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

Commit 0a6d476d authored by Georgii Kruglov's avatar Georgii Kruglov Committed by Greg Kroah-Hartman
Browse files

mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data



[ Upstream commit 0dd8316037a2a6d85b2be208bef9991de7b42170 ]

If spec_reg is equal to 'SDHCI_PRESENT_STATE', esdhc_readl_fixup()
fixes up register value and returns it immediately. As a result, the
further block
(spec_reg == SDHCI_PRESENT_STATE)
    &&(esdhc->quirk_ignore_data_inhibit == true),
is never executed.

The patch merges the second block into the first one.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 1f1929f3 ("mmc: sdhci-of-esdhc: add quirk to ignore command inhibit for data")
Signed-off-by: default avatarGeorgii Kruglov <georgy.kruglov@yandex.ru>
Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20230321203715.3975-1-georgy.kruglov@yandex.ru


Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent f79421c3
Loading
Loading
Loading
Loading
+11 −13
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,
			return ret;
		}
	}

	/*
	 * The DAT[3:0] line signal levels and the CMD line signal level are
	 * not compatible with standard SDHC register. The line signal levels
@@ -135,6 +136,16 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,
		ret = value & 0x000fffff;
		ret |= (value >> 4) & SDHCI_DATA_LVL_MASK;
		ret |= (value << 1) & SDHCI_CMD_LVL;

		/*
		 * Some controllers have unreliable Data Line Active
		 * bit for commands with busy signal. This affects
		 * Command Inhibit (data) bit. Just ignore it since
		 * MMC core driver has already polled card status
		 * with CMD13 after any command with busy siganl.
		 */
		if (esdhc->quirk_ignore_data_inhibit)
			ret &= ~SDHCI_DATA_INHIBIT;
		return ret;
	}

@@ -149,19 +160,6 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,
		return ret;
	}

	/*
	 * Some controllers have unreliable Data Line Active
	 * bit for commands with busy signal. This affects
	 * Command Inhibit (data) bit. Just ignore it since
	 * MMC core driver has already polled card status
	 * with CMD13 after any command with busy siganl.
	 */
	if ((spec_reg == SDHCI_PRESENT_STATE) &&
	(esdhc->quirk_ignore_data_inhibit == true)) {
		ret = value & ~SDHCI_DATA_INHIBIT;
		return ret;
	}

	ret = value;
	return ret;
}