From fb0f8f73bdee7db5353a86dd29503be38947d077 Mon Sep 17 00:00:00 2001 From: Paolo Sabatino Date: Sun, 25 Apr 2021 11:13:23 +0000 Subject: [PATCH] rk322x: add led/gpio config for T066 boards, updates to rk322x-config --- packages/bsp/rk322x/rk322x-config | 17 +- .../rk322x-4.4/general-add-overlays.patch | 204 ++++++++++++++++-- .../rk322x-5.10/general-add-overlays.patch | 103 ++++++++- .../rk322x-5.11/general-add-overlays.patch | 103 ++++++++- 4 files changed, 386 insertions(+), 41 deletions(-) diff --git a/packages/bsp/rk322x/rk322x-config b/packages/bsp/rk322x/rk322x-config index d5a2dfef4..7a44c2f12 100755 --- a/packages/bsp/rk322x/rk322x-config +++ b/packages/bsp/rk322x/rk322x-config @@ -9,12 +9,16 @@ BACKTITLE="Armbian RK322x device tree board selection | Paolo Sabatino" TITLE="Board configuration" MENU_TITLE="Please choose your board" +COLOR_RED="\Z1" +COLOR_BLACK="\Z0" + CONFIRM_FLASH_MISMATCH="\nYour board has a type of internal memory but you \ selected a board without support for that.\n\nYou will not be able to detect \ the internal memory and your system may not boot anymore\n\nAre you sure?" -COLOR_RED="\Z1" -COLOR_BLACK="\Z0" +NOTE_LED_GPIO_SELECTION="${COLOR_RED}Important:${COLOR_BLACK} select the \ +led/gpio configuration looking on the markings of the board.\nThe right \ +configuration may solve problems with devices detection like leds,\nwifi and bluetooth\n\n" EFUSE_PATH="/sys/bus/nvmem/devices/rockchip-efuse0/nvmem" SDIO_WIFI_PATH="/sys/bus/sdio/devices/mmc1:0001:1" @@ -57,9 +61,10 @@ DT_FLASH_OVERLAYS+=(["emmc"]="eMMC only flash memory") DT_FLASH_OVERLAYS+=(["nand"]="NAND only flash memory") DT_FLASH_OVERLAYS+=(["emmc-nand"]="eMMC or NAND flash memory") -DT_LED_OVERLAYS+=(["led-conf1"]="LED configuration #1 (Chiptrip)") -DT_LED_OVERLAYS+=(["led-conf2"]="LED configuration #2 (R329q)") -DT_LED_OVERLAYS+=(["led-conf3"]="LED configuration #3 (R28-MXQ)") +DT_LED_OVERLAYS+=(["led-conf1"]="Chiptrip brand (MX1VR, MX4VR)") +DT_LED_OVERLAYS+=(["led-conf2"]="R329q, MXQ-RK3229") +DT_LED_OVERLAYS+=(["led-conf3"]="R28-MXQ") +DT_LED_OVERLAYS+=(["led-conf4"]="T066/T066-V2") DT_CPU_OVERLAYS+=(["cpu-hs"]="RK3228B or RK3229") @@ -323,7 +328,7 @@ function select_led_configuration() { DIALOG_ENTRIES+=($KEY "${DT_LED_OVERLAYS[$KEY]}") done - MENU_TITLE="${BOARD_INFO}Select the led wiring configuation\n" + MENU_TITLE="${BOARD_INFO}${NOTE_LED_GPIO_SELECTION}" MENU_CMD=(dialog --colors --backtitle "$BACKTITLE" --title "$TITLE" --default-item "$SELECTION" --menu "$MENU_TITLE" 24 0 20) diff --git a/patch/kernel/archive/rk322x-4.4/general-add-overlays.patch b/patch/kernel/archive/rk322x-4.4/general-add-overlays.patch index ef8799b8d..027148f9c 100644 --- a/patch/kernel/archive/rk322x-4.4/general-add-overlays.patch +++ b/patch/kernel/archive/rk322x-4.4/general-add-overlays.patch @@ -1,9 +1,9 @@ diff --git a/arch/arm/boot/dts/overlay/Makefile b/arch/arm/boot/dts/overlay/Makefile new file mode 100755 -index 00000000..48eb5249 +index 00000000..abd197ed --- /dev/null +++ b/arch/arm/boot/dts/overlay/Makefile -@@ -0,0 +1,27 @@ +@@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0 +dtbo-$(CONFIG_ARCH_ROCKCHIP) += \ + rk322x-emmc.dtbo \ @@ -12,6 +12,7 @@ index 00000000..48eb5249 + rk322x-led-conf1.dtbo \ + rk322x-led-conf2.dtbo \ + rk322x-led-conf3.dtbo \ ++ rk322x-led-conf4.dtbo \ + rk322x-cpu-hs.dtbo \ + rk322x-cpu-stability.dtbo \ + rk322x-bluetooth.dtbo \ @@ -33,10 +34,10 @@ index 00000000..48eb5249 + diff --git a/arch/arm/boot/dts/overlay/README.rk322x-overlays b/arch/arm/boot/dts/overlay/README.rk322x-overlays new file mode 100755 -index 00000000..1609a892 +index 00000000..8823a01d --- /dev/null +++ b/arch/arm/boot/dts/overlay/README.rk322x-overlays -@@ -0,0 +1,79 @@ +@@ -0,0 +1,80 @@ +This document describes overlays provided in the kernel packages +For generic Armbian overlays documentation please see +https://docs.armbian.com/User-Guide_Allwinner_overlays/ @@ -90,8 +91,9 @@ index 00000000..1609a892 +usually choose a different GPIO for the auxiliary led, but the main "working" +led is always wired to the same gpio (although it may be active high or low) +led-conf1 is commonly found in boards made by Chiptrip manufacturer -+led-conf2 is found in other boards with R329Q marking ++led-conf2 is found in other boards with R329Q and MXQ_RK3229 marking +led-conf3 is found in boards with R28-MXQ marking ++led-conf4 is found on boards with T066 marking + +### rk322x-bluetooth + @@ -629,6 +631,180 @@ index 00000000..39f4547e + }; + +}; +diff --git a/arch/arm/boot/dts/overlay/rk322x-led-conf4.dts b/arch/arm/boot/dts/overlay/rk322x-led-conf4.dts +new file mode 100644 +index 00000000..e9cda296 +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/rk322x-led-conf4.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; ++ ++#include ++#include ++#include ++ ++/ { ++ ++ fragment@0 { ++ target-path = "/gpio-leds"; ++ __overlay__ { ++ ++ working { ++ gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "none"; ++ }; ++ ++ auxiliary { ++ gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_HIGH>; ++ label = "auxiliary"; ++ linux,default-trigger = "mmc2"; ++ default-state = "off"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&gpio_led_aux>; ++ }; ++ ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/pinctrl/gpio"; ++ __overlay__ { ++ ++ gpio_led_working: gpio-led-working { ++ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ gpio_led_aux: gpio-led-aux { ++ rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&gpio_keys>; ++ __overlay__ { ++ ++ reset { ++ gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; ++ label = "reset"; ++ linux,code = ; ++ debounce-interval = <200>; ++ wakeup-source; ++ }; ++ ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&sdio_pwrseq>; ++ __overlay__ { ++ ++ reset-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; /* GPIO2_D3 */ ++ ++ }; ++ ++ }; ++ ++ fragment@4 { ++ target = <&wifi_enable_h>; ++ __overlay__ { ++ ++ rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; ++ ++ }; ++ ++ }; ++ ++}; +diff --git a/arch/arm/boot/dts/overlay/rk322x-led-conf5.dts b/arch/arm/boot/dts/overlay/rk322x-led-conf5.dts +new file mode 100644 +index 00000000..e9cda296 +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/rk322x-led-conf5.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; ++ ++#include ++#include ++#include ++ ++/ { ++ ++ fragment@0 { ++ target-path = "/gpio-leds"; ++ __overlay__ { ++ ++ working { ++ gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "none"; ++ }; ++ ++ auxiliary { ++ gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_HIGH>; ++ label = "auxiliary"; ++ linux,default-trigger = "mmc2"; ++ default-state = "off"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&gpio_led_aux>; ++ }; ++ ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/pinctrl/gpio"; ++ __overlay__ { ++ ++ gpio_led_working: gpio-led-working { ++ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ gpio_led_aux: gpio-led-aux { ++ rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&gpio_keys>; ++ __overlay__ { ++ ++ reset { ++ gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; ++ label = "reset"; ++ linux,code = ; ++ debounce-interval = <200>; ++ wakeup-source; ++ }; ++ ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&sdio_pwrseq>; ++ __overlay__ { ++ ++ reset-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; /* GPIO2_D3 */ ++ ++ }; ++ ++ }; ++ ++ fragment@4 { ++ target = <&wifi_enable_h>; ++ __overlay__ { ++ ++ rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; ++ ++ }; ++ ++ }; ++ ++}; diff --git a/arch/arm/boot/dts/overlay/rk322x-nand.dts b/arch/arm/boot/dts/overlay/rk322x-nand.dts new file mode 100755 index 00000000..5675f5b3 @@ -731,10 +907,10 @@ index 00000000..f6a1a720 +}; diff --git a/arch/arm/boot/dts/overlay/rk322x-wlan-esp8089.dts b/arch/arm/boot/dts/overlay/rk322x-wlan-esp8089.dts new file mode 100755 -index 00000000..76c13a6b +index 00000000..75a2ac8b --- /dev/null +++ b/arch/arm/boot/dts/overlay/rk322x-wlan-esp8089.dts -@@ -0,0 +1,38 @@ +@@ -0,0 +1,24 @@ +/dts-v1/; +/plugin/; + @@ -758,20 +934,6 @@ index 00000000..76c13a6b + }; + }; + -+ fragment@1 { -+ target = <&sdio_pwrseq>; -+ __overlay__ { -+ reset-gpios = <&gpio2 27 GPIO_ACTIVE_LOW>; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&wifi_enable_h>; -+ __overlay__ { -+ rockchip,pins = <2 27 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ +}; diff --git a/arch/arm/boot/dts/overlay/rk322x-wlan-ssv6051.dts b/arch/arm/boot/dts/overlay/rk322x-wlan-ssv6051.dts new file mode 100755 diff --git a/patch/kernel/archive/rk322x-5.10/general-add-overlays.patch b/patch/kernel/archive/rk322x-5.10/general-add-overlays.patch index 989c4519b..0f272d05c 100644 --- a/patch/kernel/archive/rk322x-5.10/general-add-overlays.patch +++ b/patch/kernel/archive/rk322x-5.10/general-add-overlays.patch @@ -1,9 +1,9 @@ diff --git a/arch/arm/boot/dts/overlay/Makefile b/arch/arm/boot/dts/overlay/Makefile new file mode 100755 -index 000000000..dfbda5299 +index 000000000..e39fd5d37 --- /dev/null +++ b/arch/arm/boot/dts/overlay/Makefile -@@ -0,0 +1,23 @@ +@@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0 +dtbo-$(CONFIG_ARCH_ROCKCHIP) += \ + rk322x-emmc.dtbo \ @@ -12,6 +12,7 @@ index 000000000..dfbda5299 + rk322x-led-conf1.dtbo \ + rk322x-led-conf2.dtbo \ + rk322x-led-conf3.dtbo \ ++ rk322x-led-conf4.dtbo \ + rk322x-cpu-hs.dtbo \ + rk322x-wlan-alt-wiring.dtbo \ + rk322x-cpu-stability.dtbo @@ -29,10 +30,10 @@ index 000000000..dfbda5299 + diff --git a/arch/arm/boot/dts/overlay/README.rk322x-overlays b/arch/arm/boot/dts/overlay/README.rk322x-overlays new file mode 100755 -index 000000000..1abc378c9 +index 000000000..e4ea2f573 --- /dev/null +++ b/arch/arm/boot/dts/overlay/README.rk322x-overlays -@@ -0,0 +1,67 @@ +@@ -0,0 +1,68 @@ +This document describes overlays provided in the kernel packages +For generic Armbian overlays documentation please see +https://docs.armbian.com/User-Guide_Allwinner_overlays/ @@ -92,9 +93,10 @@ index 000000000..1abc378c9 +(ie: gpio and active low/high) of the onboard leds. Each board manufacturer +usually choose a different GPIO for the auxiliary led, but the main "working" +led is always wired to the same gpio (although it may be active high or low) -+led-conf1 is suited for boards usually from chiptrip brand (xt-mx4vr, xt-mx1vr, ...) -+led-conf2 is found on boards withs r329q marking -+led-conf3 is found on boards with r28-mxq marking ++led-conf1 is commonly found in boards made by Chiptrip manufacturer ++led-conf2 is found in other boards with R329Q and MXQ_RK3229 marking ++led-conf3 is found in boards with R28-MXQ marking ++led-conf4 is found on boards with T066 marking + +### rk322x-alt-wiring + @@ -470,6 +472,93 @@ index 000000000..03c99ef8b + }; + +}; +diff --git a/arch/arm/boot/dts/overlay/rk322x-led-conf4.dts b/arch/arm/boot/dts/overlay/rk322x-led-conf4.dts +new file mode 100644 +index 000000000..0ebd846eb +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/rk322x-led-conf4.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; ++ ++#include ++#include ++#include ++ ++/ { ++ ++ fragment@0 { ++ target-path = "/gpio-leds"; ++ __overlay__ { ++ ++ working { ++ gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "none"; ++ }; ++ ++ auxiliary { ++ gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_HIGH>; ++ label = "auxiliary"; ++ linux,default-trigger = "mmc2"; ++ default-state = "off"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&gpio_led_aux>; ++ }; ++ ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/pinctrl/gpio"; ++ __overlay__ { ++ ++ gpio_led_working: gpio-led-working { ++ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ gpio_led_aux: gpio-led-aux { ++ rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&gpio_keys>; ++ __overlay__ { ++ ++ reset { ++ gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; ++ label = "reset"; ++ linux,code = ; ++ debounce-interval = <200>; ++ wakeup-source; ++ }; ++ ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&sdio_pwrseq>; ++ __overlay__ { ++ ++ reset-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; /* GPIO2_D3 */ ++ ++ }; ++ ++ }; ++ ++ fragment@4 { ++ target = <&wifi_enable_h>; ++ __overlay__ { ++ ++ rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; ++ ++ }; ++ ++ }; ++ ++}; diff --git a/arch/arm/boot/dts/overlay/rk322x-nand.dts b/arch/arm/boot/dts/overlay/rk322x-nand.dts new file mode 100755 index 000000000..2a939ab49 diff --git a/patch/kernel/archive/rk322x-5.11/general-add-overlays.patch b/patch/kernel/archive/rk322x-5.11/general-add-overlays.patch index 989c4519b..0f272d05c 100644 --- a/patch/kernel/archive/rk322x-5.11/general-add-overlays.patch +++ b/patch/kernel/archive/rk322x-5.11/general-add-overlays.patch @@ -1,9 +1,9 @@ diff --git a/arch/arm/boot/dts/overlay/Makefile b/arch/arm/boot/dts/overlay/Makefile new file mode 100755 -index 000000000..dfbda5299 +index 000000000..e39fd5d37 --- /dev/null +++ b/arch/arm/boot/dts/overlay/Makefile -@@ -0,0 +1,23 @@ +@@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0 +dtbo-$(CONFIG_ARCH_ROCKCHIP) += \ + rk322x-emmc.dtbo \ @@ -12,6 +12,7 @@ index 000000000..dfbda5299 + rk322x-led-conf1.dtbo \ + rk322x-led-conf2.dtbo \ + rk322x-led-conf3.dtbo \ ++ rk322x-led-conf4.dtbo \ + rk322x-cpu-hs.dtbo \ + rk322x-wlan-alt-wiring.dtbo \ + rk322x-cpu-stability.dtbo @@ -29,10 +30,10 @@ index 000000000..dfbda5299 + diff --git a/arch/arm/boot/dts/overlay/README.rk322x-overlays b/arch/arm/boot/dts/overlay/README.rk322x-overlays new file mode 100755 -index 000000000..1abc378c9 +index 000000000..e4ea2f573 --- /dev/null +++ b/arch/arm/boot/dts/overlay/README.rk322x-overlays -@@ -0,0 +1,67 @@ +@@ -0,0 +1,68 @@ +This document describes overlays provided in the kernel packages +For generic Armbian overlays documentation please see +https://docs.armbian.com/User-Guide_Allwinner_overlays/ @@ -92,9 +93,10 @@ index 000000000..1abc378c9 +(ie: gpio and active low/high) of the onboard leds. Each board manufacturer +usually choose a different GPIO for the auxiliary led, but the main "working" +led is always wired to the same gpio (although it may be active high or low) -+led-conf1 is suited for boards usually from chiptrip brand (xt-mx4vr, xt-mx1vr, ...) -+led-conf2 is found on boards withs r329q marking -+led-conf3 is found on boards with r28-mxq marking ++led-conf1 is commonly found in boards made by Chiptrip manufacturer ++led-conf2 is found in other boards with R329Q and MXQ_RK3229 marking ++led-conf3 is found in boards with R28-MXQ marking ++led-conf4 is found on boards with T066 marking + +### rk322x-alt-wiring + @@ -470,6 +472,93 @@ index 000000000..03c99ef8b + }; + +}; +diff --git a/arch/arm/boot/dts/overlay/rk322x-led-conf4.dts b/arch/arm/boot/dts/overlay/rk322x-led-conf4.dts +new file mode 100644 +index 000000000..0ebd846eb +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/rk322x-led-conf4.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; ++ ++#include ++#include ++#include ++ ++/ { ++ ++ fragment@0 { ++ target-path = "/gpio-leds"; ++ __overlay__ { ++ ++ working { ++ gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "none"; ++ }; ++ ++ auxiliary { ++ gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_HIGH>; ++ label = "auxiliary"; ++ linux,default-trigger = "mmc2"; ++ default-state = "off"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&gpio_led_aux>; ++ }; ++ ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/pinctrl/gpio"; ++ __overlay__ { ++ ++ gpio_led_working: gpio-led-working { ++ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ gpio_led_aux: gpio-led-aux { ++ rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&gpio_keys>; ++ __overlay__ { ++ ++ reset { ++ gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; ++ label = "reset"; ++ linux,code = ; ++ debounce-interval = <200>; ++ wakeup-source; ++ }; ++ ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&sdio_pwrseq>; ++ __overlay__ { ++ ++ reset-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; /* GPIO2_D3 */ ++ ++ }; ++ ++ }; ++ ++ fragment@4 { ++ target = <&wifi_enable_h>; ++ __overlay__ { ++ ++ rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; ++ ++ }; ++ ++ }; ++ ++}; diff --git a/arch/arm/boot/dts/overlay/rk322x-nand.dts b/arch/arm/boot/dts/overlay/rk322x-nand.dts new file mode 100755 index 000000000..2a939ab49