[PATCH 2/2] mfd: rtsx: fix PM suspend for 5249
From: micky_ching
Date:  Thu Sep 11 2014 - 03:48:32 EST
From: Micky Ching <micky_ching@xxxxxxxxxxxxxx>
Fix rts5249 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@xxxxxxxxxxxxxx>
---
 drivers/mfd/rts5249.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index 573de7b..d6cc546 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -126,10 +126,31 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr)
 	return rtsx_pci_send_cmd(pcr, 100);
 }
+static int rts5249_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 rts5249_optimize_phy(struct rtsx_pcr *pcr)
 {
 	int err;
+	err = rts5249_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 |
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/