Skip to contentSkip to conversation

ARM: wolfvision PF5: Use upstream IO expander dtso

PATCH Applied Sascha Hauer 2 participants 5 messages Oct 1, 2024 – Oct 2, 2024 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ARM: wolfvision PF5: Use upstream IO expander dtso

rk3568-wolfvision-pf5-io-expander-upstream.dtso has been merged in the upstream dts files, so switch to using the upstream version.

---
 ...8-wolfvision-pf5-io-expander-upstream.dtso | 137 ------------------
 .../rk3568-wolfvision-pf5-io-expander.dtso    |   2 +-
 2 files changed, 1 insertion(+), 138 deletions(-)
 delete mode 100644 arch/arm/dts/rk3568-wolfvision-pf5-io-expander-upstream.dtso
arch/arm/dts/rk3568-wolfvision-pf5-io-expander-upstream.dtso deleted +0 -137
deleted file mode 100644
index ebcaeafc38..0000000000
@@ -1,137 +0,0 @@
-// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT)
-/*
- * Device tree overlay for the WolfVision PF5 IO Expander board.
- *
- * Copyright (C) 2024 WolfVision GmbH.
- */
-
-/dts-v1/;
-/plugin/;
-
-#include <dt-bindings/clock/rk3568-cru.h>
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/interrupt-controller/irq.h>
-#include <dt-bindings/pinctrl/rockchip.h>
-
-&{/} {
-	gmac0_clkin: external-gmac0-clock {
-		compatible = "fixed-clock";
-		clock-frequency = <50000000>;
-		clock-output-names = "gmac0_clkin";
-		#clock-cells = <0>;
-	};
-
-	usb_host_vbus: usb-host-vbus-regulator {
-		compatible = "regulator-fixed";
-		enable-active-high;
-		gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&usb_host_vbus_en>;
-		regulator-name = "usb_host_vbus";
-		regulator-min-microvolt = <5000000>;
-		regulator-max-microvolt = <5000000>;
-		vin-supply = <&vcc5v_in>;
-	};
-
-	vcc1v8_eth: vcc1v8-eth-regulator {
-		compatible = "regulator-fixed";
-		enable-active-high;
-		gpio = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&vcc1v8_eth_en>;
-		regulator-always-on;
-		regulator-boot-on;
-		regulator-name = "1v8_eth";
-		regulator-min-microvolt = <1800000>;
-		regulator-max-microvolt = <1800000>;
-		vin-supply = <&vcc3v3_sys>;
-	};
-
-	vcc3v3_eth: vcc3v3-eth-regulator {
-		compatible = "regulator-fixed";
-		enable-active-low;
-		gpio = <&gpio0 RK_PC0 GPIO_ACTIVE_LOW>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&vcc3v3_eth_enn>;
-		regulator-always-on;
-		regulator-boot-on;
-		regulator-name = "3v3_eth";
-		regulator-min-microvolt = <3300000>;
-		regulator-max-microvolt = <3300000>;
-		vin-supply = <&vcc3v3_sys>;
-	};
-};
-
-&gmac0 {
-	assigned-clocks = <&cru SCLK_GMAC0_RX_TX>,
-			  <&cru SCLK_GMAC0>;
-	assigned-clock-parents = <&cru SCLK_GMAC0_RMII_SPEED>,
-				 <&gmac0_clkin>;
-	clock_in_out = "input";
-	phy-handle = <&dp83826>;
-	phy-mode = "rmii";
-	phy-supply = <&vcc3v3_eth>;
-	pinctrl-names = "default";
-	pinctrl-0 = <&gmac0_miim
-		     &gmac0_clkinout
-		     &gmac0_rx_er
-		     &gmac0_rx_bus2
-		     &gmac0_tx_bus2>;
-	status = "okay";
-};
-
-&mdio0 {
-	#address-cells = <1>;
-	#size-cells = <0>;
-
-	dp83826: ethernet-phy@0 {
-		compatible = "ethernet-phy-ieee802.3-c22";
-		reg = <0x0>;
-		interrupt-parent = <&gpio0>;
-		interrupts = <RK_PD3 IRQ_TYPE_EDGE_FALLING>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&eth_wake_intn &eth_phy_rstn>;
-		reset-assert-us = <1000>;
-		reset-deassert-us = <2000>;
-		reset-gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_LOW>;
-		wakeup-source;
-	};
-};
-
-&pinctrl {
-	ethernet {
-		eth_wake_intn: eth-wake-intn-pinctrl {
-			rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-
-		eth_phy_rstn: eth-phy-rstn-pinctrl {
-			rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-
-		vcc1v8_eth_en: vcc1v8-eth-en-pinctrl {
-			rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-
-		vcc3v3_eth_enn: vcc3v3-eth-enn-pinctrl {
-			rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-	};
-
-	usb {
-		usb_host_vbus_en: usb-host-vbus-en-pinctrl {
-			rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-	};
-};
-
-&usb_host1_xhci {
-	maximum-speed = "high-speed";
-	phys = <&usb2phy0_host>;
-	phy-names = "usb2-phy";
-	status = "okay";
-};
-
-&usb2phy0_host {
-	phy-supply = <&usb_host_vbus>;
-	status = "okay";
-};
arch/arm/dts/rk3568-wolfvision-pf5-io-expander.dtso +1 -1
index 37b48afd2d..5160a7ec1a 100644
@@ -8,4 +8,4 @@
 /dts-v1/;
 /plugin/;
 
-#include "rk3568-wolfvision-pf5-io-expander-upstream.dtso"
+#include <arm64/rockchip/rk3568-wolfvision-pf5-io-expander.dtso>
Signature · 1 line
2.39.5
#1 lore raw

PATCH 2/3 ARM: Wolfvision PF5: of_probe only once

When overlays have been applied we have to call of_clk_init() and of_probe() once to have the changes from the overlays take effect. We only have to do it once though after all overlays have been applied, not after each overlay.

Doing it after each overlay has the undesired side effect that the VOP2 will be probed right after the io-expander board has been detected. At that time the display overlay is not yet included, so the VOP2 probes without the display and it won't be available later.

---
 common/boards/wolfvision/common.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
common/boards/wolfvision/common.c +10 -3
index 9a56b39b01..fe3417e81f 100644
@@ -48,8 +48,7 @@ int wolfvision_apply_overlay(const struct wv_overlay *overlay, char **files)
 			return ret;
 		}
 
-		of_clk_init();
-		of_probe();
+		return 1;
 	}
 
 	return 0;
@@ -106,6 +105,7 @@ int wolfvision_rk3568_detect_hw(const struct wv_rk3568_extension *extensions,
 				int num_extensions, char **overlays)
 {
 	int i, hwid, ret;
+	bool do_of_probe = false;
 
 	ret = of_device_ensure_probed_by_alias("saradc");
 	if (ret)
@@ -130,12 +130,19 @@ int wolfvision_rk3568_detect_hw(const struct wv_rk3568_extension *extensions,
 		if (overlay->name) {
 			pr_info("Detected %s %s\n", overlay->name,
 				extension->name);
-			wolfvision_apply_overlay(overlay, overlays);
+			ret = wolfvision_apply_overlay(overlay, overlays);
+			if (ret > 0)
+				do_of_probe = true;
 		} else {
 			pr_warning("Detected unknown %s HWID %d\n",
 				   extension->name, hwid);
 		}
 	}
 
+	if (do_of_probe) {
+		of_clk_init();
+		of_probe();
+	}
+
 	return 0;
 }
Signature · 1 line
2.39.5
#2 lore raw

PATCH 3/3 ARM: Wolfvision PF5: add display overlay

In reply to Sascha Hauer

The Wolfvision PF5 can have a display connected to it. The presence of the display can be checked for using an analog input. Include the corresponding device tree overlay when the display is connected.

---
 arch/arm/boards/wolfvision-pf5/board.c            | 15 +++++++++++++++
 arch/arm/dts/Makefile                             |  4 ++--
 .../arm/dts/rk3568-wolfvision-pf5-display-vz.dtso | 11 +++++++++++
 3 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/rk3568-wolfvision-pf5-display-vz.dtso
arch/arm/boards/wolfvision-pf5/board.c +15 -0
index 5a2f4201ba..c2a6963c0f 100644
@@ -15,15 +15,19 @@
 #include <boards/wolfvision/common.h>
 #include <mach/rockchip/bbu.h>
 
+#define PF5_DISPLAY_VZ_FILENAME "rk3568-wolfvision-pf5-display-vz.dtbo"
+#define PF5_DISPLAY_VZ_DATA __dtbo_rk3568_wolfvision_pf5_display_vz_start
 #define PF5_IO_EXPANDER_FILENAME "rk3568-wolfvision-pf5-io-expander.dtbo"
 #define PF5_IO_EXPANDER_DATA __dtbo_rk3568_wolfvision_pf5_io_expander_start
 
 enum {
 	PF5_HWID_CHANNEL_MAINBOARD = 1,
 	PF5_HWID_CHANNEL_MODULE = 2,
+	PF5_HWID_CHANNEL_DISPLAY = 3,
 };
 
 extern char PF5_IO_EXPANDER_DATA[];
+extern char PF5_DISPLAY_VZ_DATA[];
 
 static const struct wv_rk3568_extension pf5_extensions[] = {
 	{
@@ -45,6 +49,17 @@ static const struct wv_rk3568_extension pf5_extensions[] = {
 			[16] = { .name = "no", },
 		},
 	},
+	{
+		.adc_chan = PF5_HWID_CHANNEL_DISPLAY,
+		.name = "display",
+		.overlays = {
+			[0] = { .name = "Visualizer",
+				.filename = PF5_DISPLAY_VZ_FILENAME,
+				.data = PF5_DISPLAY_VZ_DATA,
+			},
+			[16] = { .name = "no" },
+		},
+	},
 };
 
 static int pf5_probe(struct device *dev)
arch/arm/dts/Makefile +2 -2
index 654d221fa3..fe32b812f6 100644
@@ -231,6 +231,6 @@ lwl-$(CONFIG_MACH_VARISCITE_DT8MCUSTOMBOARD_IMX8MP) += imx8mp-var-dart-dt8mcusto
 lwl-$(CONFIG_MACH_TQMA93XX) += imx93-tqma9352-mba93xxca.dtb.o \
 			       imx93-tqma9352-mba93xxla.dtb.o
 
-obj-$(CONFIG_MACH_WOLFVISION_PF5) += rk3568-wolfvision-pf5-io-expander.dtbo.o
-
+obj-$(CONFIG_MACH_WOLFVISION_PF5) += rk3568-wolfvision-pf5-io-expander.dtbo.o \
+				     rk3568-wolfvision-pf5-display-vz.dtbo.o
 clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts *.dtb.z
arch/arm/dts/rk3568-wolfvision-pf5-display-vz.dtso new file +11 -0
new file mode 100644
index 0000000000..0e57a6660e
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT)
+/*
+ * Device tree overlay for the WolfVision PF5 Visualizer display.
+ *
+ * Copyright (C) 2024 WolfVision GmbH.
+ */
+
+/dts-v1/;
+/plugin/;
+
+#include <arm64/rockchip/rk3568-wolfvision-pf5-display-vz.dtso>
Signature · 1 line
2.39.5
Reviewed-by on v1 1/3
#3 lore raw
In reply to Sascha Hauer

Hi Sascha,

Very nice, thanks for the patches.

Quoted 4 lines · Sascha Hauer

rk3568-wolfvision-pf5-io-expander-upstream.dtso has been merged in the upstream dts files, so switch to using the upstream version.

Regards, Michael

Quoted 159 lines
---
 ...8-wolfvision-pf5-io-expander-upstream.dtso | 137 ------------------
 .../rk3568-wolfvision-pf5-io-expander.dtso    |   2 +-
 2 files changed, 1 insertion(+), 138 deletions(-)
 delete mode 100644 arch/arm/dts/rk3568-wolfvision-pf5-io-expander-upstream.dtso
arch/arm/dts/rk3568-wolfvision-pf5-io-expander-upstream.dtso deleted +0 -137
deleted file mode 100644
index ebcaeafc38..0000000000
@@ -1,137 +0,0 @@
-// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT)
-/*
- * Device tree overlay for the WolfVision PF5 IO Expander board.
- *
- * Copyright (C) 2024 WolfVision GmbH.
- */
-
-/dts-v1/;
-/plugin/;
-
-#include <dt-bindings/clock/rk3568-cru.h>
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/interrupt-controller/irq.h>
-#include <dt-bindings/pinctrl/rockchip.h>
-
-&{/} {
-	gmac0_clkin: external-gmac0-clock {
-		compatible = "fixed-clock";
-		clock-frequency = <50000000>;
-		clock-output-names = "gmac0_clkin";
-		#clock-cells = <0>;
-	};
-
-	usb_host_vbus: usb-host-vbus-regulator {
-		compatible = "regulator-fixed";
-		enable-active-high;
-		gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&usb_host_vbus_en>;
-		regulator-name = "usb_host_vbus";
-		regulator-min-microvolt = <5000000>;
-		regulator-max-microvolt = <5000000>;
-		vin-supply = <&vcc5v_in>;
-	};
-
-	vcc1v8_eth: vcc1v8-eth-regulator {
-		compatible = "regulator-fixed";
-		enable-active-high;
-		gpio = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&vcc1v8_eth_en>;
-		regulator-always-on;
-		regulator-boot-on;
-		regulator-name = "1v8_eth";
-		regulator-min-microvolt = <1800000>;
-		regulator-max-microvolt = <1800000>;
-		vin-supply = <&vcc3v3_sys>;
-	};
-
-	vcc3v3_eth: vcc3v3-eth-regulator {
-		compatible = "regulator-fixed";
-		enable-active-low;
-		gpio = <&gpio0 RK_PC0 GPIO_ACTIVE_LOW>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&vcc3v3_eth_enn>;
-		regulator-always-on;
-		regulator-boot-on;
-		regulator-name = "3v3_eth";
-		regulator-min-microvolt = <3300000>;
-		regulator-max-microvolt = <3300000>;
-		vin-supply = <&vcc3v3_sys>;
-	};
-};
-
-&gmac0 {
-	assigned-clocks = <&cru SCLK_GMAC0_RX_TX>,
-			  <&cru SCLK_GMAC0>;
-	assigned-clock-parents = <&cru SCLK_GMAC0_RMII_SPEED>,
-				 <&gmac0_clkin>;
-	clock_in_out = "input";
-	phy-handle = <&dp83826>;
-	phy-mode = "rmii";
-	phy-supply = <&vcc3v3_eth>;
-	pinctrl-names = "default";
-	pinctrl-0 = <&gmac0_miim
-		     &gmac0_clkinout
-		     &gmac0_rx_er
-		     &gmac0_rx_bus2
-		     &gmac0_tx_bus2>;
-	status = "okay";
-};
-
-&mdio0 {
-	#address-cells = <1>;
-	#size-cells = <0>;
-
-	dp83826: ethernet-phy@0 {
-		compatible = "ethernet-phy-ieee802.3-c22";
-		reg = <0x0>;
-		interrupt-parent = <&gpio0>;
-		interrupts = <RK_PD3 IRQ_TYPE_EDGE_FALLING>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&eth_wake_intn &eth_phy_rstn>;
-		reset-assert-us = <1000>;
-		reset-deassert-us = <2000>;
-		reset-gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_LOW>;
-		wakeup-source;
-	};
-};
-
-&pinctrl {
-	ethernet {
-		eth_wake_intn: eth-wake-intn-pinctrl {
-			rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-
-		eth_phy_rstn: eth-phy-rstn-pinctrl {
-			rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-
-		vcc1v8_eth_en: vcc1v8-eth-en-pinctrl {
-			rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-
-		vcc3v3_eth_enn: vcc3v3-eth-enn-pinctrl {
-			rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-	};
-
-	usb {
-		usb_host_vbus_en: usb-host-vbus-en-pinctrl {
-			rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-	};
-};
-
-&usb_host1_xhci {
-	maximum-speed = "high-speed";
-	phys = <&usb2phy0_host>;
-	phy-names = "usb2-phy";
-	status = "okay";
-};
-
-&usb2phy0_host {
-	phy-supply = <&usb_host_vbus>;
-	status = "okay";
-};
arch/arm/dts/rk3568-wolfvision-pf5-io-expander.dtso +1 -1
index 37b48afd2d..5160a7ec1a 100644
@@ -8,4 +8,4 @@
 /dts-v1/;
 /plugin/;
 
-#include "rk3568-wolfvision-pf5-io-expander-upstream.dtso"
+#include <arm64/rockchip/rk3568-wolfvision-pf5-io-expander.dtso>
author Applied
#4 lore raw
In reply to Sascha Hauer
Quoted 4 lines · Sascha Hauer

rk3568-wolfvision-pf5-io-expander-upstream.dtso has been merged in the upstream dts files, so switch to using the upstream version.

Applied, thanks!

[1/3] ARM: wolfvision PF5: Use upstream IO expander dtso
https://git.pengutronix.de/cgit/barebox/commit/?id=234f36ad4082 (link may not be stable)
[2/3] ARM: Wolfvision PF5: of_probe only once
https://git.pengutronix.de/cgit/barebox/commit/?id=281aa901624e (link may not be stable)
[3/3] ARM: Wolfvision PF5: add display overlay
https://git.pengutronix.de/cgit/barebox/commit/?id=3ed7b0ebc507 (link may not be stable)

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>