1 #warning "REVISIT_PFS168: Need to verify and test GPIO power encodings."
3 * drivers/pcmcia/sa1100_pfs168.c
5 * PFS168 PCMCIA specific routines
8 #include <linux/module.h>
9 #include <linux/kernel.h>
10 #include <linux/sched.h>
11 #include <linux/delay.h>
12 #include <linux/device.h>
13 #include <linux/init.h>
15 #include <asm/hardware.h>
16 #include <asm/mach-types.h>
19 #include "sa1111_generic.h"
21 static int pfs168_pcmcia_init(struct sa1100_pcmcia_socket
*skt
)
23 /* TPS2211 to standby mode: */
24 PA_DWR
&= ~(GPIO_GPIO0
| GPIO_GPIO1
| GPIO_GPIO2
| GPIO_GPIO3
);
26 /* Set GPIO_A<3:0> to be outputs for PCMCIA (socket 0) power controller: */
27 PA_DDR
&= ~(GPIO_GPIO0
| GPIO_GPIO1
| GPIO_GPIO2
| GPIO_GPIO3
);
29 return sa1111_pcmcia_init(skt
);
33 pfs168_pcmcia_configure_socket(struct sa1100_pcmcia_socket
*skt
,
34 const socket_state_t
*state
)
36 unsigned int pa_dwr_mask
= 0, pa_dwr_set
= 0;
39 /* PFS168 uses the Texas Instruments TPS2211 for PCMCIA (socket 0) voltage control only,
40 * with the following connections:
44 * -VCCD0 SA-1111 GPIO A<0>
45 * -VCCD0 SA-1111 GPIO A<1>
46 * VPPD0 SA-1111 GPIO A<2>
47 * VPPD0 SA-1111 GPIO A<2>
53 pa_dwr_mask
= GPIO_GPIO0
| GPIO_GPIO1
| GPIO_GPIO2
| GPIO_GPIO3
;
57 case 0: pa_dwr_set
= 0; break;
58 case 33: pa_dwr_set
= GPIO_GPIO0
; break;
59 case 50: pa_dwr_set
= GPIO_GPIO1
; break;
67 printk(KERN_ERR
"%s(): PFS-168 does not support VPP %uV\n",
68 __FUNCTION__
, state
->Vpp
/ 10);
73 if (state
->Vpp
== state
->Vcc
)
74 pa_dwr_set
|= GPIO_GPIO3
;
76 printk(KERN_ERR
"%s(): unrecognized VPP %u\n", __FUNCTION__
,
93 printk(KERN_ERR
"%s(): PFS-168 CompactFlash socket does not support VCC %uV\n",
94 __FUNCTION__
, state
->Vcc
/ 10);
98 printk(KERN_ERR
"%s(): unrecognized VCC %u\n", __FUNCTION__
,
103 if (state
->Vpp
!= state
->Vcc
&& state
->Vpp
!= 0) {
104 printk(KERN_ERR
"%s(): CompactFlash socket does not support VPP %uV\n"
105 __FUNCTION__
, state
->Vpp
/ 10);
111 ret
= sa1111_pcmcia_configure_socket(skt
, state
);
115 local_irq_save(flags
);
116 PA_DWR
= (PA_DWR
& ~pa_dwr_mask
) | pa_dwr_set
;
117 local_irq_restore(flags
);
123 static struct pcmcia_low_level pfs168_pcmcia_ops
= {
124 .owner
= THIS_MODULE
,
125 .hw_init
= pfs168_pcmcia_hw_init
,
126 .hw_shutdown
= sa1111_pcmcia_hw_shutdown
,
127 .socket_state
= sa1111_pcmcia_socket_state
,
128 .configure_socket
= pfs168_pcmcia_configure_socket
,
129 .socket_init
= sa1111_pcmcia_socket_init
,
130 .socket_suspend
= sa1111_pcmcia_socket_suspend
,
133 int __init
pcmcia_pfs168_init(struct device
*dev
)
137 if (machine_is_pfs168())
138 ret
= sa11xx_drv_pcmcia_probe(dev
, &pfs168_pcmcia_ops
, 0, 2);