2 * drivers/pcmcia/sa1100_simpad.c
4 * PCMCIA implementation routines for simpad
7 #include <linux/module.h>
8 #include <linux/kernel.h>
9 #include <linux/device.h>
10 #include <linux/init.h>
12 #include <mach/hardware.h>
13 #include <asm/mach-types.h>
15 #include <mach/simpad.h>
16 #include "sa1100_generic.h"
18 static struct pcmcia_irqs irqs
[] = {
19 { 1, IRQ_GPIO_CF_CD
, "CF_CD" },
22 static int simpad_pcmcia_hw_init(struct soc_pcmcia_socket
*skt
)
25 simpad_clear_cs3_bit(VCC_3V_EN
|VCC_5V_EN
|EN0
|EN1
);
27 skt
->socket
.pci_irq
= IRQ_GPIO_CF_IRQ
;
29 return soc_pcmcia_request_irqs(skt
, irqs
, ARRAY_SIZE(irqs
));
32 static void simpad_pcmcia_hw_shutdown(struct soc_pcmcia_socket
*skt
)
34 soc_pcmcia_free_irqs(skt
, irqs
, ARRAY_SIZE(irqs
));
37 /*simpad_set_cs3_bit(PCMCIA_BUFF_DIS);*/
38 simpad_clear_cs3_bit(PCMCIA_RESET
);
42 simpad_pcmcia_socket_state(struct soc_pcmcia_socket
*skt
,
43 struct pcmcia_state
*state
)
45 unsigned long levels
= GPLR
;
46 long cs3reg
= simpad_get_cs3_ro();
48 state
->detect
=((levels
& GPIO_CF_CD
)==0)?1:0;
49 state
->ready
=(levels
& GPIO_CF_IRQ
)?1:0;
50 state
->bvd1
= 1; /* Might be cs3reg & PCMCIA_BVD1 */
51 state
->bvd2
= 1; /* Might be cs3reg & PCMCIA_BVD2 */
52 state
->wrprot
=0; /* Not available on Simpad. */
54 if ((cs3reg
& (PCMCIA_VS1
|PCMCIA_VS2
)) ==
55 (PCMCIA_VS1
|PCMCIA_VS2
)) {
65 simpad_pcmcia_configure_socket(struct soc_pcmcia_socket
*skt
,
66 const socket_state_t
*state
)
70 local_irq_save(flags
);
72 /* Murphy: see table of MIC2562a-1 */
75 simpad_clear_cs3_bit(VCC_3V_EN
|VCC_5V_EN
|EN0
|EN1
);
79 simpad_clear_cs3_bit(VCC_3V_EN
|EN1
);
80 simpad_set_cs3_bit(VCC_5V_EN
|EN0
);
84 simpad_clear_cs3_bit(VCC_5V_EN
|EN1
);
85 simpad_set_cs3_bit(VCC_3V_EN
|EN0
);
89 printk(KERN_ERR
"%s(): unrecognized Vcc %u\n",
90 __func__
, state
->Vcc
);
91 simpad_clear_cs3_bit(VCC_3V_EN
|VCC_5V_EN
|EN0
|EN1
);
92 local_irq_restore(flags
);
97 local_irq_restore(flags
);
102 static void simpad_pcmcia_socket_init(struct soc_pcmcia_socket
*skt
)
104 soc_pcmcia_enable_irqs(skt
, irqs
, ARRAY_SIZE(irqs
));
107 static void simpad_pcmcia_socket_suspend(struct soc_pcmcia_socket
*skt
)
109 soc_pcmcia_disable_irqs(skt
, irqs
, ARRAY_SIZE(irqs
));
110 simpad_set_cs3_bit(PCMCIA_RESET
);
113 static struct pcmcia_low_level simpad_pcmcia_ops
= {
114 .owner
= THIS_MODULE
,
115 .hw_init
= simpad_pcmcia_hw_init
,
116 .hw_shutdown
= simpad_pcmcia_hw_shutdown
,
117 .socket_state
= simpad_pcmcia_socket_state
,
118 .configure_socket
= simpad_pcmcia_configure_socket
,
119 .socket_init
= simpad_pcmcia_socket_init
,
120 .socket_suspend
= simpad_pcmcia_socket_suspend
,
123 int __devinit
pcmcia_simpad_init(struct device
*dev
)
127 if (machine_is_simpad())
128 ret
= sa11xx_drv_pcmcia_probe(dev
, &simpad_pcmcia_ops
, 1, 1);