Lines Matching refs:sd

84 static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, uint32 regaddr);
148 int sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 *data);
151 sdioh_sdmmc_card_regwrite(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 data);
156 void sdioh_sdmmc_card_enable_func_f3(sdioh_info_t *sd, struct sdio_func *func) in sdioh_sdmmc_card_enable_func_f3() argument
158 sd->func[3] = func; in sdioh_sdmmc_card_enable_func_f3()
159 sd_info(("%s sd->func[3] %p\n", __FUNCTION__, sd->func[3])); in sdioh_sdmmc_card_enable_func_f3()
163 void sdmmc_set_clock_rate(sdioh_info_t *sd, uint hz);
164 uint sdmmc_get_clock_rate(sdioh_info_t *sd);
165 void sdmmc_set_clock_divisor(sdioh_info_t *sd, uint sd_div);
168 sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd) in sdioh_sdmmc_card_enablefuncs() argument
177 sd->com_cis_ptr = sdioh_sdmmc_get_cisaddr(sd, SDIOD_CCCR_CISPTR_0); in sdioh_sdmmc_card_enablefuncs()
178 sd->func_cis_ptr[0] = sd->com_cis_ptr; in sdioh_sdmmc_card_enablefuncs()
179 sd_info(("%s: Card's Common CIS Ptr = 0x%x\n", __FUNCTION__, sd->com_cis_ptr)); in sdioh_sdmmc_card_enablefuncs()
183 func <= sd->num_funcs; func++, fbraddr += SDIOD_FBR_SIZE) { in sdioh_sdmmc_card_enablefuncs()
184 sd->func_cis_ptr[func] = sdioh_sdmmc_get_cisaddr(sd, SDIOD_FBR_CISPTR_0 + fbraddr); in sdioh_sdmmc_card_enablefuncs()
186 __FUNCTION__, func, sd->func_cis_ptr[func])); in sdioh_sdmmc_card_enablefuncs()
189 sd->func_cis_ptr[0] = sd->com_cis_ptr; in sdioh_sdmmc_card_enablefuncs()
190 sd_info(("%s: Card's Common CIS Ptr = 0x%x\n", __FUNCTION__, sd->com_cis_ptr)); in sdioh_sdmmc_card_enablefuncs()
193 sdio_claim_host(sd->func[1]); in sdioh_sdmmc_card_enablefuncs()
194 err_ret = sdio_enable_func(sd->func[1]); in sdioh_sdmmc_card_enablefuncs()
195 sdio_release_host(sd->func[1]); in sdioh_sdmmc_card_enablefuncs()
209 sdioh_info_t *sd = NULL; in sdioh_attach() local
219 if ((sd = (sdioh_info_t *)MALLOC(osh, sizeof(sdioh_info_t))) == NULL) { in sdioh_attach()
223 bzero((char *)sd, sizeof(sdioh_info_t)); in sdioh_attach()
225 sd->copy_buf = MALLOC(osh, COPY_BUF_SIZE); in sdioh_attach()
226 if (sd->copy_buf == NULL) { in sdioh_attach()
232 sd->osh = osh; in sdioh_attach()
233 sd->fake_func0.num = 0; in sdioh_attach()
234 sd->fake_func0.card = func->card; in sdioh_attach()
235 sd->func[0] = &sd->fake_func0; in sdioh_attach()
238 sd->func[1] = gInstance->func[1]; in sdioh_attach()
240 sd->func[1] = func->card->sdio_func[0]; in sdioh_attach()
242 sd->func[2] = func->card->sdio_func[1]; in sdioh_attach()
244 sd->func[func->num] = func; in sdioh_attach()
248 sd->func[3] = NULL; in sdioh_attach()
251 sd->num_funcs = 2; in sdioh_attach()
252 sd->sd_blockmode = TRUE; in sdioh_attach()
253 sd->use_client_ints = TRUE; in sdioh_attach()
254 sd->client_block_size[0] = 64; in sdioh_attach()
255 sd->use_rxchain = CUSTOM_RXCHAIN; in sdioh_attach()
256 if (sd->func[1] == NULL || sd->func[2] == NULL) { in sdioh_attach()
260 sdio_set_drvdata(sd->func[1], sd); in sdioh_attach()
262 sdio_claim_host(sd->func[1]); in sdioh_attach()
263 sd->client_block_size[1] = sd_f1_blocksize; in sdioh_attach()
264 err_ret = sdio_set_block_size(sd->func[1], sd_f1_blocksize); in sdioh_attach()
265 sdio_release_host(sd->func[1]); in sdioh_attach()
271 sdio_claim_host(sd->func[2]); in sdioh_attach()
275 sd->client_block_size[2] = sd_f2_blocksize; in sdioh_attach()
277 err_ret = sdio_set_block_size(sd->func[2], sd_f2_blocksize); in sdioh_attach()
278 sdio_release_host(sd->func[2]); in sdioh_attach()
285 sd->sd_clk_rate = sdmmc_get_clock_rate(sd); in sdioh_attach()
286 printf("%s: sd clock rate = %u\n", __FUNCTION__, sd->sd_clk_rate); in sdioh_attach()
287 sdioh_sdmmc_card_enablefuncs(sd); in sdioh_attach()
289 mutex_init(&sd->claim_host_mutex); // terence 20140926: fix for claim host issue in sdioh_attach()
293 return sd; in sdioh_attach()
297 MFREE(sd->osh, sd->copy_buf, COPY_BUF_SIZE); in sdioh_attach()
299 MFREE(sd->osh, sd, sizeof(sdioh_info_t)); in sdioh_attach()
304 sdioh_detach(osl_t *osh, sdioh_info_t *sd) in sdioh_detach() argument
308 if (sd) { in sdioh_detach()
311 if (sd->func[2]) { in sdioh_detach()
312 sdio_claim_host(sd->func[2]); in sdioh_detach()
313 sdio_disable_func(sd->func[2]); in sdioh_detach()
314 sdio_release_host(sd->func[2]); in sdioh_detach()
318 if (sd->func[1]) { in sdioh_detach()
319 sdio_claim_host(sd->func[1]); in sdioh_detach()
320 sdio_disable_func(sd->func[1]); in sdioh_detach()
321 sdio_release_host(sd->func[1]); in sdioh_detach()
324 sd->func[1] = NULL; in sdioh_detach()
325 sd->func[2] = NULL; in sdioh_detach()
328 MFREE(sd->osh, sd->copy_buf, COPY_BUF_SIZE); in sdioh_detach()
330 MFREE(sd->osh, sd, sizeof(sdioh_info_t)); in sdioh_detach()
338 sdioh_enable_func_intr(sdioh_info_t *sd) in sdioh_enable_func_intr() argument
343 if (sd->func[0] == NULL) { in sdioh_enable_func_intr()
348 sdio_claim_host(sd->func[0]); in sdioh_enable_func_intr()
349 reg = sdio_readb(sd->func[0], SDIOD_CCCR_INTEN, &err); in sdioh_enable_func_intr()
352 sdio_release_host(sd->func[0]); in sdioh_enable_func_intr()
361 sdio_writeb(sd->func[0], reg, SDIOD_CCCR_INTEN, &err); in sdioh_enable_func_intr()
362 sdio_release_host(sd->func[0]); in sdioh_enable_func_intr()
373 sdioh_disable_func_intr(sdioh_info_t *sd) in sdioh_disable_func_intr() argument
378 if (sd->func[0] == NULL) { in sdioh_disable_func_intr()
383 sdio_claim_host(sd->func[0]); in sdioh_disable_func_intr()
384 reg = sdio_readb(sd->func[0], SDIOD_CCCR_INTEN, &err); in sdioh_disable_func_intr()
387 sdio_release_host(sd->func[0]); in sdioh_disable_func_intr()
397 sdio_writeb(sd->func[0], reg, SDIOD_CCCR_INTEN, &err); in sdioh_disable_func_intr()
398 sdio_release_host(sd->func[0]); in sdioh_disable_func_intr()
411 sdioh_interrupt_register(sdioh_info_t *sd, sdioh_cb_fn_t fn, void *argh) in sdioh_interrupt_register() argument
419 sd->intr_handler = fn; in sdioh_interrupt_register()
420 sd->intr_handler_arg = argh; in sdioh_interrupt_register()
421 sd->intr_handler_valid = TRUE; in sdioh_interrupt_register()
424 if (sd->func[2]) { in sdioh_interrupt_register()
425 sdio_claim_host(sd->func[2]); in sdioh_interrupt_register()
426 sdio_claim_irq(sd->func[2], IRQHandlerF2); in sdioh_interrupt_register()
427 sdio_release_host(sd->func[2]); in sdioh_interrupt_register()
430 if (sd->func[1]) { in sdioh_interrupt_register()
431 sdio_claim_host(sd->func[1]); in sdioh_interrupt_register()
432 sdio_claim_irq(sd->func[1], IRQHandler); in sdioh_interrupt_register()
433 sdio_release_host(sd->func[1]); in sdioh_interrupt_register()
436 sdioh_enable_func_intr(sd); in sdioh_interrupt_register()
443 sdioh_interrupt_deregister(sdioh_info_t *sd) in sdioh_interrupt_deregister() argument
448 if (sd->func[1]) { in sdioh_interrupt_deregister()
450 sdio_claim_host(sd->func[1]); in sdioh_interrupt_deregister()
451 sdio_release_irq(sd->func[1]); in sdioh_interrupt_deregister()
452 sdio_release_host(sd->func[1]); in sdioh_interrupt_deregister()
455 if (sd->func[2]) { in sdioh_interrupt_deregister()
457 sdio_claim_host(sd->func[2]); in sdioh_interrupt_deregister()
458 sdio_release_irq(sd->func[2]); in sdioh_interrupt_deregister()
460 sdio_release_host(sd->func[2]); in sdioh_interrupt_deregister()
463 sd->intr_handler_valid = FALSE; in sdioh_interrupt_deregister()
464 sd->intr_handler = NULL; in sdioh_interrupt_deregister()
465 sd->intr_handler_arg = NULL; in sdioh_interrupt_deregister()
468 sdioh_disable_func_intr(sd); in sdioh_interrupt_deregister()
474 sdioh_interrupt_query(sdioh_info_t *sd, bool *onoff) in sdioh_interrupt_query() argument
477 *onoff = sd->client_intr_enabled; in sdioh_interrupt_query()
483 sdioh_interrupt_pending(sdioh_info_t *sd) in sdioh_interrupt_pending() argument
490 sdioh_query_iofnum(sdioh_info_t *sd) in sdioh_query_iofnum() argument
492 return sd->num_funcs; in sdioh_query_iofnum()
848 sdioh_enable_hw_oob_intr(sdioh_info_t *sd, bool enable) in sdioh_enable_hw_oob_intr() argument
858 status = sdioh_request_byte(sd, SDIOH_WRITE, 0, SDIOD_CCCR_BRCM_SEPINT, &data); in sdioh_enable_hw_oob_intr()
864 sdioh_cfg_read(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data) in sdioh_cfg_read() argument
868 status = sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data); in sdioh_cfg_read()
873 sdioh_cfg_write(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data) in sdioh_cfg_write() argument
877 status = sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data); in sdioh_cfg_write()
882 sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, uint32 regaddr) in sdioh_sdmmc_get_cisaddr() argument
889 if ((sdioh_sdmmc_card_regread (sd, 0, regaddr, 1, &regdata)) != SUCCESS) in sdioh_sdmmc_get_cisaddr()
903 sdioh_cis_read(sdioh_info_t *sd, uint func, uint8 *cisd, uint32 length) in sdioh_cis_read() argument
912 if (!sd->func_cis_ptr[func]) { in sdioh_cis_read()
918 sd_err(("%s: func_cis_ptr[%d]=0x%04x\n", __FUNCTION__, func, sd->func_cis_ptr[func])); in sdioh_cis_read()
921 offset = sd->func_cis_ptr[func] + count; in sdioh_cis_read()
922 if (sdioh_sdmmc_card_regread (sd, 0, offset, 1, &foo) < 0) { in sdioh_cis_read()
935 sdioh_cisaddr_read(sdioh_info_t *sd, uint func, uint8 *cisd, uint32 offset) in sdioh_cisaddr_read() argument
941 if (!sd->func_cis_ptr[func]) { in sdioh_cisaddr_read()
946 if (sdioh_sdmmc_card_regread (sd, 0, sd->func_cis_ptr[func]+offset, 1, &foo) < 0) { in sdioh_cisaddr_read()
957 sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *byte) in sdioh_request_byte() argument
980 if (sd->func[3]) { in sdioh_request_byte()
984 sdio_claim_host(sd->func[3]); in sdioh_request_byte()
987 err_ret = sdio_set_block_size(sd->func[3], in sdioh_request_byte()
996 sd->func[3])); in sdioh_request_byte()
997 err_ret = sdio_enable_func(sd->func[3]); in sdioh_request_byte()
1003 sdio_release_host(sd->func[3]); in sdioh_request_byte()
1007 sdio_claim_host(sd->func[3]); in sdioh_request_byte()
1011 sd->func[3])); in sdioh_request_byte()
1012 err_ret = sdio_disable_func(sd->func[3]); in sdioh_request_byte()
1017 sdio_release_host(sd->func[3]); in sdioh_request_byte()
1018 sd->func[3] = NULL; in sdioh_request_byte()
1024 if (sd->func[2]) { in sdioh_request_byte()
1025 sdio_claim_host(sd->func[2]); in sdioh_request_byte()
1028 err_ret = sdio_enable_func(sd->func[2]); in sdioh_request_byte()
1035 err_ret = sdio_disable_func(sd->func[2]); in sdioh_request_byte()
1041 sdio_release_host(sd->func[2]); in sdioh_request_byte()
1055 if (sd->func[func]) { in sdioh_request_byte()
1056 sdio_claim_host(sd->func[func]); in sdioh_request_byte()
1062 sdio_writeb(sd->func[func], in sdioh_request_byte()
1064 sdio_release_host(sd->func[func]); in sdioh_request_byte()
1074 if (sd->func[func]) { in sdioh_request_byte()
1075 sdio_claim_host(sd->func[func]); in sdioh_request_byte()
1081 sdio_writeb(sd->func[func], in sdioh_request_byte()
1083 sdio_release_host(sd->func[func]); in sdioh_request_byte()
1094 if (sd->func[func]) { in sdioh_request_byte()
1095 sdio_claim_host(sd->func[func]); in sdioh_request_byte()
1096 sdio_f0_writeb(sd->func[func], in sdioh_request_byte()
1098 sdio_release_host(sd->func[func]); in sdioh_request_byte()
1103 if (sd->func[func]) { in sdioh_request_byte()
1104 sdio_claim_host(sd->func[func]); in sdioh_request_byte()
1105 sdio_writeb(sd->func[func], *byte, regaddr, &err_ret); in sdioh_request_byte()
1106 sdio_release_host(sd->func[func]); in sdioh_request_byte()
1111 if (sd->func[func]) { in sdioh_request_byte()
1112 sdio_claim_host(sd->func[func]); in sdioh_request_byte()
1114 *byte = sdio_f0_readb(sd->func[func], regaddr, &err_ret); in sdioh_request_byte()
1116 *byte = sdio_readb(sd->func[func], regaddr, &err_ret); in sdioh_request_byte()
1118 sdio_release_host(sd->func[func]); in sdioh_request_byte()
1148 sdioh_set_mode(sdioh_info_t *sd, uint mode) in sdioh_set_mode() argument
1151 sd->txglom_mode = mode; in sdioh_set_mode()
1153 sd->txglom_mode = mode; in sdioh_set_mode()
1155 return (sd->txglom_mode); in sdioh_set_mode()
1160 sdioh_get_spend_time(sdioh_info_t *sd) in sdioh_get_spend_time() argument
1162 return (sd->sdio_spent_time_us); in sdioh_get_spend_time()
1167 sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, uint addr, in sdioh_request_word() argument
1191 sdio_claim_host(sd->func[func]); in sdioh_request_word()
1195 sdio_writel(sd->func[func], *word, addr, &err_ret); in sdioh_request_word()
1197 sdio_writew(sd->func[func], (*word & 0xFFFF), addr, &err_ret); in sdioh_request_word()
1203 *word = sdio_readl(sd->func[func], addr, &err_ret); in sdioh_request_word()
1205 *word = sdio_readw(sd->func[func], addr, &err_ret) & 0xFFFF; in sdioh_request_word()
1212 sdio_release_host(sd->func[func]); in sdioh_request_word()
1218 if (sd->func[0]) { in sdioh_request_word()
1219 sdio_claim_host(sd->func[0]); in sdioh_request_word()
1225 sdio_writeb(sd->func[0], in sdioh_request_word()
1227 sdio_release_host(sd->func[0]); in sdioh_request_word()
1253 sdioh_request_packet_chain(sdioh_info_t *sd, uint fix_inc, uint write, uint func, in sdioh_request_packet_chain() argument
1268 struct sdio_func *sdio_func = sd->func[func]; in sdioh_request_packet_chain()
1285 blk_size = sd->client_block_size[func]; in sdioh_request_packet_chain()
1294 if(sd->txglom_mode == SDPCM_TXGLOM_MDESC) { in sdioh_request_packet_chain()
1301 sg_init_table(sd->sg_list, ARRAYSIZE(sd->sg_list)); in sdioh_request_packet_chain()
1312 uint8 *pdata = (uint8*)PKTDATA(sd->osh, pnext); in sdioh_request_packet_chain()
1315 pkt_len = PKTLEN(sd->osh, pnext); in sdioh_request_packet_chain()
1321 if (sg_count >= ARRAYSIZE(sd->sg_list)) { in sdioh_request_packet_chain()
1324 __FUNCTION__, sg_count, (size_t)ARRAYSIZE(sd->sg_list), blk_size)); in sdioh_request_packet_chain()
1339 sg_set_buf(&sd->sg_list[sg_count++], pdata, sg_data_size); in sdioh_request_packet_chain()
1344 pnext = PKTNEXT(sd->osh, pnext); in sdioh_request_packet_chain()
1355 mmc_dat.sg = sd->sg_list; in sdioh_request_packet_chain()
1386 else if(sd->txglom_mode == SDPCM_TXGLOM_CPY) { in sdioh_request_packet_chain()
1387 for (pnext = pkt; pnext; pnext = PKTNEXT(sd->osh, pnext)) { in sdioh_request_packet_chain()
1388 ttl_len += PKTLEN(sd->osh, pnext); in sdioh_request_packet_chain()
1391 sdio_claim_host(sd->func[func]); in sdioh_request_packet_chain()
1392 for (pnext = pkt; pnext; pnext = PKTNEXT(sd->osh, pnext)) { in sdioh_request_packet_chain()
1393 uint8 *buf = (uint8*)PKTDATA(sd->osh, pnext); in sdioh_request_packet_chain()
1394 pkt_len = PKTLEN(sd->osh, pnext); in sdioh_request_packet_chain()
1398 localbuf = sd->copy_buf; in sdioh_request_packet_chain()
1400 localbuf = (uint8 *)MALLOC(sd->osh, ttl_len); in sdioh_request_packet_chain()
1411 if (PKTNEXT(sd->osh, pnext)) in sdioh_request_packet_chain()
1424 err_ret = sdio_memcpy_toio(sd->func[func], addr, buf, pkt_len); in sdioh_request_packet_chain()
1426 err_ret = sdio_memcpy_toio(sd->func[func], addr, buf, pkt_len); in sdioh_request_packet_chain()
1428 err_ret = sdio_readsb(sd->func[func], buf, addr, pkt_len); in sdioh_request_packet_chain()
1430 err_ret = sdio_memcpy_fromio(sd->func[func], buf, addr, pkt_len); in sdioh_request_packet_chain()
1447 sdio_release_host(sd->func[func]); in sdioh_request_packet_chain()
1449 sd_err(("%s: set to wrong glom mode %d\n", __FUNCTION__, sd->txglom_mode)); in sdioh_request_packet_chain()
1455 MFREE(sd->osh, localbuf, ttl_len); in sdioh_request_packet_chain()
1469 sd->sdio_spent_time_us = diff_us; in sdioh_request_packet_chain()
1479 sdioh_buffer_tofrom_bus(sdioh_info_t *sd, uint fix_inc, uint write, uint func, in sdioh_buffer_tofrom_bus() argument
1501 sdio_claim_host(sd->func[func]); in sdioh_buffer_tofrom_bus()
1504 err_ret = sdio_memcpy_toio(sd->func[func], addr, buf, len); in sdioh_buffer_tofrom_bus()
1506 err_ret = sdio_memcpy_toio(sd->func[func], addr, buf, len); in sdioh_buffer_tofrom_bus()
1508 err_ret = sdio_readsb(sd->func[func], buf, addr, len); in sdioh_buffer_tofrom_bus()
1510 err_ret = sdio_memcpy_fromio(sd->func[func], buf, addr, len); in sdioh_buffer_tofrom_bus()
1512 sdio_release_host(sd->func[func]); in sdioh_buffer_tofrom_bus()
1546 sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write, uint func, in sdioh_request_buffer() argument
1566 if (PKTNEXT(sd->osh, pkt)) in sdioh_request_buffer()
1567 return sdioh_request_packet_chain(sd, fix_inc, write, func, addr, pkt); in sdioh_request_buffer()
1572 buffer = PKTDATA(sd->osh, pkt); in sdioh_request_buffer()
1573 buf_len = PKTLEN(sd->osh, pkt); in sdioh_request_buffer()
1584 return sdioh_buffer_tofrom_bus(sd, fix_inc, write, func, addr, buffer, buf_len); in sdioh_request_buffer()
1596 tmppkt = PKTGET_STATIC(sd->osh, buf_len + DEFAULT_SDIO_F2_BLKSIZE, write ? TRUE : FALSE); in sdioh_request_buffer()
1603 bcopy(buffer, PKTDATA(sd->osh, tmppkt), buf_len); in sdioh_request_buffer()
1605 status = sdioh_buffer_tofrom_bus(sd, fix_inc, write, func, addr, in sdioh_request_buffer()
1606 PKTDATA(sd->osh, tmppkt), ROUNDUP(buf_len, (DMA_ALIGN_MASK+1))); in sdioh_request_buffer()
1609 bcopy(PKTDATA(sd->osh, tmppkt), buffer, buf_len); in sdioh_request_buffer()
1611 PKTFREE_STATIC(sd->osh, tmppkt, write ? TRUE : FALSE); in sdioh_request_buffer()
1626 sdioh_abort(sdioh_info_t *sd, uint func) in sdioh_abort() argument
1636 sdioh_request_byte(sd, SD_IO_OP_WRITE, SDIO_FUNC_0, SDIOD_CCCR_IOABORT, &t_func); in sdioh_abort()
1653 sdioh_sdmmc_devintr_off(sdioh_info_t *sd) in sdioh_sdmmc_devintr_off() argument
1655 sd_trace(("%s: %d\n", __FUNCTION__, sd->use_client_ints)); in sdioh_sdmmc_devintr_off()
1656 sd->intmask &= ~CLIENT_INTR; in sdioh_sdmmc_devintr_off()
1661 sdioh_sdmmc_devintr_on(sdioh_info_t *sd) in sdioh_sdmmc_devintr_on() argument
1663 sd_trace(("%s: %d\n", __FUNCTION__, sd->use_client_ints)); in sdioh_sdmmc_devintr_on()
1664 sd->intmask |= CLIENT_INTR; in sdioh_sdmmc_devintr_on()
1669 sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 *data) in sdioh_sdmmc_card_regread() argument
1675 sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp); in sdioh_sdmmc_card_regread()
1681 if (sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, data, regsize)) { in sdioh_sdmmc_card_regread()
1695 void sdio_claim_host_lock_local(sdioh_info_t *sd) // terence 20140926: fix for claim host issue in sdio_claim_host_lock_local() argument
1698 if (sd) in sdio_claim_host_lock_local()
1699 mutex_lock(&sd->claim_host_mutex); in sdio_claim_host_lock_local()
1703 void sdio_claim_host_unlock_local(sdioh_info_t *sd) // terence 20140926: fix for claim host issue in sdio_claim_host_unlock_local() argument
1706 if (sd) in sdio_claim_host_unlock_local()
1707 mutex_unlock(&sd->claim_host_mutex); in sdio_claim_host_unlock_local()
1714 sdioh_info_t *sd; in IRQHandler() local
1716 sd = sdio_get_drvdata(func); in IRQHandler()
1718 ASSERT(sd != NULL); in IRQHandler()
1720 if (mutex_is_locked(&sd->claim_host_mutex)) { in IRQHandler()
1726 sdio_claim_host_lock_local(sd); in IRQHandler()
1727 sdio_release_host(sd->func[0]); in IRQHandler()
1729 if (sd->use_client_ints) { in IRQHandler()
1730 sd->intrcount++; in IRQHandler()
1731 ASSERT(sd->intr_handler); in IRQHandler()
1732 ASSERT(sd->intr_handler_arg); in IRQHandler()
1733 (sd->intr_handler)(sd->intr_handler_arg); in IRQHandler()
1741 __FUNCTION__, sd->client_intr_enabled, sd->intr_handler)); in IRQHandler()
1744 sdio_claim_host(sd->func[0]); in IRQHandler()
1745 sdio_claim_host_unlock_local(sd); in IRQHandler()
1758 sdioh_sdmmc_card_regwrite(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 data) in sdioh_sdmmc_card_regwrite() argument
1765 sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp); in sdioh_sdmmc_card_regwrite()
1772 sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, &data, regsize); in sdioh_sdmmc_card_regwrite()
1783 static int sdio_sw_reset(sdioh_info_t *sd) in sdio_sw_reset() argument
1785 struct mmc_card *card = sd->func[0]->card; in sdio_sw_reset()
1791 sdio_claim_host(sd->func[0]); in sdio_sw_reset()
1797 sdio_release_host(sd->func[0]); in sdio_sw_reset()
1801 sdio_claim_host(sd->func[0]); in sdio_sw_reset()
1812 sdio_release_host(sd->func[0]); in sdio_sw_reset()
1826 sdioh_start(sdioh_info_t *sd, int stage) in sdioh_start() argument
1831 if (!sd) { in sdioh_start()
1840 if (sd->func[0]) { in sdioh_start()
1852 if ((ret = sdio_sw_reset(sd))) { in sdioh_start()
1858 sd->num_funcs = 2; in sdioh_start()
1859 sd->sd_blockmode = TRUE; in sdioh_start()
1860 sd->use_client_ints = TRUE; in sdioh_start()
1861 sd->client_block_size[0] = 64; in sdioh_start()
1863 if (sd->func[1]) { in sdioh_start()
1865 sdio_claim_host(sd->func[1]); in sdioh_start()
1867 sd->client_block_size[1] = 64; in sdioh_start()
1868 ret = sdio_set_block_size(sd->func[1], 64); in sdioh_start()
1875 sdio_release_host(sd->func[1]); in sdioh_start()
1878 if (sd->func[2]) { in sdioh_start()
1880 sdio_claim_host(sd->func[2]); in sdioh_start()
1882 sd->client_block_size[2] = sd_f2_blocksize; in sdioh_start()
1884 ret = sdio_set_block_size(sd->func[2], sd_f2_blocksize); in sdioh_start()
1891 sdio_release_host(sd->func[2]); in sdioh_start()
1894 sdioh_sdmmc_card_enablefuncs(sd); in sdioh_start()
1898 sdio_claim_host(sd->func[0]); in sdioh_start()
1899 if (sd->func[2]) in sdioh_start()
1900 sdio_claim_irq(sd->func[2], IRQHandlerF2); in sdioh_start()
1901 if (sd->func[1]) in sdioh_start()
1902 sdio_claim_irq(sd->func[1], IRQHandler); in sdioh_start()
1903 sdio_release_host(sd->func[0]); in sdioh_start()
1906 sdioh_enable_func_intr(sd); in sdioh_start()
1908 bcmsdh_oob_intr_set(sd->bcmsdh, TRUE); in sdioh_start()
1920 sdioh_stop(sdioh_info_t *sd) in sdioh_stop() argument
1930 sdio_claim_host_lock_local(sd); in sdioh_stop()
1932 if (sd->func[0]) { in sdioh_stop()
1934 sdio_claim_host(sd->func[0]); in sdioh_stop()
1935 if (sd->func[1]) in sdioh_stop()
1936 sdio_release_irq(sd->func[1]); in sdioh_stop()
1937 if (sd->func[2]) in sdioh_stop()
1938 sdio_release_irq(sd->func[2]); in sdioh_stop()
1939 sdio_release_host(sd->func[0]); in sdioh_stop()
1942 sdioh_disable_func_intr(sd); in sdioh_stop()
1944 bcmsdh_oob_intr_set(sd->bcmsdh, FALSE); in sdioh_stop()
1951 sdio_claim_host_unlock_local(sd); in sdioh_stop()
1957 sdioh_waitlockfree(sdioh_info_t *sd) in sdioh_waitlockfree() argument
1964 sdioh_test_diag(sdioh_info_t *sd) in sdioh_test_diag() argument
1973 sdioh_gpioouten(sdioh_info_t *sd, uint32 gpio) in sdioh_gpioouten() argument
1979 sdioh_gpioout(sdioh_info_t *sd, uint32 gpio, bool enab) in sdioh_gpioout() argument
1985 sdioh_gpioin(sdioh_info_t *sd, uint32 gpio) in sdioh_gpioin() argument
1991 sdioh_gpio_init(sdioh_info_t *sd) in sdioh_gpio_init() argument
1997 sdmmc_get_clock_rate(sdioh_info_t *sd) in sdmmc_get_clock_rate() argument
2000 struct sdio_func *sdio_func = sd->func[0]; in sdmmc_get_clock_rate()
2009 sdmmc_set_clock_rate(sdioh_info_t *sd, uint hz) in sdmmc_set_clock_rate() argument
2012 struct sdio_func *sdio_func = sd->func[0]; in sdmmc_set_clock_rate()
2037 sdmmc_set_clock_divisor(sdioh_info_t *sd, uint sd_div) in sdmmc_set_clock_divisor() argument
2040 uint old_div = sdmmc_get_clock_rate(sd); in sdmmc_set_clock_divisor()
2045 hz = sd->sd_clk_rate / sd_div; in sdmmc_set_clock_divisor()
2046 sdmmc_set_clock_rate(sd, hz); in sdmmc_set_clock_divisor()