Blame view
drivers/pcmcia/sa1100_shannon.c
2.45 KB
1da177e4c
|
1 2 3 4 5 6 7 8 |
/* * drivers/pcmcia/sa1100_shannon.c * * PCMCIA implementation routines for Shannon * */ #include <linux/module.h> #include <linux/kernel.h> |
1da177e4c
|
9 10 |
#include <linux/device.h> #include <linux/init.h> |
3169663ac
|
11 |
#include <linux/io.h> |
1da177e4c
|
12 |
|
a09e64fbc
|
13 |
#include <mach/hardware.h> |
1da177e4c
|
14 |
#include <asm/mach-types.h> |
a09e64fbc
|
15 |
#include <mach/shannon.h> |
1da177e4c
|
16 17 |
#include <asm/irq.h> #include "sa1100_generic.h" |
1da177e4c
|
18 19 20 |
static int shannon_pcmcia_hw_init(struct soc_pcmcia_socket *skt) { /* All those are inputs */ |
3b61436a7
|
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
GAFR &= ~(GPIO_GPIO(SHANNON_GPIO_EJECT_0) | GPIO_GPIO(SHANNON_GPIO_EJECT_1) | GPIO_GPIO(SHANNON_GPIO_RDY_0) | GPIO_GPIO(SHANNON_GPIO_RDY_1)); if (skt->nr == 0) { skt->stat[SOC_STAT_CD].gpio = SHANNON_GPIO_EJECT_0; skt->stat[SOC_STAT_CD].name = "PCMCIA_CD_0"; skt->stat[SOC_STAT_RDY].gpio = SHANNON_GPIO_RDY_0; skt->stat[SOC_STAT_RDY].name = "PCMCIA_RDY_0"; } else { skt->stat[SOC_STAT_CD].gpio = SHANNON_GPIO_EJECT_1; skt->stat[SOC_STAT_CD].name = "PCMCIA_CD_1"; skt->stat[SOC_STAT_RDY].gpio = SHANNON_GPIO_RDY_1; skt->stat[SOC_STAT_RDY].name = "PCMCIA_RDY_1"; } |
1da177e4c
|
37 |
|
3b61436a7
|
38 |
return 0; |
1da177e4c
|
39 40 41 42 43 44 |
} static void shannon_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) { |
1da177e4c
|
45 46 |
switch (skt->nr) { case 0: |
1da177e4c
|
47 48 49 50 51 52 53 |
state->bvd1 = 1; state->bvd2 = 1; state->vs_3v = 1; /* FIXME Can only apply 3.3V on Shannon. */ state->vs_Xv = 0; break; case 1: |
1da177e4c
|
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
state->bvd1 = 1; state->bvd2 = 1; state->vs_3v = 1; /* FIXME Can only apply 3.3V on Shannon. */ state->vs_Xv = 0; break; } } static int shannon_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) { switch (state->Vcc) { case 0: /* power off */ |
2e11cb4c5
|
68 69 |
printk(KERN_WARNING "%s(): CS asked for 0V, still applying 3.3V.. ", __func__); |
1da177e4c
|
70 71 |
break; case 50: |
2e11cb4c5
|
72 73 |
printk(KERN_WARNING "%s(): CS asked for 5V, applying 3.3V.. ", __func__); |
1da177e4c
|
74 75 76 77 78 |
case 33: break; default: printk(KERN_ERR "%s(): unrecognized Vcc %u ", |
2e11cb4c5
|
79 |
__func__, state->Vcc); |
1da177e4c
|
80 81 |
return -1; } |
2e11cb4c5
|
82 83 |
printk(KERN_WARNING "%s(): Warning, Can't perform reset ", __func__); |
1da177e4c
|
84 85 86 87 88 |
/* Silently ignore Vpp, output enable, speaker enable. */ return 0; } |
1da177e4c
|
89 90 91 |
static struct pcmcia_low_level shannon_pcmcia_ops = { .owner = THIS_MODULE, .hw_init = shannon_pcmcia_hw_init, |
1da177e4c
|
92 93 |
.socket_state = shannon_pcmcia_socket_state, .configure_socket = shannon_pcmcia_configure_socket, |
1da177e4c
|
94 |
}; |
5b85e04e9
|
95 |
int __devinit pcmcia_shannon_init(struct device *dev) |
1da177e4c
|
96 97 98 99 100 101 102 103 |
{ int ret = -ENODEV; if (machine_is_shannon()) ret = sa11xx_drv_pcmcia_probe(dev, &shannon_pcmcia_ops, 0, 2); return ret; } |