rtsx: patchset for supporting new model RTS5227
Subsystems (2)
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
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
@@ -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
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_sdmmcmodule. It will be implemented in device-depend calls encapsulated byrtsx_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
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_sdmmcmodule. It will be implemented in device-depend calls encapsulated byrtsx_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.
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
Re: [PATCH 1/3] MMC: rtsx: remove driving adjustment
In reply to Roger TsengHi,
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_sdmmcmodule. It will be implemented in device-depend calls encapsulated byrtsx_pci_switch_output_voltage().Signed-off-by Roger Tseng <[email protected]>Reviewed-by Wei WANG <[email protected]>--- drivers/mmc/host/rtsx_pci_sdmmc.c | 5 ----- 1 file changed, 5 deletions(-)drivers/mmc/host/rtsx_pci_sdmmc.c +0
-0@@ -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
-5if (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
PATCH 2/3 mfd: rtsx: implement driving adjustment to device-dependent callbacks
In reply to Roger TsengImplement 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
@@ -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
@@ -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
@@ -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
Samuel Ortiz
AppliedRe: [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
Signed-off-by Roger Tseng <[email protected]>Reviewed-by Wei WANG <[email protected]>--- 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/
PATCH 3/3 mfd: rtsx: support RTS5227
In reply to Roger TsengSupport 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
@@ -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
@@ -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
@@ -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
@@ -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
Samuel Ortiz
AppliedRe: [PATCH 3/3] mfd: rtsx: support RTS5227
Hi Roger,
Quoted 4 lines · Roger Tseng
Support new model RTS5227.
Signed-off-by Roger Tseng <[email protected]>Reviewed-by Wei WANG <[email protected]>
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/