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 extern long get_cs3_shadow(void);
19 extern void set_cs3_bit(int value
);
20 extern void clear_cs3_bit(int value
);
22 static struct pcmcia_irqs irqs
[] = {
23 { 1, IRQ_GPIO_CF_CD
, "CF_CD" },
26 static int simpad_pcmcia_hw_init(struct soc_pcmcia_socket
*skt
)
29 clear_cs3_bit(VCC_3V_EN
|VCC_5V_EN
|EN0
|EN1
);
31 skt
->irq
= IRQ_GPIO_CF_IRQ
;
33 return soc_pcmcia_request_irqs(skt
, irqs
, ARRAY_SIZE(irqs
));
36 static void simpad_pcmcia_hw_shutdown(struct soc_pcmcia_socket
*skt
)
38 soc_pcmcia_free_irqs(skt
, irqs
, ARRAY_SIZE(irqs
));
41 //set_cs3_bit(PCMCIA_BUFF_DIS);
42 clear_cs3_bit(PCMCIA_RESET
);
46 simpad_pcmcia_socket_state(struct soc_pcmcia_socket
*skt
,
47 struct pcmcia_state
*state
)
49 unsigned long levels
= GPLR
;
50 long cs3reg
= get_cs3_shadow();
52 state
->detect
=((levels
& GPIO_CF_CD
)==0)?1:0;
53 state
->ready
=(levels
& GPIO_CF_IRQ
)?1:0;
54 state
->bvd1
=1; /* Not available on Simpad. */
55 state
->bvd2
=1; /* Not available on Simpad. */
56 state
->wrprot
=0; /* Not available on Simpad. */
58 if((cs3reg
& 0x0c) == 0x0c) {
68 simpad_pcmcia_configure_socket(struct soc_pcmcia_socket
*skt
,
69 const socket_state_t
*state
)
73 local_irq_save(flags
);
75 /* Murphy: see table of MIC2562a-1 */
78 clear_cs3_bit(VCC_3V_EN
|VCC_5V_EN
|EN0
|EN1
);
82 clear_cs3_bit(VCC_3V_EN
|EN1
);
83 set_cs3_bit(VCC_5V_EN
|EN0
);
87 clear_cs3_bit(VCC_5V_EN
|EN1
);
88 set_cs3_bit(VCC_3V_EN
|EN0
);
92 printk(KERN_ERR
"%s(): unrecognized Vcc %u\n",
93 __func__
, state
->Vcc
);
94 clear_cs3_bit(VCC_3V_EN
|VCC_5V_EN
|EN0
|EN1
);
95 local_irq_restore(flags
);
100 local_irq_restore(flags
);
105 static void simpad_pcmcia_socket_init(struct soc_pcmcia_socket
*skt
)
107 soc_pcmcia_enable_irqs(skt
, irqs
, ARRAY_SIZE(irqs
));
110 static void simpad_pcmcia_socket_suspend(struct soc_pcmcia_socket
*skt
)
112 soc_pcmcia_disable_irqs(skt
, irqs
, ARRAY_SIZE(irqs
));
113 set_cs3_bit(PCMCIA_RESET
);
116 static struct pcmcia_low_level simpad_pcmcia_ops
= {
117 .owner
= THIS_MODULE
,
118 .hw_init
= simpad_pcmcia_hw_init
,
119 .hw_shutdown
= simpad_pcmcia_hw_shutdown
,
120 .socket_state
= simpad_pcmcia_socket_state
,
121 .configure_socket
= simpad_pcmcia_configure_socket
,
122 .socket_init
= simpad_pcmcia_socket_init
,
123 .socket_suspend
= simpad_pcmcia_socket_suspend
,
126 int __init
pcmcia_simpad_init(struct device
*dev
)
130 if (machine_is_simpad())
131 ret
= sa11xx_drv_pcmcia_probe(dev
, &simpad_pcmcia_ops
, 1, 1);