Lines Matching +full:tx +full:- +full:ping +full:- +full:pong
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* Realtek PCI-Express SD/MMC Card Interface driver
4 * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
53 return &(host->pdev->dev); in sdmmc_dev()
58 rtsx_pci_write_register(host->pcr, CARD_STOP, in sd_clear_error()
65 u16 len = end - start + 1; in dump_reg_range()
71 int n = min(8, len - i); in dump_reg_range()
75 rtsx_pci_read_register(host->pcr, start + i + j, in dump_reg_range()
93 return rtsx_pci_readl(host->pcr, RTSX_BIPR) & SD_EXIST; in sd_get_cd_int()
99 SD_CMD_START | cmd->opcode); in sd_cmd_set_sd_cmd()
100 rtsx_pci_write_be32(pcr, SD_CMD1, cmd->arg); in sd_cmd_set_sd_cmd()
127 return -EINVAL; in sd_response_type()
141 * sd_pre_dma_transfer - do dma_map_sg() or using cookie
145 * 0 - do dma_map_sg()
146 * 1 - using cookie
151 struct rtsx_pcr *pcr = host->pcr; in sd_pre_dma_transfer()
152 int read = data->flags & MMC_DATA_READ; in sd_pre_dma_transfer()
156 if (!pre && data->host_cookie && data->host_cookie != host->cookie) { in sd_pre_dma_transfer()
158 "error: data->host_cookie = %d, host->cookie = %d\n", in sd_pre_dma_transfer()
159 data->host_cookie, host->cookie); in sd_pre_dma_transfer()
160 data->host_cookie = 0; in sd_pre_dma_transfer()
163 if (pre || data->host_cookie != host->cookie) { in sd_pre_dma_transfer()
164 count = rtsx_pci_dma_map_sg(pcr, data->sg, data->sg_len, read); in sd_pre_dma_transfer()
166 count = host->cookie_sg_count; in sd_pre_dma_transfer()
171 host->cookie_sg_count = count; in sd_pre_dma_transfer()
172 if (++host->cookie < 0) in sd_pre_dma_transfer()
173 host->cookie = 1; in sd_pre_dma_transfer()
174 data->host_cookie = host->cookie; in sd_pre_dma_transfer()
176 host->sg_count = count; in sd_pre_dma_transfer()
185 struct mmc_data *data = mrq->data; in sdmmc_pre_req()
187 if (data->host_cookie) { in sdmmc_pre_req()
189 "error: reset data->host_cookie = %d\n", in sdmmc_pre_req()
190 data->host_cookie); in sdmmc_pre_req()
191 data->host_cookie = 0; in sdmmc_pre_req()
195 dev_dbg(sdmmc_dev(host), "pre dma sg: %d\n", host->cookie_sg_count); in sdmmc_pre_req()
202 struct rtsx_pcr *pcr = host->pcr; in sdmmc_post_req()
203 struct mmc_data *data = mrq->data; in sdmmc_post_req()
204 int read = data->flags & MMC_DATA_READ; in sdmmc_post_req()
206 rtsx_pci_dma_unmap_sg(pcr, data->sg, data->sg_len, read); in sdmmc_post_req()
207 data->host_cookie = 0; in sdmmc_post_req()
213 struct rtsx_pcr *pcr = host->pcr; in sd_send_cmd_get_rsp()
214 u8 cmd_idx = (u8)cmd->opcode; in sd_send_cmd_get_rsp()
215 u32 arg = cmd->arg; in sd_send_cmd_get_rsp()
234 timeout = cmd->busy_timeout ? cmd->busy_timeout : 3000; in sd_send_cmd_get_rsp()
236 if (cmd->opcode == SD_SWITCH_VOLTAGE) { in sd_send_cmd_get_rsp()
257 /* Read data from ping-pong buffer */ in sd_send_cmd_get_rsp()
287 err = -EILSEQ; in sd_send_cmd_get_rsp()
295 err = -EILSEQ; in sd_send_cmd_get_rsp()
303 * The controller offloads the last byte {CRC-7, end bit 1'b1} in sd_send_cmd_get_rsp()
310 cmd->resp[i] = get_unaligned_be32(ptr + 1 + i * 4); in sd_send_cmd_get_rsp()
311 dev_dbg(sdmmc_dev(host), "cmd->resp[%d] = 0x%08x\n", in sd_send_cmd_get_rsp()
312 i, cmd->resp[i]); in sd_send_cmd_get_rsp()
315 cmd->resp[0] = get_unaligned_be32(ptr + 1); in sd_send_cmd_get_rsp()
316 dev_dbg(sdmmc_dev(host), "cmd->resp[0] = 0x%08x\n", in sd_send_cmd_get_rsp()
317 cmd->resp[0]); in sd_send_cmd_get_rsp()
321 cmd->error = err; in sd_send_cmd_get_rsp()
331 struct rtsx_pcr *pcr = host->pcr; in sd_read_data()
336 __func__, cmd->opcode, cmd->arg); in sd_read_data()
341 if (cmd->opcode == MMC_SEND_TUNING_BLOCK) in sd_read_data()
385 struct rtsx_pcr *pcr = host->pcr; in sd_write_data()
389 __func__, cmd->opcode, cmd->arg); in sd_write_data()
395 if (cmd->error) in sd_write_data()
396 return cmd->error; in sd_write_data()
431 struct rtsx_pcr *pcr = host->pcr; in sd_read_long_data()
432 struct mmc_host *mmc = host->mmc; in sd_read_long_data()
433 struct mmc_card *card = mmc->card; in sd_read_long_data()
434 struct mmc_command *cmd = mrq->cmd; in sd_read_long_data()
435 struct mmc_data *data = mrq->data; in sd_read_long_data()
440 size_t data_len = data->blksz * data->blocks; in sd_read_long_data()
443 __func__, cmd->opcode, cmd->arg); in sd_read_long_data()
454 sd_cmd_set_data_len(pcr, data->blocks, data->blksz); in sd_read_long_data()
476 err = rtsx_pci_dma_transfer(pcr, data->sg, host->sg_count, 1, 10000); in sd_read_long_data()
489 struct rtsx_pcr *pcr = host->pcr; in sd_write_long_data()
490 struct mmc_host *mmc = host->mmc; in sd_write_long_data()
491 struct mmc_card *card = mmc->card; in sd_write_long_data()
492 struct mmc_command *cmd = mrq->cmd; in sd_write_long_data()
493 struct mmc_data *data = mrq->data; in sd_write_long_data()
497 size_t data_len = data->blksz * data->blocks; in sd_write_long_data()
500 if (cmd->error) in sd_write_long_data()
501 return cmd->error; in sd_write_long_data()
504 __func__, cmd->opcode, cmd->arg); in sd_write_long_data()
513 sd_cmd_set_data_len(pcr, data->blocks, data->blksz); in sd_write_long_data()
534 err = rtsx_pci_dma_transfer(pcr, data->sg, host->sg_count, 0, 10000); in sd_write_long_data()
545 rtsx_pci_write_register(host->pcr, SD_CFG1, in sd_enable_initial_mode()
551 rtsx_pci_write_register(host->pcr, SD_CFG1, in sd_disable_initial_mode()
557 struct mmc_data *data = mrq->data; in sd_rw_multi()
560 if (host->sg_count < 0) { in sd_rw_multi()
561 data->error = host->sg_count; in sd_rw_multi()
563 __func__, host->sg_count); in sd_rw_multi()
564 return data->error; in sd_rw_multi()
567 if (data->flags & MMC_DATA_READ) { in sd_rw_multi()
568 if (host->initial_mode) in sd_rw_multi()
573 if (host->initial_mode) in sd_rw_multi()
585 struct mmc_command *cmd = mrq->cmd; in sd_normal_rw()
586 struct mmc_data *data = mrq->data; in sd_normal_rw()
589 buf = kzalloc(data->blksz, GFP_NOIO); in sd_normal_rw()
591 cmd->error = -ENOMEM; in sd_normal_rw()
595 if (data->flags & MMC_DATA_READ) { in sd_normal_rw()
596 if (host->initial_mode) in sd_normal_rw()
599 cmd->error = sd_read_data(host, cmd, (u16)data->blksz, buf, in sd_normal_rw()
600 data->blksz, 200); in sd_normal_rw()
602 if (host->initial_mode) in sd_normal_rw()
605 sg_copy_from_buffer(data->sg, data->sg_len, buf, data->blksz); in sd_normal_rw()
607 sg_copy_to_buffer(data->sg, data->sg_len, buf, data->blksz); in sd_normal_rw()
609 cmd->error = sd_write_data(host, cmd, (u16)data->blksz, buf, in sd_normal_rw()
610 data->blksz, 200); in sd_normal_rw()
619 struct rtsx_pcr *pcr = host->pcr; in sd_change_phase()
622 __func__, rx ? "RX" : "TX", sample_point); in sd_change_phase()
693 rtsx_pci_read_register(host->pcr, SD_DATA_STATE, &val); in sd_wait_data_idle()
706 struct rtsx_pcr *pcr = host->pcr; in sd_tuning_rx_cmd()
772 return -EINVAL; in sd_tuning_rx()
778 return -EINVAL; in sd_tuning_rx()
787 return (cmd->opcode == SD_IO_RW_EXTENDED) && (data->blksz == 512); in sdio_extblock_cmd()
792 return mmc_op_multi(cmd->opcode) || in sd_rw_cmd()
793 (cmd->opcode == MMC_READ_SINGLE_BLOCK) || in sd_rw_cmd()
794 (cmd->opcode == MMC_WRITE_BLOCK); in sd_rw_cmd()
801 struct rtsx_pcr *pcr = host->pcr; in sd_request()
803 struct mmc_host *mmc = host->mmc; in sd_request()
804 struct mmc_request *mrq = host->mrq; in sd_request()
805 struct mmc_command *cmd = mrq->cmd; in sd_request()
806 struct mmc_data *data = mrq->data; in sd_request()
811 if (host->eject || !sd_get_cd_int(host)) { in sd_request()
812 cmd->error = -ENOMEDIUM; in sd_request()
816 err = rtsx_pci_card_exclusive_check(host->pcr, RTSX_SD_CARD); in sd_request()
818 cmd->error = err; in sd_request()
822 mutex_lock(&pcr->pcr_mutex); in sd_request()
826 rtsx_pci_switch_clock(pcr, host->clock, host->ssc_depth, in sd_request()
827 host->initial_mode, host->double_clk, host->vpclk); in sd_request()
832 mutex_lock(&host->host_mutex); in sd_request()
833 host->mrq = mrq; in sd_request()
834 mutex_unlock(&host->host_mutex); in sd_request()
836 if (mrq->data) in sd_request()
837 data_size = data->blocks * data->blksz; in sd_request()
842 cmd->error = sd_rw_multi(host, mrq); in sd_request()
843 if (!host->using_cookie) in sd_request()
844 sdmmc_post_req(host->mmc, host->mrq, 0); in sd_request()
846 if (mmc_op_multi(cmd->opcode) && mrq->stop) in sd_request()
847 sd_send_cmd_get_rsp(host, mrq->stop); in sd_request()
852 if (mrq->data) { in sd_request()
853 if (cmd->error || data->error) in sd_request()
854 data->bytes_xfered = 0; in sd_request()
856 data->bytes_xfered = data->blocks * data->blksz; in sd_request()
859 mutex_unlock(&pcr->pcr_mutex); in sd_request()
862 if (cmd->error) { in sd_request()
864 cmd->opcode, cmd->arg, cmd->error); in sd_request()
867 mutex_lock(&host->host_mutex); in sd_request()
868 host->mrq = NULL; in sd_request()
869 mutex_unlock(&host->host_mutex); in sd_request()
877 struct mmc_data *data = mrq->data; in sdmmc_request()
879 mutex_lock(&host->host_mutex); in sdmmc_request()
880 host->mrq = mrq; in sdmmc_request()
881 mutex_unlock(&host->host_mutex); in sdmmc_request()
883 if (sd_rw_cmd(mrq->cmd) || sdio_extblock_cmd(mrq->cmd, data)) in sdmmc_request()
884 host->using_cookie = sd_pre_dma_transfer(host, data, false); in sdmmc_request()
886 schedule_work(&host->work); in sdmmc_request()
900 err = rtsx_pci_write_register(host->pcr, SD_CFG1, in sd_set_bus_width()
908 struct rtsx_pcr *pcr = host->pcr; in sd_power_on()
909 struct mmc_host *mmc = host->mmc; in sd_power_on()
914 if (host->prev_power_state == MMC_POWER_ON) in sd_power_on()
917 if (host->prev_power_state == MMC_POWER_UP) { in sd_power_on()
961 if (pcr->extra_caps & EXTRA_CAPS_SD_EXPRESS) in sd_power_on()
962 mmc->caps2 |= MMC_CAP2_SD_EXP | MMC_CAP2_SD_EXP_1_2V; in sd_power_on()
966 * in read-only mode. in sd_power_on()
970 pcr->extra_caps &= ~EXTRA_CAPS_SD_EXPRESS; in sd_power_on()
971 mmc->caps2 &= ~(MMC_CAP2_SD_EXP | MMC_CAP2_SD_EXP_1_2V); in sd_power_on()
976 host->prev_power_state = power_mode; in sd_power_on()
982 struct rtsx_pcr *pcr = host->pcr; in sd_power_off()
985 host->prev_power_state = MMC_POWER_OFF; in sd_power_off()
1018 struct rtsx_pcr *pcr = host->pcr; in sd_set_timing()
1091 struct rtsx_pcr *pcr = host->pcr; in sdmmc_set_ios()
1093 if (host->eject) in sdmmc_set_ios()
1096 if (rtsx_pci_card_exclusive_check(host->pcr, RTSX_SD_CARD)) in sdmmc_set_ios()
1099 mutex_lock(&pcr->pcr_mutex); in sdmmc_set_ios()
1103 sd_set_bus_width(host, ios->bus_width); in sdmmc_set_ios()
1104 sd_set_power_mode(host, ios->power_mode); in sdmmc_set_ios()
1105 sd_set_timing(host, ios->timing); in sdmmc_set_ios()
1107 host->vpclk = false; in sdmmc_set_ios()
1108 host->double_clk = true; in sdmmc_set_ios()
1110 switch (ios->timing) { in sdmmc_set_ios()
1113 host->ssc_depth = RTSX_SSC_DEPTH_2M; in sdmmc_set_ios()
1114 host->vpclk = true; in sdmmc_set_ios()
1115 host->double_clk = false; in sdmmc_set_ios()
1120 host->ssc_depth = RTSX_SSC_DEPTH_1M; in sdmmc_set_ios()
1123 host->ssc_depth = RTSX_SSC_DEPTH_500K; in sdmmc_set_ios()
1127 host->initial_mode = (ios->clock <= 1000000) ? true : false; in sdmmc_set_ios()
1129 host->clock = ios->clock; in sdmmc_set_ios()
1130 rtsx_pci_switch_clock(pcr, ios->clock, host->ssc_depth, in sdmmc_set_ios()
1131 host->initial_mode, host->double_clk, host->vpclk); in sdmmc_set_ios()
1133 mutex_unlock(&pcr->pcr_mutex); in sdmmc_set_ios()
1139 struct rtsx_pcr *pcr = host->pcr; in sdmmc_get_ro()
1143 if (host->eject) in sdmmc_get_ro()
1144 return -ENOMEDIUM; in sdmmc_get_ro()
1146 mutex_lock(&pcr->pcr_mutex); in sdmmc_get_ro()
1150 /* Check SD mechanical write-protect switch */ in sdmmc_get_ro()
1156 mutex_unlock(&pcr->pcr_mutex); in sdmmc_get_ro()
1164 struct rtsx_pcr *pcr = host->pcr; in sdmmc_get_cd()
1168 if (host->eject) in sdmmc_get_cd()
1171 mutex_lock(&pcr->pcr_mutex); in sdmmc_get_cd()
1181 mutex_unlock(&pcr->pcr_mutex); in sdmmc_get_cd()
1188 struct rtsx_pcr *pcr = host->pcr; in sd_wait_voltage_stable_1()
1208 return -EINVAL; in sd_wait_voltage_stable_1()
1221 struct rtsx_pcr *pcr = host->pcr; in sd_wait_voltage_stable_2()
1253 return -EINVAL; in sd_wait_voltage_stable_2()
1262 struct rtsx_pcr *pcr = host->pcr; in sdmmc_switch_voltage()
1267 __func__, ios->signal_voltage); in sdmmc_switch_voltage()
1269 if (host->eject) in sdmmc_switch_voltage()
1270 return -ENOMEDIUM; in sdmmc_switch_voltage()
1272 err = rtsx_pci_card_exclusive_check(host->pcr, RTSX_SD_CARD); in sdmmc_switch_voltage()
1276 mutex_lock(&pcr->pcr_mutex); in sdmmc_switch_voltage()
1280 if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) in sdmmc_switch_voltage()
1306 mutex_unlock(&pcr->pcr_mutex); in sdmmc_switch_voltage()
1314 struct rtsx_pcr *pcr = host->pcr; in sdmmc_execute_tuning()
1317 if (host->eject) in sdmmc_execute_tuning()
1318 return -ENOMEDIUM; in sdmmc_execute_tuning()
1320 err = rtsx_pci_card_exclusive_check(host->pcr, RTSX_SD_CARD); in sdmmc_execute_tuning()
1324 mutex_lock(&pcr->pcr_mutex); in sdmmc_execute_tuning()
1328 /* Set initial TX phase */ in sdmmc_execute_tuning()
1329 switch (mmc->ios.timing) { in sdmmc_execute_tuning()
1350 if ((mmc->ios.timing == MMC_TIMING_UHS_SDR104) || in sdmmc_execute_tuning()
1351 (mmc->ios.timing == MMC_TIMING_UHS_SDR50)) in sdmmc_execute_tuning()
1353 else if (mmc->ios.timing == MMC_TIMING_UHS_DDR50) in sdmmc_execute_tuning()
1357 mutex_unlock(&pcr->pcr_mutex); in sdmmc_execute_tuning()
1366 struct rtsx_pcr *pcr = host->pcr; in sdmmc_init_sd_express()
1369 pcie_capability_clear_and_set_word(pcr->pci, PCI_EXP_LNKCTL2, in sdmmc_init_sd_express()
1371 pci_write_config_byte(pcr->pci, 0x80e, 0x02); in sdmmc_init_sd_express()
1372 pcie_capability_clear_and_set_word(pcr->pci, PCI_EXP_LNKCTL2, in sdmmc_init_sd_express()
1386 pcr->option.sd_800mA_ocp_thd); in sdmmc_init_sd_express()
1388 if (pcr->ops->disable_auto_blink) in sdmmc_init_sd_express()
1389 pcr->ops->disable_auto_blink(pcr); in sdmmc_init_sd_express()
1398 pcr->hw_param.interrupt_en &= ~(SD_INT_EN); in sdmmc_init_sd_express()
1399 rtsx_pci_writel(pcr, RTSX_BIER, pcr->hw_param.interrupt_en); in sdmmc_init_sd_express()
1411 host->eject = true; in sdmmc_init_sd_express()
1429 struct mmc_host *mmc = host->mmc; in init_extra_caps()
1430 struct rtsx_pcr *pcr = host->pcr; in init_extra_caps()
1432 dev_dbg(sdmmc_dev(host), "pcr->extra_caps = 0x%x\n", pcr->extra_caps); in init_extra_caps()
1434 if (pcr->extra_caps & EXTRA_CAPS_SD_SDR50) in init_extra_caps()
1435 mmc->caps |= MMC_CAP_UHS_SDR50; in init_extra_caps()
1436 if (pcr->extra_caps & EXTRA_CAPS_SD_SDR104) in init_extra_caps()
1437 mmc->caps |= MMC_CAP_UHS_SDR104; in init_extra_caps()
1438 if (pcr->extra_caps & EXTRA_CAPS_SD_DDR50) in init_extra_caps()
1439 mmc->caps |= MMC_CAP_UHS_DDR50; in init_extra_caps()
1440 if (pcr->extra_caps & EXTRA_CAPS_MMC_HSDDR) in init_extra_caps()
1441 mmc->caps |= MMC_CAP_1_8V_DDR; in init_extra_caps()
1442 if (pcr->extra_caps & EXTRA_CAPS_MMC_8BIT) in init_extra_caps()
1443 mmc->caps |= MMC_CAP_8_BIT_DATA; in init_extra_caps()
1444 if (pcr->extra_caps & EXTRA_CAPS_NO_MMC) in init_extra_caps()
1445 mmc->caps2 |= MMC_CAP2_NO_MMC; in init_extra_caps()
1446 if (pcr->extra_caps & EXTRA_CAPS_SD_EXPRESS) in init_extra_caps()
1447 mmc->caps2 |= MMC_CAP2_SD_EXP | MMC_CAP2_SD_EXP_1_2V; in init_extra_caps()
1452 struct mmc_host *mmc = host->mmc; in realtek_init_host()
1453 struct rtsx_pcr *pcr = host->pcr; in realtek_init_host()
1455 mmc->f_min = 250000; in realtek_init_host()
1456 mmc->f_max = 208000000; in realtek_init_host()
1457 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195; in realtek_init_host()
1458 mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED | in realtek_init_host()
1461 if (pcr->rtd3_en) in realtek_init_host()
1462 mmc->caps = mmc->caps | MMC_CAP_AGGRESSIVE_PM; in realtek_init_host()
1463 mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE | in realtek_init_host()
1465 mmc->max_current_330 = 400; in realtek_init_host()
1466 mmc->max_current_180 = 800; in realtek_init_host()
1467 mmc->ops = &realtek_pci_sdmmc_ops; in realtek_init_host()
1471 mmc->max_segs = 256; in realtek_init_host()
1472 mmc->max_seg_size = 65536; in realtek_init_host()
1473 mmc->max_blk_size = 512; in realtek_init_host()
1474 mmc->max_blk_count = 65535; in realtek_init_host()
1475 mmc->max_req_size = 524288; in realtek_init_host()
1482 host->cookie = -1; in rtsx_pci_sdmmc_card_event()
1483 mmc_detect_change(host->mmc, 0); in rtsx_pci_sdmmc_card_event()
1491 struct pcr_handle *handle = pdev->dev.platform_data; in rtsx_pci_sdmmc_drv_probe()
1495 return -ENXIO; in rtsx_pci_sdmmc_drv_probe()
1497 pcr = handle->pcr; in rtsx_pci_sdmmc_drv_probe()
1499 return -ENXIO; in rtsx_pci_sdmmc_drv_probe()
1501 dev_dbg(&(pdev->dev), ": Realtek PCI-E SDMMC controller found\n"); in rtsx_pci_sdmmc_drv_probe()
1503 mmc = mmc_alloc_host(sizeof(*host), &pdev->dev); in rtsx_pci_sdmmc_drv_probe()
1505 return -ENOMEM; in rtsx_pci_sdmmc_drv_probe()
1508 host->pcr = pcr; in rtsx_pci_sdmmc_drv_probe()
1509 mmc->ios.power_delay_ms = 5; in rtsx_pci_sdmmc_drv_probe()
1510 host->mmc = mmc; in rtsx_pci_sdmmc_drv_probe()
1511 host->pdev = pdev; in rtsx_pci_sdmmc_drv_probe()
1512 host->cookie = -1; in rtsx_pci_sdmmc_drv_probe()
1513 host->prev_power_state = MMC_POWER_OFF; in rtsx_pci_sdmmc_drv_probe()
1514 INIT_WORK(&host->work, sd_request); in rtsx_pci_sdmmc_drv_probe()
1516 pcr->slots[RTSX_SD_CARD].p_dev = pdev; in rtsx_pci_sdmmc_drv_probe()
1517 pcr->slots[RTSX_SD_CARD].card_event = rtsx_pci_sdmmc_card_event; in rtsx_pci_sdmmc_drv_probe()
1519 mutex_init(&host->host_mutex); in rtsx_pci_sdmmc_drv_probe()
1523 pm_runtime_no_callbacks(&pdev->dev); in rtsx_pci_sdmmc_drv_probe()
1524 pm_runtime_set_active(&pdev->dev); in rtsx_pci_sdmmc_drv_probe()
1525 pm_runtime_enable(&pdev->dev); in rtsx_pci_sdmmc_drv_probe()
1526 pm_runtime_set_autosuspend_delay(&pdev->dev, 200); in rtsx_pci_sdmmc_drv_probe()
1527 pm_runtime_mark_last_busy(&pdev->dev); in rtsx_pci_sdmmc_drv_probe()
1528 pm_runtime_use_autosuspend(&pdev->dev); in rtsx_pci_sdmmc_drv_probe()
1532 pm_runtime_dont_use_autosuspend(&pdev->dev); in rtsx_pci_sdmmc_drv_probe()
1533 pm_runtime_disable(&pdev->dev); in rtsx_pci_sdmmc_drv_probe()
1547 pcr = host->pcr; in rtsx_pci_sdmmc_drv_remove()
1548 pcr->slots[RTSX_SD_CARD].p_dev = NULL; in rtsx_pci_sdmmc_drv_remove()
1549 pcr->slots[RTSX_SD_CARD].card_event = NULL; in rtsx_pci_sdmmc_drv_remove()
1550 mmc = host->mmc; in rtsx_pci_sdmmc_drv_remove()
1552 cancel_work_sync(&host->work); in rtsx_pci_sdmmc_drv_remove()
1554 mutex_lock(&host->host_mutex); in rtsx_pci_sdmmc_drv_remove()
1555 if (host->mrq) { in rtsx_pci_sdmmc_drv_remove()
1556 dev_dbg(&(pdev->dev), in rtsx_pci_sdmmc_drv_remove()
1562 host->mrq->cmd->error = -ENOMEDIUM; in rtsx_pci_sdmmc_drv_remove()
1563 if (host->mrq->stop) in rtsx_pci_sdmmc_drv_remove()
1564 host->mrq->stop->error = -ENOMEDIUM; in rtsx_pci_sdmmc_drv_remove()
1565 mmc_request_done(mmc, host->mrq); in rtsx_pci_sdmmc_drv_remove()
1567 mutex_unlock(&host->host_mutex); in rtsx_pci_sdmmc_drv_remove()
1570 host->eject = true; in rtsx_pci_sdmmc_drv_remove()
1572 flush_work(&host->work); in rtsx_pci_sdmmc_drv_remove()
1574 pm_runtime_dont_use_autosuspend(&pdev->dev); in rtsx_pci_sdmmc_drv_remove()
1575 pm_runtime_disable(&pdev->dev); in rtsx_pci_sdmmc_drv_remove()
1579 dev_dbg(&(pdev->dev), in rtsx_pci_sdmmc_drv_remove()
1580 ": Realtek PCI-E SDMMC controller has been removed\n"); in rtsx_pci_sdmmc_drv_remove()
1605 MODULE_DESCRIPTION("Realtek PCI-E SD/MMC Card Host Driver");