]> bbs.cooldavid.org Git - net-next-2.6.git/blame - drivers/pcmcia/soc_common.h
xps: Transmit Packet Steering
[net-next-2.6.git] / drivers / pcmcia / soc_common.h
CommitLineData
1da177e4
LT
1/*
2 * linux/drivers/pcmcia/soc_common.h
3 *
4 * Copyright (C) 2000 John G Dorsey <john+@cs.cmu.edu>
5 *
6 * This file contains definitions for the PCMCIA support code common to
7 * integrated SOCs like the SA-11x0 and PXA2xx microprocessors.
8 */
9#ifndef _ASM_ARCH_PCMCIA
10#define _ASM_ARCH_PCMCIA
11
12/* include the world */
13#include <linux/cpufreq.h>
1da177e4 14#include <pcmcia/ss.h>
1da177e4 15#include <pcmcia/cistpl.h>
1da177e4
LT
16
17
18struct device;
19struct pcmcia_low_level;
20
21/*
22 * This structure encapsulates per-socket state which we might need to
23 * use when responding to a Card Services query of some kind.
24 */
25struct soc_pcmcia_socket {
26 struct pcmcia_socket socket;
27
28 /*
29 * Info from low level handler
30 */
1da177e4 31 unsigned int nr;
1da177e4
LT
32
33 /*
34 * Core PCMCIA state
35 */
b62d99b5 36 const struct pcmcia_low_level *ops;
1da177e4
LT
37
38 unsigned int status;
39 socket_state_t cs_state;
40
41 unsigned short spd_io[MAX_IO_WIN];
42 unsigned short spd_mem[MAX_WIN];
43 unsigned short spd_attr[MAX_WIN];
44
45 struct resource res_skt;
46 struct resource res_io;
47 struct resource res_mem;
48 struct resource res_attr;
49 void __iomem *virt_io;
50
51 unsigned int irq_state;
52
53 struct timer_list poll_timer;
54 struct list_head node;
55};
56
b393c696
EM
57struct skt_dev_info {
58 int nskt;
59 struct soc_pcmcia_socket skt[0];
60};
61
1da177e4
LT
62struct pcmcia_state {
63 unsigned detect: 1,
64 ready: 1,
65 bvd1: 1,
66 bvd2: 1,
67 wrprot: 1,
68 vs_3v: 1,
69 vs_Xv: 1;
70};
71
72struct pcmcia_low_level {
73 struct module *owner;
74
75 /* first socket in system */
76 int first;
77 /* nr of sockets */
78 int nr;
79
80 int (*hw_init)(struct soc_pcmcia_socket *);
81 void (*hw_shutdown)(struct soc_pcmcia_socket *);
82
83 void (*socket_state)(struct soc_pcmcia_socket *, struct pcmcia_state *);
84 int (*configure_socket)(struct soc_pcmcia_socket *, const socket_state_t *);
85
86 /*
87 * Enable card status IRQs on (re-)initialisation. This can
88 * be called at initialisation, power management event, or
89 * pcmcia event.
90 */
91 void (*socket_init)(struct soc_pcmcia_socket *);
92
93 /*
94 * Disable card status IRQs and PCMCIA bus on suspend.
95 */
96 void (*socket_suspend)(struct soc_pcmcia_socket *);
97
98 /*
99 * Hardware specific timing routines.
100 * If provided, the get_timing routine overrides the SOC default.
101 */
102 unsigned int (*get_timing)(struct soc_pcmcia_socket *, unsigned int, unsigned int);
103 int (*set_timing)(struct soc_pcmcia_socket *);
104 int (*show_timing)(struct soc_pcmcia_socket *, char *);
105
106#ifdef CONFIG_CPU_FREQ
107 /*
108 * CPUFREQ support.
109 */
110 int (*frequency_change)(struct soc_pcmcia_socket *, unsigned long, struct cpufreq_freqs *);
111#endif
112};
113
114
115struct pcmcia_irqs {
116 int sock;
117 int irq;
118 const char *str;
119};
120
121struct soc_pcmcia_timing {
122 unsigned short io;
123 unsigned short mem;
124 unsigned short attr;
125};
126
127extern int soc_pcmcia_request_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
128extern void soc_pcmcia_free_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
129extern void soc_pcmcia_disable_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
130extern void soc_pcmcia_enable_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
131extern void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *, struct soc_pcmcia_timing *);
132
133
097e296d
RKAL
134void soc_pcmcia_remove_one(struct soc_pcmcia_socket *skt);
135int soc_pcmcia_add_one(struct soc_pcmcia_socket *skt);
1da177e4 136
1da177e4 137
7d16b658 138#ifdef CONFIG_PCMCIA_DEBUG
1da177e4
LT
139
140extern void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func,
141 int lvl, const char *fmt, ...);
142
143#define debug(skt, lvl, fmt, arg...) \
144 soc_pcmcia_debug(skt, __func__, lvl, fmt , ## arg)
145
146#else
147#define debug(skt, lvl, fmt, arg...) do { } while (0)
148#endif
149
150
151/*
152 * The PC Card Standard, Release 7, section 4.13.4, says that twIORD
153 * has a minimum value of 165ns. Section 4.13.5 says that twIOWR has
154 * a minimum value of 165ns, as well. Section 4.7.2 (describing
155 * common and attribute memory write timing) says that twWE has a
156 * minimum value of 150ns for a 250ns cycle time (for 5V operation;
157 * see section 4.7.4), or 300ns for a 600ns cycle time (for 3.3V
158 * operation, also section 4.7.4). Section 4.7.3 says that taOE
159 * has a maximum value of 150ns for a 300ns cycle time (for 5V
160 * operation), or 300ns for a 600ns cycle time (for 3.3V operation).
161 *
162 * When configuring memory maps, Card Services appears to adopt the policy
163 * that a memory access time of "0" means "use the default." The default
164 * PCMCIA I/O command width time is 165ns. The default PCMCIA 5V attribute
165 * and memory command width time is 150ns; the PCMCIA 3.3V attribute and
166 * memory command width time is 300ns.
167 */
168#define SOC_PCMCIA_IO_ACCESS (165)
169#define SOC_PCMCIA_5V_MEM_ACCESS (150)
170#define SOC_PCMCIA_3V_MEM_ACCESS (300)
171#define SOC_PCMCIA_ATTR_MEM_ACCESS (300)
172
173/*
174 * The socket driver actually works nicely in interrupt-driven form,
175 * so the (relatively infrequent) polling is "just to be sure."
176 */
177#define SOC_PCMCIA_POLL_PERIOD (2*HZ)
178
179
180/* I/O pins replacing memory pins
181 * (PCMCIA System Architecture, 2nd ed., by Don Anderson, p.75)
182 *
183 * These signals change meaning when going from memory-only to
184 * memory-or-I/O interface:
185 */
186#define iostschg bvd1
187#define iospkr bvd2
188
189#endif