From 2bd6ce05940f01b7df527012572a6f85cf56da26 Mon Sep 17 00:00:00 2001 From: GH Cao Date: Mon, 5 May 2025 02:22:27 +0800 Subject: [PATCH] feat: add a common 99pi dtsi for both variants --- arch/loongarch/boot/dts/ls2k300_99pi.dtsi | 184 ++++++++++++++++++ arch/loongarch/boot/dts/ls2k300_99pi_tf.dts | 179 +---------------- arch/loongarch/boot/dts/ls2k300_99pi_wifi.dts | 179 +---------------- 3 files changed, 186 insertions(+), 356 deletions(-) create mode 100644 arch/loongarch/boot/dts/ls2k300_99pi.dtsi diff --git a/arch/loongarch/boot/dts/ls2k300_99pi.dtsi b/arch/loongarch/boot/dts/ls2k300_99pi.dtsi new file mode 100644 index 000000000..fc4c73714 --- /dev/null +++ b/arch/loongarch/boot/dts/ls2k300_99pi.dtsi @@ -0,0 +1,184 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2025 Loongson Technology Corporation Limited + */ + +/ { + chosen { + stdout-path = "serial0:115200n8"; + bootargs = "earlycon"; + }; + + /* not need memory node, we get memory info from boot params. */ + + leds { + compatible = "gpio-leds"; + + led1 { + label = "led1"; + gpios = <&gpio 83 GPIO_ACTIVE_LOW>; + linux,default-trigger = "heartbeat"; + default-state = "on"; + }; + }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + linux,cma { + compatible = "shared-dma-pool"; + reusable; + size = <0 0x02000000>; + linux,cma-default; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&uart1 { + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&gmac0 { + status = "okay"; + phy-handle = <&yt8511h0>; + mdio { + compatible = "snps,dwmac-mdio"; + #address-cells = <1>; + #size-cells = <0>; + + yt8511h0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + motorcomm,led0_cfg = <0x40>; //千兆常亮 + motorcomm,led1_cfg = <0x30>; //百兆 十兆常亮 + motorcomm,led2_cfg = <0x2600>; //有数据时闪烁 + }; + }; +}; + +&i2c0 { + status = "okay"; +}; + +&i2c1 { + status = "okay"; +}; + +&i2c2 { + status = "disabled"; // 在 LCD 排线处 +}; + +&spi0 { + status = "okay"; + pinctrl-0 = <&qspi0_pins>; + pinctrl-names = "default"; + + spi-flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <25000000>; + reg = <0>; + }; +}; + +&spi1 { + status = "okay"; + + spidev0@0 { + compatible = "rohm,dh2228fv"; + reg = <0>; + spi-max-frequency = <25000000>; + }; +}; + +&spi2 { + status = "okay"; // 与 PWM0-3 的 MUX0 冲突 + + spidev1@0 { + compatible = "rohm,dh2228fv"; + reg = <0>; + spi-max-frequency = <25000000>; + }; +}; + +&timers1 { + status = "okay"; + /delete-property/ dmas; + /delete-property/ dma-names; + pinctrl-0 = <&atim3n_pin_m1>; // LCD PWM 背光,备用 + pinctrl-names = "default"; + + pwm { + compatible = "loongson,ls2k-pwm-timer"; + #pwm-cells = <2>; + status = "okay"; + }; +}; + +&timers2 { + status = "okay"; + dmas = <&dma 2 0x400>, <&dma 3 0x400>; + dma-names = "ch3", "ch4"; + pinctrl-0 = <>im2_pin_m1>, <>im3_pin_m1>; + pinctrl-names = "default"; + + pwm { + compatible = "loongson,ls2k-pwm-timer"; + #pwm-cells = <2>; + status = "okay"; + }; +}; + +&pwm0 { + status = "disabled"; + pinctrl-0 = <&pwm0_mux_m0>; + pinctrl-names = "default"; +}; + +&pwm1 { + status = "disabled"; + pinctrl-0 = <&pwm1_mux_m0>; + pinctrl-names = "default"; +}; + +&pwm2 { + status = "disabled"; + pinctrl-0 = <&pwm2_mux_m0>; + pinctrl-names = "default"; +}; + +&pwm3 { + status = "disabled"; + pinctrl-0 = <&pwm3_mux_m0>; + pinctrl-names = "default"; +}; + +&can2 { + status = "okay"; +}; + +&can3 { + status = "okay"; +}; + +&adc { + status = "okay"; +}; + +&rtc0 { + status = "okay"; +}; + +&sdio1 { + cd-gpios = <&gpio 82 GPIO_ACTIVE_LOW>; + status = "okay"; +}; diff --git a/arch/loongarch/boot/dts/ls2k300_99pi_tf.dts b/arch/loongarch/boot/dts/ls2k300_99pi_tf.dts index 785f0e490..adb702774 100644 --- a/arch/loongarch/boot/dts/ls2k300_99pi_tf.dts +++ b/arch/loongarch/boot/dts/ls2k300_99pi_tf.dts @@ -7,187 +7,10 @@ #include "loongson-2k0300.dtsi" #include "loongson_panel_param.dtsi" +#include "ls2k300_99pi.dtsi" / { model = "LS2K300-99PI-TF"; - - chosen { - stdout-path = "serial0:115200n8"; - bootargs = "earlycon"; - }; - - /* not need memory node, we get memory info from boot params. */ - - leds { - compatible = "gpio-leds"; - - led1 { - label = "led1"; - gpios = <&gpio 83 GPIO_ACTIVE_LOW>; - linux,default-trigger = "heartbeat"; - default-state = "on"; - }; - }; - - reserved-memory { - #address-cells = <2>; - #size-cells = <2>; - ranges; - - linux,cma { - compatible = "shared-dma-pool"; - reusable; - size = <0 0x02000000>; - linux,cma-default; - }; - }; -}; - -&uart0 { - status = "okay"; -}; - -&uart1 { - status = "okay"; -}; - -&uart2 { - status = "okay"; -}; - -&gmac0 { - status = "okay"; - phy-handle = <&yt8511h0>; - mdio { - compatible = "snps,dwmac-mdio"; - #address-cells = <1>; - #size-cells = <0>; - - yt8511h0: ethernet-phy@0 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <0>; - motorcomm,led0_cfg = <0x40>; //千兆常亮 - motorcomm,led1_cfg = <0x30>; //百兆 十兆常亮 - motorcomm,led2_cfg = <0x2600>; //有数据时闪烁 - }; - }; -}; - -&i2c0 { - status = "okay"; -}; - -&i2c1 { - status = "okay"; -}; - -&i2c2 { - status = "disabled"; // 在 LCD 排线处 -}; - -&spi0 { - status = "okay"; - pinctrl-0 = <&qspi0_pins>; - pinctrl-names = "default"; - - spi-flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <25000000>; - reg = <0>; - }; -}; - -&spi1 { - status = "okay"; - - spidev0@0 { - compatible = "rohm,dh2228fv"; - reg = <0>; - spi-max-frequency = <25000000>; - }; -}; - -&spi2 { - status = "okay"; // 与 PWM0-3 的 MUX0 冲突 - - spidev1@0 { - compatible = "rohm,dh2228fv"; - reg = <0>; - spi-max-frequency = <25000000>; - }; -}; - -&timers1 { - status = "okay"; - /delete-property/ dmas; - /delete-property/ dma-names; - pinctrl-0 = <&atim3n_pin_m1>; // LCD PWM 背光,备用 - pinctrl-names = "default"; - - pwm { - compatible = "loongson,ls2k-pwm-timer"; - #pwm-cells = <2>; - status = "okay"; - }; -}; - -&timers2 { - status = "okay"; - dmas = <&dma 2 0x400>, <&dma 3 0x400>; - dma-names = "ch3", "ch4"; - pinctrl-0 = <>im2_pin_m1>, <>im3_pin_m1>; - pinctrl-names = "default"; - - pwm { - compatible = "loongson,ls2k-pwm-timer"; - #pwm-cells = <2>; - status = "okay"; - }; -}; - -&pwm0 { - status = "disabled"; - pinctrl-0 = <&pwm0_mux_m0>; - pinctrl-names = "default"; -}; - -&pwm1 { - status = "disabled"; - pinctrl-0 = <&pwm1_mux_m0>; - pinctrl-names = "default"; -}; - -&pwm2 { - status = "disabled"; - pinctrl-0 = <&pwm2_mux_m0>; - pinctrl-names = "default"; -}; - -&pwm3 { - status = "disabled"; - pinctrl-0 = <&pwm3_mux_m0>; - pinctrl-names = "default"; -}; - -&can2 { - status = "okay"; -}; - -&can3 { - status = "okay"; -}; - -&adc { - status = "okay"; -}; - -&rtc0 { - status = "okay"; -}; - -&sdio1 { - cd-gpios = <&gpio 82 GPIO_ACTIVE_LOW>; - status = "okay"; }; &emmc { diff --git a/arch/loongarch/boot/dts/ls2k300_99pi_wifi.dts b/arch/loongarch/boot/dts/ls2k300_99pi_wifi.dts index c18776b7e..ac9c4211d 100644 --- a/arch/loongarch/boot/dts/ls2k300_99pi_wifi.dts +++ b/arch/loongarch/boot/dts/ls2k300_99pi_wifi.dts @@ -7,185 +7,8 @@ #include "loongson-2k0300.dtsi" #include "loongson_panel_param.dtsi" +#include "ls2k300_99pi.dtsi" / { model = "LS2K300-99PI-WIFI"; - - chosen { - stdout-path = "serial0:115200n8"; - bootargs = "earlycon"; - }; - - /* not need memory node, we get memory info from boot params. */ - - leds { - compatible = "gpio-leds"; - - led1 { - label = "led1"; - gpios = <&gpio 83 GPIO_ACTIVE_LOW>; - linux,default-trigger = "heartbeat"; - default-state = "on"; - }; - }; - - reserved-memory { - #address-cells = <2>; - #size-cells = <2>; - ranges; - - linux,cma { - compatible = "shared-dma-pool"; - reusable; - size = <0 0x02000000>; - linux,cma-default; - }; - }; -}; - -&uart0 { - status = "okay"; -}; - -&uart1 { - status = "okay"; -}; - -&uart2 { - status = "okay"; -}; - -&gmac0 { - status = "okay"; - phy-handle = <&yt8511h0>; - mdio { - compatible = "snps,dwmac-mdio"; - #address-cells = <1>; - #size-cells = <0>; - - yt8511h0: ethernet-phy@0 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <0>; - motorcomm,led0_cfg = <0x40>; //千兆常亮 - motorcomm,led1_cfg = <0x30>; //百兆 十兆常亮 - motorcomm,led2_cfg = <0x2600>; //有数据时闪烁 - }; - }; -}; - -&i2c0 { - status = "okay"; -}; - -&i2c1 { - status = "okay"; -}; - -&i2c2 { - status = "disabled"; // 在 LCD 排线处 -}; - -&spi0 { - status = "okay"; - pinctrl-0 = <&qspi0_pins>; - pinctrl-names = "default"; - - spi-flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <25000000>; - reg = <0>; - }; -}; - -&spi1 { - status = "okay"; - - spidev0@0 { - compatible = "rohm,dh2228fv"; - reg = <0>; - spi-max-frequency = <25000000>; - }; -}; - -&spi2 { - status = "okay"; // 与 PWM0-3 的 MUX0 冲突 - - spidev1@0 { - compatible = "rohm,dh2228fv"; - reg = <0>; - spi-max-frequency = <25000000>; - }; -}; - -&timers1 { - status = "okay"; - /delete-property/ dmas; - /delete-property/ dma-names; - pinctrl-0 = <&atim3n_pin_m1>; // LCD PWM 背光,备用 - pinctrl-names = "default"; - - pwm { - compatible = "loongson,ls2k-pwm-timer"; - #pwm-cells = <2>; - status = "okay"; - }; -}; - -&timers2 { - status = "okay"; - dmas = <&dma 2 0x400>, <&dma 3 0x400>; - dma-names = "ch3", "ch4"; - pinctrl-0 = <>im2_pin_m1>, <>im3_pin_m1>; - pinctrl-names = "default"; - - pwm { - compatible = "loongson,ls2k-pwm-timer"; - #pwm-cells = <2>; - status = "okay"; - }; -}; - -&pwm0 { - status = "disabled"; - pinctrl-0 = <&pwm0_mux_m0>; - pinctrl-names = "default"; -}; - -&pwm1 { - status = "disabled"; - pinctrl-0 = <&pwm1_mux_m0>; - pinctrl-names = "default"; -}; - -&pwm2 { - status = "disabled"; - pinctrl-0 = <&pwm2_mux_m0>; - pinctrl-names = "default"; -}; - -&pwm3 { - status = "disabled"; - pinctrl-0 = <&pwm3_mux_m0>; - pinctrl-names = "default"; -}; - -&can2 { - status = "okay"; -}; - -&can3 { - status = "okay"; -}; - -&adc { - status = "okay"; -}; - -&rtc0 { - status = "okay"; -}; - -&sdio1 { - cd-gpios = <&gpio 82 GPIO_ACTIVE_LOW>; - status = "okay"; };