Message ID | 1418114702-16331-1-git-send-email-adam.lee@canonical.com |
---|---|
State | New |
Headers | show |
On Tue, Dec 09, 2014 at 04:45:02PM +0800, Adam Lee wrote: > From: Micky Ching <micky_ching@realsil.com.cn> > > BugLink: http://bugs.launchpad.net/bugs/1359052 > > Fix rts5227&5249 failed send buffer cmd after suspend, > PM_CTRL3 should reset before send any buffer cmd after suspend. > Otherwise, buffer cmd will failed, this will lead resume fail. > > Signed-off-by: Micky Ching <micky_ching@realsil.com.cn> > Signed-off-by: Lee Jones <lee.jones@linaro.org> > (cherry picked from commit 5cb5d9616a47d5383a85379afa4429382ef46b38) > Signed-off-by: Adam Lee <adam.lee@canonical.com> > --- > drivers/mfd/Makefile | 2 +- > drivers/mfd/rts5227.c | 6 ++++++ > drivers/mfd/rts5249.c | 4 ++++ > drivers/mfd/rtsx_gops.c | 37 +++++++++++++++++++++++++++++++++++++ > drivers/mfd/rtsx_pcr.h | 3 +++ > include/linux/mfd/rtsx_pci.h | 28 ++++++++++++++++++++++++++++ > 6 files changed, 79 insertions(+), 1 deletion(-) > create mode 100644 drivers/mfd/rtsx_gops.c > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > index 8a28dc9..04883ee 100644 > --- a/drivers/mfd/Makefile > +++ b/drivers/mfd/Makefile > @@ -12,7 +12,7 @@ obj-$(CONFIG_MFD_CROS_EC) += cros_ec.o > obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o > obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o > > -rtsx_pci-objs := rtsx_pcr.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.o > +rtsx_pci-objs := rtsx_pcr.o rtsx_gops.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.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 > index 9c8eec8..3240740 100644 > --- a/drivers/mfd/rts5227.c > +++ b/drivers/mfd/rts5227.c > @@ -130,6 +130,12 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr) > > static int rts5227_optimize_phy(struct rtsx_pcr *pcr) > { > + int err; > + > + err = rtsx_gops_pm_reset(pcr); > + if (err < 0) > + return err; > + > /* Optimize RX sensitivity */ > return rtsx_pci_write_phy_register(pcr, 0x00, 0xBA42); > } > diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c > index 573de7b..cf425cc 100644 > --- a/drivers/mfd/rts5249.c > +++ b/drivers/mfd/rts5249.c > @@ -130,6 +130,10 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr) > { > int err; > > + err = rtsx_gops_pm_reset(pcr); > + if (err < 0) > + return err; > + > err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV, > PHY_REG_REV_RESV | PHY_REG_REV_RXIDLE_LATCHED | > PHY_REG_REV_P1_EN | PHY_REG_REV_RXIDLE_EN | > diff --git a/drivers/mfd/rtsx_gops.c b/drivers/mfd/rtsx_gops.c > new file mode 100644 > index 0000000..b1a98c6 > --- /dev/null > +++ b/drivers/mfd/rtsx_gops.c > @@ -0,0 +1,37 @@ > +/* Driver for Realtek PCI-Express card reader > + * > + * Copyright(c) 2009-2013 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: > + * Micky Ching <micky_ching@realsil.com.cn> > + */ > + > +#include <linux/mfd/rtsx_pci.h> > +#include "rtsx_pcr.h" > + > +int rtsx_gops_pm_reset(struct rtsx_pcr *pcr) > +{ > + int err; > + > + /* init aspm */ > + rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0x00); > + err = rtsx_pci_update_cfg_byte(pcr, LCTLR, ~LCTLR_ASPM_CTL_MASK, 0x00); > + if (err < 0) > + return err; > + > + /* reset PM_CTRL3 before send buffer cmd */ > + return rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00); > +} > diff --git a/drivers/mfd/rtsx_pcr.h b/drivers/mfd/rtsx_pcr.h > index 07e4c2e..fe2bbb6 100644 > --- a/drivers/mfd/rtsx_pcr.h > +++ b/drivers/mfd/rtsx_pcr.h > @@ -72,4 +72,7 @@ do { \ > pcr->ms_pull_ctl_disable_tbl = __device##_ms_pull_ctl_disable_tbl; \ > } while (0) > > +/* generic operations */ > +int rtsx_gops_pm_reset(struct rtsx_pcr *pcr); > + > #endif > diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h > index 0ce7721..3b69bff 100644 > --- a/include/linux/mfd/rtsx_pci.h > +++ b/include/linux/mfd/rtsx_pci.h > @@ -707,6 +707,14 @@ > #define PM_CTRL1 0xFF44 > #define PM_CTRL2 0xFF45 > #define PM_CTRL3 0xFF46 > +#define SDIO_SEND_PME_EN 0x80 > +#define FORCE_RC_MODE_ON 0x40 > +#define FORCE_RX50_LINK_ON 0x20 > +#define D3_DELINK_MODE_EN 0x10 > +#define USE_PESRTB_CTL_DELINK 0x08 > +#define DELAY_PIN_WAKE 0x04 > +#define RESET_PIN_WAKE 0x02 > +#define PM_WAKE_EN 0x01 > #define PM_CTRL4 0xFF47 > > /* Memory mapping */ > @@ -752,6 +760,14 @@ > #define PHY_DUM_REG 0x1F > > #define LCTLR 0x80 > +#define LCTLR_EXT_SYNC 0x80 > +#define LCTLR_COMMON_CLOCK_CFG 0x40 > +#define LCTLR_RETRAIN_LINK 0x20 > +#define LCTLR_LINK_DISABLE 0x10 > +#define LCTLR_RCB 0x08 > +#define LCTLR_RESERVED 0x04 > +#define LCTLR_ASPM_CTL_MASK 0x03 > + > #define PCR_SETTING_REG1 0x724 > #define PCR_SETTING_REG2 0x814 > #define PCR_SETTING_REG3 0x747 > @@ -961,4 +977,16 @@ static inline u8 *rtsx_pci_get_cmd_data(struct rtsx_pcr *pcr) > return (u8 *)(pcr->host_cmds_ptr); > } > > +static inline int rtsx_pci_update_cfg_byte(struct rtsx_pcr *pcr, int addr, > + u8 mask, u8 append) > +{ > + int err; > + u8 val; > + > + err = pci_read_config_byte(pcr->pci, addr, &val); > + if (err < 0) > + return err; > + return pci_write_config_byte(pcr->pci, addr, (val & mask) | append); > +} > + > #endif Looks to be an upstream cherry-pick, and specific to these drivers. Acked-by: Andy Whitcroft <apw@canonical.com> -apw
On Tue, Dec 09, 2014 at 04:45:02PM +0800, Adam Lee wrote: > From: Micky Ching <micky_ching@realsil.com.cn> > > BugLink: http://bugs.launchpad.net/bugs/1359052 > > Fix rts5227&5249 failed send buffer cmd after suspend, > PM_CTRL3 should reset before send any buffer cmd after suspend. > Otherwise, buffer cmd will failed, this will lead resume fail. > > Signed-off-by: Micky Ching <micky_ching@realsil.com.cn> > Signed-off-by: Lee Jones <lee.jones@linaro.org> > (cherry picked from commit 5cb5d9616a47d5383a85379afa4429382ef46b38) > Signed-off-by: Adam Lee <adam.lee@canonical.com> > --- > drivers/mfd/Makefile | 2 +- > drivers/mfd/rts5227.c | 6 ++++++ > drivers/mfd/rts5249.c | 4 ++++ > drivers/mfd/rtsx_gops.c | 37 +++++++++++++++++++++++++++++++++++++ > drivers/mfd/rtsx_pcr.h | 3 +++ > include/linux/mfd/rtsx_pci.h | 28 ++++++++++++++++++++++++++++ > 6 files changed, 79 insertions(+), 1 deletion(-) > create mode 100644 drivers/mfd/rtsx_gops.c > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > index 8a28dc9..04883ee 100644 > --- a/drivers/mfd/Makefile > +++ b/drivers/mfd/Makefile > @@ -12,7 +12,7 @@ obj-$(CONFIG_MFD_CROS_EC) += cros_ec.o > obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o > obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o > > -rtsx_pci-objs := rtsx_pcr.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.o > +rtsx_pci-objs := rtsx_pcr.o rtsx_gops.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.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 > index 9c8eec8..3240740 100644 > --- a/drivers/mfd/rts5227.c > +++ b/drivers/mfd/rts5227.c > @@ -130,6 +130,12 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr) > > static int rts5227_optimize_phy(struct rtsx_pcr *pcr) > { > + int err; > + > + err = rtsx_gops_pm_reset(pcr); > + if (err < 0) > + return err; > + > /* Optimize RX sensitivity */ > return rtsx_pci_write_phy_register(pcr, 0x00, 0xBA42); > } > diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c > index 573de7b..cf425cc 100644 > --- a/drivers/mfd/rts5249.c > +++ b/drivers/mfd/rts5249.c > @@ -130,6 +130,10 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr) > { > int err; > > + err = rtsx_gops_pm_reset(pcr); > + if (err < 0) > + return err; > + > err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV, > PHY_REG_REV_RESV | PHY_REG_REV_RXIDLE_LATCHED | > PHY_REG_REV_P1_EN | PHY_REG_REV_RXIDLE_EN | > diff --git a/drivers/mfd/rtsx_gops.c b/drivers/mfd/rtsx_gops.c > new file mode 100644 > index 0000000..b1a98c6 > --- /dev/null > +++ b/drivers/mfd/rtsx_gops.c > @@ -0,0 +1,37 @@ > +/* Driver for Realtek PCI-Express card reader > + * > + * Copyright(c) 2009-2013 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: > + * Micky Ching <micky_ching@realsil.com.cn> > + */ > + > +#include <linux/mfd/rtsx_pci.h> > +#include "rtsx_pcr.h" > + > +int rtsx_gops_pm_reset(struct rtsx_pcr *pcr) > +{ > + int err; > + > + /* init aspm */ > + rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0x00); > + err = rtsx_pci_update_cfg_byte(pcr, LCTLR, ~LCTLR_ASPM_CTL_MASK, 0x00); > + if (err < 0) > + return err; > + > + /* reset PM_CTRL3 before send buffer cmd */ > + return rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00); > +} > diff --git a/drivers/mfd/rtsx_pcr.h b/drivers/mfd/rtsx_pcr.h > index 07e4c2e..fe2bbb6 100644 > --- a/drivers/mfd/rtsx_pcr.h > +++ b/drivers/mfd/rtsx_pcr.h > @@ -72,4 +72,7 @@ do { \ > pcr->ms_pull_ctl_disable_tbl = __device##_ms_pull_ctl_disable_tbl; \ > } while (0) > > +/* generic operations */ > +int rtsx_gops_pm_reset(struct rtsx_pcr *pcr); > + > #endif > diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h > index 0ce7721..3b69bff 100644 > --- a/include/linux/mfd/rtsx_pci.h > +++ b/include/linux/mfd/rtsx_pci.h > @@ -707,6 +707,14 @@ > #define PM_CTRL1 0xFF44 > #define PM_CTRL2 0xFF45 > #define PM_CTRL3 0xFF46 > +#define SDIO_SEND_PME_EN 0x80 > +#define FORCE_RC_MODE_ON 0x40 > +#define FORCE_RX50_LINK_ON 0x20 > +#define D3_DELINK_MODE_EN 0x10 > +#define USE_PESRTB_CTL_DELINK 0x08 > +#define DELAY_PIN_WAKE 0x04 > +#define RESET_PIN_WAKE 0x02 > +#define PM_WAKE_EN 0x01 > #define PM_CTRL4 0xFF47 > > /* Memory mapping */ > @@ -752,6 +760,14 @@ > #define PHY_DUM_REG 0x1F > > #define LCTLR 0x80 > +#define LCTLR_EXT_SYNC 0x80 > +#define LCTLR_COMMON_CLOCK_CFG 0x40 > +#define LCTLR_RETRAIN_LINK 0x20 > +#define LCTLR_LINK_DISABLE 0x10 > +#define LCTLR_RCB 0x08 > +#define LCTLR_RESERVED 0x04 > +#define LCTLR_ASPM_CTL_MASK 0x03 > + > #define PCR_SETTING_REG1 0x724 > #define PCR_SETTING_REG2 0x814 > #define PCR_SETTING_REG3 0x747 > @@ -961,4 +977,16 @@ static inline u8 *rtsx_pci_get_cmd_data(struct rtsx_pcr *pcr) > return (u8 *)(pcr->host_cmds_ptr); > } > > +static inline int rtsx_pci_update_cfg_byte(struct rtsx_pcr *pcr, int addr, > + u8 mask, u8 append) > +{ > + int err; > + u8 val; > + > + err = pci_read_config_byte(pcr->pci, addr, &val); > + if (err < 0) > + return err; > + return pci_write_config_byte(pcr->pci, addr, (val & mask) | append); > +} > + > #endif > -- > 2.1.3 > > > -- > kernel-team mailing list > kernel-team@lists.ubuntu.com > https://lists.ubuntu.com/mailman/listinfo/kernel-team Looks good
On Tue, Dec 09, 2014 at 04:45:02PM +0800, Adam Lee wrote: > From: Micky Ching <micky_ching@realsil.com.cn> > > BugLink: http://bugs.launchpad.net/bugs/1359052 > > Fix rts5227&5249 failed send buffer cmd after suspend, > PM_CTRL3 should reset before send any buffer cmd after suspend. > Otherwise, buffer cmd will failed, this will lead resume fail. > > Signed-off-by: Micky Ching <micky_ching@realsil.com.cn> > Signed-off-by: Lee Jones <lee.jones@linaro.org> > (cherry picked from commit 5cb5d9616a47d5383a85379afa4429382ef46b38) > Signed-off-by: Adam Lee <adam.lee@canonical.com> > --- > drivers/mfd/Makefile | 2 +- > drivers/mfd/rts5227.c | 6 ++++++ > drivers/mfd/rts5249.c | 4 ++++ > drivers/mfd/rtsx_gops.c | 37 +++++++++++++++++++++++++++++++++++++ > drivers/mfd/rtsx_pcr.h | 3 +++ > include/linux/mfd/rtsx_pci.h | 28 ++++++++++++++++++++++++++++ > 6 files changed, 79 insertions(+), 1 deletion(-) > create mode 100644 drivers/mfd/rtsx_gops.c > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > index 8a28dc9..04883ee 100644 > --- a/drivers/mfd/Makefile > +++ b/drivers/mfd/Makefile > @@ -12,7 +12,7 @@ obj-$(CONFIG_MFD_CROS_EC) += cros_ec.o > obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o > obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o > > -rtsx_pci-objs := rtsx_pcr.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.o > +rtsx_pci-objs := rtsx_pcr.o rtsx_gops.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.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 > index 9c8eec8..3240740 100644 > --- a/drivers/mfd/rts5227.c > +++ b/drivers/mfd/rts5227.c > @@ -130,6 +130,12 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr) > > static int rts5227_optimize_phy(struct rtsx_pcr *pcr) > { > + int err; > + > + err = rtsx_gops_pm_reset(pcr); > + if (err < 0) > + return err; > + > /* Optimize RX sensitivity */ > return rtsx_pci_write_phy_register(pcr, 0x00, 0xBA42); > } > diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c > index 573de7b..cf425cc 100644 > --- a/drivers/mfd/rts5249.c > +++ b/drivers/mfd/rts5249.c > @@ -130,6 +130,10 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr) > { > int err; > > + err = rtsx_gops_pm_reset(pcr); > + if (err < 0) > + return err; > + > err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV, > PHY_REG_REV_RESV | PHY_REG_REV_RXIDLE_LATCHED | > PHY_REG_REV_P1_EN | PHY_REG_REV_RXIDLE_EN | > diff --git a/drivers/mfd/rtsx_gops.c b/drivers/mfd/rtsx_gops.c > new file mode 100644 > index 0000000..b1a98c6 > --- /dev/null > +++ b/drivers/mfd/rtsx_gops.c > @@ -0,0 +1,37 @@ > +/* Driver for Realtek PCI-Express card reader > + * > + * Copyright(c) 2009-2013 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: > + * Micky Ching <micky_ching@realsil.com.cn> > + */ > + > +#include <linux/mfd/rtsx_pci.h> > +#include "rtsx_pcr.h" > + > +int rtsx_gops_pm_reset(struct rtsx_pcr *pcr) > +{ > + int err; > + > + /* init aspm */ > + rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0x00); > + err = rtsx_pci_update_cfg_byte(pcr, LCTLR, ~LCTLR_ASPM_CTL_MASK, 0x00); > + if (err < 0) > + return err; > + > + /* reset PM_CTRL3 before send buffer cmd */ > + return rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00); > +} > diff --git a/drivers/mfd/rtsx_pcr.h b/drivers/mfd/rtsx_pcr.h > index 07e4c2e..fe2bbb6 100644 > --- a/drivers/mfd/rtsx_pcr.h > +++ b/drivers/mfd/rtsx_pcr.h > @@ -72,4 +72,7 @@ do { \ > pcr->ms_pull_ctl_disable_tbl = __device##_ms_pull_ctl_disable_tbl; \ > } while (0) > > +/* generic operations */ > +int rtsx_gops_pm_reset(struct rtsx_pcr *pcr); > + > #endif > diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h > index 0ce7721..3b69bff 100644 > --- a/include/linux/mfd/rtsx_pci.h > +++ b/include/linux/mfd/rtsx_pci.h > @@ -707,6 +707,14 @@ > #define PM_CTRL1 0xFF44 > #define PM_CTRL2 0xFF45 > #define PM_CTRL3 0xFF46 > +#define SDIO_SEND_PME_EN 0x80 > +#define FORCE_RC_MODE_ON 0x40 > +#define FORCE_RX50_LINK_ON 0x20 > +#define D3_DELINK_MODE_EN 0x10 > +#define USE_PESRTB_CTL_DELINK 0x08 > +#define DELAY_PIN_WAKE 0x04 > +#define RESET_PIN_WAKE 0x02 > +#define PM_WAKE_EN 0x01 > #define PM_CTRL4 0xFF47 > > /* Memory mapping */ > @@ -752,6 +760,14 @@ > #define PHY_DUM_REG 0x1F > > #define LCTLR 0x80 > +#define LCTLR_EXT_SYNC 0x80 > +#define LCTLR_COMMON_CLOCK_CFG 0x40 > +#define LCTLR_RETRAIN_LINK 0x20 > +#define LCTLR_LINK_DISABLE 0x10 > +#define LCTLR_RCB 0x08 > +#define LCTLR_RESERVED 0x04 > +#define LCTLR_ASPM_CTL_MASK 0x03 > + > #define PCR_SETTING_REG1 0x724 > #define PCR_SETTING_REG2 0x814 > #define PCR_SETTING_REG3 0x747 > @@ -961,4 +977,16 @@ static inline u8 *rtsx_pci_get_cmd_data(struct rtsx_pcr *pcr) > return (u8 *)(pcr->host_cmds_ptr); > } > > +static inline int rtsx_pci_update_cfg_byte(struct rtsx_pcr *pcr, int addr, > + u8 mask, u8 append) > +{ > + int err; > + u8 val; > + > + err = pci_read_config_byte(pcr->pci, addr, &val); > + if (err < 0) > + return err; > + return pci_write_config_byte(pcr->pci, addr, (val & mask) | append); > +} > + > #endif > -- > 2.1.3 > > > -- > kernel-team mailing list > kernel-team@lists.ubuntu.com > https://lists.ubuntu.com/mailman/listinfo/kernel-team I had to make a small adjustment to the context of the patch when applying it to trusty. Therefore, I changed it on trusty to be a backport. Brad
On Tue, Dec 09, 2014 at 11:00:26AM -0800, Brad Figg wrote: > I had to make a small adjustment to the context of the patch when applying > it to trusty. Therefore, I changed it on trusty to be a backport. > > Brad A little confused here, that context adjustment was handled by `git cherry-pick` command automatically, still considered as a backport?
Applied to Vivid. -apw
On 12/10/2014 07:00 PM, Adam Lee wrote: > On Tue, Dec 09, 2014 at 11:00:26AM -0800, Brad Figg wrote: >> I had to make a small adjustment to the context of the patch when applying >> it to trusty. Therefore, I changed it on trusty to be a backport. >> >> Brad > > A little confused here, that context adjustment was handled by `git > cherry-pick` command automatically, still considered as a backport? > Adam, So yes, the commit will cherry-pick but since we add Acks we use git am to apply the commit after modification and that failed. You can compare what is in linus' tree with the commit in the trusty tree to see what I changed. Brad
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 8a28dc9..04883ee 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -12,7 +12,7 @@ obj-$(CONFIG_MFD_CROS_EC) += cros_ec.o obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o -rtsx_pci-objs := rtsx_pcr.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.o +rtsx_pci-objs := rtsx_pcr.o rtsx_gops.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.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 index 9c8eec8..3240740 100644 --- a/drivers/mfd/rts5227.c +++ b/drivers/mfd/rts5227.c @@ -130,6 +130,12 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr) static int rts5227_optimize_phy(struct rtsx_pcr *pcr) { + int err; + + err = rtsx_gops_pm_reset(pcr); + if (err < 0) + return err; + /* Optimize RX sensitivity */ return rtsx_pci_write_phy_register(pcr, 0x00, 0xBA42); } diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c index 573de7b..cf425cc 100644 --- a/drivers/mfd/rts5249.c +++ b/drivers/mfd/rts5249.c @@ -130,6 +130,10 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr) { int err; + err = rtsx_gops_pm_reset(pcr); + if (err < 0) + return err; + err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV, PHY_REG_REV_RESV | PHY_REG_REV_RXIDLE_LATCHED | PHY_REG_REV_P1_EN | PHY_REG_REV_RXIDLE_EN | diff --git a/drivers/mfd/rtsx_gops.c b/drivers/mfd/rtsx_gops.c new file mode 100644 index 0000000..b1a98c6 --- /dev/null +++ b/drivers/mfd/rtsx_gops.c @@ -0,0 +1,37 @@ +/* Driver for Realtek PCI-Express card reader + * + * Copyright(c) 2009-2013 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: + * Micky Ching <micky_ching@realsil.com.cn> + */ + +#include <linux/mfd/rtsx_pci.h> +#include "rtsx_pcr.h" + +int rtsx_gops_pm_reset(struct rtsx_pcr *pcr) +{ + int err; + + /* init aspm */ + rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0x00); + err = rtsx_pci_update_cfg_byte(pcr, LCTLR, ~LCTLR_ASPM_CTL_MASK, 0x00); + if (err < 0) + return err; + + /* reset PM_CTRL3 before send buffer cmd */ + return rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00); +} diff --git a/drivers/mfd/rtsx_pcr.h b/drivers/mfd/rtsx_pcr.h index 07e4c2e..fe2bbb6 100644 --- a/drivers/mfd/rtsx_pcr.h +++ b/drivers/mfd/rtsx_pcr.h @@ -72,4 +72,7 @@ do { \ pcr->ms_pull_ctl_disable_tbl = __device##_ms_pull_ctl_disable_tbl; \ } while (0) +/* generic operations */ +int rtsx_gops_pm_reset(struct rtsx_pcr *pcr); + #endif diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h index 0ce7721..3b69bff 100644 --- a/include/linux/mfd/rtsx_pci.h +++ b/include/linux/mfd/rtsx_pci.h @@ -707,6 +707,14 @@ #define PM_CTRL1 0xFF44 #define PM_CTRL2 0xFF45 #define PM_CTRL3 0xFF46 +#define SDIO_SEND_PME_EN 0x80 +#define FORCE_RC_MODE_ON 0x40 +#define FORCE_RX50_LINK_ON 0x20 +#define D3_DELINK_MODE_EN 0x10 +#define USE_PESRTB_CTL_DELINK 0x08 +#define DELAY_PIN_WAKE 0x04 +#define RESET_PIN_WAKE 0x02 +#define PM_WAKE_EN 0x01 #define PM_CTRL4 0xFF47 /* Memory mapping */ @@ -752,6 +760,14 @@ #define PHY_DUM_REG 0x1F #define LCTLR 0x80 +#define LCTLR_EXT_SYNC 0x80 +#define LCTLR_COMMON_CLOCK_CFG 0x40 +#define LCTLR_RETRAIN_LINK 0x20 +#define LCTLR_LINK_DISABLE 0x10 +#define LCTLR_RCB 0x08 +#define LCTLR_RESERVED 0x04 +#define LCTLR_ASPM_CTL_MASK 0x03 + #define PCR_SETTING_REG1 0x724 #define PCR_SETTING_REG2 0x814 #define PCR_SETTING_REG3 0x747 @@ -961,4 +977,16 @@ static inline u8 *rtsx_pci_get_cmd_data(struct rtsx_pcr *pcr) return (u8 *)(pcr->host_cmds_ptr); } +static inline int rtsx_pci_update_cfg_byte(struct rtsx_pcr *pcr, int addr, + u8 mask, u8 append) +{ + int err; + u8 val; + + err = pci_read_config_byte(pcr->pci, addr, &val); + if (err < 0) + return err; + return pci_write_config_byte(pcr->pci, addr, (val & mask) | append); +} + #endif