Commit ff80aa57cc9946d3dafe65119d576b3d11304303
1 parent
11990b2b28
Exists in
master
and in
20 other branches
PCMCIA: sa1111: rename sa1111 socket drivers to have sa1111_ prefix.
Acked-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Showing 9 changed files with 654 additions and 654 deletions Side-by-side Diff
drivers/pcmcia/Makefile
... | ... | @@ -40,10 +40,10 @@ |
40 | 40 | obj-$(CONFIG_PCMCIA_ALCHEMY_DEVBOARD) += db1xxx_ss.o |
41 | 41 | |
42 | 42 | sa1111_cs-y += sa1111_generic.o |
43 | -sa1111_cs-$(CONFIG_ASSABET_NEPONSET) += sa1100_neponset.o | |
44 | -sa1111_cs-$(CONFIG_SA1100_BADGE4) += sa1100_badge4.o | |
45 | -sa1111_cs-$(CONFIG_SA1100_JORNADA720) += sa1100_jornada720.o | |
46 | -sa1111_cs-$(CONFIG_ARCH_LUBBOCK) += pxa2xx_lubbock.o | |
43 | +sa1111_cs-$(CONFIG_ASSABET_NEPONSET) += sa1111_neponset.o | |
44 | +sa1111_cs-$(CONFIG_SA1100_BADGE4) += sa1111_badge4.o | |
45 | +sa1111_cs-$(CONFIG_SA1100_JORNADA720) += sa1111_jornada720.o | |
46 | +sa1111_cs-$(CONFIG_ARCH_LUBBOCK) += sa1111_lubbock.o | |
47 | 47 | |
48 | 48 | sa1100_cs-y += sa1100_generic.o |
49 | 49 | sa1100_cs-$(CONFIG_SA1100_ASSABET) += sa1100_assabet.o |
drivers/pcmcia/pxa2xx_lubbock.c
1 | -/* | |
2 | - * linux/drivers/pcmcia/pxa2xx_lubbock.c | |
3 | - * | |
4 | - * Author: George Davis | |
5 | - * Created: Jan 10, 2002 | |
6 | - * Copyright: MontaVista Software Inc. | |
7 | - * | |
8 | - * This program is free software; you can redistribute it and/or modify | |
9 | - * it under the terms of the GNU General Public License version 2 as | |
10 | - * published by the Free Software Foundation. | |
11 | - * | |
12 | - * Originally based upon linux/drivers/pcmcia/sa1100_neponset.c | |
13 | - * | |
14 | - * Lubbock PCMCIA specific routines. | |
15 | - * | |
16 | - */ | |
17 | -#include <linux/module.h> | |
18 | -#include <linux/kernel.h> | |
19 | -#include <linux/device.h> | |
20 | -#include <linux/errno.h> | |
21 | -#include <linux/init.h> | |
22 | -#include <linux/delay.h> | |
23 | - | |
24 | -#include <mach/hardware.h> | |
25 | -#include <asm/hardware/sa1111.h> | |
26 | -#include <asm/mach-types.h> | |
27 | -#include <mach/lubbock.h> | |
28 | - | |
29 | -#include "sa1111_generic.h" | |
30 | - | |
31 | -static int | |
32 | -lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |
33 | - const socket_state_t *state) | |
34 | -{ | |
35 | - struct sa1111_pcmcia_socket *s = to_skt(skt); | |
36 | - unsigned int pa_dwr_mask, pa_dwr_set, misc_mask, misc_set; | |
37 | - int ret = 0; | |
38 | - | |
39 | - pa_dwr_mask = pa_dwr_set = misc_mask = misc_set = 0; | |
40 | - | |
41 | - /* Lubbock uses the Maxim MAX1602, with the following connections: | |
42 | - * | |
43 | - * Socket 0 (PCMCIA): | |
44 | - * MAX1602 Lubbock Register | |
45 | - * Pin Signal | |
46 | - * ----- ------- ---------------------- | |
47 | - * A0VPP S0_PWR0 SA-1111 GPIO A<0> | |
48 | - * A1VPP S0_PWR1 SA-1111 GPIO A<1> | |
49 | - * A0VCC S0_PWR2 SA-1111 GPIO A<2> | |
50 | - * A1VCC S0_PWR3 SA-1111 GPIO A<3> | |
51 | - * VX VCC | |
52 | - * VY +3.3V | |
53 | - * 12IN +12V | |
54 | - * CODE +3.3V Cirrus Code, CODE = High (VY) | |
55 | - * | |
56 | - * Socket 1 (CF): | |
57 | - * MAX1602 Lubbock Register | |
58 | - * Pin Signal | |
59 | - * ----- ------- ---------------------- | |
60 | - * A0VPP GND VPP is not connected | |
61 | - * A1VPP GND VPP is not connected | |
62 | - * A0VCC S1_PWR0 MISC_WR<14> | |
63 | - * A1VCC S1_PWR1 MISC_WR<15> | |
64 | - * VX VCC | |
65 | - * VY +3.3V | |
66 | - * 12IN GND VPP is not connected | |
67 | - * CODE +3.3V Cirrus Code, CODE = High (VY) | |
68 | - * | |
69 | - */ | |
70 | - | |
71 | - again: | |
72 | - switch (skt->nr) { | |
73 | - case 0: | |
74 | - pa_dwr_mask = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; | |
75 | - | |
76 | - switch (state->Vcc) { | |
77 | - case 0: /* Hi-Z */ | |
78 | - break; | |
79 | - | |
80 | - case 33: /* VY */ | |
81 | - pa_dwr_set |= GPIO_A3; | |
82 | - break; | |
83 | - | |
84 | - case 50: /* VX */ | |
85 | - pa_dwr_set |= GPIO_A2; | |
86 | - break; | |
87 | - | |
88 | - default: | |
89 | - printk(KERN_ERR "%s(): unrecognized Vcc %u\n", | |
90 | - __func__, state->Vcc); | |
91 | - ret = -1; | |
92 | - } | |
93 | - | |
94 | - switch (state->Vpp) { | |
95 | - case 0: /* Hi-Z */ | |
96 | - break; | |
97 | - | |
98 | - case 120: /* 12IN */ | |
99 | - pa_dwr_set |= GPIO_A1; | |
100 | - break; | |
101 | - | |
102 | - default: /* VCC */ | |
103 | - if (state->Vpp == state->Vcc) | |
104 | - pa_dwr_set |= GPIO_A0; | |
105 | - else { | |
106 | - printk(KERN_ERR "%s(): unrecognized Vpp %u\n", | |
107 | - __func__, state->Vpp); | |
108 | - ret = -1; | |
109 | - break; | |
110 | - } | |
111 | - } | |
112 | - break; | |
113 | - | |
114 | - case 1: | |
115 | - misc_mask = (1 << 15) | (1 << 14); | |
116 | - | |
117 | - switch (state->Vcc) { | |
118 | - case 0: /* Hi-Z */ | |
119 | - break; | |
120 | - | |
121 | - case 33: /* VY */ | |
122 | - misc_set |= 1 << 15; | |
123 | - break; | |
124 | - | |
125 | - case 50: /* VX */ | |
126 | - misc_set |= 1 << 14; | |
127 | - break; | |
128 | - | |
129 | - default: | |
130 | - printk(KERN_ERR "%s(): unrecognized Vcc %u\n", | |
131 | - __func__, state->Vcc); | |
132 | - ret = -1; | |
133 | - break; | |
134 | - } | |
135 | - | |
136 | - if (state->Vpp != state->Vcc && state->Vpp != 0) { | |
137 | - printk(KERN_ERR "%s(): CF slot cannot support Vpp %u\n", | |
138 | - __func__, state->Vpp); | |
139 | - ret = -1; | |
140 | - break; | |
141 | - } | |
142 | - break; | |
143 | - | |
144 | - default: | |
145 | - ret = -1; | |
146 | - } | |
147 | - | |
148 | - if (ret == 0) | |
149 | - ret = sa1111_pcmcia_configure_socket(skt, state); | |
150 | - | |
151 | - if (ret == 0) { | |
152 | - lubbock_set_misc_wr(misc_mask, misc_set); | |
153 | - sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set); | |
154 | - } | |
155 | - | |
156 | -#if 1 | |
157 | - if (ret == 0 && state->Vcc == 33) { | |
158 | - struct pcmcia_state new_state; | |
159 | - | |
160 | - /* | |
161 | - * HACK ALERT: | |
162 | - * We can't sense the voltage properly on Lubbock before | |
163 | - * actually applying some power to the socket (catch 22). | |
164 | - * Resense the socket Voltage Sense pins after applying | |
165 | - * socket power. | |
166 | - * | |
167 | - * Note: It takes about 2.5ms for the MAX1602 VCC output | |
168 | - * to rise. | |
169 | - */ | |
170 | - mdelay(3); | |
171 | - | |
172 | - sa1111_pcmcia_socket_state(skt, &new_state); | |
173 | - | |
174 | - if (!new_state.vs_3v && !new_state.vs_Xv) { | |
175 | - /* | |
176 | - * Switch to 5V, Configure socket with 5V voltage | |
177 | - */ | |
178 | - lubbock_set_misc_wr(misc_mask, 0); | |
179 | - sa1111_set_io(s->dev, pa_dwr_mask, 0); | |
180 | - | |
181 | - /* | |
182 | - * It takes about 100ms to turn off Vcc. | |
183 | - */ | |
184 | - mdelay(100); | |
185 | - | |
186 | - /* | |
187 | - * We need to hack around the const qualifier as | |
188 | - * well to keep this ugly workaround localized and | |
189 | - * not force it to the rest of the code. Barf bags | |
190 | - * available in the seat pocket in front of you! | |
191 | - */ | |
192 | - ((socket_state_t *)state)->Vcc = 50; | |
193 | - ((socket_state_t *)state)->Vpp = 50; | |
194 | - goto again; | |
195 | - } | |
196 | - } | |
197 | -#endif | |
198 | - | |
199 | - return ret; | |
200 | -} | |
201 | - | |
202 | -static struct pcmcia_low_level lubbock_pcmcia_ops = { | |
203 | - .owner = THIS_MODULE, | |
204 | - .configure_socket = lubbock_pcmcia_configure_socket, | |
205 | - .first = 0, | |
206 | - .nr = 2, | |
207 | -}; | |
208 | - | |
209 | -#include "pxa2xx_base.h" | |
210 | - | |
211 | -int pcmcia_lubbock_init(struct sa1111_dev *sadev) | |
212 | -{ | |
213 | - int ret = -ENODEV; | |
214 | - | |
215 | - if (machine_is_lubbock()) { | |
216 | - /* | |
217 | - * Set GPIO_A<3:0> to be outputs for the MAX1600, | |
218 | - * and switch to standby mode. | |
219 | - */ | |
220 | - sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); | |
221 | - sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | |
222 | - sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | |
223 | - | |
224 | - /* Set CF Socket 1 power to standby mode. */ | |
225 | - lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); | |
226 | - | |
227 | - pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); | |
228 | - pxa2xx_configure_sockets(&sadev->dev); | |
229 | - ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops, | |
230 | - pxa2xx_drv_pcmcia_add_one); | |
231 | - } | |
232 | - | |
233 | - return ret; | |
234 | -} | |
235 | - | |
236 | -MODULE_LICENSE("GPL"); |
drivers/pcmcia/sa1100_badge4.c
1 | -/* | |
2 | - * linux/drivers/pcmcia/sa1100_badge4.c | |
3 | - * | |
4 | - * BadgePAD 4 PCMCIA specific routines | |
5 | - * | |
6 | - * Christopher Hoover <ch@hpl.hp.com> | |
7 | - * | |
8 | - * Copyright (C) 2002 Hewlett-Packard Company | |
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 | - */ | |
15 | -#include <linux/module.h> | |
16 | -#include <linux/kernel.h> | |
17 | -#include <linux/device.h> | |
18 | -#include <linux/errno.h> | |
19 | -#include <linux/init.h> | |
20 | - | |
21 | -#include <mach/hardware.h> | |
22 | -#include <asm/mach-types.h> | |
23 | -#include <mach/badge4.h> | |
24 | -#include <asm/hardware/sa1111.h> | |
25 | - | |
26 | -#include "sa1111_generic.h" | |
27 | - | |
28 | -/* | |
29 | - * BadgePAD 4 Details | |
30 | - * | |
31 | - * PCM Vcc: | |
32 | - * | |
33 | - * PCM Vcc on BadgePAD 4 can be jumpered for 3v3 (short pins 1 and 3 | |
34 | - * on JP6) or 5v0 (short pins 3 and 5 on JP6). | |
35 | - * | |
36 | - * PCM Vpp: | |
37 | - * | |
38 | - * PCM Vpp on BadgePAD 4 can be jumpered for 12v0 (short pins 4 and 6 | |
39 | - * on JP6) or tied to PCM Vcc (short pins 2 and 4 on JP6). N.B., | |
40 | - * 12v0 operation requires that the power supply actually supply 12v0 | |
41 | - * via pin 7 of JP7. | |
42 | - * | |
43 | - * CF Vcc: | |
44 | - * | |
45 | - * CF Vcc on BadgePAD 4 can be jumpered either for 3v3 (short pins 1 | |
46 | - * and 2 on JP10) or 5v0 (short pins 2 and 3 on JP10). | |
47 | - * | |
48 | - * Unfortunately there's no way programmatically to determine how a | |
49 | - * given board is jumpered. This code assumes a default jumpering | |
50 | - * as described below. | |
51 | - * | |
52 | - * If the defaults aren't correct, you may override them with a pcmv | |
53 | - * setup argument: pcmv=<pcm vcc>,<pcm vpp>,<cf vcc>. The units are | |
54 | - * tenths of volts; e.g. pcmv=33,120,50 indicates 3v3 PCM Vcc, 12v0 | |
55 | - * PCM Vpp, and 5v0 CF Vcc. | |
56 | - * | |
57 | - */ | |
58 | - | |
59 | -static int badge4_pcmvcc = 50; /* pins 3 and 5 jumpered on JP6 */ | |
60 | -static int badge4_pcmvpp = 50; /* pins 2 and 4 jumpered on JP6 */ | |
61 | -static int badge4_cfvcc = 33; /* pins 1 and 2 jumpered on JP10 */ | |
62 | - | |
63 | -static void complain_about_jumpering(const char *whom, | |
64 | - const char *supply, | |
65 | - int given, int wanted) | |
66 | -{ | |
67 | - printk(KERN_ERR | |
68 | - "%s: %s %d.%dV wanted but board is jumpered for %s %d.%dV operation" | |
69 | - "; re-jumper the board and/or use pcmv=xx,xx,xx\n", | |
70 | - whom, supply, | |
71 | - wanted / 10, wanted % 10, | |
72 | - supply, | |
73 | - given / 10, given % 10); | |
74 | -} | |
75 | - | |
76 | -static int | |
77 | -badge4_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) | |
78 | -{ | |
79 | - int ret; | |
80 | - | |
81 | - switch (skt->nr) { | |
82 | - case 0: | |
83 | - if ((state->Vcc != 0) && | |
84 | - (state->Vcc != badge4_pcmvcc)) { | |
85 | - complain_about_jumpering(__func__, "pcmvcc", | |
86 | - badge4_pcmvcc, state->Vcc); | |
87 | - // Apply power regardless of the jumpering. | |
88 | - // return -1; | |
89 | - } | |
90 | - if ((state->Vpp != 0) && | |
91 | - (state->Vpp != badge4_pcmvpp)) { | |
92 | - complain_about_jumpering(__func__, "pcmvpp", | |
93 | - badge4_pcmvpp, state->Vpp); | |
94 | - return -1; | |
95 | - } | |
96 | - break; | |
97 | - | |
98 | - case 1: | |
99 | - if ((state->Vcc != 0) && | |
100 | - (state->Vcc != badge4_cfvcc)) { | |
101 | - complain_about_jumpering(__func__, "cfvcc", | |
102 | - badge4_cfvcc, state->Vcc); | |
103 | - return -1; | |
104 | - } | |
105 | - break; | |
106 | - | |
107 | - default: | |
108 | - return -1; | |
109 | - } | |
110 | - | |
111 | - ret = sa1111_pcmcia_configure_socket(skt, state); | |
112 | - if (ret == 0) { | |
113 | - unsigned long flags; | |
114 | - int need5V; | |
115 | - | |
116 | - local_irq_save(flags); | |
117 | - | |
118 | - need5V = ((state->Vcc == 50) || (state->Vpp == 50)); | |
119 | - | |
120 | - badge4_set_5V(BADGE4_5V_PCMCIA_SOCK(skt->nr), need5V); | |
121 | - | |
122 | - local_irq_restore(flags); | |
123 | - } | |
124 | - | |
125 | - return ret; | |
126 | -} | |
127 | - | |
128 | -static struct pcmcia_low_level badge4_pcmcia_ops = { | |
129 | - .owner = THIS_MODULE, | |
130 | - .configure_socket = badge4_pcmcia_configure_socket, | |
131 | - .first = 0, | |
132 | - .nr = 2, | |
133 | -}; | |
134 | - | |
135 | -int pcmcia_badge4_init(struct device *dev) | |
136 | -{ | |
137 | - int ret = -ENODEV; | |
138 | - | |
139 | - if (machine_is_badge4()) { | |
140 | - printk(KERN_INFO | |
141 | - "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n", | |
142 | - __func__, | |
143 | - badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); | |
144 | - | |
145 | - sa11xx_drv_pcmcia_ops(&badge4_pcmcia_ops); | |
146 | - ret = sa1111_pcmcia_add(dev, &badge4_pcmcia_ops, | |
147 | - sa11xx_drv_pcmcia_add_one); | |
148 | - } | |
149 | - | |
150 | - return ret; | |
151 | -} | |
152 | - | |
153 | -static int __init pcmv_setup(char *s) | |
154 | -{ | |
155 | - int v[4]; | |
156 | - | |
157 | - s = get_options(s, ARRAY_SIZE(v), v); | |
158 | - | |
159 | - if (v[0] >= 1) badge4_pcmvcc = v[1]; | |
160 | - if (v[0] >= 2) badge4_pcmvpp = v[2]; | |
161 | - if (v[0] >= 3) badge4_cfvcc = v[3]; | |
162 | - | |
163 | - return 1; | |
164 | -} | |
165 | - | |
166 | -__setup("pcmv=", pcmv_setup); |
drivers/pcmcia/sa1100_jornada720.c
1 | -/* | |
2 | - * drivers/pcmcia/sa1100_jornada720.c | |
3 | - * | |
4 | - * Jornada720 PCMCIA specific routines | |
5 | - * | |
6 | - */ | |
7 | -#include <linux/module.h> | |
8 | -#include <linux/kernel.h> | |
9 | -#include <linux/device.h> | |
10 | -#include <linux/errno.h> | |
11 | -#include <linux/init.h> | |
12 | - | |
13 | -#include <mach/hardware.h> | |
14 | -#include <asm/hardware/sa1111.h> | |
15 | -#include <asm/mach-types.h> | |
16 | - | |
17 | -#include "sa1111_generic.h" | |
18 | - | |
19 | -/* Does SOCKET1_3V actually do anything? */ | |
20 | -#define SOCKET0_POWER GPIO_GPIO0 | |
21 | -#define SOCKET0_3V GPIO_GPIO2 | |
22 | -#define SOCKET1_POWER (GPIO_GPIO1 | GPIO_GPIO3) | |
23 | -#define SOCKET1_3V GPIO_GPIO3 | |
24 | - | |
25 | -static int | |
26 | -jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) | |
27 | -{ | |
28 | - struct sa1111_pcmcia_socket *s = to_skt(skt); | |
29 | - unsigned int pa_dwr_mask, pa_dwr_set; | |
30 | - int ret; | |
31 | - | |
32 | - printk(KERN_INFO "%s(): config socket %d vcc %d vpp %d\n", __func__, | |
33 | - skt->nr, state->Vcc, state->Vpp); | |
34 | - | |
35 | - switch (skt->nr) { | |
36 | - case 0: | |
37 | - pa_dwr_mask = SOCKET0_POWER | SOCKET0_3V; | |
38 | - | |
39 | - switch (state->Vcc) { | |
40 | - default: | |
41 | - case 0: | |
42 | - pa_dwr_set = 0; | |
43 | - break; | |
44 | - case 33: | |
45 | - pa_dwr_set = SOCKET0_POWER | SOCKET0_3V; | |
46 | - break; | |
47 | - case 50: | |
48 | - pa_dwr_set = SOCKET0_POWER; | |
49 | - break; | |
50 | - } | |
51 | - break; | |
52 | - | |
53 | - case 1: | |
54 | - pa_dwr_mask = SOCKET1_POWER; | |
55 | - | |
56 | - switch (state->Vcc) { | |
57 | - default: | |
58 | - case 0: | |
59 | - pa_dwr_set = 0; | |
60 | - break; | |
61 | - case 33: | |
62 | - pa_dwr_set = SOCKET1_POWER; | |
63 | - break; | |
64 | - case 50: | |
65 | - pa_dwr_set = SOCKET1_POWER; | |
66 | - break; | |
67 | - } | |
68 | - break; | |
69 | - | |
70 | - default: | |
71 | - return -1; | |
72 | - } | |
73 | - | |
74 | - if (state->Vpp != state->Vcc && state->Vpp != 0) { | |
75 | - printk(KERN_ERR "%s(): slot cannot support VPP %u\n", | |
76 | - __func__, state->Vpp); | |
77 | - return -EPERM; | |
78 | - } | |
79 | - | |
80 | - ret = sa1111_pcmcia_configure_socket(skt, state); | |
81 | - if (ret == 0) | |
82 | - sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set); | |
83 | - | |
84 | - return ret; | |
85 | -} | |
86 | - | |
87 | -static struct pcmcia_low_level jornada720_pcmcia_ops = { | |
88 | - .owner = THIS_MODULE, | |
89 | - .configure_socket = jornada720_pcmcia_configure_socket, | |
90 | - .first = 0, | |
91 | - .nr = 2, | |
92 | -}; | |
93 | - | |
94 | -int __devinit pcmcia_jornada720_init(struct device *dev) | |
95 | -{ | |
96 | - int ret = -ENODEV; | |
97 | - | |
98 | - if (machine_is_jornada720()) { | |
99 | - unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; | |
100 | - | |
101 | - GRER |= 0x00000002; | |
102 | - | |
103 | - /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ | |
104 | - sa1111_set_io_dir(dev, pin, 0, 0); | |
105 | - sa1111_set_io(dev, pin, 0); | |
106 | - sa1111_set_sleep_io(dev, pin, 0); | |
107 | - | |
108 | - sa11xx_drv_pcmcia_ops(&jornada720_pcmcia_ops); | |
109 | - ret = sa1111_pcmcia_add(dev, &jornada720_pcmcia_ops, | |
110 | - sa11xx_drv_pcmcia_add_one); | |
111 | - } | |
112 | - | |
113 | - return ret; | |
114 | -} |
drivers/pcmcia/sa1100_neponset.c
1 | -/* | |
2 | - * linux/drivers/pcmcia/sa1100_neponset.c | |
3 | - * | |
4 | - * Neponset PCMCIA specific routines | |
5 | - */ | |
6 | -#include <linux/module.h> | |
7 | -#include <linux/kernel.h> | |
8 | -#include <linux/device.h> | |
9 | -#include <linux/errno.h> | |
10 | -#include <linux/init.h> | |
11 | - | |
12 | -#include <mach/hardware.h> | |
13 | -#include <asm/mach-types.h> | |
14 | -#include <mach/neponset.h> | |
15 | -#include <asm/hardware/sa1111.h> | |
16 | - | |
17 | -#include "sa1111_generic.h" | |
18 | - | |
19 | -/* | |
20 | - * Neponset uses the Maxim MAX1600, with the following connections: | |
21 | - * | |
22 | - * MAX1600 Neponset | |
23 | - * | |
24 | - * A0VCC SA-1111 GPIO A<1> | |
25 | - * A1VCC SA-1111 GPIO A<0> | |
26 | - * A0VPP CPLD NCR A0VPP | |
27 | - * A1VPP CPLD NCR A1VPP | |
28 | - * B0VCC SA-1111 GPIO A<2> | |
29 | - * B1VCC SA-1111 GPIO A<3> | |
30 | - * B0VPP ground (slot B is CF) | |
31 | - * B1VPP ground (slot B is CF) | |
32 | - * | |
33 | - * VX VCC (5V) | |
34 | - * VY VCC3_3 (3.3V) | |
35 | - * 12INA 12V | |
36 | - * 12INB ground (slot B is CF) | |
37 | - * | |
38 | - * The MAX1600 CODE pin is tied to ground, placing the device in | |
39 | - * "Standard Intel code" mode. Refer to the Maxim data sheet for | |
40 | - * the corresponding truth table. | |
41 | - */ | |
42 | - | |
43 | -static int | |
44 | -neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) | |
45 | -{ | |
46 | - struct sa1111_pcmcia_socket *s = to_skt(skt); | |
47 | - unsigned int ncr_mask, ncr_set, pa_dwr_mask, pa_dwr_set; | |
48 | - int ret; | |
49 | - | |
50 | - switch (skt->nr) { | |
51 | - case 0: | |
52 | - pa_dwr_mask = GPIO_A0 | GPIO_A1; | |
53 | - ncr_mask = NCR_A0VPP | NCR_A1VPP; | |
54 | - | |
55 | - if (state->Vpp == 0) | |
56 | - ncr_set = 0; | |
57 | - else if (state->Vpp == 120) | |
58 | - ncr_set = NCR_A1VPP; | |
59 | - else if (state->Vpp == state->Vcc) | |
60 | - ncr_set = NCR_A0VPP; | |
61 | - else { | |
62 | - printk(KERN_ERR "%s(): unrecognized VPP %u\n", | |
63 | - __func__, state->Vpp); | |
64 | - return -1; | |
65 | - } | |
66 | - break; | |
67 | - | |
68 | - case 1: | |
69 | - pa_dwr_mask = GPIO_A2 | GPIO_A3; | |
70 | - ncr_mask = 0; | |
71 | - ncr_set = 0; | |
72 | - | |
73 | - if (state->Vpp != state->Vcc && state->Vpp != 0) { | |
74 | - printk(KERN_ERR "%s(): CF slot cannot support VPP %u\n", | |
75 | - __func__, state->Vpp); | |
76 | - return -1; | |
77 | - } | |
78 | - break; | |
79 | - | |
80 | - default: | |
81 | - return -1; | |
82 | - } | |
83 | - | |
84 | - /* | |
85 | - * pa_dwr_set is the mask for selecting Vcc on both sockets. | |
86 | - * pa_dwr_mask selects which bits (and therefore socket) we change. | |
87 | - */ | |
88 | - switch (state->Vcc) { | |
89 | - default: | |
90 | - case 0: pa_dwr_set = 0; break; | |
91 | - case 33: pa_dwr_set = GPIO_A1|GPIO_A2; break; | |
92 | - case 50: pa_dwr_set = GPIO_A0|GPIO_A3; break; | |
93 | - } | |
94 | - | |
95 | - ret = sa1111_pcmcia_configure_socket(skt, state); | |
96 | - if (ret == 0) { | |
97 | - unsigned long flags; | |
98 | - | |
99 | - local_irq_save(flags); | |
100 | - NCR_0 = (NCR_0 & ~ncr_mask) | ncr_set; | |
101 | - | |
102 | - local_irq_restore(flags); | |
103 | - sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set); | |
104 | - } | |
105 | - | |
106 | - return ret; | |
107 | -} | |
108 | - | |
109 | -static struct pcmcia_low_level neponset_pcmcia_ops = { | |
110 | - .owner = THIS_MODULE, | |
111 | - .configure_socket = neponset_pcmcia_configure_socket, | |
112 | - .first = 0, | |
113 | - .nr = 2, | |
114 | -}; | |
115 | - | |
116 | -int pcmcia_neponset_init(struct sa1111_dev *sadev) | |
117 | -{ | |
118 | - int ret = -ENODEV; | |
119 | - | |
120 | - if (machine_is_assabet()) { | |
121 | - /* | |
122 | - * Set GPIO_A<3:0> to be outputs for the MAX1600, | |
123 | - * and switch to standby mode. | |
124 | - */ | |
125 | - sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); | |
126 | - sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | |
127 | - sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | |
128 | - sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops); | |
129 | - ret = sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops, | |
130 | - sa11xx_drv_pcmcia_add_one); | |
131 | - } | |
132 | - | |
133 | - return ret; | |
134 | -} |
drivers/pcmcia/sa1111_badge4.c
1 | +/* | |
2 | + * linux/drivers/pcmcia/sa1100_badge4.c | |
3 | + * | |
4 | + * BadgePAD 4 PCMCIA specific routines | |
5 | + * | |
6 | + * Christopher Hoover <ch@hpl.hp.com> | |
7 | + * | |
8 | + * Copyright (C) 2002 Hewlett-Packard Company | |
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 | + */ | |
15 | +#include <linux/module.h> | |
16 | +#include <linux/kernel.h> | |
17 | +#include <linux/device.h> | |
18 | +#include <linux/errno.h> | |
19 | +#include <linux/init.h> | |
20 | + | |
21 | +#include <mach/hardware.h> | |
22 | +#include <asm/mach-types.h> | |
23 | +#include <mach/badge4.h> | |
24 | +#include <asm/hardware/sa1111.h> | |
25 | + | |
26 | +#include "sa1111_generic.h" | |
27 | + | |
28 | +/* | |
29 | + * BadgePAD 4 Details | |
30 | + * | |
31 | + * PCM Vcc: | |
32 | + * | |
33 | + * PCM Vcc on BadgePAD 4 can be jumpered for 3v3 (short pins 1 and 3 | |
34 | + * on JP6) or 5v0 (short pins 3 and 5 on JP6). | |
35 | + * | |
36 | + * PCM Vpp: | |
37 | + * | |
38 | + * PCM Vpp on BadgePAD 4 can be jumpered for 12v0 (short pins 4 and 6 | |
39 | + * on JP6) or tied to PCM Vcc (short pins 2 and 4 on JP6). N.B., | |
40 | + * 12v0 operation requires that the power supply actually supply 12v0 | |
41 | + * via pin 7 of JP7. | |
42 | + * | |
43 | + * CF Vcc: | |
44 | + * | |
45 | + * CF Vcc on BadgePAD 4 can be jumpered either for 3v3 (short pins 1 | |
46 | + * and 2 on JP10) or 5v0 (short pins 2 and 3 on JP10). | |
47 | + * | |
48 | + * Unfortunately there's no way programmatically to determine how a | |
49 | + * given board is jumpered. This code assumes a default jumpering | |
50 | + * as described below. | |
51 | + * | |
52 | + * If the defaults aren't correct, you may override them with a pcmv | |
53 | + * setup argument: pcmv=<pcm vcc>,<pcm vpp>,<cf vcc>. The units are | |
54 | + * tenths of volts; e.g. pcmv=33,120,50 indicates 3v3 PCM Vcc, 12v0 | |
55 | + * PCM Vpp, and 5v0 CF Vcc. | |
56 | + * | |
57 | + */ | |
58 | + | |
59 | +static int badge4_pcmvcc = 50; /* pins 3 and 5 jumpered on JP6 */ | |
60 | +static int badge4_pcmvpp = 50; /* pins 2 and 4 jumpered on JP6 */ | |
61 | +static int badge4_cfvcc = 33; /* pins 1 and 2 jumpered on JP10 */ | |
62 | + | |
63 | +static void complain_about_jumpering(const char *whom, | |
64 | + const char *supply, | |
65 | + int given, int wanted) | |
66 | +{ | |
67 | + printk(KERN_ERR | |
68 | + "%s: %s %d.%dV wanted but board is jumpered for %s %d.%dV operation" | |
69 | + "; re-jumper the board and/or use pcmv=xx,xx,xx\n", | |
70 | + whom, supply, | |
71 | + wanted / 10, wanted % 10, | |
72 | + supply, | |
73 | + given / 10, given % 10); | |
74 | +} | |
75 | + | |
76 | +static int | |
77 | +badge4_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) | |
78 | +{ | |
79 | + int ret; | |
80 | + | |
81 | + switch (skt->nr) { | |
82 | + case 0: | |
83 | + if ((state->Vcc != 0) && | |
84 | + (state->Vcc != badge4_pcmvcc)) { | |
85 | + complain_about_jumpering(__func__, "pcmvcc", | |
86 | + badge4_pcmvcc, state->Vcc); | |
87 | + // Apply power regardless of the jumpering. | |
88 | + // return -1; | |
89 | + } | |
90 | + if ((state->Vpp != 0) && | |
91 | + (state->Vpp != badge4_pcmvpp)) { | |
92 | + complain_about_jumpering(__func__, "pcmvpp", | |
93 | + badge4_pcmvpp, state->Vpp); | |
94 | + return -1; | |
95 | + } | |
96 | + break; | |
97 | + | |
98 | + case 1: | |
99 | + if ((state->Vcc != 0) && | |
100 | + (state->Vcc != badge4_cfvcc)) { | |
101 | + complain_about_jumpering(__func__, "cfvcc", | |
102 | + badge4_cfvcc, state->Vcc); | |
103 | + return -1; | |
104 | + } | |
105 | + break; | |
106 | + | |
107 | + default: | |
108 | + return -1; | |
109 | + } | |
110 | + | |
111 | + ret = sa1111_pcmcia_configure_socket(skt, state); | |
112 | + if (ret == 0) { | |
113 | + unsigned long flags; | |
114 | + int need5V; | |
115 | + | |
116 | + local_irq_save(flags); | |
117 | + | |
118 | + need5V = ((state->Vcc == 50) || (state->Vpp == 50)); | |
119 | + | |
120 | + badge4_set_5V(BADGE4_5V_PCMCIA_SOCK(skt->nr), need5V); | |
121 | + | |
122 | + local_irq_restore(flags); | |
123 | + } | |
124 | + | |
125 | + return ret; | |
126 | +} | |
127 | + | |
128 | +static struct pcmcia_low_level badge4_pcmcia_ops = { | |
129 | + .owner = THIS_MODULE, | |
130 | + .configure_socket = badge4_pcmcia_configure_socket, | |
131 | + .first = 0, | |
132 | + .nr = 2, | |
133 | +}; | |
134 | + | |
135 | +int pcmcia_badge4_init(struct device *dev) | |
136 | +{ | |
137 | + int ret = -ENODEV; | |
138 | + | |
139 | + if (machine_is_badge4()) { | |
140 | + printk(KERN_INFO | |
141 | + "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n", | |
142 | + __func__, | |
143 | + badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); | |
144 | + | |
145 | + sa11xx_drv_pcmcia_ops(&badge4_pcmcia_ops); | |
146 | + ret = sa1111_pcmcia_add(dev, &badge4_pcmcia_ops, | |
147 | + sa11xx_drv_pcmcia_add_one); | |
148 | + } | |
149 | + | |
150 | + return ret; | |
151 | +} | |
152 | + | |
153 | +static int __init pcmv_setup(char *s) | |
154 | +{ | |
155 | + int v[4]; | |
156 | + | |
157 | + s = get_options(s, ARRAY_SIZE(v), v); | |
158 | + | |
159 | + if (v[0] >= 1) badge4_pcmvcc = v[1]; | |
160 | + if (v[0] >= 2) badge4_pcmvpp = v[2]; | |
161 | + if (v[0] >= 3) badge4_cfvcc = v[3]; | |
162 | + | |
163 | + return 1; | |
164 | +} | |
165 | + | |
166 | +__setup("pcmv=", pcmv_setup); |
drivers/pcmcia/sa1111_jornada720.c
1 | +/* | |
2 | + * drivers/pcmcia/sa1100_jornada720.c | |
3 | + * | |
4 | + * Jornada720 PCMCIA specific routines | |
5 | + * | |
6 | + */ | |
7 | +#include <linux/module.h> | |
8 | +#include <linux/kernel.h> | |
9 | +#include <linux/device.h> | |
10 | +#include <linux/errno.h> | |
11 | +#include <linux/init.h> | |
12 | + | |
13 | +#include <mach/hardware.h> | |
14 | +#include <asm/hardware/sa1111.h> | |
15 | +#include <asm/mach-types.h> | |
16 | + | |
17 | +#include "sa1111_generic.h" | |
18 | + | |
19 | +/* Does SOCKET1_3V actually do anything? */ | |
20 | +#define SOCKET0_POWER GPIO_GPIO0 | |
21 | +#define SOCKET0_3V GPIO_GPIO2 | |
22 | +#define SOCKET1_POWER (GPIO_GPIO1 | GPIO_GPIO3) | |
23 | +#define SOCKET1_3V GPIO_GPIO3 | |
24 | + | |
25 | +static int | |
26 | +jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) | |
27 | +{ | |
28 | + struct sa1111_pcmcia_socket *s = to_skt(skt); | |
29 | + unsigned int pa_dwr_mask, pa_dwr_set; | |
30 | + int ret; | |
31 | + | |
32 | + printk(KERN_INFO "%s(): config socket %d vcc %d vpp %d\n", __func__, | |
33 | + skt->nr, state->Vcc, state->Vpp); | |
34 | + | |
35 | + switch (skt->nr) { | |
36 | + case 0: | |
37 | + pa_dwr_mask = SOCKET0_POWER | SOCKET0_3V; | |
38 | + | |
39 | + switch (state->Vcc) { | |
40 | + default: | |
41 | + case 0: | |
42 | + pa_dwr_set = 0; | |
43 | + break; | |
44 | + case 33: | |
45 | + pa_dwr_set = SOCKET0_POWER | SOCKET0_3V; | |
46 | + break; | |
47 | + case 50: | |
48 | + pa_dwr_set = SOCKET0_POWER; | |
49 | + break; | |
50 | + } | |
51 | + break; | |
52 | + | |
53 | + case 1: | |
54 | + pa_dwr_mask = SOCKET1_POWER; | |
55 | + | |
56 | + switch (state->Vcc) { | |
57 | + default: | |
58 | + case 0: | |
59 | + pa_dwr_set = 0; | |
60 | + break; | |
61 | + case 33: | |
62 | + pa_dwr_set = SOCKET1_POWER; | |
63 | + break; | |
64 | + case 50: | |
65 | + pa_dwr_set = SOCKET1_POWER; | |
66 | + break; | |
67 | + } | |
68 | + break; | |
69 | + | |
70 | + default: | |
71 | + return -1; | |
72 | + } | |
73 | + | |
74 | + if (state->Vpp != state->Vcc && state->Vpp != 0) { | |
75 | + printk(KERN_ERR "%s(): slot cannot support VPP %u\n", | |
76 | + __func__, state->Vpp); | |
77 | + return -EPERM; | |
78 | + } | |
79 | + | |
80 | + ret = sa1111_pcmcia_configure_socket(skt, state); | |
81 | + if (ret == 0) | |
82 | + sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set); | |
83 | + | |
84 | + return ret; | |
85 | +} | |
86 | + | |
87 | +static struct pcmcia_low_level jornada720_pcmcia_ops = { | |
88 | + .owner = THIS_MODULE, | |
89 | + .configure_socket = jornada720_pcmcia_configure_socket, | |
90 | + .first = 0, | |
91 | + .nr = 2, | |
92 | +}; | |
93 | + | |
94 | +int __devinit pcmcia_jornada720_init(struct device *dev) | |
95 | +{ | |
96 | + int ret = -ENODEV; | |
97 | + | |
98 | + if (machine_is_jornada720()) { | |
99 | + unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; | |
100 | + | |
101 | + GRER |= 0x00000002; | |
102 | + | |
103 | + /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ | |
104 | + sa1111_set_io_dir(dev, pin, 0, 0); | |
105 | + sa1111_set_io(dev, pin, 0); | |
106 | + sa1111_set_sleep_io(dev, pin, 0); | |
107 | + | |
108 | + sa11xx_drv_pcmcia_ops(&jornada720_pcmcia_ops); | |
109 | + ret = sa1111_pcmcia_add(dev, &jornada720_pcmcia_ops, | |
110 | + sa11xx_drv_pcmcia_add_one); | |
111 | + } | |
112 | + | |
113 | + return ret; | |
114 | +} |
drivers/pcmcia/sa1111_lubbock.c
1 | +/* | |
2 | + * linux/drivers/pcmcia/pxa2xx_lubbock.c | |
3 | + * | |
4 | + * Author: George Davis | |
5 | + * Created: Jan 10, 2002 | |
6 | + * Copyright: MontaVista Software Inc. | |
7 | + * | |
8 | + * This program is free software; you can redistribute it and/or modify | |
9 | + * it under the terms of the GNU General Public License version 2 as | |
10 | + * published by the Free Software Foundation. | |
11 | + * | |
12 | + * Originally based upon linux/drivers/pcmcia/sa1100_neponset.c | |
13 | + * | |
14 | + * Lubbock PCMCIA specific routines. | |
15 | + * | |
16 | + */ | |
17 | +#include <linux/module.h> | |
18 | +#include <linux/kernel.h> | |
19 | +#include <linux/device.h> | |
20 | +#include <linux/errno.h> | |
21 | +#include <linux/init.h> | |
22 | +#include <linux/delay.h> | |
23 | + | |
24 | +#include <mach/hardware.h> | |
25 | +#include <asm/hardware/sa1111.h> | |
26 | +#include <asm/mach-types.h> | |
27 | +#include <mach/lubbock.h> | |
28 | + | |
29 | +#include "sa1111_generic.h" | |
30 | + | |
31 | +static int | |
32 | +lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |
33 | + const socket_state_t *state) | |
34 | +{ | |
35 | + struct sa1111_pcmcia_socket *s = to_skt(skt); | |
36 | + unsigned int pa_dwr_mask, pa_dwr_set, misc_mask, misc_set; | |
37 | + int ret = 0; | |
38 | + | |
39 | + pa_dwr_mask = pa_dwr_set = misc_mask = misc_set = 0; | |
40 | + | |
41 | + /* Lubbock uses the Maxim MAX1602, with the following connections: | |
42 | + * | |
43 | + * Socket 0 (PCMCIA): | |
44 | + * MAX1602 Lubbock Register | |
45 | + * Pin Signal | |
46 | + * ----- ------- ---------------------- | |
47 | + * A0VPP S0_PWR0 SA-1111 GPIO A<0> | |
48 | + * A1VPP S0_PWR1 SA-1111 GPIO A<1> | |
49 | + * A0VCC S0_PWR2 SA-1111 GPIO A<2> | |
50 | + * A1VCC S0_PWR3 SA-1111 GPIO A<3> | |
51 | + * VX VCC | |
52 | + * VY +3.3V | |
53 | + * 12IN +12V | |
54 | + * CODE +3.3V Cirrus Code, CODE = High (VY) | |
55 | + * | |
56 | + * Socket 1 (CF): | |
57 | + * MAX1602 Lubbock Register | |
58 | + * Pin Signal | |
59 | + * ----- ------- ---------------------- | |
60 | + * A0VPP GND VPP is not connected | |
61 | + * A1VPP GND VPP is not connected | |
62 | + * A0VCC S1_PWR0 MISC_WR<14> | |
63 | + * A1VCC S1_PWR1 MISC_WR<15> | |
64 | + * VX VCC | |
65 | + * VY +3.3V | |
66 | + * 12IN GND VPP is not connected | |
67 | + * CODE +3.3V Cirrus Code, CODE = High (VY) | |
68 | + * | |
69 | + */ | |
70 | + | |
71 | + again: | |
72 | + switch (skt->nr) { | |
73 | + case 0: | |
74 | + pa_dwr_mask = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; | |
75 | + | |
76 | + switch (state->Vcc) { | |
77 | + case 0: /* Hi-Z */ | |
78 | + break; | |
79 | + | |
80 | + case 33: /* VY */ | |
81 | + pa_dwr_set |= GPIO_A3; | |
82 | + break; | |
83 | + | |
84 | + case 50: /* VX */ | |
85 | + pa_dwr_set |= GPIO_A2; | |
86 | + break; | |
87 | + | |
88 | + default: | |
89 | + printk(KERN_ERR "%s(): unrecognized Vcc %u\n", | |
90 | + __func__, state->Vcc); | |
91 | + ret = -1; | |
92 | + } | |
93 | + | |
94 | + switch (state->Vpp) { | |
95 | + case 0: /* Hi-Z */ | |
96 | + break; | |
97 | + | |
98 | + case 120: /* 12IN */ | |
99 | + pa_dwr_set |= GPIO_A1; | |
100 | + break; | |
101 | + | |
102 | + default: /* VCC */ | |
103 | + if (state->Vpp == state->Vcc) | |
104 | + pa_dwr_set |= GPIO_A0; | |
105 | + else { | |
106 | + printk(KERN_ERR "%s(): unrecognized Vpp %u\n", | |
107 | + __func__, state->Vpp); | |
108 | + ret = -1; | |
109 | + break; | |
110 | + } | |
111 | + } | |
112 | + break; | |
113 | + | |
114 | + case 1: | |
115 | + misc_mask = (1 << 15) | (1 << 14); | |
116 | + | |
117 | + switch (state->Vcc) { | |
118 | + case 0: /* Hi-Z */ | |
119 | + break; | |
120 | + | |
121 | + case 33: /* VY */ | |
122 | + misc_set |= 1 << 15; | |
123 | + break; | |
124 | + | |
125 | + case 50: /* VX */ | |
126 | + misc_set |= 1 << 14; | |
127 | + break; | |
128 | + | |
129 | + default: | |
130 | + printk(KERN_ERR "%s(): unrecognized Vcc %u\n", | |
131 | + __func__, state->Vcc); | |
132 | + ret = -1; | |
133 | + break; | |
134 | + } | |
135 | + | |
136 | + if (state->Vpp != state->Vcc && state->Vpp != 0) { | |
137 | + printk(KERN_ERR "%s(): CF slot cannot support Vpp %u\n", | |
138 | + __func__, state->Vpp); | |
139 | + ret = -1; | |
140 | + break; | |
141 | + } | |
142 | + break; | |
143 | + | |
144 | + default: | |
145 | + ret = -1; | |
146 | + } | |
147 | + | |
148 | + if (ret == 0) | |
149 | + ret = sa1111_pcmcia_configure_socket(skt, state); | |
150 | + | |
151 | + if (ret == 0) { | |
152 | + lubbock_set_misc_wr(misc_mask, misc_set); | |
153 | + sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set); | |
154 | + } | |
155 | + | |
156 | +#if 1 | |
157 | + if (ret == 0 && state->Vcc == 33) { | |
158 | + struct pcmcia_state new_state; | |
159 | + | |
160 | + /* | |
161 | + * HACK ALERT: | |
162 | + * We can't sense the voltage properly on Lubbock before | |
163 | + * actually applying some power to the socket (catch 22). | |
164 | + * Resense the socket Voltage Sense pins after applying | |
165 | + * socket power. | |
166 | + * | |
167 | + * Note: It takes about 2.5ms for the MAX1602 VCC output | |
168 | + * to rise. | |
169 | + */ | |
170 | + mdelay(3); | |
171 | + | |
172 | + sa1111_pcmcia_socket_state(skt, &new_state); | |
173 | + | |
174 | + if (!new_state.vs_3v && !new_state.vs_Xv) { | |
175 | + /* | |
176 | + * Switch to 5V, Configure socket with 5V voltage | |
177 | + */ | |
178 | + lubbock_set_misc_wr(misc_mask, 0); | |
179 | + sa1111_set_io(s->dev, pa_dwr_mask, 0); | |
180 | + | |
181 | + /* | |
182 | + * It takes about 100ms to turn off Vcc. | |
183 | + */ | |
184 | + mdelay(100); | |
185 | + | |
186 | + /* | |
187 | + * We need to hack around the const qualifier as | |
188 | + * well to keep this ugly workaround localized and | |
189 | + * not force it to the rest of the code. Barf bags | |
190 | + * available in the seat pocket in front of you! | |
191 | + */ | |
192 | + ((socket_state_t *)state)->Vcc = 50; | |
193 | + ((socket_state_t *)state)->Vpp = 50; | |
194 | + goto again; | |
195 | + } | |
196 | + } | |
197 | +#endif | |
198 | + | |
199 | + return ret; | |
200 | +} | |
201 | + | |
202 | +static struct pcmcia_low_level lubbock_pcmcia_ops = { | |
203 | + .owner = THIS_MODULE, | |
204 | + .configure_socket = lubbock_pcmcia_configure_socket, | |
205 | + .first = 0, | |
206 | + .nr = 2, | |
207 | +}; | |
208 | + | |
209 | +#include "pxa2xx_base.h" | |
210 | + | |
211 | +int pcmcia_lubbock_init(struct sa1111_dev *sadev) | |
212 | +{ | |
213 | + int ret = -ENODEV; | |
214 | + | |
215 | + if (machine_is_lubbock()) { | |
216 | + /* | |
217 | + * Set GPIO_A<3:0> to be outputs for the MAX1600, | |
218 | + * and switch to standby mode. | |
219 | + */ | |
220 | + sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); | |
221 | + sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | |
222 | + sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | |
223 | + | |
224 | + /* Set CF Socket 1 power to standby mode. */ | |
225 | + lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); | |
226 | + | |
227 | + pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); | |
228 | + pxa2xx_configure_sockets(&sadev->dev); | |
229 | + ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops, | |
230 | + pxa2xx_drv_pcmcia_add_one); | |
231 | + } | |
232 | + | |
233 | + return ret; | |
234 | +} | |
235 | + | |
236 | +MODULE_LICENSE("GPL"); |
drivers/pcmcia/sa1111_neponset.c
1 | +/* | |
2 | + * linux/drivers/pcmcia/sa1100_neponset.c | |
3 | + * | |
4 | + * Neponset PCMCIA specific routines | |
5 | + */ | |
6 | +#include <linux/module.h> | |
7 | +#include <linux/kernel.h> | |
8 | +#include <linux/device.h> | |
9 | +#include <linux/errno.h> | |
10 | +#include <linux/init.h> | |
11 | + | |
12 | +#include <mach/hardware.h> | |
13 | +#include <asm/mach-types.h> | |
14 | +#include <mach/neponset.h> | |
15 | +#include <asm/hardware/sa1111.h> | |
16 | + | |
17 | +#include "sa1111_generic.h" | |
18 | + | |
19 | +/* | |
20 | + * Neponset uses the Maxim MAX1600, with the following connections: | |
21 | + * | |
22 | + * MAX1600 Neponset | |
23 | + * | |
24 | + * A0VCC SA-1111 GPIO A<1> | |
25 | + * A1VCC SA-1111 GPIO A<0> | |
26 | + * A0VPP CPLD NCR A0VPP | |
27 | + * A1VPP CPLD NCR A1VPP | |
28 | + * B0VCC SA-1111 GPIO A<2> | |
29 | + * B1VCC SA-1111 GPIO A<3> | |
30 | + * B0VPP ground (slot B is CF) | |
31 | + * B1VPP ground (slot B is CF) | |
32 | + * | |
33 | + * VX VCC (5V) | |
34 | + * VY VCC3_3 (3.3V) | |
35 | + * 12INA 12V | |
36 | + * 12INB ground (slot B is CF) | |
37 | + * | |
38 | + * The MAX1600 CODE pin is tied to ground, placing the device in | |
39 | + * "Standard Intel code" mode. Refer to the Maxim data sheet for | |
40 | + * the corresponding truth table. | |
41 | + */ | |
42 | + | |
43 | +static int | |
44 | +neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) | |
45 | +{ | |
46 | + struct sa1111_pcmcia_socket *s = to_skt(skt); | |
47 | + unsigned int ncr_mask, ncr_set, pa_dwr_mask, pa_dwr_set; | |
48 | + int ret; | |
49 | + | |
50 | + switch (skt->nr) { | |
51 | + case 0: | |
52 | + pa_dwr_mask = GPIO_A0 | GPIO_A1; | |
53 | + ncr_mask = NCR_A0VPP | NCR_A1VPP; | |
54 | + | |
55 | + if (state->Vpp == 0) | |
56 | + ncr_set = 0; | |
57 | + else if (state->Vpp == 120) | |
58 | + ncr_set = NCR_A1VPP; | |
59 | + else if (state->Vpp == state->Vcc) | |
60 | + ncr_set = NCR_A0VPP; | |
61 | + else { | |
62 | + printk(KERN_ERR "%s(): unrecognized VPP %u\n", | |
63 | + __func__, state->Vpp); | |
64 | + return -1; | |
65 | + } | |
66 | + break; | |
67 | + | |
68 | + case 1: | |
69 | + pa_dwr_mask = GPIO_A2 | GPIO_A3; | |
70 | + ncr_mask = 0; | |
71 | + ncr_set = 0; | |
72 | + | |
73 | + if (state->Vpp != state->Vcc && state->Vpp != 0) { | |
74 | + printk(KERN_ERR "%s(): CF slot cannot support VPP %u\n", | |
75 | + __func__, state->Vpp); | |
76 | + return -1; | |
77 | + } | |
78 | + break; | |
79 | + | |
80 | + default: | |
81 | + return -1; | |
82 | + } | |
83 | + | |
84 | + /* | |
85 | + * pa_dwr_set is the mask for selecting Vcc on both sockets. | |
86 | + * pa_dwr_mask selects which bits (and therefore socket) we change. | |
87 | + */ | |
88 | + switch (state->Vcc) { | |
89 | + default: | |
90 | + case 0: pa_dwr_set = 0; break; | |
91 | + case 33: pa_dwr_set = GPIO_A1|GPIO_A2; break; | |
92 | + case 50: pa_dwr_set = GPIO_A0|GPIO_A3; break; | |
93 | + } | |
94 | + | |
95 | + ret = sa1111_pcmcia_configure_socket(skt, state); | |
96 | + if (ret == 0) { | |
97 | + unsigned long flags; | |
98 | + | |
99 | + local_irq_save(flags); | |
100 | + NCR_0 = (NCR_0 & ~ncr_mask) | ncr_set; | |
101 | + | |
102 | + local_irq_restore(flags); | |
103 | + sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set); | |
104 | + } | |
105 | + | |
106 | + return ret; | |
107 | +} | |
108 | + | |
109 | +static struct pcmcia_low_level neponset_pcmcia_ops = { | |
110 | + .owner = THIS_MODULE, | |
111 | + .configure_socket = neponset_pcmcia_configure_socket, | |
112 | + .first = 0, | |
113 | + .nr = 2, | |
114 | +}; | |
115 | + | |
116 | +int pcmcia_neponset_init(struct sa1111_dev *sadev) | |
117 | +{ | |
118 | + int ret = -ENODEV; | |
119 | + | |
120 | + if (machine_is_assabet()) { | |
121 | + /* | |
122 | + * Set GPIO_A<3:0> to be outputs for the MAX1600, | |
123 | + * and switch to standby mode. | |
124 | + */ | |
125 | + sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); | |
126 | + sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | |
127 | + sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | |
128 | + sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops); | |
129 | + ret = sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops, | |
130 | + sa11xx_drv_pcmcia_add_one); | |
131 | + } | |
132 | + | |
133 | + return ret; | |
134 | +} |