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/kernel.h>
9 #include <linux/sched.h>
11 #include <asm/delay.h>
12 #include <asm/hardware.h>
15 #include "sa1100_generic.h"
16 #include "sa1111_generic.h"
18 static int pfs168_pcmcia_init(struct pcmcia_init *init)
20 /* TPS2211 to standby mode: */
21 PA_DWR &= ~(GPIO_GPIO0 | GPIO_GPIO1 | GPIO_GPIO2 | GPIO_GPIO3);
23 /* Set GPIO_A<3:0> to be outputs for PCMCIA (socket 0) power controller: */
24 PA_DDR &= ~(GPIO_GPIO0 | GPIO_GPIO1 | GPIO_GPIO2 | GPIO_GPIO3);
26 return sa1111_pcmcia_init(init);
30 pfs168_pcmcia_configure_socket(const struct pcmcia_configure *conf)
32 unsigned int pa_dwr_mask = 0, pa_dwr_set = 0;
35 /* PFS168 uses the Texas Instruments TPS2211 for PCMCIA (socket 0) voltage control only,
36 * with the following connections:
40 * -VCCD0 SA-1111 GPIO A<0>
41 * -VCCD0 SA-1111 GPIO A<1>
42 * VPPD0 SA-1111 GPIO A<2>
43 * VPPD0 SA-1111 GPIO A<2>
49 pa_dwr_mask = GPIO_GPIO0 | GPIO_GPIO1 | GPIO_GPIO2 | GPIO_GPIO3;
53 case 0: pa_dwr_set = 0; break;
54 case 33: pa_dwr_set = GPIO_GPIO0; break;
55 case 50: pa_dwr_set = GPIO_GPIO1; break;
63 printk(KERN_ERR "%s(): PFS-168 does not support VPP %uV\n",
64 __FUNCTION__, conf->vpp / 10);
69 if (conf->vpp == conf->vcc)
70 pa_dwr_set |= GPIO_GPIO3;
72 printk(KERN_ERR "%s(): unrecognized VPP %u\n", __FUNCTION__,
89 printk(KERN_ERR "%s(): PFS-168 CompactFlash socket does not support VCC %uV\n",
90 __FUNCTION__, conf->vcc / 10);
94 printk(KERN_ERR "%s(): unrecognized VCC %u\n", __FUNCTION__,
99 if (conf->vpp != conf->vcc && conf->vpp != 0) {
100 printk(KERN_ERR "%s(): CompactFlash socket does not support VPP %uV\n"
101 __FUNCTION__, conf->vpp/10);
107 ret = sa1111_pcmcia_configure_socket(conf);
111 local_irq_save(flags);
112 PA_DWR = (PA_DWR & ~pa_dwr_mask) | pa_dwr_set;
113 local_irq_restore(flags);
119 struct pcmcia_low_level pfs168_pcmcia_ops = {
120 init: pfs168_pcmcia_init,
121 shutdown: sa1111_pcmcia_shutdown,
122 socket_state: sa1111_pcmcia_socket_state,
123 get_irq_info: sa1111_pcmcia_get_irq_info,
124 configure_socket: pfs168_pcmcia_configure_socket,
126 socket_init: sa1111_pcmcia_socket_init,
127 socket_suspend: sa1111_pcmcia_socket_suspend,