2 * drivers/pcmcia/sa1100_assabet.c
4 * PCMCIA implementation routines for Assabet
7 #include <linux/module.h>
8 #include <linux/kernel.h>
9 #include <linux/errno.h>
10 #include <linux/interrupt.h>
11 #include <linux/device.h>
12 #include <linux/init.h>
13 #include <linux/gpio.h>
15 #include <asm/mach-types.h>
16 #include <mach/assabet.h>
18 #include "sa1100_generic.h"
20 static int assabet_pcmcia_hw_init(struct soc_pcmcia_socket
*skt
)
22 skt
->stat
[SOC_STAT_CD
].gpio
= ASSABET_GPIO_CF_CD
;
23 skt
->stat
[SOC_STAT_CD
].name
= "CF CD";
24 skt
->stat
[SOC_STAT_BVD1
].gpio
= ASSABET_GPIO_CF_BVD1
;
25 skt
->stat
[SOC_STAT_BVD1
].name
= "CF BVD1";
26 skt
->stat
[SOC_STAT_BVD2
].gpio
= ASSABET_GPIO_CF_BVD2
;
27 skt
->stat
[SOC_STAT_BVD2
].name
= "CF BVD2";
28 skt
->stat
[SOC_STAT_RDY
].gpio
= ASSABET_GPIO_CF_IRQ
;
29 skt
->stat
[SOC_STAT_RDY
].name
= "CF RDY";
35 assabet_pcmcia_socket_state(struct soc_pcmcia_socket
*skt
, struct pcmcia_state
*state
)
37 state
->vs_3v
= 1; /* Can only apply 3.3V on Assabet. */
42 assabet_pcmcia_configure_socket(struct soc_pcmcia_socket
*skt
, const socket_state_t
*state
)
52 printk(KERN_WARNING
"%s(): CS asked for 5V, applying 3.3V...\n",
55 case 33: /* Can only apply 3.3V to the CF slot. */
56 mask
= ASSABET_BCR_CF_PWR
;
60 printk(KERN_ERR
"%s(): unrecognized Vcc %u\n", __func__
,
65 /* Silently ignore Vpp, speaker enable. */
67 if (state
->flags
& SS_RESET
)
68 mask
|= ASSABET_BCR_CF_RST
;
69 if (!(state
->flags
& SS_OUTPUT_ENA
))
70 mask
|= ASSABET_BCR_CF_BUS_OFF
;
72 ASSABET_BCR_frob(ASSABET_BCR_CF_RST
| ASSABET_BCR_CF_PWR
|
73 ASSABET_BCR_CF_BUS_OFF
, mask
);
79 * Disable card status IRQs on suspend.
81 static void assabet_pcmcia_socket_suspend(struct soc_pcmcia_socket
*skt
)
84 * Tristate the CF bus signals. Also assert CF
85 * reset as per user guide page 4-11.
87 ASSABET_BCR_set(ASSABET_BCR_CF_BUS_OFF
| ASSABET_BCR_CF_RST
);
90 static struct pcmcia_low_level assabet_pcmcia_ops
= {
92 .hw_init
= assabet_pcmcia_hw_init
,
93 .socket_state
= assabet_pcmcia_socket_state
,
94 .configure_socket
= assabet_pcmcia_configure_socket
,
95 .socket_suspend
= assabet_pcmcia_socket_suspend
,
98 int __devinit
pcmcia_assabet_init(struct device
*dev
)
102 if (machine_is_assabet() && !machine_has_neponset())
103 ret
= sa11xx_drv_pcmcia_probe(dev
, &assabet_pcmcia_ops
, 1, 1);