From 2e2f6e893bff9d8b2efab0d78f60ae8927919883 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 4 Sep 2020 21:05:49 +0200 Subject: [PATCH] Fix Tinker Board S (eMMC) boot (#650) (#845) * Fix Tinker Board S (eMMC) boot (#650) Use Tinker Board S U-Boot configuration which is capable to boot from eMMC as well as from SD card. Note that this makes U-Boot always claiming to run on Tinker Board S: .. Model: Rockchip RK3288 Asus Tinker Board S .. It seems that there is no generic Tinker Board configuration. However, Tinker Board S configuration really seems to work well with Tinker Board as well, so just use it. Also today the U-Boot Makefile seems to generate a working idbloader.img already. Drop our special handling. * Use Tinker Board S device tree if booting from eMMC for Linux Instead of patching the Tinker Board device tree, select the device tree based on what device we are booting from. Note: This boots the non-S device tree when booting a Tinker Board S from SD card! But there is no reliable detection otherwise, so let's just live with that fact. * Document how to use our U-Boot to flash eMMC --- Documentation/boards/asus/README.md | 20 +++++-- buildroot-external/board/asus/hassos-hook.sh | 10 +--- ...oard-tinkerboard-enable-emmc-support.patch | 25 --------- ...01-SPL-modify-load-address-of-U-Boot.patch | 37 +++++++++++++ ...001-TLP-Modify-entrypoint-for-u-boot.patch | 23 -------- ...ker-move-i2c-node-to-shared-device-t.patch | 55 +++++++++++++++++++ ...p-dts-tinker-remove-unnecessary-node.patch | 34 ++++++++++++ .../board/asus/tinker/uboot-boot.ush | 6 +- buildroot-external/configs/tinker_defconfig | 4 +- 9 files changed, 151 insertions(+), 63 deletions(-) delete mode 100644 buildroot-external/board/asus/tinker/patches/linux/board-tinkerboard-enable-emmc-support.patch create mode 100644 buildroot-external/board/asus/tinker/patches/uboot/0001-SPL-modify-load-address-of-U-Boot.patch delete mode 100644 buildroot-external/board/asus/tinker/patches/uboot/0001-TLP-Modify-entrypoint-for-u-boot.patch create mode 100644 buildroot-external/board/asus/tinker/patches/uboot/0002-rockchip-dts-tinker-move-i2c-node-to-shared-device-t.patch create mode 100644 buildroot-external/board/asus/tinker/patches/uboot/0003-rockchip-dts-tinker-remove-unnecessary-node.patch diff --git a/Documentation/boards/asus/README.md b/Documentation/boards/asus/README.md index 5c5053495..9cb5f60be 100644 --- a/Documentation/boards/asus/README.md +++ b/Documentation/boards/asus/README.md @@ -5,16 +5,26 @@ | Device | Release Date | Support | Config | |----------------|---------------|---------|----------| | Tinker RK3288 | April 2017 | yes | [tinker](../../../buildroot-external/configs/tinker_defconfig) | -| Tinker S RK3288| January 2018 | yes? | [tinker](../../../buildroot-external/configs/tinker_defconfig)? | +| Tinker S RK3288| January 2018 | yes | [tinker](../../../buildroot-external/configs/tinker_defconfig) | | Tinker Edge T | November 2019 | no? | | | Tinker Edge R | November 2019 | no? | | -(? is the Tinker S supported?) - +eMMC support is provided with the same image. Just flash the image to the eMMC by connecting your Tinker Board S to your PC via Micro-USB. Refer to the Tinkerboard documentation how-to flash using Micro-USB and UMS. + +The Home Assistant OS provided U-Boot does support UMS as well, +however manual intervention is necessary: + + 1. Set the jumper between Micro-USB and HDMI the maskrom mode + 2. Insert SD card and connect the board via Micro-USB to your PC + 3. Continusly press Ctrl+C to interrupt boot + 4. Set the jumper back to the park position + 5. Start UMS using: +``` +ums 0 mmc 0 +``` + 6. A mass storage device should appear. Flash Home Assistant OS to it. ## Serial console diff --git a/buildroot-external/board/asus/hassos-hook.sh b/buildroot-external/board/asus/hassos-hook.sh index 9582e5474..b456d6e74 100755 --- a/buildroot-external/board/asus/hassos-hook.sh +++ b/buildroot-external/board/asus/hassos-hook.sh @@ -7,20 +7,16 @@ function hassos_pre_image() { cp -t "${BOOT_DATA}" \ "${BINARIES_DIR}/boot.scr" \ - "${BINARIES_DIR}/rk3288-tinker.dtb" + "${BINARIES_DIR}/rk3288-tinker.dtb" \ + "${BINARIES_DIR}/rk3288-tinker-s.dtb" echo "console=tty1" > "${BOOT_DATA}/cmdline.txt" - # Create boot binary - rm -f "${BINARIES_DIR}/idbloader.img" - mkimage -n rk3288 -T rksd -d "${BINARIES_DIR}/u-boot-tpl.bin" "${BINARIES_DIR}/idbloader.img" - cat "${BINARIES_DIR}/u-boot-spl.bin" >> "${BINARIES_DIR}/idbloader.img" - # SPL create_spl_image dd if="${BINARIES_DIR}/idbloader.img" of="${SPL_IMG}" conv=notrunc bs=512 seek=64 - dd if="${BINARIES_DIR}/u-boot-dtb.img" of="${SPL_IMG}" conv=notrunc bs=512 seek=12288 + dd if="${BINARIES_DIR}/u-boot-dtb.img" of="${SPL_IMG}" conv=notrunc bs=512 seek=8192 } diff --git a/buildroot-external/board/asus/tinker/patches/linux/board-tinkerboard-enable-emmc-support.patch b/buildroot-external/board/asus/tinker/patches/linux/board-tinkerboard-enable-emmc-support.patch deleted file mode 100644 index d9e10ccb9..000000000 --- a/buildroot-external/board/asus/tinker/patches/linux/board-tinkerboard-enable-emmc-support.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/arch/arm/boot/dts/rk3288-tinker.dtsi b/arch/arm/boot/dts/rk3288-tinker.dtsi -index f88c913ff..7f04ccbdf 100644 ---- a/arch/arm/boot/dts/rk3288-tinker.dtsi -+++ b/arch/arm/boot/dts/rk3288-tinker.dtsi -@@ -547,3 +547,20 @@ - &gpiomem { - status = "okay"; - }; -+ -+&emmc { -+ bus-width = <8>; -+ cap-mmc-highspeed; -+ non-removable; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_pwr &emmc_bus8>; -+ max-frequency = <150000000>; -+ mmc-hs200-1_8v; -+ mmc-ddr-1_8v; -+ status = "okay"; -+}; -+ -+&hdmi { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hdmi_cec_c0>; -+}; diff --git a/buildroot-external/board/asus/tinker/patches/uboot/0001-SPL-modify-load-address-of-U-Boot.patch b/buildroot-external/board/asus/tinker/patches/uboot/0001-SPL-modify-load-address-of-U-Boot.patch new file mode 100644 index 000000000..8a95acb64 --- /dev/null +++ b/buildroot-external/board/asus/tinker/patches/uboot/0001-SPL-modify-load-address-of-U-Boot.patch @@ -0,0 +1,37 @@ +From 74e929bc4713b76f58a8df82019d74078b4b8d0c Mon Sep 17 00:00:00 2001 +Message-Id: <74e929bc4713b76f58a8df82019d74078b4b8d0c.1599227174.git.stefan@agner.ch> +From: Pascal Vizeli +Date: Fri, 24 Apr 2020 12:41:50 +0000 +Subject: [PATCH 1/3] SPL: modify load address of U-Boot + +Default load address of U-Boot is at sector 16384, which is where HAOS +has its first partition. Use 0x2000 (8192) instead. + +Signed-off-by: Pascal Vizeli +Signed-off-by: Stefan Agner +--- + configs/tinker-rk3288_defconfig | 1 + + configs/tinker-s-rk3288_defconfig | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig +index 83c3450839..574a711a32 100644 +--- a/configs/tinker-rk3288_defconfig ++++ b/configs/tinker-rk3288_defconfig +@@ -84,3 +84,4 @@ CONFIG_USB_ETHER_ASIX=y + CONFIG_USB_ETHER_SMSC95XX=y + CONFIG_CMD_DHRYSTONE=y + CONFIG_ERRNO_STR=y ++CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x2000 +diff --git a/configs/tinker-s-rk3288_defconfig b/configs/tinker-s-rk3288_defconfig +index 4925b14821..df047785ea 100644 +--- a/configs/tinker-s-rk3288_defconfig ++++ b/configs/tinker-s-rk3288_defconfig +@@ -90,3 +90,4 @@ CONFIG_DISPLAY_ROCKCHIP_HDMI=y + CONFIG_CONSOLE_SCROLL_LINES=10 + CONFIG_CMD_DHRYSTONE=y + CONFIG_ERRNO_STR=y ++CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x2000 +-- +2.28.0 + diff --git a/buildroot-external/board/asus/tinker/patches/uboot/0001-TLP-Modify-entrypoint-for-u-boot.patch b/buildroot-external/board/asus/tinker/patches/uboot/0001-TLP-Modify-entrypoint-for-u-boot.patch deleted file mode 100644 index 71a07cc4c..000000000 --- a/buildroot-external/board/asus/tinker/patches/uboot/0001-TLP-Modify-entrypoint-for-u-boot.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 17735a28503d90db2a7173816861750f475580ea Mon Sep 17 00:00:00 2001 -From: Pascal Vizeli -Date: Fri, 24 Apr 2020 12:41:50 +0000 -Subject: [PATCH 1/1] TLP: Modify entrypoint for u-boot - -Signed-off-by: Pascal Vizeli ---- - configs/tinker-rk3288_defconfig | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig -index 83c3450839..648a7904be 100644 ---- a/configs/tinker-rk3288_defconfig -+++ b/configs/tinker-rk3288_defconfig -@@ -84,3 +84,5 @@ CONFIG_USB_ETHER_ASIX=y - CONFIG_USB_ETHER_SMSC95XX=y - CONFIG_CMD_DHRYSTONE=y - CONFIG_ERRNO_STR=y -+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x3000 -+ --- -2.17.1 - diff --git a/buildroot-external/board/asus/tinker/patches/uboot/0002-rockchip-dts-tinker-move-i2c-node-to-shared-device-t.patch b/buildroot-external/board/asus/tinker/patches/uboot/0002-rockchip-dts-tinker-move-i2c-node-to-shared-device-t.patch new file mode 100644 index 000000000..a195ac493 --- /dev/null +++ b/buildroot-external/board/asus/tinker/patches/uboot/0002-rockchip-dts-tinker-move-i2c-node-to-shared-device-t.patch @@ -0,0 +1,55 @@ +From 683783c7253981c0d4c3b772aeb1f9bda833e2be Mon Sep 17 00:00:00 2001 +Message-Id: <683783c7253981c0d4c3b772aeb1f9bda833e2be.1599227174.git.stefan@agner.ch> +In-Reply-To: <74e929bc4713b76f58a8df82019d74078b4b8d0c.1599227174.git.stefan@agner.ch> +References: <74e929bc4713b76f58a8df82019d74078b4b8d0c.1599227174.git.stefan@agner.ch> +From: Stefan Agner +Date: Fri, 4 Sep 2020 15:40:55 +0200 +Subject: [PATCH 2/3] rockchip: dts: tinker: move i2c node to shared device + tree + +The I2C EEPROM is present on Tinker Board S as well. Move the i2c node +to the shared, U-Boot specific rk3288-tinker-u-boot.dtsi device tree. + +Cc: Jonas Karlman +Signed-off-by: Stefan Agner +--- + arch/arm/dts/rk3288-tinker-u-boot.dtsi | 7 +++++++ + arch/arm/dts/rk3288-tinker.dts | 7 ------- + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/arch/arm/dts/rk3288-tinker-u-boot.dtsi b/arch/arm/dts/rk3288-tinker-u-boot.dtsi +index 732aa4f91f..3d169906fd 100644 +--- a/arch/arm/dts/rk3288-tinker-u-boot.dtsi ++++ b/arch/arm/dts/rk3288-tinker-u-boot.dtsi +@@ -17,6 +17,13 @@ + rockchip,sdram-params = <0x20d266a4 0x5b6 2 533000000 6 9 0>; + }; + ++&i2c2 { ++ m24c08@50 { ++ compatible = "at,24c08", "i2c-eeprom"; ++ reg = <0x50>; ++ }; ++}; ++ + &pinctrl { + u-boot,dm-pre-reloc; + }; +diff --git a/arch/arm/dts/rk3288-tinker.dts b/arch/arm/dts/rk3288-tinker.dts +index 4b8405fd82..338670123b 100644 +--- a/arch/arm/dts/rk3288-tinker.dts ++++ b/arch/arm/dts/rk3288-tinker.dts +@@ -35,10 +35,3 @@ + vbus-supply = <&vcc5v0_host>; + status = "okay"; + }; +- +-&i2c2 { +- m24c08@50 { +- compatible = "at,24c08", "i2c-eeprom"; +- reg = <0x50>; +- }; +-}; +-- +2.28.0 + diff --git a/buildroot-external/board/asus/tinker/patches/uboot/0003-rockchip-dts-tinker-remove-unnecessary-node.patch b/buildroot-external/board/asus/tinker/patches/uboot/0003-rockchip-dts-tinker-remove-unnecessary-node.patch new file mode 100644 index 000000000..a31bd22f0 --- /dev/null +++ b/buildroot-external/board/asus/tinker/patches/uboot/0003-rockchip-dts-tinker-remove-unnecessary-node.patch @@ -0,0 +1,34 @@ +From 2af46619bb66af62bbfd2a880fe57d6dd0ec43fe Mon Sep 17 00:00:00 2001 +Message-Id: <2af46619bb66af62bbfd2a880fe57d6dd0ec43fe.1599227174.git.stefan@agner.ch> +In-Reply-To: <74e929bc4713b76f58a8df82019d74078b4b8d0c.1599227174.git.stefan@agner.ch> +References: <74e929bc4713b76f58a8df82019d74078b4b8d0c.1599227174.git.stefan@agner.ch> +From: Stefan Agner +Date: Fri, 4 Sep 2020 15:44:38 +0200 +Subject: [PATCH 3/3] rockchip: dts: tinker: remove unnecessary node + +The property reg-shift with the same value is present in the base +device tree already. Remove unnecessary node from rk3288-tinker.dts. + +Signed-off-by: Stefan Agner +--- + arch/arm/dts/rk3288-tinker.dts | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/arch/arm/dts/rk3288-tinker.dts b/arch/arm/dts/rk3288-tinker.dts +index 338670123b..8b1848c310 100644 +--- a/arch/arm/dts/rk3288-tinker.dts ++++ b/arch/arm/dts/rk3288-tinker.dts +@@ -27,10 +27,6 @@ + status = "okay"; + }; + +-&uart2 { +- reg-shift = <2>; +-}; +- + &usb_host1 { + vbus-supply = <&vcc5v0_host>; + status = "okay"; +-- +2.28.0 + diff --git a/buildroot-external/board/asus/tinker/uboot-boot.ush b/buildroot-external/board/asus/tinker/uboot-boot.ush index c693c0e74..ca7e1c998 100644 --- a/buildroot-external/board/asus/tinker/uboot-boot.ush +++ b/buildroot-external/board/asus/tinker/uboot-boot.ush @@ -27,7 +27,11 @@ setenv bootargs_b "root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 rootfstype fileenv mmc ${devnum}:1 ${ramdisk_addr_r} cmdline.txt cmdline # Load device tree -fatload mmc ${devnum}:1 ${fdt_addr_r} rk3288-tinker.dtb +if test "$devnum" = "0"; then + fatload mmc ${devnum}:1 ${fdt_addr_r} rk3288-tinker-s.dtb +else + fatload mmc ${devnum}:1 ${fdt_addr_r} rk3288-tinker.dtb +fi setenv bootargs for BOOT_SLOT in "${BOOT_ORDER}"; do diff --git a/buildroot-external/configs/tinker_defconfig b/buildroot-external/configs/tinker_defconfig index ccfc42253..ca2e2f271 100644 --- a/buildroot-external/configs/tinker_defconfig +++ b/buildroot-external/configs/tinker_defconfig @@ -30,7 +30,7 @@ BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_HASSOS_PATH)/board/asus/tink BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config" BR2_LINUX_KERNEL_LZ4=y BR2_LINUX_KERNEL_DTS_SUPPORT=y -BR2_LINUX_KERNEL_INTREE_DTS_NAME="rk3288-tinker" +BR2_LINUX_KERNEL_INTREE_DTS_NAME="rk3288-tinker rk3288-tinker-s" BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_HASSOS_PATH)/busybox.config" @@ -89,7 +89,7 @@ BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_CUSTOM_VERSION=y BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.01" -BR2_TARGET_UBOOT_BOARD_DEFCONFIG="tinker-rk3288" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="tinker-s-rk3288" BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/bootloader/uboot.config $(BR2_EXTERNAL_HASSOS_PATH)/board/asus/tinker/uboot.config" BR2_TARGET_UBOOT_FORMAT_DTB_BIN=y BR2_TARGET_UBOOT_FORMAT_DTB_IMG=y