Initial commit
This commit is contained in:
commit
278cc1ec1b
15
configuration.nix
Normal file
15
configuration.nix
Normal file
@ -0,0 +1,15 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
imports = [ ./helios64.nix /etc/nixos/defaults.nix ];
|
||||
nixpkgs.system = "aarch64-linux";
|
||||
networking = {
|
||||
hostName = "bold";
|
||||
hostId = "c7233a9f";
|
||||
};
|
||||
environment.systemPackages = [ pkgs.sysstat pkgs.cryptsetup ];
|
||||
fileSystems."/" = { device = lib.mkForce "/dev/disk/by-label/bold-emmc"; fsType = lib.mkForce "btrfs"; };
|
||||
programs.mosh.enable = true;
|
||||
boot.zfs.extraPools = ["bold"];
|
||||
boot.supportedFilesystems = ["zfs"];
|
||||
system.stateVersion = "20.09";
|
||||
}
|
82
emmc-image.nix
Normal file
82
emmc-image.nix
Normal file
@ -0,0 +1,82 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
<nixpkgs/nixos/modules/installer/cd-dvd/sd-image.nix>
|
||||
./configuration.nix
|
||||
];
|
||||
nixpkgs.overlays = [(import ./u-boot.nix)];
|
||||
|
||||
sdImage.populateRootCommands = ''
|
||||
mkdir -p ./files/boot
|
||||
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
|
||||
'';
|
||||
system.build.sdImage = with lib;
|
||||
let
|
||||
rootfsImage = pkgs.callPackage ./make-btrfs-fs.nix ({
|
||||
inherit (config.sdImage) storePaths;
|
||||
compressImage = true;
|
||||
populateImageCommands = config.sdImage.populateRootCommands;
|
||||
volumeLabel = "bold-emmc";
|
||||
} // optionalAttrs (config.sdImage.rootPartitionUUID != null) {
|
||||
uuid = config.sdImage.rootPartitionUUID;
|
||||
});
|
||||
in pkgs.callPackage ({ stdenv, dosfstools, e2fsprogs,
|
||||
mtools, libfaketime, utillinux, bzip2, zstd }: stdenv.mkDerivation {
|
||||
name = config.sdImage.imageName;
|
||||
|
||||
nativeBuildInputs = [ dosfstools e2fsprogs mtools libfaketime utillinux bzip2 zstd ];
|
||||
|
||||
inherit (config.sdImage) compressImage;
|
||||
|
||||
diskUUID = "A8ABB0FA-2FD7-4FB8-ABB0-2EEB7CD66AFA";
|
||||
loadUUID = "534078AF-3BB4-EC43-B6C7-828FB9A788C6";
|
||||
bootUUID = "95D89D52-CA00-42D6-883F-50F5720EF37E";
|
||||
rootUUID = "0340EA1D-C827-8048-B631-0C60D4478796";
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -p $out/nix-support $out/sd-image
|
||||
export img=$out/sd-image/${config.sdImage.imageName}
|
||||
echo "${pkgs.stdenv.buildPlatform.system}" > $out/nix-support/system
|
||||
if test -n "$compressImage"; then
|
||||
echo "file sd-image $img.bz2" >> $out/nix-support/hydra-build-products
|
||||
else
|
||||
echo "file sd-image $img" >> $out/nix-support/hydra-build-products
|
||||
fi
|
||||
echo "Decompressing rootfs image"
|
||||
zstd -d --no-progress "${rootfsImage}" -o ./root-fs.img
|
||||
|
||||
# Create the image file sized to fit /boot/firmware and /, plus slack for the gap.
|
||||
rootSizeBlocks=$(du -B 512 --apparent-size ./root-fs.img | awk '{ print $1 }')
|
||||
|
||||
# rootfs will be at offset 0x8000, so we'll need to account for that.
|
||||
# And add an additional 20mb slack at the end.
|
||||
imageSize=$((0x8000 + rootSizeBlocks * 512 + 20 * 1024 * 1024))
|
||||
truncate -s $imageSize $img
|
||||
|
||||
sfdisk --no-reread --no-tell-kernel $img <<EOF
|
||||
label: gpt
|
||||
label-id: $diskUUID
|
||||
first-lba: 64
|
||||
start=64, size=8000, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=$loadUUID, name=loader1
|
||||
start=16384, size=8192, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=$bootUUID, name=loader2
|
||||
start=32768, type=B921B045-1DF0-41C3-AF44-4C6F280D3FAE, uuid=$rootUUID, name=boot, attrs=LegacyBIOSBootable
|
||||
EOF
|
||||
|
||||
# Copy the rootfs into the SD image
|
||||
eval $(partx $img -o START,SECTORS --nr 3 --pairs)
|
||||
dd conv=notrunc if=./root-fs.img of=$img seek=$START count=$SECTORS
|
||||
|
||||
# Copy u-boot into the SD image
|
||||
eval $(partx $img -o START,SECTORS --nr 2 --pairs)
|
||||
dd conv=notrunc if=${pkgs.ubootHelios64}/u-boot.itb of=$img seek=$START count=$SECTORS
|
||||
|
||||
# Copy bootloader into the SD image
|
||||
eval $(partx $img -o START,SECTORS --nr 1 --pairs)
|
||||
dd conv=notrunc if=${pkgs.ubootHelios64}/idbloader.img of=$img seek=$START count=$SECTORS
|
||||
|
||||
if test -n "$compressImage"; then
|
||||
zstd -v --no-progress $img
|
||||
fi
|
||||
'';
|
||||
}) {};
|
||||
}
|
47
fancontrol.rs
Normal file
47
fancontrol.rs
Normal file
@ -0,0 +1,47 @@
|
||||
use std::cmp::{max, min};
|
||||
use std::path::PathBuf;
|
||||
use std::fs::{read_dir, read_to_string, write};
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
|
||||
const MINTEMP : i32 = 50000;
|
||||
const MAXTEMP : i32 = 80000;
|
||||
const MINSTART : i32 = 60;
|
||||
const MINSTOP : i32 = 29;
|
||||
const MAXPWM : i32 = 255;
|
||||
|
||||
|
||||
fn adjust(fan: &PathBuf, sensor: &PathBuf) {
|
||||
let temp: i32 = read_to_string(sensor).unwrap().trim().parse().unwrap();
|
||||
let prev_pwm: i32 = read_to_string(fan).unwrap().trim().parse().unwrap();
|
||||
|
||||
let mut pwm: i32 = 0;
|
||||
pwm = (temp - MINTEMP) * 255 / (MAXTEMP - MINTEMP);
|
||||
pwm = max(pwm, 0);
|
||||
if pwm > 0 {
|
||||
pwm = max(pwm, if prev_pwm < MINSTOP { MINSTART } else { MINSTOP });
|
||||
pwm = min(pwm, MAXPWM);
|
||||
}
|
||||
println!("sensor: {}, pwm: {}", temp, pwm);
|
||||
write(fan, pwm.to_string());
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut fans = Vec::new();
|
||||
for hwmon_dir in ["/sys/devices/platform/p6-fan/hwmon", "/sys/devices/platform/p7-fan/hwmon"].iter() {
|
||||
for dir in read_dir(hwmon_dir).unwrap() {
|
||||
let mut p = dir.unwrap().path();
|
||||
p.push("pwm1");
|
||||
if p.exists() {
|
||||
fans.push(p)
|
||||
}
|
||||
}
|
||||
}
|
||||
let fans = fans;
|
||||
loop {
|
||||
for fan in &fans {
|
||||
adjust(fan, &PathBuf::from("/sys/devices/virtual/thermal/thermal_zone0/hwmon0/temp1_input"))
|
||||
}
|
||||
sleep(Duration::from_secs(5));
|
||||
}
|
||||
}
|
41
helios64.nix
Normal file
41
helios64.nix
Normal file
@ -0,0 +1,41 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
crossPkgs = import pkgs.path { system = "x86_64-linux"; crossSystem = "aarch64-linux"; };
|
||||
in {
|
||||
# Fan speed adjustment
|
||||
systemd.services.fans = {
|
||||
wantedBy = ["multi-user.target"];
|
||||
serviceConfig.ExecStart = pkgs.runCommandCC "fans" { nativeBuildInputs = [ pkgs.rustc ]; } ''
|
||||
rustc ${./fancontrol.rs} -o $out
|
||||
'';
|
||||
serviceConfig.Restart = "always";
|
||||
};
|
||||
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./kernel.nix {});
|
||||
#kernelPackages = pkgs.linuxPackages_latest;
|
||||
kernelParams = ["panic=3" "boot.shell_on_fail"];
|
||||
loader.grub.enable = false;
|
||||
loader.generic-extlinux-compatible.enable = true;
|
||||
initrd.postDeviceCommands = ''
|
||||
(
|
||||
cd /sys/bus/platform/drivers/sdhci-arasan
|
||||
while true; do
|
||||
test -e fe330000.sdhci/mmc_host/mmc*/mmc*/block && break
|
||||
echo fe330000.sdhci > unbind
|
||||
echo fe330000.sdhci > bind
|
||||
sleep 1
|
||||
done
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.services.disable-offload = {
|
||||
wantedBy = ["sys-devices-platform-fe300000.ethernet-net-eth0.device" "multi-user.targtet"];
|
||||
after = ["sys-devices-platform-fe300000.ethernet-net-eth0.device"];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.ethtool}/bin/ethtool --offload eth0 tx off";
|
||||
};
|
||||
};
|
||||
}
|
4891
kernel.nix
Normal file
4891
kernel.nix
Normal file
File diff suppressed because it is too large
Load Diff
74
make-btrfs-fs.nix
Normal file
74
make-btrfs-fs.nix
Normal file
@ -0,0 +1,74 @@
|
||||
# Builds an ext4 image containing a populated /nix/store with the closure
|
||||
# of store paths passed in the storePaths parameter, in addition to the
|
||||
# contents of a directory that can be populated with commands. The
|
||||
# generated image is sized to only fit its contents, with the expectation
|
||||
# that a script resizes the filesystem at boot time.
|
||||
{ pkgs
|
||||
, lib
|
||||
# List of derivations to be included
|
||||
, storePaths
|
||||
# Whether or not to compress the resulting image with zstd
|
||||
, compressImage ? false, zstd
|
||||
# Shell commands to populate the ./files directory.
|
||||
# All files in that directory are copied to the root of the FS.
|
||||
, populateImageCommands ? ""
|
||||
, volumeLabel
|
||||
, uuid ? "44444444-4444-4444-8888-888888888888"
|
||||
, btrfs-progs
|
||||
, libfaketime
|
||||
, perl
|
||||
, fakeroot
|
||||
}:
|
||||
|
||||
let
|
||||
sdClosureInfo = pkgs.buildPackages.closureInfo { rootPaths = storePaths; };
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "btrfs-fs.img${lib.optionalString compressImage ".zst"}";
|
||||
|
||||
nativeBuildInputs = [ btrfs-progs libfaketime perl fakeroot ]
|
||||
++ lib.optional compressImage zstd;
|
||||
|
||||
buildCommand =
|
||||
''
|
||||
${if compressImage then "img=temp.img" else "img=$out"}
|
||||
(
|
||||
mkdir -p ./files
|
||||
${populateImageCommands}
|
||||
)
|
||||
|
||||
echo "Preparing store paths for image..."
|
||||
|
||||
# Create nix/store before copying path
|
||||
mkdir -p ./rootImage/nix/store
|
||||
|
||||
xargs -I % cp -a --reflink=auto % -t ./rootImage/nix/store/ < ${sdClosureInfo}/store-paths
|
||||
(
|
||||
GLOBIGNORE=".:.."
|
||||
shopt -u dotglob
|
||||
|
||||
for f in ./files/*; do
|
||||
cp -a --reflink=auto -t ./rootImage/ "$f"
|
||||
done
|
||||
)
|
||||
|
||||
# Also include a manifest of the closures in a format suitable for nix-store --load-db
|
||||
cp ${sdClosureInfo}/registration ./rootImage/nix-path-registration
|
||||
|
||||
# Make a crude approximation of the size of the target image.
|
||||
# If the script starts failing, increase the fudge factors here.
|
||||
numInodes=$(find ./rootImage | wc -l)
|
||||
numDataBlocks=$(du -s -c -B 4096 --apparent-size ./rootImage | tail -1 | awk '{ print int($1 * 1.10) }')
|
||||
bytes=$((2 * 4096 * $numInodes + 4096 * $numDataBlocks))
|
||||
echo "Creating a btrfs image of $bytes bytes (numInodes=$numInodes, numDataBlocks=$numDataBlocks)"
|
||||
|
||||
truncate -s $bytes $img
|
||||
|
||||
faketime -f "1970-01-01 00:00:01" fakeroot mkfs.btrfs -L ${volumeLabel} -U ${uuid} -r ./rootImage $img
|
||||
|
||||
if [ ${builtins.toString compressImage} ]; then
|
||||
echo "Compressing image"
|
||||
zstd -v --no-progress ./$img -o $out
|
||||
fi
|
||||
'';
|
||||
}
|
437
patches/kernel/09e006cfb43e8ec38afe28278b210dab72e6cac8.patch
Normal file
437
patches/kernel/09e006cfb43e8ec38afe28278b210dab72e6cac8.patch
Normal file
@ -0,0 +1,437 @@
|
||||
From 09e006cfb43e8ec38afe28278b210dab72e6cac8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <uwe@kleine-koenig.org>
|
||||
Date: Wed, 14 Oct 2020 22:00:30 +0200
|
||||
Subject: arm64: dts: rockchip: Add basic support for Kobol's Helios64
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The hardware is described in detail on Kobol's wiki at
|
||||
https://wiki.kobol.io/helios64/intro/.
|
||||
|
||||
Up to now the following peripherals are working:
|
||||
|
||||
- UART
|
||||
- Micro-SD card
|
||||
- eMMC
|
||||
- ethernet port 1
|
||||
- status LED
|
||||
- temperature sensor on i2c bus 2
|
||||
|
||||
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
|
||||
Link: https://lore.kernel.org/r/20201014200030.845759-3-uwe@kleine-koenig.org
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/Makefile | 1 +
|
||||
.../boot/dts/rockchip/rk3399-kobol-helios64.dts | 372 +++++++++++++++++++++
|
||||
2 files changed, 373 insertions(+)
|
||||
create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile
|
||||
index 26661c7b736b7..28b26a874313e 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/Makefile
|
||||
+++ b/arch/arm64/boot/dts/rockchip/Makefile
|
||||
@@ -26,6 +26,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-hugsun-x99.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-khadas-edge.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-khadas-edge-captain.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-khadas-edge-v.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-kobol-helios64.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-leez-p710.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopc-t4.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-m4.dtb
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
|
||||
new file mode 100644
|
||||
index 0000000000000..2a561be724b22
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
|
||||
@@ -0,0 +1,387 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2020 Aditya Prayoga <aditya@kobol.io>
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * The Kobol Helios64 is a board designed to operate as a NAS and optionally
|
||||
+ * ships with an enclosing that can host five 2.5" hard disks.
|
||||
+ *
|
||||
+ * See https://wiki.kobol.io/helios64/intro/ for further details.
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "rk3399.dtsi"
|
||||
+#include "rk3399-opp.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ model = "Kobol Helios64";
|
||||
+ compatible = "kobol,helios64", "rockchip,rk3399";
|
||||
+
|
||||
+ avdd_1v8_s0: avdd-1v8-s0 {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "avdd_1v8_s0";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ vin-supply = <&vcc3v3_sys_s3>;
|
||||
+ };
|
||||
+
|
||||
+ clkin_gmac: external-gmac-clock {
|
||||
+ compatible = "fixed-clock";
|
||||
+ clock-frequency = <125000000>;
|
||||
+ clock-output-names = "clkin_gmac";
|
||||
+ #clock-cells = <0>;
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&sys_grn_led_on &sys_red_led_on>;
|
||||
+
|
||||
+ led-0 {
|
||||
+ label = "helios64:green:status";
|
||||
+ gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>;
|
||||
+ default-state = "on";
|
||||
+ };
|
||||
+
|
||||
+ led-1 {
|
||||
+ label = "helios64:red:fault";
|
||||
+ gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
|
||||
+ default-state = "keep";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc1v8_sys_s0: vcc1v8-sys-s0 {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vcc1v8_sys_s0";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ vin-supply = <&vcc1v8_sys_s3>;
|
||||
+ };
|
||||
+
|
||||
+ vcc3v0_sd: vcc3v0-sd {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ enable-active-high;
|
||||
+ gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
|
||||
+ regulator-name = "vcc3v0_sd";
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <3000000>;
|
||||
+ regulator-max-microvolt = <3000000>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&sdmmc0_pwr_h>;
|
||||
+ vin-supply = <&vcc3v3_sys_s3>;
|
||||
+ };
|
||||
+
|
||||
+ vcc3v3_sys_s3: vcc_lan: vcc3v3-sys-s3 {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vcc3v3_sys_s3";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ vin-supply = <&vcc5v0_sys>;
|
||||
+
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc5v0_sys: vcc5v0-sys {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vcc5v0_sys";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ vin-supply = <&vcc12v_dcin_bkup>;
|
||||
+
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc12v_dcin: vcc12v-dcin {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vcc12v_dcin";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <12000000>;
|
||||
+ regulator-max-microvolt = <12000000>;
|
||||
+ };
|
||||
+
|
||||
+ vcc12v_dcin_bkup: vcc12v-dcin-bkup {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vcc12v_dcin_bkup";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <12000000>;
|
||||
+ regulator-max-microvolt = <12000000>;
|
||||
+ vin-supply = <&vcc12v_dcin>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * The system doesn't run stable with cpu freq enabled, so disallow the lower
|
||||
+ * frequencies until this problem is properly understood and resolved.
|
||||
+ */
|
||||
+&cluster0_opp {
|
||||
+ /delete-node/ opp00;
|
||||
+ /delete-node/ opp01;
|
||||
+ /delete-node/ opp02;
|
||||
+ /delete-node/ opp03;
|
||||
+ /delete-node/ opp04;
|
||||
+};
|
||||
+
|
||||
+&cluster1_opp {
|
||||
+ /delete-node/ opp00;
|
||||
+ /delete-node/ opp01;
|
||||
+ /delete-node/ opp02;
|
||||
+ /delete-node/ opp03;
|
||||
+ /delete-node/ opp04;
|
||||
+ /delete-node/ opp05;
|
||||
+ /delete-node/ opp06;
|
||||
+};
|
||||
+
|
||||
+&cpu_b0 {
|
||||
+ cpu-supply = <&vdd_cpu_b>;
|
||||
+};
|
||||
+
|
||||
+&cpu_b1 {
|
||||
+ cpu-supply = <&vdd_cpu_b>;
|
||||
+};
|
||||
+
|
||||
+&cpu_l0 {
|
||||
+ cpu-supply = <&vdd_cpu_l>;
|
||||
+};
|
||||
+
|
||||
+&cpu_l1 {
|
||||
+ cpu-supply = <&vdd_cpu_l>;
|
||||
+};
|
||||
+
|
||||
+&cpu_l2 {
|
||||
+ cpu-supply = <&vdd_cpu_l>;
|
||||
+};
|
||||
+
|
||||
+&cpu_l3 {
|
||||
+ cpu-supply = <&vdd_cpu_l>;
|
||||
+};
|
||||
+
|
||||
+&emmc_phy {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&gmac {
|
||||
+ assigned-clock-parents = <&clkin_gmac>;
|
||||
+ assigned-clocks = <&cru SCLK_RMII_SRC>;
|
||||
+ clock_in_out = "input";
|
||||
+ phy-mode = "rgmii";
|
||||
+ phy-supply = <&vcc_lan>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&rgmii_pins &gphy_reset>;
|
||||
+ rx_delay = <0x20>;
|
||||
+ tx_delay = <0x28>;
|
||||
+ snps,reset-active-low;
|
||||
+ snps,reset-delays-us = <0 10000 50000>;
|
||||
+ snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c0 {
|
||||
+ clock-frequency = <400000>;
|
||||
+ i2c-scl-rising-time-ns = <168>;
|
||||
+ i2c-scl-falling-time-ns = <4>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ rk808: pmic@1b {
|
||||
+ compatible = "rockchip,rk808";
|
||||
+ reg = <0x1b>;
|
||||
+ interrupt-parent = <&gpio0>;
|
||||
+ interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clock-output-names = "xin32k", "rk808-clkout2";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pmic_int_l>;
|
||||
+ vcc1-supply = <&vcc5v0_sys>;
|
||||
+ vcc2-supply = <&vcc5v0_sys>;
|
||||
+ vcc3-supply = <&vcc5v0_sys>;
|
||||
+ vcc4-supply = <&vcc5v0_sys>;
|
||||
+ vcc6-supply = <&vcc5v0_sys>;
|
||||
+ vcc7-supply = <&vcc5v0_sys>;
|
||||
+ vcc8-supply = <&vcc3v3_sys_s3>;
|
||||
+ vcc9-supply = <&vcc5v0_sys>;
|
||||
+ vcc10-supply = <&vcc5v0_sys>;
|
||||
+ vcc11-supply = <&vcc5v0_sys>;
|
||||
+ vcc12-supply = <&vcc3v3_sys_s3>;
|
||||
+ vddio-supply = <&vcc3v0_s3>;
|
||||
+ wakeup-source;
|
||||
+ #clock-cells = <1>;
|
||||
+
|
||||
+ regulators {
|
||||
+ vdd_cpu_l: DCDC_REG2 {
|
||||
+ regulator-name = "vdd_cpu_l";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <750000>;
|
||||
+ regulator-max-microvolt = <1350000>;
|
||||
+ regulator-ramp-delay = <6001>;
|
||||
+
|
||||
+ regulator-state-mem {
|
||||
+ regulator-off-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc1v8_sys_s3: DCDC_REG4 {
|
||||
+ regulator-name = "vcc1v8_sys_s3";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1800000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc_sdio_s0: LDO_REG4 {
|
||||
+ regulator-name = "vcc_sdio_s0";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <3000000>;
|
||||
+
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <3000000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc3v0_s3: LDO_REG8 {
|
||||
+ regulator-name = "vcc3v0_s3";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <3000000>;
|
||||
+ regulator-max-microvolt = <3000000>;
|
||||
+
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <3000000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vdd_cpu_b: regulator@40 {
|
||||
+ compatible = "silergy,syr827";
|
||||
+ reg = <0x40>;
|
||||
+ fcs,suspend-voltage-selector = <1>;
|
||||
+ regulator-name = "vdd_cpu_b";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <712500>;
|
||||
+ regulator-max-microvolt = <1500000>;
|
||||
+ regulator-ramp-delay = <1000>;
|
||||
+ vin-supply = <&vcc5v0_sys>;
|
||||
+
|
||||
+ regulator-state-mem {
|
||||
+ regulator-off-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&i2c2 {
|
||||
+ clock-frequency = <400000>;
|
||||
+ i2c-scl-rising-time-ns = <160>;
|
||||
+ i2c-scl-falling-time-ns = <30>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ temp@4c {
|
||||
+ compatible = "national,lm75";
|
||||
+ reg = <0x4c>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&io_domains {
|
||||
+ audio-supply = <&vcc1v8_sys_s0>;
|
||||
+ bt656-supply = <&vcc1v8_sys_s0>;
|
||||
+ gpio1830-supply = <&vcc3v0_s3>;
|
||||
+ sdmmc-supply = <&vcc_sdio_s0>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&pcie0 {
|
||||
+ num-lanes = <2>;
|
||||
+ max-link-speed = <2>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pcie_prst &pcie_clkreqn_cpm>;
|
||||
+ vpcie12v-supply = <&vcc12v_dcin>;
|
||||
+ vpcie3v3-supply = <&pcie_power>;
|
||||
+ vpcie1v8-supply = <&avdd_1v8_s0>;
|
||||
+ vpcie0v9-supply = <&avdd_0v9_s0>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&pcie_phy {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ gmac {
|
||||
+ gphy_reset: gphy-reset {
|
||||
+ rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_output_low>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ sys_grn_led_on: sys-grn-led-on {
|
||||
+ rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>;
|
||||
+ };
|
||||
+
|
||||
+ sys_red_led_on: sys-red-led-on {
|
||||
+ rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_down>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pmic {
|
||||
+ pmic_int_l: pmic-int-l {
|
||||
+ rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc3v0-sd {
|
||||
+ sdmmc0_pwr_h: sdmmc0-pwr-h {
|
||||
+ rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pmu_io_domains {
|
||||
+ pmu1830-supply = <&vcc3v0_s3>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&sdhci {
|
||||
+ bus-width = <8>;
|
||||
+ mmc-hs200-1_8v;
|
||||
+ non-removable;
|
||||
+ vqmmc-supply = <&vcc1v8_sys_s0>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&sdmmc {
|
||||
+ bus-width = <4>;
|
||||
+ cap-sd-highspeed;
|
||||
+ cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
|
||||
+ disable-wp;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
|
||||
+ vmmc-supply = <&vcc3v0_sd>;
|
||||
+ vqmmc-supply = <&vcc_sdio_s0>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart2 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
--
|
||||
cgit 1.2.3-1.el7
|
14
patches/kernel/115200baud.patch
Normal file
14
patches/kernel/115200baud.patch
Normal file
@ -0,0 +1,14 @@
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
|
||||
index 714616618..b1fb824f3 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
|
||||
@@ -16,6 +16,11 @@
|
||||
compatible = "kobol,helios64", "rockchip,rk3399";
|
||||
|
||||
+ chosen {
|
||||
+ bootargs = "earlycon=uart8250,mmio32,0xff1a0000 earlyprintk";
|
||||
+ stdout-path = "serial2:115200n8";
|
||||
+ };
|
||||
+
|
||||
adc-keys {
|
||||
compatible = "adc-keys";
|
@ -0,0 +1,38 @@
|
||||
From 62dbf80fc581a8eed7288ed7aca24446054eb616 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <uwe@kleine-koenig.org>
|
||||
Date: Mon, 2 Nov 2020 16:06:58 +0100
|
||||
Subject: dt-bindings: arm: rockchip: Add Kobol Helios64
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Document the new board by Kobol introduced recently in
|
||||
rockchip/rk3399-kobol-helios64.dts.
|
||||
|
||||
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
|
||||
Acked-by: Rob Herring <robh@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20201102150658.167161-1-uwe@kleine-koenig.org
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
Documentation/devicetree/bindings/arm/rockchip.yaml | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/arm/rockchip.yaml b/Documentation/devicetree/bindings/arm/rockchip.yaml
|
||||
index 65b4cc2c63f7c..70fa4d98db564 100644
|
||||
--- a/Documentation/devicetree/bindings/arm/rockchip.yaml
|
||||
+++ b/Documentation/devicetree/bindings/arm/rockchip.yaml
|
||||
@@ -381,6 +381,11 @@ properties:
|
||||
- khadas,edge-v
|
||||
- const: rockchip,rk3399
|
||||
|
||||
+ - description: Kobol Helios64
|
||||
+ items:
|
||||
+ - const: kobol,helios64
|
||||
+ - const: rockchip,rk3399
|
||||
+
|
||||
- description: Mecer Xtreme Mini S6
|
||||
items:
|
||||
- const: mecer,xms6
|
||||
--
|
||||
cgit 1.2.3-1.el7
|
||||
|
1183
patches/kernel/add-board-helios64.patch
Normal file
1183
patches/kernel/add-board-helios64.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,34 @@
|
||||
From fa67f2817ff2c9bb07472d30e58d904922f1a538 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <uwe@kleine-koenig.org>
|
||||
Date: Wed, 14 Oct 2020 22:00:29 +0200
|
||||
Subject: dt-bindings: vendor-prefixes: Add kobol prefix
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The prefix is already used in arm/armada-388-helios4.dts.
|
||||
|
||||
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
|
||||
Acked-by: Rob Herring <robh@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20201014200030.845759-2-uwe@kleine-koenig.org
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
|
||||
index 2735be1a84709..259faf1b382c0 100644
|
||||
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
|
||||
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
|
||||
@@ -553,6 +553,8 @@ patternProperties:
|
||||
description: Kionix, Inc.
|
||||
"^kobo,.*":
|
||||
description: Rakuten Kobo Inc.
|
||||
+ "^kobol,.*":
|
||||
+ description: Kobol Innovations Pte. Ltd.
|
||||
"^koe,.*":
|
||||
description: Kaohsiung Opto-Electronics Inc.
|
||||
"^kontron,.*":
|
||||
--
|
||||
cgit 1.2.3-1.el7
|
||||
|
25
patches/kernel/helios64-remove-pcie-ep-gpios.patch
Normal file
25
patches/kernel/helios64-remove-pcie-ep-gpios.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From e7e9a3a959927094d59b67f46ecc1c5d50190ce8 Mon Sep 17 00:00:00 2001
|
||||
From: Aditya Prayoga <aditya@kobol.io>
|
||||
Date: Tue, 15 Sep 2020 13:42:02 +0700
|
||||
Subject: [PATCH] Remove PCIE ep-gpios from Helios64
|
||||
|
||||
Signed-off-by: Aditya Prayoga <aditya@kobol.io>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3399-helios64.dts | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
|
||||
index c065ba82d..002c93912 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
|
||||
@@ -721,7 +721,6 @@
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
- ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>;
|
||||
num-lanes = <2>;
|
||||
max-link-speed = <2>;
|
||||
pinctrl-names = "default";
|
||||
--
|
||||
Created with Armbian build tools https://github.com/armbian/build
|
||||
|
@ -0,0 +1,29 @@
|
||||
From 002593cfe8fc7539a6aa2dfb246d832e0b8b8516 Mon Sep 17 00:00:00 2001
|
||||
From: Aditya Prayoga <aditya@kobol.io>
|
||||
Date: Tue, 15 Sep 2020 13:29:45 +0700
|
||||
Subject: [PATCH] PCI: rockchip: support ep-gpio undefined case
|
||||
|
||||
Signed-off-by: Aditya Prayoga <aditya@kobol.io>
|
||||
---
|
||||
drivers/pci/controller/pcie-rockchip.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/pci/controller/pcie-rockchip.c b/drivers/pci/controller/pcie-rockchip.c
|
||||
index c53d1322a..e4f42591d 100644
|
||||
--- a/drivers/pci/controller/pcie-rockchip.c
|
||||
+++ b/drivers/pci/controller/pcie-rockchip.c
|
||||
@@ -119,9 +119,9 @@ int rockchip_pcie_parse_dt(struct rockchip_pcie *rockchip)
|
||||
}
|
||||
|
||||
if (rockchip->is_rc) {
|
||||
- rockchip->ep_gpio = devm_gpiod_get(dev, "ep", GPIOD_OUT_HIGH);
|
||||
+ rockchip->ep_gpio = devm_gpiod_get_optional(dev, "ep", GPIOD_OUT_HIGH);
|
||||
if (IS_ERR(rockchip->ep_gpio)) {
|
||||
- dev_err(dev, "missing ep-gpios property in node\n");
|
||||
+ dev_err(dev, "invalid ep-gpios property in node\n");
|
||||
return PTR_ERR(rockchip->ep_gpio);
|
||||
}
|
||||
}
|
||||
--
|
||||
Created with Armbian build tools https://github.com/armbian/build
|
||||
|
21
patches/uboot/115200baud.patch
Normal file
21
patches/uboot/115200baud.patch
Normal file
@ -0,0 +1,21 @@
|
||||
From efb3ec2ca3a88530d45c593f051ec53f80a4c4d8 Mon Sep 17 00:00:00 2001
|
||||
From: Moritz Angermann <moritz.angermann@gmail.com>
|
||||
Date: Fri, 4 Dec 2020 17:00:03 +0800
|
||||
Subject: [PATCH] Update rk3399-helios64-u-boot.dtsi
|
||||
|
||||
---
|
||||
arch/arm/dts/rk3399-kobol-helios64-u-boot.dtsi | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm/dts/rk3399-kobol-helios64-u-boot.dtsi b/arch/arm/dts/rk3399-kobol-helios64-u-boot.dtsi
|
||||
index 27ea5eaa971..3a260c7e126 100644
|
||||
--- a/arch/arm/dts/rk3399-kobol-helios64-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/rk3399-kobol-helios64-u-boot.dtsi
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
chosen {
|
||||
bootargs = "earlycon=uart8250,mmio32,0xff1a0000 earlyprintk";
|
||||
- stdout-path = "serial2:1500000n8";
|
||||
+ stdout-path = "serial2:115200n8";
|
||||
u-boot,spl-boot-order = "same-as-spl", &spiflash, &sdmmc, &sdhci;
|
||||
};
|
2184
patches/uboot/add-board-helios64.patch
Normal file
2184
patches/uboot/add-board-helios64.patch
Normal file
File diff suppressed because it is too large
Load Diff
34
u-boot.nix
Normal file
34
u-boot.nix
Normal file
@ -0,0 +1,34 @@
|
||||
final: prev: {
|
||||
ubootHelios64 =
|
||||
let plat = if true || builtins.currentSystem == "aarch64-linux" then prev
|
||||
else prev.pkgsCross.aarch64-multiplatform; in
|
||||
plat.buildUBoot {
|
||||
# version = "v2020.04.20";
|
||||
# See https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic/-/commit/6de936b011fb02d1019a69aea0184cee4a578f59
|
||||
# that's the first commit that introduces reading the ethaddr from the efuse!
|
||||
# src = fetchTarball {
|
||||
# url = "https://github.com/kobol-io/u-boot/archive/29d63b29550818992e3bcdb1ceb2a0db49d395cc.tar.gz";
|
||||
# sha256 = "1lxyjlssalc0c6nxaw2h8xxmazphmqdp4z8lz947s7v2cmbkmgd5";
|
||||
# };
|
||||
extraConfig = ''
|
||||
# The default 1_500_000 doesn't work with anything but ftdi modems
|
||||
# apparently, and all I got are CP2102 and PL2303HX. 1_500_000 isn't
|
||||
# listed as a supported baudrate, 115_200 is though.
|
||||
CONFIG_BAUDRATE=115200
|
||||
# This one is needed to obtain the cpu-id;
|
||||
CONFIG_MISC=y
|
||||
CONFIG_ROCKCHIP_EFUSE=y
|
||||
# which in turn is used to derive the mac address.
|
||||
CONFIG_MISC_INIT_R=y
|
||||
CONFIG_CMD_BTRFS=y
|
||||
'';
|
||||
extraPatches = [
|
||||
./patches/uboot/add-board-helios64.patch
|
||||
./patches/uboot/115200baud.patch
|
||||
];
|
||||
defconfig = "helios64-rk3399_defconfig";
|
||||
extraMeta.platforms = [ "aarch64-linux" ];
|
||||
BL31 = "${plat.armTrustedFirmwareRK3399}/bl31.elf";
|
||||
filesToInstall = ["idbloader.img" "u-boot.itb" ".config"];
|
||||
};
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user