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
This commit is contained in:
Stefan Agner 2020-09-04 21:05:49 +02:00 committed by GitHub
parent a2a4cf8668
commit 2e2f6e893b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 151 additions and 63 deletions

View File

@ -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
eMMC support is provided transparently. Just flash the image to the eMMC by connecting your Tinker Board S to your PC via Micro-USB.
-->
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

View File

@ -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
}

View File

@ -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>;
+};

View File

@ -0,0 +1,37 @@
From 74e929bc4713b76f58a8df82019d74078b4b8d0c Mon Sep 17 00:00:00 2001
Message-Id: <74e929bc4713b76f58a8df82019d74078b4b8d0c.1599227174.git.stefan@agner.ch>
From: Pascal Vizeli <pvizeli@syshack.ch>
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 <pvizeli@syshack.ch>
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
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

View File

@ -1,23 +0,0 @@
From 17735a28503d90db2a7173816861750f475580ea Mon Sep 17 00:00:00 2001
From: Pascal Vizeli <pvizeli@syshack.ch>
Date: Fri, 24 Apr 2020 12:41:50 +0000
Subject: [PATCH 1/1] TLP: Modify entrypoint for u-boot
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
---
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

View File

@ -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 <stefan@agner.ch>
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 <jonas@kwiboo.se>
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
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

View File

@ -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 <stefan@agner.ch>
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 <stefan@agner.ch>
---
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

View File

@ -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

View File

@ -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