linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] arm64: dts: rockchip: rk356x: Fix PCIe register and range mappings
@ 2022-11-12 11:41 Andrew Powers-Holmes
  2022-11-12 11:41 ` [PATCH 1/1] " Andrew Powers-Holmes
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Powers-Holmes @ 2022-11-12 11:41 UTC (permalink / raw)
  To: linux-rockchip
  Cc: Ondřej Jirman, Rob Herring, Krzysztof Kozlowski,
	Heiko Stuebner, Peter Geis, Frank Wunderlich, Michael Riesch,
	Yifeng Zhao, Sascha Hauer, Nicolas Frattaroli, Chris Morgan,
	Ezequiel Garcia, Robin Murphy, Mark Kettenis, devicetree,
	linux-arm-kernel, linux-kernel

The Rockchip RK356x SoCs currently have incorrect, or at least sub-optimal,`reg`
and `ranges` values in their DTS files' PCIe nodes. Ondřej Jirman sent a patch
in [1] to resolve this, but it was not merged due to some issues discovered
during testing (it fixed his issues with devices behind a switch, but broke
directly connected NVMe drives, amongst others - see [2]).

This patch is a reworked of that patch, using the same mappings the Rockchip BSP
kernel uses. Peter sent these up during the discussion in [3] and they've been
tested on his boards as well as Ondřej's, mine, and those of a few others.

Ondřej also sent a patch in [4] with these fixed ranges, but without the fix
for RK3568 as he was not able to test on that SoC. I've included the fixes for
both SoCs as he's happy with that and the patch has not yet been merged.

I have tested these ranges against devices which only map 32-bit ranges, devices
which only map 64-bit, and devices which require both. An Intel i350-T4 NIC does
not enumerate at all with the existing or previous patch's addresses, but works
quite happily with these, as do NVMe drives and every other device I've been
able to test.

MSI/MSI-X has also been tested as working, but does not currently work upstream
due to a workaround needed in the GIC driver which Rockchip are still yet to
issue an erratum for.

Thanks,
Andrew

[1] https://lore.kernel.org/linux-rockchip/20221005085439.740992-1-megi@xff.cz/
[2] https://lore.kernel.org/linux-rockchip/CAMdYzYq3S2rR3Kb61irpV9xHYijNiJY0mkVnJwPrpXzxg_Zh9g@mail.gmail.com/
[3] https://lore.kernel.org/linux-rockchip/CAMdYzYp6ShLqKxdiAjaRFiRF5i+wzfKiQvwPMzyQLAutWZbApg@mail.gmail.com/
[4] https://lore.kernel.org/all/20221107130157.1425882-1-megi@xff.cz/

Andrew Powers-Holmes (1):
  arm64: dts: rockchip: rk356x: Fix PCIe register and range mappings

 arch/arm64/boot/dts/rockchip/rk3568.dtsi | 14 ++++++++------
 arch/arm64/boot/dts/rockchip/rk356x.dtsi |  7 ++++---
 2 files changed, 12 insertions(+), 9 deletions(-)


base-commit: f0c4d9fc9cc9462659728d168387191387e903cc
--
2.38.0


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

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

* [PATCH 1/1] arm64: dts: rockchip: rk356x: Fix PCIe register and range mappings
  2022-11-12 11:41 [PATCH 0/1] arm64: dts: rockchip: rk356x: Fix PCIe register and range mappings Andrew Powers-Holmes
@ 2022-11-12 11:41 ` Andrew Powers-Holmes
  2022-12-05 16:23   ` Chukun Pan
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Powers-Holmes @ 2022-11-12 11:41 UTC (permalink / raw)
  To: linux-rockchip
  Cc: Ondřej Jirman, Rob Herring, Krzysztof Kozlowski,
	Heiko Stuebner, Peter Geis, Frank Wunderlich, Michael Riesch,
	Yifeng Zhao, Sascha Hauer, Nicolas Frattaroli, Chris Morgan,
	Ezequiel Garcia, Robin Murphy, Mark Kettenis, devicetree,
	linux-arm-kernel, linux-kernel

The register and range mappings for the PCIe controller in Rockchip's
RK356x SoCs are incorrect. Replace them with corrected values from the
vendor BSP sources, updated to match current DT schema.

Tested-by: Ondrej Jirman <megi@xff.cz>
Signed-off-by: Andrew Powers-Holmes <aholmes@omnom.net>
---
 arch/arm64/boot/dts/rockchip/rk3568.dtsi | 14 ++++++++------
 arch/arm64/boot/dts/rockchip/rk356x.dtsi |  7 ++++---
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3568.dtsi b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
index ba67b58f05b7..c1128d0c4406 100644
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
@@ -94,9 +94,10 @@ pcie3x1: pcie@fe270000 {
 		power-domains = <&power RK3568_PD_PIPE>;
 		reg = <0x3 0xc0400000 0x0 0x00400000>,
 		      <0x0 0xfe270000 0x0 0x00010000>,
-		      <0x3 0x7f000000 0x0 0x01000000>;
-		ranges = <0x01000000 0x0 0x3ef00000 0x3 0x7ef00000 0x0 0x00100000>,
-			 <0x02000000 0x0 0x00000000 0x3 0x40000000 0x0 0x3ef00000>;
+		      <0x0 0xf2000000 0x0 0x00100000>;
+		ranges = <0x01000000 0x0 0xf2100000 0x0 0xf2100000 0x0 0x00100000>,
+			 <0x02000000 0x0 0xf2200000 0x0 0xf2200000 0x0 0x01e00000>,
+			 <0x03000000 0x0 0x40000000 0x3 0x40000000 0x0 0x40000000>;
 		reg-names = "dbi", "apb", "config";
 		resets = <&cru SRST_PCIE30X1_POWERUP>;
 		reset-names = "pipe";
@@ -146,9 +147,10 @@ pcie3x2: pcie@fe280000 {
 		power-domains = <&power RK3568_PD_PIPE>;
 		reg = <0x3 0xc0800000 0x0 0x00400000>,
 		      <0x0 0xfe280000 0x0 0x00010000>,
-		      <0x3 0xbf000000 0x0 0x01000000>;
-		ranges = <0x01000000 0x0 0x3ef00000 0x3 0xbef00000 0x0 0x00100000>,
-			 <0x02000000 0x0 0x00000000 0x3 0x80000000 0x0 0x3ef00000>;
+		      <0x0 0xf2000000 0x0 0x01000000>;
+		ranges = <0x01000000 0x0 0xf0100000 0x0 0xf0100000 0x0 0x00100000>,
+			 <0x02000000 0x0 0xf0200000 0x0 0xf0200000 0x0 0x01e00000>,
+			 <0x03000000 0x0 0x40000000 0x3 0x80000000 0x0 0x40000000>;
 		reg-names = "dbi", "apb", "config";
 		resets = <&cru SRST_PCIE30X2_POWERUP>;
 		reset-names = "pipe";
diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
index 164708f1eb67..eec1d496c617 100644
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
@@ -951,7 +951,7 @@ pcie2x1: pcie@fe260000 {
 		compatible = "rockchip,rk3568-pcie";
 		reg = <0x3 0xc0000000 0x0 0x00400000>,
 		      <0x0 0xfe260000 0x0 0x00010000>,
-		      <0x3 0x3f000000 0x0 0x01000000>;
+		      <0x0 0xf4000000 0x0 0x00100000>;
 		reg-names = "dbi", "apb", "config";
 		interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>,
 			     <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>,
@@ -980,8 +980,9 @@ pcie2x1: pcie@fe260000 {
 		phys = <&combphy2 PHY_TYPE_PCIE>;
 		phy-names = "pcie-phy";
 		power-domains = <&power RK3568_PD_PIPE>;
-		ranges = <0x01000000 0x0 0x3ef00000 0x3 0x3ef00000 0x0 0x00100000
-			  0x02000000 0x0 0x00000000 0x3 0x00000000 0x0 0x3ef00000>;
+		ranges = <0x01000000 0x0 0xf4100000 0x0 0xf4100000 0x0 0x00100000>,
+			 <0x02000000 0x0 0xf4200000 0x0 0xf4200000 0x0 0x01e00000>,
+			 <0x03000000 0x0 0x40000000 0x3 0x00000000 0x0 0x40000000>;
 		resets = <&cru SRST_PCIE20_POWERUP>;
 		reset-names = "pipe";
 		#address-cells = <3>;
--
2.38.0


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

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

* Re: [PATCH 1/1] arm64: dts: rockchip: rk356x: Fix PCIe register and range mappings
  2022-11-12 11:41 ` [PATCH 1/1] " Andrew Powers-Holmes
@ 2022-12-05 16:23   ` Chukun Pan
  2022-12-05 18:15     ` Ondřej Jirman
  0 siblings, 1 reply; 4+ messages in thread
From: Chukun Pan @ 2022-12-05 16:23 UTC (permalink / raw)
  To: aholmes
  Cc: devicetree, ezequiel, frank-w, frattaroli.nicolas, heiko,
	krzysztof.kozlowski+dt, linux-arm-kernel, linux-kernel,
	linux-rockchip, macromorgan, mark.kettenis, megi, michael.riesch,
	pgwipeout, robh+dt, robin.murphy, s.hauer, yifeng.zhao,
	Chukun Pan

> The register and range mappings for the PCIe controller in Rockchip's
> RK356x SoCs are incorrect. Replace them with corrected values from the
> vendor BSP sources, updated to match current DT schema.

Hi, Andrew

This patch broken pcie3x2 on my board.
And the wireless card on pcie2x1 is still not working.

[    0.405341] pcieport 0000:00:00.0: of_irq_parse_pci: failed with rc=-22
[    0.670522] rockchip-dw-pcie 3c0800000.pcie: can't request region for resource [mem 0xf2000000-0xf2ffffff]
[    0.671527] rockchip-dw-pcie: probe of 3c0800000.pcie failed with error -16
[    7.354521] pci 0000:00:00.0: of_irq_parse_pci: failed with rc=-22
[    7.355116] mt7921e 0000:01:00.0: enabling device (0000 -> 0002)
[    7.355812] mt7921e: probe of 0000:01:00.0 failed with error -28

--
Thanks,
Chukun

-- 
2.25.1


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

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

* Re: [PATCH 1/1] arm64: dts: rockchip: rk356x: Fix PCIe register and range mappings
  2022-12-05 16:23   ` Chukun Pan
@ 2022-12-05 18:15     ` Ondřej Jirman
  0 siblings, 0 replies; 4+ messages in thread
From: Ondřej Jirman @ 2022-12-05 18:15 UTC (permalink / raw)
  To: Chukun Pan
  Cc: aholmes, devicetree, ezequiel, frank-w, frattaroli.nicolas,
	heiko, krzysztof.kozlowski+dt, linux-arm-kernel, linux-kernel,
	linux-rockchip, macromorgan, mark.kettenis, michael.riesch,
	pgwipeout, robh+dt, robin.murphy, s.hauer, yifeng.zhao

On Tue, Dec 06, 2022 at 12:23:22AM +0800, Chukun Pan wrote:
> > The register and range mappings for the PCIe controller in Rockchip's
> > RK356x SoCs are incorrect. Replace them with corrected values from the
> > vendor BSP sources, updated to match current DT schema.
> 
> Hi, Andrew
> 
> This patch broken pcie3x2 on my board.

That's because 32bit mapping for pcie3x2 config should start at 0xf0000000 and
the patch declares it incorrectly at 0xf2000000.

https://megous.com/dl/tmp/6d1a04195112b1e0.png

> And the wireless card on pcie2x1 is still not working.

> [    0.405341] pcieport 0000:00:00.0: of_irq_parse_pci: failed with rc=-22
> [    0.670522] rockchip-dw-pcie 3c0800000.pcie: can't request region for resource [mem 0xf2000000-0xf2ffffff]
> [    0.671527] rockchip-dw-pcie: probe of 3c0800000.pcie failed with error -16
> [    7.354521] pci 0000:00:00.0: of_irq_parse_pci: failed with rc=-22
> [    7.355116] mt7921e 0000:01:00.0: enabling device (0000 -> 0002)
> [    7.355812] mt7921e: probe of 0000:01:00.0 failed with error -28

That's ENOSPC. Who knows where it's comming from. Something for you to debug. ;)

regards,
	o.
> 
> --
> Thanks,
> Chukun
> 
> -- 
> 2.25.1
> 

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

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

end of thread, other threads:[~2022-12-05 18:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-12 11:41 [PATCH 0/1] arm64: dts: rockchip: rk356x: Fix PCIe register and range mappings Andrew Powers-Holmes
2022-11-12 11:41 ` [PATCH 1/1] " Andrew Powers-Holmes
2022-12-05 16:23   ` Chukun Pan
2022-12-05 18:15     ` Ondřej Jirman

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