1 // SPDX-License-Identifier: GPL-2.0
3 * drivers/pcmcia/sa1100_simpad.c
5 * PCMCIA implementation routines for simpad
8 #include <linux/module.h>
9 #include <linux/kernel.h>
10 #include <linux/device.h>
11 #include <linux/init.h>
13 #include <mach/hardware.h>
14 #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
].name
= "cf-detect";
24 skt
->stat
[SOC_STAT_RDY
].name
= "cf-ready";
26 return soc_pcmcia_request_gpiods(skt
);
29 static void simpad_pcmcia_hw_shutdown(struct soc_pcmcia_socket
*skt
)
32 /*simpad_set_cs3_bit(PCMCIA_BUFF_DIS);*/
33 simpad_clear_cs3_bit(PCMCIA_RESET
);
37 simpad_pcmcia_socket_state(struct soc_pcmcia_socket
*skt
,
38 struct pcmcia_state
*state
)
40 long cs3reg
= simpad_get_cs3_ro();
42 state
->bvd1
= 1; /* Might be cs3reg & PCMCIA_BVD1 */
43 state
->bvd2
= 1; /* Might be cs3reg & PCMCIA_BVD2 */
45 if ((cs3reg
& (PCMCIA_VS1
|PCMCIA_VS2
)) ==
46 (PCMCIA_VS1
|PCMCIA_VS2
)) {
56 simpad_pcmcia_configure_socket(struct soc_pcmcia_socket
*skt
,
57 const socket_state_t
*state
)
61 local_irq_save(flags
);
63 /* Murphy: see table of MIC2562a-1 */
66 simpad_clear_cs3_bit(VCC_3V_EN
|VCC_5V_EN
|EN0
|EN1
);
70 simpad_clear_cs3_bit(VCC_3V_EN
|EN1
);
71 simpad_set_cs3_bit(VCC_5V_EN
|EN0
);
75 simpad_clear_cs3_bit(VCC_5V_EN
|EN1
);
76 simpad_set_cs3_bit(VCC_3V_EN
|EN0
);
80 printk(KERN_ERR
"%s(): unrecognized Vcc %u\n",
81 __func__
, state
->Vcc
);
82 simpad_clear_cs3_bit(VCC_3V_EN
|VCC_5V_EN
|EN0
|EN1
);
83 local_irq_restore(flags
);
88 local_irq_restore(flags
);
93 static void simpad_pcmcia_socket_suspend(struct soc_pcmcia_socket
*skt
)
95 simpad_set_cs3_bit(PCMCIA_RESET
);
98 static struct pcmcia_low_level simpad_pcmcia_ops
= {
100 .hw_init
= simpad_pcmcia_hw_init
,
101 .hw_shutdown
= simpad_pcmcia_hw_shutdown
,
102 .socket_state
= simpad_pcmcia_socket_state
,
103 .configure_socket
= simpad_pcmcia_configure_socket
,
104 .socket_suspend
= simpad_pcmcia_socket_suspend
,
107 int pcmcia_simpad_init(struct device
*dev
)
111 if (machine_is_simpad())
112 ret
= sa11xx_drv_pcmcia_probe(dev
, &simpad_pcmcia_ops
, 1, 1);