From: Frank Li <[email protected]>

Add a GPIO mux controller to describe the onboard signal multiplexer.
Previously, the device tree relied on the hardware reset defaults to
select the mux state. Now that the kernel supports the pinctrl-multiplexer
framework, describe the onboard mux explicitly and let the kernel configure
the required routing.

Prepare for additional device tree overlays that require different mux
configurations.

Remove the regulator-m2uart1sel node, which incorrectly modeled the board
mux as a regulator.

There are no backward compatibility concerns, as the affected functions
(lpuart1 for Bluetooth, spi3, and m4_lpuart) are not used by existing other
users such as U-Boot.

Signed-off-by: Frank Li <[email protected]>
---
 arch/arm64/boot/dts/freescale/imx8dxl-evk.dts | 76 +++++++++++++++++++++++----
 1 file changed, 65 insertions(+), 11 deletions(-)

diff --git a/arch/arm64/boot/dts/freescale/imx8dxl-evk.dts 
b/arch/arm64/boot/dts/freescale/imx8dxl-evk.dts
index 78e8d41e67916..33941645641f5 100644
--- a/arch/arm64/boot/dts/freescale/imx8dxl-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8dxl-evk.dts
@@ -97,14 +97,68 @@ vdevbuffer: memory-vdevbuffer@90400000 {
                };
        };
 
-       m2_uart1_sel: regulator-m2uart1sel {
-               compatible = "regulator-fixed";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-               regulator-name = "m2_uart1_sel";
-               gpio = <&pca6416_1 6 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
-               regulator-always-on;
+       m4_debug_mux: mux-controller-0 {
+               compatible = "gpio-mux";
+               #mux-control-cells = <0>;
+               #mux-state-cells = <1>;
+               mux-gpios = <&pca6416_1 3 GPIO_ACTIVE_HIGH>;
+       };
+
+       spi3_mux: mux-controller-1 {
+               compatible = "gpio-mux";
+               #mux-control-cells = <0>;
+               #mux-state-cells = <1>;
+               mux-gpios = <&pca6416_1 4 GPIO_ACTIVE_HIGH>;
+       };
+
+       uart1_mux: mux-controller-2 {
+               compatible = "gpio-mux";
+               #mux-control-cells = <0>;
+               #mux-state-cells = <1>;
+               mux-gpios = <&pca6416_1 6 GPIO_ACTIVE_HIGH>;
+       };
+
+       spi0_mux: mux-controller-3 {
+               compatible = "gpio-mux";
+               #mux-control-cells = <0>;
+               #mux-state-cells = <1>;
+               mux-gpios = <&pca6416_1 7 GPIO_ACTIVE_HIGH>;
+       };
+
+       pinctrl-gpiomux {
+               compatible = "pinctrl-multiplexer";
+
+               m4_debug_fun: cm4-uart-grp {
+                       mux-states = <&m4_debug_mux 1>;
+               };
+
+               spi0_fun: spi0-grp {
+                       mux-states = <&spi0_mux 1>;
+               };
+
+               spi3_fun: spi3-grp {
+                       mux-states = <&spi3_mux 1>;
+               };
+
+               uart1_fun: uart1-grp {
+                       mux-states = <&uart1_mux 1>;
+               };
+
+               lcd_0_fun: lcd0-grp {
+                       mux-states = <&spi0_mux 0>;
+               };
+
+               lcd_1_fun: lcd1-grp {
+                       mux-states = <&spi3_mux 0>;
+               };
+
+               lcd_2_fun: lcd2-grp {
+                       mux-states = <&uart1_mux 0>;
+               };
+
+               lcd_3_fun: lcd3-grp {
+                       mux-states = <&m4_debug_mux 0>;
+               };
        };
 
        mux3_en: regulator-0 {
@@ -620,7 +674,7 @@ &lpuart0 {
 
 &lpuart1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_lpuart1>;
+       pinctrl-0 = <&pinctrl_lpuart1>, <&uart1_fun>;
        status = "okay";
 
        bluetooth {
@@ -658,7 +712,7 @@ &cm40_intmux {
 
 &cm40_lpuart {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_cm40_lpuart>;
+       pinctrl-0 = <&pinctrl_cm40_lpuart>, <&m4_debug_fun>;
        status = "disabled";
 };
 
@@ -876,7 +930,7 @@ &usdhc2 {
 &lpspi3 {
        fsl,spi-only-use-cs1-sel;
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_lpspi3>;
+       pinctrl-0 = <&pinctrl_lpspi3>, <&spi3_fun>;
        status = "okay";
 };
 

-- 
2.43.0

Reply via email to