Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odroidm1: u-boot: bump to 2025.01; kernel: add nodes for overlays #7686

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions config/boards/odroidm1.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,15 @@ IMAGE_PARTITION_TABLE="gpt"
FULL_DESKTOP="yes"
BOOT_LOGO="desktop"

BOOTBRANCH_BOARD="tag:v2024.07"
BOOTPATCHDIR="v2024.07"
BOOTBRANCH_BOARD="tag:v2025.01"
BOOTPATCHDIR="v2025.01" # but all changes are done in this board file, not patches

BOOTCONFIG="odroid-m1-rk3568_defconfig"
BOOTDIR="u-boot-${BOARD}" # do not share u-boot directory

# The overlays for this board are prefixed by 'rockchip-rk3568-hk' (see for example patch/kernel/archive/rockchip64-6.6/overlay/rockchip-rk3568-hk-i2c0.dts)
OVERLAY_PREFIX="rockchip-rk3568-hk"

# HK's SPI partition on MTD:
# mtd0: start 0 size 917.504 end 917.504 : SPL == start 0x0 size 0xe0000 : SPL
# mtd1: start 917.504 size 131.072 end 1.048.576 : U-Boot Env == start 0xe0000 size 0x20000 : U-Boot Env
# mtd2: start 1.048.576 size 2.097.152 end 3.145.728 : U-Boot == start 0x100000 size 0x200000 : U-Boot
function post_family_config__uboot_config() {
display_alert "$BOARD" "u-boot ${BOOTBRANCH_BOARD} overrides" "info"
BOOTDELAY=1 # Wait for UART interrupt to enter UMS/RockUSB mode etc
Expand Down Expand Up @@ -67,14 +63,20 @@ function post_family_tweaks__config_odroidm1_fwenv() {
# https://github.com/hardkernel/u-boot/blob/356906e6445378a45ac14ec184fc6e666b22338a/configs/odroid_rk3568_defconfig#L212-L213
# The kernel DT has a convenient partition table, so mtd1 is ready to use, just gotta set the size.
# https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts#L637-L662
# HK's SPI partition on MTD:
# mtd0: start 0 size 917.504 end 917.504 : SPL == start 0x0 size 0xe0000 : SPL
# mtd1: start 917.504 size 131.072 end 1.048.576 : U-Boot Env == start 0xe0000 size 0x20000 : U-Boot Env
# mtd2: start 1.048.576 size 2.097.152 end 3.145.728 : U-Boot == start 0x100000 size 0x200000 : U-Boot

cat <<- 'FW_ENV_CONFIG' > "${SDCARD}"/etc/fw_env.config
# MTD on the SPI for the Odroid-M1; this requires the MTD partition table in the board kernel DTS
# MTD device name Device offset Env. size Flash sector size Number of sectors
/dev/mtd1 0x0000 0x20000
FW_ENV_CONFIG
}

# add a network rule to rename default name
# add a network rule to rename default name
function post_family_tweaks__odroidm1_rename_gmac_eth0() {
display_alert "Creating network rename rule for Odroid M1"
mkdir -p "${SDCARD}"/etc/udev/rules.d/
cat <<- EOF > "${SDCARD}"/etc/udev/rules.d/70-rename-lan.rules
Expand All @@ -83,6 +85,22 @@ function post_family_tweaks__config_odroidm1_fwenv() {

}

function pre_config_uboot_target__odroidm1_patch_uboot_dtsi_for_ums() {
display_alert "u-boot for ${BOARD}" "u-boot: add to u-boot dtsi for UMS" "info" # avoid a patch, just append to the dtsi file
cat <<- UBOOT_BOARD_DTSI_OTG >> arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi
&usb_host0_xhci { dr_mode = "otg"; };
UBOOT_BOARD_DTSI_OTG
}

# "rockchip-common: boot SD card first, then NVMe, then SATA, then USB, then mmc"
# On odroidm1, mmc0 is the eMMC, mmc1 is the SD card slot
function pre_config_uboot_target__odroidm1_patch_rockchip_common_boot_order() {
declare -a rockchip_uboot_targets=("mmc1" "nvme" "scsi" "usb" "mmc0" "pxe" "dhcp" "spi") # for future make-this-generic delight
display_alert "u-boot for ${BOARD}/${BRANCH}" "u-boot: adjust boot order to '${rockchip_uboot_targets[*]}'" "info"
sed -i -e "s/#define BOOT_TARGETS.*/#define BOOT_TARGETS \"${rockchip_uboot_targets[*]}\"/" include/configs/rockchip-common.h
regular_git diff -u include/configs/rockchip-common.h || true
}

# A better equivalent to patching a defconfig, do changes to .config via code.
# For UMS/RockUSB to work in u-boot, &usb_host0_xhci { dr_mode = "otg" } is required. See 0002-board-rockchip-ODROID-M1-override-kernel-DT-for-xhci-otg-dr_mode.patch
function post_config_uboot_target__extra_configs_for_odroid-m1() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 9 Jan 2025 19:22:12 +0100
Subject: rk3568-odroid-m1: add nodes for i2c/pwm/spi/uart overlays

- we used to have a bare-dt for odroid-m1 that got removed as it landed upstream
- but mainline doesn't have the nodes we use for the overlays
- at least i2c3 (which is aliased to i2c0) and uart1 breaks without them
---
arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts | 34 ++++++++++
1 file changed, 34 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts b/arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts
index 111111111111..222222222222 100644
--- a/arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts
@@ -739,3 +739,37 @@ vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
remote-endpoint = <&hdmi_in_vp0>;
};
};
+
+&i2c3 {
+ status = "disabled";
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c3m1_xfer>;
+};
+
+&pwm1 {
+ status = "disabled";
+ pinctrl-0 = <&pwm1m1_pins>;
+};
+
+&pwm2 {
+ status = "disabled";
+ pinctrl-0 = <&pwm2m1_pins>;
+};
+
+&spi0 {
+ status = "disabled";
+
+ pinctrl-0 = <&spi0m1_pins>;
+ pinctrl-1 = <&spi0m1_pins_hs>;
+ num_chipselect = <1>;
+
+ cs-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_LOW>;
+};
+
+&uart1 {
+ status = "disabled";
+ dma-names = "tx", "rx";
+ /* uart1 uart1-with-ctsrts */
+ pinctrl-0 = <&uart1m1_xfer>;
+ pinctrl-1 = <&uart1m1_xfer &uart1m1_ctsn &uart1m1_rtsn>;
+};
--
Armbian

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Thu, 9 Jan 2025 19:22:12 +0100
Subject: rk3568-odroid-m1: add nodes for i2c/pwm/spi/uart overlays

- we used to have a bare-dt for odroid-m1 that got removed as it landed upstream
- but mainline doesn't have the nodes we use for the overlays
- at least i2c3 (which is aliased to i2c0) and uart1 breaks without them
---
arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts | 34 ++++++++++
1 file changed, 34 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts b/arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts
index 111111111111..222222222222 100644
--- a/arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts
@@ -739,3 +739,37 @@ vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
remote-endpoint = <&hdmi_in_vp0>;
};
};
+
+&i2c3 {
+ status = "disabled";
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c3m1_xfer>;
+};
+
+&pwm1 {
+ status = "disabled";
+ pinctrl-0 = <&pwm1m1_pins>;
+};
+
+&pwm2 {
+ status = "disabled";
+ pinctrl-0 = <&pwm2m1_pins>;
+};
+
+&spi0 {
+ status = "disabled";
+
+ pinctrl-0 = <&spi0m1_pins>;
+ pinctrl-1 = <&spi0m1_pins_hs>;
+ num_chipselect = <1>;
+
+ cs-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_LOW>;
+};
+
+&uart1 {
+ status = "disabled";
+ dma-names = "tx", "rx";
+ /* uart1 uart1-with-ctsrts */
+ pinctrl-0 = <&uart1m1_xfer>;
+ pinctrl-1 = <&uart1m1_xfer &uart1m1_ctsn &uart1m1_rtsn>;
+};
--
Armbian

This file was deleted.

This file was deleted.