* [PATCH] mmc: sdhci-of-dwcmshc: Use inverted-wp quirk for CV18xx and SG200x SoCs
@ 2024-05-31 14:13 Haylen Chu
2024-06-12 8:11 ` Adrian Hunter
2024-06-13 13:03 ` Jisheng Zhang
0 siblings, 2 replies; 6+ messages in thread
From: Haylen Chu @ 2024-05-31 14:13 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson, Jisheng Zhang
Cc: linux-mmc, linux-kernel, Haylen Chu
MMC controller integrated in Sophgo CV18xx and SG200x SoCs has an
inverted write-protect flag, causing SDCards misdetected as read-only.
So set SDHCI_QURIK_INVERTED_WRITE_PROTECT to make write protection work
correctly.
Fixes: 017199c2849c ("mmc: sdhci-of-dwcmshc: Add support for Sophgo CV1800B and SG2002")
Signed-off-by: Haylen Chu <heylenay@outlook.com>
---
drivers/mmc/host/sdhci-of-dwcmshc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
index 39edf04fedcf..62b7f28de54f 100644
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -962,7 +962,8 @@ static const struct sdhci_pltfm_data sdhci_dwcmshc_th1520_pdata = {
static const struct sdhci_pltfm_data sdhci_dwcmshc_cv18xx_pdata = {
.ops = &sdhci_dwcmshc_cv18xx_ops,
- .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
+ .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
+ SDHCI_QUIRK_INVERTED_WRITE_PROTECT,
.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
};
--
2.45.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] mmc: sdhci-of-dwcmshc: Use inverted-wp quirk for CV18xx and SG200x SoCs
2024-05-31 14:13 [PATCH] mmc: sdhci-of-dwcmshc: Use inverted-wp quirk for CV18xx and SG200x SoCs Haylen Chu
@ 2024-06-12 8:11 ` Adrian Hunter
2024-06-13 13:03 ` Jisheng Zhang
1 sibling, 0 replies; 6+ messages in thread
From: Adrian Hunter @ 2024-06-12 8:11 UTC (permalink / raw)
To: Haylen Chu, Ulf Hansson, Jisheng Zhang; +Cc: linux-mmc, linux-kernel
On 31/05/24 17:13, Haylen Chu wrote:
> MMC controller integrated in Sophgo CV18xx and SG200x SoCs has an
> inverted write-protect flag, causing SDCards misdetected as read-only.
Is it the SDHCI_WRITE_PROTECT bit of the SDHCI_PRESENT_STATE
register that needs to be inverted?
> So set SDHCI_QURIK_INVERTED_WRITE_PROTECT to make write protection work
> correctly.
>
> Fixes: 017199c2849c ("mmc: sdhci-of-dwcmshc: Add support for Sophgo CV1800B and SG2002")
> Signed-off-by: Haylen Chu <heylenay@outlook.com>
> ---
> drivers/mmc/host/sdhci-of-dwcmshc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
> index 39edf04fedcf..62b7f28de54f 100644
> --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
> @@ -962,7 +962,8 @@ static const struct sdhci_pltfm_data sdhci_dwcmshc_th1520_pdata = {
>
> static const struct sdhci_pltfm_data sdhci_dwcmshc_cv18xx_pdata = {
> .ops = &sdhci_dwcmshc_cv18xx_ops,
> - .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
> + .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
> + SDHCI_QUIRK_INVERTED_WRITE_PROTECT,
> .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
> };
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mmc: sdhci-of-dwcmshc: Use inverted-wp quirk for CV18xx and SG200x SoCs
2024-05-31 14:13 [PATCH] mmc: sdhci-of-dwcmshc: Use inverted-wp quirk for CV18xx and SG200x SoCs Haylen Chu
2024-06-12 8:11 ` Adrian Hunter
@ 2024-06-13 13:03 ` Jisheng Zhang
2024-06-13 13:15 ` Jisheng Zhang
2024-06-18 9:13 ` Haylen Chu
1 sibling, 2 replies; 6+ messages in thread
From: Jisheng Zhang @ 2024-06-13 13:03 UTC (permalink / raw)
To: Haylen Chu; +Cc: Adrian Hunter, Ulf Hansson, linux-mmc, linux-kernel
On Fri, May 31, 2024 at 02:13:47PM +0000, Haylen Chu wrote:
> MMC controller integrated in Sophgo CV18xx and SG200x SoCs has an
> inverted write-protect flag, causing SDCards misdetected as read-only.
> So set SDHCI_QURIK_INVERTED_WRITE_PROTECT to make write protection work
> correctly.
No, I would rather set cd-inverted property in dts.
>
> Fixes: 017199c2849c ("mmc: sdhci-of-dwcmshc: Add support for Sophgo CV1800B and SG2002")
> Signed-off-by: Haylen Chu <heylenay@outlook.com>
> ---
> drivers/mmc/host/sdhci-of-dwcmshc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
> index 39edf04fedcf..62b7f28de54f 100644
> --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
> @@ -962,7 +962,8 @@ static const struct sdhci_pltfm_data sdhci_dwcmshc_th1520_pdata = {
>
> static const struct sdhci_pltfm_data sdhci_dwcmshc_cv18xx_pdata = {
> .ops = &sdhci_dwcmshc_cv18xx_ops,
> - .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
> + .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
> + SDHCI_QUIRK_INVERTED_WRITE_PROTECT,
> .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
> };
>
> --
> 2.45.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mmc: sdhci-of-dwcmshc: Use inverted-wp quirk for CV18xx and SG200x SoCs
2024-06-13 13:03 ` Jisheng Zhang
@ 2024-06-13 13:15 ` Jisheng Zhang
2024-06-13 13:26 ` Jisheng Zhang
2024-06-18 9:13 ` Haylen Chu
1 sibling, 1 reply; 6+ messages in thread
From: Jisheng Zhang @ 2024-06-13 13:15 UTC (permalink / raw)
To: Haylen Chu; +Cc: Adrian Hunter, Ulf Hansson, linux-mmc, linux-kernel
On Thu, Jun 13, 2024 at 09:03:24PM +0800, Jisheng Zhang wrote:
> On Fri, May 31, 2024 at 02:13:47PM +0000, Haylen Chu wrote:
> > MMC controller integrated in Sophgo CV18xx and SG200x SoCs has an
> > inverted write-protect flag, causing SDCards misdetected as read-only.
> > So set SDHCI_QURIK_INVERTED_WRITE_PROTECT to make write protection work
> > correctly.
>
> No, I would rather set cd-inverted property in dts.
wp-inverted
> >
> > Fixes: 017199c2849c ("mmc: sdhci-of-dwcmshc: Add support for Sophgo CV1800B and SG2002")
> > Signed-off-by: Haylen Chu <heylenay@outlook.com>
> > ---
> > drivers/mmc/host/sdhci-of-dwcmshc.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
> > index 39edf04fedcf..62b7f28de54f 100644
> > --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> > +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
> > @@ -962,7 +962,8 @@ static const struct sdhci_pltfm_data sdhci_dwcmshc_th1520_pdata = {
> >
> > static const struct sdhci_pltfm_data sdhci_dwcmshc_cv18xx_pdata = {
> > .ops = &sdhci_dwcmshc_cv18xx_ops,
> > - .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
> > + .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
> > + SDHCI_QUIRK_INVERTED_WRITE_PROTECT,
> > .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
> > };
> >
> > --
> > 2.45.1
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mmc: sdhci-of-dwcmshc: Use inverted-wp quirk for CV18xx and SG200x SoCs
2024-06-13 13:15 ` Jisheng Zhang
@ 2024-06-13 13:26 ` Jisheng Zhang
0 siblings, 0 replies; 6+ messages in thread
From: Jisheng Zhang @ 2024-06-13 13:26 UTC (permalink / raw)
To: Haylen Chu; +Cc: Adrian Hunter, Ulf Hansson, linux-mmc, linux-kernel
On Thu, Jun 13, 2024 at 09:15:50PM +0800, Jisheng Zhang wrote:
> On Thu, Jun 13, 2024 at 09:03:24PM +0800, Jisheng Zhang wrote:
> > On Fri, May 31, 2024 at 02:13:47PM +0000, Haylen Chu wrote:
> > > MMC controller integrated in Sophgo CV18xx and SG200x SoCs has an
> > > inverted write-protect flag, causing SDCards misdetected as read-only.
> > > So set SDHCI_QURIK_INVERTED_WRITE_PROTECT to make write protection work
> > > correctly.
> >
> > No, I would rather set cd-inverted property in dts.
>
> wp-inverted
hmm, if I read the SCH correctly, there's no wp pin at all, so
disable-wp is better
>
> > >
> > > Fixes: 017199c2849c ("mmc: sdhci-of-dwcmshc: Add support for Sophgo CV1800B and SG2002")
> > > Signed-off-by: Haylen Chu <heylenay@outlook.com>
> > > ---
> > > drivers/mmc/host/sdhci-of-dwcmshc.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
> > > index 39edf04fedcf..62b7f28de54f 100644
> > > --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> > > +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
> > > @@ -962,7 +962,8 @@ static const struct sdhci_pltfm_data sdhci_dwcmshc_th1520_pdata = {
> > >
> > > static const struct sdhci_pltfm_data sdhci_dwcmshc_cv18xx_pdata = {
> > > .ops = &sdhci_dwcmshc_cv18xx_ops,
> > > - .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
> > > + .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
> > > + SDHCI_QUIRK_INVERTED_WRITE_PROTECT,
> > > .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
> > > };
> > >
> > > --
> > > 2.45.1
> > >
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mmc: sdhci-of-dwcmshc: Use inverted-wp quirk for CV18xx and SG200x SoCs
2024-06-13 13:03 ` Jisheng Zhang
2024-06-13 13:15 ` Jisheng Zhang
@ 2024-06-18 9:13 ` Haylen Chu
1 sibling, 0 replies; 6+ messages in thread
From: Haylen Chu @ 2024-06-18 9:13 UTC (permalink / raw)
To: Jisheng Zhang; +Cc: Adrian Hunter, Ulf Hansson, linux-mmc, linux-kernel
On Thu, Jun 13, 2024 at 09:03:20PM +0800, Jisheng Zhang wrote:
> On Fri, May 31, 2024 at 02:13:47PM +0000, Haylen Chu wrote:
> > MMC controller integrated in Sophgo CV18xx and SG200x SoCs has an
> > inverted write-protect flag, causing SDCards misdetected as read-only.
> > So set SDHCI_QURIK_INVERTED_WRITE_PROTECT to make write protection work
> > correctly.
>
> No, I would rather set cd-inverted property in dts.
Okay, I will fix it it in dts instead.
Thanks,
Haylen Chu
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-06-18 9:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-31 14:13 [PATCH] mmc: sdhci-of-dwcmshc: Use inverted-wp quirk for CV18xx and SG200x SoCs Haylen Chu
2024-06-12 8:11 ` Adrian Hunter
2024-06-13 13:03 ` Jisheng Zhang
2024-06-13 13:15 ` Jisheng Zhang
2024-06-13 13:26 ` Jisheng Zhang
2024-06-18 9:13 ` Haylen Chu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox