PATCH: rtsx_pci driver - don't disable the rts5229 card reader on Intel NUC boxes
bede03a579b3 introduced a bug which leaves the rts5229 PCI Express card reader on my Intel NUC6CAYH box.
The bug is in drivers/misc/cardreader/rtsx_pcr.c. A call to rtsx_pci_init_ocp() was added to rtsx_pci_init_hw(). At the call point, pcr->ops->init_ocp is NULL and pcr->option.ocp_en is 0, so in rtsx_pci_init_ocp() the cardreader gets disabled.
I've avoided this by making excution code that results in the reader being disabled conditional on the device not being an RTS5229. Of course, other rtsxxx card readers may also be disabled by this bug. I don't have the knowledge to address that, so I'll leave to the driver maintainers.
The patch to avoid the bug is attached.
bede03a579b3 introduced a bug which leaves the rts5229 PCI Express card reader on my Intel NUC6CAYH box.
The bug is in drivers/misc/cardreader/rtsx_pcr.c. A call to rtsx_pci_init_ocp() was added to rtsx_pci_init_hw(). At the call point, pcr->ops->init_ocp is NULL and pcr->option.ocp_en is 0, so in rtsx_pci_init_ocp() the cardreader gets disabled.
I've avoided this by making excution code that results in the reader being disabled conditional on the device not being an RTS5229. Of course, other rtsxxx card readers may also be disabled by this bug. I don't have the knowledge to address that, so I'll leave to the driver maintainers.
The patch to avoid the bug is attached.
Chris
drivers/misc/cardreader/rtsx_pcr.c renamed from drivers/misc/cardreader/rtsx_pcr.c.orig +7 -3
@@ -1200,9 +1200,13 @@ void rtsx_pci_init_ocp(struct rtsx_pcr * SD_OCP_GLITCH_MASK, pcr->hw_param.ocp_glitch);rtsx_pci_enable_ocp (pcr); }else { -/* OC power down */ -rtsx_pci_write_register (pcr,FPDCTL ,OC_POWER_DOWN , -OC_POWER_DOWN ); +/* On (some?) Intel NUC platforms, this disables +* the rts5229 cardreader, so don't do it +*/ +if (!CHK_PCI_PID (pcr,0x5229 )) +/* OC power down */ +rtsx_pci_write_register (pcr,FPDCTL ,OC_POWER_DOWN , +OC_POWER_DOWN ); } } }
Sorry, I should have said that the patch is against 5.7.12. It applies to upstream, but with offsets.
Quoted 31 lines · Chris Clayton
bede03a579b3introduced a bug which leaves the rts5229 PCI Express card reader on my Intel NUC6CAYH box.The bug is in
drivers/misc/cardreader/rtsx_pcr.c. A call tortsx_pci_init_ocp()was added tortsx_pci_init_hw(). At the call point,pcr->ops->init_ocpis NULL andpcr->option.ocp_enis 0, so inrtsx_pci_init_ocp()the cardreader gets disabled.I've avoided this by making excution code that results in the reader being disabled conditional on the device not being an RTS5229. Of course, other rtsxxx card readers may also be disabled by this bug. I don't have the knowledge to address that, so I'll leave to the driver maintainers.
The patch to avoid the bug is attached.
Fixes bede03a579b3 ("misc: rtsx: Enable OCP for rts522a rts524a rts525a rts5260")Signed-off-by Chris Clayton <[email protected]>
bede03a579b3introduced a bug which leaves the rts5229 PCI Express card reader on my Intel NUC6CAYH box.The bug is in
drivers/misc/cardreader/rtsx_pcr.c. A call tortsx_pci_init_ocp()was added tortsx_pci_init_hw(). At the call point,pcr->ops->init_ocpis NULL andpcr->option.ocp_enis 0, so inrtsx_pci_init_ocp()the cardreader gets disabled.I've avoided this by making excution code that results in the reader being disabled conditional on the device not being an RTS5229. Of course, other rtsxxx card readers may also be disabled by this bug. I don't have the knowledge to address that, so I'll leave to the driver maintainers.
The patch to avoid the bug is attached.
Chris
Hi Chris,
We don’t think this is our bug...
This register(FPDCTL) write to OC_POWER_DOWN is for our power saving feature, not to disable the reader
In your case, we cannot reproduce this on our side that we mention before, we don’t have the platform(Intel NUC Tall Arches Canyon NUC6CAYH Celeron J345) to see this issue But we think this issue maybe only on this platform, our RTS5229 works well on the new kernel all platform that we have
Ricky
Quoted 56 lines
-----Original Message-----
From: Chris Clayton [mailto:[email protected]]
Sent: Monday, August 03, 2020 3:59 AM
To: LKML; 吳昊澄 Ricky; [email protected]; [email protected]; [email protected]; Arnd Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesSorry, I should have said that the patch is against 5.7.12. It applies to upstream, but with offsets.
Quoted 1 line · Chris Clayton
bede03a579b3introduced a bug which leaves the rts5229 PCI Express cardreader on my Intel NUC6CAYH box.
Quoted 2 lines
The bug is in
drivers/misc/cardreader/rtsx_pcr.c. A call tortsx_pci_init_ocp()was added to
rtsx_pci_init_hw().Quoted 1 line
At the call point,
pcr->ops->init_ocpis NULL andpcr->option.ocp_enis 0, so in
rtsx_pci_init_ocp()the cardreaderQuoted 3 lines
gets disabled.
I've avoided this by making excution code that results in the reader being
disabled conditional on the device
Quoted 1 line
not being an RTS5229. Of course, other rtsxxx card readers may also be
disabled by this bug. I don't have the
Quoted 5 lines
knowledge to address that, so I'll leave to the driver maintainers.
The patch to avoid the bug is attached.
Fixes bede03a579b3 ("misc: rtsx: Enable OCP for rts522a rts524a rts525arts5260")
Quoted 5 lines
Signed-off-by Chris Clayton <[email protected]>
bede03a579b3introduced a bug which leaves the rts5229 PCI Express cardreader on my Intel NUC6CAYH box.
Quoted 2 lines
The bug is in
drivers/misc/cardreader/rtsx_pcr.c. A call tortsx_pci_init_ocp()was added to
rtsx_pci_init_hw().Quoted 1 line
At the call point,
pcr->ops->init_ocpis NULL andpcr->option.ocp_enis 0, so in
rtsx_pci_init_ocp()the cardreaderQuoted 3 lines
gets disabled.
I've avoided this by making excution code that results in the reader being
disabled conditional on the device
Quoted 1 line
not being an RTS5229. Of course, other rtsxxx card readers may also be
disabled by this bug. I don't have the
Quoted 6 lines
knowledge to address that, so I'll leave to the driver maintainers.
The patch to avoid the bug is attached.
Chris
------Please consider the environment before printing this e-mail.
Hi, Ricky
Quoted 8 lines · 吳昊澄 Ricky
Hi Chris,
We don’t think this is our bug...
This register(FPDCTL) write toOC_POWER_DOWNis for our power saving feature, not to disable the reader
In your case, we cannot reproduce this on our side that we mention before, we don’t have the platform(Intel NUC Tall Arches Canyon NUC6CAYH Celeron J345) to see this issue But we think this issue maybe only on this platform, our RTS5229 works well on the new kernel all platform that we haveRicky
Perhaps I should have used the word regression rather than bug. I didn't buy the machine until earlier this year, but other people who have reported this problem have indicated that until bede03a579b3 was applied (during the 5.1 merge window), the driver supported the card reader on this on the Intel NUC boxes. I know that is true because I built and tested a 5.0 kernel and the card reader worked fine. I've also built and tested an 5.1-rc1 kernel and the card reader no longer works. Whether by design or by accident, the card reader worked and now it doesn't. That's a regression in my book!
Since you signed off the patch that caused the regression, I believe it is your bug.
Thanks.
Chris
Quoted 57 lines
Quoted 57 lines
-----Original Message-----
From: Chris Clayton [mailto:[email protected]]
Sent: Monday, August 03, 2020 3:59 AM
To: LKML; 吳昊澄 Ricky; [email protected]; [email protected]; [email protected]; Arnd Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesSorry, I should have said that the patch is against 5.7.12. It applies to upstream, but with offsets.
Quoted 1 line · Chris Clayton
bede03a579b3introduced a bug which leaves the rts5229 PCI Express cardreader on my Intel NUC6CAYH box.
Quoted 2 lines
The bug is in
drivers/misc/cardreader/rtsx_pcr.c. A call tortsx_pci_init_ocp()was added to
rtsx_pci_init_hw().Quoted 1 line
At the call point,
pcr->ops->init_ocpis NULL andpcr->option.ocp_enis 0, so in
rtsx_pci_init_ocp()the cardreaderQuoted 3 lines
gets disabled.
I've avoided this by making excution code that results in the reader being
disabled conditional on the device
Quoted 1 line
not being an RTS5229. Of course, other rtsxxx card readers may also be
disabled by this bug. I don't have the
Quoted 5 lines
knowledge to address that, so I'll leave to the driver maintainers.
The patch to avoid the bug is attached.
Fixes bede03a579b3 ("misc: rtsx: Enable OCP for rts522a rts524a rts525arts5260")
Quoted 5 lines
Signed-off-by Chris Clayton <[email protected]>
bede03a579b3introduced a bug which leaves the rts5229 PCI Express cardreader on my Intel NUC6CAYH box.
Quoted 2 lines
The bug is in
drivers/misc/cardreader/rtsx_pcr.c. A call tortsx_pci_init_ocp()was added to
rtsx_pci_init_hw().Quoted 1 line
At the call point,
pcr->ops->init_ocpis NULL andpcr->option.ocp_enis 0, so in
rtsx_pci_init_ocp()the cardreaderQuoted 3 lines
gets disabled.
I've avoided this by making excution code that results in the reader being
disabled conditional on the device
Quoted 1 line
not being an RTS5229. Of course, other rtsxxx card readers may also be
disabled by this bug. I don't have the
Quoted 6 lines
knowledge to address that, so I'll leave to the driver maintainers.
The patch to avoid the bug is attached.
Chris
------Please consider the environment before printing this e-mail.
Hi Chris,
rtsx_pci_write_register(pcr, FPDTL, OC_POWER_DOWN, OC_POWER_DOWN);
This register operation saved power under 1mA, so if do not care the 1mA power we can have a patch to remove it, make compatible with NUC6 We tested others our card reader that remove it, we did not see any side effect
Hi Greg k-h,
Do you have any comments?
thanks
Ricky
Quoted 56 lines
-----Original Message-----
From: Chris Clayton [mailto:[email protected]]
Sent: Monday, August 03, 2020 3:59 AM
To: LKML; 吳昊澄 Ricky; [email protected]; [email protected]; [email protected]; Arnd Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesSorry, I should have said that the patch is against 5.7.12. It applies to upstream, but with offsets.
Quoted 1 line · Chris Clayton
bede03a579b3introduced a bug which leaves the rts5229 PCI Express cardreader on my Intel NUC6CAYH box.
Quoted 2 lines
The bug is in
drivers/misc/cardreader/rtsx_pcr.c. A call tortsx_pci_init_ocp()was added to
rtsx_pci_init_hw().Quoted 1 line
At the call point,
pcr->ops->init_ocpis NULL andpcr->option.ocp_enis 0, so in
rtsx_pci_init_ocp()the cardreaderQuoted 3 lines
gets disabled.
I've avoided this by making excution code that results in the reader being
disabled conditional on the device
Quoted 1 line
not being an RTS5229. Of course, other rtsxxx card readers may also be
disabled by this bug. I don't have the
Quoted 5 lines
knowledge to address that, so I'll leave to the driver maintainers.
The patch to avoid the bug is attached.
Fixes bede03a579b3 ("misc: rtsx: Enable OCP for rts522a rts524a rts525arts5260")
Quoted 5 lines
Signed-off-by Chris Clayton <[email protected]>
bede03a579b3introduced a bug which leaves the rts5229 PCI Express cardreader on my Intel NUC6CAYH box.
Quoted 2 lines
The bug is in
drivers/misc/cardreader/rtsx_pcr.c. A call tortsx_pci_init_ocp()was added to
rtsx_pci_init_hw().Quoted 1 line
At the call point,
pcr->ops->init_ocpis NULL andpcr->option.ocp_enis 0, so in
rtsx_pci_init_ocp()the cardreaderQuoted 3 lines
gets disabled.
I've avoided this by making excution code that results in the reader being
disabled conditional on the device
Quoted 1 line
not being an RTS5229. Of course, other rtsxxx card readers may also be
disabled by this bug. I don't have the
Quoted 6 lines
knowledge to address that, so I'll leave to the driver maintainers.
The patch to avoid the bug is attached.
Chris
------Please consider the environment before printing this e-mail.
[email protected]
maintainerQuoted 9 lines · 吳昊澄 Ricky
Hi Chris,
rtsx_pci_write_register(pcr, FPDTL, OC_POWER_DOWN, OC_POWER_DOWN);
This register operation saved power under 1mA, so if do not care the 1mA power we can have a patch to remove it, make compatible with NUC6 We tested others our card reader that remove it, we did not see any side effectHi Greg k-h,
Do you have any comments?
comments on what? I don't know what you are responding to here, sorry.
greg k-h
Quoted 14 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 3:49 PM
To: 吳昊澄 Ricky
Cc: Chris Clayton; LKML; [email protected]; [email protected]; Arnd Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesQuoted 4 lines · 吳昊澄 Ricky
Hi Chris,
rtsx_pci_write_register(pcr, FPDTL, OC_POWER_DOWN, OC_POWER_DOWN); This register operation saved power under 1mA, so if do not care the 1mA
Quoted 9 lines
power we can have a patch to remove it, make compatible with NUC6
Quoted 5 lines
We tested others our card reader that remove it, we did not see any side effect
Hi Greg k-h,
Do you have any comments?
comments on what? I don't know what you are responding to here, sorry.
Can we have a patch to kernel for NUC6? It may cause more power(1mA) but it will have more compatibility
Quoted 3 lines
greg k-h
------Please consider the environment before printing this e-mail.
[email protected]
maintainerQuoted 17 lines · 吳昊澄 Ricky
Quoted 17 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 3:49 PM
To: 吳昊澄 Ricky
Cc: Chris Clayton; LKML; [email protected]; [email protected]; Arnd Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesQuoted 4 lines · 吳昊澄 Ricky
Hi Chris,
rtsx_pci_write_register(pcr, FPDTL, OC_POWER_DOWN, OC_POWER_DOWN); This register operation saved power under 1mA, so if do not care the 1mApower we can have a patch to remove it, make compatible with NUC6
Quoted 2 lines
We tested others our card reader that remove it, we did not see any side effect
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Hi Greg k-h,
Do you have any comments?
comments on what? I don't know what you are responding to here, sorry.
Can we have a patch to kernel for NUC6? It may cause more power(1mA) but it will have more compatibility
I do not understand at all, sorry.
greg k-h
Quoted 17 lines · 吳昊澄 Ricky
Quoted 17 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 3:49 PM
To: 吳昊澄 Ricky
Cc: Chris Clayton; LKML; [email protected]; [email protected]; Arnd Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesQuoted 4 lines · 吳昊澄 Ricky
Hi Chris,
rtsx_pci_write_register(pcr, FPDTL, OC_POWER_DOWN, OC_POWER_DOWN); This register operation saved power under 1mA, so if do not care the 1mApower we can have a patch to remove it, make compatible with NUC6
Quoted 2 lines
We tested others our card reader that remove it, we did not see any side effect
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Hi Greg k-h,
Do you have any comments?
comments on what? I don't know what you are responding to here, sorry.
Can we have a patch to kernel for NUC6? It may cause more power(1mA) but it will have more compatibility
Ricky,
I don't understand why you want to completely remove the code that sets up the 1mA power saving. That code was there even before your patch (bede03a579b3b4a036003c4862cc1baa4ddc351f), so I assume it benefits some of the Realtek card readers. Before your patch however, rtsx_pci_init_ocp() was not called for the rts5229 reader, but the patch introduced an unconditional call to that function into rtsx_pci_init_hw(), which is run for the rts5229. That is what now disables the card reader.
Now, I don't know whether other cards are affected, although I don't recall seeing any reported as I searched the kernel and ubuntu bugzillas for any analysis of the problem. I know this is not what the patch I sent does, but having thought about it more, seems to me that the simplest fix is to skip the new call to rtsx_pci_init_ocp() if the reader is an rts5229.
If you agree, I can prepare a patch and send it to you. Whatever the solution is, it will also be needed in the stable kernels later than 5.0.
Chris
Quoted 3 lines
Quoted 3 lines
greg k-h
------Please consider the environment before printing this e-mail.
Quoted 53 lines
-----Original Message-----
From: Chris Clayton [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 4:51 PM
To: 吳昊澄 Ricky; [email protected]
Cc: LKML; [email protected]; [email protected]; Arnd Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesQuoted 5 lines · 吳昊澄 Ricky
Quoted 5 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 3:49 PM
To: 吳昊澄 Ricky
Cc: Chris Clayton; LKML; [email protected]; [email protected];Arnd
Quoted 8 lines
Quoted 8 lines
Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesQuoted 3 lines · 吳昊澄 Ricky
Hi Chris,
rtsx_pci_write_register(pcr, FPDTL,
OC_POWER_DOWN,
OC_POWER_DOWN);Quoted 3 lines
Quoted 3 lines
Quoted 1 line
This register operation saved power under 1mA, so if do not care the 1mA
power we can have a patch to remove it, make compatible with NUC6
Quoted 1 line
We tested others our card reader that remove it, we did not see any side
effect
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Hi Greg k-h,
Do you have any comments?
comments on what? I don't know what you are responding to here, sorry.
Can we have a patch to kernel for NUC6? It may cause more power(1mA) but it
will have more compatibility
Quoted 1 line
Ricky,
I don't understand why you want to completely remove the code that sets up the 1mA power saving. That code was there
even before your patch (bede03a579b3b4a036003c4862cc1baa4ddc351f), so I assume it benefits some of the Realtek card
readers. Before your patch however,rtsx_pci_init_ocp()was not called for the rts5229 reader, but the patch introduced
an unconditional call to that function intortsx_pci_init_hw(), which is run for the rts5229. That is what now disables
the card reader.
Quoted 7 lines
Now, I don't know whether other cards are affected, although I don't recall seeing any reported as I searched the kernel
and ubuntu bugzillas for any analysis of the problem. I know this is not what the patch I sent does, but having thought
about it more, seems to me that the simplest fix is to skip the new call tortsx_pci_init_ocp()if the reader is an rts5229.
Because we are thinking about if others our card reader that not belong A series(my ocp patch coverage) also on NUC6 platform maybe have the same problem...
Quoted 4 lines
If you agree, I can prepare a patch and send it to you. Whatever the solution is, it will also be needed in the stable
kernels later than 5.0.
OK, I agree your opinion, for now can only patch rts5229 first make NUC6 user can work well
Thank you
Quoted 4 lines
Chris
Quoted 3 lines
Quoted 3 lines
greg k-h
------Please consider the environment before printing this e-mail.
Quoted 61 lines · 吳昊澄 Ricky
Quoted 53 lines
-----Original Message-----
From: Chris Clayton [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 4:51 PM
To: 吳昊澄 Ricky; [email protected]
Cc: LKML; [email protected]; [email protected]; Arnd Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesQuoted 5 lines · 吳昊澄 Ricky
Quoted 5 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 3:49 PM
To: 吳昊澄 Ricky
Cc: Chris Clayton; LKML; [email protected]; [email protected];Arnd
Quoted 8 lines
Quoted 8 lines
Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesQuoted 3 lines · 吳昊澄 Ricky
Hi Chris,
rtsx_pci_write_register(pcr, FPDTL,
OC_POWER_DOWN,
OC_POWER_DOWN);Quoted 3 lines
Quoted 3 lines
Quoted 1 line
This register operation saved power under 1mA, so if do not care the 1mA
power we can have a patch to remove it, make compatible with NUC6
Quoted 1 line
We tested others our card reader that remove it, we did not see any side
effect
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Hi Greg k-h,
Do you have any comments?
comments on what? I don't know what you are responding to here, sorry.
Can we have a patch to kernel for NUC6? It may cause more power(1mA) but it
will have more compatibility
Quoted 1 line
Ricky,
I don't understand why you want to completely remove the code that sets up the 1mA power saving. That code was there
even before your patch (bede03a579b3b4a036003c4862cc1baa4ddc351f), so I assume it benefits some of the Realtek card
readers. Before your patch however,rtsx_pci_init_ocp()was not called for the rts5229 reader, but the patch introduced
an unconditional call to that function intortsx_pci_init_hw(), which is run for the rts5229. That is what now disables
the card reader.Quoted 7 lines
Now, I don't know whether other cards are affected, although I don't recall seeing any reported as I searched the kernel
and ubuntu bugzillas for any analysis of the problem. I know this is not what the patch I sent does, but having thought
about it more, seems to me that the simplest fix is to skip the new call tortsx_pci_init_ocp()if the reader is an rts5229.
Quoted 2 lines
Because we are thinking about if others our card reader that not belong A series(my ocp patch coverage) also on NUC6 platform maybe have the same problem...
OK. What if we do make the new call but only for the card readers that are in the A series? Are they the ones that have PID_5nnn defines in include/linux/rtsx_pci.h? Or is there another simple way of identifying that a reader is a member of the A series?
I'm thinking of something like:
static bool rtsx_pci_is_series_A(pcr)
{
unsigned short device = pcr->pci->device;
return device == PID524A || device == PID_5249 || device == PID_5250 || device == PID_525A
|| device == PID_525A || device == PID_5260 || device == PID_5261;
}then in rtsx_pci_init_hw() change the unconditional call to:
if rtsx_pci_is_series_A(pcr) rtsx_pci_init_ocp();
Does that seem OK?
Quoted 13 lines
Quoted 4 lines
If you agree, I can prepare a patch and send it to you. Whatever the solution is, it will also be needed in the stable
kernels later than 5.0.OK, I agree your opinion, for now can only patch rts5229 first make NUC6 user can work well
Thank you
Quoted 4 lines
Chris
Quoted 3 lines
Quoted 3 lines
greg k-h
------Please consider the environment before printing this e-mail.
Quoted 101 lines
-----Original Message-----
From: Chris Clayton [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 7:52 PM
To: 吳昊澄 Ricky; [email protected]
Cc: LKML; [email protected]; [email protected]; Arnd Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesQuoted 11 lines · 吳昊澄 Ricky
Quoted 11 lines
-----Original Message-----
From: Chris Clayton [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 4:51 PM
To: 吳昊澄 Ricky; [email protected]
Cc: LKML; [email protected]; [email protected]; Arnd Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesOn 04/08/2020 09:08, 吳昊澄 Ricky wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 3:49 PM
To: 吳昊澄 Ricky
Cc: Chris Clayton; LKML; [email protected]; [email protected];Arnd
Quoted 2 lines
Quoted 2 lines
Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card readeron
Quoted 12 lines
Quoted 12 lines
Quoted 6 lines
Quoted 6 lines
Intel NUC boxes
Quoted 3 lines · 吳昊澄 Ricky
Hi Chris,
rtsx_pci_write_register(pcr, FPDTL,
OC_POWER_DOWN,
OC_POWER_DOWN);Quoted 3 lines
Quoted 3 lines
Quoted 1 line
This register operation saved power under 1mA, so if do not care the 1mA
power we can have a patch to remove it, make compatible with NUC6
Quoted 1 line
We tested others our card reader that remove it, we did not see any side
effect
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Hi Greg k-h,
Do you have any comments?
comments on what? I don't know what you are responding to here, sorry.
Can we have a patch to kernel for NUC6? It may cause more power(1mA) but
it
Quoted 6 lines
Quoted 6 lines
will have more compatibility
Quoted 1 line
Ricky,
I don't understand why you want to completely remove the code that sets up
the
Quoted 6 lines
Quoted 6 lines
1mA power saving. That code was there
even before your patch (bede03a579b3b4a036003c4862cc1baa4ddc351f), so I assume it benefits some of the Realtek card
readers. Before your patch however,rtsx_pci_init_ocp()was not called for the rts5229 reader, but the patch introduced
an unconditional call to that function intortsx_pci_init_hw(), which is run forthe
Quoted 6 lines
Quoted 6 lines
rts5229. That is what now disables
the card reader.Now, I don't know whether other cards are affected, although I don't recall seeing any reported as I searched the kernel
and ubuntu bugzillas for any analysis of the problem. I know this is not whatthe
Quoted 6 lines
Quoted 4 lines
patch I sent does, but having thought
about it more, seems to me that the simplest fix is to skip the new call tortsx_pci_init_ocp()if the reader is an rts5229.Because we are thinking about if others our card reader that not belong A
series(my ocp patch coverage) also on NUC6 platform maybe have the same problem...
Quoted 1 line
OK. What if we do make the new call but only for the card readers that are in the A series? Are they the ones that have
PID_5nnndefines ininclude/linux/rtsx_pci.h? Or is there another simple way of identifying that a reader is a member of
the A series?I'm thinking of something like:
static boolrtsx_pci_is_series_A(pcr){ unsigned short device = pcr->pci->device; return device == PID524A || device == PID_5249 || device == PID_5250 || device == PID_525A || device == PID_525A || device == PID_5260 || device ==
PID_5261;
}
Quoted 7 lines
then in
rtsx_pci_init_hw()change the unconditional call to:if rtsx_pci_is_series_A(pcr) rtsx_pci_init_ocp();Does that seem OK?
Previously, I want to remove
else {
/* OC power down */
rtsx_pci_write_register(pcr, FPDCTL, OC_POWER_DOWN,
OC_POWER_DOWN);
}Because in our A-series card Reader we already assigned option->ocp_en to 1 in self init_params() , this is an easy way to fix this problem
Quoted 15 lines
Quoted 1 line
Quoted 1 line
If you agree, I can prepare a patch and send it to you. Whatever the solution is,
it
Quoted 5 lines
Quoted 3 lines
will also be needed in the stable
kernels later than 5.0.OK, I agree your opinion, for now can only patch rts5229 first make NUC6 user
can work well
Quoted 7 lines
Thank you
Quoted 4 lines
Chris
Quoted 3 lines
Quoted 3 lines
greg k-h
------Please consider the environment before printing this e-mail.
Thanks, Ricky.
Quoted 108 lines · 吳昊澄 Ricky
Quoted 101 lines
-----Original Message-----
From: Chris Clayton [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 7:52 PM
To: 吳昊澄 Ricky; [email protected]
Cc: LKML; [email protected]; [email protected]; Arnd Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesQuoted 11 lines · 吳昊澄 Ricky
Quoted 11 lines
-----Original Message-----
From: Chris Clayton [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 4:51 PM
To: 吳昊澄 Ricky; [email protected]
Cc: LKML; [email protected]; [email protected]; Arnd Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesOn 04/08/2020 09:08, 吳昊澄 Ricky wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 3:49 PM
To: 吳昊澄 Ricky
Cc: Chris Clayton; LKML; [email protected]; [email protected];Arnd
Quoted 2 lines
Quoted 2 lines
Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card readeron
Quoted 12 lines
Quoted 12 lines
Quoted 6 lines
Quoted 6 lines
Intel NUC boxes
Quoted 3 lines · 吳昊澄 Ricky
Hi Chris,
rtsx_pci_write_register(pcr, FPDTL,
OC_POWER_DOWN,
OC_POWER_DOWN);Quoted 3 lines
Quoted 3 lines
Quoted 1 line
This register operation saved power under 1mA, so if do not care the 1mA
power we can have a patch to remove it, make compatible with NUC6
Quoted 1 line
We tested others our card reader that remove it, we did not see any side
effect
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Hi Greg k-h,
Do you have any comments?
comments on what? I don't know what you are responding to here, sorry.
Can we have a patch to kernel for NUC6? It may cause more power(1mA) but
it
Quoted 6 lines
Quoted 6 lines
will have more compatibility
Quoted 1 line
Ricky,
I don't understand why you want to completely remove the code that sets up
the
Quoted 6 lines
Quoted 6 lines
1mA power saving. That code was there
even before your patch (bede03a579b3b4a036003c4862cc1baa4ddc351f), so I assume it benefits some of the Realtek card
readers. Before your patch however,rtsx_pci_init_ocp()was not called for the rts5229 reader, but the patch introduced
an unconditional call to that function intortsx_pci_init_hw(), which is run forthe
Quoted 6 lines
Quoted 6 lines
rts5229. That is what now disables
the card reader.Now, I don't know whether other cards are affected, although I don't recall seeing any reported as I searched the kernel
and ubuntu bugzillas for any analysis of the problem. I know this is not whatthe
Quoted 6 lines
Quoted 4 lines
patch I sent does, but having thought
about it more, seems to me that the simplest fix is to skip the new call tortsx_pci_init_ocp()if the reader is an rts5229.Because we are thinking about if others our card reader that not belong A
series(my ocp patch coverage) also on NUC6 platform maybe have the same problem...
Quoted 1 line
OK. What if we do make the new call but only for the card readers that are in the A series? Are they the ones that have
PID_5nnndefines ininclude/linux/rtsx_pci.h? Or is there another simple way of identifying that a reader is a member of
the A series?I'm thinking of something like:
static boolrtsx_pci_is_series_A(pcr){ unsigned short device = pcr->pci->device; return device == PID524A || device == PID_5249 || device == PID_5250 || device == PID_525A || device == PID_525A || device == PID_5260 || device ==
PID_5261;
}Quoted 7 lines
then in
rtsx_pci_init_hw()change the unconditional call to:if rtsx_pci_is_series_A(pcr) rtsx_pci_init_ocp();Does that seem OK?
Quoted 8 lines
Previously, I want to remove
else { /* OC power down */ rtsx_pci_write_register(pcr, FPDCTL, OC_POWER_DOWN, OC_POWER_DOWN); }Because in our A-series card Reader we already assigned
option->ocp_ento 1 in selfinit_params(), this is an easy way to fix this problem
Ah, OK. I'll prepare the patch and send it to you once I've tested it.
Chris
Hi Ricky
Quoted 120 lines · Chris Clayton
Thanks, Ricky.
Quoted 108 lines · 吳昊澄 Ricky
Quoted 101 lines
-----Original Message-----
From: Chris Clayton [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 7:52 PM
To: 吳昊澄 Ricky; [email protected]
Cc: LKML; [email protected]; [email protected]; Arnd Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesQuoted 11 lines · 吳昊澄 Ricky
Quoted 11 lines
-----Original Message-----
From: Chris Clayton [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 4:51 PM
To: 吳昊澄 Ricky; [email protected]
Cc: LKML; [email protected]; [email protected]; Arnd Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card reader on Intel NUC boxesOn 04/08/2020 09:08, 吳昊澄 Ricky wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, August 04, 2020 3:49 PM
To: 吳昊澄 Ricky
Cc: Chris Clayton; LKML; [email protected]; [email protected];Arnd
Quoted 2 lines
Quoted 2 lines
Bergmann
Subject: Re: PATCH:rtsx_pcidriver - don't disable the rts5229 card readeron
Quoted 12 lines
Quoted 12 lines
Quoted 6 lines
Quoted 6 lines
Intel NUC boxes
Quoted 3 lines · 吳昊澄 Ricky
Hi Chris,
rtsx_pci_write_register(pcr, FPDTL,
OC_POWER_DOWN,
OC_POWER_DOWN);Quoted 3 lines
Quoted 3 lines
Quoted 1 line
This register operation saved power under 1mA, so if do not care the 1mA
power we can have a patch to remove it, make compatible with NUC6
Quoted 1 line
We tested others our card reader that remove it, we did not see any side
effect
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Hi Greg k-h,
Do you have any comments?
comments on what? I don't know what you are responding to here, sorry.
Can we have a patch to kernel for NUC6? It may cause more power(1mA) but
it
Quoted 6 lines
Quoted 6 lines
will have more compatibility
Quoted 1 line
Ricky,
I don't understand why you want to completely remove the code that sets up
the
Quoted 6 lines
Quoted 6 lines
1mA power saving. That code was there
even before your patch (bede03a579b3b4a036003c4862cc1baa4ddc351f), so I assume it benefits some of the Realtek card
readers. Before your patch however,rtsx_pci_init_ocp()was not called for the rts5229 reader, but the patch introduced
an unconditional call to that function intortsx_pci_init_hw(), which is run forthe
Quoted 6 lines
Quoted 6 lines
rts5229. That is what now disables
the card reader.Now, I don't know whether other cards are affected, although I don't recall seeing any reported as I searched the kernel
and ubuntu bugzillas for any analysis of the problem. I know this is not whatthe
Quoted 6 lines
Quoted 4 lines
patch I sent does, but having thought
about it more, seems to me that the simplest fix is to skip the new call tortsx_pci_init_ocp()if the reader is an rts5229.Because we are thinking about if others our card reader that not belong A
series(my ocp patch coverage) also on NUC6 platform maybe have the same problem...
Quoted 1 line
OK. What if we do make the new call but only for the card readers that are in the A series? Are they the ones that have
PID_5nnndefines ininclude/linux/rtsx_pci.h? Or is there another simple way of identifying that a reader is a member of
the A series?I'm thinking of something like:
static boolrtsx_pci_is_series_A(pcr){ unsigned short device = pcr->pci->device; return device == PID524A || device == PID_5249 || device == PID_5250 || device == PID_525A || device == PID_525A || device == PID_5260 || device ==
PID_5261;
}Quoted 7 lines
then in
rtsx_pci_init_hw()change the unconditional call to:if rtsx_pci_is_series_A(pcr) rtsx_pci_init_ocp();Does that seem OK?
Quoted 8 lines
Previously, I want to remove
else { /* OC power down */ rtsx_pci_write_register(pcr, FPDCTL, OC_POWER_DOWN, OC_POWER_DOWN); }Because in our A-series card Reader we already assigned
option->ocp_ento 1 in selfinit_params(), this is an easy way to fix this problem
Quoted 2 lines
Ah, OK. I'll prepare the patch and send it to you once I've tested it.
Please see the patch included below. As you suggested, it removes the code that does the OC power down on card readers that are not members of your A series. The patch is against a fresh pull of Linus's tree this morning (v5.8-2768-g4da9f3302615).
I've tested the resultant kernel on my Intel NUC6CAYH box (which contains an NUC66AYB board) and the rts5229 works fine. I've also tested it on my laptop which also has a card reader supported by the rtsx_pci driver (an RTL8411B) and that also works fine.
As I mentioned yesterday, I think it's a candidate for the 5.4 ans 5.7 stable series.
Thanks for your patience!
Chris
drivers/misc/cardreader/rtsx_pcr.c 2020-08-05 07:11:05.568074278 +0100 renamed from drivers/misc/cardreader/rtsx_pcr.c 2020-08-05 07:10:21.752072515 +0100 +0 -4
@@ -1172,10 +1172,6 @@ void rtsx_pci_init_ocp(struct rtsx_pcr * rtsx_pci_write_register(pcr, REG_OCPGLITCH, SD_OCP_GLITCH_MASK, pcr->hw_param.ocp_glitch); rtsx_pci_enable_ocp(pcr); - } else { - /* OC power down */ - rtsx_pci_write_register(pcr, FPDCTL, OC_POWER_DOWN, - OC_POWER_DOWN); } } }
Hi Ricky.
Quoted 1 line · Chris Clayton
Hi Ricky
<snip>
Quoted 25 lines
Quoted 3 lines
Ah, OK. I'll prepare the patch and send it to you once I've tested it.
Please see the patch included below. As you suggested, it removes the code that does the OC power down on card readers that are not members of your A series. The patch is against a fresh pull of Linus's tree this morning (v5.8-2768-g4da9f3302615).
I've tested the resultant kernel on my Intel NUC6CAYH box (which contains an NUC66AYB board) and the rts5229 works fine. I've also tested it on my laptop which also has a card reader supported by the
rtsx_pcidriver (an RTL8411B) and that also works fine.As I mentioned yesterday, I think it's a candidate for the 5.4 ans 5.7 stable series.
Thanks for your patience!
Chris
Signed-off-by Chris Clayton <[email protected]>
drivers/misc/cardreader/rtsx_pcr.c 2020-08-05 07:11:05.568074278 +0100 void rtsx_pci_init_ocp(struct rtsx_pcr * · line 1177
Quoted 10 lines
drivers/misc/cardreader/rtsx_pcr.c 2020-08-05 07:11:05.568074278 +0100 renamed from drivers/misc/cardreader/rtsx_pcr.c 2020-08-05 07:10:21.752072515 +0100 +0
-4@@ -1172,10 +1172,6 @@ void rtsx_pci_init_ocp(struct rtsx_pcr * rtsx_pci_write_register(pcr, REG_OCPGLITCH, SD_OCP_GLITCH_MASK, pcr->hw_param.ocp_glitch); rtsx_pci_enable_ocp(pcr); - } else { - /* OC power down */ - rtsx_pci_write_register(pcr, FPDCTL, OC_POWER_DOWN, - OC_POWER_DOWN); } } }
Is there some problem with my patch? If you are too busy to deal with it, perhaps I can submit directly it to Greg/Arnd.
Thanks
Chris