Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1191768

[PATCH v2 3/3] PCI: host: pci-dra7xx: Idle the module by disabling MSE bit

From Kishon Vijay Abraham I <kishon@ti.com>
Newsgroups linux.kernel
Subject [PATCH v2 3/3] PCI: host: pci-dra7xx: Idle the module by disabling MSE bit
Date 2015-07-24 14:00 +0200
Message-ID <pPJNW-4T4-33@gated-at.bofh.it> (permalink)
References <pPJNV-4T4-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


DRA7xx require MSE bit to be cleared to set the master in
standby mode. (In DRA7xx TRM_vE, section 24.9.4.5.2.2.1 PCIe
Controller Master Standby Behavior advises to use the clearing
of the local MSE bit to set the master in standby. Without this
some of the clocks do not idle).

Cleared the MSE bit on suspend and enabled it back on resume.
Clearing MSE bit is required to get clocks to be idled after
suspend.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 drivers/pci/host/pci-dra7xx.c |   23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/host/pci-dra7xx.c b/drivers/pci/host/pci-dra7xx.c
index d3ee2ef..7e798e8 100644
--- a/drivers/pci/host/pci-dra7xx.c
+++ b/drivers/pci/host/pci-dra7xx.c
@@ -83,6 +83,17 @@ static inline void dra7xx_pcie_writel(struct dra7xx_pcie *pcie, u32 offset,
 	writel(value, pcie->base + offset);
 }
 
+static inline u32 dra7xx_pcie_readl_rc(struct pcie_port *pp, u32 offset)
+{
+	return readl(pp->dbi_base + offset);
+}
+
+static inline void dra7xx_pcie_writel_rc(struct pcie_port *pp, u32 offset,
+					 u32 value)
+{
+	writel(value, pp->dbi_base + offset);
+}
+
 static int dra7xx_pcie_link_up(struct pcie_port *pp)
 {
 	struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp);
@@ -438,8 +449,12 @@ static int dra7xx_pcie_suspend(struct device *dev)
 {
 	struct dra7xx_pcie *dra7xx = dev_get_drvdata(dev);
 	struct pcie_port *pp = &dra7xx->pp;
+	u32 val;
 
-	dw_pcie_suspend_rc(pp);
+	/* clear MSE */
+	val = dra7xx_pcie_readl_rc(pp, PCI_COMMAND);
+	val &= ~PCI_COMMAND_MEMORY;
+	dra7xx_pcie_writel_rc(pp, PCI_COMMAND, val);
 
 	return 0;
 }
@@ -448,8 +463,12 @@ static int dra7xx_pcie_resume(struct device *dev)
 {
 	struct dra7xx_pcie *dra7xx = dev_get_drvdata(dev);
 	struct pcie_port *pp = &dra7xx->pp;
+	u32 val;
 
-	dw_pcie_resume_rc(pp);
+	/* clear MSE */
+	val = dra7xx_pcie_readl_rc(pp, PCI_COMMAND);
+	val |= PCI_COMMAND_MEMORY;
+	dra7xx_pcie_writel_rc(pp, PCI_COMMAND, val);
 
 	return 0;
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/3] dra7xx: Add PM support to PCIe Kishon Vijay Abraham I <kishon@ti.com> - 2015-07-24 14:00 +0200
  [PATCH v2 2/3] PCI: host: pci-dra7xx: add pm support to pci dra7xx Kishon Vijay Abraham I <kishon@ti.com> - 2015-07-24 14:00 +0200
  [PATCH v2 3/3] PCI: host: pci-dra7xx: Idle the module by disabling MSE bit Kishon Vijay Abraham I <kishon@ti.com> - 2015-07-24 14:00 +0200
  [PATCH v2 1/3] PCI: host: pci-dra7xx: Disable pm_runtime on get_sync failure Kishon Vijay Abraham I <kishon@ti.com> - 2015-07-24 14:00 +0200

csiph-web