aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/sa1100_shannon.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/pcmcia/sa1100_shannon.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/pcmcia/sa1100_shannon.c')
-rw-r--r--drivers/pcmcia/sa1100_shannon.c125
1 files changed, 125 insertions, 0 deletions
diff --git a/drivers/pcmcia/sa1100_shannon.c b/drivers/pcmcia/sa1100_shannon.c
new file mode 100644
index 000000000000..7bc9e59c761f
--- /dev/null
+++ b/drivers/pcmcia/sa1100_shannon.c
@@ -0,0 +1,125 @@
1/*
2 * drivers/pcmcia/sa1100_shannon.c
3 *
4 * PCMCIA implementation routines for Shannon
5 *
6 */
7#include <linux/module.h>
8#include <linux/kernel.h>
9#include <linux/sched.h>
10#include <linux/device.h>
11#include <linux/init.h>
12
13#include <asm/hardware.h>
14#include <asm/mach-types.h>
15#include <asm/arch/shannon.h>
16#include <asm/irq.h>
17#include "sa1100_generic.h"
18
19static struct pcmcia_irqs irqs[] = {
20 { 0, SHANNON_IRQ_GPIO_EJECT_0, "PCMCIA_CD_0" },
21 { 1, SHANNON_IRQ_GPIO_EJECT_1, "PCMCIA_CD_1" },
22};
23
24static int shannon_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
25{
26 /* All those are inputs */
27 GPDR &= ~(SHANNON_GPIO_EJECT_0 | SHANNON_GPIO_EJECT_1 |
28 SHANNON_GPIO_RDY_0 | SHANNON_GPIO_RDY_1);
29 GAFR &= ~(SHANNON_GPIO_EJECT_0 | SHANNON_GPIO_EJECT_1 |
30 SHANNON_GPIO_RDY_0 | SHANNON_GPIO_RDY_1);
31
32 skt->irq = skt->nr ? SHANNON_IRQ_GPIO_RDY_1 : SHANNON_IRQ_GPIO_RDY_0;
33
34 return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
35}
36
37static void shannon_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
38{
39 soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
40}
41
42static void
43shannon_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
44 struct pcmcia_state *state)
45{
46 unsigned long levels = GPLR;
47
48 switch (skt->nr) {
49 case 0:
50 state->detect = (levels & SHANNON_GPIO_EJECT_0) ? 0 : 1;
51 state->ready = (levels & SHANNON_GPIO_RDY_0) ? 1 : 0;
52 state->wrprot = 0; /* Not available on Shannon. */
53 state->bvd1 = 1;
54 state->bvd2 = 1;
55 state->vs_3v = 1; /* FIXME Can only apply 3.3V on Shannon. */
56 state->vs_Xv = 0;
57 break;
58
59 case 1:
60 state->detect = (levels & SHANNON_GPIO_EJECT_1) ? 0 : 1;
61 state->ready = (levels & SHANNON_GPIO_RDY_1) ? 1 : 0;
62 state->wrprot = 0; /* Not available on Shannon. */
63 state->bvd1 = 1;
64 state->bvd2 = 1;
65 state->vs_3v = 1; /* FIXME Can only apply 3.3V on Shannon. */
66 state->vs_Xv = 0;
67 break;
68 }
69}
70
71static int
72shannon_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
73 const socket_state_t *state)
74{
75 switch (state->Vcc) {
76 case 0: /* power off */
77 printk(KERN_WARNING "%s(): CS asked for 0V, still applying 3.3V..\n", __FUNCTION__);
78 break;
79 case 50:
80 printk(KERN_WARNING "%s(): CS asked for 5V, applying 3.3V..\n", __FUNCTION__);
81 case 33:
82 break;
83 default:
84 printk(KERN_ERR "%s(): unrecognized Vcc %u\n",
85 __FUNCTION__, state->Vcc);
86 return -1;
87 }
88
89 printk(KERN_WARNING "%s(): Warning, Can't perform reset\n", __FUNCTION__);
90
91 /* Silently ignore Vpp, output enable, speaker enable. */
92
93 return 0;
94}
95
96static void shannon_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
97{
98 soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
99}
100
101static void shannon_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
102{
103 soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
104}
105
106static struct pcmcia_low_level shannon_pcmcia_ops = {
107 .owner = THIS_MODULE,
108 .hw_init = shannon_pcmcia_hw_init,
109 .hw_shutdown = shannon_pcmcia_hw_shutdown,
110 .socket_state = shannon_pcmcia_socket_state,
111 .configure_socket = shannon_pcmcia_configure_socket,
112
113 .socket_init = shannon_pcmcia_socket_init,
114 .socket_suspend = shannon_pcmcia_socket_suspend,
115};
116
117int __init pcmcia_shannon_init(struct device *dev)
118{
119 int ret = -ENODEV;
120
121 if (machine_is_shannon())
122 ret = sa11xx_drv_pcmcia_probe(dev, &shannon_pcmcia_ops, 0, 2);
123
124 return ret;
125}