2 * drivers/pcmcia/sa1100_cerf.c
4 * PCMCIA implementation routines for CerfBoard
5 * Based off the Assabet.
8 #include <linux/config.h>
9 #include <linux/module.h>
10 #include <linux/kernel.h>
11 #include <linux/sched.h>
12 #include <linux/device.h>
13 #include <linux/init.h>
14 #include <linux/delay.h>
16 #include <asm/hardware.h>
17 #include <asm/mach-types.h>
19 #include <asm/arch/cerf.h>
20 #include "sa1100_generic.h"
24 static struct pcmcia_irqs irqs[] = {
25 { CERF_SOCKET, CERF_IRQ_GPIO_CF_CD, "CF_CD" },
26 { CERF_SOCKET, CERF_IRQ_GPIO_CF_BVD2, "CF_BVD2" },
27 { CERF_SOCKET, CERF_IRQ_GPIO_CF_BVD1, "CF_BVD1" }
30 static int cerf_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
32 skt->irq = CERF_IRQ_GPIO_CF_IRQ;
34 return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
37 static void cerf_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
39 soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
43 cerf_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
45 unsigned long levels = GPLR;
47 state->detect = (levels & CERF_GPIO_CF_CD) ?0:1;
48 state->ready = (levels & CERF_GPIO_CF_IRQ) ?1:0;
49 state->bvd1 = (levels & CERF_GPIO_CF_BVD1)?1:0;
50 state->bvd2 = (levels & CERF_GPIO_CF_BVD2)?1:0;
57 cerf_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
58 const socket_state_t *state)
67 printk(KERN_ERR "%s(): unrecognized Vcc %u\n",
68 __FUNCTION__, state->Vcc);
72 if (state->flags & SS_RESET) {
73 GPSR = CERF_GPIO_CF_RESET;
75 GPCR = CERF_GPIO_CF_RESET;
81 static void cerf_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
83 soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
86 static void cerf_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
88 soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
91 static struct pcmcia_low_level cerf_pcmcia_ops = {
93 .hw_init = cerf_pcmcia_hw_init,
94 .hw_shutdown = cerf_pcmcia_hw_shutdown,
95 .socket_state = cerf_pcmcia_socket_state,
96 .configure_socket = cerf_pcmcia_configure_socket,
98 .socket_init = cerf_pcmcia_socket_init,
99 .socket_suspend = cerf_pcmcia_socket_suspend,
102 int __init pcmcia_cerf_init(struct device *dev)
106 if (machine_is_cerf())
107 ret = sa11xx_drv_pcmcia_probe(dev, &cerf_pcmcia_ops, CERF_SOCKET, 1);