From e2864d99fddc26c2ab11f6937f493c6390b0ad12 Mon Sep 17 00:00:00 2001 From: Jakob Leifhelm Date: Tue, 23 May 2023 19:05:21 +0200 Subject: [PATCH] starfive visionfive2: replace 8GB memory patch with overlay --- starfive/visionfive/v2/README.md | 34 ++++++++++++++++--- starfive/visionfive/v2/fix-memory-size.patch | 13 ------- starfive/visionfive/v2/linux-6.3.nix | 1 - .../visionfive/v2/visionfive-2-v1.2a-8GB.dts | 11 ++++++ .../visionfive/v2/visionfive-2-v1.3b-8GB.dts | 11 ++++++ 5 files changed, 52 insertions(+), 18 deletions(-) delete mode 100644 starfive/visionfive/v2/fix-memory-size.patch create mode 100644 starfive/visionfive/v2/visionfive-2-v1.2a-8GB.dts create mode 100644 starfive/visionfive/v2/visionfive-2-v1.3b-8GB.dts diff --git a/starfive/visionfive/v2/README.md b/starfive/visionfive/v2/README.md index 51e811f..64f4c84 100644 --- a/starfive/visionfive/v2/README.md +++ b/starfive/visionfive/v2/README.md @@ -31,10 +31,6 @@ Create and configure the `flake.nix` file: # networking.interfaces.end0.useDHCP = true; # networking.interfaces.end1.useDHCP = true; - # If you have the 2A variant uncomment the following line - # hardware.deviceTree.name = - # lib.mkDefault "starfive/jh7110-starfive-visionfive-2-v1.2a.dtb"; - # Additional configuration goes here sdImage.compressImage = false; @@ -57,3 +53,33 @@ Build the sd image. ``` sh nix build .# ``` + +## Additional configuration +Additional configuration may be needed depending on your specific hardware configuration. +### Board rev 1.2A +If you have the 1.2A board revision add the following to your config: +``` nix +hardware.deviceTree.name = + lib.mkDefault "starfive/jh7110-starfive-visionfive-2-v1.2a.dtb"; +``` + +### 8GB memory +If your board has 8GB of RAM add the following to your config: + +#### Board rev 1.3B +``` nix +hardware.deviceTree.overlays = [{ + name = "8GB-patch"; + dtsFile = + "${nixos-hardware}/starfive/visionfive/v2/visionfive-2-v1.3b-8GB.dts"; +}]; +``` + +#### Board rev 1.2A +``` nix +hardware.deviceTree.overlays = [{ + name = "8GB-patch"; + dtsFile = + "${nixos-hardware}/starfive/visionfive/v2/visionfive-2-v1.2a-8GB.dts"; +}]; +``` diff --git a/starfive/visionfive/v2/fix-memory-size.patch b/starfive/visionfive/v2/fix-memory-size.patch deleted file mode 100644 index a8bd5bc..0000000 --- a/starfive/visionfive/v2/fix-memory-size.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi -index 752bb0b6fd00..93670da6cabd 100644 ---- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi -+++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi -@@ -30,7 +30,7 @@ cpus { - - memory@40000000 { - device_type = "memory"; -- reg = <0x0 0x40000000 0x1 0x0>; -+ reg = <0x0 0x40000000 0x2 0x0>; - }; - - thermal-zones { diff --git a/starfive/visionfive/v2/linux-6.3.nix b/starfive/visionfive/v2/linux-6.3.nix index 0a07584..6d7ed86 100644 --- a/starfive/visionfive/v2/linux-6.3.nix +++ b/starfive/visionfive/v2/linux-6.3.nix @@ -15,7 +15,6 @@ let inherit modDirVersion; kernelPatches = [ - { patch = ./fix-memory-size.patch; } { patch = fetchpatch { url = diff --git a/starfive/visionfive/v2/visionfive-2-v1.2a-8GB.dts b/starfive/visionfive/v2/visionfive-2-v1.2a-8GB.dts new file mode 100644 index 0000000..9478eae --- /dev/null +++ b/starfive/visionfive/v2/visionfive-2-v1.2a-8GB.dts @@ -0,0 +1,11 @@ +/dts-v1/; +/plugin/; +/ { + compatible = "starfive,visionfive-2-v1.2a", "starfive,jh7110"; + fragment@0 { + target-path = "/memory@40000000"; + __overlay__ { + reg = <0x0 0x40000000 0x2 0x0>; + }; + }; +}; diff --git a/starfive/visionfive/v2/visionfive-2-v1.3b-8GB.dts b/starfive/visionfive/v2/visionfive-2-v1.3b-8GB.dts new file mode 100644 index 0000000..f18a6a2 --- /dev/null +++ b/starfive/visionfive/v2/visionfive-2-v1.3b-8GB.dts @@ -0,0 +1,11 @@ +/dts-v1/; +/plugin/; +/ { + compatible = "starfive,visionfive-2-v1.3b", "starfive,jh7110"; + fragment@0 { + target-path = "/memory@40000000"; + __overlay__ { + reg = <0x0 0x40000000 0x2 0x0>; + }; + }; +};