linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] pci: clean up cpu_addr_fixup() for visconti
@ 2025-09-08  2:34 Nobuhiro Iwamatsu
  2025-09-08  2:34 ` [PATCH v3 1/2] arm64: dts: toshiba: Update SoC and PCIe ranges to reflect hardware behavior Nobuhiro Iwamatsu
  2025-09-08  2:34 ` [PATCH v3 2/2] PCI: dwc: visconti: Remove cpu_addr_fix() after DTS fix ranges Nobuhiro Iwamatsu
  0 siblings, 2 replies; 9+ messages in thread
From: Nobuhiro Iwamatsu @ 2025-09-08  2:34 UTC (permalink / raw)
  To: Frank.Li, robh, krzk+dt, conor+dt, lpieralisi, kwilczynski, mani,
	bhelgaas
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pci,
	yuji2.ishikawa, Nobuhiro Iwamatsu

Since 7db02f725df44 PCI: dwc: Use devicetree 'reg[config]' to derive CPU -> ATU addr offset

dwc common code have handled address translate by bus fabric.

1. Correct dts
2. remove cpu_addr_fixup()

dts change need be merge firstly.

Changes from v2:
  Move update in drivers/pci/controller/dwc/pcie-visconti.c to patch 2.
  Update Signed-off-by address, because my company email address has changed. 

Changes from v1:
  Update commit message.
  Fix range.
  Set true to use_parent_dt_ranges.
  move pcie under the dedicated sub-bus.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>

Frank Li (2):
  arm64: dts: toshiba: Update SoC and PCIe ranges to reflect hardware behavior
  PCI: dwc: visconti: Remove cpu_addr_fix() after DTS fix ranges

 arch/arm64/boot/dts/toshiba/tmpv7708.dtsi  | 75 +++++++++++++---------
 drivers/pci/controller/dwc/pcie-visconti.c | 15 +----
 2 files changed, 47 insertions(+), 43 deletions(-)

-- 
2.51.0




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

* [PATCH v3 1/2] arm64: dts: toshiba: Update SoC and PCIe ranges to reflect hardware behavior
  2025-09-08  2:34 [PATCH v3 0/2] pci: clean up cpu_addr_fixup() for visconti Nobuhiro Iwamatsu
@ 2025-09-08  2:34 ` Nobuhiro Iwamatsu
  2025-10-19  5:45   ` Manivannan Sadhasivam
  2025-09-08  2:34 ` [PATCH v3 2/2] PCI: dwc: visconti: Remove cpu_addr_fix() after DTS fix ranges Nobuhiro Iwamatsu
  1 sibling, 1 reply; 9+ messages in thread
From: Nobuhiro Iwamatsu @ 2025-09-08  2:34 UTC (permalink / raw)
  To: Frank.Li, robh, krzk+dt, conor+dt, lpieralisi, kwilczynski, mani,
	bhelgaas
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pci,
	yuji2.ishikawa, Nobuhiro Iwamatsu

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

tmpv7708 trim address bit[31:30] in tmpv7708 before passing to the PCIe
controller. Since only PCIe controller needs to convert the address range
0x40000000 - 0x80000000, add a bus definition, describe the ranges in it,
and move the PCIe definition.

Prepare for the removal of the driver’s cpu_addr_fixup().

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Suggested-by: Yuji Ishikawa <yuji2.ishikawa@toshiba.co.jp>
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>

---
v3:
 Move update in drivers/pci/controller/dwc/pcie-visconti.c to patch 2.
 Update Signed-off-by address, because my company email address has changed.

v2:
  Update commit message.
  Fix range.
  Set true to use_parent_dt_ranges.
  move pcie under the dedicated sub-bus.
---
 arch/arm64/boot/dts/toshiba/tmpv7708.dtsi | 75 ++++++++++++++---------
 1 file changed, 45 insertions(+), 30 deletions(-)

diff --git a/arch/arm64/boot/dts/toshiba/tmpv7708.dtsi b/arch/arm64/boot/dts/toshiba/tmpv7708.dtsi
index 39806f0ae5133..b754965a76ca6 100644
--- a/arch/arm64/boot/dts/toshiba/tmpv7708.dtsi
+++ b/arch/arm64/boot/dts/toshiba/tmpv7708.dtsi
@@ -478,37 +478,52 @@ pwm: pwm@241c0000 {
 			status = "disabled";
 		};
 
-		pcie: pcie@28400000 {
-			compatible = "toshiba,visconti-pcie";
-			reg = <0x0 0x28400000 0x0 0x00400000>,
-			      <0x0 0x70000000 0x0 0x10000000>,
-			      <0x0 0x28050000 0x0 0x00010000>,
-			      <0x0 0x24200000 0x0 0x00002000>,
-			      <0x0 0x24162000 0x0 0x00001000>;
-			reg-names = "dbi", "config", "ulreg", "smu", "mpu";
-			device_type = "pci";
-			bus-range = <0x00 0xff>;
-			num-lanes = <2>;
-			num-viewport = <8>;
-
-			#address-cells = <3>;
+		pcie_bus: bus@24000000 {
+			compatible = "simple-bus";
+			#address-cells = <2>;
 			#size-cells = <2>;
-			#interrupt-cells = <1>;
-			ranges = <0x81000000 0 0x40000000 0 0x40000000 0 0x00010000
-				  0x82000000 0 0x50000000 0 0x50000000 0 0x20000000>;
-			interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_HIGH>,
-				     <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>;
-			interrupt-names = "msi", "intr";
-			interrupt-map-mask = <0 0 0 7>;
-			interrupt-map =
-				<0 0 0 1 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH
-				 0 0 0 2 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH
-				 0 0 0 3 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH
-				 0 0 0 4 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>;
-			max-link-speed = <2>;
-			clocks = <&extclk100mhz>, <&pismu TMPV770X_CLK_PCIE_MSTR>, <&pismu TMPV770X_CLK_PCIE_AUX>;
-			clock-names = "ref", "core", "aux";
-			status = "disabled";
+			ranges = /* register 1:1 map */
+				 <0x0 0x24000000 0x0 0x24000000 0x0 0x0C000000>,
+				 /*
+				  * bus fabric mask address bit 30 and 31 to 0
+				  * before send to PCIe controller.
+				  *
+				  * PCIe map address 0 to cpu's 0x40000000
+				  */
+				 <0x0 0x00000000 0x0 0x40000000 0x0 0x40000000>;
+
+			pcie: pcie@28400000 {
+				compatible = "toshiba,visconti-pcie";
+				reg = <0x0 0x28400000 0x0 0x00400000>,
+				      <0x0 0x30000000 0x0 0x10000000>,
+				      <0x0 0x28050000 0x0 0x00010000>,
+				      <0x0 0x24200000 0x0 0x00002000>,
+				      <0x0 0x24162000 0x0 0x00001000>;
+				reg-names = "dbi", "config", "ulreg", "smu", "mpu";
+				device_type = "pci";
+				bus-range = <0x00 0xff>;
+				num-lanes = <2>;
+				num-viewport = <8>;
+
+				#address-cells = <3>;
+				#size-cells = <2>;
+				#interrupt-cells = <1>;
+				ranges = <0x81000000 0 0x00000000 0 0x00000000 0 0x00010000
+					  0x82000000 0 0x10000000 0 0x10000000 0 0x20000000>;
+				interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-names = "msi", "intr";
+				interrupt-map-mask = <0 0 0 7>;
+				interrupt-map =
+					<0 0 0 1 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH
+					 0 0 0 2 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH
+					 0 0 0 3 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH
+					 0 0 0 4 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>;
+				max-link-speed = <2>;
+				clocks = <&extclk100mhz>, <&pismu TMPV770X_CLK_PCIE_MSTR>, <&pismu TMPV770X_CLK_PCIE_AUX>;
+				clock-names = "ref", "core", "aux";
+				status = "disabled";
+			};
 		};
 	};
 };
-- 
2.51.0




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

* [PATCH v3 2/2] PCI: dwc: visconti: Remove cpu_addr_fix() after DTS fix ranges
  2025-09-08  2:34 [PATCH v3 0/2] pci: clean up cpu_addr_fixup() for visconti Nobuhiro Iwamatsu
  2025-09-08  2:34 ` [PATCH v3 1/2] arm64: dts: toshiba: Update SoC and PCIe ranges to reflect hardware behavior Nobuhiro Iwamatsu
@ 2025-09-08  2:34 ` Nobuhiro Iwamatsu
  2025-09-08 12:38   ` Manivannan Sadhasivam
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Nobuhiro Iwamatsu @ 2025-09-08  2:34 UTC (permalink / raw)
  To: Frank.Li, robh, krzk+dt, conor+dt, lpieralisi, kwilczynski, mani,
	bhelgaas
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pci,
	yuji2.ishikawa, Nobuhiro Iwamatsu

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

Remove cpu_addr_fix() since it is no longer needed. The PCIe ranges
property has been corrected in the DTS, and the DesignWare common code now
handles address translation properly without requiring this workaround.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>

---
v3:
  Add pci->use_parent_dt_ranges fixes.
  Update Signed-off-by address, because my company email address haschanged.

v2:
  No Update.
---
 drivers/pci/controller/dwc/pcie-visconti.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-visconti.c b/drivers/pci/controller/dwc/pcie-visconti.c
index cdeac6177143c..d8765e57147af 100644
--- a/drivers/pci/controller/dwc/pcie-visconti.c
+++ b/drivers/pci/controller/dwc/pcie-visconti.c
@@ -171,20 +171,7 @@ static void visconti_pcie_stop_link(struct dw_pcie *pci)
 	visconti_mpu_writel(pcie, val | MPU_MP_EN_DISABLE, PCIE_MPU_REG_MP_EN);
 }
 
-/*
- * In this SoC specification, the CPU bus outputs the offset value from
- * 0x40000000 to the PCIe bus, so 0x40000000 is subtracted from the CPU
- * bus address. This 0x40000000 is also based on io_base from DT.
- */
-static u64 visconti_pcie_cpu_addr_fixup(struct dw_pcie *pci, u64 cpu_addr)
-{
-	struct dw_pcie_rp *pp = &pci->pp;
-
-	return cpu_addr & ~pp->io_base;
-}
-
 static const struct dw_pcie_ops dw_pcie_ops = {
-	.cpu_addr_fixup = visconti_pcie_cpu_addr_fixup,
 	.link_up = visconti_pcie_link_up,
 	.start_link = visconti_pcie_start_link,
 	.stop_link = visconti_pcie_stop_link,
@@ -310,6 +297,8 @@ static int visconti_pcie_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, pcie);
 
+	pci->use_parent_dt_ranges = true;
+
 	return visconti_add_pcie_port(pcie, pdev);
 }
 
-- 
2.51.0




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

* Re: [PATCH v3 2/2] PCI: dwc: visconti: Remove cpu_addr_fix() after DTS fix ranges
  2025-09-08  2:34 ` [PATCH v3 2/2] PCI: dwc: visconti: Remove cpu_addr_fix() after DTS fix ranges Nobuhiro Iwamatsu
@ 2025-09-08 12:38   ` Manivannan Sadhasivam
  2025-09-08 21:55   ` Bjorn Helgaas
  2025-10-19  5:47   ` Manivannan Sadhasivam
  2 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2025-09-08 12:38 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu
  Cc: Frank.Li, robh, krzk+dt, conor+dt, lpieralisi, kwilczynski,
	bhelgaas, linux-arm-kernel, devicetree, linux-kernel, linux-pci,
	yuji2.ishikawa

On Mon, Sep 08, 2025 at 11:34:08AM GMT, Nobuhiro Iwamatsu wrote:
> From: Frank Li <Frank.Li@nxp.com>
> 
> Remove cpu_addr_fix() since it is no longer needed. The PCIe ranges
> property has been corrected in the DTS, and the DesignWare common code now
> handles address translation properly without requiring this workaround.
> 

What about the old DTs? Wouldn't this driver fail to work if you use it with old
DTs as cpu_addr_fixup() no longer exists?

- Mani

> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>
> 
> ---
> v3:
>   Add pci->use_parent_dt_ranges fixes.
>   Update Signed-off-by address, because my company email address haschanged.
> 
> v2:
>   No Update.
> ---
>  drivers/pci/controller/dwc/pcie-visconti.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-visconti.c b/drivers/pci/controller/dwc/pcie-visconti.c
> index cdeac6177143c..d8765e57147af 100644
> --- a/drivers/pci/controller/dwc/pcie-visconti.c
> +++ b/drivers/pci/controller/dwc/pcie-visconti.c
> @@ -171,20 +171,7 @@ static void visconti_pcie_stop_link(struct dw_pcie *pci)
>  	visconti_mpu_writel(pcie, val | MPU_MP_EN_DISABLE, PCIE_MPU_REG_MP_EN);
>  }
>  
> -/*
> - * In this SoC specification, the CPU bus outputs the offset value from
> - * 0x40000000 to the PCIe bus, so 0x40000000 is subtracted from the CPU
> - * bus address. This 0x40000000 is also based on io_base from DT.
> - */
> -static u64 visconti_pcie_cpu_addr_fixup(struct dw_pcie *pci, u64 cpu_addr)
> -{
> -	struct dw_pcie_rp *pp = &pci->pp;
> -
> -	return cpu_addr & ~pp->io_base;
> -}
> -
>  static const struct dw_pcie_ops dw_pcie_ops = {
> -	.cpu_addr_fixup = visconti_pcie_cpu_addr_fixup,
>  	.link_up = visconti_pcie_link_up,
>  	.start_link = visconti_pcie_start_link,
>  	.stop_link = visconti_pcie_stop_link,
> @@ -310,6 +297,8 @@ static int visconti_pcie_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, pcie);
>  
> +	pci->use_parent_dt_ranges = true;
> +
>  	return visconti_add_pcie_port(pcie, pdev);
>  }
>  
> -- 
> 2.51.0
> 
> 

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


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

* Re: [PATCH v3 2/2] PCI: dwc: visconti: Remove cpu_addr_fix() after DTS fix ranges
  2025-09-08  2:34 ` [PATCH v3 2/2] PCI: dwc: visconti: Remove cpu_addr_fix() after DTS fix ranges Nobuhiro Iwamatsu
  2025-09-08 12:38   ` Manivannan Sadhasivam
@ 2025-09-08 21:55   ` Bjorn Helgaas
  2025-09-10 16:10     ` Frank Li
  2025-10-19  5:47   ` Manivannan Sadhasivam
  2 siblings, 1 reply; 9+ messages in thread
From: Bjorn Helgaas @ 2025-09-08 21:55 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu
  Cc: Frank.Li, robh, krzk+dt, conor+dt, lpieralisi, kwilczynski, mani,
	bhelgaas, linux-arm-kernel, devicetree, linux-kernel, linux-pci,
	yuji2.ishikawa

In subject, s/PCI: dwc: visconti:/PCI: visconti:/ to match previous
history.

On Mon, Sep 08, 2025 at 11:34:08AM +0900, Nobuhiro Iwamatsu wrote:
> From: Frank Li <Frank.Li@nxp.com>
> 
> Remove cpu_addr_fix() since it is no longer needed. The PCIe ranges
> property has been corrected in the DTS, and the DesignWare common code now
> handles address translation properly without requiring this workaround.

As Mani pointed out, the driver has to continue working correctly with
any old DTs in the field.

> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>
> 
> ---
> v3:
>   Add pci->use_parent_dt_ranges fixes.
>   Update Signed-off-by address, because my company email address haschanged.
> 
> v2:
>   No Update.
> ---
>  drivers/pci/controller/dwc/pcie-visconti.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-visconti.c b/drivers/pci/controller/dwc/pcie-visconti.c
> index cdeac6177143c..d8765e57147af 100644
> --- a/drivers/pci/controller/dwc/pcie-visconti.c
> +++ b/drivers/pci/controller/dwc/pcie-visconti.c
> @@ -171,20 +171,7 @@ static void visconti_pcie_stop_link(struct dw_pcie *pci)
>  	visconti_mpu_writel(pcie, val | MPU_MP_EN_DISABLE, PCIE_MPU_REG_MP_EN);
>  }
>  
> -/*
> - * In this SoC specification, the CPU bus outputs the offset value from
> - * 0x40000000 to the PCIe bus, so 0x40000000 is subtracted from the CPU
> - * bus address. This 0x40000000 is also based on io_base from DT.
> - */
> -static u64 visconti_pcie_cpu_addr_fixup(struct dw_pcie *pci, u64 cpu_addr)
> -{
> -	struct dw_pcie_rp *pp = &pci->pp;
> -
> -	return cpu_addr & ~pp->io_base;
> -}
> -
>  static const struct dw_pcie_ops dw_pcie_ops = {
> -	.cpu_addr_fixup = visconti_pcie_cpu_addr_fixup,
>  	.link_up = visconti_pcie_link_up,
>  	.start_link = visconti_pcie_start_link,
>  	.stop_link = visconti_pcie_stop_link,
> @@ -310,6 +297,8 @@ static int visconti_pcie_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, pcie);
>  
> +	pci->use_parent_dt_ranges = true;
> +
>  	return visconti_add_pcie_port(pcie, pdev);
>  }
>  
> -- 
> 2.51.0
> 
> 


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

* Re: [PATCH v3 2/2] PCI: dwc: visconti: Remove cpu_addr_fix() after DTS fix ranges
  2025-09-08 21:55   ` Bjorn Helgaas
@ 2025-09-10 16:10     ` Frank Li
  2025-09-11 17:56       ` Manivannan Sadhasivam
  0 siblings, 1 reply; 9+ messages in thread
From: Frank Li @ 2025-09-10 16:10 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Nobuhiro Iwamatsu, robh, krzk+dt, conor+dt, lpieralisi,
	kwilczynski, mani, bhelgaas, linux-arm-kernel, devicetree,
	linux-kernel, linux-pci, yuji2.ishikawa

On Mon, Sep 08, 2025 at 04:55:10PM -0500, Bjorn Helgaas wrote:
> In subject, s/PCI: dwc: visconti:/PCI: visconti:/ to match previous
> history.
>
> On Mon, Sep 08, 2025 at 11:34:08AM +0900, Nobuhiro Iwamatsu wrote:
> > From: Frank Li <Frank.Li@nxp.com>
> >
> > Remove cpu_addr_fix() since it is no longer needed. The PCIe ranges
> > property has been corrected in the DTS, and the DesignWare common code now
> > handles address translation properly without requiring this workaround.
>
> As Mani pointed out, the driver has to continue working correctly with
> any old DTs in the field.

DTS should be merged first, then after some linux release cycle, then PCI
can merge this change.

The similar case happen at other area, which broken back compatible. But
we still need move forward.

Frank

>
> > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>
> >
> > ---
> > v3:
> >   Add pci->use_parent_dt_ranges fixes.
> >   Update Signed-off-by address, because my company email address haschanged.
> >
> > v2:
> >   No Update.
> > ---
> >  drivers/pci/controller/dwc/pcie-visconti.c | 15 ++-------------
> >  1 file changed, 2 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/pci/controller/dwc/pcie-visconti.c b/drivers/pci/controller/dwc/pcie-visconti.c
> > index cdeac6177143c..d8765e57147af 100644
> > --- a/drivers/pci/controller/dwc/pcie-visconti.c
> > +++ b/drivers/pci/controller/dwc/pcie-visconti.c
> > @@ -171,20 +171,7 @@ static void visconti_pcie_stop_link(struct dw_pcie *pci)
> >  	visconti_mpu_writel(pcie, val | MPU_MP_EN_DISABLE, PCIE_MPU_REG_MP_EN);
> >  }
> >
> > -/*
> > - * In this SoC specification, the CPU bus outputs the offset value from
> > - * 0x40000000 to the PCIe bus, so 0x40000000 is subtracted from the CPU
> > - * bus address. This 0x40000000 is also based on io_base from DT.
> > - */
> > -static u64 visconti_pcie_cpu_addr_fixup(struct dw_pcie *pci, u64 cpu_addr)
> > -{
> > -	struct dw_pcie_rp *pp = &pci->pp;
> > -
> > -	return cpu_addr & ~pp->io_base;
> > -}
> > -
> >  static const struct dw_pcie_ops dw_pcie_ops = {
> > -	.cpu_addr_fixup = visconti_pcie_cpu_addr_fixup,
> >  	.link_up = visconti_pcie_link_up,
> >  	.start_link = visconti_pcie_start_link,
> >  	.stop_link = visconti_pcie_stop_link,
> > @@ -310,6 +297,8 @@ static int visconti_pcie_probe(struct platform_device *pdev)
> >
> >  	platform_set_drvdata(pdev, pcie);
> >
> > +	pci->use_parent_dt_ranges = true;
> > +
> >  	return visconti_add_pcie_port(pcie, pdev);
> >  }
> >
> > --
> > 2.51.0
> >
> >


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

* Re: [PATCH v3 2/2] PCI: dwc: visconti: Remove cpu_addr_fix() after DTS fix ranges
  2025-09-10 16:10     ` Frank Li
@ 2025-09-11 17:56       ` Manivannan Sadhasivam
  0 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2025-09-11 17:56 UTC (permalink / raw)
  To: Frank Li
  Cc: Bjorn Helgaas, Nobuhiro Iwamatsu, robh, krzk+dt, conor+dt,
	lpieralisi, kwilczynski, bhelgaas, linux-arm-kernel, devicetree,
	linux-kernel, linux-pci, yuji2.ishikawa

On Wed, Sep 10, 2025 at 12:10:10PM GMT, Frank Li wrote:
> On Mon, Sep 08, 2025 at 04:55:10PM -0500, Bjorn Helgaas wrote:
> > In subject, s/PCI: dwc: visconti:/PCI: visconti:/ to match previous
> > history.
> >
> > On Mon, Sep 08, 2025 at 11:34:08AM +0900, Nobuhiro Iwamatsu wrote:
> > > From: Frank Li <Frank.Li@nxp.com>
> > >
> > > Remove cpu_addr_fix() since it is no longer needed. The PCIe ranges
> > > property has been corrected in the DTS, and the DesignWare common code now
> > > handles address translation properly without requiring this workaround.
> >
> > As Mani pointed out, the driver has to continue working correctly with
> > any old DTs in the field.
> 
> DTS should be merged first, then after some linux release cycle, then PCI
> can merge this change.
> 
> The similar case happen at other area, which broken back compatible. But
> we still need move forward.
> 

Absolutely not! DT is a firmware. Even though the firmware turns out to be
buggy, we should not regress platforms that were using the old firmware.

We can surely remove the check after some time. Maybe when all the stable
kernels stop supporting older DTs. But not until then.

- Mani

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


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

* Re: [PATCH v3 1/2] arm64: dts: toshiba: Update SoC and PCIe ranges to reflect hardware behavior
  2025-09-08  2:34 ` [PATCH v3 1/2] arm64: dts: toshiba: Update SoC and PCIe ranges to reflect hardware behavior Nobuhiro Iwamatsu
@ 2025-10-19  5:45   ` Manivannan Sadhasivam
  0 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2025-10-19  5:45 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu
  Cc: Frank.Li, robh, krzk+dt, conor+dt, lpieralisi, kwilczynski,
	bhelgaas, linux-arm-kernel, devicetree, linux-kernel, linux-pci,
	yuji2.ishikawa

On Mon, Sep 08, 2025 at 11:34:07AM +0900, Nobuhiro Iwamatsu wrote:
> From: Frank Li <Frank.Li@nxp.com>
> 
> tmpv7708 trim address bit[31:30] in tmpv7708 before passing to the PCIe
> controller. Since only PCIe controller needs to convert the address range
> 0x40000000 - 0x80000000, add a bus definition, describe the ranges in it,
> and move the PCIe definition.
> 
> Prepare for the removal of the driver’s cpu_addr_fixup().
> 

This statement is the linux driver behavior which has nothing to do with
devicetree. Please drop it.

> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> Suggested-by: Yuji Ishikawa <yuji2.ishikawa@toshiba.co.jp>
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>

Acked-by: Manivannan Sadhasivam <mani@kernel.org>

- Mani

> 
> ---
> v3:
>  Move update in drivers/pci/controller/dwc/pcie-visconti.c to patch 2.
>  Update Signed-off-by address, because my company email address has changed.
> 
> v2:
>   Update commit message.
>   Fix range.
>   Set true to use_parent_dt_ranges.
>   move pcie under the dedicated sub-bus.
> ---
>  arch/arm64/boot/dts/toshiba/tmpv7708.dtsi | 75 ++++++++++++++---------
>  1 file changed, 45 insertions(+), 30 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/toshiba/tmpv7708.dtsi b/arch/arm64/boot/dts/toshiba/tmpv7708.dtsi
> index 39806f0ae5133..b754965a76ca6 100644
> --- a/arch/arm64/boot/dts/toshiba/tmpv7708.dtsi
> +++ b/arch/arm64/boot/dts/toshiba/tmpv7708.dtsi
> @@ -478,37 +478,52 @@ pwm: pwm@241c0000 {
>  			status = "disabled";
>  		};
>  
> -		pcie: pcie@28400000 {
> -			compatible = "toshiba,visconti-pcie";
> -			reg = <0x0 0x28400000 0x0 0x00400000>,
> -			      <0x0 0x70000000 0x0 0x10000000>,
> -			      <0x0 0x28050000 0x0 0x00010000>,
> -			      <0x0 0x24200000 0x0 0x00002000>,
> -			      <0x0 0x24162000 0x0 0x00001000>;
> -			reg-names = "dbi", "config", "ulreg", "smu", "mpu";
> -			device_type = "pci";
> -			bus-range = <0x00 0xff>;
> -			num-lanes = <2>;
> -			num-viewport = <8>;
> -
> -			#address-cells = <3>;
> +		pcie_bus: bus@24000000 {
> +			compatible = "simple-bus";
> +			#address-cells = <2>;
>  			#size-cells = <2>;
> -			#interrupt-cells = <1>;
> -			ranges = <0x81000000 0 0x40000000 0 0x40000000 0 0x00010000
> -				  0x82000000 0 0x50000000 0 0x50000000 0 0x20000000>;
> -			interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_HIGH>,
> -				     <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>;
> -			interrupt-names = "msi", "intr";
> -			interrupt-map-mask = <0 0 0 7>;
> -			interrupt-map =
> -				<0 0 0 1 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH
> -				 0 0 0 2 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH
> -				 0 0 0 3 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH
> -				 0 0 0 4 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>;
> -			max-link-speed = <2>;
> -			clocks = <&extclk100mhz>, <&pismu TMPV770X_CLK_PCIE_MSTR>, <&pismu TMPV770X_CLK_PCIE_AUX>;
> -			clock-names = "ref", "core", "aux";
> -			status = "disabled";
> +			ranges = /* register 1:1 map */
> +				 <0x0 0x24000000 0x0 0x24000000 0x0 0x0C000000>,
> +				 /*
> +				  * bus fabric mask address bit 30 and 31 to 0
> +				  * before send to PCIe controller.
> +				  *
> +				  * PCIe map address 0 to cpu's 0x40000000
> +				  */
> +				 <0x0 0x00000000 0x0 0x40000000 0x0 0x40000000>;
> +
> +			pcie: pcie@28400000 {
> +				compatible = "toshiba,visconti-pcie";
> +				reg = <0x0 0x28400000 0x0 0x00400000>,
> +				      <0x0 0x30000000 0x0 0x10000000>,
> +				      <0x0 0x28050000 0x0 0x00010000>,
> +				      <0x0 0x24200000 0x0 0x00002000>,
> +				      <0x0 0x24162000 0x0 0x00001000>;
> +				reg-names = "dbi", "config", "ulreg", "smu", "mpu";
> +				device_type = "pci";
> +				bus-range = <0x00 0xff>;
> +				num-lanes = <2>;
> +				num-viewport = <8>;
> +
> +				#address-cells = <3>;
> +				#size-cells = <2>;
> +				#interrupt-cells = <1>;
> +				ranges = <0x81000000 0 0x00000000 0 0x00000000 0 0x00010000
> +					  0x82000000 0 0x10000000 0 0x10000000 0 0x20000000>;
> +				interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_HIGH>,
> +					     <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>;
> +				interrupt-names = "msi", "intr";
> +				interrupt-map-mask = <0 0 0 7>;
> +				interrupt-map =
> +					<0 0 0 1 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH
> +					 0 0 0 2 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH
> +					 0 0 0 3 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH
> +					 0 0 0 4 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>;
> +				max-link-speed = <2>;
> +				clocks = <&extclk100mhz>, <&pismu TMPV770X_CLK_PCIE_MSTR>, <&pismu TMPV770X_CLK_PCIE_AUX>;
> +				clock-names = "ref", "core", "aux";
> +				status = "disabled";
> +			};
>  		};
>  	};
>  };
> -- 
> 2.51.0
> 
> 

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


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

* Re: [PATCH v3 2/2] PCI: dwc: visconti: Remove cpu_addr_fix() after DTS fix ranges
  2025-09-08  2:34 ` [PATCH v3 2/2] PCI: dwc: visconti: Remove cpu_addr_fix() after DTS fix ranges Nobuhiro Iwamatsu
  2025-09-08 12:38   ` Manivannan Sadhasivam
  2025-09-08 21:55   ` Bjorn Helgaas
@ 2025-10-19  5:47   ` Manivannan Sadhasivam
  2 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2025-10-19  5:47 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu
  Cc: Frank.Li, robh, krzk+dt, conor+dt, lpieralisi, kwilczynski,
	bhelgaas, linux-arm-kernel, devicetree, linux-kernel, linux-pci,
	yuji2.ishikawa

On Mon, Sep 08, 2025 at 11:34:08AM +0900, Nobuhiro Iwamatsu wrote:
> From: Frank Li <Frank.Li@nxp.com>
> 
> Remove cpu_addr_fix() since it is no longer needed. The PCIe ranges
> property has been corrected in the DTS, and the DesignWare common code now
> handles address translation properly without requiring this workaround.
> 
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>
> 
> ---
> v3:
>   Add pci->use_parent_dt_ranges fixes.
>   Update Signed-off-by address, because my company email address haschanged.
> 
> v2:
>   No Update.
> ---
>  drivers/pci/controller/dwc/pcie-visconti.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-visconti.c b/drivers/pci/controller/dwc/pcie-visconti.c
> index cdeac6177143c..d8765e57147af 100644
> --- a/drivers/pci/controller/dwc/pcie-visconti.c
> +++ b/drivers/pci/controller/dwc/pcie-visconti.c
> @@ -171,20 +171,7 @@ static void visconti_pcie_stop_link(struct dw_pcie *pci)
>  	visconti_mpu_writel(pcie, val | MPU_MP_EN_DISABLE, PCIE_MPU_REG_MP_EN);
>  }
>  
> -/*
> - * In this SoC specification, the CPU bus outputs the offset value from
> - * 0x40000000 to the PCIe bus, so 0x40000000 is subtracted from the CPU
> - * bus address. This 0x40000000 is also based on io_base from DT.
> - */
> -static u64 visconti_pcie_cpu_addr_fixup(struct dw_pcie *pci, u64 cpu_addr)
> -{
> -	struct dw_pcie_rp *pp = &pci->pp;
> -
> -	return cpu_addr & ~pp->io_base;
> -}
> -
>  static const struct dw_pcie_ops dw_pcie_ops = {
> -	.cpu_addr_fixup = visconti_pcie_cpu_addr_fixup,
>  	.link_up = visconti_pcie_link_up,
>  	.start_link = visconti_pcie_start_link,
>  	.stop_link = visconti_pcie_stop_link,
> @@ -310,6 +297,8 @@ static int visconti_pcie_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, pcie);
>  
> +	pci->use_parent_dt_ranges = true;
> +

I hope you'll respin this series by keeping just the above flag and dropping the
cpu_addr_fixup removal.

- Mani

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


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

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

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-08  2:34 [PATCH v3 0/2] pci: clean up cpu_addr_fixup() for visconti Nobuhiro Iwamatsu
2025-09-08  2:34 ` [PATCH v3 1/2] arm64: dts: toshiba: Update SoC and PCIe ranges to reflect hardware behavior Nobuhiro Iwamatsu
2025-10-19  5:45   ` Manivannan Sadhasivam
2025-09-08  2:34 ` [PATCH v3 2/2] PCI: dwc: visconti: Remove cpu_addr_fix() after DTS fix ranges Nobuhiro Iwamatsu
2025-09-08 12:38   ` Manivannan Sadhasivam
2025-09-08 21:55   ` Bjorn Helgaas
2025-09-10 16:10     ` Frank Li
2025-09-11 17:56       ` Manivannan Sadhasivam
2025-10-19  5:47   ` Manivannan Sadhasivam

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).