diff --git a/package/boot/uboot-rockchip/patches/202-rockchip-rk3399-Add-support-for-FriendlyARM-NanoPi-R.patch b/package/boot/uboot-rockchip/patches/102-rockchip-rk3399-Add-support-for-FriendlyARM-NanoPi-R.patch similarity index 68% rename from package/boot/uboot-rockchip/patches/202-rockchip-rk3399-Add-support-for-FriendlyARM-NanoPi-R.patch rename to package/boot/uboot-rockchip/patches/102-rockchip-rk3399-Add-support-for-FriendlyARM-NanoPi-R.patch index 74c7c3f4a..a2fd87ea2 100644 --- a/package/boot/uboot-rockchip/patches/202-rockchip-rk3399-Add-support-for-FriendlyARM-NanoPi-R.patch +++ b/package/boot/uboot-rockchip/patches/102-rockchip-rk3399-Add-support-for-FriendlyARM-NanoPi-R.patch @@ -1,4 +1,4 @@ -From 8dc76bbce30c3f63f290f008f8410c00fee13c9a Mon Sep 17 00:00:00 2001 +From 2dd6b01ec665c376e6be7d37b513fb4d05df60db Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 8 Jan 2021 05:55:50 +0000 Subject: [PATCH] rockchip: rk3399: Add support for FriendlyARM NanoPi R4S @@ -14,25 +14,26 @@ MicroSD slot Reset button WAN - LAN - SYS LED -Signed-off-by: Tianling Shen -Co-authored-by: Jensen Huang +Co-developed-by: Jensen Huang Signed-off-by: Jensen Huang -Co-authored-by: Marty Jones +[minor adjustments] +Co-developed-by: Marty Jones Signed-off-by: Marty Jones +[further adjustments, fixed format issues] +Signed-off-by: Tianling Shen --- arch/arm/dts/Makefile | 1 + arch/arm/dts/rk3399-nanopi-r4s-u-boot.dtsi | 9 ++ - arch/arm/dts/rk3399-nanopi-r4s.dts | 178 +++++++++++++++++++++ - board/friendlyarm/nanopi4/MAINTAINERS | 6 + - configs/nanopi-r4s-rk3399_defconfig | 63 ++++++++ - 5 files changed, 257 insertions(+) + arch/arm/dts/rk3399-nanopi-r4s.dts | 133 +++++++++++++++++++++ + configs/nanopi-r4s-rk3399_defconfig | 63 ++++++++++ + 4 files changed, 206 insertions(+) create mode 100644 arch/arm/dts/rk3399-nanopi-r4s-u-boot.dtsi create mode 100644 arch/arm/dts/rk3399-nanopi-r4s.dts create mode 100644 configs/nanopi-r4s-rk3399_defconfig --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -132,6 +132,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \ +@@ -134,6 +134,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \ rk3399-nanopi-m4.dtb \ rk3399-nanopi-m4-2gb.dtb \ rk3399-nanopi-neo4.dtb \ @@ -54,12 +55,19 @@ Signed-off-by: Marty Jones +#include "rk3399-sdram-ddr3-1866.dtsi" --- /dev/null +++ b/arch/arm/dts/rk3399-nanopi-r4s.dts -@@ -0,0 +1,178 @@ +@@ -0,0 +1,133 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* ++ * FriendlyElec NanoPC-T4 board device tree source ++ * ++ * Copyright (c) 2020 FriendlyElec Computer Tech. Co., Ltd. ++ * (http://www.friendlyarm.com) ++ * ++ * Copyright (c) 2018 Collabora Ltd. ++ * + * Copyright (c) 2020 Jensen Huang + * Copyright (c) 2020 Marty Jones -+ * Copyright (c) 2020 Tianling Shen ++ * Copyright (c) 2021 Tianling Shen + */ + +/dts-v1/; @@ -69,41 +77,35 @@ Signed-off-by: Marty Jones + model = "FriendlyElec NanoPi R4S"; + compatible = "friendlyarm,nanopi-r4s", "rockchip,rk3399"; + -+ aliases { -+ led-boot = &sys_led; -+ led-failsafe = &sys_led; -+ led-running = &sys_led; -+ led-upgrade = &sys_led; -+ }; ++ /delete-node/ display-subsystem; + -+ /delete-node/ gpio-leds; + gpio-leds { -+ compatible = "gpio-leds"; + pinctrl-0 = <&lan_led_pin>, <&sys_led_pin>, <&wan_led_pin>; -+ pinctrl-names = "default"; + -+ lan_led: led-0 { ++ /delete-node/ status; ++ ++ lan_led: led-lan { + gpios = <&gpio1 RK_PA1 GPIO_ACTIVE_HIGH>; -+ label = "nanopi-r4s:green:lan"; ++ label = "green:lan"; + }; + -+ sys_led: led-1 { ++ sys_led: led-sys { + gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; -+ label = "nanopi-r4s:red:sys"; ++ label = "red:sys"; ++ default-state = "on"; + }; + -+ wan_led: led-2 { ++ wan_led: led-wan { + gpios = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; -+ label = "nanopi-r4s:green:wan"; ++ label = "green:wan"; + }; + }; + -+ /delete-node/ gpio-keys; + gpio-keys { -+ compatible = "gpio-keys"; -+ pinctrl-names = "default"; + pinctrl-0 = <&reset_button_pin>; + ++ /delete-node/ power; ++ + reset { + debounce-interval = <50>; + gpios = <&gpio1 RK_PC6 GPIO_ACTIVE_LOW>; @@ -118,53 +120,13 @@ Signed-off-by: Marty Jones + regulator-always-on; + regulator-boot-on; + }; -+ -+ fan: pwm-fan { -+ compatible = "pwm-fan"; -+ /* -+ * With 20KHz PWM and an EVERCOOL EC4007H12SA fan, these levels -+ * work out to 0, ~1200, ~3000, and 5000RPM respectively. -+ */ -+ cooling-levels = <0 12 18 255>; -+ #cooling-cells = <2>; -+ fan-supply = <&vdd_5v>; -+ pwms = <&pwm1 0 50000 0>; -+ }; -+}; -+ -+&cpu_thermal { -+ trips { -+ cpu_warm: cpu_warm { -+ temperature = <55000>; -+ hysteresis = <2000>; -+ type = "active"; -+ }; -+ -+ cpu_hot: cpu_hot { -+ temperature = <65000>; -+ hysteresis = <2000>; -+ type = "active"; -+ }; -+ }; -+ -+ cooling-maps { -+ map2 { -+ trip = <&cpu_warm>; -+ cooling-device = <&fan THERMAL_NO_LIMIT 1>; -+ }; -+ -+ map3 { -+ trip = <&cpu_hot>; -+ cooling-device = <&fan 2 THERMAL_NO_LIMIT>; -+ }; -+ }; +}; + +&emmc_phy { + status = "disabled"; +}; + -+&fusb0 { ++&i2c4 { + status = "disabled"; +}; + @@ -172,17 +134,12 @@ Signed-off-by: Marty Jones + max-link-speed = <1>; + num-lanes = <1>; + vpcie3v3-supply = <&vcc3v3_sys>; -+ -+ pcie@0 { -+ reg = <0x00000000 0 0 0 0>; -+ #address-cells = <3>; -+ #size-cells = <2>; -+ }; +}; + +&pinctrl { -+ /delete-node/ gpio-leds; + gpio-leds { ++ /delete-node/ leds-gpio; ++ + lan_led_pin: lan-led-pin { + rockchip,pins = <1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>; + }; @@ -196,8 +153,9 @@ Signed-off-by: Marty Jones + }; + }; + -+ /delete-node/ rockchip-key; + rockchip-key { ++ /delete-node/ power-key; ++ + reset_button_pin: reset-button-pin { + rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>; + }; @@ -212,12 +170,6 @@ Signed-off-by: Marty Jones + status = "disabled"; +}; + -+&sdmmc { -+ sd-uhs-sdr12; -+ sd-uhs-sdr25; -+ sd-uhs-sdr50; -+}; -+ +&u2phy0_host { + phy-supply = <&vdd_5v>; +}; @@ -226,6 +178,10 @@ Signed-off-by: Marty Jones + status = "disabled"; +}; + ++&uart0 { ++ status = "disabled"; ++}; ++ +&usbdrd_dwc3_0 { + dr_mode = "host"; +}; @@ -233,18 +189,6 @@ Signed-off-by: Marty Jones +&vcc3v3_sys { + vin-supply = <&vcc5v0_sys>; +}; ---- a/board/friendlyarm/nanopi4/MAINTAINERS -+++ b/board/friendlyarm/nanopi4/MAINTAINERS -@@ -3,3 +3,9 @@ M: FriendlyElec - S: Maintained - F: board/friendlyarm/nanopi4/ - F: include/configs/nanopi4.h -+ -+NANOPI-R4S -+M: Tianling Shen -+S: Maintained -+F: configs/nanopi-r4s-rk3399_defconfig -+F: arch/arm/dts/rk3399-nanopi-r4s-u-boot.dtsi --- /dev/null +++ b/configs/nanopi-r4s-rk3399_defconfig @@ -0,0 +1,63 @@ diff --git a/package/boot/uboot-rockchip/patches/200-rockchip-rk3399-split-nanopi-r4-rk3399-out-of-evb_rk.patch b/package/boot/uboot-rockchip/patches/200-rockchip-rk3399-split-nanopi-r4-rk3399-out-of-evb_rk.patch index d8a118dd2..8ceb9f506 100644 --- a/package/boot/uboot-rockchip/patches/200-rockchip-rk3399-split-nanopi-r4-rk3399-out-of-evb_rk.patch +++ b/package/boot/uboot-rockchip/patches/200-rockchip-rk3399-split-nanopi-r4-rk3399-out-of-evb_rk.patch @@ -467,19 +467,17 @@ Signed-off-by: Tianling Shen + serialnr->low = (u32)(serial & 0xffffffff); +} +#endif -diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c -index 22c373a623..38975c0c65 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c -@@ -1351,6 +1351,8 @@ static void rkclk_init(struct rockchip_cru *cru) +@@ -1370,6 +1370,8 @@ static void rkclk_init(struct rockchip_c pclk_div << PCLK_PERILP1_DIV_CON_SHIFT | hclk_div << HCLK_PERILP1_DIV_CON_SHIFT | HCLK_PERILP1_PLL_SEL_GPLL << HCLK_PERILP1_PLL_SEL_SHIFT); + + rk3399_saradc_set_clk(cru, 1000000); } - #endif + static int rk3399_clk_probe(struct udevice *dev) --- /dev/null +++ b/include/configs/nanopi4.h @@ -0,0 +1,24 @@ diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds b/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds index 77655d426..4575f4c99 100755 --- a/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds +++ b/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds @@ -9,11 +9,14 @@ boardname="${board##*,}" board_config_update case $board in -friendlyarm,nanopi-r2s|\ -friendlyarm,nanopi-r4s) +friendlyarm,nanopi-r2s) ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth0" ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth1" ;; +friendlyarm,nanopi-r4s) + ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0" + ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth1" + ;; esac board_config_flush diff --git a/target/linux/rockchip/patches-5.4/200-rockchip-rk3399-Add-support-for-FriendlyARM-NanoPi-R.patch b/target/linux/rockchip/patches-5.4/009-rockchip-rk3399-Add-support-for-FriendlyARM-NanoPi-R.patch similarity index 62% rename from target/linux/rockchip/patches-5.4/200-rockchip-rk3399-Add-support-for-FriendlyARM-NanoPi-R.patch rename to target/linux/rockchip/patches-5.4/009-rockchip-rk3399-Add-support-for-FriendlyARM-NanoPi-R.patch index 70bc881c3..c508d7131 100644 --- a/target/linux/rockchip/patches-5.4/200-rockchip-rk3399-Add-support-for-FriendlyARM-NanoPi-R.patch +++ b/target/linux/rockchip/patches-5.4/009-rockchip-rk3399-Add-support-for-FriendlyARM-NanoPi-R.patch @@ -1,6 +1,6 @@ -From 11c2b38cf0a04b0edb3eabae24fb1484489725e2 Mon Sep 17 00:00:00 2001 +From db792e9adbf85ffc9d6b0b060ac3c8e3148c8992 Mon Sep 17 00:00:00 2001 From: Tianling Shen -Date: Fri, 8 Jan 2021 07:12:30 +0000 +Date: Fri, 19 Mar 2021 13:16:27 +0800 Subject: [PATCH] rockchip: rk3399: Add support for FriendlyARM NanoPi R4S This adds support for the NanoPi R4S from FriendlyArm. @@ -9,20 +9,24 @@ Rockchip RK3399 SoC 1GB DDR3 or 4GB LPDDR4 RAM Gigabit Ethernet (WAN) Gigabit Ethernet (PCIe) (LAN) -USB 3.0 Host Port x 2 +USB 3.0 Port x 2 MicroSD slot Reset button WAN - LAN - SYS LED -Signed-off-by: Tianling Shen -Co-authored-by: Jensen Huang +Co-developed-by: Jensen Huang Signed-off-by: Jensen Huang -Co-authored-by: Marty Jones +[minor adjustments] +Co-developed-by: Marty Jones Signed-off-by: Marty Jones +[further adjustments, fixed format issues] +Signed-off-by: Tianling Shen +Link: https://lore.kernel.org/r/20210319051627.814-2-cnsztl@gmail.com +Signed-off-by: Heiko Stuebner --- arch/arm64/boot/dts/rockchip/Makefile | 1 + - .../boot/dts/rockchip/rk3399-nanopi-r4s.dts | 178 ++++++++++++++++++ - 2 files changed, 179 insertions(+) + .../boot/dts/rockchip/rk3399-nanopi-r4s.dts | 133 +++++++++++++++++++++ + 2 files changed, 134 insertions(+) create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts --- a/arch/arm64/boot/dts/rockchip/Makefile @@ -37,12 +41,19 @@ Signed-off-by: Marty Jones dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb --- /dev/null +++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts -@@ -0,0 +1,178 @@ +@@ -0,0 +1,133 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* ++ * FriendlyElec NanoPC-T4 board device tree source ++ * ++ * Copyright (c) 2020 FriendlyElec Computer Tech. Co., Ltd. ++ * (http://www.friendlyarm.com) ++ * ++ * Copyright (c) 2018 Collabora Ltd. ++ * + * Copyright (c) 2020 Jensen Huang + * Copyright (c) 2020 Marty Jones -+ * Copyright (c) 2020 Tianling Shen ++ * Copyright (c) 2021 Tianling Shen + */ + +/dts-v1/; @@ -52,41 +63,35 @@ Signed-off-by: Marty Jones + model = "FriendlyElec NanoPi R4S"; + compatible = "friendlyarm,nanopi-r4s", "rockchip,rk3399"; + -+ aliases { -+ led-boot = &sys_led; -+ led-failsafe = &sys_led; -+ led-running = &sys_led; -+ led-upgrade = &sys_led; -+ }; ++ /delete-node/ display-subsystem; + -+ /delete-node/ gpio-leds; + gpio-leds { -+ compatible = "gpio-leds"; + pinctrl-0 = <&lan_led_pin>, <&sys_led_pin>, <&wan_led_pin>; -+ pinctrl-names = "default"; + -+ lan_led: led-0 { ++ /delete-node/ status; ++ ++ lan_led: led-lan { + gpios = <&gpio1 RK_PA1 GPIO_ACTIVE_HIGH>; -+ label = "nanopi-r4s:green:lan"; ++ label = "green:lan"; + }; + -+ sys_led: led-1 { ++ sys_led: led-sys { + gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; -+ label = "nanopi-r4s:red:sys"; ++ label = "red:sys"; ++ default-state = "on"; + }; + -+ wan_led: led-2 { ++ wan_led: led-wan { + gpios = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; -+ label = "nanopi-r4s:green:wan"; ++ label = "green:wan"; + }; + }; + -+ /delete-node/ gpio-keys; + gpio-keys { -+ compatible = "gpio-keys"; -+ pinctrl-names = "default"; + pinctrl-0 = <&reset_button_pin>; + ++ /delete-node/ power; ++ + reset { + debounce-interval = <50>; + gpios = <&gpio1 RK_PC6 GPIO_ACTIVE_LOW>; @@ -101,53 +106,13 @@ Signed-off-by: Marty Jones + regulator-always-on; + regulator-boot-on; + }; -+ -+ fan: pwm-fan { -+ compatible = "pwm-fan"; -+ /* -+ * With 20KHz PWM and an EVERCOOL EC4007H12SA fan, these levels -+ * work out to 0, ~1200, ~3000, and 5000RPM respectively. -+ */ -+ cooling-levels = <0 12 18 255>; -+ #cooling-cells = <2>; -+ fan-supply = <&vdd_5v>; -+ pwms = <&pwm1 0 50000 0>; -+ }; -+}; -+ -+&cpu_thermal { -+ trips { -+ cpu_warm: cpu_warm { -+ temperature = <55000>; -+ hysteresis = <2000>; -+ type = "active"; -+ }; -+ -+ cpu_hot: cpu_hot { -+ temperature = <65000>; -+ hysteresis = <2000>; -+ type = "active"; -+ }; -+ }; -+ -+ cooling-maps { -+ map2 { -+ trip = <&cpu_warm>; -+ cooling-device = <&fan THERMAL_NO_LIMIT 1>; -+ }; -+ -+ map3 { -+ trip = <&cpu_hot>; -+ cooling-device = <&fan 2 THERMAL_NO_LIMIT>; -+ }; -+ }; +}; + +&emmc_phy { + status = "disabled"; +}; + -+&fusb0 { ++&i2c4 { + status = "disabled"; +}; + @@ -155,17 +120,12 @@ Signed-off-by: Marty Jones + max-link-speed = <1>; + num-lanes = <1>; + vpcie3v3-supply = <&vcc3v3_sys>; -+ -+ pcie@0 { -+ reg = <0x00000000 0 0 0 0>; -+ #address-cells = <3>; -+ #size-cells = <2>; -+ }; +}; + +&pinctrl { -+ /delete-node/ gpio-leds; + gpio-leds { ++ /delete-node/ leds-gpio; ++ + lan_led_pin: lan-led-pin { + rockchip,pins = <1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>; + }; @@ -179,8 +139,9 @@ Signed-off-by: Marty Jones + }; + }; + -+ /delete-node/ rockchip-key; + rockchip-key { ++ /delete-node/ power-key; ++ + reset_button_pin: reset-button-pin { + rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>; + }; @@ -195,12 +156,6 @@ Signed-off-by: Marty Jones + status = "disabled"; +}; + -+&sdmmc { -+ sd-uhs-sdr12; -+ sd-uhs-sdr25; -+ sd-uhs-sdr50; -+}; -+ +&u2phy0_host { + phy-supply = <&vdd_5v>; +}; @@ -209,6 +164,10 @@ Signed-off-by: Marty Jones + status = "disabled"; +}; + ++&uart0 { ++ status = "disabled"; ++}; ++ +&usbdrd_dwc3_0 { + dr_mode = "host"; +}; diff --git a/target/linux/rockchip/patches-5.4/100-rockchip-use-system-LED-for-OpenWrt.patch b/target/linux/rockchip/patches-5.4/100-rockchip-use-system-LED-for-OpenWrt.patch index 7b3b50ffd..d0860de8c 100644 --- a/target/linux/rockchip/patches-5.4/100-rockchip-use-system-LED-for-OpenWrt.patch +++ b/target/linux/rockchip/patches-5.4/100-rockchip-use-system-LED-for-OpenWrt.patch @@ -29,3 +29,19 @@ Signed-off-by: David Bauer chosen { stdout-path = "serial2:1500000n8"; }; +--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +@@ -19,6 +19,13 @@ + model = "FriendlyElec NanoPi R4S"; + compatible = "friendlyarm,nanopi-r4s", "rockchip,rk3399"; + ++ aliases { ++ led-boot = &sys_led; ++ led-failsafe = &sys_led; ++ led-running = &sys_led; ++ led-upgrade = &sys_led; ++ }; ++ + /delete-node/ display-subsystem; + + gpio-leds {