Lines Matching +full:dsr +full:- +full:override
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright 2006-2007 Pierre Ossman
75 if (!mmc_host_is_spi(card->host)) in __mmc_send_status()
76 cmd.arg = card->rca << 16; in __mmc_send_status()
79 err = mmc_wait_for_cmd(card->host, &cmd, retries); in __mmc_send_status()
106 cmd.arg = card->rca << 16; in _mmc_select_card()
119 return _mmc_select_card(card->host, card); in mmc_select_card()
132 * The presence of the DSR register can be determined from the CSD register,
141 cmd.arg = (host->dsr << 16) | 0xffff; in mmc_set_dsr()
153 * Non-SPI hosts need to prevent chipselect going active during in mmc_go_idle()
158 * rules that must accommodate non-MMC slaves which this layer in mmc_go_idle()
179 host->use_spi_crc = 0; in mmc_go_idle()
187 struct mmc_host *host = data->host; in __mmc_send_op_cond_cb()
188 struct mmc_command *cmd = data->cmd; in __mmc_send_op_cond_cb()
189 u32 ocr = data->ocr; in __mmc_send_op_cond_cb()
197 if (!(cmd->resp[0] & R1_SPI_IDLE)) { in __mmc_send_op_cond_cb()
202 if (cmd->resp[0] & MMC_CARD_BUSY) { in __mmc_send_op_cond_cb()
218 cmd->arg = cmd->resp[0] | BIT(30); in __mmc_send_op_cond_cb()
254 cmd.arg = card->rca << 16; in mmc_set_relative_addr()
257 return mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); in mmc_set_relative_addr()
280 * NOTE: void *buf, caller for the buf is required to use DMA-capable
281 * buffer or on-stack buffer (with some overhead in callee).
339 return -ENOMEM; in mmc_spi_send_cxd()
355 if (mmc_host_is_spi(card->host)) in mmc_send_csd()
356 return mmc_spi_send_cxd(card->host, csd, MMC_SEND_CSD); in mmc_send_csd()
358 return mmc_send_cxd_native(card->host, card->rca << 16, csd, in mmc_send_csd()
376 return -EINVAL; in mmc_get_ext_csd()
379 return -EOPNOTSUPP; in mmc_get_ext_csd()
387 return -ENOMEM; in mmc_get_ext_csd()
389 err = mmc_send_adtc_data(card, card->host, MMC_SEND_EXT_CSD, 0, ext_csd, in mmc_get_ext_csd()
426 host->use_spi_crc = use_crc; in mmc_spi_set_crc()
434 return -EBADMSG; in mmc_switch_status_error()
440 return -EBADMSG; in mmc_switch_status_error()
445 /* Caller must hold re-tuning */
452 if (!crc_err_fatal && err == -EILSEQ) in mmc_switch_status()
457 return mmc_switch_status_error(card->host, status); in mmc_switch_status()
463 struct mmc_host *host = data->card->host; in mmc_busy_cb()
467 if (data->busy_cmd != MMC_BUSY_IO && host->ops->card_busy) { in mmc_busy_cb()
468 *busy = host->ops->card_busy(host); in mmc_busy_cb()
472 err = mmc_send_status(data->card, &status); in mmc_busy_cb()
473 if (data->retry_crc_err && err == -EILSEQ) { in mmc_busy_cb()
480 switch (data->busy_cmd) { in mmc_busy_cb()
485 err = R1_STATUS(status) ? -EIO : 0; in mmc_busy_cb()
492 err = -EINVAL; in mmc_busy_cb()
529 return -ETIMEDOUT; in __mmc_poll_for_busy()
547 struct mmc_host *host = card->host; in mmc_poll_for_busy()
568 if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && host->max_busy_timeout && in mmc_prepare_busy_cmd()
569 (timeout_ms > host->max_busy_timeout)) { in mmc_prepare_busy_cmd()
570 cmd->flags = MMC_CMD_AC | MMC_RSP_SPI_R1 | MMC_RSP_R1; in mmc_prepare_busy_cmd()
574 cmd->flags = MMC_CMD_AC | MMC_RSP_SPI_R1B | MMC_RSP_R1B; in mmc_prepare_busy_cmd()
575 cmd->busy_timeout = timeout_ms; in mmc_prepare_busy_cmd()
581 * __mmc_switch - modify EXT_CSD register
599 struct mmc_host *host = card->host; in __mmc_switch()
603 unsigned char old_timing = host->ios.timing; in __mmc_switch()
608 pr_warn("%s: unspecified timeout for CMD6 - use generic\n", in __mmc_switch()
610 timeout_ms = card->ext_csd.generic_cmd6_time; in __mmc_switch()
625 if (((host->caps & MMC_CAP_WAIT_WHILE_BUSY) && use_r1b_resp) || in __mmc_switch()
630 * If the host doesn't support HW polling via the ->card_busy() ops and in __mmc_switch()
634 if (!send_status && !host->ops->card_busy) { in __mmc_switch()
674 struct mmc_ios *ios = &host->ios; in mmc_send_tuning()
679 if (ios->bus_width == MMC_BUS_WIDTH_8) { in mmc_send_tuning()
682 } else if (ios->bus_width == MMC_BUS_WIDTH_4) { in mmc_send_tuning()
686 return -EINVAL; in mmc_send_tuning()
690 return -ENOMEM; in mmc_send_tuning()
729 err = -EIO; in mmc_send_tuning()
753 * For drivers that override R1 to R1b, set an arbitrary timeout based in mmc_send_abort_tuning()
777 * routine normally provide temporary on-stack buffers ... in mmc_send_bus_test()
781 return -ENOMEM; in mmc_send_bus_test()
791 return -EINVAL; in mmc_send_bus_test()
825 err = -EIO; in mmc_send_bus_test()
850 return -EINVAL; in mmc_bus_test()
856 mmc_send_bus_test(card, card->host, MMC_BUS_TEST_W, width); in mmc_bus_test()
857 return mmc_send_bus_test(card, card->host, MMC_BUS_TEST_R, width); in mmc_bus_test()
862 unsigned int busy_timeout_ms = card->ext_csd.out_of_int_time; in mmc_send_hpi_cmd()
863 struct mmc_host *host = card->host; in mmc_send_hpi_cmd()
868 cmd.opcode = card->ext_csd.hpi_cmd; in mmc_send_hpi_cmd()
869 cmd.arg = card->rca << 16 | 1; in mmc_send_hpi_cmd()
884 if (host->caps & MMC_CAP_WAIT_WHILE_BUSY && use_r1b_resp) in mmc_send_hpi_cmd()
892 * mmc_interrupt_hpi - Issue for High priority Interrupt
896 * until out-of prg-state.
903 if (!card->ext_csd.hpi_en) { in mmc_interrupt_hpi()
904 pr_info("%s: HPI enable bit unset\n", mmc_hostname(card->host)); in mmc_interrupt_hpi()
910 pr_err("%s: Get card status fail\n", mmc_hostname(card->host)); in mmc_interrupt_hpi()
929 mmc_hostname(card->host), R1_CURRENT_STATE(status)); in mmc_interrupt_hpi()
930 err = -EINVAL; in mmc_interrupt_hpi()
941 return (card && card->csd.mmca_vsn > CSD_SPEC_VER_3); in mmc_can_ext_csd()
953 card->ext_csd.raw_bkops_status = ext_csd[EXT_CSD_BKOPS_STATUS]; in mmc_read_bkops_status()
954 card->ext_csd.raw_exception_status = ext_csd[EXT_CSD_EXP_EVENTS_STATUS]; in mmc_read_bkops_status()
960 * mmc_run_bkops - Run BKOPS for supported cards
970 if (!card->ext_csd.man_bkops_en) in mmc_run_bkops()
976 mmc_hostname(card->host), err); in mmc_run_bkops()
980 if (!card->ext_csd.raw_bkops_status || in mmc_run_bkops()
981 card->ext_csd.raw_bkops_status < EXT_CSD_BKOPS_LEVEL_2) in mmc_run_bkops()
984 mmc_retune_hold(card->host); in mmc_run_bkops()
998 if (err == -ETIMEDOUT && !mmc_interrupt_hpi(card)) in mmc_run_bkops()
999 pr_warn("%s: BKOPS aborted\n", mmc_hostname(card->host)); in mmc_run_bkops()
1002 mmc_hostname(card->host), err); in mmc_run_bkops()
1004 mmc_retune_release(card->host); in mmc_run_bkops()
1013 if (!card->ext_csd.cmdq_support) in mmc_cmdq_switch()
1014 return -EOPNOTSUPP; in mmc_cmdq_switch()
1017 val, card->ext_csd.generic_cmd6_time); in mmc_cmdq_switch()
1019 card->ext_csd.cmdq_en = enable; in mmc_cmdq_switch()
1038 struct mmc_host *host = card->host; in mmc_sanitize()
1043 return -EOPNOTSUPP; in mmc_sanitize()
1063 if (err == -ETIMEDOUT && !mmc_interrupt_hpi(card)) in mmc_sanitize()