1 /*
2 * BCMSDH interface glue
3 * implement bcmsdh API for SDIOH driver
4 *
5 * Copyright (C) 1999-2009, Broadcom Corporation
6 *
7 * Unless you and Broadcom execute a separate written software license
8 * agreement governing use of this software, this software is licensed to you
9 * under the terms of the GNU General Public License version 2 (the "GPL"),
10 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
11 * following added to such license:
12 *
13 * As a special exception, the copyright holders of this software give you
14 * permission to link this software with independent modules, and to copy and
15 * distribute the resulting executable under terms of your choice, provided that
16 * you also meet, for each linked independent module, the terms and conditions of
17 * the license of that module. An independent module is a module which is not
18 * derived from this software. The special exception does not apply to any
19 * modifications of the software.
20 *
21 * Notwithstanding the above, under no circumstances may you combine this
22 * software in any way with any other Broadcom software provided under a license
23 * other than the GPL, without Broadcom's express prior written consent.
24 *
25 * $Id: bcmsdh.c,v 1.35.2.1.4.8.6.11 2009/10/20 09:48:20 Exp $
26 */
27 /* ****************** BCMSDH Interface Functions *************************** */
28
29 #include <typedefs.h>
30 #include <bcmdevs.h>
31 #include <bcmendian.h>
32 #include <bcmutils.h>
33 #include <hndsoc.h>
34 #include <siutils.h>
35 #include <osl.h>
36
37 #include <bcmsdh.h> /* BRCM API for SDIO clients (such as wl, dhd) */
38 #include <bcmsdbus.h> /* common SDIO/controller interface */
39 #include <sbsdio.h> /* BRCM sdio device core */
40
41 #include <sdio.h> /* sdio spec */
42
43 const uint bcmsdh_msglevel = BCMSDH_ERROR_VAL;
44
45
46 struct bcmsdh_info
47 {
48 bool init_success; /* underlying driver successfully attached */
49 void *sdioh; /* handler for sdioh */
50 uint32 vendevid; /* Target Vendor and Device ID on SD bus */
51 osl_t *osh;
52 bool regfail; /* Save status of last reg_read/reg_write call */
53 uint32 sbwad; /* Save backplane window address */
54 };
55 /* local copy of bcm sd handler */
56 bcmsdh_info_t * l_bcmsdh = NULL;
57
58 #if defined(OOB_INTR_ONLY) && defined(HW_OOB)
59
60 extern int
61 sdioh_enable_hw_oob_intr(void *sdioh, bool enable);
62
63 void
bcmsdh_enable_hw_oob_intr(bcmsdh_info_t * sdh,bool enable)64 bcmsdh_enable_hw_oob_intr(bcmsdh_info_t *sdh, bool enable)
65 {
66 sdioh_enable_hw_oob_intr(sdh->sdioh, enable);
67 }
68
69 #endif
70
71 bcmsdh_info_t *
bcmsdh_attach(osl_t * osh,void * cfghdl,void ** regsva,uint irq)72 bcmsdh_attach(osl_t *osh, void *cfghdl, void **regsva, uint irq)
73 {
74 bcmsdh_info_t *bcmsdh;
75
76 if ((bcmsdh = (bcmsdh_info_t *)MALLOC(osh, sizeof(bcmsdh_info_t))) == NULL) {
77 BCMSDH_ERROR(("bcmsdh_attach: out of memory, malloced %d bytes\n", MALLOCED(osh)));
78 return NULL;
79 }
80 bzero((char *)bcmsdh, sizeof(bcmsdh_info_t));
81
82 /* save the handler locally */
83 l_bcmsdh = bcmsdh;
84
85 if (!(bcmsdh->sdioh = sdioh_attach(osh, cfghdl, irq))) {
86 bcmsdh_detach(osh, bcmsdh);
87 return NULL;
88 }
89
90 bcmsdh->osh = osh;
91 bcmsdh->init_success = TRUE;
92
93 *regsva = (uint32 *)SI_ENUM_BASE;
94
95 /* Report the BAR, to fix if needed */
96 bcmsdh->sbwad = SI_ENUM_BASE;
97 return bcmsdh;
98 }
99
100 int
bcmsdh_detach(osl_t * osh,void * sdh)101 bcmsdh_detach(osl_t *osh, void *sdh)
102 {
103 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
104
105 if (bcmsdh != NULL) {
106 if (bcmsdh->sdioh) {
107 sdioh_detach(osh, bcmsdh->sdioh);
108 bcmsdh->sdioh = NULL;
109 }
110 MFREE(osh, bcmsdh, sizeof(bcmsdh_info_t));
111 }
112
113 l_bcmsdh = NULL;
114 return 0;
115 }
116
117 int
bcmsdh_iovar_op(void * sdh,const char * name,void * params,int plen,void * arg,int len,bool set)118 bcmsdh_iovar_op(void *sdh, const char *name,
119 void *params, int plen, void *arg, int len, bool set)
120 {
121 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
122 return sdioh_iovar_op(bcmsdh->sdioh, name, params, plen, arg, len, set);
123 }
124
125 bool
bcmsdh_intr_query(void * sdh)126 bcmsdh_intr_query(void *sdh)
127 {
128 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
129 SDIOH_API_RC status;
130 bool on;
131
132 ASSERT(bcmsdh);
133 status = sdioh_interrupt_query(bcmsdh->sdioh, &on);
134 if (SDIOH_API_SUCCESS(status))
135 return FALSE;
136 else
137 return on;
138 }
139
140 int
bcmsdh_intr_enable(void * sdh)141 bcmsdh_intr_enable(void *sdh)
142 {
143 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
144 SDIOH_API_RC status;
145 ASSERT(bcmsdh);
146
147 status = sdioh_interrupt_set(bcmsdh->sdioh, TRUE);
148 return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
149 }
150
151 int
bcmsdh_intr_disable(void * sdh)152 bcmsdh_intr_disable(void *sdh)
153 {
154 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
155 SDIOH_API_RC status;
156 ASSERT(bcmsdh);
157
158 status = sdioh_interrupt_set(bcmsdh->sdioh, FALSE);
159 return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
160 }
161
162 int
bcmsdh_intr_reg(void * sdh,bcmsdh_cb_fn_t fn,void * argh)163 bcmsdh_intr_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh)
164 {
165 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
166 SDIOH_API_RC status;
167 ASSERT(bcmsdh);
168
169 status = sdioh_interrupt_register(bcmsdh->sdioh, fn, argh);
170 return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
171 }
172
173 int
bcmsdh_intr_dereg(void * sdh)174 bcmsdh_intr_dereg(void *sdh)
175 {
176 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
177 SDIOH_API_RC status;
178 ASSERT(bcmsdh);
179
180 status = sdioh_interrupt_deregister(bcmsdh->sdioh);
181 return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
182 }
183
184 #if defined(DHD_DEBUG)
185 bool
bcmsdh_intr_pending(void * sdh)186 bcmsdh_intr_pending(void *sdh)
187 {
188 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
189
190 ASSERT(sdh);
191 return sdioh_interrupt_pending(bcmsdh->sdioh);
192 }
193 #endif
194
195
196 int
bcmsdh_devremove_reg(void * sdh,bcmsdh_cb_fn_t fn,void * argh)197 bcmsdh_devremove_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh)
198 {
199 ASSERT(sdh);
200
201 /* don't support yet */
202 return BCME_UNSUPPORTED;
203 }
204
205 uint8
bcmsdh_cfg_read(void * sdh,uint fnc_num,uint32 addr,int * err)206 bcmsdh_cfg_read(void *sdh, uint fnc_num, uint32 addr, int *err)
207 {
208 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
209 SDIOH_API_RC status;
210 uint8 data = 0;
211
212 if (!bcmsdh)
213 bcmsdh = l_bcmsdh;
214
215 ASSERT(bcmsdh->init_success);
216
217 status = sdioh_cfg_read(bcmsdh->sdioh, fnc_num, addr, (uint8 *)&data);
218 if (err)
219 *err = (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR);
220
221 BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, uint8data = 0x%x\n", __FUNCTION__,
222 fnc_num, addr, data));
223
224 return data;
225 }
226
227 void
bcmsdh_cfg_write(void * sdh,uint fnc_num,uint32 addr,uint8 data,int * err)228 bcmsdh_cfg_write(void *sdh, uint fnc_num, uint32 addr, uint8 data, int *err)
229 {
230 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
231 SDIOH_API_RC status;
232
233 if (!bcmsdh)
234 bcmsdh = l_bcmsdh;
235
236 ASSERT(bcmsdh->init_success);
237
238 status = sdioh_cfg_write(bcmsdh->sdioh, fnc_num, addr, (uint8 *)&data);
239 if (err)
240 *err = SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR;
241
242 BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, uint8data = 0x%x\n", __FUNCTION__,
243 fnc_num, addr, data));
244 }
245
246 uint32
bcmsdh_cfg_read_word(void * sdh,uint fnc_num,uint32 addr,int * err)247 bcmsdh_cfg_read_word(void *sdh, uint fnc_num, uint32 addr, int *err)
248 {
249 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
250 SDIOH_API_RC status;
251 uint32 data = 0;
252
253 if (!bcmsdh)
254 bcmsdh = l_bcmsdh;
255
256 ASSERT(bcmsdh->init_success);
257
258 status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, SDIOH_READ, fnc_num,
259 addr, &data, 4);
260
261 if (err)
262 *err = (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR);
263
264 BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, uint32data = 0x%x\n", __FUNCTION__,
265 fnc_num, addr, data));
266
267 return data;
268 }
269
270 void
bcmsdh_cfg_write_word(void * sdh,uint fnc_num,uint32 addr,uint32 data,int * err)271 bcmsdh_cfg_write_word(void *sdh, uint fnc_num, uint32 addr, uint32 data, int *err)
272 {
273 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
274 SDIOH_API_RC status;
275
276 if (!bcmsdh)
277 bcmsdh = l_bcmsdh;
278
279 ASSERT(bcmsdh->init_success);
280
281 status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, SDIOH_WRITE, fnc_num,
282 addr, &data, 4);
283
284 if (err)
285 *err = (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR);
286
287 BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, uint32data = 0x%x\n", __FUNCTION__, fnc_num,
288 addr, data));
289 }
290
291
292 int
bcmsdh_cis_read(void * sdh,uint func,uint8 * cis,uint length)293 bcmsdh_cis_read(void *sdh, uint func, uint8 *cis, uint length)
294 {
295 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
296 SDIOH_API_RC status;
297
298 uint8 *tmp_buf, *tmp_ptr;
299 uint8 *ptr;
300 bool ascii = func & ~0xf;
301 func &= 0x7;
302
303 if (!bcmsdh)
304 bcmsdh = l_bcmsdh;
305
306 ASSERT(bcmsdh->init_success);
307 ASSERT(cis);
308 ASSERT(length <= SBSDIO_CIS_SIZE_LIMIT);
309
310 status = sdioh_cis_read(bcmsdh->sdioh, func, cis, length);
311
312 if (ascii) {
313 /* Move binary bits to tmp and format them into the provided buffer. */
314 if ((tmp_buf = (uint8 *)MALLOC(bcmsdh->osh, length)) == NULL) {
315 BCMSDH_ERROR(("%s: out of memory\n", __FUNCTION__));
316 return BCME_NOMEM;
317 }
318 bcopy(cis, tmp_buf, length);
319 for (tmp_ptr = tmp_buf, ptr = cis; ptr < (cis + length - 4); tmp_ptr++) {
320 ptr += sprintf((char*)ptr, "%.2x ", *tmp_ptr & 0xff);
321 if ((((tmp_ptr - tmp_buf) + 1) & 0xf) == 0)
322 ptr += sprintf((char *)ptr, "\n");
323 }
324 MFREE(bcmsdh->osh, tmp_buf, length);
325 }
326
327 return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
328 }
329
330
331 static int
bcmsdhsdio_set_sbaddr_window(void * sdh,uint32 address)332 bcmsdhsdio_set_sbaddr_window(void *sdh, uint32 address)
333 {
334 int err = 0;
335 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
336 bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,
337 (address >> 8) & SBSDIO_SBADDRLOW_MASK, &err);
338 if (!err)
339 bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRMID,
340 (address >> 16) & SBSDIO_SBADDRMID_MASK, &err);
341 if (!err)
342 bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRHIGH,
343 (address >> 24) & SBSDIO_SBADDRHIGH_MASK, &err);
344
345
346 return err;
347 }
348
349 uint32
bcmsdh_reg_read(void * sdh,uint32 addr,uint size)350 bcmsdh_reg_read(void *sdh, uint32 addr, uint size)
351 {
352 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
353 SDIOH_API_RC status;
354 uint32 word = 0;
355 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
356
357 BCMSDH_INFO(("%s:fun = 1, addr = 0x%x, ", __FUNCTION__, addr));
358
359 if (!bcmsdh)
360 bcmsdh = l_bcmsdh;
361
362 ASSERT(bcmsdh->init_success);
363
364 if (bar0 != bcmsdh->sbwad) {
365 if (bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0))
366 return 0xFFFFFFFF;
367
368 bcmsdh->sbwad = bar0;
369 }
370
371 addr &= SBSDIO_SB_OFT_ADDR_MASK;
372 if (size == 4)
373 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
374
375 status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL,
376 SDIOH_READ, SDIO_FUNC_1, addr, &word, size);
377
378 bcmsdh->regfail = !(SDIOH_API_SUCCESS(status));
379
380 BCMSDH_INFO(("uint32data = 0x%x\n", word));
381
382 /* if ok, return appropriately masked word */
383 if (SDIOH_API_SUCCESS(status)) {
384 switch (size) {
385 case sizeof(uint8):
386 return (word & 0xff);
387 case sizeof(uint16):
388 return (word & 0xffff);
389 case sizeof(uint32):
390 return word;
391 default:
392 bcmsdh->regfail = TRUE;
393
394 }
395 }
396
397 /* otherwise, bad sdio access or invalid size */
398 BCMSDH_ERROR(("%s: error reading addr 0x%04x size %d\n", __FUNCTION__, addr, size));
399 return 0xFFFFFFFF;
400 }
401
402 uint32
bcmsdh_reg_write(void * sdh,uint32 addr,uint size,uint32 data)403 bcmsdh_reg_write(void *sdh, uint32 addr, uint size, uint32 data)
404 {
405 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
406 SDIOH_API_RC status;
407 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
408 int err = 0;
409
410 BCMSDH_INFO(("%s:fun = 1, addr = 0x%x, uint%ddata = 0x%x\n",
411 __FUNCTION__, addr, size*8, data));
412
413 if (!bcmsdh)
414 bcmsdh = l_bcmsdh;
415
416 ASSERT(bcmsdh->init_success);
417
418 if (bar0 != bcmsdh->sbwad) {
419 if ((err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0)))
420 return err;
421
422 bcmsdh->sbwad = bar0;
423 }
424
425 addr &= SBSDIO_SB_OFT_ADDR_MASK;
426 if (size == 4)
427 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
428 status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, SDIOH_WRITE, SDIO_FUNC_1,
429 addr, &data, size);
430 bcmsdh->regfail = !(SDIOH_API_SUCCESS(status));
431
432 if (SDIOH_API_SUCCESS(status))
433 return 0;
434
435 BCMSDH_ERROR(("%s: error writing 0x%08x to addr 0x%04x size %d\n",
436 __FUNCTION__, data, addr, size));
437 return 0xFFFFFFFF;
438 }
439
440 bool
bcmsdh_regfail(void * sdh)441 bcmsdh_regfail(void *sdh)
442 {
443 return ((bcmsdh_info_t *)sdh)->regfail;
444 }
445
446 int
bcmsdh_recv_buf(void * sdh,uint32 addr,uint fn,uint flags,uint8 * buf,uint nbytes,void * pkt,bcmsdh_cmplt_fn_t complete,void * handle)447 bcmsdh_recv_buf(void *sdh, uint32 addr, uint fn, uint flags,
448 uint8 *buf, uint nbytes, void *pkt,
449 bcmsdh_cmplt_fn_t complete, void *handle)
450 {
451 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
452 SDIOH_API_RC status;
453 uint incr_fix;
454 uint width;
455 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
456 int err = 0;
457
458 ASSERT(bcmsdh);
459 ASSERT(bcmsdh->init_success);
460
461 BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n",
462 __FUNCTION__, fn, addr, nbytes));
463
464 /* Async not implemented yet */
465 ASSERT(!(flags & SDIO_REQ_ASYNC));
466 if (flags & SDIO_REQ_ASYNC)
467 return BCME_UNSUPPORTED;
468
469 if (bar0 != bcmsdh->sbwad) {
470 if ((err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0)))
471 return err;
472
473 bcmsdh->sbwad = bar0;
474 }
475
476 addr &= SBSDIO_SB_OFT_ADDR_MASK;
477
478 incr_fix = (flags & SDIO_REQ_FIXED) ? SDIOH_DATA_FIX : SDIOH_DATA_INC;
479 width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
480 if (width == 4)
481 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
482
483 status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, incr_fix,
484 SDIOH_READ, fn, addr, width, nbytes, buf, pkt);
485
486 return (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR);
487 }
488
489 int
bcmsdh_send_buf(void * sdh,uint32 addr,uint fn,uint flags,uint8 * buf,uint nbytes,void * pkt,bcmsdh_cmplt_fn_t complete,void * handle)490 bcmsdh_send_buf(void *sdh, uint32 addr, uint fn, uint flags,
491 uint8 *buf, uint nbytes, void *pkt,
492 bcmsdh_cmplt_fn_t complete, void *handle)
493 {
494 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
495 SDIOH_API_RC status;
496 uint incr_fix;
497 uint width;
498 uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
499 int err = 0;
500
501 ASSERT(bcmsdh);
502 ASSERT(bcmsdh->init_success);
503
504 BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n",
505 __FUNCTION__, fn, addr, nbytes));
506
507 /* Async not implemented yet */
508 ASSERT(!(flags & SDIO_REQ_ASYNC));
509 if (flags & SDIO_REQ_ASYNC)
510 return BCME_UNSUPPORTED;
511
512 if (bar0 != bcmsdh->sbwad) {
513 if ((err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0)))
514 return err;
515
516 bcmsdh->sbwad = bar0;
517 }
518
519 addr &= SBSDIO_SB_OFT_ADDR_MASK;
520
521 incr_fix = (flags & SDIO_REQ_FIXED) ? SDIOH_DATA_FIX : SDIOH_DATA_INC;
522 width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
523 if (width == 4)
524 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
525
526 status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, incr_fix,
527 SDIOH_WRITE, fn, addr, width, nbytes, buf, pkt);
528
529 return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
530 }
531
532 int
bcmsdh_rwdata(void * sdh,uint rw,uint32 addr,uint8 * buf,uint nbytes)533 bcmsdh_rwdata(void *sdh, uint rw, uint32 addr, uint8 *buf, uint nbytes)
534 {
535 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
536 SDIOH_API_RC status;
537
538 ASSERT(bcmsdh);
539 ASSERT(bcmsdh->init_success);
540 ASSERT((addr & SBSDIO_SBWINDOW_MASK) == 0);
541
542 addr &= SBSDIO_SB_OFT_ADDR_MASK;
543 addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
544
545 status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, SDIOH_DATA_INC,
546 (rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1,
547 addr, 4, nbytes, buf, NULL);
548
549 return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
550 }
551
552 int
bcmsdh_abort(void * sdh,uint fn)553 bcmsdh_abort(void *sdh, uint fn)
554 {
555 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
556
557 return sdioh_abort(bcmsdh->sdioh, fn);
558 }
559
560 int
bcmsdh_start(void * sdh,int stage)561 bcmsdh_start(void *sdh, int stage)
562 {
563 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
564
565 return sdioh_start(bcmsdh->sdioh, stage);
566 }
567
568 int
bcmsdh_stop(void * sdh)569 bcmsdh_stop(void *sdh)
570 {
571 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
572
573 return sdioh_stop(bcmsdh->sdioh);
574 }
575
576
577 int
bcmsdh_query_device(void * sdh)578 bcmsdh_query_device(void *sdh)
579 {
580 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
581 bcmsdh->vendevid = (VENDOR_BROADCOM << 16) | 0;
582 return (bcmsdh->vendevid);
583 }
584
585 uint
bcmsdh_query_iofnum(void * sdh)586 bcmsdh_query_iofnum(void *sdh)
587 {
588 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
589
590 if (!bcmsdh)
591 bcmsdh = l_bcmsdh;
592
593 return (sdioh_query_iofnum(bcmsdh->sdioh));
594 }
595
596 int
bcmsdh_reset(bcmsdh_info_t * sdh)597 bcmsdh_reset(bcmsdh_info_t *sdh)
598 {
599 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
600
601 return sdioh_sdio_reset(bcmsdh->sdioh);
602 }
603
bcmsdh_get_sdioh(bcmsdh_info_t * sdh)604 void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh)
605 {
606 ASSERT(sdh);
607 return sdh->sdioh;
608 }
609
610 /* Function to pass device-status bits to DHD. */
611 uint32
bcmsdh_get_dstatus(void * sdh)612 bcmsdh_get_dstatus(void *sdh)
613 {
614 return 0;
615 }
616 uint32
bcmsdh_cur_sbwad(void * sdh)617 bcmsdh_cur_sbwad(void *sdh)
618 {
619 bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
620
621 if (!bcmsdh)
622 bcmsdh = l_bcmsdh;
623
624 return (bcmsdh->sbwad);
625 }
626
627 void
bcmsdh_chipinfo(void * sdh,uint32 chip,uint32 chiprev)628 bcmsdh_chipinfo(void *sdh, uint32 chip, uint32 chiprev)
629 {
630 return;
631 }
632