2 * drivers/pcmcia/sa1100_pangolin.c
4 * PCMCIA implementation routines for Pangolin
7 #include <linux/config.h>
8 #include <linux/module.h>
9 #include <linux/kernel.h>
10 #include <linux/sched.h>
11 #include <linux/device.h>
12 #include <linux/init.h>
14 #include <asm/hardware.h>
15 #include <asm/mach-types.h>
17 #include "sa1100_generic.h"
19 #ifndef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
20 #define PANGOLIN_SOCK 1
22 #define PANGOLIN_SOCK 0
25 static struct pcmcia_irqs irqs
[] = {
26 { PANGOLIN_SOCK
, IRQ_PCMCIA_CD
, "PCMCIA CD" },
29 static int pangolin_pcmcia_hw_init(struct soc_pcmcia_socket
*skt
)
33 #ifndef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
34 /* Enable PCMCIA bus: */
35 GPCR
= GPIO_PCMCIA_BUS_ON
;
38 skt
->irq
= IRQ_PCMCIA_IRQ
;
40 return soc_pcmcia_request_irqs(skt
, irqs
, ARRAY_SIZE(irqs
));
43 static void pangolin_pcmcia_hw_shutdown(struct soc_pcmcia_socket
*skt
)
45 soc_pcmcia_free_irqs(skt
, irqs
, ARRAY_SIZE(irqs
));
47 #ifndef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
48 /* Disable PCMCIA bus: */
49 GPSR
= GPIO_PCMCIA_BUS_ON
;
54 pangolin_pcmcia_socket_state(struct soc_pcmcia_socket
*skt
,
55 struct pcmcia_state
*state
)
57 unsigned long levels
= GPLR
;
59 state
->detect
=((levels
& GPIO_PCMCIA_CD
)==0)?1:0;
60 state
->ready
=(levels
& GPIO_PCMCIA_IRQ
)?1:0;
61 state
->bvd1
=1; /* Not available on Pangolin. */
62 state
->bvd2
=1; /* Not available on Pangolin. */
63 state
->wrprot
=0; /* Not available on Pangolin. */
64 state
->vs_3v
=1; /* Can only apply 3.3V on Pangolin. */
69 pangolin_pcmcia_configure_socket(struct soc_pcmcia_socket
*skt
,
70 const socket_state_t
*state
)
72 unsigned long value
, flags
;
74 local_irq_save(flags
);
76 /* Murphy: BUS_ON different from POWER ? */
81 #ifndef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
83 printk(KERN_WARNING
"%s(): CS asked for 5V, applying 3.3V...\n",
85 case 33: /* Can only apply 3.3V to the CF slot. */
89 printk(KERN_WARNING
"%s(): CS asked for 5V, determinded by "
90 "jumper setting...\n", __FUNCTION__
);
93 printk(KERN_WARNING
"%s(): CS asked for 3.3V, determined by "
94 "jumper setting...\n", __FUNCTION__
);
98 printk(KERN_ERR
"%s(): unrecognized Vcc %u\n",
99 __FUNCTION__
, state
->Vcc
);
100 local_irq_restore(flags
);
103 #ifdef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
104 /* reset & unreset request */
106 if (state
->flags
& SS_RESET
) {
107 GPSR
= GPIO_PCMCIA_RESET
;
109 GPCR
= GPIO_PCMCIA_RESET
;
113 /* Silently ignore Vpp, output enable, speaker enable. */
114 local_irq_restore(flags
);
118 static void pangolin_pcmcia_socket_init(struct soc_pcmcia_socket
*skt
)
120 soc_pcmcia_enable_irqs(skt
, irqs
, ARRAY_SIZE(irqs
));
123 static void pangolin_pcmcia_socket_suspend(struct soc_pcmcia_socket
*skt
)
125 soc_pcmcia_disable_irqs(skt
, irqs
, ARRAY_SIZE(irqs
));
128 static struct pcmcia_low_level pangolin_pcmcia_ops
= {
129 .owner
= THIS_MODULE
,
130 .hw_init
= pangolin_pcmcia_hw_init
,
131 .hw_shutdown
= pangolin_pcmcia_hw_shutdown
,
132 .socket_state
= pangolin_pcmcia_socket_state
,
133 .configure_socket
= pangolin_pcmcia_configure_socket
,
135 .socket_init
= pangolin_pcmcia_socket_init
,
136 .socket_suspend
= pangolin_pcmcia_socket_suspend
,
139 int __init
pcmcia_pangolin_init(struct device
*dev
)
143 if (machine_is_pangolin())
144 ret
= sa11xx_drv_pcmcia_probe(dev
, &pangolin_pcmcia_ops
, PANGOLIN_SOCK
, 1);