diff options
author | Marc Zyngier <maz@misterjones.org> | 2009-11-14 07:39:13 -0500 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2009-12-13 08:42:58 -0500 |
commit | c2de1c382933fd9ef0a3db13b6747115e1e32c56 (patch) | |
tree | d9e0fa251d376fb7d5f9906952bf02f2f31570e0 /arch/arm/mach-pxa | |
parent | e491a11c77a4ed93ec14cc052b1f048bddc9e99a (diff) |
[ARM] pxa/zeus: make Viper pcmcia support more generic to support Zeus
The Arcom Zeus CF slot requires the same kind of support as the Viper.
To avoid code duplication, introduce a platform device that abstracts
the differences.
This also allows for the removal of the ugly export of viper_cf_rst().
Signed-off-by: Marc Zyngier <maz@misterjones.org>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r-- | arch/arm/mach-pxa/Kconfig | 7 | ||||
-rw-r--r-- | arch/arm/mach-pxa/include/mach/arcom-pcmcia.h | 11 | ||||
-rw-r--r-- | arch/arm/mach-pxa/include/mach/viper.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/viper.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-pxa/zeus.c | 29 |
5 files changed, 65 insertions, 4 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index fc553e896b1b..e6d8e10ae5d1 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig | |||
@@ -63,6 +63,7 @@ config ARCH_VIPER | |||
63 | select HAVE_PWM | 63 | select HAVE_PWM |
64 | select PXA_HAVE_BOARD_IRQS | 64 | select PXA_HAVE_BOARD_IRQS |
65 | select PXA_HAVE_ISA_IRQS | 65 | select PXA_HAVE_ISA_IRQS |
66 | select ARCOM_PCMCIA | ||
66 | 67 | ||
67 | config MACH_ARCOM_ZEUS | 68 | config MACH_ARCOM_ZEUS |
68 | bool "Arcom/Eurotech ZEUS SBC" | 69 | bool "Arcom/Eurotech ZEUS SBC" |
@@ -70,6 +71,7 @@ config MACH_ARCOM_ZEUS | |||
70 | select ISA | 71 | select ISA |
71 | select PXA_HAVE_BOARD_IRQS | 72 | select PXA_HAVE_BOARD_IRQS |
72 | select PXA_HAVE_ISA_IRQS | 73 | select PXA_HAVE_ISA_IRQS |
74 | select ARCOM_PCMCIA | ||
73 | 75 | ||
74 | config MACH_BALLOON3 | 76 | config MACH_BALLOON3 |
75 | bool "Balloon 3 board" | 77 | bool "Balloon 3 board" |
@@ -186,6 +188,11 @@ config MACH_TRIZEPS_ANY | |||
186 | 188 | ||
187 | endchoice | 189 | endchoice |
188 | 190 | ||
191 | config ARCOM_PCMCIA | ||
192 | bool | ||
193 | help | ||
194 | Generic option for Arcom Viper/Zeus PCMCIA | ||
195 | |||
189 | config TRIZEPS_PCMCIA | 196 | config TRIZEPS_PCMCIA |
190 | bool | 197 | bool |
191 | help | 198 | help |
diff --git a/arch/arm/mach-pxa/include/mach/arcom-pcmcia.h b/arch/arm/mach-pxa/include/mach/arcom-pcmcia.h new file mode 100644 index 000000000000..d428be4db44c --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/arcom-pcmcia.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef __ARCOM_PCMCIA_H | ||
2 | #define __ARCOM_PCMCIA_H | ||
3 | |||
4 | struct arcom_pcmcia_pdata { | ||
5 | int cd_gpio; | ||
6 | int rdy_gpio; | ||
7 | int pwr_gpio; | ||
8 | void (*reset)(int state); | ||
9 | }; | ||
10 | |||
11 | #endif | ||
diff --git a/arch/arm/mach-pxa/include/mach/viper.h b/arch/arm/mach-pxa/include/mach/viper.h index 10988c270ca3..5f5fbf1f6489 100644 --- a/arch/arm/mach-pxa/include/mach/viper.h +++ b/arch/arm/mach-pxa/include/mach/viper.h | |||
@@ -85,8 +85,6 @@ | |||
85 | /* Interrupt and Configuration Register (VIPER_ICR) */ | 85 | /* Interrupt and Configuration Register (VIPER_ICR) */ |
86 | /* This is a write only register. Only CF_RST is used under Linux */ | 86 | /* This is a write only register. Only CF_RST is used under Linux */ |
87 | 87 | ||
88 | extern void viper_cf_rst(int state); | ||
89 | |||
90 | #define VIPER_ICR_RETRIG (1 << 0) | 88 | #define VIPER_ICR_RETRIG (1 << 0) |
91 | #define VIPER_ICR_AUTO_CLR (1 << 1) | 89 | #define VIPER_ICR_AUTO_CLR (1 << 1) |
92 | #define VIPER_ICR_R_DIS (1 << 2) | 90 | #define VIPER_ICR_R_DIS (1 << 2) |
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c index cf0d71b7797e..5352b4e5a7dd 100644 --- a/arch/arm/mach-pxa/viper.c +++ b/arch/arm/mach-pxa/viper.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <mach/pxafb.h> | 47 | #include <mach/pxafb.h> |
48 | #include <plat/i2c.h> | 48 | #include <plat/i2c.h> |
49 | #include <mach/regs-uart.h> | 49 | #include <mach/regs-uart.h> |
50 | #include <mach/arcom-pcmcia.h> | ||
50 | #include <mach/viper.h> | 51 | #include <mach/viper.h> |
51 | 52 | ||
52 | #include <asm/setup.h> | 53 | #include <asm/setup.h> |
@@ -76,14 +77,28 @@ static void viper_icr_clear_bit(unsigned int bit) | |||
76 | } | 77 | } |
77 | 78 | ||
78 | /* This function is used from the pcmcia module to reset the CF */ | 79 | /* This function is used from the pcmcia module to reset the CF */ |
79 | void viper_cf_rst(int state) | 80 | static void viper_cf_reset(int state) |
80 | { | 81 | { |
81 | if (state) | 82 | if (state) |
82 | viper_icr_set_bit(VIPER_ICR_CF_RST); | 83 | viper_icr_set_bit(VIPER_ICR_CF_RST); |
83 | else | 84 | else |
84 | viper_icr_clear_bit(VIPER_ICR_CF_RST); | 85 | viper_icr_clear_bit(VIPER_ICR_CF_RST); |
85 | } | 86 | } |
86 | EXPORT_SYMBOL(viper_cf_rst); | 87 | |
88 | static struct arcom_pcmcia_pdata viper_pcmcia_info = { | ||
89 | .cd_gpio = VIPER_CF_CD_GPIO, | ||
90 | .rdy_gpio = VIPER_CF_RDY_GPIO, | ||
91 | .pwr_gpio = VIPER_CF_POWER_GPIO, | ||
92 | .reset = viper_cf_reset, | ||
93 | }; | ||
94 | |||
95 | static struct platform_device viper_pcmcia_device = { | ||
96 | .name = "viper-pcmcia", | ||
97 | .id = -1, | ||
98 | .dev = { | ||
99 | .platform_data = &viper_pcmcia_info, | ||
100 | }, | ||
101 | }; | ||
87 | 102 | ||
88 | /* | 103 | /* |
89 | * The CPLD version register was not present on VIPER boards prior to | 104 | * The CPLD version register was not present on VIPER boards prior to |
@@ -685,6 +700,7 @@ static struct platform_device *viper_devs[] __initdata = { | |||
685 | &viper_mtd_devices[0], | 700 | &viper_mtd_devices[0], |
686 | &viper_mtd_devices[1], | 701 | &viper_mtd_devices[1], |
687 | &viper_backlight_device, | 702 | &viper_backlight_device, |
703 | &viper_pcmcia_device, | ||
688 | }; | 704 | }; |
689 | 705 | ||
690 | static mfp_cfg_t viper_pin_config[] __initdata = { | 706 | static mfp_cfg_t viper_pin_config[] __initdata = { |
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c index ae1c3d2f6d5b..5b986a8bd9e6 100644 --- a/arch/arm/mach-pxa/zeus.c +++ b/arch/arm/mach-pxa/zeus.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <mach/mfp-pxa27x.h> | 43 | #include <mach/mfp-pxa27x.h> |
44 | #include <mach/pm.h> | 44 | #include <mach/pm.h> |
45 | #include <mach/audio.h> | 45 | #include <mach/audio.h> |
46 | #include <mach/arcom-pcmcia.h> | ||
46 | #include <mach/zeus.h> | 47 | #include <mach/zeus.h> |
47 | 48 | ||
48 | #include "generic.h" | 49 | #include "generic.h" |
@@ -428,6 +429,33 @@ static struct platform_device zeus_leds_device = { | |||
428 | }, | 429 | }, |
429 | }; | 430 | }; |
430 | 431 | ||
432 | static void zeus_cf_reset(int state) | ||
433 | { | ||
434 | u16 cpld_state = __raw_readw(ZEUS_CPLD_CONTROL); | ||
435 | |||
436 | if (state) | ||
437 | cpld_state |= ZEUS_CPLD_CONTROL_CF_RST; | ||
438 | else | ||
439 | cpld_state &= ~ZEUS_CPLD_CONTROL_CF_RST; | ||
440 | |||
441 | __raw_writew(cpld_state, ZEUS_CPLD_CONTROL); | ||
442 | } | ||
443 | |||
444 | static struct arcom_pcmcia_pdata zeus_pcmcia_info = { | ||
445 | .cd_gpio = ZEUS_CF_CD_GPIO, | ||
446 | .rdy_gpio = ZEUS_CF_RDY_GPIO, | ||
447 | .pwr_gpio = ZEUS_CF_PWEN_GPIO, | ||
448 | .reset = zeus_cf_reset, | ||
449 | }; | ||
450 | |||
451 | static struct platform_device zeus_pcmcia_device = { | ||
452 | .name = "zeus-pcmcia", | ||
453 | .id = -1, | ||
454 | .dev = { | ||
455 | .platform_data = &zeus_pcmcia_info, | ||
456 | }, | ||
457 | }; | ||
458 | |||
431 | static struct platform_device *zeus_devices[] __initdata = { | 459 | static struct platform_device *zeus_devices[] __initdata = { |
432 | &zeus_serial_device, | 460 | &zeus_serial_device, |
433 | &zeus_mtd_devices[0], | 461 | &zeus_mtd_devices[0], |
@@ -436,6 +464,7 @@ static struct platform_device *zeus_devices[] __initdata = { | |||
436 | &zeus_sram_device, | 464 | &zeus_sram_device, |
437 | &pxa2xx_spi_ssp3_device, | 465 | &pxa2xx_spi_ssp3_device, |
438 | &zeus_leds_device, | 466 | &zeus_leds_device, |
467 | &zeus_pcmcia_device, | ||
439 | }; | 468 | }; |
440 | 469 | ||
441 | /* AC'97 */ | 470 | /* AC'97 */ |