linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PATCH: rtsx_pci driver - don't disable the rts5229 card reader on Intel NUC boxes
@ 2020-08-02 19:48 Chris Clayton
  2020-08-02 19:58 ` Chris Clayton
  0 siblings, 1 reply; 15+ messages in thread
From: Chris Clayton @ 2020-08-02 19:48 UTC (permalink / raw)
  To: LKML, ricky_wu, gregkh, rdunlap, philquadra, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 1623 bytes --]

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.

Fixes: bede03a579b3 ("misc: rtsx: Enable OCP for rts522a rts524a rts525a rts5260")
Link: https://marc.info/?l=linux-kernel&m=159105912832257
Link: https://bugzilla.kernel.org/show_bug.cgi?id=204003
Signed-off-by: Chris Clayton <chris2553@googlemail.com>

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

[-- Attachment #2: dont-disable-rts5229-cardreader-on-intel-NUC.patch --]
[-- Type: text/x-patch, Size: 697 bytes --]

--- linux-5.7.12/drivers/misc/cardreader/rtsx_pcr.c.orig	2020-08-02 13:36:50.216947944 +0100
+++ linux-5.7.12/drivers/misc/cardreader/rtsx_pcr.c	2020-08-02 18:37:30.456610731 +0100
@@ -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);
 		}
 	}
 }

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

end of thread, other threads:[~2020-08-22  7:24 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-02 19:48 PATCH: rtsx_pci driver - don't disable the rts5229 card reader on Intel NUC boxes Chris Clayton
2020-08-02 19:58 ` Chris Clayton
2020-08-03  3:01   ` 吳昊澄 Ricky
2020-08-03  5:27     ` Chris Clayton
2020-08-04  2:44   ` 吳昊澄 Ricky
2020-08-04  7:48     ` gregkh
2020-08-04  8:08       ` 吳昊澄 Ricky
2020-08-04  8:13         ` gregkh
2020-08-04  8:50         ` Chris Clayton
2020-08-04 10:46           ` 吳昊澄 Ricky
2020-08-04 11:51             ` Chris Clayton
2020-08-05  2:35               ` 吳昊澄 Ricky
2020-08-05  5:51                 ` Chris Clayton
2020-08-05 12:48                   ` Chris Clayton
2020-08-22  7:24                     ` Chris Clayton

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).