diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2010-12-14 06:54:03 -0500 |
---|---|---|
committer | Nicolas Pitre <nico@fluxnic.net> | 2011-03-03 16:27:02 -0500 |
commit | 9eac6d0a4e7e5149a7f86575b46d710ad2e05fe2 (patch) | |
tree | 3f3eb4504f3221954a5adaae66e417d9a0883e71 /arch/arm/mach-kirkwood | |
parent | 4ee1f6b574765a6c97f945e6b0277e5ccac38cb5 (diff) |
ARM: Remove dependency of plat-orion GPIO code on mach directory includes.
This patch makes the various mach dirs that use the plat-orion GPIO
code pass in GPIO-related platform info (GPIO controller base address,
secondary base IRQ number, etc) explicitly, instead of having
plat-orion get those values by including a mach dir include file --
the latter mechanism is problematic if you want to support multiple
ARM platforms in the same kernel image.
Signed-off-by: Lennert Buytenhek <buytenh@secretlab.ca>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r-- | arch/arm/mach-kirkwood/include/mach/gpio.h | 29 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/include/mach/kirkwood.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/irq.c | 22 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/mpp.c | 3 |
4 files changed, 8 insertions, 48 deletions
diff --git a/arch/arm/mach-kirkwood/include/mach/gpio.h b/arch/arm/mach-kirkwood/include/mach/gpio.h index 81b335eb62ec..84f340b546c0 100644 --- a/arch/arm/mach-kirkwood/include/mach/gpio.h +++ b/arch/arm/mach-kirkwood/include/mach/gpio.h | |||
@@ -6,33 +6,4 @@ | |||
6 | * warranty of any kind, whether express or implied. | 6 | * warranty of any kind, whether express or implied. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #ifndef __ASM_ARCH_GPIO_H | ||
10 | #define __ASM_ARCH_GPIO_H | ||
11 | |||
12 | #include <mach/irqs.h> | ||
13 | #include <plat/gpio.h> | 9 | #include <plat/gpio.h> |
14 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | ||
15 | |||
16 | #define GPIO_MAX 50 | ||
17 | #define GPIO_OFF(pin) (((pin) >> 5) ? 0x0140 : 0x0100) | ||
18 | #define GPIO_OUT(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x00) | ||
19 | #define GPIO_IO_CONF(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x04) | ||
20 | #define GPIO_BLINK_EN(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x08) | ||
21 | #define GPIO_IN_POL(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x0c) | ||
22 | #define GPIO_DATA_IN(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x10) | ||
23 | #define GPIO_EDGE_CAUSE(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x14) | ||
24 | #define GPIO_EDGE_MASK(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x18) | ||
25 | #define GPIO_LEVEL_MASK(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x1c) | ||
26 | |||
27 | static inline int gpio_to_irq(int pin) | ||
28 | { | ||
29 | return pin + IRQ_KIRKWOOD_GPIO_START; | ||
30 | } | ||
31 | |||
32 | static inline int irq_to_gpio(int irq) | ||
33 | { | ||
34 | return irq - IRQ_KIRKWOOD_GPIO_START; | ||
35 | } | ||
36 | |||
37 | |||
38 | #endif | ||
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h index 6e924b398919..010bdeb4ac5f 100644 --- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h +++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h | |||
@@ -69,6 +69,8 @@ | |||
69 | #define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x10000) | 69 | #define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x10000) |
70 | #define SAMPLE_AT_RESET (DEV_BUS_VIRT_BASE | 0x0030) | 70 | #define SAMPLE_AT_RESET (DEV_BUS_VIRT_BASE | 0x0030) |
71 | #define DEVICE_ID (DEV_BUS_VIRT_BASE | 0x0034) | 71 | #define DEVICE_ID (DEV_BUS_VIRT_BASE | 0x0034) |
72 | #define GPIO_LOW_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x0100) | ||
73 | #define GPIO_HIGH_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x0140) | ||
72 | #define RTC_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0300) | 74 | #define RTC_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0300) |
73 | #define SPI_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0600) | 75 | #define SPI_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0600) |
74 | #define I2C_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x1000) | 76 | #define I2C_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x1000) |
diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c index 28020abf49e1..cbdb5863d13b 100644 --- a/arch/arm/mach-kirkwood/irq.c +++ b/arch/arm/mach-kirkwood/irq.c | |||
@@ -27,31 +27,21 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
27 | 27 | ||
28 | void __init kirkwood_init_irq(void) | 28 | void __init kirkwood_init_irq(void) |
29 | { | 29 | { |
30 | int i; | ||
31 | |||
32 | orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF)); | 30 | orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF)); |
33 | orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF)); | 31 | orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF)); |
34 | 32 | ||
35 | /* | 33 | /* |
36 | * Mask and clear GPIO IRQ interrupts. | 34 | * Initialize gpiolib for GPIOs 0-49. |
37 | */ | 35 | */ |
38 | writel(0, GPIO_LEVEL_MASK(0)); | 36 | orion_gpio_init(0, 32, GPIO_LOW_VIRT_BASE, 0, |
39 | writel(0, GPIO_EDGE_MASK(0)); | 37 | IRQ_KIRKWOOD_GPIO_START); |
40 | writel(0, GPIO_EDGE_CAUSE(0)); | ||
41 | writel(0, GPIO_LEVEL_MASK(32)); | ||
42 | writel(0, GPIO_EDGE_MASK(32)); | ||
43 | writel(0, GPIO_EDGE_CAUSE(32)); | ||
44 | |||
45 | for (i = IRQ_KIRKWOOD_GPIO_START; i < NR_IRQS; i++) { | ||
46 | set_irq_chip(i, &orion_gpio_irq_chip); | ||
47 | set_irq_handler(i, handle_level_irq); | ||
48 | irq_desc[i].status |= IRQ_LEVEL; | ||
49 | set_irq_flags(i, IRQF_VALID); | ||
50 | } | ||
51 | set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_0_7, gpio_irq_handler); | 38 | set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_0_7, gpio_irq_handler); |
52 | set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_8_15, gpio_irq_handler); | 39 | set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_8_15, gpio_irq_handler); |
53 | set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_16_23, gpio_irq_handler); | 40 | set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_16_23, gpio_irq_handler); |
54 | set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_24_31, gpio_irq_handler); | 41 | set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_24_31, gpio_irq_handler); |
42 | |||
43 | orion_gpio_init(32, 18, GPIO_HIGH_VIRT_BASE, 0, | ||
44 | IRQ_KIRKWOOD_GPIO_START + 32); | ||
55 | set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_0_7, gpio_irq_handler); | 45 | set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_0_7, gpio_irq_handler); |
56 | set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_8_15, gpio_irq_handler); | 46 | set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_8_15, gpio_irq_handler); |
57 | set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_16_23, gpio_irq_handler); | 47 | set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_16_23, gpio_irq_handler); |
diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c index 27901f702feb..7ce201848067 100644 --- a/arch/arm/mach-kirkwood/mpp.c +++ b/arch/arm/mach-kirkwood/mpp.c | |||
@@ -49,9 +49,6 @@ void __init kirkwood_mpp_conf(unsigned int *mpp_list) | |||
49 | if (!variant_mask) | 49 | if (!variant_mask) |
50 | return; | 50 | return; |
51 | 51 | ||
52 | /* Initialize gpiolib. */ | ||
53 | orion_gpio_init(); | ||
54 | |||
55 | printk(KERN_DEBUG "initial MPP regs:"); | 52 | printk(KERN_DEBUG "initial MPP regs:"); |
56 | for (i = 0; i < MPP_NR_REGS; i++) { | 53 | for (i = 0; i < MPP_NR_REGS; i++) { |
57 | mpp_ctrl[i] = readl(MPP_CTRL(i)); | 54 | mpp_ctrl[i] = readl(MPP_CTRL(i)); |