diff options
author | Robert Jarzmik <robert.jarzmik@free.fr> | 2014-12-14 17:04:14 -0500 |
---|---|---|
committer | Robert Jarzmik <robert.jarzmik@free.fr> | 2015-04-30 16:52:51 -0400 |
commit | fc9e38c0f4d38bfc68b405cf48365d65f7b6319e (patch) | |
tree | 53faf4627ae77760f32136d831eacfd2931d8632 | |
parent | 277688639f98a9e34a6f109f9cd6129f92e718c1 (diff) |
ARM: pxa: lubbock: use new pxa_cplds driver
As the interrupt handling was transferred to the pxa_cplds driver,
make the switch in lubbock platform code.
Fixes: 157d2644cb0c ("ARM: pxa: change gpio to platform device")
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r-- | arch/arm/mach-pxa/include/mach/lubbock.h | 7 | ||||
-rw-r--r-- | arch/arm/mach-pxa/lubbock.c | 108 |
2 files changed, 33 insertions, 82 deletions
diff --git a/arch/arm/mach-pxa/include/mach/lubbock.h b/arch/arm/mach-pxa/include/mach/lubbock.h index 958cd6af9384..1eecf794acd2 100644 --- a/arch/arm/mach-pxa/include/mach/lubbock.h +++ b/arch/arm/mach-pxa/include/mach/lubbock.h | |||
@@ -37,7 +37,9 @@ | |||
37 | #define LUB_GP __LUB_REG(LUBBOCK_FPGA_PHYS + 0x100) | 37 | #define LUB_GP __LUB_REG(LUBBOCK_FPGA_PHYS + 0x100) |
38 | 38 | ||
39 | /* Board specific IRQs */ | 39 | /* Board specific IRQs */ |
40 | #define LUBBOCK_IRQ(x) (IRQ_BOARD_START + (x)) | 40 | #define LUBBOCK_NR_IRQS IRQ_BOARD_START |
41 | |||
42 | #define LUBBOCK_IRQ(x) (LUBBOCK_NR_IRQS + (x)) | ||
41 | #define LUBBOCK_SD_IRQ LUBBOCK_IRQ(0) | 43 | #define LUBBOCK_SD_IRQ LUBBOCK_IRQ(0) |
42 | #define LUBBOCK_SA1111_IRQ LUBBOCK_IRQ(1) | 44 | #define LUBBOCK_SA1111_IRQ LUBBOCK_IRQ(1) |
43 | #define LUBBOCK_USB_IRQ LUBBOCK_IRQ(2) /* usb connect */ | 45 | #define LUBBOCK_USB_IRQ LUBBOCK_IRQ(2) /* usb connect */ |
@@ -47,8 +49,7 @@ | |||
47 | #define LUBBOCK_USB_DISC_IRQ LUBBOCK_IRQ(6) /* usb disconnect */ | 49 | #define LUBBOCK_USB_DISC_IRQ LUBBOCK_IRQ(6) /* usb disconnect */ |
48 | #define LUBBOCK_LAST_IRQ LUBBOCK_IRQ(6) | 50 | #define LUBBOCK_LAST_IRQ LUBBOCK_IRQ(6) |
49 | 51 | ||
50 | #define LUBBOCK_SA1111_IRQ_BASE (IRQ_BOARD_START + 16) | 52 | #define LUBBOCK_SA1111_IRQ_BASE (LUBBOCK_NR_IRQS + 32) |
51 | #define LUBBOCK_NR_IRQS (IRQ_BOARD_START + 16 + 55) | ||
52 | 53 | ||
53 | #ifndef __ASSEMBLY__ | 54 | #ifndef __ASSEMBLY__ |
54 | extern void lubbock_set_misc_wr(unsigned int mask, unsigned int set); | 55 | extern void lubbock_set_misc_wr(unsigned int mask, unsigned int set); |
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index d8a1be619f21..4ac9ab80d24b 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * published by the Free Software Foundation. | 12 | * published by the Free Software Foundation. |
13 | */ | 13 | */ |
14 | #include <linux/gpio.h> | 14 | #include <linux/gpio.h> |
15 | #include <linux/gpio/machine.h> | ||
15 | #include <linux/module.h> | 16 | #include <linux/module.h> |
16 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 18 | #include <linux/init.h> |
@@ -123,84 +124,6 @@ void lubbock_set_misc_wr(unsigned int mask, unsigned int set) | |||
123 | } | 124 | } |
124 | EXPORT_SYMBOL(lubbock_set_misc_wr); | 125 | EXPORT_SYMBOL(lubbock_set_misc_wr); |
125 | 126 | ||
126 | static unsigned long lubbock_irq_enabled; | ||
127 | |||
128 | static void lubbock_mask_irq(struct irq_data *d) | ||
129 | { | ||
130 | int lubbock_irq = (d->irq - LUBBOCK_IRQ(0)); | ||
131 | LUB_IRQ_MASK_EN = (lubbock_irq_enabled &= ~(1 << lubbock_irq)); | ||
132 | } | ||
133 | |||
134 | static void lubbock_unmask_irq(struct irq_data *d) | ||
135 | { | ||
136 | int lubbock_irq = (d->irq - LUBBOCK_IRQ(0)); | ||
137 | /* the irq can be acknowledged only if deasserted, so it's done here */ | ||
138 | LUB_IRQ_SET_CLR &= ~(1 << lubbock_irq); | ||
139 | LUB_IRQ_MASK_EN = (lubbock_irq_enabled |= (1 << lubbock_irq)); | ||
140 | } | ||
141 | |||
142 | static struct irq_chip lubbock_irq_chip = { | ||
143 | .name = "FPGA", | ||
144 | .irq_ack = lubbock_mask_irq, | ||
145 | .irq_mask = lubbock_mask_irq, | ||
146 | .irq_unmask = lubbock_unmask_irq, | ||
147 | }; | ||
148 | |||
149 | static void lubbock_irq_handler(unsigned int irq, struct irq_desc *desc) | ||
150 | { | ||
151 | unsigned long pending = LUB_IRQ_SET_CLR & lubbock_irq_enabled; | ||
152 | do { | ||
153 | /* clear our parent irq */ | ||
154 | desc->irq_data.chip->irq_ack(&desc->irq_data); | ||
155 | if (likely(pending)) { | ||
156 | irq = LUBBOCK_IRQ(0) + __ffs(pending); | ||
157 | generic_handle_irq(irq); | ||
158 | } | ||
159 | pending = LUB_IRQ_SET_CLR & lubbock_irq_enabled; | ||
160 | } while (pending); | ||
161 | } | ||
162 | |||
163 | static void __init lubbock_init_irq(void) | ||
164 | { | ||
165 | int irq; | ||
166 | |||
167 | pxa25x_init_irq(); | ||
168 | |||
169 | /* setup extra lubbock irqs */ | ||
170 | for (irq = LUBBOCK_IRQ(0); irq <= LUBBOCK_LAST_IRQ; irq++) { | ||
171 | irq_set_chip_and_handler(irq, &lubbock_irq_chip, | ||
172 | handle_level_irq); | ||
173 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | ||
174 | } | ||
175 | |||
176 | irq_set_chained_handler(PXA_GPIO_TO_IRQ(0), lubbock_irq_handler); | ||
177 | irq_set_irq_type(PXA_GPIO_TO_IRQ(0), IRQ_TYPE_EDGE_FALLING); | ||
178 | } | ||
179 | |||
180 | #ifdef CONFIG_PM | ||
181 | |||
182 | static void lubbock_irq_resume(void) | ||
183 | { | ||
184 | LUB_IRQ_MASK_EN = lubbock_irq_enabled; | ||
185 | } | ||
186 | |||
187 | static struct syscore_ops lubbock_irq_syscore_ops = { | ||
188 | .resume = lubbock_irq_resume, | ||
189 | }; | ||
190 | |||
191 | static int __init lubbock_irq_device_init(void) | ||
192 | { | ||
193 | if (machine_is_lubbock()) { | ||
194 | register_syscore_ops(&lubbock_irq_syscore_ops); | ||
195 | return 0; | ||
196 | } | ||
197 | return -ENODEV; | ||
198 | } | ||
199 | |||
200 | device_initcall(lubbock_irq_device_init); | ||
201 | |||
202 | #endif | ||
203 | |||
204 | static int lubbock_udc_is_connected(void) | 127 | static int lubbock_udc_is_connected(void) |
205 | { | 128 | { |
206 | return (LUB_MISC_RD & (1 << 9)) == 0; | 129 | return (LUB_MISC_RD & (1 << 9)) == 0; |
@@ -383,11 +306,38 @@ static struct platform_device lubbock_flash_device[2] = { | |||
383 | }, | 306 | }, |
384 | }; | 307 | }; |
385 | 308 | ||
309 | static struct resource lubbock_cplds_resources[] = { | ||
310 | [0] = { | ||
311 | .start = LUBBOCK_FPGA_PHYS + 0xc0, | ||
312 | .end = LUBBOCK_FPGA_PHYS + 0xe0 - 1, | ||
313 | .flags = IORESOURCE_MEM, | ||
314 | }, | ||
315 | [1] = { | ||
316 | .start = PXA_GPIO_TO_IRQ(0), | ||
317 | .end = PXA_GPIO_TO_IRQ(0), | ||
318 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, | ||
319 | }, | ||
320 | [2] = { | ||
321 | .start = LUBBOCK_IRQ(0), | ||
322 | .end = LUBBOCK_IRQ(6), | ||
323 | .flags = IORESOURCE_IRQ, | ||
324 | }, | ||
325 | }; | ||
326 | |||
327 | static struct platform_device lubbock_cplds_device = { | ||
328 | .name = "pxa_cplds_irqs", | ||
329 | .id = -1, | ||
330 | .resource = &lubbock_cplds_resources[0], | ||
331 | .num_resources = 3, | ||
332 | }; | ||
333 | |||
334 | |||
386 | static struct platform_device *devices[] __initdata = { | 335 | static struct platform_device *devices[] __initdata = { |
387 | &sa1111_device, | 336 | &sa1111_device, |
388 | &smc91x_device, | 337 | &smc91x_device, |
389 | &lubbock_flash_device[0], | 338 | &lubbock_flash_device[0], |
390 | &lubbock_flash_device[1], | 339 | &lubbock_flash_device[1], |
340 | &lubbock_cplds_device, | ||
391 | }; | 341 | }; |
392 | 342 | ||
393 | static struct pxafb_mode_info sharp_lm8v31_mode = { | 343 | static struct pxafb_mode_info sharp_lm8v31_mode = { |
@@ -648,7 +598,7 @@ MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)") | |||
648 | /* Maintainer: MontaVista Software Inc. */ | 598 | /* Maintainer: MontaVista Software Inc. */ |
649 | .map_io = lubbock_map_io, | 599 | .map_io = lubbock_map_io, |
650 | .nr_irqs = LUBBOCK_NR_IRQS, | 600 | .nr_irqs = LUBBOCK_NR_IRQS, |
651 | .init_irq = lubbock_init_irq, | 601 | .init_irq = pxa25x_init_irq, |
652 | .handle_irq = pxa25x_handle_irq, | 602 | .handle_irq = pxa25x_handle_irq, |
653 | .init_time = pxa_timer_init, | 603 | .init_time = pxa_timer_init, |
654 | .init_machine = lubbock_init, | 604 | .init_machine = lubbock_init, |