This source file includes following definitions.
- brcmf_sdiod_freezing
- brcmf_sdiod_try_freeze
- brcmf_sdiod_freezer_count
- brcmf_sdiod_freezer_uncount
1
2
3
4
5
6 #ifndef BRCMFMAC_SDIO_H
7 #define BRCMFMAC_SDIO_H
8
9 #include <linux/skbuff.h>
10 #include <linux/firmware.h>
11 #include "firmware.h"
12
13 #define SDIOD_FBR_SIZE 0x100
14
15
16 #define SDIO_FUNC_ENABLE_1 0x02
17 #define SDIO_FUNC_ENABLE_2 0x04
18
19
20 #define SDIO_FUNC_READY_1 0x02
21 #define SDIO_FUNC_READY_2 0x04
22
23
24 #define INTR_STATUS_FUNC1 0x2
25 #define INTR_STATUS_FUNC2 0x4
26
27
28 #define REG_F0_REG_MASK 0x7FF
29 #define REG_F1_MISC_MASK 0x1FFFF
30
31
32
33 #define SDIO_CCCR_BRCM_CARDCAP 0xf0
34 #define SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT BIT(1)
35 #define SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT BIT(2)
36 #define SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC BIT(3)
37
38
39 #define SDIO_CCCR_IEN_FUNC0 BIT(0)
40 #define SDIO_CCCR_IEN_FUNC1 BIT(1)
41 #define SDIO_CCCR_IEN_FUNC2 BIT(2)
42
43 #define SDIO_CCCR_BRCM_CARDCTRL 0xf1
44 #define SDIO_CCCR_BRCM_CARDCTRL_WLANRESET BIT(1)
45
46 #define SDIO_CCCR_BRCM_SEPINT 0xf2
47 #define SDIO_CCCR_BRCM_SEPINT_MASK BIT(0)
48 #define SDIO_CCCR_BRCM_SEPINT_OE BIT(1)
49 #define SDIO_CCCR_BRCM_SEPINT_ACT_HI BIT(2)
50
51
52
53
54 #define SBSDIO_SPROM_CS 0x10000
55
56 #define SBSDIO_SPROM_INFO 0x10001
57
58 #define SBSDIO_SPROM_DATA_LOW 0x10002
59
60 #define SBSDIO_SPROM_DATA_HIGH 0x10003
61
62 #define SBSDIO_SPROM_ADDR_LOW 0x10004
63
64 #define SBSDIO_GPIO_SELECT 0x10005
65
66 #define SBSDIO_GPIO_OUT 0x10006
67
68 #define SBSDIO_GPIO_EN 0x10007
69
70 #define SBSDIO_WATERMARK 0x10008
71
72 #define SBSDIO_DEVICE_CTL 0x10009
73
74
75 #define SBSDIO_FUNC1_SBADDRLOW 0x1000A
76
77 #define SBSDIO_FUNC1_SBADDRMID 0x1000B
78
79 #define SBSDIO_FUNC1_SBADDRHIGH 0x1000C
80
81 #define SBSDIO_FUNC1_FRAMECTRL 0x1000D
82
83 #define SBSDIO_FUNC1_CHIPCLKCSR 0x1000E
84
85 #define SBSDIO_FUNC1_SDIOPULLUP 0x1000F
86
87 #define SBSDIO_FUNC1_WFRAMEBCLO 0x10019
88
89 #define SBSDIO_FUNC1_WFRAMEBCHI 0x1001A
90
91 #define SBSDIO_FUNC1_RFRAMEBCLO 0x1001B
92
93 #define SBSDIO_FUNC1_RFRAMEBCHI 0x1001C
94
95 #define SBSDIO_FUNC1_MESBUSYCTRL 0x1001D
96
97 #define SBSDIO_MESBUSY_RXFIFO_WM_MASK 0x7F
98 #define SBSDIO_MESBUSY_RXFIFO_WM_SHIFT 0
99
100 #define SBSDIO_MESBUSYCTRL_ENAB 0x80
101 #define SBSDIO_MESBUSYCTRL_ENAB_SHIFT 7
102
103
104 #define SBSDIO_FUNC1_WAKEUPCTRL 0x1001E
105 #define SBSDIO_FUNC1_WCTRL_ALPWAIT_MASK 0x1
106 #define SBSDIO_FUNC1_WCTRL_ALPWAIT_SHIFT 0
107 #define SBSDIO_FUNC1_WCTRL_HTWAIT_MASK 0x2
108 #define SBSDIO_FUNC1_WCTRL_HTWAIT_SHIFT 1
109 #define SBSDIO_FUNC1_SLEEPCSR 0x1001F
110 #define SBSDIO_FUNC1_SLEEPCSR_KSO_MASK 0x1
111 #define SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT 0
112 #define SBSDIO_FUNC1_SLEEPCSR_KSO_EN 1
113 #define SBSDIO_FUNC1_SLEEPCSR_DEVON_MASK 0x2
114 #define SBSDIO_FUNC1_SLEEPCSR_DEVON_SHIFT 1
115
116 #define SBSDIO_FUNC1_MISC_REG_START 0x10000
117 #define SBSDIO_FUNC1_MISC_REG_LIMIT 0x1001F
118
119
120
121
122 #define SBSDIO_SB_OFT_ADDR_MASK 0x07FFF
123 #define SBSDIO_SB_OFT_ADDR_LIMIT 0x08000
124
125 #define SBSDIO_SB_ACCESS_2_4B_FLAG 0x08000
126
127
128 #define SBSDIO_SBWINDOW_MASK 0xffff8000
129
130 #define SDIOH_READ 0
131 #define SDIOH_WRITE 1
132
133 #define SDIOH_DATA_FIX 0
134 #define SDIOH_DATA_INC 1
135
136
137 #define SUCCESS 0
138 #define ERROR 1
139
140
141 #define BRCMF_SDALIGN (1 << 6)
142
143
144 #define BRCMF_WD_POLL msecs_to_jiffies(10)
145
146
147
148
149
150
151
152
153 enum brcmf_sdiod_state {
154 BRCMF_SDIOD_DOWN,
155 BRCMF_SDIOD_DATA,
156 BRCMF_SDIOD_NOMEDIUM
157 };
158
159 struct brcmf_sdreg {
160 int func;
161 int offset;
162 int value;
163 };
164
165 struct brcmf_sdio;
166 struct brcmf_sdiod_freezer;
167
168 struct brcmf_sdio_dev {
169 struct sdio_func *func1;
170 struct sdio_func *func2;
171 u32 sbwad;
172 struct brcmf_core *cc_core;
173 struct brcmf_sdio *bus;
174 struct device *dev;
175 struct brcmf_bus *bus_if;
176 struct brcmf_mp_device *settings;
177 bool oob_irq_requested;
178 bool sd_irq_requested;
179 bool irq_en;
180 spinlock_t irq_en_lock;
181 bool irq_wake;
182 bool sg_support;
183 uint max_request_size;
184 ushort max_segment_count;
185 uint max_segment_size;
186 uint txglomsz;
187 struct sg_table sgtable;
188 char fw_name[BRCMF_FW_NAME_LEN];
189 char nvram_name[BRCMF_FW_NAME_LEN];
190 bool wowl_enabled;
191 enum brcmf_sdiod_state state;
192 struct brcmf_sdiod_freezer *freezer;
193 };
194
195
196 struct sdpcmd_regs {
197 u32 corecontrol;
198 u32 corestatus;
199 u32 PAD[1];
200 u32 biststatus;
201
202
203 u16 pcmciamesportaladdr;
204 u16 PAD[1];
205 u16 pcmciamesportalmask;
206 u16 PAD[1];
207 u16 pcmciawrframebc;
208 u16 PAD[1];
209 u16 pcmciaunderflowtimer;
210 u16 PAD[1];
211
212
213 u32 intstatus;
214 u32 hostintmask;
215 u32 intmask;
216 u32 sbintstatus;
217 u32 sbintmask;
218 u32 funcintmask;
219 u32 PAD[2];
220 u32 tosbmailbox;
221 u32 tohostmailbox;
222 u32 tosbmailboxdata;
223 u32 tohostmailboxdata;
224
225
226 u32 sdioaccess;
227 u32 PAD[3];
228
229
230 u8 pcmciaframectrl;
231 u8 PAD[3];
232 u8 pcmciawatermark;
233 u8 PAD[155];
234
235
236 u32 intrcvlazy;
237 u32 PAD[3];
238
239
240 u32 cmd52rd;
241 u32 cmd52wr;
242 u32 cmd53rd;
243 u32 cmd53wr;
244 u32 abort;
245 u32 datacrcerror;
246 u32 rdoutofsync;
247 u32 wroutofsync;
248 u32 writebusy;
249 u32 readwait;
250 u32 readterm;
251 u32 writeterm;
252 u32 PAD[40];
253 u32 clockctlstatus;
254 u32 PAD[7];
255
256 u32 PAD[128];
257
258
259 char cis[512];
260
261
262 char pcmciafcr[256];
263 u16 PAD[55];
264
265
266 u16 backplanecsr;
267 u16 backplaneaddr0;
268 u16 backplaneaddr1;
269 u16 backplaneaddr2;
270 u16 backplaneaddr3;
271 u16 backplanedata0;
272 u16 backplanedata1;
273 u16 backplanedata2;
274 u16 backplanedata3;
275 u16 PAD[31];
276
277
278 u16 spromstatus;
279 u32 PAD[464];
280
281 u16 PAD[0x80];
282 };
283
284
285 int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev);
286 void brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev);
287
288
289
290 #define brcmf_sdiod_func0_rb(sdiodev, addr, r) \
291 sdio_f0_readb((sdiodev)->func1, (addr), (r))
292
293 #define brcmf_sdiod_func0_wb(sdiodev, addr, v, ret) \
294 sdio_f0_writeb((sdiodev)->func1, (v), (addr), (ret))
295
296
297 #define brcmf_sdiod_readb(sdiodev, addr, r) \
298 sdio_readb((sdiodev)->func1, (addr), (r))
299
300 #define brcmf_sdiod_writeb(sdiodev, addr, v, ret) \
301 sdio_writeb((sdiodev)->func1, (v), (addr), (ret))
302
303 u32 brcmf_sdiod_readl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret);
304 void brcmf_sdiod_writel(struct brcmf_sdio_dev *sdiodev, u32 addr, u32 data,
305 int *ret);
306
307
308
309
310
311
312
313
314
315
316
317
318 int brcmf_sdiod_send_pkt(struct brcmf_sdio_dev *sdiodev,
319 struct sk_buff_head *pktq);
320 int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes);
321
322 int brcmf_sdiod_recv_pkt(struct brcmf_sdio_dev *sdiodev, struct sk_buff *pkt);
323 int brcmf_sdiod_recv_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes);
324 int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev,
325 struct sk_buff_head *pktq, uint totlen);
326
327
328
329
330 #define SDIO_REQ_4BYTE 0x1
331
332 #define SDIO_REQ_FIXED 0x2
333
334
335
336
337
338
339
340
341 int brcmf_sdiod_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address,
342 u8 *data, uint size);
343
344
345 int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, struct sdio_func *func);
346
347 void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev);
348 void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev,
349 enum brcmf_sdiod_state state);
350 #ifdef CONFIG_PM_SLEEP
351 bool brcmf_sdiod_freezing(struct brcmf_sdio_dev *sdiodev);
352 void brcmf_sdiod_try_freeze(struct brcmf_sdio_dev *sdiodev);
353 void brcmf_sdiod_freezer_count(struct brcmf_sdio_dev *sdiodev);
354 void brcmf_sdiod_freezer_uncount(struct brcmf_sdio_dev *sdiodev);
355 #else
356 static inline bool brcmf_sdiod_freezing(struct brcmf_sdio_dev *sdiodev)
357 {
358 return false;
359 }
360 static inline void brcmf_sdiod_try_freeze(struct brcmf_sdio_dev *sdiodev)
361 {
362 }
363 static inline void brcmf_sdiod_freezer_count(struct brcmf_sdio_dev *sdiodev)
364 {
365 }
366 static inline void brcmf_sdiod_freezer_uncount(struct brcmf_sdio_dev *sdiodev)
367 {
368 }
369 #endif
370
371 struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev);
372 void brcmf_sdio_remove(struct brcmf_sdio *bus);
373 void brcmf_sdio_isr(struct brcmf_sdio *bus);
374
375 void brcmf_sdio_wd_timer(struct brcmf_sdio *bus, bool active);
376 void brcmf_sdio_wowl_config(struct device *dev, bool enabled);
377 int brcmf_sdio_sleep(struct brcmf_sdio *bus, bool sleep);
378 void brcmf_sdio_trigger_dpc(struct brcmf_sdio *bus);
379
380 #endif