Skip to contentSkip to conversation

PCIE support for i.MX8MQ

PATCH Superseded Andrey Smirnov 5 participants 17 messages Dec 6, 2018 – Dec 17, 2018

Subsystems (5)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v2 cover PCIE support for i.MX8MQ

Everyone:

This series contains changes I made in order to enable support of PCIE IP block on i.MX8MQ SoCs (full tree can be found at [github-v2]).

NOTE: The last patch have a Kconfig symbol depenency on [imx8mq-kconfig].

Changes since [v1]:

- Driver changed to use single "fsl,controller-id" property to distinguish between two intances of PCIE IP block

- All code pertaining to L1SS was dropped to simplify the patch

- Documented additions to DT bindings

Feedback is welcome!

Thanks,
Andrey Smirnov

[v1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
[github-v2] https://github.com/ndreys/linux/commits/imx8mq-pcie-v2
[imx8mq-kconfig] https://lore.kernel.org/linux-arm-kernel/[email protected]/

Andrey Smirnov (3):
PCI: imx: No-op imx6_setup_phy_mpll() on i.MX7D
PCI: imx: No-op imx6_pcie_reset_phy() on i.MX7D
PCI: imx: Add support for i.MX8MQ

 .../bindings/pci/fsl,imx6q-pcie.txt           |  6 +-
 drivers/pci/controller/dwc/Kconfig            |  2 +-
 drivers/pci/controller/dwc/pci-imx6.c         | 87 ++++++++++++++++++-
 3 files changed, 90 insertions(+), 5 deletions(-)
Signature · 1 line
2.19.1
#5 lore raw

PATCH v2 3/3 PCI: imx: Add support for i.MX8MQ

Add code needed to support i.MX8MQ variant.

---
 .../bindings/pci/fsl,imx6q-pcie.txt           |  6 +-
 drivers/pci/controller/dwc/Kconfig            |  2 +-
 drivers/pci/controller/dwc/pci-imx6.c         | 85 +++++++++++++++++--
 3 files changed, 86 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +5 -1
index f37494d5a7be..40b46d11e7e7 100644
@@ -9,6 +9,7 @@ Required properties:
 	- "fsl,imx6sx-pcie",
 	- "fsl,imx6qp-pcie"
 	- "fsl,imx7d-pcie"
+	- "fsl,imx8mq-pcie"
 - reg: base address and length of the PCIe controller
 - interrupts: A list of interrupt outputs of the controller. Must contain an
   entry for each entry in the interrupt-names property.
@@ -43,7 +44,7 @@ Additional required properties for imx6sx-pcie:
 	- "pcie_inbound_axi"
 - power-domains: Must be set to a phandle pointing to the PCIE_PHY power domain
 
-Additional required properties for imx7d-pcie:
+Additional required properties for imx7d-pcie and imx8mq-pcie:
 - power-domains: Must be set to a phandle pointing to PCIE_PHY power domain
 - resets: Must contain phandles to PCIe-related reset lines exposed by SRC
   IP block
@@ -52,6 +53,9 @@ Additional required properties for imx7d-pcie:
 	       - "apps"
 	       - "turnoff"
 
+Additional required properties for imx8mq-pcie:
+- fsl,controller-id: Logical ID of a given PCIE controller. PCIE1 is 0, PCIE2 is 1;
+
 Example:
 
 	pcie@01000000 {
drivers/pci/controller/dwc/Kconfig +1 -1
index 91b0194240a5..2b139acccf32 100644
@@ -90,7 +90,7 @@ config PCI_EXYNOS
 
 config PCI_IMX6
 	bool "Freescale i.MX6 PCIe controller"
-	depends on SOC_IMX6Q || (ARM && COMPILE_TEST)
+	depends on SOC_IMX8MQ || SOC_IMX6Q || (ARM && COMPILE_TEST)
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIE_DW_HOST
 
drivers/pci/controller/dwc/pci-imx6.c +80 -5

206 lines not on this page · raw message

Signature · 1 line
2.19.1
#1 lore raw

PATCH v2 1/3 PCI: imx: No-op imx6_setup_phy_mpll() on i.MX7D

In reply to Andrey Smirnov

PCIE PHY IP block on i.MX7D differs from the one used on i.MX6 family, so none of the code in current implementation of imx6_setup_phy_mpll() is applicable.

---
 drivers/pci/controller/dwc/pci-imx6.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/pci/controller/dwc/pci-imx6.c +3 -0
index 2cbef2d7c207..c140f7987598 100644
@@ -525,6 +525,9 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie)
 	int mult, div;
 	u32 val;
 
+	if (imx6_pcie->variant == IMX7D)
+		return 0;
+
 	switch (phy_rate) {
 	case 125000000:
 		/*
Signature · 1 line
2.19.1
#3 lore raw

PATCH v2 2/3 PCI: imx: No-op imx6_pcie_reset_phy() on i.MX7D

In reply to Andrey Smirnov

PCIE PHY IP block on i.MX7D differs from the one used on i.MX6 family, so none of the code in current implementation of imx6_pcie_reset_phy() is applicable.

---
 drivers/pci/controller/dwc/pci-imx6.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/pci/controller/dwc/pci-imx6.c +3 -0
index c140f7987598..3c3002861d25 100644
@@ -245,6 +245,9 @@ static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie)
 {
 	u32 tmp;
 
+	if (imx6_pcie->variant == IMX7D)
+		return;
+
 	pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp);
 	tmp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN |
 		PHY_RX_OVRD_IN_LO_RX_PLL_EN);
Signature · 1 line
2.19.1
maintainer Reviewed-by on v2 1/3
#2 lore raw

Re: [PATCH v2 1/3] PCI: imx: No-op imx6_setup_phy_mpll() on i.MX7D

In reply to Andrey Smirnov

Am Mittwoch, den 05.12.2018, 23:35 -0800 schrieb Andrey Smirnov:

Quoted 6 lines

PCIE PHY IP block on i.MX7D differs from the one used on i.MX6 family,
so none of the code in current implementation of imx6_setup_phy_mpll()
is applicable.

Quoted 13 lines
Quoted 20 lines

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

 1 file changed, 3 insertions(+)
drivers/pci/controller/dwc/pci-imx6.c +0 -0
index 2cbef2d7c207..c140f7987598 100644
@@ -525,6 +525,9 @@ static int imx6_setup_phy_mpll(struct imx6_pcie
 *imx6_pcie)
  	int mult, div;
  	u32 val;

drivers/pci/controller/dwc/pci-imx6.c +3 -0
+	if (imx6_pcie->variant == IMX7D)
+		return 0;
+

  switch (phy_rate) {
  case 125000000:
  /*

maintainer Reviewed-by on v2 2/3
#4 lore raw

Re: [PATCH v2 2/3] PCI: imx: No-op imx6_pcie_reset_phy() on i.MX7D

In reply to Andrey Smirnov

Am Mittwoch, den 05.12.2018, 23:35 -0800 schrieb Andrey Smirnov:

Quoted 11 lines

PCIE PHY IP block on i.MX7D differs from the one used on i.MX6 family, so none of the code in current implementation of imx6_pcie_reset_phy() is applicable.

Quoted 1 line
Cc Fabio Estevam <[email protected]>
Quoted 3 lines
Cc Leonard Crestez <[email protected]>
Cc "A.s. Dong" <[email protected]>
Cc Richard Zhu <[email protected]>
Quoted 6 lines
Quoted 1 line
Quoted 18 lines

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

 1 file changed, 3 insertions(+)
drivers/pci/controller/dwc/pci-imx6.c +0 -0
index c140f7987598..3c3002861d25 100644
@@ -245,6 +245,9 @@ static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie)
  {
 >  	u32 tmp;

drivers/pci/controller/dwc/pci-imx6.c static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) · line 249

Quoted 2 lines
drivers/pci/controller/dwc/pci-imx6.c +2 -0
+	if (imx6_pcie->variant == IMX7D)
+		return;

+

Quoted 3 lines

  pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp); tmp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN | PHY_RX_OVRD_IN_LO_RX_PLL_EN);

maintainer Reviewed-by on v2 3/3
#6 lore raw

Re: [PATCH v2 3/3] PCI: imx: Add support for i.MX8MQ

In reply to Andrey Smirnov

Am Mittwoch, den 05.12.2018, 23:35 -0800 schrieb Andrey Smirnov:

Quoted 9 lines

Add code needed to support i.MX8MQ variant.

Quoted 1 line
Cc Fabio Estevam <[email protected]>
Quoted 3 lines
Cc Leonard Crestez <[email protected]>
Cc "A.s. Dong" <[email protected]>
Cc Richard Zhu <[email protected]>
Quoted 8 lines
Quoted 2 lines
Cc Mark Rutland <[email protected]>
Cc Rob Herring <[email protected]>
Quoted 280 lines

---
 .../bindings/pci/fsl,imx6q-pcie.txt           |  6 +- drivers/pci/controller/dwc/Kconfig            |  2 +- drivers/pci/controller/dwc/pci-imx6.c         | 85 +++++++++++++++++--

 3 files changed, 86 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +0 -0
index f37494d5a7be..40b46d11e7e7 100644
@@ -9,6 +9,7 @@ Required properties:
 >  	- "fsl,imx6sx-pcie",

Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt Required properties: · line 12

Quoted 3 lines

  - "fsl,imx6qp-pcie"
  - "fsl,imx7d-pcie"

Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +1 -0
+	- "fsl,imx8mq-pcie"

 - reg: base address and length of the PCIe controller
 - interrupts: A list of interrupt outputs of the controller. Must contain an entry for each entry in the interrupt-names property.

Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +0 -0
@@ -43,7 +44,7 @@ Additional required properties for imx6sx-pcie:
Quoted 1 line

  - "pcie_inbound_axi"

 - power-domains: Must be set to a phandle pointing to the PCIE_PHY power domain

Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +1 -1
-Additional required properties for imx7d-pcie:
+Additional required properties for imx7d-pcie and imx8mq-pcie:

 - power-domains: Must be set to a phandle pointing to PCIE_PHY power domain
 - resets: Must contain phandles to PCIe-related reset lines exposed by SRC IP block

Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +0 -0
@@ -52,6 +53,9 @@ Additional required properties for imx7d-pcie:
Quoted 2 lines

         - "apps"
         - "turnoff"

Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +3 -0
+Additional required properties for imx8mq-pcie:
+- fsl,controller-id: Logical ID of a given PCIE controller. PCIE1 is 0, PCIE2 is 1;
+

 Example:

Quoted 1 line

  pcie@01000000 {

drivers/pci/controller/dwc/Kconfig +0 -0
index 91b0194240a5..2b139acccf32 100644
@@ -90,7 +90,7 @@ config PCI_EXYNOS


 config PCI_IMX6

Quoted 5 lines

  bool "Freescale i.MX6 PCIe controller"

drivers/pci/controller/dwc/Kconfig +1 -1
-	depends on SOC_IMX6Q || (ARM && COMPILE_TEST)
+	depends on SOC_IMX8MQ || SOC_IMX6Q || (ARM && COMPILE_TEST)

  depends on PCI_MSI_IRQ_DOMAIN select PCIE_DW_HOST

drivers/pci/controller/dwc/pci-imx6.c +0 -0
index 3c3002861d25..326f71698ac2 100644
@@ -8,6 +8,7 @@
Quoted 1 line

  * Author: Sean Cross <[email protected]>

  */

+#include <linux/bitfield.h>
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/gpio.h>

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -30,6 +31,11 @@


 #include "pcie-designware.h"

drivers/pci/controller/dwc/pci-imx6.c line 37

Quoted 4 lines
drivers/pci/controller/dwc/pci-imx6.c +4 -0
+#define IMX8MQ_GPR_PCIE_REF_USE_PAD		BIT(9)
+#define IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN	BIT(10)
+#define IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE	BIT(11)
+#define IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE	GENMASK(11, 8)

+

Quoted 1 line

 #define to_imx6_pcie(x) dev_get_drvdata((x)->dev)


 enum imx6_pcie_variants {

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -37,6 +43,7 @@ enum imx6_pcie_variants {
 >  	IMX6SX,
 >  	IMX6QP,
 >  	IMX7D,
 > +	IMX8MQ,
  };


 struct imx6_pcie {

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -48,6 +55,7 @@ struct imx6_pcie {
 > >  	struct clk		*pcie_inbound_axi;
 > >  	struct clk		*pcie;
 > >  	struct regmap		*iomuxc_gpr;
 > > +	u32			controller_id;
 > >  	struct reset_control	*pciephy_reset;
 > >  	struct reset_control	*apps_reset;
Quoted 1 line
Quoted 1 line

  struct reset_control *turnoff_reset;

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -245,7 +253,8 @@ static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie)
  {
 >  	u32 tmp;

Quoted 4 lines
drivers/pci/controller/dwc/pci-imx6.c +2 -1
-	if (imx6_pcie->variant == IMX7D)
+	if (imx6_pcie->variant == IMX7D ||
+	    imx6_pcie->variant == IMX8MQ)

  return;

Quoted 1 line

  pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp);

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -261,6 +270,7 @@ static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie)
 >  	pcie_phy_write(imx6_pcie, PHY_RX_OVRD_IN_LO, tmp);
  }


+#ifdef CONFIG_ARM
 /*  Added for PCI abort handling */
 static int imx6q_pcie_abort_handler(unsigned long addr,

Quoted 1 line

  unsigned int fsr, struct pt_regs *regs)

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -294,6 +304,7 @@ static int imx6q_pcie_abort_handler(unsigned long addr,

Quoted 1 line

  return 1;

 }
+#endif

 static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) {

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -301,6 +312,7 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie)

Quoted 6 lines

  switch (imx6_pcie->variant) { case IMX7D:

(quoted diff) +1 -0
+	case IMX8MQ: /* FALLTHROUGH */

  reset_control_assert(imx6_pcie->pciephy_reset); reset_control_assert(imx6_pcie->apps_reset); break;

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -339,6 +351,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
  {
 >  	struct dw_pcie *pci = imx6_pcie->pci;
 >  	struct device *dev = pci->dev;
 > +	unsigned int offset;
 >  	int ret = 0;

Quoted 1 line

  switch (imx6_pcie->variant) {

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -369,6 +382,29 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
 >  		break;

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

Quoted 13 lines

  case IMX7D:
  break;

drivers/pci/controller/dwc/pci-imx6.c +11 -0
+	case IMX8MQ:
+		switch (imx6_pcie->controller_id) {
+		case 0:
+			offset = IOMUXC_GPR14;
+			break;
+		case 1:
+			offset = IOMUXC_GPR16;
+			break;
+		default:
+			return -EINVAL;
+		}

+

Quoted 11 lines
drivers/pci/controller/dwc/pci-imx6.c +11 -0
+		/*
+		 * Set the over ride low and enabled
+		 * make sure that REF_CLK is turned on.
+		 */
+		regmap_update_bits(imx6_pcie->iomuxc_gpr, offset,
+				   IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE,
+				   0);
+		regmap_update_bits(imx6_pcie->iomuxc_gpr, offset,
+				   IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN,
+				   IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN);
+		break;
Quoted 1 line

  }

Quoted 1 line

  return ret;

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -445,6 +481,9 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)
 >  	}

Quoted 7 lines

  switch (imx6_pcie->variant) {

drivers/pci/controller/dwc/pci-imx6.c +3 -0
+	case IMX8MQ:
+		reset_control_deassert(imx6_pcie->pciephy_reset);
+		break;

  case IMX7D:
  reset_control_deassert(imx6_pcie->pciephy_reset); imx7d_pcie_wait_for_phy_pll_lock(imx6_pcie);

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -482,7 +521,34 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)


 static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie) {

drivers/pci/controller/dwc/pci-imx6.c static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) · line 524

Quoted 1 line
drivers/pci/controller/dwc/pci-imx6.c +1 -0
+	unsigned int mask, val, offset;

+

drivers/pci/controller/dwc/pci-imx6.c static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) · line 527

Quoted 2 lines
drivers/pci/controller/dwc/pci-imx6.c +2 -0
+	mask = IMX6Q_GPR12_DEVICE_TYPE;
+	val  = FIELD_PREP(IMX6Q_GPR12_DEVICE_TYPE, PCI_EXP_TYPE_ROOT_PORT);

+

Quoted 26 lines

  switch (imx6_pcie->variant) {

drivers/pci/controller/dwc/pci-imx6.c +22 -0
+	case IMX8MQ:
+		switch (imx6_pcie->controller_id) {
+		case 0:
+			offset = IOMUXC_GPR14;
+			break;
+		case 1:
+			offset = IOMUXC_GPR16;
+			mask = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE;
+			val  = FIELD_PREP(IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE,
+					  PCI_EXP_TYPE_ROOT_PORT);
+			break;
+		default:
+			return;
+		}
+		/*
+		 * TODO: Currently this code assumes external
+		 * oscillator is being used
+		 */
+		regmap_update_bits(imx6_pcie->iomuxc_gpr, offset,
+				   IMX8MQ_GPR_PCIE_REF_USE_PAD,
+				   IMX8MQ_GPR_PCIE_REF_USE_PAD);
+		break;

  case IMX7D:
  regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0);

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -518,8 +584,7 @@ static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie)
 >  		break;
 >  	}

drivers/pci/controller/dwc/pci-imx6.c static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie) · line 587

Quoted 3 lines
drivers/pci/controller/dwc/pci-imx6.c +1 -2
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
-			IMX6Q_GPR12_DEVICE_TYPE, PCI_EXP_TYPE_ROOT_PORT << 12);
+	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, mask, val);

 }

 static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie)

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -528,7 +593,8 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie)
 >  	int mult, div;
 >  	u32 val;

Quoted 4 lines
drivers/pci/controller/dwc/pci-imx6.c +2 -1
-	if (imx6_pcie->variant == IMX7D)
+	if (imx6_pcie->variant == IMX7D ||
+	    imx6_pcie->variant == IMX8MQ)

  return 0;

Quoted 1 line

  switch (phy_rate) {

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -616,6 +682,7 @@ static void imx6_pcie_ltssm_enable(struct device *dev)
 >  				   IMX6Q_GPR12_PCIE_CTL_2);
 >  		break;
Quoted 5 lines

  case IMX7D:

Review

Quoted 1 line
(quoted diff) +1 -0
+	case IMX8MQ:		/* FALLTHROUGH */

  reset_control_deassert(imx6_pcie->apps_reset); break;
  }

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -870,6 +937,10 @@ static int imx6_pcie_probe(struct platform_device *pdev)
Quoted 2 lines

  imx6_pcie->variant =
  (enum imx6_pcie_variants)of_device_get_match_data(dev);

drivers/pci/controller/dwc/pci-imx6.c static int imx6_pcie_probe(struct platform_device *pdev) · line 942

Quoted 3 lines
drivers/pci/controller/dwc/pci-imx6.c +3 -0
+	if (of_property_read_u32(node, "fsl,controller-id",
+				 &imx6_pcie->controller_id))
+		imx6_pcie->controller_id = 0;

+

Quoted 3 lines

  dbi_base = platform_get_resource(pdev, IORESOURCE_MEM, 0); pci->dbi_base = devm_ioremap_resource(dev, dbi_base); if (IS_ERR(pci->dbi_base))

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -921,7 +992,8 @@ static int imx6_pcie_probe(struct platform_device *pdev)
 >  			return PTR_ERR(imx6_pcie->pcie_inbound_axi);
 >  		}
 >  		break;
Quoted 6 lines
drivers/pci/controller/dwc/pci-imx6.c +1 -1
-	case IMX7D:
+	case IMX8MQ:

drivers/pci/controller/dwc/pci-imx6.c static int imx6_pcie_probe(struct platform_device *pdev) · line 996

Quoted 1 line
drivers/pci/controller/dwc/pci-imx6.c +1 -0
+	case IMX7D:		/* FALLTHROUGH */

  imx6_pcie->pciephy_reset = devm_reset_control_get_exclusive(dev, "pciephy"); if (IS_ERR(imx6_pcie->pciephy_reset)) {

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -1011,6 +1083,7 @@ static const struct of_device_id imx6_pcie_of_match[] = {
 >  	{ .compatible = "fsl,imx6sx-pcie", .data = (void *)IMX6SX, },
 >  	{ .compatible = "fsl,imx6qp-pcie", .data = (void *)IMX6QP, },
 >  	{ .compatible = "fsl,imx7d-pcie",  .data = (void *)IMX7D,  },
 > +	{ .compatible = "fsl,imx8mq-pcie", .data = (void *)IMX8MQ, } ,
 >  	{},
  };

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -1027,6 +1100,7 @@ static struct platform_driver imx6_pcie_driver = {


 static int __init imx6_pcie_init(void)
 {
+#ifdef CONFIG_ARM

Quoted 3 lines

  /*
   * Since probe() can be deferred we need to make sure that
   * hook_fault_code is not called after __init memory is freed

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -1036,6 +1110,7 @@ static int __init imx6_pcie_init(void)
Quoted 3 lines

   */
  hook_fault_code(8, imx6q_pcie_abort_handler, SIGBUS, 0, "external abort on non-linefetch");

+#endif

Quoted 1 line

  return platform_driver_register(&imx6_pcie_driver);

 }

#10 lore raw
In reply to Andrey Smirnov
Quoted 12 lines · Andrey Smirnov

Everyone:

This series contains changes I made in order to enable support of PCIE IP block on i.MX8MQ SoCs (full tree can be found at [github-v2]).

NOTE: The last patch have a Kconfig symbol depenency on [imx8mq-kconfig].

Changes since [v1]:

- Driver changed to use single "fsl,controller-id" property to distinguish between two intances of PCIE IP block

Quoted 8 lines

- All code pertaining to L1SS was dropped to simplify the patch

- Documented additions to DT bindings

Feedback is welcome!

Thanks,
Andrey Smirnov

Andrey,

I have applied the patches, I would like to make the CC list in standard format so I kindly ask you firstname/surname for [email protected], I could not find it in the maintainers list but I want to keep the CC list as per patches (I removed the lists, though).

Thanks,
Lorenzo

Quoted 17 lines

[v1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
[github-v2] https://github.com/ndreys/linux/commits/imx8mq-pcie-v2
[imx8mq-kconfig] https://lore.kernel.org/linux-arm-kernel/[email protected]/

Andrey Smirnov (3):
PCI: imx: No-op imx6_setup_phy_mpll() on i.MX7D
PCI: imx: No-op imx6_pcie_reset_phy() on i.MX7D
PCI: imx: Add support for i.MX8MQ

 .../bindings/pci/fsl,imx6q-pcie.txt           |  6 +-
 drivers/pci/controller/dwc/Kconfig            |  2 +-
 drivers/pci/controller/dwc/pci-imx6.c         | 87 ++++++++++++++++++-
 3 files changed, 90 insertions(+), 5 deletions(-)
Signature · 1 line
2.19.1
#11 lore raw
Quoted 23 lines · Lorenzo Pieralisi
Quoted 12 lines · Andrey Smirnov

Everyone:

This series contains changes I made in order to enable support of PCIE IP block on i.MX8MQ SoCs (full tree can be found at [github-v2]).

NOTE: The last patch have a Kconfig symbol depenency on [imx8mq-kconfig].

Changes since [v1]:

- Driver changed to use single "fsl,controller-id" property to distinguish between two intances of PCIE IP block

Quoted 8 lines

- All code pertaining to L1SS was dropped to simplify the patch

- Documented additions to DT bindings

Feedback is welcome!

Thanks,
Andrey Smirnov

Quoted 6 lines

Andrey,

I have applied the patches, I would like to make the CC list in standard format so I kindly ask you firstname/surname for [email protected], I could not find it in the maintainers list but I want to keep the CC list as per patches (I removed the lists, though).

Oh, sorry about that! That would be Chris Healy <[email protected]>. Let me know if anything else is needed.

Thanks,
Andrey Smirnov

#7 lore raw

Re: [PATCH v2 3/3] PCI: imx: Add support for i.MX8MQ

In reply to Andrey Smirnov

[+cc Gustavo for fallthrough annotation]

drivers/pci/controller/dwc/pci-imx6.c static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) · line 257

Quoted 9 lines · Andrey Smirnov

Add code needed to support i.MX8MQ variant.

drivers/pci/controller/dwc/pci-imx6.c +2 -1
@@ -245,7 +253,8 @@ static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie)
 {
 	u32 tmp;
 
-	if (imx6_pcie->variant == IMX7D)
+	if (imx6_pcie->variant == IMX7D ||
+	    imx6_pcie->variant == IMX8MQ)

This style looks like a maintenance problem: the code below is probably IMX6-specific, and you should test for *that* instead of adding to this list of things that are *not* IMX6, because that list is likely to continue growing. There are more occurrences below.

drivers/pci/controller/dwc/pci-imx6.c static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) · line 318

Quoted 8 lines
drivers/pci/controller/dwc/pci-imx6.c +1 -0
@@ -301,6 +312,7 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie)
 
 	switch (imx6_pcie->variant) {
 	case IMX7D:
+	case IMX8MQ: /* FALLTHROUGH */
 		reset_control_assert(imx6_pcie->pciephy_reset);
 		reset_control_assert(imx6_pcie->apps_reset);
 		break;

I'm not an expert on fallthrough annotation (Gustavo, cc'd, is), but this looks wrong. It's the IMX7D case that falls through, not the IMX8MQ case.

The recent annotations added by Gustavo are at the point where the "break" would normally be, e.g.,

case IMX7D:

    /* fall through */                    <--- annotation
  case IMX8MQ:
    <code>
    break;

But in this case there's actually no IMX7D-specific *code* there, so I suspect the annotation is unnecessary. It's obvious that IMX7D and IMX8MQ are handled the same, so there's really no opportunity for the "forgotten break" mistake -Wimplicit-fallthrough is trying to find.

If we *do* want this annotation, we should spell it the same as Gustavo has been, i.e., "fall through".

Again, more occurrences below.

Bjorn

#12 lore raw
In reply to Lorenzo Pieralisi

[+cc Trent]

Quoted 17 lines · Lorenzo Pieralisi
Quoted 16 lines · Andrey Smirnov

Everyone:

This series contains changes I made in order to enable support of PCIE IP block on i.MX8MQ SoCs (full tree can be found at [github-v2]).

NOTE: The last patch have a Kconfig symbol depenency on [imx8mq-kconfig].

Changes since [v1]:

- Driver changed to use single "fsl,controller-id" property to distinguish between two intances of PCIE IP block

- All code pertaining to L1SS was dropped to simplify the patch

- Documented additions to DT bindings

Quoted 8 lines
Quoted 4 lines

Feedback is welcome!

Thanks,
Andrey Smirnov

Andrey,

I have applied the patches, ...

When I merged your pci/dwc branch, I noticed what looks like a merge conflict between these commits:

d123765b58ee ("PCI: dwc: Adjust Kconfig to allow IMX6 PCIe host on IMX7") 1a059d994189 ("PCI: imx: Add support for i.MX8MQ")

d123765b58ee added SOC_IMX7D:

  -       depends on SOC_IMX6Q || (ARM && COMPILE_TEST)
  +       depends on SOC_IMX6Q || SOC_IMX7D || (ARM && COMPILE_TEST)

and 1a059d994189 added SOC_IMX8MQ but dropped SOC_IMX7D again, which looks like a mistake:

  -       depends on SOC_IMX6Q || SOC_IMX7D || (ARM && COMPILE_TEST)
  +       depends on SOC_IMX8MQ || SOC_IMX6Q || (ARM && COMPILE_TEST)

So my "next" branch[1] (current head 7053eeb009e0) is:

  config PCI_IMX6
        bool "Freescale i.MX6/7 PCIe controller"
        depends on SOC_IMX8MQ || SOC_IMX6Q || (ARM && COMPILE_TEST)
        depends on PCI_MSI_IRQ_DOMAIN
        select PCIE_DW_HOST

which I think is wrong. Lorenzo, if you update your pci/dwc branch, I'll rebuild my "next" branch.

If you want to tweak the switch statements and/or IMX8 checks, you could do that at the same time.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/log/?h=next

#8 lore raw

Re: [PATCH v2 3/3] PCI: imx: Add support for i.MX8MQ

In reply to Bjorn Helgaas

Hi,

Quoted 5 lines · Bjorn Helgaas

[+cc Gustavo for fallthrough annotation]

Quoted 2 lines
(quoted diff) +0 -0
@@ -301,6 +312,7 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie)
 
Quoted 11 lines

drivers/pci/controller/dwc/pci-imx6.c static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) · line 318

Quoted 6 lines
drivers/pci/controller/dwc/pci-imx6.c +1 -0
  	switch (imx6_pcie->variant) {
  	case IMX7D:
+	case IMX8MQ: /* FALLTHROUGH */
  		reset_control_assert(imx6_pcie->pciephy_reset);
  		reset_control_assert(imx6_pcie->apps_reset);
  		break;

I'm not an expert on fallthrough annotation (Gustavo, cc'd, is), but this looks wrong. It's the IMX7D case that falls through, not the IMX8MQ case.

Correct.

Quoted 9 lines

The recent annotations added by Gustavo are at the point where the "break" would normally be, e.g.,

   case IMX7D:
     /* fall through */                    <--- annotation
   case IMX8MQ:
     <code>
     break;
Quoted 5 lines

But in this case there's actually no IMX7D-specific *code* there, so I suspect the annotation is unnecessary. It's obvious that IMX7D and IMX8MQ are handled the same, so there's really no opportunity for the "forgotten break" mistake -Wimplicit-fallthrough is trying to find.

Yep. That's correct. There is no need for those annotations in this patch.

Quoted 3 lines

If we *do* want this annotation, we should spell it the same as Gustavo has been, i.e., "fall through".

This is a matter of style. For -Wimplicit-fallthrough, "FALLTHROUGH" is as valid a "fall through".

Although, currently, there are 1997 instances of "fall through" vs 235 of "FALLTHROUGH" in linux-next.

Thanks
--
Gustavo

#9 lore raw

Re: [PATCH v2 3/3] PCI: imx: Add support for i.MX8MQ

In reply to Bjorn Helgaas
Quoted 10 lines · Bjorn Helgaas

[+cc Gustavo for fallthrough annotation]

Quoted 6 lines · Andrey Smirnov

Add code needed to support i.MX8MQ variant.

drivers/pci/controller/dwc/pci-imx6.c +0 -0
@@ -245,7 +253,8 @@ static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie)
 {
      u32 tmp;
 
Quoted 9 lines

drivers/pci/controller/dwc/pci-imx6.c static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) · line 257

Quoted 3 lines
drivers/pci/controller/dwc/pci-imx6.c +2 -1
-     if (imx6_pcie->variant == IMX7D)
+     if (imx6_pcie->variant == IMX7D ||
+         imx6_pcie->variant == IMX8MQ)

This style looks like a maintenance problem: the code below is probably IMX6-specific, and you should test for *that* instead of adding to this list of things that are *not* IMX6, because that list is likely to continue growing. There are more occurrences below.

Makes sense, I'll update that patches and send a v3 out.

Quoted 27 lines

drivers/pci/controller/dwc/pci-imx6.c static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) · line 318

Quoted 8 lines
drivers/pci/controller/dwc/pci-imx6.c +1 -0
@@ -301,6 +312,7 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie)
 
      switch (imx6_pcie->variant) {
      case IMX7D:
+     case IMX8MQ: /* FALLTHROUGH */
              reset_control_assert(imx6_pcie->pciephy_reset);
              reset_control_assert(imx6_pcie->apps_reset);
              break;

I'm not an expert on fallthrough annotation (Gustavo, cc'd, is), but this looks wrong. It's the IMX7D case that falls through, not the IMX8MQ case.

The recent annotations added by Gustavo are at the point where the "break" would normally be, e.g.,

case IMX7D:

    /* fall through */                    <--- annotation
  case IMX8MQ:
    <code>
    break;

But in this case there's actually no IMX7D-specific *code* there, so I suspect the annotation is unnecessary. It's obvious that IMX7D and IMX8MQ are handled the same, so there's really no opportunity for the "forgotten break" mistake -Wimplicit-fallthrough is trying to find.

Quoted 4 lines

If we *do* want this annotation, we should spell it the same as Gustavo has been, i.e., "fall through".

Again, more occurrences below.

Yes, definitely, same mistake of mine was already caught elsewhere in the tree https://lore.kernel.org/lkml/[email protected]/

I'll fix it in v3.

Thanks,
Andrey Smirnov

#13 lore raw
In reply to Bjorn Helgaas
Quoted 49 lines · Bjorn Helgaas

[+cc Trent]

Quoted 17 lines · Lorenzo Pieralisi
Quoted 16 lines · Andrey Smirnov

Everyone:

This series contains changes I made in order to enable support of PCIE IP block on i.MX8MQ SoCs (full tree can be found at [github-v2]).

NOTE: The last patch have a Kconfig symbol depenency on [imx8mq-kconfig].

Changes since [v1]:

- Driver changed to use single "fsl,controller-id" property to distinguish between two intances of PCIE IP block

- All code pertaining to L1SS was dropped to simplify the patch

- Documented additions to DT bindings

Quoted 8 lines
Quoted 4 lines

Feedback is welcome!

Thanks,
Andrey Smirnov

Andrey,

I have applied the patches, ...

When I merged your pci/dwc branch, I noticed what looks like a merge conflict between these commits:

d123765b58ee ("PCI: dwc: Adjust Kconfig to allow IMX6 PCIe host on IMX7") 1a059d994189 ("PCI: imx: Add support for i.MX8MQ")

d123765b58ee added SOC_IMX7D:

  -       depends on SOC_IMX6Q || (ARM && COMPILE_TEST)
  +       depends on SOC_IMX6Q || SOC_IMX7D || (ARM && COMPILE_TEST)

and 1a059d994189 added SOC_IMX8MQ but dropped SOC_IMX7D again, which looks like a mistake:

  -       depends on SOC_IMX6Q || SOC_IMX7D || (ARM && COMPILE_TEST)
  +       depends on SOC_IMX8MQ || SOC_IMX6Q || (ARM && COMPILE_TEST)

So my "next" branch[1] (current head 7053eeb009e0) is:

Quoted 7 lines
  config PCI_IMX6
        bool "Freescale i.MX6/7 PCIe controller"
        depends on SOC_IMX8MQ || SOC_IMX6Q || (ARM && COMPILE_TEST)
        depends on PCI_MSI_IRQ_DOMAIN
        select PCIE_DW_HOST

which I think is wrong.

Yeah, this is definitely wrong, should be SOC_IMX8MQ || SOC_IMX6Q || SOC_IMX7D || (ARM && COMPILE_TEST)

Quoted 6 lines

Lorenzo, if you update your pci/dwc branch, I'll rebuild my "next" branch.

If you want to tweak the switch statements and/or IMX8 checks, you could do that at the same time.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/log/?h=next

OK, I'll use the branch above for v3 of the patches.

Thanks,
Andrey Smirnov

maintainer
#14 lore raw

Am Freitag, den 14.12.2018, 21:25 -0800 schrieb Andrey Smirnov:

Quoted 56 lines
Quoted 56 lines · Bjorn Helgaas

[+cc Trent]

Quoted 17 lines · Lorenzo Pieralisi
Quoted 16 lines · Andrey Smirnov

Everyone:

This series contains changes I made in order to enable support of PCIE IP block on i.MX8MQ SoCs (full tree can be found at [github-v2]).

NOTE: The last patch have a Kconfig symbol depenency on [imx8mq-kconfig].

Changes since [v1]:

 - Driver changed to use single "fsl,controller-id" property to distinguish between two intances of PCIE IP block

 - All code pertaining to L1SS was dropped to simplify the patch

 - Documented additions to DT bindings

Quoted 8 lines
Quoted 4 lines

Feedback is welcome!

Thanks,
Andrey Smirnov

Andrey,

I have applied the patches, ...

When I merged your pci/dwc branch, I noticed what looks like a merge conflict between these commits:

  d123765b58ee ("PCI: dwc: Adjust Kconfig to allow IMX6 PCIe host on IMX7") 1a059d994189 ("PCI: imx: Add support for i.MX8MQ")

d123765b58ee added SOC_IMX7D:

  -       depends on SOC_IMX6Q || (ARM && COMPILE_TEST)
  +       depends on SOC_IMX6Q || SOC_IMX7D || (ARM && COMPILE_TEST)

and 1a059d994189 added SOC_IMX8MQ but dropped SOC_IMX7D again, which looks like a mistake:

  -       depends on SOC_IMX6Q || SOC_IMX7D || (ARM && COMPILE_TEST)
  +       depends on SOC_IMX8MQ || SOC_IMX6Q || (ARM && COMPILE_TEST)

So my "next" branch[1] (current head 7053eeb009e0) is:

  config PCI_IMX6
        bool "Freescale i.MX6/7 PCIe controller"
        depends on SOC_IMX8MQ || SOC_IMX6Q || (ARM && COMPILE_TEST) depends on PCI_MSI_IRQ_DOMAIN
        select PCIE_DW_HOST

Quoted 4 lines
Quoted 1 line

which I think is wrong.

Yeah, this is definitely wrong, should be SOC_IMX8MQ || SOC_IMX6Q || SOC_IMX7D || (ARM && COMPILE_TEST)

arm-soc would like to see the SOC_IMX8MQ option removed, so let's try to not add any more things that depend on this. Please use (ARM64 && MACH_MXC) or something to that tune instead.

Regards,
Lucas

#15 lore raw
Quoted 57 lines · Lucas Stach

Am Freitag, den 14.12.2018, 21:25 -0800 schrieb Andrey Smirnov:

Quoted 56 lines
Quoted 56 lines · Bjorn Helgaas

[+cc Trent]

Quoted 17 lines · Lorenzo Pieralisi
Quoted 16 lines · Andrey Smirnov

Everyone:

This series contains changes I made in order to enable support of PCIE IP block on i.MX8MQ SoCs (full tree can be found at [github-v2]).

NOTE: The last patch have a Kconfig symbol depenency on [imx8mq-kconfig].

Changes since [v1]:

 - Driver changed to use single "fsl,controller-id" property to distinguish between two intances of PCIE IP block

 - All code pertaining to L1SS was dropped to simplify the patch

 - Documented additions to DT bindings

Quoted 8 lines
Quoted 4 lines

Feedback is welcome!

Thanks,
Andrey Smirnov

Andrey,

I have applied the patches, ...

When I merged your pci/dwc branch, I noticed what looks like a merge conflict between these commits:

  d123765b58ee ("PCI: dwc: Adjust Kconfig to allow IMX6 PCIe host on IMX7") 1a059d994189 ("PCI: imx: Add support for i.MX8MQ")

d123765b58ee added SOC_IMX7D:

  -       depends on SOC_IMX6Q || (ARM && COMPILE_TEST)
  +       depends on SOC_IMX6Q || SOC_IMX7D || (ARM && COMPILE_TEST)

and 1a059d994189 added SOC_IMX8MQ but dropped SOC_IMX7D again, which looks like a mistake:

  -       depends on SOC_IMX6Q || SOC_IMX7D || (ARM && COMPILE_TEST)
  +       depends on SOC_IMX8MQ || SOC_IMX6Q || (ARM && COMPILE_TEST)

So my "next" branch[1] (current head 7053eeb009e0) is:

  config PCI_IMX6
        bool "Freescale i.MX6/7 PCIe controller"
        depends on SOC_IMX8MQ || SOC_IMX6Q || (ARM && COMPILE_TEST) depends on PCI_MSI_IRQ_DOMAIN
        select PCIE_DW_HOST

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

which I think is wrong.

Yeah, this is definitely wrong, should be SOC_IMX8MQ || SOC_IMX6Q || SOC_IMX7D || (ARM && COMPILE_TEST)

arm-soc would like to see the SOC_IMX8MQ option removed, so let's try to not add any more things that depend on this. Please use (ARM64 && MACH_MXC) or something to that tune instead.

Patch series dropped from the PCI queue, waiting for the discussion and related follow-up patches to settle.

Lorenzo

#16 lore raw
In reply to Bjorn Helgaas
Quoted 48 lines · Bjorn Helgaas

[+cc Trent]

Quoted 17 lines · Lorenzo Pieralisi
Quoted 16 lines · Andrey Smirnov

Everyone:

This series contains changes I made in order to enable support of PCIE IP block on i.MX8MQ SoCs (full tree can be found at [github-v2]).

NOTE: The last patch have a Kconfig symbol depenency on [imx8mq-kconfig].

Changes since [v1]:

- Driver changed to use single "fsl,controller-id" property to distinguish between two intances of PCIE IP block

- All code pertaining to L1SS was dropped to simplify the patch

- Documented additions to DT bindings

Quoted 8 lines
Quoted 4 lines

Feedback is welcome!

Thanks,
Andrey Smirnov

Andrey,

I have applied the patches, ...

When I merged your pci/dwc branch, I noticed what looks like a merge conflict between these commits:

d123765b58ee ("PCI: dwc: Adjust Kconfig to allow IMX6 PCIe host on IMX7") 1a059d994189 ("PCI: imx: Add support for i.MX8MQ")

d123765b58ee added SOC_IMX7D:

  -       depends on SOC_IMX6Q || (ARM && COMPILE_TEST)
  +       depends on SOC_IMX6Q || SOC_IMX7D || (ARM && COMPILE_TEST)

and 1a059d994189 added SOC_IMX8MQ but dropped SOC_IMX7D again, which looks like a mistake:

  -       depends on SOC_IMX6Q || SOC_IMX7D || (ARM && COMPILE_TEST)
  +       depends on SOC_IMX8MQ || SOC_IMX6Q || (ARM && COMPILE_TEST)

So my "next" branch[1] (current head 7053eeb009e0) is:

Quoted 8 lines
  config PCI_IMX6
        bool "Freescale i.MX6/7 PCIe controller"
        depends on SOC_IMX8MQ || SOC_IMX6Q || (ARM && COMPILE_TEST)
        depends on PCI_MSI_IRQ_DOMAIN
        select PCIE_DW_HOST

which I think is wrong. Lorenzo, if you update your pci/dwc branch, I'll rebuild my "next" branch.

Sorry about that, I missed it.

I dropped Andrey's patches from pci/dwc waiting for him/Lucas to agree on a way forward.

Thanks,
Lorenzo

Quoted 4 lines

If you want to tweak the switch statements and/or IMX8 checks, you could do that at the same time.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/log/?h=next