* [PATCH 0/3] rtsx: patchset for supporting new model RTS5227 @ 2013-02-04 7:45 ` Roger Tseng 0 siblings, 0 replies; 17+ messages in thread From: Roger Tseng @ 2013-02-04 7:45 UTC (permalink / raw) To: cjb, sameo; +Cc: devel, linux-kernel, linux-mmc, gregkh, wei_wang, Roger Tseng 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 -- 1.7.12.1 ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 0/3] rtsx: patchset for supporting new model RTS5227 @ 2013-02-04 7:45 ` Roger Tseng 0 siblings, 0 replies; 17+ messages in thread From: Roger Tseng @ 2013-02-04 7:45 UTC (permalink / raw) To: cjb, sameo; +Cc: devel, linux-kernel, linux-mmc, gregkh, wei_wang, Roger Tseng 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 -- 1.7.12.1 ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/3] MMC: rtsx: remove driving adjustment 2013-02-04 7:45 ` Roger Tseng @ 2013-02-04 7:45 ` Roger Tseng -1 siblings, 0 replies; 17+ messages in thread From: Roger Tseng @ 2013-02-04 7:45 UTC (permalink / raw) To: cjb, sameo; +Cc: devel, linux-kernel, linux-mmc, gregkh, wei_wang, 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(). Signed-off-by: Roger Tseng <rogerable@realtek.com> Reviewed-by: Wei WANG <wei_wang@realsil.com.cn> --- drivers/mmc/host/rtsx_pci_sdmmc.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c index f74b5ad..f93f100 100644 --- a/drivers/mmc/host/rtsx_pci_sdmmc.c +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c @@ -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; -- 1.7.12.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 1/3] MMC: rtsx: remove driving adjustment @ 2013-02-04 7:45 ` Roger Tseng 0 siblings, 0 replies; 17+ messages in thread From: Roger Tseng @ 2013-02-04 7:45 UTC (permalink / raw) To: cjb, sameo; +Cc: devel, linux-kernel, linux-mmc, gregkh, wei_wang, 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(). Signed-off-by: Roger Tseng <rogerable@realtek.com> Reviewed-by: Wei WANG <wei_wang@realsil.com.cn> --- drivers/mmc/host/rtsx_pci_sdmmc.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c index f74b5ad..f93f100 100644 --- a/drivers/mmc/host/rtsx_pci_sdmmc.c +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c @@ -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; -- 1.7.12.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 1/3] MMC: rtsx: remove driving adjustment 2013-02-04 7:45 ` Roger Tseng (?) @ 2013-02-04 8:47 ` Dan Carpenter 2013-02-05 2:51 ` Roger Tseng -1 siblings, 1 reply; 17+ messages in thread From: Dan Carpenter @ 2013-02-04 8:47 UTC (permalink / raw) To: Roger Tseng; +Cc: cjb, sameo, gregkh, linux-mmc, linux-kernel, wei_wang, devel On Mon, Feb 04, 2013 at 03:45:57PM +0800, Roger Tseng wrote: > 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 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/3] MMC: rtsx: remove driving adjustment 2013-02-04 8:47 ` Dan Carpenter @ 2013-02-05 2:51 ` Roger Tseng 2013-02-05 8:30 ` Dan Carpenter 0 siblings, 1 reply; 17+ messages in thread From: Roger Tseng @ 2013-02-05 2:51 UTC (permalink / raw) To: Dan Carpenter, cjb@laptop.org Cc: sameo@linux.intel.com, gregkh@linuxfoundation.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Wei_wang, devel@linuxdriverproject.org 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 On 02/04/2013 04:47 PM, Dan Carpenter wrote: > On Mon, Feb 04, 2013 at 03:45:57PM +0800, Roger Tseng wrote: >> 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. > > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/3] MMC: rtsx: remove driving adjustment 2013-02-05 2:51 ` Roger Tseng @ 2013-02-05 8:30 ` Dan Carpenter 0 siblings, 0 replies; 17+ messages in thread From: Dan Carpenter @ 2013-02-05 8:30 UTC (permalink / raw) To: Roger Tseng Cc: cjb@laptop.org, sameo@linux.intel.com, gregkh@linuxfoundation.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Wei_wang, devel@linuxdriverproject.org On Tue, Feb 05, 2013 at 10:51:49AM +0800, Roger Tseng wrote: > 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. > 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 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/3] MMC: rtsx: remove driving adjustment 2013-02-04 7:45 ` Roger Tseng @ 2013-02-11 17:53 ` Chris Ball -1 siblings, 0 replies; 17+ messages in thread From: Chris Ball @ 2013-02-11 17:53 UTC (permalink / raw) To: Roger Tseng; +Cc: sameo, devel, linux-kernel, linux-mmc, gregkh, wei_wang Hi, On Mon, Feb 04 2013, Roger Tseng wrote: > 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(). > > Signed-off-by: Roger Tseng <rogerable@realtek.com> > Reviewed-by: Wei WANG <wei_wang@realsil.com.cn> > --- > drivers/mmc/host/rtsx_pci_sdmmc.c | 5 ----- > 1 file changed, 5 deletions(-) > > diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c > index f74b5ad..f93f100 100644 > --- a/drivers/mmc/host/rtsx_pci_sdmmc.c > +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c > @@ -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; Thanks, I've pushed 1/3 to mmc-next for 3.9 now. - Chris. -- Chris Ball <cjb@laptop.org> <http://printf.net/> One Laptop Per Child ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/3] MMC: rtsx: remove driving adjustment @ 2013-02-11 17:53 ` Chris Ball 0 siblings, 0 replies; 17+ messages in thread From: Chris Ball @ 2013-02-11 17:53 UTC (permalink / raw) To: Roger Tseng; +Cc: sameo, devel, linux-kernel, linux-mmc, gregkh, wei_wang Hi, On Mon, Feb 04 2013, Roger Tseng wrote: > 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(). > > Signed-off-by: Roger Tseng <rogerable@realtek.com> > Reviewed-by: Wei WANG <wei_wang@realsil.com.cn> > --- > drivers/mmc/host/rtsx_pci_sdmmc.c | 5 ----- > 1 file changed, 5 deletions(-) > > diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c > index f74b5ad..f93f100 100644 > --- a/drivers/mmc/host/rtsx_pci_sdmmc.c > +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c > @@ -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; Thanks, I've pushed 1/3 to mmc-next for 3.9 now. - Chris. -- Chris Ball <cjb@laptop.org> <http://printf.net/> One Laptop Per Child ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2/3] mfd: rtsx: implement driving adjustment to device-dependent callbacks 2013-02-04 7:45 ` Roger Tseng @ 2013-02-04 7:45 ` Roger Tseng -1 siblings, 0 replies; 17+ messages in thread From: Roger Tseng @ 2013-02-04 7:45 UTC (permalink / raw) To: cjb, sameo; +Cc: devel, linux-kernel, linux-mmc, gregkh, wei_wang, 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. Signed-off-by: Roger Tseng <rogerable@realtek.com> Reviewed-by: Wei WANG <wei_wang@realsil.com.cn> --- drivers/mfd/rtl8411.c | 16 +++++++++++++--- drivers/mfd/rts5209.c | 8 ++++++++ drivers/mfd/rts5229.c | 8 ++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c index 3d3b4ad..2a2d316 100644 --- a/drivers/mfd/rtl8411.c +++ b/drivers/mfd/rtl8411.c @@ -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); } diff --git a/drivers/mfd/rts5209.c b/drivers/mfd/rts5209.c index 98fe0f3..ec78d9f 100644 --- a/drivers/mfd/rts5209.c +++ b/drivers/mfd/rts5209.c @@ -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; diff --git a/drivers/mfd/rts5229.c b/drivers/mfd/rts5229.c index 29d889c..58af4db 100644 --- a/drivers/mfd/rts5229.c +++ b/drivers/mfd/rts5229.c @@ -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; -- 1.7.12.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/3] mfd: rtsx: implement driving adjustment to device-dependent callbacks @ 2013-02-04 7:45 ` Roger Tseng 0 siblings, 0 replies; 17+ messages in thread From: Roger Tseng @ 2013-02-04 7:45 UTC (permalink / raw) To: cjb, sameo; +Cc: devel, linux-kernel, linux-mmc, gregkh, wei_wang, 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. Signed-off-by: Roger Tseng <rogerable@realtek.com> Reviewed-by: Wei WANG <wei_wang@realsil.com.cn> --- drivers/mfd/rtl8411.c | 16 +++++++++++++--- drivers/mfd/rts5209.c | 8 ++++++++ drivers/mfd/rts5229.c | 8 ++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c index 3d3b4ad..2a2d316 100644 --- a/drivers/mfd/rtl8411.c +++ b/drivers/mfd/rtl8411.c @@ -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); } diff --git a/drivers/mfd/rts5209.c b/drivers/mfd/rts5209.c index 98fe0f3..ec78d9f 100644 --- a/drivers/mfd/rts5209.c +++ b/drivers/mfd/rts5209.c @@ -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; diff --git a/drivers/mfd/rts5229.c b/drivers/mfd/rts5229.c index 29d889c..58af4db 100644 --- a/drivers/mfd/rts5229.c +++ b/drivers/mfd/rts5229.c @@ -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; -- 1.7.12.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 2/3] mfd: rtsx: implement driving adjustment to device-dependent callbacks 2013-02-04 7:45 ` Roger Tseng @ 2013-02-04 11:56 ` Samuel Ortiz -1 siblings, 0 replies; 17+ messages in thread From: Samuel Ortiz @ 2013-02-04 11:56 UTC (permalink / raw) To: Roger Tseng; +Cc: gregkh, linux-mmc, linux-kernel, wei_wang, devel, cjb Hi Roger, On Mon, Feb 04, 2013 at 03:45:58PM +0800, Roger Tseng wrote: > 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. > > Signed-off-by: Roger Tseng <rogerable@realtek.com> > Reviewed-by: Wei WANG <wei_wang@realsil.com.cn> > --- > 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. -- Intel Open Source Technology Centre http://oss.intel.com/ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 2/3] mfd: rtsx: implement driving adjustment to device-dependent callbacks @ 2013-02-04 11:56 ` Samuel Ortiz 0 siblings, 0 replies; 17+ messages in thread From: Samuel Ortiz @ 2013-02-04 11:56 UTC (permalink / raw) To: Roger Tseng; +Cc: cjb, devel, linux-kernel, linux-mmc, gregkh, wei_wang Hi Roger, On Mon, Feb 04, 2013 at 03:45:58PM +0800, Roger Tseng wrote: > 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. > > Signed-off-by: Roger Tseng <rogerable@realtek.com> > Reviewed-by: Wei WANG <wei_wang@realsil.com.cn> > --- > 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. -- Intel Open Source Technology Centre http://oss.intel.com/ ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 3/3] mfd: rtsx: support RTS5227 2013-02-04 7:45 ` Roger Tseng @ 2013-02-04 7:45 ` Roger Tseng -1 siblings, 0 replies; 17+ messages in thread From: Roger Tseng @ 2013-02-04 7:45 UTC (permalink / raw) To: cjb, sameo; +Cc: devel, linux-kernel, linux-mmc, gregkh, wei_wang, Roger Tseng Support new model RTS5227. Signed-off-by: Roger Tseng <rogerable@realtek.com> Reviewed-by: Wei WANG <wei_wang@realsil.com.cn> --- 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 diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 8b977f8..b90409c 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -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 diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c new file mode 100644 index 0000000..fc831dc --- /dev/null +++ b/drivers/mfd/rts5227.c @@ -0,0 +1,234 @@ +/* Driver for Realtek PCI-Express card reader + * + * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see <http://www.gnu.org/licenses/>. + * + * Author: + * Wei WANG <wei_wang@realsil.com.cn> + * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China + * + * Roger Tseng <rogerable@realtek.com> + * No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan + */ + +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/mfd/rtsx_pci.h> + +#include "rtsx_pcr.h" + +static int rts5227_extra_init_hw(struct rtsx_pcr *pcr) +{ + u16 cap; + + rtsx_pci_init_cmd(pcr); + + /* Configure GPIO as output */ + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, GPIO_CTL, 0x02, 0x02); + /* Switch LDO3318 source from DV33 to card_3v3 */ + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, LDO_PWR_SEL, 0x03, 0x00); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, LDO_PWR_SEL, 0x03, 0x01); + /* LED shine disabled, set initial shine cycle period */ + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, OLT_LED_CTL, 0x0F, 0x02); + /* Configure LTR */ + pcie_capability_read_word(pcr->pci, PCI_EXP_DEVCTL2, &cap); + if (cap & PCI_EXP_LTR_EN) + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, LTR_CTL, 0xFF, 0xA3); + /* Configure OBFF */ + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, OBFF_CFG, 0x03, 0x03); + /* Configure force_clock_req + * Maybe We should define 0xFF03 as some name + */ + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, 0xFF03, 0x08, 0x08); + /* Correct driving */ + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, + SD30_CLK_DRIVE_SEL, 0xFF, 0x96); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, + SD30_CMD_DRIVE_SEL, 0xFF, 0x96); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, + SD30_DAT_DRIVE_SEL, 0xFF, 0x96); + + return rtsx_pci_send_cmd(pcr, 100); +} + +static int rts5227_optimize_phy(struct rtsx_pcr *pcr) +{ + /* Optimize RX sensitivity */ + return rtsx_pci_write_phy_register(pcr, 0x00, 0xBA42); +} + +static int rts5227_turn_on_led(struct rtsx_pcr *pcr) +{ + return rtsx_pci_write_register(pcr, GPIO_CTL, 0x02, 0x02); +} + +static int rts5227_turn_off_led(struct rtsx_pcr *pcr) +{ + return rtsx_pci_write_register(pcr, GPIO_CTL, 0x02, 0x00); +} + +static int rts5227_enable_auto_blink(struct rtsx_pcr *pcr) +{ + return rtsx_pci_write_register(pcr, OLT_LED_CTL, 0x08, 0x08); +} + +static int rts5227_disable_auto_blink(struct rtsx_pcr *pcr) +{ + return rtsx_pci_write_register(pcr, OLT_LED_CTL, 0x08, 0x00); +} + +static int rts5227_card_power_on(struct rtsx_pcr *pcr, int card) +{ + int err; + + rtsx_pci_init_cmd(pcr); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, + SD_POWER_MASK, SD_PARTIAL_POWER_ON); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, + LDO3318_PWR_MASK, 0x02); + err = rtsx_pci_send_cmd(pcr, 100); + if (err < 0) + return err; + + /* To avoid too large in-rush current */ + udelay(150); + + rtsx_pci_init_cmd(pcr); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, + SD_POWER_MASK, SD_POWER_ON); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, + LDO3318_PWR_MASK, 0x06); + err = rtsx_pci_send_cmd(pcr, 100); + if (err < 0) + return err; + + return 0; +} + +static int rts5227_card_power_off(struct rtsx_pcr *pcr, int card) +{ + rtsx_pci_init_cmd(pcr); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, + SD_POWER_MASK | PMOS_STRG_MASK, + SD_POWER_OFF | PMOS_STRG_400mA); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, + LDO3318_PWR_MASK, 0X00); + return rtsx_pci_send_cmd(pcr, 100); +} + +static int rts5227_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) +{ + int err; + u8 drive_sel; + + if (voltage == OUTPUT_3V3) { + err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24); + if (err < 0) + return err; + drive_sel = 0x96; + } else if (voltage == OUTPUT_1V8) { + err = rtsx_pci_write_phy_register(pcr, 0x11, 0x3C02); + if (err < 0) + return err; + err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C80 | 0x24); + if (err < 0) + return err; + drive_sel = 0xB3; + } else { + return -EINVAL; + } + + /* set pad drive */ + rtsx_pci_init_cmd(pcr); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD30_CLK_DRIVE_SEL, + 0xFF, drive_sel); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD30_CMD_DRIVE_SEL, + 0xFF, drive_sel); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD30_DAT_DRIVE_SEL, + 0xFF, drive_sel); + return rtsx_pci_send_cmd(pcr, 100); +} + +static const struct pcr_ops rts5227_pcr_ops = { + .extra_init_hw = rts5227_extra_init_hw, + .optimize_phy = rts5227_optimize_phy, + .turn_on_led = rts5227_turn_on_led, + .turn_off_led = rts5227_turn_off_led, + .enable_auto_blink = rts5227_enable_auto_blink, + .disable_auto_blink = rts5227_disable_auto_blink, + .card_power_on = rts5227_card_power_on, + .card_power_off = rts5227_card_power_off, + .switch_output_voltage = rts5227_switch_output_voltage, + .cd_deglitch = NULL, + .conv_clk_and_div_n = NULL, +}; + +/* SD Pull Control Enable: + * SD_DAT[3:0] ==> pull up + * SD_CD ==> pull up + * SD_WP ==> pull up + * SD_CMD ==> pull up + * SD_CLK ==> pull down + */ +static const u32 rts5227_sd_pull_ctl_enable_tbl[] = { + RTSX_REG_PAIR(CARD_PULL_CTL2, 0xAA), + RTSX_REG_PAIR(CARD_PULL_CTL3, 0xE9), + 0, +}; + +/* SD Pull Control Disable: + * SD_DAT[3:0] ==> pull down + * SD_CD ==> pull up + * SD_WP ==> pull down + * SD_CMD ==> pull down + * SD_CLK ==> pull down + */ +static const u32 rts5227_sd_pull_ctl_disable_tbl[] = { + RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55), + RTSX_REG_PAIR(CARD_PULL_CTL3, 0xD5), + 0, +}; + +/* MS Pull Control Enable: + * MS CD ==> pull up + * others ==> pull down + */ +static const u32 rts5227_ms_pull_ctl_enable_tbl[] = { + RTSX_REG_PAIR(CARD_PULL_CTL5, 0x55), + RTSX_REG_PAIR(CARD_PULL_CTL6, 0x15), + 0, +}; + +/* MS Pull Control Disable: + * MS CD ==> pull up + * others ==> pull down + */ +static const u32 rts5227_ms_pull_ctl_disable_tbl[] = { + RTSX_REG_PAIR(CARD_PULL_CTL5, 0x55), + RTSX_REG_PAIR(CARD_PULL_CTL6, 0x15), + 0, +}; + +void rts5227_init_params(struct rtsx_pcr *pcr) +{ + pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104; + pcr->num_slots = 2; + pcr->ops = &rts5227_pcr_ops; + + pcr->sd_pull_ctl_enable_tbl = rts5227_sd_pull_ctl_enable_tbl; + pcr->sd_pull_ctl_disable_tbl = rts5227_sd_pull_ctl_disable_tbl; + pcr->ms_pull_ctl_enable_tbl = rts5227_ms_pull_ctl_enable_tbl; + pcr->ms_pull_ctl_disable_tbl = rts5227_ms_pull_ctl_disable_tbl; +} diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index 9016932..822237e 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c @@ -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", diff --git a/drivers/mfd/rtsx_pcr.h b/drivers/mfd/rtsx_pcr.h index 33c210b..2b3ab8a 100644 --- a/drivers/mfd/rtsx_pcr.h +++ b/drivers/mfd/rtsx_pcr.h @@ -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 diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h index 3f2bf26..5d9b81e 100644 --- a/include/linux/mfd/rtsx_pci.h +++ b/include/linux/mfd/rtsx_pci.h @@ -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 -- 1.7.12.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/3] mfd: rtsx: support RTS5227 @ 2013-02-04 7:45 ` Roger Tseng 0 siblings, 0 replies; 17+ messages in thread From: Roger Tseng @ 2013-02-04 7:45 UTC (permalink / raw) To: cjb, sameo; +Cc: devel, linux-kernel, linux-mmc, gregkh, wei_wang, Roger Tseng Support new model RTS5227. Signed-off-by: Roger Tseng <rogerable@realtek.com> Reviewed-by: Wei WANG <wei_wang@realsil.com.cn> --- 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 diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 8b977f8..b90409c 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -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 diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c new file mode 100644 index 0000000..fc831dc --- /dev/null +++ b/drivers/mfd/rts5227.c @@ -0,0 +1,234 @@ +/* Driver for Realtek PCI-Express card reader + * + * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see <http://www.gnu.org/licenses/>. + * + * Author: + * Wei WANG <wei_wang@realsil.com.cn> + * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China + * + * Roger Tseng <rogerable@realtek.com> + * No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan + */ + +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/mfd/rtsx_pci.h> + +#include "rtsx_pcr.h" + +static int rts5227_extra_init_hw(struct rtsx_pcr *pcr) +{ + u16 cap; + + rtsx_pci_init_cmd(pcr); + + /* Configure GPIO as output */ + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, GPIO_CTL, 0x02, 0x02); + /* Switch LDO3318 source from DV33 to card_3v3 */ + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, LDO_PWR_SEL, 0x03, 0x00); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, LDO_PWR_SEL, 0x03, 0x01); + /* LED shine disabled, set initial shine cycle period */ + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, OLT_LED_CTL, 0x0F, 0x02); + /* Configure LTR */ + pcie_capability_read_word(pcr->pci, PCI_EXP_DEVCTL2, &cap); + if (cap & PCI_EXP_LTR_EN) + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, LTR_CTL, 0xFF, 0xA3); + /* Configure OBFF */ + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, OBFF_CFG, 0x03, 0x03); + /* Configure force_clock_req + * Maybe We should define 0xFF03 as some name + */ + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, 0xFF03, 0x08, 0x08); + /* Correct driving */ + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, + SD30_CLK_DRIVE_SEL, 0xFF, 0x96); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, + SD30_CMD_DRIVE_SEL, 0xFF, 0x96); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, + SD30_DAT_DRIVE_SEL, 0xFF, 0x96); + + return rtsx_pci_send_cmd(pcr, 100); +} + +static int rts5227_optimize_phy(struct rtsx_pcr *pcr) +{ + /* Optimize RX sensitivity */ + return rtsx_pci_write_phy_register(pcr, 0x00, 0xBA42); +} + +static int rts5227_turn_on_led(struct rtsx_pcr *pcr) +{ + return rtsx_pci_write_register(pcr, GPIO_CTL, 0x02, 0x02); +} + +static int rts5227_turn_off_led(struct rtsx_pcr *pcr) +{ + return rtsx_pci_write_register(pcr, GPIO_CTL, 0x02, 0x00); +} + +static int rts5227_enable_auto_blink(struct rtsx_pcr *pcr) +{ + return rtsx_pci_write_register(pcr, OLT_LED_CTL, 0x08, 0x08); +} + +static int rts5227_disable_auto_blink(struct rtsx_pcr *pcr) +{ + return rtsx_pci_write_register(pcr, OLT_LED_CTL, 0x08, 0x00); +} + +static int rts5227_card_power_on(struct rtsx_pcr *pcr, int card) +{ + int err; + + rtsx_pci_init_cmd(pcr); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, + SD_POWER_MASK, SD_PARTIAL_POWER_ON); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, + LDO3318_PWR_MASK, 0x02); + err = rtsx_pci_send_cmd(pcr, 100); + if (err < 0) + return err; + + /* To avoid too large in-rush current */ + udelay(150); + + rtsx_pci_init_cmd(pcr); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, + SD_POWER_MASK, SD_POWER_ON); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, + LDO3318_PWR_MASK, 0x06); + err = rtsx_pci_send_cmd(pcr, 100); + if (err < 0) + return err; + + return 0; +} + +static int rts5227_card_power_off(struct rtsx_pcr *pcr, int card) +{ + rtsx_pci_init_cmd(pcr); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, + SD_POWER_MASK | PMOS_STRG_MASK, + SD_POWER_OFF | PMOS_STRG_400mA); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, + LDO3318_PWR_MASK, 0X00); + return rtsx_pci_send_cmd(pcr, 100); +} + +static int rts5227_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) +{ + int err; + u8 drive_sel; + + if (voltage == OUTPUT_3V3) { + err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24); + if (err < 0) + return err; + drive_sel = 0x96; + } else if (voltage == OUTPUT_1V8) { + err = rtsx_pci_write_phy_register(pcr, 0x11, 0x3C02); + if (err < 0) + return err; + err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C80 | 0x24); + if (err < 0) + return err; + drive_sel = 0xB3; + } else { + return -EINVAL; + } + + /* set pad drive */ + rtsx_pci_init_cmd(pcr); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD30_CLK_DRIVE_SEL, + 0xFF, drive_sel); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD30_CMD_DRIVE_SEL, + 0xFF, drive_sel); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD30_DAT_DRIVE_SEL, + 0xFF, drive_sel); + return rtsx_pci_send_cmd(pcr, 100); +} + +static const struct pcr_ops rts5227_pcr_ops = { + .extra_init_hw = rts5227_extra_init_hw, + .optimize_phy = rts5227_optimize_phy, + .turn_on_led = rts5227_turn_on_led, + .turn_off_led = rts5227_turn_off_led, + .enable_auto_blink = rts5227_enable_auto_blink, + .disable_auto_blink = rts5227_disable_auto_blink, + .card_power_on = rts5227_card_power_on, + .card_power_off = rts5227_card_power_off, + .switch_output_voltage = rts5227_switch_output_voltage, + .cd_deglitch = NULL, + .conv_clk_and_div_n = NULL, +}; + +/* SD Pull Control Enable: + * SD_DAT[3:0] ==> pull up + * SD_CD ==> pull up + * SD_WP ==> pull up + * SD_CMD ==> pull up + * SD_CLK ==> pull down + */ +static const u32 rts5227_sd_pull_ctl_enable_tbl[] = { + RTSX_REG_PAIR(CARD_PULL_CTL2, 0xAA), + RTSX_REG_PAIR(CARD_PULL_CTL3, 0xE9), + 0, +}; + +/* SD Pull Control Disable: + * SD_DAT[3:0] ==> pull down + * SD_CD ==> pull up + * SD_WP ==> pull down + * SD_CMD ==> pull down + * SD_CLK ==> pull down + */ +static const u32 rts5227_sd_pull_ctl_disable_tbl[] = { + RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55), + RTSX_REG_PAIR(CARD_PULL_CTL3, 0xD5), + 0, +}; + +/* MS Pull Control Enable: + * MS CD ==> pull up + * others ==> pull down + */ +static const u32 rts5227_ms_pull_ctl_enable_tbl[] = { + RTSX_REG_PAIR(CARD_PULL_CTL5, 0x55), + RTSX_REG_PAIR(CARD_PULL_CTL6, 0x15), + 0, +}; + +/* MS Pull Control Disable: + * MS CD ==> pull up + * others ==> pull down + */ +static const u32 rts5227_ms_pull_ctl_disable_tbl[] = { + RTSX_REG_PAIR(CARD_PULL_CTL5, 0x55), + RTSX_REG_PAIR(CARD_PULL_CTL6, 0x15), + 0, +}; + +void rts5227_init_params(struct rtsx_pcr *pcr) +{ + pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104; + pcr->num_slots = 2; + pcr->ops = &rts5227_pcr_ops; + + pcr->sd_pull_ctl_enable_tbl = rts5227_sd_pull_ctl_enable_tbl; + pcr->sd_pull_ctl_disable_tbl = rts5227_sd_pull_ctl_disable_tbl; + pcr->ms_pull_ctl_enable_tbl = rts5227_ms_pull_ctl_enable_tbl; + pcr->ms_pull_ctl_disable_tbl = rts5227_ms_pull_ctl_disable_tbl; +} diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index 9016932..822237e 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c @@ -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", diff --git a/drivers/mfd/rtsx_pcr.h b/drivers/mfd/rtsx_pcr.h index 33c210b..2b3ab8a 100644 --- a/drivers/mfd/rtsx_pcr.h +++ b/drivers/mfd/rtsx_pcr.h @@ -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 diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h index 3f2bf26..5d9b81e 100644 --- a/include/linux/mfd/rtsx_pci.h +++ b/include/linux/mfd/rtsx_pci.h @@ -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 -- 1.7.12.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 3/3] mfd: rtsx: support RTS5227 2013-02-04 7:45 ` Roger Tseng @ 2013-02-04 11:57 ` Samuel Ortiz -1 siblings, 0 replies; 17+ messages in thread From: Samuel Ortiz @ 2013-02-04 11:57 UTC (permalink / raw) To: Roger Tseng; +Cc: gregkh, linux-mmc, linux-kernel, wei_wang, devel, cjb Hi Roger, On Mon, Feb 04, 2013 at 03:45:59PM +0800, Roger Tseng wrote: > Support new model RTS5227. > > Signed-off-by: Roger Tseng <rogerable@realtek.com> > Reviewed-by: Wei WANG <wei_wang@realsil.com.cn> > --- > 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. -- Intel Open Source Technology Centre http://oss.intel.com/ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/3] mfd: rtsx: support RTS5227 @ 2013-02-04 11:57 ` Samuel Ortiz 0 siblings, 0 replies; 17+ messages in thread From: Samuel Ortiz @ 2013-02-04 11:57 UTC (permalink / raw) To: Roger Tseng; +Cc: cjb, devel, linux-kernel, linux-mmc, gregkh, wei_wang Hi Roger, On Mon, Feb 04, 2013 at 03:45:59PM +0800, Roger Tseng wrote: > Support new model RTS5227. > > Signed-off-by: Roger Tseng <rogerable@realtek.com> > Reviewed-by: Wei WANG <wei_wang@realsil.com.cn> > --- > 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. -- Intel Open Source Technology Centre http://oss.intel.com/ ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2013-02-11 17:53 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-02-04 7:45 [PATCH 0/3] rtsx: patchset for supporting new model RTS5227 Roger Tseng 2013-02-04 7:45 ` Roger Tseng 2013-02-04 7:45 ` [PATCH 1/3] MMC: rtsx: remove driving adjustment Roger Tseng 2013-02-04 7:45 ` Roger Tseng 2013-02-04 8:47 ` Dan Carpenter 2013-02-05 2:51 ` Roger Tseng 2013-02-05 8:30 ` Dan Carpenter 2013-02-11 17:53 ` Chris Ball 2013-02-11 17:53 ` Chris Ball 2013-02-04 7:45 ` [PATCH 2/3] mfd: rtsx: implement driving adjustment to device-dependent callbacks Roger Tseng 2013-02-04 7:45 ` Roger Tseng 2013-02-04 11:56 ` Samuel Ortiz 2013-02-04 11:56 ` Samuel Ortiz 2013-02-04 7:45 ` [PATCH 3/3] mfd: rtsx: support RTS5227 Roger Tseng 2013-02-04 7:45 ` Roger Tseng 2013-02-04 11:57 ` Samuel Ortiz 2013-02-04 11:57 ` Samuel Ortiz
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.