2 * linux/drivers/pcmcia/pxa2xx_lubbock.c
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"
31 static int lubbock_pcmcia_hw_init(struct soc_pcmcia_socket
*skt
)
36 ret
= max1600_init(skt
->socket
.dev
.parent
, &m
,
37 skt
->nr
? MAX1600_CHAN_B
: MAX1600_CHAN_A
,
46 lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket
*skt
,
47 const socket_state_t
*state
)
49 struct max1600
*m
= skt
->driver_data
;
52 /* Lubbock uses the Maxim MAX1602, with the following connections:
55 * MAX1602 Lubbock Register
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>
65 * CODE +3.3V Cirrus Code, CODE = High (VY)
68 * MAX1602 Lubbock Register
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>
77 * 12IN GND VPP is not connected
78 * CODE +3.3V Cirrus Code, CODE = High (VY)
93 ret
= sa1111_pcmcia_configure_socket(skt
, state
);
95 ret
= max1600_configure(m
, state
->Vcc
, state
->Vpp
);
98 if (ret
== 0 && state
->Vcc
== 33) {
99 struct pcmcia_state new_state
;
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
108 * Note: It takes about 2.5ms for the MAX1602 VCC output
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.
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;
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
,
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");