[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c13c93e9f5fca1a46df2b141899d50c13b28aaa0.1410330111.git.micky_ching@realsil.com.cn>
Date: Thu, 11 Sep 2014 15:17:52 +0800
From: <micky_ching@...lsil.com.cn>
To: <sameo@...ux.intel.com>, <lee.jones@...aro.org>
CC: <devel@...uxdriverproject.org>, <linux-kernel@...r.kernel.org>,
<gregkh@...uxfoundation.org>, <rogerable@...ltek.com>,
<wei_wang@...lsil.com.cn>, Micky Ching <micky_ching@...lsil.com.cn>
Subject: [PATCH 1/2] mfd: rtsx: fix PM suspend for 5227
From: Micky Ching <micky_ching@...lsil.com.cn>
Fix rts5227 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@...lsil.com.cn>
---
drivers/mfd/rts5227.c | 23 +++++++++++++++++++++++
include/linux/mfd/rtsx_pci.h | 13 +++++++++++++
2 files changed, 36 insertions(+)
diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c
index 9c8eec8..3d4998e 100644
--- a/drivers/mfd/rts5227.c
+++ b/drivers/mfd/rts5227.c
@@ -128,8 +128,31 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr)
return rtsx_pci_send_cmd(pcr, 100);
}
+static int rts5227_pm_reset(struct rtsx_pcr *pcr)
+{
+ int err;
+
+ /* init aspm */
+ err = rtsx_pci_update_cfg_byte(pcr, LCTLR, 0xFC, 0);
+ if (err < 0)
+ return err;
+
+ /* reset PM_CTRL3 before send buffer cmd */
+ err = rtsx_pci_write_register(pcr, PM_CTRL3, 0x10, 0x00);
+ if (err < 0)
+ return err;
+
+ return err;
+}
+
static int rts5227_optimize_phy(struct rtsx_pcr *pcr)
{
+ int err;
+
+ err = rts5227_pm_reset(pcr);
+ if (err < 0)
+ return err;
+
/* Optimize RX sensitivity */
return rtsx_pci_write_phy_register(pcr, 0x00, 0xBA42);
}
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 74346d5..037fbc5 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -967,4 +967,17 @@ 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)
+ return err;
+ err = pci_write_config_byte(pcr->pci, addr, (val & mask) | append);
+ return err;
+}
+
#endif
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists