Skip to contentSkip to conversation

i.MX6, DesignWare PCI improvements

PATCH In review Andrey Smirnov 3 participants 16 messages Apr 15, 2019 – May 1, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v4 cover i.MX6, DesignWare PCI improvements

Everyone:

This is the series containing various small improvements that I made while reading the code and researching commit history of pci-imx6.c and pcie-designware*.c files. All changes are optional, so commits that don't seem like an improvement can be easily dropped. Hopefully each patch is self-explanatory.

I tested this series on i.MX6Q, i.MX7D and i.MX8MQ.

Feedback is welcome!

Thanks,
Andrey Smirnov

Chagnes since [v3]:

- Collected Reviewed-by from Lucas for most of the patches

- Converted "PCI: imx6: Replace calls to udelay() with usleep_range()" to "PCI: imx6: Use usleep_range() in imx6_pcie_enable_ref_clk()"

- Converted "PCI: imx6: Remove redundant debug tracing" to "PCI:
imx6: Drop imx6_pcie_wait_for_link()"

- Converted all of the callers of pcie_phy_poll_ack() to use true/false in "PCI: imx6: Simplify pcie_phy_poll_ack()"

Changes since [v2]:

- All non i.MX6 patches dropped, since they were accepted as a seprarte series

- Series rebased on latest 'dwc-pci' branch of PCI tree

- Patches "PCI: imx6: Use flags to indicate support for suspend" and "PCI: imx6: Replace calls to udelay() with usleep_range()" added to the series

Changes since [v1]:

- Dropped "PCI: imx6: Drop imx6_pcie_link_up()" due to the matter already having been addressed by "PCI: imx6: Fix link training status detection in link up check" from Trent Piepho

- Changed "designware" -> "dwc" for all subject lines

- Collected Acked-by's from Gustavo Pimentel

[v3] lkml.kernel.org/r/[email protected] [v2] lkml.kernel.org/r/[email protected] [v1] lkml.kernel.org/r/[email protected]

Andrey Smirnov (11):
PCI: imx6: Simplify imx7d_pcie_wait_for_phy_pll_lock()
PCI: imx6: Drop imx6_pcie_wait_for_link()
PCI: imx6: Return -ETIMEOUT from imx6_pcie_wait_for_speed_change()
PCI: imx6: Remove PCIE_PL_PFLR_* constants
PCI: dwc: imx6: Share PHY debug register definitions
PCI: imx6: Make use of BIT() in constant definitions
PCI: imx6: Simplify bit operations in PHY functions
PCI: imx6: Simplify pcie_phy_poll_ack()
PCI: imx6: Restrict PHY register data to 16-bit
PCI: imx6: Use flags to indicate support for suspend
PCI: imx6: Use usleep_range() in imx6_pcie_enable_ref_clk()

 drivers/pci/controller/dwc/pci-imx6.c        | 143 ++++++++-----------
 drivers/pci/controller/dwc/pcie-designware.c |  12 +-
 drivers/pci/controller/dwc/pcie-designware.h |   3 +
 3 files changed, 62 insertions(+), 96 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH v4 1/11 PCI: imx6: Simplify imx7d_pcie_wait_for_phy_pll_lock()

Make use of regmap_read_poll_timeout() to simplify imx7d_pcie_wait_for_phy_pll_lock(). No functional change intended.

---
 drivers/pci/controller/dwc/pci-imx6.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +7 -14
index 3d627f94a166..ea2617712a3b 100644
@@ -89,9 +89,8 @@ struct imx6_pcie {
 };
 
 /* Parameters for the waiting for PCIe PHY PLL to lock on i.MX7 */
-#define PHY_PLL_LOCK_WAIT_MAX_RETRIES	2000
-#define PHY_PLL_LOCK_WAIT_USLEEP_MIN	50
 #define PHY_PLL_LOCK_WAIT_USLEEP_MAX	200
+#define PHY_PLL_LOCK_WAIT_TIMEOUT	(2000 * PHY_PLL_LOCK_WAIT_USLEEP_MAX)
 
 /* PCIe Root Complex registers (memory-mapped) */
 #define PCIE_RC_IMX6_MSI_CAP			0x50
@@ -488,20 +487,14 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
 static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie)
 {
 	u32 val;
-	unsigned int retries;
 	struct device *dev = imx6_pcie->pci->dev;
 
-	for (retries = 0; retries < PHY_PLL_LOCK_WAIT_MAX_RETRIES; retries++) {
-		regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR22, &val);
-
-		if (val & IMX7D_GPR22_PCIE_PHY_PLL_LOCKED)
-			return;
-
-		usleep_range(PHY_PLL_LOCK_WAIT_USLEEP_MIN,
-			     PHY_PLL_LOCK_WAIT_USLEEP_MAX);
-	}
-
-	dev_err(dev, "PCIe PLL lock timeout\n");
+	if (regmap_read_poll_timeout(imx6_pcie->iomuxc_gpr,
+				     IOMUXC_GPR22, val,
+				     val & IMX7D_GPR22_PCIE_PHY_PLL_LOCKED,
+				     PHY_PLL_LOCK_WAIT_USLEEP_MAX,
+				     PHY_PLL_LOCK_WAIT_TIMEOUT))
+		dev_err(dev, "PCIe PLL lock timeout\n");
 }
 
 static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)
Signature · 1 line
2.20.1
#2 lore raw

PATCH v4 2/11 PCI: imx6: Drop imx6_pcie_wait_for_link()

In reply to Andrey Smirnov

All calls to imx6_pcie_wait_for_link() share the same error path and the state of PHY debug registers will already be printed there, so there's no real reason we can't just use dw_pcie_wait_for_link(). Drop imx6_pcie_wait_for_link() and replace it with dw_pcie_wait_for_link().

---
 drivers/pci/controller/dwc/pci-imx6.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +2 -17
index ea2617712a3b..bb3dcfdbf697 100644
@@ -723,21 +723,6 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie)
 	return 0;
 }
 
-static int imx6_pcie_wait_for_link(struct imx6_pcie *imx6_pcie)
-{
-	struct dw_pcie *pci = imx6_pcie->pci;
-	struct device *dev = pci->dev;
-
-	/* check if the link is up or not */
-	if (!dw_pcie_wait_for_link(pci))
-		return 0;
-
-	dev_dbg(dev, "DEBUG_R0: 0x%08x, DEBUG_R1: 0x%08x\n",
-		dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R0),
-		dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1));
-	return -ETIMEDOUT;
-}
-
 static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie)
 {
 	struct dw_pcie *pci = imx6_pcie->pci;
@@ -796,7 +781,7 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie)
 	/* Start LTSSM. */
 	imx6_pcie_ltssm_enable(dev);
 
-	ret = imx6_pcie_wait_for_link(imx6_pcie);
+	ret = dw_pcie_wait_for_link(pci);
 	if (ret)
 		goto err_reset_phy;
 
@@ -834,7 +819,7 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie)
 		}
 
 		/* Make sure link training is finished as well! */
-		ret = imx6_pcie_wait_for_link(imx6_pcie);
+		ret = dw_pcie_wait_for_link(pci);
 		if (ret) {
 			dev_err(dev, "Failed to bring link up!\n");
 			goto err_reset_phy;
Signature · 1 line
2.20.1
maintainer Reviewed-by on v4 2/11
#3 lore raw

Re: [PATCH v4 02/11] PCI: imx6: Drop imx6_pcie_wait_for_link()

Am Sonntag, den 14.04.2019, 17:46 -0700 schrieb Andrey Smirnov:

Quoted 5 lines

All calls to imx6_pcie_wait_for_link() share the same error path and the state of PHY debug registers will already be printed there, so there's no real reason we can't just use dw_pcie_wait_for_link(). Drop imx6_pcie_wait_for_link() and replace it with dw_pcie_wait_for_link().

Quoted 8 lines
Quoted 6 lines
Cc Lorenzo Pieralisi <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Chris Healy <[email protected]>
Cc Lucas Stach <[email protected]>
Quoted 48 lines

---
 drivers/pci/controller/dwc/pci-imx6.c | 19 ++-----------------

 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +0 -0
index ea2617712a3b..bb3dcfdbf697 100644
@@ -723,21 +723,6 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie)
 >  	return 0;
  }

drivers/pci/controller/dwc/pci-imx6.c +0 -2
-static int imx6_pcie_wait_for_link(struct imx6_pcie *imx6_pcie)
-{

drivers/pci/controller/dwc/pci-imx6.c static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) · line 729

Quoted 2 lines
drivers/pci/controller/dwc/pci-imx6.c +0 -2
-	struct dw_pcie *pci = imx6_pcie->pci;
-	struct device *dev = pci->dev;

-

drivers/pci/controller/dwc/pci-imx6.c static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) · line 733

Quoted 3 lines
drivers/pci/controller/dwc/pci-imx6.c +0 -3
-	/* check if the link is up or not */
-	if (!dw_pcie_wait_for_link(pci))
-		return 0;

-

Quoted 4 lines
drivers/pci/controller/dwc/pci-imx6.c +0 -4
-	dev_dbg(dev, "DEBUG_R0: 0x%08x, DEBUG_R1: 0x%08x\n",
-		dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R0),
-		dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1));
-	return -ETIMEDOUT;
drivers/pci/controller/dwc/pci-imx6.c +0 -2
-}
-

 static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) {

Quoted 1 line

  struct dw_pcie *pci = imx6_pcie->pci;

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -796,7 +781,7 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie)
Quoted 2 lines

  /* Start LTSSM. */
  imx6_pcie_ltssm_enable(dev);

Quoted 4 lines
(quoted diff) +1 -1
-	ret = imx6_pcie_wait_for_link(imx6_pcie);
+	ret = dw_pcie_wait_for_link(pci);

  if (ret)
  goto err_reset_phy;

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -834,7 +819,7 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie)
 >  		}

Quoted 6 lines

  /* Make sure link training is finished as well! */

(quoted diff) +1 -1
-		ret = imx6_pcie_wait_for_link(imx6_pcie);
+		ret = dw_pcie_wait_for_link(pci);

  if (ret) {
  dev_err(dev, "Failed to bring link up!\n"); goto err_reset_phy;

#4 lore raw

PATCH v4 3/11 PCI: imx6: Return -ETIMEOUT from imx6_pcie_wait_for_speed_change()

In reply to Andrey Smirnov

Change error code from EINVAL to ETIMEDOUT in imx6_pcie_wait_for_speed_change() since that error code seems more appropriate.

---
 drivers/pci/controller/dwc/pci-imx6.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pci-imx6.c +1 -1
index bb3dcfdbf697..021ef121a058 100644
@@ -739,7 +739,7 @@ static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie)
 	}
 
 	dev_err(dev, "Speed change timeout\n");
-	return -EINVAL;
+	return -ETIMEDOUT;
 }
 
 static void imx6_pcie_ltssm_enable(struct device *dev)
Signature · 1 line
2.20.1
#5 lore raw

PATCH v4 4/11 PCI: imx6: Remove PCIE_PL_PFLR_* constants

In reply to Andrey Smirnov

Code using these constants was removed in commit a71280722eeb ("PCI:
imx6: Remove LTSSM disable workaround"). No functional change intended.

---
 drivers/pci/controller/dwc/pci-imx6.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +0 -3
index 021ef121a058..c0867df090f5 100644
@@ -103,9 +103,6 @@ struct imx6_pcie {
 
 /* PCIe Port Logic registers (memory-mapped) */
 #define PL_OFFSET 0x700
-#define PCIE_PL_PFLR (PL_OFFSET + 0x08)
-#define PCIE_PL_PFLR_LINK_STATE_MASK		(0x3f << 16)
-#define PCIE_PL_PFLR_FORCE_LINK			(1 << 15)
 #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
 #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
 
Signature · 1 line
2.20.1
#6 lore raw

PATCH v4 5/11 PCI: dwc: imx6: Share PHY debug register definitions

In reply to Andrey Smirnov

Both pcie-designware.c and pci-imx6.c contain custom definitions for PHY debug registers R0/R1 and on top of that there's already a definition for R0 in pcie-designware.h. Move all of the definitions to pcie-designware.h. No functional change intended.

---
 drivers/pci/controller/dwc/pci-imx6.c        |  6 ++----
 drivers/pci/controller/dwc/pcie-designware.c | 12 +++---------
 drivers/pci/controller/dwc/pcie-designware.h |  3 +++
 3 files changed, 8 insertions(+), 13 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +2 -4
index c0867df090f5..eeacdebd9b50 100644
@@ -103,8 +103,6 @@ struct imx6_pcie {
 
 /* PCIe Port Logic registers (memory-mapped) */
 #define PL_OFFSET 0x700
-#define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
-#define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
 
 #define PCIE_PHY_CTRL (PL_OFFSET + 0x114)
 #define PCIE_PHY_CTRL_DATA_LOC 0
@@ -831,8 +829,8 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie)
 
 err_reset_phy:
 	dev_dbg(dev, "PHY DEBUG_R0=0x%08x DEBUG_R1=0x%08x\n",
-		dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R0),
-		dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1));
+		dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0),
+		dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1));
 	imx6_pcie_reset_phy(imx6_pcie);
 	return ret;
 }
drivers/pci/controller/dwc/pcie-designware.c +3 -9
index 31f6331ca46f..086e87a40316 100644
@@ -14,12 +14,6 @@
 
 #include "pcie-designware.h"
 
-/* PCIe Port Logic registers */
-#define PLR_OFFSET			0x700
-#define PCIE_PHY_DEBUG_R1		(PLR_OFFSET + 0x2c)
-#define PCIE_PHY_DEBUG_R1_LINK_UP	(0x1 << 4)
-#define PCIE_PHY_DEBUG_R1_LINK_IN_TRAINING	(0x1 << 29)
-
 int dw_pcie_read(void __iomem *addr, int size, u32 *val)
 {
 	if (!IS_ALIGNED((uintptr_t)addr, size)) {
@@ -334,9 +328,9 @@ int dw_pcie_link_up(struct dw_pcie *pci)
 	if (pci->ops->link_up)
 		return pci->ops->link_up(pci);
 
-	val = readl(pci->dbi_base + PCIE_PHY_DEBUG_R1);
-	return ((val & PCIE_PHY_DEBUG_R1_LINK_UP) &&
-		(!(val & PCIE_PHY_DEBUG_R1_LINK_IN_TRAINING)));
+	val = readl(pci->dbi_base + PCIE_PORT_DEBUG1);
+	return ((val & PCIE_PORT_DEBUG1_LINK_UP) &&
+		(!(val & PCIE_PORT_DEBUG1_LINK_IN_TRAINING)));
 }
 
 void dw_pcie_setup(struct dw_pcie *pci)
drivers/pci/controller/dwc/pcie-designware.h +3 -0
index 377f4c0b52da..b33ae13194be 100644
@@ -41,6 +41,9 @@
 #define PCIE_PORT_DEBUG0		0x728
 #define PORT_LOGIC_LTSSM_STATE_MASK	0x1f
 #define PORT_LOGIC_LTSSM_STATE_L0	0x11
+#define PCIE_PORT_DEBUG1		0x72C
+#define PCIE_PORT_DEBUG1_LINK_UP		BIT(4)
+#define PCIE_PORT_DEBUG1_LINK_IN_TRAINING	BIT(29)
 
 #define PCIE_LINK_WIDTH_SPEED_CONTROL	0x80C
 #define PORT_LOGIC_SPEED_CHANGE		BIT(17)
Signature · 1 line
2.20.1
#7 lore raw

PATCH v4 6/11 PCI: imx6: Make use of BIT() in constant definitions

In reply to Andrey Smirnov

Avoid using explicit left shifts and convert various definitions to use BIT() instead. No functional change intended.

---
 drivers/pci/controller/dwc/pci-imx6.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +4 -4
index eeacdebd9b50..5650642ab248 100644
@@ -118,14 +118,14 @@ struct imx6_pcie {
 
 /* PHY registers (not memory-mapped) */
 #define PCIE_PHY_ATEOVRD			0x10
-#define  PCIE_PHY_ATEOVRD_EN			(0x1 << 2)
+#define  PCIE_PHY_ATEOVRD_EN			BIT(2)
 #define  PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT	0
 #define  PCIE_PHY_ATEOVRD_REF_CLKDIV_MASK	0x1
 
 #define PCIE_PHY_MPLL_OVRD_IN_LO		0x11
 #define  PCIE_PHY_MPLL_MULTIPLIER_SHIFT		2
 #define  PCIE_PHY_MPLL_MULTIPLIER_MASK		0x7f
-#define  PCIE_PHY_MPLL_MULTIPLIER_OVRD		(0x1 << 9)
+#define  PCIE_PHY_MPLL_MULTIPLIER_OVRD		BIT(9)
 
 #define PCIE_PHY_RX_ASIC_OUT 0x100D
 #define PCIE_PHY_RX_ASIC_OUT_VALID	(1 << 0)
@@ -148,8 +148,8 @@ struct imx6_pcie {
 #define PCIE_PHY_CMN_REG26_ATT_MODE	0xBC
 
 #define PHY_RX_OVRD_IN_LO 0x1005
-#define PHY_RX_OVRD_IN_LO_RX_DATA_EN (1 << 5)
-#define PHY_RX_OVRD_IN_LO_RX_PLL_EN (1 << 3)
+#define PHY_RX_OVRD_IN_LO_RX_DATA_EN		BIT(5)
+#define PHY_RX_OVRD_IN_LO_RX_PLL_EN		BIT(3)
 
 static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, int exp_val)
 {
Signature · 1 line
2.20.1
#8 lore raw

PATCH v4 7/11 PCI: imx6: Simplify bit operations in PHY functions

In reply to Andrey Smirnov

Simplify the code by incorporating left shifts into constant defnitions as well as using FIELD_PREP/GENMASK. No functional change intended.

---
 drivers/pci/controller/dwc/pci-imx6.c | 28 +++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +14 -14
index 5650642ab248..669e01353026 100644
@@ -105,11 +105,11 @@ struct imx6_pcie {
 #define PL_OFFSET 0x700
 
 #define PCIE_PHY_CTRL (PL_OFFSET + 0x114)
-#define PCIE_PHY_CTRL_DATA_LOC 0
-#define PCIE_PHY_CTRL_CAP_ADR_LOC 16
-#define PCIE_PHY_CTRL_CAP_DAT_LOC 17
-#define PCIE_PHY_CTRL_WR_LOC 18
-#define PCIE_PHY_CTRL_RD_LOC 19
+#define PCIE_PHY_CTRL_DATA(x)		FIELD_PREP(GENMASK(15, 0), (x))
+#define PCIE_PHY_CTRL_CAP_ADR		BIT(16)
+#define PCIE_PHY_CTRL_CAP_DAT		BIT(17)
+#define PCIE_PHY_CTRL_WR		BIT(18)
+#define PCIE_PHY_CTRL_RD		BIT(19)
 
 #define PCIE_PHY_STAT (PL_OFFSET + 0x110)
 #define PCIE_PHY_STAT_ACK_LOC 16
@@ -178,17 +178,17 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr)
 	u32 val;
 	int ret;
 
-	val = addr << PCIE_PHY_CTRL_DATA_LOC;
+	val = PCIE_PHY_CTRL_DATA(addr);
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val);
 
-	val |= (0x1 << PCIE_PHY_CTRL_CAP_ADR_LOC);
+	val |= PCIE_PHY_CTRL_CAP_ADR;
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val);
 
 	ret = pcie_phy_poll_ack(imx6_pcie, 1);
 	if (ret)
 		return ret;
 
-	val = addr << PCIE_PHY_CTRL_DATA_LOC;
+	val = PCIE_PHY_CTRL_DATA(addr);
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val);
 
 	return pcie_phy_poll_ack(imx6_pcie, 0);
@@ -206,7 +206,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data)
 		return ret;
 
 	/* assert Read signal */
-	phy_ctl = 0x1 << PCIE_PHY_CTRL_RD_LOC;
+	phy_ctl = PCIE_PHY_CTRL_RD;
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, phy_ctl);
 
 	ret = pcie_phy_poll_ack(imx6_pcie, 1);
@@ -234,11 +234,11 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
 	if (ret)
 		return ret;
 
-	var = data << PCIE_PHY_CTRL_DATA_LOC;
+	var = PCIE_PHY_CTRL_DATA(data);
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);
 
 	/* capture data */
-	var |= (0x1 << PCIE_PHY_CTRL_CAP_DAT_LOC);
+	var |= PCIE_PHY_CTRL_CAP_DAT;
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);
 
 	ret = pcie_phy_poll_ack(imx6_pcie, 1);
@@ -246,7 +246,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
 		return ret;
 
 	/* deassert cap data */
-	var = data << PCIE_PHY_CTRL_DATA_LOC;
+	var = PCIE_PHY_CTRL_DATA(data);
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);
 
 	/* wait for ack de-assertion */
@@ -255,7 +255,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
 		return ret;
 
 	/* assert wr signal */
-	var = 0x1 << PCIE_PHY_CTRL_WR_LOC;
+	var = PCIE_PHY_CTRL_WR;
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);
 
 	/* wait for ack */
@@ -264,7 +264,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
 		return ret;
 
 	/* deassert wr signal */
-	var = data << PCIE_PHY_CTRL_DATA_LOC;
+	var = PCIE_PHY_CTRL_DATA(data);
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);
 
 	/* wait for ack de-assertion */
Signature · 1 line
2.20.1
#9 lore raw

PATCH v4 8/11 PCI: imx6: Simplify pcie_phy_poll_ack()

In reply to Andrey Smirnov

Simplify pcie_phy_poll_ack() by incorporating shifting into constant definition and convert the code to use 'bool'. No functional change intended.

Cc Lorenzo Pieralisi <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Chris Healy <[email protected]>
Cc Lucas Stach <[email protected]>
---
 drivers/pci/controller/dwc/pci-imx6.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +13 -13
index 669e01353026..3fd084357488 100644
@@ -112,7 +112,7 @@ struct imx6_pcie {
 #define PCIE_PHY_CTRL_RD		BIT(19)
 
 #define PCIE_PHY_STAT (PL_OFFSET + 0x110)
-#define PCIE_PHY_STAT_ACK_LOC 16
+#define PCIE_PHY_STAT_ACK		BIT(16)
 
 #define PCIE_LINK_WIDTH_SPEED_CONTROL	0x80C
 
@@ -151,16 +151,16 @@ struct imx6_pcie {
 #define PHY_RX_OVRD_IN_LO_RX_DATA_EN		BIT(5)
 #define PHY_RX_OVRD_IN_LO_RX_PLL_EN		BIT(3)
 
-static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, int exp_val)
+static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, bool exp_val)
 {
 	struct dw_pcie *pci = imx6_pcie->pci;
-	u32 val;
+	bool val;
 	u32 max_iterations = 10;
 	u32 wait_counter = 0;
 
 	do {
-		val = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT);
-		val = (val >> PCIE_PHY_STAT_ACK_LOC) & 0x1;
+		val = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT) &
+			PCIE_PHY_STAT_ACK;
 		wait_counter++;
 
 		if (val == exp_val)
@@ -184,14 +184,14 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr)
 	val |= PCIE_PHY_CTRL_CAP_ADR;
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val);
 
-	ret = pcie_phy_poll_ack(imx6_pcie, 1);
+	ret = pcie_phy_poll_ack(imx6_pcie, true);
 	if (ret)
 		return ret;
 
 	val = PCIE_PHY_CTRL_DATA(addr);
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val);
 
-	return pcie_phy_poll_ack(imx6_pcie, 0);
+	return pcie_phy_poll_ack(imx6_pcie, false);
 }
 
 /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */
@@ -209,7 +209,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data)
 	phy_ctl = PCIE_PHY_CTRL_RD;
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, phy_ctl);
 
-	ret = pcie_phy_poll_ack(imx6_pcie, 1);
+	ret = pcie_phy_poll_ack(imx6_pcie, true);
 	if (ret)
 		return ret;
 
@@ -219,7 +219,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data)
 	/* deassert Read signal */
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, 0x00);
 
-	return pcie_phy_poll_ack(imx6_pcie, 0);
+	return pcie_phy_poll_ack(imx6_pcie, false);
 }
 
 static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
@@ -241,7 +241,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
 	var |= PCIE_PHY_CTRL_CAP_DAT;
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);
 
-	ret = pcie_phy_poll_ack(imx6_pcie, 1);
+	ret = pcie_phy_poll_ack(imx6_pcie, true);
 	if (ret)
 		return ret;
 
@@ -250,7 +250,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);
 
 	/* wait for ack de-assertion */
-	ret = pcie_phy_poll_ack(imx6_pcie, 0);
+	ret = pcie_phy_poll_ack(imx6_pcie, false);
 	if (ret)
 		return ret;
 
@@ -259,7 +259,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);
 
 	/* wait for ack */
-	ret = pcie_phy_poll_ack(imx6_pcie, 1);
+	ret = pcie_phy_poll_ack(imx6_pcie, true);
 	if (ret)
 		return ret;
 
@@ -268,7 +268,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);
 
 	/* wait for ack de-assertion */
-	ret = pcie_phy_poll_ack(imx6_pcie, 0);
+	ret = pcie_phy_poll_ack(imx6_pcie, false);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.20.1
maintainer Reviewed-by on v4 8/11
#10 lore raw

Re: [PATCH v4 08/11] PCI: imx6: Simplify pcie_phy_poll_ack()

Am Sonntag, den 14.04.2019, 17:46 -0700 schrieb Andrey Smirnov:

Quoted 11 lines

Simplify pcie_phy_poll_ack() by incorporating shifting into constant definition and convert the code to use 'bool'. No functional change intended.

Cc Lorenzo Pieralisi <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Chris Healy <[email protected]>
Cc Lucas Stach <[email protected]>
Quoted 122 lines

---
 drivers/pci/controller/dwc/pci-imx6.c | 26 +++++++++++++----------
---

 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +0 -0
index 669e01353026..3fd084357488 100644
@@ -112,7 +112,7 @@ struct imx6_pcie {
  #define PCIE_PHY_CTRL_RD		BIT(19)


 #define PCIE_PHY_STAT (PL_OFFSET + 0x110)

drivers/pci/controller/dwc/pci-imx6.c +1 -1
-#define PCIE_PHY_STAT_ACK_LOC 16
+#define PCIE_PHY_STAT_ACK		BIT(16)


 #define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -151,16 +151,16 @@ struct imx6_pcie {
  #define PHY_RX_OVRD_IN_LO_RX_DATA_EN		BIT(5)
  #define PHY_RX_OVRD_IN_LO_RX_PLL_EN		BIT(3)


-static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, int exp_val)
+static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, bool exp_val)
 {
  struct dw_pcie *pci = imx6_pcie->pci;

drivers/pci/controller/dwc/pci-imx6.c +1 -1
-	u32 val;
+	bool val;

  u32 max_iterations = 10;
  u32 wait_counter = 0;

  do {

drivers/pci/controller/dwc/pci-imx6.c +2 -2
-		val = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT);
-		val = (val >> PCIE_PHY_STAT_ACK_LOC) & 0x1;
+		val = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT) &
+			PCIE_PHY_STAT_ACK;

  wait_counter++;

  if (val == exp_val)

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -184,14 +184,14 @@ static int pcie_phy_wait_ack(struct imx6_pcie
 *imx6_pcie, int addr)
  	val |= PCIE_PHY_CTRL_CAP_ADR;
  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val);

drivers/pci/controller/dwc/pci-imx6.c +1 -1
-	ret = pcie_phy_poll_ack(imx6_pcie, 1);
+	ret = pcie_phy_poll_ack(imx6_pcie, true);

  if (ret)
  return ret;

  val = PCIE_PHY_CTRL_DATA(addr); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val);

drivers/pci/controller/dwc/pci-imx6.c +1 -1
-	return pcie_phy_poll_ack(imx6_pcie, 0);
+	return pcie_phy_poll_ack(imx6_pcie, false);

 }

 /* Read from the 16-bit PCIe PHY control registers (not memory- mapped) */

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -209,7 +209,7 @@ static int pcie_phy_read(struct imx6_pcie
 *imx6_pcie, int addr, int *data)
  	phy_ctl = PCIE_PHY_CTRL_RD;
  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, phy_ctl);

drivers/pci/controller/dwc/pci-imx6.c +1 -1
-	ret = pcie_phy_poll_ack(imx6_pcie, 1);
+	ret = pcie_phy_poll_ack(imx6_pcie, true);

  if (ret)
  return ret;

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -219,7 +219,7 @@ static int pcie_phy_read(struct imx6_pcie
 *imx6_pcie, int addr, int *data)
  	/* deassert Read signal */
  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, 0x00);

drivers/pci/controller/dwc/pci-imx6.c +1 -1
-	return pcie_phy_poll_ack(imx6_pcie, 0);
+	return pcie_phy_poll_ack(imx6_pcie, false);

 }

 static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -241,7 +241,7 @@ static int pcie_phy_write(struct imx6_pcie
 *imx6_pcie, int addr, int data)
  	var |= PCIE_PHY_CTRL_CAP_DAT;
  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);

drivers/pci/controller/dwc/pci-imx6.c +1 -1
-	ret = pcie_phy_poll_ack(imx6_pcie, 1);
+	ret = pcie_phy_poll_ack(imx6_pcie, true);

  if (ret)
  return ret;

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -250,7 +250,7 @@ static int pcie_phy_write(struct imx6_pcie
 *imx6_pcie, int addr, int data)
  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);


  /* wait for ack de-assertion */

drivers/pci/controller/dwc/pci-imx6.c +1 -1
-	ret = pcie_phy_poll_ack(imx6_pcie, 0);
+	ret = pcie_phy_poll_ack(imx6_pcie, false);

  if (ret)
  return ret;

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -259,7 +259,7 @@ static int pcie_phy_write(struct imx6_pcie
 *imx6_pcie, int addr, int data)
  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);


  /* wait for ack */

drivers/pci/controller/dwc/pci-imx6.c +1 -1
-	ret = pcie_phy_poll_ack(imx6_pcie, 1);
+	ret = pcie_phy_poll_ack(imx6_pcie, true);

  if (ret)
  return ret;

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -268,7 +268,7 @@ static int pcie_phy_write(struct imx6_pcie
 *imx6_pcie, int addr, int data)
  	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var);


  /* wait for ack de-assertion */

drivers/pci/controller/dwc/pci-imx6.c +1 -1
-	ret = pcie_phy_poll_ack(imx6_pcie, 0);
+	ret = pcie_phy_poll_ack(imx6_pcie, false);

  if (ret)
  return ret;

#11 lore raw

PATCH v4 9/11 PCI: imx6: Restrict PHY register data to 16-bit

In reply to Andrey Smirnov

PHY registers on i.MX6 are 16-bit wide, so we can get rid of explicit masking if we restrict pcie_phy_read/pcie_phy_write to use 'u16' instead of 'int'. No functional change intended.

---
 drivers/pci/controller/dwc/pci-imx6.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +6 -7
index 3fd084357488..30e764b6cbcc 100644
@@ -195,10 +195,10 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr)
 }
 
 /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */
-static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data)
+static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data)
 {
 	struct dw_pcie *pci = imx6_pcie->pci;
-	u32 val, phy_ctl;
+	u32 phy_ctl;
 	int ret;
 
 	ret = pcie_phy_wait_ack(imx6_pcie, addr);
@@ -213,8 +213,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data)
 	if (ret)
 		return ret;
 
-	val = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT);
-	*data = val & 0xffff;
+	*data = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT);
 
 	/* deassert Read signal */
 	dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, 0x00);
@@ -222,7 +221,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data)
 	return pcie_phy_poll_ack(imx6_pcie, false);
 }
 
-static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
+static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data)
 {
 	struct dw_pcie *pci = imx6_pcie->pci;
 	u32 var;
@@ -279,7 +278,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data)
 
 static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie)
 {
-	u32 tmp;
+	u16 tmp;
 
 	if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY))
 		return;
@@ -675,7 +674,7 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie)
 {
 	unsigned long phy_rate = clk_get_rate(imx6_pcie->pcie_phy);
 	int mult, div;
-	u32 val;
+	u16 val;
 
 	if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY))
 		return 0;
Signature · 1 line
2.20.1
#12 lore raw

PATCH v4 10/11 PCI: imx6: Use flags to indicate support for suspend

In reply to Andrey Smirnov

Now that driver data has flags variable that can be used to indicate quirks/features supported we can switch the code to use it instead of having a special function that does so based on variant alone. No functional change intended.

---
 drivers/pci/controller/dwc/pci-imx6.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +6 -9
index 30e764b6cbcc..3e45f49b8a4f 100644
@@ -52,6 +52,7 @@ enum imx6_pcie_variants {
 
 #define IMX6_PCIE_FLAG_IMX6_PHY			BIT(0)
 #define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE	BIT(1)
+#define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND		BIT(2)
 
 struct imx6_pcie_drvdata {
 	enum imx6_pcie_variants variant;
@@ -965,17 +966,11 @@ static void imx6_pcie_clk_disable(struct imx6_pcie *imx6_pcie)
 	}
 }
 
-static inline bool imx6_pcie_supports_suspend(struct imx6_pcie *imx6_pcie)
-{
-	return (imx6_pcie->drvdata->variant == IMX7D ||
-		imx6_pcie->drvdata->variant == IMX6SX);
-}
-
 static int imx6_pcie_suspend_noirq(struct device *dev)
 {
 	struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev);
 
-	if (!imx6_pcie_supports_suspend(imx6_pcie))
+	if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_SUSPEND))
 		return 0;
 
 	imx6_pcie_pm_turnoff(imx6_pcie);
@@ -991,7 +986,7 @@ static int imx6_pcie_resume_noirq(struct device *dev)
 	struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev);
 	struct pcie_port *pp = &imx6_pcie->pci->pp;
 
-	if (!imx6_pcie_supports_suspend(imx6_pcie))
+	if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_SUSPEND))
 		return 0;
 
 	imx6_pcie_assert_core_reset(imx6_pcie);
@@ -1221,7 +1216,8 @@ static const struct imx6_pcie_drvdata drvdata[] = {
 	[IMX6SX] = {
 		.variant = IMX6SX,
 		.flags = IMX6_PCIE_FLAG_IMX6_PHY |
-			 IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE,
+			 IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE |
+			 IMX6_PCIE_FLAG_SUPPORTS_SUSPEND,
 	},
 	[IMX6QP] = {
 		.variant = IMX6QP,
@@ -1230,6 +1226,7 @@ static const struct imx6_pcie_drvdata drvdata[] = {
 	},
 	[IMX7D] = {
 		.variant = IMX7D,
+		.flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND,
 	},
 	[IMX8MQ] = {
 		.variant = IMX8MQ,
Signature · 1 line
2.20.1
#13 lore raw

PATCH v4 11/11 PCI: imx6: Use usleep_range() in imx6_pcie_enable_ref_clk()

In reply to Andrey Smirnov

imx6_pcie_enable_ref_clk() is never called in atomic context, so there's no need to use udelay(). Replace it with usleep_range().

Cc Lorenzo Pieralisi <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Chris Healy <[email protected]>
Cc Lucas Stach <[email protected]>
---
 drivers/pci/controller/dwc/pci-imx6.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pci-imx6.c +1 -1
index 3e45f49b8a4f..c6d6bde4d860 100644
@@ -449,7 +449,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
 		 * reset time is too short, cannot meet the requirement.
 		 * add one ~10us delay here.
 		 */
-		udelay(10);
+		usleep_range(10, 100);
 		regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
 				   IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
 		break;
Signature · 1 line
2.20.1
maintainer Reviewed-by on v4 11/11
#14 lore raw

Re: [PATCH v4 11/11] PCI: imx6: Use usleep_range() in imx6_pcie_enable_ref_clk()

Am Sonntag, den 14.04.2019, 17:46 -0700 schrieb Andrey Smirnov:

Quoted 10 lines

imx6_pcie_enable_ref_clk() is never called in atomic context, so there's no need to use udelay(). Replace it with usleep_range().

Cc Lorenzo Pieralisi <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Chris Healy <[email protected]>
Cc Lucas Stach <[email protected]>
Quoted 17 lines

---
 drivers/pci/controller/dwc/pci-imx6.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pci-imx6.c +0 -0
index 3e45f49b8a4f..c6d6bde4d860 100644
@@ -449,7 +449,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
Quoted 8 lines

   * reset time is too short, cannot meet the requirement.
   * add one ~10us delay here.
   */

drivers/pci/controller/dwc/pci-imx6.c +1 -1
-		udelay(10);
+		usleep_range(10, 100);

  regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); break;

#15 lore raw
In reply to Andrey Smirnov
Quoted 9 lines · Andrey Smirnov

Everyone:

This is the series containing various small improvements that I made while reading the code and researching commit history of pci-imx6.c and pcie-designware*.c files. All changes are optional, so commits that don't seem like an improvement can be easily dropped. Hopefully each patch is self-explanatory.

I tested this series on i.MX6Q, i.MX7D and i.MX8MQ.

Applied with Lucas' tags to pci/imx, hopefully we can squeeze this in for the v5.2 merge window.

Lorenzo

Quoted 65 lines

Feedback is welcome!

Thanks,
Andrey Smirnov

Chagnes since [v3]:

- Collected Reviewed-by from Lucas for most of the patches

- Converted "PCI: imx6: Replace calls to udelay() with usleep_range()" to "PCI: imx6: Use usleep_range() in imx6_pcie_enable_ref_clk()"

- Converted "PCI: imx6: Remove redundant debug tracing" to "PCI:
imx6: Drop imx6_pcie_wait_for_link()"

- Converted all of the callers of pcie_phy_poll_ack() to use true/false in "PCI: imx6: Simplify pcie_phy_poll_ack()"

Changes since [v2]:

- All non i.MX6 patches dropped, since they were accepted as a seprarte series

- Series rebased on latest 'dwc-pci' branch of PCI tree

- Patches "PCI: imx6: Use flags to indicate support for suspend" and "PCI: imx6: Replace calls to udelay() with usleep_range()" added to the series

Changes since [v1]:

- Dropped "PCI: imx6: Drop imx6_pcie_link_up()" due to the matter already having been addressed by "PCI: imx6: Fix link training status detection in link up check" from Trent Piepho

- Changed "designware" -> "dwc" for all subject lines

- Collected Acked-by's from Gustavo Pimentel

[v3] lkml.kernel.org/r/[email protected] [v2] lkml.kernel.org/r/[email protected] [v1] lkml.kernel.org/r/[email protected]

Andrey Smirnov (11):
PCI: imx6: Simplify imx7d_pcie_wait_for_phy_pll_lock()
PCI: imx6: Drop imx6_pcie_wait_for_link()
PCI: imx6: Return -ETIMEOUT from imx6_pcie_wait_for_speed_change()
PCI: imx6: Remove PCIE_PL_PFLR_* constants
PCI: dwc: imx6: Share PHY debug register definitions
PCI: imx6: Make use of BIT() in constant definitions
PCI: imx6: Simplify bit operations in PHY functions
PCI: imx6: Simplify pcie_phy_poll_ack()
PCI: imx6: Restrict PHY register data to 16-bit
PCI: imx6: Use flags to indicate support for suspend
PCI: imx6: Use usleep_range() in imx6_pcie_enable_ref_clk()

 drivers/pci/controller/dwc/pci-imx6.c        | 143 ++++++++-----------
 drivers/pci/controller/dwc/pcie-designware.c |  12 +-
 drivers/pci/controller/dwc/pcie-designware.h |   3 +
 3 files changed, 62 insertions(+), 96 deletions(-)
Signature · 1 line
2.20.1