From 73e129640799770fefa54e5c9f997a3ecc73af3c Mon Sep 17 00:00:00 2001 From: Ando Date: Fri, 19 Dec 2025 18:48:00 +1100 Subject: [PATCH 1/3] fix: Re-enable reset button --- nix/builders/nanopc-t6/base.nix | 4 ++++ nix/builders/nanopc-t6/pmic.patch | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 nix/builders/nanopc-t6/pmic.patch diff --git a/nix/builders/nanopc-t6/base.nix b/nix/builders/nanopc-t6/base.nix index ba0c3c4..2e61b9b 100644 --- a/nix/builders/nanopc-t6/base.nix +++ b/nix/builders/nanopc-t6/base.nix @@ -63,6 +63,10 @@ name = "rk3588-nanopc-t6.dtsi.patch"; patch = ./rk3588-nanopc-t6.dtsi.patch; } + { + name = "pmic.patch"; + patch = ./pmic.patch; + } ]; boot.initrd.availableKernelModules = [ diff --git a/nix/builders/nanopc-t6/pmic.patch b/nix/builders/nanopc-t6/pmic.patch new file mode 100644 index 0000000..dd5f958 --- /dev/null +++ b/nix/builders/nanopc-t6/pmic.patch @@ -0,0 +1,31 @@ +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi +index fafeabe9a..bc05f4bba 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include "rk8xx.h" + #include "rk3588.dtsi" + + / { +@@ -769,8 +770,16 @@ pmic@0 { + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; + + pinctrl-names = "default"; +- pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>, +- <&rk806_dvs2_null>, <&rk806_dvs3_null>; ++ pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>, <&rk806_dvs2_null>, <&rk806_dvs3_null>; ++ ++ /* RK806_RESTART 0: restart PMU; ++ * RK806_RESET 1: reset all the power off reset registers, ++ * forcing the state to switch to ACTIVE mode; ++ * RK806_RESET_NOTIFY 2: Reset all the power off reset registers, ++ * forcing the state to switch to ACTIVE mode, ++ * and simultaneously pull down the RESETB PIN for 5mS before releasing ++ */ ++ rockchip,reset-mode = ; + + system-power-controller; + From 81928ef25d21b7e4475044543e7c69fc88fcf986 Mon Sep 17 00:00:00 2001 From: Ando Date: Fri, 9 Jan 2026 09:41:49 +1100 Subject: [PATCH 2/3] this also doesn't work, but it shows a better way to use device tree overlays --- flake.lock | 36 +++++----- nix/builders/nanopc-t6/base.nix | 116 ++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+), 18 deletions(-) diff --git a/flake.lock b/flake.lock index 7fcaf3e..2fff152 100644 --- a/flake.lock +++ b/flake.lock @@ -56,11 +56,11 @@ ] }, "locked": { - "lastModified": 1776396796, - "narHash": "sha256-tJeor6OSnm2xJ6tlqFl3z70vzWF17Rt2aNN9tfqw/JE=", + "lastModified": 1776743529, + "narHash": "sha256-ArmQ/dShCodEvn9Dc3J4MI0AxrY6HOv+EFencddIAJI=", "owner": "dogebox-wg", "repo": "dogeboxd", - "rev": "8f23a91297d47386c5a14c58a0382b35f616fb23", + "rev": "6c3e77cbd8033e66c592b8b9a3296314d961e3ca", "type": "github" }, "original": { @@ -80,11 +80,11 @@ "playwright": "playwright" }, "locked": { - "lastModified": 1776134597, - "narHash": "sha256-heCvekpvlA5At68Lea2rCQU1dIMnev471pVzi08Ba3c=", + "lastModified": 1776665351, + "narHash": "sha256-cMkHzWomzclhXjPIrDn2LuPAk6RhxlVy3SoW86r0eG0=", "owner": "dogebox-wg", "repo": "dpanel", - "rev": "909bbece63608747bff29aecbdc2a0c11d466ca6", + "rev": "60a5c9020776ae47667de5f93941d18b86bd49cd", "type": "github" }, "original": { @@ -232,11 +232,11 @@ }, "nixpkgsUnstable": { "locked": { - "lastModified": 1775710090, - "narHash": "sha256-ar3rofg+awPB8QXDaFJhJ2jJhu+KqN/PRCXeyuXR76E=", + "lastModified": 1777578337, + "narHash": "sha256-Ad49moKWeXtKBJNy2ebiTQUEgdLyvGmTeykAQ9xM+Z4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4c1018dae018162ec878d42fec712642d214fdfa", + "rev": "15f4ee454b1dce334612fa6843b3e05cf546efab", "type": "github" }, "original": { @@ -248,11 +248,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1776221942, - "narHash": "sha256-FbQAeVNi7G4v3QCSThrSAAvzQTmrmyDLiHNPvTF2qFM=", + "lastModified": 1778003029, + "narHash": "sha256-q/nkKLDtHIyLjZpKhWk3cSK5IYsFqtMd6UtXF3ddjgA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1766437c5509f444c1b15331e82b8b6a9b967000", + "rev": "0c88e1f2bdb93d5999019e99cb0e61e1fe2af4c5", "type": "github" }, "original": { @@ -289,11 +289,11 @@ ] }, "locked": { - "lastModified": 1775585728, - "narHash": "sha256-8Psjt+TWvE4thRKktJsXfR6PA/fWWsZ04DVaY6PUhr4=", + "lastModified": 1776796298, + "narHash": "sha256-PcRvlWayisPSjd0UcRQbhG8Oqw78AcPE6x872cPRHN8=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "580633fa3fe5fc0379905986543fd7495481913d", + "rev": "3cfd774b0a530725a077e17354fbdb87ea1c4aad", "type": "github" }, "original": { @@ -309,11 +309,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1776107127, - "narHash": "sha256-+7h+3CvZEqU75bI1q4xEgkLhgA4Efhv+qAJy9XycxlI=", + "lastModified": 1777922305, + "narHash": "sha256-QQrZcuYQi8jcxZZKZhlCpEqNKUbqjtgI3dnKWR1859I=", "owner": "nabam", "repo": "nixos-rockchip", - "rev": "c2a1cf8975e11ed9cc8e55867ee65e3a5dbc40d4", + "rev": "cb5aced8be90c37166e9614aaa11f5777f662068", "type": "github" }, "original": { diff --git a/nix/builders/nanopc-t6/base.nix b/nix/builders/nanopc-t6/base.nix index 2e61b9b..883f79a 100644 --- a/nix/builders/nanopc-t6/base.nix +++ b/nix/builders/nanopc-t6/base.nix @@ -62,6 +62,12 @@ { name = "rk3588-nanopc-t6.dtsi.patch"; patch = ./rk3588-nanopc-t6.dtsi.patch; + extraConfig = '' + PINCTRL_RK805 y + RESET_GPIO y + POWER_RESET_GPIO y + POWER_RESET_GPIO_RESTART y + ''; } { name = "pmic.patch"; @@ -185,4 +191,114 @@ ln -sf ${nanopc-t6-rk3588-firmware}/lib/firmware/ /lib/firmware ln -sf ${nanopc-t6-rk3588-firmware}/system/ /system ''; + + hardware.deviceTree.overlays = [ + { + name = "pmic-fix"; + dtsText = '' + /dts-v1/; + /plugin/; + + #include + #include + + &{/spi2} { + compatible = "rockchip,rk3588"; + pmic@0 { + compatible = "rockchip,rk806"; + pinctrl-names = "default", "pmic-power-off"; + pinctrl-1 = <&rk806_dvs1_pwrdn>; + + rockchip,reset-mode = <1>; + + pwrkey { + status = "okay"; + }; + + /// START COPY + rk806_dvs1_null: dvs1-null-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun0"; + }; + + rk806_dvs2_null: dvs2-null-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun0"; + }; + + rk806_dvs3_null: dvs3-null-pins { + pins = "gpio_pwrctrl3"; + function = "pin_fun0"; + }; + + rk806_dvs1_slp: dvs1-slp-pins { + pins = "gpio_pwrctrl1"; + function = "pin_fun1"; + }; + + rk806_dvs2_slp: dvs2-slp-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun1"; + }; + + rk806_dvs3_slp: dvs3-slp-pins { + pins = "gpio_pwrctrl3"; + function = "pin_fun1"; + }; + + rk806_dvs1_pwrdn: dvs1-pwrdn-pins { + pins = "gpio_pwrctrl1"; + function = "pin_fun2"; + }; + + rk806_dvs2_pwrdn: dvs2-pwrdn-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun2"; + }; + + rk806_dvs3_pwrdn: dvs3-pwrdn-pins { + pins = "gpio_pwrctrl3"; + function = "pin_fun2"; + }; + + rk806_dvs1_rst: dvs1-rst-pins { + pins = "gpio_pwrctrl1"; + function = "pin_fun3"; + }; + + rk806_dvs2_rst: dvs2-rst-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun3"; + }; + + rk806_dvs3_rst: dvs3-rst-pins { + pins = "gpio_pwrctrl3"; + function = "pin_fun3"; + }; + + + rk806_dvs2_dvs: dvs2-dvs-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun4"; + }; + + rk806_dvs2_gpio: dvs2-gpio-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun5"; + }; + + rk806_dvs3_dvs: dvs3-dvs-pins { + pins = "gpio_pwrctrl3"; + function = "pin_fun4"; + }; + + rk806_dvs3_gpio: dvs3-gpio-pins { + pins = "gpio_pwrctrl3"; + function = "pin_fun5"; + }; + }; + }; + ''; + } + ]; } From 91cd01a4f3769224790a0ba8a4a42f20000aa990 Mon Sep 17 00:00:00 2001 From: "Ando \"Thor\" Nando" Date: Mon, 19 Jan 2026 14:20:36 +1100 Subject: [PATCH 3/3] stuff --- nix/builders/nanopc-t6/base.nix | 110 ------------------------------ nix/builders/nanopc-t6/pmic.patch | 11 +++ 2 files changed, 11 insertions(+), 110 deletions(-) diff --git a/nix/builders/nanopc-t6/base.nix b/nix/builders/nanopc-t6/base.nix index 883f79a..fb8fb24 100644 --- a/nix/builders/nanopc-t6/base.nix +++ b/nix/builders/nanopc-t6/base.nix @@ -191,114 +191,4 @@ ln -sf ${nanopc-t6-rk3588-firmware}/lib/firmware/ /lib/firmware ln -sf ${nanopc-t6-rk3588-firmware}/system/ /system ''; - - hardware.deviceTree.overlays = [ - { - name = "pmic-fix"; - dtsText = '' - /dts-v1/; - /plugin/; - - #include - #include - - &{/spi2} { - compatible = "rockchip,rk3588"; - pmic@0 { - compatible = "rockchip,rk806"; - pinctrl-names = "default", "pmic-power-off"; - pinctrl-1 = <&rk806_dvs1_pwrdn>; - - rockchip,reset-mode = <1>; - - pwrkey { - status = "okay"; - }; - - /// START COPY - rk806_dvs1_null: dvs1-null-pins { - pins = "gpio_pwrctrl2"; - function = "pin_fun0"; - }; - - rk806_dvs2_null: dvs2-null-pins { - pins = "gpio_pwrctrl2"; - function = "pin_fun0"; - }; - - rk806_dvs3_null: dvs3-null-pins { - pins = "gpio_pwrctrl3"; - function = "pin_fun0"; - }; - - rk806_dvs1_slp: dvs1-slp-pins { - pins = "gpio_pwrctrl1"; - function = "pin_fun1"; - }; - - rk806_dvs2_slp: dvs2-slp-pins { - pins = "gpio_pwrctrl2"; - function = "pin_fun1"; - }; - - rk806_dvs3_slp: dvs3-slp-pins { - pins = "gpio_pwrctrl3"; - function = "pin_fun1"; - }; - - rk806_dvs1_pwrdn: dvs1-pwrdn-pins { - pins = "gpio_pwrctrl1"; - function = "pin_fun2"; - }; - - rk806_dvs2_pwrdn: dvs2-pwrdn-pins { - pins = "gpio_pwrctrl2"; - function = "pin_fun2"; - }; - - rk806_dvs3_pwrdn: dvs3-pwrdn-pins { - pins = "gpio_pwrctrl3"; - function = "pin_fun2"; - }; - - rk806_dvs1_rst: dvs1-rst-pins { - pins = "gpio_pwrctrl1"; - function = "pin_fun3"; - }; - - rk806_dvs2_rst: dvs2-rst-pins { - pins = "gpio_pwrctrl2"; - function = "pin_fun3"; - }; - - rk806_dvs3_rst: dvs3-rst-pins { - pins = "gpio_pwrctrl3"; - function = "pin_fun3"; - }; - - - rk806_dvs2_dvs: dvs2-dvs-pins { - pins = "gpio_pwrctrl2"; - function = "pin_fun4"; - }; - - rk806_dvs2_gpio: dvs2-gpio-pins { - pins = "gpio_pwrctrl2"; - function = "pin_fun5"; - }; - - rk806_dvs3_dvs: dvs3-dvs-pins { - pins = "gpio_pwrctrl3"; - function = "pin_fun4"; - }; - - rk806_dvs3_gpio: dvs3-gpio-pins { - pins = "gpio_pwrctrl3"; - function = "pin_fun5"; - }; - }; - }; - ''; - } - ]; } diff --git a/nix/builders/nanopc-t6/pmic.patch b/nix/builders/nanopc-t6/pmic.patch index dd5f958..ecb4695 100644 --- a/nix/builders/nanopc-t6/pmic.patch +++ b/nix/builders/nanopc-t6/pmic.patch @@ -29,3 +29,14 @@ index fafeabe9a..bc05f4bba 100644 system-power-controller; +@@ -1081,6 +1090,10 @@ + status = "okay"; + }; + ++&tsadc_shut_org { ++ rockchip,pins = <0 RK_PA1 1 &pcfg_pull_down_drv_level_0>; ++}; ++ + &uart2 { + pinctrl-0 = <&uart2m0_xfer>; + status = "okay"; \ No newline at end of file