Re: [PATCH v2] arm64: dts: mediatek: mt7988a-bpi-r4: allow hw variants of bpi-r4

From: AngeloGioacchino Del Regno
Date: Mon Apr 14 2025 - 07:20:18 EST


Il 14/04/25 12:19, Frank Wunderlich ha scritto:
Am 14. April 2025 11:27:23 MESZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>:
Il 12/04/25 12:21, Frank Wunderlich ha scritto:
From: Frank Wunderlich <frank-w@xxxxxxxxxxxxxxx>

snip
This should at least have some different compatible, if not probably also a
different model string - as it's a different device.

compatible = "bananapi,bpi-r4-2g5", "bananapi,bpi-r4", "mediatek,mt7988a";
model = "Banana Pi BPI-R4 (2.5GbE)";
chassis-type = "embedded";

..snip..

a/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi b/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi
new file mode 100644
index 000000000000..1ab09ed2f151
--- /dev/null
+++ b/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi
@@ -0,0 +1,403 @@
+// SPDX-License-Identifier: GPL-2.0-only OR MIT
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/regulator/richtek,rt5190a-regulator.h>
+
+#include "mt7988a.dtsi"
+
+/ {
+ compatible = "bananapi,bpi-r4", "mediatek,mt7988a";
+ model = "Banana Pi BPI-R4";
+ chassis-type = "embedded";

Please keep compatible/model/chassis-type in dts files.

Ok, should i add specific compatible to existing board (like 2sfp)? Just thinking how binding should look like.


No, the existing board compatibles should not be touched.

I would imagine the bootloader reading the compatibles of all DTs and:

- On the 2G5 device, prefer a devicetree having that machine compatible;
- 2G5: If no 2G5 specific DT exists, fall back to using bananapi,bpi-r4
- On the 2sfp device, use DT that has bananapi,bpi-r4 but not the 2g5 compat.

So all of the DTs can be present, and the bootloader chooses the right one for
whatever device it is running on.
If it's not possible for the bootloader to do so... well, that still doesn't
change anything: you need two different DTS with a difference in machine compatible
because those are two different machines :-)

Else is there an example for adding optional compatible without adding a complete block in binding?

I'm not sure if you can nest oneOf statements in bindings... but that anyway
doesn't really solve anything, so just add a full block....

Just to be sure, though:

krzk/Rob/Conor, am I right on this?

Thanks!>
Cheers,
Angelo


regards Frank