Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eb83af52 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mmc: sdhci: retune on cmd or data CRC error"

parents e35ec02c 40546d66
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -1718,7 +1718,10 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
		 * is no on-going data transfer. If so, we need to execute
		 * tuning procedure before sending command.
		 */
		if ((host->flags & SDHCI_NEEDS_RETUNING) &&
		if ((mrq->cmd->opcode != MMC_SEND_TUNING_BLOCK) &&
		    (mrq->cmd->opcode != MMC_SEND_TUNING_BLOCK_HS400) &&
		    (mrq->cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200) &&
		    (host->flags & SDHCI_NEEDS_RETUNING) &&
		    !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) {
			if (mmc->card) {
				/* eMMC uses cmd21 but sd and sdio use cmd19 */
@@ -1726,6 +1729,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
					mmc->card->type == MMC_TYPE_MMC ?
					MMC_SEND_TUNING_BLOCK_HS200 :
					MMC_SEND_TUNING_BLOCK;
				host->mrq = NULL;
				spin_unlock_irqrestore(&host->lock, flags);
				sdhci_execute_tuning(mmc, tuning_opcode);
				spin_lock_irqsave(&host->lock, flags);
@@ -2802,6 +2806,8 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
	}

	if (host->cmd->error) {
		if (host->cmd->error == -EILSEQ)
			host->flags |= SDHCI_NEEDS_RETUNING;
		tasklet_schedule(&host->finish_tasklet);
		return;
	}
@@ -2939,8 +2945,11 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
							    SDHCI_COMMAND));
			if ((command != MMC_SEND_TUNING_BLOCK_HS400) &&
			    (command != MMC_SEND_TUNING_BLOCK_HS200) &&
			    (command != MMC_SEND_TUNING_BLOCK))
			    (command != MMC_SEND_TUNING_BLOCK)) {
				pr_msg = true;
				if (intmask & SDHCI_INT_DATA_CRC)
					host->flags |= SDHCI_NEEDS_RETUNING;
			}
		} else {
			pr_msg = true;
		}