mm: get rid of pagevec_release_nonlru()
[linux-2.6/linux-2.6-openrd.git] / drivers / pcmcia / soc_common.h
blob38c67375f363aeb9483a5656170a453e61c4101a
1 /*
2 * linux/drivers/pcmcia/soc_common.h
4 * Copyright (C) 2000 John G Dorsey <john+@cs.cmu.edu>
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
12 /* include the world */
13 #include <linux/cpufreq.h>
14 #include <pcmcia/cs_types.h>
15 #include <pcmcia/cs.h>
16 #include <pcmcia/ss.h>
17 #include <pcmcia/cistpl.h>
20 struct device;
21 struct pcmcia_low_level;
24 * This structure encapsulates per-socket state which we might need to
25 * use when responding to a Card Services query of some kind.
27 struct soc_pcmcia_socket {
28 struct pcmcia_socket socket;
31 * Info from low level handler
33 struct device *dev;
34 unsigned int nr;
35 unsigned int irq;
38 * Core PCMCIA state
40 struct pcmcia_low_level *ops;
42 unsigned int status;
43 socket_state_t cs_state;
45 unsigned short spd_io[MAX_IO_WIN];
46 unsigned short spd_mem[MAX_WIN];
47 unsigned short spd_attr[MAX_WIN];
49 struct resource res_skt;
50 struct resource res_io;
51 struct resource res_mem;
52 struct resource res_attr;
53 void __iomem *virt_io;
55 unsigned int irq_state;
57 struct timer_list poll_timer;
58 struct list_head node;
61 struct pcmcia_state {
62 unsigned detect: 1,
63 ready: 1,
64 bvd1: 1,
65 bvd2: 1,
66 wrprot: 1,
67 vs_3v: 1,
68 vs_Xv: 1;
71 struct pcmcia_low_level {
72 struct module *owner;
74 /* first socket in system */
75 int first;
76 /* nr of sockets */
77 int nr;
79 int (*hw_init)(struct soc_pcmcia_socket *);
80 void (*hw_shutdown)(struct soc_pcmcia_socket *);
82 void (*socket_state)(struct soc_pcmcia_socket *, struct pcmcia_state *);
83 int (*configure_socket)(struct soc_pcmcia_socket *, const socket_state_t *);
86 * Enable card status IRQs on (re-)initialisation. This can
87 * be called at initialisation, power management event, or
88 * pcmcia event.
90 void (*socket_init)(struct soc_pcmcia_socket *);
93 * Disable card status IRQs and PCMCIA bus on suspend.
95 void (*socket_suspend)(struct soc_pcmcia_socket *);
98 * Hardware specific timing routines.
99 * If provided, the get_timing routine overrides the SOC default.
101 unsigned int (*get_timing)(struct soc_pcmcia_socket *, unsigned int, unsigned int);
102 int (*set_timing)(struct soc_pcmcia_socket *);
103 int (*show_timing)(struct soc_pcmcia_socket *, char *);
105 #ifdef CONFIG_CPU_FREQ
107 * CPUFREQ support.
109 int (*frequency_change)(struct soc_pcmcia_socket *, unsigned long, struct cpufreq_freqs *);
110 #endif
114 struct pcmcia_irqs {
115 int sock;
116 int irq;
117 const char *str;
120 struct soc_pcmcia_timing {
121 unsigned short io;
122 unsigned short mem;
123 unsigned short attr;
126 extern int soc_pcmcia_request_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
127 extern void soc_pcmcia_free_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
128 extern void soc_pcmcia_disable_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
129 extern void soc_pcmcia_enable_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
130 extern void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *, struct soc_pcmcia_timing *);
133 extern struct list_head soc_pcmcia_sockets;
135 extern int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr);
136 extern int soc_common_drv_pcmcia_remove(struct device *dev);
139 #ifdef CONFIG_PCMCIA_DEBUG
141 extern void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func,
142 int lvl, const char *fmt, ...);
144 #define debug(skt, lvl, fmt, arg...) \
145 soc_pcmcia_debug(skt, __func__, lvl, fmt , ## arg)
147 #else
148 #define debug(skt, lvl, fmt, arg...) do { } while (0)
149 #endif
153 * The PC Card Standard, Release 7, section 4.13.4, says that twIORD
154 * has a minimum value of 165ns. Section 4.13.5 says that twIOWR has
155 * a minimum value of 165ns, as well. Section 4.7.2 (describing
156 * common and attribute memory write timing) says that twWE has a
157 * minimum value of 150ns for a 250ns cycle time (for 5V operation;
158 * see section 4.7.4), or 300ns for a 600ns cycle time (for 3.3V
159 * operation, also section 4.7.4). Section 4.7.3 says that taOE
160 * has a maximum value of 150ns for a 300ns cycle time (for 5V
161 * operation), or 300ns for a 600ns cycle time (for 3.3V operation).
163 * When configuring memory maps, Card Services appears to adopt the policy
164 * that a memory access time of "0" means "use the default." The default
165 * PCMCIA I/O command width time is 165ns. The default PCMCIA 5V attribute
166 * and memory command width time is 150ns; the PCMCIA 3.3V attribute and
167 * memory command width time is 300ns.
169 #define SOC_PCMCIA_IO_ACCESS (165)
170 #define SOC_PCMCIA_5V_MEM_ACCESS (150)
171 #define SOC_PCMCIA_3V_MEM_ACCESS (300)
172 #define SOC_PCMCIA_ATTR_MEM_ACCESS (300)
175 * The socket driver actually works nicely in interrupt-driven form,
176 * so the (relatively infrequent) polling is "just to be sure."
178 #define SOC_PCMCIA_POLL_PERIOD (2*HZ)
181 /* I/O pins replacing memory pins
182 * (PCMCIA System Architecture, 2nd ed., by Don Anderson, p.75)
184 * These signals change meaning when going from memory-only to
185 * memory-or-I/O interface:
187 #define iostschg bvd1
188 #define iospkr bvd2
190 #endif