add all source code from linksys/broadcom which is free, to cvs for better maintainen...
[openwrt/svn-archive/archive.git] / openwrt / package / linux / kernel-source / drivers / pcmcia / bcm4710pcmcia.h
1 /*
2 *
3 * bcm47xx pcmcia driver
4 *
5 * Copyright 2004, Broadcom Corporation
6 * All Rights Reserved.
7 *
8 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
10 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
11 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
12 *
13 * Based on sa1100.h and include/asm-arm/arch-sa1100/pcmica.h
14 * from www.handhelds.org,
15 * and au1000_generic.c from oss.sgi.com.
16 *
17 * $Id$
18 */
19
20 #if !defined(_BCM4710PCMCIA_H)
21 #define _BCM4710PCMCIA_H
22
23 #include <pcmcia/cs_types.h>
24 #include <pcmcia/ss.h>
25 #include <pcmcia/bulkmem.h>
26 #include <pcmcia/cistpl.h>
27 #include "cs_internal.h"
28
29
30 /* The 47xx can only support one socket */
31 #define BCM47XX_PCMCIA_MAX_SOCK 1
32
33 /* In the bcm947xx gpio's are used for some pcmcia functions */
34 #define BCM47XX_PCMCIA_WP 0x01 /* Bit 0 is WP input */
35 #define BCM47XX_PCMCIA_STSCHG 0x20 /* Bit 5 is STSCHG input/interrupt */
36 #define BCM47XX_PCMCIA_RESET 0x80 /* Bit 7 is RESET */
37
38 #define BCM47XX_PCMCIA_IRQ 2
39
40 /* The socket driver actually works nicely in interrupt-driven form,
41 * so the (relatively infrequent) polling is "just to be sure."
42 */
43 #define BCM47XX_PCMCIA_POLL_PERIOD (2 * HZ)
44
45 #define BCM47XX_PCMCIA_IO_SPEED (255)
46 #define BCM47XX_PCMCIA_MEM_SPEED (300)
47
48
49 struct pcmcia_state {
50 unsigned detect: 1,
51 ready: 1,
52 bvd1: 1,
53 bvd2: 1,
54 wrprot: 1,
55 vs_3v: 1,
56 vs_Xv: 1;
57 };
58
59
60 struct pcmcia_configure {
61 unsigned sock: 8,
62 vcc: 8,
63 vpp: 8,
64 output: 1,
65 speaker: 1,
66 reset: 1;
67 };
68
69 struct pcmcia_irq_info {
70 unsigned int sock;
71 unsigned int irq;
72 };
73
74 /* This structure encapsulates per-socket state which we might need to
75 * use when responding to a Card Services query of some kind.
76 */
77 struct bcm47xx_pcmcia_socket {
78 socket_state_t cs_state;
79 struct pcmcia_state k_state;
80 unsigned int irq;
81 void (*handler)(void *, unsigned int);
82 void *handler_info;
83 pccard_io_map io_map[MAX_IO_WIN];
84 pccard_mem_map mem_map[MAX_WIN];
85 ioaddr_t virt_io, phys_attr, phys_mem;
86 unsigned short speed_io, speed_attr, speed_mem;
87 };
88
89 struct pcmcia_init {
90 void (*handler)(int irq, void *dev, struct pt_regs *regs);
91 };
92
93 struct pcmcia_low_level {
94 int (*init)(struct pcmcia_init *);
95 int (*shutdown)(void);
96 int (*socket_state)(unsigned sock, struct pcmcia_state *);
97 int (*get_irq_info)(struct pcmcia_irq_info *);
98 int (*configure_socket)(const struct pcmcia_configure *);
99 };
100
101 extern struct pcmcia_low_level bcm47xx_pcmcia_ops;
102
103 /* I/O pins replacing memory pins
104 * (PCMCIA System Architecture, 2nd ed., by Don Anderson, p.75)
105 *
106 * These signals change meaning when going from memory-only to
107 * memory-or-I/O interface:
108 */
109 #define iostschg bvd1
110 #define iospkr bvd2
111
112
113 /*
114 * Declaration for implementation specific low_level operations.
115 */
116 extern struct pcmcia_low_level bcm4710_pcmcia_ops;
117
118 #endif /* !defined(_BCM4710PCMCIA_H) */