diff options
Diffstat (limited to 'arch/arm/mach-pxa')
40 files changed, 2052 insertions, 717 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index 0908bea0f609..5da7a6820492 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig | |||
@@ -23,6 +23,12 @@ endif | |||
23 | choice | 23 | choice |
24 | prompt "Select target board" | 24 | prompt "Select target board" |
25 | 25 | ||
26 | config ARCH_GUMSTIX | ||
27 | bool "Gumstix XScale boards" | ||
28 | help | ||
29 | Say Y here if you intend to run this kernel on a | ||
30 | Gumstix Full Function Minature Computer. | ||
31 | |||
26 | config ARCH_LUBBOCK | 32 | config ARCH_LUBBOCK |
27 | bool "Intel DBPXA250 Development Platform" | 33 | bool "Intel DBPXA250 Development Platform" |
28 | select PXA25x | 34 | select PXA25x |
@@ -160,6 +166,20 @@ endchoice | |||
160 | 166 | ||
161 | endif | 167 | endif |
162 | 168 | ||
169 | if ARCH_GUMSTIX | ||
170 | |||
171 | choice | ||
172 | prompt "Select target Gumstix board" | ||
173 | |||
174 | config MACH_GUMSTIX_F | ||
175 | bool "Basix, Connex, ws-200ax, ws-400ax systems" | ||
176 | select PXA25x | ||
177 | |||
178 | endchoice | ||
179 | |||
180 | endif | ||
181 | |||
182 | |||
163 | if MACH_TRIZEPS4 | 183 | if MACH_TRIZEPS4 |
164 | 184 | ||
165 | choice | 185 | choice |
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index 6e0c4f5b5ae6..7cdcb459ea9d 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -5,13 +5,14 @@ | |||
5 | # Common support (must be linked before board specific support) | 5 | # Common support (must be linked before board specific support) |
6 | obj-y += clock.o devices.o generic.o irq.o dma.o \ | 6 | obj-y += clock.o devices.o generic.o irq.o dma.o \ |
7 | time.o gpio.o | 7 | time.o gpio.o |
8 | obj-$(CONFIG_PXA25x) += pxa25x.o | 8 | obj-$(CONFIG_PXA25x) += pxa25x.o mfp-pxa2xx.o |
9 | obj-$(CONFIG_PXA27x) += pxa27x.o | 9 | obj-$(CONFIG_PXA27x) += pxa27x.o mfp-pxa2xx.o |
10 | obj-$(CONFIG_PXA3xx) += pxa3xx.o mfp.o smemc.o | 10 | obj-$(CONFIG_PXA3xx) += pxa3xx.o mfp-pxa3xx.o smemc.o |
11 | obj-$(CONFIG_CPU_PXA300) += pxa300.o | 11 | obj-$(CONFIG_CPU_PXA300) += pxa300.o |
12 | obj-$(CONFIG_CPU_PXA320) += pxa320.o | 12 | obj-$(CONFIG_CPU_PXA320) += pxa320.o |
13 | 13 | ||
14 | # Specific board support | 14 | # Specific board support |
15 | obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o | ||
15 | obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o | 16 | obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o |
16 | obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o | 17 | obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o |
17 | obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o | 18 | obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o |
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c index df5ae2710ab1..e97dc59813c8 100644 --- a/arch/arm/mach-pxa/clock.c +++ b/arch/arm/mach-pxa/clock.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
14 | 14 | ||
15 | #include <asm/arch/pxa-regs.h> | 15 | #include <asm/arch/pxa-regs.h> |
16 | #include <asm/arch/pxa2xx-gpio.h> | ||
16 | #include <asm/hardware.h> | 17 | #include <asm/hardware.h> |
17 | 18 | ||
18 | #include "devices.h" | 19 | #include "devices.h" |
diff --git a/arch/arm/mach-pxa/cm-x270-pci.c b/arch/arm/mach-pxa/cm-x270-pci.c index fcda7d5cb693..ac7f05f9f3eb 100644 --- a/arch/arm/mach-pxa/cm-x270-pci.c +++ b/arch/arm/mach-pxa/cm-x270-pci.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <asm/mach/pci.h> | 23 | #include <asm/mach/pci.h> |
24 | #include <asm/arch/cm-x270.h> | 24 | #include <asm/arch/cm-x270.h> |
25 | #include <asm/arch/pxa-regs.h> | 25 | #include <asm/arch/pxa-regs.h> |
26 | #include <asm/arch/pxa2xx-gpio.h> | ||
26 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
27 | 28 | ||
28 | #include <asm/hardware/it8152.h> | 29 | #include <asm/hardware/it8152.h> |
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c index ecdbc96a4de1..6d4416a4f378 100644 --- a/arch/arm/mach-pxa/cm-x270.c +++ b/arch/arm/mach-pxa/cm-x270.c | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | #include <asm/arch/pxa-regs.h> | 31 | #include <asm/arch/pxa-regs.h> |
32 | #include <asm/arch/pxa2xx-regs.h> | 32 | #include <asm/arch/pxa2xx-regs.h> |
33 | #include <asm/arch/pxa2xx-gpio.h> | ||
33 | #include <asm/arch/pxafb.h> | 34 | #include <asm/arch/pxafb.h> |
34 | #include <asm/arch/ohci.h> | 35 | #include <asm/arch/ohci.h> |
35 | #include <asm/arch/mmc.h> | 36 | #include <asm/arch/mmc.h> |
diff --git a/arch/arm/mach-pxa/colibri.c b/arch/arm/mach-pxa/colibri.c index 6db54e31c397..43bf5a183e90 100644 --- a/arch/arm/mach-pxa/colibri.c +++ b/arch/arm/mach-pxa/colibri.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <asm/mach/irq.h> | 29 | #include <asm/mach/irq.h> |
30 | #include <asm/mach/flash.h> | 30 | #include <asm/mach/flash.h> |
31 | #include <asm/arch/pxa-regs.h> | 31 | #include <asm/arch/pxa-regs.h> |
32 | #include <asm/arch/pxa2xx-gpio.h> | ||
32 | #include <asm/arch/colibri.h> | 33 | #include <asm/arch/colibri.h> |
33 | 34 | ||
34 | #include "generic.h" | 35 | #include "generic.h" |
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index 9292576b83b3..259ca821e464 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <asm/mach/irq.h> | 36 | #include <asm/mach/irq.h> |
37 | 37 | ||
38 | #include <asm/arch/pxa-regs.h> | 38 | #include <asm/arch/pxa-regs.h> |
39 | #include <asm/arch/pxa2xx-gpio.h> | ||
39 | #include <asm/arch/irda.h> | 40 | #include <asm/arch/irda.h> |
40 | #include <asm/arch/mmc.h> | 41 | #include <asm/arch/mmc.h> |
41 | #include <asm/arch/udc.h> | 42 | #include <asm/arch/udc.h> |
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c index 392c38717362..0a85f706e887 100644 --- a/arch/arm/mach-pxa/corgi_pm.c +++ b/arch/arm/mach-pxa/corgi_pm.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/arch/sharpsl.h> | 26 | #include <asm/arch/sharpsl.h> |
27 | #include <asm/arch/corgi.h> | 27 | #include <asm/arch/corgi.h> |
28 | #include <asm/arch/pxa-regs.h> | 28 | #include <asm/arch/pxa-regs.h> |
29 | #include <asm/arch/pxa2xx-gpio.h> | ||
29 | #include "sharpsl.h" | 30 | #include "sharpsl.h" |
30 | 31 | ||
31 | #define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */ | 32 | #define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */ |
diff --git a/arch/arm/mach-pxa/corgi_ssp.c b/arch/arm/mach-pxa/corgi_ssp.c index 31706224a04c..eccc45d21f75 100644 --- a/arch/arm/mach-pxa/corgi_ssp.c +++ b/arch/arm/mach-pxa/corgi_ssp.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <asm/arch/ssp.h> | 22 | #include <asm/arch/ssp.h> |
23 | #include <asm/arch/pxa-regs.h> | 23 | #include <asm/arch/pxa-regs.h> |
24 | #include <asm/arch/pxa2xx-gpio.h> | ||
24 | #include <asm/arch/regs-ssp.h> | 25 | #include <asm/arch/regs-ssp.h> |
25 | #include "sharpsl.h" | 26 | #include "sharpsl.h" |
26 | 27 | ||
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index bfccb80ac8ef..d6c05b6eab35 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c | |||
@@ -11,6 +11,8 @@ | |||
11 | #include <asm/arch/irda.h> | 11 | #include <asm/arch/irda.h> |
12 | #include <asm/arch/i2c.h> | 12 | #include <asm/arch/i2c.h> |
13 | #include <asm/arch/ohci.h> | 13 | #include <asm/arch/ohci.h> |
14 | #include <asm/arch/pxa27x_keypad.h> | ||
15 | #include <asm/arch/camera.h> | ||
14 | 16 | ||
15 | #include "devices.h" | 17 | #include "devices.h" |
16 | 18 | ||
@@ -396,6 +398,31 @@ struct platform_device pxa25x_device_assp = { | |||
396 | 398 | ||
397 | #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) | 399 | #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) |
398 | 400 | ||
401 | static struct resource pxa27x_resource_keypad[] = { | ||
402 | [0] = { | ||
403 | .start = 0x41500000, | ||
404 | .end = 0x4150004c, | ||
405 | .flags = IORESOURCE_MEM, | ||
406 | }, | ||
407 | [1] = { | ||
408 | .start = IRQ_KEYPAD, | ||
409 | .end = IRQ_KEYPAD, | ||
410 | .flags = IORESOURCE_IRQ, | ||
411 | }, | ||
412 | }; | ||
413 | |||
414 | struct platform_device pxa27x_device_keypad = { | ||
415 | .name = "pxa27x-keypad", | ||
416 | .id = -1, | ||
417 | .resource = pxa27x_resource_keypad, | ||
418 | .num_resources = ARRAY_SIZE(pxa27x_resource_keypad), | ||
419 | }; | ||
420 | |||
421 | void __init pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info) | ||
422 | { | ||
423 | pxa_register_device(&pxa27x_device_keypad, info); | ||
424 | } | ||
425 | |||
399 | static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32); | 426 | static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32); |
400 | 427 | ||
401 | static struct resource pxa27x_resource_ohci[] = { | 428 | static struct resource pxa27x_resource_ohci[] = { |
@@ -540,6 +567,37 @@ struct platform_device pxa27x_device_ssp3 = { | |||
540 | .resource = pxa27x_resource_ssp3, | 567 | .resource = pxa27x_resource_ssp3, |
541 | .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3), | 568 | .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3), |
542 | }; | 569 | }; |
570 | |||
571 | static struct resource pxa27x_resource_camera[] = { | ||
572 | [0] = { | ||
573 | .start = 0x50000000, | ||
574 | .end = 0x50000fff, | ||
575 | .flags = IORESOURCE_MEM, | ||
576 | }, | ||
577 | [1] = { | ||
578 | .start = IRQ_CAMERA, | ||
579 | .end = IRQ_CAMERA, | ||
580 | .flags = IORESOURCE_IRQ, | ||
581 | }, | ||
582 | }; | ||
583 | |||
584 | static u64 pxa27x_dma_mask_camera = DMA_BIT_MASK(32); | ||
585 | |||
586 | static struct platform_device pxa27x_device_camera = { | ||
587 | .name = "pxa27x-camera", | ||
588 | .id = 0, /* This is used to put cameras on this interface */ | ||
589 | .dev = { | ||
590 | .dma_mask = &pxa27x_dma_mask_camera, | ||
591 | .coherent_dma_mask = 0xffffffff, | ||
592 | }, | ||
593 | .num_resources = ARRAY_SIZE(pxa27x_resource_camera), | ||
594 | .resource = pxa27x_resource_camera, | ||
595 | }; | ||
596 | |||
597 | void __init pxa_set_camera_info(struct pxacamera_platform_data *info) | ||
598 | { | ||
599 | pxa_register_device(&pxa27x_device_camera, info); | ||
600 | } | ||
543 | #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */ | 601 | #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */ |
544 | 602 | ||
545 | #ifdef CONFIG_PXA3xx | 603 | #ifdef CONFIG_PXA3xx |
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h index 96c7c8909068..fcab017f27ee 100644 --- a/arch/arm/mach-pxa/devices.h +++ b/arch/arm/mach-pxa/devices.h | |||
@@ -14,6 +14,7 @@ extern struct platform_device pxa_device_rtc; | |||
14 | 14 | ||
15 | extern struct platform_device pxa27x_device_i2c_power; | 15 | extern struct platform_device pxa27x_device_i2c_power; |
16 | extern struct platform_device pxa27x_device_ohci; | 16 | extern struct platform_device pxa27x_device_ohci; |
17 | extern struct platform_device pxa27x_device_keypad; | ||
17 | 18 | ||
18 | extern struct platform_device pxa25x_device_ssp; | 19 | extern struct platform_device pxa25x_device_ssp; |
19 | extern struct platform_device pxa25x_device_nssp; | 20 | extern struct platform_device pxa25x_device_nssp; |
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index 3bb31314429a..edc4f07a230d 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
24 | 24 | ||
25 | #include <asm/arch/pxa-regs.h> | 25 | #include <asm/arch/pxa-regs.h> |
26 | #include <asm/arch/pxa2xx-gpio.h> | ||
26 | #include <asm/arch/pxafb.h> | 27 | #include <asm/arch/pxafb.h> |
27 | #include <asm/arch/ohci.h> | 28 | #include <asm/arch/ohci.h> |
28 | #include <asm/arch/mmc.h> | 29 | #include <asm/arch/mmc.h> |
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c index 80721c610d41..331f29b2d0cd 100644 --- a/arch/arm/mach-pxa/generic.c +++ b/arch/arm/mach-pxa/generic.c | |||
@@ -19,14 +19,8 @@ | |||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/delay.h> | ||
23 | #include <linux/ioport.h> | ||
24 | #include <linux/pm.h> | ||
25 | #include <linux/string.h> | ||
26 | #include <linux/sysdev.h> | ||
27 | 22 | ||
28 | #include <asm/hardware.h> | 23 | #include <asm/hardware.h> |
29 | #include <asm/irq.h> | ||
30 | #include <asm/system.h> | 24 | #include <asm/system.h> |
31 | #include <asm/pgtable.h> | 25 | #include <asm/pgtable.h> |
32 | #include <asm/mach/map.h> | 26 | #include <asm/mach/map.h> |
@@ -134,59 +128,3 @@ void __init pxa_map_io(void) | |||
134 | iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc)); | 128 | iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc)); |
135 | get_clk_frequency_khz(1); | 129 | get_clk_frequency_khz(1); |
136 | } | 130 | } |
137 | |||
138 | #ifdef CONFIG_PM | ||
139 | |||
140 | static unsigned long saved_gplr[4]; | ||
141 | static unsigned long saved_gpdr[4]; | ||
142 | static unsigned long saved_grer[4]; | ||
143 | static unsigned long saved_gfer[4]; | ||
144 | |||
145 | static int pxa_gpio_suspend(struct sys_device *dev, pm_message_t state) | ||
146 | { | ||
147 | int i, gpio; | ||
148 | |||
149 | for (gpio = 0, i = 0; gpio < pxa_last_gpio; gpio += 32, i++) { | ||
150 | saved_gplr[i] = GPLR(gpio); | ||
151 | saved_gpdr[i] = GPDR(gpio); | ||
152 | saved_grer[i] = GRER(gpio); | ||
153 | saved_gfer[i] = GFER(gpio); | ||
154 | |||
155 | /* Clear GPIO transition detect bits */ | ||
156 | GEDR(gpio) = GEDR(gpio); | ||
157 | } | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | static int pxa_gpio_resume(struct sys_device *dev) | ||
162 | { | ||
163 | int i, gpio; | ||
164 | |||
165 | for (gpio = 0, i = 0; gpio < pxa_last_gpio; gpio += 32, i++) { | ||
166 | /* restore level with set/clear */ | ||
167 | GPSR(gpio) = saved_gplr[i]; | ||
168 | GPCR(gpio) = ~saved_gplr[i]; | ||
169 | |||
170 | GRER(gpio) = saved_grer[i]; | ||
171 | GFER(gpio) = saved_gfer[i]; | ||
172 | GPDR(gpio) = saved_gpdr[i]; | ||
173 | } | ||
174 | return 0; | ||
175 | } | ||
176 | #else | ||
177 | #define pxa_gpio_suspend NULL | ||
178 | #define pxa_gpio_resume NULL | ||
179 | #endif | ||
180 | |||
181 | struct sysdev_class pxa_gpio_sysclass = { | ||
182 | .name = "gpio", | ||
183 | .suspend = pxa_gpio_suspend, | ||
184 | .resume = pxa_gpio_resume, | ||
185 | }; | ||
186 | |||
187 | static int __init pxa_gpio_init(void) | ||
188 | { | ||
189 | return sysdev_class_register(&pxa_gpio_sysclass); | ||
190 | } | ||
191 | |||
192 | core_initcall(pxa_gpio_init); | ||
diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h index b3d10b0e52a0..5bb7ae757831 100644 --- a/arch/arm/mach-pxa/generic.h +++ b/arch/arm/mach-pxa/generic.h | |||
@@ -9,14 +9,13 @@ | |||
9 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | typedef int (*set_wake_t)(unsigned int, unsigned int); | ||
13 | |||
12 | struct sys_timer; | 14 | struct sys_timer; |
13 | 15 | ||
14 | extern struct sys_timer pxa_timer; | 16 | extern struct sys_timer pxa_timer; |
15 | extern void __init pxa_init_irq_low(void); | 17 | extern void __init pxa_init_irq(int irq_nr, set_wake_t fn); |
16 | extern void __init pxa_init_irq_high(void); | 18 | extern void __init pxa_init_gpio(int gpio_nr, set_wake_t fn); |
17 | extern void __init pxa_init_irq_gpio(int gpio_nr); | ||
18 | extern void __init pxa_init_irq_set_wake(int (*set_wake)(unsigned int, unsigned int)); | ||
19 | extern void __init pxa_init_gpio(int gpio_nr); | ||
20 | extern void __init pxa25x_init_irq(void); | 19 | extern void __init pxa25x_init_irq(void); |
21 | extern void __init pxa27x_init_irq(void); | 20 | extern void __init pxa27x_init_irq(void); |
22 | extern void __init pxa3xx_init_irq(void); | 21 | extern void __init pxa3xx_init_irq(void); |
@@ -30,6 +29,8 @@ extern int pxa_last_gpio; | |||
30 | mi->bank[__nr].size = (__size), \ | 29 | mi->bank[__nr].size = (__size), \ |
31 | mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27) | 30 | mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27) |
32 | 31 | ||
32 | #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) | ||
33 | |||
33 | #ifdef CONFIG_PXA25x | 34 | #ifdef CONFIG_PXA25x |
34 | extern unsigned pxa25x_get_clk_frequency_khz(int); | 35 | extern unsigned pxa25x_get_clk_frequency_khz(int); |
35 | extern unsigned pxa25x_get_memclk_frequency_10khz(void); | 36 | extern unsigned pxa25x_get_memclk_frequency_10khz(void); |
@@ -56,3 +57,4 @@ extern unsigned pxa3xx_get_memclk_frequency_10khz(void); | |||
56 | 57 | ||
57 | extern struct sysdev_class pxa_irq_sysclass; | 58 | extern struct sysdev_class pxa_irq_sysclass; |
58 | extern struct sysdev_class pxa_gpio_sysclass; | 59 | extern struct sysdev_class pxa_gpio_sysclass; |
60 | extern struct sysdev_class pxa3xx_mfp_sysclass; | ||
diff --git a/arch/arm/mach-pxa/gpio.c b/arch/arm/mach-pxa/gpio.c index 8638dd7dd076..7d3e16970be0 100644 --- a/arch/arm/mach-pxa/gpio.c +++ b/arch/arm/mach-pxa/gpio.c | |||
@@ -14,11 +14,14 @@ | |||
14 | 14 | ||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/irq.h> | ||
18 | #include <linux/sysdev.h> | ||
17 | 19 | ||
18 | #include <asm/gpio.h> | 20 | #include <asm/gpio.h> |
19 | #include <asm/hardware.h> | 21 | #include <asm/hardware.h> |
20 | #include <asm/io.h> | 22 | #include <asm/io.h> |
21 | #include <asm/arch/pxa-regs.h> | 23 | #include <asm/arch/pxa-regs.h> |
24 | #include <asm/arch/pxa2xx-gpio.h> | ||
22 | 25 | ||
23 | #include "generic.h" | 26 | #include "generic.h" |
24 | 27 | ||
@@ -129,69 +132,283 @@ static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
129 | __raw_writel(mask, pxa->regbase + GPCR_OFFSET); | 132 | __raw_writel(mask, pxa->regbase + GPCR_OFFSET); |
130 | } | 133 | } |
131 | 134 | ||
135 | #define GPIO_CHIP(_n) \ | ||
136 | [_n] = { \ | ||
137 | .regbase = GPIO##_n##_BASE, \ | ||
138 | .chip = { \ | ||
139 | .label = "gpio-" #_n, \ | ||
140 | .direction_input = pxa_gpio_direction_input, \ | ||
141 | .direction_output = pxa_gpio_direction_output, \ | ||
142 | .get = pxa_gpio_get, \ | ||
143 | .set = pxa_gpio_set, \ | ||
144 | .base = (_n) * 32, \ | ||
145 | .ngpio = 32, \ | ||
146 | }, \ | ||
147 | } | ||
148 | |||
132 | static struct pxa_gpio_chip pxa_gpio_chip[] = { | 149 | static struct pxa_gpio_chip pxa_gpio_chip[] = { |
133 | [0] = { | 150 | GPIO_CHIP(0), |
134 | .regbase = GPIO0_BASE, | 151 | GPIO_CHIP(1), |
135 | .chip = { | 152 | GPIO_CHIP(2), |
136 | .label = "gpio-0", | ||
137 | .direction_input = pxa_gpio_direction_input, | ||
138 | .direction_output = pxa_gpio_direction_output, | ||
139 | .get = pxa_gpio_get, | ||
140 | .set = pxa_gpio_set, | ||
141 | .base = 0, | ||
142 | .ngpio = 32, | ||
143 | }, | ||
144 | }, | ||
145 | [1] = { | ||
146 | .regbase = GPIO1_BASE, | ||
147 | .chip = { | ||
148 | .label = "gpio-1", | ||
149 | .direction_input = pxa_gpio_direction_input, | ||
150 | .direction_output = pxa_gpio_direction_output, | ||
151 | .get = pxa_gpio_get, | ||
152 | .set = pxa_gpio_set, | ||
153 | .base = 32, | ||
154 | .ngpio = 32, | ||
155 | }, | ||
156 | }, | ||
157 | [2] = { | ||
158 | .regbase = GPIO2_BASE, | ||
159 | .chip = { | ||
160 | .label = "gpio-2", | ||
161 | .direction_input = pxa_gpio_direction_input, | ||
162 | .direction_output = pxa_gpio_direction_output, | ||
163 | .get = pxa_gpio_get, | ||
164 | .set = pxa_gpio_set, | ||
165 | .base = 64, | ||
166 | .ngpio = 32, /* 21 for PXA25x */ | ||
167 | }, | ||
168 | }, | ||
169 | #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) | 153 | #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) |
170 | [3] = { | 154 | GPIO_CHIP(3), |
171 | .regbase = GPIO3_BASE, | ||
172 | .chip = { | ||
173 | .label = "gpio-3", | ||
174 | .direction_input = pxa_gpio_direction_input, | ||
175 | .direction_output = pxa_gpio_direction_output, | ||
176 | .get = pxa_gpio_get, | ||
177 | .set = pxa_gpio_set, | ||
178 | .base = 96, | ||
179 | .ngpio = 32, | ||
180 | }, | ||
181 | }, | ||
182 | #endif | 155 | #endif |
183 | }; | 156 | }; |
184 | 157 | ||
185 | void __init pxa_init_gpio(int gpio_nr) | 158 | /* |
159 | * PXA GPIO edge detection for IRQs: | ||
160 | * IRQs are generated on Falling-Edge, Rising-Edge, or both. | ||
161 | * Use this instead of directly setting GRER/GFER. | ||
162 | */ | ||
163 | |||
164 | static unsigned long GPIO_IRQ_rising_edge[4]; | ||
165 | static unsigned long GPIO_IRQ_falling_edge[4]; | ||
166 | static unsigned long GPIO_IRQ_mask[4]; | ||
167 | |||
168 | /* | ||
169 | * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate | ||
170 | * function of a GPIO, and GPDRx cannot be altered once configured. It | ||
171 | * is attributed as "occupied" here (I know this terminology isn't | ||
172 | * accurate, you are welcome to propose a better one :-) | ||
173 | */ | ||
174 | static int __gpio_is_occupied(unsigned gpio) | ||
175 | { | ||
176 | if (cpu_is_pxa25x() || cpu_is_pxa27x()) | ||
177 | return GAFR(gpio) & (0x3 << (((gpio) & 0xf) * 2)); | ||
178 | else | ||
179 | return 0; | ||
180 | } | ||
181 | |||
182 | static int pxa_gpio_irq_type(unsigned int irq, unsigned int type) | ||
183 | { | ||
184 | int gpio, idx; | ||
185 | |||
186 | gpio = IRQ_TO_GPIO(irq); | ||
187 | idx = gpio >> 5; | ||
188 | |||
189 | if (type == IRQ_TYPE_PROBE) { | ||
190 | /* Don't mess with enabled GPIOs using preconfigured edges or | ||
191 | * GPIOs set to alternate function or to output during probe | ||
192 | */ | ||
193 | if ((GPIO_IRQ_rising_edge[idx] | | ||
194 | GPIO_IRQ_falling_edge[idx] | | ||
195 | GPDR(gpio)) & GPIO_bit(gpio)) | ||
196 | return 0; | ||
197 | |||
198 | if (__gpio_is_occupied(gpio)) | ||
199 | return 0; | ||
200 | |||
201 | type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; | ||
202 | } | ||
203 | |||
204 | GPDR(gpio) &= ~GPIO_bit(gpio); | ||
205 | |||
206 | if (type & IRQ_TYPE_EDGE_RISING) | ||
207 | __set_bit(gpio, GPIO_IRQ_rising_edge); | ||
208 | else | ||
209 | __clear_bit(gpio, GPIO_IRQ_rising_edge); | ||
210 | |||
211 | if (type & IRQ_TYPE_EDGE_FALLING) | ||
212 | __set_bit(gpio, GPIO_IRQ_falling_edge); | ||
213 | else | ||
214 | __clear_bit(gpio, GPIO_IRQ_falling_edge); | ||
215 | |||
216 | GRER(gpio) = GPIO_IRQ_rising_edge[idx] & GPIO_IRQ_mask[idx]; | ||
217 | GFER(gpio) = GPIO_IRQ_falling_edge[idx] & GPIO_IRQ_mask[idx]; | ||
218 | |||
219 | pr_debug("%s: IRQ%d (GPIO%d) - edge%s%s\n", __func__, irq, gpio, | ||
220 | ((type & IRQ_TYPE_EDGE_RISING) ? " rising" : ""), | ||
221 | ((type & IRQ_TYPE_EDGE_FALLING) ? " falling" : "")); | ||
222 | return 0; | ||
223 | } | ||
224 | |||
225 | /* | ||
226 | * GPIO IRQs must be acknowledged. This is for GPIO 0 and 1. | ||
227 | */ | ||
228 | |||
229 | static void pxa_ack_low_gpio(unsigned int irq) | ||
230 | { | ||
231 | GEDR0 = (1 << (irq - IRQ_GPIO0)); | ||
232 | } | ||
233 | |||
234 | static void pxa_mask_low_gpio(unsigned int irq) | ||
235 | { | ||
236 | ICMR &= ~(1 << (irq - PXA_IRQ(0))); | ||
237 | } | ||
238 | |||
239 | static void pxa_unmask_low_gpio(unsigned int irq) | ||
240 | { | ||
241 | ICMR |= 1 << (irq - PXA_IRQ(0)); | ||
242 | } | ||
243 | |||
244 | static struct irq_chip pxa_low_gpio_chip = { | ||
245 | .name = "GPIO-l", | ||
246 | .ack = pxa_ack_low_gpio, | ||
247 | .mask = pxa_mask_low_gpio, | ||
248 | .unmask = pxa_unmask_low_gpio, | ||
249 | .set_type = pxa_gpio_irq_type, | ||
250 | }; | ||
251 | |||
252 | /* | ||
253 | * Demux handler for GPIO>=2 edge detect interrupts | ||
254 | */ | ||
255 | |||
256 | #define GEDR_BITS (sizeof(gedr) * BITS_PER_BYTE) | ||
257 | |||
258 | static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc) | ||
259 | { | ||
260 | int loop, bit, n; | ||
261 | unsigned long gedr[4]; | ||
262 | |||
263 | do { | ||
264 | gedr[0] = GEDR0 & GPIO_IRQ_mask[0] & ~3; | ||
265 | gedr[1] = GEDR1 & GPIO_IRQ_mask[1]; | ||
266 | gedr[2] = GEDR2 & GPIO_IRQ_mask[2]; | ||
267 | gedr[3] = GEDR3 & GPIO_IRQ_mask[3]; | ||
268 | |||
269 | GEDR0 = gedr[0]; GEDR1 = gedr[1]; | ||
270 | GEDR2 = gedr[2]; GEDR3 = gedr[3]; | ||
271 | |||
272 | loop = 0; | ||
273 | bit = find_first_bit(gedr, GEDR_BITS); | ||
274 | while (bit < GEDR_BITS) { | ||
275 | loop = 1; | ||
276 | |||
277 | n = PXA_GPIO_IRQ_BASE + bit; | ||
278 | desc_handle_irq(n, irq_desc + n); | ||
279 | |||
280 | bit = find_next_bit(gedr, GEDR_BITS, bit + 1); | ||
281 | } | ||
282 | } while (loop); | ||
283 | } | ||
284 | |||
285 | static void pxa_ack_muxed_gpio(unsigned int irq) | ||
286 | { | ||
287 | int gpio = irq - IRQ_GPIO(2) + 2; | ||
288 | GEDR(gpio) = GPIO_bit(gpio); | ||
289 | } | ||
290 | |||
291 | static void pxa_mask_muxed_gpio(unsigned int irq) | ||
292 | { | ||
293 | int gpio = irq - IRQ_GPIO(2) + 2; | ||
294 | __clear_bit(gpio, GPIO_IRQ_mask); | ||
295 | GRER(gpio) &= ~GPIO_bit(gpio); | ||
296 | GFER(gpio) &= ~GPIO_bit(gpio); | ||
297 | } | ||
298 | |||
299 | static void pxa_unmask_muxed_gpio(unsigned int irq) | ||
300 | { | ||
301 | int gpio = irq - IRQ_GPIO(2) + 2; | ||
302 | int idx = gpio >> 5; | ||
303 | __set_bit(gpio, GPIO_IRQ_mask); | ||
304 | GRER(gpio) = GPIO_IRQ_rising_edge[idx] & GPIO_IRQ_mask[idx]; | ||
305 | GFER(gpio) = GPIO_IRQ_falling_edge[idx] & GPIO_IRQ_mask[idx]; | ||
306 | } | ||
307 | |||
308 | static struct irq_chip pxa_muxed_gpio_chip = { | ||
309 | .name = "GPIO", | ||
310 | .ack = pxa_ack_muxed_gpio, | ||
311 | .mask = pxa_mask_muxed_gpio, | ||
312 | .unmask = pxa_unmask_muxed_gpio, | ||
313 | .set_type = pxa_gpio_irq_type, | ||
314 | }; | ||
315 | |||
316 | void __init pxa_init_gpio(int gpio_nr, set_wake_t fn) | ||
186 | { | 317 | { |
187 | int i; | 318 | int irq, i, gpio; |
319 | |||
320 | pxa_last_gpio = gpio_nr - 1; | ||
321 | |||
322 | /* clear all GPIO edge detects */ | ||
323 | for (i = 0; i < gpio_nr; i += 32) { | ||
324 | GFER(i) = 0; | ||
325 | GRER(i) = 0; | ||
326 | GEDR(i) = GEDR(i); | ||
327 | } | ||
328 | |||
329 | /* GPIO 0 and 1 must have their mask bit always set */ | ||
330 | GPIO_IRQ_mask[0] = 3; | ||
331 | |||
332 | for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) { | ||
333 | set_irq_chip(irq, &pxa_low_gpio_chip); | ||
334 | set_irq_handler(irq, handle_edge_irq); | ||
335 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | ||
336 | } | ||
337 | |||
338 | for (irq = IRQ_GPIO(2); irq < IRQ_GPIO(gpio_nr); irq++) { | ||
339 | set_irq_chip(irq, &pxa_muxed_gpio_chip); | ||
340 | set_irq_handler(irq, handle_edge_irq); | ||
341 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | ||
342 | } | ||
343 | |||
344 | /* Install handler for GPIO>=2 edge detect interrupts */ | ||
345 | set_irq_chained_handler(IRQ_GPIO_2_x, pxa_gpio_demux_handler); | ||
346 | |||
347 | pxa_low_gpio_chip.set_wake = fn; | ||
348 | pxa_muxed_gpio_chip.set_wake = fn; | ||
188 | 349 | ||
189 | /* add a GPIO chip for each register bank. | 350 | /* add a GPIO chip for each register bank. |
190 | * the last PXA25x register only contains 21 GPIOs | 351 | * the last PXA25x register only contains 21 GPIOs |
191 | */ | 352 | */ |
192 | for (i = 0; i < gpio_nr; i += 32) { | 353 | for (gpio = 0, i = 0; gpio < gpio_nr; gpio += 32, i++) { |
193 | if (i+32 > gpio_nr) | 354 | if (gpio + 32 > gpio_nr) |
194 | pxa_gpio_chip[i/32].chip.ngpio = gpio_nr - i; | 355 | pxa_gpio_chip[i].chip.ngpio = gpio_nr - gpio; |
195 | gpiochip_add(&pxa_gpio_chip[i/32].chip); | 356 | gpiochip_add(&pxa_gpio_chip[i].chip); |
196 | } | 357 | } |
197 | } | 358 | } |
359 | |||
360 | #ifdef CONFIG_PM | ||
361 | |||
362 | static unsigned long saved_gplr[4]; | ||
363 | static unsigned long saved_gpdr[4]; | ||
364 | static unsigned long saved_grer[4]; | ||
365 | static unsigned long saved_gfer[4]; | ||
366 | |||
367 | static int pxa_gpio_suspend(struct sys_device *dev, pm_message_t state) | ||
368 | { | ||
369 | int i, gpio; | ||
370 | |||
371 | for (gpio = 0, i = 0; gpio < pxa_last_gpio; gpio += 32, i++) { | ||
372 | saved_gplr[i] = GPLR(gpio); | ||
373 | saved_gpdr[i] = GPDR(gpio); | ||
374 | saved_grer[i] = GRER(gpio); | ||
375 | saved_gfer[i] = GFER(gpio); | ||
376 | |||
377 | /* Clear GPIO transition detect bits */ | ||
378 | GEDR(gpio) = GEDR(gpio); | ||
379 | } | ||
380 | return 0; | ||
381 | } | ||
382 | |||
383 | static int pxa_gpio_resume(struct sys_device *dev) | ||
384 | { | ||
385 | int i, gpio; | ||
386 | |||
387 | for (gpio = 0, i = 0; gpio < pxa_last_gpio; gpio += 32, i++) { | ||
388 | /* restore level with set/clear */ | ||
389 | GPSR(gpio) = saved_gplr[i]; | ||
390 | GPCR(gpio) = ~saved_gplr[i]; | ||
391 | |||
392 | GRER(gpio) = saved_grer[i]; | ||
393 | GFER(gpio) = saved_gfer[i]; | ||
394 | GPDR(gpio) = saved_gpdr[i]; | ||
395 | } | ||
396 | return 0; | ||
397 | } | ||
398 | #else | ||
399 | #define pxa_gpio_suspend NULL | ||
400 | #define pxa_gpio_resume NULL | ||
401 | #endif | ||
402 | |||
403 | struct sysdev_class pxa_gpio_sysclass = { | ||
404 | .name = "gpio", | ||
405 | .suspend = pxa_gpio_suspend, | ||
406 | .resume = pxa_gpio_resume, | ||
407 | }; | ||
408 | |||
409 | static int __init pxa_gpio_init(void) | ||
410 | { | ||
411 | return sysdev_class_register(&pxa_gpio_sysclass); | ||
412 | } | ||
413 | |||
414 | core_initcall(pxa_gpio_init); | ||
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c new file mode 100644 index 000000000000..f01d18544133 --- /dev/null +++ b/arch/arm/mach-pxa/gumstix.c | |||
@@ -0,0 +1,147 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/gumstix.c | ||
3 | * | ||
4 | * Support for the Gumstix motherboards. | ||
5 | * | ||
6 | * Original Author: Craig Hughes | ||
7 | * Created: Feb 14, 2008 | ||
8 | * Copyright: Craig Hughes | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | * Implemented based on lubbock.c by Nicolas Pitre and code from Craig | ||
15 | * Hughes | ||
16 | */ | ||
17 | |||
18 | #include <linux/module.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/interrupt.h> | ||
23 | #include <linux/mtd/mtd.h> | ||
24 | #include <linux/mtd/partitions.h> | ||
25 | |||
26 | #include <asm/setup.h> | ||
27 | #include <asm/memory.h> | ||
28 | #include <asm/mach-types.h> | ||
29 | #include <asm/hardware.h> | ||
30 | #include <asm/irq.h> | ||
31 | #include <asm/sizes.h> | ||
32 | |||
33 | #include <asm/mach/arch.h> | ||
34 | #include <asm/mach/map.h> | ||
35 | #include <asm/mach/irq.h> | ||
36 | #include <asm/mach/flash.h> | ||
37 | #include <asm/arch/mmc.h> | ||
38 | #include <asm/arch/udc.h> | ||
39 | #include <asm/arch/gumstix.h> | ||
40 | |||
41 | #include <asm/arch/pxa-regs.h> | ||
42 | #include <asm/arch/pxa2xx-regs.h> | ||
43 | |||
44 | #include "generic.h" | ||
45 | |||
46 | static struct resource flash_resource = { | ||
47 | .start = 0x00000000, | ||
48 | .end = SZ_64M - 1, | ||
49 | .flags = IORESOURCE_MEM, | ||
50 | }; | ||
51 | |||
52 | static struct mtd_partition gumstix_partitions[] = { | ||
53 | { | ||
54 | .name = "Bootloader", | ||
55 | .size = 0x00040000, | ||
56 | .offset = 0, | ||
57 | .mask_flags = MTD_WRITEABLE /* force read-only */ | ||
58 | } , { | ||
59 | .name = "rootfs", | ||
60 | .size = MTDPART_SIZ_FULL, | ||
61 | .offset = MTDPART_OFS_APPEND | ||
62 | } | ||
63 | }; | ||
64 | |||
65 | static struct flash_platform_data gumstix_flash_data = { | ||
66 | .map_name = "cfi_probe", | ||
67 | .parts = gumstix_partitions, | ||
68 | .nr_parts = ARRAY_SIZE(gumstix_partitions), | ||
69 | .width = 2, | ||
70 | }; | ||
71 | |||
72 | static struct platform_device gumstix_flash_device = { | ||
73 | .name = "pxa2xx-flash", | ||
74 | .id = 0, | ||
75 | .dev = { | ||
76 | .platform_data = &gumstix_flash_data, | ||
77 | }, | ||
78 | .resource = &flash_resource, | ||
79 | .num_resources = 1, | ||
80 | }; | ||
81 | |||
82 | static struct platform_device *devices[] __initdata = { | ||
83 | &gumstix_flash_device, | ||
84 | }; | ||
85 | |||
86 | #ifdef CONFIG_MMC_PXA | ||
87 | static struct pxamci_platform_data gumstix_mci_platform_data; | ||
88 | |||
89 | static int gumstix_mci_init(struct device *dev, irq_handler_t detect_int, | ||
90 | void *data) | ||
91 | { | ||
92 | pxa_gpio_mode(GPIO6_MMCCLK_MD); | ||
93 | pxa_gpio_mode(GPIO53_MMCCLK_MD); | ||
94 | pxa_gpio_mode(GPIO8_MMCCS0_MD); | ||
95 | |||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | static struct pxamci_platform_data gumstix_mci_platform_data = { | ||
100 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | ||
101 | .init = gumstix_mci_init, | ||
102 | }; | ||
103 | |||
104 | static void __init gumstix_mmc_init(void) | ||
105 | { | ||
106 | pxa_set_mci_info(&gumstix_mci_platform_data); | ||
107 | } | ||
108 | #else | ||
109 | static void __init gumstix_mmc_init(void) | ||
110 | { | ||
111 | printk(KERN_INFO "Gumstix mmc disabled\n"); | ||
112 | } | ||
113 | #endif | ||
114 | |||
115 | #ifdef CONFIG_USB_GADGET_PXA2XX | ||
116 | static struct pxa2xx_udc_mach_info gumstix_udc_info __initdata = { | ||
117 | .gpio_vbus = GPIO_GUMSTIX_USB_GPIOn, | ||
118 | .gpio_pullup = GPIO_GUMSTIX_USB_GPIOx, | ||
119 | }; | ||
120 | |||
121 | static void __init gumstix_udc_init(void) | ||
122 | { | ||
123 | pxa_set_udc_info(&gumstix_udc_info); | ||
124 | } | ||
125 | #else | ||
126 | static void gumstix_udc_init(void) | ||
127 | { | ||
128 | printk(KERN_INFO "Gumstix udc is disabled\n"); | ||
129 | } | ||
130 | #endif | ||
131 | |||
132 | static void __init gumstix_init(void) | ||
133 | { | ||
134 | gumstix_udc_init(); | ||
135 | gumstix_mmc_init(); | ||
136 | (void) platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
137 | } | ||
138 | |||
139 | MACHINE_START(GUMSTIX, "Gumstix") | ||
140 | .phys_io = 0x40000000, | ||
141 | .boot_params = 0xa0000100, /* match u-boot bi_boot_params */ | ||
142 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | ||
143 | .map_io = pxa_map_io, | ||
144 | .init_irq = pxa25x_init_irq, | ||
145 | .timer = &pxa_timer, | ||
146 | .init_machine = gumstix_init, | ||
147 | MACHINE_END | ||
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c index 0a9434432c55..2637633f9166 100644 --- a/arch/arm/mach-pxa/idp.c +++ b/arch/arm/mach-pxa/idp.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/mach/map.h> | 32 | #include <asm/mach/map.h> |
33 | 33 | ||
34 | #include <asm/arch/pxa-regs.h> | 34 | #include <asm/arch/pxa-regs.h> |
35 | #include <asm/arch/pxa2xx-gpio.h> | ||
35 | #include <asm/arch/idp.h> | 36 | #include <asm/arch/idp.h> |
36 | #include <asm/arch/pxafb.h> | 37 | #include <asm/arch/pxafb.h> |
37 | #include <asm/arch/bitfield.h> | 38 | #include <asm/arch/bitfield.h> |
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c index 36c6a68beca2..a9a0c3fab159 100644 --- a/arch/arm/mach-pxa/irq.c +++ b/arch/arm/mach-pxa/irq.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/mach-pxa/irq.c | 2 | * linux/arch/arm/mach-pxa/irq.c |
3 | * | 3 | * |
4 | * Generic PXA IRQ handling, GPIO IRQ demultiplexing, etc. | 4 | * Generic PXA IRQ handling |
5 | * | 5 | * |
6 | * Author: Nicolas Pitre | 6 | * Author: Nicolas Pitre |
7 | * Created: Jun 15, 2001 | 7 | * Created: Jun 15, 2001 |
@@ -21,308 +21,58 @@ | |||
21 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
22 | #include <asm/mach/irq.h> | 22 | #include <asm/mach/irq.h> |
23 | #include <asm/arch/pxa-regs.h> | 23 | #include <asm/arch/pxa-regs.h> |
24 | #include <asm/arch/pxa2xx-gpio.h> | ||
24 | 25 | ||
25 | #include "generic.h" | 26 | #include "generic.h" |
26 | 27 | ||
28 | #define IRQ_BIT(n) (((n) - PXA_IRQ(0)) & 0x1f) | ||
29 | #define _ICMR(n) (*((((n) - PXA_IRQ(0)) & ~0x1f) ? &ICMR2 : &ICMR)) | ||
30 | #define _ICLR(n) (*((((n) - PXA_IRQ(0)) & ~0x1f) ? &ICLR2 : &ICLR)) | ||
27 | 31 | ||
28 | /* | 32 | /* |
29 | * This is for peripheral IRQs internal to the PXA chip. | 33 | * This is for peripheral IRQs internal to the PXA chip. |
30 | */ | 34 | */ |
31 | 35 | ||
32 | static void pxa_mask_low_irq(unsigned int irq) | 36 | static int pxa_internal_irq_nr; |
37 | |||
38 | static void pxa_mask_irq(unsigned int irq) | ||
33 | { | 39 | { |
34 | ICMR &= ~(1 << irq); | 40 | _ICMR(irq) &= ~(1 << IRQ_BIT(irq)); |
35 | } | 41 | } |
36 | 42 | ||
37 | static void pxa_unmask_low_irq(unsigned int irq) | 43 | static void pxa_unmask_irq(unsigned int irq) |
38 | { | 44 | { |
39 | ICMR |= (1 << irq); | 45 | _ICMR(irq) |= 1 << IRQ_BIT(irq); |
40 | } | 46 | } |
41 | 47 | ||
42 | static struct irq_chip pxa_internal_chip_low = { | 48 | static struct irq_chip pxa_internal_irq_chip = { |
43 | .name = "SC", | 49 | .name = "SC", |
44 | .ack = pxa_mask_low_irq, | 50 | .ack = pxa_mask_irq, |
45 | .mask = pxa_mask_low_irq, | 51 | .mask = pxa_mask_irq, |
46 | .unmask = pxa_unmask_low_irq, | 52 | .unmask = pxa_unmask_irq, |
47 | }; | 53 | }; |
48 | 54 | ||
49 | void __init pxa_init_irq_low(void) | 55 | void __init pxa_init_irq(int irq_nr, set_wake_t fn) |
50 | { | 56 | { |
51 | int irq; | 57 | int irq; |
52 | 58 | ||
53 | /* disable all IRQs */ | 59 | pxa_internal_irq_nr = irq_nr; |
54 | ICMR = 0; | ||
55 | 60 | ||
56 | /* all IRQs are IRQ, not FIQ */ | 61 | for (irq = 0; irq < irq_nr; irq += 32) { |
57 | ICLR = 0; | 62 | _ICMR(irq) = 0; /* disable all IRQs */ |
63 | _ICLR(irq) = 0; /* all IRQs are IRQ, not FIQ */ | ||
64 | } | ||
58 | 65 | ||
59 | /* only unmasked interrupts kick us out of idle */ | 66 | /* only unmasked interrupts kick us out of idle */ |
60 | ICCR = 1; | 67 | ICCR = 1; |
61 | 68 | ||
62 | for (irq = PXA_IRQ(0); irq <= PXA_IRQ(31); irq++) { | 69 | for (irq = PXA_IRQ(0); irq < PXA_IRQ(irq_nr); irq++) { |
63 | set_irq_chip(irq, &pxa_internal_chip_low); | 70 | set_irq_chip(irq, &pxa_internal_irq_chip); |
64 | set_irq_handler(irq, handle_level_irq); | ||
65 | set_irq_flags(irq, IRQF_VALID); | ||
66 | } | ||
67 | } | ||
68 | |||
69 | #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) | ||
70 | |||
71 | /* | ||
72 | * This is for the second set of internal IRQs as found on the PXA27x. | ||
73 | */ | ||
74 | |||
75 | static void pxa_mask_high_irq(unsigned int irq) | ||
76 | { | ||
77 | ICMR2 &= ~(1 << (irq - 32)); | ||
78 | } | ||
79 | |||
80 | static void pxa_unmask_high_irq(unsigned int irq) | ||
81 | { | ||
82 | ICMR2 |= (1 << (irq - 32)); | ||
83 | } | ||
84 | |||
85 | static struct irq_chip pxa_internal_chip_high = { | ||
86 | .name = "SC-hi", | ||
87 | .ack = pxa_mask_high_irq, | ||
88 | .mask = pxa_mask_high_irq, | ||
89 | .unmask = pxa_unmask_high_irq, | ||
90 | }; | ||
91 | |||
92 | void __init pxa_init_irq_high(void) | ||
93 | { | ||
94 | int irq; | ||
95 | |||
96 | ICMR2 = 0; | ||
97 | ICLR2 = 0; | ||
98 | |||
99 | for (irq = PXA_IRQ(32); irq < PXA_IRQ(64); irq++) { | ||
100 | set_irq_chip(irq, &pxa_internal_chip_high); | ||
101 | set_irq_handler(irq, handle_level_irq); | 71 | set_irq_handler(irq, handle_level_irq); |
102 | set_irq_flags(irq, IRQF_VALID); | 72 | set_irq_flags(irq, IRQF_VALID); |
103 | } | 73 | } |
104 | } | ||
105 | #endif | ||
106 | |||
107 | /* | ||
108 | * PXA GPIO edge detection for IRQs: | ||
109 | * IRQs are generated on Falling-Edge, Rising-Edge, or both. | ||
110 | * Use this instead of directly setting GRER/GFER. | ||
111 | */ | ||
112 | |||
113 | static long GPIO_IRQ_rising_edge[4]; | ||
114 | static long GPIO_IRQ_falling_edge[4]; | ||
115 | static long GPIO_IRQ_mask[4]; | ||
116 | |||
117 | static int pxa_gpio_irq_type(unsigned int irq, unsigned int type) | ||
118 | { | ||
119 | int gpio, idx; | ||
120 | |||
121 | gpio = IRQ_TO_GPIO(irq); | ||
122 | idx = gpio >> 5; | ||
123 | |||
124 | if (type == IRQT_PROBE) { | ||
125 | /* Don't mess with enabled GPIOs using preconfigured edges or | ||
126 | GPIOs set to alternate function or to output during probe */ | ||
127 | if ((GPIO_IRQ_rising_edge[idx] | GPIO_IRQ_falling_edge[idx] | GPDR(gpio)) & | ||
128 | GPIO_bit(gpio)) | ||
129 | return 0; | ||
130 | if (GAFR(gpio) & (0x3 << (((gpio) & 0xf)*2))) | ||
131 | return 0; | ||
132 | type = __IRQT_RISEDGE | __IRQT_FALEDGE; | ||
133 | } | ||
134 | |||
135 | /* printk(KERN_DEBUG "IRQ%d (GPIO%d): ", irq, gpio); */ | ||
136 | |||
137 | pxa_gpio_mode(gpio | GPIO_IN); | ||
138 | |||
139 | if (type & __IRQT_RISEDGE) { | ||
140 | /* printk("rising "); */ | ||
141 | __set_bit (gpio, GPIO_IRQ_rising_edge); | ||
142 | } else { | ||
143 | __clear_bit (gpio, GPIO_IRQ_rising_edge); | ||
144 | } | ||
145 | |||
146 | if (type & __IRQT_FALEDGE) { | ||
147 | /* printk("falling "); */ | ||
148 | __set_bit (gpio, GPIO_IRQ_falling_edge); | ||
149 | } else { | ||
150 | __clear_bit (gpio, GPIO_IRQ_falling_edge); | ||
151 | } | ||
152 | |||
153 | /* printk("edges\n"); */ | ||
154 | |||
155 | GRER(gpio) = GPIO_IRQ_rising_edge[idx] & GPIO_IRQ_mask[idx]; | ||
156 | GFER(gpio) = GPIO_IRQ_falling_edge[idx] & GPIO_IRQ_mask[idx]; | ||
157 | return 0; | ||
158 | } | ||
159 | |||
160 | /* | ||
161 | * GPIO IRQs must be acknowledged. This is for GPIO 0 and 1. | ||
162 | */ | ||
163 | |||
164 | static void pxa_ack_low_gpio(unsigned int irq) | ||
165 | { | ||
166 | GEDR0 = (1 << (irq - IRQ_GPIO0)); | ||
167 | } | ||
168 | |||
169 | static struct irq_chip pxa_low_gpio_chip = { | ||
170 | .name = "GPIO-l", | ||
171 | .ack = pxa_ack_low_gpio, | ||
172 | .mask = pxa_mask_low_irq, | ||
173 | .unmask = pxa_unmask_low_irq, | ||
174 | .set_type = pxa_gpio_irq_type, | ||
175 | }; | ||
176 | |||
177 | /* | ||
178 | * Demux handler for GPIO>=2 edge detect interrupts | ||
179 | */ | ||
180 | |||
181 | static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc) | ||
182 | { | ||
183 | unsigned int mask; | ||
184 | int loop; | ||
185 | |||
186 | do { | ||
187 | loop = 0; | ||
188 | |||
189 | mask = GEDR0 & GPIO_IRQ_mask[0] & ~3; | ||
190 | if (mask) { | ||
191 | GEDR0 = mask; | ||
192 | irq = IRQ_GPIO(2); | ||
193 | desc = irq_desc + irq; | ||
194 | mask >>= 2; | ||
195 | do { | ||
196 | if (mask & 1) | ||
197 | desc_handle_irq(irq, desc); | ||
198 | irq++; | ||
199 | desc++; | ||
200 | mask >>= 1; | ||
201 | } while (mask); | ||
202 | loop = 1; | ||
203 | } | ||
204 | |||
205 | mask = GEDR1 & GPIO_IRQ_mask[1]; | ||
206 | if (mask) { | ||
207 | GEDR1 = mask; | ||
208 | irq = IRQ_GPIO(32); | ||
209 | desc = irq_desc + irq; | ||
210 | do { | ||
211 | if (mask & 1) | ||
212 | desc_handle_irq(irq, desc); | ||
213 | irq++; | ||
214 | desc++; | ||
215 | mask >>= 1; | ||
216 | } while (mask); | ||
217 | loop = 1; | ||
218 | } | ||
219 | |||
220 | mask = GEDR2 & GPIO_IRQ_mask[2]; | ||
221 | if (mask) { | ||
222 | GEDR2 = mask; | ||
223 | irq = IRQ_GPIO(64); | ||
224 | desc = irq_desc + irq; | ||
225 | do { | ||
226 | if (mask & 1) | ||
227 | desc_handle_irq(irq, desc); | ||
228 | irq++; | ||
229 | desc++; | ||
230 | mask >>= 1; | ||
231 | } while (mask); | ||
232 | loop = 1; | ||
233 | } | ||
234 | |||
235 | mask = GEDR3 & GPIO_IRQ_mask[3]; | ||
236 | if (mask) { | ||
237 | GEDR3 = mask; | ||
238 | irq = IRQ_GPIO(96); | ||
239 | desc = irq_desc + irq; | ||
240 | do { | ||
241 | if (mask & 1) | ||
242 | desc_handle_irq(irq, desc); | ||
243 | irq++; | ||
244 | desc++; | ||
245 | mask >>= 1; | ||
246 | } while (mask); | ||
247 | loop = 1; | ||
248 | } | ||
249 | } while (loop); | ||
250 | } | ||
251 | |||
252 | static void pxa_ack_muxed_gpio(unsigned int irq) | ||
253 | { | ||
254 | int gpio = irq - IRQ_GPIO(2) + 2; | ||
255 | GEDR(gpio) = GPIO_bit(gpio); | ||
256 | } | ||
257 | |||
258 | static void pxa_mask_muxed_gpio(unsigned int irq) | ||
259 | { | ||
260 | int gpio = irq - IRQ_GPIO(2) + 2; | ||
261 | __clear_bit(gpio, GPIO_IRQ_mask); | ||
262 | GRER(gpio) &= ~GPIO_bit(gpio); | ||
263 | GFER(gpio) &= ~GPIO_bit(gpio); | ||
264 | } | ||
265 | |||
266 | static void pxa_unmask_muxed_gpio(unsigned int irq) | ||
267 | { | ||
268 | int gpio = irq - IRQ_GPIO(2) + 2; | ||
269 | int idx = gpio >> 5; | ||
270 | __set_bit(gpio, GPIO_IRQ_mask); | ||
271 | GRER(gpio) = GPIO_IRQ_rising_edge[idx] & GPIO_IRQ_mask[idx]; | ||
272 | GFER(gpio) = GPIO_IRQ_falling_edge[idx] & GPIO_IRQ_mask[idx]; | ||
273 | } | ||
274 | |||
275 | static struct irq_chip pxa_muxed_gpio_chip = { | ||
276 | .name = "GPIO", | ||
277 | .ack = pxa_ack_muxed_gpio, | ||
278 | .mask = pxa_mask_muxed_gpio, | ||
279 | .unmask = pxa_unmask_muxed_gpio, | ||
280 | .set_type = pxa_gpio_irq_type, | ||
281 | }; | ||
282 | |||
283 | void __init pxa_init_irq_gpio(int gpio_nr) | ||
284 | { | ||
285 | int irq, i; | ||
286 | |||
287 | pxa_last_gpio = gpio_nr - 1; | ||
288 | |||
289 | /* clear all GPIO edge detects */ | ||
290 | for (i = 0; i < gpio_nr; i += 32) { | ||
291 | GFER(i) = 0; | ||
292 | GRER(i) = 0; | ||
293 | GEDR(i) = GEDR(i); | ||
294 | } | ||
295 | |||
296 | /* GPIO 0 and 1 must have their mask bit always set */ | ||
297 | GPIO_IRQ_mask[0] = 3; | ||
298 | |||
299 | for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) { | ||
300 | set_irq_chip(irq, &pxa_low_gpio_chip); | ||
301 | set_irq_handler(irq, handle_edge_irq); | ||
302 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | ||
303 | } | ||
304 | 74 | ||
305 | for (irq = IRQ_GPIO(2); irq < IRQ_GPIO(gpio_nr); irq++) { | 75 | pxa_internal_irq_chip.set_wake = fn; |
306 | set_irq_chip(irq, &pxa_muxed_gpio_chip); | ||
307 | set_irq_handler(irq, handle_edge_irq); | ||
308 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | ||
309 | } | ||
310 | |||
311 | /* Install handler for GPIO>=2 edge detect interrupts */ | ||
312 | set_irq_chip(IRQ_GPIO_2_x, &pxa_internal_chip_low); | ||
313 | set_irq_chained_handler(IRQ_GPIO_2_x, pxa_gpio_demux_handler); | ||
314 | |||
315 | pxa_init_gpio(gpio_nr); | ||
316 | } | ||
317 | |||
318 | void __init pxa_init_irq_set_wake(int (*set_wake)(unsigned int, unsigned int)) | ||
319 | { | ||
320 | pxa_internal_chip_low.set_wake = set_wake; | ||
321 | #ifdef CONFIG_PXA27x | ||
322 | pxa_internal_chip_high.set_wake = set_wake; | ||
323 | #endif | ||
324 | pxa_low_gpio_chip.set_wake = set_wake; | ||
325 | pxa_muxed_gpio_chip.set_wake = set_wake; | ||
326 | } | 76 | } |
327 | 77 | ||
328 | #ifdef CONFIG_PM | 78 | #ifdef CONFIG_PM |
@@ -330,19 +80,11 @@ static unsigned long saved_icmr[2]; | |||
330 | 80 | ||
331 | static int pxa_irq_suspend(struct sys_device *dev, pm_message_t state) | 81 | static int pxa_irq_suspend(struct sys_device *dev, pm_message_t state) |
332 | { | 82 | { |
333 | switch (dev->id) { | 83 | int i, irq = PXA_IRQ(0); |
334 | case 0: | 84 | |
335 | saved_icmr[0] = ICMR; | 85 | for (i = 0; irq < PXA_IRQ(pxa_internal_irq_nr); i++, irq += 32) { |
336 | ICMR = 0; | 86 | saved_icmr[i] = _ICMR(irq); |
337 | break; | 87 | _ICMR(irq) = 0; |
338 | #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) | ||
339 | case 1: | ||
340 | saved_icmr[1] = ICMR2; | ||
341 | ICMR2 = 0; | ||
342 | break; | ||
343 | #endif | ||
344 | default: | ||
345 | return -EINVAL; | ||
346 | } | 88 | } |
347 | 89 | ||
348 | return 0; | 90 | return 0; |
@@ -350,22 +92,14 @@ static int pxa_irq_suspend(struct sys_device *dev, pm_message_t state) | |||
350 | 92 | ||
351 | static int pxa_irq_resume(struct sys_device *dev) | 93 | static int pxa_irq_resume(struct sys_device *dev) |
352 | { | 94 | { |
353 | switch (dev->id) { | 95 | int i, irq = PXA_IRQ(0); |
354 | case 0: | 96 | |
355 | ICMR = saved_icmr[0]; | 97 | for (i = 0; irq < PXA_IRQ(pxa_internal_irq_nr); i++, irq += 32) { |
356 | ICLR = 0; | 98 | _ICMR(irq) = saved_icmr[i]; |
357 | ICCR = 1; | 99 | _ICLR(irq) = 0; |
358 | break; | ||
359 | #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) | ||
360 | case 1: | ||
361 | ICMR2 = saved_icmr[1]; | ||
362 | ICLR2 = 0; | ||
363 | break; | ||
364 | #endif | ||
365 | default: | ||
366 | return -EINVAL; | ||
367 | } | 100 | } |
368 | 101 | ||
102 | ICCR = 1; | ||
369 | return 0; | 103 | return 0; |
370 | } | 104 | } |
371 | #else | 105 | #else |
diff --git a/arch/arm/mach-pxa/leds-trizeps4.c b/arch/arm/mach-pxa/leds-trizeps4.c index 2271d20ffeda..21880daabafe 100644 --- a/arch/arm/mach-pxa/leds-trizeps4.c +++ b/arch/arm/mach-pxa/leds-trizeps4.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/leds.h> | 18 | #include <asm/leds.h> |
19 | 19 | ||
20 | #include <asm/arch/pxa-regs.h> | 20 | #include <asm/arch/pxa-regs.h> |
21 | #include <asm/arch/pxa2xx-gpio.h> | ||
21 | #include <asm/arch/trizeps4.h> | 22 | #include <asm/arch/trizeps4.h> |
22 | 23 | ||
23 | #include "leds.h" | 24 | #include "leds.h" |
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c index 0a4b54c21314..03396063b561 100644 --- a/arch/arm/mach-pxa/littleton.c +++ b/arch/arm/mach-pxa/littleton.c | |||
@@ -37,12 +37,11 @@ | |||
37 | #include <asm/arch/gpio.h> | 37 | #include <asm/arch/gpio.h> |
38 | #include <asm/arch/pxafb.h> | 38 | #include <asm/arch/pxafb.h> |
39 | #include <asm/arch/ssp.h> | 39 | #include <asm/arch/ssp.h> |
40 | #include <asm/arch/pxa27x_keypad.h> | ||
40 | #include <asm/arch/littleton.h> | 41 | #include <asm/arch/littleton.h> |
41 | 42 | ||
42 | #include "generic.h" | 43 | #include "generic.h" |
43 | 44 | ||
44 | #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) | ||
45 | |||
46 | /* Littleton MFP configurations */ | 45 | /* Littleton MFP configurations */ |
47 | static mfp_cfg_t littleton_mfp_cfg[] __initdata = { | 46 | static mfp_cfg_t littleton_mfp_cfg[] __initdata = { |
48 | /* LCD */ | 47 | /* LCD */ |
@@ -76,6 +75,21 @@ static mfp_cfg_t littleton_mfp_cfg[] __initdata = { | |||
76 | 75 | ||
77 | /* Debug Ethernet */ | 76 | /* Debug Ethernet */ |
78 | GPIO90_GPIO, | 77 | GPIO90_GPIO, |
78 | |||
79 | /* Keypad */ | ||
80 | GPIO107_KP_DKIN_0, | ||
81 | GPIO108_KP_DKIN_1, | ||
82 | GPIO115_KP_MKIN_0, | ||
83 | GPIO116_KP_MKIN_1, | ||
84 | GPIO117_KP_MKIN_2, | ||
85 | GPIO118_KP_MKIN_3, | ||
86 | GPIO119_KP_MKIN_4, | ||
87 | GPIO120_KP_MKIN_5, | ||
88 | GPIO121_KP_MKOUT_0, | ||
89 | GPIO122_KP_MKOUT_1, | ||
90 | GPIO123_KP_MKOUT_2, | ||
91 | GPIO124_KP_MKOUT_3, | ||
92 | GPIO125_KP_MKOUT_4, | ||
79 | }; | 93 | }; |
80 | 94 | ||
81 | static struct resource smc91x_resources[] = { | 95 | static struct resource smc91x_resources[] = { |
@@ -300,6 +314,54 @@ static void littleton_init_lcd(void) | |||
300 | static inline void littleton_init_lcd(void) {}; | 314 | static inline void littleton_init_lcd(void) {}; |
301 | #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULES */ | 315 | #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULES */ |
302 | 316 | ||
317 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES) | ||
318 | static unsigned int littleton_matrix_key_map[] = { | ||
319 | /* KEY(row, col, key_code) */ | ||
320 | KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3), | ||
321 | KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7), | ||
322 | KEY(1, 2, KEY_8), KEY(2, 2, KEY_9), | ||
323 | |||
324 | KEY(0, 3, KEY_KPASTERISK), /* * */ | ||
325 | KEY(2, 3, KEY_KPDOT), /* # */ | ||
326 | |||
327 | KEY(5, 4, KEY_ENTER), | ||
328 | |||
329 | KEY(5, 0, KEY_UP), | ||
330 | KEY(5, 1, KEY_DOWN), | ||
331 | KEY(5, 2, KEY_LEFT), | ||
332 | KEY(5, 3, KEY_RIGHT), | ||
333 | KEY(3, 2, KEY_HOME), | ||
334 | KEY(4, 1, KEY_END), | ||
335 | KEY(3, 3, KEY_BACK), | ||
336 | |||
337 | KEY(4, 0, KEY_SEND), | ||
338 | KEY(4, 2, KEY_VOLUMEUP), | ||
339 | KEY(4, 3, KEY_VOLUMEDOWN), | ||
340 | |||
341 | KEY(3, 0, KEY_F22), /* soft1 */ | ||
342 | KEY(3, 1, KEY_F23), /* soft2 */ | ||
343 | }; | ||
344 | |||
345 | static struct pxa27x_keypad_platform_data littleton_keypad_info = { | ||
346 | .matrix_key_rows = 6, | ||
347 | .matrix_key_cols = 5, | ||
348 | .matrix_key_map = littleton_matrix_key_map, | ||
349 | .matrix_key_map_size = ARRAY_SIZE(littleton_matrix_key_map), | ||
350 | |||
351 | .enable_rotary0 = 1, | ||
352 | .rotary0_up_key = KEY_UP, | ||
353 | .rotary0_down_key = KEY_DOWN, | ||
354 | |||
355 | .debounce_interval = 30, | ||
356 | }; | ||
357 | static void __init littleton_init_keypad(void) | ||
358 | { | ||
359 | pxa_set_keypad_info(&littleton_keypad_info); | ||
360 | } | ||
361 | #else | ||
362 | static inline void littleton_init_keypad(void) {} | ||
363 | #endif | ||
364 | |||
303 | static void __init littleton_init(void) | 365 | static void __init littleton_init(void) |
304 | { | 366 | { |
305 | /* initialize MFP configurations */ | 367 | /* initialize MFP configurations */ |
@@ -312,6 +374,7 @@ static void __init littleton_init(void) | |||
312 | platform_device_register(&smc91x_device); | 374 | platform_device_register(&smc91x_device); |
313 | 375 | ||
314 | littleton_init_lcd(); | 376 | littleton_init_lcd(); |
377 | littleton_init_keypad(); | ||
315 | } | 378 | } |
316 | 379 | ||
317 | MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)") | 380 | MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)") |
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c index afa62ffe3ad5..a20e4b1649d6 100644 --- a/arch/arm/mach-pxa/lpd270.c +++ b/arch/arm/mach-pxa/lpd270.c | |||
@@ -39,6 +39,7 @@ | |||
39 | 39 | ||
40 | #include <asm/arch/pxa-regs.h> | 40 | #include <asm/arch/pxa-regs.h> |
41 | #include <asm/arch/pxa2xx-regs.h> | 41 | #include <asm/arch/pxa2xx-regs.h> |
42 | #include <asm/arch/pxa2xx-gpio.h> | ||
42 | #include <asm/arch/lpd270.h> | 43 | #include <asm/arch/lpd270.h> |
43 | #include <asm/arch/audio.h> | 44 | #include <asm/arch/audio.h> |
44 | #include <asm/arch/pxafb.h> | 45 | #include <asm/arch/pxafb.h> |
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index e7ae4bb3e361..ca209c443f34 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c | |||
@@ -42,6 +42,7 @@ | |||
42 | 42 | ||
43 | #include <asm/arch/pxa-regs.h> | 43 | #include <asm/arch/pxa-regs.h> |
44 | #include <asm/arch/pxa2xx-regs.h> | 44 | #include <asm/arch/pxa2xx-regs.h> |
45 | #include <asm/arch/mfp-pxa25x.h> | ||
45 | #include <asm/arch/lubbock.h> | 46 | #include <asm/arch/lubbock.h> |
46 | #include <asm/arch/udc.h> | 47 | #include <asm/arch/udc.h> |
47 | #include <asm/arch/irda.h> | 48 | #include <asm/arch/irda.h> |
@@ -51,6 +52,40 @@ | |||
51 | #include "generic.h" | 52 | #include "generic.h" |
52 | #include "devices.h" | 53 | #include "devices.h" |
53 | 54 | ||
55 | static unsigned long lubbock_pin_config[] __initdata = { | ||
56 | GPIO15_nCS_1, /* CS1 - Flash */ | ||
57 | GPIO79_nCS_3, /* CS3 - SMC ethernet */ | ||
58 | |||
59 | /* SSP data pins */ | ||
60 | GPIO23_SSP1_SCLK, | ||
61 | GPIO25_SSP1_TXD, | ||
62 | GPIO26_SSP1_RXD, | ||
63 | |||
64 | /* BTUART */ | ||
65 | GPIO42_BTUART_RXD, | ||
66 | GPIO43_BTUART_TXD, | ||
67 | GPIO44_BTUART_CTS, | ||
68 | GPIO45_BTUART_RTS, | ||
69 | |||
70 | /* PC Card */ | ||
71 | GPIO48_nPOE, | ||
72 | GPIO49_nPWE, | ||
73 | GPIO50_nPIOR, | ||
74 | GPIO51_nPIOW, | ||
75 | GPIO52_nPCE_1, | ||
76 | GPIO53_nPCE_2, | ||
77 | GPIO54_nPSKTSEL, | ||
78 | GPIO55_nPREG, | ||
79 | GPIO56_nPWAIT, | ||
80 | GPIO57_nIOIS16, | ||
81 | |||
82 | /* MMC */ | ||
83 | GPIO6_MMC_CLK, | ||
84 | GPIO8_MMC_CS0, | ||
85 | |||
86 | /* wakeup */ | ||
87 | GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, | ||
88 | }; | ||
54 | 89 | ||
55 | #define LUB_MISC_WR __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080) | 90 | #define LUB_MISC_WR __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080) |
56 | 91 | ||
@@ -186,26 +221,6 @@ static struct platform_device sa1111_device = { | |||
186 | .resource = sa1111_resources, | 221 | .resource = sa1111_resources, |
187 | }; | 222 | }; |
188 | 223 | ||
189 | static struct resource smc91x_resources[] = { | ||
190 | [0] = { | ||
191 | .name = "smc91x-regs", | ||
192 | .start = 0x0c000c00, | ||
193 | .end = 0x0c0fffff, | ||
194 | .flags = IORESOURCE_MEM, | ||
195 | }, | ||
196 | [1] = { | ||
197 | .start = LUBBOCK_ETH_IRQ, | ||
198 | .end = LUBBOCK_ETH_IRQ, | ||
199 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | ||
200 | }, | ||
201 | [2] = { | ||
202 | .name = "smc91x-attrib", | ||
203 | .start = 0x0e000000, | ||
204 | .end = 0x0e0fffff, | ||
205 | .flags = IORESOURCE_MEM, | ||
206 | }, | ||
207 | }; | ||
208 | |||
209 | /* ADS7846 is connected through SSP ... and if your board has J5 populated, | 224 | /* ADS7846 is connected through SSP ... and if your board has J5 populated, |
210 | * you can select it to replace the ucb1400 by switching the touchscreen cable | 225 | * you can select it to replace the ucb1400 by switching the touchscreen cable |
211 | * (to J5) and poking board registers (as done below). Else it's only useful | 226 | * (to J5) and poking board registers (as done below). Else it's only useful |
@@ -261,6 +276,26 @@ static struct spi_board_info spi_board_info[] __initdata = { { | |||
261 | }, | 276 | }, |
262 | }; | 277 | }; |
263 | 278 | ||
279 | static struct resource smc91x_resources[] = { | ||
280 | [0] = { | ||
281 | .name = "smc91x-regs", | ||
282 | .start = 0x0c000c00, | ||
283 | .end = 0x0c0fffff, | ||
284 | .flags = IORESOURCE_MEM, | ||
285 | }, | ||
286 | [1] = { | ||
287 | .start = LUBBOCK_ETH_IRQ, | ||
288 | .end = LUBBOCK_ETH_IRQ, | ||
289 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | ||
290 | }, | ||
291 | [2] = { | ||
292 | .name = "smc91x-attrib", | ||
293 | .start = 0x0e000000, | ||
294 | .end = 0x0e0fffff, | ||
295 | .flags = IORESOURCE_MEM, | ||
296 | }, | ||
297 | }; | ||
298 | |||
264 | static struct platform_device smc91x_device = { | 299 | static struct platform_device smc91x_device = { |
265 | .name = "smc91x", | 300 | .name = "smc91x", |
266 | .id = -1, | 301 | .id = -1, |
@@ -404,10 +439,6 @@ static int lubbock_mci_init(struct device *dev, | |||
404 | irq_handler_t detect_int, | 439 | irq_handler_t detect_int, |
405 | void *data) | 440 | void *data) |
406 | { | 441 | { |
407 | /* setup GPIO for PXA25x MMC controller */ | ||
408 | pxa_gpio_mode(GPIO6_MMCCLK_MD); | ||
409 | pxa_gpio_mode(GPIO8_MMCCS0_MD); | ||
410 | |||
411 | /* detect card insert/eject */ | 442 | /* detect card insert/eject */ |
412 | mmc_detect_int = detect_int; | 443 | mmc_detect_int = detect_int; |
413 | init_timer(&mmc_timer); | 444 | init_timer(&mmc_timer); |
@@ -457,6 +488,8 @@ static void __init lubbock_init(void) | |||
457 | { | 488 | { |
458 | int flashboot = (LUB_CONF_SWITCHES & 1); | 489 | int flashboot = (LUB_CONF_SWITCHES & 1); |
459 | 490 | ||
491 | pxa2xx_mfp_config(ARRAY_AND_SIZE(lubbock_pin_config)); | ||
492 | |||
460 | pxa_set_udc_info(&udc_info); | 493 | pxa_set_udc_info(&udc_info); |
461 | set_pxa_fb_info(&sharp_lm8v31); | 494 | set_pxa_fb_info(&sharp_lm8v31); |
462 | pxa_set_mci_info(&lubbock_mci_platform_data); | 495 | pxa_set_mci_info(&lubbock_mci_platform_data); |
@@ -489,46 +522,6 @@ static void __init lubbock_map_io(void) | |||
489 | pxa_map_io(); | 522 | pxa_map_io(); |
490 | iotable_init(lubbock_io_desc, ARRAY_SIZE(lubbock_io_desc)); | 523 | iotable_init(lubbock_io_desc, ARRAY_SIZE(lubbock_io_desc)); |
491 | 524 | ||
492 | /* SSP data pins */ | ||
493 | pxa_gpio_mode(GPIO23_SCLK_MD); | ||
494 | pxa_gpio_mode(GPIO25_STXD_MD); | ||
495 | pxa_gpio_mode(GPIO26_SRXD_MD); | ||
496 | |||
497 | /* This enables the BTUART */ | ||
498 | pxa_gpio_mode(GPIO42_BTRXD_MD); | ||
499 | pxa_gpio_mode(GPIO43_BTTXD_MD); | ||
500 | pxa_gpio_mode(GPIO44_BTCTS_MD); | ||
501 | pxa_gpio_mode(GPIO45_BTRTS_MD); | ||
502 | |||
503 | GPSR(GPIO48_nPOE) = | ||
504 | GPIO_bit(GPIO48_nPOE) | | ||
505 | GPIO_bit(GPIO49_nPWE) | | ||
506 | GPIO_bit(GPIO50_nPIOR) | | ||
507 | GPIO_bit(GPIO51_nPIOW) | | ||
508 | GPIO_bit(GPIO52_nPCE_1) | | ||
509 | GPIO_bit(GPIO53_nPCE_2); | ||
510 | |||
511 | pxa_gpio_mode(GPIO48_nPOE_MD); | ||
512 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
513 | pxa_gpio_mode(GPIO50_nPIOR_MD); | ||
514 | pxa_gpio_mode(GPIO51_nPIOW_MD); | ||
515 | pxa_gpio_mode(GPIO52_nPCE_1_MD); | ||
516 | pxa_gpio_mode(GPIO53_nPCE_2_MD); | ||
517 | pxa_gpio_mode(GPIO54_pSKTSEL_MD); | ||
518 | pxa_gpio_mode(GPIO55_nPREG_MD); | ||
519 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | ||
520 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | ||
521 | |||
522 | /* This is for the SMC chip select */ | ||
523 | pxa_gpio_mode(GPIO79_nCS_3_MD); | ||
524 | |||
525 | /* setup sleep mode values */ | ||
526 | PWER = 0x00000002; | ||
527 | PFER = 0x00000000; | ||
528 | PRER = 0x00000002; | ||
529 | PGSR0 = 0x00008000; | ||
530 | PGSR1 = 0x003F0202; | ||
531 | PGSR2 = 0x0001C000; | ||
532 | PCFR |= PCFR_OPDE; | 525 | PCFR |= PCFR_OPDE; |
533 | } | 526 | } |
534 | 527 | ||
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index d98ef7ada2f8..d70be75bd199 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -16,24 +16,106 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/delay.h> | ||
19 | #include <linux/gpio_keys.h> | 20 | #include <linux/gpio_keys.h> |
20 | #include <linux/input.h> | 21 | #include <linux/input.h> |
22 | #include <linux/mfd/htc-egpio.h> | ||
23 | #include <linux/mfd/htc-pasic3.h> | ||
21 | #include <linux/mtd/mtd.h> | 24 | #include <linux/mtd/mtd.h> |
22 | #include <linux/mtd/map.h> | 25 | #include <linux/mtd/map.h> |
23 | #include <linux/mtd/physmap.h> | 26 | #include <linux/mtd/physmap.h> |
27 | #include <linux/pda_power.h> | ||
24 | 28 | ||
25 | #include <asm/gpio.h> | 29 | #include <asm/gpio.h> |
26 | #include <asm/hardware.h> | 30 | #include <asm/hardware.h> |
27 | #include <asm/mach-types.h> | 31 | #include <asm/mach-types.h> |
28 | #include <asm/mach/arch.h> | 32 | #include <asm/mach/arch.h> |
29 | #include <asm/arch/magician.h> | 33 | #include <asm/arch/magician.h> |
34 | #include <asm/arch/mfp-pxa27x.h> | ||
30 | #include <asm/arch/pxa-regs.h> | 35 | #include <asm/arch/pxa-regs.h> |
31 | #include <asm/arch/pxafb.h> | 36 | #include <asm/arch/pxafb.h> |
37 | #include <asm/arch/i2c.h> | ||
38 | #include <asm/arch/mmc.h> | ||
32 | #include <asm/arch/irda.h> | 39 | #include <asm/arch/irda.h> |
33 | #include <asm/arch/ohci.h> | 40 | #include <asm/arch/ohci.h> |
34 | 41 | ||
35 | #include "generic.h" | 42 | #include "generic.h" |
36 | 43 | ||
44 | static unsigned long magician_pin_config[] = { | ||
45 | |||
46 | /* SDRAM and Static Memory I/O Signals */ | ||
47 | GPIO20_nSDCS_2, | ||
48 | GPIO21_nSDCS_3, | ||
49 | GPIO15_nCS_1, | ||
50 | GPIO78_nCS_2, /* PASIC3 */ | ||
51 | GPIO79_nCS_3, /* EGPIO CPLD */ | ||
52 | GPIO80_nCS_4, | ||
53 | GPIO33_nCS_5, | ||
54 | |||
55 | /* I2C */ | ||
56 | GPIO117_I2C_SCL, | ||
57 | GPIO118_I2C_SDA, | ||
58 | |||
59 | /* PWM 0 */ | ||
60 | GPIO16_PWM0_OUT, | ||
61 | |||
62 | /* I2S */ | ||
63 | GPIO28_I2S_BITCLK_OUT, | ||
64 | GPIO29_I2S_SDATA_IN, | ||
65 | GPIO31_I2S_SYNC, | ||
66 | GPIO113_I2S_SYSCLK, | ||
67 | |||
68 | /* SSP 2 */ | ||
69 | GPIO19_SSP2_SCLK, | ||
70 | GPIO14_SSP2_SFRM, | ||
71 | GPIO89_SSP2_TXD, | ||
72 | GPIO88_SSP2_RXD, | ||
73 | |||
74 | /* MMC */ | ||
75 | GPIO32_MMC_CLK, | ||
76 | GPIO92_MMC_DAT_0, | ||
77 | GPIO109_MMC_DAT_1, | ||
78 | GPIO110_MMC_DAT_2, | ||
79 | GPIO111_MMC_DAT_3, | ||
80 | GPIO112_MMC_CMD, | ||
81 | |||
82 | /* LCD */ | ||
83 | GPIO58_LCD_LDD_0, | ||
84 | GPIO59_LCD_LDD_1, | ||
85 | GPIO60_LCD_LDD_2, | ||
86 | GPIO61_LCD_LDD_3, | ||
87 | GPIO62_LCD_LDD_4, | ||
88 | GPIO63_LCD_LDD_5, | ||
89 | GPIO64_LCD_LDD_6, | ||
90 | GPIO65_LCD_LDD_7, | ||
91 | GPIO66_LCD_LDD_8, | ||
92 | GPIO67_LCD_LDD_9, | ||
93 | GPIO68_LCD_LDD_10, | ||
94 | GPIO69_LCD_LDD_11, | ||
95 | GPIO70_LCD_LDD_12, | ||
96 | GPIO71_LCD_LDD_13, | ||
97 | GPIO72_LCD_LDD_14, | ||
98 | GPIO73_LCD_LDD_15, | ||
99 | GPIO74_LCD_FCLK, | ||
100 | GPIO75_LCD_LCLK, | ||
101 | GPIO76_LCD_PCLK, | ||
102 | GPIO77_LCD_BIAS, | ||
103 | |||
104 | /* QCI */ | ||
105 | GPIO12_CIF_DD_7, | ||
106 | GPIO17_CIF_DD_6, | ||
107 | GPIO50_CIF_DD_3, | ||
108 | GPIO51_CIF_DD_2, | ||
109 | GPIO52_CIF_DD_4, | ||
110 | GPIO53_CIF_MCLK, | ||
111 | GPIO54_CIF_PCLK, | ||
112 | GPIO55_CIF_DD_1, | ||
113 | GPIO81_CIF_DD_0, | ||
114 | GPIO82_CIF_DD_5, | ||
115 | GPIO84_CIF_FV, | ||
116 | GPIO85_CIF_LV, | ||
117 | }; | ||
118 | |||
37 | /* | 119 | /* |
38 | * IRDA | 120 | * IRDA |
39 | */ | 121 | */ |
@@ -83,8 +165,64 @@ static struct platform_device gpio_keys = { | |||
83 | .id = -1, | 165 | .id = -1, |
84 | }; | 166 | }; |
85 | 167 | ||
168 | |||
169 | /* | ||
170 | * EGPIO (Xilinx CPLD) | ||
171 | * | ||
172 | * 7 32-bit aligned 8-bit registers: 3x output, 1x irq, 3x input | ||
173 | */ | ||
174 | |||
175 | static struct resource egpio_resources[] = { | ||
176 | [0] = { | ||
177 | .start = PXA_CS3_PHYS, | ||
178 | .end = PXA_CS3_PHYS + 0x20, | ||
179 | .flags = IORESOURCE_MEM, | ||
180 | }, | ||
181 | [1] = { | ||
182 | .start = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), | ||
183 | .end = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), | ||
184 | .flags = IORESOURCE_IRQ, | ||
185 | }, | ||
186 | }; | ||
187 | |||
188 | static struct htc_egpio_chip egpio_chips[] = { | ||
189 | [0] = { | ||
190 | .reg_start = 0, | ||
191 | .gpio_base = MAGICIAN_EGPIO(0, 0), | ||
192 | .num_gpios = 24, | ||
193 | .direction = HTC_EGPIO_OUTPUT, | ||
194 | .initial_values = 0x40, /* EGPIO_MAGICIAN_GSM_RESET */ | ||
195 | }, | ||
196 | [1] = { | ||
197 | .reg_start = 4, | ||
198 | .gpio_base = MAGICIAN_EGPIO(4, 0), | ||
199 | .num_gpios = 24, | ||
200 | .direction = HTC_EGPIO_INPUT, | ||
201 | }, | ||
202 | }; | ||
203 | |||
204 | static struct htc_egpio_platform_data egpio_info = { | ||
205 | .reg_width = 8, | ||
206 | .bus_width = 32, | ||
207 | .irq_base = IRQ_BOARD_START, | ||
208 | .num_irqs = 4, | ||
209 | .ack_register = 3, | ||
210 | .chip = egpio_chips, | ||
211 | .num_chips = ARRAY_SIZE(egpio_chips), | ||
212 | }; | ||
213 | |||
214 | static struct platform_device egpio = { | ||
215 | .name = "htc-egpio", | ||
216 | .id = -1, | ||
217 | .resource = egpio_resources, | ||
218 | .num_resources = ARRAY_SIZE(egpio_resources), | ||
219 | .dev = { | ||
220 | .platform_data = &egpio_info, | ||
221 | }, | ||
222 | }; | ||
223 | |||
86 | /* | 224 | /* |
87 | * LCD - Toppoly TD028STEB1 | 225 | * LCD - Toppoly TD028STEB1 or Samsung LTP280QV |
88 | */ | 226 | */ |
89 | 227 | ||
90 | static struct pxafb_mode_info toppoly_modes[] = { | 228 | static struct pxafb_mode_info toppoly_modes[] = { |
@@ -103,12 +241,99 @@ static struct pxafb_mode_info toppoly_modes[] = { | |||
103 | }, | 241 | }, |
104 | }; | 242 | }; |
105 | 243 | ||
244 | static struct pxafb_mode_info samsung_modes[] = { | ||
245 | { | ||
246 | .pixclock = 96153, | ||
247 | .bpp = 16, | ||
248 | .xres = 240, | ||
249 | .yres = 320, | ||
250 | .hsync_len = 8, | ||
251 | .vsync_len = 4, | ||
252 | .left_margin = 9, | ||
253 | .upper_margin = 4, | ||
254 | .right_margin = 9, | ||
255 | .lower_margin = 4, | ||
256 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
257 | }, | ||
258 | }; | ||
259 | |||
260 | static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si) | ||
261 | { | ||
262 | pr_debug("Toppoly LCD power\n"); | ||
263 | |||
264 | if (on) { | ||
265 | pr_debug("on\n"); | ||
266 | gpio_set_value(EGPIO_MAGICIAN_TOPPOLY_POWER, 1); | ||
267 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); | ||
268 | udelay(2000); | ||
269 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); | ||
270 | udelay(2000); | ||
271 | /* FIXME: enable LCDC here */ | ||
272 | udelay(2000); | ||
273 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); | ||
274 | udelay(2000); | ||
275 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); | ||
276 | } else { | ||
277 | pr_debug("off\n"); | ||
278 | msleep(15); | ||
279 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); | ||
280 | udelay(500); | ||
281 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); | ||
282 | udelay(1000); | ||
283 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); | ||
284 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); | ||
285 | } | ||
286 | } | ||
287 | |||
288 | static void samsung_lcd_power(int on, struct fb_var_screeninfo *si) | ||
289 | { | ||
290 | pr_debug("Samsung LCD power\n"); | ||
291 | |||
292 | if (on) { | ||
293 | pr_debug("on\n"); | ||
294 | if (system_rev < 3) | ||
295 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1); | ||
296 | else | ||
297 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); | ||
298 | mdelay(10); | ||
299 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); | ||
300 | mdelay(10); | ||
301 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); | ||
302 | mdelay(30); | ||
303 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); | ||
304 | mdelay(10); | ||
305 | } else { | ||
306 | pr_debug("off\n"); | ||
307 | mdelay(10); | ||
308 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); | ||
309 | mdelay(30); | ||
310 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); | ||
311 | mdelay(10); | ||
312 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); | ||
313 | mdelay(10); | ||
314 | if (system_rev < 3) | ||
315 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0); | ||
316 | else | ||
317 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); | ||
318 | } | ||
319 | } | ||
320 | |||
106 | static struct pxafb_mach_info toppoly_info = { | 321 | static struct pxafb_mach_info toppoly_info = { |
107 | .modes = toppoly_modes, | 322 | .modes = toppoly_modes, |
108 | .num_modes = 1, | 323 | .num_modes = 1, |
109 | .fixed_modes = 1, | 324 | .fixed_modes = 1, |
110 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, | 325 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, |
111 | .lccr3 = LCCR3_PixRsEdg, | 326 | .lccr3 = LCCR3_PixRsEdg, |
327 | .pxafb_lcd_power = toppoly_lcd_power, | ||
328 | }; | ||
329 | |||
330 | static struct pxafb_mach_info samsung_info = { | ||
331 | .modes = samsung_modes, | ||
332 | .num_modes = 1, | ||
333 | .fixed_modes = 1, | ||
334 | .lccr0 = LCCR0_LDDALT | LCCR0_Color | LCCR0_Sngl | LCCR0_Act, | ||
335 | .lccr3 = LCCR3_PixFlEdg, | ||
336 | .pxafb_lcd_power = samsung_lcd_power, | ||
112 | }; | 337 | }; |
113 | 338 | ||
114 | /* | 339 | /* |
@@ -120,9 +345,18 @@ static void magician_set_bl_intensity(int intensity) | |||
120 | if (intensity) { | 345 | if (intensity) { |
121 | PWM_CTRL0 = 1; | 346 | PWM_CTRL0 = 1; |
122 | PWM_PERVAL0 = 0xc8; | 347 | PWM_PERVAL0 = 0xc8; |
123 | PWM_PWDUTY0 = intensity; | 348 | if (intensity > 0xc7) { |
349 | PWM_PWDUTY0 = intensity - 0x48; | ||
350 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1); | ||
351 | } else { | ||
352 | PWM_PWDUTY0 = intensity; | ||
353 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0); | ||
354 | } | ||
355 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER, 1); | ||
124 | pxa_set_cken(CKEN_PWM0, 1); | 356 | pxa_set_cken(CKEN_PWM0, 1); |
125 | } else { | 357 | } else { |
358 | /* PWM_PWDUTY0 = intensity; */ | ||
359 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER, 0); | ||
126 | pxa_set_cken(CKEN_PWM0, 0); | 360 | pxa_set_cken(CKEN_PWM0, 0); |
127 | } | 361 | } |
128 | } | 362 | } |
@@ -130,18 +364,215 @@ static void magician_set_bl_intensity(int intensity) | |||
130 | static struct generic_bl_info backlight_info = { | 364 | static struct generic_bl_info backlight_info = { |
131 | .default_intensity = 0x64, | 365 | .default_intensity = 0x64, |
132 | .limit_mask = 0x0b, | 366 | .limit_mask = 0x0b, |
133 | .max_intensity = 0xc7, | 367 | .max_intensity = 0xc7+0x48, |
134 | .set_bl_intensity = magician_set_bl_intensity, | 368 | .set_bl_intensity = magician_set_bl_intensity, |
135 | }; | 369 | }; |
136 | 370 | ||
137 | static struct platform_device backlight = { | 371 | static struct platform_device backlight = { |
138 | .name = "corgi-bl", | 372 | .name = "generic-bl", |
139 | .dev = { | 373 | .dev = { |
140 | .platform_data = &backlight_info, | 374 | .platform_data = &backlight_info, |
141 | }, | 375 | }, |
142 | .id = -1, | 376 | .id = -1, |
143 | }; | 377 | }; |
144 | 378 | ||
379 | /* | ||
380 | * LEDs | ||
381 | */ | ||
382 | |||
383 | struct gpio_led gpio_leds[] = { | ||
384 | { | ||
385 | .name = "magician::vibra", | ||
386 | .default_trigger = "none", | ||
387 | .gpio = GPIO22_MAGICIAN_VIBRA_EN, | ||
388 | }, | ||
389 | { | ||
390 | .name = "magician::phone_bl", | ||
391 | .default_trigger = "none", | ||
392 | .gpio = GPIO103_MAGICIAN_LED_KP, | ||
393 | }, | ||
394 | }; | ||
395 | |||
396 | static struct gpio_led_platform_data gpio_led_info = { | ||
397 | .leds = gpio_leds, | ||
398 | .num_leds = ARRAY_SIZE(gpio_leds), | ||
399 | }; | ||
400 | |||
401 | static struct platform_device leds_gpio = { | ||
402 | .name = "leds-gpio", | ||
403 | .id = -1, | ||
404 | .dev = { | ||
405 | .platform_data = &gpio_led_info, | ||
406 | }, | ||
407 | }; | ||
408 | |||
409 | static struct pasic3_led pasic3_leds[] = { | ||
410 | { | ||
411 | .led = { | ||
412 | .name = "magician:red", | ||
413 | .default_trigger = "ds2760-battery.0-charging", | ||
414 | }, | ||
415 | .hw_num = 0, | ||
416 | .bit2 = PASIC3_BIT2_LED0, | ||
417 | .mask = PASIC3_MASK_LED0, | ||
418 | }, | ||
419 | { | ||
420 | .led = { | ||
421 | .name = "magician:green", | ||
422 | .default_trigger = "ds2760-battery.0-charging-or-full", | ||
423 | }, | ||
424 | .hw_num = 1, | ||
425 | .bit2 = PASIC3_BIT2_LED1, | ||
426 | .mask = PASIC3_MASK_LED1, | ||
427 | }, | ||
428 | { | ||
429 | .led = { | ||
430 | .name = "magician:blue", | ||
431 | .default_trigger = "bluetooth", | ||
432 | }, | ||
433 | .hw_num = 2, | ||
434 | .bit2 = PASIC3_BIT2_LED2, | ||
435 | .mask = PASIC3_MASK_LED2, | ||
436 | }, | ||
437 | }; | ||
438 | |||
439 | static struct platform_device pasic3; | ||
440 | |||
441 | static struct pasic3_leds_machinfo __devinit pasic3_leds_info = { | ||
442 | .num_leds = ARRAY_SIZE(pasic3_leds), | ||
443 | .power_gpio = EGPIO_MAGICIAN_LED_POWER, | ||
444 | .leds = pasic3_leds, | ||
445 | }; | ||
446 | |||
447 | /* | ||
448 | * PASIC3 with DS1WM | ||
449 | */ | ||
450 | |||
451 | static struct resource pasic3_resources[] = { | ||
452 | [0] = { | ||
453 | .start = PXA_CS2_PHYS, | ||
454 | .end = PXA_CS2_PHYS + 0x1b, | ||
455 | .flags = IORESOURCE_MEM, | ||
456 | }, | ||
457 | /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */ | ||
458 | [1] = { | ||
459 | .start = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), | ||
460 | .end = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), | ||
461 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | ||
462 | } | ||
463 | }; | ||
464 | |||
465 | static struct pasic3_platform_data pasic3_platform_data = { | ||
466 | .bus_shift = 2, | ||
467 | .led_pdata = &pasic3_leds_info, | ||
468 | .clock_rate = 4000000, | ||
469 | }; | ||
470 | |||
471 | static struct platform_device pasic3 = { | ||
472 | .name = "pasic3", | ||
473 | .id = -1, | ||
474 | .num_resources = ARRAY_SIZE(pasic3_resources), | ||
475 | .resource = pasic3_resources, | ||
476 | .dev = { | ||
477 | .platform_data = &pasic3_platform_data, | ||
478 | }, | ||
479 | }; | ||
480 | |||
481 | /* | ||
482 | * External power | ||
483 | */ | ||
484 | |||
485 | static int magician_is_ac_online(void) | ||
486 | { | ||
487 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC); | ||
488 | } | ||
489 | |||
490 | static int magician_is_usb_online(void) | ||
491 | { | ||
492 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_USB); | ||
493 | } | ||
494 | |||
495 | static void magician_set_charge(int flags) | ||
496 | { | ||
497 | gpio_set_value(GPIO30_MAGICIAN_nCHARGE_EN, !flags); | ||
498 | gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags); | ||
499 | } | ||
500 | |||
501 | static char *magician_supplicants[] = { | ||
502 | "ds2760-battery.0", "backup-battery" | ||
503 | }; | ||
504 | |||
505 | static struct pda_power_pdata power_supply_info = { | ||
506 | .is_ac_online = magician_is_ac_online, | ||
507 | .is_usb_online = magician_is_usb_online, | ||
508 | .set_charge = magician_set_charge, | ||
509 | .supplied_to = magician_supplicants, | ||
510 | .num_supplicants = ARRAY_SIZE(magician_supplicants), | ||
511 | }; | ||
512 | |||
513 | static struct resource power_supply_resources[] = { | ||
514 | [0] = { | ||
515 | .name = "ac", | ||
516 | .flags = IORESOURCE_IRQ, | ||
517 | .start = IRQ_MAGICIAN_AC, | ||
518 | .end = IRQ_MAGICIAN_AC, | ||
519 | }, | ||
520 | [1] = { | ||
521 | .name = "usb", | ||
522 | .flags = IORESOURCE_IRQ, | ||
523 | .start = IRQ_MAGICIAN_AC, | ||
524 | .end = IRQ_MAGICIAN_AC, | ||
525 | }, | ||
526 | }; | ||
527 | |||
528 | static struct platform_device power_supply = { | ||
529 | .name = "pda-power", | ||
530 | .id = -1, | ||
531 | .dev = { | ||
532 | .platform_data = &power_supply_info, | ||
533 | }, | ||
534 | .resource = power_supply_resources, | ||
535 | .num_resources = ARRAY_SIZE(power_supply_resources), | ||
536 | }; | ||
537 | |||
538 | |||
539 | /* | ||
540 | * MMC/SD | ||
541 | */ | ||
542 | |||
543 | static int magician_mci_init(struct device *dev, | ||
544 | irq_handler_t detect_irq, void *data) | ||
545 | { | ||
546 | return request_irq(IRQ_MAGICIAN_SD, detect_irq, | ||
547 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, | ||
548 | "MMC card detect", data); | ||
549 | } | ||
550 | |||
551 | static void magician_mci_setpower(struct device *dev, unsigned int vdd) | ||
552 | { | ||
553 | struct pxamci_platform_data *pdata = dev->platform_data; | ||
554 | |||
555 | gpio_set_value(EGPIO_MAGICIAN_SD_POWER, (1 << vdd) & pdata->ocr_mask); | ||
556 | } | ||
557 | |||
558 | static int magician_mci_get_ro(struct device *dev) | ||
559 | { | ||
560 | return (!gpio_get_value(EGPIO_MAGICIAN_nSD_READONLY)); | ||
561 | } | ||
562 | |||
563 | static void magician_mci_exit(struct device *dev, void *data) | ||
564 | { | ||
565 | free_irq(IRQ_MAGICIAN_SD, data); | ||
566 | } | ||
567 | |||
568 | static struct pxamci_platform_data magician_mci_info = { | ||
569 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | ||
570 | .init = magician_mci_init, | ||
571 | .get_ro = magician_mci_get_ro, | ||
572 | .setpower = magician_mci_setpower, | ||
573 | .exit = magician_mci_exit, | ||
574 | }; | ||
575 | |||
145 | 576 | ||
146 | /* | 577 | /* |
147 | * USB OHCI | 578 | * USB OHCI |
@@ -166,6 +597,11 @@ static struct pxaohci_platform_data magician_ohci_info = { | |||
166 | * StrataFlash | 597 | * StrataFlash |
167 | */ | 598 | */ |
168 | 599 | ||
600 | static void magician_set_vpp(struct map_info *map, int vpp) | ||
601 | { | ||
602 | gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); | ||
603 | } | ||
604 | |||
169 | #define PXA_CS_SIZE 0x04000000 | 605 | #define PXA_CS_SIZE 0x04000000 |
170 | 606 | ||
171 | static struct resource strataflash_resource = { | 607 | static struct resource strataflash_resource = { |
@@ -176,13 +612,14 @@ static struct resource strataflash_resource = { | |||
176 | 612 | ||
177 | static struct physmap_flash_data strataflash_data = { | 613 | static struct physmap_flash_data strataflash_data = { |
178 | .width = 4, | 614 | .width = 4, |
615 | .set_vpp = magician_set_vpp, | ||
179 | }; | 616 | }; |
180 | 617 | ||
181 | static struct platform_device strataflash = { | 618 | static struct platform_device strataflash = { |
182 | .name = "physmap-flash", | 619 | .name = "physmap-flash", |
183 | .id = -1, | 620 | .id = -1, |
184 | .num_resources = 1, | ||
185 | .resource = &strataflash_resource, | 621 | .resource = &strataflash_resource, |
622 | .num_resources = 1, | ||
186 | .dev = { | 623 | .dev = { |
187 | .platform_data = &strataflash_data, | 624 | .platform_data = &strataflash_data, |
188 | }, | 625 | }, |
@@ -194,16 +631,43 @@ static struct platform_device strataflash = { | |||
194 | 631 | ||
195 | static struct platform_device *devices[] __initdata = { | 632 | static struct platform_device *devices[] __initdata = { |
196 | &gpio_keys, | 633 | &gpio_keys, |
634 | &egpio, | ||
197 | &backlight, | 635 | &backlight, |
636 | &pasic3, | ||
637 | &power_supply, | ||
198 | &strataflash, | 638 | &strataflash, |
639 | &leds_gpio, | ||
199 | }; | 640 | }; |
200 | 641 | ||
201 | static void __init magician_init(void) | 642 | static void __init magician_init(void) |
202 | { | 643 | { |
644 | void __iomem *cpld; | ||
645 | int lcd_select; | ||
646 | |||
647 | pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config)); | ||
648 | |||
203 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 649 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
650 | pxa_set_i2c_info(NULL); | ||
651 | pxa_set_mci_info(&magician_mci_info); | ||
204 | pxa_set_ohci_info(&magician_ohci_info); | 652 | pxa_set_ohci_info(&magician_ohci_info); |
205 | pxa_set_ficp_info(&magician_ficp_info); | 653 | pxa_set_ficp_info(&magician_ficp_info); |
206 | set_pxa_fb_info(&toppoly_info); | 654 | |
655 | /* Check LCD type we have */ | ||
656 | cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000); | ||
657 | if (cpld) { | ||
658 | u8 board_id = __raw_readb(cpld+0x14); | ||
659 | system_rev = board_id & 0x7; | ||
660 | lcd_select = board_id & 0x8; | ||
661 | iounmap(cpld); | ||
662 | pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly"); | ||
663 | if (lcd_select && (system_rev < 3)) | ||
664 | pxa_gpio_mode(GPIO75_MAGICIAN_SAMSUNG_POWER_MD); | ||
665 | pxa_gpio_mode(GPIO104_MAGICIAN_LCD_POWER_1_MD); | ||
666 | pxa_gpio_mode(GPIO105_MAGICIAN_LCD_POWER_2_MD); | ||
667 | pxa_gpio_mode(GPIO106_MAGICIAN_LCD_POWER_3_MD); | ||
668 | set_pxa_fb_info(lcd_select ? &samsung_info : &toppoly_info); | ||
669 | } else | ||
670 | pr_err("LCD detection: CPLD mapping failed\n"); | ||
207 | } | 671 | } |
208 | 672 | ||
209 | 673 | ||
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 72a436fb9a29..18d47cfa2a18 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <linux/mtd/mtd.h> | 24 | #include <linux/mtd/mtd.h> |
25 | #include <linux/mtd/partitions.h> | 25 | #include <linux/mtd/partitions.h> |
26 | #include <linux/backlight.h> | 26 | #include <linux/backlight.h> |
27 | #include <linux/input.h> | ||
28 | #include <linux/gpio_keys.h> | ||
27 | 29 | ||
28 | #include <asm/types.h> | 30 | #include <asm/types.h> |
29 | #include <asm/setup.h> | 31 | #include <asm/setup.h> |
@@ -40,16 +42,94 @@ | |||
40 | 42 | ||
41 | #include <asm/arch/pxa-regs.h> | 43 | #include <asm/arch/pxa-regs.h> |
42 | #include <asm/arch/pxa2xx-regs.h> | 44 | #include <asm/arch/pxa2xx-regs.h> |
45 | #include <asm/arch/mfp-pxa27x.h> | ||
43 | #include <asm/arch/mainstone.h> | 46 | #include <asm/arch/mainstone.h> |
44 | #include <asm/arch/audio.h> | 47 | #include <asm/arch/audio.h> |
45 | #include <asm/arch/pxafb.h> | 48 | #include <asm/arch/pxafb.h> |
49 | #include <asm/arch/i2c.h> | ||
46 | #include <asm/arch/mmc.h> | 50 | #include <asm/arch/mmc.h> |
47 | #include <asm/arch/irda.h> | 51 | #include <asm/arch/irda.h> |
48 | #include <asm/arch/ohci.h> | 52 | #include <asm/arch/ohci.h> |
53 | #include <asm/arch/pxa27x_keypad.h> | ||
49 | 54 | ||
50 | #include "generic.h" | 55 | #include "generic.h" |
51 | #include "devices.h" | 56 | #include "devices.h" |
52 | 57 | ||
58 | static unsigned long mainstone_pin_config[] = { | ||
59 | /* Chip Select */ | ||
60 | GPIO15_nCS_1, | ||
61 | |||
62 | /* LCD - 16bpp Active TFT */ | ||
63 | GPIO58_LCD_LDD_0, | ||
64 | GPIO59_LCD_LDD_1, | ||
65 | GPIO60_LCD_LDD_2, | ||
66 | GPIO61_LCD_LDD_3, | ||
67 | GPIO62_LCD_LDD_4, | ||
68 | GPIO63_LCD_LDD_5, | ||
69 | GPIO64_LCD_LDD_6, | ||
70 | GPIO65_LCD_LDD_7, | ||
71 | GPIO66_LCD_LDD_8, | ||
72 | GPIO67_LCD_LDD_9, | ||
73 | GPIO68_LCD_LDD_10, | ||
74 | GPIO69_LCD_LDD_11, | ||
75 | GPIO70_LCD_LDD_12, | ||
76 | GPIO71_LCD_LDD_13, | ||
77 | GPIO72_LCD_LDD_14, | ||
78 | GPIO73_LCD_LDD_15, | ||
79 | GPIO74_LCD_FCLK, | ||
80 | GPIO75_LCD_LCLK, | ||
81 | GPIO76_LCD_PCLK, | ||
82 | GPIO77_LCD_BIAS, | ||
83 | GPIO16_PWM0_OUT, /* Backlight */ | ||
84 | |||
85 | /* MMC */ | ||
86 | GPIO32_MMC_CLK, | ||
87 | GPIO112_MMC_CMD, | ||
88 | GPIO92_MMC_DAT_0, | ||
89 | GPIO109_MMC_DAT_1, | ||
90 | GPIO110_MMC_DAT_2, | ||
91 | GPIO111_MMC_DAT_3, | ||
92 | |||
93 | /* USB Host Port 1 */ | ||
94 | GPIO88_USBH1_PWR, | ||
95 | GPIO89_USBH1_PEN, | ||
96 | |||
97 | /* PC Card */ | ||
98 | GPIO48_nPOE, | ||
99 | GPIO49_nPWE, | ||
100 | GPIO50_nPIOR, | ||
101 | GPIO51_nPIOW, | ||
102 | GPIO85_nPCE_1, | ||
103 | GPIO54_nPCE_2, | ||
104 | GPIO79_PSKTSEL, | ||
105 | GPIO55_nPREG, | ||
106 | GPIO56_nPWAIT, | ||
107 | GPIO57_nIOIS16, | ||
108 | |||
109 | /* AC97 */ | ||
110 | GPIO45_AC97_SYSCLK, | ||
111 | |||
112 | /* Keypad */ | ||
113 | GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, | ||
114 | GPIO94_KP_DKIN_1 | WAKEUP_ON_LEVEL_HIGH, | ||
115 | GPIO95_KP_DKIN_2 | WAKEUP_ON_LEVEL_HIGH, | ||
116 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, | ||
117 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, | ||
118 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, | ||
119 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, | ||
120 | GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH, | ||
121 | GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH, | ||
122 | GPIO103_KP_MKOUT_0, | ||
123 | GPIO104_KP_MKOUT_1, | ||
124 | GPIO105_KP_MKOUT_2, | ||
125 | GPIO106_KP_MKOUT_3, | ||
126 | GPIO107_KP_MKOUT_4, | ||
127 | GPIO108_KP_MKOUT_5, | ||
128 | GPIO96_KP_MKOUT_6, | ||
129 | |||
130 | /* GPIO */ | ||
131 | GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, | ||
132 | }; | ||
53 | 133 | ||
54 | static unsigned long mainstone_irq_enabled; | 134 | static unsigned long mainstone_irq_enabled; |
55 | 135 | ||
@@ -278,13 +358,13 @@ static int mainstone_backlight_update_status(struct backlight_device *bl) | |||
278 | bl->props.fb_blank != FB_BLANK_UNBLANK) | 358 | bl->props.fb_blank != FB_BLANK_UNBLANK) |
279 | brightness = 0; | 359 | brightness = 0; |
280 | 360 | ||
281 | if (brightness != 0) { | 361 | if (brightness != 0) |
282 | pxa_gpio_mode(GPIO16_PWM0_MD); | ||
283 | pxa_set_cken(CKEN_PWM0, 1); | 362 | pxa_set_cken(CKEN_PWM0, 1); |
284 | } | 363 | |
285 | PWM_CTRL0 = 0; | 364 | PWM_CTRL0 = 0; |
286 | PWM_PWDUTY0 = brightness; | 365 | PWM_PWDUTY0 = brightness; |
287 | PWM_PERVAL0 = bl->props.max_brightness; | 366 | PWM_PERVAL0 = bl->props.max_brightness; |
367 | |||
288 | if (brightness == 0) | 368 | if (brightness == 0) |
289 | pxa_set_cken(CKEN_PWM0, 0); | 369 | pxa_set_cken(CKEN_PWM0, 0); |
290 | return 0; /* pointless return value */ | 370 | return 0; /* pointless return value */ |
@@ -362,16 +442,6 @@ static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_in | |||
362 | { | 442 | { |
363 | int err; | 443 | int err; |
364 | 444 | ||
365 | /* | ||
366 | * setup GPIO for PXA27x MMC controller | ||
367 | */ | ||
368 | pxa_gpio_mode(GPIO32_MMCCLK_MD); | ||
369 | pxa_gpio_mode(GPIO112_MMCCMD_MD); | ||
370 | pxa_gpio_mode(GPIO92_MMCDAT0_MD); | ||
371 | pxa_gpio_mode(GPIO109_MMCDAT1_MD); | ||
372 | pxa_gpio_mode(GPIO110_MMCDAT2_MD); | ||
373 | pxa_gpio_mode(GPIO111_MMCDAT3_MD); | ||
374 | |||
375 | /* make sure SD/Memory Stick multiplexer's signals | 445 | /* make sure SD/Memory Stick multiplexer's signals |
376 | * are routed to MMC controller | 446 | * are routed to MMC controller |
377 | */ | 447 | */ |
@@ -434,19 +504,39 @@ static struct pxaficp_platform_data mainstone_ficp_platform_data = { | |||
434 | .transceiver_mode = mainstone_irda_transceiver_mode, | 504 | .transceiver_mode = mainstone_irda_transceiver_mode, |
435 | }; | 505 | }; |
436 | 506 | ||
507 | static struct gpio_keys_button gpio_keys_button[] = { | ||
508 | [0] = { | ||
509 | .desc = "wakeup", | ||
510 | .code = KEY_SUSPEND, | ||
511 | .type = EV_KEY, | ||
512 | .gpio = 1, | ||
513 | .wakeup = 1, | ||
514 | }, | ||
515 | }; | ||
516 | |||
517 | static struct gpio_keys_platform_data mainstone_gpio_keys = { | ||
518 | .buttons = gpio_keys_button, | ||
519 | .nbuttons = 1, | ||
520 | }; | ||
521 | |||
522 | static struct platform_device mst_gpio_keys_device = { | ||
523 | .name = "gpio-keys", | ||
524 | .id = -1, | ||
525 | .dev = { | ||
526 | .platform_data = &mainstone_gpio_keys, | ||
527 | }, | ||
528 | }; | ||
529 | |||
437 | static struct platform_device *platform_devices[] __initdata = { | 530 | static struct platform_device *platform_devices[] __initdata = { |
438 | &smc91x_device, | 531 | &smc91x_device, |
439 | &mst_audio_device, | 532 | &mst_audio_device, |
440 | &mst_flash_device[0], | 533 | &mst_flash_device[0], |
441 | &mst_flash_device[1], | 534 | &mst_flash_device[1], |
535 | &mst_gpio_keys_device, | ||
442 | }; | 536 | }; |
443 | 537 | ||
444 | static int mainstone_ohci_init(struct device *dev) | 538 | static int mainstone_ohci_init(struct device *dev) |
445 | { | 539 | { |
446 | /* setup Port1 GPIO pin. */ | ||
447 | pxa_gpio_mode( 88 | GPIO_ALT_FN_1_IN); /* USBHPWR1 */ | ||
448 | pxa_gpio_mode( 89 | GPIO_ALT_FN_2_OUT); /* USBHPEN1 */ | ||
449 | |||
450 | /* Set the Power Control Polarity Low and Power Sense | 540 | /* Set the Power Control Polarity Low and Power Sense |
451 | Polarity Low to active low. */ | 541 | Polarity Low to active low. */ |
452 | UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) & | 542 | UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) & |
@@ -460,10 +550,63 @@ static struct pxaohci_platform_data mainstone_ohci_platform_data = { | |||
460 | .init = mainstone_ohci_init, | 550 | .init = mainstone_ohci_init, |
461 | }; | 551 | }; |
462 | 552 | ||
553 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES) | ||
554 | static unsigned int mainstone_matrix_keys[] = { | ||
555 | KEY(0, 0, KEY_A), KEY(1, 0, KEY_B), KEY(2, 0, KEY_C), | ||
556 | KEY(3, 0, KEY_D), KEY(4, 0, KEY_E), KEY(5, 0, KEY_F), | ||
557 | KEY(0, 1, KEY_G), KEY(1, 1, KEY_H), KEY(2, 1, KEY_I), | ||
558 | KEY(3, 1, KEY_J), KEY(4, 1, KEY_K), KEY(5, 1, KEY_L), | ||
559 | KEY(0, 2, KEY_M), KEY(1, 2, KEY_N), KEY(2, 2, KEY_O), | ||
560 | KEY(3, 2, KEY_P), KEY(4, 2, KEY_Q), KEY(5, 2, KEY_R), | ||
561 | KEY(0, 3, KEY_S), KEY(1, 3, KEY_T), KEY(2, 3, KEY_U), | ||
562 | KEY(3, 3, KEY_V), KEY(4, 3, KEY_W), KEY(5, 3, KEY_X), | ||
563 | KEY(2, 4, KEY_Y), KEY(3, 4, KEY_Z), | ||
564 | |||
565 | KEY(0, 4, KEY_DOT), /* . */ | ||
566 | KEY(1, 4, KEY_CLOSE), /* @ */ | ||
567 | KEY(4, 4, KEY_SLASH), | ||
568 | KEY(5, 4, KEY_BACKSLASH), | ||
569 | KEY(0, 5, KEY_HOME), | ||
570 | KEY(1, 5, KEY_LEFTSHIFT), | ||
571 | KEY(2, 5, KEY_SPACE), | ||
572 | KEY(3, 5, KEY_SPACE), | ||
573 | KEY(4, 5, KEY_ENTER), | ||
574 | KEY(5, 5, KEY_BACKSPACE), | ||
575 | |||
576 | KEY(0, 6, KEY_UP), | ||
577 | KEY(1, 6, KEY_DOWN), | ||
578 | KEY(2, 6, KEY_LEFT), | ||
579 | KEY(3, 6, KEY_RIGHT), | ||
580 | KEY(4, 6, KEY_SELECT), | ||
581 | }; | ||
582 | |||
583 | struct pxa27x_keypad_platform_data mainstone_keypad_info = { | ||
584 | .matrix_key_rows = 6, | ||
585 | .matrix_key_cols = 7, | ||
586 | .matrix_key_map = mainstone_matrix_keys, | ||
587 | .matrix_key_map_size = ARRAY_SIZE(mainstone_matrix_keys), | ||
588 | |||
589 | .enable_rotary0 = 1, | ||
590 | .rotary0_up_key = KEY_UP, | ||
591 | .rotary0_down_key = KEY_DOWN, | ||
592 | |||
593 | .debounce_interval = 30, | ||
594 | }; | ||
595 | |||
596 | static void __init mainstone_init_keypad(void) | ||
597 | { | ||
598 | pxa_set_keypad_info(&mainstone_keypad_info); | ||
599 | } | ||
600 | #else | ||
601 | static inline void mainstone_init_keypad(void) {} | ||
602 | #endif | ||
603 | |||
463 | static void __init mainstone_init(void) | 604 | static void __init mainstone_init(void) |
464 | { | 605 | { |
465 | int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */ | 606 | int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */ |
466 | 607 | ||
608 | pxa2xx_mfp_config(ARRAY_AND_SIZE(mainstone_pin_config)); | ||
609 | |||
467 | mst_flash_data[0].width = (BOOT_DEF & 1) ? 2 : 4; | 610 | mst_flash_data[0].width = (BOOT_DEF & 1) ? 2 : 4; |
468 | mst_flash_data[1].width = 4; | 611 | mst_flash_data[1].width = 4; |
469 | 612 | ||
@@ -480,31 +623,6 @@ static void __init mainstone_init(void) | |||
480 | */ | 623 | */ |
481 | ARB_CNTRL = ARB_CORE_PARK | 0x234; | 624 | ARB_CNTRL = ARB_CORE_PARK | 0x234; |
482 | 625 | ||
483 | /* | ||
484 | * On Mainstone, we route AC97_SYSCLK via GPIO45 to | ||
485 | * the audio daughter card | ||
486 | */ | ||
487 | pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD); | ||
488 | |||
489 | GPSR(GPIO48_nPOE) = | ||
490 | GPIO_bit(GPIO48_nPOE) | | ||
491 | GPIO_bit(GPIO49_nPWE) | | ||
492 | GPIO_bit(GPIO50_nPIOR) | | ||
493 | GPIO_bit(GPIO51_nPIOW) | | ||
494 | GPIO_bit(GPIO85_nPCE_1) | | ||
495 | GPIO_bit(GPIO54_nPCE_2); | ||
496 | |||
497 | pxa_gpio_mode(GPIO48_nPOE_MD); | ||
498 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
499 | pxa_gpio_mode(GPIO50_nPIOR_MD); | ||
500 | pxa_gpio_mode(GPIO51_nPIOW_MD); | ||
501 | pxa_gpio_mode(GPIO85_nPCE_1_MD); | ||
502 | pxa_gpio_mode(GPIO54_nPCE_2_MD); | ||
503 | pxa_gpio_mode(GPIO79_pSKTSEL_MD); | ||
504 | pxa_gpio_mode(GPIO55_nPREG_MD); | ||
505 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | ||
506 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | ||
507 | |||
508 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 626 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
509 | 627 | ||
510 | /* reading Mainstone's "Virtual Configuration Register" | 628 | /* reading Mainstone's "Virtual Configuration Register" |
@@ -520,6 +638,9 @@ static void __init mainstone_init(void) | |||
520 | pxa_set_mci_info(&mainstone_mci_platform_data); | 638 | pxa_set_mci_info(&mainstone_mci_platform_data); |
521 | pxa_set_ficp_info(&mainstone_ficp_platform_data); | 639 | pxa_set_ficp_info(&mainstone_ficp_platform_data); |
522 | pxa_set_ohci_info(&mainstone_ohci_platform_data); | 640 | pxa_set_ohci_info(&mainstone_ohci_platform_data); |
641 | pxa_set_i2c_info(NULL); | ||
642 | |||
643 | mainstone_init_keypad(); | ||
523 | } | 644 | } |
524 | 645 | ||
525 | 646 | ||
@@ -537,23 +658,9 @@ static void __init mainstone_map_io(void) | |||
537 | pxa_map_io(); | 658 | pxa_map_io(); |
538 | iotable_init(mainstone_io_desc, ARRAY_SIZE(mainstone_io_desc)); | 659 | iotable_init(mainstone_io_desc, ARRAY_SIZE(mainstone_io_desc)); |
539 | 660 | ||
540 | /* initialize sleep mode regs (wake-up sources, etc) */ | ||
541 | PGSR0 = 0x00008800; | ||
542 | PGSR1 = 0x00000002; | ||
543 | PGSR2 = 0x0001FC00; | ||
544 | PGSR3 = 0x00001F81; | ||
545 | PWER = 0xC0000002; | ||
546 | PRER = 0x00000002; | ||
547 | PFER = 0x00000002; | ||
548 | /* for use I SRAM as framebuffer. */ | 661 | /* for use I SRAM as framebuffer. */ |
549 | PSLR |= 0xF04; | 662 | PSLR |= 0xF04; |
550 | PCFR = 0x66; | 663 | PCFR = 0x66; |
551 | /* For Keypad wakeup. */ | ||
552 | KPC &=~KPC_ASACT; | ||
553 | KPC |=KPC_AS; | ||
554 | PKWR = 0x000FD000; | ||
555 | /* Need read PKWR back after set it. */ | ||
556 | PKWR; | ||
557 | } | 664 | } |
558 | 665 | ||
559 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") | 666 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") |
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c new file mode 100644 index 000000000000..22097a1707cc --- /dev/null +++ b/arch/arm/mach-pxa/mfp-pxa2xx.c | |||
@@ -0,0 +1,245 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/mfp-pxa2xx.c | ||
3 | * | ||
4 | * PXA2xx pin mux configuration support | ||
5 | * | ||
6 | * The GPIOs on PXA2xx can be configured as one of many alternate | ||
7 | * functions, this is by concept samilar to the MFP configuration | ||
8 | * on PXA3xx, what's more important, the low power pin state and | ||
9 | * wakeup detection are also supported by the same framework. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | #include <linux/module.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/sysdev.h> | ||
20 | |||
21 | #include <asm/arch/hardware.h> | ||
22 | #include <asm/arch/pxa-regs.h> | ||
23 | #include <asm/arch/mfp-pxa2xx.h> | ||
24 | |||
25 | #include "generic.h" | ||
26 | |||
27 | #define PGSR(x) __REG2(0x40F00020, ((x) & 0x60) >> 3) | ||
28 | |||
29 | #define PWER_WE35 (1 << 24) | ||
30 | |||
31 | struct gpio_desc { | ||
32 | unsigned valid : 1; | ||
33 | unsigned can_wakeup : 1; | ||
34 | unsigned keypad_gpio : 1; | ||
35 | unsigned int mask; /* bit mask in PWER or PKWR */ | ||
36 | unsigned long config; | ||
37 | }; | ||
38 | |||
39 | static struct gpio_desc gpio_desc[MFP_PIN_GPIO127 + 1]; | ||
40 | |||
41 | static int __mfp_config_gpio(unsigned gpio, unsigned long c) | ||
42 | { | ||
43 | unsigned long gafr, mask = GPIO_bit(gpio); | ||
44 | int fn; | ||
45 | |||
46 | fn = MFP_AF(c); | ||
47 | if (fn > 3) | ||
48 | return -EINVAL; | ||
49 | |||
50 | /* alternate function and direction */ | ||
51 | gafr = GAFR(gpio) & ~(0x3 << ((gpio & 0xf) * 2)); | ||
52 | GAFR(gpio) = gafr | (fn << ((gpio & 0xf) * 2)); | ||
53 | |||
54 | if (c & MFP_DIR_OUT) | ||
55 | GPDR(gpio) |= mask; | ||
56 | else | ||
57 | GPDR(gpio) &= ~mask; | ||
58 | |||
59 | /* low power state */ | ||
60 | switch (c & MFP_LPM_STATE_MASK) { | ||
61 | case MFP_LPM_DRIVE_HIGH: | ||
62 | PGSR(gpio) |= mask; | ||
63 | break; | ||
64 | case MFP_LPM_DRIVE_LOW: | ||
65 | PGSR(gpio) &= ~mask; | ||
66 | break; | ||
67 | case MFP_LPM_INPUT: | ||
68 | break; | ||
69 | default: | ||
70 | pr_warning("%s: invalid low power state for GPIO%d\n", | ||
71 | __func__, gpio); | ||
72 | return -EINVAL; | ||
73 | } | ||
74 | |||
75 | /* give early warning if MFP_LPM_CAN_WAKEUP is set on the | ||
76 | * configurations of those pins not able to wakeup | ||
77 | */ | ||
78 | if ((c & MFP_LPM_CAN_WAKEUP) && !gpio_desc[gpio].can_wakeup) { | ||
79 | pr_warning("%s: GPIO%d unable to wakeup\n", | ||
80 | __func__, gpio); | ||
81 | return -EINVAL; | ||
82 | } | ||
83 | |||
84 | if ((c & MFP_LPM_CAN_WAKEUP) && (c & MFP_DIR_OUT)) { | ||
85 | pr_warning("%s: output GPIO%d unable to wakeup\n", | ||
86 | __func__, gpio); | ||
87 | return -EINVAL; | ||
88 | } | ||
89 | |||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num) | ||
94 | { | ||
95 | unsigned long flags; | ||
96 | unsigned long *c; | ||
97 | int i, gpio; | ||
98 | |||
99 | for (i = 0, c = mfp_cfgs; i < num; i++, c++) { | ||
100 | |||
101 | gpio = mfp_to_gpio(MFP_PIN(*c)); | ||
102 | |||
103 | if (!gpio_desc[gpio].valid) { | ||
104 | pr_warning("%s: GPIO%d is invalid pin\n", | ||
105 | __func__, gpio); | ||
106 | continue; | ||
107 | } | ||
108 | |||
109 | local_irq_save(flags); | ||
110 | |||
111 | gpio_desc[gpio].config = *c; | ||
112 | __mfp_config_gpio(gpio, *c); | ||
113 | |||
114 | local_irq_restore(flags); | ||
115 | } | ||
116 | } | ||
117 | |||
118 | int gpio_set_wake(unsigned int gpio, unsigned int on) | ||
119 | { | ||
120 | struct gpio_desc *d; | ||
121 | unsigned long c; | ||
122 | |||
123 | if (gpio > mfp_to_gpio(MFP_PIN_GPIO127)) | ||
124 | return -EINVAL; | ||
125 | |||
126 | d = &gpio_desc[gpio]; | ||
127 | c = d->config; | ||
128 | |||
129 | if (!d->valid) | ||
130 | return -EINVAL; | ||
131 | |||
132 | if (d->keypad_gpio) | ||
133 | return -EINVAL; | ||
134 | |||
135 | if (d->can_wakeup && (c & MFP_LPM_CAN_WAKEUP)) { | ||
136 | if (on) { | ||
137 | PWER |= d->mask; | ||
138 | |||
139 | if (c & MFP_LPM_EDGE_RISE) | ||
140 | PRER |= d->mask; | ||
141 | else | ||
142 | PRER &= ~d->mask; | ||
143 | |||
144 | if (c & MFP_LPM_EDGE_FALL) | ||
145 | PFER |= d->mask; | ||
146 | else | ||
147 | PFER &= ~d->mask; | ||
148 | } else { | ||
149 | PWER &= ~d->mask; | ||
150 | PRER &= ~d->mask; | ||
151 | PFER &= ~d->mask; | ||
152 | } | ||
153 | } | ||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | #ifdef CONFIG_PXA25x | ||
158 | static int __init pxa25x_mfp_init(void) | ||
159 | { | ||
160 | int i; | ||
161 | |||
162 | if (cpu_is_pxa25x()) { | ||
163 | for (i = 0; i <= 84; i++) | ||
164 | gpio_desc[i].valid = 1; | ||
165 | |||
166 | for (i = 0; i <= 15; i++) { | ||
167 | gpio_desc[i].can_wakeup = 1; | ||
168 | gpio_desc[i].mask = GPIO_bit(i); | ||
169 | } | ||
170 | } | ||
171 | |||
172 | return 0; | ||
173 | } | ||
174 | postcore_initcall(pxa25x_mfp_init); | ||
175 | #endif /* CONFIG_PXA25x */ | ||
176 | |||
177 | #ifdef CONFIG_PXA27x | ||
178 | static int pxa27x_pkwr_gpio[] = { | ||
179 | 13, 16, 17, 34, 36, 37, 38, 39, 90, 91, 93, 94, | ||
180 | 95, 96, 97, 98, 99, 100, 101, 102 | ||
181 | }; | ||
182 | |||
183 | int keypad_set_wake(unsigned int on) | ||
184 | { | ||
185 | unsigned int i, gpio, mask = 0; | ||
186 | |||
187 | if (!on) { | ||
188 | PKWR = 0; | ||
189 | return 0; | ||
190 | } | ||
191 | |||
192 | for (i = 0; i < ARRAY_SIZE(pxa27x_pkwr_gpio); i++) { | ||
193 | |||
194 | gpio = pxa27x_pkwr_gpio[i]; | ||
195 | |||
196 | if (gpio_desc[gpio].config & MFP_LPM_CAN_WAKEUP) | ||
197 | mask |= gpio_desc[gpio].mask; | ||
198 | } | ||
199 | |||
200 | PKWR = mask; | ||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static int __init pxa27x_mfp_init(void) | ||
205 | { | ||
206 | int i, gpio; | ||
207 | |||
208 | if (cpu_is_pxa27x()) { | ||
209 | for (i = 0; i <= 120; i++) { | ||
210 | /* skip GPIO2, 5, 6, 7, 8, they are not | ||
211 | * valid pins allow configuration | ||
212 | */ | ||
213 | if (i == 2 || i == 5 || i == 6 || | ||
214 | i == 7 || i == 8) | ||
215 | continue; | ||
216 | |||
217 | gpio_desc[i].valid = 1; | ||
218 | } | ||
219 | |||
220 | /* Keypad GPIOs */ | ||
221 | for (i = 0; i < ARRAY_SIZE(pxa27x_pkwr_gpio); i++) { | ||
222 | gpio = pxa27x_pkwr_gpio[i]; | ||
223 | gpio_desc[gpio].can_wakeup = 1; | ||
224 | gpio_desc[gpio].keypad_gpio = 1; | ||
225 | gpio_desc[gpio].mask = 1 << i; | ||
226 | } | ||
227 | |||
228 | /* Overwrite GPIO13 as a PWER wakeup source */ | ||
229 | for (i = 0; i <= 15; i++) { | ||
230 | /* skip GPIO2, 5, 6, 7, 8 */ | ||
231 | if (GPIO_bit(i) & 0x1e4) | ||
232 | continue; | ||
233 | |||
234 | gpio_desc[i].can_wakeup = 1; | ||
235 | gpio_desc[i].mask = GPIO_bit(i); | ||
236 | } | ||
237 | |||
238 | gpio_desc[35].can_wakeup = 1; | ||
239 | gpio_desc[35].mask = PWER_WE35; | ||
240 | } | ||
241 | |||
242 | return 0; | ||
243 | } | ||
244 | postcore_initcall(pxa27x_mfp_init); | ||
245 | #endif /* CONFIG_PXA27x */ | ||
diff --git a/arch/arm/mach-pxa/mfp.c b/arch/arm/mach-pxa/mfp-pxa3xx.c index f5809adce298..b84c3ba7a8d6 100644 --- a/arch/arm/mach-pxa/mfp.c +++ b/arch/arm/mach-pxa/mfp-pxa3xx.c | |||
@@ -234,22 +234,22 @@ static int pxa3xx_mfp_resume(struct sys_device *d) | |||
234 | 234 | ||
235 | return 0; | 235 | return 0; |
236 | } | 236 | } |
237 | #else | ||
238 | #define pxa3xx_mfp_suspend NULL | ||
239 | #define pxa3xx_mfp_resume NULL | ||
240 | #endif | ||
237 | 241 | ||
238 | static struct sysdev_class mfp_sysclass = { | 242 | struct sysdev_class pxa3xx_mfp_sysclass = { |
239 | .name = "mfp", | 243 | .name = "mfp", |
240 | .suspend = pxa3xx_mfp_suspend, | 244 | .suspend = pxa3xx_mfp_suspend, |
241 | .resume = pxa3xx_mfp_resume, | 245 | .resume = pxa3xx_mfp_resume, |
242 | }; | 246 | }; |
243 | 247 | ||
244 | static struct sys_device mfp_device = { | ||
245 | .id = 0, | ||
246 | .cls = &mfp_sysclass, | ||
247 | }; | ||
248 | |||
249 | static int __init mfp_init_devicefs(void) | 248 | static int __init mfp_init_devicefs(void) |
250 | { | 249 | { |
251 | sysdev_class_register(&mfp_sysclass); | 250 | if (cpu_is_pxa3xx()) |
252 | return sysdev_register(&mfp_device); | 251 | return sysdev_class_register(&pxa3xx_mfp_sysclass); |
252 | |||
253 | return 0; | ||
253 | } | 254 | } |
254 | device_initcall(mfp_init_devicefs); | 255 | postcore_initcall(mfp_init_devicefs); |
255 | #endif | ||
diff --git a/arch/arm/mach-pxa/pcm027.c b/arch/arm/mach-pxa/pcm027.c index c14696b9979d..3b945eb0aee3 100644 --- a/arch/arm/mach-pxa/pcm027.c +++ b/arch/arm/mach-pxa/pcm027.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <asm/mach/arch.h> | 29 | #include <asm/mach/arch.h> |
30 | #include <asm/arch/hardware.h> | 30 | #include <asm/arch/hardware.h> |
31 | #include <asm/arch/pxa-regs.h> | 31 | #include <asm/arch/pxa-regs.h> |
32 | #include <asm/arch/pxa2xx-gpio.h> | ||
32 | #include <asm/arch/pxa2xx-regs.h> | 33 | #include <asm/arch/pxa2xx-regs.h> |
33 | #include <asm/arch/pxa2xx_spi.h> | 34 | #include <asm/arch/pxa2xx_spi.h> |
34 | #include <asm/arch/pcm027.h> | 35 | #include <asm/arch/pcm027.h> |
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c index 3dda16a20049..e6be9d0aeccf 100644 --- a/arch/arm/mach-pxa/pcm990-baseboard.c +++ b/arch/arm/mach-pxa/pcm990-baseboard.c | |||
@@ -23,8 +23,16 @@ | |||
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/ide.h> | 25 | #include <linux/ide.h> |
26 | #include <linux/i2c.h> | ||
27 | |||
28 | #include <media/soc_camera.h> | ||
29 | |||
30 | #include <asm/gpio.h> | ||
31 | #include <asm/arch/i2c.h> | ||
32 | #include <asm/arch/camera.h> | ||
26 | #include <asm/mach/map.h> | 33 | #include <asm/mach/map.h> |
27 | #include <asm/arch/pxa-regs.h> | 34 | #include <asm/arch/pxa-regs.h> |
35 | #include <asm/arch/pxa2xx-gpio.h> | ||
28 | #include <asm/arch/mmc.h> | 36 | #include <asm/arch/mmc.h> |
29 | #include <asm/arch/ohci.h> | 37 | #include <asm/arch/ohci.h> |
30 | #include <asm/arch/pcm990_baseboard.h> | 38 | #include <asm/arch/pcm990_baseboard.h> |
@@ -258,6 +266,76 @@ static struct pxaohci_platform_data pcm990_ohci_platform_data = { | |||
258 | }; | 266 | }; |
259 | 267 | ||
260 | /* | 268 | /* |
269 | * PXA27x Camera specific stuff | ||
270 | */ | ||
271 | #if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE) | ||
272 | static int pcm990_pxacamera_init(struct device *dev) | ||
273 | { | ||
274 | pxa_gpio_mode(GPIO98_CIF_DD_0_MD); | ||
275 | pxa_gpio_mode(GPIO105_CIF_DD_1_MD); | ||
276 | pxa_gpio_mode(GPIO104_CIF_DD_2_MD); | ||
277 | pxa_gpio_mode(GPIO103_CIF_DD_3_MD); | ||
278 | pxa_gpio_mode(GPIO95_CIF_DD_4_MD); | ||
279 | pxa_gpio_mode(GPIO94_CIF_DD_5_MD); | ||
280 | pxa_gpio_mode(GPIO93_CIF_DD_6_MD); | ||
281 | pxa_gpio_mode(GPIO108_CIF_DD_7_MD); | ||
282 | pxa_gpio_mode(GPIO107_CIF_DD_8_MD); | ||
283 | pxa_gpio_mode(GPIO106_CIF_DD_9_MD); | ||
284 | pxa_gpio_mode(GPIO42_CIF_MCLK_MD); | ||
285 | pxa_gpio_mode(GPIO45_CIF_PCLK_MD); | ||
286 | pxa_gpio_mode(GPIO43_CIF_FV_MD); | ||
287 | pxa_gpio_mode(GPIO44_CIF_LV_MD); | ||
288 | |||
289 | return 0; | ||
290 | } | ||
291 | |||
292 | /* | ||
293 | * CICR4: PCLK_EN: Pixel clock is supplied by the sensor | ||
294 | * MCLK_EN: Master clock is generated by PXA | ||
295 | * PCP: Data sampled on the falling edge of pixel clock | ||
296 | */ | ||
297 | struct pxacamera_platform_data pcm990_pxacamera_platform_data = { | ||
298 | .init = pcm990_pxacamera_init, | ||
299 | .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | PXA_CAMERA_DATAWIDTH_10 | | ||
300 | PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN/* | PXA_CAMERA_PCP*/, | ||
301 | .mclk_10khz = 1000, | ||
302 | }; | ||
303 | |||
304 | #include <linux/i2c/pca953x.h> | ||
305 | |||
306 | static struct pca953x_platform_data pca9536_data = { | ||
307 | .gpio_base = NR_BUILTIN_GPIO + 1, | ||
308 | }; | ||
309 | |||
310 | static struct soc_camera_link iclink[] = { | ||
311 | { | ||
312 | .bus_id = 0, /* Must match with the camera ID above */ | ||
313 | .gpio = NR_BUILTIN_GPIO + 1, | ||
314 | }, { | ||
315 | .bus_id = 0, /* Must match with the camera ID above */ | ||
316 | } | ||
317 | }; | ||
318 | |||
319 | /* Board I2C devices. */ | ||
320 | static struct i2c_board_info __initdata pcm990_i2c_devices[] = { | ||
321 | { | ||
322 | /* Must initialize before the camera(s) */ | ||
323 | I2C_BOARD_INFO("pca953x", 0x41), | ||
324 | .type = "pca9536", | ||
325 | .platform_data = &pca9536_data, | ||
326 | }, { | ||
327 | I2C_BOARD_INFO("mt9v022", 0x48), | ||
328 | .type = "mt9v022", | ||
329 | .platform_data = &iclink[0], /* With extender */ | ||
330 | }, { | ||
331 | I2C_BOARD_INFO("mt9m001", 0x5d), | ||
332 | .type = "mt9m001", | ||
333 | .platform_data = &iclink[0], /* With extender */ | ||
334 | }, | ||
335 | }; | ||
336 | #endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */ | ||
337 | |||
338 | /* | ||
261 | * AC97 support | 339 | * AC97 support |
262 | * Note: The connected AC97 mixer also reports interrupts at PCM990_AC97_IRQ | 340 | * Note: The connected AC97 mixer also reports interrupts at PCM990_AC97_IRQ |
263 | */ | 341 | */ |
@@ -326,5 +404,14 @@ void __init pcm990_baseboard_init(void) | |||
326 | /* USB host */ | 404 | /* USB host */ |
327 | pxa_set_ohci_info(&pcm990_ohci_platform_data); | 405 | pxa_set_ohci_info(&pcm990_ohci_platform_data); |
328 | 406 | ||
407 | pxa_set_i2c_info(NULL); | ||
408 | |||
409 | #if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE) | ||
410 | pxa_set_camera_info(&pcm990_pxacamera_platform_data); | ||
411 | |||
412 | i2c_register_board_info(0, pcm990_i2c_devices, | ||
413 | ARRAY_SIZE(pcm990_i2c_devices)); | ||
414 | #endif | ||
415 | |||
329 | printk(KERN_INFO"PCM-990 Evaluation baseboard initialized\n"); | 416 | printk(KERN_INFO"PCM-990 Evaluation baseboard initialized\n"); |
330 | } | 417 | } |
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 209eabf0ed3e..ca5ac196b47b 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/mach/irq.h> | 32 | #include <asm/mach/irq.h> |
33 | 33 | ||
34 | #include <asm/arch/pxa-regs.h> | 34 | #include <asm/arch/pxa-regs.h> |
35 | #include <asm/arch/pxa2xx-gpio.h> | ||
35 | #include <asm/arch/mmc.h> | 36 | #include <asm/arch/mmc.h> |
36 | #include <asm/arch/udc.h> | 37 | #include <asm/arch/udc.h> |
37 | #include <asm/arch/irda.h> | 38 | #include <asm/arch/irda.h> |
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index 599e53fcc2c5..d9b5450aee5b 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/hardware.h> | 26 | #include <asm/hardware.h> |
27 | #include <asm/arch/irqs.h> | 27 | #include <asm/arch/irqs.h> |
28 | #include <asm/arch/pxa-regs.h> | 28 | #include <asm/arch/pxa-regs.h> |
29 | #include <asm/arch/mfp-pxa25x.h> | ||
29 | #include <asm/arch/pm.h> | 30 | #include <asm/arch/pm.h> |
30 | #include <asm/arch/dma.h> | 31 | #include <asm/arch/dma.h> |
31 | 32 | ||
@@ -129,6 +130,8 @@ static struct clk pxa25x_clks[] = { | |||
129 | INIT_CKEN("SSPCLK", NSSP, 3686400, 0, &pxa25x_device_nssp.dev), | 130 | INIT_CKEN("SSPCLK", NSSP, 3686400, 0, &pxa25x_device_nssp.dev), |
130 | INIT_CKEN("SSPCLK", ASSP, 3686400, 0, &pxa25x_device_assp.dev), | 131 | INIT_CKEN("SSPCLK", ASSP, 3686400, 0, &pxa25x_device_assp.dev), |
131 | 132 | ||
133 | INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL), | ||
134 | |||
132 | /* | 135 | /* |
133 | INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL), | 136 | INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL), |
134 | INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL), | 137 | INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL), |
@@ -228,24 +231,10 @@ static inline void pxa25x_init_pm(void) {} | |||
228 | static int pxa25x_set_wake(unsigned int irq, unsigned int on) | 231 | static int pxa25x_set_wake(unsigned int irq, unsigned int on) |
229 | { | 232 | { |
230 | int gpio = IRQ_TO_GPIO(irq); | 233 | int gpio = IRQ_TO_GPIO(irq); |
231 | uint32_t gpio_bit, mask = 0; | 234 | uint32_t mask = 0; |
232 | 235 | ||
233 | if (gpio >= 0 && gpio <= 15) { | 236 | if (gpio >= 0 && gpio < 85) |
234 | gpio_bit = GPIO_bit(gpio); | 237 | return gpio_set_wake(gpio, on); |
235 | mask = gpio_bit; | ||
236 | if (on) { | ||
237 | if (GRER(gpio) | gpio_bit) | ||
238 | PRER |= gpio_bit; | ||
239 | else | ||
240 | PRER &= ~gpio_bit; | ||
241 | |||
242 | if (GFER(gpio) | gpio_bit) | ||
243 | PFER |= gpio_bit; | ||
244 | else | ||
245 | PFER &= ~gpio_bit; | ||
246 | } | ||
247 | goto set_pwer; | ||
248 | } | ||
249 | 238 | ||
250 | if (irq == IRQ_RTCAlrm) { | 239 | if (irq == IRQ_RTCAlrm) { |
251 | mask = PWER_RTC; | 240 | mask = PWER_RTC; |
@@ -265,9 +254,8 @@ set_pwer: | |||
265 | 254 | ||
266 | void __init pxa25x_init_irq(void) | 255 | void __init pxa25x_init_irq(void) |
267 | { | 256 | { |
268 | pxa_init_irq_low(); | 257 | pxa_init_irq(32, pxa25x_set_wake); |
269 | pxa_init_irq_gpio(85); | 258 | pxa_init_gpio(85, pxa25x_set_wake); |
270 | pxa_init_irq_set_wake(pxa25x_set_wake); | ||
271 | } | 259 | } |
272 | 260 | ||
273 | static struct platform_device *pxa25x_devices[] __initdata = { | 261 | static struct platform_device *pxa25x_devices[] __initdata = { |
@@ -325,4 +313,4 @@ static int __init pxa25x_init(void) | |||
325 | return ret; | 313 | return ret; |
326 | } | 314 | } |
327 | 315 | ||
328 | subsys_initcall(pxa25x_init); | 316 | postcore_initcall(pxa25x_init); |
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index 46a951c3e5a0..7a2449dd0fd4 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <asm/arch/irqs.h> | 23 | #include <asm/arch/irqs.h> |
24 | #include <asm/arch/pxa-regs.h> | 24 | #include <asm/arch/pxa-regs.h> |
25 | #include <asm/arch/pxa2xx-regs.h> | 25 | #include <asm/arch/pxa2xx-regs.h> |
26 | #include <asm/arch/mfp-pxa27x.h> | ||
26 | #include <asm/arch/ohci.h> | 27 | #include <asm/arch/ohci.h> |
27 | #include <asm/arch/pm.h> | 28 | #include <asm/arch/pm.h> |
28 | #include <asm/arch/dma.h> | 29 | #include <asm/arch/dma.h> |
@@ -151,12 +152,15 @@ static struct clk pxa27x_clks[] = { | |||
151 | 152 | ||
152 | INIT_CKEN("USBCLK", USBHOST, 48000000, 0, &pxa27x_device_ohci.dev), | 153 | INIT_CKEN("USBCLK", USBHOST, 48000000, 0, &pxa27x_device_ohci.dev), |
153 | INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev), | 154 | INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev), |
154 | INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, NULL), | 155 | INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev), |
155 | 156 | ||
156 | INIT_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev), | 157 | INIT_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev), |
157 | INIT_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), | 158 | INIT_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), |
158 | INIT_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), | 159 | INIT_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), |
159 | 160 | ||
161 | INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL), | ||
162 | INIT_CKEN("AC97CONFCLK", AC97CONF, 24576000, 0, NULL), | ||
163 | |||
160 | /* | 164 | /* |
161 | INIT_CKEN("PWMCLK", PWM0, 13000000, 0, NULL), | 165 | INIT_CKEN("PWMCLK", PWM0, 13000000, 0, NULL), |
162 | INIT_CKEN("MSLCLK", MSL, 48000000, 0, NULL), | 166 | INIT_CKEN("MSLCLK", MSL, 48000000, 0, NULL), |
@@ -283,37 +287,16 @@ static inline void pxa27x_init_pm(void) {} | |||
283 | /* PXA27x: Various gpios can issue wakeup events. This logic only | 287 | /* PXA27x: Various gpios can issue wakeup events. This logic only |
284 | * handles the simple cases, not the WEMUX2 and WEMUX3 options | 288 | * handles the simple cases, not the WEMUX2 and WEMUX3 options |
285 | */ | 289 | */ |
286 | #define PXA27x_GPIO_NOWAKE_MASK \ | ||
287 | ((1 << 8) | (1 << 7) | (1 << 6) | (1 << 5) | (1 << 2)) | ||
288 | #define WAKEMASK(gpio) \ | ||
289 | (((gpio) <= 15) \ | ||
290 | ? ((1 << (gpio)) & ~PXA27x_GPIO_NOWAKE_MASK) \ | ||
291 | : ((gpio == 35) ? (1 << 24) : 0)) | ||
292 | |||
293 | static int pxa27x_set_wake(unsigned int irq, unsigned int on) | 290 | static int pxa27x_set_wake(unsigned int irq, unsigned int on) |
294 | { | 291 | { |
295 | int gpio = IRQ_TO_GPIO(irq); | 292 | int gpio = IRQ_TO_GPIO(irq); |
296 | uint32_t mask; | 293 | uint32_t mask; |
297 | 294 | ||
298 | if ((gpio >= 0 && gpio <= 15) || (gpio == 35)) { | 295 | if (gpio >= 0 && gpio < 128) |
299 | if (WAKEMASK(gpio) == 0) | 296 | return gpio_set_wake(gpio, on); |
300 | return -EINVAL; | ||
301 | |||
302 | mask = WAKEMASK(gpio); | ||
303 | |||
304 | if (on) { | ||
305 | if (GRER(gpio) | GPIO_bit(gpio)) | ||
306 | PRER |= mask; | ||
307 | else | ||
308 | PRER &= ~mask; | ||
309 | 297 | ||
310 | if (GFER(gpio) | GPIO_bit(gpio)) | 298 | if (irq == IRQ_KEYPAD) |
311 | PFER |= mask; | 299 | return keypad_set_wake(on); |
312 | else | ||
313 | PFER &= ~mask; | ||
314 | } | ||
315 | goto set_pwer; | ||
316 | } | ||
317 | 300 | ||
318 | switch (irq) { | 301 | switch (irq) { |
319 | case IRQ_RTCAlrm: | 302 | case IRQ_RTCAlrm: |
@@ -326,7 +309,6 @@ static int pxa27x_set_wake(unsigned int irq, unsigned int on) | |||
326 | return -EINVAL; | 309 | return -EINVAL; |
327 | } | 310 | } |
328 | 311 | ||
329 | set_pwer: | ||
330 | if (on) | 312 | if (on) |
331 | PWER |= mask; | 313 | PWER |= mask; |
332 | else | 314 | else |
@@ -337,10 +319,8 @@ set_pwer: | |||
337 | 319 | ||
338 | void __init pxa27x_init_irq(void) | 320 | void __init pxa27x_init_irq(void) |
339 | { | 321 | { |
340 | pxa_init_irq_low(); | 322 | pxa_init_irq(34, pxa27x_set_wake); |
341 | pxa_init_irq_high(); | 323 | pxa_init_gpio(128, pxa27x_set_wake); |
342 | pxa_init_irq_gpio(128); | ||
343 | pxa_init_irq_set_wake(pxa27x_set_wake); | ||
344 | } | 324 | } |
345 | 325 | ||
346 | /* | 326 | /* |
@@ -386,10 +366,6 @@ static struct platform_device *devices[] __initdata = { | |||
386 | 366 | ||
387 | static struct sys_device pxa27x_sysdev[] = { | 367 | static struct sys_device pxa27x_sysdev[] = { |
388 | { | 368 | { |
389 | .id = 0, | ||
390 | .cls = &pxa_irq_sysclass, | ||
391 | }, { | ||
392 | .id = 1, | ||
393 | .cls = &pxa_irq_sysclass, | 369 | .cls = &pxa_irq_sysclass, |
394 | }, { | 370 | }, { |
395 | .cls = &pxa_gpio_sysclass, | 371 | .cls = &pxa_gpio_sysclass, |
@@ -420,4 +396,4 @@ static int __init pxa27x_init(void) | |||
420 | return ret; | 396 | return ret; |
421 | } | 397 | } |
422 | 398 | ||
423 | subsys_initcall(pxa27x_init); | 399 | postcore_initcall(pxa27x_init); |
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 35f25fdaeba3..dde355e88fa1 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c | |||
@@ -110,6 +110,25 @@ unsigned int pxa3xx_get_memclk_frequency_10khz(void) | |||
110 | } | 110 | } |
111 | 111 | ||
112 | /* | 112 | /* |
113 | * Return the current AC97 clock frequency. | ||
114 | */ | ||
115 | static unsigned long clk_pxa3xx_ac97_getrate(struct clk *clk) | ||
116 | { | ||
117 | unsigned long rate = 312000000; | ||
118 | unsigned long ac97_div; | ||
119 | |||
120 | ac97_div = AC97_DIV; | ||
121 | |||
122 | /* This may loose precision for some rates but won't for the | ||
123 | * standard 24.576MHz. | ||
124 | */ | ||
125 | rate /= (ac97_div >> 12) & 0x7fff; | ||
126 | rate *= (ac97_div & 0xfff); | ||
127 | |||
128 | return rate; | ||
129 | } | ||
130 | |||
131 | /* | ||
113 | * Return the current HSIO bus clock frequency | 132 | * Return the current HSIO bus clock frequency |
114 | */ | 133 | */ |
115 | static unsigned long clk_pxa3xx_hsio_getrate(struct clk *clk) | 134 | static unsigned long clk_pxa3xx_hsio_getrate(struct clk *clk) |
@@ -156,6 +175,27 @@ static const struct clkops clk_pxa3xx_hsio_ops = { | |||
156 | .getrate = clk_pxa3xx_hsio_getrate, | 175 | .getrate = clk_pxa3xx_hsio_getrate, |
157 | }; | 176 | }; |
158 | 177 | ||
178 | static const struct clkops clk_pxa3xx_ac97_ops = { | ||
179 | .enable = clk_pxa3xx_cken_enable, | ||
180 | .disable = clk_pxa3xx_cken_disable, | ||
181 | .getrate = clk_pxa3xx_ac97_getrate, | ||
182 | }; | ||
183 | |||
184 | static void clk_pout_enable(struct clk *clk) | ||
185 | { | ||
186 | OSCC |= OSCC_PEN; | ||
187 | } | ||
188 | |||
189 | static void clk_pout_disable(struct clk *clk) | ||
190 | { | ||
191 | OSCC &= ~OSCC_PEN; | ||
192 | } | ||
193 | |||
194 | static const struct clkops clk_pout_ops = { | ||
195 | .enable = clk_pout_enable, | ||
196 | .disable = clk_pout_disable, | ||
197 | }; | ||
198 | |||
159 | #define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \ | 199 | #define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \ |
160 | { \ | 200 | { \ |
161 | .name = _name, \ | 201 | .name = _name, \ |
@@ -175,8 +215,16 @@ static const struct clkops clk_pxa3xx_hsio_ops = { | |||
175 | } | 215 | } |
176 | 216 | ||
177 | static struct clk pxa3xx_clks[] = { | 217 | static struct clk pxa3xx_clks[] = { |
178 | PXA3xx_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev), | 218 | { |
179 | PXA3xx_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL), | 219 | .name = "CLK_POUT", |
220 | .ops = &clk_pout_ops, | ||
221 | .rate = 13000000, | ||
222 | .delay = 70, | ||
223 | }, | ||
224 | |||
225 | PXA3xx_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev), | ||
226 | PXA3xx_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL), | ||
227 | PXA3xx_CK("AC97CLK", AC97, &clk_pxa3xx_ac97_ops, NULL), | ||
180 | 228 | ||
181 | PXA3xx_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev), | 229 | PXA3xx_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev), |
182 | PXA3xx_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev), | 230 | PXA3xx_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev), |
@@ -185,6 +233,7 @@ static struct clk pxa3xx_clks[] = { | |||
185 | PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), | 233 | PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), |
186 | PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev), | 234 | PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev), |
187 | PXA3xx_CKEN("USBCLK", USBH, 48000000, 0, &pxa27x_device_ohci.dev), | 235 | PXA3xx_CKEN("USBCLK", USBH, 48000000, 0, &pxa27x_device_ohci.dev), |
236 | PXA3xx_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev), | ||
188 | 237 | ||
189 | PXA3xx_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev), | 238 | PXA3xx_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev), |
190 | PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), | 239 | PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), |
@@ -305,8 +354,10 @@ static void pxa3xx_cpu_pm_enter(suspend_state_t state) | |||
305 | /* | 354 | /* |
306 | * Don't sleep if no wakeup sources are defined | 355 | * Don't sleep if no wakeup sources are defined |
307 | */ | 356 | */ |
308 | if (wakeup_src == 0) | 357 | if (wakeup_src == 0) { |
358 | printk(KERN_ERR "Not suspending: no wakeup sources\n"); | ||
309 | return; | 359 | return; |
360 | } | ||
310 | 361 | ||
311 | switch (state) { | 362 | switch (state) { |
312 | case PM_SUSPEND_STANDBY: | 363 | case PM_SUSPEND_STANDBY: |
@@ -446,15 +497,9 @@ static int pxa3xx_set_wake(unsigned int irq, unsigned int on) | |||
446 | 497 | ||
447 | return 0; | 498 | return 0; |
448 | } | 499 | } |
449 | |||
450 | static void pxa3xx_init_irq_pm(void) | ||
451 | { | ||
452 | pxa_init_irq_set_wake(pxa3xx_set_wake); | ||
453 | } | ||
454 | |||
455 | #else | 500 | #else |
456 | static inline void pxa3xx_init_pm(void) {} | 501 | static inline void pxa3xx_init_pm(void) {} |
457 | static inline void pxa3xx_init_irq_pm(void) {} | 502 | #define pxa3xx_set_wake NULL |
458 | #endif | 503 | #endif |
459 | 504 | ||
460 | void __init pxa3xx_init_irq(void) | 505 | void __init pxa3xx_init_irq(void) |
@@ -465,10 +510,8 @@ void __init pxa3xx_init_irq(void) | |||
465 | value |= (1 << 6); | 510 | value |= (1 << 6); |
466 | __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value)); | 511 | __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value)); |
467 | 512 | ||
468 | pxa_init_irq_low(); | 513 | pxa_init_irq(56, pxa3xx_set_wake); |
469 | pxa_init_irq_high(); | 514 | pxa_init_gpio(128, NULL); |
470 | pxa_init_irq_gpio(128); | ||
471 | pxa3xx_init_irq_pm(); | ||
472 | } | 515 | } |
473 | 516 | ||
474 | /* | 517 | /* |
@@ -490,11 +533,9 @@ static struct platform_device *devices[] __initdata = { | |||
490 | 533 | ||
491 | static struct sys_device pxa3xx_sysdev[] = { | 534 | static struct sys_device pxa3xx_sysdev[] = { |
492 | { | 535 | { |
493 | .id = 0, | ||
494 | .cls = &pxa_irq_sysclass, | 536 | .cls = &pxa_irq_sysclass, |
495 | }, { | 537 | }, { |
496 | .id = 1, | 538 | .cls = &pxa3xx_mfp_sysclass, |
497 | .cls = &pxa_irq_sysclass, | ||
498 | }, { | 539 | }, { |
499 | .cls = &pxa_gpio_sysclass, | 540 | .cls = &pxa_gpio_sysclass, |
500 | }, | 541 | }, |
@@ -532,4 +573,4 @@ static int __init pxa3xx_init(void) | |||
532 | return ret; | 573 | return ret; |
533 | } | 574 | } |
534 | 575 | ||
535 | subsys_initcall(pxa3xx_init); | 576 | postcore_initcall(pxa3xx_init); |
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c index f9d1b61e1185..34cd585075b0 100644 --- a/arch/arm/mach-pxa/sharpsl_pm.c +++ b/arch/arm/mach-pxa/sharpsl_pm.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/mach-types.h> | 26 | #include <asm/mach-types.h> |
27 | #include <asm/arch/pm.h> | 27 | #include <asm/arch/pm.h> |
28 | #include <asm/arch/pxa-regs.h> | 28 | #include <asm/arch/pxa-regs.h> |
29 | #include <asm/arch/pxa2xx-gpio.h> | ||
29 | #include <asm/arch/sharpsl.h> | 30 | #include <asm/arch/sharpsl.h> |
30 | #include "sharpsl.h" | 31 | #include "sharpsl.h" |
31 | 32 | ||
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 9e7773fca01c..62a02c3927c5 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -37,6 +37,7 @@ | |||
37 | 37 | ||
38 | #include <asm/arch/pxa-regs.h> | 38 | #include <asm/arch/pxa-regs.h> |
39 | #include <asm/arch/pxa2xx-regs.h> | 39 | #include <asm/arch/pxa2xx-regs.h> |
40 | #include <asm/arch/pxa2xx-gpio.h> | ||
40 | #include <asm/arch/irda.h> | 41 | #include <asm/arch/irda.h> |
41 | #include <asm/arch/mmc.h> | 42 | #include <asm/arch/mmc.h> |
42 | #include <asm/arch/ohci.h> | 43 | #include <asm/arch/ohci.h> |
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c index 745a4dc7acdd..7a7f5f947cc5 100644 --- a/arch/arm/mach-pxa/spitz_pm.c +++ b/arch/arm/mach-pxa/spitz_pm.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/arch/sharpsl.h> | 26 | #include <asm/arch/sharpsl.h> |
27 | #include <asm/arch/spitz.h> | 27 | #include <asm/arch/spitz.h> |
28 | #include <asm/arch/pxa-regs.h> | 28 | #include <asm/arch/pxa-regs.h> |
29 | #include <asm/arch/pxa2xx-gpio.h> | ||
29 | #include "sharpsl.h" | 30 | #include "sharpsl.h" |
30 | 31 | ||
31 | #define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */ | 32 | #define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */ |
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index f99112d50b41..6458f6d371d9 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/gpio_keys.h> | 24 | #include <linux/gpio_keys.h> |
25 | #include <linux/input.h> | 25 | #include <linux/input.h> |
26 | #include <linux/gpio.h> | ||
26 | 27 | ||
27 | #include <asm/setup.h> | 28 | #include <asm/setup.h> |
28 | #include <asm/memory.h> | 29 | #include <asm/memory.h> |
@@ -32,7 +33,9 @@ | |||
32 | #include <asm/system.h> | 33 | #include <asm/system.h> |
33 | #include <asm/arch/pxa-regs.h> | 34 | #include <asm/arch/pxa-regs.h> |
34 | #include <asm/arch/pxa2xx-regs.h> | 35 | #include <asm/arch/pxa2xx-regs.h> |
36 | #include <asm/arch/mfp-pxa25x.h> | ||
35 | #include <asm/arch/irda.h> | 37 | #include <asm/arch/irda.h> |
38 | #include <asm/arch/i2c.h> | ||
36 | #include <asm/arch/mmc.h> | 39 | #include <asm/arch/mmc.h> |
37 | #include <asm/arch/udc.h> | 40 | #include <asm/arch/udc.h> |
38 | 41 | ||
@@ -47,6 +50,110 @@ | |||
47 | #include "generic.h" | 50 | #include "generic.h" |
48 | #include "devices.h" | 51 | #include "devices.h" |
49 | 52 | ||
53 | static unsigned long tosa_pin_config[] = { | ||
54 | GPIO78_nCS_2, /* Scoop */ | ||
55 | GPIO80_nCS_4, /* tg6393xb */ | ||
56 | GPIO33_nCS_5, /* Scoop */ | ||
57 | |||
58 | // GPIO76 CARD_VCC_ON1 | ||
59 | |||
60 | GPIO19_GPIO, /* Reset out */ | ||
61 | GPIO1_RST | WAKEUP_ON_EDGE_FALL, | ||
62 | |||
63 | GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* WAKE_UP */ | ||
64 | GPIO2_GPIO | WAKEUP_ON_EDGE_BOTH, /* AC_IN */ | ||
65 | GPIO3_GPIO | WAKEUP_ON_EDGE_FALL, /* RECORD */ | ||
66 | GPIO4_GPIO | WAKEUP_ON_EDGE_FALL, /* SYNC */ | ||
67 | GPIO20_GPIO, /* EAR_IN */ | ||
68 | GPIO22_GPIO, /* On */ | ||
69 | |||
70 | GPIO5_GPIO, /* USB_IN */ | ||
71 | GPIO32_GPIO, /* Pen IRQ */ | ||
72 | |||
73 | GPIO7_GPIO, /* Jacket Detect */ | ||
74 | GPIO14_GPIO, /* BAT0_CRG */ | ||
75 | GPIO12_GPIO, /* BAT1_CRG */ | ||
76 | GPIO17_GPIO, /* BAT0_LOW */ | ||
77 | GPIO84_GPIO, /* BAT1_LOW */ | ||
78 | GPIO38_GPIO, /* BAT_LOCK */ | ||
79 | |||
80 | GPIO11_3_6MHz, | ||
81 | GPIO15_GPIO, /* TC6393XB IRQ */ | ||
82 | GPIO18_RDY, | ||
83 | GPIO27_GPIO, /* LCD Sync */ | ||
84 | |||
85 | /* MMC */ | ||
86 | GPIO6_MMC_CLK, | ||
87 | GPIO8_MMC_CS0, | ||
88 | GPIO9_GPIO, /* Detect */ | ||
89 | // GPIO10 nSD_INT | ||
90 | |||
91 | /* CF */ | ||
92 | GPIO13_GPIO, /* CD_IRQ */ | ||
93 | GPIO21_GPIO, /* Main Slot IRQ */ | ||
94 | GPIO36_GPIO, /* Jacket Slot IRQ */ | ||
95 | GPIO48_nPOE, | ||
96 | GPIO49_nPWE, | ||
97 | GPIO50_nPIOR, | ||
98 | GPIO51_nPIOW, | ||
99 | GPIO52_nPCE_1, | ||
100 | GPIO53_nPCE_2, | ||
101 | GPIO54_nPSKTSEL, | ||
102 | GPIO55_nPREG, | ||
103 | GPIO56_nPWAIT, | ||
104 | GPIO57_nIOIS16, | ||
105 | |||
106 | /* AC97 */ | ||
107 | GPIO31_AC97_SYNC, | ||
108 | GPIO30_AC97_SDATA_OUT, | ||
109 | GPIO28_AC97_BITCLK, | ||
110 | GPIO29_AC97_SDATA_IN_0, | ||
111 | // GPIO79 nAUD_IRQ | ||
112 | |||
113 | /* FFUART */ | ||
114 | GPIO34_FFUART_RXD, | ||
115 | GPIO35_FFUART_CTS, | ||
116 | GPIO37_FFUART_DSR, | ||
117 | GPIO39_FFUART_TXD, | ||
118 | GPIO40_FFUART_DTR, | ||
119 | GPIO41_FFUART_RTS, | ||
120 | |||
121 | /* BTUART */ | ||
122 | GPIO42_BTUART_RXD, | ||
123 | GPIO43_BTUART_TXD, | ||
124 | GPIO44_BTUART_CTS, | ||
125 | GPIO45_BTUART_RTS, | ||
126 | |||
127 | /* IrDA */ | ||
128 | GPIO46_STUART_RXD, | ||
129 | GPIO47_STUART_TXD, | ||
130 | |||
131 | /* Keybd */ | ||
132 | GPIO58_GPIO, | ||
133 | GPIO59_GPIO, | ||
134 | GPIO60_GPIO, | ||
135 | GPIO61_GPIO, | ||
136 | GPIO62_GPIO, | ||
137 | GPIO63_GPIO, | ||
138 | GPIO64_GPIO, | ||
139 | GPIO65_GPIO, | ||
140 | GPIO66_GPIO, | ||
141 | GPIO67_GPIO, | ||
142 | GPIO68_GPIO, | ||
143 | GPIO69_GPIO, | ||
144 | GPIO70_GPIO, | ||
145 | GPIO71_GPIO, | ||
146 | GPIO72_GPIO, | ||
147 | GPIO73_GPIO, | ||
148 | GPIO74_GPIO, | ||
149 | GPIO75_GPIO, | ||
150 | |||
151 | /* SPI */ | ||
152 | GPIO81_SSP2_CLK_OUT, | ||
153 | GPIO82_SSP2_FRM_OUT, | ||
154 | GPIO83_SSP2_TXD, | ||
155 | }; | ||
156 | |||
50 | /* | 157 | /* |
51 | * SCOOP Device | 158 | * SCOOP Device |
52 | */ | 159 | */ |
@@ -60,11 +167,10 @@ static struct resource tosa_scoop_resources[] = { | |||
60 | 167 | ||
61 | static struct scoop_config tosa_scoop_setup = { | 168 | static struct scoop_config tosa_scoop_setup = { |
62 | .io_dir = TOSA_SCOOP_IO_DIR, | 169 | .io_dir = TOSA_SCOOP_IO_DIR, |
63 | .io_out = TOSA_SCOOP_IO_OUT, | 170 | .gpio_base = TOSA_SCOOP_GPIO_BASE, |
64 | |||
65 | }; | 171 | }; |
66 | 172 | ||
67 | struct platform_device tosascoop_device = { | 173 | static struct platform_device tosascoop_device = { |
68 | .name = "sharp-scoop", | 174 | .name = "sharp-scoop", |
69 | .id = 0, | 175 | .id = 0, |
70 | .dev = { | 176 | .dev = { |
@@ -88,10 +194,10 @@ static struct resource tosa_scoop_jc_resources[] = { | |||
88 | 194 | ||
89 | static struct scoop_config tosa_scoop_jc_setup = { | 195 | static struct scoop_config tosa_scoop_jc_setup = { |
90 | .io_dir = TOSA_SCOOP_JC_IO_DIR, | 196 | .io_dir = TOSA_SCOOP_JC_IO_DIR, |
91 | .io_out = TOSA_SCOOP_JC_IO_OUT, | 197 | .gpio_base = TOSA_SCOOP_JC_GPIO_BASE, |
92 | }; | 198 | }; |
93 | 199 | ||
94 | struct platform_device tosascoop_jc_device = { | 200 | static struct platform_device tosascoop_jc_device = { |
95 | .name = "sharp-scoop", | 201 | .name = "sharp-scoop", |
96 | .id = 1, | 202 | .id = 1, |
97 | .dev = { | 203 | .dev = { |
@@ -118,50 +224,16 @@ static struct scoop_pcmcia_dev tosa_pcmcia_scoop[] = { | |||
118 | }, | 224 | }, |
119 | }; | 225 | }; |
120 | 226 | ||
121 | static void tosa_pcmcia_init(void) | ||
122 | { | ||
123 | /* Setup default state of GPIO outputs | ||
124 | before we enable them as outputs. */ | ||
125 | GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) | | ||
126 | GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) | | ||
127 | GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO52_nPCE_1) | | ||
128 | GPIO_bit(GPIO53_nPCE_2); | ||
129 | |||
130 | pxa_gpio_mode(GPIO48_nPOE_MD); | ||
131 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
132 | pxa_gpio_mode(GPIO50_nPIOR_MD); | ||
133 | pxa_gpio_mode(GPIO51_nPIOW_MD); | ||
134 | pxa_gpio_mode(GPIO55_nPREG_MD); | ||
135 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | ||
136 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | ||
137 | pxa_gpio_mode(GPIO52_nPCE_1_MD); | ||
138 | pxa_gpio_mode(GPIO53_nPCE_2_MD); | ||
139 | pxa_gpio_mode(GPIO54_pSKTSEL_MD); | ||
140 | } | ||
141 | |||
142 | static struct scoop_pcmcia_config tosa_pcmcia_config = { | 227 | static struct scoop_pcmcia_config tosa_pcmcia_config = { |
143 | .devs = &tosa_pcmcia_scoop[0], | 228 | .devs = &tosa_pcmcia_scoop[0], |
144 | .num_devs = 2, | 229 | .num_devs = 2, |
145 | .pcmcia_init = tosa_pcmcia_init, | ||
146 | }; | 230 | }; |
147 | 231 | ||
148 | /* | 232 | /* |
149 | * USB Device Controller | 233 | * USB Device Controller |
150 | */ | 234 | */ |
151 | static void tosa_udc_command(int cmd) | ||
152 | { | ||
153 | switch(cmd) { | ||
154 | case PXA2XX_UDC_CMD_CONNECT: | ||
155 | set_scoop_gpio(&tosascoop_jc_device.dev,TOSA_SCOOP_JC_USB_PULLUP); | ||
156 | break; | ||
157 | case PXA2XX_UDC_CMD_DISCONNECT: | ||
158 | reset_scoop_gpio(&tosascoop_jc_device.dev,TOSA_SCOOP_JC_USB_PULLUP); | ||
159 | break; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | static struct pxa2xx_udc_mach_info udc_info __initdata = { | 235 | static struct pxa2xx_udc_mach_info udc_info __initdata = { |
164 | .udc_command = tosa_udc_command, | 236 | .gpio_pullup = TOSA_GPIO_USB_PULLUP, |
165 | .gpio_vbus = TOSA_GPIO_USB_IN, | 237 | .gpio_vbus = TOSA_GPIO_USB_IN, |
166 | .gpio_vbus_inverted = 1, | 238 | .gpio_vbus_inverted = 1, |
167 | }; | 239 | }; |
@@ -175,19 +247,44 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void | |||
175 | { | 247 | { |
176 | int err; | 248 | int err; |
177 | 249 | ||
178 | /* setup GPIO for PXA25x MMC controller */ | ||
179 | pxa_gpio_mode(GPIO6_MMCCLK_MD); | ||
180 | pxa_gpio_mode(GPIO8_MMCCS0_MD); | ||
181 | pxa_gpio_mode(TOSA_GPIO_nSD_DETECT | GPIO_IN); | ||
182 | |||
183 | tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250); | 250 | tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250); |
184 | 251 | ||
185 | err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, | 252 | err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, |
186 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 253 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
187 | "MMC/SD card detect", data); | 254 | "MMC/SD card detect", data); |
188 | if (err) | 255 | if (err) { |
189 | printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); | 256 | printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); |
257 | goto err_irq; | ||
258 | } | ||
190 | 259 | ||
260 | err = gpio_request(TOSA_GPIO_SD_WP, "sd_wp"); | ||
261 | if (err) { | ||
262 | printk(KERN_ERR "tosa_mci_init: can't request SD_WP gpio\n"); | ||
263 | goto err_gpio_wp; | ||
264 | } | ||
265 | err = gpio_direction_input(TOSA_GPIO_SD_WP); | ||
266 | if (err) | ||
267 | goto err_gpio_wp_dir; | ||
268 | |||
269 | err = gpio_request(TOSA_GPIO_PWR_ON, "sd_pwr"); | ||
270 | if (err) { | ||
271 | printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n"); | ||
272 | goto err_gpio_pwr; | ||
273 | } | ||
274 | err = gpio_direction_output(TOSA_GPIO_PWR_ON, 0); | ||
275 | if (err) | ||
276 | goto err_gpio_pwr_dir; | ||
277 | |||
278 | return 0; | ||
279 | |||
280 | err_gpio_pwr_dir: | ||
281 | gpio_free(TOSA_GPIO_PWR_ON); | ||
282 | err_gpio_pwr: | ||
283 | err_gpio_wp_dir: | ||
284 | gpio_free(TOSA_GPIO_SD_WP); | ||
285 | err_gpio_wp: | ||
286 | free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); | ||
287 | err_irq: | ||
191 | return err; | 288 | return err; |
192 | } | 289 | } |
193 | 290 | ||
@@ -196,19 +293,21 @@ static void tosa_mci_setpower(struct device *dev, unsigned int vdd) | |||
196 | struct pxamci_platform_data* p_d = dev->platform_data; | 293 | struct pxamci_platform_data* p_d = dev->platform_data; |
197 | 294 | ||
198 | if (( 1 << vdd) & p_d->ocr_mask) { | 295 | if (( 1 << vdd) & p_d->ocr_mask) { |
199 | set_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_PWR_ON); | 296 | gpio_set_value(TOSA_GPIO_PWR_ON, 1); |
200 | } else { | 297 | } else { |
201 | reset_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_PWR_ON); | 298 | gpio_set_value(TOSA_GPIO_PWR_ON, 0); |
202 | } | 299 | } |
203 | } | 300 | } |
204 | 301 | ||
205 | static int tosa_mci_get_ro(struct device *dev) | 302 | static int tosa_mci_get_ro(struct device *dev) |
206 | { | 303 | { |
207 | return (read_scoop_reg(&tosascoop_device.dev, SCOOP_GPWR)&TOSA_SCOOP_SD_WP); | 304 | return gpio_get_value(TOSA_GPIO_SD_WP); |
208 | } | 305 | } |
209 | 306 | ||
210 | static void tosa_mci_exit(struct device *dev, void *data) | 307 | static void tosa_mci_exit(struct device *dev, void *data) |
211 | { | 308 | { |
309 | gpio_free(TOSA_GPIO_PWR_ON); | ||
310 | gpio_free(TOSA_GPIO_SD_WP); | ||
212 | free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); | 311 | free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); |
213 | } | 312 | } |
214 | 313 | ||
@@ -223,21 +322,36 @@ static struct pxamci_platform_data tosa_mci_platform_data = { | |||
223 | /* | 322 | /* |
224 | * Irda | 323 | * Irda |
225 | */ | 324 | */ |
226 | static void tosa_irda_transceiver_mode(struct device *dev, int mode) | 325 | static int tosa_irda_startup(struct device *dev) |
227 | { | 326 | { |
228 | if (mode & IR_OFF) { | 327 | int ret; |
229 | reset_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_IR_POWERDWN); | 328 | |
230 | pxa_gpio_mode(GPIO47_STTXD|GPIO_DFLT_LOW); | 329 | ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown"); |
231 | pxa_gpio_mode(GPIO47_STTXD|GPIO_OUT); | 330 | if (ret) |
232 | } else { | 331 | return ret; |
233 | pxa_gpio_mode(GPIO47_STTXD_MD); | 332 | |
234 | set_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_IR_POWERDWN); | 333 | ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0); |
334 | if (ret) | ||
335 | gpio_free(TOSA_GPIO_IR_POWERDWN); | ||
336 | |||
337 | return ret; | ||
235 | } | 338 | } |
339 | |||
340 | static void tosa_irda_shutdown(struct device *dev) | ||
341 | { | ||
342 | gpio_free(TOSA_GPIO_IR_POWERDWN); | ||
343 | } | ||
344 | |||
345 | static void tosa_irda_transceiver_mode(struct device *dev, int mode) | ||
346 | { | ||
347 | gpio_set_value(TOSA_GPIO_IR_POWERDWN, !(mode & IR_OFF)); | ||
236 | } | 348 | } |
237 | 349 | ||
238 | static struct pxaficp_platform_data tosa_ficp_platform_data = { | 350 | static struct pxaficp_platform_data tosa_ficp_platform_data = { |
239 | .transceiver_cap = IR_SIRMODE | IR_OFF, | 351 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
240 | .transceiver_mode = tosa_irda_transceiver_mode, | 352 | .transceiver_mode = tosa_irda_transceiver_mode, |
353 | .startup = tosa_irda_startup, | ||
354 | .shutdown = tosa_irda_shutdown, | ||
241 | }; | 355 | }; |
242 | 356 | ||
243 | /* | 357 | /* |
@@ -249,12 +363,28 @@ static struct platform_device tosakbd_device = { | |||
249 | }; | 363 | }; |
250 | 364 | ||
251 | static struct gpio_keys_button tosa_gpio_keys[] = { | 365 | static struct gpio_keys_button tosa_gpio_keys[] = { |
366 | /* | ||
367 | * Two following keys are directly tied to "ON" button of tosa. Why? | ||
368 | * The first one can be used as a wakeup source, the second can't; | ||
369 | * also the first one is OR of ac_powered and on_button. | ||
370 | */ | ||
371 | { | ||
372 | .type = EV_PWR, | ||
373 | .code = KEY_RESERVED, | ||
374 | .gpio = TOSA_GPIO_POWERON, | ||
375 | .desc = "Poweron", | ||
376 | .wakeup = 1, | ||
377 | .active_low = 1, | ||
378 | }, | ||
252 | { | 379 | { |
253 | .type = EV_PWR, | 380 | .type = EV_PWR, |
254 | .code = KEY_SUSPEND, | 381 | .code = KEY_SUSPEND, |
255 | .gpio = TOSA_GPIO_ON_KEY, | 382 | .gpio = TOSA_GPIO_ON_KEY, |
256 | .desc = "On key", | 383 | .desc = "On key", |
257 | .wakeup = 1, | 384 | /* |
385 | * can't be used as wakeup | ||
386 | * .wakeup = 1, | ||
387 | */ | ||
258 | .active_low = 1, | 388 | .active_low = 1, |
259 | }, | 389 | }, |
260 | { | 390 | { |
@@ -291,9 +421,40 @@ static struct platform_device tosa_gpio_keys_device = { | |||
291 | /* | 421 | /* |
292 | * Tosa LEDs | 422 | * Tosa LEDs |
293 | */ | 423 | */ |
424 | static struct gpio_led tosa_gpio_leds[] = { | ||
425 | { | ||
426 | .name = "tosa:amber:charge", | ||
427 | .default_trigger = "main-battery-charging", | ||
428 | .gpio = TOSA_GPIO_CHRG_ERR_LED, | ||
429 | }, | ||
430 | { | ||
431 | .name = "tosa:green:mail", | ||
432 | .default_trigger = "nand-disk", | ||
433 | .gpio = TOSA_GPIO_NOTE_LED, | ||
434 | }, | ||
435 | { | ||
436 | .name = "tosa:dual:wlan", | ||
437 | .default_trigger = "none", | ||
438 | .gpio = TOSA_GPIO_WLAN_LED, | ||
439 | }, | ||
440 | { | ||
441 | .name = "tosa:blue:bluetooth", | ||
442 | .default_trigger = "none", | ||
443 | .gpio = TOSA_GPIO_BT_LED, | ||
444 | }, | ||
445 | }; | ||
446 | |||
447 | static struct gpio_led_platform_data tosa_gpio_leds_platform_data = { | ||
448 | .leds = tosa_gpio_leds, | ||
449 | .num_leds = ARRAY_SIZE(tosa_gpio_leds), | ||
450 | }; | ||
451 | |||
294 | static struct platform_device tosaled_device = { | 452 | static struct platform_device tosaled_device = { |
295 | .name = "tosa-led", | 453 | .name = "leds-gpio", |
296 | .id = -1, | 454 | .id = -1, |
455 | .dev = { | ||
456 | .platform_data = &tosa_gpio_leds_platform_data, | ||
457 | }, | ||
297 | }; | 458 | }; |
298 | 459 | ||
299 | static struct platform_device *devices[] __initdata = { | 460 | static struct platform_device *devices[] __initdata = { |
@@ -326,20 +487,13 @@ static void tosa_restart(char mode) | |||
326 | 487 | ||
327 | static void __init tosa_init(void) | 488 | static void __init tosa_init(void) |
328 | { | 489 | { |
490 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config)); | ||
491 | gpio_set_wake(MFP_PIN_GPIO1, 1); | ||
492 | /* We can't pass to gpio-keys since it will drop the Reset altfunc */ | ||
493 | |||
329 | pm_power_off = tosa_poweroff; | 494 | pm_power_off = tosa_poweroff; |
330 | arm_pm_restart = tosa_restart; | 495 | arm_pm_restart = tosa_restart; |
331 | 496 | ||
332 | pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_IN); | ||
333 | pxa_gpio_mode(TOSA_GPIO_TC6393_INT | GPIO_IN); | ||
334 | pxa_gpio_mode(TOSA_GPIO_USB_IN | GPIO_IN); | ||
335 | |||
336 | /* setup sleep mode values */ | ||
337 | PWER = 0x00000002; | ||
338 | PFER = 0x00000000; | ||
339 | PRER = 0x00000002; | ||
340 | PGSR0 = 0x00000000; | ||
341 | PGSR1 = 0x00FF0002; | ||
342 | PGSR2 = 0x00014000; | ||
343 | PCFR |= PCFR_OPDE; | 497 | PCFR |= PCFR_OPDE; |
344 | 498 | ||
345 | /* enable batt_fault */ | 499 | /* enable batt_fault */ |
@@ -348,6 +502,7 @@ static void __init tosa_init(void) | |||
348 | pxa_set_mci_info(&tosa_mci_platform_data); | 502 | pxa_set_mci_info(&tosa_mci_platform_data); |
349 | pxa_set_udc_info(&udc_info); | 503 | pxa_set_udc_info(&udc_info); |
350 | pxa_set_ficp_info(&tosa_ficp_platform_data); | 504 | pxa_set_ficp_info(&tosa_ficp_platform_data); |
505 | pxa_set_i2c_info(NULL); | ||
351 | platform_scoop_config = &tosa_pcmcia_config; | 506 | platform_scoop_config = &tosa_pcmcia_config; |
352 | 507 | ||
353 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 508 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c index f207fcd30cd7..931885d86b91 100644 --- a/arch/arm/mach-pxa/trizeps4.c +++ b/arch/arm/mach-pxa/trizeps4.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <asm/mach/flash.h> | 41 | #include <asm/mach/flash.h> |
42 | 42 | ||
43 | #include <asm/arch/pxa-regs.h> | 43 | #include <asm/arch/pxa-regs.h> |
44 | #include <asm/arch/pxa2xx-gpio.h> | ||
44 | #include <asm/arch/trizeps4.h> | 45 | #include <asm/arch/trizeps4.h> |
45 | #include <asm/arch/audio.h> | 46 | #include <asm/arch/audio.h> |
46 | #include <asm/arch/pxafb.h> | 47 | #include <asm/arch/pxafb.h> |
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c index afd2cbfca0d9..dbb546216be1 100644 --- a/arch/arm/mach-pxa/zylonite.c +++ b/arch/arm/mach-pxa/zylonite.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/arch/pxafb.h> | 26 | #include <asm/arch/pxafb.h> |
27 | #include <asm/arch/zylonite.h> | 27 | #include <asm/arch/zylonite.h> |
28 | #include <asm/arch/mmc.h> | 28 | #include <asm/arch/mmc.h> |
29 | #include <asm/arch/pxa27x_keypad.h> | ||
29 | 30 | ||
30 | #include "generic.h" | 31 | #include "generic.h" |
31 | 32 | ||
@@ -35,6 +36,8 @@ struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS]; | |||
35 | int gpio_backlight; | 36 | int gpio_backlight; |
36 | int gpio_eth_irq; | 37 | int gpio_eth_irq; |
37 | 38 | ||
39 | int wm9713_irq; | ||
40 | |||
38 | int lcd_id; | 41 | int lcd_id; |
39 | int lcd_orientation; | 42 | int lcd_orientation; |
40 | 43 | ||
@@ -249,6 +252,71 @@ static void __init zylonite_init_mmc(void) | |||
249 | static inline void zylonite_init_mmc(void) {} | 252 | static inline void zylonite_init_mmc(void) {} |
250 | #endif | 253 | #endif |
251 | 254 | ||
255 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES) | ||
256 | static unsigned int zylonite_matrix_key_map[] = { | ||
257 | /* KEY(row, col, key_code) */ | ||
258 | KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D), | ||
259 | KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H), | ||
260 | KEY(2, 0, KEY_I), KEY(2, 1, KEY_J), KEY(2, 2, KEY_K), KEY(2, 5, KEY_L), | ||
261 | KEY(3, 0, KEY_M), KEY(3, 1, KEY_N), KEY(3, 2, KEY_O), KEY(3, 5, KEY_P), | ||
262 | KEY(5, 0, KEY_Q), KEY(5, 1, KEY_R), KEY(5, 2, KEY_S), KEY(5, 5, KEY_T), | ||
263 | KEY(6, 0, KEY_U), KEY(6, 1, KEY_V), KEY(6, 2, KEY_W), KEY(6, 5, KEY_X), | ||
264 | KEY(7, 1, KEY_Y), KEY(7, 2, KEY_Z), | ||
265 | |||
266 | KEY(4, 4, KEY_0), KEY(1, 3, KEY_1), KEY(4, 1, KEY_2), KEY(1, 4, KEY_3), | ||
267 | KEY(2, 3, KEY_4), KEY(4, 2, KEY_5), KEY(2, 4, KEY_6), KEY(3, 3, KEY_7), | ||
268 | KEY(4, 3, KEY_8), KEY(3, 4, KEY_9), | ||
269 | |||
270 | KEY(4, 5, KEY_SPACE), | ||
271 | KEY(5, 3, KEY_KPASTERISK), /* * */ | ||
272 | KEY(5, 4, KEY_KPDOT), /* #" */ | ||
273 | |||
274 | KEY(0, 7, KEY_UP), | ||
275 | KEY(1, 7, KEY_DOWN), | ||
276 | KEY(2, 7, KEY_LEFT), | ||
277 | KEY(3, 7, KEY_RIGHT), | ||
278 | KEY(2, 6, KEY_HOME), | ||
279 | KEY(3, 6, KEY_END), | ||
280 | KEY(6, 4, KEY_DELETE), | ||
281 | KEY(6, 6, KEY_BACK), | ||
282 | KEY(6, 3, KEY_CAPSLOCK), /* KEY_LEFTSHIFT), */ | ||
283 | |||
284 | KEY(4, 6, KEY_ENTER), /* scroll push */ | ||
285 | KEY(5, 7, KEY_ENTER), /* keypad action */ | ||
286 | |||
287 | KEY(0, 4, KEY_EMAIL), | ||
288 | KEY(5, 6, KEY_SEND), | ||
289 | KEY(4, 0, KEY_CALENDAR), | ||
290 | KEY(7, 6, KEY_RECORD), | ||
291 | KEY(6, 7, KEY_VOLUMEUP), | ||
292 | KEY(7, 7, KEY_VOLUMEDOWN), | ||
293 | |||
294 | KEY(0, 6, KEY_F22), /* soft1 */ | ||
295 | KEY(1, 6, KEY_F23), /* soft2 */ | ||
296 | KEY(0, 3, KEY_AUX), /* contact */ | ||
297 | }; | ||
298 | |||
299 | static struct pxa27x_keypad_platform_data zylonite_keypad_info = { | ||
300 | .matrix_key_rows = 8, | ||
301 | .matrix_key_cols = 8, | ||
302 | .matrix_key_map = zylonite_matrix_key_map, | ||
303 | .matrix_key_map_size = ARRAY_SIZE(zylonite_matrix_key_map), | ||
304 | |||
305 | .enable_rotary0 = 1, | ||
306 | .rotary0_up_key = KEY_UP, | ||
307 | .rotary0_down_key = KEY_DOWN, | ||
308 | |||
309 | .debounce_interval = 30, | ||
310 | }; | ||
311 | |||
312 | static void __init zylonite_init_keypad(void) | ||
313 | { | ||
314 | pxa_set_keypad_info(&zylonite_keypad_info); | ||
315 | } | ||
316 | #else | ||
317 | static inline void zylonite_init_keypad(void) {} | ||
318 | #endif | ||
319 | |||
252 | static void __init zylonite_init(void) | 320 | static void __init zylonite_init(void) |
253 | { | 321 | { |
254 | /* board-processor specific initialization */ | 322 | /* board-processor specific initialization */ |
@@ -265,6 +333,7 @@ static void __init zylonite_init(void) | |||
265 | 333 | ||
266 | zylonite_init_lcd(); | 334 | zylonite_init_lcd(); |
267 | zylonite_init_mmc(); | 335 | zylonite_init_mmc(); |
336 | zylonite_init_keypad(); | ||
268 | } | 337 | } |
269 | 338 | ||
270 | MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)") | 339 | MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)") |
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c index 6ac04c09b0e9..324fb9daae28 100644 --- a/arch/arm/mach-pxa/zylonite_pxa300.c +++ b/arch/arm/mach-pxa/zylonite_pxa300.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <asm/arch/mfp-pxa300.h> | 21 | #include <asm/arch/mfp-pxa300.h> |
22 | #include <asm/arch/zylonite.h> | 22 | #include <asm/arch/zylonite.h> |
23 | 23 | ||
24 | #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) | 24 | #include "generic.h" |
25 | 25 | ||
26 | /* PXA300/PXA310 common configurations */ | 26 | /* PXA300/PXA310 common configurations */ |
27 | static mfp_cfg_t common_mfp_cfg[] __initdata = { | 27 | static mfp_cfg_t common_mfp_cfg[] __initdata = { |
@@ -69,6 +69,9 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = { | |||
69 | GPIO27_AC97_SDATA_OUT, | 69 | GPIO27_AC97_SDATA_OUT, |
70 | GPIO28_AC97_SYNC, | 70 | GPIO28_AC97_SYNC, |
71 | 71 | ||
72 | /* WM9713 IRQ */ | ||
73 | GPIO26_GPIO, | ||
74 | |||
72 | /* Keypad */ | 75 | /* Keypad */ |
73 | GPIO107_KP_DKIN_0 | MFP_LPM_EDGE_BOTH, | 76 | GPIO107_KP_DKIN_0 | MFP_LPM_EDGE_BOTH, |
74 | GPIO108_KP_DKIN_1 | MFP_LPM_EDGE_BOTH, | 77 | GPIO108_KP_DKIN_1 | MFP_LPM_EDGE_BOTH, |
@@ -203,6 +206,9 @@ void __init zylonite_pxa300_init(void) | |||
203 | /* MMC card detect & write protect for controller 0 */ | 206 | /* MMC card detect & write protect for controller 0 */ |
204 | zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0); | 207 | zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0); |
205 | zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2); | 208 | zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2); |
209 | |||
210 | /* WM9713 IRQ */ | ||
211 | wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO26); | ||
206 | } | 212 | } |
207 | 213 | ||
208 | if (cpu_is_pxa300()) { | 214 | if (cpu_is_pxa300()) { |
diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c index dfa79992b8ab..193d07903b06 100644 --- a/arch/arm/mach-pxa/zylonite_pxa320.c +++ b/arch/arm/mach-pxa/zylonite_pxa320.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <asm/arch/mfp-pxa320.h> | 21 | #include <asm/arch/mfp-pxa320.h> |
22 | #include <asm/arch/zylonite.h> | 22 | #include <asm/arch/zylonite.h> |
23 | 23 | ||
24 | #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) | 24 | #include "generic.h" |
25 | 25 | ||
26 | static mfp_cfg_t mfp_cfg[] __initdata = { | 26 | static mfp_cfg_t mfp_cfg[] __initdata = { |
27 | /* LCD */ | 27 | /* LCD */ |
@@ -68,6 +68,9 @@ static mfp_cfg_t mfp_cfg[] __initdata = { | |||
68 | GPIO39_AC97_BITCLK, | 68 | GPIO39_AC97_BITCLK, |
69 | GPIO40_AC97_nACRESET, | 69 | GPIO40_AC97_nACRESET, |
70 | 70 | ||
71 | /* WM9713 IRQ */ | ||
72 | GPIO15_GPIO, | ||
73 | |||
71 | /* I2C */ | 74 | /* I2C */ |
72 | GPIO32_I2C_SCL, | 75 | GPIO32_I2C_SCL, |
73 | GPIO33_I2C_SDA, | 76 | GPIO33_I2C_SDA, |
@@ -190,5 +193,8 @@ void __init zylonite_pxa320_init(void) | |||
190 | /* MMC card detect & write protect for controller 0 */ | 193 | /* MMC card detect & write protect for controller 0 */ |
191 | zylonite_mmc_slot[0].gpio_cd = mfp_to_gpio(MFP_PIN_GPIO1); | 194 | zylonite_mmc_slot[0].gpio_cd = mfp_to_gpio(MFP_PIN_GPIO1); |
192 | zylonite_mmc_slot[0].gpio_wp = mfp_to_gpio(MFP_PIN_GPIO5); | 195 | zylonite_mmc_slot[0].gpio_wp = mfp_to_gpio(MFP_PIN_GPIO5); |
196 | |||
197 | /* WM9713 IRQ */ | ||
198 | wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO15); | ||
193 | } | 199 | } |
194 | } | 200 | } |