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 int simpad_pcmcia_hw_init(struct soc_pcmcia_socket
*skt
)
21 simpad_clear_cs3_bit(VCC_3V_EN
|VCC_5V_EN
|EN0
|EN1
);
23 skt
->stat
[SOC_STAT_CD
].gpio
= GPIO_CF_CD
;
24 skt
->stat
[SOC_STAT_CD
].name
= "CF_CD";
25 skt
->stat
[SOC_STAT_RDY
].gpio
= GPIO_CF_IRQ
;
26 skt
->stat
[SOC_STAT_RDY
].name
= "CF_RDY";
31 static void simpad_pcmcia_hw_shutdown(struct soc_pcmcia_socket
*skt
)
34 /*simpad_set_cs3_bit(PCMCIA_BUFF_DIS);*/
35 simpad_clear_cs3_bit(PCMCIA_RESET
);
39 simpad_pcmcia_socket_state(struct soc_pcmcia_socket
*skt
,
40 struct pcmcia_state
*state
)
42 long cs3reg
= simpad_get_cs3_ro();
44 /* the detect signal is inverted - fix that up here */
45 state
->detect
= !state
->detect
;
47 state
->bvd1
= 1; /* Might be cs3reg & PCMCIA_BVD1 */
48 state
->bvd2
= 1; /* Might be cs3reg & PCMCIA_BVD2 */
50 if ((cs3reg
& (PCMCIA_VS1
|PCMCIA_VS2
)) ==
51 (PCMCIA_VS1
|PCMCIA_VS2
)) {
61 simpad_pcmcia_configure_socket(struct soc_pcmcia_socket
*skt
,
62 const socket_state_t
*state
)
66 local_irq_save(flags
);
68 /* Murphy: see table of MIC2562a-1 */
71 simpad_clear_cs3_bit(VCC_3V_EN
|VCC_5V_EN
|EN0
|EN1
);
75 simpad_clear_cs3_bit(VCC_3V_EN
|EN1
);
76 simpad_set_cs3_bit(VCC_5V_EN
|EN0
);
80 simpad_clear_cs3_bit(VCC_5V_EN
|EN1
);
81 simpad_set_cs3_bit(VCC_3V_EN
|EN0
);
85 printk(KERN_ERR
"%s(): unrecognized Vcc %u\n",
86 __func__
, state
->Vcc
);
87 simpad_clear_cs3_bit(VCC_3V_EN
|VCC_5V_EN
|EN0
|EN1
);
88 local_irq_restore(flags
);
93 local_irq_restore(flags
);
98 static void simpad_pcmcia_socket_suspend(struct soc_pcmcia_socket
*skt
)
100 simpad_set_cs3_bit(PCMCIA_RESET
);
103 static struct pcmcia_low_level simpad_pcmcia_ops
= {
104 .owner
= THIS_MODULE
,
105 .hw_init
= simpad_pcmcia_hw_init
,
106 .hw_shutdown
= simpad_pcmcia_hw_shutdown
,
107 .socket_state
= simpad_pcmcia_socket_state
,
108 .configure_socket
= simpad_pcmcia_configure_socket
,
109 .socket_suspend
= simpad_pcmcia_socket_suspend
,
112 int pcmcia_simpad_init(struct device
*dev
)
116 if (machine_is_simpad())
117 ret
= sa11xx_drv_pcmcia_probe(dev
, &simpad_pcmcia_ops
, 1, 1);