From 6f6543c6f5be0ef5f33b6d910f0378591923a28a Mon Sep 17 00:00:00 2001 From: Aditya Prayoga Date: Tue, 15 Sep 2020 14:46:06 +0700 Subject: [PATCH] Assign Fault LED, rework HDD power staggering, fix minor systemd service warning on Helios64 (#2204) * Supress systemd service warning * helios64: u-boot: staggered HDD power up Set the delay to 10s in between turning on the next HDD power rails. Remove the delay property from kernel device tree, let it only apply to u-boot Signed-off-by: Aditya Prayoga * helios64: fault LED as kernel panic indicator also sync, u-boot dts * helios64: fix hwmon udev rules Legacy kernel (LK 4.4) has different class/naming on SoC Temp sensor. Also fix typo on current/dev udev rules. --- .../families/include/rockchip64_common.inc | 9 +++- .../helios64/90-helios64-hwmon-legacy.rules | 24 ++++++++++ packages/bsp/helios64/90-helios64-hwmon.rules | 2 +- .../helios64/fancontrol.service.pid-override | 2 + .../helios64/helios64-heartbeat-led.service | 2 +- .../rk3399-legacy/helios64-add-board.patch | 16 +++---- .../add-board-helios64.patch | 20 ++++---- .../add-board-helios64.patch | 46 ++++++++++--------- 8 files changed, 76 insertions(+), 45 deletions(-) create mode 100755 packages/bsp/helios64/90-helios64-hwmon-legacy.rules create mode 100644 packages/bsp/helios64/fancontrol.service.pid-override diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc index 2770ae57c5..f027b38b33 100644 --- a/config/sources/families/include/rockchip64_common.inc +++ b/config/sources/families/include/rockchip64_common.inc @@ -299,6 +299,7 @@ family_tweaks_bsp() if [[ $BOARD == helios64 ]]; then mkdir -p $destination/etc/udev/rules.d/ + mkdir -p $destination/etc/systemd/system/fancontrol.service.d/ mkdir -p $destination/lib/systemd/system-shutdown/ cp $SRC/packages/bsp/helios64/50-usb-realtek-net.rules $destination/etc/udev/rules.d/ cp $SRC/packages/bsp/helios64/70-keep-usb-lan-as-eth1.rules $destination/etc/udev/rules.d/ @@ -307,7 +308,13 @@ family_tweaks_bsp() ### Fancontrol tweaks # copy hwmon rules to fix device mapping - install -m 644 $SRC/packages/bsp/helios64/90-helios64-hwmon.rules $destination/etc/udev/rules.d/ + if [[ $BRANCH == legacy ]]; then + install -m 644 $SRC/packages/bsp/helios64/90-helios64-hwmon-legacy.rules $destination/etc/udev/rules.d/ + else + install -m 644 $SRC/packages/bsp/helios64/90-helios64-hwmon.rules $destination/etc/udev/rules.d/ + fi + + install -m 644 $SRC/packages/bsp/helios64/fancontrol.service.pid-override $destination/etc/systemd/system/fancontrol.service.d/pid.conf # copy fancontrol config install -m 644 $SRC/packages/bsp/helios64/fancontrol.conf $destination/etc/fancontrol diff --git a/packages/bsp/helios64/90-helios64-hwmon-legacy.rules b/packages/bsp/helios64/90-helios64-hwmon-legacy.rules new file mode 100755 index 0000000000..5b1d6ebb12 --- /dev/null +++ b/packages/bsp/helios64/90-helios64-hwmon-legacy.rules @@ -0,0 +1,24 @@ +# Helios64 persistent hwmon + +ACTION=="remove", GOTO="helios64_hwmon_end" + +# +KERNELS=="p6-fan", SUBSYSTEMS=="platform", ENV{_HELIOS64_FAN_}="p6", ENV{_IS_HELIOS64_FAN_}="1", ENV{IS_HELIOS64_HWMON}="1" +KERNELS=="p7-fan", SUBSYSTEMS=="platform", ENV{_HELIOS64_FAN_}="p7", ENV{_IS_HELIOS64_FAN_}="1", ENV{IS_HELIOS64_HWMON}="1" +KERNELS=="2-004c", SUBSYSTEMS=="i2c", DRIVERS=="lm75", ENV{IS_HELIOS64_HWMON}="1" +KERNELS=="thermal_zone0", SUBSYSTEMS=="thermal", ENV{IS_HELIOS64_HWMON}="1" + +SUBSYSTEM!="hwmon|thermal", GOTO="helios64_hwmon_end" + +ENV{HWMON_PATH}="/sys%p" +# +ATTR{type}=="soc-thermal", ENV{HWMON_PATH}="/sys%p/temp", ENV{HELIOS64_SYMLINK}="/dev/thermal-cpu/temp1_input", RUN+="/usr/bin/mkdir /dev/thermal-cpu/" +# +ENV{IS_HELIOS64_HWMON}=="1", ATTR{name}=="lm75", ENV{HELIOS64_SYMLINK}="/dev/thermal-board" +ENV{_IS_HELIOS64_FAN_}=="1", ENV{HELIOS64_SYMLINK}="/dev/fan-$env{_HELIOS64_FAN_}" + +# +ENV{IS_HELIOS64_HWMON}=="1", RUN+="/bin/ln -sf $env{HWMON_PATH} $env{HELIOS64_SYMLINK}" + +LABEL="helios64_hwmon_end" + diff --git a/packages/bsp/helios64/90-helios64-hwmon.rules b/packages/bsp/helios64/90-helios64-hwmon.rules index 9573d30f02..59288d3577 100755 --- a/packages/bsp/helios64/90-helios64-hwmon.rules +++ b/packages/bsp/helios64/90-helios64-hwmon.rules @@ -13,7 +13,7 @@ ENV{HWMON_PATH}="/sys%p" # ATTR{name}=="cpu", ENV{IS_HELIOS64_HWMON}="1", ENV{HELIOS64_SYMLINK}="/dev/thermal-cpu" # -ENV{IS_HELIOS64_HWMON}=="1", ATTR{name}=="lm75", ENV{HELIOS4_SYMLINK}="/dev/thermal-board" +ENV{IS_HELIOS64_HWMON}=="1", ATTR{name}=="lm75", ENV{HELIOS64_SYMLINK}="/dev/thermal-board" ENV{_IS_HELIOS64_FAN_}=="1", ENV{HELIOS64_SYMLINK}="/dev/fan-$env{_HELIOS64_FAN_}" # diff --git a/packages/bsp/helios64/fancontrol.service.pid-override b/packages/bsp/helios64/fancontrol.service.pid-override new file mode 100644 index 0000000000..76d4d85f25 --- /dev/null +++ b/packages/bsp/helios64/fancontrol.service.pid-override @@ -0,0 +1,2 @@ +[Service] +PIDFile=/run/fancontrol.pid diff --git a/packages/bsp/helios64/helios64-heartbeat-led.service b/packages/bsp/helios64/helios64-heartbeat-led.service index 8f0057118c..16e4e8a409 100644 --- a/packages/bsp/helios64/helios64-heartbeat-led.service +++ b/packages/bsp/helios64/helios64-heartbeat-led.service @@ -4,7 +4,7 @@ After=getty.target [Service] Type=oneshot -ExecStart=bash -c 'echo heartbeat | tee /sys/class/leds/helios64\:\:status/trigger' +ExecStart=bash -c 'echo heartbeat | tee /sys/class/leds/helios64\\:\\:status/trigger' [Install] WantedBy=multi-user.target diff --git a/patch/kernel/rk3399-legacy/helios64-add-board.patch b/patch/kernel/rk3399-legacy/helios64-add-board.patch index 9108e1857e..72051904db 100644 --- a/patch/kernel/rk3399-legacy/helios64-add-board.patch +++ b/patch/kernel/rk3399-legacy/helios64-add-board.patch @@ -1,17 +1,17 @@ -From 022ada1465cac946e17097ea3f9b9715f66494de Mon Sep 17 00:00:00 2001 +From 20d538b02c0d5bb9faf4470a9c57ce4551b95564 Mon Sep 17 00:00:00 2001 From: Aditya Prayoga -Date: Tue, 28 Jul 2020 11:30:39 +0700 +Date: Fri, 11 Sep 2020 20:57:53 +0700 Subject: [PATCH] Add Helios64 board device tree Signed-off-by: Aditya Prayoga --- arch/arm64/boot/dts/rockchip/Makefile | 1 + - .../boot/dts/rockchip/rk3399-helios64.dts | 1260 +++++++++++++++++ - 2 files changed, 1261 insertions(+) + .../boot/dts/rockchip/rk3399-helios64.dts | 1257 +++++++++++++++++ + 2 files changed, 1258 insertions(+) create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-helios64.dts diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile -index 270c0c62..adfa8211 100644 +index dbebbf9fe..2b1e29649 100644 --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile @@ -14,6 +14,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \ @@ -24,10 +24,10 @@ index 270c0c62..adfa8211 100644 dtb-$(CONFIG_ARCH_ROCKCHIP) += \ diff --git a/arch/arm64/boot/dts/rockchip/rk3399-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-helios64.dts new file mode 100644 -index 00000000..d4248a01 +index 000000000..51462db75 --- /dev/null +++ b/arch/arm64/boot/dts/rockchip/rk3399-helios64.dts -@@ -0,0 +1,1259 @@ +@@ -0,0 +1,1257 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2020 Aditya Prayoga (aditya@kobol.io) @@ -281,7 +281,6 @@ index 00000000..d4248a01 + regulator-name = "power_hdd_a"; + regulator-always-on; + regulator-boot-on; -+ startup-delay-us = <2000000>; + }; + + power_hdd_b: power-hdd-b { @@ -293,7 +292,6 @@ index 00000000..d4248a01 + regulator-name = "power_hdd_b"; + regulator-always-on; + regulator-boot-on; -+ startup-delay-us = <2000000>; + }; + + usblan_power: usblan-power { diff --git a/patch/kernel/rockchip64-current/add-board-helios64.patch b/patch/kernel/rockchip64-current/add-board-helios64.patch index 4f3b9b768f..5e386e0dda 100644 --- a/patch/kernel/rockchip64-current/add-board-helios64.patch +++ b/patch/kernel/rockchip64-current/add-board-helios64.patch @@ -1,20 +1,20 @@ -From c2dafa427696ae0edd9f1348a00e90a22edddace Mon Sep 17 00:00:00 2001 +From ce21ecd70dc2432e2f8aaf063e9c123980f5844c Mon Sep 17 00:00:00 2001 From: Aditya Prayoga -Date: Mon, 3 Aug 2020 02:53:02 +0700 +Date: Mon, 14 Sep 2020 08:36:32 +0700 Subject: [PATCH] Add board Helios64 Signed-off-by: Aditya Prayoga --- arch/arm64/boot/dts/rockchip/Makefile | 1 + - .../boot/dts/rockchip/rk3399-helios64.dts | 1080 +++++++++++++++++ - 2 files changed, 1081 insertions(+) + .../boot/dts/rockchip/rk3399-helios64.dts | 1079 +++++++++++++++++ + 2 files changed, 1080 insertions(+) create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-helios64.dts diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile -index 06ddfb869..b8a273c91 100644 +index 473e14e12..b8e6e86e0 100644 --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -19,6 +19,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-bob.dtb +@@ -25,6 +25,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-bob.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-kevin.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-scarlet-inx.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-scarlet-kd.dtb @@ -24,10 +24,10 @@ index 06ddfb869..b8a273c91 100644 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-khadas-edge-captain.dtb diff --git a/arch/arm64/boot/dts/rockchip/rk3399-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-helios64.dts new file mode 100644 -index 000000000..342589131 +index 000000000..5f47b2556 --- /dev/null +++ b/arch/arm64/boot/dts/rockchip/rk3399-helios64.dts -@@ -0,0 +1,1081 @@ +@@ -0,0 +1,1079 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2020 Aditya Prayoga (aditya@kobol.io) @@ -244,7 +244,6 @@ index 000000000..342589131 + regulator-name = "power_hdd_a"; + regulator-always-on; + regulator-boot-on; -+ startup-delay-us = <2000000>; + }; + + power_hdd_b: power-hdd-b { @@ -256,7 +255,6 @@ index 000000000..342589131 + regulator-name = "power_hdd_b"; + regulator-always-on; + regulator-boot-on; -+ startup-delay-us = <2000000>; + }; + + usblan_power: usblan-power { @@ -418,7 +416,7 @@ index 000000000..342589131 + fault-led { + label = "helios64:red:fault"; + gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; -+ linux,default-trigger = "none"; ++ linux,default-trigger = "panic"; + default-state = "keep"; + mode = <0x23>; + }; diff --git a/patch/u-boot/u-boot-rockchip64-mainline/add-board-helios64.patch b/patch/u-boot/u-boot-rockchip64-mainline/add-board-helios64.patch index 06d9e6fa02..e18442fef2 100644 --- a/patch/u-boot/u-boot-rockchip64-mainline/add-board-helios64.patch +++ b/patch/u-boot/u-boot-rockchip64-mainline/add-board-helios64.patch @@ -1,13 +1,13 @@ -From 469211a4113729a93e64448cf9726973d1a9b2e6 Mon Sep 17 00:00:00 2001 +From 89fcfe49a259d7f8a21bd88c8a7ebab651bb4417 Mon Sep 17 00:00:00 2001 From: Aditya Prayoga -Date: Mon, 7 Sep 2020 17:54:51 +0700 +Date: Mon, 14 Sep 2020 08:31:22 +0700 Subject: [PATCH] Patching something Signed-off-by: Aditya Prayoga --- arch/arm/dts/Makefile | 1 + - arch/arm/dts/rk3399-helios64-u-boot.dtsi | 130 +++ - arch/arm/dts/rk3399-helios64.dts | 1149 ++++++++++++++++++++++ + arch/arm/dts/rk3399-helios64-u-boot.dtsi | 134 +++ + arch/arm/dts/rk3399-helios64.dts | 1147 ++++++++++++++++++++++ arch/arm/mach-rockchip/rk3399/Kconfig | 17 + board/kobol/helios64/Kconfig | 24 + board/kobol/helios64/MAINTAINERS | 6 + @@ -17,7 +17,7 @@ Signed-off-by: Aditya Prayoga board/kobol/helios64/sys_otp.h | 10 + configs/helios64-rk3399_defconfig | 149 +++ include/configs/helios64.h | 47 + - 12 files changed, 2048 insertions(+) + 12 files changed, 2050 insertions(+) create mode 100644 arch/arm/dts/rk3399-helios64-u-boot.dtsi create mode 100644 arch/arm/dts/rk3399-helios64.dts create mode 100644 board/kobol/helios64/Kconfig @@ -30,7 +30,7 @@ Signed-off-by: Aditya Prayoga create mode 100644 include/configs/helios64.h diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile -index 530d60bfc..d9fd6cf1c 100644 +index 530d60bf..d9fd6cf1 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -122,6 +122,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \ @@ -43,10 +43,10 @@ index 530d60bfc..d9fd6cf1c 100644 rk3399-khadas-edge-v.dtb \ diff --git a/arch/arm/dts/rk3399-helios64-u-boot.dtsi b/arch/arm/dts/rk3399-helios64-u-boot.dtsi new file mode 100644 -index 000000000..27ea5eaa9 +index 00000000..db362d44 --- /dev/null +++ b/arch/arm/dts/rk3399-helios64-u-boot.dtsi -@@ -0,0 +1,130 @@ +@@ -0,0 +1,134 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2020 Aditya Prayoga (aditya@kobol.io) @@ -163,6 +163,10 @@ index 000000000..27ea5eaa9 + }; +}; + ++&power_hdd_a { ++ startup-delay-us = <10000000>; ++}; ++ +&spi1 { + spiflash: flash@0 { + compatible = "jedec,spi-nor"; @@ -179,10 +183,10 @@ index 000000000..27ea5eaa9 +}; diff --git a/arch/arm/dts/rk3399-helios64.dts b/arch/arm/dts/rk3399-helios64.dts new file mode 100644 -index 000000000..d5f1df674 +index 00000000..c4fedbf0 --- /dev/null +++ b/arch/arm/dts/rk3399-helios64.dts -@@ -0,0 +1,1149 @@ +@@ -0,0 +1,1147 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2020 Aditya Prayoga (aditya@kobol.io) @@ -405,7 +409,6 @@ index 000000000..d5f1df674 + regulator-name = "power_hdd_a"; + regulator-always-on; + regulator-boot-on; -+ startup-delay-us = <2500000>; + }; + + power_hdd_b: power-hdd-b { @@ -417,7 +420,6 @@ index 000000000..d5f1df674 + regulator-name = "power_hdd_b"; + regulator-always-on; + regulator-boot-on; -+ startup-delay-us = <2500000>; + }; + + usblan_power: usblan-power { @@ -578,7 +580,7 @@ index 000000000..d5f1df674 + fault-led { + label = "helios64:red:fault"; + gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; -+ linux,default-trigger = "none"; ++ linux,default-trigger = "panic"; + default-state = "keep"; + mode = <0x23>; + }; @@ -1333,7 +1335,7 @@ index 000000000..d5f1df674 + status = "okay"; +}; diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig -index 254b9c5b4..5f89bf6eb 100644 +index 254b9c5b..5f89bf6e 100644 --- a/arch/arm/mach-rockchip/rk3399/Kconfig +++ b/arch/arm/mach-rockchip/rk3399/Kconfig @@ -26,6 +26,22 @@ config TARGET_PINEBOOK_PRO_RK3399 @@ -1369,7 +1371,7 @@ index 254b9c5b4..5f89bf6eb 100644 source "board/rockchip/evb_rk3399/Kconfig" diff --git a/board/kobol/helios64/Kconfig b/board/kobol/helios64/Kconfig new file mode 100644 -index 000000000..644cdbd8f +index 00000000..644cdbd8 --- /dev/null +++ b/board/kobol/helios64/Kconfig @@ -0,0 +1,24 @@ @@ -1399,7 +1401,7 @@ index 000000000..644cdbd8f +endif diff --git a/board/kobol/helios64/MAINTAINERS b/board/kobol/helios64/MAINTAINERS new file mode 100644 -index 000000000..a9c88c79e +index 00000000..a9c88c79 --- /dev/null +++ b/board/kobol/helios64/MAINTAINERS @@ -0,0 +1,6 @@ @@ -1411,7 +1413,7 @@ index 000000000..a9c88c79e +F: configs/helios64_defconfig diff --git a/board/kobol/helios64/Makefile b/board/kobol/helios64/Makefile new file mode 100644 -index 000000000..ab34245a6 +index 00000000..ab34245a --- /dev/null +++ b/board/kobol/helios64/Makefile @@ -0,0 +1,5 @@ @@ -1422,7 +1424,7 @@ index 000000000..ab34245a6 +obj-y := helios64.o sys_otp.o diff --git a/board/kobol/helios64/helios64.c b/board/kobol/helios64/helios64.c new file mode 100644 -index 000000000..c7a0efa49 +index 00000000..c7a0efa4 --- /dev/null +++ b/board/kobol/helios64/helios64.c @@ -0,0 +1,262 @@ @@ -1690,7 +1692,7 @@ index 000000000..c7a0efa49 +#endif diff --git a/board/kobol/helios64/sys_otp.c b/board/kobol/helios64/sys_otp.c new file mode 100644 -index 000000000..3a2783464 +index 00000000..3a278346 --- /dev/null +++ b/board/kobol/helios64/sys_otp.c @@ -0,0 +1,248 @@ @@ -1944,7 +1946,7 @@ index 000000000..3a2783464 +} diff --git a/board/kobol/helios64/sys_otp.h b/board/kobol/helios64/sys_otp.h new file mode 100644 -index 000000000..61f6f3b38 +index 00000000..61f6f3b3 --- /dev/null +++ b/board/kobol/helios64/sys_otp.h @@ -0,0 +1,10 @@ @@ -1960,7 +1962,7 @@ index 000000000..61f6f3b38 +#endif diff --git a/configs/helios64-rk3399_defconfig b/configs/helios64-rk3399_defconfig new file mode 100644 -index 000000000..622100551 +index 00000000..62210055 --- /dev/null +++ b/configs/helios64-rk3399_defconfig @@ -0,0 +1,149 @@ @@ -2115,7 +2117,7 @@ index 000000000..622100551 +CONFIG_HEXDUMP=y diff --git a/include/configs/helios64.h b/include/configs/helios64.h new file mode 100644 -index 000000000..6fca9a6be +index 00000000..6fca9a6b --- /dev/null +++ b/include/configs/helios64.h @@ -0,0 +1,47 @@