mmc: Avoid open coding by using mmc_op_tuning()
Replace code with the already defined function. No functional changes. Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20221124080031.14690-1-cw9316.lee@samsung.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
1e8cb505f3
commit
b98e7e8daf
|
@ -142,8 +142,7 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
|
||||||
int err = cmd->error;
|
int err = cmd->error;
|
||||||
|
|
||||||
/* Flag re-tuning needed on CRC errors */
|
/* Flag re-tuning needed on CRC errors */
|
||||||
if (cmd->opcode != MMC_SEND_TUNING_BLOCK &&
|
if (!mmc_op_tuning(cmd->opcode) &&
|
||||||
cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200 &&
|
|
||||||
!host->retune_crc_disable &&
|
!host->retune_crc_disable &&
|
||||||
(err == -EILSEQ || (mrq->sbc && mrq->sbc->error == -EILSEQ) ||
|
(err == -EILSEQ || (mrq->sbc && mrq->sbc->error == -EILSEQ) ||
|
||||||
(mrq->data && mrq->data->error == -EILSEQ) ||
|
(mrq->data && mrq->data->error == -EILSEQ) ||
|
||||||
|
|
|
@ -334,8 +334,7 @@ static u32 dw_mci_prep_stop_abort(struct dw_mci *host, struct mmc_command *cmd)
|
||||||
cmdr == MMC_READ_MULTIPLE_BLOCK ||
|
cmdr == MMC_READ_MULTIPLE_BLOCK ||
|
||||||
cmdr == MMC_WRITE_BLOCK ||
|
cmdr == MMC_WRITE_BLOCK ||
|
||||||
cmdr == MMC_WRITE_MULTIPLE_BLOCK ||
|
cmdr == MMC_WRITE_MULTIPLE_BLOCK ||
|
||||||
cmdr == MMC_SEND_TUNING_BLOCK ||
|
mmc_op_tuning(cmdr) ||
|
||||||
cmdr == MMC_SEND_TUNING_BLOCK_HS200 ||
|
|
||||||
cmdr == MMC_GEN_CMD) {
|
cmdr == MMC_GEN_CMD) {
|
||||||
stop->opcode = MMC_STOP_TRANSMISSION;
|
stop->opcode = MMC_STOP_TRANSMISSION;
|
||||||
stop->arg = 0;
|
stop->arg = 0;
|
||||||
|
|
|
@ -1224,9 +1224,7 @@ static bool msdc_cmd_done(struct msdc_host *host, int events,
|
||||||
|
|
||||||
if (!sbc_error && !(events & MSDC_INT_CMDRDY)) {
|
if (!sbc_error && !(events & MSDC_INT_CMDRDY)) {
|
||||||
if (events & MSDC_INT_CMDTMO ||
|
if (events & MSDC_INT_CMDTMO ||
|
||||||
(cmd->opcode != MMC_SEND_TUNING_BLOCK &&
|
(!mmc_op_tuning(cmd->opcode) && !host->hs400_tuning))
|
||||||
cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200 &&
|
|
||||||
!host->hs400_tuning))
|
|
||||||
/*
|
/*
|
||||||
* should not clear fifo/interrupt as the tune data
|
* should not clear fifo/interrupt as the tune data
|
||||||
* may have already come when cmd19/cmd21 gets response
|
* may have already come when cmd19/cmd21 gets response
|
||||||
|
@ -1320,9 +1318,7 @@ static void msdc_cmd_next(struct msdc_host *host,
|
||||||
{
|
{
|
||||||
if ((cmd->error &&
|
if ((cmd->error &&
|
||||||
!(cmd->error == -EILSEQ &&
|
!(cmd->error == -EILSEQ &&
|
||||||
(cmd->opcode == MMC_SEND_TUNING_BLOCK ||
|
(mmc_op_tuning(cmd->opcode) || host->hs400_tuning))) ||
|
||||||
cmd->opcode == MMC_SEND_TUNING_BLOCK_HS200 ||
|
|
||||||
host->hs400_tuning))) ||
|
|
||||||
(mrq->sbc && mrq->sbc->error))
|
(mrq->sbc && mrq->sbc->error))
|
||||||
msdc_request_done(host, mrq);
|
msdc_request_done(host, mrq);
|
||||||
else if (cmd == mrq->sbc)
|
else if (cmd == mrq->sbc)
|
||||||
|
|
|
@ -2219,8 +2219,7 @@ static int __sdhci_msm_check_write(struct sdhci_host *host, u16 val, int reg)
|
||||||
if (!msm_host->use_cdr)
|
if (!msm_host->use_cdr)
|
||||||
break;
|
break;
|
||||||
if ((msm_host->transfer_mode & SDHCI_TRNS_READ) &&
|
if ((msm_host->transfer_mode & SDHCI_TRNS_READ) &&
|
||||||
SDHCI_GET_CMD(val) != MMC_SEND_TUNING_BLOCK_HS200 &&
|
!mmc_op_tuning(SDHCI_GET_CMD(val)))
|
||||||
SDHCI_GET_CMD(val) != MMC_SEND_TUNING_BLOCK)
|
|
||||||
sdhci_msm_set_cdr(host, true);
|
sdhci_msm_set_cdr(host, true);
|
||||||
else
|
else
|
||||||
sdhci_msm_set_cdr(host, false);
|
sdhci_msm_set_cdr(host, false);
|
||||||
|
|
|
@ -326,8 +326,7 @@ static int sdhci_o2_execute_tuning(struct mmc_host *mmc, u32 opcode)
|
||||||
(host->timing != MMC_TIMING_UHS_SDR50))
|
(host->timing != MMC_TIMING_UHS_SDR50))
|
||||||
return sdhci_execute_tuning(mmc, opcode);
|
return sdhci_execute_tuning(mmc, opcode);
|
||||||
|
|
||||||
if (WARN_ON((opcode != MMC_SEND_TUNING_BLOCK_HS200) &&
|
if (WARN_ON(!mmc_op_tuning(opcode)))
|
||||||
(opcode != MMC_SEND_TUNING_BLOCK)))
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* Force power mode enter L0 */
|
/* Force power mode enter L0 */
|
||||||
|
|
|
@ -268,13 +268,9 @@ static void tegra210_sdhci_writew(struct sdhci_host *host, u16 val, int reg)
|
||||||
{
|
{
|
||||||
bool is_tuning_cmd = 0;
|
bool is_tuning_cmd = 0;
|
||||||
bool clk_enabled;
|
bool clk_enabled;
|
||||||
u8 cmd;
|
|
||||||
|
|
||||||
if (reg == SDHCI_COMMAND) {
|
if (reg == SDHCI_COMMAND)
|
||||||
cmd = SDHCI_GET_CMD(val);
|
is_tuning_cmd = mmc_op_tuning(SDHCI_GET_CMD(val));
|
||||||
is_tuning_cmd = cmd == MMC_SEND_TUNING_BLOCK ||
|
|
||||||
cmd == MMC_SEND_TUNING_BLOCK_HS200;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_tuning_cmd)
|
if (is_tuning_cmd)
|
||||||
clk_enabled = tegra_sdhci_configure_card_clk(host, 0);
|
clk_enabled = tegra_sdhci_configure_card_clk(host, 0);
|
||||||
|
|
|
@ -1693,8 +1693,7 @@ static bool sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
|
||||||
flags |= SDHCI_CMD_INDEX;
|
flags |= SDHCI_CMD_INDEX;
|
||||||
|
|
||||||
/* CMD19 is special in that the Data Present Select should be set */
|
/* CMD19 is special in that the Data Present Select should be set */
|
||||||
if (cmd->data || cmd->opcode == MMC_SEND_TUNING_BLOCK ||
|
if (cmd->data || mmc_op_tuning(cmd->opcode))
|
||||||
cmd->opcode == MMC_SEND_TUNING_BLOCK_HS200)
|
|
||||||
flags |= SDHCI_CMD_DATA;
|
flags |= SDHCI_CMD_DATA;
|
||||||
|
|
||||||
timeout = jiffies;
|
timeout = jiffies;
|
||||||
|
@ -3374,8 +3373,6 @@ static void sdhci_adma_show_error(struct sdhci_host *host)
|
||||||
|
|
||||||
static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
|
static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
|
||||||
{
|
{
|
||||||
u32 command;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CMD19 generates _only_ Buffer Read Ready interrupt if
|
* CMD19 generates _only_ Buffer Read Ready interrupt if
|
||||||
* use sdhci_send_tuning.
|
* use sdhci_send_tuning.
|
||||||
|
@ -3384,9 +3381,7 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
|
||||||
* SDHCI_INT_DATA_AVAIL always there, stuck in irq storm.
|
* SDHCI_INT_DATA_AVAIL always there, stuck in irq storm.
|
||||||
*/
|
*/
|
||||||
if (intmask & SDHCI_INT_DATA_AVAIL && !host->data) {
|
if (intmask & SDHCI_INT_DATA_AVAIL && !host->data) {
|
||||||
command = SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND));
|
if (mmc_op_tuning(SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND)))) {
|
||||||
if (command == MMC_SEND_TUNING_BLOCK ||
|
|
||||||
command == MMC_SEND_TUNING_BLOCK_HS200) {
|
|
||||||
host->tuning_done = 1;
|
host->tuning_done = 1;
|
||||||
wake_up(&host->buf_ready_int);
|
wake_up(&host->buf_ready_int);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue