From 155d9244265942a1d51bd737e42c5057d35ae908 Mon Sep 17 00:00:00 2001 From: SuperKali Date: Fri, 19 Sep 2025 08:08:28 +0200 Subject: [PATCH] board: NanoPi M5 add initial support (#400) --- arch/arm64/boot/dts/rockchip/Makefile | 1 + .../boot/dts/rockchip/rk3576-nanopi-m5.dts | 336 ++++++++++++++++++ .../dts/rockchip/rk3576-nanopi5-common.dtsi | 25 -- 3 files changed, 337 insertions(+), 25 deletions(-) create mode 100644 arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile index e0b98e9548ae..584dcb347b22 100644 --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile @@ -333,6 +333,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3576-vehicle-evb-v10-linux.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3576-vehicle-evb-v20.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3576-vehicle-evb-v20-linux.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3576-nanopi-r76s.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3576-nanopi-m5.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3576s-evb1-v10.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3576s-evb1-v10-linux.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3576s-tablet-v10.dtb diff --git a/arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts b/arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts new file mode 100644 index 000000000000..75326d291cec --- /dev/null +++ b/arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts @@ -0,0 +1,336 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2025 FriendlyElec Computer Tech. Co., Ltd. + * (http://www.friendlyelec.com) + */ + +/dts-v1/; + +#include "rk3576-nanopi5-common.dtsi" + +/ { + model = "FriendlyElec NanoPi M5"; + compatible = "friendlyelec,nanopi-m5", "rockchip,rk3576"; + + /delete-node/ chosen; + + gpio_keys: gpio-keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&key1_pin>; + + button@1 { + debounce-interval = <50>; + gpios = <&gpio1 RK_PA0 GPIO_ACTIVE_LOW>; + label = "K1"; + linux,code = ; + wakeup-source; + }; + }; + + gpio_leds: gpio-leds { + compatible = "gpio-leds"; + + sys_led: led-0 { + gpios = <&gpio2 RK_PB3 GPIO_ACTIVE_HIGH>; + label = "sys_led"; + linux,default-trigger = "heartbeat"; + pinctrl-names = "default"; + pinctrl-0 = <&sys_led_pin>; + }; + + lan_led: led-1 { + gpios = <&gpio2 RK_PB0 GPIO_ACTIVE_HIGH>; + label = "lan_led"; + pinctrl-names = "default"; + pinctrl-0 = <&lan_led_pin>; + }; + + wan_led: led-2 { + gpios = <&gpio4 RK_PC5 GPIO_ACTIVE_HIGH>; + label = "wan_led"; + pinctrl-names = "default"; + pinctrl-0 = <&wan_led_pin>; + }; + }; + + rt5616_sound: rt5616-sound { + status = "okay"; + compatible = "simple-audio-card"; + pinctrl-names = "default"; + pinctrl-0 = <&hp_det>; + + simple-audio-card,name = "realtek,rt5616-codec"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + + simple-audio-card,hp-det-gpio = <&gpio2 RK_PD6 GPIO_ACTIVE_LOW>; + simple-audio-card,hp-pin-name = "Headphone Jack"; + + simple-audio-card,widgets = + "Headphone", "Headphone Jack", + "Microphone", "Microphone Jack"; + simple-audio-card,routing = + "Headphone Jack", "HPOL", + "Headphone Jack", "HPOR", + "MIC1", "Microphone Jack", + "Microphone Jack", "micbias1"; + + simple-audio-card,cpu { + sound-dai = <&sai2>; + }; + simple-audio-card,codec { + sound-dai = <&rt5616>; + }; + }; +}; + +&i2c5 { + status = "okay"; + clock-frequency = <200000>; + pinctrl-0 = <&i2c5m3_xfer>; + + rt5616: rt5616@1b { + status = "okay"; + #sound-dai-cells = <0>; + compatible = "rt5616"; + reg = <0x1b>; + clocks = <&mclkout_sai2>; + clock-names = "mclk"; + assigned-clocks = <&mclkout_sai2>; + assigned-clock-rates = <12288000>; + pinctrl-names = "default"; + pinctrl-0 = <&sai2m0_mclk>; + }; +}; + +&i2c8 { + clock-frequency = <200000>; + pinctrl-0 = <&i2c8m2_xfer>; +}; + +&pinctrl { + gpio-key { + key1_pin: key1-pin { + rockchip,pins = <4 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + gpio-leds { + sys_led_pin: sys-led-pin { + rockchip,pins = <2 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + lan_led_pin: lan-led-pin { + rockchip,pins = <2 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + wan_led_pin: wan-led-pin { + rockchip,pins = <4 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <2 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&sai2 { + status = "okay"; +}; + +&sdhci { + status = "disabled"; +}; + +&sdio_pwrseq { + status = "okay"; +}; + +&sdio { + status = "okay"; + vqmmc-supply = <&vcc_1v8_s0>; + sd-uhs-sdr104; + #address-cells = <1>; + #size-cells = <0>; + + rtl8822cs@1 { + reg = <1>; + compatible = "realtek,rtl8822cs"; + }; +}; + +&fspi1m1_pins { + rockchip,pins = + /* clk, d0~4 */ + <1 RK_PD5 3 &pcfg_pull_none>, + <1 RK_PC4 3 &pcfg_pull_none>, + <1 RK_PC5 3 &pcfg_pull_none>, + <1 RK_PC6 3 &pcfg_pull_none>, + <1 RK_PC7 3 &pcfg_pull_none>; +}; + +&sfc1 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&fspi1m1_csn0 &fspi1m1_pins>; + #address-cells = <1>; + #size-cells = <0>; + + spi-nor@0 { + compatible = "jedec,spi-nor"; + label = "sfc_nor"; + reg = <0>; + m25p,fast-read; + spi-max-frequency = <20000000>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <1>; + }; +}; + +&uart5 { + pinctrl-names = "default"; + pinctrl-0 = <&uart5m0_xfer &uart5m0_ctsn &uart5m0_rtsn>; + status = "okay"; + + bluetooth { + compatible = "realtek,rtl8822cs-bt"; + enable-gpios = <&gpio3 RK_PC7 GPIO_ACTIVE_HIGH>; + host-wake-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + device-wake-gpios = <&gpio3 RK_PD0 GPIO_ACTIVE_HIGH>; + }; +}; + +&usbdp_phy_dp { + status = "disabled"; +}; + +&vop { + disable-win-move; +}; + +&vp1 { + status = "okay"; +}; + +&vp2 { + status = "disabled"; +}; + +/* GPIO Connector */ +&gpio0 { + gpio-line-names = + /* GPIO0 A0-A7 */ + "", "", "", "", + "", "", "", "", + /* GPIO0 B0-B7 */ + "", "", "", "", + "", "PIN_12", "", "", + /* GPIO0 C0-C7 */ + "", "PIN_05 [I2C0_SCL_M1]", "PIN_03 [I2C0_SDA_M1]", "", + "PIN_22", "", "", "", + /* GPIO0 D0-D7 */ + "", "", "", "", + "", "", "", ""; +}; + +&gpio1 { + gpio-line-names = + /* GPIO1 A0-A7 */ + "", "", "", "", + "", "", "", "", + /* GPIO1 B0-B7 */ + "", "", "", "", + "", "", "", "", + /* GPIO1 C0-C7 */ + "", "", "", "", + "", "", "", "", + /* GPIO1 D0-D7 */ + "", "", "", "", + "", "", "", ""; +}; + +&gpio2 { + gpio-line-names = + /* GPIO2 A0-A7 */ + "", "", "", "", + "", "", "PIN_11 [UART8_TX_M1]", "PIN_13 [UART8_RX_M1]", + /* GPIO2 B0-B7 */ + "", "", "", "", + "", "", "", "", + /* GPIO2 C0-C7 */ + "", "", "", "", + "", "", "", "", + /* GPIO2 D0-D7 */ + "", "", "", "", + "", "", "", ""; +}; + +&gpio3 { + gpio-line-names = + /* GPIO3 A0-A7 */ + "PIN_16 [UART3_TX_M0]", "PIN_18 [UART3_RX_M0]", "", "", + "", "", "", "", + /* GPIO3 B0-B7 */ + "", "", "", "", + "", "", "", "", + /* GPIO3 C0-C7 */ + "", "", "", "", + "", "", "", "", + /* GPIO3 D0-D7 */ + "", "", "", "", + "", "", "", ""; +}; + +&gpio4 { + gpio-line-names = + /* GPIO4 A0-A7 */ + "", "", + "PIN_15", "PIN_29", + "PIN_28", "PIN_07", + "PIN_26", "PIN_27", + /* GPIO4 B0-B7 */ + "PIN_23", "PIN_19", + "PIN_21", "PIN_24", + "PIN_10", "PIN_08", + "", "", + /* GPIO4 C0-C7 */ + "", "", "", "", + "", "", "", "", + /* GPIO4 D0-D7 */ + "", "", "", "", + "", "", "", ""; +}; + +&spi3 { + status = "disabled"; + pinctrl-0 = <&spi3m2_csn0 &spi3m2_csn1 &spi3m2_pins>; + + spidev0: spidev@0 { + compatible = "rockchip,spidev"; + reg = <0>; + spi-max-frequency = <10000000>; + status = "disabled"; + }; +}; + +&sai1 { + status = "disabled"; +}; + +&uart2 { + pinctrl-0 = <&uart2m1_xfer &uart2m1_ctsn &uart2m1_rtsn>; + status = "disabled"; +}; + +&uart3 { + pinctrl-0 = <&uart3m0_xfer>; + status = "okay"; +}; + +&uart8 { + pinctrl-0 = <&uart8m1_xfer>; + status = "okay"; +}; \ No newline at end of file diff --git a/arch/arm64/boot/dts/rockchip/rk3576-nanopi5-common.dtsi b/arch/arm64/boot/dts/rockchip/rk3576-nanopi5-common.dtsi index 60c1d3bd5da6..5183dbc958f0 100644 --- a/arch/arm64/boot/dts/rockchip/rk3576-nanopi5-common.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3576-nanopi5-common.dtsi @@ -26,10 +26,6 @@ mmc0 = &sdmmc; mmc1 = &sdio; mmc2 = &sdhci; - scsi0 = &lun0; - scsi1 = &lun1; - scsi2 = &lun2; - scsi3 = &lun3; }; @@ -719,27 +715,6 @@ &ufs { status = "okay"; reset-gpios = <&gpio4 RK_PD0 GPIO_ACTIVE_HIGH>; - - scsi { - #address-cells = <1>; - #size-cells = <0>; - - lun0: lun@0 { - reg = <0>; - }; - - lun1: lun@1 { - reg = <1>; - }; - - lun2: lun@2 { - reg = <2>; - }; - - lun3: lun@3 { - reg = <3>; - }; - }; }; &usbdp_phy {