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