linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/8] Add Bananapi R4 variants and add xsphy
@ 2025-04-16  9:53 Frank Wunderlich
  2025-04-16  9:53 ` [PATCH v3 1/8] dt-bindings: arm: mediatek: add bpi-r4 2g5 phy variant Frank Wunderlich
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-16  9:53 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Frank Wunderlich, Rafał Miłecki, Daniel Golle,
	Sean Wang, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, linux-phy

From: Frank Wunderlich <frank-w@public-files.de>

With this series i continue the mt7988/bananapi-r4 dts upstream work

https://patchwork.kernel.org/project/linux-mediatek/list/?series=952704
https://patchwork.kernel.org/project/linux-mediatek/list/?series=952805

- Adding new Hardware Variant for bananapi R4 (1 SFP replaced by RJ45 port with internal phy)
- Adding XS-phy for pcie2

because of new compatible for 2g5 variant now requires also a series i merged both into one.

Daniel Golle (1):
  phy: mediatek: xsphy: support type switch by pericfg

Frank Wunderlich (7):
  dt-bindings: arm: mediatek: add bpi-r4 2g5 phy variant
  arm64: dts: mediatek: mt7988a-bpi-r4: allow hw variants of bpi-r4
  dt-bindings: phy: mtk-xs-phy: Add mt7988 compatible
  dt-bindings: phy: mtk-xs-phy: support type switch by pericfg
  dt-bindings: mfd: syscon: Add mt7988-topmisc
  arm64: dts: mediatek: mt7988: Add xsphy for ssusb0/pcie2
  arm64: dts: mediatek: mt7988a-bpi-r4: enable xsphy

 .../devicetree/bindings/arm/mediatek.yaml     |   4 +
 .../devicetree/bindings/mfd/syscon.yaml       |   2 +
 .../bindings/phy/mediatek,xsphy.yaml          |  17 +
 arch/arm64/boot/dts/mediatek/Makefile         |   2 +
 .../mediatek/mt7988a-bananapi-bpi-r4-2g5.dts  |  11 +
 .../dts/mediatek/mt7988a-bananapi-bpi-r4.dts  | 400 +----------------
 .../dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi | 403 ++++++++++++++++++
 arch/arm64/boot/dts/mediatek/mt7988a.dtsi     |  36 ++
 drivers/phy/mediatek/phy-mtk-xsphy.c          |  85 +++-
 9 files changed, 564 insertions(+), 396 deletions(-)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4-2g5.dts
 create mode 100644 arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi

-- 
2.43.0



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

* [PATCH v3 1/8] dt-bindings: arm: mediatek: add bpi-r4 2g5 phy variant
  2025-04-16  9:53 [PATCH v3 0/8] Add Bananapi R4 variants and add xsphy Frank Wunderlich
@ 2025-04-16  9:53 ` Frank Wunderlich
  2025-04-17  6:28   ` Krzysztof Kozlowski
  2025-04-16  9:53 ` [PATCH v3 2/8] arm64: dts: mediatek: mt7988a-bpi-r4: allow hw variants of bpi-r4 Frank Wunderlich
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-16  9:53 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Frank Wunderlich, Rafał Miłecki, Daniel Golle,
	Sean Wang, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, linux-phy

From: Frank Wunderlich <frank-w@public-files.de>

Add new compatible for Bananapi R4 with 2.5G phy.
Base board is compatible with existing BPI-R4 only 1 SFP is replaced
by RJ45 port and use mt7988 internal phy.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
v3:
- new patch adding compatible for 2.5g variant
---
 Documentation/devicetree/bindings/arm/mediatek.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/mediatek.yaml b/Documentation/devicetree/bindings/arm/mediatek.yaml
index 108ae5e0185d..3aed03df0e3c 100644
--- a/Documentation/devicetree/bindings/arm/mediatek.yaml
+++ b/Documentation/devicetree/bindings/arm/mediatek.yaml
@@ -104,6 +104,10 @@ properties:
           - enum:
               - bananapi,bpi-r4
           - const: mediatek,mt7988a
+      - items:
+          - const: bananapi,bpi-r4-2g5
+          - const: bananapi,bpi-r4
+          - const: mediatek,mt7988a
       - items:
           - enum:
               - mediatek,mt8127-moose
-- 
2.43.0



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

* [PATCH v3 2/8] arm64: dts: mediatek: mt7988a-bpi-r4: allow hw variants of bpi-r4
  2025-04-16  9:53 [PATCH v3 0/8] Add Bananapi R4 variants and add xsphy Frank Wunderlich
  2025-04-16  9:53 ` [PATCH v3 1/8] dt-bindings: arm: mediatek: add bpi-r4 2g5 phy variant Frank Wunderlich
@ 2025-04-16  9:53 ` Frank Wunderlich
  2025-04-16  9:53 ` [PATCH v3 3/8] dt-bindings: phy: mtk-xs-phy: Add mt7988 compatible Frank Wunderlich
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-16  9:53 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Frank Wunderlich, Rafał Miłecki, Daniel Golle,
	Sean Wang, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, linux-phy

From: Frank Wunderlich <frank-w@public-files.de>

Sinovoip has released other variants of Bananapi-R4 board.
The known changes affecting only the LAN SFP+ slot which is replaced
by a 2.5G phy with optional PoE.

Just move the common parts to a new dtsi and keep differences (only
i2c for lan-sfp) in dts.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
v3:
- move compatible to dts
- added own compatible for 2g5 variant
- update information in board model
v2:
- added basic dts for 2g5 variant
- moved i2c used for sfp-lan to board dts
---
 arch/arm64/boot/dts/mediatek/Makefile         |   2 +
 .../mediatek/mt7988a-bananapi-bpi-r4-2g5.dts  |  11 +
 .../dts/mediatek/mt7988a-bananapi-bpi-r4.dts  | 400 +-----------------
 .../dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi | 399 +++++++++++++++++
 4 files changed, 417 insertions(+), 395 deletions(-)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4-2g5.dts
 create mode 100644 arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi

diff --git a/arch/arm64/boot/dts/mediatek/Makefile b/arch/arm64/boot/dts/mediatek/Makefile
index 58484e830063..a1ebc9aa4ba6 100644
--- a/arch/arm64/boot/dts/mediatek/Makefile
+++ b/arch/arm64/boot/dts/mediatek/Makefile
@@ -22,6 +22,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-rfb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986b-rfb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7988a-bananapi-bpi-r4.dtb
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt7988a-bananapi-bpi-r4-2g5.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7988a-bananapi-bpi-r4-emmc.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7988a-bananapi-bpi-r4-sd.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt8167-pumpkin.dtb
@@ -107,4 +108,5 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt8516-pumpkin.dtb
 DTC_FLAGS_mt7986a-bananapi-bpi-r3 := -@
 DTC_FLAGS_mt7986a-bananapi-bpi-r3-mini := -@
 DTC_FLAGS_mt7988a-bananapi-bpi-r4 := -@
+DTC_FLAGS_mt7988a-bananapi-bpi-r4-2g5 := -@
 DTC_FLAGS_mt8395-radxa-nio-12l := -@
diff --git a/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4-2g5.dts b/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4-2g5.dts
new file mode 100644
index 000000000000..53de9c113f60
--- /dev/null
+++ b/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4-2g5.dts
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-only OR MIT
+
+/dts-v1/;
+
+#include "mt7988a-bananapi-bpi-r4.dtsi"
+
+/ {
+	compatible = "bananapi,bpi-r4-2g5", "bananapi,bpi-r4", "mediatek,mt7988a";
+	model = "Banana Pi BPI-R4 (1x SFP+, 1x 2.5GbE)";
+	chassis-type = "embedded";
+};
diff --git a/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dts b/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dts
index 6623112c24c7..36bd1ef2efab 100644
--- a/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dts
+++ b/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dts
@@ -2,408 +2,18 @@
 
 /dts-v1/;
 
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/regulator/richtek,rt5190a-regulator.h>
-
-#include "mt7988a.dtsi"
+#include "mt7988a-bananapi-bpi-r4.dtsi"
 
 / {
 	compatible = "bananapi,bpi-r4", "mediatek,mt7988a";
-	model = "Banana Pi BPI-R4";
+	model = "Banana Pi BPI-R4 (2x SFP+)";
 	chassis-type = "embedded";
-
-	chosen {
-		stdout-path = "serial0:115200n8";
-	};
-
-	reg_1p8v: regulator-1p8v {
-		compatible = "regulator-fixed";
-		regulator-name = "fixed-1.8V";
-		regulator-min-microvolt = <1800000>;
-		regulator-max-microvolt = <1800000>;
-		regulator-boot-on;
-		regulator-always-on;
-	};
-
-	reg_3p3v: regulator-3p3v {
-		compatible = "regulator-fixed";
-		regulator-name = "fixed-3.3V";
-		regulator-min-microvolt = <3300000>;
-		regulator-max-microvolt = <3300000>;
-		regulator-boot-on;
-		regulator-always-on;
-	};
 };
 
-&cpu0 {
-	proc-supply = <&rt5190_buck3>;
-};
-
-&cpu1 {
-	proc-supply = <&rt5190_buck3>;
-};
-
-&cpu2 {
-	proc-supply = <&rt5190_buck3>;
-};
-
-&cpu3 {
-	proc-supply = <&rt5190_buck3>;
-};
-
-&cpu_thermal {
-	trips {
-		cpu_trip_hot: hot {
-			temperature = <120000>;
-			hysteresis = <2000>;
-			type = "hot";
-		};
-
-		cpu_trip_active_high: active-high {
-			temperature = <115000>;
-			hysteresis = <2000>;
-			type = "active";
-		};
-
-		cpu_trip_active_med: active-med {
-			temperature = <85000>;
-			hysteresis = <2000>;
-			type = "active";
-		};
-
-		cpu_trip_active_low: active-low {
-			temperature = <40000>;
-			hysteresis = <2000>;
-			type = "active";
-		};
-	};
-};
-
-&i2c0 {
-	pinctrl-names = "default";
-	pinctrl-0 = <&i2c0_pins>;
-	status = "okay";
-
-	rt5190a_64: rt5190a@64 {
-		compatible = "richtek,rt5190a";
-		reg = <0x64>;
-		vin2-supply = <&rt5190_buck1>;
-		vin3-supply = <&rt5190_buck1>;
-		vin4-supply = <&rt5190_buck1>;
-
-		regulators {
-			rt5190_buck1: buck1 {
-				regulator-name = "rt5190a-buck1";
-				regulator-min-microvolt = <5090000>;
-				regulator-max-microvolt = <5090000>;
-				regulator-allowed-modes =
-				<RT5190A_OPMODE_AUTO>, <RT5190A_OPMODE_FPWM>;
-				regulator-boot-on;
-				regulator-always-on;
-			};
-			buck2 {
-				regulator-name = "vcore";
-				regulator-min-microvolt = <600000>;
-				regulator-max-microvolt = <1400000>;
-				regulator-boot-on;
-				regulator-always-on;
-			};
-			rt5190_buck3: buck3 {
-				regulator-name = "vproc";
-				regulator-min-microvolt = <600000>;
-				regulator-max-microvolt = <1400000>;
-				regulator-boot-on;
-			};
-			buck4 {
-				regulator-name = "rt5190a-buck4";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-allowed-modes =
-				<RT5190A_OPMODE_AUTO>, <RT5190A_OPMODE_FPWM>;
-				regulator-boot-on;
-				regulator-always-on;
-			};
-			ldo {
-				regulator-name = "rt5190a-ldo";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-boot-on;
-				regulator-always-on;
-			};
-		};
-	};
-};
-
-&i2c2 {
-	pinctrl-names = "default";
-	pinctrl-0 = <&i2c2_1_pins>;
-	status = "okay";
-
-	pca9545: i2c-mux@70 {
-		compatible = "nxp,pca9545";
-		reg = <0x70>;
-		reset-gpios = <&pio 5 GPIO_ACTIVE_LOW>;
+&pca9545 {
+	i2c_sfp2: i2c@2 {
 		#address-cells = <1>;
 		#size-cells = <0>;
-
-		i2c@0 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			reg = <0>;
-
-			pcf8563: rtc@51 {
-				compatible = "nxp,pcf8563";
-				reg = <0x51>;
-				#clock-cells = <0>;
-			};
-
-			eeprom@57 {
-				compatible = "atmel,24c02";
-				reg = <0x57>;
-				size = <256>;
-			};
-
-		};
-
-		i2c_sfp1: i2c@1 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			reg = <1>;
-		};
-
-		i2c_sfp2: i2c@2 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			reg = <2>;
-		};
-	};
-};
-
-/* mPCIe SIM2 */
-&pcie0 {
-	status = "okay";
-};
-
-/* mPCIe SIM3 */
-&pcie1 {
-	status = "okay";
-};
-
-/* M.2 key-B SIM1 */
-&pcie2 {
-	status = "okay";
-};
-
-/* M.2 key-M SSD */
-&pcie3 {
-	status = "okay";
-};
-
-&pio {
-	mdio0_pins: mdio0-pins {
-		mux {
-			function = "eth";
-			groups = "mdc_mdio0";
-		};
-
-		conf {
-			pins = "SMI_0_MDC", "SMI_0_MDIO";
-			drive-strength = <8>;
-		};
-	};
-
-	i2c0_pins: i2c0-g0-pins {
-		mux {
-			function = "i2c";
-			groups = "i2c0_1";
-		};
-	};
-
-	i2c1_pins: i2c1-g0-pins {
-		mux {
-			function = "i2c";
-			groups = "i2c1_0";
-		};
-	};
-
-	i2c1_sfp_pins: i2c1-sfp-g0-pins {
-		mux {
-			function = "i2c";
-			groups = "i2c1_sfp";
-		};
-	};
-
-	i2c2_0_pins: i2c2-g0-pins {
-		mux {
-			function = "i2c";
-			groups = "i2c2_0";
-		};
+		reg = <2>;
 	};
-
-	i2c2_1_pins: i2c2-g1-pins {
-		mux {
-			function = "i2c";
-			groups = "i2c2_1";
-		};
-	};
-
-	gbe0_led0_pins: gbe0-led0-pins {
-		mux {
-			function = "led";
-			groups = "gbe0_led0";
-		};
-	};
-
-	gbe1_led0_pins: gbe1-led0-pins {
-		mux {
-			function = "led";
-			groups = "gbe1_led0";
-		};
-	};
-
-	gbe2_led0_pins: gbe2-led0-pins {
-		mux {
-			function = "led";
-			groups = "gbe2_led0";
-		};
-	};
-
-	gbe3_led0_pins: gbe3-led0-pins {
-		mux {
-			function = "led";
-			groups = "gbe3_led0";
-		};
-	};
-
-	gbe0_led1_pins: gbe0-led1-pins {
-		mux {
-			function = "led";
-			groups = "gbe0_led1";
-		};
-	};
-
-	gbe1_led1_pins: gbe1-led1-pins {
-		mux {
-			function = "led";
-			groups = "gbe1_led1";
-		};
-	};
-
-	gbe2_led1_pins: gbe2-led1-pins {
-		mux {
-			function = "led";
-			groups = "gbe2_led1";
-		};
-	};
-
-	gbe3_led1_pins: gbe3-led1-pins {
-		mux {
-			function = "led";
-			groups = "gbe3_led1";
-		};
-	};
-
-	i2p5gbe_led0_pins: 2p5gbe-led0-pins {
-		mux {
-			function = "led";
-			groups = "2p5gbe_led0";
-		};
-	};
-
-	i2p5gbe_led1_pins: 2p5gbe-led1-pins {
-		mux {
-			function = "led";
-			groups = "2p5gbe_led1";
-		};
-	};
-
-	mmc0_pins_emmc_45: mmc0-emmc-45-pins {
-		mux {
-			function = "flash";
-			groups = "emmc_45";
-		};
-	};
-
-	mmc0_pins_emmc_51: mmc0-emmc-51-pins {
-		mux {
-			function = "flash";
-			groups = "emmc_51";
-		};
-	};
-
-	mmc0_pins_sdcard: mmc0-sdcard-pins {
-		mux {
-			function = "flash";
-			groups = "sdcard";
-		};
-	};
-
-	uart0_pins: uart0-pins {
-		mux {
-			function = "uart";
-			groups =  "uart0";
-		};
-	};
-
-	snfi_pins: snfi-pins {
-		mux {
-			function = "flash";
-			groups = "snfi";
-		};
-	};
-
-	spi0_pins: spi0-pins {
-		mux {
-			function = "spi";
-			groups = "spi0";
-		};
-	};
-
-	spi0_flash_pins: spi0-flash-pins {
-		mux {
-			function = "spi";
-			groups = "spi0", "spi0_wp_hold";
-		};
-	};
-
-	spi1_pins: spi1-pins {
-		mux {
-			function = "spi";
-			groups = "spi1";
-		};
-	};
-
-	spi2_pins: spi2-pins {
-		mux {
-			function = "spi";
-			groups = "spi2";
-		};
-	};
-
-	spi2_flash_pins: spi2-flash-pins {
-		mux {
-			function = "spi";
-			groups = "spi2", "spi2_wp_hold";
-		};
-	};
-};
-
-&pwm {
-	status = "okay";
-};
-
-&serial0 {
-	status = "okay";
-};
-
-&ssusb1 {
-	status = "okay";
-};
-
-&tphy {
-	status = "okay";
-};
-
-&watchdog {
-	status = "okay";
 };
diff --git 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..0d332822971d
--- /dev/null
+++ b/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi
@@ -0,0 +1,399 @@
+// 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"
+
+/ {
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	reg_1p8v: regulator-1p8v {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-1.8V";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	reg_3p3v: regulator-3p3v {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+};
+
+&cpu0 {
+	proc-supply = <&rt5190_buck3>;
+};
+
+&cpu1 {
+	proc-supply = <&rt5190_buck3>;
+};
+
+&cpu2 {
+	proc-supply = <&rt5190_buck3>;
+};
+
+&cpu3 {
+	proc-supply = <&rt5190_buck3>;
+};
+
+&cpu_thermal {
+	trips {
+		cpu_trip_hot: hot {
+			temperature = <120000>;
+			hysteresis = <2000>;
+			type = "hot";
+		};
+
+		cpu_trip_active_high: active-high {
+			temperature = <115000>;
+			hysteresis = <2000>;
+			type = "active";
+		};
+
+		cpu_trip_active_med: active-med {
+			temperature = <85000>;
+			hysteresis = <2000>;
+			type = "active";
+		};
+
+		cpu_trip_active_low: active-low {
+			temperature = <40000>;
+			hysteresis = <2000>;
+			type = "active";
+		};
+	};
+};
+
+&i2c0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c0_pins>;
+	status = "okay";
+
+	rt5190a_64: rt5190a@64 {
+		compatible = "richtek,rt5190a";
+		reg = <0x64>;
+		vin2-supply = <&rt5190_buck1>;
+		vin3-supply = <&rt5190_buck1>;
+		vin4-supply = <&rt5190_buck1>;
+
+		regulators {
+			rt5190_buck1: buck1 {
+				regulator-name = "rt5190a-buck1";
+				regulator-min-microvolt = <5090000>;
+				regulator-max-microvolt = <5090000>;
+				regulator-allowed-modes =
+				<RT5190A_OPMODE_AUTO>, <RT5190A_OPMODE_FPWM>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+			buck2 {
+				regulator-name = "vcore";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <1400000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+			rt5190_buck3: buck3 {
+				regulator-name = "vproc";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <1400000>;
+				regulator-boot-on;
+			};
+			buck4 {
+				regulator-name = "rt5190a-buck4";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-allowed-modes =
+				<RT5190A_OPMODE_AUTO>, <RT5190A_OPMODE_FPWM>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+			ldo {
+				regulator-name = "rt5190a-ldo";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+		};
+	};
+};
+
+&i2c2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c2_1_pins>;
+	status = "okay";
+
+	pca9545: i2c-mux@70 {
+		compatible = "nxp,pca9545";
+		reg = <0x70>;
+		reset-gpios = <&pio 5 GPIO_ACTIVE_LOW>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		i2c@0 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0>;
+
+			pcf8563: rtc@51 {
+				compatible = "nxp,pcf8563";
+				reg = <0x51>;
+				#clock-cells = <0>;
+			};
+
+			eeprom@57 {
+				compatible = "atmel,24c02";
+				reg = <0x57>;
+				size = <256>;
+			};
+
+		};
+
+		i2c_sfp1: i2c@1 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <1>;
+		};
+	};
+};
+
+/* mPCIe SIM2 */
+&pcie0 {
+	status = "okay";
+};
+
+/* mPCIe SIM3 */
+&pcie1 {
+	status = "okay";
+};
+
+/* M.2 key-B SIM1 */
+&pcie2 {
+	status = "okay";
+};
+
+/* M.2 key-M SSD */
+&pcie3 {
+	status = "okay";
+};
+
+&pio {
+	mdio0_pins: mdio0-pins {
+		mux {
+			function = "eth";
+			groups = "mdc_mdio0";
+		};
+
+		conf {
+			pins = "SMI_0_MDC", "SMI_0_MDIO";
+			drive-strength = <8>;
+		};
+	};
+
+	i2c0_pins: i2c0-g0-pins {
+		mux {
+			function = "i2c";
+			groups = "i2c0_1";
+		};
+	};
+
+	i2c1_pins: i2c1-g0-pins {
+		mux {
+			function = "i2c";
+			groups = "i2c1_0";
+		};
+	};
+
+	i2c1_sfp_pins: i2c1-sfp-g0-pins {
+		mux {
+			function = "i2c";
+			groups = "i2c1_sfp";
+		};
+	};
+
+	i2c2_0_pins: i2c2-g0-pins {
+		mux {
+			function = "i2c";
+			groups = "i2c2_0";
+		};
+	};
+
+	i2c2_1_pins: i2c2-g1-pins {
+		mux {
+			function = "i2c";
+			groups = "i2c2_1";
+		};
+	};
+
+	gbe0_led0_pins: gbe0-led0-pins {
+		mux {
+			function = "led";
+			groups = "gbe0_led0";
+		};
+	};
+
+	gbe1_led0_pins: gbe1-led0-pins {
+		mux {
+			function = "led";
+			groups = "gbe1_led0";
+		};
+	};
+
+	gbe2_led0_pins: gbe2-led0-pins {
+		mux {
+			function = "led";
+			groups = "gbe2_led0";
+		};
+	};
+
+	gbe3_led0_pins: gbe3-led0-pins {
+		mux {
+			function = "led";
+			groups = "gbe3_led0";
+		};
+	};
+
+	gbe0_led1_pins: gbe0-led1-pins {
+		mux {
+			function = "led";
+			groups = "gbe0_led1";
+		};
+	};
+
+	gbe1_led1_pins: gbe1-led1-pins {
+		mux {
+			function = "led";
+			groups = "gbe1_led1";
+		};
+	};
+
+	gbe2_led1_pins: gbe2-led1-pins {
+		mux {
+			function = "led";
+			groups = "gbe2_led1";
+		};
+	};
+
+	gbe3_led1_pins: gbe3-led1-pins {
+		mux {
+			function = "led";
+			groups = "gbe3_led1";
+		};
+	};
+
+	i2p5gbe_led0_pins: 2p5gbe-led0-pins {
+		mux {
+			function = "led";
+			groups = "2p5gbe_led0";
+		};
+	};
+
+	i2p5gbe_led1_pins: 2p5gbe-led1-pins {
+		mux {
+			function = "led";
+			groups = "2p5gbe_led1";
+		};
+	};
+
+	mmc0_pins_emmc_45: mmc0-emmc-45-pins {
+		mux {
+			function = "flash";
+			groups = "emmc_45";
+		};
+	};
+
+	mmc0_pins_emmc_51: mmc0-emmc-51-pins {
+		mux {
+			function = "flash";
+			groups = "emmc_51";
+		};
+	};
+
+	mmc0_pins_sdcard: mmc0-sdcard-pins {
+		mux {
+			function = "flash";
+			groups = "sdcard";
+		};
+	};
+
+	uart0_pins: uart0-pins {
+		mux {
+			function = "uart";
+			groups =  "uart0";
+		};
+	};
+
+	snfi_pins: snfi-pins {
+		mux {
+			function = "flash";
+			groups = "snfi";
+		};
+	};
+
+	spi0_pins: spi0-pins {
+		mux {
+			function = "spi";
+			groups = "spi0";
+		};
+	};
+
+	spi0_flash_pins: spi0-flash-pins {
+		mux {
+			function = "spi";
+			groups = "spi0", "spi0_wp_hold";
+		};
+	};
+
+	spi1_pins: spi1-pins {
+		mux {
+			function = "spi";
+			groups = "spi1";
+		};
+	};
+
+	spi2_pins: spi2-pins {
+		mux {
+			function = "spi";
+			groups = "spi2";
+		};
+	};
+
+	spi2_flash_pins: spi2-flash-pins {
+		mux {
+			function = "spi";
+			groups = "spi2", "spi2_wp_hold";
+		};
+	};
+};
+
+&pwm {
+	status = "okay";
+};
+
+&serial0 {
+	status = "okay";
+};
+
+&ssusb1 {
+	status = "okay";
+};
+
+&tphy {
+	status = "okay";
+};
+
+&watchdog {
+	status = "okay";
+};
-- 
2.43.0



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

* [PATCH v3 3/8] dt-bindings: phy: mtk-xs-phy: Add mt7988 compatible
  2025-04-16  9:53 [PATCH v3 0/8] Add Bananapi R4 variants and add xsphy Frank Wunderlich
  2025-04-16  9:53 ` [PATCH v3 1/8] dt-bindings: arm: mediatek: add bpi-r4 2g5 phy variant Frank Wunderlich
  2025-04-16  9:53 ` [PATCH v3 2/8] arm64: dts: mediatek: mt7988a-bpi-r4: allow hw variants of bpi-r4 Frank Wunderlich
@ 2025-04-16  9:53 ` Frank Wunderlich
  2025-04-17  6:53   ` Krzysztof Kozlowski
  2025-04-16  9:53 ` [PATCH v3 4/8] dt-bindings: phy: mtk-xs-phy: support type switch by pericfg Frank Wunderlich
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-16  9:53 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Frank Wunderlich, Rafał Miłecki, Daniel Golle,
	Sean Wang, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, linux-phy

From: Frank Wunderlich <frank-w@public-files.de>

Add compatible for xs-phy on mt7988.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
index a9e3139fd421..3b5253659e6f 100644
--- a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
+++ b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
@@ -49,6 +49,7 @@ properties:
       - enum:
           - mediatek,mt3611-xsphy
           - mediatek,mt3612-xsphy
+          - mediatek,mt7988-xsphy
       - const: mediatek,xsphy
 
   reg:
-- 
2.43.0



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

* [PATCH v3 4/8] dt-bindings: phy: mtk-xs-phy: support type switch by pericfg
  2025-04-16  9:53 [PATCH v3 0/8] Add Bananapi R4 variants and add xsphy Frank Wunderlich
                   ` (2 preceding siblings ...)
  2025-04-16  9:53 ` [PATCH v3 3/8] dt-bindings: phy: mtk-xs-phy: Add mt7988 compatible Frank Wunderlich
@ 2025-04-16  9:53 ` Frank Wunderlich
  2025-04-17  6:56   ` Krzysztof Kozlowski
  2025-04-16  9:53 ` [PATCH v3 5/8] dt-bindings: mfd: syscon: Add mt7988-topmisc Frank Wunderlich
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-16  9:53 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Frank Wunderlich, Rafał Miłecki, Daniel Golle,
	Sean Wang, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, linux-phy

From: Frank Wunderlich <frank-w@public-files.de>

Add support for type switch by pericfg register between USB3/PCIe.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 .../devicetree/bindings/phy/mediatek,xsphy.yaml  | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
index 3b5253659e6f..5033d77c1239 100644
--- a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
+++ b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
@@ -151,6 +151,22 @@ patternProperties:
         minimum: 1
         maximum: 31
 
+      mediatek,syscon-type:
+        $ref: /schemas/types.yaml#/definitions/phandle-array
+        maxItems: 1
+        description:
+          A phandle to syscon used to access the register of type switch,
+          the field should always be 3 cells long.
+        items:
+          items:
+            - description:
+                The first cell represents a phandle to syscon
+            - description:
+                The second cell represents the register offset
+            - description:
+                The third cell represents the index of config segment
+              enum: [0, 1, 2, 3]
+
     required:
       - reg
       - clocks
-- 
2.43.0



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

* [PATCH v3 5/8] dt-bindings: mfd: syscon: Add mt7988-topmisc
  2025-04-16  9:53 [PATCH v3 0/8] Add Bananapi R4 variants and add xsphy Frank Wunderlich
                   ` (3 preceding siblings ...)
  2025-04-16  9:53 ` [PATCH v3 4/8] dt-bindings: phy: mtk-xs-phy: support type switch by pericfg Frank Wunderlich
@ 2025-04-16  9:53 ` Frank Wunderlich
  2025-04-16  9:53 ` [PATCH v3 6/8] phy: mediatek: xsphy: support type switch by pericfg Frank Wunderlich
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-16  9:53 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Frank Wunderlich, Rafał Miłecki, Daniel Golle,
	Sean Wang, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, linux-phy

From: Frank Wunderlich <frank-w@public-files.de>

Add compatible for Mediatek mt7988 topmisc syscon.
This hardware block contains 2 functional blocks

- a powercontroller which is not needed (switched by atf)
- a multiplexer for high-speed Combo-Phy

This compatible is only for the multiplexer part.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 Documentation/devicetree/bindings/mfd/syscon.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/syscon.yaml b/Documentation/devicetree/bindings/mfd/syscon.yaml
index c6bbb19c3e3e..4f3d522bc3de 100644
--- a/Documentation/devicetree/bindings/mfd/syscon.yaml
+++ b/Documentation/devicetree/bindings/mfd/syscon.yaml
@@ -84,6 +84,7 @@ select:
           - mediatek,mt2701-pctl-a-syscfg
           - mediatek,mt2712-pctl-a-syscfg
           - mediatek,mt6397-pctl-pmic-syscfg
+          - mediatek,mt7988-topmisc
           - mediatek,mt8135-pctl-a-syscfg
           - mediatek,mt8135-pctl-b-syscfg
           - mediatek,mt8173-pctl-a-syscfg
@@ -187,6 +188,7 @@ properties:
           - mediatek,mt2701-pctl-a-syscfg
           - mediatek,mt2712-pctl-a-syscfg
           - mediatek,mt6397-pctl-pmic-syscfg
+          - mediatek,mt7988-topmisc
           - mediatek,mt8135-pctl-a-syscfg
           - mediatek,mt8135-pctl-b-syscfg
           - mediatek,mt8173-pctl-a-syscfg
-- 
2.43.0



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

* [PATCH v3 6/8] phy: mediatek: xsphy: support type switch by pericfg
  2025-04-16  9:53 [PATCH v3 0/8] Add Bananapi R4 variants and add xsphy Frank Wunderlich
                   ` (4 preceding siblings ...)
  2025-04-16  9:53 ` [PATCH v3 5/8] dt-bindings: mfd: syscon: Add mt7988-topmisc Frank Wunderlich
@ 2025-04-16  9:53 ` Frank Wunderlich
  2025-04-16  9:53 ` [PATCH v3 7/8] arm64: dts: mediatek: mt7988: Add xsphy for ssusb0/pcie2 Frank Wunderlich
  2025-04-16  9:54 ` [PATCH v3 8/8] arm64: dts: mediatek: mt7988a-bpi-r4: enable xsphy Frank Wunderlich
  7 siblings, 0 replies; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-16  9:53 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Frank Wunderlich, Rafał Miłecki, Daniel Golle,
	Sean Wang, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, linux-phy

From: Daniel Golle <daniel@makrotopia.org>

Patch from Sam Shih <sam.shih@mediatek.com> found in MediaTek SDK
released under GPL.

Get syscon and use it to set the PHY type.
Extend support to PCIe and SGMII mode in addition to USB2 and USB3.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 drivers/phy/mediatek/phy-mtk-xsphy.c | 85 +++++++++++++++++++++++++++-
 1 file changed, 84 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/mediatek/phy-mtk-xsphy.c b/drivers/phy/mediatek/phy-mtk-xsphy.c
index 7c248f5cfca5..c0ddb9273cc3 100644
--- a/drivers/phy/mediatek/phy-mtk-xsphy.c
+++ b/drivers/phy/mediatek/phy-mtk-xsphy.c
@@ -11,10 +11,12 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/iopoll.h>
+#include <linux/mfd/syscon.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/regmap.h>
 
 #include "phy-mtk-io.h"
 
@@ -81,12 +83,22 @@
 #define XSP_SR_COEF_DIVISOR	1000
 #define XSP_FM_DET_CYCLE_CNT	1024
 
+/* PHY switch between pcie/usb3/sgmii */
+#define USB_PHY_SWITCH_CTRL	0x0
+#define RG_PHY_SW_TYPE		GENMASK(3, 0)
+#define RG_PHY_SW_PCIE		0x0
+#define RG_PHY_SW_USB3		0x1
+#define RG_PHY_SW_SGMII		0x2
+
 struct xsphy_instance {
 	struct phy *phy;
 	void __iomem *port_base;
 	struct clk *ref_clk;	/* reference clock of anolog phy */
 	u32 index;
 	u32 type;
+	struct regmap *type_sw;
+	u32 type_sw_reg;
+	u32 type_sw_index;
 	/* only for HQA test */
 	int efuse_intr;
 	int efuse_tx_imp;
@@ -259,6 +271,10 @@ static void phy_parse_property(struct mtk_xsphy *xsphy,
 			inst->efuse_intr, inst->efuse_tx_imp,
 			inst->efuse_rx_imp);
 		break;
+	case PHY_TYPE_PCIE:
+	case PHY_TYPE_SGMII:
+		/* nothing to do */
+		break;
 	default:
 		dev_err(xsphy->dev, "incompatible phy type\n");
 		return;
@@ -305,6 +321,62 @@ static void u3_phy_props_set(struct mtk_xsphy *xsphy,
 				     RG_XTP_LN0_RX_IMPSEL, inst->efuse_rx_imp);
 }
 
+/* type switch for usb3/pcie/sgmii */
+static int phy_type_syscon_get(struct xsphy_instance *instance,
+			       struct device_node *dn)
+{
+	struct of_phandle_args args;
+	int ret;
+
+	/* type switch function is optional */
+	if (!of_property_present(dn, "mediatek,syscon-type"))
+		return 0;
+
+	ret = of_parse_phandle_with_fixed_args(dn, "mediatek,syscon-type",
+					       2, 0, &args);
+	if (ret)
+		return ret;
+
+	instance->type_sw_reg = args.args[0];
+	instance->type_sw_index = args.args[1] & 0x3; /* <=3 */
+	instance->type_sw = syscon_node_to_regmap(args.np);
+	of_node_put(args.np);
+	dev_info(&instance->phy->dev, "type_sw - reg %#x, index %d\n",
+		 instance->type_sw_reg, instance->type_sw_index);
+
+	return PTR_ERR_OR_ZERO(instance->type_sw);
+}
+
+static int phy_type_set(struct xsphy_instance *instance)
+{
+	int type;
+	u32 offset;
+
+	if (!instance->type_sw)
+		return 0;
+
+	switch (instance->type) {
+	case PHY_TYPE_USB3:
+		type = RG_PHY_SW_USB3;
+		break;
+	case PHY_TYPE_PCIE:
+		type = RG_PHY_SW_PCIE;
+		break;
+	case PHY_TYPE_SGMII:
+		type = RG_PHY_SW_SGMII;
+		break;
+	case PHY_TYPE_USB2:
+	default:
+		return 0;
+	}
+
+	offset = instance->type_sw_index * BITS_PER_BYTE;
+	regmap_update_bits(instance->type_sw, instance->type_sw_reg,
+			   RG_PHY_SW_TYPE << offset, type << offset);
+
+	return 0;
+}
+
 static int mtk_phy_init(struct phy *phy)
 {
 	struct xsphy_instance *inst = phy_get_drvdata(phy);
@@ -325,6 +397,10 @@ static int mtk_phy_init(struct phy *phy)
 	case PHY_TYPE_USB3:
 		u3_phy_props_set(xsphy, inst);
 		break;
+	case PHY_TYPE_PCIE:
+	case PHY_TYPE_SGMII:
+		/* nothing to do, only used to set type */
+		break;
 	default:
 		dev_err(xsphy->dev, "incompatible phy type\n");
 		clk_disable_unprepare(inst->ref_clk);
@@ -403,12 +479,15 @@ static struct phy *mtk_phy_xlate(struct device *dev,
 
 	inst->type = args->args[0];
 	if (!(inst->type == PHY_TYPE_USB2 ||
-	      inst->type == PHY_TYPE_USB3)) {
+	      inst->type == PHY_TYPE_USB3 ||
+	      inst->type == PHY_TYPE_PCIE ||
+	      inst->type == PHY_TYPE_SGMII)) {
 		dev_err(dev, "unsupported phy type: %d\n", inst->type);
 		return ERR_PTR(-EINVAL);
 	}
 
 	phy_parse_property(xsphy, inst);
+	phy_type_set(inst);
 
 	return inst->phy;
 }
@@ -510,6 +589,10 @@ static int mtk_xsphy_probe(struct platform_device *pdev)
 			dev_err(dev, "failed to get ref_clk(id-%d)\n", port);
 			return PTR_ERR(inst->ref_clk);
 		}
+
+		retval = phy_type_syscon_get(inst, child_np);
+		if (retval)
+			return retval;
 	}
 
 	provider = devm_of_phy_provider_register(dev, mtk_phy_xlate);
-- 
2.43.0



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

* [PATCH v3 7/8] arm64: dts: mediatek: mt7988: Add xsphy for ssusb0/pcie2
  2025-04-16  9:53 [PATCH v3 0/8] Add Bananapi R4 variants and add xsphy Frank Wunderlich
                   ` (5 preceding siblings ...)
  2025-04-16  9:53 ` [PATCH v3 6/8] phy: mediatek: xsphy: support type switch by pericfg Frank Wunderlich
@ 2025-04-16  9:53 ` Frank Wunderlich
  2025-04-16  9:54 ` [PATCH v3 8/8] arm64: dts: mediatek: mt7988a-bpi-r4: enable xsphy Frank Wunderlich
  7 siblings, 0 replies; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-16  9:53 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Frank Wunderlich, Rafał Miłecki, Daniel Golle,
	Sean Wang, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, linux-phy

From: Frank Wunderlich <frank-w@public-files.de>

First usb and third pcie controller on mt7988 need a xs-phy to work
properly.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
v3:
- drop unneeded properties and compatibles from topmisc
- xsphy unit name not changed because binding requires this name (not only phy)
- also not changed port names to be clear abour which phy is used (mt7988 also have tphy)
- change offset to have clean syscon (without power controller)
---
 arch/arm64/boot/dts/mediatek/mt7988a.dtsi | 36 +++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt7988a.dtsi b/arch/arm64/boot/dts/mediatek/mt7988a.dtsi
index 88b56a24efca..72792f4ccde3 100644
--- a/arch/arm64/boot/dts/mediatek/mt7988a.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7988a.dtsi
@@ -334,6 +334,8 @@ usb@11190000 {
 				 <&infracfg CLK_INFRA_133M_USB_HCK>,
 				 <&infracfg CLK_INFRA_USB_XHCI>;
 			clock-names = "sys_ck", "ref_ck", "mcu_ck", "dma_ck", "xhci_ck";
+			phys = <&xphyu2port0 PHY_TYPE_USB2>,
+			       <&xphyu3port0 PHY_TYPE_USB3>;
 			status = "disabled";
 		};
 
@@ -398,6 +400,9 @@ pcie2: pcie@11280000 {
 			pinctrl-0 = <&pcie2_pins>;
 			status = "disabled";
 
+			phys = <&xphyu3port0 PHY_TYPE_PCIE>;
+			phy-names = "pcie-phy";
+
 			#interrupt-cells = <1>;
 			interrupt-map-mask = <0 0 0 0x7>;
 			interrupt-map = <0 0 0 1 &pcie_intc2 0>,
@@ -548,6 +553,37 @@ tphyu3port0: usb-phy@11c50700 {
 			};
 		};
 
+
+		topmisc: system-controller@11d10000 {
+			compatible = "mediatek,mt7988-topmisc",
+				     "syscon";
+			reg = <0 0x11d10084 0 0xff80>;
+		};
+
+		xs-phy@11e10000 {
+			compatible = "mediatek,mt7988-xsphy",
+				     "mediatek,xsphy";
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+			status = "disabled";
+
+			xphyu2port0: usb-phy@11e10000 {
+				reg = <0 0x11e10000 0 0x400>;
+				clocks = <&infracfg CLK_INFRA_USB_UTMI>;
+				clock-names = "ref";
+				#phy-cells = <1>;
+			};
+
+			xphyu3port0: usb-phy@11e13000 {
+				reg = <0 0x11e13400 0 0x500>;
+				clocks = <&infracfg CLK_INFRA_USB_PIPE>;
+				clock-names = "ref";
+				#phy-cells = <1>;
+				mediatek,syscon-type = <&topmisc 0x194 0>;
+			};
+		};
+
 		clock-controller@11f40000 {
 			compatible = "mediatek,mt7988-xfi-pll";
 			reg = <0 0x11f40000 0 0x1000>;
-- 
2.43.0



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

* [PATCH v3 8/8] arm64: dts: mediatek: mt7988a-bpi-r4: enable xsphy
  2025-04-16  9:53 [PATCH v3 0/8] Add Bananapi R4 variants and add xsphy Frank Wunderlich
                   ` (6 preceding siblings ...)
  2025-04-16  9:53 ` [PATCH v3 7/8] arm64: dts: mediatek: mt7988: Add xsphy for ssusb0/pcie2 Frank Wunderlich
@ 2025-04-16  9:54 ` Frank Wunderlich
  7 siblings, 0 replies; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-16  9:54 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Frank Wunderlich, Rafał Miłecki, Daniel Golle,
	Sean Wang, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, linux-phy

From: Frank Wunderlich <frank-w@public-files.de>

Enable XS-Phy on Bananapi R4 for pcie2.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi | 4 ++++
 arch/arm64/boot/dts/mediatek/mt7988a.dtsi                 | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi b/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi
index 0d332822971d..37e541a98ee1 100644
--- a/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi
@@ -397,3 +397,7 @@ &tphy {
 &watchdog {
 	status = "okay";
 };
+
+&xsphy {
+	status = "okay";
+};
diff --git a/arch/arm64/boot/dts/mediatek/mt7988a.dtsi b/arch/arm64/boot/dts/mediatek/mt7988a.dtsi
index 72792f4ccde3..868d6c0742e7 100644
--- a/arch/arm64/boot/dts/mediatek/mt7988a.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7988a.dtsi
@@ -560,7 +560,7 @@ topmisc: system-controller@11d10000 {
 			reg = <0 0x11d10084 0 0xff80>;
 		};
 
-		xs-phy@11e10000 {
+		xsphy: xs-phy@11e10000 {
 			compatible = "mediatek,mt7988-xsphy",
 				     "mediatek,xsphy";
 			#address-cells = <2>;
-- 
2.43.0



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

* Re: [PATCH v3 1/8] dt-bindings: arm: mediatek: add bpi-r4 2g5 phy variant
  2025-04-16  9:53 ` [PATCH v3 1/8] dt-bindings: arm: mediatek: add bpi-r4 2g5 phy variant Frank Wunderlich
@ 2025-04-17  6:28   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 16+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-17  6:28 UTC (permalink / raw)
  To: Frank Wunderlich
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno, Frank Wunderlich,
	Rafał Miłecki, Daniel Golle, Sean Wang, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, linux-phy

On Wed, Apr 16, 2025 at 11:53:53AM GMT, Frank Wunderlich wrote:
> From: Frank Wunderlich <frank-w@public-files.de>
> 
> Add new compatible for Bananapi R4 with 2.5G phy.
> Base board is compatible with existing BPI-R4 only 1 SFP is replaced
> by RJ45 port and use mt7988 internal phy.
> 
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> ---
> v3:
> - new patch adding compatible for 2.5g variant
> ---
>  Documentation/devicetree/bindings/arm/mediatek.yaml | 4 ++++
>  1 file changed, 4 insertions(+)

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof



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

* Re: [PATCH v3 3/8] dt-bindings: phy: mtk-xs-phy: Add mt7988 compatible
  2025-04-16  9:53 ` [PATCH v3 3/8] dt-bindings: phy: mtk-xs-phy: Add mt7988 compatible Frank Wunderlich
@ 2025-04-17  6:53   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 16+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-17  6:53 UTC (permalink / raw)
  To: Frank Wunderlich
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno, Frank Wunderlich,
	Rafał Miłecki, Daniel Golle, Sean Wang, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, linux-phy

On Wed, Apr 16, 2025 at 11:53:55AM GMT, Frank Wunderlich wrote:
> From: Frank Wunderlich <frank-w@public-files.de>
> 
> Add compatible for xs-phy on mt7988.
> 
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> ---
>  Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof



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

* Re: [PATCH v3 4/8] dt-bindings: phy: mtk-xs-phy: support type switch by pericfg
  2025-04-16  9:53 ` [PATCH v3 4/8] dt-bindings: phy: mtk-xs-phy: support type switch by pericfg Frank Wunderlich
@ 2025-04-17  6:56   ` Krzysztof Kozlowski
  2025-04-17  7:52     ` Frank Wunderlich (linux)
  0 siblings, 1 reply; 16+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-17  6:56 UTC (permalink / raw)
  To: Frank Wunderlich
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno, Frank Wunderlich,
	Rafał Miłecki, Daniel Golle, Sean Wang, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, linux-phy

On Wed, Apr 16, 2025 at 11:53:56AM GMT, Frank Wunderlich wrote:
> From: Frank Wunderlich <frank-w@public-files.de>
> 
> Add support for type switch by pericfg register between USB3/PCIe.
> 
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> ---
>  .../devicetree/bindings/phy/mediatek,xsphy.yaml  | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
> index 3b5253659e6f..5033d77c1239 100644
> --- a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
> +++ b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
> @@ -151,6 +151,22 @@ patternProperties:
>          minimum: 1
>          maximum: 31
>  
> +      mediatek,syscon-type:
> +        $ref: /schemas/types.yaml#/definitions/phandle-array
> +        maxItems: 1
> +        description:
> +          A phandle to syscon used to access the register of type switch,
> +          the field should always be 3 cells long.
> +        items:
> +          items:

Missing -, because you have one phandle.

> +            - description:
> +                The first cell represents a phandle to syscon

Don't repeat constraints in free form text. "Foo bar system controller"
or "Phandle to foo bar system controller"

> +            - description:
> +                The second cell represents the register offset

"Baz register offset"

> +            - description:
> +                The third cell represents the index of config segment

"Index of config segment", but what is index of config?

Best regards,
Krzysztof



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

* Re: [PATCH v3 4/8] dt-bindings: phy: mtk-xs-phy: support type switch by pericfg
  2025-04-17  6:56   ` Krzysztof Kozlowski
@ 2025-04-17  7:52     ` Frank Wunderlich (linux)
  2025-04-17  7:59       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 16+ messages in thread
From: Frank Wunderlich (linux) @ 2025-04-17  7:52 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno, Frank Wunderlich,
	Rafał Miłecki, Daniel Golle, Sean Wang, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, linux-phy

Hi Krzysztof,

thanks for review.

basicly i used the same binding like for tphy.

Am 2025-04-17 08:56, schrieb Krzysztof Kozlowski:
> On Wed, Apr 16, 2025 at 11:53:56AM GMT, Frank Wunderlich wrote:
>> From: Frank Wunderlich <frank-w@public-files.de>
>> 
>> Add support for type switch by pericfg register between USB3/PCIe.
>> 
>> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
>> ---
>>  .../devicetree/bindings/phy/mediatek,xsphy.yaml  | 16 
>> ++++++++++++++++
>>  1 file changed, 16 insertions(+)
>> 
>> diff --git a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml 
>> b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
>> index 3b5253659e6f..5033d77c1239 100644
>> --- a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
>> +++ b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
>> @@ -151,6 +151,22 @@ patternProperties:
>>          minimum: 1
>>          maximum: 31
>> 
>> +      mediatek,syscon-type:
>> +        $ref: /schemas/types.yaml#/definitions/phandle-array
>> +        maxItems: 1
>> +        description:
>> +          A phandle to syscon used to access the register of type 
>> switch,
>> +          the field should always be 3 cells long.
>> +        items:
>> +          items:
> 
> Missing -, because you have one phandle.

ok, then i need to drop MaxItems and indent 2 spaces more, but no 
problem

>> +            - description:
>> +                The first cell represents a phandle to syscon
> 
> Don't repeat constraints in free form text. "Foo bar system controller"
> or "Phandle to foo bar system controller"

i would write only "phandle to system controller". on mt7988 it is the 
topmisc syscon, but maybe on
other SoC it is different name.

>> +            - description:
>> +                The second cell represents the register offset
> 
> "Baz register offset"

same here, only "register offset".

>> +            - description:
>> +                The third cell represents the index of config segment
> 
> "Index of config segment", but what is index of config?

unfortunately we have no detailed documentation here, but based on 
driver (i guess daniel ported it
from SDK) this value is multiplied with BITS_PER_BYTE so it can handle 
up to 4 config-segments in
the 32bit register (maybe configuring 4 phys). But on mt7988 we use only 
the first config-segment
(last cell=0 in dts-patch).

at the end it will look like this:

       mediatek,syscon-type:
         $ref: /schemas/types.yaml#/definitions/phandle-array
         description:
           A phandle to syscon used to access the register of type 
switch,
           the field should always be 3 cells long.
         items:
           - items:
               - description:
                   Phandle to system controller
               - description:
                   Register offset
               - description:
                   Index of config segment
                 enum: [0, 1, 2, 3]

would this be ok?

> Best regards,
> Krzysztof

regards Frank


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

* Re: [PATCH v3 4/8] dt-bindings: phy: mtk-xs-phy: support type switch by pericfg
  2025-04-17  7:52     ` Frank Wunderlich (linux)
@ 2025-04-17  7:59       ` Krzysztof Kozlowski
  2025-04-17  9:35         ` Frank Wunderlich (linux)
  0 siblings, 1 reply; 16+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-17  7:59 UTC (permalink / raw)
  To: Frank Wunderlich (linux)
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno, Frank Wunderlich,
	Rafał Miłecki, Daniel Golle, Sean Wang, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, linux-phy

On 17/04/2025 09:52, Frank Wunderlich (linux) wrote:
>>>
>>> +      mediatek,syscon-type:
>>> +        $ref: /schemas/types.yaml#/definitions/phandle-array
>>> +        maxItems: 1
>>> +        description:
>>> +          A phandle to syscon used to access the register of type 
>>> switch,
>>> +          the field should always be 3 cells long.
>>> +        items:
>>> +          items:
>>
>> Missing -, because you have one phandle.
> 
> ok, then i need to drop MaxItems and indent 2 spaces more, but no 
> problem

I missed that maxItems - should not be placed above description, but
immediately around items.

> 
>>> +            - description:
>>> +                The first cell represents a phandle to syscon
>>
>> Don't repeat constraints in free form text. "Foo bar system controller"
>> or "Phandle to foo bar system controller"
> 
> i would write only "phandle to system controller". on mt7988 it is the 
> topmisc syscon, but maybe on
> other SoC it is different name.

This must be specific to what sort of system controller you point. You
are not interested in phandle to any system controller.

> 
>>> +            - description:
>>> +                The second cell represents the register offset
>>
>> "Baz register offset"
> 
> same here, only "register offset".

Also not. You need specific register, not any register.


Best regards,
Krzysztof


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

* Re: [PATCH v3 4/8] dt-bindings: phy: mtk-xs-phy: support type switch by pericfg
  2025-04-17  7:59       ` Krzysztof Kozlowski
@ 2025-04-17  9:35         ` Frank Wunderlich (linux)
  2025-04-17 12:07           ` Krzysztof Kozlowski
  0 siblings, 1 reply; 16+ messages in thread
From: Frank Wunderlich (linux) @ 2025-04-17  9:35 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno, Frank Wunderlich,
	Rafał Miłecki, Daniel Golle, Sean Wang, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, linux-phy

Am 2025-04-17 09:59, schrieb Krzysztof Kozlowski:
> On 17/04/2025 09:52, Frank Wunderlich (linux) wrote:
>>>> 
>>>> +      mediatek,syscon-type:
>>>> +        $ref: /schemas/types.yaml#/definitions/phandle-array
>>>> +        maxItems: 1
>>>> +        description:
>>>> +          A phandle to syscon used to access the register of type
>>>> switch,
>>>> +          the field should always be 3 cells long.
>>>> +        items:
>>>> +          items:
>>> 
>>> Missing -, because you have one phandle.
>> 
>> ok, then i need to drop MaxItems and indent 2 spaces more, but no
>> problem
> 
> I missed that maxItems - should not be placed above description, but
> immediately around items.

dt_binding_check complains about maxItems should not be set when having 
only 1 item ;)
so i dropped it in my current version completely.

>> 
>>>> +            - description:
>>>> +                The first cell represents a phandle to syscon
>>> 
>>> Don't repeat constraints in free form text. "Foo bar system 
>>> controller"
>>> or "Phandle to foo bar system controller"
>> 
>> i would write only "phandle to system controller". on mt7988 it is the
>> topmisc syscon, but maybe on
>> other SoC it is different name.
> 
> This must be specific to what sort of system controller you point. You
> are not interested in phandle to any system controller.

how about phy configuration controller/register?

>> 
>>>> +            - description:
>>>> +                The second cell represents the register offset
>>> 
>>> "Baz register offset"
>> 
>> same here, only "register offset".
> 
> Also not. You need specific register, not any register.
> 
> 
> Best regards,
> Krzysztof


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

* Re: [PATCH v3 4/8] dt-bindings: phy: mtk-xs-phy: support type switch by pericfg
  2025-04-17  9:35         ` Frank Wunderlich (linux)
@ 2025-04-17 12:07           ` Krzysztof Kozlowski
  0 siblings, 0 replies; 16+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-17 12:07 UTC (permalink / raw)
  To: Frank Wunderlich (linux)
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I,
	Matthias Brugger, AngeloGioacchino Del Regno, Frank Wunderlich,
	Rafał Miłecki, Daniel Golle, Sean Wang, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, linux-phy

On 17/04/2025 11:35, Frank Wunderlich (linux) wrote:
>>>>> +            - description:
>>>>> +                The first cell represents a phandle to syscon
>>>>
>>>> Don't repeat constraints in free form text. "Foo bar system 
>>>> controller"
>>>> or "Phandle to foo bar system controller"
>>>
>>> i would write only "phandle to system controller". on mt7988 it is the
>>> topmisc syscon, but maybe on
>>> other SoC it is different name.
>>
>> This must be specific to what sort of system controller you point. You
>> are not interested in phandle to any system controller.
> 
> how about phy configuration controller/register?
If that's distinctive enough to identify the controller and its
register, then sure.

Best regards,
Krzysztof


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

end of thread, other threads:[~2025-04-17 12:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-16  9:53 [PATCH v3 0/8] Add Bananapi R4 variants and add xsphy Frank Wunderlich
2025-04-16  9:53 ` [PATCH v3 1/8] dt-bindings: arm: mediatek: add bpi-r4 2g5 phy variant Frank Wunderlich
2025-04-17  6:28   ` Krzysztof Kozlowski
2025-04-16  9:53 ` [PATCH v3 2/8] arm64: dts: mediatek: mt7988a-bpi-r4: allow hw variants of bpi-r4 Frank Wunderlich
2025-04-16  9:53 ` [PATCH v3 3/8] dt-bindings: phy: mtk-xs-phy: Add mt7988 compatible Frank Wunderlich
2025-04-17  6:53   ` Krzysztof Kozlowski
2025-04-16  9:53 ` [PATCH v3 4/8] dt-bindings: phy: mtk-xs-phy: support type switch by pericfg Frank Wunderlich
2025-04-17  6:56   ` Krzysztof Kozlowski
2025-04-17  7:52     ` Frank Wunderlich (linux)
2025-04-17  7:59       ` Krzysztof Kozlowski
2025-04-17  9:35         ` Frank Wunderlich (linux)
2025-04-17 12:07           ` Krzysztof Kozlowski
2025-04-16  9:53 ` [PATCH v3 5/8] dt-bindings: mfd: syscon: Add mt7988-topmisc Frank Wunderlich
2025-04-16  9:53 ` [PATCH v3 6/8] phy: mediatek: xsphy: support type switch by pericfg Frank Wunderlich
2025-04-16  9:53 ` [PATCH v3 7/8] arm64: dts: mediatek: mt7988: Add xsphy for ssusb0/pcie2 Frank Wunderlich
2025-04-16  9:54 ` [PATCH v3 8/8] arm64: dts: mediatek: mt7988a-bpi-r4: enable xsphy Frank Wunderlich

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