├── .editorconfig ├── .envrc ├── .github └── workflows │ └── build.yml ├── .gitignore ├── LICENSE.txt ├── Readme.md ├── devices ├── by-name │ ├── nixos-aarch64-uefi.nix │ ├── nixos-bozz-sw799.nix │ ├── nixos-cdhx-rb30.nix │ ├── nixos-friendly-nanopc-t6.nix │ ├── nixos-hinlink-h88k.nix │ ├── nixos-phytium-uefi.nix │ ├── nixos-radxa-rock-5a.nix │ ├── nixos-radxa-rock-5b.nix │ ├── nixos-x86_64-generic.nix │ ├── nixos-x86_64-uefi.nix │ ├── nixos-xunlong-orangepi-5-plus.nix │ └── nixos-xunlong-orangepi-5.nix └── default.nix ├── dts ├── mainline │ ├── overlay │ │ └── h88k-enable-rs232-rs485.dts │ ├── rk3399-aio-3399b-u-boot.dtsi │ ├── rk3399-aio-3399b.dts │ ├── rk3399-bozz-sw799a-5g-u-boot.dtsi │ ├── rk3399-bozz-sw799a-5g.dts │ ├── rk3399-cdhx-rb30-u-boot.dtsi │ ├── rk3399-cdhx-rb30.dts │ ├── rk3399-eaio-3399j-u-boot.dtsi │ ├── rk3399-eaio-3399j.dts │ ├── rk3399-fine3399-u-boot.dtsi │ ├── rk3399-fine3399.dts │ └── rk3588-hinlink-h88k.dts └── vendor │ ├── overlay │ └── h88k-enable-hdmiphy.dts │ └── rk3588-hinlink-h88k.dts ├── flake.lock ├── flake.nix ├── hosts ├── by-name │ ├── azure-b1s.nix │ ├── h88k.nix │ ├── nanopc-t6.nix │ ├── opi5-plus.nix │ ├── opi5.nix │ ├── rb30.nix │ ├── rock-5a.nix │ └── rock-5b.nix ├── default.nix └── readme.md ├── modules ├── config │ ├── desktop.nix │ ├── networking.nix │ ├── nixpkgs.nix │ ├── passless.nix │ └── rsync-nixosconfig.nix ├── default.nix ├── disko │ ├── btrfs.nix │ ├── disk-image.nix │ ├── ext4.nix │ └── uboot.nix ├── hardware │ └── serial.nix ├── overlay │ ├── hardware │ │ └── device-tree.nix │ └── system │ │ └── boot │ │ └── loader │ │ ├── grub.nix │ │ └── install-grub.pl └── system │ └── grow-partition.nix ├── overlays.nix ├── patches ├── kernel │ ├── gobinet-for-longsung.patch │ └── serial-option-for-fm350.patch └── u-boot │ └── add-smbios-config.patch ├── pkgs ├── armbian-firmware.nix ├── armbianBuild.nix ├── brcmfmac-firmware.nix ├── linux_phytium_6_6.nix ├── linux_rkbsp_6_1.nix ├── linux_rockchip64_6_12.nix ├── linux_rockchip64_6_14.nix ├── ubootBozzSW799.nix ├── ubootCdhxRb30.nix ├── ubootHinlinkH88k.nix ├── ubootNanoPCT6.nix ├── ubootOrangePi5.nix ├── ubootOrangePi5Plus.nix ├── ubootRock5ModelA.nix └── ubootRock5ModelB.nix ├── templates └── flake.nix └── tools ├── rk3399_loader_v1.24.126.bin └── rk3588_spl_loader_v1.08.111.bin /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig configuration for nixpkgs 2 | # https://EditorConfig.org 3 | 4 | # Top-most EditorConfig file 5 | root = true 6 | 7 | # Unix-style newlines with a newline ending every file, utf-8 charset 8 | [*] 9 | end_of_line = lf 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | charset = utf-8 13 | 14 | # Ignore diffs/patches 15 | [*.{diff,patch}] 16 | end_of_line = unset 17 | insert_final_newline = unset 18 | trim_trailing_whitespace = unset 19 | 20 | # We want readFile .version to return the version without a newline. 21 | [.version] 22 | insert_final_newline = false 23 | 24 | # see https://nixos.org/nixpkgs/manual/#chap-conventions 25 | 26 | # Match json/lockfiles/markdown/nix/perl/python/ruby/shell/docbook files, set indent to spaces 27 | [*.{bash,json,lock,md,nix,pl,pm,py,rb,sh,xml}] 28 | indent_style = space 29 | 30 | # Match docbook files, set indent width of one 31 | [*.xml] 32 | indent_size = 1 33 | 34 | # Match json/lockfiles/markdown/nix/ruby files, set indent width of two 35 | [*.{json,lock,md,nix,rb}] 36 | indent_size = 2 37 | 38 | # Match perl/python/shell scripts, set indent width of four 39 | [*.{bash,pl,pm,py,sh}] 40 | indent_size = 4 41 | 42 | # Match gemfiles, set indent to spaces with width of two 43 | [Gemfile] 44 | indent_size = 2 45 | indent_style = space 46 | 47 | # Match package.json, which are generally pulled from upstream and accept them as they are 48 | [package.json] 49 | indent_style = unset 50 | 51 | # Disable file types or individual files 52 | # some of these files may be auto-generated and/or require significant changes 53 | 54 | [*.{c,h}] 55 | insert_final_newline = unset 56 | trim_trailing_whitespace = unset 57 | 58 | [*.{asc,key,ovpn}] 59 | insert_final_newline = unset 60 | end_of_line = unset 61 | trim_trailing_whitespace = unset 62 | 63 | [*.lock] 64 | indent_size = unset 65 | 66 | # Although Markdown/CommonMark allows using two trailing spaces to denote 67 | # a hard line break, we do not use that feature in nixpkgs since 68 | # it forces the surrounding paragraph to become a which 69 | # does not wrap reasonably. 70 | # Instead of a hard line break, start a new paragraph by inserting a blank line. 71 | [*.md] 72 | trim_trailing_whitespace = true 73 | 74 | # binaries 75 | [*.nib] 76 | end_of_line = unset 77 | insert_final_newline = unset 78 | trim_trailing_whitespace = unset 79 | charset = unset 80 | 81 | [eggs.nix] 82 | trim_trailing_whitespace = unset 83 | 84 | [nixos/modules/services/networking/ircd-hybrid/*.{conf,in}] 85 | trim_trailing_whitespace = unset 86 | 87 | [pkgs/build-support/dotnetenv/Wrapper/**] 88 | end_of_line = unset 89 | indent_style = unset 90 | insert_final_newline = unset 91 | trim_trailing_whitespace = unset 92 | 93 | [pkgs/development/compilers/elm/registry.dat] 94 | end_of_line = unset 95 | insert_final_newline = unset 96 | 97 | [pkgs/development/haskell-modules/hackage-packages.nix] 98 | indent_style = unset 99 | trim_trailing_whitespace = unset 100 | 101 | [pkgs/misc/documentation-highlighter/**] 102 | insert_final_newline = unset 103 | 104 | [pkgs/servers/dict/wordnet_structures.py] 105 | trim_trailing_whitespace = unset 106 | 107 | [pkgs/tools/misc/timidity/timidity.cfg] 108 | trim_trailing_whitespace = unset 109 | 110 | [pkgs/tools/virtualization/ovftool/*.ova] 111 | end_of_line = unset 112 | insert_final_newline = unset 113 | trim_trailing_whitespace = unset 114 | charset = unset 115 | 116 | [lib/tests/*.plist] 117 | indent_style = tab 118 | insert_final_newline = unset 119 | 120 | [pkgs/kde/generated/**] 121 | insert_final_newline = unset 122 | end_of_line = unset 123 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | use flake -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: "Build" 2 | on: 3 | repository_dispatch: 4 | workflow_dispatch: 5 | inputs: 6 | release: 7 | description: "release" 8 | required: true 9 | type: string 10 | 11 | env: 12 | GH_TOKEN: ${{ secrets.GH_TOKEN }} 13 | 14 | jobs: 15 | release: 16 | name: Create Release 17 | runs-on: ubuntu-latest 18 | permissions: write-all 19 | steps: 20 | - uses: actions/checkout@v4 21 | - name: Create new release 22 | run: | 23 | if ! gh release view ${{ inputs.release }}; then 24 | gh release create ${{ inputs.release }} --title ${{ inputs.release }} 25 | fi 26 | 27 | images: 28 | needs: release 29 | strategy: 30 | fail-fast: false 31 | matrix: 32 | device: 33 | - x86_64-generic 34 | - x86_64-uefi 35 | - aarch64-uefi 36 | - friendly-nanopc-t6 37 | - radxa-rock-5a 38 | - radxa-rock-5b 39 | - xunlong-orangepi-5-plus 40 | - xunlong-orangepi-5 41 | - hinlink-h88k 42 | runs-on: ubuntu-latest 43 | steps: 44 | - uses: actions/checkout@v4 45 | - uses: docker/setup-qemu-action@v3 46 | - uses: cachix/install-nix-action@v31 47 | with: 48 | enable_kvm: true 49 | extra_nix_config: | 50 | extra-platforms = aarch64-linux i686-linux 51 | experimental-features = nix-command flakes 52 | system-features = nixos-test benchmark big-parallel kvm 53 | trusted-public-keys = cache.qbisi.cc-1:xEChzP5k8fj+7wajY+e9IDORRTGMhViP5NaqMShGGjQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= 54 | substituters = https://cache.qbisi.cc https://cache.nixos.org/ 55 | - name: Set Swap Space 56 | uses: pierotofy/set-swap-space@master 57 | with: 58 | swap-size-gb: 32 59 | - name: Build image 60 | run: nix build .#images.nixos-${{ matrix.device }} 61 | - name: Upload 62 | run: gh release upload ${{ inputs.release }} result/* 63 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | result* 2 | source 3 | outputs 4 | .direnv -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 qbisicwate 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Nixos-images 2 | 3 | ## Introduction 4 | 5 | Bootstrap NixOS images for servers, PCs, and SBCs. The provided images use a preset disk partition and will automatically expand to the full size after startup. The system has a passwordless root account that can be accessed locally or remotely, facilitating the deployment of your own NixOS configuration. 6 | 7 | **Note:** The bootstrap system disables the firewall and allows root login via SSH without a password. Therefore, leaving the system unchanged on the public internet is unsafe and dangerous. You should set your own password or SSH key as soon as possible. 8 | 9 | --- 10 | 11 | ## Features 12 | 13 | - Pre-configured NixOS bootstrap images for different environments (servers, PCs, SBCs) 14 | - Automatic disk resizing to fit the full available space after first boot 15 | - Passwordless root access for easy configuration deployment 16 | - Example configurations provided for Colmena deployment 17 | 18 | --- 19 | 20 | ## Getting Started 21 | 22 | ### Option 1: Local Installation (PC, SBC, Server) 23 | 24 | 1. Download the appropriate NixOS image from the [releases page](#link-to-releases). 25 | 2. Flash the image to your storage media (e.g., using `dd`, Etcher, etc.). 26 | 3. Boot the device — the root partition will resize automatically. 27 | 28 | ### Option 2: Cloud Server Installation 29 | 30 | For cloud servers, you can use the [bin456789/reinstall](https://github.com/bin456789/reinstall) script to streamline the installation process. This script reboots the server into a minimal Alpine Linux environment that runs entirely in memory, and then uses `dd` to overwrite the disk with the NixOS image. 31 | 32 | **Run the following one-liner to reinstall the NixOS image on your cloud server:** 33 | 34 | ```bash 35 | ## x86_64-linux 36 | bash <(curl -L https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh) dd --password 123@@@ --img=https://github.com/qbisi/nixos-images/releases/download/20241101/nixos-x86_64-generic.raw.xz && reboot 37 | ## aarch64 38 | bash <(curl -L https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh) dd --password 123@@@ --img=https://github.com/qbisi/nixos-images/releases/download/20241101/nixos-aarch64-uefi.raw.xz && reboot 39 | ``` 40 | 41 | ## Custom your own configuration 42 | This project provide a init template that accept this repo as a flake inputs. 43 | ``` 44 | nix flake new -t github:qbisi/nixos-images my-nixos-config 45 | ``` 46 | 47 | ## Building the Image Yourself 48 | 49 | For advanced users looking to build a custom NixOS image from this Nix-based flake source, follow the steps below: 50 | 51 | ### Prerequisites 52 | 53 | Ensure you have the following installed: 54 | 55 | - **Nix**: Follow the installation instructions at [nixos.org](https://nixos.org/download.html). 56 | - **Flakes Support**: Enable flakes in your Nix configuration by adding the following line to `/etc/nix/nix.conf`: 57 | 58 | ```ini 59 | experimental-features = nix-command flakes 60 | ``` 61 | 62 | ### Build Process 63 | 64 | Use the following command to build your desired NixOS image. 65 | Replace ${device} with the appropriate device type (e.g., nixos-x86_64-generic). 66 | Replace ${partlabel} with the appropriate media type (e.g., nvme, mmc, hdd). 67 | 68 | ```bash 69 | PARTLABEL=${partlabel} nix build github:qbisi/nixos-images#images.${device} 70 | ``` 71 | 72 | Once the build is complete, the resulting image will be located in the result directory: 73 | ```bash 74 | ls result/ 75 | ``` 76 | You should see the generated NixOS image file. 77 | 78 | ### Note 79 | All disko-images are built on x86_64 hosts, to build aarch64-images, you should enable binfmt by add this line to your nixos configuration. 80 | ``` 81 | boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; 82 | ``` 83 | -------------------------------------------------------------------------------- /devices/by-name/nixos-aarch64-uefi.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | inputs, 6 | self, 7 | ... 8 | }: 9 | { 10 | nixpkgs = { 11 | system = "aarch64-linux"; 12 | }; 13 | 14 | disko = { 15 | enableConfig = true; 16 | bootImage.fileSystem = "btrfs"; 17 | }; 18 | 19 | hardware = { 20 | serial = { 21 | enable = true; 22 | }; 23 | }; 24 | 25 | boot = { 26 | kernelParams = [ 27 | "net.ifnames=0" 28 | "console=tty1" 29 | "earlycon" 30 | ]; 31 | 32 | loader.grub.enable = true; 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /devices/by-name/nixos-bozz-sw799.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | inputs, 6 | self, 7 | ... 8 | }: 9 | { 10 | nixpkgs = { 11 | system = "aarch64-linux"; 12 | config = { 13 | allowUnfreePredicate = 14 | pkg: 15 | builtins.elem (pkgs.lib.getName pkg) [ 16 | "arm-trusted-firmware-rk3399" 17 | ]; 18 | }; 19 | }; 20 | 21 | networking.hostName = lib.mkDefault "sw799"; 22 | 23 | disko = { 24 | enableConfig = true; 25 | bootImage = { 26 | fileSystem = "btrfs"; 27 | espStart = "16M"; 28 | uboot.enable = true; 29 | uboot.package = pkgs.ubootBozzSW799; 30 | }; 31 | }; 32 | 33 | hardware = { 34 | firmware = [ pkgs.brcmfmac-firmware ]; 35 | serial = { 36 | enable = true; 37 | unit = 2; 38 | baudrate = 1500000; 39 | }; 40 | }; 41 | 42 | boot = { 43 | kernelPackages = pkgs.linuxPackages_latest; 44 | kernelParams = [ 45 | "net.ifnames=0" 46 | "console=tty1" 47 | "earlycon" 48 | ]; 49 | loader.grub.enable = true; 50 | }; 51 | 52 | } 53 | -------------------------------------------------------------------------------- /devices/by-name/nixos-cdhx-rb30.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | inputs, 6 | self, 7 | ... 8 | }: 9 | { 10 | nixpkgs = { 11 | system = "aarch64-linux"; 12 | config = { 13 | allowUnfreePredicate = 14 | pkg: 15 | builtins.elem (pkgs.lib.getName pkg) [ 16 | "arm-trusted-firmware-rk3399" 17 | ]; 18 | }; 19 | }; 20 | 21 | networking.hostName = lib.mkDefault "rb30"; 22 | 23 | disko = { 24 | enableConfig = true; 25 | bootImage = { 26 | fileSystem = "btrfs"; 27 | espStart = "16M"; 28 | uboot.enable = true; 29 | uboot.package = pkgs.ubootCdhxRb30; 30 | }; 31 | }; 32 | 33 | hardware = { 34 | firmware = [ pkgs.brcmfmac-firmware ]; 35 | serial = { 36 | enable = true; 37 | unit = 2; 38 | baudrate = 1500000; 39 | }; 40 | }; 41 | 42 | boot = { 43 | # kernelPackages = pkgs.linuxPackages_latest; 44 | kernelParams = [ 45 | "net.ifnames=0" 46 | "console=tty1" 47 | "earlycon" 48 | ]; 49 | loader.grub.enable = true; 50 | }; 51 | 52 | } 53 | -------------------------------------------------------------------------------- /devices/by-name/nixos-friendly-nanopc-t6.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | inputs, 6 | self, 7 | ... 8 | }: 9 | { 10 | nixpkgs = { 11 | system = "aarch64-linux"; 12 | }; 13 | 14 | networking.hostName = lib.mkDefault "nanopc-t6"; 15 | 16 | disko = { 17 | enableConfig = true; 18 | bootImage = { 19 | fileSystem = "btrfs"; 20 | espStart = "16M"; 21 | uboot.enable = true; 22 | uboot.package = pkgs.ubootNanoPCT6; 23 | }; 24 | }; 25 | 26 | hardware = { 27 | firmware = [ 28 | pkgs.armbian-firmware 29 | ]; 30 | deviceTree = { 31 | name = "rockchip/rk3588-nanopc-t6.dtb"; 32 | }; 33 | serial = { 34 | enable = true; 35 | unit = 2; 36 | baudrate = 1500000; 37 | }; 38 | }; 39 | 40 | boot = { 41 | kernelPackages = pkgs.linuxPackagesFor pkgs.linux_rockchip64_6_14; 42 | initrd.availableKernelModules = lib.mkForce [ ]; 43 | kernelParams = [ 44 | "net.ifnames=0" 45 | "console=tty1" 46 | "earlycon" 47 | ]; 48 | loader.grub.enable = true; 49 | }; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /devices/by-name/nixos-hinlink-h88k.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | inputs, 6 | self, 7 | ... 8 | }: 9 | { 10 | nixpkgs = { 11 | system = "aarch64-linux"; 12 | }; 13 | 14 | networking.hostName = lib.mkDefault "h88k"; 15 | 16 | disko = { 17 | enableConfig = true; 18 | bootImage = { 19 | imageSize = "2G"; 20 | fileSystem = "btrfs"; 21 | espStart = "16M"; 22 | uboot.enable = true; 23 | uboot.package = pkgs.ubootHinlinkH88k; 24 | }; 25 | }; 26 | 27 | hardware = { 28 | firmware = [ 29 | (pkgs.armbian-firmware.override { 30 | filters = [ 31 | "arm/mali/*" 32 | "rtl_nic/*" 33 | "mediatek/*" 34 | "regulatory.db" 35 | "hinlink-h88k-240x135-lcd.bin" 36 | ]; 37 | }) 38 | ]; 39 | deviceTree = { 40 | name = "rockchip/rk3588-hinlink-h88k.dtb"; 41 | platform = "rockchip"; 42 | dtsFile = ../../dts/mainline/rk3588-hinlink-h88k.dts; 43 | }; 44 | serial = { 45 | enable = true; 46 | unit = 2; 47 | baudrate = 1500000; 48 | }; 49 | }; 50 | 51 | services.udev.packages = [ 52 | (pkgs.writeTextFile { 53 | name = "naming-audios-udev-rules"; 54 | destination = "/etc/udev/rules.d/90-naming-audios.rules"; 55 | text = '' 56 | SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-hdmi0-sound", ENV{SOUND_DESCRIPTION}="HDMI0 Audio" 57 | SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-hdmi1-sound", ENV{SOUND_DESCRIPTION}="HDMI1 Audio" 58 | SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-hdmiin-sound", ENV{SOUND_DESCRIPTION}="HDMI-In Audio" 59 | SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-dp0-sound", ENV{SOUND_DESCRIPTION}="DP0 Audio" 60 | SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-es8388-sound", ENV{SOUND_DESCRIPTION}="ES8388 Audio" 61 | ''; 62 | }) 63 | (pkgs.writeTextFile { 64 | name = "setting-led-udev-rules"; 65 | destination = "/etc/udev/rules.d/90-setting-led.rules"; 66 | text = '' 67 | ACTION=="add", SUBSYSTEM=="leds", KERNEL=="blue:net", ATTR{device_name}="wwan0" 68 | ACTION=="add", SUBSYSTEM=="leds", KERNEL=="blue:net", ATTR{link}="1" 69 | ACTION=="add", SUBSYSTEM=="leds", KERNEL=="blue:net", ATTR{rx}="1" 70 | ACTION=="add", SUBSYSTEM=="leds", KERNEL=="blue:net", ATTR{tx}="1" 71 | ''; 72 | }) 73 | ]; 74 | 75 | boot = { 76 | kernelPackages = pkgs.linuxPackagesFor pkgs.linux_rockchip64_6_14; 77 | initrd.availableKernelModules = lib.mkForce [ ]; 78 | kernelModules = [ "ledtrig-netdev" ]; 79 | kernelParams = [ 80 | "console=tty1" 81 | "earlycon" 82 | "net.ifnames=0" 83 | ]; 84 | loader.grub.enable = true; 85 | }; 86 | 87 | } 88 | -------------------------------------------------------------------------------- /devices/by-name/nixos-phytium-uefi.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | inputs, 6 | self, 7 | ... 8 | }: 9 | { 10 | nixpkgs = { 11 | system = "aarch64-linux"; 12 | }; 13 | 14 | disko = { 15 | enableConfig = true; 16 | bootImage.fileSystem = "btrfs"; 17 | }; 18 | 19 | hardware = { 20 | serial.enable = true; 21 | }; 22 | 23 | boot = { 24 | kernelPackages = pkgs.linuxPackagesFor pkgs.linux_phytium_6_6; 25 | kernelParams = [ 26 | "net.ifnames=0" 27 | "console=tty1" 28 | "earlycon" 29 | ]; 30 | loader.grub.enable = true; 31 | }; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /devices/by-name/nixos-radxa-rock-5a.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | inputs, 6 | self, 7 | ... 8 | }: 9 | { 10 | nixpkgs = { 11 | system = "aarch64-linux"; 12 | }; 13 | 14 | networking.hostName = lib.mkDefault "rock-5a"; 15 | 16 | disko = { 17 | enableConfig = true; 18 | bootImage = { 19 | fileSystem = "btrfs"; 20 | espStart = "16M"; 21 | uboot.enable = true; 22 | uboot.package = pkgs.ubootRock5ModelA; 23 | }; 24 | }; 25 | 26 | hardware = { 27 | firmware = [ 28 | pkgs.armbian-firmware 29 | ]; 30 | deviceTree = { 31 | name = "rockchip/rk3588s-rock-5a.dtb"; 32 | }; 33 | serial = { 34 | enable = true; 35 | unit = 2; 36 | baudrate = 1500000; 37 | }; 38 | }; 39 | 40 | boot = { 41 | kernelPackages = pkgs.linuxPackagesFor pkgs.linux_rockchip64_6_14; 42 | initrd.availableKernelModules = lib.mkForce [ ]; 43 | kernelParams = [ 44 | "net.ifnames=0" 45 | "console=tty1" 46 | "earlycon" 47 | ]; 48 | loader.grub.enable = true; 49 | }; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /devices/by-name/nixos-radxa-rock-5b.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | inputs, 6 | self, 7 | ... 8 | }: 9 | { 10 | nixpkgs = { 11 | system = "aarch64-linux"; 12 | }; 13 | 14 | networking.hostName = lib.mkDefault "rock-5b"; 15 | 16 | disko = { 17 | enableConfig = true; 18 | bootImage = { 19 | fileSystem = "btrfs"; 20 | espStart = "16M"; 21 | uboot.enable = true; 22 | uboot.package = pkgs.ubootRock5ModelB; 23 | }; 24 | }; 25 | 26 | hardware = { 27 | firmware = [ 28 | pkgs.armbian-firmware 29 | ]; 30 | deviceTree = { 31 | name = "rockchip/rk3588-rock-5b.dtb"; 32 | }; 33 | serial = { 34 | enable = true; 35 | unit = 2; 36 | baudrate = 1500000; 37 | }; 38 | }; 39 | 40 | boot = { 41 | kernelPackages = pkgs.linuxPackagesFor pkgs.linux_rockchip64_6_14; 42 | initrd.availableKernelModules = lib.mkForce [ ]; 43 | kernelParams = [ 44 | "net.ifnames=0" 45 | "console=tty1" 46 | "earlycon" 47 | ]; 48 | loader.grub.enable = true; 49 | }; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /devices/by-name/nixos-x86_64-generic.nix: -------------------------------------------------------------------------------- 1 | { 2 | imports = [ 3 | ./nixos-x86_64-uefi.nix 4 | ]; 5 | 6 | disko.bootImage.enableBiosBoot = true; 7 | boot.loader.grub.device = "/dev/disk/by-diskseq/1"; 8 | } 9 | -------------------------------------------------------------------------------- /devices/by-name/nixos-x86_64-uefi.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | inputs, 6 | self, 7 | ... 8 | }: 9 | { 10 | nixpkgs = { 11 | system = "x86_64-linux"; 12 | }; 13 | 14 | disko = { 15 | enableConfig = true; 16 | bootImage.fileSystem = "btrfs"; 17 | }; 18 | 19 | hardware = { 20 | serial.enable = true; 21 | }; 22 | 23 | boot = { 24 | kernelParams = [ 25 | "net.ifnames=0" 26 | ]; 27 | loader.grub.enable = true; 28 | }; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /devices/by-name/nixos-xunlong-orangepi-5-plus.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | inputs, 6 | self, 7 | ... 8 | }: 9 | { 10 | nixpkgs = { 11 | system = "aarch64-linux"; 12 | }; 13 | 14 | networking.hostName = lib.mkDefault "opi5-plus"; 15 | 16 | disko = { 17 | enableConfig = true; 18 | bootImage = { 19 | fileSystem = "btrfs"; 20 | espStart = "16M"; 21 | uboot.enable = true; 22 | uboot.package = pkgs.ubootOrangePi5Plus; 23 | }; 24 | }; 25 | 26 | hardware = { 27 | firmware = [ 28 | pkgs.armbian-firmware 29 | ]; 30 | deviceTree = { 31 | name = "rockchip/rk3588-orangepi-5-plus.dtb"; 32 | }; 33 | serial = { 34 | enable = true; 35 | unit = 2; 36 | baudrate = 1500000; 37 | }; 38 | }; 39 | 40 | boot = { 41 | kernelPackages = pkgs.linuxPackagesFor pkgs.linux_rockchip64_6_14; 42 | initrd.availableKernelModules = lib.mkForce [ ]; 43 | kernelParams = [ 44 | "net.ifnames=0" 45 | "console=tty1" 46 | "earlycon" 47 | ]; 48 | loader.grub.enable = true; 49 | }; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /devices/by-name/nixos-xunlong-orangepi-5.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | inputs, 6 | self, 7 | ... 8 | }: 9 | { 10 | nixpkgs = { 11 | system = "aarch64-linux"; 12 | }; 13 | 14 | networking.hostName = lib.mkDefault "opi5"; 15 | 16 | disko = { 17 | enableConfig = true; 18 | bootImage = { 19 | fileSystem = "btrfs"; 20 | espStart = "16M"; 21 | uboot.enable = true; 22 | uboot.package = pkgs.ubootOrangePi5; 23 | }; 24 | }; 25 | 26 | hardware = { 27 | firmware = [ 28 | pkgs.armbian-firmware 29 | ]; 30 | deviceTree = { 31 | name = "rockchip/rk3588s-orangepi-5.dtb"; 32 | }; 33 | serial = { 34 | enable = true; 35 | unit = 2; 36 | baudrate = 1500000; 37 | }; 38 | }; 39 | 40 | boot = { 41 | kernelPackages = pkgs.linuxPackagesFor pkgs.linux_rockchip64_6_14; 42 | initrd.availableKernelModules = lib.mkForce [ ]; 43 | kernelParams = [ 44 | "net.ifnames=0" 45 | "console=tty1" 46 | "earlycon" 47 | ]; 48 | loader.grub.enable = true; 49 | }; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /devices/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | self, 4 | inputs, 5 | ... 6 | }: 7 | { 8 | flake = rec { 9 | nixosConfigurations = lib.packagesFromDirectoryRecursive { 10 | callPackage = 11 | path: _: 12 | lib.nixosSystem { 13 | specialArgs = { 14 | inherit inputs self; 15 | }; 16 | modules = [ 17 | { 18 | disko.bootImage.imageName = lib.removeSuffix ".nix" (baseNameOf path); 19 | } 20 | path 21 | self.nixosModules.default 22 | self.nixosModules.bootstrap 23 | ]; 24 | }; 25 | directory = ./by-name; 26 | }; 27 | images = lib.mapAttrs (n: v: v.config.system.build.diskoImages) nixosConfigurations; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /dts/mainline/overlay/h88k-enable-rs232-rs485.dts: -------------------------------------------------------------------------------- 1 | /dts-v1/; 2 | /plugin/; 3 | 4 | / { 5 | 6 | compatible = "hinlink,h88k"; 7 | 8 | fragment@0 { 9 | target = <&uart3>; 10 | 11 | __overlay__ { 12 | status = "okay"; 13 | }; 14 | }; 15 | 16 | fragment@1 { 17 | target = <&uart4>; 18 | 19 | __overlay__ { 20 | pinctrl-0 = <&uart4m0_xfer>; 21 | status = "okay"; 22 | }; 23 | }; 24 | }; -------------------------------------------------------------------------------- /dts/mainline/rk3399-aio-3399b-u-boot.dtsi: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0 2 | 3 | #include "rk3399-u-boot.dtsi" 4 | #include "rk3399-sdram-ddr3-1600.dtsi" 5 | #include "rk3399-sdram-lpddr4-100.dtsi" 6 | / { 7 | chosen { 8 | u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc; 9 | }; 10 | }; 11 | 12 | &vdd_log { 13 | regulator-min-microvolt = <430000>; 14 | regulator-init-microvolt = <950000>; 15 | }; 16 | -------------------------------------------------------------------------------- /dts/mainline/rk3399-bozz-sw799a-5g-u-boot.dtsi: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0+ 2 | #include "rk3399-u-boot.dtsi" 3 | #include "rk3399-sdram-lpddr4-100.dtsi" 4 | 5 | / { 6 | chosen { 7 | u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc; 8 | }; 9 | 10 | }; 11 | 12 | &vdd_log { 13 | regulator-init-microvolt = <950000>; 14 | }; 15 | -------------------------------------------------------------------------------- /dts/mainline/rk3399-bozz-sw799a-5g.dts: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: (GPL-2.0+ OR MIT) 2 | /dts-v1/; 3 | 4 | #include 5 | #include 6 | #include 7 | #include "rk3399.dtsi" 8 | #include "rk3399-opp.dtsi" 9 | 10 | 11 | / { 12 | model = "Bozz SW799A"; 13 | compatible = "rockchip,rk3399-bozz", "rockchip,rk3399"; 14 | 15 | aliases { 16 | mmc2 = &sdio0; 17 | mmc1 = &sdmmc; 18 | mmc0 = &sdhci; 19 | }; 20 | 21 | chosen { 22 | stdout-path = "serial2:1500000n8"; 23 | bootargs = "earlycon=uart8250,mmio32,0xff1a0000"; 24 | }; 25 | 26 | clkin_gmac: external-gmac-clock { 27 | compatible = "fixed-clock"; 28 | clock-frequency = <125000000>; 29 | clock-output-names = "clkin_gmac"; 30 | #clock-cells = <0>; 31 | }; 32 | 33 | dc_5v: dc-5v { 34 | compatible = "regulator-fixed"; 35 | regulator-name = "dc_5v"; 36 | regulator-always-on; 37 | regulator-boot-on; 38 | regulator-min-microvolt = <5000000>; 39 | regulator-max-microvolt = <5000000>; 40 | }; 41 | 42 | sdio_pwrseq: sdio-pwrseq { 43 | compatible = "mmc-pwrseq-simple"; 44 | clocks = <&rk808 1>; 45 | clock-names = "ext_clock"; 46 | pinctrl-names = "default"; 47 | pinctrl-0 = <&wifi_reg_on_h>; 48 | reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; // bsp 49 | }; 50 | 51 | /* switched by pmic_sleep */ 52 | vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 { 53 | compatible = "regulator-fixed"; 54 | regulator-name = "vcc1v8_s3"; 55 | regulator-always-on; 56 | regulator-boot-on; 57 | regulator-min-microvolt = <1800000>; 58 | regulator-max-microvolt = <1800000>; 59 | vin-supply = <&vcc_1v8>; 60 | }; 61 | 62 | vcc3v3_sys: vcc3v3_pcie: vcc3v3_bl: vcc3v3-sys { // sch 63 | compatible = "regulator-fixed"; 64 | regulator-name = "vcc3v3_sys"; 65 | regulator-always-on; 66 | regulator-boot-on; 67 | regulator-min-microvolt = <3300000>; 68 | regulator-max-microvolt = <3300000>; 69 | vin-supply = <&dc_5v>; 70 | }; 71 | 72 | vcc_sys: vcc-sys { // sch 73 | compatible = "regulator-fixed"; 74 | regulator-name = "vcc_sys"; 75 | regulator-always-on; 76 | regulator-boot-on; 77 | regulator-min-microvolt = <5000000>; 78 | regulator-max-microvolt = <5000000>; 79 | vin-supply = <&dc_5v>; 80 | }; 81 | 82 | // vcc5v0_host: vcc5v0-host-regulator { 83 | // compatible = "regulator-fixed"; 84 | // enable-active-high; 85 | // gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; 86 | // pinctrl-names = "default"; 87 | // pinctrl-0 = <&vcc5v0_host_en>; 88 | // regulator-always-on; 89 | // regulator-name = "vcc5v0_host"; 90 | // vin-supply = <&vcc_sys>; 91 | // }; 92 | 93 | vcc_phy: vcc-phy-regulator { 94 | compatible = "regulator-fixed"; 95 | enable-active-high; 96 | gpio = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; 97 | pinctrl-names = "default"; 98 | pinctrl-0 = <&vcc_phy_h>; 99 | regulator-name = "vcc_phy"; 100 | regulator-always-on; 101 | regulator-boot-on; 102 | }; 103 | 104 | vdd_log: vdd-log { 105 | compatible = "pwm-regulator"; 106 | pwms = <&pwm2 0 25000 1>; 107 | regulator-name = "vdd_log"; 108 | regulator-always-on; 109 | regulator-boot-on; 110 | regulator-min-microvolt = <800000>; 111 | regulator-max-microvolt = <1400000>; 112 | vin-supply = <&vcc_sys>; 113 | }; 114 | 115 | leds: gpio-leds { 116 | compatible = "gpio-leds"; 117 | pinctrl-names = "default"; 118 | pinctrl-0 = <&user_led2>; 119 | 120 | user_led2 { 121 | label = "blue:work_led"; 122 | gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; // sch 123 | linux,default-trigger = "heartbeat"; 124 | }; 125 | }; 126 | 127 | gpio-keys { 128 | compatible = "gpio-keys"; 129 | autorepeat; 130 | pinctrl-names = "default"; 131 | pinctrl-0 = <&power_key>; 132 | 133 | power { 134 | debounce-interval = <100>; 135 | gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; // bsp 136 | label = "GPIO Key Power"; 137 | linux,code = ; 138 | wakeup-source; 139 | }; 140 | }; 141 | 142 | fan0: pwm-fan { 143 | compatible = "pwm-fan"; 144 | cooling-levels = <0 150 200 255>; 145 | #cooling-cells = <2>; 146 | fan-supply = <&vcc_sys>; 147 | pwms = <&pwm1 0 40000 0>; 148 | }; 149 | 150 | // pwm3 151 | ir-receiver { 152 | compatible = "gpio-ir-receiver"; 153 | gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_LOW>; 154 | pinctrl-names = "default"; 155 | pinctrl-0 = <&ir_int>; 156 | }; 157 | 158 | adc-keys { 159 | compatible = "adc-keys"; 160 | io-channels = <&saradc 1>; 161 | io-channel-names = "buttons"; 162 | keyup-threshold-microvolt = <1750000>; 163 | poll-interval = <100>; 164 | 165 | recovery { 166 | label = "Recovery"; 167 | linux,code = ; // ?? 168 | press-threshold-microvolt = <0>; 169 | }; 170 | }; 171 | 172 | }; 173 | 174 | &cpu_l0 { 175 | cpu-supply = <&vdd_cpu_l>; 176 | }; 177 | 178 | &cpu_l1 { 179 | cpu-supply = <&vdd_cpu_l>; 180 | }; 181 | 182 | &cpu_l2 { 183 | cpu-supply = <&vdd_cpu_l>; 184 | }; 185 | 186 | &cpu_l3 { 187 | cpu-supply = <&vdd_cpu_l>; 188 | }; 189 | 190 | &cpu_b0 { 191 | cpu-supply = <&vdd_cpu_b>; 192 | }; 193 | 194 | &cpu_b1 { 195 | cpu-supply = <&vdd_cpu_b>; 196 | }; 197 | 198 | &gpu { 199 | mali-supply = <&vdd_gpu>; 200 | status = "okay"; 201 | }; 202 | 203 | &cpu_thermal { 204 | trips { 205 | cpu_hot: cpu_hot { 206 | hysteresis = <10000>; 207 | temperature = <55000>; 208 | type = "active"; 209 | }; 210 | }; 211 | 212 | cooling-maps { 213 | map2 { 214 | cooling-device = 215 | <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; 216 | trip = <&cpu_hot>; 217 | }; 218 | }; 219 | }; 220 | 221 | &emmc_phy { 222 | status = "okay"; 223 | }; 224 | 225 | &gmac { 226 | assigned-clocks = <&cru SCLK_RMII_SRC>; 227 | assigned-clock-parents = <&clkin_gmac>; 228 | clock_in_out = "input"; 229 | phy-supply = <&vcc_phy>; 230 | phy-mode = "rgmii"; 231 | pinctrl-names = "default"; 232 | pinctrl-0 = <&rgmii_pins>; 233 | snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; // bsp 234 | snps,reset-active-low; 235 | snps,reset-delays-us = <0 10000 50000>; 236 | tx_delay = <0x28>; 237 | rx_delay = <0x11>; 238 | status = "okay"; 239 | }; 240 | 241 | &hdmi { 242 | ddc-i2c-bus = <&i2c3>; 243 | pinctrl-names = "default"; 244 | pinctrl-0 = <&hdmi_cec>; 245 | status = "okay"; 246 | }; 247 | 248 | &hdmi_sound { 249 | status = "okay"; 250 | }; 251 | 252 | &i2c0 { 253 | clock-frequency = <400000>; 254 | i2c-scl-rising-time-ns = <168>; 255 | i2c-scl-falling-time-ns = <4>; 256 | status = "okay"; 257 | 258 | rk808: pmic@1b { 259 | compatible = "rockchip,rk808"; 260 | reg = <0x1b>; 261 | interrupt-parent = <&gpio1>; 262 | interrupts = ; 263 | #clock-cells = <1>; 264 | clock-output-names = "xin32k", "rk808-clkout2"; 265 | pinctrl-names = "default"; 266 | pinctrl-0 = <&pmic_int_l &pmic_dvs2>; 267 | rockchip,system-power-controller; 268 | wakeup-source; 269 | 270 | vcc1-supply = <&vcc3v3_sys>; 271 | vcc2-supply = <&vcc3v3_sys>; 272 | vcc3-supply = <&vcc3v3_sys>; 273 | vcc4-supply = <&vcc3v3_sys>; 274 | vcc6-supply = <&vcc3v3_sys>; 275 | vcc7-supply = <&vcc3v3_sys>; 276 | vcc8-supply = <&vcc3v3_sys>; 277 | vcc9-supply = <&vcc3v3_sys>; 278 | vcc10-supply = <&vcc3v3_sys>; 279 | vcc11-supply = <&vcc3v3_sys>; 280 | vcc12-supply = <&vcc3v3_sys>; 281 | vddio-supply = <&vcc1v8_pmu>; 282 | 283 | regulators { 284 | vdd_center: DCDC_REG1 { 285 | regulator-name = "vdd_center"; 286 | regulator-always-on; 287 | regulator-boot-on; 288 | regulator-min-microvolt = <750000>; 289 | regulator-max-microvolt = <1350000>; 290 | regulator-ramp-delay = <6001>; 291 | regulator-state-mem { 292 | regulator-off-in-suspend; 293 | }; 294 | }; 295 | 296 | vdd_cpu_l: DCDC_REG2 { 297 | regulator-name = "vdd_cpu_l"; 298 | regulator-always-on; 299 | regulator-boot-on; 300 | regulator-min-microvolt = <750000>; 301 | regulator-max-microvolt = <1350000>; 302 | regulator-ramp-delay = <6001>; 303 | regulator-state-mem { 304 | regulator-off-in-suspend; 305 | }; 306 | }; 307 | 308 | vcc_ddr: DCDC_REG3 { 309 | regulator-name = "vcc_ddr"; 310 | regulator-always-on; 311 | regulator-boot-on; 312 | regulator-state-mem { 313 | regulator-on-in-suspend; 314 | }; 315 | }; 316 | 317 | vcc_1v8: DCDC_REG4 { 318 | regulator-name = "vcc_1v8"; 319 | regulator-always-on; 320 | regulator-boot-on; 321 | regulator-min-microvolt = <1800000>; 322 | regulator-max-microvolt = <1800000>; 323 | regulator-state-mem { 324 | regulator-on-in-suspend; 325 | regulator-suspend-microvolt = <1800000>; 326 | }; 327 | }; 328 | 329 | vcc1v8_dvp: LDO_REG1 { 330 | regulator-name = "vcc1v8_dvp"; 331 | regulator-always-on; 332 | regulator-boot-on; 333 | regulator-min-microvolt = <1800000>; 334 | regulator-max-microvolt = <1800000>; 335 | regulator-state-mem { 336 | regulator-off-in-suspend; 337 | }; 338 | }; 339 | 340 | vcc3v0_tp: LDO_REG2 { 341 | regulator-always-on; 342 | regulator-boot-on; 343 | regulator-min-microvolt = <3000000>; 344 | regulator-max-microvolt = <3000000>; 345 | regulator-name = "vcc3v0_tp"; 346 | regulator-state-mem { 347 | regulator-off-in-suspend; 348 | }; 349 | }; 350 | 351 | vcc1v8_pmu: LDO_REG3 { 352 | regulator-name = "vcc1v8_pmu"; 353 | regulator-always-on; 354 | regulator-boot-on; 355 | regulator-min-microvolt = <1800000>; 356 | regulator-max-microvolt = <1800000>; 357 | regulator-state-mem { 358 | regulator-on-in-suspend; 359 | regulator-suspend-microvolt = <1800000>; 360 | }; 361 | }; 362 | 363 | vcc_sd: LDO_REG4 { 364 | regulator-name = "vcc_sd"; 365 | regulator-always-on; 366 | regulator-boot-on; 367 | regulator-min-microvolt = <1800000>; 368 | regulator-max-microvolt = <3300000>; 369 | regulator-state-mem { 370 | regulator-on-in-suspend; 371 | regulator-suspend-microvolt = <3300000>; 372 | }; 373 | }; 374 | 375 | vcca3v0_codec: LDO_REG5 { 376 | regulator-name = "vcca3v0_codec"; 377 | regulator-always-on; 378 | regulator-boot-on; 379 | regulator-min-microvolt = <3000000>; 380 | regulator-max-microvolt = <3000000>; 381 | regulator-state-mem { 382 | regulator-off-in-suspend; 383 | }; 384 | }; 385 | 386 | vcc_1v5: LDO_REG6 { 387 | regulator-name = "vcc_1v5"; 388 | regulator-always-on; 389 | regulator-boot-on; 390 | regulator-min-microvolt = <1500000>; 391 | regulator-max-microvolt = <1500000>; 392 | regulator-state-mem { 393 | regulator-on-in-suspend; 394 | regulator-suspend-microvolt = <1500000>; 395 | }; 396 | }; 397 | 398 | vcca1v8_codec: LDO_REG7 { 399 | regulator-name = "vcca1v8_codec"; 400 | regulator-always-on; 401 | regulator-boot-on; 402 | regulator-min-microvolt = <1800000>; 403 | regulator-max-microvolt = <1800000>; 404 | regulator-state-mem { 405 | regulator-off-in-suspend; 406 | }; 407 | }; 408 | 409 | vcc_3v0: LDO_REG8 { 410 | regulator-name = "vcc_3v0"; 411 | regulator-always-on; 412 | regulator-boot-on; 413 | regulator-min-microvolt = <3000000>; 414 | regulator-max-microvolt = <3000000>; 415 | regulator-state-mem { 416 | regulator-on-in-suspend; 417 | regulator-suspend-microvolt = <3000000>; 418 | }; 419 | }; 420 | 421 | vcc3v3_s3: SWITCH_REG1 { 422 | regulator-name = "vcc3v3_s3"; 423 | regulator-always-on; 424 | regulator-boot-on; 425 | regulator-state-mem { 426 | regulator-off-in-suspend; 427 | }; 428 | }; 429 | 430 | vcc3v3_s0: SWITCH_REG2 { 431 | regulator-name = "vcc3v3_s0"; 432 | regulator-always-on; 433 | regulator-boot-on; 434 | regulator-state-mem { 435 | regulator-off-in-suspend; 436 | }; 437 | }; 438 | }; 439 | }; 440 | 441 | vdd_cpu_b: regulator@40 { 442 | compatible = "silergy,syr827"; 443 | reg = <0x40>; 444 | fcs,suspend-voltage-selector = <1>; 445 | pinctrl-names = "default"; 446 | pinctrl-0 = <&cpu_b_sleep>; 447 | regulator-name = "vdd_cpu_b"; 448 | regulator-min-microvolt = <712500>; 449 | regulator-max-microvolt = <1500000>; 450 | regulator-ramp-delay = <1000>; 451 | regulator-always-on; 452 | regulator-boot-on; 453 | vin-supply = <&vcc_sys>; 454 | 455 | regulator-state-mem { 456 | regulator-off-in-suspend; 457 | }; 458 | }; 459 | 460 | vdd_gpu: regulator@41 { 461 | compatible = "silergy,syr828"; 462 | reg = <0x41>; 463 | fcs,suspend-voltage-selector = <1>; 464 | pinctrl-names = "default"; 465 | pinctrl-0 = <&gpu_sleep>; 466 | regulator-name = "vdd_gpu"; 467 | // regulator-min-microvolt = <712500>; 468 | // regulator-max-microvolt = <1500000>; 469 | regulator-min-microvolt = <875000>; 470 | regulator-max-microvolt = <975000>; 471 | regulator-ramp-delay = <1000>; 472 | regulator-always-on; 473 | regulator-boot-on; 474 | vin-supply = <&vcc_sys>; 475 | 476 | regulator-state-mem { 477 | regulator-off-in-suspend; 478 | }; 479 | }; 480 | }; 481 | 482 | // Used for HDMI 483 | &i2c3 { 484 | i2c-scl-rising-time-ns = <450>; 485 | i2c-scl-falling-time-ns = <15>; 486 | status = "okay"; 487 | }; 488 | 489 | // HDMI sound 490 | &i2s2 { 491 | #sound-dai-cells = <0>; 492 | status = "disabled"; 493 | }; 494 | 495 | &io_domains { 496 | status = "okay"; 497 | 498 | bt656-supply = <&vcc_3v0>; 499 | audio-supply = <&vcca1v8_codec>; 500 | sdmmc-supply = <&vcc_sd>; 501 | gpio1830-supply = <&vcc_3v0>; 502 | }; 503 | 504 | &pmu_io_domains { 505 | status = "okay"; 506 | pmu1830-supply = <&vcc_1v8>; 507 | }; 508 | 509 | &pcie_phy { 510 | status = "okay"; 511 | }; 512 | 513 | &pcie0 { 514 | ep-gpios = <&gpio4 RK_PD4 GPIO_ACTIVE_HIGH>; // sch 515 | num-lanes = <1>; 516 | max-link-speed = <1>; 517 | pinctrl-names = "default"; 518 | pinctrl-0 = <&pcie_clkreqn_cpm>; 519 | status = "okay"; 520 | }; 521 | 522 | &pinctrl { 523 | pmic { 524 | cpu_b_sleep: cpu-b-sleep { 525 | rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; 526 | }; 527 | 528 | gpu_sleep: gpu-sleep { 529 | rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; 530 | }; 531 | 532 | pmic_int_l: pmic-int-l { 533 | rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; 534 | }; 535 | 536 | pmic_dvs2: pmic-dvs2 { 537 | rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; // bsp 538 | }; 539 | }; 540 | 541 | sdio-pwrseq { 542 | wifi_reg_on_h: wifi-reg-on-h { 543 | rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; 544 | }; 545 | }; 546 | 547 | wifi { 548 | wifi_host_wake_l: wifi-host-wake-l { 549 | rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; 550 | }; 551 | }; 552 | 553 | bt { 554 | bt_enable_h: bt-enable-h { 555 | rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; 556 | }; 557 | 558 | bt_host_wake_l: bt-host-wake-l { 559 | rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>; 560 | }; 561 | 562 | bt_wake_l: bt-wake-l { 563 | rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; 564 | }; 565 | }; 566 | 567 | gmac { 568 | vcc_phy_h: vcc-phy-h { 569 | rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; 570 | }; 571 | }; 572 | 573 | leds { 574 | user_led2: user_led2 { 575 | rockchip,pins = 576 | <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; 577 | }; 578 | }; 579 | 580 | ir { 581 | ir_int: ir-int { 582 | rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; 583 | }; 584 | }; 585 | 586 | buttons { 587 | power_key: power_key { 588 | rockchip,pins = 589 | <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; 590 | }; 591 | }; 592 | 593 | // usb2 { 594 | // vcc5v0_host_en: vcc5v0-host-en { 595 | // rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; 596 | // }; 597 | // }; 598 | }; 599 | /* 600 | // TFT 601 | &pwm0 { 602 | status = "okay"; 603 | }; 604 | */ 605 | /* 606 | // FAN 607 | &pwm1 { 608 | status = "okay"; 609 | }; 610 | */ 611 | &pwm2 { 612 | status = "okay"; 613 | }; 614 | 615 | &saradc { 616 | vref-supply = <&vcca1v8_s3>; 617 | status = "okay"; 618 | }; 619 | 620 | &sdio0 { 621 | bus-width = <4>; 622 | cap-sd-highspeed; 623 | cap-sdio-irq; 624 | clock-frequency = <50000000>; 625 | disable-wp; 626 | keep-power-in-suspend; 627 | max-frequency = <50000000>; 628 | mmc-pwrseq = <&sdio_pwrseq>; 629 | non-removable; 630 | pinctrl-names = "default"; 631 | pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; 632 | sd-uhs-sdr104; 633 | #address-cells = <1>; 634 | #size-cells = <0>; 635 | status = "okay"; 636 | // status = "okay"; 637 | 638 | brcmf: wifi@1 { 639 | reg = <1>; 640 | compatible = "brcm,bcm4329-fmac"; 641 | interrupt-parent = <&gpio0>; 642 | interrupts = ; 643 | interrupt-names = "host-wake"; 644 | pinctrl-names = "default"; 645 | pinctrl-0 = <&wifi_host_wake_l>; 646 | status = "okay"; 647 | // status = "okay"; 648 | }; 649 | }; 650 | 651 | &sdmmc { 652 | bus-width = <4>; 653 | cap-sd-highspeed; 654 | cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; // bsp 655 | clock-frequency = <150000000>; 656 | disable-wp; 657 | sd-uhs-sdr104; 658 | max-frequency = <150000000>; 659 | pinctrl-names = "default"; 660 | pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; 661 | vqmmc-supply = <&vcc_sd>; 662 | status = "okay"; 663 | }; 664 | 665 | &sdhci { 666 | bus-width = <8>; 667 | mmc-hs200-1_8v; 668 | // mmc-hs400-1_8v; 669 | // mmc-hs400-enhanced-strobe; 670 | keep-power-in-suspend; 671 | card-detect-delay = <1000>; 672 | non-removable; 673 | status = "okay"; 674 | }; 675 | /* 676 | &spi1 { 677 | status = "okay"; 678 | 679 | norflash: flash@0 { 680 | compatible = "jedec,spi-nor"; 681 | reg = <0>; 682 | spi-max-frequency = <50000000>; 683 | }; 684 | }; 685 | */ 686 | /* 687 | &spi2 { 688 | status = "okay"; 689 | pinctrl-names = "default"; 690 | pinctrl-0 = <&spi2_clk &spi2_tx &spi2_cs0>; 691 | 692 | panel@0 { 693 | compatible = "sitronix,st7789v"; 694 | reg = <0>; 695 | // backlight = <&pwm0>; 696 | dc-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>; 697 | reset-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_LOW>; 698 | led-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>; 699 | spi-max-frequency = <15000000>; 700 | spi-cs-high; 701 | status = "okay"; 702 | }; 703 | }; 704 | */ 705 | &tcphy0 { 706 | status = "okay"; 707 | }; 708 | 709 | &tcphy1 { 710 | status = "okay"; 711 | }; 712 | 713 | &tsadc { 714 | /* tshut mode 0:CRU 1:GPIO */ 715 | rockchip,hw-tshut-mode = <1>; 716 | /* tshut polarity 0:LOW 1:HIGH */ 717 | rockchip,hw-tshut-polarity = <1>; 718 | status = "okay"; 719 | }; 720 | 721 | &u2phy0 { 722 | status = "okay"; 723 | }; 724 | 725 | &u2phy0_host { 726 | // phy-supply = <&vcc5v0_host>; 727 | status = "okay"; 728 | }; 729 | 730 | &u2phy0_otg { 731 | status = "okay"; 732 | }; 733 | 734 | &u2phy1 { 735 | status = "okay"; 736 | }; 737 | 738 | &u2phy1_host { 739 | // phy-supply = <&vcc5v0_host>; 740 | status = "okay"; 741 | }; 742 | 743 | &u2phy1_otg { 744 | status = "okay"; 745 | }; 746 | 747 | &uart0 { 748 | pinctrl-names = "default"; 749 | pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; 750 | status = "okay"; 751 | 752 | bluetooth { 753 | compatible = "brcm,bcm43438-bt"; 754 | clocks = <&rk808 1>; 755 | clock-names = "lpo"; 756 | device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; 757 | host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; 758 | shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; 759 | pinctrl-names = "default"; 760 | pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; 761 | vbat-supply = <&vcc3v3_sys>; 762 | vddio-supply = <&vcc_1v8>; 763 | status = "okay"; 764 | }; 765 | }; 766 | 767 | // Debug TTL 768 | &uart2 { 769 | status = "okay"; 770 | }; 771 | 772 | &usb_host0_ehci { 773 | status = "okay"; 774 | }; 775 | 776 | &usb_host0_ohci { 777 | status = "okay"; 778 | }; 779 | 780 | &usb_host1_ehci { 781 | status = "okay"; 782 | }; 783 | 784 | &usb_host1_ohci { 785 | status = "okay"; 786 | }; 787 | 788 | &usbdrd3_0 { 789 | status = "okay"; 790 | }; 791 | 792 | &usbdrd_dwc3_0 { 793 | status = "okay"; 794 | dr_mode = "host"; 795 | }; 796 | 797 | &usbdrd3_1 { 798 | status = "okay"; 799 | }; 800 | 801 | &usbdrd_dwc3_1 { 802 | status = "okay"; 803 | dr_mode = "host"; 804 | }; 805 | 806 | &vopb { 807 | status = "okay"; 808 | }; 809 | 810 | &vopb_mmu { 811 | status = "okay"; 812 | }; 813 | 814 | &vopl { 815 | status = "okay"; 816 | }; 817 | 818 | &vopl_mmu { 819 | status = "okay"; 820 | }; 821 | 822 | &iep_mmu { 823 | status = "okay"; 824 | }; 825 | 826 | &hdmi_in_vopb { 827 | status = "okay"; 828 | }; 829 | 830 | &hdmi_in_vopl { 831 | status = "disabled"; 832 | }; 833 | 834 | &vpu_mmu { 835 | status = "okay"; 836 | }; 837 | 838 | &vdec_mmu { 839 | status = "okay"; 840 | }; 841 | 842 | // &vpu { 843 | // status = "okay"; 844 | // }; 845 | 846 | // &vdec { 847 | // status = "okay"; 848 | // }; 849 | 850 | // &mpp_srv { 851 | // status = "okay"; 852 | // }; 853 | 854 | // &vepu { 855 | // status = "okay"; 856 | // }; 857 | 858 | // &vdpu { 859 | // status = "okay"; 860 | // }; 861 | 862 | // &rkvdec { 863 | // status = "okay"; 864 | // }; 865 | -------------------------------------------------------------------------------- /dts/mainline/rk3399-cdhx-rb30-u-boot.dtsi: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0+ 2 | #include "rk3399-u-boot.dtsi" 3 | #include "rk3399-sdram-ddr3-1333.dtsi" 4 | 5 | / { 6 | chosen { 7 | u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc; 8 | }; 9 | }; 10 | 11 | &vdd_log { 12 | regulator-init-microvolt = <950000>; 13 | }; 14 | -------------------------------------------------------------------------------- /dts/mainline/rk3399-cdhx-rb30.dts: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: (GPL-2.0+ OR MIT) 2 | /dts-v1/; 3 | 4 | #include 5 | #include 6 | #include "dt-bindings/input/input.h" 7 | #include 8 | #include "rk3399.dtsi" 9 | #include "rk3399-opp.dtsi" 10 | // #include "rk3399-t-opp.dtsi" 11 | 12 | / { 13 | model = "CDHX RB30"; 14 | compatible = "cdhx,rb30", "rockchip,rk3399"; 15 | 16 | aliases { 17 | ethernet0 = &gmac; 18 | mmc0 = &sdio0; 19 | mmc1 = &sdmmc; 20 | mmc2 = &sdhci; 21 | }; 22 | 23 | chosen { 24 | stdout-path = "serial2:1500000n8"; 25 | }; 26 | 27 | clkin_gmac: external-gmac-clock { 28 | compatible = "fixed-clock"; 29 | clock-frequency = <125000000>; 30 | clock-output-names = "clkin_gmac"; 31 | #clock-cells = <0>; 32 | }; 33 | 34 | gpio-keys { 35 | compatible = "gpio-keys"; 36 | autorepeat; 37 | pinctrl-names = "default"; 38 | pinctrl-0 = <&pwrbtn>; 39 | 40 | key-power { 41 | debounce-interval = <100>; 42 | gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; // bsp 43 | label = "GPIO Key Power"; 44 | linux,code = ; 45 | wakeup-source; 46 | }; 47 | }; 48 | 49 | sdio_pwrseq: sdio-pwrseq { 50 | compatible = "mmc-pwrseq-simple"; 51 | clocks = <&rk808 1>; 52 | clock-names = "ext_clock"; 53 | pinctrl-names = "default"; 54 | pinctrl-0 = <&wifi_enable_h>; 55 | reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; // bsp 56 | }; 57 | 58 | vcc12v_dcin: vcc12v-dcin { 59 | compatible = "regulator-fixed"; 60 | regulator-name = "vcc12v_dcin"; 61 | regulator-always-on; 62 | regulator-boot-on; 63 | regulator-min-microvolt = <12000000>; 64 | regulator-max-microvolt = <12000000>; 65 | }; 66 | 67 | vcc_lcd: vcc-lcd { 68 | compatible = "regulator-fixed"; 69 | enable-active-high; 70 | gpio = <&gpio4 RK_PD6 GPIO_ACTIVE_HIGH>; // bsp 71 | pinctrl-names = "default"; 72 | pinctrl-0 = <&vcc_lcd_en>; 73 | regulator-name = "vcc_lcd"; 74 | regulator-always-on; 75 | }; 76 | 77 | vccadc_ref: vccadc-ref { 78 | compatible = "regulator-fixed"; 79 | regulator-name = "vcc1v8_sys"; 80 | regulator-always-on; 81 | regulator-boot-on; 82 | regulator-min-microvolt = <1800000>; 83 | regulator-max-microvolt = <1800000>; 84 | }; 85 | 86 | vcc_phy: vcc-phy-regulator { 87 | compatible = "regulator-fixed"; 88 | regulator-name = "vcc_phy"; 89 | regulator-always-on; 90 | regulator-boot-on; 91 | }; 92 | 93 | vcc_sd: vcc-sd { 94 | compatible = "regulator-fixed"; 95 | regulator-name = "vcc_sd"; 96 | regulator-always-on; 97 | regulator-boot-on; 98 | regulator-min-microvolt = <3300000>; 99 | regulator-max-microvolt = <3300000>; 100 | vin-supply = <&vcc5v0_sys>; 101 | }; 102 | 103 | vcc3v3_sys: vcc3v3-sys { 104 | compatible = "regulator-fixed"; 105 | regulator-name = "vcc3v3_sys"; 106 | regulator-always-on; 107 | regulator-boot-on; 108 | regulator-min-microvolt = <3300000>; 109 | regulator-max-microvolt = <3300000>; 110 | vin-supply = <&vcc5v0_sys>; 111 | }; 112 | 113 | vcc5v0_host: vcc5v0-host-regulator { 114 | compatible = "regulator-fixed"; 115 | enable-active-high; 116 | gpio = <&gpio4 RK_PD4 GPIO_ACTIVE_HIGH>; // bsp 117 | pinctrl-names = "default"; 118 | pinctrl-0 = <&vcc5v0_host_en>; 119 | regulator-name = "vcc5v0_host"; 120 | regulator-always-on; 121 | vin-supply = <&vcc5v0_sys>; 122 | }; 123 | 124 | usb2_hub: usb2-hub-en { 125 | compatible = "regulator-fixed"; 126 | enable-active-high; 127 | gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; 128 | pinctrl-names = "default"; 129 | pinctrl-0 = <&usb2_hub_en>; // bsp 130 | regulator-name = "usb2_hub"; 131 | regulator-always-on; 132 | }; 133 | 134 | vcc5v0_sys: vcc5v0-sys { 135 | compatible = "regulator-fixed"; 136 | regulator-name = "vcc5v0_sys"; 137 | regulator-always-on; 138 | regulator-boot-on; 139 | regulator-min-microvolt = <5000000>; 140 | regulator-max-microvolt = <5000000>; 141 | vin-supply = <&vcc12v_dcin>; 142 | }; 143 | 144 | vdd_log: vdd-log { 145 | compatible = "pwm-regulator"; 146 | pwms = <&pwm2 0 25000 1>; 147 | pwm-supply = <&vcc5v0_sys>; 148 | regulator-name = "vdd_log"; 149 | regulator-always-on; 150 | regulator-boot-on; 151 | regulator-min-microvolt = <800000>; 152 | regulator-max-microvolt = <1700000>; 153 | }; 154 | }; 155 | 156 | &cpu_l0 { 157 | cpu-supply = <&vdd_cpu_l>; 158 | }; 159 | 160 | &cpu_l1 { 161 | cpu-supply = <&vdd_cpu_l>; 162 | }; 163 | 164 | &cpu_l2 { 165 | cpu-supply = <&vdd_cpu_l>; 166 | }; 167 | 168 | &cpu_l3 { 169 | cpu-supply = <&vdd_cpu_l>; 170 | }; 171 | 172 | &cpu_b0 { 173 | cpu-supply = <&vdd_cpu_b>; 174 | }; 175 | 176 | &cpu_b1 { 177 | cpu-supply = <&vdd_cpu_b>; 178 | }; 179 | 180 | &emmc_phy { 181 | status = "okay"; 182 | }; 183 | 184 | &gmac { 185 | assigned-clocks = <&cru SCLK_RMII_SRC>; 186 | assigned-clock-parents = <&clkin_gmac>; 187 | clock_in_out = "input"; 188 | phy-supply = <&vcc_phy>; 189 | phy-mode = "rgmii"; 190 | pinctrl-names = "default"; 191 | pinctrl-0 = <&rgmii_pins>; 192 | snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; // bsp 193 | snps,reset-active-low; 194 | snps,reset-delays-us = <0 10000 50000>; 195 | tx_delay = <0x28>; 196 | rx_delay = <0x11>; 197 | status = "okay"; 198 | }; 199 | 200 | &hdmi { 201 | status = "okay"; 202 | ddc-i2c-bus = <&i2c3>; 203 | pinctrl-names = "default"; 204 | pinctrl-0 = <&hdmi_cec>; 205 | }; 206 | 207 | &hdmi_sound { 208 | status = "okay"; 209 | }; 210 | 211 | &gpu { 212 | mali-supply = <&vdd_gpu>; 213 | status = "okay"; 214 | }; 215 | 216 | &i2c0 { 217 | status = "okay"; 218 | clock-frequency = <400000>; 219 | i2c-scl-rising-time-ns = <168>; 220 | i2c-scl-falling-time-ns = <4>; 221 | 222 | rk808: pmic@1b { 223 | compatible = "rockchip,rk808"; 224 | reg = <0x1b>; 225 | interrupt-parent = <&gpio1>; 226 | interrupts = ; 227 | #clock-cells = <1>; 228 | clock-output-names = "xin32k", "rk808-clkout2"; 229 | pinctrl-names = "default"; 230 | pinctrl-0 = <&pmic_int_l>; 231 | rockchip,system-power-controller; 232 | wakeup-source; 233 | 234 | vcc1-supply = <&vcc3v3_sys>; 235 | vcc2-supply = <&vcc3v3_sys>; 236 | vcc3-supply = <&vcc3v3_sys>; 237 | vcc4-supply = <&vcc3v3_sys>; 238 | vcc6-supply = <&vcc3v3_sys>; 239 | vcc7-supply = <&vcc3v3_sys>; 240 | vcc8-supply = <&vcc3v3_sys>; 241 | vcc9-supply = <&vcc3v3_sys>; 242 | vcc10-supply = <&vcc3v3_sys>; 243 | vcc11-supply = <&vcc3v3_sys>; 244 | vcc12-supply = <&vcc3v3_sys>; 245 | vddio-supply = <&vcc_1v8>; 246 | 247 | regulators { 248 | vdd_center: DCDC_REG1 { 249 | regulator-name = "vdd_center"; 250 | regulator-always-on; 251 | regulator-boot-on; 252 | regulator-min-microvolt = <750000>; 253 | regulator-max-microvolt = <1350000>; 254 | regulator-ramp-delay = <6001>; 255 | regulator-state-mem { 256 | regulator-off-in-suspend; 257 | }; 258 | }; 259 | 260 | vdd_cpu_l: DCDC_REG2 { 261 | regulator-name = "vdd_cpu_l"; 262 | regulator-always-on; 263 | regulator-boot-on; 264 | regulator-min-microvolt = <750000>; 265 | regulator-max-microvolt = <1350000>; 266 | regulator-ramp-delay = <6001>; 267 | regulator-state-mem { 268 | regulator-off-in-suspend; 269 | }; 270 | }; 271 | 272 | vcc_ddr: DCDC_REG3 { 273 | regulator-name = "vcc_ddr"; 274 | regulator-always-on; 275 | regulator-boot-on; 276 | regulator-state-mem { 277 | regulator-on-in-suspend; 278 | }; 279 | }; 280 | 281 | vcc_1v8: DCDC_REG4 { 282 | regulator-name = "vcc_1v8"; 283 | regulator-always-on; 284 | regulator-boot-on; 285 | regulator-min-microvolt = <1800000>; 286 | regulator-max-microvolt = <1800000>; 287 | regulator-state-mem { 288 | regulator-on-in-suspend; 289 | regulator-suspend-microvolt = <1800000>; 290 | }; 291 | }; 292 | 293 | vcc1v8_dvp: LDO_REG1 { 294 | regulator-name = "vcc1v8_dvp"; 295 | regulator-always-on; 296 | regulator-boot-on; 297 | regulator-min-microvolt = <1800000>; 298 | regulator-max-microvolt = <1800000>; 299 | regulator-state-mem { 300 | regulator-off-in-suspend; 301 | }; 302 | }; 303 | 304 | vcc3v0_tp: LDO_REG2 { 305 | regulator-name = "vcc3v0_tp"; 306 | // regulator-always-on; 307 | // regulator-boot-on; 308 | regulator-min-microvolt = <3000000>; 309 | regulator-max-microvolt = <3000000>; 310 | regulator-state-mem { 311 | regulator-off-in-suspend; 312 | }; 313 | }; 314 | 315 | vcc1v8_pmu: LDO_REG3 { 316 | regulator-name = "vcc1v8_pmu"; 317 | regulator-always-on; 318 | regulator-boot-on; 319 | regulator-min-microvolt = <1800000>; 320 | regulator-max-microvolt = <1800000>; 321 | regulator-state-mem { 322 | regulator-on-in-suspend; 323 | regulator-suspend-microvolt = <1800000>; 324 | }; 325 | }; 326 | 327 | vccio_sd: LDO_REG4 { 328 | regulator-name = "vccio_sd"; 329 | regulator-always-on; 330 | regulator-boot-on; 331 | regulator-min-microvolt = <1800000>; 332 | regulator-max-microvolt = <3300000>; 333 | regulator-state-mem { 334 | regulator-on-in-suspend; 335 | regulator-suspend-microvolt = <3300000>; 336 | }; 337 | }; 338 | 339 | vcca3v0_codec: LDO_REG5 { 340 | regulator-name = "vcca3v0_codec"; 341 | regulator-always-on; 342 | regulator-boot-on; 343 | regulator-min-microvolt = <3000000>; 344 | regulator-max-microvolt = <3000000>; 345 | regulator-state-mem { 346 | regulator-off-in-suspend; 347 | }; 348 | }; 349 | 350 | vcc_1v5: LDO_REG6 { 351 | regulator-name = "vcc_1v5"; 352 | regulator-always-on; 353 | regulator-boot-on; 354 | regulator-min-microvolt = <1500000>; 355 | regulator-max-microvolt = <1500000>; 356 | regulator-state-mem { 357 | regulator-on-in-suspend; 358 | regulator-suspend-microvolt = <1500000>; 359 | }; 360 | }; 361 | 362 | vcca1v8_codec: LDO_REG7 { 363 | regulator-name = "vcca1v8_codec"; 364 | regulator-always-on; 365 | regulator-boot-on; 366 | regulator-min-microvolt = <1800000>; 367 | regulator-max-microvolt = <1800000>; 368 | regulator-state-mem { 369 | regulator-off-in-suspend; 370 | }; 371 | }; 372 | 373 | vcc_3v0: LDO_REG8 { 374 | regulator-name = "vcc_3v0"; 375 | regulator-always-on; 376 | regulator-boot-on; 377 | regulator-min-microvolt = <3000000>; 378 | regulator-max-microvolt = <3000000>; 379 | regulator-state-mem { 380 | regulator-on-in-suspend; 381 | regulator-suspend-microvolt = <3000000>; 382 | }; 383 | }; 384 | 385 | vcc3v3_s3: SWITCH_REG1 { 386 | regulator-name = "vcc3v3_s3"; 387 | regulator-always-on; 388 | regulator-boot-on; 389 | regulator-state-mem { 390 | regulator-off-in-suspend; 391 | }; 392 | }; 393 | 394 | vcc3v3_s0: SWITCH_REG2 { 395 | regulator-name = "vcc3v3_s0"; 396 | regulator-always-on; 397 | regulator-boot-on; 398 | regulator-state-mem { 399 | regulator-off-in-suspend; 400 | }; 401 | }; 402 | }; 403 | }; 404 | 405 | vdd_cpu_b: regulator@40 { 406 | compatible = "silergy,syr827"; 407 | reg = <0x40>; 408 | fcs,suspend-voltage-selector = <1>; 409 | pinctrl-names = "default"; 410 | pinctrl-0 = <&vsel1_pin>; // bsp 411 | regulator-name = "vdd_cpu_b"; 412 | regulator-min-microvolt = <712500>; 413 | regulator-max-microvolt = <1500000>; 414 | regulator-ramp-delay = <1000>; 415 | regulator-always-on; 416 | regulator-boot-on; 417 | vin-supply = <&vcc5v0_sys>; 418 | 419 | regulator-state-mem { 420 | regulator-off-in-suspend; 421 | }; 422 | }; 423 | 424 | vdd_gpu: regulator@41 { 425 | compatible = "silergy,syr828"; 426 | reg = <0x41>; 427 | fcs,suspend-voltage-selector = <1>; 428 | pinctrl-names = "default"; 429 | pinctrl-0 = <&vsel2_pin>; // bsp 430 | regulator-name = "vdd_gpu"; 431 | regulator-min-microvolt = <712500>; 432 | regulator-max-microvolt = <1500000>; 433 | regulator-ramp-delay = <1000>; 434 | regulator-always-on; 435 | regulator-boot-on; 436 | vin-supply = <&vcc5v0_sys>; 437 | 438 | regulator-state-mem { 439 | regulator-off-in-suspend; 440 | }; 441 | }; 442 | }; 443 | 444 | &i2c1 { 445 | i2c-scl-rising-time-ns = <300>; 446 | i2c-scl-falling-time-ns = <15>; 447 | status = "okay"; 448 | }; 449 | 450 | // HDMI 451 | &i2c3 { 452 | i2c-scl-rising-time-ns = <450>; 453 | i2c-scl-falling-time-ns = <15>; 454 | status = "okay"; 455 | }; 456 | 457 | // ALC5651 458 | &i2c4 { 459 | i2c-scl-rising-time-ns = <600>; 460 | i2c-scl-falling-time-ns = <20>; 461 | status = "okay"; 462 | }; 463 | 464 | // HDMI sound 465 | &i2s2 { 466 | #sound-dai-cells = <0>; 467 | status = "okay"; 468 | }; 469 | 470 | &io_domains { 471 | status = "okay"; 472 | bt656-supply = <&vcc_3v0>; 473 | audio-supply = <&vcca1v8_codec>; 474 | sdmmc-supply = <&vccio_sd>; 475 | gpio1830-supply = <&vcc_3v0>; 476 | }; 477 | 478 | &pmu_io_domains { 479 | status = "okay"; 480 | pmu1830-supply = <&vcc_3v0>; 481 | }; 482 | 483 | &pinctrl { 484 | bt { 485 | bt_enable_h: bt-enable-h { 486 | rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; // bsp 487 | }; 488 | 489 | bt_host_wake_l: bt-host-wake-l { 490 | rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>; // bsp 491 | }; 492 | 493 | bt_wake_l: bt-wake-l { 494 | rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; // bsp 495 | }; 496 | }; 497 | 498 | wifi { 499 | wifi_host_wake_l: wifi-host-wake-l { 500 | rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; // bsp 501 | }; 502 | }; 503 | 504 | buttons { 505 | pwrbtn: pwrbtn { 506 | rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; // common 507 | }; 508 | }; 509 | 510 | pmic { 511 | pmic_int_l: pmic-int-l { 512 | rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; // bsp 513 | }; 514 | 515 | vsel1_pin: vsel1-pin { 516 | rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; // bsp 517 | }; 518 | 519 | vsel2_pin: vsel2-pin { 520 | rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; // bsp 521 | }; 522 | }; 523 | 524 | sdio-pwrseq { 525 | wifi_enable_h: wifi-enable-h { 526 | rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; // common 527 | }; 528 | }; 529 | 530 | usb { 531 | vcc5v0_host_en: vcc5v0-host-en { 532 | rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; // bsp 533 | }; 534 | usb2_hub_en: usb2-hub-en { 535 | rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>; // bsp 536 | }; 537 | }; 538 | 539 | headphone { 540 | spk_ctl: spk-ctl { 541 | rockchip,pins = <4 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; // bsp: spk-con-gpio 542 | }; 543 | spk_pwr: spk-pwr { 544 | rockchip,pins = <1 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; // bsp 545 | }; 546 | }; 547 | 548 | bl_ctrl { 549 | bl_en: bl-en { 550 | rockchip,pins = <4 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>; // bsp 551 | }; 552 | vcc_lcd_en: vcc-lcd-en { 553 | rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; // bsp 554 | }; 555 | }; 556 | 557 | gmac { 558 | rgmii_sleep_pins: rgmii-sleep-pins { 559 | rockchip,pins =<3 RK_PB7 RK_FUNC_GPIO &pcfg_output_low>; // bsp 560 | }; 561 | }; 562 | }; 563 | 564 | &pwm1 { 565 | status = "okay"; 566 | }; 567 | 568 | &pwm2 { 569 | status = "okay"; 570 | }; 571 | 572 | &saradc { 573 | status = "okay"; 574 | vref-supply = <&vccadc_ref>; 575 | }; 576 | 577 | &sdio0 { 578 | status = "okay"; 579 | #address-cells = <1>; 580 | #size-cells = <0>; 581 | bus-width = <4>; 582 | clock-frequency = <50000000>; 583 | cap-sdio-irq; 584 | cap-sd-highspeed; 585 | keep-power-in-suspend; 586 | mmc-pwrseq = <&sdio_pwrseq>; 587 | non-removable; 588 | pinctrl-names = "default"; 589 | pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; 590 | sd-uhs-sdr104; 591 | 592 | brcmf: wifi@1 { 593 | compatible = "brcm,bcm43455-fmac"; 594 | reg = <1>; 595 | interrupt-parent = <&gpio0>; 596 | interrupts = ; 597 | interrupt-names = "host-wake"; 598 | pinctrl-names = "default"; 599 | pinctrl-0 = <&wifi_host_wake_l>; // bsp 600 | }; 601 | }; 602 | 603 | &sdmmc { 604 | clock-frequency = <150000000>; 605 | clock-freq-min-max = <100000 150000000>; 606 | supports-sd; 607 | bus-width = <4>; 608 | cap-mmc-highspeed; 609 | cap-sd-highspeed; 610 | disable-wp; 611 | num-slots = <1>; 612 | sd-uhs-sdr104; 613 | vmmc-supply = <&vcc_sd>; 614 | vqmmc-supply = <&vccio_sd>; 615 | pinctrl-names = "default"; 616 | pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; 617 | status = "okay"; 618 | }; 619 | 620 | &sdhci { 621 | bus-width = <8>; 622 | mmc-hs400-enhanced-strobe; 623 | non-removable; 624 | status = "okay"; 625 | }; 626 | 627 | &tcphy0 { 628 | status = "okay"; 629 | }; 630 | 631 | &tcphy1 { 632 | status = "okay"; 633 | }; 634 | 635 | &tsadc { 636 | /* tshut mode 0:CRU 1:GPIO */ 637 | rockchip,hw-tshut-mode = <1>; 638 | /* tshut polarity 0:LOW 1:HIGH */ 639 | rockchip,hw-tshut-polarity = <1>; 640 | status = "okay"; 641 | }; 642 | 643 | &u2phy0 { 644 | status = "okay"; 645 | 646 | u2phy0_otg: otg-port { 647 | status = "okay"; 648 | }; 649 | 650 | u2phy0_host: host-port { 651 | phy-supply = <&vcc5v0_host>; 652 | status = "okay"; 653 | }; 654 | }; 655 | 656 | &u2phy1 { 657 | status = "okay"; 658 | 659 | u2phy1_otg: otg-port { 660 | status = "okay"; 661 | }; 662 | 663 | u2phy1_host: host-port { 664 | phy-supply = <&vcc5v0_host>; 665 | status = "okay"; 666 | }; 667 | }; 668 | 669 | &uart0 { 670 | pinctrl-names = "default"; 671 | pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; 672 | status = "okay"; 673 | 674 | bluetooth { 675 | compatible = "brcm,bcm43438-bt"; 676 | clocks = <&rk808 1>; 677 | clock-names = "lpo"; 678 | device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; // bsp 679 | host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; // bsp 680 | shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; // bsp 681 | pinctrl-names = "default"; 682 | pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; 683 | vbat-supply = <&vcc3v3_sys>; 684 | vddio-supply = <&vcc_1v8>; 685 | }; 686 | }; 687 | 688 | // Debug TTL 689 | &uart2 { 690 | status = "okay"; 691 | }; 692 | 693 | &usb_host0_ehci { 694 | status = "okay"; 695 | }; 696 | 697 | &usb_host0_ohci { 698 | status = "okay"; 699 | }; 700 | 701 | &usb_host1_ehci { 702 | status = "okay"; 703 | }; 704 | 705 | &usb_host1_ohci { 706 | status = "okay"; 707 | }; 708 | 709 | &usbdrd3_0 { 710 | status = "okay"; 711 | }; 712 | 713 | &usbdrd_dwc3_0 { 714 | status = "okay"; 715 | dr_mode = "host"; 716 | }; 717 | 718 | &usbdrd3_1 { 719 | status = "okay"; 720 | }; 721 | 722 | &usbdrd_dwc3_1 { 723 | status = "okay"; 724 | dr_mode = "host"; 725 | }; 726 | 727 | &vopb { 728 | status = "okay"; 729 | }; 730 | 731 | &vopb_mmu { 732 | status = "okay"; 733 | }; 734 | 735 | &vopl { 736 | status = "okay"; 737 | }; 738 | 739 | &vopl_mmu { 740 | status = "okay"; 741 | }; 742 | 743 | &iep_mmu { 744 | status = "okay"; 745 | }; 746 | -------------------------------------------------------------------------------- /dts/mainline/rk3399-eaio-3399j-u-boot.dtsi: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0+ 2 | #include "rk3399-u-boot.dtsi" 3 | #include "rk3399-sdram-ddr3-1600.dtsi" 4 | #include "rk3399-sdram-lpddr4-100.dtsi" 5 | 6 | / { 7 | chosen { 8 | u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc; 9 | }; 10 | }; 11 | 12 | &vdd_log { 13 | regulator-min-microvolt = <430000>; 14 | regulator-init-microvolt = <950000>; 15 | }; 16 | -------------------------------------------------------------------------------- /dts/mainline/rk3399-eaio-3399j.dts: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: (GPL-2.0 OR MIT) 2 | 3 | /dts-v1/; 4 | #include 5 | #include "rk3399.dtsi" 6 | #include "rk3399-opp.dtsi" 7 | 8 | / { 9 | model = "EAIO EAIO-3399j"; 10 | compatible = "eaio,eaio-3399j", "rockchip,rk3399"; 11 | 12 | aliases { 13 | led-boot = &user_led1; 14 | led-failsafe = &user_led2; 15 | led-running = &user_led1; 16 | led-upgrade = &user_led2; 17 | spi1 = &spi1; 18 | }; 19 | 20 | chosen { 21 | stdout-path = "serial2:1500000n8"; 22 | }; 23 | 24 | adc-keys { 25 | compatible = "adc-keys"; 26 | io-channels = <&saradc 1>; 27 | io-channel-names = "buttons"; 28 | keyup-threshold-microvolt = <1750000>; 29 | poll-interval = <100>; 30 | 31 | recovery { 32 | label = "Recovery"; 33 | linux,code = ; 34 | press-threshold-microvolt = <0>; 35 | }; 36 | }; 37 | 38 | clkin_gmac: external-gmac-clock { 39 | compatible = "fixed-clock"; 40 | clock-frequency = <125000000>; 41 | clock-output-names = "clkin_gmac"; 42 | #clock-cells = <0>; 43 | }; 44 | 45 | fan: pwm-fan { 46 | compatible = "pwm-fan"; 47 | #cooling-cells = <2>; 48 | fan-supply = <&vcc12v_dcin>; 49 | pwms = <&pwm0 0 50000 0>; 50 | cooling-levels = <0 100 150 200 255>; 51 | status = "okay"; 52 | }; 53 | 54 | gpio-keys { 55 | compatible = "gpio-keys"; 56 | autorepeat; 57 | pinctrl-names = "default"; 58 | pinctrl-0 = <&power_key>; 59 | #address-cells = <1>; 60 | #size-cells = <0>; 61 | 62 | power { 63 | debounce-interval = <100>; 64 | gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; 65 | label = "GPIO Key Power"; 66 | linux,code = ; 67 | wakeup-source; 68 | }; 69 | }; 70 | 71 | ir-receiver { 72 | compatible = "gpio-ir-receiver"; 73 | gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_LOW>; 74 | pinctrl-0 = <&ir_int>; 75 | pinctrl-names = "default"; 76 | }; 77 | 78 | leds: gpio-leds { 79 | compatible = "gpio-leds"; 80 | pinctrl-names = "default"; 81 | pinctrl-0 = <&user_led1_pin>, <&user_led2_pin>; 82 | 83 | user_led1: user-led1 { 84 | gpios = <&gpio1 RK_PC6 GPIO_ACTIVE_LOW>; 85 | label = "green:user_led1"; 86 | }; 87 | 88 | user_led2: user-led2 { 89 | gpios = <&gpio1 RK_PC7 GPIO_ACTIVE_LOW>; 90 | label = "blue:user_led2"; 91 | }; 92 | }; 93 | 94 | sdio_pwrseq: sdio-pwrseq { 95 | compatible = "mmc-pwrseq-simple"; 96 | clocks = <&rk808 1>; 97 | clock-names = "ext_clock"; 98 | pinctrl-names = "default"; 99 | pinctrl-0 = <&wifi_reg_on_h>; 100 | reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; 101 | }; 102 | 103 | /* 104 | * Really, this is supplied by vcc_1v8, and vcc1v8_s3 only 105 | * drives the enable pin, but we can't quite model that. 106 | */ 107 | vcca0v9_s3: vcca0v9-s3 { 108 | compatible = "regulator-fixed"; 109 | regulator-min-microvolt = <900000>; 110 | regulator-max-microvolt = <900000>; 111 | regulator-name = "vcca0v9_s3"; 112 | vin-supply = <&vcc1v8_s3>; 113 | }; 114 | 115 | /* As above, actually supplied by vcc3v3_sys */ 116 | vcca1v8_s3: vcca1v8-s3 { 117 | compatible = "regulator-fixed"; 118 | regulator-min-microvolt = <1800000>; 119 | regulator-max-microvolt = <1800000>; 120 | regulator-name = "vcca1v8_s3"; 121 | vin-supply = <&vcc1v8_s3>; 122 | }; 123 | 124 | vcc12v_dcin: vcc12v-dcin { 125 | compatible = "regulator-fixed"; 126 | regulator-name = "vcc12v-dcin"; 127 | regulator-always-on; 128 | regulator-boot-on; 129 | regulator-min-microvolt = <12000000>; 130 | regulator-max-microvolt = <12000000>; 131 | }; 132 | 133 | vcc3v3_ext: vcc3v3-ext { 134 | compatible = "regulator-fixed"; 135 | regulator-always-on; 136 | regulator-boot-on; 137 | regulator-min-microvolt = <3300000>; 138 | regulator-max-microvolt = <3300000>; 139 | regulator-name = "vcc3v3_ext"; 140 | vin-supply = <&vcc5v0_sys>; 141 | }; 142 | 143 | vcc3v3_sys: vcc3v3-sys { 144 | compatible = "regulator-fixed"; 145 | regulator-always-on; 146 | regulator-boot-on; 147 | regulator-min-microvolt = <3300000>; 148 | regulator-max-microvolt = <3300000>; 149 | regulator-name = "vcc3v3_sys"; 150 | vin-supply = <&vcc5v0_sys>; 151 | }; 152 | 153 | vcc5v0_sys: vcc5v0-sys { 154 | compatible = "regulator-fixed"; 155 | regulator-always-on; 156 | regulator-boot-on; 157 | regulator-min-microvolt = <5000000>; 158 | regulator-max-microvolt = <5000000>; 159 | regulator-name = "vcc5v0_sys"; 160 | vin-supply = <&vcc12v_dcin>; 161 | }; 162 | 163 | /* switched by pmic_sleep */ 164 | vcc1v8_s3: vcc1v8-s3 { 165 | compatible = "regulator-fixed"; 166 | regulator-always-on; 167 | regulator-boot-on; 168 | regulator-min-microvolt = <1800000>; 169 | regulator-max-microvolt = <1800000>; 170 | regulator-name = "vcc1v8_s3"; 171 | vin-supply = <&vcc_1v8>; 172 | }; 173 | 174 | vcc3v3_sd: vcc3v3-sd { 175 | compatible = "regulator-fixed"; 176 | enable-active-high; 177 | gpio = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>; 178 | pinctrl-names = "default"; 179 | pinctrl-0 = <&sdmmc0_pwr_h>; 180 | regulator-always-on; 181 | regulator-min-microvolt = <3300000>; 182 | regulator-max-microvolt = <3300000>; 183 | regulator-name = "vcc3v3_sd"; 184 | vin-supply = <&vcc3v3_ext>; 185 | }; 186 | 187 | vcc5v0_host: vcc5v0-host-regulator { 188 | compatible = "regulator-fixed"; 189 | enable-active-high; 190 | gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; 191 | pinctrl-names = "default"; 192 | pinctrl-0 = <&vcc5v0_host_en>; 193 | regulator-name = "vcc5v0_host"; 194 | regulator-always-on; 195 | vin-supply = <&vcc5v0_sys>; 196 | }; 197 | 198 | vdd_log: vdd-log { 199 | compatible = "pwm-regulator"; 200 | pwms = <&pwm2 0 25000 1>; 201 | regulator-name = "vdd_log"; 202 | regulator-always-on; 203 | regulator-boot-on; 204 | regulator-min-microvolt = <800000>; 205 | regulator-max-microvolt = <1400000>; 206 | vin-supply = <&vcc5v0_sys>; 207 | 208 | /* for rockchip boot on */ 209 | rockchip,pwm_id= <2>; 210 | rockchip,pwm_voltage = <1000000>; 211 | 212 | }; 213 | 214 | wireless-wlan { 215 | compatible = "wlan-platdata"; 216 | rockchip,grf = <&grf>; 217 | pinctrl-names = "default"; 218 | pinctrl-0 = <&wifi_host_wake_l>; 219 | wifi_chip_type = "ap6275s"; 220 | WIFI,host_wake_irq = <&gpio4 RK_PA2 GPIO_ACTIVE_HIGH>; 221 | status = "okay"; 222 | }; 223 | 224 | rtl8367s { 225 | compatible = "realtek,rtl8367s"; 226 | cpu_port = <7>; 227 | mii-bus = <&mdio0>; 228 | realtek,extif1 = <1 0 12 1 1 1 1 1 4>; //rtl8367b_extif_init_of 229 | realtek,extif2 = <1 3 1 1 1 1 1 1 2>; 230 | }; 231 | }; 232 | 233 | &cpu_b0 { 234 | cpu-supply = <&vdd_cpu_b>; 235 | }; 236 | 237 | &cpu_b1 { 238 | cpu-supply = <&vdd_cpu_b>; 239 | }; 240 | 241 | &cpu_l0 { 242 | cpu-supply = <&vdd_cpu_l>; 243 | }; 244 | 245 | &cpu_l1 { 246 | cpu-supply = <&vdd_cpu_l>; 247 | }; 248 | 249 | &cpu_l2 { 250 | cpu-supply = <&vdd_cpu_l>; 251 | }; 252 | 253 | &cpu_l3 { 254 | cpu-supply = <&vdd_cpu_l>; 255 | }; 256 | 257 | &emmc_phy { 258 | status = "okay"; 259 | }; 260 | 261 | &gmac { 262 | assigned-clocks = <&cru SCLK_RMII_SRC>; 263 | assigned-clock-parents = <&cru SCLK_MAC>; 264 | assigned-clock-rates = <125000000>; 265 | clock_in_out = "output"; 266 | phy-mode = "rgmii"; 267 | phy-supply = <&vcc3v3_s3>; 268 | pinctrl-names = "default"; 269 | pinctrl-0 = <&rgmii_pins>; 270 | snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; 271 | snps,reset-active-low; 272 | snps,reset-delays-us = <0 10000 50000>; 273 | tx_delay = <0x28>; 274 | rx_delay = <0x11>; 275 | status = "okay"; 276 | 277 | fixed-link { 278 | speed = <1000>; 279 | full-duplex; 280 | }; 281 | 282 | mdio0: mdio { 283 | compatible = "snps,dwmac-mdio"; 284 | #address-cells = <1>; 285 | #size-cells = <0>; 286 | }; 287 | }; 288 | 289 | &gpu { 290 | mali-supply = <&vdd_gpu>; 291 | status = "okay"; 292 | }; 293 | 294 | &hdmi { 295 | ddc-i2c-bus = <&i2c3>; 296 | pinctrl-names = "default"; 297 | pinctrl-0 = <&hdmi_cec>; 298 | status = "okay"; 299 | }; 300 | 301 | &hdmi_sound { 302 | status = "okay"; 303 | }; 304 | 305 | // Let hdmi port support 4k@60fps. 306 | &hdmi_in_vopl { 307 | status = "disabled"; 308 | }; 309 | 310 | &i2c0 { 311 | clock-frequency = <400000>; 312 | i2c-scl-rising-time-ns = <168>; 313 | i2c-scl-falling-time-ns = <4>; 314 | status = "okay"; 315 | 316 | rk808: pmic@1b { 317 | compatible = "rockchip,rk808"; 318 | reg = <0x1b>; 319 | #clock-cells = <1>; 320 | clock-output-names = "xin32k", "rk808-clkout2"; 321 | interrupt-parent = <&gpio1>; 322 | interrupts = <21 IRQ_TYPE_LEVEL_LOW>; 323 | pinctrl-names = "default"; 324 | pinctrl-0 = <&pmic_int_l>; 325 | rockchip,system-power-controller; 326 | wakeup-source; 327 | 328 | vcc1-supply = <&vcc5v0_sys>; 329 | vcc2-supply = <&vcc5v0_sys>; 330 | vcc3-supply = <&vcc5v0_sys>; 331 | vcc4-supply = <&vcc5v0_sys>; 332 | vcc6-supply = <&vcc5v0_sys>; 333 | vcc7-supply = <&vcc5v0_sys>; 334 | vcc8-supply = <&vcc3v3_sys>; 335 | vcc9-supply = <&vcc5v0_sys>; 336 | vcc10-supply = <&vcc5v0_sys>; 337 | vcc11-supply = <&vcc5v0_sys>; 338 | vcc12-supply = <&vcc3v3_sys>; 339 | vddio-supply = <&vcc1v8_pmu>; 340 | 341 | regulators { 342 | vdd_center: DCDC_REG1 { 343 | regulator-always-on; 344 | regulator-boot-on; 345 | regulator-min-microvolt = <750000>; 346 | regulator-max-microvolt = <1350000>; 347 | regulator-name = "vdd_center"; 348 | regulator-ramp-delay = <6001>; 349 | 350 | regulator-state-mem { 351 | regulator-off-in-suspend; 352 | }; 353 | }; 354 | 355 | vdd_cpu_l: DCDC_REG2 { 356 | regulator-always-on; 357 | regulator-boot-on; 358 | regulator-min-microvolt = <750000>; 359 | regulator-max-microvolt = <1350000>; 360 | regulator-name = "vdd_cpu_l"; 361 | regulator-ramp-delay = <6001>; 362 | 363 | regulator-state-mem { 364 | regulator-off-in-suspend; 365 | }; 366 | }; 367 | 368 | vcc_ddr: DCDC_REG3 { 369 | regulator-always-on; 370 | regulator-boot-on; 371 | regulator-name = "vcc_ddr"; 372 | 373 | regulator-state-mem { 374 | regulator-on-in-suspend; 375 | }; 376 | }; 377 | 378 | vcc_1v8: DCDC_REG4 { 379 | regulator-always-on; 380 | regulator-boot-on; 381 | regulator-min-microvolt = <1800000>; 382 | regulator-max-microvolt = <1800000>; 383 | regulator-name = "vcc_1v8"; 384 | 385 | regulator-state-mem { 386 | regulator-on-in-suspend; 387 | regulator-suspend-microvolt = <1800000>; 388 | }; 389 | }; 390 | 391 | vcc1v8_dvp: LDO_REG1 { 392 | regulator-always-on; 393 | regulator-boot-on; 394 | regulator-min-microvolt = <1800000>; 395 | regulator-max-microvolt = <1800000>; 396 | regulator-name = "vcc1v8_dvp"; 397 | 398 | regulator-state-mem { 399 | regulator-off-in-suspend; 400 | }; 401 | }; 402 | 403 | vcc2v8_dvp: LDO_REG2 { 404 | regulator-always-on; 405 | regulator-boot-on; 406 | regulator-min-microvolt = <2800000>; 407 | regulator-max-microvolt = <2800000>; 408 | regulator-name = "vcc2v8_dvp"; 409 | 410 | regulator-state-mem { 411 | regulator-off-in-suspend; 412 | }; 413 | }; 414 | 415 | vcc1v8_pmu: LDO_REG3 { 416 | regulator-always-on; 417 | regulator-boot-on; 418 | regulator-min-microvolt = <1800000>; 419 | regulator-max-microvolt = <1800000>; 420 | regulator-name = "vcc1v8_pmu"; 421 | 422 | regulator-state-mem { 423 | regulator-on-in-suspend; 424 | regulator-suspend-microvolt = <1800000>; 425 | }; 426 | }; 427 | 428 | vcc_sdio: LDO_REG4 { 429 | regulator-always-on; 430 | regulator-boot-on; 431 | regulator-min-microvolt = <1800000>; 432 | regulator-max-microvolt = <3000000>; 433 | regulator-name = "vcc_sdio"; 434 | 435 | regulator-state-mem { 436 | regulator-on-in-suspend; 437 | regulator-suspend-microvolt = <3000000>; 438 | }; 439 | }; 440 | 441 | vcca3v0_codec: LDO_REG5 { 442 | regulator-always-on; 443 | regulator-boot-on; 444 | regulator-min-microvolt = <3000000>; 445 | regulator-max-microvolt = <3000000>; 446 | regulator-name = "vcca3v0_codec"; 447 | 448 | regulator-state-mem { 449 | regulator-off-in-suspend; 450 | }; 451 | }; 452 | 453 | vcc_1v5: LDO_REG6 { 454 | regulator-always-on; 455 | regulator-boot-on; 456 | regulator-min-microvolt = <1500000>; 457 | regulator-max-microvolt = <1500000>; 458 | regulator-name = "vcc_1v5"; 459 | 460 | regulator-state-mem { 461 | regulator-on-in-suspend; 462 | regulator-suspend-microvolt = <1500000>; 463 | }; 464 | }; 465 | 466 | vcca1v8_codec: LDO_REG7 { 467 | regulator-always-on; 468 | regulator-boot-on; 469 | regulator-min-microvolt = <1800000>; 470 | regulator-max-microvolt = <1800000>; 471 | regulator-name = "vcca1v8_codec"; 472 | 473 | regulator-state-mem { 474 | regulator-off-in-suspend; 475 | }; 476 | }; 477 | 478 | vcc_3v0: LDO_REG8 { 479 | regulator-always-on; 480 | regulator-boot-on; 481 | regulator-min-microvolt = <3000000>; 482 | regulator-max-microvolt = <3000000>; 483 | regulator-name = "vcc_3v0"; 484 | 485 | regulator-state-mem { 486 | regulator-on-in-suspend; 487 | regulator-suspend-microvolt = <3000000>; 488 | }; 489 | }; 490 | 491 | vcc3v3_s3: SWITCH_REG1 { 492 | regulator-always-on; 493 | regulator-boot-on; 494 | regulator-name = "vcc3v3_s3"; 495 | 496 | regulator-state-mem { 497 | regulator-off-in-suspend; 498 | }; 499 | }; 500 | 501 | vcc3v3_s0: SWITCH_REG2 { 502 | regulator-always-on; 503 | regulator-boot-on; 504 | regulator-name = "vcc3v3_s0"; 505 | 506 | regulator-state-mem { 507 | regulator-off-in-suspend; 508 | }; 509 | }; 510 | }; 511 | }; 512 | 513 | vdd_cpu_b: regulator@40 { 514 | compatible = "silergy,syr827"; 515 | reg = <0x40>; 516 | fcs,suspend-voltage-selector = <1>; 517 | pinctrl-names = "default"; 518 | pinctrl-0 = <&cpu_b_sleep>; 519 | regulator-always-on; 520 | regulator-boot-on; 521 | regulator-min-microvolt = <712500>; 522 | regulator-max-microvolt = <1500000>; 523 | regulator-name = "vdd_cpu_b"; 524 | regulator-ramp-delay = <1000>; 525 | vin-supply = <&vcc5v0_sys>; 526 | 527 | regulator-state-mem { 528 | regulator-off-in-suspend; 529 | }; 530 | }; 531 | 532 | vdd_gpu: regulator@41 { 533 | compatible = "silergy,syr828"; 534 | reg = <0x41>; 535 | fcs,suspend-voltage-selector = <1>; 536 | pinctrl-names = "default"; 537 | pinctrl-0 = <&gpu_sleep>; 538 | regulator-always-on; 539 | regulator-boot-on; 540 | regulator-min-microvolt = <712500>; 541 | regulator-max-microvolt = <1500000>; 542 | regulator-name = "vdd_gpu"; 543 | regulator-ramp-delay = <1000>; 544 | vin-supply = <&vcc5v0_sys>; 545 | 546 | regulator-state-mem { 547 | regulator-off-in-suspend; 548 | }; 549 | }; 550 | }; 551 | 552 | &i2c3 { 553 | i2c-scl-rising-time-ns = <450>; 554 | i2c-scl-falling-time-ns = <15>; 555 | status = "okay"; //hdmi_cec 556 | }; 557 | 558 | &i2s2 { 559 | status = "okay"; //hdmi_sound 560 | }; 561 | 562 | &spi1 { 563 | status = "disabled"; 564 | // status = "okay"; //lcd pannel 565 | pinctrl-names = "default"; 566 | pinctrl-0 = <&spi1_clk &spi1_tx &spi1_cs0>; 567 | //cs-gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>; /*SPI-CS:PC3 and PA6*/ 568 | 569 | st7789v@0 { 570 | status = "disabled"; 571 | // status = "okay"; 572 | compatible = "sitronix,st7789v"; 573 | reg = <0>; 574 | spi-max-frequency = <12000000>; 575 | bgr; 576 | fps = <30>; 577 | rotate = <90>; 578 | buswidth = <8>; 579 | dc-gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_HIGH>; 580 | reset-gpios = <&gpio1 RK_PA3 GPIO_ACTIVE_LOW>; 581 | led-gpios = <&gpio1 RK_PC4 GPIO_ACTIVE_HIGH>; 582 | debug = <0>; //等级0~7 越高信息越多 583 | }; 584 | }; 585 | 586 | &io_domains { 587 | status = "okay"; 588 | 589 | bt656-supply = <&vcc1v8_dvp>; 590 | audio-supply = <&vcca1v8_codec>; 591 | sdmmc-supply = <&vcc_sdio>; 592 | gpio1830-supply = <&vcc_3v0>; 593 | }; 594 | 595 | &pcie_phy { 596 | assigned-clock-parents = <&cru SCLK_PCIEPHY_REF100M>; 597 | assigned-clock-rates = <100000000>; 598 | assigned-clocks = <&cru SCLK_PCIEPHY_REF>; 599 | status = "okay"; 600 | }; 601 | 602 | &pcie0 { 603 | ep-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; 604 | num-lanes = <4>; 605 | status = "okay"; 606 | vpcie0v9-supply = <&vcca0v9_s3>; 607 | vpcie1v8-supply = <&vcca1v8_s3>; 608 | vpcie3v3-supply = <&vcc3v3_ext>; 609 | }; 610 | 611 | &pinctrl { 612 | buttons { 613 | power_key: power_key { 614 | rockchip,pins = 615 | <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; 616 | }; 617 | }; 618 | 619 | gmac { //13 16 19 22 26 620 | rgmii_pins: rgmii-pins { 621 | rockchip,pins = 622 | /* mac_txclk */ 623 | <3 RK_PC1 1 &pcfg_pull_none_19ma>, 624 | /* mac_rxclk */ 625 | <3 RK_PB6 1 &pcfg_pull_none>, 626 | /* mac_mdio */ 627 | <3 RK_PB5 1 &pcfg_pull_none>, 628 | /* mac_txen */ 629 | <3 RK_PB4 1 &pcfg_pull_none_26ma>, 630 | /* mac_clk */ 631 | <3 RK_PB3 1 &pcfg_pull_none>, 632 | /* mac_rxdv */ 633 | <3 RK_PB1 1 &pcfg_pull_none>, 634 | /* mac_mdc */ 635 | <3 RK_PB0 1 &pcfg_pull_none>, 636 | /* mac_rxd1 */ 637 | <3 RK_PA7 1 &pcfg_pull_none>, 638 | /* mac_rxd0 */ 639 | <3 RK_PA6 1 &pcfg_pull_none>, 640 | /* mac_txd1 */ 641 | <3 RK_PA5 1 &pcfg_pull_none_26ma>, 642 | /* mac_txd0 */ 643 | <3 RK_PA4 1 &pcfg_pull_none_26ma>, 644 | /* mac_rxd3 */ 645 | <3 RK_PA3 1 &pcfg_pull_none>, 646 | /* mac_rxd2 */ 647 | <3 RK_PA2 1 &pcfg_pull_none>, 648 | /* mac_txd3 */ 649 | <3 RK_PA1 1 &pcfg_pull_none_26ma>, 650 | /* mac_txd2 */ 651 | <3 RK_PA0 1 &pcfg_pull_none_26ma>; 652 | }; 653 | }; 654 | 655 | ir { 656 | ir_int: ir-int { 657 | rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; 658 | }; 659 | }; 660 | 661 | leds { 662 | user_led1_pin: user-led1-pin { 663 | rockchip,pins = 664 | <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; 665 | }; 666 | 667 | user_led2_pin: user-led2-pin { 668 | rockchip,pins = 669 | <1 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>; 670 | }; 671 | }; 672 | 673 | pcfg_pull_none_16ma: pcfg-pull-none-16ma { 674 | bias-disable; 675 | drive-strength = <16>; 676 | }; 677 | 678 | pcfg_pull_none_19ma: pcfg-pull-none-19ma { 679 | bias-disable; 680 | drive-strength = <19>; 681 | }; 682 | 683 | pcfg_pull_none_26ma: pcfg-pull-none-26ma { 684 | bias-disable; 685 | drive-strength = <26>; 686 | }; 687 | 688 | pcfg_pull_up_15ma: pcfg-pull-up_15ma { 689 | bias-pull-up; 690 | drive-strength = <15>; 691 | }; 692 | 693 | pcfg_pull_none_15ma: pcfg-pull-none-15ma { 694 | bias-disable; 695 | drive-strength = <15>; 696 | }; 697 | 698 | pcfg_pull_up_16ma: pcfg-pull-up_16ma { 699 | bias-pull-up; 700 | drive-strength = <16>; 701 | }; 702 | 703 | pmic { 704 | cpu_b_sleep: cpu-b-sleep { 705 | rockchip,pins = 706 | <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; 707 | }; 708 | 709 | gpu_sleep: gpu-sleep { 710 | rockchip,pins = 711 | <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; 712 | }; 713 | 714 | pmic_int_l: pmic-int-l { 715 | rockchip,pins = 716 | <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; 717 | }; 718 | }; 719 | 720 | usb2 { 721 | vcc5v0_host_en: vcc5v0-host-en { 722 | rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; 723 | }; 724 | }; 725 | 726 | sdmmc { //4 6 8 10 12 14 16 18 727 | sdmmc_bus1: sdmmc-bus1 { 728 | rockchip,pins = 729 | <4 RK_PB0 1 &pcfg_pull_up>; 730 | }; 731 | 732 | sdmmc_bus4: sdmmc-bus4 { 733 | rockchip,pins = 734 | <4 RK_PB0 1 &pcfg_pull_up_16ma>, 735 | <4 RK_PB1 1 &pcfg_pull_up_16ma>, 736 | <4 RK_PB2 1 &pcfg_pull_up_16ma>, 737 | <4 RK_PB3 1 &pcfg_pull_up_16ma>; 738 | }; 739 | 740 | sdmmc_clk: sdmmc-clk { 741 | rockchip,pins = 742 | <4 RK_PB4 1 &pcfg_pull_none_16ma>; 743 | }; 744 | 745 | sdmmc_cmd: sdmmc-cmd { 746 | rockchip,pins = 747 | <4 RK_PB5 1 &pcfg_pull_up_16ma>; 748 | }; 749 | 750 | sdmmc_cd: sdmmc-cd { 751 | rockchip,pins = 752 | <0 RK_PA7 1 &pcfg_pull_up>; 753 | }; 754 | 755 | sdmmc_wp: sdmmc-wp { 756 | rockchip,pins = 757 | <0 RK_PB0 1 &pcfg_pull_up>; 758 | }; 759 | }; 760 | 761 | sdio { 762 | bt_host_wake_l: bt-host-wake-l { 763 | rockchip,pins = 764 | <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; 765 | }; 766 | 767 | bt_reg_on_h: bt-reg-on-h { 768 | /* external pullup to VCC1V8_PMUPLL */ 769 | rockchip,pins = 770 | <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; 771 | }; 772 | 773 | bt_wake_l: bt-wake-l { 774 | rockchip,pins = 775 | <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; 776 | }; 777 | 778 | wifi_reg_on_h: wifi-reg_on-h { 779 | rockchip,pins = 780 | <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; 781 | }; 782 | }; 783 | 784 | sdio0 { //5;10;15;20 785 | sdio0_bus1: sdio0-bus1 { 786 | rockchip,pins = 787 | <2 RK_PC4 1 &pcfg_pull_up>; 788 | }; 789 | 790 | sdio0_bus4: sdio0-bus4 { 791 | rockchip,pins = 792 | <2 RK_PC4 1 &pcfg_pull_up_15ma>, 793 | <2 RK_PC5 1 &pcfg_pull_up_15ma>, 794 | <2 RK_PC6 1 &pcfg_pull_up_15ma>, 795 | <2 RK_PC7 1 &pcfg_pull_up_15ma>; 796 | }; 797 | 798 | sdio0_cmd: sdio0-cmd { 799 | rockchip,pins = 800 | <2 RK_PD0 1 &pcfg_pull_up_15ma>; 801 | }; 802 | 803 | sdio0_clk: sdio0-clk { 804 | rockchip,pins = 805 | <2 RK_PD1 1 &pcfg_pull_none_15ma>; 806 | }; 807 | 808 | sdio0_cd: sdio0-cd { 809 | rockchip,pins = 810 | <2 RK_PD2 1 &pcfg_pull_up>; 811 | }; 812 | 813 | sdio0_pwr: sdio0-pwr { 814 | rockchip,pins = 815 | <2 RK_PD3 1 &pcfg_pull_up>; 816 | }; 817 | 818 | sdio0_bkpwr: sdio0-bkpwr { 819 | rockchip,pins = 820 | <2 RK_PD4 1 &pcfg_pull_up>; 821 | }; 822 | 823 | sdio0_wp: sdio0-wp { 824 | rockchip,pins = 825 | <0 RK_PA3 1 &pcfg_pull_up>; 826 | }; 827 | 828 | sdio0_int: sdio0-int { 829 | rockchip,pins = 830 | <0 RK_PA4 1 &pcfg_pull_up>; 831 | }; 832 | }; 833 | 834 | sdio-pwrseq { 835 | wifi_host_wake_l: wifi-host-wake-l { 836 | rockchip,pins = 837 | <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; 838 | }; 839 | }; 840 | 841 | sdmmc { 842 | sdmmc0_det_l: sdmmc0-det-l { 843 | rockchip,pins = 844 | <0 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>; 845 | }; 846 | 847 | sdmmc0_pwr_h: sdmmc0-pwr-h { 848 | rockchip,pins = 849 | <2 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; 850 | }; 851 | }; 852 | }; 853 | 854 | &pmu_io_domains { 855 | status = "okay"; 856 | pmu1830-supply = <&vcc_3v0>; 857 | }; 858 | 859 | &pwm0 { 860 | status = "okay"; 861 | }; 862 | 863 | &pwm2 { 864 | status = "okay"; //vdd_log 865 | }; 866 | 867 | &saradc { 868 | status = "okay"; 869 | vref-supply = <&vcca1v8_s3>; 870 | }; 871 | 872 | &sdhci { 873 | bus-width = <8>; 874 | mmc-hs400-1_8v; 875 | mmc-hs400-enhanced-strobe; 876 | keep-power-in-suspend; 877 | non-removable; 878 | status = "okay"; 879 | }; 880 | 881 | &sdio0 { 882 | bus-width = <4>; 883 | //clock-frequency = <50000000>; 884 | cap-sdio-irq; 885 | cap-sd-highspeed; 886 | keep-power-in-suspend; 887 | mmc-pwrseq = <&sdio_pwrseq>; 888 | non-removable; 889 | pinctrl-names = "default"; 890 | pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; 891 | sd-uhs-sdr104; 892 | #address-cells = <1>; 893 | #size-cells = <0>; 894 | status = "okay"; 895 | 896 | brcmf: wifi@1 { 897 | compatible = "brcm,bcm43752-fmac"; 898 | reg = <1>; 899 | pinctrl-names = "default"; 900 | pinctrl-0 = <&wifi_host_wake_l>; 901 | }; 902 | }; 903 | 904 | &sdmmc { 905 | bus-width = <4>; 906 | cap-mmc-highspeed; 907 | cap-sd-highspeed; 908 | cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; 909 | disable-wp; 910 | cap-sdio-irq; 911 | pinctrl-names = "default"; 912 | pinctrl-0 = <&sdmmc_bus4 &sdmmc_clk &sdmmc_cmd &sdmmc0_det_l>; 913 | status = "okay"; 914 | vmmc-supply = <&vcc3v3_sd>; 915 | // vqmmc-supply = <&vcc3v3_sd>; 916 | vqmmc-supply = <&vcc_sdio>; 917 | }; 918 | 919 | &tcphy0 { 920 | status = "okay"; 921 | }; 922 | 923 | &tcphy1 { 924 | status = "okay"; 925 | }; 926 | 927 | &tsadc { 928 | /* tshut mode 0:CRU 1:GPIO */ 929 | rockchip,hw-tshut-mode = <1>; 930 | /* tshut polarity 0:LOW 1:HIGH */ 931 | rockchip,hw-tshut-polarity = <1>; 932 | status = "okay"; 933 | }; 934 | 935 | &u2phy0 { 936 | status = "okay"; 937 | 938 | u2phy0_otg: otg-port { 939 | status = "okay"; 940 | }; 941 | 942 | u2phy0_host: host-port { 943 | phy-supply = <&vcc5v0_host>; 944 | status = "okay"; 945 | }; 946 | }; 947 | 948 | &u2phy1 { 949 | status = "okay"; 950 | 951 | u2phy1_otg: otg-port { 952 | status = "okay"; 953 | }; 954 | 955 | u2phy1_host: host-port { 956 | phy-supply = <&vcc5v0_host>; 957 | status = "okay"; 958 | }; 959 | }; 960 | 961 | &uart0 { 962 | pinctrl-names = "default"; 963 | pinctrl-0 = <&uart0_xfer &uart0_rts &uart0_cts>; 964 | status = "disabled"; 965 | }; 966 | 967 | &uart2 { 968 | status = "okay"; //ttl 969 | }; 970 | 971 | &usb_host0_ehci { 972 | status = "okay"; 973 | }; 974 | 975 | &usb_host0_ohci { 976 | status = "okay"; 977 | }; 978 | 979 | &usb_host1_ehci { 980 | status = "okay"; 981 | }; 982 | 983 | &usb_host1_ohci { 984 | status = "okay"; 985 | }; 986 | 987 | &usbdrd3_0 { 988 | status = "okay"; 989 | }; 990 | 991 | &usbdrd_dwc3_0 { 992 | status = "okay"; 993 | dr_mode = "host"; 994 | }; 995 | 996 | &usbdrd3_1 { 997 | status = "okay"; 998 | }; 999 | 1000 | &usbdrd_dwc3_1 { 1001 | status = "okay"; 1002 | dr_mode = "host"; 1003 | }; 1004 | 1005 | &vopb { 1006 | status = "okay"; 1007 | }; 1008 | 1009 | &vopb_mmu { 1010 | status = "okay"; 1011 | }; 1012 | 1013 | &vopl { 1014 | status = "okay"; 1015 | }; 1016 | 1017 | &vopl_mmu { 1018 | status = "okay"; 1019 | }; 1020 | 1021 | &i2c3_xfer { 1022 | rockchip,pins = 1023 | <4 RK_PC1 1 &pcfg_pull_none_12ma>, 1024 | <4 RK_PC0 1 &pcfg_pull_none_12ma>; 1025 | }; 1026 | 1027 | -------------------------------------------------------------------------------- /dts/mainline/rk3399-fine3399-u-boot.dtsi: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0+ 2 | #include "rk3399-u-boot.dtsi" 3 | #include "rk3399-sdram-lpddr4-100.dtsi" 4 | 5 | / { 6 | chosen { 7 | u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc; 8 | }; 9 | }; 10 | 11 | &vdd_log { 12 | regulator-init-microvolt = <950000>; 13 | }; 14 | -------------------------------------------------------------------------------- /dts/mainline/rk3399-fine3399.dts: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: (GPL-2.0+ OR MIT) 2 | // Thank https://github.com/QXY716 3 | /dts-v1/; 4 | 5 | #include 6 | #include 7 | #include 8 | #include "rk3399.dtsi" 9 | #include "rk3399-op1-opp.dtsi" 10 | 11 | 12 | / { 13 | model = "Fine3399"; 14 | compatible = "rockchip,rk3399"; 15 | 16 | aliases { 17 | ethernet0 = &gmac; 18 | mmc0 = &sdio0; 19 | mmc1 = &sdmmc; 20 | mmc2 = &sdhci; 21 | }; 22 | 23 | chosen { 24 | stdout-path = "serial2:1500000n8"; 25 | }; 26 | 27 | clkin_gmac: external-gmac-clock { 28 | compatible = "fixed-clock"; 29 | clock-frequency = <125000000>; 30 | clock-output-names = "clkin_gmac"; 31 | #clock-cells = <0>; 32 | }; 33 | 34 | dc_12v: dc-12v { 35 | compatible = "regulator-fixed"; 36 | regulator-name = "dc_12v"; 37 | regulator-always-on; 38 | regulator-boot-on; 39 | regulator-min-microvolt = <12000000>; 40 | regulator-max-microvolt = <12000000>; 41 | }; 42 | 43 | sdio_pwrseq: sdio-pwrseq { 44 | compatible = "mmc-pwrseq-simple"; 45 | clocks = <&rk808 1>; 46 | clock-names = "ext_clock"; 47 | pinctrl-names = "default"; 48 | pinctrl-0 = <&wifi_reg_on_h>; 49 | reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; // bsp 50 | }; 51 | 52 | /* switched by pmic_sleep */ 53 | vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 { 54 | compatible = "regulator-fixed"; 55 | regulator-name = "vcc1v8_s3"; 56 | regulator-always-on; 57 | regulator-boot-on; 58 | regulator-min-microvolt = <1800000>; 59 | regulator-max-microvolt = <1800000>; 60 | vin-supply = <&vcc_1v8>; 61 | }; 62 | 63 | vcc3v3_sys: vcc3v3_pcie: vcc3v3_bl: vcc3v3-sys { // sch 64 | compatible = "regulator-fixed"; 65 | regulator-name = "vcc3v3_sys"; 66 | regulator-always-on; 67 | regulator-boot-on; 68 | regulator-min-microvolt = <3300000>; 69 | regulator-max-microvolt = <3300000>; 70 | vin-supply = <&dc_12v>; 71 | }; 72 | 73 | vcc_sys: vcc-sys { // sch 74 | compatible = "regulator-fixed"; 75 | regulator-name = "vcc_sys"; 76 | regulator-always-on; 77 | regulator-boot-on; 78 | regulator-min-microvolt = <5000000>; 79 | regulator-max-microvolt = <5000000>; 80 | vin-supply = <&dc_12v>; 81 | }; 82 | 83 | vcc_phy: vcc-phy-regulator { 84 | compatible = "regulator-fixed"; 85 | enable-active-high; 86 | gpio = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; 87 | pinctrl-names = "default"; 88 | pinctrl-0 = <&vcc_phy_h>; 89 | regulator-name = "vcc_phy"; 90 | regulator-always-on; 91 | regulator-boot-on; 92 | }; 93 | 94 | vdd_log: vdd-log { 95 | compatible = "pwm-regulator"; 96 | pwms = <&pwm2 0 25000 1>; 97 | regulator-name = "vdd_log"; 98 | regulator-always-on; 99 | regulator-boot-on; 100 | regulator-min-microvolt = <800000>; 101 | regulator-max-microvolt = <1400000>; 102 | vin-supply = <&vcc_sys>; 103 | }; 104 | 105 | leds: gpio-leds { 106 | compatible = "gpio-leds"; 107 | pinctrl-names = "default"; 108 | pinctrl-0 = <&user_led2>; 109 | 110 | user_led2 { 111 | label = "blue:work_led"; 112 | gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; // sch 113 | linux,default-trigger = "heartbeat"; 114 | }; 115 | }; 116 | 117 | gpio-keys { 118 | compatible = "gpio-keys"; 119 | autorepeat; 120 | pinctrl-names = "default"; 121 | pinctrl-0 = <&power_key>; 122 | 123 | key-power { 124 | debounce-interval = <100>; 125 | gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; // bsp 126 | label = "GPIO Key Power"; 127 | linux,code = ; 128 | wakeup-source; 129 | }; 130 | }; 131 | 132 | fan0: pwm-fan { 133 | compatible = "pwm-fan"; 134 | cooling-levels = <0 25 50 75 100 150>; 135 | #cooling-cells = <2>; 136 | fan-supply = <&vcc_sys>; 137 | pwms = <&pwm1 0 40000 0>; 138 | }; 139 | 140 | backlight: backlight { 141 | compatible = "pwm-backlight"; 142 | brightness-levels = <0 36 72 108 144 180 216 255>; 143 | default-brightness-level = <144>; 144 | pwms = <&pwm0 0 1000000 0>; 145 | }; 146 | 147 | // pwm3 148 | ir-receiver { 149 | compatible = "gpio-ir-receiver"; 150 | gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_LOW>; 151 | pinctrl-names = "default"; 152 | pinctrl-0 = <&ir_int>; 153 | }; 154 | 155 | adc-keys { 156 | compatible = "adc-keys"; 157 | io-channels = <&saradc 1>; 158 | io-channel-names = "buttons"; 159 | keyup-threshold-microvolt = <1750000>; 160 | poll-interval = <100>; 161 | 162 | recovery { 163 | label = "Recovery"; 164 | linux,code = ; // ?? 165 | press-threshold-microvolt = <0>; 166 | }; 167 | }; 168 | 169 | }; 170 | 171 | &cpu_l0 { 172 | cpu-supply = <&vdd_cpu_l>; 173 | }; 174 | 175 | &cpu_l1 { 176 | cpu-supply = <&vdd_cpu_l>; 177 | }; 178 | 179 | &cpu_l2 { 180 | cpu-supply = <&vdd_cpu_l>; 181 | }; 182 | 183 | &cpu_l3 { 184 | cpu-supply = <&vdd_cpu_l>; 185 | }; 186 | 187 | &cpu_b0 { 188 | cpu-supply = <&vdd_cpu_b>; 189 | }; 190 | 191 | &cpu_b1 { 192 | cpu-supply = <&vdd_cpu_b>; 193 | }; 194 | 195 | &gpu { 196 | mali-supply = <&vdd_gpu>; 197 | status = "okay"; 198 | }; 199 | 200 | &cpu_thermal { 201 | trips { 202 | cpu_hot: cpu_hot { 203 | hysteresis = <10000>; 204 | temperature = <55000>; 205 | type = "active"; 206 | }; 207 | }; 208 | 209 | cooling-maps { 210 | map2 { 211 | cooling-device = 212 | <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; 213 | trip = <&cpu_hot>; 214 | }; 215 | }; 216 | }; 217 | 218 | &emmc_phy { 219 | status = "okay"; 220 | }; 221 | 222 | &gmac { 223 | assigned-clocks = <&cru SCLK_RMII_SRC>; 224 | assigned-clock-parents = <&clkin_gmac>; 225 | clock_in_out = "input"; 226 | phy-supply = <&vcc_phy>; 227 | phy-mode = "rgmii"; 228 | pinctrl-names = "default"; 229 | pinctrl-0 = <&rgmii_pins>; 230 | snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; // bsp 231 | snps,reset-active-low; 232 | snps,reset-delays-us = <0 10000 50000>; 233 | tx_delay = <0x28>; 234 | rx_delay = <0x11>; 235 | status = "okay"; 236 | }; 237 | 238 | &hdmi { 239 | ddc-i2c-bus = <&i2c3>; 240 | pinctrl-names = "default"; 241 | pinctrl-0 = <&hdmi_cec>; 242 | status = "okay"; 243 | }; 244 | 245 | &hdmi_sound { 246 | status = "okay"; 247 | }; 248 | 249 | &i2c0 { 250 | clock-frequency = <400000>; 251 | i2c-scl-rising-time-ns = <168>; 252 | i2c-scl-falling-time-ns = <4>; 253 | status = "okay"; 254 | 255 | rk808: pmic@1b { 256 | compatible = "rockchip,rk808"; 257 | reg = <0x1b>; 258 | interrupt-parent = <&gpio1>; 259 | interrupts = ; 260 | #clock-cells = <1>; 261 | clock-output-names = "xin32k", "rk808-clkout2"; 262 | pinctrl-names = "default"; 263 | pinctrl-0 = <&pmic_int_l &pmic_dvs2>; 264 | rockchip,system-power-controller; 265 | wakeup-source; 266 | 267 | vcc1-supply = <&vcc3v3_sys>; 268 | vcc2-supply = <&vcc3v3_sys>; 269 | vcc3-supply = <&vcc3v3_sys>; 270 | vcc4-supply = <&vcc3v3_sys>; 271 | vcc6-supply = <&vcc3v3_sys>; 272 | vcc7-supply = <&vcc3v3_sys>; 273 | vcc8-supply = <&vcc3v3_sys>; 274 | vcc9-supply = <&vcc3v3_sys>; 275 | vcc10-supply = <&vcc3v3_sys>; 276 | vcc11-supply = <&vcc3v3_sys>; 277 | vcc12-supply = <&vcc3v3_sys>; 278 | vddio-supply = <&vcc1v8_pmu>; 279 | 280 | regulators { 281 | vdd_center: DCDC_REG1 { 282 | regulator-name = "vdd_center"; 283 | regulator-always-on; 284 | regulator-boot-on; 285 | regulator-min-microvolt = <750000>; 286 | regulator-max-microvolt = <1350000>; 287 | regulator-ramp-delay = <6001>; 288 | regulator-state-mem { 289 | regulator-off-in-suspend; 290 | }; 291 | }; 292 | 293 | vdd_cpu_l: DCDC_REG2 { 294 | regulator-name = "vdd_cpu_l"; 295 | regulator-always-on; 296 | regulator-boot-on; 297 | regulator-min-microvolt = <750000>; 298 | regulator-max-microvolt = <1350000>; 299 | regulator-ramp-delay = <6001>; 300 | regulator-state-mem { 301 | regulator-off-in-suspend; 302 | }; 303 | }; 304 | 305 | vcc_ddr: DCDC_REG3 { 306 | regulator-name = "vcc_ddr"; 307 | regulator-always-on; 308 | regulator-boot-on; 309 | regulator-state-mem { 310 | regulator-on-in-suspend; 311 | }; 312 | }; 313 | 314 | vcc_1v8: DCDC_REG4 { 315 | regulator-name = "vcc_1v8"; 316 | regulator-always-on; 317 | regulator-boot-on; 318 | regulator-min-microvolt = <1800000>; 319 | regulator-max-microvolt = <1800000>; 320 | regulator-state-mem { 321 | regulator-on-in-suspend; 322 | regulator-suspend-microvolt = <1800000>; 323 | }; 324 | }; 325 | 326 | vcc1v8_dvp: LDO_REG1 { 327 | regulator-name = "vcc1v8_dvp"; 328 | regulator-always-on; 329 | regulator-boot-on; 330 | regulator-min-microvolt = <1800000>; 331 | regulator-max-microvolt = <1800000>; 332 | regulator-state-mem { 333 | regulator-off-in-suspend; 334 | }; 335 | }; 336 | 337 | vcc3v0_tp: LDO_REG2 { 338 | regulator-always-on; 339 | regulator-boot-on; 340 | regulator-min-microvolt = <3000000>; 341 | regulator-max-microvolt = <3000000>; 342 | regulator-name = "vcc3v0_tp"; 343 | regulator-state-mem { 344 | regulator-off-in-suspend; 345 | }; 346 | }; 347 | 348 | vcc1v8_pmu: LDO_REG3 { 349 | regulator-name = "vcc1v8_pmu"; 350 | regulator-always-on; 351 | regulator-boot-on; 352 | regulator-min-microvolt = <1800000>; 353 | regulator-max-microvolt = <1800000>; 354 | regulator-state-mem { 355 | regulator-on-in-suspend; 356 | regulator-suspend-microvolt = <1800000>; 357 | }; 358 | }; 359 | 360 | vcc_sd: LDO_REG4 { 361 | regulator-name = "vcc_sd"; 362 | regulator-always-on; 363 | regulator-boot-on; 364 | regulator-min-microvolt = <1800000>; 365 | regulator-max-microvolt = <3300000>; 366 | regulator-state-mem { 367 | regulator-on-in-suspend; 368 | regulator-suspend-microvolt = <3300000>; 369 | }; 370 | }; 371 | 372 | vcca3v0_codec: LDO_REG5 { 373 | regulator-name = "vcca3v0_codec"; 374 | regulator-always-on; 375 | regulator-boot-on; 376 | regulator-min-microvolt = <3000000>; 377 | regulator-max-microvolt = <3000000>; 378 | regulator-state-mem { 379 | regulator-off-in-suspend; 380 | }; 381 | }; 382 | 383 | vcc_1v5: LDO_REG6 { 384 | regulator-name = "vcc_1v5"; 385 | regulator-always-on; 386 | regulator-boot-on; 387 | regulator-min-microvolt = <1500000>; 388 | regulator-max-microvolt = <1500000>; 389 | regulator-state-mem { 390 | regulator-on-in-suspend; 391 | regulator-suspend-microvolt = <1500000>; 392 | }; 393 | }; 394 | 395 | vcca1v8_codec: LDO_REG7 { 396 | regulator-name = "vcca1v8_codec"; 397 | regulator-always-on; 398 | regulator-boot-on; 399 | regulator-min-microvolt = <1800000>; 400 | regulator-max-microvolt = <1800000>; 401 | regulator-state-mem { 402 | regulator-off-in-suspend; 403 | }; 404 | }; 405 | 406 | vcc_3v0: LDO_REG8 { 407 | regulator-name = "vcc_3v0"; 408 | regulator-always-on; 409 | regulator-boot-on; 410 | regulator-min-microvolt = <3000000>; 411 | regulator-max-microvolt = <3000000>; 412 | regulator-state-mem { 413 | regulator-on-in-suspend; 414 | regulator-suspend-microvolt = <3000000>; 415 | }; 416 | }; 417 | 418 | vcc3v3_s3: SWITCH_REG1 { 419 | regulator-name = "vcc3v3_s3"; 420 | regulator-always-on; 421 | regulator-boot-on; 422 | regulator-state-mem { 423 | regulator-off-in-suspend; 424 | }; 425 | }; 426 | 427 | vcc3v3_s0: SWITCH_REG2 { 428 | regulator-name = "vcc3v3_s0"; 429 | regulator-always-on; 430 | regulator-boot-on; 431 | regulator-state-mem { 432 | regulator-off-in-suspend; 433 | }; 434 | }; 435 | }; 436 | }; 437 | 438 | vdd_cpu_b: regulator@40 { 439 | compatible = "silergy,syr827"; 440 | reg = <0x40>; 441 | fcs,suspend-voltage-selector = <1>; 442 | pinctrl-names = "default"; 443 | pinctrl-0 = <&cpu_b_sleep>; 444 | regulator-name = "vdd_cpu_b"; 445 | regulator-min-microvolt = <712500>; 446 | regulator-max-microvolt = <1500000>; 447 | regulator-ramp-delay = <1000>; 448 | regulator-always-on; 449 | regulator-boot-on; 450 | vin-supply = <&vcc_sys>; 451 | 452 | regulator-state-mem { 453 | regulator-off-in-suspend; 454 | }; 455 | }; 456 | 457 | vdd_gpu: regulator@41 { 458 | compatible = "silergy,syr828"; 459 | reg = <0x41>; 460 | fcs,suspend-voltage-selector = <1>; 461 | pinctrl-names = "default"; 462 | pinctrl-0 = <&gpu_sleep>; 463 | regulator-name = "vdd_gpu"; 464 | regulator-min-microvolt = <712500>; 465 | regulator-max-microvolt = <1500000>; 466 | regulator-ramp-delay = <1000>; 467 | regulator-always-on; 468 | regulator-boot-on; 469 | vin-supply = <&vcc_sys>; 470 | 471 | regulator-state-mem { 472 | regulator-off-in-suspend; 473 | }; 474 | }; 475 | }; 476 | 477 | // Used for HDMI 478 | &i2c3 { 479 | i2c-scl-rising-time-ns = <450>; 480 | i2c-scl-falling-time-ns = <15>; 481 | status = "okay"; 482 | }; 483 | 484 | // HDMI sound 485 | &i2s2 { 486 | #sound-dai-cells = <0>; 487 | status = "okay"; 488 | }; 489 | 490 | &io_domains { 491 | status = "okay"; 492 | 493 | bt656-supply = <&vcc_3v0>; 494 | audio-supply = <&vcca1v8_codec>; 495 | sdmmc-supply = <&vcc_sd>; 496 | gpio1830-supply = <&vcc_3v0>; 497 | }; 498 | 499 | &pmu_io_domains { 500 | status = "okay"; 501 | pmu1830-supply = <&vcc_1v8>; 502 | }; 503 | 504 | &pcie_phy { 505 | status = "okay"; 506 | }; 507 | 508 | &pcie0 { 509 | ep-gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>; // sch 510 | max-link-speed = <2>; 511 | num-lanes = <2>; 512 | pinctrl-names = "default"; 513 | pinctrl-0 = <&pcie_clkreqn_cpm>; 514 | status = "okay"; 515 | }; 516 | 517 | &pinctrl { 518 | pmic { 519 | cpu_b_sleep: cpu-b-sleep { 520 | rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; 521 | }; 522 | 523 | gpu_sleep: gpu-sleep { 524 | rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; 525 | }; 526 | 527 | pmic_int_l: pmic-int-l { 528 | rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; 529 | }; 530 | 531 | pmic_dvs2: pmic-dvs2 { 532 | rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; // bsp 533 | }; 534 | }; 535 | 536 | sdio-pwrseq { 537 | wifi_reg_on_h: wifi-reg-on-h { 538 | rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; 539 | }; 540 | }; 541 | 542 | wifi { 543 | wifi_host_wake_l: wifi-host-wake-l { 544 | rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; 545 | }; 546 | }; 547 | 548 | bt { 549 | bt_enable_h: bt-enable-h { 550 | rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; 551 | }; 552 | 553 | bt_host_wake_l: bt-host-wake-l { 554 | rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>; 555 | }; 556 | 557 | bt_wake_l: bt-wake-l { 558 | rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; 559 | }; 560 | }; 561 | 562 | gmac { 563 | vcc_phy_h: vcc-phy-h { 564 | rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; 565 | }; 566 | }; 567 | 568 | leds { 569 | user_led2: user_led2 { 570 | rockchip,pins = 571 | <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; 572 | }; 573 | }; 574 | 575 | ir { 576 | ir_int: ir-int { 577 | rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; 578 | }; 579 | }; 580 | 581 | buttons { 582 | power_key: power_key { 583 | rockchip,pins = 584 | <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; 585 | }; 586 | }; 587 | }; 588 | 589 | // LCD 590 | &pwm0 { 591 | status = "okay"; 592 | }; 593 | 594 | // FAN 595 | &pwm1 { 596 | status = "okay"; 597 | }; 598 | 599 | &pwm2 { 600 | status = "okay"; 601 | }; 602 | 603 | &saradc { 604 | vref-supply = <&vcca1v8_s3>; 605 | status = "okay"; 606 | }; 607 | 608 | // if kernel panic at system boot, try to disable WiFi 609 | &sdio0 { 610 | bus-width = <4>; 611 | cap-sd-highspeed; 612 | cap-sdio-irq; 613 | clock-frequency = <50000000>; 614 | disable-wp; 615 | keep-power-in-suspend; 616 | max-frequency = <50000000>; 617 | mmc-pwrseq = <&sdio_pwrseq>; 618 | non-removable; 619 | pinctrl-names = "default"; 620 | pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; 621 | sd-uhs-sdr104; 622 | #address-cells = <1>; 623 | #size-cells = <0>; 624 | status = "okay"; 625 | 626 | brcmf: wifi@1 { 627 | reg = <1>; 628 | compatible = "brcm,bcm4329-fmac"; 629 | interrupt-parent = <&gpio0>; 630 | interrupts = ; 631 | interrupt-names = "host-wake"; 632 | brcm,drive-strength = <5>; 633 | pinctrl-names = "default"; 634 | pinctrl-0 = <&wifi_host_wake_l>; 635 | }; 636 | }; 637 | 638 | &sdmmc { 639 | bus-width = <4>; 640 | cap-sd-highspeed; 641 | cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; // bsp 642 | clock-frequency = <150000000>; 643 | disable-wp; 644 | sd-uhs-sdr104; 645 | max-frequency = <150000000>; 646 | pinctrl-names = "default"; 647 | pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; 648 | vqmmc-supply = <&vcc_sd>; 649 | status = "okay"; 650 | }; 651 | 652 | &sdhci { 653 | bus-width = <8>; 654 | mmc-hs400-1_8v; 655 | mmc-hs400-enhanced-strobe; 656 | keep-power-in-suspend; 657 | non-removable; 658 | status = "okay"; 659 | }; 660 | /* 661 | &spi1 { 662 | status = "okay"; 663 | 664 | norflash: flash@0 { 665 | compatible = "jedec,spi-nor"; 666 | reg = <0>; 667 | spi-max-frequency = <50000000>; 668 | }; 669 | }; 670 | */ 671 | 672 | &spi2 { 673 | status = "okay"; 674 | 675 | panel@0 { 676 | compatible = "sitronix,st7735s", "sitronix,st7735r", "sitronix,st7789v", "jianda,jd-t18003-t01"; 677 | reg = <0>; 678 | rgb; 679 | width = <80>; 680 | height = <160>; 681 | fps = <30>; 682 | buswidth = <8>; 683 | rotate = <90>; 684 | backlight = <&backlight>; 685 | dc-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>; 686 | reset-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_LOW>; 687 | led-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>; 688 | spi-max-frequency = <32000000>; 689 | debug = <0>; 690 | spi-cpol; 691 | spi-cpha; 692 | }; 693 | }; 694 | 695 | &tcphy0 { 696 | status = "okay"; 697 | }; 698 | 699 | &tcphy1 { 700 | status = "okay"; 701 | }; 702 | 703 | &tsadc { 704 | /* tshut mode 0:CRU 1:GPIO */ 705 | rockchip,hw-tshut-mode = <1>; 706 | /* tshut polarity 0:LOW 1:HIGH */ 707 | rockchip,hw-tshut-polarity = <1>; 708 | status = "okay"; 709 | }; 710 | 711 | &u2phy0 { 712 | status = "okay"; 713 | 714 | u2phy0_otg: otg-port { 715 | status = "okay"; 716 | }; 717 | 718 | u2phy0_host: host-port { 719 | status = "okay"; 720 | }; 721 | }; 722 | 723 | &u2phy1 { 724 | status = "okay"; 725 | 726 | u2phy1_otg: otg-port { 727 | status = "okay"; 728 | }; 729 | 730 | u2phy1_host: host-port { 731 | status = "okay"; 732 | }; 733 | }; 734 | 735 | &uart0 { 736 | pinctrl-names = "default"; 737 | pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; 738 | status = "okay"; 739 | 740 | bluetooth { 741 | compatible = "brcm,bcm43438-bt"; 742 | clocks = <&rk808 1>; 743 | clock-names = "lpo"; 744 | device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; 745 | host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; 746 | shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; 747 | max-speed = <4000000>; 748 | pinctrl-names = "default"; 749 | pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; 750 | vbat-supply = <&vcc3v3_sys>; 751 | vddio-supply = <&vcc_1v8>; 752 | }; 753 | }; 754 | 755 | // Debug TTL 756 | &uart2 { 757 | status = "okay"; 758 | }; 759 | 760 | &usb_host0_ehci { 761 | status = "okay"; 762 | }; 763 | 764 | &usb_host0_ohci { 765 | status = "okay"; 766 | }; 767 | 768 | &usb_host1_ehci { 769 | status = "okay"; 770 | }; 771 | 772 | &usb_host1_ohci { 773 | status = "okay"; 774 | }; 775 | 776 | &usbdrd3_0 { 777 | status = "okay"; 778 | }; 779 | 780 | &usbdrd_dwc3_0 { 781 | status = "okay"; 782 | dr_mode = "host"; 783 | }; 784 | 785 | &usbdrd3_1 { 786 | status = "okay"; 787 | }; 788 | 789 | &usbdrd_dwc3_1 { 790 | status = "okay"; 791 | dr_mode = "host"; 792 | }; 793 | 794 | &vopb { 795 | status = "okay"; 796 | }; 797 | 798 | &vopb_mmu { 799 | status = "okay"; 800 | }; 801 | 802 | &vopl { 803 | status = "okay"; 804 | }; 805 | 806 | &vopl_mmu { 807 | status = "okay"; 808 | }; 809 | 810 | &iep_mmu { 811 | status = "okay"; 812 | }; 813 | -------------------------------------------------------------------------------- /dts/mainline/rk3588-hinlink-h88k.dts: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: (GPL-2.0+ OR MIT) 2 | 3 | /dts-v1/; 4 | 5 | #include 6 | #include 7 | #include 8 | #include "rk3588.dtsi" 9 | 10 | / { 11 | model = "HINLINK H88K"; 12 | compatible = "hinlink,h88k", "rockchip,rk3588"; 13 | 14 | aliases { 15 | ethernet0 = &gmac0; 16 | mmc0 = &sdhci; 17 | mmc1 = &sdmmc; 18 | mmc2 = &sdio; 19 | }; 20 | 21 | analog-sound { 22 | compatible = "simple-audio-card"; 23 | label = "rockchip,es8388-codec"; 24 | pinctrl-names = "default"; 25 | pinctrl-0 = <&hp_detect>; 26 | simple-audio-card,name = "Analog"; 27 | simple-audio-card,format = "i2s"; 28 | simple-audio-card,mclk-fs = <256>; 29 | simple-audio-card,hp-det-gpios = <&gpio1 RK_PD5 GPIO_ACTIVE_HIGH>; 30 | simple-audio-card,bitclock-master = <&daicpu>; 31 | simple-audio-card,frame-master = <&daicpu>; 32 | 33 | simple-audio-card,widgets = 34 | "Microphone", "Onboard Microphone", 35 | "Microphone", "Microphone Jack", 36 | "Speaker", "Speaker", 37 | "Headphone", "Headphones"; 38 | 39 | simple-audio-card,routing = 40 | "Headphones", "LOUT1", 41 | "Headphones", "ROUT1", 42 | "Speaker", "LOUT2", 43 | "Speaker", "ROUT2", 44 | 45 | /* single ended signal to LINPUT1 */ 46 | "LINPUT1", "Microphone Jack", 47 | "RINPUT1", "Microphone Jack", 48 | /* differential signal */ 49 | "LINPUT2", "Onboard Microphone", 50 | "RINPUT2", "Onboard Microphone"; 51 | 52 | daicpu: simple-audio-card,cpu { 53 | sound-dai = <&i2s0_8ch>; 54 | system-clock-frequency = <12288000>; 55 | }; 56 | 57 | daicodec: simple-audio-card,codec { 58 | sound-dai = <&es8388>; 59 | system-clock-frequency = <12288000>; 60 | }; 61 | }; 62 | 63 | chosen { 64 | stdout-path = "serial2:1500000n8"; 65 | }; 66 | 67 | leds { 68 | compatible = "gpio-leds"; 69 | pinctrl-names = "default"; 70 | pinctrl-0 = <&led_net_en>, <&led_sata_en>, 71 | <&led_user_en>, <&led_work_en>; 72 | 73 | net { 74 | label = "blue:net"; 75 | gpios = <&gpio2 RK_PC3 GPIO_ACTIVE_HIGH>; 76 | linux,default-trigger = "netdev"; 77 | }; 78 | 79 | ssd { 80 | label = "amber:ssd"; 81 | gpios = <&gpio2 RK_PC5 GPIO_ACTIVE_HIGH>; 82 | }; 83 | 84 | user { 85 | label = "green:user"; 86 | gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_HIGH>; 87 | linux,default-trigger = "mmc1"; 88 | }; 89 | 90 | work { 91 | label = "red:work"; 92 | gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; 93 | linux,default-trigger = "heartbeat"; 94 | }; 95 | }; 96 | 97 | hdmi0-con { 98 | compatible = "hdmi-connector"; 99 | type = "a"; 100 | 101 | port { 102 | hdmi0_con_in: endpoint { 103 | remote-endpoint = <&hdmi0_out_con>; 104 | }; 105 | }; 106 | }; 107 | 108 | hdmi1-con { 109 | compatible = "hdmi-connector"; 110 | type = "a"; 111 | 112 | port { 113 | hdmi1_con_in: endpoint { 114 | remote-endpoint = <&hdmi1_out_con>; 115 | }; 116 | }; 117 | }; 118 | 119 | rfkilli-wifi { 120 | compatible = "rfkill-gpio"; 121 | label = "rfkill-pcie-wlan"; 122 | radio-type = "wlan"; 123 | shutdown-gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_HIGH>; 124 | }; 125 | 126 | rfkill-bt { 127 | compatible = "rfkill-gpio"; 128 | label = "rfkill-m2-bt"; 129 | radio-type = "bluetooth"; 130 | shutdown-gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_HIGH>; 131 | }; 132 | 133 | vcc12v_dcin: vcc12v-dcin { 134 | compatible = "regulator-fixed"; 135 | regulator-always-on; 136 | regulator-boot-on; 137 | regulator-min-microvolt = <12000000>; 138 | regulator-max-microvolt = <12000000>; 139 | regulator-name = "vcc12v_dcin"; 140 | }; 141 | 142 | vcc3v3_pcie30: vcc3v3-pcie30-regulator { 143 | compatible = "regulator-fixed"; 144 | enable-active-high; 145 | gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>; 146 | regulator-name = "vcc3v3_pcie30"; 147 | regulator-min-microvolt = <3300000>; 148 | regulator-max-microvolt = <3300000>; 149 | startup-delay-us = <5000>; 150 | vin-supply = <&vcc12v_dcin>; 151 | }; 152 | 153 | /* it's modem reset pin */ 154 | modem_enable: modem-enable { 155 | compatible = "regulator-fixed"; 156 | enable-active-high; 157 | regulator-always-on; 158 | regulator-boot-on; 159 | gpios = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>; 160 | regulator-min-microvolt = <3300000>; 161 | regulator-max-microvolt = <3300000>; 162 | regulator-name = "modem-enable"; 163 | vin-supply = <&vcc_3v3_s3>; 164 | startup-delay-us = <500000>; 165 | pinctrl-names = "default"; 166 | pintctrl-0 = <&modem_reset_en>; 167 | }; 168 | 169 | vcc3v3_modem: vcc3v3-modem { 170 | compatible = "regulator-fixed"; 171 | enable-active-high; 172 | regulator-always-on; 173 | regulator-boot-on; 174 | gpios = <&gpio4 RK_PA3 GPIO_ACTIVE_HIGH>; 175 | regulator-min-microvolt = <3300000>; 176 | regulator-max-microvolt = <3300000>; 177 | regulator-name = "vcc3v3_modem"; 178 | pinctrl-names = "default"; 179 | pintctrl-0 = <&modem_power_en>; 180 | vin-supply = <&vcc_3v3_s3>; 181 | }; 182 | 183 | vcc5v0_host: vcc5v0-host-regulator { 184 | compatible = "regulator-fixed"; 185 | regulator-name = "vcc5v0_host"; 186 | regulator-boot-on; 187 | regulator-always-on; 188 | regulator-min-microvolt = <5000000>; 189 | regulator-max-microvolt = <5000000>; 190 | enable-active-high; 191 | gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; 192 | pinctrl-names = "default"; 193 | pinctrl-0 = <&vcc5v0_host_en>; 194 | vin-supply = <&vcc5v0_sys>; 195 | }; 196 | 197 | vcc5v0_usb_hub: vcc5v0-usb-hub { 198 | compatible = "regulator-fixed"; 199 | enable-active-high; 200 | gpio = <&gpio4 RK_PA6 GPIO_ACTIVE_HIGH>; 201 | pinctrl-names = "default"; 202 | pinctrl-0 = <&vcc5v0_usb_hub_en>; 203 | regulator-name = "vcc5v0_usb_hub"; 204 | regulator-always-on; 205 | vin-supply = <&vcc5v0_sys>; 206 | }; 207 | 208 | vcc5v0_sys: vcc5v0-sys-regulator { 209 | compatible = "regulator-fixed"; 210 | regulator-name = "vcc5v0_sys"; 211 | regulator-always-on; 212 | regulator-boot-on; 213 | regulator-min-microvolt = <5000000>; 214 | regulator-max-microvolt = <5000000>; 215 | }; 216 | 217 | vcc_1v1_nldo_s3: vcc-1v1-nldo-s3-regulator { 218 | compatible = "regulator-fixed"; 219 | regulator-name = "vcc_1v1_nldo_s3"; 220 | regulator-always-on; 221 | regulator-boot-on; 222 | regulator-min-microvolt = <1100000>; 223 | regulator-max-microvolt = <1100000>; 224 | vin-supply = <&vcc5v0_sys>; 225 | }; 226 | }; 227 | 228 | &combphy0_ps { 229 | status = "okay"; 230 | }; 231 | 232 | &combphy1_ps { 233 | status = "okay"; 234 | }; 235 | 236 | &combphy2_psu { 237 | status = "okay"; 238 | }; 239 | 240 | &cpu_b0 { 241 | cpu-supply = <&vdd_cpu_big0_s0>; 242 | }; 243 | 244 | &cpu_b1 { 245 | cpu-supply = <&vdd_cpu_big0_s0>; 246 | }; 247 | 248 | &cpu_b2 { 249 | cpu-supply = <&vdd_cpu_big1_s0>; 250 | }; 251 | 252 | &cpu_b3 { 253 | cpu-supply = <&vdd_cpu_big1_s0>; 254 | }; 255 | 256 | &cpu_l0 { 257 | cpu-supply = <&vdd_cpu_lit_s0>; 258 | }; 259 | 260 | &cpu_l1 { 261 | cpu-supply = <&vdd_cpu_lit_s0>; 262 | }; 263 | 264 | &cpu_l2 { 265 | cpu-supply = <&vdd_cpu_lit_s0>; 266 | }; 267 | 268 | &cpu_l3 { 269 | cpu-supply = <&vdd_cpu_lit_s0>; 270 | }; 271 | 272 | &gmac0 { 273 | clock_in_out = "output"; 274 | phy-handle = <&rgmii_phy>; 275 | phy-mode = "rgmii-rxid"; 276 | pinctrl-0 = <&gmac0_miim 277 | &gmac0_tx_bus2 278 | &gmac0_rx_bus2 279 | &gmac0_rgmii_clk 280 | &gmac0_rgmii_bus>; 281 | pinctrl-names = "default"; 282 | rx_delay = <0x00>; 283 | tx_delay = <0x43>; 284 | status = "okay"; 285 | }; 286 | 287 | &gpu { 288 | mali-supply = <&vdd_gpu_s0>; 289 | status = "okay"; 290 | }; 291 | 292 | &hdmi0 { 293 | status = "okay"; 294 | }; 295 | 296 | 297 | &hdptxphy0 { 298 | status = "okay"; 299 | }; 300 | 301 | &hdmi0_in { 302 | hdmi0_in_vp0: endpoint { 303 | remote-endpoint = <&vp0_out_hdmi0>; 304 | }; 305 | }; 306 | 307 | &hdmi0_out { 308 | hdmi0_out_con: endpoint { 309 | remote-endpoint = <&hdmi0_con_in>; 310 | }; 311 | }; 312 | 313 | &hdmi1 { 314 | status = "okay"; 315 | }; 316 | 317 | &hdmi1_in { 318 | hdmi1_in_vp1: endpoint { 319 | remote-endpoint = <&vp1_out_hdmi1>; 320 | }; 321 | }; 322 | 323 | &hdmi1_out { 324 | hdmi1_out_con: endpoint { 325 | remote-endpoint = <&hdmi1_con_in>; 326 | }; 327 | }; 328 | 329 | &hdptxphy1 { 330 | status = "okay"; 331 | }; 332 | 333 | &hdmi_receiver_cma { 334 | status = "okay"; 335 | }; 336 | 337 | &hdmi_receiver { 338 | status = "okay"; 339 | hpd-gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>; 340 | pinctrl-0 = <&hdmim1_rx_cec &hdmim1_rx_hpdin &hdmim1_rx_scl &hdmim1_rx_sda &hdmirx_hpd>; 341 | pinctrl-names = "default"; 342 | memory-region = <&hdmi_receiver_cma>; 343 | }; 344 | 345 | &i2c0 { 346 | pinctrl-names = "default"; 347 | pinctrl-0 = <&i2c0m2_xfer>; 348 | status = "okay"; 349 | 350 | vdd_cpu_big0_s0: regulator@42 { 351 | compatible = "rockchip,rk8602"; 352 | reg = <0x42>; 353 | fcs,suspend-voltage-selector = <1>; 354 | regulator-name = "vdd_cpu_big0_s0"; 355 | regulator-always-on; 356 | regulator-boot-on; 357 | regulator-min-microvolt = <550000>; 358 | regulator-max-microvolt = <1050000>; 359 | regulator-ramp-delay = <2300>; 360 | vin-supply = <&vcc5v0_sys>; 361 | 362 | regulator-state-mem { 363 | regulator-off-in-suspend; 364 | }; 365 | }; 366 | 367 | vdd_cpu_big1_s0: regulator@43 { 368 | compatible = "rockchip,rk8603", "rockchip,rk8602"; 369 | reg = <0x43>; 370 | fcs,suspend-voltage-selector = <1>; 371 | regulator-name = "vdd_cpu_big1_s0"; 372 | regulator-always-on; 373 | regulator-boot-on; 374 | regulator-min-microvolt = <550000>; 375 | regulator-max-microvolt = <1050000>; 376 | regulator-ramp-delay = <2300>; 377 | vin-supply = <&vcc5v0_sys>; 378 | 379 | regulator-state-mem { 380 | regulator-off-in-suspend; 381 | }; 382 | }; 383 | }; 384 | 385 | &i2c2 { 386 | status = "okay"; 387 | 388 | hym8563: rtc@51 { 389 | compatible = "haoyu,hym8563"; 390 | reg = <0x51>; 391 | #clock-cells = <0>; 392 | clock-output-names = "hym8563"; 393 | pinctrl-names = "default"; 394 | pinctrl-0 = <&hym8563_int>; 395 | interrupt-parent = <&gpio0>; 396 | interrupts = ; 397 | wakeup-source; 398 | }; 399 | }; 400 | 401 | &i2c7 { 402 | status = "okay"; 403 | 404 | es8388: audio-codec@11 { 405 | compatible = "everest,es8388"; 406 | reg = <0x11>; 407 | assigned-clocks = <&cru I2S0_8CH_MCLKOUT>; 408 | assigned-clock-rates = <12288000>; 409 | AVDD-supply = <&vcc_3v3_s3>; 410 | clocks = <&cru I2S0_8CH_MCLKOUT>; 411 | DVDD-supply = <&vcc_1v8_s3>; 412 | HPVDD-supply = <&vcc_3v3_s3>; 413 | PVDD-supply = <&vcc_1v8_s3>; 414 | #sound-dai-cells = <0>; 415 | }; 416 | }; 417 | 418 | &i2s0_8ch { 419 | pinctrl-names = "default"; 420 | pinctrl-0 = <&i2s0_lrck 421 | &i2s0_mclk 422 | &i2s0_sclk 423 | &i2s0_sdi0 424 | &i2s0_sdo0>; 425 | status = "okay"; 426 | }; 427 | 428 | &mdio0 { 429 | rgmii_phy: ethernet-phy@1 { 430 | /* RTL8211F */ 431 | compatible = "ethernet-phy-ieee802.3-c22"; 432 | reg = <0x1>; 433 | pinctrl-names = "default"; 434 | pinctrl-0 = <&rtl8211f_rst>; 435 | reset-assert-us = <20000>; 436 | reset-deassert-us = <100000>; 437 | reset-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_LOW>; 438 | }; 439 | }; 440 | 441 | &pcie2x1l0 { 442 | reset-gpios = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>; 443 | status = "okay"; 444 | }; 445 | 446 | &pcie2x1l1 { 447 | reset-gpios = <&gpio4 RK_PA2 GPIO_ACTIVE_HIGH>; 448 | status = "okay"; 449 | }; 450 | 451 | &pcie2x1l2 { 452 | reset-gpios = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>; 453 | status = "okay"; 454 | }; 455 | 456 | &pcie30phy { 457 | status = "okay"; 458 | }; 459 | 460 | &pcie3x4 { 461 | pinctrl-names = "default"; 462 | reset-gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>; 463 | vpcie3v3-supply = <&vcc3v3_pcie30>; 464 | status = "okay"; 465 | }; 466 | 467 | &pinctrl { 468 | hdmirx { 469 | hdmirx_hpd: hdmirx-hpd { 470 | rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; 471 | }; 472 | }; 473 | 474 | hym8563 { 475 | hym8563_int: hym8563-int { 476 | rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; 477 | }; 478 | }; 479 | 480 | leds { 481 | led_net_en: led_net_en { 482 | rockchip,pins = <2 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>; 483 | }; 484 | 485 | led_sata_en: led_sata_en { 486 | rockchip,pins = <2 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; 487 | }; 488 | 489 | led_user_en: led_user_en { 490 | rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; 491 | }; 492 | 493 | led_work_en: led_work_en { 494 | rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; 495 | }; 496 | }; 497 | 498 | modem { 499 | modem_power_en: modem-power-en { 500 | rockchip,pins = <4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; 501 | }; 502 | 503 | modem_reset_en: modem-reset-en { 504 | rockchip,pins = <4 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; 505 | }; 506 | }; 507 | 508 | rtl8211f { 509 | rtl8211f_rst: rtl8211f-rst { 510 | rockchip,pins = <4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; 511 | }; 512 | }; 513 | 514 | sound { 515 | hp_detect: hp-detect { 516 | rockchip,pins = <1 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>; 517 | }; 518 | }; 519 | 520 | usb { 521 | vcc5v0_host_en: vcc5v0-host-en { 522 | rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; 523 | }; 524 | 525 | vcc5v0_usb_hub_en: vcc5v0_usb_hub_en { 526 | rockchip,pins = <4 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; 527 | }; 528 | }; 529 | }; 530 | 531 | &saradc { 532 | vref-supply = <&avcc_1v8_s0>; 533 | status = "okay"; 534 | }; 535 | 536 | &sdhci { 537 | bus-width = <8>; 538 | max-frequency = <200000000>; 539 | mmc-hs400-1_8v; 540 | mmc-hs400-enhanced-strobe; 541 | no-sdio; 542 | no-sd; 543 | non-removable; 544 | status = "okay"; 545 | }; 546 | 547 | &sdmmc { 548 | max-frequency = <150000000>; 549 | no-sdio; 550 | no-mmc; 551 | bus-width = <4>; 552 | cap-mmc-highspeed; 553 | cap-sd-highspeed; 554 | disable-wp; 555 | sd-uhs-sdr104; 556 | cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; 557 | vmmc-supply = <&vcc_3v3_s3>; 558 | vqmmc-supply = <&vccio_sd_s0>; 559 | status = "okay"; 560 | }; 561 | 562 | &spi2 { 563 | status = "okay"; 564 | assigned-clocks = <&cru CLK_SPI2>; 565 | assigned-clock-rates = <200000000>; 566 | pinctrl-names = "default"; 567 | pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>; 568 | num-cs = <1>; 569 | 570 | pmic@0 { 571 | compatible = "rockchip,rk806"; 572 | spi-max-frequency = <1000000>; 573 | reg = <0x0>; 574 | 575 | interrupt-parent = <&gpio0>; 576 | interrupts = <7 IRQ_TYPE_LEVEL_LOW>; 577 | 578 | pinctrl-names = "default"; 579 | pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>, 580 | <&rk806_dvs2_null>, <&rk806_dvs3_null>; 581 | 582 | system-power-controller; 583 | 584 | vcc1-supply = <&vcc5v0_sys>; 585 | vcc2-supply = <&vcc5v0_sys>; 586 | vcc3-supply = <&vcc5v0_sys>; 587 | vcc4-supply = <&vcc5v0_sys>; 588 | vcc5-supply = <&vcc5v0_sys>; 589 | vcc6-supply = <&vcc5v0_sys>; 590 | vcc7-supply = <&vcc5v0_sys>; 591 | vcc8-supply = <&vcc5v0_sys>; 592 | vcc9-supply = <&vcc5v0_sys>; 593 | vcc10-supply = <&vcc5v0_sys>; 594 | vcc11-supply = <&vcc_2v0_pldo_s3>; 595 | vcc12-supply = <&vcc5v0_sys>; 596 | vcc13-supply = <&vcc_1v1_nldo_s3>; 597 | vcc14-supply = <&vcc_1v1_nldo_s3>; 598 | vcca-supply = <&vcc5v0_sys>; 599 | 600 | gpio-controller; 601 | #gpio-cells = <2>; 602 | 603 | rk806_dvs1_null: dvs1-null-pins { 604 | pins = "gpio_pwrctrl1"; 605 | function = "pin_fun0"; 606 | }; 607 | 608 | rk806_dvs2_null: dvs2-null-pins { 609 | pins = "gpio_pwrctrl2"; 610 | function = "pin_fun0"; 611 | }; 612 | 613 | rk806_dvs3_null: dvs3-null-pins { 614 | pins = "gpio_pwrctrl3"; 615 | function = "pin_fun0"; 616 | }; 617 | 618 | regulators { 619 | vdd_gpu_s0: vdd_gpu_mem_s0: dcdc-reg1 { 620 | regulator-always-on; 621 | regulator-boot-on; 622 | regulator-min-microvolt = <550000>; 623 | regulator-max-microvolt = <950000>; 624 | regulator-ramp-delay = <12500>; 625 | regulator-name = "vdd_gpu_s0"; 626 | regulator-enable-ramp-delay = <400>; 627 | 628 | regulator-state-mem { 629 | regulator-off-in-suspend; 630 | }; 631 | }; 632 | 633 | vdd_cpu_lit_s0: vdd_cpu_lit_mem_s0: dcdc-reg2 { 634 | regulator-always-on; 635 | regulator-boot-on; 636 | regulator-min-microvolt = <550000>; 637 | regulator-max-microvolt = <950000>; 638 | regulator-ramp-delay = <12500>; 639 | regulator-name = "vdd_cpu_lit_s0"; 640 | 641 | regulator-state-mem { 642 | regulator-off-in-suspend; 643 | }; 644 | }; 645 | 646 | vdd_log_s0: dcdc-reg3 { 647 | regulator-always-on; 648 | regulator-boot-on; 649 | regulator-min-microvolt = <675000>; 650 | regulator-max-microvolt = <750000>; 651 | regulator-ramp-delay = <12500>; 652 | regulator-name = "vdd_log_s0"; 653 | 654 | regulator-state-mem { 655 | regulator-off-in-suspend; 656 | regulator-suspend-microvolt = <750000>; 657 | }; 658 | }; 659 | 660 | vdd_vdenc_s0: vdd_vdenc_mem_s0: dcdc-reg4 { 661 | regulator-always-on; 662 | regulator-boot-on; 663 | regulator-min-microvolt = <550000>; 664 | regulator-max-microvolt = <950000>; 665 | regulator-ramp-delay = <12500>; 666 | regulator-name = "vdd_vdenc_s0"; 667 | 668 | regulator-state-mem { 669 | regulator-off-in-suspend; 670 | }; 671 | }; 672 | 673 | vdd_ddr_s0: dcdc-reg5 { 674 | regulator-always-on; 675 | regulator-boot-on; 676 | regulator-min-microvolt = <675000>; 677 | regulator-max-microvolt = <900000>; 678 | regulator-ramp-delay = <12500>; 679 | regulator-name = "vdd_ddr_s0"; 680 | 681 | regulator-state-mem { 682 | regulator-off-in-suspend; 683 | regulator-suspend-microvolt = <850000>; 684 | }; 685 | }; 686 | 687 | vdd2_ddr_s3: dcdc-reg6 { 688 | regulator-always-on; 689 | regulator-boot-on; 690 | regulator-name = "vdd2_ddr_s3"; 691 | 692 | regulator-state-mem { 693 | regulator-on-in-suspend; 694 | }; 695 | }; 696 | 697 | vcc_2v0_pldo_s3: dcdc-reg7 { 698 | regulator-always-on; 699 | regulator-boot-on; 700 | regulator-min-microvolt = <2000000>; 701 | regulator-max-microvolt = <2000000>; 702 | regulator-ramp-delay = <12500>; 703 | regulator-name = "vdd_2v0_pldo_s3"; 704 | 705 | regulator-state-mem { 706 | regulator-on-in-suspend; 707 | regulator-suspend-microvolt = <2000000>; 708 | }; 709 | }; 710 | 711 | vcc_3v3_s3: dcdc-reg8 { 712 | regulator-always-on; 713 | regulator-boot-on; 714 | regulator-min-microvolt = <3300000>; 715 | regulator-max-microvolt = <3300000>; 716 | regulator-name = "vcc_3v3_s3"; 717 | 718 | regulator-state-mem { 719 | regulator-on-in-suspend; 720 | regulator-suspend-microvolt = <3300000>; 721 | }; 722 | }; 723 | 724 | vddq_ddr_s0: dcdc-reg9 { 725 | regulator-always-on; 726 | regulator-boot-on; 727 | regulator-name = "vddq_ddr_s0"; 728 | 729 | regulator-state-mem { 730 | regulator-off-in-suspend; 731 | }; 732 | }; 733 | 734 | vcc_1v8_s3: dcdc-reg10 { 735 | regulator-always-on; 736 | regulator-boot-on; 737 | regulator-min-microvolt = <1800000>; 738 | regulator-max-microvolt = <1800000>; 739 | regulator-name = "vcc_1v8_s3"; 740 | 741 | regulator-state-mem { 742 | regulator-on-in-suspend; 743 | regulator-suspend-microvolt = <1800000>; 744 | }; 745 | }; 746 | 747 | avcc_1v8_s0: pldo-reg1 { 748 | regulator-always-on; 749 | regulator-boot-on; 750 | regulator-min-microvolt = <1800000>; 751 | regulator-max-microvolt = <1800000>; 752 | regulator-name = "avcc_1v8_s0"; 753 | 754 | regulator-state-mem { 755 | regulator-off-in-suspend; 756 | }; 757 | }; 758 | 759 | vcc_1v8_s0: pldo-reg2 { 760 | regulator-always-on; 761 | regulator-boot-on; 762 | regulator-min-microvolt = <1800000>; 763 | regulator-max-microvolt = <1800000>; 764 | regulator-name = "vcc_1v8_s0"; 765 | 766 | regulator-state-mem { 767 | regulator-off-in-suspend; 768 | regulator-suspend-microvolt = <1800000>; 769 | }; 770 | }; 771 | 772 | avdd_1v2_s0: pldo-reg3 { 773 | regulator-always-on; 774 | regulator-boot-on; 775 | regulator-min-microvolt = <1200000>; 776 | regulator-max-microvolt = <1200000>; 777 | regulator-name = "avdd_1v2_s0"; 778 | 779 | regulator-state-mem { 780 | regulator-off-in-suspend; 781 | }; 782 | }; 783 | 784 | vcc_3v3_s0: pldo-reg4 { 785 | regulator-always-on; 786 | regulator-boot-on; 787 | regulator-min-microvolt = <3300000>; 788 | regulator-max-microvolt = <3300000>; 789 | regulator-ramp-delay = <12500>; 790 | regulator-name = "vcc_3v3_s0"; 791 | 792 | regulator-state-mem { 793 | regulator-off-in-suspend; 794 | }; 795 | }; 796 | 797 | vccio_sd_s0: pldo-reg5 { 798 | regulator-always-on; 799 | regulator-boot-on; 800 | regulator-min-microvolt = <1800000>; 801 | regulator-max-microvolt = <3300000>; 802 | regulator-ramp-delay = <12500>; 803 | regulator-name = "vccio_sd_s0"; 804 | 805 | regulator-state-mem { 806 | regulator-off-in-suspend; 807 | }; 808 | }; 809 | 810 | pldo6_s3: pldo-reg6 { 811 | regulator-always-on; 812 | regulator-boot-on; 813 | regulator-min-microvolt = <1800000>; 814 | regulator-max-microvolt = <1800000>; 815 | regulator-name = "pldo6_s3"; 816 | 817 | regulator-state-mem { 818 | regulator-on-in-suspend; 819 | regulator-suspend-microvolt = <1800000>; 820 | }; 821 | }; 822 | 823 | vdd_0v75_s3: nldo-reg1 { 824 | regulator-always-on; 825 | regulator-boot-on; 826 | regulator-min-microvolt = <750000>; 827 | regulator-max-microvolt = <750000>; 828 | regulator-name = "vdd_0v75_s3"; 829 | 830 | regulator-state-mem { 831 | regulator-on-in-suspend; 832 | regulator-suspend-microvolt = <750000>; 833 | }; 834 | }; 835 | 836 | vdd_ddr_pll_s0: nldo-reg2 { 837 | regulator-always-on; 838 | regulator-boot-on; 839 | regulator-min-microvolt = <850000>; 840 | regulator-max-microvolt = <850000>; 841 | regulator-name = "vdd_ddr_pll_s0"; 842 | 843 | regulator-state-mem { 844 | regulator-off-in-suspend; 845 | regulator-suspend-microvolt = <850000>; 846 | }; 847 | }; 848 | 849 | avdd_0v75_s0: nldo-reg3 { 850 | regulator-always-on; 851 | regulator-boot-on; 852 | regulator-min-microvolt = <750000>; 853 | regulator-max-microvolt = <750000>; 854 | regulator-name = "avdd_0v75_s0"; 855 | 856 | regulator-state-mem { 857 | regulator-off-in-suspend; 858 | }; 859 | }; 860 | 861 | vdd_0v85_s0: nldo-reg4 { 862 | regulator-always-on; 863 | regulator-boot-on; 864 | regulator-min-microvolt = <850000>; 865 | regulator-max-microvolt = <850000>; 866 | regulator-name = "vdd_0v85_s0"; 867 | 868 | regulator-state-mem { 869 | regulator-off-in-suspend; 870 | }; 871 | }; 872 | 873 | vdd_0v75_s0: nldo-reg5 { 874 | regulator-always-on; 875 | regulator-boot-on; 876 | regulator-min-microvolt = <750000>; 877 | regulator-max-microvolt = <750000>; 878 | regulator-name = "vdd_0v75_s0"; 879 | 880 | regulator-state-mem { 881 | regulator-off-in-suspend; 882 | }; 883 | }; 884 | }; 885 | }; 886 | }; 887 | 888 | &tsadc { 889 | status = "okay"; 890 | }; 891 | 892 | &uart2 { 893 | pinctrl-names = "default"; 894 | pinctrl-0 = <&uart2m0_xfer>; 895 | status = "okay"; 896 | }; 897 | 898 | &uart3 { 899 | status = "okay"; 900 | }; 901 | 902 | &uart4 { 903 | pinctrl-0 = <&uart4m0_xfer>; 904 | status = "okay"; 905 | }; 906 | 907 | &u2phy1 { 908 | status = "okay"; 909 | }; 910 | 911 | &u2phy1_otg { 912 | phy-supply = <&vcc5v0_host>; 913 | status = "okay"; 914 | }; 915 | 916 | &u2phy2 { 917 | status = "okay"; 918 | }; 919 | 920 | &u2phy2_host { 921 | /* connected to USB hub, which is powered by vcc5v0_sys */ 922 | phy-supply = <&vcc5v0_sys>; 923 | status = "okay"; 924 | }; 925 | 926 | &u2phy3 { 927 | status = "okay"; 928 | }; 929 | 930 | &u2phy3_host { 931 | phy-supply = <&vcc5v0_host>; 932 | status = "okay"; 933 | }; 934 | 935 | &usbdp_phy1 { 936 | status = "okay"; 937 | }; 938 | 939 | &usb_host0_ehci { 940 | status = "okay"; 941 | }; 942 | 943 | &usb_host0_ohci { 944 | status = "okay"; 945 | }; 946 | 947 | &usb_host1_ehci { 948 | status = "okay"; 949 | }; 950 | 951 | &usb_host1_ohci { 952 | status = "okay"; 953 | }; 954 | 955 | &usb_host1_xhci { 956 | dr_mode = "host"; 957 | status = "okay"; 958 | }; 959 | 960 | &usb_host2_xhci { 961 | status = "okay"; 962 | }; 963 | 964 | &vop { 965 | status = "okay"; 966 | }; 967 | 968 | &vop_mmu { 969 | status = "okay"; 970 | }; 971 | 972 | &vp0 { 973 | vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { 974 | reg = ; 975 | remote-endpoint = <&hdmi0_in_vp0>; 976 | }; 977 | }; 978 | 979 | &vp1 { 980 | vp1_out_hdmi1: endpoint@ROCKCHIP_VOP2_EP_HDMI1 { 981 | reg = ; 982 | remote-endpoint = <&hdmi1_in_vp1>; 983 | }; 984 | }; 985 | -------------------------------------------------------------------------------- /dts/vendor/overlay/h88k-enable-hdmiphy.dts: -------------------------------------------------------------------------------- 1 | /dts-v1/; 2 | /plugin/; 3 | 4 | / { 5 | 6 | compatible = "hinlink,h88k"; 7 | 8 | fragment@0 { 9 | target = <&display_subsystem>; 10 | 11 | __overlay__ { 12 | clocks = <&hdptxphy_hdmi0>, <&hdptxphy_hdmi1>; 13 | clock-names = "hdmi0_phy_pll", "hdmi1_phy_pll"; 14 | }; 15 | }; 16 | }; 17 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "colmena": { 4 | "inputs": { 5 | "flake-compat": "flake-compat", 6 | "flake-utils": "flake-utils", 7 | "nix-github-actions": "nix-github-actions", 8 | "nixpkgs": [ 9 | "nixpkgs" 10 | ], 11 | "stable": "stable" 12 | }, 13 | "locked": { 14 | "lastModified": 1746816769, 15 | "narHash": "sha256-ymQzXrfHVT8/RJiGbfrNjEeuzXQan46lUJdxEhgivdM=", 16 | "owner": "zhaofengli", 17 | "repo": "colmena", 18 | "rev": "df694ee23be7ed7b2d8b42c245a640f0724eb06c", 19 | "type": "github" 20 | }, 21 | "original": { 22 | "owner": "zhaofengli", 23 | "repo": "colmena", 24 | "type": "github" 25 | } 26 | }, 27 | "disko": { 28 | "inputs": { 29 | "nixpkgs": [ 30 | "nixpkgs" 31 | ] 32 | }, 33 | "locked": { 34 | "lastModified": 1747742835, 35 | "narHash": "sha256-kYL4GCwwznsypvsnA20oyvW8zB/Dvn6K5G/tgMjVMT4=", 36 | "owner": "nix-community", 37 | "repo": "disko", 38 | "rev": "df522e787fdffc4f32ed3e1fca9ed0968a384d62", 39 | "type": "github" 40 | }, 41 | "original": { 42 | "owner": "nix-community", 43 | "repo": "disko", 44 | "type": "github" 45 | } 46 | }, 47 | "flake-compat": { 48 | "flake": false, 49 | "locked": { 50 | "lastModified": 1650374568, 51 | "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", 52 | "owner": "edolstra", 53 | "repo": "flake-compat", 54 | "rev": "b4a34015c698c7793d592d66adbab377907a2be8", 55 | "type": "github" 56 | }, 57 | "original": { 58 | "owner": "edolstra", 59 | "repo": "flake-compat", 60 | "type": "github" 61 | } 62 | }, 63 | "flake-parts": { 64 | "inputs": { 65 | "nixpkgs-lib": [ 66 | "nixpkgs" 67 | ] 68 | }, 69 | "locked": { 70 | "lastModified": 1743550720, 71 | "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", 72 | "owner": "hercules-ci", 73 | "repo": "flake-parts", 74 | "rev": "c621e8422220273271f52058f618c94e405bb0f5", 75 | "type": "github" 76 | }, 77 | "original": { 78 | "owner": "hercules-ci", 79 | "repo": "flake-parts", 80 | "type": "github" 81 | } 82 | }, 83 | "flake-utils": { 84 | "locked": { 85 | "lastModified": 1659877975, 86 | "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", 87 | "owner": "numtide", 88 | "repo": "flake-utils", 89 | "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", 90 | "type": "github" 91 | }, 92 | "original": { 93 | "owner": "numtide", 94 | "repo": "flake-utils", 95 | "type": "github" 96 | } 97 | }, 98 | "nix-github-actions": { 99 | "inputs": { 100 | "nixpkgs": [ 101 | "colmena", 102 | "nixpkgs" 103 | ] 104 | }, 105 | "locked": { 106 | "lastModified": 1729742964, 107 | "narHash": "sha256-B4mzTcQ0FZHdpeWcpDYPERtyjJd/NIuaQ9+BV1h+MpA=", 108 | "owner": "nix-community", 109 | "repo": "nix-github-actions", 110 | "rev": "e04df33f62cdcf93d73e9a04142464753a16db67", 111 | "type": "github" 112 | }, 113 | "original": { 114 | "owner": "nix-community", 115 | "repo": "nix-github-actions", 116 | "type": "github" 117 | } 118 | }, 119 | "nixpkgs": { 120 | "locked": { 121 | "lastModified": 1747953325, 122 | "narHash": "sha256-y2ZtlIlNTuVJUZCqzZAhIw5rrKP4DOSklev6c8PyCkQ=", 123 | "owner": "NixOS", 124 | "repo": "nixpkgs", 125 | "rev": "55d1f923c480dadce40f5231feb472e81b0bab48", 126 | "type": "github" 127 | }, 128 | "original": { 129 | "owner": "NixOS", 130 | "ref": "nixos-25.05", 131 | "repo": "nixpkgs", 132 | "type": "github" 133 | } 134 | }, 135 | "root": { 136 | "inputs": { 137 | "colmena": "colmena", 138 | "disko": "disko", 139 | "flake-parts": "flake-parts", 140 | "nixpkgs": "nixpkgs" 141 | } 142 | }, 143 | "stable": { 144 | "locked": { 145 | "lastModified": 1746557022, 146 | "narHash": "sha256-QkNoyEf6TbaTW5UZYX0OkwIJ/ZMeKSSoOMnSDPQuol0=", 147 | "owner": "NixOS", 148 | "repo": "nixpkgs", 149 | "rev": "1d3aeb5a193b9ff13f63f4d9cc169fb88129f860", 150 | "type": "github" 151 | }, 152 | "original": { 153 | "owner": "NixOS", 154 | "ref": "nixos-24.11", 155 | "repo": "nixpkgs", 156 | "type": "github" 157 | } 158 | } 159 | }, 160 | "root": "root", 161 | "version": 7 162 | } 163 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | nixConfig = { 3 | extra-substituters = [ 4 | "https://cache.qbisi.cc" 5 | ]; 6 | extra-trusted-public-keys = [ 7 | "cache.qbisi.cc-1:xEChzP5k8fj+7wajY+e9IDORRTGMhViP5NaqMShGGjQ=" 8 | ]; 9 | }; 10 | 11 | inputs = { 12 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; 13 | flake-parts = { 14 | url = "github:hercules-ci/flake-parts"; 15 | inputs.nixpkgs-lib.follows = "nixpkgs"; 16 | }; 17 | disko = { 18 | url = "github:nix-community/disko"; 19 | inputs.nixpkgs.follows = "nixpkgs"; 20 | }; 21 | colmena = { 22 | url = "github:zhaofengli/colmena"; 23 | inputs.nixpkgs.follows = "nixpkgs"; 24 | }; 25 | }; 26 | 27 | outputs = 28 | inputs: 29 | inputs.flake-parts.lib.mkFlake { inherit inputs; } ( 30 | { 31 | lib, 32 | self, 33 | withSystem, 34 | getSystemIgnoreWarning, 35 | ... 36 | }: 37 | { 38 | systems = [ 39 | "i686-linux" 40 | "x86_64-linux" 41 | "aarch64-linux" 42 | ]; 43 | imports = [ 44 | ./devices 45 | ./hosts 46 | ./modules 47 | ]; 48 | 49 | flake = { 50 | overlays.default = final: prev: self.packages."${prev.stdenv.hostPlatform.system}"; 51 | 52 | templates = { 53 | default = { 54 | path = ./templates; 55 | description = "init template"; 56 | }; 57 | }; 58 | }; 59 | 60 | perSystem = 61 | { 62 | config, 63 | pkgs, 64 | lib, 65 | system, 66 | self', 67 | ... 68 | }: 69 | { 70 | _module.args = { 71 | pkgs = import inputs.nixpkgs { 72 | inherit system; 73 | config = { 74 | allowUnfree = true; 75 | }; 76 | }; 77 | }; 78 | 79 | formatter = pkgs.nixfmt-rfc-style; 80 | 81 | legacyPackages = lib.makeScope pkgs.newScope ( 82 | self: 83 | (lib.packagesFromDirectoryRecursive { 84 | inherit (self) callPackage; 85 | directory = ./pkgs; 86 | }) 87 | // (import ./overlays.nix self pkgs) 88 | ); 89 | 90 | packages = lib.packagesFromDirectoryRecursive { 91 | inherit (self'.legacyPackages) callPackage; 92 | directory = ./pkgs; 93 | }; 94 | 95 | hydraJobs = { 96 | packages = lib.optionalAttrs (system == "aarch64-linux") config.packages; 97 | }; 98 | }; 99 | 100 | transposition.hydraJobs.adHoc = true; 101 | } 102 | ); 103 | } 104 | -------------------------------------------------------------------------------- /hosts/by-name/azure-b1s.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | self, 6 | inputs, 7 | ... 8 | }: 9 | { 10 | deployment = { 11 | buildOnTarget = true; 12 | tags = [ "vps" ]; 13 | }; 14 | 15 | imports = [ 16 | "${self}/devices/by-name/nixos-x86_64-uefi.nix" 17 | ]; 18 | 19 | boot.initrd.availableKernelModules = [ "sd_mod" ]; 20 | 21 | virtualisation.hypervGuest.enable = true; 22 | 23 | networking.hostName = "azure-b1s"; 24 | 25 | swapDevices = [ 26 | { 27 | device = "/swap/swapfile"; 28 | size = 1024; 29 | } 30 | ]; 31 | 32 | system.stateVersion = "24.11"; 33 | } 34 | -------------------------------------------------------------------------------- /hosts/by-name/h88k.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | self, 6 | inputs, 7 | ... 8 | }: 9 | { 10 | deployment = { 11 | targetHost = config.networking.hostName; 12 | buildOnTarget = false; 13 | tags = [ "rk3588" ]; 14 | }; 15 | 16 | imports = [ 17 | "${self}/devices/by-name/nixos-hinlink-h88k.nix" 18 | "${self}/modules/config/desktop.nix" 19 | ]; 20 | 21 | users.users.nixos = { 22 | password = "nixos"; 23 | # use mkpasswd to generate hashedPassword 24 | # hashedPassword = "$y$j9T$20Q2FTEqEYm1hzP10L1UA.$HLsxMJKmYnIHM2kGVJrLHh0dCtMz.TSVlWb0S2Ja29C"; 25 | isNormalUser = true; 26 | extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. 27 | openssh.authorizedKeys.keys = [ ]; 28 | }; 29 | 30 | users.users.root = { 31 | password = "root"; 32 | openssh.authorizedKeys.keys = [ 33 | ]; 34 | }; 35 | 36 | services.openssh = { 37 | enable = true; 38 | }; 39 | 40 | environment.systemPackages = with pkgs; [ 41 | vim 42 | wget 43 | htop 44 | git 45 | neofetch 46 | ]; 47 | 48 | nix.settings = { 49 | experimental-features = [ 50 | "nix-command" 51 | "flakes" 52 | ]; 53 | trusted-users = [ "@wheel" ]; 54 | }; 55 | 56 | system.stateVersion = "24.11"; 57 | } 58 | -------------------------------------------------------------------------------- /hosts/by-name/nanopc-t6.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | self, 6 | inputs, 7 | ... 8 | }: 9 | { 10 | deployment = { 11 | targetHost = config.networking.hostName; 12 | buildOnTarget = false; 13 | tags = [ "rk3588" ]; 14 | }; 15 | 16 | imports = [ 17 | "${self}/devices/by-name/nixos-friendly-nanopc-t6.nix" 18 | "${self}/modules/config/desktop.nix" 19 | ]; 20 | 21 | users.users.nixos = { 22 | password = "nixos"; 23 | # use mkpasswd to generate hashedPassword 24 | # hashedPassword = "$y$j9T$20Q2FTEqEYm1hzP10L1UA.$HLsxMJKmYnIHM2kGVJrLHh0dCtMz.TSVlWb0S2Ja29C"; 25 | isNormalUser = true; 26 | extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. 27 | openssh.authorizedKeys.keys = [ ]; 28 | }; 29 | 30 | users.users.root = { 31 | password = "root"; 32 | openssh.authorizedKeys.keys = [ 33 | ]; 34 | }; 35 | 36 | services.openssh = { 37 | enable = true; 38 | }; 39 | 40 | environment.systemPackages = with pkgs; [ 41 | vim 42 | wget 43 | htop 44 | git 45 | neofetch 46 | ]; 47 | 48 | nix.settings = { 49 | experimental-features = [ 50 | "nix-command" 51 | "flakes" 52 | ]; 53 | trusted-users = [ "@wheel" ]; 54 | }; 55 | 56 | system.stateVersion = "24.11"; 57 | } 58 | -------------------------------------------------------------------------------- /hosts/by-name/opi5-plus.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | self, 6 | inputs, 7 | ... 8 | }: 9 | { 10 | deployment = { 11 | targetHost = config.networking.hostName; 12 | buildOnTarget = false; 13 | tags = [ "rk3588" ]; 14 | }; 15 | 16 | imports = [ 17 | "${self}/devices/by-name/nixos-xunlong-orangepi-5-plus.nix" 18 | "${self}/modules/config/desktop.nix" 19 | ]; 20 | 21 | users.users.nixos = { 22 | password = "nixos"; 23 | # use mkpasswd to generate hashedPassword 24 | # hashedPassword = "$y$j9T$20Q2FTEqEYm1hzP10L1UA.$HLsxMJKmYnIHM2kGVJrLHh0dCtMz.TSVlWb0S2Ja29C"; 25 | isNormalUser = true; 26 | extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. 27 | openssh.authorizedKeys.keys = [ ]; 28 | }; 29 | 30 | users.users.root = { 31 | password = "root"; 32 | openssh.authorizedKeys.keys = [ 33 | ]; 34 | }; 35 | 36 | services.openssh = { 37 | enable = true; 38 | }; 39 | 40 | environment.systemPackages = with pkgs; [ 41 | vim 42 | wget 43 | htop 44 | git 45 | neofetch 46 | ]; 47 | 48 | nix.settings = { 49 | experimental-features = [ 50 | "nix-command" 51 | "flakes" 52 | ]; 53 | trusted-users = [ "@wheel" ]; 54 | }; 55 | 56 | system.stateVersion = "24.11"; 57 | } 58 | -------------------------------------------------------------------------------- /hosts/by-name/opi5.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | self, 6 | inputs, 7 | ... 8 | }: 9 | { 10 | deployment = { 11 | targetHost = config.networking.hostName; 12 | buildOnTarget = false; 13 | tags = [ "rk3588" ]; 14 | }; 15 | 16 | imports = [ 17 | "${self}/devices/by-name/nixos-xunlong-orangepi-5.nix" 18 | "${self}/modules/config/desktop.nix" 19 | ]; 20 | 21 | users.users.nixos = { 22 | password = "nixos"; 23 | # use mkpasswd to generate hashedPassword 24 | # hashedPassword = "$y$j9T$20Q2FTEqEYm1hzP10L1UA.$HLsxMJKmYnIHM2kGVJrLHh0dCtMz.TSVlWb0S2Ja29C"; 25 | isNormalUser = true; 26 | extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. 27 | openssh.authorizedKeys.keys = [ ]; 28 | }; 29 | 30 | users.users.root = { 31 | password = "root"; 32 | openssh.authorizedKeys.keys = [ 33 | ]; 34 | }; 35 | 36 | services.openssh = { 37 | enable = true; 38 | }; 39 | 40 | environment.systemPackages = with pkgs; [ 41 | vim 42 | wget 43 | htop 44 | git 45 | neofetch 46 | ]; 47 | 48 | nix.settings = { 49 | experimental-features = [ 50 | "nix-command" 51 | "flakes" 52 | ]; 53 | trusted-users = [ "@wheel" ]; 54 | }; 55 | 56 | system.stateVersion = "24.11"; 57 | } 58 | -------------------------------------------------------------------------------- /hosts/by-name/rb30.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | self, 6 | inputs, 7 | ... 8 | }: 9 | { 10 | deployment = { 11 | targetHost = config.networking.hostName; 12 | buildOnTarget = false; 13 | tags = [ "rk3399" ]; 14 | }; 15 | 16 | imports = [ 17 | "${self}/devices/by-name/nixos-cdhx-rb30.nix" 18 | "${self}/modules/config/desktop.nix" 19 | ]; 20 | 21 | users.users.nixos = { 22 | password = "nixos"; 23 | # use mkpasswd to generate hashedPassword 24 | # hashedPassword = "$y$j9T$20Q2FTEqEYm1hzP10L1UA.$HLsxMJKmYnIHM2kGVJrLHh0dCtMz.TSVlWb0S2Ja29C"; 25 | isNormalUser = true; 26 | extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. 27 | openssh.authorizedKeys.keys = [ ]; 28 | }; 29 | 30 | users.users.root = { 31 | password = "root"; 32 | openssh.authorizedKeys.keys = [ 33 | ]; 34 | }; 35 | 36 | services.openssh = { 37 | enable = true; 38 | }; 39 | 40 | environment.systemPackages = with pkgs; [ 41 | vim 42 | wget 43 | htop 44 | git 45 | neofetch 46 | ]; 47 | 48 | nix.settings = { 49 | experimental-features = [ 50 | "nix-command" 51 | "flakes" 52 | ]; 53 | trusted-users = [ "@wheel" ]; 54 | }; 55 | 56 | system.stateVersion = "24.11"; 57 | } 58 | -------------------------------------------------------------------------------- /hosts/by-name/rock-5a.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | self, 6 | inputs, 7 | ... 8 | }: 9 | { 10 | deployment = { 11 | targetHost = config.networking.hostName; 12 | buildOnTarget = false; 13 | tags = [ "rk3588" ]; 14 | }; 15 | 16 | imports = [ 17 | "${self}/devices/by-name/nixos-radxa-rock-5a.nix" 18 | "${self}/modules/config/desktop.nix" 19 | ]; 20 | 21 | users.users.nixos = { 22 | password = "nixos"; 23 | # use mkpasswd to generate hashedPassword 24 | # hashedPassword = "$y$j9T$20Q2FTEqEYm1hzP10L1UA.$HLsxMJKmYnIHM2kGVJrLHh0dCtMz.TSVlWb0S2Ja29C"; 25 | isNormalUser = true; 26 | extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. 27 | openssh.authorizedKeys.keys = [ ]; 28 | }; 29 | 30 | users.users.root = { 31 | password = "root"; 32 | openssh.authorizedKeys.keys = [ 33 | ]; 34 | }; 35 | 36 | services.openssh = { 37 | enable = true; 38 | }; 39 | 40 | environment.systemPackages = with pkgs; [ 41 | vim 42 | wget 43 | htop 44 | git 45 | neofetch 46 | ]; 47 | 48 | nix.settings = { 49 | experimental-features = [ 50 | "nix-command" 51 | "flakes" 52 | ]; 53 | trusted-users = [ "@wheel" ]; 54 | }; 55 | 56 | system.stateVersion = "24.11"; 57 | } 58 | -------------------------------------------------------------------------------- /hosts/by-name/rock-5b.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | self, 6 | inputs, 7 | ... 8 | }: 9 | { 10 | deployment = { 11 | targetHost = config.networking.hostName; 12 | buildOnTarget = false; 13 | tags = [ "rk3588" ]; 14 | }; 15 | 16 | imports = [ 17 | "${self}/devices/by-name/nixos-radxa-rock-5b.nix" 18 | "${self}/modules/config/desktop.nix" 19 | ]; 20 | 21 | users.users.nixos = { 22 | password = "nixos"; 23 | # use mkpasswd to generate hashedPassword 24 | # hashedPassword = "$y$j9T$20Q2FTEqEYm1hzP10L1UA.$HLsxMJKmYnIHM2kGVJrLHh0dCtMz.TSVlWb0S2Ja29C"; 25 | isNormalUser = true; 26 | extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. 27 | openssh.authorizedKeys.keys = [ ]; 28 | }; 29 | 30 | users.users.root = { 31 | password = "root"; 32 | openssh.authorizedKeys.keys = [ 33 | ]; 34 | }; 35 | 36 | services.openssh = { 37 | enable = true; 38 | }; 39 | 40 | environment.systemPackages = with pkgs; [ 41 | vim 42 | wget 43 | htop 44 | git 45 | neofetch 46 | ]; 47 | 48 | nix.settings = { 49 | experimental-features = [ 50 | "nix-command" 51 | "flakes" 52 | ]; 53 | trusted-users = [ "@wheel" ]; 54 | }; 55 | 56 | system.stateVersion = "24.11"; 57 | } 58 | -------------------------------------------------------------------------------- /hosts/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | inputs, 4 | self, 5 | ... 6 | }: 7 | { 8 | flake = { 9 | nixosConfigurations = lib.packagesFromDirectoryRecursive { 10 | callPackage = 11 | path: _: 12 | lib.nixosSystem { 13 | specialArgs = { 14 | inherit inputs self; 15 | }; 16 | modules = [ 17 | { 18 | disko.bootImage.imageName = lib.removeSuffix ".nix" (baseNameOf path); 19 | } 20 | path 21 | self.nixosModules.default 22 | inputs.colmena.nixosModules.deploymentOptions 23 | ]; 24 | }; 25 | directory = ./by-name; 26 | }; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /hosts/readme.md: -------------------------------------------------------------------------------- 1 | # Rebuild or Deploy you own nixos configuration 2 | 3 | This document is for people unfamiliar with nix/nixpkgs/nixos and want to set their own configuration of nixos on sbc, pc or vps. 4 | 5 | ## Through nixos-rebuild 6 | 7 | This flake souce is by default rsynced to /etc/nixos, thus one can rebuild their system immediately in bootstrap images. 8 | The main example configuration file is `/etc/nixos/hosts//`. 9 | One can change the default nixos user name and passwd to their own preference. 10 | 11 | ``` 12 | nixos-rebuild switch 13 | ``` 14 | 15 | ## Use this repo as your nixos-config center 16 | 17 | It is recommended to clone this repository to your home directory. And you can change your configuration via 18 | ``` 19 | nixos-rebuild switch --flake ~/nixos-images 20 | ``` 21 | 22 | Alternatively, you can intergrate this repo into your own nixos-configuration. -------------------------------------------------------------------------------- /modules/config/desktop.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | hardware = { 4 | graphics.enable = true; 5 | bluetooth.enable = true; 6 | }; 7 | 8 | services.desktopManager.plasma6.enable = true; 9 | services.displayManager.sddm = { 10 | enable = true; 11 | wayland.enable = true; 12 | }; 13 | 14 | systemd.sleep.extraConfig = '' 15 | # disable hibernation 16 | # doc : https://archived.forum.manjaro.org/t/turn-off-disable-hibernate-completely/139939 17 | AllowHibernation=no 18 | AllowHybridSleep=no 19 | AllowSuspendThenHibernate=no 20 | ''; 21 | services.logind.extraConfig = '' 22 | HibernateKeyIgnoreInhibited=no 23 | ''; 24 | 25 | fonts.packages = with pkgs; [ 26 | noto-fonts 27 | # noto-fonts-cjk-sans 28 | # noto-fonts-cjk-serif 29 | source-han-sans 30 | source-han-serif 31 | # sarasa-gothic 32 | source-code-pro 33 | hack-font 34 | jetbrains-mono 35 | ]; 36 | 37 | fonts.fontconfig = { 38 | defaultFonts = { 39 | emoji = [ "Noto Color Emoji" ]; 40 | monospace = [ 41 | "Noto Sans Mono CJK SC" 42 | "Sarasa Mono SC" 43 | "DejaVu Sans Mono" 44 | ]; 45 | sansSerif = [ 46 | "Noto Sans CJK SC" 47 | "Source Han Sans SC" 48 | "DejaVu Sans" 49 | ]; 50 | serif = [ 51 | "Noto Serif CJK SC" 52 | "Source Han Serif SC" 53 | "DejaVu Serif" 54 | ]; 55 | }; 56 | }; 57 | 58 | i18n.supportedLocales = [ 59 | "en_US.UTF-8/UTF-8" 60 | "zh_CN.UTF-8/UTF-8" 61 | ]; 62 | 63 | i18n.inputMethod = { 64 | enable = true; 65 | type = "fcitx5"; 66 | fcitx5.addons = with pkgs; [ 67 | fcitx5-rime 68 | ]; 69 | }; 70 | } 71 | -------------------------------------------------------------------------------- /modules/config/networking.nix: -------------------------------------------------------------------------------- 1 | { 2 | networking = { 3 | firewall.enable = false; 4 | useDHCP = false; 5 | useNetworkd = true; 6 | }; 7 | 8 | systemd.network.networks."eth" = { 9 | matchConfig.Name = "eth*"; 10 | networkConfig = { 11 | DHCP = "yes"; 12 | }; 13 | linkConfig.RequiredForOnline = "no"; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /modules/config/nixpkgs.nix: -------------------------------------------------------------------------------- 1 | { self, inputs, ... }: 2 | { 3 | nixpkgs.overlays = [ 4 | (self.overlays.default or (final: prev: { })) 5 | (inputs.nixos-images.overlays.default or (final: prev: { })) 6 | ]; 7 | } 8 | -------------------------------------------------------------------------------- /modules/config/passless.nix: -------------------------------------------------------------------------------- 1 | { 2 | 3 | users.users.root = { 4 | hashedPassword = ""; 5 | }; 6 | 7 | services = { 8 | openssh = { 9 | enable = true; 10 | settings = { 11 | PermitRootLogin = "yes"; 12 | PermitEmptyPasswords = "yes"; 13 | }; 14 | }; 15 | }; 16 | 17 | security.pam.services.sshd.allowNullPassword = true; 18 | } 19 | -------------------------------------------------------------------------------- /modules/config/rsync-nixosconfig.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | self, 5 | ... 6 | }: 7 | { 8 | systemd.services.rsync-nixosconfigurations = { 9 | description = "Rsync this flake source to /etc/nixos"; 10 | 11 | enable = lib.mkDefault true; 12 | wantedBy = [ "multi-user.target" ]; 13 | serviceConfig = { 14 | Type = "oneshot"; 15 | RemainAfterExit = true; 16 | }; 17 | path = with pkgs; [ rsync ]; 18 | script = '' 19 | rsync -a --delete --chmod=D770,F660 "${self}/" /etc/nixos 20 | ''; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /modules/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | ... 4 | }: 5 | { 6 | flake = { 7 | nixosModules = { 8 | default = { 9 | disabledModules = [ 10 | "system/boot/loader/grub/grub.nix" 11 | "hardware/device-tree.nix" 12 | ]; 13 | 14 | imports = [ 15 | ./config/nixpkgs.nix 16 | ./disko/disk-image.nix 17 | ./hardware/serial.nix 18 | ./overlay/system/boot/loader/grub.nix 19 | ./overlay/hardware/device-tree.nix 20 | inputs.disko.nixosModules.default 21 | ]; 22 | }; 23 | bootstrap = 24 | { 25 | config, 26 | pkgs, 27 | modulesPath, 28 | ... 29 | }: 30 | { 31 | imports = [ 32 | "${modulesPath}/profiles/all-hardware.nix" 33 | ./config/networking.nix 34 | ./config/passless.nix 35 | ./config/rsync-nixosconfig.nix 36 | ./system/grow-partition.nix 37 | ]; 38 | 39 | boot.loader.grub.btrfsPackage = config.disko.imageBuilder.pkgs.btrfs-progs; 40 | 41 | boot.initrd.availableKernelModules = [ 42 | "mpt3sas" 43 | "hv_storvsc" 44 | ]; 45 | 46 | environment.systemPackages = with pkgs; [ 47 | vim 48 | grub2_efi 49 | ]; 50 | 51 | nix.settings = { 52 | experimental-features = [ 53 | "nix-command" 54 | "flakes" 55 | ]; 56 | }; 57 | 58 | system.stateVersion = config.system.nixos.release; 59 | }; 60 | }; 61 | }; 62 | } 63 | -------------------------------------------------------------------------------- /modules/disko/btrfs.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | { 3 | config = lib.mkIf (config.disko.enableConfig && config.disko.bootImage.fileSystem == "btrfs") { 4 | disko.bootImage._extraPartition = { 5 | nix = { 6 | size = "100%"; 7 | content = { 8 | type = "btrfs"; 9 | extraArgs = [ "-f" ]; 10 | subvolumes = { 11 | "/" = { 12 | mountOptions = [ "noatime" ]; 13 | mountpoint = "/.btrfs_root"; 14 | }; 15 | "/@" = { 16 | mountOptions = [ 17 | "compress=zstd" 18 | "noatime" 19 | ]; 20 | mountpoint = "/"; 21 | }; 22 | "/@var" = { 23 | mountOptions = [ 24 | "compress=zstd" 25 | "noatime" 26 | ]; 27 | mountpoint = "/var"; 28 | }; 29 | "/@home" = { 30 | mountOptions = [ 31 | "compress=zstd" 32 | "noatime" 33 | ]; 34 | mountpoint = "/home"; 35 | }; 36 | "/@swap" = { 37 | mountpoint = "/swap"; 38 | }; 39 | }; 40 | }; 41 | }; 42 | }; 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /modules/disko/disk-image.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | config, 4 | pkgs, 5 | inputs, 6 | ... 7 | }: 8 | let 9 | cfg = config.disko.bootImage; 10 | in 11 | { 12 | imports = [ 13 | ./ext4.nix 14 | ./btrfs.nix 15 | ./uboot.nix 16 | ]; 17 | 18 | options = { 19 | disko.bootImage = { 20 | fileSystem = lib.mkOption { 21 | type = lib.types.nullOr ( 22 | lib.types.enum [ 23 | "ext4" 24 | "btrfs" 25 | ] 26 | ); 27 | default = null; 28 | description = "disko preset bootImage to use"; 29 | }; 30 | 31 | enableBiosBoot = lib.mkEnableOption "biosboot partition in gpt disk"; 32 | 33 | imageSize = lib.mkOption { 34 | type = lib.types.strMatching "[0-9]+[KMGTP]?"; 35 | description = '' 36 | size of the image when disko images are created 37 | is used as an argument to "qemu-img create ..." 38 | ''; 39 | default = "2G"; 40 | }; 41 | 42 | imageName = lib.mkOption { 43 | type = lib.types.str; 44 | description = "name for the disk images"; 45 | default = "nixos-${config.nixpkgs.system}-${cfg.fileSystem}-${cfg.partLabel}"; 46 | }; 47 | 48 | partLabel = lib.mkOption { 49 | type = lib.types.str; 50 | default = "main"; 51 | example = "nvme"; 52 | description = '' 53 | Disko use partlabel to identify and mount disk, use different partlabel 54 | for different media. 55 | ''; 56 | }; 57 | 58 | type = lib.mkOption { 59 | type = lib.types.str; 60 | default = "gpt"; 61 | description = '' 62 | disk partition type. 63 | ''; 64 | }; 65 | 66 | espStart = lib.mkOption { 67 | type = lib.types.nullOr (lib.types.strMatching "[0-9]+[KMGTP]?"); 68 | default = null; 69 | example = "16M"; 70 | description = "esp partition start size"; 71 | }; 72 | 73 | espSize = lib.mkOption { 74 | type = lib.types.strMatching "[0-9]+[KMGTP]?"; 75 | default = "4M"; 76 | description = "esp partition size"; 77 | }; 78 | 79 | _extraPartition = lib.mkOption { 80 | type = lib.types.nullOr lib.types.attrs; 81 | internal = true; 82 | default = null; 83 | }; 84 | }; 85 | }; 86 | 87 | config = lib.mkIf (config.disko.enableConfig && cfg.fileSystem != null) { 88 | assertions = [ 89 | { 90 | assertion = cfg.enableBiosBoot -> cfg.type == "gpt"; 91 | message = "biosboot partition requires gpt disk type."; 92 | } 93 | ]; 94 | 95 | disko = { 96 | memSize = lib.mkDefault 4096; 97 | 98 | imageBuilder = rec { 99 | enableBinfmt = true; 100 | pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; 101 | kernelPackages = inputs.nixpkgs.legacyPackages.x86_64-linux.linuxPackages; 102 | extraPostVM = lib.mkAfter '' 103 | ${pkgs.xz}/bin/xz -z $out/*${config.disko.imageBuilder.imageFormat} 104 | ''; 105 | }; 106 | 107 | bootImage.partLabel = lib.mkIf (builtins.getEnv "PARTLABEL" != "") ( 108 | lib.mkForce (builtins.getEnv "PARTLABEL") 109 | ); 110 | 111 | devices = { 112 | disk.main = { 113 | name = cfg.partLabel; 114 | imageName = cfg.imageName; 115 | imageSize = cfg.imageSize; 116 | device = 117 | let 118 | device = config.boot.loader.grub.device; 119 | in 120 | if (device != "nodev") then device else "/dev/disk/by-diskseq/1"; 121 | type = "disk"; 122 | content = { 123 | type = cfg.type; 124 | partitions = lib.mkMerge [ 125 | (lib.mkIf cfg.enableBiosBoot { 126 | boot = { 127 | size = "1M"; 128 | type = "EF02"; 129 | priority = 0; 130 | }; 131 | }) 132 | 133 | (lib.mkIf (cfg.type == "gpt") { 134 | ESP = { 135 | start = lib.mkIf (cfg.espStart != null) cfg.espStart; 136 | size = cfg.espSize; 137 | type = "EF00"; 138 | priority = 1; 139 | content = { 140 | type = "filesystem"; 141 | format = "vfat"; 142 | mountpoint = "/boot/efi"; 143 | mountOptions = [ 144 | "fmask=0077" 145 | "dmask=0077" 146 | ]; 147 | }; 148 | }; 149 | }) 150 | 151 | (lib.mkIf (cfg._extraPartition != null) cfg._extraPartition) 152 | ]; 153 | }; 154 | }; 155 | }; 156 | }; 157 | }; 158 | } 159 | -------------------------------------------------------------------------------- /modules/disko/ext4.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | { 3 | config = lib.mkIf (config.disko.enableConfig && config.disko.bootImage.fileSystem == "ext4") { 4 | disko.bootImage._extraPartition = { 5 | nix = { 6 | size = "100%"; 7 | content = { 8 | type = "filesystem"; 9 | format = "ext4"; 10 | mountpoint = "/"; 11 | }; 12 | }; 13 | }; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /modules/disko/uboot.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | let 8 | cfg = config.disko.bootImage; 9 | in 10 | { 11 | options = { 12 | disko.bootImage.uboot = { 13 | enable = lib.mkEnableOption "uboot part in disk"; 14 | 15 | package = lib.mkOption { 16 | type = lib.types.nullOr lib.types.package; 17 | default = null; 18 | }; 19 | }; 20 | }; 21 | 22 | config = lib.mkIf (cfg.fileSystem != null && cfg.uboot.enable) { 23 | assertions = [ 24 | { 25 | assertion = cfg.uboot.package != null; 26 | message = "disko.bootImage.uboot.pacakges should not be null"; 27 | } 28 | ]; 29 | 30 | disko.imageBuilder.extraPostVM = 31 | let 32 | diskoCfg = config.disko; 33 | imageName = "${diskoCfg.devices.disk.main.imageName}.${diskoCfg.imageBuilder.imageFormat}"; 34 | in 35 | lib.mkBefore '' 36 | ${pkgs.coreutils}/bin/dd of=$out/${imageName} if=${cfg.uboot.package}/u-boot-rockchip.bin bs=4K seek=8 conv=notrunc 37 | ''; 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /modules/hardware/serial.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | with lib; 3 | let 4 | cfg = config.hardware.serial; 5 | in 6 | { 7 | options = { 8 | hardware.serial = { 9 | enable = mkEnableOption "enable serial output"; 10 | 11 | unit = mkOption { 12 | default = 0; 13 | example = 2; 14 | type = types.int; 15 | }; 16 | 17 | baudrate = mkOption { 18 | default = 115200; 19 | example = 1500000; 20 | type = types.int; 21 | }; 22 | 23 | word = mkOption { 24 | default = 8; 25 | type = types.int; 26 | }; 27 | 28 | parity = mkOption { 29 | default = "no"; 30 | type = types.enum [ 31 | "no" 32 | "odd" 33 | "even" 34 | ]; 35 | }; 36 | 37 | stop = mkOption { 38 | default = 1; 39 | type = types.int; 40 | }; 41 | }; 42 | }; 43 | 44 | config = mkMerge [ 45 | { 46 | boot.loader = mkDefault { 47 | efi.efiSysMountPoint = "/boot/efi"; 48 | grub = { 49 | device = "nodev"; 50 | efiSupport = true; 51 | efiInstallAsRemovable = true; 52 | }; 53 | }; 54 | } 55 | 56 | (mkIf cfg.enable { 57 | boot.loader.grub.extraConfig = '' 58 | serial --unit=${toString cfg.unit} --speed=${toString cfg.baudrate} --word=${toString cfg.word} --parity=${cfg.parity} --stop=${toString cfg.stop} 59 | terminal_input --append serial 60 | terminal_output --append serial 61 | ''; 62 | 63 | boot.kernelParams = (mkBefore [ "console=ttyS${toString cfg.unit},${toString cfg.baudrate}" ]); 64 | }) 65 | ]; 66 | } 67 | -------------------------------------------------------------------------------- /modules/overlay/hardware/device-tree.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | let 8 | cfg = config.hardware.deviceTree; 9 | 10 | overlayType = lib.types.submodule { 11 | options = { 12 | name = lib.mkOption { 13 | type = lib.types.str; 14 | description = '' 15 | Name of this overlay 16 | ''; 17 | }; 18 | 19 | filter = lib.mkOption { 20 | type = lib.types.nullOr lib.types.str; 21 | default = null; 22 | example = "*rpi*.dtb"; 23 | description = '' 24 | Only apply to .dtb files matching glob expression. 25 | ''; 26 | }; 27 | 28 | dtsFile = lib.mkOption { 29 | type = lib.types.nullOr lib.types.path; 30 | description = '' 31 | Path to .dts overlay file, overlay is applied to 32 | each .dtb file matching "compatible" of the overlay. 33 | ''; 34 | default = null; 35 | example = lib.literalExpression "./dts/overlays.dts"; 36 | }; 37 | 38 | dtsText = lib.mkOption { 39 | type = lib.types.nullOr lib.types.str; 40 | default = null; 41 | description = '' 42 | Literal DTS contents, overlay is applied to 43 | each .dtb file matching "compatible" of the overlay. 44 | ''; 45 | example = '' 46 | /dts-v1/; 47 | /plugin/; 48 | / { 49 | compatible = "raspberrypi"; 50 | }; 51 | &{/soc} { 52 | pps { 53 | compatible = "pps-gpio"; 54 | status = "okay"; 55 | }; 56 | }; 57 | ''; 58 | }; 59 | 60 | dtboFile = lib.mkOption { 61 | type = lib.types.nullOr lib.types.path; 62 | default = null; 63 | description = '' 64 | Path to .dtbo compiled overlay file. 65 | ''; 66 | }; 67 | }; 68 | }; 69 | 70 | filteredKernelSource = lib.overrideDerivation (pkgs.srcOnly cfg.kernelPackage) (oldAttrs: { 71 | installPhase = '' 72 | mkdir -p $out 73 | rsync -avL scripts/dtc/include-prefixes/ $out \ 74 | --include="${pkgs.stdenv.hostPlatform.linuxArch}/**" \ 75 | --include="dt-bindings/**" \ 76 | --exclude="*/**" 77 | ''; 78 | }); 79 | 80 | dtbFile = 81 | if (cfg.dtbFile != null) then 82 | cfg.dtbFile 83 | else if (cfg.dtsFile != null) then 84 | let 85 | includePaths = 86 | cfg.dtbBuildExtraIncludePaths 87 | ++ [ "${filteredKernelSource}" ] 88 | ++ lib.optional ( 89 | cfg.platform != null 90 | ) "${filteredKernelSource}/${pkgs.stdenv.hostPlatform.linuxArch}/${cfg.platform}"; 91 | extraPreprocessorFlags = cfg.dtbBuildExtraPreprocessorFlags; 92 | in 93 | pkgs.deviceTree.compileDTS { 94 | name = "${cfg.name}.dtb"; 95 | inherit (cfg) dtsFile; 96 | inherit includePaths extraPreprocessorFlags; 97 | } 98 | else 99 | null; 100 | 101 | dtbSource = 102 | if (dtbFile == null) then 103 | cfg.dtbSource 104 | else 105 | pkgs.runCommand "single-dtb" { } '' 106 | install -D ${dtbFile} $out/${cfg.name} 107 | ''; 108 | 109 | filterDTBs = 110 | src: 111 | if cfg.filter == null then 112 | src 113 | else 114 | pkgs.runCommand "dtbs-filtered" { } '' 115 | mkdir -p $out 116 | cd ${src} 117 | find . -type f -name '${cfg.filter}' -print0 \ 118 | | xargs -0 cp -v --no-preserve=mode --target-directory $out --parents 119 | ''; 120 | 121 | filteredDTBs = filterDTBs dtbSource; 122 | 123 | # Fill in `dtboFile` for each overlay if not set already. 124 | # Existence of one of these is guarded by assertion below 125 | withDTBOs = 126 | xs: 127 | lib.flip map xs ( 128 | o: 129 | o 130 | // { 131 | dtboFile = 132 | let 133 | includePaths = [ "${filteredKernelSource}" ] ++ cfg.dtboBuildExtraIncludePaths; 134 | extraPreprocessorFlags = cfg.dtboBuildExtraPreprocessorFlags; 135 | in 136 | if o.dtboFile == null then 137 | let 138 | dtsFile = if o.dtsFile == null then (pkgs.writeText "dts" o.dtsText) else o.dtsFile; 139 | in 140 | pkgs.deviceTree.compileDTS { 141 | name = "${o.name}-dtbo"; 142 | inherit includePaths extraPreprocessorFlags dtsFile; 143 | } 144 | else 145 | o.dtboFile; 146 | } 147 | ); 148 | 149 | in 150 | { 151 | imports = [ 152 | (lib.mkRemovedOptionModule [ 153 | "hardware" 154 | "deviceTree" 155 | "base" 156 | ] "Use hardware.deviceTree.kernelPackage instead") 157 | ]; 158 | 159 | options = { 160 | hardware.deviceTree = { 161 | enable = lib.mkOption { 162 | default = pkgs.stdenv.hostPlatform.linux-kernel.DTB or false; 163 | type = lib.types.bool; 164 | description = '' 165 | Build device tree files. These are used to describe the 166 | non-discoverable hardware of a system. 167 | ''; 168 | }; 169 | 170 | kernelPackage = lib.mkOption { 171 | default = config.boot.kernelPackages.kernel; 172 | defaultText = lib.literalExpression "config.boot.kernelPackages.kernel"; 173 | example = lib.literalExpression "pkgs.linux_latest"; 174 | type = lib.types.path; 175 | description = '' 176 | Kernel package where device tree include directory is from. Also used as default source of dtb package to apply overlays to 177 | ''; 178 | }; 179 | 180 | dtbBuildExtraPreprocessorFlags = lib.mkOption { 181 | default = [ ]; 182 | example = lib.literalExpression "[ \"-DMY_DTB_DEFINE\" ]"; 183 | type = lib.types.listOf lib.types.str; 184 | description = '' 185 | Additional flags to pass to the preprocessor during dtb compilations. 186 | ''; 187 | }; 188 | 189 | dtbBuildExtraIncludePaths = lib.mkOption { 190 | default = [ ]; 191 | example = lib.literalExpression '' 192 | [ 193 | \${cfg.kernelPackage.src}/arch/arm64/boot/dts/rockchip 194 | ] 195 | ''; 196 | type = lib.types.listOf lib.types.path; 197 | description = '' 198 | Additional include paths that will be passed to the preprocessor when compiling the .dts into .dtb. 199 | ''; 200 | }; 201 | 202 | dtboBuildExtraPreprocessorFlags = lib.mkOption { 203 | default = [ ]; 204 | example = lib.literalExpression "[ \"-DMY_DTB_DEFINE\" ]"; 205 | type = lib.types.listOf lib.types.str; 206 | description = '' 207 | Additional flags to pass to the preprocessor during dtbo compilations 208 | ''; 209 | }; 210 | 211 | dtboBuildExtraIncludePaths = lib.mkOption { 212 | default = [ ]; 213 | example = lib.literalExpression '' 214 | [ 215 | ./my_custom_include_dir_1 216 | ./custom_include_dir_2 217 | ] 218 | ''; 219 | type = lib.types.listOf lib.types.path; 220 | description = '' 221 | Additional include paths that will be passed to the preprocessor when creating the final .dts to compile into .dtbo 222 | ''; 223 | }; 224 | 225 | dtbSource = lib.mkOption { 226 | default = "${cfg.kernelPackage}/dtbs"; 227 | defaultText = lib.literalExpression "\${cfg.kernelPackage}/dtbs"; 228 | type = lib.types.path; 229 | description = '' 230 | Path to dtb directory that overlays and other processing will be applied to. Uses 231 | device trees bundled with the Linux kernel by default. 232 | ''; 233 | }; 234 | 235 | name = lib.mkOption { 236 | default = null; 237 | example = "some-dtb.dtb"; 238 | type = lib.types.nullOr lib.types.str; 239 | description = '' 240 | The name of an explicit dtb to be loaded, relative to the dtb base. 241 | Useful in extlinux scenarios if the bootloader doesn't pick the 242 | right .dtb file from FDTDIR. 243 | ''; 244 | }; 245 | 246 | platform = lib.mkOption { 247 | type = lib.types.nullOr lib.types.str; 248 | default = null; 249 | description = lib.literalExpression '' 250 | Platform of this device. 251 | Path \${lib.getDev cfg.kernelPackage}/lib/modules/\${cfg.kernelPackage.modDirVersion}/source\ 252 | /arch/\${pkgs.stdenv.hostPlatform.linuxArch}/boot/dts/\${cfg.platform} will be appended to 253 | dtbBuildExtraIncludePaths. 254 | ''; 255 | }; 256 | 257 | dtsFile = lib.mkOption { 258 | type = lib.types.nullOr lib.types.path; 259 | description = '' 260 | Path to .dts file 261 | ''; 262 | default = null; 263 | example = lib.literalExpression "./dts/overlays.dts"; 264 | }; 265 | 266 | dtbFile = lib.mkOption { 267 | type = lib.types.nullOr lib.types.path; 268 | default = null; 269 | description = '' 270 | Path to .dtb compiled file 271 | ''; 272 | }; 273 | 274 | filter = lib.mkOption { 275 | type = lib.types.nullOr lib.types.str; 276 | default = null; 277 | example = "*rpi*.dtb"; 278 | description = '' 279 | Only include .dtb files matching glob expression. 280 | ''; 281 | }; 282 | 283 | overlays = lib.mkOption { 284 | default = [ ]; 285 | example = lib.literalExpression '' 286 | [ 287 | { name = "pps"; dtsFile = ./dts/pps.dts; } 288 | { name = "spi"; 289 | dtsText = "..."; 290 | } 291 | { name = "precompiled"; dtboFile = ./dtbos/example.dtbo; } 292 | ] 293 | ''; 294 | type = lib.types.listOf ( 295 | lib.types.coercedTo lib.types.path (path: { 296 | name = baseNameOf path; 297 | filter = null; 298 | dtboFile = path; 299 | }) overlayType 300 | ); 301 | description = '' 302 | List of overlays to apply to base device-tree (.dtb) files. 303 | ''; 304 | }; 305 | 306 | package = lib.mkOption { 307 | default = null; 308 | type = lib.types.nullOr lib.types.path; 309 | internal = true; 310 | description = '' 311 | A path containing the result of applying `overlays` to `kernelPackage`. 312 | ''; 313 | }; 314 | 315 | filteredKernelSource = lib.mkOption { 316 | default = null; 317 | type = lib.types.nullOr lib.types.package; 318 | internal = true; 319 | description = '' 320 | Filtered kernel source for compiling out-of-tree dtbs . 321 | ''; 322 | }; 323 | }; 324 | }; 325 | 326 | config = lib.mkIf (cfg.enable) { 327 | 328 | assertions = 329 | let 330 | invalidOverlay = o: (o.dtsFile == null) && (o.dtsText == null) && (o.dtboFile == null); 331 | in 332 | [ 333 | { 334 | assertion = lib.all (o: !invalidOverlay o) cfg.overlays; 335 | message = '' 336 | deviceTree overlay needs one of dtsFile, dtsText or dtboFile set. 337 | Offending overlay(s): 338 | ${toString (map (o: o.name) (builtins.filter invalidOverlay cfg.overlays))} 339 | ''; 340 | } 341 | { 342 | assertion = cfg.dtsFile != null -> (cfg.name != null); 343 | message = '' 344 | deviceTree.dtsFile need deviceTree.name set. 345 | ''; 346 | } 347 | { 348 | assertion = cfg.dtbFile != null -> (cfg.name != null); 349 | message = '' 350 | deviceTree.dtbFile need deviceTree.name set. 351 | ''; 352 | } 353 | ]; 354 | 355 | hardware.deviceTree.filteredKernelSource = filteredKernelSource; 356 | 357 | hardware.deviceTree.package = 358 | if (cfg.overlays != [ ]) then 359 | pkgs.deviceTree.applyOverlays filteredDTBs (withDTBOs cfg.overlays) 360 | else 361 | filteredDTBs; 362 | 363 | system.extraDependencies = lib.optional (cfg.filteredKernelSource != null) cfg.filteredKernelSource; 364 | }; 365 | } 366 | -------------------------------------------------------------------------------- /modules/system/grow-partition.nix: -------------------------------------------------------------------------------- 1 | # This module automatically grows the root partition. 2 | # This allows an instance to be created with a bigger root filesystem 3 | # than provided by the machine image. 4 | 5 | { 6 | config, 7 | lib, 8 | pkgs, 9 | ... 10 | }: 11 | 12 | with lib; 13 | 14 | { 15 | 16 | disabledModules = [ "system/boot/grow-partition.nix" ]; 17 | 18 | options = { 19 | boot.growPartition = { 20 | enable = mkOption { 21 | default = true; 22 | type = types.bool; 23 | description = '' 24 | growing the root partition on boot 25 | ''; 26 | }; 27 | mountPoint = mkOption { 28 | default = "/"; 29 | example = "/nix"; 30 | type = types.str; 31 | description = '' 32 | This is the main partition mount point. 33 | 34 | Used when building a stateless image. 35 | ''; 36 | }; 37 | }; 38 | }; 39 | 40 | config = 41 | let 42 | cfg = config.boot.growPartition; 43 | isBtrfs = config.fileSystems.${cfg.mountPoint}.fsType == "btrfs"; 44 | device = config.fileSystems.${cfg.mountPoint}.device; 45 | in 46 | mkIf cfg.enable { 47 | assertions = [ 48 | { 49 | assertion = !config.boot.initrd.systemd.repart.enable && !config.systemd.repart.enable; 50 | message = "systemd-repart already grows the root partition and thus you should not use boot.growPartition"; 51 | } 52 | ]; 53 | systemd.services.growpart = { 54 | enable = true; 55 | wantedBy = [ "-.mount" ]; 56 | after = [ "-.mount" ]; 57 | before = [ 58 | "systemd-growfs-root.service" 59 | "shutdown.target" 60 | "mkswap-.service" 61 | ]; 62 | conflicts = [ "shutdown.target" ]; 63 | unitConfig.DefaultDependencies = false; 64 | serviceConfig = { 65 | Type = "oneshot"; 66 | RemainAfterExit = true; 67 | TimeoutSec = "infinity"; 68 | # growpart returns 1 if the partition is already grown 69 | SuccessExitStatus = "0 1"; 70 | }; 71 | path = 72 | with pkgs; 73 | [ 74 | cloud-utils.guest 75 | ] 76 | ++ optional isBtrfs btrfs-progs; 77 | script = 78 | '' 79 | device="${device}" 80 | device="$(readlink -f "$device")" 81 | parentDevice="$device" 82 | while [ "''${parentDevice%[0-9]}" != "''${parentDevice}" ]; do 83 | parentDevice="''${parentDevice%[0-9]}"; 84 | done 85 | partNum="''${device#''${parentDevice}}" 86 | if [ "''${parentDevice%[0-9]p}" != "''${parentDevice}" ] && [ -b "''${parentDevice%p}" ]; then 87 | parentDevice="''${parentDevice%p}" 88 | fi 89 | growpart "$parentDevice" "$partNum" 90 | '' 91 | + optionalString isBtrfs '' 92 | btrfs filesystem resize max ${cfg.mountPoint} 93 | ''; 94 | }; 95 | }; 96 | } 97 | -------------------------------------------------------------------------------- /overlays.nix: -------------------------------------------------------------------------------- 1 | self: pkgs: { 2 | makePatch = 3 | { 4 | name ? "unnamed", 5 | src, 6 | patchCommands, 7 | }: 8 | pkgs.runCommand "${name}.patch" { inherit src; } '' 9 | unpackPhase 10 | 11 | orig=$sourceRoot 12 | new=$sourceRoot-modded 13 | cp -r $orig/. $new/ 14 | 15 | pushd $new >/dev/null 16 | ${patchCommands} 17 | popd >/dev/null 18 | 19 | diff -Naur $orig $new > $out || true 20 | ''; 21 | 22 | buildUBoot = 23 | { defconfig, ... }@args: 24 | (pkgs.buildUBoot args).overrideAttrs { 25 | configurePhase = '' 26 | runHook preConfigure 27 | 28 | cat $extraConfigPath >> configs/${defconfig} 29 | 30 | make ${defconfig} 31 | 32 | runHook postConfigure 33 | ''; 34 | }; 35 | 36 | buildLinux = 37 | let 38 | kernalArch = 39 | if pkgs.stdenv.hostPlatform.linuxArch == "x86_64" then 40 | "x86" 41 | else 42 | pkgs.stdenv.hostPlatform.linuxArch; 43 | in 44 | { 45 | defconfigFile ? null, 46 | ... 47 | }@args: 48 | (pkgs.buildLinux args).override (prev: { 49 | defconfig = if isNull defconfigFile then prev.defconfig or null else "fromfile_defconfig"; 50 | kernelPatches = 51 | prev.kernelPatches or [ ] 52 | ++ pkgs.lib.optional (!(isNull defconfigFile)) { 53 | name = "symlink-defconfigFile-to-kernel-defconfig"; 54 | patch = self.makePatch { 55 | src = pkgs.emptyDirectory; 56 | patchCommands = '' 57 | mkdir -p arch/${kernalArch}/configs 58 | ln -s ${defconfigFile} arch/${kernalArch}/configs/fromfile_defconfig 59 | ''; 60 | }; 61 | }; 62 | }); 63 | } 64 | -------------------------------------------------------------------------------- /patches/kernel/gobinet-for-longsung.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c 2 | index 68829a5a9..532da7c5e 100644 3 | --- a/drivers/net/usb/qmi_wwan.c 4 | +++ b/drivers/net/usb/qmi_wwan.c 5 | @@ -1429,6 +1429,7 @@ static const struct usb_device_id products[] = { 6 | {QMI_QUIRK_SET_DTR(0x1546, 0x1342, 4)}, /* u-blox LARA-L6 */ 7 | 8 | /* 4. Gobi 1000 devices */ 9 | + {QMI_GOBI1K_DEVICE(0x2df3, 0x5b01)}, /* Longsung EX510 Modem Device */ 10 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ 11 | {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ 12 | {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ 13 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c 14 | index 119641761..cb19a44d0 100644 15 | --- a/drivers/usb/serial/option.c 16 | +++ b/drivers/usb/serial/option.c 17 | @@ -75,6 +75,9 @@ static void option_instat_callback(struct urb *urb); 18 | #define OPTION_PRODUCT_ETNA_KOI_MODEM 0x7100 19 | #define OPTION_PRODUCT_GTM380_MODEM 0x7201 20 | 21 | +#define LONGSUNG_EX510_VID 0x2df3 22 | +#define LONGSUNG_EX510_PID 0x5b01 23 | + 24 | #define HUAWEI_VENDOR_ID 0x12D1 25 | #define HUAWEI_PRODUCT_E173 0x140C 26 | #define HUAWEI_PRODUCT_E1750 0x1406 27 | @@ -650,6 +653,8 @@ static const struct usb_device_id option_ids[] = { 28 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_EX) }, 29 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) }, 30 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GTM380_MODEM) }, 31 | + { USB_DEVICE(LONGSUNG_EX510_VID, LONGSUNG_EX510_PID), 32 | + .driver_info = RSVD(2)|RSVD(3)|RSVD(4)|RSVD(5)}, 33 | { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_Q101) }, 34 | { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_Q111) }, 35 | { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLX) }, 36 | -------------------------------------------------------------------------------- /patches/kernel/serial-option-for-fm350.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/usb/serial/option.c 2 | +++ b/drivers/usb/serial/option.c 3 | @@ -589,6 +589,7 @@ 4 | 5 | 6 | static const struct usb_device_id option_ids[] = { 7 | + { USB_DEVICE(MEDIATEK_VENDOR_ID, 0x7126) }, 8 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 9 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, 10 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) }, 11 | @@ -2210,6 +2211,15 @@ 12 | if (device_flags & NUMEP2 && iface_desc->bNumEndpoints != 2) 13 | return -ENODEV; 14 | 15 | + if(id->idVendor == MEDIATEK_VENDOR_ID && 16 | + (id->idProduct == cpu_to_le16(0x7126) && 17 | + ((serial->interface->cur_altsetting->desc.bInterfaceNumber <= 5) || 18 | + (serial->interface->cur_altsetting->desc.bInterfaceNumber >= 7)))) 19 | + { 20 | + printk(KERN_INFO "Discovery the interface for Fibocom & MEDIATEK."); 21 | + return -ENODEV; 22 | + } 23 | + 24 | /* Store the device flags so we can use them during attach. */ 25 | usb_set_serial_data(serial, (void *)device_flags); 26 | -------------------------------------------------------------------------------- /patches/u-boot/add-smbios-config.patch: -------------------------------------------------------------------------------- 1 | diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi 2 | index c8c928c7e5..ae466b100f 100644 3 | --- a/arch/arm/dts/rockchip-u-boot.dtsi 4 | +++ b/arch/arm/dts/rockchip-u-boot.dtsi 5 | @@ -9,6 +9,47 @@ 6 | binman: binman { 7 | multiple-images; 8 | }; 9 | + 10 | +#ifdef CONFIG_SYSINFO_SMBIOS 11 | + smbios{ 12 | + compatible = "u-boot,sysinfo-smbios"; 13 | + smbios { 14 | + system { 15 | +#ifdef CONFIG_SYSINFO_SMBIOS_MANUFACTURER 16 | + manufacturer = CONFIG_SYSINFO_SMBIOS_MANUFACTURER; 17 | +#endif 18 | +#ifdef CONFIG_SYSINFO_SMBIOS_PRODUCT 19 | + product = CONFIG_SYSINFO_SMBIOS_PRODUCT; 20 | +#endif 21 | +#ifdef CONFIG_SYSINFO_SMBIOS_VERSION 22 | + version = CONFIG_SYSINFO_SMBIOS_VERSION; 23 | +#endif 24 | +#ifdef CONFIG_SYSINFO_SMBIOS_FAMILY 25 | + family = CONFIG_SYSINFO_SMBIOS_FAMILY; 26 | +#endif 27 | + }; 28 | + 29 | + baseboard { 30 | +#ifdef CONFIG_SYSINFO_SMBIOS_MANUFACTURER 31 | + manufacturer = CONFIG_SYSINFO_SMBIOS_MANUFACTURER; 32 | +#endif 33 | +#ifdef CONFIG_SYSINFO_SMBIOS_PRODUCT 34 | + product = CONFIG_SYSINFO_SMBIOS_PRODUCT; 35 | +#endif 36 | + }; 37 | + 38 | + chassis { 39 | +#ifdef CONFIG_SYSINFO_SMBIOS_MANUFACTURER 40 | + manufacturer = CONFIG_SYSINFO_SMBIOS_MANUFACTURER; 41 | +#endif 42 | +#ifdef CONFIG_SYSINFO_SMBIOS_PRODUCT 43 | + product = CONFIG_SYSINFO_SMBIOS_PRODUCT; 44 | +#endif 45 | + }; 46 | + }; 47 | + }; 48 | +#endif 49 | + 50 | }; 51 | 52 | #ifdef CONFIG_SPL 53 | diff --git a/drivers/sysinfo/Kconfig b/drivers/sysinfo/Kconfig 54 | index 2030e4babc..04a07386b6 100644 55 | --- a/drivers/sysinfo/Kconfig 56 | +++ b/drivers/sysinfo/Kconfig 57 | @@ -52,4 +52,20 @@ config SYSINFO_GPIO 58 | This ternary number is then mapped to a board revision name using 59 | device tree properties. 60 | 61 | +config SYSINFO_SMBIOS_MANUFACTURER 62 | + depends on SYSINFO_SMBIOS 63 | + string "Smbios manufacturer" 64 | + 65 | +config SYSINFO_SMBIOS_PRODUCT 66 | + depends on SYSINFO_SMBIOS 67 | + string "Smbios product" 68 | + 69 | +config SYSINFO_SMBIOS_VERSION 70 | + depends on SYSINFO_SMBIOS 71 | + string "Smbios version" 72 | + 73 | +config SYSINFO_SMBIOS_FAMILY 74 | + depends on SYSINFO_SMBIOS 75 | + string "Smbios family" 76 | + 77 | endif 78 | -------------------------------------------------------------------------------- /pkgs/armbian-firmware.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenvNoCC, 3 | lib, 4 | fetchFromGitHub, 5 | filters ? [ "*" ], 6 | }: 7 | let 8 | installFilter = f: '' 9 | find . -type f -path './${f}' -exec cp --parents {} $out/lib/firmware \; 10 | ''; 11 | in 12 | stdenvNoCC.mkDerivation rec { 13 | pname = "armbian-firmware"; 14 | version = "unstable-2025-01-31"; 15 | 16 | src = fetchFromGitHub { 17 | owner = "armbian"; 18 | repo = "firmware"; 19 | rev = "e75d7b6e36696a7877111c02bd3497cbd2d5cb34"; 20 | hash = "sha256-VhcrMBFpq2TM/XeiG22K+ZrN97Lv7m36J9Y/0W4lHrM="; 21 | }; 22 | 23 | installPhase = 24 | '' 25 | mkdir -p $out/lib/firmware 26 | '' 27 | + lib.concatMapStringsSep "\n" installFilter filters; 28 | 29 | # Firmware blobs do not need fixing and should not be modified 30 | dontBuild = true; 31 | dontFixup = true; 32 | 33 | passthru = { 34 | compressFirmware = false; 35 | }; 36 | 37 | meta = with lib; { 38 | description = "Firmware from Armbian"; 39 | homepage = "https://github.com/armbian/firmware"; 40 | # license = licenses.unfree; 41 | platforms = platforms.all; 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /pkgs/armbianBuild.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub }: 2 | fetchFromGitHub { 3 | owner = "armbian"; 4 | repo = "build"; 5 | tag = "v25.5.1"; 6 | nonConeMode = true; 7 | sparseCheckout = [ 8 | "config/kernel/*.config" 9 | "patch/kernel/**/*.patch" 10 | ]; 11 | hash = "sha256-Xrd2PElurtTtSQ2WqI7GdW0oOs/ZrufHxgwYQ0fD91A="; 12 | } 13 | -------------------------------------------------------------------------------- /pkgs/brcmfmac-firmware.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenv, 3 | fetchurl, 4 | fetchFromGitHub, 5 | }: 6 | stdenv.mkDerivation rec { 7 | pname = "brcmfmac-firmware"; 8 | version = "unstable-2024-09-29"; 9 | 10 | src = fetchFromGitHub { 11 | owner = "qbisi"; 12 | repo = "brcmfmac_sdio-firmware"; 13 | rev = "240139ab39e3b13b2676a7b0aabbcd268b82b4ea"; 14 | sha256 = "sha256-cV5dR6bLU5pVvHGjdAQkanCH+TtwrgVv/PF8xMzUrqk="; 15 | }; 16 | 17 | installPhase = '' 18 | install -d $out/lib/firmware/brcm 19 | install -m 644 * $out/lib/firmware/brcm/ 20 | ''; 21 | 22 | # Firmware blobs do not need fixing and should not be modified 23 | dontBuild = true; 24 | dontFixup = true; 25 | 26 | passthru = { 27 | compressFirmware = false; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /pkgs/linux_phytium_6_6.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | buildLinux, 4 | fetchFromGitHub, 5 | ... 6 | }: 7 | let 8 | version = "6.6.0-phytium"; 9 | modDirVersion = "6.6.0"; 10 | src = fetchFromGitHub { 11 | githubBase = "gitee.com"; 12 | owner = "phytium_opensource"; 13 | repo = "linux"; 14 | rev = "Phytium-6.6.2"; 15 | forceFetchGit = true; 16 | hash = "sha256-gzm/lmqQdIiTkhtzbj6/tHg1I8PrY9RznUpTO8+l1dE="; 17 | }; 18 | structuredExtraConfig = with lib.kernel; { 19 | DRM_AST = yes; 20 | }; 21 | in 22 | buildLinux { 23 | inherit src modDirVersion version; 24 | inherit structuredExtraConfig; 25 | } 26 | -------------------------------------------------------------------------------- /pkgs/linux_rkbsp_6_1.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | buildLinux, 4 | fetchurl, 5 | fetchFromGitHub, 6 | armbianBuild, 7 | ... 8 | }: 9 | let 10 | version = "6.1.75-armbian"; 11 | modDirVersion = "6.1.75"; 12 | src = fetchFromGitHub { 13 | owner = "armbian"; 14 | repo = "linux-rockchip"; 15 | rev = "v24.11.1"; 16 | hash = "sha256-ZqEKQyFeE0UXN+tY8uAGrKgi9mXEp6s5WGyjVuxmuyM="; 17 | }; 18 | defconfigFile = "${armbianBuild}/config/kernel/linux-rk35xx-vendor.config"; 19 | in 20 | buildLinux { 21 | inherit 22 | src 23 | modDirVersion 24 | version 25 | defconfigFile 26 | ; 27 | enableCommonConfig = false; 28 | extraConfig = ""; 29 | ignoreConfigErrors = true; 30 | autoModules = false; 31 | extraMakeFlags = [ "KCFLAGS=-march=armv8-a+crypto" ]; 32 | } 33 | -------------------------------------------------------------------------------- /pkgs/linux_rockchip64_6_12.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | buildLinux, 4 | fetchFromGitHub, 5 | fetchurl, 6 | armbianBuild, 7 | linux_6_12, 8 | ... 9 | }: 10 | let 11 | defconfigFile = "${armbianBuild}/config/kernel/linux-rockchip64-edge.config"; 12 | patchDir = "${armbianBuild}/patch/kernel/archive/rockchip64-6.12"; 13 | kernelPatches = ( 14 | map (p: { 15 | name = baseNameOf p; 16 | patch = p; 17 | }) (lib.filesystem.listFilesRecursive patchDir) 18 | ); 19 | structuredExtraConfig = with lib.kernel; { 20 | # FW_LOADER 21 | FW_LOADER_COMPRESS = yes; 22 | FW_LOADER_COMPRESS_ZSTD = yes; 23 | # HDMI 24 | PHY_ROCKCHIP_SAMSUNG_HDPTX = yes; 25 | # NVME 26 | PHY_ROCKCHIP_SNPS_PCIE3 = yes; 27 | # MMC 28 | MMC_BLOCK = yes; 29 | # USB 30 | TYPEC = yes; 31 | PHY_ROCKCHIP_USBDP = yes; 32 | # MPTCP 33 | MPTCP = yes; 34 | INET_MPTCP_DIAG = module; 35 | }; 36 | in 37 | buildLinux { 38 | inherit (linux_6_12) 39 | version 40 | src 41 | ; 42 | inherit 43 | defconfigFile 44 | kernelPatches 45 | structuredExtraConfig 46 | ; 47 | enableCommonConfig = false; 48 | extraConfig = ""; 49 | ignoreConfigErrors = true; 50 | autoModules = false; 51 | extraMakeFlags = [ "KCFLAGS=-march=armv8-a+crypto" ]; 52 | } 53 | -------------------------------------------------------------------------------- /pkgs/linux_rockchip64_6_14.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | buildLinux, 4 | fetchFromGitHub, 5 | fetchurl, 6 | armbianBuild, 7 | linux_6_14, 8 | ... 9 | }: 10 | let 11 | defconfigFile = "${armbianBuild}/config/kernel/linux-rockchip64-edge.config"; 12 | patchDir = "${armbianBuild}/patch/kernel/archive/rockchip64-6.14"; 13 | kernelPatches = ( 14 | map (p: { 15 | name = baseNameOf p; 16 | patch = p; 17 | }) (lib.filesystem.listFilesRecursive patchDir) 18 | ); 19 | structuredExtraConfig = with lib.kernel; { 20 | # FW_LOADER 21 | FW_LOADER_COMPRESS = yes; 22 | FW_LOADER_COMPRESS_ZSTD = yes; 23 | # HDMI 24 | PHY_ROCKCHIP_SAMSUNG_HDPTX = yes; 25 | # NVME 26 | PHY_ROCKCHIP_SNPS_PCIE3 = yes; 27 | # MMC 28 | MMC_BLOCK = yes; 29 | # USB 30 | TYPEC = yes; 31 | PHY_ROCKCHIP_USBDP = yes; 32 | # MPTCP 33 | MPTCP = yes; 34 | INET_MPTCP_DIAG = module; 35 | }; 36 | in 37 | buildLinux { 38 | inherit (linux_6_14) 39 | version 40 | src 41 | ; 42 | inherit 43 | defconfigFile 44 | kernelPatches 45 | structuredExtraConfig 46 | ; 47 | enableCommonConfig = false; 48 | extraConfig = ""; 49 | ignoreConfigErrors = true; 50 | autoModules = false; 51 | extraMakeFlags = [ "KCFLAGS=-march=armv8-a+crypto" ]; 52 | } 53 | -------------------------------------------------------------------------------- /pkgs/ubootBozzSW799.nix: -------------------------------------------------------------------------------- 1 | { 2 | buildUBoot, 3 | makePatch, 4 | emptyDirectory, 5 | armTrustedFirmwareRK3399, 6 | rkbin, 7 | }: 8 | let 9 | dtsPatch = makePatch { 10 | src = emptyDirectory; 11 | patchCommands = '' 12 | mkdir -p arch/arm/dts 13 | install -m 644 -D ${../dts/mainline}/*u-boot.dtsi arch/arm/dts 14 | mkdir -p dts/upstream/src/arm64/rockchip 15 | install -m 644 -D ${../dts/mainline}/*.dts dts/upstream/src/arm64/rockchip 16 | ''; 17 | }; 18 | in 19 | buildUBoot rec { 20 | defconfig = "evb-rk3399_defconfig"; 21 | BL31 = "${armTrustedFirmwareRK3399}/bl31.elf"; 22 | ROCKCHIP_TPL = "${rkbin}/bin/rk33/rk3399_ddr_800MHz_v1.30.bin"; 23 | extraPatches = [ 24 | ../patches/u-boot/add-smbios-config.patch 25 | dtsPatch 26 | ]; 27 | filesToInstall = [ 28 | "u-boot.itb" 29 | "idbloader.img" 30 | "u-boot-rockchip.bin" 31 | ]; 32 | extraConfig = '' 33 | CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-bozz-sw799a-5g" 34 | CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-bozz-sw799a-5g.dtb" 35 | CONFIG_SYSINFO=y 36 | CONFIG_SYSINFO_SMBIOS=y 37 | CONFIG_SYSINFO_SMBIOS_MANUFACTURER="Bozz" 38 | CONFIG_SYSINFO_SMBIOS_PRODUCT="Bozz SW799A" 39 | CONFIG_SYSINFO_SMBIOS_VERSION="5G" 40 | CONFIG_SYSINFO_SMBIOS_FAMILY="Rockchip/RK3399" 41 | CONFIG_ROCKCHIP_EXTERNAL_TPL=y 42 | CONFIG_VIDEO=y 43 | CONFIG_DISPLAY=y 44 | CONFIG_VIDEO_ROCKCHIP=y 45 | CONFIG_DISPLAY_ROCKCHIP_HDMI=y 46 | CONFIG_BOOTSTD_FULL=y 47 | CONFIG_BOOTCOMMAND="bootmenu" 48 | CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE=y 49 | CONFIG_CMD_BOOTMENU=y 50 | CONFIG_CMD_EFICONFIG=y 51 | CONFIG_USE_PREBOOT=y 52 | CONFIG_PREBOOT="usb start;" 53 | CONFIG_PHY_ROCKCHIP_INNO_USB2=y 54 | CONFIG_PHY_ROCKCHIP_TYPEC=y 55 | CONFIG_PHY_ROCKCHIP_USBDP=y 56 | CONFIG_USB=y 57 | CONFIG_USB_XHCI_HCD=y 58 | CONFIG_USB_XHCI_DWC3=y 59 | CONFIG_USB_EHCI_HCD=y 60 | CONFIG_USB_EHCI_GENERIC=y 61 | CONFIG_USB_OHCI_HCD=y 62 | CONFIG_USB_OHCI_GENERIC=y 63 | CONFIG_USB_KEYBOARD=y 64 | CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y 65 | ''; 66 | } 67 | -------------------------------------------------------------------------------- /pkgs/ubootCdhxRb30.nix: -------------------------------------------------------------------------------- 1 | { 2 | buildUBoot, 3 | makePatch, 4 | emptyDirectory, 5 | armTrustedFirmwareRK3399, 6 | rkbin, 7 | }: 8 | let 9 | dtsPatch = makePatch { 10 | src = emptyDirectory; 11 | patchCommands = '' 12 | mkdir -p arch/arm/dts 13 | install -m 644 -D ${../dts/mainline}/*u-boot.dtsi arch/arm/dts 14 | mkdir -p dts/upstream/src/arm64/rockchip 15 | install -m 644 -D ${../dts/mainline}/*.dts dts/upstream/src/arm64/rockchip 16 | ''; 17 | }; 18 | in 19 | buildUBoot rec { 20 | defconfig = "evb-rk3399_defconfig"; 21 | BL31 = "${armTrustedFirmwareRK3399}/bl31.elf"; 22 | ROCKCHIP_TPL = "${rkbin}/bin/rk33/rk3399_ddr_800MHz_v1.30.bin"; 23 | extraPatches = [ 24 | ../patches/u-boot/add-smbios-config.patch 25 | dtsPatch 26 | ]; 27 | filesToInstall = [ 28 | "u-boot.itb" 29 | "idbloader.img" 30 | "u-boot-rockchip.bin" 31 | ]; 32 | extraConfig = '' 33 | CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-cdhx-rb30" 34 | CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-cdhx-rb30.dtb" 35 | CONFIG_SYSINFO=y 36 | CONFIG_SYSINFO_SMBIOS=y 37 | CONFIG_SYSINFO_SMBIOS_MANUFACTURER="Cdhx" 38 | CONFIG_SYSINFO_SMBIOS_PRODUCT="Cdhx Rb30" 39 | CONFIG_SYSINFO_SMBIOS_FAMILY="Rockchip/RK3399" 40 | CONFIG_ROCKCHIP_EXTERNAL_TPL=y 41 | CONFIG_VIDEO=y 42 | CONFIG_DISPLAY=y 43 | CONFIG_VIDEO_ROCKCHIP=y 44 | CONFIG_DISPLAY_ROCKCHIP_HDMI=y 45 | CONFIG_BOOTSTD_FULL=y 46 | CONFIG_BOOTCOMMAND="bootmenu" 47 | CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE=y 48 | CONFIG_CMD_BOOTMENU=y 49 | CONFIG_CMD_EFICONFIG=y 50 | CONFIG_USE_PREBOOT=y 51 | CONFIG_PREBOOT="usb start;" 52 | CONFIG_PHY_ROCKCHIP_INNO_USB2=y 53 | CONFIG_PHY_ROCKCHIP_TYPEC=y 54 | CONFIG_PHY_ROCKCHIP_USBDP=y 55 | CONFIG_USB=y 56 | CONFIG_USB_XHCI_HCD=y 57 | CONFIG_USB_XHCI_DWC3=y 58 | CONFIG_USB_EHCI_HCD=y 59 | CONFIG_USB_EHCI_GENERIC=y 60 | CONFIG_USB_OHCI_HCD=y 61 | CONFIG_USB_OHCI_GENERIC=y 62 | CONFIG_USB_KEYBOARD=y 63 | CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y 64 | ''; 65 | } 66 | -------------------------------------------------------------------------------- /pkgs/ubootHinlinkH88k.nix: -------------------------------------------------------------------------------- 1 | { 2 | buildUBoot, 3 | fetchFromGitHub, 4 | gcc12Stdenv, 5 | armTrustedFirmwareRK3588, 6 | rkbin, 7 | }: 8 | buildUBoot { 9 | src = fetchFromGitHub { 10 | owner = "qbisi"; 11 | repo = "u-boot"; 12 | rev = "drm-dirty"; 13 | sha256 = "sha256-c9Pq9gWGNQWibaDqXTFenD8Q3/G0DnYnUCvyNZNyKmw="; 14 | }; 15 | version = "2024.07"; 16 | defconfig = "hinlink-h88k-rk3588_defconfig"; 17 | stdenv = gcc12Stdenv; 18 | extraMeta.platforms = [ "aarch64-linux" ]; 19 | BL31 = "${armTrustedFirmwareRK3588}/bl31.elf"; 20 | ROCKCHIP_TPL = rkbin.TPL_RK3588; 21 | filesToInstall = [ 22 | "u-boot.itb" 23 | "idbloader.img" 24 | "u-boot-rockchip.bin" 25 | ]; 26 | } 27 | -------------------------------------------------------------------------------- /pkgs/ubootNanoPCT6.nix: -------------------------------------------------------------------------------- 1 | { 2 | buildUBoot, 3 | fetchFromGitHub, 4 | gcc12Stdenv, 5 | armTrustedFirmwareRK3588, 6 | rkbin, 7 | }: 8 | buildUBoot { 9 | src = fetchFromGitHub { 10 | owner = "qbisi"; 11 | repo = "u-boot"; 12 | rev = "drm-dirty"; 13 | sha256 = "sha256-c9Pq9gWGNQWibaDqXTFenD8Q3/G0DnYnUCvyNZNyKmw="; 14 | }; 15 | version = "2024.07"; 16 | defconfig = "nanopc-t6-rk3588_defconfig"; 17 | stdenv = gcc12Stdenv; 18 | extraMeta.platforms = [ "aarch64-linux" ]; 19 | BL31 = "${armTrustedFirmwareRK3588}/bl31.elf"; 20 | ROCKCHIP_TPL = rkbin.TPL_RK3588; 21 | filesToInstall = [ 22 | "u-boot.itb" 23 | "idbloader.img" 24 | "u-boot-rockchip.bin" 25 | "u-boot-rockchip-spi.bin" 26 | ]; 27 | } 28 | -------------------------------------------------------------------------------- /pkgs/ubootOrangePi5.nix: -------------------------------------------------------------------------------- 1 | { 2 | buildUBoot, 3 | fetchFromGitHub, 4 | gcc12Stdenv, 5 | armTrustedFirmwareRK3588, 6 | rkbin, 7 | }: 8 | buildUBoot { 9 | src = fetchFromGitHub { 10 | owner = "qbisi"; 11 | repo = "u-boot"; 12 | rev = "drm-dirty"; 13 | sha256 = "sha256-c9Pq9gWGNQWibaDqXTFenD8Q3/G0DnYnUCvyNZNyKmw="; 14 | }; 15 | version = "2024.07"; 16 | defconfig = "orangepi-5-rk3588s_defconfig"; 17 | stdenv = gcc12Stdenv; 18 | extraMeta.platforms = [ "aarch64-linux" ]; 19 | BL31 = "${armTrustedFirmwareRK3588}/bl31.elf"; 20 | ROCKCHIP_TPL = rkbin.TPL_RK3588; 21 | filesToInstall = [ 22 | "u-boot.itb" 23 | "idbloader.img" 24 | "u-boot-rockchip.bin" 25 | "u-boot-rockchip-spi.bin" 26 | ]; 27 | } 28 | -------------------------------------------------------------------------------- /pkgs/ubootOrangePi5Plus.nix: -------------------------------------------------------------------------------- 1 | { 2 | buildUBoot, 3 | fetchFromGitHub, 4 | gcc12Stdenv, 5 | armTrustedFirmwareRK3588, 6 | rkbin, 7 | }: 8 | buildUBoot { 9 | src = fetchFromGitHub { 10 | owner = "qbisi"; 11 | repo = "u-boot"; 12 | rev = "drm-dirty"; 13 | sha256 = "sha256-c9Pq9gWGNQWibaDqXTFenD8Q3/G0DnYnUCvyNZNyKmw="; 14 | }; 15 | version = "2024.07"; 16 | defconfig = "orangepi-5-plus-rk3588_defconfig"; 17 | stdenv = gcc12Stdenv; 18 | extraMeta.platforms = [ "aarch64-linux" ]; 19 | BL31 = "${armTrustedFirmwareRK3588}/bl31.elf"; 20 | ROCKCHIP_TPL = rkbin.TPL_RK3588; 21 | filesToInstall = [ 22 | "u-boot.itb" 23 | "idbloader.img" 24 | "u-boot-rockchip.bin" 25 | "u-boot-rockchip-spi.bin" 26 | ]; 27 | } 28 | -------------------------------------------------------------------------------- /pkgs/ubootRock5ModelA.nix: -------------------------------------------------------------------------------- 1 | { 2 | buildUBoot, 3 | fetchFromGitHub, 4 | gcc12Stdenv, 5 | armTrustedFirmwareRK3588, 6 | rkbin, 7 | }: 8 | buildUBoot { 9 | src = fetchFromGitHub { 10 | owner = "qbisi"; 11 | repo = "u-boot"; 12 | rev = "drm-dirty"; 13 | sha256 = "sha256-c9Pq9gWGNQWibaDqXTFenD8Q3/G0DnYnUCvyNZNyKmw="; 14 | }; 15 | version = "2024.07"; 16 | defconfig = "rock5a-rk3588s_defconfig"; 17 | stdenv = gcc12Stdenv; 18 | extraMeta.platforms = [ "aarch64-linux" ]; 19 | BL31 = "${armTrustedFirmwareRK3588}/bl31.elf"; 20 | ROCKCHIP_TPL = rkbin.TPL_RK3588; 21 | filesToInstall = [ 22 | "u-boot.itb" 23 | "idbloader.img" 24 | "u-boot-rockchip.bin" 25 | ]; 26 | } 27 | -------------------------------------------------------------------------------- /pkgs/ubootRock5ModelB.nix: -------------------------------------------------------------------------------- 1 | { 2 | buildUBoot, 3 | fetchFromGitHub, 4 | gcc12Stdenv, 5 | armTrustedFirmwareRK3588, 6 | rkbin, 7 | }: 8 | buildUBoot { 9 | src = fetchFromGitHub { 10 | owner = "qbisi"; 11 | repo = "u-boot"; 12 | rev = "drm-dirty"; 13 | sha256 = "sha256-c9Pq9gWGNQWibaDqXTFenD8Q3/G0DnYnUCvyNZNyKmw="; 14 | }; 15 | version = "2024.07"; 16 | defconfig = "rock5b-rk3588_defconfig"; 17 | stdenv = gcc12Stdenv; 18 | extraMeta.platforms = [ "aarch64-linux" ]; 19 | BL31 = "${armTrustedFirmwareRK3588}/bl31.elf"; 20 | ROCKCHIP_TPL = rkbin.TPL_RK3588; 21 | filesToInstall = [ 22 | "u-boot.itb" 23 | "idbloader.img" 24 | "u-boot-rockchip.bin" 25 | "u-boot-rockchip-spi.bin" 26 | ]; 27 | } 28 | -------------------------------------------------------------------------------- /templates/flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | nixConfig = { 3 | extra-substituters = [ 4 | "https://cache.qbisi.cc" 5 | ]; 6 | extra-trusted-public-keys = [ 7 | "cache.qbisi.cc-1:xEChzP5k8fj+7wajY+e9IDORRTGMhViP5NaqMShGGjQ=" 8 | ]; 9 | }; 10 | 11 | inputs = { 12 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 13 | nixos-images.url = "github:qbisi/nixos-images"; 14 | colmena = { 15 | url = "github:zhaofengli/colmena"; 16 | inputs.nixpkgs.follows = "nixpkgs"; 17 | }; 18 | }; 19 | 20 | outputs = 21 | { self, nixpkgs, ... }@inputs: 22 | { 23 | nixosConfigurations = { 24 | azure-b1s = nixpkgs.lib.nixosSystem { 25 | specialArgs = { 26 | inherit inputs self; 27 | }; 28 | modules = [ 29 | inputs.nixos-images.nixosModules.default 30 | inputs.colmena.nixosModules.deploymentOptions 31 | "${inputs.nixos-images}/devices/by-name/nixos-x86_64-uefi.nix" 32 | # ./path-to-your-custom-config 33 | ]; 34 | }; 35 | 36 | opi5-plus = nixpkgs.lib.nixosSystem { 37 | specialArgs = { 38 | inherit inputs self; 39 | }; 40 | modules = [ 41 | inputs.nixos-images.nixosModules.default 42 | inputs.colmena.nixosModules.deploymentOptions 43 | "${inputs.nixos-images}/devices/by-name/nixos-xunlong-orangepi-5-plus.nix" 44 | # ./path-to-your-custom-config 45 | ]; 46 | }; 47 | }; 48 | 49 | colmena = { 50 | meta = { 51 | nixpkgs = import inputs.nixpkgs { system = "x86_64-linux"; }; 52 | specialArgs = { 53 | inherit inputs self; 54 | }; 55 | }; 56 | 57 | azure-b1s = { 58 | imports = [ 59 | inputs.nixos-images.nixosModules.default 60 | "${inputs.nixos-images}/devices/by-name/nixos-x86_64-uefi.nix" 61 | # ./path-to-your-custom-config 62 | ]; 63 | }; 64 | 65 | opi5-plus = { 66 | imports = [ 67 | inputs.nixos-images.nixosModules.default 68 | "${inputs.nixos-images}/devices/by-name/nixos-xunlong-orangepi-5-plus.nix" 69 | # ./path-to-your-custom-config 70 | ]; 71 | }; 72 | }; 73 | }; 74 | } 75 | -------------------------------------------------------------------------------- /tools/rk3399_loader_v1.24.126.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qbisi/nixos-images/ba0af49cbf0946815334add867a6c5f12afea1ab/tools/rk3399_loader_v1.24.126.bin -------------------------------------------------------------------------------- /tools/rk3588_spl_loader_v1.08.111.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qbisi/nixos-images/ba0af49cbf0946815334add867a6c5f12afea1ab/tools/rk3588_spl_loader_v1.08.111.bin --------------------------------------------------------------------------------