Lines Matching refs:slot

112 	struct dw_mci_slot *slot = s->private;  in dw_mci_req_show()  local
119 spin_lock_bh(&slot->host->lock); in dw_mci_req_show()
120 mrq = slot->mrq; in dw_mci_req_show()
145 spin_unlock_bh(&slot->host->lock); in dw_mci_req_show()
188 static void dw_mci_init_debugfs(struct dw_mci_slot *slot) in dw_mci_init_debugfs() argument
190 struct mmc_host *mmc = slot->mmc; in dw_mci_init_debugfs()
191 struct dw_mci *host = slot->host; in dw_mci_init_debugfs()
204 node = debugfs_create_file("req", S_IRUSR, root, slot, in dw_mci_init_debugfs()
230 static void mci_send_cmd(struct dw_mci_slot *slot, u32 cmd, u32 arg);
235 struct dw_mci_slot *slot = mmc_priv(mmc); in dw_mci_prepare_command() local
236 struct dw_mci *host = slot->host; in dw_mci_prepare_command()
237 const struct dw_mci_drv_data *drv_data = slot->host->drv_data; in dw_mci_prepare_command()
259 WARN_ON(slot->host->state != STATE_SENDING_CMD); in dw_mci_prepare_command()
260 slot->host->state = STATE_SENDING_CMD11; in dw_mci_prepare_command()
274 clk_en_a &= ~(SDMMC_CLKEN_LOW_PWR << slot->id); in dw_mci_prepare_command()
276 mci_send_cmd(slot, SDMMC_CMD_UPD_CLK | in dw_mci_prepare_command()
300 drv_data->prepare_command(slot->host, &cmdr); in dw_mci_prepare_command()
828 struct dw_mci_slot *slot = mmc_priv(mmc); in dw_mci_pre_req() local
831 if (!slot->host->use_dma || !data) in dw_mci_pre_req()
839 if (dw_mci_pre_dma_transfer(slot->host, mrq->data, 1) < 0) in dw_mci_pre_req()
847 struct dw_mci_slot *slot = mmc_priv(mmc); in dw_mci_post_req() local
850 if (!slot->host->use_dma || !data) in dw_mci_post_req()
854 dma_unmap_sg(slot->host->dev, in dw_mci_post_req()
1058 static void mci_send_cmd(struct dw_mci_slot *slot, u32 cmd, u32 arg) in mci_send_cmd() argument
1060 struct dw_mci *host = slot->host; in mci_send_cmd()
1074 dev_err(&slot->mmc->class_dev, in mci_send_cmd()
1079 static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit) in dw_mci_setup_bus() argument
1081 struct dw_mci *host = slot->host; in dw_mci_setup_bus()
1082 unsigned int clock = slot->clock; in dw_mci_setup_bus()
1093 mci_send_cmd(slot, sdmmc_cmd_bits, 0); in dw_mci_setup_bus()
1105 if ((clock << div) != slot->__clk_old || force_clkinit) in dw_mci_setup_bus()
1106 dev_info(&slot->mmc->class_dev, in dw_mci_setup_bus()
1108 slot->id, host->bus_hz, clock, in dw_mci_setup_bus()
1117 mci_send_cmd(slot, sdmmc_cmd_bits, 0); in dw_mci_setup_bus()
1123 mci_send_cmd(slot, sdmmc_cmd_bits, 0); in dw_mci_setup_bus()
1126 clk_en_a = SDMMC_CLKEN_ENABLE << slot->id; in dw_mci_setup_bus()
1127 if (!test_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags)) in dw_mci_setup_bus()
1128 clk_en_a |= SDMMC_CLKEN_LOW_PWR << slot->id; in dw_mci_setup_bus()
1132 mci_send_cmd(slot, sdmmc_cmd_bits, 0); in dw_mci_setup_bus()
1135 slot->__clk_old = clock << div; in dw_mci_setup_bus()
1141 mci_writel(host, CTYPE, (slot->ctype << slot->id)); in dw_mci_setup_bus()
1145 struct dw_mci_slot *slot, in __dw_mci_start_request() argument
1152 mrq = slot->mrq; in __dw_mci_start_request()
1154 host->cur_slot = slot; in __dw_mci_start_request()
1170 cmdflags = dw_mci_prepare_command(slot->mmc, cmd); in __dw_mci_start_request()
1173 if (test_and_clear_bit(DW_MMC_CARD_NEED_INIT, &slot->flags)) in __dw_mci_start_request()
1204 host->stop_cmdr = dw_mci_prepare_command(slot->mmc, mrq->stop); in __dw_mci_start_request()
1210 struct dw_mci_slot *slot) in dw_mci_start_request() argument
1212 struct mmc_request *mrq = slot->mrq; in dw_mci_start_request()
1216 __dw_mci_start_request(host, slot, cmd); in dw_mci_start_request()
1220 static void dw_mci_queue_request(struct dw_mci *host, struct dw_mci_slot *slot, in dw_mci_queue_request() argument
1223 dev_vdbg(&slot->mmc->class_dev, "queue request: state=%d\n", in dw_mci_queue_request()
1226 slot->mrq = mrq; in dw_mci_queue_request()
1229 dev_warn(&slot->mmc->class_dev, in dw_mci_queue_request()
1241 dw_mci_start_request(host, slot); in dw_mci_queue_request()
1243 list_add_tail(&slot->queue_node, &host->queue); in dw_mci_queue_request()
1249 struct dw_mci_slot *slot = mmc_priv(mmc); in dw_mci_request() local
1250 struct dw_mci *host = slot->host; in dw_mci_request()
1252 WARN_ON(slot->mrq); in dw_mci_request()
1261 if (!test_bit(DW_MMC_CARD_PRESENT, &slot->flags)) { in dw_mci_request()
1268 dw_mci_queue_request(host, slot, mrq); in dw_mci_request()
1275 struct dw_mci_slot *slot = mmc_priv(mmc); in dw_mci_set_ios() local
1276 const struct dw_mci_drv_data *drv_data = slot->host->drv_data; in dw_mci_set_ios()
1282 slot->ctype = SDMMC_CTYPE_4BIT; in dw_mci_set_ios()
1285 slot->ctype = SDMMC_CTYPE_8BIT; in dw_mci_set_ios()
1289 slot->ctype = SDMMC_CTYPE_1BIT; in dw_mci_set_ios()
1292 regs = mci_readl(slot->host, UHS_REG); in dw_mci_set_ios()
1298 regs |= ((0x1 << slot->id) << 16); in dw_mci_set_ios()
1300 regs &= ~((0x1 << slot->id) << 16); in dw_mci_set_ios()
1302 mci_writel(slot->host, UHS_REG, regs); in dw_mci_set_ios()
1303 slot->host->timing = ios->timing; in dw_mci_set_ios()
1309 slot->clock = ios->clock; in dw_mci_set_ios()
1312 drv_data->set_ios(slot->host, ios); in dw_mci_set_ios()
1320 dev_err(slot->host->dev, in dw_mci_set_ios()
1326 set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags); in dw_mci_set_ios()
1327 regs = mci_readl(slot->host, PWREN); in dw_mci_set_ios()
1328 regs |= (1 << slot->id); in dw_mci_set_ios()
1329 mci_writel(slot->host, PWREN, regs); in dw_mci_set_ios()
1332 if (!slot->host->vqmmc_enabled) { in dw_mci_set_ios()
1336 dev_err(slot->host->dev, in dw_mci_set_ios()
1339 slot->host->vqmmc_enabled = true; in dw_mci_set_ios()
1343 slot->host->vqmmc_enabled = true; in dw_mci_set_ios()
1347 dw_mci_ctrl_reset(slot->host, in dw_mci_set_ios()
1352 dw_mci_setup_bus(slot, false); in dw_mci_set_ios()
1357 dw_mci_setup_bus(slot, false); in dw_mci_set_ios()
1362 if (!IS_ERR(mmc->supply.vqmmc) && slot->host->vqmmc_enabled) in dw_mci_set_ios()
1364 slot->host->vqmmc_enabled = false; in dw_mci_set_ios()
1366 regs = mci_readl(slot->host, PWREN); in dw_mci_set_ios()
1367 regs &= ~(1 << slot->id); in dw_mci_set_ios()
1368 mci_writel(slot->host, PWREN, regs); in dw_mci_set_ios()
1374 if (slot->host->state == STATE_WAITING_CMD11_DONE && ios->clock != 0) in dw_mci_set_ios()
1375 slot->host->state = STATE_IDLE; in dw_mci_set_ios()
1380 struct dw_mci_slot *slot = mmc_priv(mmc); in dw_mci_card_busy() local
1387 status = mci_readl(slot->host, STATUS); in dw_mci_card_busy()
1394 struct dw_mci_slot *slot = mmc_priv(mmc); in dw_mci_switch_voltage() local
1395 struct dw_mci *host = slot->host; in dw_mci_switch_voltage()
1398 u32 v18 = SDMMC_UHS_18V << slot->id; in dw_mci_switch_voltage()
1433 struct dw_mci_slot *slot = mmc_priv(mmc); in dw_mci_get_ro() local
1441 mci_readl(slot->host, WRTPRT) & (1 << slot->id) ? 1 : 0; in dw_mci_get_ro()
1452 struct dw_mci_slot *slot = mmc_priv(mmc); in dw_mci_get_cd() local
1453 struct dw_mci_board *brd = slot->host->pdata; in dw_mci_get_cd()
1454 struct dw_mci *host = slot->host; in dw_mci_get_cd()
1464 present = (mci_readl(slot->host, CDETECT) & (1 << slot->id)) in dw_mci_get_cd()
1469 set_bit(DW_MMC_CARD_PRESENT, &slot->flags); in dw_mci_get_cd()
1472 clear_bit(DW_MMC_CARD_PRESENT, &slot->flags); in dw_mci_get_cd()
1482 struct dw_mci_slot *slot = mmc_priv(mmc); in dw_mci_init_card() local
1483 struct dw_mci *host = slot->host; in dw_mci_init_card()
1491 const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id; in dw_mci_init_card()
1499 set_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags); in dw_mci_init_card()
1502 clear_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags); in dw_mci_init_card()
1508 mci_send_cmd(slot, SDMMC_CMD_UPD_CLK | in dw_mci_init_card()
1516 struct dw_mci_slot *slot = mmc_priv(mmc); in dw_mci_enable_sdio_irq() local
1517 struct dw_mci *host = slot->host; in dw_mci_enable_sdio_irq()
1526 int_mask |= SDMMC_INT_SDIO(slot->sdio_id); in dw_mci_enable_sdio_irq()
1528 int_mask &= ~SDMMC_INT_SDIO(slot->sdio_id); in dw_mci_enable_sdio_irq()
1536 struct dw_mci_slot *slot = mmc_priv(mmc); in dw_mci_execute_tuning() local
1537 struct dw_mci *host = slot->host; in dw_mci_execute_tuning()
1542 err = drv_data->execute_tuning(slot, opcode); in dw_mci_execute_tuning()
1549 struct dw_mci_slot *slot = mmc_priv(mmc); in dw_mci_prepare_hs400_tuning() local
1550 struct dw_mci *host = slot->host; in dw_mci_prepare_hs400_tuning()
1578 struct dw_mci_slot *slot; in dw_mci_request_end() local
1586 slot = list_entry(host->queue.next, in dw_mci_request_end()
1588 list_del(&slot->queue_node); in dw_mci_request_end()
1590 mmc_hostname(slot->mmc)); in dw_mci_request_end()
1592 dw_mci_start_request(host, slot); in dw_mci_request_end()
2338 struct dw_mci_slot *slot = host->slot[i]; in dw_mci_handle_cd() local
2340 if (!slot) in dw_mci_handle_cd()
2343 if (slot->mmc->ops->card_event) in dw_mci_handle_cd()
2344 slot->mmc->ops->card_event(slot->mmc); in dw_mci_handle_cd()
2345 mmc_detect_change(slot->mmc, in dw_mci_handle_cd()
2444 struct dw_mci_slot *slot = host->slot[i]; in dw_mci_interrupt() local
2446 if (!slot) in dw_mci_interrupt()
2449 if (pending & SDMMC_INT_SDIO(slot->sdio_id)) { in dw_mci_interrupt()
2451 SDMMC_INT_SDIO(slot->sdio_id)); in dw_mci_interrupt()
2452 mmc_signal_sdio_irq(slot->mmc); in dw_mci_interrupt()
2485 static struct device_node *dw_mci_of_find_slot_node(struct dw_mci_slot *slot) in dw_mci_of_find_slot_node() argument
2487 struct device *dev = slot->mmc->parent; in dw_mci_of_find_slot_node()
2499 if (be32_to_cpup(addr) == slot->id) in dw_mci_of_find_slot_node()
2505 static void dw_mci_slot_of_parse(struct dw_mci_slot *slot) in dw_mci_slot_of_parse() argument
2507 struct device_node *np = dw_mci_of_find_slot_node(slot); in dw_mci_slot_of_parse()
2513 slot->mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT; in dw_mci_slot_of_parse()
2514 dev_warn(slot->mmc->parent, in dw_mci_slot_of_parse()
2519 static void dw_mci_slot_of_parse(struct dw_mci_slot *slot) in dw_mci_slot_of_parse() argument
2527 struct dw_mci_slot *slot; in dw_mci_init_slot() local
2536 slot = mmc_priv(mmc); in dw_mci_init_slot()
2537 slot->id = id; in dw_mci_init_slot()
2538 slot->sdio_id = host->sdio_id0 + id; in dw_mci_init_slot()
2539 slot->mmc = mmc; in dw_mci_init_slot()
2540 slot->host = host; in dw_mci_init_slot()
2541 host->slot[id] = slot; in dw_mci_init_slot()
2580 dw_mci_slot_of_parse(slot); in dw_mci_init_slot()
2611 set_bit(DW_MMC_CARD_PRESENT, &slot->flags); in dw_mci_init_slot()
2613 clear_bit(DW_MMC_CARD_PRESENT, &slot->flags); in dw_mci_init_slot()
2620 dw_mci_init_debugfs(slot); in dw_mci_init_slot()
2630 static void dw_mci_cleanup_slot(struct dw_mci_slot *slot, unsigned int id) in dw_mci_cleanup_slot() argument
2633 mmc_remove_host(slot->mmc); in dw_mci_cleanup_slot()
2634 slot->host->slot[id] = NULL; in dw_mci_cleanup_slot()
2635 mmc_free_host(slot->mmc); in dw_mci_cleanup_slot()
2938 struct dw_mci_slot *slot = host->slot[i]; in dw_mci_enable_cd() local
2940 if (IS_ERR_VALUE(mmc_gpio_get_cd(slot->mmc))) in dw_mci_enable_cd()
3195 if (host->slot[i]) in dw_mci_remove()
3196 dw_mci_cleanup_slot(host->slot[i], i); in dw_mci_remove()
3261 struct dw_mci_slot *slot = host->slot[i]; in dw_mci_resume() local
3263 if (!slot) in dw_mci_resume()
3265 if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER) { in dw_mci_resume()
3266 dw_mci_set_ios(slot->mmc, &slot->mmc->ios); in dw_mci_resume()
3267 dw_mci_setup_bus(slot, true); in dw_mci_resume()