Skip to contentSkip to conversation

rtsx: patchset for supporting new model RTS5227

PATCH Applied Roger Tseng 4 participants 10 messages Feb 4, 2013 – Feb 11, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover rtsx: patchset for supporting new model RTS5227

The patchset makes necessary changes in mfd and mmc tree for supporting RTS5227 card reader.

Roger Tseng (3):
MMC: rtsx: remove driving adjustment
mfd: rtsx: implement driving adjustment to device-dependent callbacks
mfd: rtsx: support RTS5227

 drivers/mfd/Makefile              |   2 +-
 drivers/mfd/rtl8411.c             |  16 ++-
 drivers/mfd/rts5209.c             |   8 ++
 drivers/mfd/rts5227.c             | 234 ++++++++++++++++++++++++++++++++++++++
 drivers/mfd/rts5229.c             |   8 ++
 drivers/mfd/rtsx_pcr.c            |   5 +
 drivers/mfd/rtsx_pcr.h            |   1 +
 drivers/mmc/host/rtsx_pci_sdmmc.c |   5 -
 include/linux/mfd/rtsx_pci.h      |   5 +
 9 files changed, 275 insertions(+), 9 deletions(-)
 create mode 100644 drivers/mfd/rts5227.c
Signature · 1 line
1.7.12.1
#1 lore raw

PATCH 1/3 MMC: rtsx: remove driving adjustment

Several new models of readers use different way to select driving capability(a necessary adjustment along with voltage change). Removing this from device-independent rtsx_pci_sdmmc module. It will be implemented in device-depend calls encapsulated by rtsx_pci_switch_output_voltage().

---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/mmc/host/rtsx_pci_sdmmc.c +0 -5
index f74b5ad..f93f100 100644
@@ -1083,11 +1083,6 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
 		voltage = OUTPUT_1V8;
 
 	if (voltage == OUTPUT_1V8) {
-		err = rtsx_pci_write_register(pcr,
-				SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B);
-		if (err < 0)
-			goto out;
-
 		err = sd_wait_voltage_stable_1(host);
 		if (err < 0)
 			goto out;
Signature · 1 line
1.7.12.1
#2 lore raw

Re: [PATCH 1/3] MMC: rtsx: remove driving adjustment

Quoted 5 lines · Roger Tseng

Several new models of readers use different way to select driving capability(a necessary adjustment along with voltage change). Removing this from device-independent rtsx_pci_sdmmc module. It will be implemented in device-depend calls encapsulated by rtsx_pci_switch_output_voltage().

I'm not sure I understand.

Does this patch break things and then "[PATCH 2/3] mfd: rtsx:
implement driving adjustment to device-dependent callbacks" fixes things again? In other words, will all the old devices run if we only apply patch 1/3 and not 2/3?

That's not the right idea. Just merge the two patches into one patch.

regards,
dan carpenter

#3 lore raw

Re: [PATCH 1/3] MMC: rtsx: remove driving adjustment

Hi Dan,

Correct. I will prevent this kind of breaking in the future.

However, after our analysis the breaking of patch 1/3 and 2/3 should not fail old devices. And since Samuel has applied 2/3 and 3/3, it might be better for Chris to apply patch 1/3 and let all this things appear in kernel v3.9.

Hi Chris,

Would you please apply patch 1/3 for kernel v3.9. Thanks.

Best regards,
Roger Tseng

Quoted 24 lines · Dan Carpenter
Quoted 5 lines · Roger Tseng

Several new models of readers use different way to select driving capability(a necessary adjustment along with voltage change). Removing this from device-independent rtsx_pci_sdmmc module. It will be implemented in device-depend calls encapsulated by rtsx_pci_switch_output_voltage().

I'm not sure I understand.

Does this patch break things and then "[PATCH 2/3] mfd: rtsx:
implement driving adjustment to device-dependent callbacks" fixes things again? In other words, will all the old devices run if we only apply patch 1/3 and not 2/3?

That's not the right idea. Just merge the two patches into one patch.

regards,
dan carpenter

------Please consider the environment before printing this e-mail.

#4 lore raw

Re: [PATCH 1/3] MMC: rtsx: remove driving adjustment

Quoted 4 lines · Roger Tseng

Hi Dan,

Correct. I will prevent this kind of breaking in the future.

Cool. Or if we applied 2/3 first and then 1/3 there would be no breakage? Anyway, it's a bit late to combine them at this point.

Quoted 9 lines

However, after our analysis the breaking of patch 1/3 and 2/3 should not fail old devices. And since Samuel has applied 2/3 and 3/3, it might be better for Chris to apply patch 1/3 and let all this things appear in kernel v3.9.

Hi Chris,

Would you please apply patch 1/3 for kernel v3.9. Thanks.

Sounds good.

regards,
dan carpenter

#5 lore raw

Re: [PATCH 1/3] MMC: rtsx: remove driving adjustment

In reply to Roger Tseng

Hi,

Quoted 17 lines · Roger Tseng

Several new models of readers use different way to select driving capability(a necessary adjustment along with voltage change). Removing this from device-independent rtsx_pci_sdmmc module. It will be implemented in device-depend calls encapsulated by rtsx_pci_switch_output_voltage().

---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/mmc/host/rtsx_pci_sdmmc.c +0 -0
index f74b5ad..f93f100 100644
@@ -1083,11 +1083,6 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
 		voltage = OUTPUT_1V8;

drivers/mmc/host/rtsx_pci_sdmmc.c static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) · line 1088

Quoted 10 lines
drivers/mmc/host/rtsx_pci_sdmmc.c +0 -5
 
 	if (voltage == OUTPUT_1V8) {
-		err = rtsx_pci_write_register(pcr,
-				SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B);
-		if (err < 0)
-			goto out;
-
 		err = sd_wait_voltage_stable_1(host);
 		if (err < 0)
 			goto out;

Thanks, I've pushed 1/3 to mmc-next for 3.9 now.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#6 lore raw

PATCH 2/3 mfd: rtsx: implement driving adjustment to device-dependent callbacks

In reply to Roger Tseng

Implement different ways of selecting driving capability(a necessary adjustment along with voltage change). It was origionally in device-independent mmc/host/rtsx_pci_sdmmc.c. Moving it here to support devices which may have a different way of adjustment.

---
 drivers/mfd/rtl8411.c | 16 +++++++++++++---
 drivers/mfd/rts5209.c |  8 ++++++++
 drivers/mfd/rts5229.c |  8 ++++++++
 3 files changed, 29 insertions(+), 3 deletions(-)
drivers/mfd/rtl8411.c +13 -3
index 3d3b4ad..2a2d316 100644
@@ -115,14 +115,24 @@ static int rtl8411_card_power_off(struct rtsx_pcr *pcr, int card)
 static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
 {
 	u8 mask, val;
+	int err;
 
 	mask = (BPP_REG_TUNED18 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_MASK;
-	if (voltage == OUTPUT_3V3)
+	if (voltage == OUTPUT_3V3) {
+		err = rtsx_pci_write_register(pcr,
+				SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_D);
+		if (err < 0)
+			return err;
 		val = (BPP_ASIC_3V3 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_3V3;
-	else if (voltage == OUTPUT_1V8)
+	} else if (voltage == OUTPUT_1V8) {
+		err = rtsx_pci_write_register(pcr,
+				SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B);
+		if (err < 0)
+			return err;
 		val = (BPP_ASIC_1V8 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_1V8;
-	else
+	} else {
 		return -EINVAL;
+	}
 
 	return rtsx_pci_write_register(pcr, LDO_CTL, mask, val);
 }
drivers/mfd/rts5209.c +8 -0
index 98fe0f3..ec78d9f 100644
@@ -149,10 +149,18 @@ static int rts5209_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
 	int err;
 
 	if (voltage == OUTPUT_3V3) {
+		err = rtsx_pci_write_register(pcr,
+				SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_D);
+		if (err < 0)
+			return err;
 		err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24);
 		if (err < 0)
 			return err;
 	} else if (voltage == OUTPUT_1V8) {
+		err = rtsx_pci_write_register(pcr,
+				SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B);
+		if (err < 0)
+			return err;
 		err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24);
 		if (err < 0)
 			return err;
drivers/mfd/rts5229.c +8 -0
index 29d889c..58af4db 100644
@@ -119,10 +119,18 @@ static int rts5229_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
 	int err;
 
 	if (voltage == OUTPUT_3V3) {
+		err = rtsx_pci_write_register(pcr,
+				SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_D);
+		if (err < 0)
+			return err;
 		err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24);
 		if (err < 0)
 			return err;
 	} else if (voltage == OUTPUT_1V8) {
+		err = rtsx_pci_write_register(pcr,
+				SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B);
+		if (err < 0)
+			return err;
 		err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24);
 		if (err < 0)
 			return err;
Signature · 1 line
1.7.12.1
Applied
#7 lore raw

Re: [PATCH 2/3] mfd: rtsx: implement driving adjustment to device-dependent callbacks

Hi Roger,

Quoted 5 lines · Roger Tseng

Implement different ways of selecting driving capability(a necessary adjustment along with voltage change). It was origionally in device-independent mmc/host/rtsx_pci_sdmmc.c. Moving it here to support devices which may have a different way of adjustment.

Quoted 7 lines
---
 drivers/mfd/rtl8411.c | 16 +++++++++++++---
 drivers/mfd/rts5209.c |  8 ++++++++
 drivers/mfd/rts5229.c |  8 ++++++++
 3 files changed, 29 insertions(+), 3 deletions(-)

Applied, thanks.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
#8 lore raw

PATCH 3/3 mfd: rtsx: support RTS5227

In reply to Roger Tseng

Support new model RTS5227.

---
 drivers/mfd/Makefile         |   2 +-
 drivers/mfd/rts5227.c        | 234 +++++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/rtsx_pcr.c       |   5 +
 drivers/mfd/rtsx_pcr.h       |   1 +
 include/linux/mfd/rtsx_pci.h |   5 +
 5 files changed, 246 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mfd/rts5227.c
drivers/mfd/Makefile +1 -1
index 8b977f8..b90409c 100644
@@ -9,7 +9,7 @@ obj-$(CONFIG_MFD_88PM805)	+= 88pm805.o 88pm80x.o
 obj-$(CONFIG_MFD_SM501)		+= sm501.o
 obj-$(CONFIG_MFD_ASIC3)		+= asic3.o tmio_core.o
 
-rtsx_pci-objs			:= rtsx_pcr.o rts5209.o rts5229.o rtl8411.o
+rtsx_pci-objs			:= rtsx_pcr.o rts5209.o rts5229.o rtl8411.o rts5227.o
 obj-$(CONFIG_MFD_RTSX_PCI)	+= rtsx_pci.o
 
 obj-$(CONFIG_HTC_EGPIO)		+= htc-egpio.o
drivers/mfd/rts5227.c new file +234 -0

234 lines not on this page · raw message

drivers/mfd/rtsx_pcr.c +5 -0
index 9016932..822237e 100644
@@ -55,6 +55,7 @@ static DEFINE_PCI_DEVICE_TABLE(rtsx_pci_ids) = {
 	{ PCI_DEVICE(0x10EC, 0x5209), PCI_CLASS_OTHERS << 16, 0xFF0000 },
 	{ PCI_DEVICE(0x10EC, 0x5229), PCI_CLASS_OTHERS << 16, 0xFF0000 },
 	{ PCI_DEVICE(0x10EC, 0x5289), PCI_CLASS_OTHERS << 16, 0xFF0000 },
+	{ PCI_DEVICE(0x10EC, 0x5227), PCI_CLASS_OTHERS << 16, 0xFF0000 },
 	{ 0, }
 };
 
@@ -998,6 +999,10 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr)
 	case 0x5289:
 		rtl8411_init_params(pcr);
 		break;
+
+	case 0x5227:
+		rts5227_init_params(pcr);
+		break;
 	}
 
 	dev_dbg(&(pcr->pci->dev), "PID: 0x%04x, IC version: 0x%02x\n",
drivers/mfd/rtsx_pcr.h +1 -0
index 33c210b..2b3ab8a 100644
@@ -31,5 +31,6 @@
 void rts5209_init_params(struct rtsx_pcr *pcr);
 void rts5229_init_params(struct rtsx_pcr *pcr);
 void rtl8411_init_params(struct rtsx_pcr *pcr);
+void rts5227_init_params(struct rtsx_pcr *pcr);
 
 #endif
include/linux/mfd/rtsx_pci.h +5 -0
index 3f2bf26..5d9b81e 100644
@@ -581,8 +581,11 @@
 #define CARD_GPIO_DIR			0xFD57
 #define CARD_GPIO			0xFD58
 #define CARD_DATA_SOURCE		0xFD5B
+#define SD30_CLK_DRIVE_SEL		0xFD5A
 #define CARD_SELECT			0xFD5C
 #define SD30_DRIVE_SEL			0xFD5E
+#define SD30_CMD_DRIVE_SEL		0xFD5E
+#define SD30_DAT_DRIVE_SEL		0xFD5F
 #define CARD_CLK_EN			0xFD69
 #define SDIO_CTRL			0xFD6B
 #define CD_PAD_CTL			0xFD73
@@ -655,6 +658,8 @@
 #define MSGTXDATA3			0xFE47
 #define MSGTXCTL			0xFE48
 #define PETXCFG				0xFE49
+#define LTR_CTL				0xFE4A
+#define OBFF_CFG			0xFE4C
 
 #define CDRESUMECTL			0xFE52
 #define WAKE_SEL_CTL			0xFE54
Signature · 1 line
1.7.12.1
Applied
#9 lore raw

Re: [PATCH 3/3] mfd: rtsx: support RTS5227

Hi Roger,

Quoted 4 lines · Roger Tseng

Support new model RTS5227.

Quoted 8 lines
---
 drivers/mfd/Makefile         |   2 +-
 drivers/mfd/rts5227.c        | 234 +++++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/rtsx_pcr.c       |   5 +
 drivers/mfd/rtsx_pcr.h       |   1 +
 include/linux/mfd/rtsx_pci.h |   5 +
 5 files changed, 246 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mfd/rts5227.c

Applied as well, thanks.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/