diff options
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/Makefile | 3 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_palmld.c | 151 |
2 files changed, 153 insertions, 1 deletions
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 20c5b06790a5..679ca927a62a 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -73,5 +73,6 @@ pxa2xx_cs-$(CONFIG_MACH_MAINSTONE) += pxa2xx_mainstone.o | |||
73 | pxa2xx_cs-$(CONFIG_PXA_SHARPSL) += pxa2xx_sharpsl.o | 73 | pxa2xx_cs-$(CONFIG_PXA_SHARPSL) += pxa2xx_sharpsl.o |
74 | pxa2xx_cs-$(CONFIG_MACH_ARMCORE) += pxa2xx_cm_x2xx.o pxa2xx_cm_x255.o pxa2xx_cm_x270.o | 74 | pxa2xx_cs-$(CONFIG_MACH_ARMCORE) += pxa2xx_cm_x2xx.o pxa2xx_cm_x255.o pxa2xx_cm_x270.o |
75 | pxa2xx_cs-$(CONFIG_TRIZEPS_PCMCIA) += pxa2xx_trizeps.o | 75 | pxa2xx_cs-$(CONFIG_TRIZEPS_PCMCIA) += pxa2xx_trizeps.o |
76 | pxa2xx_cs-$(CONFIG_MACH_PALMTX) += pxa2xx_palmtx.o | 76 | pxa2xx_cs-$(CONFIG_MACH_PALMTX) += pxa2xx_palmtx.o |
77 | pxa2xx_cs-$(CONFIG_MACH_PALMLD) += pxa2xx_palmld.o | ||
77 | 78 | ||
diff --git a/drivers/pcmcia/pxa2xx_palmld.c b/drivers/pcmcia/pxa2xx_palmld.c new file mode 100644 index 000000000000..1736c67e547e --- /dev/null +++ b/drivers/pcmcia/pxa2xx_palmld.c | |||
@@ -0,0 +1,151 @@ | |||
1 | /* | ||
2 | * linux/drivers/pcmcia/pxa2xx_palmld.c | ||
3 | * | ||
4 | * Driver for Palm LifeDrive PCMCIA | ||
5 | * | ||
6 | * Copyright (C) 2006 Alex Osborne <ato@meshy.org> | ||
7 | * Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/module.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/gpio.h> | ||
18 | |||
19 | #include <asm/mach-types.h> | ||
20 | #include <mach/palmld.h> | ||
21 | #include "soc_common.h" | ||
22 | |||
23 | static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | ||
24 | { | ||
25 | int ret; | ||
26 | |||
27 | ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_POWER, "PCMCIA PWR"); | ||
28 | if (ret) | ||
29 | goto err1; | ||
30 | ret = gpio_direction_output(GPIO_NR_PALMLD_PCMCIA_POWER, 0); | ||
31 | if (ret) | ||
32 | goto err2; | ||
33 | |||
34 | ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_RESET, "PCMCIA RST"); | ||
35 | if (ret) | ||
36 | goto err2; | ||
37 | ret = gpio_direction_output(GPIO_NR_PALMLD_PCMCIA_RESET, 1); | ||
38 | if (ret) | ||
39 | goto err3; | ||
40 | |||
41 | ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_READY, "PCMCIA RDY"); | ||
42 | if (ret) | ||
43 | goto err3; | ||
44 | ret = gpio_direction_input(GPIO_NR_PALMLD_PCMCIA_READY); | ||
45 | if (ret) | ||
46 | goto err4; | ||
47 | |||
48 | skt->irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY); | ||
49 | return 0; | ||
50 | |||
51 | err4: | ||
52 | gpio_free(GPIO_NR_PALMLD_PCMCIA_READY); | ||
53 | err3: | ||
54 | gpio_free(GPIO_NR_PALMLD_PCMCIA_RESET); | ||
55 | err2: | ||
56 | gpio_free(GPIO_NR_PALMLD_PCMCIA_POWER); | ||
57 | err1: | ||
58 | return ret; | ||
59 | } | ||
60 | |||
61 | static void palmld_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | ||
62 | { | ||
63 | gpio_free(GPIO_NR_PALMLD_PCMCIA_READY); | ||
64 | gpio_free(GPIO_NR_PALMLD_PCMCIA_RESET); | ||
65 | gpio_free(GPIO_NR_PALMLD_PCMCIA_POWER); | ||
66 | } | ||
67 | |||
68 | static void palmld_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | ||
69 | struct pcmcia_state *state) | ||
70 | { | ||
71 | state->detect = 1; /* always inserted */ | ||
72 | state->ready = !!gpio_get_value(GPIO_NR_PALMLD_PCMCIA_READY); | ||
73 | state->bvd1 = 1; | ||
74 | state->bvd2 = 1; | ||
75 | state->wrprot = 0; | ||
76 | state->vs_3v = 1; | ||
77 | state->vs_Xv = 0; | ||
78 | } | ||
79 | |||
80 | static int palmld_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | ||
81 | const socket_state_t *state) | ||
82 | { | ||
83 | gpio_set_value(GPIO_NR_PALMLD_PCMCIA_POWER, 1); | ||
84 | gpio_set_value(GPIO_NR_PALMLD_PCMCIA_RESET, | ||
85 | !!(state->flags & SS_RESET)); | ||
86 | |||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | static void palmld_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | ||
91 | { | ||
92 | } | ||
93 | |||
94 | static void palmld_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | ||
95 | { | ||
96 | } | ||
97 | |||
98 | static struct pcmcia_low_level palmld_pcmcia_ops = { | ||
99 | .owner = THIS_MODULE, | ||
100 | |||
101 | .first = 0, | ||
102 | .nr = 2, | ||
103 | |||
104 | .hw_init = palmld_pcmcia_hw_init, | ||
105 | .hw_shutdown = palmld_pcmcia_hw_shutdown, | ||
106 | |||
107 | .socket_state = palmld_pcmcia_socket_state, | ||
108 | .configure_socket = palmld_pcmcia_configure_socket, | ||
109 | |||
110 | .socket_init = palmld_pcmcia_socket_init, | ||
111 | .socket_suspend = palmld_pcmcia_socket_suspend, | ||
112 | }; | ||
113 | |||
114 | static struct platform_device *palmld_pcmcia_device; | ||
115 | |||
116 | static int __init palmld_pcmcia_init(void) | ||
117 | { | ||
118 | int ret; | ||
119 | |||
120 | if (!machine_is_palmld()) | ||
121 | return -ENODEV; | ||
122 | |||
123 | palmld_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); | ||
124 | if (!palmld_pcmcia_device) | ||
125 | return -ENOMEM; | ||
126 | |||
127 | ret = platform_device_add_data(palmld_pcmcia_device, &palmld_pcmcia_ops, | ||
128 | sizeof(palmld_pcmcia_ops)); | ||
129 | |||
130 | if (!ret) | ||
131 | ret = platform_device_add(palmld_pcmcia_device); | ||
132 | |||
133 | if (ret) | ||
134 | platform_device_put(palmld_pcmcia_device); | ||
135 | |||
136 | return ret; | ||
137 | } | ||
138 | |||
139 | static void __exit palmld_pcmcia_exit(void) | ||
140 | { | ||
141 | platform_device_unregister(palmld_pcmcia_device); | ||
142 | } | ||
143 | |||
144 | module_init(palmld_pcmcia_init); | ||
145 | module_exit(palmld_pcmcia_exit); | ||
146 | |||
147 | MODULE_AUTHOR("Alex Osborne <ato@meshy.org>," | ||
148 | " Marek Vasut <marek.vasut@gmail.com>"); | ||
149 | MODULE_DESCRIPTION("PCMCIA support for Palm LifeDrive"); | ||
150 | MODULE_ALIAS("platform:pxa2xx-pcmcia"); | ||
151 | MODULE_LICENSE("GPL"); | ||