MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / drivers / pcmcia / sa1100_system3.c
blobc0d19fcf3e98df626631a2ab3c932c291c6beb2e
1 /*
2 * drivers/pcmcia/sa1100_system3.c
4 * PT Diagital Board PCMCIA specific routines
6 * Copyright (C) 2001 Stefan Eletzhofer <stefan.eletzhofer@eletztrick.de>
8 * $Id: sa1100_system3.c,v 1.1.4.2 2002/02/25 13:56:45 seletz Exp $
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 * $Log: sa1100_system3.c,v $
15 * Revision 1.1.4.2 2002/02/25 13:56:45 seletz
16 * - more cleanups
17 * - setup interrupts for CF card only ATM
19 * Revision 1.1.4.1 2002/02/14 02:23:27 seletz
20 * - 2.5.2-rmk6 PCMCIA changes
22 * Revision 1.1.2.1 2002/02/13 23:49:33 seletz
23 * - added from 2.4.16-rmk2
24 * - cleanups
28 #include <linux/module.h>
29 #include <linux/kernel.h>
30 #include <linux/sched.h>
31 #include <linux/init.h>
32 #include <linux/device.h>
33 #include <linux/ioport.h>
35 #include <asm/hardware.h>
36 #include <asm/mach-types.h>
37 #include <asm/irq.h>
38 #include <asm/hardware/sa1111.h>
40 #include "sa1111_generic.h"
42 #define DEBUG 0
44 #ifdef DEBUG
45 # define DPRINTK( x, args... ) printk( "%s: line %d: "x, __FUNCTION__, __LINE__, ## args );
46 #else
47 # define DPRINTK( x, args... ) /* nix */
48 #endif
50 static int system3_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
52 skt->irq = skt->nr ? IRQ_S1_READY_NINT : IRQ_S0_READY_NINT;
54 /* Don't need no CD and BVD* interrupts */
55 return 0;
58 void system3_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
62 static void
63 system3_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
65 unsigned long status = PCSR;
67 switch (skt->nr) {
68 #if 0 /* PCMCIA socket not yet connected */
69 case 0:
70 state->detect = status & PCSR_S0_DETECT ? 0 : 1;
71 state->ready = status & PCSR_S0_READY ? 1 : 0;
72 state->bvd1 = status & PCSR_S0_BVD1 ? 1 : 0;
73 state->bvd2 = 1;
74 state->wrprot = status & PCSR_S0_WP ? 1 : 0;
75 state->vs_3v = 1;
76 state->vs_Xv = 0;
77 break;
78 #endif
80 case 1:
81 state->detect = status & PCSR_S1_DETECT ? 0 : 1;
82 state->ready = status & PCSR_S1_READY ? 1 : 0;
83 state->bvd1 = status & PCSR_S1_BVD1 ? 1 : 0;
84 state->bvd2 = 1;
85 state->wrprot = status & PCSR_S1_WP ? 1 : 0;
86 state->vs_3v = 1;
87 state->vs_Xv = 0;
88 break;
91 DPRINTK("Sock %d PCSR=0x%08lx, Sx_RDY_nIREQ=%d\n",
92 skt->nr, status, state->ready);
95 struct pcmcia_low_level system3_pcmcia_ops = {
96 .owner = THIS_MODULE,
97 .init = system3_pcmcia_hw_init,
98 .shutdown = system3_pcmcia_hw_shutdown,
99 .socket_state = system3_pcmcia_socket_state,
100 .configure_socket = sa1111_pcmcia_configure_socket,
102 .socket_init = sa1111_pcmcia_socket_init,
103 .socket_suspend = sa1111_pcmcia_socket_suspend,
106 int __init pcmcia_system3_init(struct device *dev)
108 int ret = -ENODEV;
110 if (machine_is_pt_system3())
111 /* only CF ATM */
112 ret = sa11xx_drv_pcmcia_probe(dev, &system3_pcmcia_ops, 1, 1);
114 return ret;