aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/sa1100_cerf.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_cerf.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_cerf.c')
-rw-r--r--drivers/pcmcia/sa1100_cerf.c110
1 files changed, 110 insertions, 0 deletions
diff --git a/drivers/pcmcia/sa1100_cerf.c b/drivers/pcmcia/sa1100_cerf.c
new file mode 100644
index 000000000000..2b3c2895b43d
--- /dev/null
+++ b/drivers/pcmcia/sa1100_cerf.c
@@ -0,0 +1,110 @@
1/*
2 * drivers/pcmcia/sa1100_cerf.c
3 *
4 * PCMCIA implementation routines for CerfBoard
5 * Based off the Assabet.
6 *
7 */
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>
15
16#include <asm/hardware.h>
17#include <asm/mach-types.h>
18#include <asm/irq.h>
19#include <asm/arch/cerf.h>
20#include "sa1100_generic.h"
21
22#define CERF_SOCKET 1
23
24static 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" }
28};
29
30static int cerf_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
31{
32 skt->irq = CERF_IRQ_GPIO_CF_IRQ;
33
34 return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
35}
36
37static void cerf_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
38{
39 soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
40}
41
42static void
43cerf_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
44{
45 unsigned long levels = GPLR;
46
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;
51 state->wrprot = 0;
52 state->vs_3v = 1;
53 state->vs_Xv = 0;
54}
55
56static int
57cerf_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
58 const socket_state_t *state)
59{
60 switch (state->Vcc) {
61 case 0:
62 case 50:
63 case 33:
64 break;
65
66 default:
67 printk(KERN_ERR "%s(): unrecognized Vcc %u\n",
68 __FUNCTION__, state->Vcc);
69 return -1;
70 }
71
72 if (state->flags & SS_RESET) {
73 GPSR = CERF_GPIO_CF_RESET;
74 } else {
75 GPCR = CERF_GPIO_CF_RESET;
76 }
77
78 return 0;
79}
80
81static void cerf_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
82{
83 soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
84}
85
86static void cerf_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
87{
88 soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
89}
90
91static struct pcmcia_low_level cerf_pcmcia_ops = {
92 .owner = THIS_MODULE,
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,
97
98 .socket_init = cerf_pcmcia_socket_init,
99 .socket_suspend = cerf_pcmcia_socket_suspend,
100};
101
102int __init pcmcia_cerf_init(struct device *dev)
103{
104 int ret = -ENODEV;
105
106 if (machine_is_cerf())
107 ret = sa11xx_drv_pcmcia_probe(dev, &cerf_pcmcia_ops, CERF_SOCKET, 1);
108
109 return ret;
110}