From 5bc9b44704057c0998a20b4e11edabf6745f7791 Mon Sep 17 00:00:00 2001 From: Iliyan Malchev Date: Wed, 26 May 2010 14:21:21 -0700 Subject: [PATCH] [ARM] tegra: add FIQ support Signed-off-by: Iliyan Malchev --- arch/arm/Kconfig | 1 + arch/arm/mach-tegra/Makefile | 2 + arch/arm/mach-tegra/fiq.c | 53 +++++++++++++++++++++++++ arch/arm/mach-tegra/include/mach/fiq.h | 32 +++++++++++++++ arch/arm/mach-tegra/include/mach/irqs.h | 2 + 5 files changed, 90 insertions(+) create mode 100644 arch/arm/mach-tegra/fiq.c create mode 100644 arch/arm/mach-tegra/include/mach/fiq.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 968c7c812454..f33645e2336d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -578,6 +578,7 @@ config ARCH_TEGRA select ARCH_HAS_BARRIERS if CACHE_L2X0 select ARCH_HAS_CPUFREQ select ARCH_PROVIDES_UDELAY + select FIQ help This enables support for NVIDIA Tegra based systems (Tegra APX, Tegra 6xx and Tegra 2 series). diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index 6b4a94bee566..b6baa5664c4a 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -10,6 +10,8 @@ obj-y += delay.o obj-y += powergate.o obj-y += suspend.o obj-y += fuse.o +obj-$(CONFIG_FIQ) += fiq.o + obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clock.o obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_clocks.o obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_dvfs.o diff --git a/arch/arm/mach-tegra/fiq.c b/arch/arm/mach-tegra/fiq.c new file mode 100644 index 000000000000..81f573b1a1dc --- /dev/null +++ b/arch/arm/mach-tegra/fiq.c @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Google, Inc. + * + * Author: + * Brian Swetland + * Iliyan Malchev + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include "board.h" + +void tegra_fiq_enable(int irq) +{ + void __iomem *base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x100); + /* enable FIQ */ + u32 val = readl(base + GIC_CPU_CTRL); + val &= ~8; /* pass FIQs through */ + val |= 2; /* enableNS */ + writel(val, base + GIC_CPU_CTRL); + tegra_legacy_unmask_irq(irq); +} + +void tegra_fiq_disable(int irq) +{ + tegra_legacy_mask_irq(irq); +} + +void tegra_fiq_select(int irq, int on) +{ + tegra_legacy_select_fiq(irq, !!on); +} diff --git a/arch/arm/mach-tegra/include/mach/fiq.h b/arch/arm/mach-tegra/include/mach/fiq.h new file mode 100644 index 000000000000..b538629c74a9 --- /dev/null +++ b/arch/arm/mach-tegra/include/mach/fiq.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2010 Google, Inc. + * + * Author: + * Iliyan Malchev + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __ASM_ARCH_TEGRA_FIQ_H +#define __ASM_ARCH_TEGRA_FIQ_H + +/* change an interrupt to be an FIQ instead of an IRQ */ +void tegra_fiq_select(int n, int on); + +/* enable/disable an interrupt that is an FIQ (safe from FIQ context?) */ +void tegra_fiq_enable(int n); +void tegra_fiq_disable(int n); + +/* install an FIQ handler */ +int tegra_fiq_set_handler(void (*func)(void *data, void *regs, void *svc_sp), + void *data); + +#endif diff --git a/arch/arm/mach-tegra/include/mach/irqs.h b/arch/arm/mach-tegra/include/mach/irqs.h index 73265af4dda3..9c2da0ec7759 100644 --- a/arch/arm/mach-tegra/include/mach/irqs.h +++ b/arch/arm/mach-tegra/include/mach/irqs.h @@ -172,6 +172,8 @@ #define INT_GPIO_NR (28 * 8) +#define FIQ_START INT_GIC_BASE + #define TEGRA_NR_IRQS (INT_GPIO_BASE + INT_GPIO_NR) #define INT_BOARD_BASE TEGRA_NR_IRQS -- 2.34.1