dmaengine: imx-sdma: Let the core do the device node validation
[linux/fpc-iii.git] / drivers / pcmcia / sa1111_lubbock.c
blobe3fc14cfb42b33ff51ad3c88f60d4d91801894a9
1 /*
2 * linux/drivers/pcmcia/pxa2xx_lubbock.c
4 * Author: George Davis
5 * Created: Jan 10, 2002
6 * Copyright: MontaVista Software Inc.
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.
12 * Originally based upon linux/drivers/pcmcia/sa1100_neponset.c
14 * Lubbock PCMCIA specific routines.
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>
24 #include <mach/hardware.h>
25 #include <asm/hardware/sa1111.h>
26 #include <asm/mach-types.h>
28 #include "sa1111_generic.h"
29 #include "max1600.h"
31 static int lubbock_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
33 struct max1600 *m;
34 int ret;
36 ret = max1600_init(skt->socket.dev.parent, &m,
37 skt->nr ? MAX1600_CHAN_B : MAX1600_CHAN_A,
38 MAX1600_CODE_HIGH);
39 if (ret == 0)
40 skt->driver_data = m;
42 return ret;
45 static int
46 lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
47 const socket_state_t *state)
49 struct max1600 *m = skt->driver_data;
50 int ret = 0;
52 /* Lubbock uses the Maxim MAX1602, with the following connections:
54 * Socket 0 (PCMCIA):
55 * MAX1602 Lubbock Register
56 * Pin Signal
57 * ----- ------- ----------------------
58 * A0VPP S0_PWR0 SA-1111 GPIO A<0>
59 * A1VPP S0_PWR1 SA-1111 GPIO A<1>
60 * A0VCC S0_PWR2 SA-1111 GPIO A<2>
61 * A1VCC S0_PWR3 SA-1111 GPIO A<3>
62 * VX VCC
63 * VY +3.3V
64 * 12IN +12V
65 * CODE +3.3V Cirrus Code, CODE = High (VY)
67 * Socket 1 (CF):
68 * MAX1602 Lubbock Register
69 * Pin Signal
70 * ----- ------- ----------------------
71 * A0VPP GND VPP is not connected
72 * A1VPP GND VPP is not connected
73 * A0VCC S1_PWR0 MISC_WR<14>
74 * A1VCC S1_PWR1 MISC_WR<15>
75 * VX VCC
76 * VY +3.3V
77 * 12IN GND VPP is not connected
78 * CODE +3.3V Cirrus Code, CODE = High (VY)
82 again:
83 switch (skt->nr) {
84 case 0:
85 case 1:
86 break;
88 default:
89 ret = -1;
92 if (ret == 0)
93 ret = sa1111_pcmcia_configure_socket(skt, state);
94 if (ret == 0)
95 ret = max1600_configure(m, state->Vcc, state->Vpp);
97 #if 1
98 if (ret == 0 && state->Vcc == 33) {
99 struct pcmcia_state new_state;
102 * HACK ALERT:
103 * We can't sense the voltage properly on Lubbock before
104 * actually applying some power to the socket (catch 22).
105 * Resense the socket Voltage Sense pins after applying
106 * socket power.
108 * Note: It takes about 2.5ms for the MAX1602 VCC output
109 * to rise.
111 mdelay(3);
113 sa1111_pcmcia_socket_state(skt, &new_state);
115 if (!new_state.vs_3v && !new_state.vs_Xv) {
117 * Switch to 5V, Configure socket with 5V voltage
119 max1600_configure(m, 0, 0);
122 * It takes about 100ms to turn off Vcc.
124 mdelay(100);
127 * We need to hack around the const qualifier as
128 * well to keep this ugly workaround localized and
129 * not force it to the rest of the code. Barf bags
130 * available in the seat pocket in front of you!
132 ((socket_state_t *)state)->Vcc = 50;
133 ((socket_state_t *)state)->Vpp = 50;
134 goto again;
137 #endif
139 return ret;
142 static struct pcmcia_low_level lubbock_pcmcia_ops = {
143 .owner = THIS_MODULE,
144 .hw_init = lubbock_pcmcia_hw_init,
145 .configure_socket = lubbock_pcmcia_configure_socket,
146 .first = 0,
147 .nr = 2,
150 #include "pxa2xx_base.h"
152 int pcmcia_lubbock_init(struct sa1111_dev *sadev)
154 pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops);
155 pxa2xx_configure_sockets(&sadev->dev, &lubbock_pcmcia_ops);
156 return sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops,
157 pxa2xx_drv_pcmcia_add_one);
160 MODULE_LICENSE("GPL");