linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/9] A bunch of changes to refine i.MX PCIe driver
@ 2024-09-25  6:24 Richard Zhu
  2024-09-25  6:24 ` [PATCH v2 1/9] dt-bindings: imx6q-pcie: Add ref clock for i.MX95 PCIe Richard Zhu
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Richard Zhu @ 2024-09-25  6:24 UTC (permalink / raw)
  To: l.stach, kwilczynski, bhelgaas, lpieralisi, frank.li, robh+dt,
	conor+dt, shawnguo, krzysztof.kozlowski+dt, festevam, s.hauer
  Cc: linux-pci, linux-arm-kernel, linux-kernel, devicetree, kernel,
	imx

A bunch of changes to refine i.MX PCIe driver.
- Add ref clock gate for i.MX95 PCIe by #1, #2 and #9 patches.
  The changes of clock part is here [1].
  [1] https://patchwork.kernel.org/project/linux-arm-kernel/cover/1725525535-22924-1-git-send-email-hongxing.zhu@nxp.com/
- #3 and #4 patches clean i.MX PCIe driver by removing useless codes.
  Patch #3 depends on [2].
  [2] https://patchwork.kernel.org/project/linux-arm-kernel/cover/1723534943-28499-1-git-send-email-hongxing.zhu@nxp.com/
- Make core reset and enable_ref_clk symmetric for i.MX PCIe driver by
  #5 and #6 patches.
- Use dwc common suspend resume method, and enable i.MX8MQ, i.MX8Q and
  i.MX95 PCIe PM supports by #7 and #8 patches.

v2 changes:
- Add the reasons why one more clock is added for i.MX95 PCIe in patch #1.
- Add the "Reviewed-by: Frank Li <Frank.Li@nxp.com>" into patch #2, #4, #5,
  #6, #8 and #9.

[PATCH v2 1/9] dt-bindings: imx6q-pcie: Add ref clock for i.MX95 PCIe
[PATCH v2 2/9] PCI: imx6: Add ref clock for i.MX95 PCIe
[PATCH v2 3/9] PCI: imx6: Fetch dbi2 and iATU base addesses from DT
[PATCH v2 4/9] PCI: imx6: Correct controller_id generation logic for
[PATCH v2 5/9] PCI: imx6: Make core reset assertion deassertion
[PATCH v2 6/9] PCI: imx6: Make *_enable_ref_clk() function symmetric
[PATCH v2 7/9] PCI: imx6: Use dwc common suspend resume method
[PATCH v2 8/9] PCI: imx6: Add i.MX8MQ i.MX8Q and i.MX95 PCIe PM
[PATCH v2 9/9] arm64: dts: imx95: Add ref clock for i.MX95 PCIe

cumentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml |   4 +-
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml        |  25 ++++++++++--
arch/arm64/boot/dts/freescale/imx95.dtsi                         |  25 ++++++++++--
drivers/pci/controller/dwc/pci-imx6.c                            | 166 +++++++++++++++++++++++++++-------------------------------------------------
4 files changed, 103 insertions(+), 117 deletions(-)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/9] dt-bindings: imx6q-pcie: Add ref clock for i.MX95 PCIe
  2024-09-25  6:24 [PATCH v2 0/9] A bunch of changes to refine i.MX PCIe driver Richard Zhu
@ 2024-09-25  6:24 ` Richard Zhu
  2024-09-25  7:50   ` Krzysztof Kozlowski
  2024-09-25  6:24 ` [PATCH v2 2/9] PCI: imx6: " Richard Zhu
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Richard Zhu @ 2024-09-25  6:24 UTC (permalink / raw)
  To: l.stach, kwilczynski, bhelgaas, lpieralisi, frank.li, robh+dt,
	conor+dt, shawnguo, krzysztof.kozlowski+dt, festevam, s.hauer
  Cc: linux-pci, linux-arm-kernel, linux-kernel, devicetree, kernel,
	imx, Richard Zhu

Previous reference clock of i.MX95 is on when system boot to kernel. But
boot firmware change the behavor, it is off when boot. So it needs be turn
on when it is used. Also it needs be turn off/on when suspend and resume.

Add one ref clock for i.MX95 PCIe. Increase clocks' maxItems to 5 and keep
the same restriction with other compatible string.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 .../bindings/pci/fsl,imx6q-pcie-common.yaml   |  4 +--
 .../bindings/pci/fsl,imx6q-pcie.yaml          | 25 ++++++++++++++++---
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml
index a8b34f58f8f4..cddbe21f99f2 100644
--- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml
+++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml
@@ -17,11 +17,11 @@ description:
 properties:
   clocks:
     minItems: 3
-    maxItems: 4
+    maxItems: 5
 
   clock-names:
     minItems: 3
-    maxItems: 4
+    maxItems: 5
 
   num-lanes:
     const: 1
diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
index 1e05c560d797..4c76cd3f98a9 100644
--- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
+++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
@@ -40,10 +40,11 @@ properties:
       - description: PCIe PHY clock.
       - description: Additional required clock entry for imx6sx-pcie,
            imx6sx-pcie-ep, imx8mq-pcie, imx8mq-pcie-ep.
+      - description: PCIe reference clock.
 
   clock-names:
     minItems: 3
-    maxItems: 4
+    maxItems: 5
 
   interrupts:
     items:
@@ -127,7 +128,7 @@ allOf:
     then:
       properties:
         clocks:
-          minItems: 4
+          maxItems: 4
         clock-names:
           items:
             - const: pcie
@@ -140,11 +141,10 @@ allOf:
         compatible:
           enum:
             - fsl,imx8mq-pcie
-            - fsl,imx95-pcie
     then:
       properties:
         clocks:
-          minItems: 4
+          maxItems: 4
         clock-names:
           items:
             - const: pcie
@@ -200,6 +200,23 @@ allOf:
             - const: mstr
             - const: slv
 
+  - if:
+      properties:
+        compatible:
+          enum:
+            - fsl,imx95-pcie
+    then:
+      properties:
+        clocks:
+          maxItems: 5
+        clock-names:
+          items:
+            - const: pcie
+            - const: pcie_bus
+            - const: pcie_phy
+            - const: pcie_aux
+            - const: ref
+
 unevaluatedProperties: false
 
 examples:
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/9] PCI: imx6: Add ref clock for i.MX95 PCIe
  2024-09-25  6:24 [PATCH v2 0/9] A bunch of changes to refine i.MX PCIe driver Richard Zhu
  2024-09-25  6:24 ` [PATCH v2 1/9] dt-bindings: imx6q-pcie: Add ref clock for i.MX95 PCIe Richard Zhu
@ 2024-09-25  6:24 ` Richard Zhu
  2024-09-25  6:24 ` [PATCH v2 3/9] PCI: imx6: Fetch dbi2 and iATU base addesses from DT Richard Zhu
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Richard Zhu @ 2024-09-25  6:24 UTC (permalink / raw)
  To: l.stach, kwilczynski, bhelgaas, lpieralisi, frank.li, robh+dt,
	conor+dt, shawnguo, krzysztof.kozlowski+dt, festevam, s.hauer
  Cc: linux-pci, linux-arm-kernel, linux-kernel, devicetree, kernel,
	imx, Richard Zhu

Add "ref" clock to enable reference clock.

If use external clock, ref clock should point to external reference.

If use internal clock, CREF_EN in LAST_TO_REG controls reference output,
which implement in drivers/clk/imx/clk-imx95-blk-ctl.c.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 0dbc333adcff..2aa02674c817 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1480,6 +1480,7 @@ static const char * const imx8mm_clks[] = {"pcie_bus", "pcie", "pcie_aux"};
 static const char * const imx8mq_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"};
 static const char * const imx6sx_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_inbound_axi"};
 static const char * const imx8q_clks[] = {"mstr", "slv", "dbi"};
+static const char * const imx95_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux", "ref"};
 
 static const struct imx_pcie_drvdata drvdata[] = {
 	[IMX6Q] = {
@@ -1593,8 +1594,8 @@ static const struct imx_pcie_drvdata drvdata[] = {
 	[IMX95] = {
 		.variant = IMX95,
 		.flags = IMX_PCIE_FLAG_HAS_SERDES,
-		.clk_names = imx8mq_clks,
-		.clks_cnt = ARRAY_SIZE(imx8mq_clks),
+		.clk_names = imx95_clks,
+		.clks_cnt = ARRAY_SIZE(imx95_clks),
 		.ltssm_off = IMX95_PE0_GEN_CTRL_3,
 		.ltssm_mask = IMX95_PCIE_LTSSM_EN,
 		.mode_off[0]  = IMX95_PE0_GEN_CTRL_1,
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/9] PCI: imx6: Fetch dbi2 and iATU base addesses from DT
  2024-09-25  6:24 [PATCH v2 0/9] A bunch of changes to refine i.MX PCIe driver Richard Zhu
  2024-09-25  6:24 ` [PATCH v2 1/9] dt-bindings: imx6q-pcie: Add ref clock for i.MX95 PCIe Richard Zhu
  2024-09-25  6:24 ` [PATCH v2 2/9] PCI: imx6: " Richard Zhu
@ 2024-09-25  6:24 ` Richard Zhu
  2024-09-25  6:24 ` [PATCH v2 4/9] PCI: imx6: Correct controller_id generation logic for i.MX7D Richard Zhu
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Richard Zhu @ 2024-09-25  6:24 UTC (permalink / raw)
  To: l.stach, kwilczynski, bhelgaas, lpieralisi, frank.li, robh+dt,
	conor+dt, shawnguo, krzysztof.kozlowski+dt, festevam, s.hauer
  Cc: linux-pci, linux-arm-kernel, linux-kernel, devicetree, kernel,
	imx, Richard Zhu

Since dbi2 and atu regs are added for i.MX8M PCIes. Fetch the dbi2 and iATU
base addresses from DT directly, and remove the useless codes.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 2aa02674c817..e8e401729893 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1113,7 +1113,6 @@ static int imx_add_pcie_ep(struct imx_pcie *imx_pcie,
 			   struct platform_device *pdev)
 {
 	int ret;
-	unsigned int pcie_dbi2_offset;
 	struct dw_pcie_ep *ep;
 	struct dw_pcie *pci = imx_pcie->pci;
 	struct dw_pcie_rp *pp = &pci->pp;
@@ -1123,25 +1122,6 @@ static int imx_add_pcie_ep(struct imx_pcie *imx_pcie,
 	ep = &pci->ep;
 	ep->ops = &pcie_ep_ops;
 
-	switch (imx_pcie->drvdata->variant) {
-	case IMX8MQ_EP:
-	case IMX8MM_EP:
-	case IMX8MP_EP:
-		pcie_dbi2_offset = SZ_1M;
-		break;
-	default:
-		pcie_dbi2_offset = SZ_4K;
-		break;
-	}
-
-	pci->dbi_base2 = pci->dbi_base + pcie_dbi2_offset;
-
-	/*
-	 * FIXME: Ideally, dbi2 base address should come from DT. But since only IMX95 is defining
-	 * "dbi2" in DT, "dbi_base2" is set to NULL here for that platform alone so that the DWC
-	 * core code can fetch that from DT. But once all platform DTs were fixed, this and the
-	 * above "dbi_base2" setting should be removed.
-	 */
 	if (device_property_match_string(dev, "reg-names", "dbi2") >= 0)
 		pci->dbi_base2 = NULL;
 
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/9] PCI: imx6: Correct controller_id generation logic for i.MX7D
  2024-09-25  6:24 [PATCH v2 0/9] A bunch of changes to refine i.MX PCIe driver Richard Zhu
                   ` (2 preceding siblings ...)
  2024-09-25  6:24 ` [PATCH v2 3/9] PCI: imx6: Fetch dbi2 and iATU base addesses from DT Richard Zhu
@ 2024-09-25  6:24 ` Richard Zhu
  2024-09-25  6:24 ` [PATCH v2 5/9] PCI: imx6: Make core reset assertion deassertion symmetric Richard Zhu
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Richard Zhu @ 2024-09-25  6:24 UTC (permalink / raw)
  To: l.stach, kwilczynski, bhelgaas, lpieralisi, frank.li, robh+dt,
	conor+dt, shawnguo, krzysztof.kozlowski+dt, festevam, s.hauer
  Cc: linux-pci, linux-arm-kernel, linux-kernel, devicetree, kernel,
	imx, Richard Zhu

i.MX7D only has one PCIe controller, so controller_id should always be 0.
The previous code is incorrect although yielding the correct result. Fix by
removing IMX7D from the switch case branch.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index e8e401729893..d49154dbb1bd 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1338,7 +1338,6 @@ static int imx_pcie_probe(struct platform_device *pdev)
 	switch (imx_pcie->drvdata->variant) {
 	case IMX8MQ:
 	case IMX8MQ_EP:
-	case IMX7D:
 		if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR)
 			imx_pcie->controller_id = 1;
 		break;
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 5/9] PCI: imx6: Make core reset assertion deassertion symmetric
  2024-09-25  6:24 [PATCH v2 0/9] A bunch of changes to refine i.MX PCIe driver Richard Zhu
                   ` (3 preceding siblings ...)
  2024-09-25  6:24 ` [PATCH v2 4/9] PCI: imx6: Correct controller_id generation logic for i.MX7D Richard Zhu
@ 2024-09-25  6:24 ` Richard Zhu
  2024-09-25  6:24 ` [PATCH v2 6/9] PCI: imx6: Make *_enable_ref_clk() function symmetric Richard Zhu
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Richard Zhu @ 2024-09-25  6:24 UTC (permalink / raw)
  To: l.stach, kwilczynski, bhelgaas, lpieralisi, frank.li, robh+dt,
	conor+dt, shawnguo, krzysztof.kozlowski+dt, festevam, s.hauer
  Cc: linux-pci, linux-arm-kernel, linux-kernel, devicetree, kernel,
	imx, Richard Zhu

Add apps_reset deassertion in the imx_pcie_deassert_core_reset(). Let it be
symmetric with imx_pcie_assert_core_reset().

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index d49154dbb1bd..f306f2e9dcce 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -770,6 +770,7 @@ static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie)
 static int imx_pcie_deassert_core_reset(struct imx_pcie *imx_pcie)
 {
 	reset_control_deassert(imx_pcie->pciephy_reset);
+	reset_control_deassert(imx_pcie->apps_reset);
 
 	if (imx_pcie->drvdata->core_reset)
 		imx_pcie->drvdata->core_reset(imx_pcie, false);
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 6/9] PCI: imx6: Make *_enable_ref_clk() function symmetric
  2024-09-25  6:24 [PATCH v2 0/9] A bunch of changes to refine i.MX PCIe driver Richard Zhu
                   ` (4 preceding siblings ...)
  2024-09-25  6:24 ` [PATCH v2 5/9] PCI: imx6: Make core reset assertion deassertion symmetric Richard Zhu
@ 2024-09-25  6:24 ` Richard Zhu
  2024-09-25  6:24 ` [PATCH v2 7/9] PCI: imx6: Use dwc common suspend resume method Richard Zhu
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Richard Zhu @ 2024-09-25  6:24 UTC (permalink / raw)
  To: l.stach, kwilczynski, bhelgaas, lpieralisi, frank.li, robh+dt,
	conor+dt, shawnguo, krzysztof.kozlowski+dt, festevam, s.hauer
  Cc: linux-pci, linux-arm-kernel, linux-kernel, devicetree, kernel,
	imx, Richard Zhu

Ensure the *_enable_ref_clk() function is symmetric by addressing missing
disable parts on some platforms. Also, remove the duplicate
imx7d_pcie_init_phy() function as it is the same as
imx7d_pcie_enable_ref_clk().

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 33 +++++++++++----------------
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index f306f2e9dcce..5ec43d9f9784 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -388,13 +388,6 @@ static int imx8mq_pcie_init_phy(struct imx_pcie *imx_pcie)
 	return 0;
 }
 
-static int imx7d_pcie_init_phy(struct imx_pcie *imx_pcie)
-{
-	regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0);
-
-	return 0;
-}
-
 static int imx_pcie_init_phy(struct imx_pcie *imx_pcie)
 {
 	regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
@@ -593,13 +586,13 @@ static int imx_pcie_attach_pd(struct device *dev)
 
 static int imx6sx_pcie_enable_ref_clk(struct imx_pcie *imx_pcie, bool enable)
 {
-	if (enable)
-		regmap_clear_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
-				  IMX6SX_GPR12_PCIE_TEST_POWERDOWN);
-
+	regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
+			   IMX6SX_GPR12_PCIE_TEST_POWERDOWN,
+			   enable ? 0 : IMX6SX_GPR12_PCIE_TEST_POWERDOWN);
 	return 0;
 }
 
+
 static int imx6q_pcie_enable_ref_clk(struct imx_pcie *imx_pcie, bool enable)
 {
 	if (enable) {
@@ -625,19 +618,20 @@ static int imx8mm_pcie_enable_ref_clk(struct imx_pcie *imx_pcie, bool enable)
 {
 	int offset = imx_pcie_grp_offset(imx_pcie);
 
-	if (enable) {
-		regmap_clear_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE);
-		regmap_set_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN);
-	}
-
+	regmap_update_bits(imx_pcie->iomuxc_gpr, offset,
+			   IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE,
+			   enable ? 0 : IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE);
+	regmap_update_bits(imx_pcie->iomuxc_gpr, offset,
+			   IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN,
+			   enable ? IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN : 0);
 	return 0;
 }
 
 static int imx7d_pcie_enable_ref_clk(struct imx_pcie *imx_pcie, bool enable)
 {
-	if (!enable)
-		regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
-				IMX7D_GPR12_PCIE_PHY_REFCLK_SEL);
+	regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
+			   IMX7D_GPR12_PCIE_PHY_REFCLK_SEL,
+			   enable ? 0 : IMX7D_GPR12_PCIE_PHY_REFCLK_SEL);
 	return 0;
 }
 
@@ -1522,7 +1516,6 @@ static const struct imx_pcie_drvdata drvdata[] = {
 		.clks_cnt = ARRAY_SIZE(imx6q_clks),
 		.mode_off[0] = IOMUXC_GPR12,
 		.mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE,
-		.init_phy = imx7d_pcie_init_phy,
 		.enable_ref_clk = imx7d_pcie_enable_ref_clk,
 		.core_reset = imx7d_pcie_core_reset,
 	},
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 7/9] PCI: imx6: Use dwc common suspend resume method
  2024-09-25  6:24 [PATCH v2 0/9] A bunch of changes to refine i.MX PCIe driver Richard Zhu
                   ` (5 preceding siblings ...)
  2024-09-25  6:24 ` [PATCH v2 6/9] PCI: imx6: Make *_enable_ref_clk() function symmetric Richard Zhu
@ 2024-09-25  6:24 ` Richard Zhu
  2024-09-25  6:24 ` [PATCH v2 8/9] PCI: imx6: Add i.MX8MQ i.MX8Q and i.MX95 PCIe PM support Richard Zhu
  2024-09-25  6:24 ` [PATCH v2 9/9] arm64: dts: imx95: Add ref clock for i.MX95 PCIe Richard Zhu
  8 siblings, 0 replies; 13+ messages in thread
From: Richard Zhu @ 2024-09-25  6:24 UTC (permalink / raw)
  To: l.stach, kwilczynski, bhelgaas, lpieralisi, frank.li, robh+dt,
	conor+dt, shawnguo, krzysztof.kozlowski+dt, festevam, s.hauer
  Cc: linux-pci, linux-arm-kernel, linux-kernel, devicetree, kernel,
	imx, Frank Li, Richard Zhu

From: Frank Li <Frank.Li@nxp.com>

Call common dwc suspend/resume function. Use dwc common iATU method to send
out PME_TURN_OFF message. Old platform such as iMX6SX and iMX6QP, iATU
CTRL2 bit 22 (PCIE_ATU_INHIBIT_PAYLOAD) are reserved. So can't send out MSG
without data by dummy MMIO write. Without PCIE_ATU_INHIBIT_PAYLOAD, MSGD
will be sent out instead of MSG. So keep old method to send PME_TURN_OFF
MSG.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 97 ++++++++++-----------------
 1 file changed, 36 insertions(+), 61 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 5ec43d9f9784..36df439d43ae 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -33,6 +33,7 @@
 #include <linux/pm_domain.h>
 #include <linux/pm_runtime.h>
 
+#include "../../pci.h"
 #include "pcie-designware.h"
 
 #define IMX8MQ_GPR_PCIE_REF_USE_PAD		BIT(9)
@@ -82,6 +83,7 @@ enum imx_pcie_variants {
 #define IMX_PCIE_FLAG_HAS_SERDES		BIT(6)
 #define IMX_PCIE_FLAG_SUPPORT_64BIT		BIT(7)
 #define IMX_PCIE_FLAG_CPU_ADDR_FIXUP		BIT(8)
+#define IMX_PCIE_FLAG_CUSTOM_PME_TURNOFF	BIT(9)
 
 #define imx_check_flag(pci, val)	(pci->drvdata->flags & val)
 
@@ -106,19 +108,18 @@ struct imx_pcie_drvdata {
 	int (*init_phy)(struct imx_pcie *pcie);
 	int (*enable_ref_clk)(struct imx_pcie *pcie, bool enable);
 	int (*core_reset)(struct imx_pcie *pcie, bool assert);
+	const struct dw_pcie_host_ops *ops;
 };
 
 struct imx_pcie {
 	struct dw_pcie		*pci;
 	struct gpio_desc	*reset_gpiod;
-	bool			link_is_up;
 	struct clk_bulk_data	clks[IMX_PCIE_MAX_CLKS];
 	struct regmap		*iomuxc_gpr;
 	u16			msi_ctrl;
 	u32			controller_id;
 	struct reset_control	*pciephy_reset;
 	struct reset_control	*apps_reset;
-	struct reset_control	*turnoff_reset;
 	u32			tx_deemph_gen1;
 	u32			tx_deemph_gen2_3p5db;
 	u32			tx_deemph_gen2_6db;
@@ -898,13 +899,11 @@ static int imx_pcie_start_link(struct dw_pcie *pci)
 		dev_info(dev, "Link: Only Gen1 is enabled\n");
 	}
 
-	imx_pcie->link_is_up = true;
 	tmp = dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKSTA);
 	dev_info(dev, "Link up, Gen%i\n", tmp & PCI_EXP_LNKSTA_CLS);
 	return 0;
 
 err_reset_phy:
-	imx_pcie->link_is_up = false;
 	dev_dbg(dev, "PHY DEBUG_R0=0x%08x DEBUG_R1=0x%08x\n",
 		dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0),
 		dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1));
@@ -1023,9 +1022,33 @@ static u64 imx_pcie_cpu_addr_fixup(struct dw_pcie *pcie, u64 cpu_addr)
 	return (cpu_addr - offset);
 }
 
+/*
+ * Old dwc iATU ctrl2 bit 22 (PCIE_ATU_INHIBIT_PAYLOAD) are reserved. So can't
+ * send out MSG without data by dummy MMIO write. Without
+ * PCIE_ATU_INHIBIT_PAYLOAD, MSGD will be sent out. So have to keep old method
+ * to send PME_TURN_OFF MSG.
+ */
+static void imx_pcie_pm_turn_off(struct dw_pcie_rp *pp)
+{
+	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+	struct imx_pcie *imx_pcie = to_imx_pcie(pci);
+
+	regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_PM_TURN_OFF);
+	regmap_clear_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_PM_TURN_OFF);
+
+	usleep_range(PCIE_PME_TO_L2_TIMEOUT_US/10, PCIE_PME_TO_L2_TIMEOUT_US);
+}
+
+
 static const struct dw_pcie_host_ops imx_pcie_host_ops = {
 	.init = imx_pcie_host_init,
 	.deinit = imx_pcie_host_exit,
+	.pme_turn_off = imx_pcie_pm_turn_off,
+};
+
+static const struct dw_pcie_host_ops imx_pcie_host_dw_pme_ops = {
+	.init = imx_pcie_host_init,
+	.deinit = imx_pcie_host_exit,
 };
 
 static const struct dw_pcie_ops dw_pcie_ops = {
@@ -1146,43 +1169,6 @@ static int imx_add_pcie_ep(struct imx_pcie *imx_pcie,
 	return 0;
 }
 
-static void imx_pcie_pm_turnoff(struct imx_pcie *imx_pcie)
-{
-	struct device *dev = imx_pcie->pci->dev;
-
-	/* Some variants have a turnoff reset in DT */
-	if (imx_pcie->turnoff_reset) {
-		reset_control_assert(imx_pcie->turnoff_reset);
-		reset_control_deassert(imx_pcie->turnoff_reset);
-		goto pm_turnoff_sleep;
-	}
-
-	/* Others poke directly at IOMUXC registers */
-	switch (imx_pcie->drvdata->variant) {
-	case IMX6SX:
-	case IMX6QP:
-		regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
-				IMX6SX_GPR12_PCIE_PM_TURN_OFF,
-				IMX6SX_GPR12_PCIE_PM_TURN_OFF);
-		regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12,
-				IMX6SX_GPR12_PCIE_PM_TURN_OFF, 0);
-		break;
-	default:
-		dev_err(dev, "PME_Turn_Off not implemented\n");
-		return;
-	}
-
-	/*
-	 * Components with an upstream port must respond to
-	 * PME_Turn_Off with PME_TO_Ack but we can't check.
-	 *
-	 * The standard recommends a 1-10ms timeout after which to
-	 * proceed anyway as if acks were received.
-	 */
-pm_turnoff_sleep:
-	usleep_range(1000, 10000);
-}
-
 static void imx_pcie_msi_save_restore(struct imx_pcie *imx_pcie, bool save)
 {
 	u8 offset;
@@ -1206,36 +1192,26 @@ static void imx_pcie_msi_save_restore(struct imx_pcie *imx_pcie, bool save)
 static int imx_pcie_suspend_noirq(struct device *dev)
 {
 	struct imx_pcie *imx_pcie = dev_get_drvdata(dev);
-	struct dw_pcie_rp *pp = &imx_pcie->pci->pp;
 
 	if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND))
 		return 0;
 
 	imx_pcie_msi_save_restore(imx_pcie, true);
-	imx_pcie_pm_turnoff(imx_pcie);
-	imx_pcie_stop_link(imx_pcie->pci);
-	imx_pcie_host_exit(pp);
-
-	return 0;
+	return dw_pcie_suspend_noirq(imx_pcie->pci);
 }
 
 static int imx_pcie_resume_noirq(struct device *dev)
 {
 	int ret;
 	struct imx_pcie *imx_pcie = dev_get_drvdata(dev);
-	struct dw_pcie_rp *pp = &imx_pcie->pci->pp;
 
 	if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND))
 		return 0;
 
-	ret = imx_pcie_host_init(pp);
+	ret = dw_pcie_resume_noirq(imx_pcie->pci);
 	if (ret)
 		return ret;
 	imx_pcie_msi_save_restore(imx_pcie, false);
-	dw_pcie_setup_rc(pp);
-
-	if (imx_pcie->link_is_up)
-		imx_pcie_start_link(imx_pcie->pci);
 
 	return 0;
 }
@@ -1267,11 +1243,14 @@ static int imx_pcie_probe(struct platform_device *pdev)
 
 	pci->dev = dev;
 	pci->ops = &dw_pcie_ops;
-	pci->pp.ops = &imx_pcie_host_ops;
 
 	imx_pcie->pci = pci;
 	imx_pcie->drvdata = of_device_get_match_data(dev);
 
+	pci->pp.ops = &imx_pcie_host_dw_pme_ops;
+	if (imx_pcie->drvdata->ops)
+		pci->pp.ops = imx_pcie->drvdata->ops;
+
 	/* Find the PHY if one is defined, only imx7d uses it */
 	np = of_parse_phandle(node, "fsl,imx7d-pcie-phy", 0);
 	if (np) {
@@ -1340,13 +1319,6 @@ static int imx_pcie_probe(struct platform_device *pdev)
 		break;
 	}
 
-	/* Grab turnoff reset */
-	imx_pcie->turnoff_reset = devm_reset_control_get_optional_exclusive(dev, "turnoff");
-	if (IS_ERR(imx_pcie->turnoff_reset)) {
-		dev_err(dev, "Failed to get TURNOFF reset control\n");
-		return PTR_ERR(imx_pcie->turnoff_reset);
-	}
-
 	if (imx_pcie->drvdata->gpr) {
 	/* Grab GPR config register range */
 		imx_pcie->iomuxc_gpr =
@@ -1425,6 +1397,7 @@ static int imx_pcie_probe(struct platform_device *pdev)
 		if (ret < 0)
 			return ret;
 	} else {
+		pci->pp.use_atu_msg = true;
 		ret = dw_pcie_host_init(&pci->pp);
 		if (ret < 0)
 			return ret;
@@ -1488,6 +1461,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
 		.init_phy = imx6sx_pcie_init_phy,
 		.enable_ref_clk = imx6sx_pcie_enable_ref_clk,
 		.core_reset = imx6sx_pcie_core_reset,
+		.ops = &imx_pcie_host_ops,
 	},
 	[IMX6QP] = {
 		.variant = IMX6QP,
@@ -1505,6 +1479,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
 		.init_phy = imx_pcie_init_phy,
 		.enable_ref_clk = imx6q_pcie_enable_ref_clk,
 		.core_reset = imx6qp_pcie_core_reset,
+		.ops = &imx_pcie_host_ops,
 	},
 	[IMX7D] = {
 		.variant = IMX7D,
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 8/9] PCI: imx6: Add i.MX8MQ i.MX8Q and i.MX95 PCIe PM support
  2024-09-25  6:24 [PATCH v2 0/9] A bunch of changes to refine i.MX PCIe driver Richard Zhu
                   ` (6 preceding siblings ...)
  2024-09-25  6:24 ` [PATCH v2 7/9] PCI: imx6: Use dwc common suspend resume method Richard Zhu
@ 2024-09-25  6:24 ` Richard Zhu
  2024-09-25  6:24 ` [PATCH v2 9/9] arm64: dts: imx95: Add ref clock for i.MX95 PCIe Richard Zhu
  8 siblings, 0 replies; 13+ messages in thread
From: Richard Zhu @ 2024-09-25  6:24 UTC (permalink / raw)
  To: l.stach, kwilczynski, bhelgaas, lpieralisi, frank.li, robh+dt,
	conor+dt, shawnguo, krzysztof.kozlowski+dt, festevam, s.hauer
  Cc: linux-pci, linux-arm-kernel, linux-kernel, devicetree, kernel,
	imx, Richard Zhu

Add iMX8MQ i.MX8Q and i.MX95 PCIe suspend/resume support.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 36df439d43ae..a8505cd3b53d 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1497,7 +1497,8 @@ static const struct imx_pcie_drvdata drvdata[] = {
 	[IMX8MQ] = {
 		.variant = IMX8MQ,
 		.flags = IMX_PCIE_FLAG_HAS_APP_RESET |
-			 IMX_PCIE_FLAG_HAS_PHY_RESET,
+			 IMX_PCIE_FLAG_HAS_PHY_RESET |
+			 IMX_PCIE_FLAG_SUPPORTS_SUSPEND,
 		.gpr = "fsl,imx8mq-iomuxc-gpr",
 		.clk_names = imx8mq_clks,
 		.clks_cnt = ARRAY_SIZE(imx8mq_clks),
@@ -1535,13 +1536,15 @@ static const struct imx_pcie_drvdata drvdata[] = {
 	[IMX8Q] = {
 		.variant = IMX8Q,
 		.flags = IMX_PCIE_FLAG_HAS_PHYDRV |
-			 IMX_PCIE_FLAG_CPU_ADDR_FIXUP,
+			 IMX_PCIE_FLAG_CPU_ADDR_FIXUP |
+			 IMX_PCIE_FLAG_SUPPORTS_SUSPEND,
 		.clk_names = imx8q_clks,
 		.clks_cnt = ARRAY_SIZE(imx8q_clks),
 	},
 	[IMX95] = {
 		.variant = IMX95,
-		.flags = IMX_PCIE_FLAG_HAS_SERDES,
+		.flags = IMX_PCIE_FLAG_HAS_SERDES |
+			 IMX_PCIE_FLAG_SUPPORTS_SUSPEND,
 		.clk_names = imx95_clks,
 		.clks_cnt = ARRAY_SIZE(imx95_clks),
 		.ltssm_off = IMX95_PE0_GEN_CTRL_3,
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 9/9] arm64: dts: imx95: Add ref clock for i.MX95 PCIe
  2024-09-25  6:24 [PATCH v2 0/9] A bunch of changes to refine i.MX PCIe driver Richard Zhu
                   ` (7 preceding siblings ...)
  2024-09-25  6:24 ` [PATCH v2 8/9] PCI: imx6: Add i.MX8MQ i.MX8Q and i.MX95 PCIe PM support Richard Zhu
@ 2024-09-25  6:24 ` Richard Zhu
  8 siblings, 0 replies; 13+ messages in thread
From: Richard Zhu @ 2024-09-25  6:24 UTC (permalink / raw)
  To: l.stach, kwilczynski, bhelgaas, lpieralisi, frank.li, robh+dt,
	conor+dt, shawnguo, krzysztof.kozlowski+dt, festevam, s.hauer
  Cc: linux-pci, linux-arm-kernel, linux-kernel, devicetree, kernel,
	imx, Richard Zhu

Add ref clock for i.MX95 PCIe.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx95.dtsi | 25 ++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/freescale/imx95.dtsi b/arch/arm64/boot/dts/freescale/imx95.dtsi
index 1bbf9a0468f6..83a6b0a8da3e 100644
--- a/arch/arm64/boot/dts/freescale/imx95.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx95.dtsi
@@ -221,6 +221,13 @@ core5 {
 		};
 	};
 
+	clk_dummy: clock-dummy {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <0>;
+		clock-output-names = "clk_dummy";
+	};
+
 	clk_ext1: clock-ext1 {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
@@ -1055,6 +1062,14 @@ smmu: iommu@490d0000 {
 			};
 		};
 
+		hsio_blk_ctl: syscon@4c0100c0 {
+			compatible = "nxp,imx95-hsio-blk-ctl", "syscon";
+			reg = <0x0 0x4c0100c0 0x0 0x4>;
+			#clock-cells = <1>;
+			clocks = <&clk_dummy>;
+			power-domains = <&scmi_devpd IMX95_PD_HSIO_TOP>;
+		};
+
 		pcie0: pcie@4c300000 {
 			compatible = "fsl,imx95-pcie";
 			reg = <0 0x4c300000 0 0x10000>,
@@ -1082,8 +1097,9 @@ pcie0: pcie@4c300000 {
 			clocks = <&scmi_clk IMX95_CLK_HSIO>,
 				 <&scmi_clk IMX95_CLK_HSIOPLL>,
 				 <&scmi_clk IMX95_CLK_HSIOPLL_VCO>,
-				 <&scmi_clk IMX95_CLK_HSIOPCIEAUX>;
-			clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux";
+				 <&scmi_clk IMX95_CLK_HSIOPCIEAUX>,
+				 <&hsio_blk_ctl 0>;
+			clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux", "ref";
 			assigned-clocks =<&scmi_clk IMX95_CLK_HSIOPLL_VCO>,
 					 <&scmi_clk IMX95_CLK_HSIOPLL>,
 					 <&scmi_clk IMX95_CLK_HSIOPCIEAUX>;
@@ -1149,8 +1165,9 @@ pcie1: pcie@4c380000 {
 			clocks = <&scmi_clk IMX95_CLK_HSIO>,
 				 <&scmi_clk IMX95_CLK_HSIOPLL>,
 				 <&scmi_clk IMX95_CLK_HSIOPLL_VCO>,
-				 <&scmi_clk IMX95_CLK_HSIOPCIEAUX>;
-			clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux";
+				 <&scmi_clk IMX95_CLK_HSIOPCIEAUX>,
+				 <&hsio_blk_ctl 0>;
+			clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux", "ref";
 			assigned-clocks =<&scmi_clk IMX95_CLK_HSIOPLL_VCO>,
 					 <&scmi_clk IMX95_CLK_HSIOPLL>,
 					 <&scmi_clk IMX95_CLK_HSIOPCIEAUX>;
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/9] dt-bindings: imx6q-pcie: Add ref clock for i.MX95 PCIe
  2024-09-25  6:24 ` [PATCH v2 1/9] dt-bindings: imx6q-pcie: Add ref clock for i.MX95 PCIe Richard Zhu
@ 2024-09-25  7:50   ` Krzysztof Kozlowski
  2024-09-25 16:46     ` Frank Li
  0 siblings, 1 reply; 13+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-25  7:50 UTC (permalink / raw)
  To: Richard Zhu
  Cc: l.stach, kwilczynski, bhelgaas, lpieralisi, frank.li, robh+dt,
	conor+dt, shawnguo, krzysztof.kozlowski+dt, festevam, s.hauer,
	linux-pci, linux-arm-kernel, linux-kernel, devicetree, kernel,
	imx

On Wed, Sep 25, 2024 at 02:24:29PM +0800, Richard Zhu wrote:
> Previous reference clock of i.MX95 is on when system boot to kernel. But
> boot firmware change the behavor, it is off when boot. So it needs be turn
> on when it is used. Also it needs be turn off/on when suspend and resume.

That's an old platform... How come that you changed bootloader just now?
Like 7 or 8 years after?

For the future: you should document all clock inputs, not only ones
needed for given bootloader...

> 
> Add one ref clock for i.MX95 PCIe. Increase clocks' maxItems to 5 and keep
> the same restriction with other compatible string.

<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people
and lists to CC (and consider --no-git-fallback argument). It might
happen, that command when run on an older kernel, gives you outdated
entries. Therefore please be sure you base your patches on recent Linux
kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of
people, so fix your workflow. Tools might also fail if you work on some
ancient tree (don't, instead use mainline) or work on fork of kernel
(don't, instead use mainline). Just use b4 and everything should be
fine, although remember about  if you added new
patches to the patchset.
</form letter>

and I was wondering why I cannot find this and previous thread in my
inbox... So please stop developing on two year old kernels (and before
you say "I do not", well, then fix way how you use tools).


> 
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> ---
>  .../bindings/pci/fsl,imx6q-pcie-common.yaml   |  4 +--
>  .../bindings/pci/fsl,imx6q-pcie.yaml          | 25 ++++++++++++++++---
>  2 files changed, 23 insertions(+), 6 deletions(-)
> 

You missed to update ep binding.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/9] dt-bindings: imx6q-pcie: Add ref clock for i.MX95 PCIe
  2024-09-25  7:50   ` Krzysztof Kozlowski
@ 2024-09-25 16:46     ` Frank Li
  2024-09-25 19:28       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 13+ messages in thread
From: Frank Li @ 2024-09-25 16:46 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Richard Zhu, l.stach, kwilczynski, bhelgaas, lpieralisi, robh+dt,
	conor+dt, shawnguo, krzysztof.kozlowski+dt, festevam, s.hauer,
	linux-pci, linux-arm-kernel, linux-kernel, devicetree, kernel,
	imx

On Wed, Sep 25, 2024 at 09:50:06AM +0200, Krzysztof Kozlowski wrote:
> On Wed, Sep 25, 2024 at 02:24:29PM +0800, Richard Zhu wrote:
> > Previous reference clock of i.MX95 is on when system boot to kernel. But
> > boot firmware change the behavor, it is off when boot. So it needs be turn
> > on when it is used. Also it needs be turn off/on when suspend and resume.
>
> That's an old platform... How come that you changed bootloader just now?
> Like 7 or 8 years after?

It is new platform, which just publish in this year. Old platform reference
clock was controlled in PCI module, so needn't export to DT. So we have
not realized it when start i.MX95 work.

>
> For the future: you should document all clock inputs, not only ones
> needed for given bootloader...

Understand.

>
> >
> > Add one ref clock for i.MX95 PCIe. Increase clocks' maxItems to 5 and keep
> > the same restriction with other compatible string.
>
> <form letter>
> Please use scripts/get_maintainers.pl to get a list of necessary people
> and lists to CC (and consider --no-git-fallback argument). It might
> happen, that command when run on an older kernel, gives you outdated
> entries. Therefore please be sure you base your patches on recent Linux
> kernel.
>
> Tools like b4 or scripts/get_maintainer.pl provide you proper list of
> people, so fix your workflow. Tools might also fail if you work on some
> ancient tree (don't, instead use mainline) or work on fork of kernel
> (don't, instead use mainline). Just use b4 and everything should be
> fine, although remember about  if you added new
> patches to the patchset.
> </form letter>
>
> and I was wondering why I cannot find this and previous thread in my
> inbox... So please stop developing on two year old kernels (and before
> you say "I do not", well, then fix way how you use tools).
>
>
> >
> > Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> > ---
> >  .../bindings/pci/fsl,imx6q-pcie-common.yaml   |  4 +--
> >  .../bindings/pci/fsl,imx6q-pcie.yaml          | 25 ++++++++++++++++---
> >  2 files changed, 23 insertions(+), 6 deletions(-)
> >
>
> You missed to update ep binding.

So far, EP don't need reference clock. PCIe standard require host provide
100MHz reference clock to EP side. But EP side can choose use itself's
clock or reference clock from PCIe bus. Currently i.MX95 only support clock
from internal PLL when work as EP mode.

Frank

>
> Best regards,
> Krzysztof
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/9] dt-bindings: imx6q-pcie: Add ref clock for i.MX95 PCIe
  2024-09-25 16:46     ` Frank Li
@ 2024-09-25 19:28       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 13+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-25 19:28 UTC (permalink / raw)
  To: Frank Li
  Cc: Richard Zhu, l.stach, kwilczynski, bhelgaas, lpieralisi, robh+dt,
	conor+dt, shawnguo, krzysztof.kozlowski+dt, festevam, s.hauer,
	linux-pci, linux-arm-kernel, linux-kernel, devicetree, kernel,
	imx

On 25/09/2024 18:46, Frank Li wrote:
> On Wed, Sep 25, 2024 at 09:50:06AM +0200, Krzysztof Kozlowski wrote:
>> On Wed, Sep 25, 2024 at 02:24:29PM +0800, Richard Zhu wrote:
>>> Previous reference clock of i.MX95 is on when system boot to kernel. But
>>> boot firmware change the behavor, it is off when boot. So it needs be turn
>>> on when it is used. Also it needs be turn off/on when suspend and resume.
>>
>> That's an old platform... How come that you changed bootloader just now?
>> Like 7 or 8 years after?
> 
> It is new platform, which just publish in this year. Old platform reference
> clock was controlled in PCI module, so needn't export to DT. So we have
> not realized it when start i.MX95 work.

Indeed, I missed that it is i.MX95, not i.MX6q.

> 
>>
>> For the future: you should document all clock inputs, not only ones
>> needed for given bootloader...
> 
> Understand.

Sorry, in case of early upstreaming it's understandable.

> 
>>
>>>
>>> Add one ref clock for i.MX95 PCIe. Increase clocks' maxItems to 5 and keep
>>> the same restriction with other compatible string.
>>
>> <form letter>
>> Please use scripts/get_maintainers.pl to get a list of necessary people
>> and lists to CC (and consider --no-git-fallback argument). It might
>> happen, that command when run on an older kernel, gives you outdated
>> entries. Therefore please be sure you base your patches on recent Linux
>> kernel.
>>
>> Tools like b4 or scripts/get_maintainer.pl provide you proper list of
>> people, so fix your workflow. Tools might also fail if you work on some
>> ancient tree (don't, instead use mainline) or work on fork of kernel
>> (don't, instead use mainline). Just use b4 and everything should be
>> fine, although remember about  if you added new
>> patches to the patchset.
>> </form letter>
>>
>> and I was wondering why I cannot find this and previous thread in my
>> inbox... So please stop developing on two year old kernels (and before
>> you say "I do not", well, then fix way how you use tools).
>>
>>
>>>
>>> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
>>> ---
>>>  .../bindings/pci/fsl,imx6q-pcie-common.yaml   |  4 +--
>>>  .../bindings/pci/fsl,imx6q-pcie.yaml          | 25 ++++++++++++++++---
>>>  2 files changed, 23 insertions(+), 6 deletions(-)
>>>
>>
>> You missed to update ep binding.
> 
> So far, EP don't need reference clock. PCIe standard require host provide
> 100MHz reference clock to EP side. But EP side can choose use itself's
> clock or reference clock from PCIe bus. Currently i.MX95 only support clock
> from internal PLL when work as EP mode.

But this patch allowed certain existing variants in EP to have 5 clocks.
You missed to update EP binding...

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-09-25 19:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-25  6:24 [PATCH v2 0/9] A bunch of changes to refine i.MX PCIe driver Richard Zhu
2024-09-25  6:24 ` [PATCH v2 1/9] dt-bindings: imx6q-pcie: Add ref clock for i.MX95 PCIe Richard Zhu
2024-09-25  7:50   ` Krzysztof Kozlowski
2024-09-25 16:46     ` Frank Li
2024-09-25 19:28       ` Krzysztof Kozlowski
2024-09-25  6:24 ` [PATCH v2 2/9] PCI: imx6: " Richard Zhu
2024-09-25  6:24 ` [PATCH v2 3/9] PCI: imx6: Fetch dbi2 and iATU base addesses from DT Richard Zhu
2024-09-25  6:24 ` [PATCH v2 4/9] PCI: imx6: Correct controller_id generation logic for i.MX7D Richard Zhu
2024-09-25  6:24 ` [PATCH v2 5/9] PCI: imx6: Make core reset assertion deassertion symmetric Richard Zhu
2024-09-25  6:24 ` [PATCH v2 6/9] PCI: imx6: Make *_enable_ref_clk() function symmetric Richard Zhu
2024-09-25  6:24 ` [PATCH v2 7/9] PCI: imx6: Use dwc common suspend resume method Richard Zhu
2024-09-25  6:24 ` [PATCH v2 8/9] PCI: imx6: Add i.MX8MQ i.MX8Q and i.MX95 PCIe PM support Richard Zhu
2024-09-25  6:24 ` [PATCH v2 9/9] arm64: dts: imx95: Add ref clock for i.MX95 PCIe Richard Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).