mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
* [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region
@ 2025-11-01  4:29 Manivannan Sadhasivam
  2025-11-01  4:29 ` [PATCH RESEND 1/3] dt-bindings: PCI: amlogic: Fix the register name of the " Manivannan Sadhasivam
                   ` (5 more replies)
  0 siblings, 6 replies; 17+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-01  4:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Neil Armstrong, Hanjie Lin, Yue Wang, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andrew Murray, Jingoo Han,
	Krishna Chaitanya Chundru
  Cc: linux-pci, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, Manivannan Sadhasivam, stable+noautosel, stable,
	Linnaea Lavia

Hi,

This compile tested only series aims to fix the DBI parsing issue repored in
[1]. The issue stems from the fact that the DT and binding described 'dbi'
region as 'elbi' from the start.

Now, both binding and DTs are fixed and the driver is reworked to work with both
old and new DTs.

Note: The driver patch is OK to be backported till 6.2 where the common resource
parsing code was introduced. But the DTS patch should not be backported. And I'm
not sure about the backporting of the binding.

Please test this series on the Meson board with old and new DTs.

- Mani

[1] https://lore.kernel.org/linux-pci/DM4PR05MB102707B8CDF84D776C39F22F2C7F0A@DM4PR05MB10270.namprd05.prod.outlook.com/

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
Resending as the git sendemail config got messed up

---
Manivannan Sadhasivam (3):
      dt-bindings: PCI: amlogic: Fix the register name of the DBI region
      arm64: dts: amlogic: Fix the register name of the 'DBI' region
      PCI: meson: Fix parsing the DBI register region

 .../devicetree/bindings/pci/amlogic,axg-pcie.yaml      |  6 +++---
 arch/arm64/boot/dts/amlogic/meson-axg.dtsi             |  4 ++--
 arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi      |  2 +-
 drivers/pci/controller/dwc/pci-meson.c                 | 18 +++++++++++++++---
 drivers/pci/controller/dwc/pcie-designware.c           | 12 +++++++-----
 5 files changed, 28 insertions(+), 14 deletions(-)
---
base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
change-id: 20251031-pci-meson-fix-c8b651bc6662

Best regards,
-- 
Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH RESEND 1/3] dt-bindings: PCI: amlogic: Fix the register name of the DBI region
  2025-11-01  4:29 [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region Manivannan Sadhasivam
@ 2025-11-01  4:29 ` Manivannan Sadhasivam
  2025-11-03  9:47   ` Neil Armstrong
  2025-11-01  4:29 ` [PATCH RESEND 2/3] arm64: dts: amlogic: Fix the register name of the 'DBI' region Manivannan Sadhasivam
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 17+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-01  4:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Neil Armstrong, Hanjie Lin, Yue Wang, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andrew Murray, Jingoo Han,
	Krishna Chaitanya Chundru
  Cc: linux-pci, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, Manivannan Sadhasivam

Binding incorrectly specifies the 'DBI' region as 'ELBI'. DBI is a must
have region for DWC controllers as it has the Root Port and controller
specific registers, while ELBI has optional registers.

Hence, fix the binding. Though this is an ABI break, this change is needed
to accurately describe the PCI memory map.

Fixes: 7cd210391101 ("dt-bindings: PCI: meson: add DT bindings for Amlogic Meson PCIe controller")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
 Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml b/Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml
index 79a21ba0f9fd62804ba95fe8a6cc3252cf652197..c8258ef4032834d87cf3160ffd1d93812801b62a 100644
--- a/Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml
+++ b/Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml
@@ -36,13 +36,13 @@ properties:
 
   reg:
     items:
-      - description: External local bus interface registers
+      - description: Data Bus Interface registers
       - description: Meson designed configuration registers
       - description: PCIe configuration space
 
   reg-names:
     items:
-      - const: elbi
+      - const: dbi
       - const: cfg
       - const: config
 
@@ -113,7 +113,7 @@ examples:
     pcie: pcie@f9800000 {
         compatible = "amlogic,axg-pcie", "snps,dw-pcie";
         reg = <0xf9800000 0x400000>, <0xff646000 0x2000>, <0xf9f00000 0x100000>;
-        reg-names = "elbi", "cfg", "config";
+        reg-names = "dbi", "cfg", "config";
         interrupts = <GIC_SPI 177 IRQ_TYPE_EDGE_RISING>;
         clocks = <&pclk>, <&clk_port>, <&clk_phy>;
         clock-names = "pclk", "port", "general";

-- 
2.48.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH RESEND 2/3] arm64: dts: amlogic: Fix the register name of the 'DBI' region
  2025-11-01  4:29 [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region Manivannan Sadhasivam
  2025-11-01  4:29 ` [PATCH RESEND 1/3] dt-bindings: PCI: amlogic: Fix the register name of the " Manivannan Sadhasivam
@ 2025-11-01  4:29 ` Manivannan Sadhasivam
  2025-11-03  9:47   ` Neil Armstrong
  2025-11-01  4:29 ` [PATCH RESEND 3/3] PCI: meson: Fix parsing the DBI register region Manivannan Sadhasivam
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 17+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-01  4:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Neil Armstrong, Hanjie Lin, Yue Wang, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andrew Murray, Jingoo Han,
	Krishna Chaitanya Chundru
  Cc: linux-pci, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, Manivannan Sadhasivam, stable+noautosel

DT incorrectly specifies the 'DBI' region as 'ELBI'. DBI is a must have
region for DWC controllers as it has the Root Port and controller specific
registers, while ELBI has optional registers.

Hence, fix the DT for both Meson platforms.

Cc: stable+noautosel@kernel.org # Driver dependency
Fixes: 5b3a9c20926e ("arm64: dts: meson-axg: add PCIe nodes")
Fixes: 1f8607d59763 ("arm64: dts: meson-g12a: Add PCIe node")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
 arch/arm64/boot/dts/amlogic/meson-axg.dtsi        | 4 ++--
 arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
index 04fb130ac7c6a498f7e8029aeaa7e511cbfe815d..e95c91894968b2c8b3b8e96a5f5e85cd60f3e085 100644
--- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
@@ -208,7 +208,7 @@ pcieA: pcie@f9800000 {
 			reg = <0x0 0xf9800000 0x0 0x400000>,
 			      <0x0 0xff646000 0x0 0x2000>,
 			      <0x0 0xf9f00000 0x0 0x100000>;
-			reg-names = "elbi", "cfg", "config";
+			reg-names = "dbi", "cfg", "config";
 			interrupts = <GIC_SPI 177 IRQ_TYPE_EDGE_RISING>;
 			#interrupt-cells = <1>;
 			interrupt-map-mask = <0 0 0 0>;
@@ -234,7 +234,7 @@ pcieB: pcie@fa000000 {
 			reg = <0x0 0xfa000000 0x0 0x400000>,
 			      <0x0 0xff648000 0x0 0x2000>,
 			      <0x0 0xfa400000 0x0 0x100000>;
-			reg-names = "elbi", "cfg", "config";
+			reg-names = "dbi", "cfg", "config";
 			interrupts = <GIC_SPI 167 IRQ_TYPE_EDGE_RISING>;
 			#interrupt-cells = <1>;
 			interrupt-map-mask = <0 0 0 0>;
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
index dcc927a9da80246da43391f9f90049c3570f10d2..ca455f634834b5a52db8ff4e6ebca35a87ea17b7 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
@@ -138,7 +138,7 @@ pcie: pcie@fc000000 {
 			reg = <0x0 0xfc000000 0x0 0x400000>,
 			      <0x0 0xff648000 0x0 0x2000>,
 			      <0x0 0xfc400000 0x0 0x200000>;
-			reg-names = "elbi", "cfg", "config";
+			reg-names = "dbi", "cfg", "config";
 			interrupts = <GIC_SPI 221 IRQ_TYPE_LEVEL_HIGH>;
 			#interrupt-cells = <1>;
 			interrupt-map-mask = <0 0 0 0>;

-- 
2.48.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH RESEND 3/3] PCI: meson: Fix parsing the DBI register region
  2025-11-01  4:29 [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region Manivannan Sadhasivam
  2025-11-01  4:29 ` [PATCH RESEND 1/3] dt-bindings: PCI: amlogic: Fix the register name of the " Manivannan Sadhasivam
  2025-11-01  4:29 ` [PATCH RESEND 2/3] arm64: dts: amlogic: Fix the register name of the 'DBI' region Manivannan Sadhasivam
@ 2025-11-01  4:29 ` Manivannan Sadhasivam
  2025-11-03  9:49   ` Neil Armstrong
  2025-11-06 10:00   ` Neil Armstrong
  2025-11-03  9:50 ` [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region Neil Armstrong
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 17+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-01  4:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Neil Armstrong, Hanjie Lin, Yue Wang, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andrew Murray, Jingoo Han,
	Krishna Chaitanya Chundru
  Cc: linux-pci, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, Manivannan Sadhasivam, stable, Linnaea Lavia

First of all, the driver was parsing the 'dbi' register region as 'elbi'.
This was due to DT mistakenly passing 'dbi' as 'elbi'. Since the DT is
now fixed to supply 'dbi' region, this driver can rely on the DWC core
driver to parse and map it.

However, to support the old DTs, if the 'elbi' region is found in DT, parse
and map the region as both 'dw_pcie::elbi_base' as 'dw_pcie::dbi_base'.
This will allow the driver to work with both broken and fixed DTs.

Also, skip parsing the 'elbi' region in DWC core if 'pci->elbi_base' was
already populated.

Cc: <stable@vger.kernel.org> # 6.2
Reported-by: Linnaea Lavia <linnaea-von-lavia@live.com>
Closes: https://lore.kernel.org/linux-pci/DM4PR05MB102707B8CDF84D776C39F22F2C7F0A@DM4PR05MB10270.namprd05.prod.outlook.com/
Fixes: 9c0ef6d34fdb ("PCI: amlogic: Add the Amlogic Meson PCIe controller driver")
Fixes: c96992a24bec ("PCI: dwc: Add support for ELBI resource mapping")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
 drivers/pci/controller/dwc/pci-meson.c       | 18 +++++++++++++++---
 drivers/pci/controller/dwc/pcie-designware.c | 12 +++++++-----
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c
index 787469d1b396d4c7b3e28edfe276b7b997fb8aee..54b6a4196f1767a3c14c6c901bfee3505588134c 100644
--- a/drivers/pci/controller/dwc/pci-meson.c
+++ b/drivers/pci/controller/dwc/pci-meson.c
@@ -108,10 +108,22 @@ static int meson_pcie_get_mems(struct platform_device *pdev,
 			       struct meson_pcie *mp)
 {
 	struct dw_pcie *pci = &mp->pci;
+	struct resource *res;
 
-	pci->dbi_base = devm_platform_ioremap_resource_byname(pdev, "elbi");
-	if (IS_ERR(pci->dbi_base))
-		return PTR_ERR(pci->dbi_base);
+	/*
+	 * For the broken DTs that supply 'dbi' as 'elbi', parse the 'elbi'
+	 * region and assign it to both 'pci->elbi_base' and 'pci->dbi_space' so
+	 * that the DWC core can skip parsing both regions.
+	 */
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
+	if (res) {
+		pci->elbi_base = devm_pci_remap_cfg_resource(pci->dev, res);
+		if (IS_ERR(pci->elbi_base))
+			return PTR_ERR(pci->elbi_base);
+
+		pci->dbi_base = pci->elbi_base;
+		pci->dbi_phys_addr = res->start;
+	}
 
 	mp->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
 	if (IS_ERR(mp->cfg_base))
diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
index c644216995f69cbf065e61a0392bf1e5e32cf56e..06eca858eb1b3c7a8a833df6616febcdbe854850 100644
--- a/drivers/pci/controller/dwc/pcie-designware.c
+++ b/drivers/pci/controller/dwc/pcie-designware.c
@@ -168,11 +168,13 @@ int dw_pcie_get_resources(struct dw_pcie *pci)
 	}
 
 	/* ELBI is an optional resource */
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
-	if (res) {
-		pci->elbi_base = devm_ioremap_resource(pci->dev, res);
-		if (IS_ERR(pci->elbi_base))
-			return PTR_ERR(pci->elbi_base);
+	if (!pci->elbi_base) {
+		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
+		if (res) {
+			pci->elbi_base = devm_ioremap_resource(pci->dev, res);
+			if (IS_ERR(pci->elbi_base))
+				return PTR_ERR(pci->elbi_base);
+		}
 	}
 
 	/* LLDD is supposed to manually switch the clocks and resets state */

-- 
2.48.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH RESEND 1/3] dt-bindings: PCI: amlogic: Fix the register name of the DBI region
  2025-11-01  4:29 ` [PATCH RESEND 1/3] dt-bindings: PCI: amlogic: Fix the register name of the " Manivannan Sadhasivam
@ 2025-11-03  9:47   ` Neil Armstrong
  2025-11-03 10:12     ` Manivannan Sadhasivam
  0 siblings, 1 reply; 17+ messages in thread
From: Neil Armstrong @ 2025-11-03  9:47 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Bjorn Helgaas, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Hanjie Lin, Yue Wang,
	Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Andrew Murray,
	Jingoo Han, Krishna Chaitanya Chundru
  Cc: linux-pci, devicetree, linux-kernel, linux-arm-kernel, linux-amlogic

Hi Mani,

On 11/1/25 05:29, Manivannan Sadhasivam wrote:
> Binding incorrectly specifies the 'DBI' region as 'ELBI'. DBI is a must
> have region for DWC controllers as it has the Root Port and controller
> specific registers, while ELBI has optional registers.
> 
> Hence, fix the binding. Though this is an ABI break, this change is needed
> to accurately describe the PCI memory map.

Not fan of this ABI break, the current bindings should be marked as deprecated instead.

> 
> Fixes: 7cd210391101 ("dt-bindings: PCI: meson: add DT bindings for Amlogic Meson PCIe controller")
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> ---
>   Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml b/Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml
> index 79a21ba0f9fd62804ba95fe8a6cc3252cf652197..c8258ef4032834d87cf3160ffd1d93812801b62a 100644
> --- a/Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml
> +++ b/Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml
> @@ -36,13 +36,13 @@ properties:
>   
>     reg:
>       items:
> -      - description: External local bus interface registers
> +      - description: Data Bus Interface registers
>         - description: Meson designed configuration registers
>         - description: PCIe configuration space
>   
>     reg-names:
>       items:
> -      - const: elbi
> +      - const: dbi
>         - const: cfg
>         - const: config
>   
> @@ -113,7 +113,7 @@ examples:
>       pcie: pcie@f9800000 {
>           compatible = "amlogic,axg-pcie", "snps,dw-pcie";
>           reg = <0xf9800000 0x400000>, <0xff646000 0x2000>, <0xf9f00000 0x100000>;
> -        reg-names = "elbi", "cfg", "config";
> +        reg-names = "dbi", "cfg", "config";
>           interrupts = <GIC_SPI 177 IRQ_TYPE_EDGE_RISING>;
>           clocks = <&pclk>, <&clk_port>, <&clk_phy>;
>           clock-names = "pclk", "port", "general";
> 


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH RESEND 2/3] arm64: dts: amlogic: Fix the register name of the 'DBI' region
  2025-11-01  4:29 ` [PATCH RESEND 2/3] arm64: dts: amlogic: Fix the register name of the 'DBI' region Manivannan Sadhasivam
@ 2025-11-03  9:47   ` Neil Armstrong
  0 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2025-11-03  9:47 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Bjorn Helgaas, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Hanjie Lin, Yue Wang,
	Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Andrew Murray,
	Jingoo Han, Krishna Chaitanya Chundru
  Cc: linux-pci, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, stable+noautosel

On 11/1/25 05:29, Manivannan Sadhasivam wrote:
> DT incorrectly specifies the 'DBI' region as 'ELBI'. DBI is a must have
> region for DWC controllers as it has the Root Port and controller specific
> registers, while ELBI has optional registers.
> 
> Hence, fix the DT for both Meson platforms.
> 
> Cc: stable+noautosel@kernel.org # Driver dependency
> Fixes: 5b3a9c20926e ("arm64: dts: meson-axg: add PCIe nodes")
> Fixes: 1f8607d59763 ("arm64: dts: meson-g12a: Add PCIe node")
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> ---
>   arch/arm64/boot/dts/amlogic/meson-axg.dtsi        | 4 ++--
>   arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 2 +-
>   2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
> index 04fb130ac7c6a498f7e8029aeaa7e511cbfe815d..e95c91894968b2c8b3b8e96a5f5e85cd60f3e085 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
> @@ -208,7 +208,7 @@ pcieA: pcie@f9800000 {
>   			reg = <0x0 0xf9800000 0x0 0x400000>,
>   			      <0x0 0xff646000 0x0 0x2000>,
>   			      <0x0 0xf9f00000 0x0 0x100000>;
> -			reg-names = "elbi", "cfg", "config";
> +			reg-names = "dbi", "cfg", "config";
>   			interrupts = <GIC_SPI 177 IRQ_TYPE_EDGE_RISING>;
>   			#interrupt-cells = <1>;
>   			interrupt-map-mask = <0 0 0 0>;
> @@ -234,7 +234,7 @@ pcieB: pcie@fa000000 {
>   			reg = <0x0 0xfa000000 0x0 0x400000>,
>   			      <0x0 0xff648000 0x0 0x2000>,
>   			      <0x0 0xfa400000 0x0 0x100000>;
> -			reg-names = "elbi", "cfg", "config";
> +			reg-names = "dbi", "cfg", "config";
>   			interrupts = <GIC_SPI 167 IRQ_TYPE_EDGE_RISING>;
>   			#interrupt-cells = <1>;
>   			interrupt-map-mask = <0 0 0 0>;
> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
> index dcc927a9da80246da43391f9f90049c3570f10d2..ca455f634834b5a52db8ff4e6ebca35a87ea17b7 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
> @@ -138,7 +138,7 @@ pcie: pcie@fc000000 {
>   			reg = <0x0 0xfc000000 0x0 0x400000>,
>   			      <0x0 0xff648000 0x0 0x2000>,
>   			      <0x0 0xfc400000 0x0 0x200000>;
> -			reg-names = "elbi", "cfg", "config";
> +			reg-names = "dbi", "cfg", "config";
>   			interrupts = <GIC_SPI 221 IRQ_TYPE_LEVEL_HIGH>;
>   			#interrupt-cells = <1>;
>   			interrupt-map-mask = <0 0 0 0>;
> 

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH RESEND 3/3] PCI: meson: Fix parsing the DBI register region
  2025-11-01  4:29 ` [PATCH RESEND 3/3] PCI: meson: Fix parsing the DBI register region Manivannan Sadhasivam
@ 2025-11-03  9:49   ` Neil Armstrong
  2025-11-06 10:00   ` Neil Armstrong
  1 sibling, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2025-11-03  9:49 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Bjorn Helgaas, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Hanjie Lin, Yue Wang,
	Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Andrew Murray,
	Jingoo Han, Krishna Chaitanya Chundru
  Cc: linux-pci, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, stable, Linnaea Lavia

On 11/1/25 05:29, Manivannan Sadhasivam wrote:
> First of all, the driver was parsing the 'dbi' register region as 'elbi'.
> This was due to DT mistakenly passing 'dbi' as 'elbi'. Since the DT is
> now fixed to supply 'dbi' region, this driver can rely on the DWC core
> driver to parse and map it.
> 
> However, to support the old DTs, if the 'elbi' region is found in DT, parse
> and map the region as both 'dw_pcie::elbi_base' as 'dw_pcie::dbi_base'.
> This will allow the driver to work with both broken and fixed DTs.
> 
> Also, skip parsing the 'elbi' region in DWC core if 'pci->elbi_base' was
> already populated.
> 
> Cc: <stable@vger.kernel.org> # 6.2
> Reported-by: Linnaea Lavia <linnaea-von-lavia@live.com>
> Closes: https://lore.kernel.org/linux-pci/DM4PR05MB102707B8CDF84D776C39F22F2C7F0A@DM4PR05MB10270.namprd05.prod.outlook.com/
> Fixes: 9c0ef6d34fdb ("PCI: amlogic: Add the Amlogic Meson PCIe controller driver")
> Fixes: c96992a24bec ("PCI: dwc: Add support for ELBI resource mapping")
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> ---
>   drivers/pci/controller/dwc/pci-meson.c       | 18 +++++++++++++++---
>   drivers/pci/controller/dwc/pcie-designware.c | 12 +++++++-----
>   2 files changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c
> index 787469d1b396d4c7b3e28edfe276b7b997fb8aee..54b6a4196f1767a3c14c6c901bfee3505588134c 100644
> --- a/drivers/pci/controller/dwc/pci-meson.c
> +++ b/drivers/pci/controller/dwc/pci-meson.c
> @@ -108,10 +108,22 @@ static int meson_pcie_get_mems(struct platform_device *pdev,
>   			       struct meson_pcie *mp)
>   {
>   	struct dw_pcie *pci = &mp->pci;
> +	struct resource *res;
>   
> -	pci->dbi_base = devm_platform_ioremap_resource_byname(pdev, "elbi");
> -	if (IS_ERR(pci->dbi_base))
> -		return PTR_ERR(pci->dbi_base);
> +	/*
> +	 * For the broken DTs that supply 'dbi' as 'elbi', parse the 'elbi'
> +	 * region and assign it to both 'pci->elbi_base' and 'pci->dbi_space' so
> +	 * that the DWC core can skip parsing both regions.
> +	 */
> +	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
> +	if (res) {
> +		pci->elbi_base = devm_pci_remap_cfg_resource(pci->dev, res);
> +		if (IS_ERR(pci->elbi_base))
> +			return PTR_ERR(pci->elbi_base);
> +
> +		pci->dbi_base = pci->elbi_base;
> +		pci->dbi_phys_addr = res->start;
> +	}
>   
>   	mp->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
>   	if (IS_ERR(mp->cfg_base))
> diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
> index c644216995f69cbf065e61a0392bf1e5e32cf56e..06eca858eb1b3c7a8a833df6616febcdbe854850 100644
> --- a/drivers/pci/controller/dwc/pcie-designware.c
> +++ b/drivers/pci/controller/dwc/pcie-designware.c
> @@ -168,11 +168,13 @@ int dw_pcie_get_resources(struct dw_pcie *pci)
>   	}
>   
>   	/* ELBI is an optional resource */
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
> -	if (res) {
> -		pci->elbi_base = devm_ioremap_resource(pci->dev, res);
> -		if (IS_ERR(pci->elbi_base))
> -			return PTR_ERR(pci->elbi_base);
> +	if (!pci->elbi_base) {
> +		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
> +		if (res) {
> +			pci->elbi_base = devm_ioremap_resource(pci->dev, res);
> +			if (IS_ERR(pci->elbi_base))
> +				return PTR_ERR(pci->elbi_base);
> +		}
>   	}
>   
>   	/* LLDD is supposed to manually switch the clocks and resets state */
> 

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region
  2025-11-01  4:29 [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region Manivannan Sadhasivam
                   ` (2 preceding siblings ...)
  2025-11-01  4:29 ` [PATCH RESEND 3/3] PCI: meson: Fix parsing the DBI register region Manivannan Sadhasivam
@ 2025-11-03  9:50 ` Neil Armstrong
  2025-11-03 10:14   ` Manivannan Sadhasivam
  2025-11-10  6:56 ` (subset) " Manivannan Sadhasivam
  2025-11-10  8:18 ` Neil Armstrong
  5 siblings, 1 reply; 17+ messages in thread
From: Neil Armstrong @ 2025-11-03  9:50 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Bjorn Helgaas, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Hanjie Lin, Yue Wang,
	Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Andrew Murray,
	Jingoo Han, Krishna Chaitanya Chundru
  Cc: linux-pci, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, stable+noautosel, stable, Linnaea Lavia

On 11/1/25 05:29, Manivannan Sadhasivam wrote:
> Hi,
> 
> This compile tested only series aims to fix the DBI parsing issue repored in
> [1]. The issue stems from the fact that the DT and binding described 'dbi'
> region as 'elbi' from the start.
> 
> Now, both binding and DTs are fixed and the driver is reworked to work with both
> old and new DTs.
> 
> Note: The driver patch is OK to be backported till 6.2 where the common resource
> parsing code was introduced. But the DTS patch should not be backported. And I'm
> not sure about the backporting of the binding.
> 
> Please test this series on the Meson board with old and new DTs.

Let me try this serie, I'm on a business trip this week so don't expect a full test
report until next monday.

Neil

> 
> - Mani
> 
> [1] https://lore.kernel.org/linux-pci/DM4PR05MB102707B8CDF84D776C39F22F2C7F0A@DM4PR05MB10270.namprd05.prod.outlook.com/
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> ---
> Resending as the git sendemail config got messed up
> 
> ---
> Manivannan Sadhasivam (3):
>        dt-bindings: PCI: amlogic: Fix the register name of the DBI region
>        arm64: dts: amlogic: Fix the register name of the 'DBI' region
>        PCI: meson: Fix parsing the DBI register region
> 
>   .../devicetree/bindings/pci/amlogic,axg-pcie.yaml      |  6 +++---
>   arch/arm64/boot/dts/amlogic/meson-axg.dtsi             |  4 ++--
>   arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi      |  2 +-
>   drivers/pci/controller/dwc/pci-meson.c                 | 18 +++++++++++++++---
>   drivers/pci/controller/dwc/pcie-designware.c           | 12 +++++++-----
>   5 files changed, 28 insertions(+), 14 deletions(-)
> ---
> base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
> change-id: 20251031-pci-meson-fix-c8b651bc6662
> 
> Best regards,


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH RESEND 1/3] dt-bindings: PCI: amlogic: Fix the register name of the DBI region
  2025-11-03  9:47   ` Neil Armstrong
@ 2025-11-03 10:12     ` Manivannan Sadhasivam
  2025-11-06  8:30       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 17+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-03 10:12 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Manivannan Sadhasivam, Bjorn Helgaas, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Hanjie Lin, Yue Wang, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Andrew Murray, Jingoo Han,
	Krishna Chaitanya Chundru, linux-pci, devicetree, linux-kernel,
	linux-arm-kernel, linux-amlogic

On Mon, Nov 03, 2025 at 10:47:36AM +0100, Neil Armstrong wrote:
> Hi Mani,
> 
> On 11/1/25 05:29, Manivannan Sadhasivam wrote:
> > Binding incorrectly specifies the 'DBI' region as 'ELBI'. DBI is a must
> > have region for DWC controllers as it has the Root Port and controller
> > specific registers, while ELBI has optional registers.
> > 
> > Hence, fix the binding. Though this is an ABI break, this change is needed
> > to accurately describe the PCI memory map.
> 
> Not fan of this ABI break, the current bindings should be marked as deprecated instead.
> 

Fair enough. Will make it as deprecated.

- Mani

> > 
> > Fixes: 7cd210391101 ("dt-bindings: PCI: meson: add DT bindings for Amlogic Meson PCIe controller")
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> > ---
> >   Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml b/Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml
> > index 79a21ba0f9fd62804ba95fe8a6cc3252cf652197..c8258ef4032834d87cf3160ffd1d93812801b62a 100644
> > --- a/Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml
> > +++ b/Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml
> > @@ -36,13 +36,13 @@ properties:
> >     reg:
> >       items:
> > -      - description: External local bus interface registers
> > +      - description: Data Bus Interface registers
> >         - description: Meson designed configuration registers
> >         - description: PCIe configuration space
> >     reg-names:
> >       items:
> > -      - const: elbi
> > +      - const: dbi
> >         - const: cfg
> >         - const: config
> > @@ -113,7 +113,7 @@ examples:
> >       pcie: pcie@f9800000 {
> >           compatible = "amlogic,axg-pcie", "snps,dw-pcie";
> >           reg = <0xf9800000 0x400000>, <0xff646000 0x2000>, <0xf9f00000 0x100000>;
> > -        reg-names = "elbi", "cfg", "config";
> > +        reg-names = "dbi", "cfg", "config";
> >           interrupts = <GIC_SPI 177 IRQ_TYPE_EDGE_RISING>;
> >           clocks = <&pclk>, <&clk_port>, <&clk_phy>;
> >           clock-names = "pclk", "port", "general";
> > 
> 

-- 
மணிவண்ணன் சதாசிவம்

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region
  2025-11-03  9:50 ` [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region Neil Armstrong
@ 2025-11-03 10:14   ` Manivannan Sadhasivam
  0 siblings, 0 replies; 17+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-03 10:14 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Manivannan Sadhasivam, Bjorn Helgaas, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Hanjie Lin, Yue Wang, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Andrew Murray, Jingoo Han,
	Krishna Chaitanya Chundru, linux-pci, devicetree, linux-kernel,
	linux-arm-kernel, linux-amlogic, stable+noautosel, stable,
	Linnaea Lavia

On Mon, Nov 03, 2025 at 10:50:20AM +0100, Neil Armstrong wrote:
> On 11/1/25 05:29, Manivannan Sadhasivam wrote:
> > Hi,
> > 
> > This compile tested only series aims to fix the DBI parsing issue repored in
> > [1]. The issue stems from the fact that the DT and binding described 'dbi'
> > region as 'elbi' from the start.
> > 
> > Now, both binding and DTs are fixed and the driver is reworked to work with both
> > old and new DTs.
> > 
> > Note: The driver patch is OK to be backported till 6.2 where the common resource
> > parsing code was introduced. But the DTS patch should not be backported. And I'm
> > not sure about the backporting of the binding.
> > 
> > Please test this series on the Meson board with old and new DTs.
> 
> Let me try this serie, I'm on a business trip this week so don't expect a full test
> report until next monday.
> 

Sure. I may post the next iteration, but will not merge the binding/driver
patches until you confirm.

- Mani

> Neil
> 
> > 
> > - Mani
> > 
> > [1] https://lore.kernel.org/linux-pci/DM4PR05MB102707B8CDF84D776C39F22F2C7F0A@DM4PR05MB10270.namprd05.prod.outlook.com/
> > 
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> > ---
> > Resending as the git sendemail config got messed up
> > 
> > ---
> > Manivannan Sadhasivam (3):
> >        dt-bindings: PCI: amlogic: Fix the register name of the DBI region
> >        arm64: dts: amlogic: Fix the register name of the 'DBI' region
> >        PCI: meson: Fix parsing the DBI register region
> > 
> >   .../devicetree/bindings/pci/amlogic,axg-pcie.yaml      |  6 +++---
> >   arch/arm64/boot/dts/amlogic/meson-axg.dtsi             |  4 ++--
> >   arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi      |  2 +-
> >   drivers/pci/controller/dwc/pci-meson.c                 | 18 +++++++++++++++---
> >   drivers/pci/controller/dwc/pcie-designware.c           | 12 +++++++-----
> >   5 files changed, 28 insertions(+), 14 deletions(-)
> > ---
> > base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
> > change-id: 20251031-pci-meson-fix-c8b651bc6662
> > 
> > Best regards,
> 

-- 
மணிவண்ணன் சதாசிவம்

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH RESEND 1/3] dt-bindings: PCI: amlogic: Fix the register name of the DBI region
  2025-11-03 10:12     ` Manivannan Sadhasivam
@ 2025-11-06  8:30       ` Krzysztof Kozlowski
  2025-11-06  9:06         ` Manivannan Sadhasivam
  0 siblings, 1 reply; 17+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-06  8:30 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Neil Armstrong, Manivannan Sadhasivam, Bjorn Helgaas,
	Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Hanjie Lin, Yue Wang,
	Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Andrew Murray,
	Jingoo Han, Krishna Chaitanya Chundru, linux-pci, devicetree,
	linux-kernel, linux-arm-kernel, linux-amlogic

On Mon, Nov 03, 2025 at 03:42:58PM +0530, Manivannan Sadhasivam wrote:
> On Mon, Nov 03, 2025 at 10:47:36AM +0100, Neil Armstrong wrote:
> > Hi Mani,
> > 
> > On 11/1/25 05:29, Manivannan Sadhasivam wrote:
> > > Binding incorrectly specifies the 'DBI' region as 'ELBI'. DBI is a must
> > > have region for DWC controllers as it has the Root Port and controller
> > > specific registers, while ELBI has optional registers.
> > > 
> > > Hence, fix the binding. Though this is an ABI break, this change is needed
> > > to accurately describe the PCI memory map.
> > 
> > Not fan of this ABI break, the current bindings should be marked as deprecated instead.
> > 
> 
> Fair enough. Will make it as deprecated.

The true question is what value was being passed as that item (ELBI)?
Because if this was always DBI - device has DBI there - then what
deprecation would change?

Best regards,
Krzysztof


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH RESEND 1/3] dt-bindings: PCI: amlogic: Fix the register name of the DBI region
  2025-11-06  8:30       ` Krzysztof Kozlowski
@ 2025-11-06  9:06         ` Manivannan Sadhasivam
  2025-11-08 10:40           ` Manivannan Sadhasivam
  0 siblings, 1 reply; 17+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-06  9:06 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Neil Armstrong, Manivannan Sadhasivam, Bjorn Helgaas,
	Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Hanjie Lin, Yue Wang,
	Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Andrew Murray,
	Jingoo Han, Krishna Chaitanya Chundru, linux-pci, devicetree,
	linux-kernel, linux-arm-kernel, linux-amlogic

On Thu, Nov 06, 2025 at 09:30:15AM +0100, Krzysztof Kozlowski wrote:
> On Mon, Nov 03, 2025 at 03:42:58PM +0530, Manivannan Sadhasivam wrote:
> > On Mon, Nov 03, 2025 at 10:47:36AM +0100, Neil Armstrong wrote:
> > > Hi Mani,
> > > 
> > > On 11/1/25 05:29, Manivannan Sadhasivam wrote:
> > > > Binding incorrectly specifies the 'DBI' region as 'ELBI'. DBI is a must
> > > > have region for DWC controllers as it has the Root Port and controller
> > > > specific registers, while ELBI has optional registers.
> > > > 
> > > > Hence, fix the binding. Though this is an ABI break, this change is needed
> > > > to accurately describe the PCI memory map.
> > > 
> > > Not fan of this ABI break, the current bindings should be marked as deprecated instead.
> > > 
> > 
> > Fair enough. Will make it as deprecated.
> 
> The true question is what value was being passed as that item (ELBI)?
> Because if this was always DBI - device has DBI there - then what
> deprecation would change?

Nothing, except not breaking old DTs with the binding check. That's why I
decided to remove it in the first place.

- Mani

-- 
மணிவண்ணன் சதாசிவம்

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH RESEND 3/3] PCI: meson: Fix parsing the DBI register region
  2025-11-01  4:29 ` [PATCH RESEND 3/3] PCI: meson: Fix parsing the DBI register region Manivannan Sadhasivam
  2025-11-03  9:49   ` Neil Armstrong
@ 2025-11-06 10:00   ` Neil Armstrong
  1 sibling, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2025-11-06 10:00 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Bjorn Helgaas, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Hanjie Lin, Yue Wang,
	Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Andrew Murray,
	Jingoo Han, Krishna Chaitanya Chundru
  Cc: linux-pci, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, stable, Linnaea Lavia

Hi,

On 11/1/25 05:29, Manivannan Sadhasivam wrote:
> First of all, the driver was parsing the 'dbi' register region as 'elbi'.
> This was due to DT mistakenly passing 'dbi' as 'elbi'. Since the DT is
> now fixed to supply 'dbi' region, this driver can rely on the DWC core
> driver to parse and map it.
> 
> However, to support the old DTs, if the 'elbi' region is found in DT, parse
> and map the region as both 'dw_pcie::elbi_base' as 'dw_pcie::dbi_base'.
> This will allow the driver to work with both broken and fixed DTs.
> 
> Also, skip parsing the 'elbi' region in DWC core if 'pci->elbi_base' was
> already populated.
> 
> Cc: <stable@vger.kernel.org> # 6.2
> Reported-by: Linnaea Lavia <linnaea-von-lavia@live.com>
> Closes: https://lore.kernel.org/linux-pci/DM4PR05MB102707B8CDF84D776C39F22F2C7F0A@DM4PR05MB10270.namprd05.prod.outlook.com/
> Fixes: 9c0ef6d34fdb ("PCI: amlogic: Add the Amlogic Meson PCIe controller driver")
> Fixes: c96992a24bec ("PCI: dwc: Add support for ELBI resource mapping")
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> ---
>   drivers/pci/controller/dwc/pci-meson.c       | 18 +++++++++++++++---
>   drivers/pci/controller/dwc/pcie-designware.c | 12 +++++++-----
>   2 files changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c
> index 787469d1b396d4c7b3e28edfe276b7b997fb8aee..54b6a4196f1767a3c14c6c901bfee3505588134c 100644
> --- a/drivers/pci/controller/dwc/pci-meson.c
> +++ b/drivers/pci/controller/dwc/pci-meson.c
> @@ -108,10 +108,22 @@ static int meson_pcie_get_mems(struct platform_device *pdev,
>   			       struct meson_pcie *mp)
>   {
>   	struct dw_pcie *pci = &mp->pci;
> +	struct resource *res;
>   
> -	pci->dbi_base = devm_platform_ioremap_resource_byname(pdev, "elbi");
> -	if (IS_ERR(pci->dbi_base))
> -		return PTR_ERR(pci->dbi_base);
> +	/*
> +	 * For the broken DTs that supply 'dbi' as 'elbi', parse the 'elbi'
> +	 * region and assign it to both 'pci->elbi_base' and 'pci->dbi_space' so
> +	 * that the DWC core can skip parsing both regions.
> +	 */
> +	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
> +	if (res) {
> +		pci->elbi_base = devm_pci_remap_cfg_resource(pci->dev, res);
> +		if (IS_ERR(pci->elbi_base))
> +			return PTR_ERR(pci->elbi_base);
> +
> +		pci->dbi_base = pci->elbi_base;
> +		pci->dbi_phys_addr = res->start;
> +	}
>   
>   	mp->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
>   	if (IS_ERR(mp->cfg_base))
> diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
> index c644216995f69cbf065e61a0392bf1e5e32cf56e..06eca858eb1b3c7a8a833df6616febcdbe854850 100644
> --- a/drivers/pci/controller/dwc/pcie-designware.c
> +++ b/drivers/pci/controller/dwc/pcie-designware.c
> @@ -168,11 +168,13 @@ int dw_pcie_get_resources(struct dw_pcie *pci)
>   	}
>   
>   	/* ELBI is an optional resource */
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
> -	if (res) {
> -		pci->elbi_base = devm_ioremap_resource(pci->dev, res);
> -		if (IS_ERR(pci->elbi_base))
> -			return PTR_ERR(pci->elbi_base);
> +	if (!pci->elbi_base) {
> +		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
> +		if (res) {
> +			pci->elbi_base = devm_ioremap_resource(pci->dev, res);
> +			if (IS_ERR(pci->elbi_base))
> +				return PTR_ERR(pci->elbi_base);
> +		}
>   	}
>   
>   	/* LLDD is supposed to manually switch the clocks and resets state */
> 

Tested with "old" and "new" DT worked fine with both:

Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on Bananapi-M2S

Thanks,
Neil

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH RESEND 1/3] dt-bindings: PCI: amlogic: Fix the register name of the DBI region
  2025-11-06  9:06         ` Manivannan Sadhasivam
@ 2025-11-08 10:40           ` Manivannan Sadhasivam
  2025-11-10  6:40             ` Neil Armstrong
  0 siblings, 1 reply; 17+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-08 10:40 UTC (permalink / raw)
  To: Neil Armstrong, Krzysztof Kozlowski
  Cc: Manivannan Sadhasivam, Bjorn Helgaas, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Hanjie Lin, Yue Wang, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Andrew Murray, Jingoo Han,
	Krishna Chaitanya Chundru, linux-pci, devicetree, linux-kernel,
	linux-arm-kernel, linux-amlogic

On Thu, Nov 06, 2025 at 02:37:17PM +0530, Manivannan Sadhasivam wrote:
> On Thu, Nov 06, 2025 at 09:30:15AM +0100, Krzysztof Kozlowski wrote:
> > On Mon, Nov 03, 2025 at 03:42:58PM +0530, Manivannan Sadhasivam wrote:
> > > On Mon, Nov 03, 2025 at 10:47:36AM +0100, Neil Armstrong wrote:
> > > > Hi Mani,
> > > > 
> > > > On 11/1/25 05:29, Manivannan Sadhasivam wrote:
> > > > > Binding incorrectly specifies the 'DBI' region as 'ELBI'. DBI is a must
> > > > > have region for DWC controllers as it has the Root Port and controller
> > > > > specific registers, while ELBI has optional registers.
> > > > > 
> > > > > Hence, fix the binding. Though this is an ABI break, this change is needed
> > > > > to accurately describe the PCI memory map.
> > > > 
> > > > Not fan of this ABI break, the current bindings should be marked as deprecated instead.
> > > > 
> > > 
> > > Fair enough. Will make it as deprecated.
> > 
> > The true question is what value was being passed as that item (ELBI)?
> > Because if this was always DBI - device has DBI there - then what
> > deprecation would change?
> 
> Nothing, except not breaking old DTs with the binding check. That's why I
> decided to remove it in the first place.
> 

Neil, do you still insist on marking the 'elbi' region deprecated than removing
it?

- Mani

-- 
மணிவண்ணன் சதாசிவம்

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH RESEND 1/3] dt-bindings: PCI: amlogic: Fix the register name of the DBI region
  2025-11-08 10:40           ` Manivannan Sadhasivam
@ 2025-11-10  6:40             ` Neil Armstrong
  0 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2025-11-10  6:40 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Krzysztof Kozlowski
  Cc: Manivannan Sadhasivam, Bjorn Helgaas, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Hanjie Lin, Yue Wang, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Andrew Murray, Jingoo Han,
	Krishna Chaitanya Chundru, linux-pci, devicetree, linux-kernel,
	linux-arm-kernel, linux-amlogic

On 11/8/25 11:40, Manivannan Sadhasivam wrote:
> On Thu, Nov 06, 2025 at 02:37:17PM +0530, Manivannan Sadhasivam wrote:
>> On Thu, Nov 06, 2025 at 09:30:15AM +0100, Krzysztof Kozlowski wrote:
>>> On Mon, Nov 03, 2025 at 03:42:58PM +0530, Manivannan Sadhasivam wrote:
>>>> On Mon, Nov 03, 2025 at 10:47:36AM +0100, Neil Armstrong wrote:
>>>>> Hi Mani,
>>>>>
>>>>> On 11/1/25 05:29, Manivannan Sadhasivam wrote:
>>>>>> Binding incorrectly specifies the 'DBI' region as 'ELBI'. DBI is a must
>>>>>> have region for DWC controllers as it has the Root Port and controller
>>>>>> specific registers, while ELBI has optional registers.
>>>>>>
>>>>>> Hence, fix the binding. Though this is an ABI break, this change is needed
>>>>>> to accurately describe the PCI memory map.
>>>>>
>>>>> Not fan of this ABI break, the current bindings should be marked as deprecated instead.
>>>>>
>>>>
>>>> Fair enough. Will make it as deprecated.
>>>
>>> The true question is what value was being passed as that item (ELBI)?
>>> Because if this was always DBI - device has DBI there - then what
>>> deprecation would change?
>>
>> Nothing, except not breaking old DTs with the binding check. That's why I
>> decided to remove it in the first place.
>>
> 
> Neil, do you still insist on marking the 'elbi' region deprecated than removing
> it?

Not really. if the original definition was wrong, let's fix it.

Neil

> 
> - Mani
> 


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: (subset) [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region
  2025-11-01  4:29 [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region Manivannan Sadhasivam
                   ` (3 preceding siblings ...)
  2025-11-03  9:50 ` [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region Neil Armstrong
@ 2025-11-10  6:56 ` Manivannan Sadhasivam
  2025-11-10  8:18 ` Neil Armstrong
  5 siblings, 0 replies; 17+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-10  6:56 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
	Hanjie Lin, Yue Wang, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Andrew Murray, Jingoo Han,
	Krishna Chaitanya Chundru, Manivannan Sadhasivam
  Cc: linux-pci, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, stable+noautosel, stable, Linnaea Lavia


On Sat, 01 Nov 2025 09:59:39 +0530, Manivannan Sadhasivam wrote:
> This compile tested only series aims to fix the DBI parsing issue repored in
> [1]. The issue stems from the fact that the DT and binding described 'dbi'
> region as 'elbi' from the start.
> 
> Now, both binding and DTs are fixed and the driver is reworked to work with both
> old and new DTs.
> 
> [...]

Applied, thanks!

[1/3] dt-bindings: PCI: amlogic: Fix the register name of the DBI region
      commit: 4813dea9e272ba0a57c50b8d51d440dd8e3ccdd7
[3/3] PCI: meson: Fix parsing the DBI register region
      commit: eff0306b109f2d611e44f0155b0324f6cfec3ef4

Best regards,
-- 
Manivannan Sadhasivam <mani@kernel.org>


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: (subset) [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region
  2025-11-01  4:29 [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region Manivannan Sadhasivam
                   ` (4 preceding siblings ...)
  2025-11-10  6:56 ` (subset) " Manivannan Sadhasivam
@ 2025-11-10  8:18 ` Neil Armstrong
  5 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2025-11-10  8:18 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Hanjie Lin, Yue Wang, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Andrew Murray, Jingoo Han,
	Krishna Chaitanya Chundru, Manivannan Sadhasivam
  Cc: linux-pci, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, stable+noautosel, stable, Linnaea Lavia

Hi,

On Sat, 01 Nov 2025 09:59:39 +0530, Manivannan Sadhasivam wrote:
> This compile tested only series aims to fix the DBI parsing issue repored in
> [1]. The issue stems from the fact that the DT and binding described 'dbi'
> region as 'elbi' from the start.
> 
> Now, both binding and DTs are fixed and the driver is reworked to work with both
> old and new DTs.
> 
> [...]

Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (v6.19/arm64-dt)

[2/3] arm64: dts: amlogic: Fix the register name of the 'DBI' region
      https://git.kernel.org/amlogic/c/8b983ae355aab50942c72096beba30254c5078bd

These changes has been applied on the intermediate git tree [1].

The v6.19/arm64-dt branch will then be sent via a formal Pull Request to the Linux SoC maintainers
for inclusion in their intermediate git branches in order to be sent to Linus during
the next merge window, or sooner if it's a set of fixes.

In the cases of fixes, those will be merged in the current release candidate
kernel and as soon they appear on the Linux master branch they will be
backported to the previous Stable and Long-Stable kernels [2].

The intermediate git branches are merged daily in the linux-next tree [3],
people are encouraged testing these pre-release kernels and report issues on the
relevant mailing-lists.

If problems are discovered on those changes, please submit a signed-off-by revert
patch followed by a corrective changeset.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
[3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

-- 
Neil


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

end of thread, other threads:[~2025-11-10  8:19 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-01  4:29 [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region Manivannan Sadhasivam
2025-11-01  4:29 ` [PATCH RESEND 1/3] dt-bindings: PCI: amlogic: Fix the register name of the " Manivannan Sadhasivam
2025-11-03  9:47   ` Neil Armstrong
2025-11-03 10:12     ` Manivannan Sadhasivam
2025-11-06  8:30       ` Krzysztof Kozlowski
2025-11-06  9:06         ` Manivannan Sadhasivam
2025-11-08 10:40           ` Manivannan Sadhasivam
2025-11-10  6:40             ` Neil Armstrong
2025-11-01  4:29 ` [PATCH RESEND 2/3] arm64: dts: amlogic: Fix the register name of the 'DBI' region Manivannan Sadhasivam
2025-11-03  9:47   ` Neil Armstrong
2025-11-01  4:29 ` [PATCH RESEND 3/3] PCI: meson: Fix parsing the DBI register region Manivannan Sadhasivam
2025-11-03  9:49   ` Neil Armstrong
2025-11-06 10:00   ` Neil Armstrong
2025-11-03  9:50 ` [PATCH RESEND 0/3] PCI: meson: Fix the parsing of DBI region Neil Armstrong
2025-11-03 10:14   ` Manivannan Sadhasivam
2025-11-10  6:56 ` (subset) " Manivannan Sadhasivam
2025-11-10  8:18 ` Neil Armstrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox