1
2
3
4
5
6
7
8
9
10#ifndef _ASM_ARCH_PCMCIA
11#define _ASM_ARCH_PCMCIA
12
13
14#include <linux/clk.h>
15#include <linux/cpufreq.h>
16#include <pcmcia/ss.h>
17#include <pcmcia/cistpl.h>
18
19
20struct device;
21struct gpio_desc;
22struct pcmcia_low_level;
23struct regulator;
24
25struct soc_pcmcia_regulator {
26 struct regulator *reg;
27 bool on;
28};
29
30
31
32
33
34struct soc_pcmcia_socket {
35 struct pcmcia_socket socket;
36
37
38
39
40 unsigned int nr;
41 struct clk *clk;
42
43
44
45
46 const struct pcmcia_low_level *ops;
47
48 unsigned int status;
49 socket_state_t cs_state;
50
51 unsigned short spd_io[MAX_IO_WIN];
52 unsigned short spd_mem[MAX_WIN];
53 unsigned short spd_attr[MAX_WIN];
54
55 struct resource res_skt;
56 struct resource res_io;
57 struct resource res_mem;
58 struct resource res_attr;
59 void __iomem *virt_io;
60
61 struct {
62 int gpio;
63 struct gpio_desc *desc;
64 unsigned int irq;
65 const char *name;
66 } stat[6];
67#define SOC_STAT_CD 0
68#define SOC_STAT_BVD1 1
69#define SOC_STAT_BVD2 2
70#define SOC_STAT_RDY 3
71#define SOC_STAT_VS1 4
72#define SOC_STAT_VS2 5
73
74 struct gpio_desc *gpio_reset;
75 struct gpio_desc *gpio_bus_enable;
76 struct soc_pcmcia_regulator vcc;
77 struct soc_pcmcia_regulator vpp;
78
79 unsigned int irq_state;
80
81#ifdef CONFIG_CPU_FREQ
82 struct notifier_block cpufreq_nb;
83#endif
84 struct timer_list poll_timer;
85 struct list_head node;
86 void *driver_data;
87};
88
89struct skt_dev_info {
90 int nskt;
91 struct soc_pcmcia_socket skt[0];
92};
93
94struct pcmcia_state {
95 unsigned detect: 1,
96 ready: 1,
97 bvd1: 1,
98 bvd2: 1,
99 wrprot: 1,
100 vs_3v: 1,
101 vs_Xv: 1;
102};
103
104struct pcmcia_low_level {
105 struct module *owner;
106
107
108 int first;
109
110 int nr;
111
112 int (*hw_init)(struct soc_pcmcia_socket *);
113 void (*hw_shutdown)(struct soc_pcmcia_socket *);
114
115 void (*socket_state)(struct soc_pcmcia_socket *, struct pcmcia_state *);
116 int (*configure_socket)(struct soc_pcmcia_socket *, const socket_state_t *);
117
118
119
120
121
122
123 void (*socket_init)(struct soc_pcmcia_socket *);
124
125
126
127
128 void (*socket_suspend)(struct soc_pcmcia_socket *);
129
130
131
132
133
134 unsigned int (*get_timing)(struct soc_pcmcia_socket *, unsigned int, unsigned int);
135 int (*set_timing)(struct soc_pcmcia_socket *);
136 int (*show_timing)(struct soc_pcmcia_socket *, char *);
137
138#ifdef CONFIG_CPU_FREQ
139
140
141
142 int (*frequency_change)(struct soc_pcmcia_socket *, unsigned long, struct cpufreq_freqs *);
143#endif
144};
145
146
147struct soc_pcmcia_timing {
148 unsigned short io;
149 unsigned short mem;
150 unsigned short attr;
151};
152
153extern void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *, struct soc_pcmcia_timing *);
154
155void soc_pcmcia_init_one(struct soc_pcmcia_socket *skt,
156 const struct pcmcia_low_level *ops, struct device *dev);
157void soc_pcmcia_remove_one(struct soc_pcmcia_socket *skt);
158int soc_pcmcia_add_one(struct soc_pcmcia_socket *skt);
159int soc_pcmcia_request_gpiods(struct soc_pcmcia_socket *skt);
160
161void soc_common_cf_socket_state(struct soc_pcmcia_socket *skt,
162 struct pcmcia_state *state);
163
164int soc_pcmcia_regulator_set(struct soc_pcmcia_socket *skt,
165 struct soc_pcmcia_regulator *r, int v);
166
167#ifdef CONFIG_PCMCIA_DEBUG
168
169extern void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func,
170 int lvl, const char *fmt, ...);
171
172#define debug(skt, lvl, fmt, arg...) \
173 soc_pcmcia_debug(skt, __func__, lvl, fmt , ## arg)
174
175#else
176#define debug(skt, lvl, fmt, arg...) do { } while (0)
177#endif
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197#define SOC_PCMCIA_IO_ACCESS (165)
198#define SOC_PCMCIA_5V_MEM_ACCESS (150)
199#define SOC_PCMCIA_3V_MEM_ACCESS (300)
200#define SOC_PCMCIA_ATTR_MEM_ACCESS (300)
201
202
203
204
205
206#define SOC_PCMCIA_POLL_PERIOD (2*HZ)
207
208
209
210
211
212
213
214
215#define iostschg bvd1
216#define iospkr bvd2
217
218#endif
219