devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: allwinner: a64: Re-add "syscon" compatible
@ 2018-09-17 15:28 Andre Przywara
  2018-09-21  9:47 ` Chen-Yu Tsai
  0 siblings, 1 reply; 10+ messages in thread
From: Andre Przywara @ 2018-09-17 15:28 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai
  Cc: Mark Rutland, Rob Herring, devicetree, Corentin Labbe,
	linux-arm-kernel, Icenowy Zheng

Commit 1f1f5183981d ("arm64: dts: allwinner: a64: add SRAM controller
device tree node") changed the (so far unused) compatible name of the
sytem controller node, to match a specific SRAM controller driver
instead of relying on the generic syscon driver. The Ethernet driver
needs a register in there, so it got amended to use the new driver instead
of the generic syscon approach. Consequently the "syscon" compatible has
been dropped, as it's not needed anymore and would compete with the
new SRAM driver.

However this breaks existing DT consumers like older kernels, which
expect the node pointed to by the syscon property to contain the string
"syscon" somewhere in the compatible list. When such a DT is given to an
older kernel (<4.19, for instance one on a distro installer image),
the Ethernet will not probe successfully:
----------
dwmac-sun8i 1c30000.ethernet: PTP uses main clock
dwmac-sun8i 1c30000.ethernet: Linked as a consumer to regulator.6
dwmac-sun8i 1c30000.ethernet: Unable to map syscon: -22
dwmac-sun8i 1c30000.ethernet: Dropping the link to regulator.6
dwmac-sun8i: probe of 1c30000.ethernet failed with error -22
----------

To avoid this problem, (re-)add the "syscon" string to the compatible
list of the sytem controller. This should make both older and newer
kernels happy:
- A newer kernel will try to find an existing *device* offering the regmap
  first. The "syscon" string itself will not trigger a driver probe on
  its own, the node must be explicitly referenced by another driver, wanting
  to use the regmap. Newer kernels won't do it this way and will use the
  regmap offered by the SRAM driver.
- An older kernel will try the syscon way, and the system controller /
  SRAM driver DT node is still fully syscon compatible.

So by adding "syscon" we make everyone happy: Newer kernels will ignore
it (knowing a better way), and older kernels will still work.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
Hi,

I think we need to amend the Ethernet driver now to not too easily use
syscon as a fallback, in case dwmac-sun8i probed earlier than the SRAM driver.
Will try this later tonight, but just wanted to start the discussion.

Thanks,
Andre.

 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index d3daf90a8715..8f2dad7e5d06 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -197,7 +197,8 @@
 		};
 
 		syscon: syscon@1c00000 {
-			compatible = "allwinner,sun50i-a64-system-control";
+			compatible = "allwinner,sun50i-a64-system-control",
+				     "syscon";
 			reg = <0x01c00000 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <1>;
-- 
2.17.1

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

end of thread, other threads:[~2018-10-04 15:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-17 15:28 [PATCH] arm64: dts: allwinner: a64: Re-add "syscon" compatible Andre Przywara
2018-09-21  9:47 ` Chen-Yu Tsai
2018-09-21 14:35   ` Andre Przywara
2018-09-21 14:57     ` Chen-Yu Tsai
2018-10-01  0:52       ` André Przywara
2018-09-21 15:16     ` Maxime Ripard
2018-09-24 10:22       ` Andre Przywara
2018-09-26  9:52         ` Maxime Ripard
2018-10-01  0:55           ` André Przywara
2018-10-04 15:02             ` Maxime Ripard

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