u-boot-remarkable2: Initial commit of u-boot

Signed-off-by: Alistair Francis <alistair@alistair23.me>
This commit is contained in:
Alistair Francis 2021-01-16 21:22:30 -08:00 committed by Otavio Salvador
parent 398e73f281
commit 16f4bd6841
10 changed files with 395 additions and 0 deletions

View File

@ -0,0 +1,28 @@
From 10cc2afd76f0dc31b9a5fbfe9c8de08be174c21f Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Thu, 30 Jan 2020 09:37:15 +0000
Subject: [PATCH 1/9] Remove redundant YYLOC global declaration
Same as the upstream fix for building dtc with gcc 10.
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
scripts/dtc/dtc-lexer.l | 1 -
1 file changed, 1 deletion(-)
diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
index fd825ebba6..24af549977 100644
--- a/scripts/dtc/dtc-lexer.l
+++ b/scripts/dtc/dtc-lexer.l
@@ -38,7 +38,6 @@ LINECOMMENT "//".*\n
#include "srcpos.h"
#include "dtc-parser.tab.h"
-YYLTYPE yylloc;
extern bool treesource_error;
/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
--
2.29.2

View File

@ -0,0 +1,26 @@
From 8e3d5464cf1f0dd22c83dfa604fdca96fcd2e074 Mon Sep 17 00:00:00 2001
From: Alistair Francis <alistair@alistair23.me>
Date: Wed, 13 Jan 2021 10:15:58 -0800
Subject: [PATCH 2/9] dtc-lexer.lex.c_shipped: Remove redundant YYLOC global
declaration
Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
scripts/dtc/dtc-lexer.lex.c_shipped | 1 -
1 file changed, 1 deletion(-)
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped
index 011bb9632f..79952cd3ca 100644
--- a/scripts/dtc/dtc-lexer.lex.c_shipped
+++ b/scripts/dtc/dtc-lexer.lex.c_shipped
@@ -631,7 +631,6 @@ char *yytext;
#include "srcpos.h"
#include "dtc-parser.tab.h"
-YYLTYPE yylloc;
extern bool treesource_error;
/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
--
2.29.2

View File

@ -0,0 +1,81 @@
From 2398a414cda1ca4f8519412926641d3b0fdfa5b0 Mon Sep 17 00:00:00 2001
From: Alistair Francis <alistair@alistair23.me>
Date: Sat, 16 Jan 2021 21:17:31 -0800
Subject: [PATCH 3/9] reMarkable: Print output to pogo pins
Print the UART output to UART6 which is accessible via the pogo pins.
Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
arch/arm/dts/zero-sugar.dts | 15 +++++++++++++++
board/reMarkable/zero-sugar/uart_init.c | 6 ++++++
include/configs/zero-sugar.h | 2 +-
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/zero-sugar.dts b/arch/arm/dts/zero-sugar.dts
index facc174dcc..2e7af505b9 100644
--- a/arch/arm/dts/zero-sugar.dts
+++ b/arch/arm/dts/zero-sugar.dts
@@ -180,6 +180,14 @@
status = "okay";
};
+&uart6 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_uart6>;
+ assigned-clocks = <&clks IMX7D_UART6_ROOT_SRC>;
+ assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
+ status = "okay";
+};
+
&usbotg1 {
vbus-supply = <&reg_usb_otg1_vbus>;
srp-disable;
@@ -311,6 +319,13 @@
>;
};
+ pinctrl_uart6: uart6grp {
+ fsl,pins = <
+ MX7D_PAD_EPDC_DATA09__UART6_DCE_TX 0x79
+ MX7D_PAD_EPDC_DATA08__UART6_DCE_RX 0x79
+ >;
+ };
+
pinctrl_usbotg2_pwr_1: usbotg2-1 {
fsl,pins = <
MX7D_PAD_UART3_CTS_B__GPIO4_IO7 0x14
diff --git a/board/reMarkable/zero-sugar/uart_init.c b/board/reMarkable/zero-sugar/uart_init.c
index 8bb5969f25..377a867729 100644
--- a/board/reMarkable/zero-sugar/uart_init.c
+++ b/board/reMarkable/zero-sugar/uart_init.c
@@ -18,7 +18,13 @@ static iomux_v3_cfg_t const uart1_pads[] = {
MX7D_PAD_UART1_RX_DATA__UART1_DCE_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
};
+static iomux_v3_cfg_t const uart6_pads[] = {
+ MX7D_PAD_EPDC_DATA09__UART6_DCE_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
+ MX7D_PAD_EPDC_DATA08__UART6_DCE_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
+};
+
void setup_iomux_uart(void)
{
imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
+ imx_iomux_v3_setup_multiple_pads(uart6_pads, ARRAY_SIZE(uart6_pads));
}
diff --git a/include/configs/zero-sugar.h b/include/configs/zero-sugar.h
index 6b5450a40d..b517a0ca34 100644
--- a/include/configs/zero-sugar.h
+++ b/include/configs/zero-sugar.h
@@ -17,7 +17,7 @@
#define CONFIG_DBG_MONITOR
#define PHYS_SDRAM_SIZE SZ_1G
-#define CONFIG_MXC_UART_BASE UART1_IPS_BASE_ADDR
+#define CONFIG_MXC_UART_BASE UART6_IPS_BASE_ADDR
/* Size of malloc() pool */
#define CONFIG_SYS_MALLOC_LEN (32 * SZ_1M)
--
2.29.2

View File

@ -0,0 +1,29 @@
From 17b4309091e5000934fa865e2e2712d4b4375157 Mon Sep 17 00:00:00 2001
From: Alistair Francis <alistair@alistair23.me>
Date: Sat, 16 Jan 2021 21:20:13 -0800
Subject: [PATCH 4/9] reMarkable: Change kernel arg to use UART6
Tell the kernel to print the UART output to UART6 which is
accessible via the pogo pins.
Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
include/configs/zero-sugar.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/zero-sugar.h b/include/configs/zero-sugar.h
index b517a0ca34..6b21980288 100644
--- a/include/configs/zero-sugar.h
+++ b/include/configs/zero-sugar.h
@@ -115,7 +115,7 @@
#define CONFIG_EXTRA_ENV_SETTINGS \
"image=/boot/zImage\0" \
- "console=ttymxc0\0" \
+ "console=ttymxc5\0" \
"fdt_file=/boot/zero-sugar.dtb\0" \
"fdt_addr=0x83000000\0" \
"ip_dyn=yes\0" \
--
2.29.2

View File

@ -0,0 +1,28 @@
From 5884360d6c8dd2c6294ec20b50e442127be56224 Mon Sep 17 00:00:00 2001
From: Alistair Francis <alistair@alistair23.me>
Date: Sat, 16 Jan 2021 21:19:48 -0800
Subject: [PATCH 5/9] reMarkable: Hard code boot addresses
The original addresses didn't work correctly, let's just hard code some.
Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
include/configs/zero-sugar.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/zero-sugar.h b/include/configs/zero-sugar.h
index 6b21980288..3384e0b09d 100644
--- a/include/configs/zero-sugar.h
+++ b/include/configs/zero-sugar.h
@@ -146,7 +146,7 @@
"g_mass_storage.stall=0 g_mass_storage.removable=1 " \
"g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\
"g_mass_storage.iSerialNumber=\"\" rdinit=/linuxrc; "\
- "bootz ${loadaddr} ${initrd} ${fdt_addr};\0" \
+ "bootz 0x80800000 0x83800000 0x83000000\0" \
"altbootcmd=echo Running from fallback root...; " \
"run memboot; " \
"if test ${bootcount} -gt 10; then " \
--
2.29.2

View File

@ -0,0 +1,74 @@
From a2af6b8aaecd6d34603a81c9cb8867e340e9adb1 Mon Sep 17 00:00:00 2001
From: Alistair Francis <alistair@alistair23.me>
Date: Mon, 18 Jan 2021 16:17:13 -0800
Subject: [PATCH 6/9] reMarkable: Don't load data from uboot.env
Ensure that we use out arguments intead of ones loaded from the FAT
partition.
Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
configs/zero-sugar_defconfig | 6 ------
include/configs/zero-sugar.h | 7 +------
2 files changed, 1 insertion(+), 12 deletions(-)
diff --git a/configs/zero-sugar_defconfig b/configs/zero-sugar_defconfig
index 4bb6841ea4..6105eeced9 100644
--- a/configs/zero-sugar_defconfig
+++ b/configs/zero-sugar_defconfig
@@ -16,7 +16,6 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="rM> "
CONFIG_FASTBOOT=y
-CONFIG_FAT_WRITE=y
CONFIG_FSL_FASTBOOT=y
CONFIG_FASTBOOT_BUF_ADDR=0x83800000
CONFIG_FASTBOOT_BUF_SIZE=0x40000000
@@ -45,14 +44,9 @@ CONFIG_CMD_EXT2=y
CONFIG_CMD_EXT4=y
CONFIG_CMD_EXT4_WRITE=y
CONFIG_CMD_FAT=y
-CONFIG_CMD_SAVEENV=y
CONFIG_EFI_PARTITION=y
CONFIG_OF_CONTROL=y
-CONFIG_ENV_IS_IN_FAT=y
# CONFIG_ENV_IS_IN_MMC is not set
-CONFIG_ENV_FAT_INTERFACE="mmc"
-CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
-CONFIG_ENV_FAT_ENV_FILE="uboot.env"
CONFIG_DFU_MMC=y
CONFIG_DFU_RAM=y
CONFIG_DM_GPIO=y
diff --git a/include/configs/zero-sugar.h b/include/configs/zero-sugar.h
index 3384e0b09d..ee179e9d2e 100644
--- a/include/configs/zero-sugar.h
+++ b/include/configs/zero-sugar.h
@@ -152,7 +152,6 @@
"if test ${bootcount} -gt 10; then " \
"echo WARN: Failed too much, resetting bootcount and turning off; " \
"setenv bootcount 0; " \
- "saveenv; " \
"poweroff; " \
"fi; " \
"setenv mmcpart ${fallback_partition}; " \
@@ -164,16 +163,12 @@
/* Always try to boot from memory first, in case of USB download mode */
#define CONFIG_BOOTCOMMAND \
- "if test ! -e mmc 0:1 uboot.env; then " \
- "saveenv; " \
- "fi; " \
+ "echo Start; " \
"run memboot; " \
"run mmcargs; " \
"setenv mmcpart ${active_partition}; " \
"run mmcboot; " \
"echo WARN: unable to boot from either RAM or eMMC; " \
- "setenv upgrade_available 1; " \
- "saveenv; " \
"reset; "
#define CONFIG_SYS_MEMTEST_START 0x80000000
--
2.29.2

View File

@ -0,0 +1,26 @@
From 59a1c50896a079de7bebeadff57d2b39f429510c Mon Sep 17 00:00:00 2001
From: Alistair Francis <alistair@alistair23.me>
Date: Mon, 18 Jan 2021 16:19:13 -0800
Subject: [PATCH 7/9] HACK: Always autoboot
Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
common/autoboot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/autoboot.c b/common/autoboot.c
index d057013cc1..f80ea15ab9 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -271,7 +271,7 @@ static int abortboot(int bootdelay)
gd->flags &= ~GD_FLG_SILENT;
#endif
- return abort;
+ return 0;
}
static void process_fdt_options(const void *blob)
--
2.29.2

View File

@ -0,0 +1,44 @@
From fa6cd5c728e9b955acbf2f041c8da393180c4e61 Mon Sep 17 00:00:00 2001
From: Alistair Francis <alistair@alistair23.me>
Date: Mon, 18 Jan 2021 16:20:04 -0800
Subject: [PATCH 8/9] HACK: autoboot: Don't boot from USB
Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
common/autoboot.c | 3 ---
include/configs/zero-sugar.h | 5 +----
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/common/autoboot.c b/common/autoboot.c
index f80ea15ab9..3ae8ee6b3e 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -318,9 +318,6 @@ const char *bootdelay_process(void)
bootdelay = 1;
set_default_env("Use default environment for \
mfgtools\n");
- } else if (is_boot_from_usb()) {
- printf("Boot from USB for uuu\n");
- env_set("bootcmd", "fastboot 0");
} else {
printf("Normal Boot\n");
}
diff --git a/include/configs/zero-sugar.h b/include/configs/zero-sugar.h
index ee179e9d2e..ccf245c122 100644
--- a/include/configs/zero-sugar.h
+++ b/include/configs/zero-sugar.h
@@ -142,10 +142,7 @@
"fi; " \
"fi;\0" \
"memboot=echo Booting from memory...; " \
- "setenv bootargs console=${console},${baudrate} " \
- "g_mass_storage.stall=0 g_mass_storage.removable=1 " \
- "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\
- "g_mass_storage.iSerialNumber=\"\" rdinit=/linuxrc; "\
+ "setenv bootargs console=${console},${baudrate}; " \
"bootz 0x80800000 0x83800000 0x83000000\0" \
"altbootcmd=echo Running from fallback root...; " \
"run memboot; " \
--
2.29.2

View File

@ -0,0 +1,26 @@
From d56c978912f192068f4cc3dede73d647745ef63d Mon Sep 17 00:00:00 2001
From: Alistair Francis <alistair@alistair23.me>
Date: Mon, 18 Jan 2021 16:29:59 -0800
Subject: [PATCH 9/9] HACK: reMarkable: Use initramfs
Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
include/configs/zero-sugar.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/zero-sugar.h b/include/configs/zero-sugar.h
index ccf245c122..d6badbb15d 100644
--- a/include/configs/zero-sugar.h
+++ b/include/configs/zero-sugar.h
@@ -142,7 +142,7 @@
"fi; " \
"fi;\0" \
"memboot=echo Booting from memory...; " \
- "setenv bootargs console=${console},${baudrate}; " \
+ "setenv bootargs console=${console},${baudrate} root=/dev/ram0; " \
"bootz 0x80800000 0x83800000 0x83000000\0" \
"altbootcmd=echo Running from fallback root...; " \
"run memboot; " \
--
2.29.2

View File

@ -0,0 +1,33 @@
DESCRIPTION = "U-Boot for reMarkble2"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6"
require recipes-bsp/u-boot/u-boot.inc
PV = "2018.03+git${SRCPV}"
SRCREV = "47c91918aa7724c16b6eaf87cf5dfbf4548eafc1"
SRCBRANCH = "zero-sugar"
SRC_URI = "git://github.com/reMarkable/uboot.git;branch=${SRCBRANCH} \
file://0001-Remove-redundant-YYLOC-global-declaration.patch \
file://0002-dtc-lexer.lex.c_shipped-Remove-redundant-YYLOC-globa.patch \
file://0003-reMarkable-Print-output-to-pogo-pins.patch \
file://0004-reMarkable-Change-kernel-arg-to-use-UART6.patch \
file://0005-reMarkable-Hard-code-boot-addresses.patch \
file://0006-reMarkable-Don-t-load-data-from-uboot.env.patch \
file://0007-HACK-Always-autoboot.patch \
file://0008-HACK-autoboot-Don-t-boot-from-USB.patch \
file://0009-HACK-reMarkable-Use-initramfs.patch \
"
S = "${WORKDIR}/git"
B = "${WORKDIR}/build"
PACKAGE_ARCH = "${MACHINE_ARCH}"
DEPENDS += "bison-native"
PROVIDES += "u-boot"
BOOT_TOOLS = "imx-boot-tools"
COMPATIBLE_MACHINE = "(imx7d-remarkable2)"