linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V1 1/1] mmc: sdhci-pci-o2micro: fix card detect fail issue caused by CD# debounce timeout
@ 2022-11-04  9:55 Chevron Li
  2022-11-07 20:13 ` Ulf Hansson
  0 siblings, 1 reply; 4+ messages in thread
From: Chevron Li @ 2022-11-04  9:55 UTC (permalink / raw)
  To: adrian.hunter, ulf.hansson, linux-mmc, linux-kernel
  Cc: shaper.liu, xiaoguang.yu, shirley.her, louis.lu

The SD card is recognized failed sometimes when resume from suspend.
Because CD# debounce time too long then card present report wrong.
Finally, card is recognized failed.

Signed-off-by: Chevron Li <chevron.li@bayhubtech.com>
---
Change in V1:
Adjust bayhub chip setting for CD# debounce time to minimum value
---
 drivers/mmc/host/sdhci-pci-o2micro.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c
index ad457cd9cbaa..bca1d095b759 100644
--- a/drivers/mmc/host/sdhci-pci-o2micro.c
+++ b/drivers/mmc/host/sdhci-pci-o2micro.c
@@ -32,6 +32,7 @@
 #define O2_SD_CAPS		0xE0
 #define O2_SD_ADMA1		0xE2
 #define O2_SD_ADMA2		0xE7
+#define O2_SD_MISC_CTRL2	0xF0
 #define O2_SD_INF_MOD		0xF1
 #define O2_SD_MISC_CTRL4	0xFC
 #define O2_SD_MISC_CTRL		0x1C0
@@ -877,6 +878,12 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
 		/* Set Tuning Windows to 5 */
 		pci_write_config_byte(chip->pdev,
 				O2_SD_TUNING_CTRL, 0x55);
+		//Adjust 1st and 2nd CD debounce time
+		pci_read_config_dword(chip->pdev, O2_SD_MISC_CTRL2, &scratch_32);
+		scratch_32 &= 0xFFE7FFFF;
+		scratch_32 |= 0x00180000;
+		pci_write_config_dword(chip->pdev, O2_SD_MISC_CTRL2, scratch_32);
+		pci_write_config_dword(chip->pdev, O2_SD_DETECT_SETTING, 1);
 		/* Lock WP */
 		ret = pci_read_config_byte(chip->pdev,
 					   O2_SD_LOCK_WP, &scratch);

base-commit: ee6050c8af96bba2f81e8b0793a1fc2f998fcd20
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V1 1/1] mmc: sdhci-pci-o2micro: fix card detect fail issue caused by CD# debounce timeout
  2022-11-04  9:55 [PATCH V1 1/1] mmc: sdhci-pci-o2micro: fix card detect fail issue caused by CD# debounce timeout Chevron Li
@ 2022-11-07 20:13 ` Ulf Hansson
  2022-11-16  6:04   ` Louis Lu(TP)
  0 siblings, 1 reply; 4+ messages in thread
From: Ulf Hansson @ 2022-11-07 20:13 UTC (permalink / raw)
  To: Chevron Li
  Cc: adrian.hunter, linux-mmc, linux-kernel, shaper.liu, xiaoguang.yu,
	shirley.her, louis.lu

On Fri, 4 Nov 2022 at 10:55, Chevron Li <chevron.li@bayhubtech.com> wrote:
>
> The SD card is recognized failed sometimes when resume from suspend.
> Because CD# debounce time too long then card present report wrong.
> Finally, card is recognized failed.
>
> Signed-off-by: Chevron Li <chevron.li@bayhubtech.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
> Change in V1:
> Adjust bayhub chip setting for CD# debounce time to minimum value
> ---
>  drivers/mmc/host/sdhci-pci-o2micro.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c
> index ad457cd9cbaa..bca1d095b759 100644
> --- a/drivers/mmc/host/sdhci-pci-o2micro.c
> +++ b/drivers/mmc/host/sdhci-pci-o2micro.c
> @@ -32,6 +32,7 @@
>  #define O2_SD_CAPS             0xE0
>  #define O2_SD_ADMA1            0xE2
>  #define O2_SD_ADMA2            0xE7
> +#define O2_SD_MISC_CTRL2       0xF0
>  #define O2_SD_INF_MOD          0xF1
>  #define O2_SD_MISC_CTRL4       0xFC
>  #define O2_SD_MISC_CTRL                0x1C0
> @@ -877,6 +878,12 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
>                 /* Set Tuning Windows to 5 */
>                 pci_write_config_byte(chip->pdev,
>                                 O2_SD_TUNING_CTRL, 0x55);
> +               //Adjust 1st and 2nd CD debounce time
> +               pci_read_config_dword(chip->pdev, O2_SD_MISC_CTRL2, &scratch_32);
> +               scratch_32 &= 0xFFE7FFFF;
> +               scratch_32 |= 0x00180000;
> +               pci_write_config_dword(chip->pdev, O2_SD_MISC_CTRL2, scratch_32);
> +               pci_write_config_dword(chip->pdev, O2_SD_DETECT_SETTING, 1);
>                 /* Lock WP */
>                 ret = pci_read_config_byte(chip->pdev,
>                                            O2_SD_LOCK_WP, &scratch);
>
> base-commit: ee6050c8af96bba2f81e8b0793a1fc2f998fcd20
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH V1 1/1] mmc: sdhci-pci-o2micro: fix card detect fail issue caused by CD# debounce timeout
  2022-11-07 20:13 ` Ulf Hansson
@ 2022-11-16  6:04   ` Louis Lu(TP)
  2022-11-16 13:05     ` Ulf Hansson
  0 siblings, 1 reply; 4+ messages in thread
From: Louis Lu(TP) @ 2022-11-16  6:04 UTC (permalink / raw)
  To: Ulf Hansson, Chevron Li (WH)
  Cc: adrian.hunter, linux-mmc, linux-kernel, Shaper Liu (WH),
	XiaoGuang Yu (WH), Shirley Her(SC)

Hi Uffe,

May we check when this update patched will be phased in?

Thanks,
Best Regards,
Louis Lu

-----Original Message-----
From: Ulf Hansson <ulf.hansson@linaro.org> 
Sent: Tuesday, November 8, 2022 4:13 AM
To: Chevron Li (WH) <chevron.li@bayhubtech.com>
Cc: adrian.hunter@intel.com; linux-mmc@vger.kernel.org; linux-kernel@vger.kernel.org; Shaper Liu (WH) <shaper.liu@bayhubtech.com>; XiaoGuang Yu (WH) <xiaoguang.yu@bayhubtech.com>; Shirley Her(SC) <shirley.her@bayhubtech.com>; Louis Lu(TP) <louis.lu@bayhubtech.com>
Subject: Re: [PATCH V1 1/1] mmc: sdhci-pci-o2micro: fix card detect fail issue caused by CD# debounce timeout

On Fri, 4 Nov 2022 at 10:55, Chevron Li <chevron.li@bayhubtech.com> wrote:
>
> The SD card is recognized failed sometimes when resume from suspend.
> Because CD# debounce time too long then card present report wrong.
> Finally, card is recognized failed.
>
> Signed-off-by: Chevron Li <chevron.li@bayhubtech.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
> Change in V1:
> Adjust bayhub chip setting for CD# debounce time to minimum value
> ---
>  drivers/mmc/host/sdhci-pci-o2micro.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c
> index ad457cd9cbaa..bca1d095b759 100644
> --- a/drivers/mmc/host/sdhci-pci-o2micro.c
> +++ b/drivers/mmc/host/sdhci-pci-o2micro.c
> @@ -32,6 +32,7 @@
>  #define O2_SD_CAPS             0xE0
>  #define O2_SD_ADMA1            0xE2
>  #define O2_SD_ADMA2            0xE7
> +#define O2_SD_MISC_CTRL2       0xF0
>  #define O2_SD_INF_MOD          0xF1
>  #define O2_SD_MISC_CTRL4       0xFC
>  #define O2_SD_MISC_CTRL                0x1C0
> @@ -877,6 +878,12 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
>                 /* Set Tuning Windows to 5 */
>                 pci_write_config_byte(chip->pdev,
>                                 O2_SD_TUNING_CTRL, 0x55);
> +               //Adjust 1st and 2nd CD debounce time
> +               pci_read_config_dword(chip->pdev, O2_SD_MISC_CTRL2, &scratch_32);
> +               scratch_32 &= 0xFFE7FFFF;
> +               scratch_32 |= 0x00180000;
> +               pci_write_config_dword(chip->pdev, O2_SD_MISC_CTRL2, scratch_32);
> +               pci_write_config_dword(chip->pdev, O2_SD_DETECT_SETTING, 1);
>                 /* Lock WP */
>                 ret = pci_read_config_byte(chip->pdev,
>                                            O2_SD_LOCK_WP, &scratch);
>
> base-commit: ee6050c8af96bba2f81e8b0793a1fc2f998fcd20
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V1 1/1] mmc: sdhci-pci-o2micro: fix card detect fail issue caused by CD# debounce timeout
  2022-11-16  6:04   ` Louis Lu(TP)
@ 2022-11-16 13:05     ` Ulf Hansson
  0 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2022-11-16 13:05 UTC (permalink / raw)
  To: Louis Lu(TP)
  Cc: Chevron Li (WH),
	adrian.hunter, linux-mmc, linux-kernel, Shaper Liu (WH),
	XiaoGuang Yu (WH), Shirley Her(SC)

On Wed, 16 Nov 2022 at 07:04, Louis Lu(TP) <louis.lu@bayhubtech.com> wrote:
>
> Hi Uffe,
>
> May we check when this update patched will be phased in?

I realized that you probably want this to be applied as fix for
v6.1-rc, so I have moved the patch to the fixes branch. Moreover, I
will add a stable tag to it.

That means, the patch should show up in v6.1-rc6 next week and beyond
that, it should be tried to be picked up by maintainers of the
stable-kernels.

Kind regards
Uffe

>
> Thanks,
> Best Regards,
> Louis Lu
>
> -----Original Message-----
> From: Ulf Hansson <ulf.hansson@linaro.org>
> Sent: Tuesday, November 8, 2022 4:13 AM
> To: Chevron Li (WH) <chevron.li@bayhubtech.com>
> Cc: adrian.hunter@intel.com; linux-mmc@vger.kernel.org; linux-kernel@vger.kernel.org; Shaper Liu (WH) <shaper.liu@bayhubtech.com>; XiaoGuang Yu (WH) <xiaoguang.yu@bayhubtech.com>; Shirley Her(SC) <shirley.her@bayhubtech.com>; Louis Lu(TP) <louis.lu@bayhubtech.com>
> Subject: Re: [PATCH V1 1/1] mmc: sdhci-pci-o2micro: fix card detect fail issue caused by CD# debounce timeout
>
> On Fri, 4 Nov 2022 at 10:55, Chevron Li <chevron.li@bayhubtech.com> wrote:
> >
> > The SD card is recognized failed sometimes when resume from suspend.
> > Because CD# debounce time too long then card present report wrong.
> > Finally, card is recognized failed.
> >
> > Signed-off-by: Chevron Li <chevron.li@bayhubtech.com>
>
> Applied for next, thanks!
>
> Kind regards
> Uffe
>
>
> > ---
> > Change in V1:
> > Adjust bayhub chip setting for CD# debounce time to minimum value
> > ---
> >  drivers/mmc/host/sdhci-pci-o2micro.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c
> > index ad457cd9cbaa..bca1d095b759 100644
> > --- a/drivers/mmc/host/sdhci-pci-o2micro.c
> > +++ b/drivers/mmc/host/sdhci-pci-o2micro.c
> > @@ -32,6 +32,7 @@
> >  #define O2_SD_CAPS             0xE0
> >  #define O2_SD_ADMA1            0xE2
> >  #define O2_SD_ADMA2            0xE7
> > +#define O2_SD_MISC_CTRL2       0xF0
> >  #define O2_SD_INF_MOD          0xF1
> >  #define O2_SD_MISC_CTRL4       0xFC
> >  #define O2_SD_MISC_CTRL                0x1C0
> > @@ -877,6 +878,12 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
> >                 /* Set Tuning Windows to 5 */
> >                 pci_write_config_byte(chip->pdev,
> >                                 O2_SD_TUNING_CTRL, 0x55);
> > +               //Adjust 1st and 2nd CD debounce time
> > +               pci_read_config_dword(chip->pdev, O2_SD_MISC_CTRL2, &scratch_32);
> > +               scratch_32 &= 0xFFE7FFFF;
> > +               scratch_32 |= 0x00180000;
> > +               pci_write_config_dword(chip->pdev, O2_SD_MISC_CTRL2, scratch_32);
> > +               pci_write_config_dword(chip->pdev, O2_SD_DETECT_SETTING, 1);
> >                 /* Lock WP */
> >                 ret = pci_read_config_byte(chip->pdev,
> >                                            O2_SD_LOCK_WP, &scratch);
> >
> > base-commit: ee6050c8af96bba2f81e8b0793a1fc2f998fcd20
> > --
> > 2.25.1
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-16 13:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04  9:55 [PATCH V1 1/1] mmc: sdhci-pci-o2micro: fix card detect fail issue caused by CD# debounce timeout Chevron Li
2022-11-07 20:13 ` Ulf Hansson
2022-11-16  6:04   ` Louis Lu(TP)
2022-11-16 13:05     ` 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).