diff options
-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 | ||||
-rw-r--r-- | drivers/pcmcia/Kconfig | 2 | ||||
-rw-r--r-- | drivers/pcmcia/Makefile | 2 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_base.c | 3 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_viper.c | 119 |
9 files changed, 155 insertions, 40 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 */ |
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index cd5082d3ca19..58bee55a3dd3 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
@@ -208,7 +208,7 @@ config PCMCIA_PXA2XX | |||
208 | depends on ARM && ARCH_PXA && PCMCIA | 208 | depends on ARM && ARCH_PXA && PCMCIA |
209 | depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \ | 209 | depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \ |
210 | || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \ | 210 | || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \ |
211 | || ARCH_VIPER || ARCH_PXA_ESERIES || MACH_STARGATE2) | 211 | || ARCOM_PCMCIA || ARCH_PXA_ESERIES || MACH_STARGATE2) |
212 | select PCMCIA_SOC_COMMON | 212 | select PCMCIA_SOC_COMMON |
213 | help | 213 | help |
214 | Say Y here to include support for the PXA2xx PCMCIA controller | 214 | Say Y here to include support for the PXA2xx PCMCIA controller |
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 382938313991..83ff802de544 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -67,7 +67,7 @@ pxa2xx-obj-$(CONFIG_ARCH_LUBBOCK) += pxa2xx_lubbock_cs.o | |||
67 | pxa2xx-obj-$(CONFIG_MACH_MAINSTONE) += pxa2xx_mainstone.o | 67 | pxa2xx-obj-$(CONFIG_MACH_MAINSTONE) += pxa2xx_mainstone.o |
68 | pxa2xx-obj-$(CONFIG_PXA_SHARPSL) += pxa2xx_sharpsl.o | 68 | pxa2xx-obj-$(CONFIG_PXA_SHARPSL) += pxa2xx_sharpsl.o |
69 | pxa2xx-obj-$(CONFIG_MACH_ARMCORE) += pxa2xx_cm_x2xx_cs.o | 69 | pxa2xx-obj-$(CONFIG_MACH_ARMCORE) += pxa2xx_cm_x2xx_cs.o |
70 | pxa2xx-obj-$(CONFIG_ARCH_VIPER) += pxa2xx_viper.o | 70 | pxa2xx-obj-$(CONFIG_ARCOM_PCMCIA) += pxa2xx_viper.o |
71 | pxa2xx-obj-$(CONFIG_TRIZEPS_PCMCIA) += pxa2xx_trizeps4.o | 71 | pxa2xx-obj-$(CONFIG_TRIZEPS_PCMCIA) += pxa2xx_trizeps4.o |
72 | pxa2xx-obj-$(CONFIG_MACH_PALMTX) += pxa2xx_palmtx.o | 72 | pxa2xx-obj-$(CONFIG_MACH_PALMTX) += pxa2xx_palmtx.o |
73 | pxa2xx-obj-$(CONFIG_MACH_PALMTC) += pxa2xx_palmtc.o | 73 | pxa2xx-obj-$(CONFIG_MACH_PALMTC) += pxa2xx_palmtc.o |
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 84dde7768ad5..87481ce60dfb 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c | |||
@@ -214,7 +214,8 @@ static void pxa2xx_configure_sockets(struct device *dev) | |||
214 | MECR |= MECR_CIT; | 214 | MECR |= MECR_CIT; |
215 | 215 | ||
216 | /* Set MECR:NOS (Number Of Sockets) */ | 216 | /* Set MECR:NOS (Number Of Sockets) */ |
217 | if ((ops->first + ops->nr) > 1 || machine_is_viper()) | 217 | if ((ops->first + ops->nr) > 1 || |
218 | machine_is_viper() || machine_is_arcom_zeus()) | ||
218 | MECR |= MECR_NOS; | 219 | MECR |= MECR_NOS; |
219 | else | 220 | else |
220 | MECR &= ~MECR_NOS; | 221 | MECR &= ~MECR_NOS; |
diff --git a/drivers/pcmcia/pxa2xx_viper.c b/drivers/pcmcia/pxa2xx_viper.c index 27be2e154df2..a51f2077644a 100644 --- a/drivers/pcmcia/pxa2xx_viper.c +++ b/drivers/pcmcia/pxa2xx_viper.c | |||
@@ -1,9 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * VIPER PCMCIA support | 2 | * Viper/Zeus PCMCIA support |
3 | * Copyright 2004 Arcom Control Systems | 3 | * Copyright 2004 Arcom Control Systems |
4 | * | 4 | * |
5 | * Maintained by Marc Zyngier <maz@misterjones.org> | 5 | * Maintained by Marc Zyngier <maz@misterjones.org> |
6 | * <marc.zyngier@altran.com> | ||
7 | * | 6 | * |
8 | * Based on: | 7 | * Based on: |
9 | * iPAQ h2200 PCMCIA support | 8 | * iPAQ h2200 PCMCIA support |
@@ -26,37 +25,47 @@ | |||
26 | 25 | ||
27 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
28 | 27 | ||
29 | #include <mach/viper.h> | 28 | #include <mach/arcom-pcmcia.h> |
30 | #include <asm/mach-types.h> | ||
31 | 29 | ||
32 | #include "soc_common.h" | 30 | #include "soc_common.h" |
33 | #include "pxa2xx_base.h" | 31 | #include "pxa2xx_base.h" |
34 | 32 | ||
33 | static struct platform_device *arcom_pcmcia_dev; | ||
34 | |||
35 | static struct pcmcia_irqs irqs[] = { | 35 | static struct pcmcia_irqs irqs[] = { |
36 | { 0, gpio_to_irq(VIPER_CF_CD_GPIO), "PCMCIA_CD" } | 36 | { |
37 | .sock = 0, | ||
38 | .str = "PCMCIA_CD", | ||
39 | }, | ||
37 | }; | 40 | }; |
38 | 41 | ||
42 | static inline struct arcom_pcmcia_pdata *viper_get_pdata(void) | ||
43 | { | ||
44 | return arcom_pcmcia_dev->dev.platform_data; | ||
45 | } | ||
46 | |||
39 | static int viper_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 47 | static int viper_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
40 | { | 48 | { |
49 | struct arcom_pcmcia_pdata *pdata = viper_get_pdata(); | ||
41 | unsigned long flags; | 50 | unsigned long flags; |
42 | 51 | ||
43 | skt->socket.pci_irq = gpio_to_irq(VIPER_CF_RDY_GPIO); | 52 | skt->socket.pci_irq = gpio_to_irq(pdata->rdy_gpio); |
53 | irqs[0].irq = gpio_to_irq(pdata->cd_gpio); | ||
44 | 54 | ||
45 | if (gpio_request(VIPER_CF_CD_GPIO, "CF detect")) | 55 | if (gpio_request(pdata->cd_gpio, "CF detect")) |
46 | goto err_request_cd; | 56 | goto err_request_cd; |
47 | 57 | ||
48 | if (gpio_request(VIPER_CF_RDY_GPIO, "CF ready")) | 58 | if (gpio_request(pdata->rdy_gpio, "CF ready")) |
49 | goto err_request_rdy; | 59 | goto err_request_rdy; |
50 | 60 | ||
51 | if (gpio_request(VIPER_CF_POWER_GPIO, "CF power")) | 61 | if (gpio_request(pdata->pwr_gpio, "CF power")) |
52 | goto err_request_pwr; | 62 | goto err_request_pwr; |
53 | 63 | ||
54 | local_irq_save(flags); | 64 | local_irq_save(flags); |
55 | 65 | ||
56 | /* GPIO 82 is the CF power enable line. initially off */ | 66 | if (gpio_direction_output(pdata->pwr_gpio, 0) || |
57 | if (gpio_direction_output(VIPER_CF_POWER_GPIO, 0) || | 67 | gpio_direction_input(pdata->cd_gpio) || |
58 | gpio_direction_input(VIPER_CF_CD_GPIO) || | 68 | gpio_direction_input(pdata->rdy_gpio)) { |
59 | gpio_direction_input(VIPER_CF_RDY_GPIO)) { | ||
60 | local_irq_restore(flags); | 69 | local_irq_restore(flags); |
61 | goto err_dir; | 70 | goto err_dir; |
62 | } | 71 | } |
@@ -66,13 +75,13 @@ static int viper_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
66 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 75 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
67 | 76 | ||
68 | err_dir: | 77 | err_dir: |
69 | gpio_free(VIPER_CF_POWER_GPIO); | 78 | gpio_free(pdata->pwr_gpio); |
70 | err_request_pwr: | 79 | err_request_pwr: |
71 | gpio_free(VIPER_CF_RDY_GPIO); | 80 | gpio_free(pdata->rdy_gpio); |
72 | err_request_rdy: | 81 | err_request_rdy: |
73 | gpio_free(VIPER_CF_CD_GPIO); | 82 | gpio_free(pdata->cd_gpio); |
74 | err_request_cd: | 83 | err_request_cd: |
75 | printk(KERN_ERR "viper: Failed to setup PCMCIA GPIOs\n"); | 84 | dev_err(&arcom_pcmcia_dev->dev, "Failed to setup PCMCIA GPIOs\n"); |
76 | return -1; | 85 | return -1; |
77 | } | 86 | } |
78 | 87 | ||
@@ -81,17 +90,21 @@ err_request_cd: | |||
81 | */ | 90 | */ |
82 | static void viper_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | 91 | static void viper_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) |
83 | { | 92 | { |
93 | struct arcom_pcmcia_pdata *pdata = viper_get_pdata(); | ||
94 | |||
84 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 95 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
85 | gpio_free(VIPER_CF_POWER_GPIO); | 96 | gpio_free(pdata->pwr_gpio); |
86 | gpio_free(VIPER_CF_RDY_GPIO); | 97 | gpio_free(pdata->rdy_gpio); |
87 | gpio_free(VIPER_CF_CD_GPIO); | 98 | gpio_free(pdata->cd_gpio); |
88 | } | 99 | } |
89 | 100 | ||
90 | static void viper_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | 101 | static void viper_pcmcia_socket_state(struct soc_pcmcia_socket *skt, |
91 | struct pcmcia_state *state) | 102 | struct pcmcia_state *state) |
92 | { | 103 | { |
93 | state->detect = gpio_get_value(VIPER_CF_CD_GPIO) ? 0 : 1; | 104 | struct arcom_pcmcia_pdata *pdata = viper_get_pdata(); |
94 | state->ready = gpio_get_value(VIPER_CF_RDY_GPIO) ? 1 : 0; | 105 | |
106 | state->detect = !gpio_get_value(pdata->cd_gpio); | ||
107 | state->ready = !!gpio_get_value(pdata->rdy_gpio); | ||
95 | state->bvd1 = 1; | 108 | state->bvd1 = 1; |
96 | state->bvd2 = 1; | 109 | state->bvd2 = 1; |
97 | state->wrprot = 0; | 110 | state->wrprot = 0; |
@@ -102,20 +115,21 @@ static void viper_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | |||
102 | static int viper_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | 115 | static int viper_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, |
103 | const socket_state_t *state) | 116 | const socket_state_t *state) |
104 | { | 117 | { |
118 | struct arcom_pcmcia_pdata *pdata = viper_get_pdata(); | ||
119 | |||
105 | /* Silently ignore Vpp, output enable, speaker enable. */ | 120 | /* Silently ignore Vpp, output enable, speaker enable. */ |
106 | viper_cf_rst(state->flags & SS_RESET); | 121 | pdata->reset(state->flags & SS_RESET); |
107 | 122 | ||
108 | /* Apply socket voltage */ | 123 | /* Apply socket voltage */ |
109 | switch (state->Vcc) { | 124 | switch (state->Vcc) { |
110 | case 0: | 125 | case 0: |
111 | gpio_set_value(VIPER_CF_POWER_GPIO, 0); | 126 | gpio_set_value(pdata->pwr_gpio, 0); |
112 | break; | 127 | break; |
113 | case 33: | 128 | case 33: |
114 | gpio_set_value(VIPER_CF_POWER_GPIO, 1); | 129 | gpio_set_value(pdata->pwr_gpio, 1); |
115 | break; | 130 | break; |
116 | default: | 131 | default: |
117 | printk(KERN_ERR "%s: Unsupported Vcc:%d\n", | 132 | dev_err(&arcom_pcmcia_dev->dev, "Unsupported Vcc:%d\n", state->Vcc); |
118 | __func__, state->Vcc); | ||
119 | return -1; | 133 | return -1; |
120 | } | 134 | } |
121 | 135 | ||
@@ -130,7 +144,7 @@ static void viper_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | |||
130 | { | 144 | { |
131 | } | 145 | } |
132 | 146 | ||
133 | static struct pcmcia_low_level viper_pcmcia_ops __initdata = { | 147 | static struct pcmcia_low_level viper_pcmcia_ops = { |
134 | .owner = THIS_MODULE, | 148 | .owner = THIS_MODULE, |
135 | .hw_init = viper_pcmcia_hw_init, | 149 | .hw_init = viper_pcmcia_hw_init, |
136 | .hw_shutdown = viper_pcmcia_hw_shutdown, | 150 | .hw_shutdown = viper_pcmcia_hw_shutdown, |
@@ -143,17 +157,25 @@ static struct pcmcia_low_level viper_pcmcia_ops __initdata = { | |||
143 | 157 | ||
144 | static struct platform_device *viper_pcmcia_device; | 158 | static struct platform_device *viper_pcmcia_device; |
145 | 159 | ||
146 | static int __init viper_pcmcia_init(void) | 160 | static int viper_pcmcia_probe(struct platform_device *pdev) |
147 | { | 161 | { |
148 | int ret; | 162 | int ret; |
149 | 163 | ||
150 | if (!machine_is_viper()) | 164 | /* I can't imagine more than one device, but you never know... */ |
151 | return -ENODEV; | 165 | if (arcom_pcmcia_dev) |
166 | return -EEXIST; | ||
167 | |||
168 | if (!pdev->dev.platform_data) | ||
169 | return -EINVAL; | ||
152 | 170 | ||
153 | viper_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); | 171 | viper_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); |
154 | if (!viper_pcmcia_device) | 172 | if (!viper_pcmcia_device) |
155 | return -ENOMEM; | 173 | return -ENOMEM; |
156 | 174 | ||
175 | arcom_pcmcia_dev = pdev; | ||
176 | |||
177 | viper_pcmcia_device->dev.parent = &pdev->dev; | ||
178 | |||
157 | ret = platform_device_add_data(viper_pcmcia_device, | 179 | ret = platform_device_add_data(viper_pcmcia_device, |
158 | &viper_pcmcia_ops, | 180 | &viper_pcmcia_ops, |
159 | sizeof(viper_pcmcia_ops)); | 181 | sizeof(viper_pcmcia_ops)); |
@@ -161,18 +183,49 @@ static int __init viper_pcmcia_init(void) | |||
161 | if (!ret) | 183 | if (!ret) |
162 | ret = platform_device_add(viper_pcmcia_device); | 184 | ret = platform_device_add(viper_pcmcia_device); |
163 | 185 | ||
164 | if (ret) | 186 | if (ret) { |
165 | platform_device_put(viper_pcmcia_device); | 187 | platform_device_put(viper_pcmcia_device); |
188 | arcom_pcmcia_dev = NULL; | ||
189 | } | ||
166 | 190 | ||
167 | return ret; | 191 | return ret; |
168 | } | 192 | } |
169 | 193 | ||
170 | static void __exit viper_pcmcia_exit(void) | 194 | static int viper_pcmcia_remove(struct platform_device *pdev) |
171 | { | 195 | { |
172 | platform_device_unregister(viper_pcmcia_device); | 196 | platform_device_unregister(viper_pcmcia_device); |
197 | arcom_pcmcia_dev = NULL; | ||
198 | return 0; | ||
199 | } | ||
200 | |||
201 | static struct platform_device_id viper_pcmcia_id_table[] = { | ||
202 | { .name = "viper-pcmcia", }, | ||
203 | { .name = "zeus-pcmcia", }, | ||
204 | { }, | ||
205 | }; | ||
206 | |||
207 | static struct platform_driver viper_pcmcia_driver = { | ||
208 | .probe = viper_pcmcia_probe, | ||
209 | .remove = viper_pcmcia_remove, | ||
210 | .driver = { | ||
211 | .name = "arcom-pcmcia", | ||
212 | .owner = THIS_MODULE, | ||
213 | }, | ||
214 | .id_table = viper_pcmcia_id_table, | ||
215 | }; | ||
216 | |||
217 | static int __init viper_pcmcia_init(void) | ||
218 | { | ||
219 | return platform_driver_register(&viper_pcmcia_driver); | ||
220 | } | ||
221 | |||
222 | static void __exit viper_pcmcia_exit(void) | ||
223 | { | ||
224 | return platform_driver_unregister(&viper_pcmcia_driver); | ||
173 | } | 225 | } |
174 | 226 | ||
175 | module_init(viper_pcmcia_init); | 227 | module_init(viper_pcmcia_init); |
176 | module_exit(viper_pcmcia_exit); | 228 | module_exit(viper_pcmcia_exit); |
177 | 229 | ||
230 | MODULE_DEVICE_TABLE(platform, viper_pcmcia_id_table); | ||
178 | MODULE_LICENSE("GPL"); | 231 | MODULE_LICENSE("GPL"); |