* [PATCH] mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data
@ 2023-03-14 22:06 Georgii Kruglov
2023-03-15 10:30 ` Adrian Hunter
2023-03-21 20:37 ` [PATCH v2] " Georgii Kruglov
0 siblings, 2 replies; 4+ messages in thread
From: Georgii Kruglov @ 2023-03-14 22:06 UTC (permalink / raw)
To: Adrian Hunter
Cc: Georgii Kruglov, Ulf Hansson, Yinbo Zhu, Yangbo Lu, linux-mmc,
linux-kernel
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: 1f1929f3f2fa ("mmc: sdhci-of-esdhc: add quirk to ignore command inhibit for data")
Signed-off-by: Georgii Kruglov <georgy.kruglov@yandex.ru>
---
drivers/mmc/host/sdhci-of-esdhc.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 4712adac7f7c..cdbf1b6e1313 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -133,6 +133,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
@@ -144,6 +145,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 == true)
+ ret &= ~SDHCI_DATA_INHIBIT;
return ret;
}
@@ -158,19 +169,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;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data
2023-03-14 22:06 [PATCH] mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data Georgii Kruglov
@ 2023-03-15 10:30 ` Adrian Hunter
2023-03-21 20:37 ` [PATCH v2] " Georgii Kruglov
1 sibling, 0 replies; 4+ messages in thread
From: Adrian Hunter @ 2023-03-15 10:30 UTC (permalink / raw)
To: Georgii Kruglov
Cc: Ulf Hansson, Yinbo Zhu, Yangbo Lu, linux-mmc, linux-kernel
On 15/03/23 00:06, Georgii Kruglov wrote:
> 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: 1f1929f3f2fa ("mmc: sdhci-of-esdhc: add quirk to ignore command inhibit for data")
> Signed-off-by: Georgii Kruglov <georgy.kruglov@yandex.ru>
Minor comment, otherwise:
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/host/sdhci-of-esdhc.c | 24 +++++++++++-------------
> 1 file changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index 4712adac7f7c..cdbf1b6e1313 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -133,6 +133,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
> @@ -144,6 +145,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 == true)
Might as well drop the redundant '== true'
> + ret &= ~SDHCI_DATA_INHIBIT;
> return ret;
> }
>
> @@ -158,19 +169,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;
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data
2023-03-14 22:06 [PATCH] mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data Georgii Kruglov
2023-03-15 10:30 ` Adrian Hunter
@ 2023-03-21 20:37 ` Georgii Kruglov
2023-03-23 12:13 ` Ulf Hansson
1 sibling, 1 reply; 4+ messages in thread
From: Georgii Kruglov @ 2023-03-21 20:37 UTC (permalink / raw)
To: Adrian Hunter
Cc: Georgii Kruglov, Ulf Hansson, Yangbo Lu, Yinbo Zhu, linux-mmc,
linux-kernel, lvc-project
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: 1f1929f3f2fa ("mmc: sdhci-of-esdhc: add quirk to ignore command inhibit for data")
Signed-off-by: Georgii Kruglov <georgy.kruglov@yandex.ru>
---
v2: Drop the redundant '== true' as Adrian Hunter <adrian.hunter@intel.com> suggested.
drivers/mmc/host/sdhci-of-esdhc.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 4712adac7f7c..48ca1cf15b19 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -133,6 +133,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
@@ -144,6 +145,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;
}
@@ -158,19 +169,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;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data
2023-03-21 20:37 ` [PATCH v2] " Georgii Kruglov
@ 2023-03-23 12:13 ` Ulf Hansson
0 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2023-03-23 12:13 UTC (permalink / raw)
To: Georgii Kruglov
Cc: Adrian Hunter, Yangbo Lu, Yinbo Zhu, linux-mmc, linux-kernel,
lvc-project
On Tue, 21 Mar 2023 at 21:37, Georgii Kruglov <georgy.kruglov@yandex.ru> wrote:
>
> 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: 1f1929f3f2fa ("mmc: sdhci-of-esdhc: add quirk to ignore command inhibit for data")
> Signed-off-by: Georgii Kruglov <georgy.kruglov@yandex.ru>
Next time, please include acks according to earlier replies. This time
I have added Adrian's ack.
Applied for next, thanks!
Kind regards
Uffe
> ---
> v2: Drop the redundant '== true' as Adrian Hunter <adrian.hunter@intel.com> suggested.
> drivers/mmc/host/sdhci-of-esdhc.c | 24 +++++++++++-------------
> 1 file changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index 4712adac7f7c..48ca1cf15b19 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -133,6 +133,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
> @@ -144,6 +145,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;
> }
>
> @@ -158,19 +169,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;
> }
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-23 12:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14 22:06 [PATCH] mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data Georgii Kruglov
2023-03-15 10:30 ` Adrian Hunter
2023-03-21 20:37 ` [PATCH v2] " Georgii Kruglov
2023-03-23 12:13 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).