diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/pcmcia/pxa2xx_viper.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'drivers/pcmcia/pxa2xx_viper.c')
-rw-r--r-- | drivers/pcmcia/pxa2xx_viper.c | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/drivers/pcmcia/pxa2xx_viper.c b/drivers/pcmcia/pxa2xx_viper.c index a76f495953a..1064b1c2869 100644 --- a/drivers/pcmcia/pxa2xx_viper.c +++ b/drivers/pcmcia/pxa2xx_viper.c | |||
@@ -25,13 +25,20 @@ | |||
25 | 25 | ||
26 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
27 | 27 | ||
28 | #include <linux/platform_data/pcmcia-pxa2xx_viper.h> | 28 | #include <mach/arcom-pcmcia.h> |
29 | 29 | ||
30 | #include "soc_common.h" | 30 | #include "soc_common.h" |
31 | #include "pxa2xx_base.h" | 31 | #include "pxa2xx_base.h" |
32 | 32 | ||
33 | static struct platform_device *arcom_pcmcia_dev; | 33 | static struct platform_device *arcom_pcmcia_dev; |
34 | 34 | ||
35 | static struct pcmcia_irqs irqs[] = { | ||
36 | { | ||
37 | .sock = 0, | ||
38 | .str = "PCMCIA_CD", | ||
39 | }, | ||
40 | }; | ||
41 | |||
35 | static inline struct arcom_pcmcia_pdata *viper_get_pdata(void) | 42 | static inline struct arcom_pcmcia_pdata *viper_get_pdata(void) |
36 | { | 43 | { |
37 | return arcom_pcmcia_dev->dev.platform_data; | 44 | return arcom_pcmcia_dev->dev.platform_data; |
@@ -42,28 +49,38 @@ static int viper_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
42 | struct arcom_pcmcia_pdata *pdata = viper_get_pdata(); | 49 | struct arcom_pcmcia_pdata *pdata = viper_get_pdata(); |
43 | unsigned long flags; | 50 | unsigned long flags; |
44 | 51 | ||
45 | skt->stat[SOC_STAT_CD].gpio = pdata->cd_gpio; | 52 | skt->socket.pci_irq = gpio_to_irq(pdata->rdy_gpio); |
46 | skt->stat[SOC_STAT_CD].name = "PCMCIA_CD"; | 53 | irqs[0].irq = gpio_to_irq(pdata->cd_gpio); |
47 | skt->stat[SOC_STAT_RDY].gpio = pdata->rdy_gpio; | 54 | |
48 | skt->stat[SOC_STAT_RDY].name = "CF ready"; | 55 | if (gpio_request(pdata->cd_gpio, "CF detect")) |
56 | goto err_request_cd; | ||
57 | |||
58 | if (gpio_request(pdata->rdy_gpio, "CF ready")) | ||
59 | goto err_request_rdy; | ||
49 | 60 | ||
50 | if (gpio_request(pdata->pwr_gpio, "CF power")) | 61 | if (gpio_request(pdata->pwr_gpio, "CF power")) |
51 | goto err_request_pwr; | 62 | goto err_request_pwr; |
52 | 63 | ||
53 | local_irq_save(flags); | 64 | local_irq_save(flags); |
54 | 65 | ||
55 | if (gpio_direction_output(pdata->pwr_gpio, 0)) { | 66 | if (gpio_direction_output(pdata->pwr_gpio, 0) || |
67 | gpio_direction_input(pdata->cd_gpio) || | ||
68 | gpio_direction_input(pdata->rdy_gpio)) { | ||
56 | local_irq_restore(flags); | 69 | local_irq_restore(flags); |
57 | goto err_dir; | 70 | goto err_dir; |
58 | } | 71 | } |
59 | 72 | ||
60 | local_irq_restore(flags); | 73 | local_irq_restore(flags); |
61 | 74 | ||
62 | return 0; | 75 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
63 | 76 | ||
64 | err_dir: | 77 | err_dir: |
65 | gpio_free(pdata->pwr_gpio); | 78 | gpio_free(pdata->pwr_gpio); |
66 | err_request_pwr: | 79 | err_request_pwr: |
80 | gpio_free(pdata->rdy_gpio); | ||
81 | err_request_rdy: | ||
82 | gpio_free(pdata->cd_gpio); | ||
83 | err_request_cd: | ||
67 | dev_err(&arcom_pcmcia_dev->dev, "Failed to setup PCMCIA GPIOs\n"); | 84 | dev_err(&arcom_pcmcia_dev->dev, "Failed to setup PCMCIA GPIOs\n"); |
68 | return -1; | 85 | return -1; |
69 | } | 86 | } |
@@ -75,12 +92,22 @@ static void viper_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | |||
75 | { | 92 | { |
76 | struct arcom_pcmcia_pdata *pdata = viper_get_pdata(); | 93 | struct arcom_pcmcia_pdata *pdata = viper_get_pdata(); |
77 | 94 | ||
95 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
78 | gpio_free(pdata->pwr_gpio); | 96 | gpio_free(pdata->pwr_gpio); |
97 | gpio_free(pdata->rdy_gpio); | ||
98 | gpio_free(pdata->cd_gpio); | ||
79 | } | 99 | } |
80 | 100 | ||
81 | static void viper_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | 101 | static void viper_pcmcia_socket_state(struct soc_pcmcia_socket *skt, |
82 | struct pcmcia_state *state) | 102 | struct pcmcia_state *state) |
83 | { | 103 | { |
104 | struct arcom_pcmcia_pdata *pdata = viper_get_pdata(); | ||
105 | |||
106 | state->detect = !gpio_get_value(pdata->cd_gpio); | ||
107 | state->ready = !!gpio_get_value(pdata->rdy_gpio); | ||
108 | state->bvd1 = 1; | ||
109 | state->bvd2 = 1; | ||
110 | state->wrprot = 0; | ||
84 | state->vs_3v = 1; /* Can only apply 3.3V */ | 111 | state->vs_3v = 1; /* Can only apply 3.3V */ |
85 | state->vs_Xv = 0; | 112 | state->vs_Xv = 0; |
86 | } | 113 | } |
@@ -177,7 +204,18 @@ static struct platform_driver viper_pcmcia_driver = { | |||
177 | .id_table = viper_pcmcia_id_table, | 204 | .id_table = viper_pcmcia_id_table, |
178 | }; | 205 | }; |
179 | 206 | ||
180 | module_platform_driver(viper_pcmcia_driver); | 207 | static int __init viper_pcmcia_init(void) |
208 | { | ||
209 | return platform_driver_register(&viper_pcmcia_driver); | ||
210 | } | ||
211 | |||
212 | static void __exit viper_pcmcia_exit(void) | ||
213 | { | ||
214 | return platform_driver_unregister(&viper_pcmcia_driver); | ||
215 | } | ||
216 | |||
217 | module_init(viper_pcmcia_init); | ||
218 | module_exit(viper_pcmcia_exit); | ||
181 | 219 | ||
182 | MODULE_DEVICE_TABLE(platform, viper_pcmcia_id_table); | 220 | MODULE_DEVICE_TABLE(platform, viper_pcmcia_id_table); |
183 | MODULE_LICENSE("GPL"); | 221 | MODULE_LICENSE("GPL"); |