Skip to content

Commit

Permalink
uboot-mediatek: update to version 2022.01
Browse files Browse the repository at this point in the history
Tested on BananaPi R2 (SD, eMMC), BananaPi R64 (SD, eMMC, SPI-NAND) and
UniElec U7623-02 (eMMC).

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  • Loading branch information
dangowrt committed Jan 23, 2022
1 parent f5278bf commit 145d896
Show file tree
Hide file tree
Showing 21 changed files with 62 additions and 111 deletions.
4 changes: 2 additions & 2 deletions package/boot/uboot-mediatek/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_VERSION:=2021.10
PKG_HASH:=cde723e19262e646f2670d25e5ec4b1b368490de950d4e26275a988c36df0bd4
PKG_VERSION:=2022.01
PKG_HASH:=81b4543227db228c03f8a1bf5ddbc813b0bb8f6555ce46064ef721a6fc680413
PKG_BUILD_DEPENDS:=arm-trusted-firmware-tools/host

include $(INCLUDE_DIR)/u-boot.mk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This reverts commit 5c5992cb90cf9ca4d51e38d9a95a13c293904df5.

--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -87,7 +87,7 @@ static int clk_get_by_index_tail(int ret
@@ -88,7 +88,7 @@ static int clk_get_by_index_tail(int ret
if (ret) {
debug("%s: uclass_get_device_by_of_offset failed: err=%d\n",
__func__, ret);
Expand All @@ -19,7 +19,7 @@ This reverts commit 5c5992cb90cf9ca4d51e38d9a95a13c293904df5.
}

clk->dev = dev_clk;
@@ -100,15 +100,14 @@ static int clk_get_by_index_tail(int ret
@@ -101,15 +101,14 @@ static int clk_get_by_index_tail(int ret
ret = clk_of_xlate_default(clk, args);
if (ret) {
debug("of_xlate() failed: %d\n", ret);
Expand All @@ -37,7 +37,7 @@ This reverts commit 5c5992cb90cf9ca4d51e38d9a95a13c293904df5.
}

static int clk_get_by_indexed_prop(struct udevice *dev, const char *prop_name,
@@ -127,7 +126,7 @@ static int clk_get_by_indexed_prop(struc
@@ -128,7 +127,7 @@ static int clk_get_by_indexed_prop(struc
if (ret) {
debug("%s: fdtdec_parse_phandle_with_args failed: err=%d\n",
__func__, ret);
Expand All @@ -46,15 +46,15 @@ This reverts commit 5c5992cb90cf9ca4d51e38d9a95a13c293904df5.
}


@@ -502,7 +501,6 @@ int clk_free(struct clk *clk)
@@ -501,7 +500,6 @@ int clk_free(struct clk *clk)
ulong clk_get_rate(struct clk *clk)
{
const struct clk_ops *ops;
- int ret;

debug("%s(clk=%p)\n", __func__, clk);
if (!clk_valid(clk))
@@ -512,11 +510,7 @@ ulong clk_get_rate(struct clk *clk)
@@ -511,11 +509,7 @@ ulong clk_get_rate(struct clk *clk)
if (!ops->get_rate)
return -ENOSYS;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

--- a/include/configs/mt7622.h
+++ b/include/configs/mt7622.h
@@ -36,6 +36,7 @@
@@ -30,6 +30,7 @@

/* Ethernet */
#define CONFIG_IPADDR 192.168.1.1
Expand All @@ -25,7 +25,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
#endif
--- a/include/configs/mt7623.h
+++ b/include/configs/mt7623.h
@@ -54,6 +54,7 @@
@@ -45,6 +45,7 @@
/* Ethernet */
#define CONFIG_IPADDR 192.168.1.1
#define CONFIG_SERVERIP 192.168.1.2
Expand All @@ -35,7 +35,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

--- a/include/configs/mt7629.h
+++ b/include/configs/mt7629.h
@@ -52,5 +52,6 @@
@@ -45,5 +45,6 @@
/* Ethernet */
#define CONFIG_IPADDR 192.168.1.1
#define CONFIG_SERVERIP 192.168.1.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -109,6 +109,8 @@ config HBMC_AM654
This is the driver for HyperBus controller on TI's AM65x and
other SoCs
@@ -116,6 +116,8 @@ config STM32_FLASH
This is the driver of embedded flash for some STMicroelectronics
STM32 MCU.

+source "drivers/mtd/mtk-snand/Kconfig"
+
source "drivers/mtd/nand/Kconfig"

source "drivers/mtd/spi/Kconfig"
config SYS_NAND_MAX_CHIPS
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -39,3 +39,5 @@ obj-$(CONFIG_$(SPL_TPL_)SPI_FLASH_SUPPOR
Expand Down Expand Up @@ -1145,7 +1145,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
+}
--- /dev/null
+++ b/drivers/mtd/mtk-snand/mtk-snand-mtd.c
@@ -0,0 +1,526 @@
@@ -0,0 +1,524 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
Expand Down Expand Up @@ -1225,9 +1225,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
+ else
+ instr->state = MTD_ERASE_DONE;
+
+ if (!ret)
+ mtd_erase_callback(instr);
+ else
+ if (ret)
+ ret = -EIO;
+
+ return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -50,6 +50,7 @@ DECLARE_GLOBAL_DATA_PTR;
@@ -48,6 +48,7 @@ DECLARE_GLOBAL_DATA_PTR;
defined(CONFIG_ENV_IS_IN_MMC) || \
defined(CONFIG_ENV_IS_IN_FAT) || \
defined(CONFIG_ENV_IS_IN_EXT4) || \
+ defined(CONFIG_ENV_IS_IN_MTD) || \
defined(CONFIG_ENV_IS_IN_NAND) || \
defined(CONFIG_ENV_IS_IN_NVRAM) || \
defined(CONFIG_ENV_IS_IN_ONENAND) || \
@@ -64,7 +65,7 @@ DECLARE_GLOBAL_DATA_PTR;
@@ -62,7 +63,7 @@ DECLARE_GLOBAL_DATA_PTR;

#if !defined(ENV_IS_IN_DEVICE) && \
!defined(CONFIG_ENV_IS_NOWHERE)
Expand All @@ -47,7 +47,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
help
Define this if you don't want to or can't have an environment stored
on a storage medium. In this case the environment will still exist
@@ -207,6 +207,27 @@ config ENV_IS_IN_MMC
@@ -208,6 +208,27 @@ config ENV_IS_IN_MMC
This value is also in units of bytes, but must also be aligned to
an MMC sector boundary.

Expand Down Expand Up @@ -75,7 +75,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
config ENV_IS_IN_NAND
bool "Environment in a NAND device"
depends on !CHAIN_OF_TRUST
@@ -534,10 +555,16 @@ config ENV_ADDR_REDUND
@@ -535,10 +556,16 @@ config ENV_ADDR_REDUND
Offset from the start of the device (or partition) of the redundant
environment location.

Expand All @@ -93,7 +93,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
default 0x3f8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC
default 0x140000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH
default 0x88000 if ARCH_SUNXI
@@ -582,6 +609,12 @@ config ENV_SECT_SIZE
@@ -583,6 +610,12 @@ config ENV_SECT_SIZE
help
Size of the sector containing the environment.

Expand Down Expand Up @@ -389,7 +389,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
+};
--- a/include/env_internal.h
+++ b/include/env_internal.h
@@ -131,6 +131,7 @@ enum env_location {
@@ -130,6 +130,7 @@ enum env_location {
ENVL_FAT,
ENVL_FLASH,
ENVL_MMC,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,49 +85,6 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
snor: snor@11014000 {
compatible = "mediatek,mtk-snor";
reg = <0x11014000 0x1000>;
--- a/board/mediatek/mt7629/Kconfig
+++ b/board/mediatek/mt7629/Kconfig
@@ -12,6 +12,39 @@ config MTK_SPL_PAD_SIZE

config MTK_BROM_HEADER_INFO
string
- default "media=nor"
+ default "media=nor" if BOOT_FROM_SNOR
+ default "media=snand;nandinfo=2k+64" if BOOT_FROM_SNAND_2K_64
+ default "media=snand;nandinfo=2k+128" if BOOT_FROM_SNAND_2K_128
+ default "media=snand;nandinfo=4k+128" if BOOT_FROM_SNAND_4K_128
+ default "media=snand;nandinfo=4k+256" if BOOT_FROM_SNAND_4K_256
+
+choice
+ prompt "Boot device"
+ default BOOT_FROM_SNOR
+
+config BOOT_FROM_SNOR
+ bool "SPI-NOR"
+
+config BOOT_FROM_SNAND_2K_64
+ bool "SPI-NAND (2K+64)"
+ select MT7629_BOOT_FROM_SNAND
+
+config BOOT_FROM_SNAND_2K_128
+ bool "SPI-NAND (2K+128)"
+ select MT7629_BOOT_FROM_SNAND
+
+config BOOT_FROM_SNAND_4K_128
+ bool "SPI-NAND (4K+128)"
+ select MT7629_BOOT_FROM_SNAND
+
+config BOOT_FROM_SNAND_4K_256
+ bool "SPI-NAND (4K+256)"
+ select MT7629_BOOT_FROM_SNAND
+
+endchoice
+
+config MT7629_BOOT_FROM_SNAND
+ bool
+ default n

endif
--- /dev/null
+++ b/configs/mt7629_nand_rfb_defconfig
@@ -0,0 +1,111 @@
Expand Down Expand Up @@ -244,7 +201,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
+# CONFIG_EFI_LOADER is not set
--- a/include/configs/mt7629.h
+++ b/include/configs/mt7629.h
@@ -30,12 +30,19 @@
@@ -25,12 +25,19 @@

/* Defines for SPL */
#define CONFIG_SPL_STACK 0x106000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
reg = <0x11014000 0x1000>;
--- a/configs/mt7622_rfb_defconfig
+++ b/configs/mt7622_rfb_defconfig
@@ -15,6 +15,7 @@ CONFIG_LOG=y
@@ -16,6 +16,7 @@ CONFIG_LOG=y
CONFIG_SYS_PROMPT="MT7622> "
CONFIG_CMD_BOOTMENU=y
CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
CONFIG_CMD_PCI=y
CONFIG_CMD_SF_TEST=y
CONFIG_CMD_PING=y
@@ -27,6 +28,10 @@ CONFIG_SYSCON=y
@@ -28,6 +29,10 @@ CONFIG_SYSCON=y
CONFIG_CLK=y
CONFIG_MMC_HS200_SUPPORT=y
CONFIG_MMC_MTK=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

--- a/configs/mt7629_rfb_defconfig
+++ b/configs/mt7629_rfb_defconfig
@@ -28,9 +28,14 @@ CONFIG_SPL_WATCHDOG=y
@@ -29,9 +29,14 @@ CONFIG_SPL_WATCHDOG=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="U-Boot> "
CONFIG_CMD_BOOTMENU=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
CONFIG_DEBUG_UART_BASE=0x11002000
CONFIG_DEBUG_UART_CLOCK=25000000
CONFIG_DEBUG_UART=y
@@ -21,6 +23,9 @@ CONFIG_CMD_SF_TEST=y
@@ -22,6 +24,9 @@ CONFIG_CMD_SF_TEST=y
CONFIG_CMD_PING=y
CONFIG_CMD_SMC=y
CONFIG_ENV_OVERWRITE=y
Expand Down
2 changes: 1 addition & 1 deletion package/boot/uboot-mediatek/patches/110-no-kwbimage.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -118,7 +118,6 @@ dumpimage-mkimage-objs := aisimage.o \
@@ -119,7 +119,6 @@ dumpimage-mkimage-objs := aisimage.o \
imximage.o \
imx8image.o \
imx8mimage.o \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/Makefile
+++ b/Makefile
@@ -1051,7 +1051,7 @@ quiet_cmd_pad_cat = CAT $@
@@ -1045,7 +1045,7 @@ quiet_cmd_pad_cat = CAT $@
cmd_pad_cat = $(cmd_objcopy) && $(append) || { rm -f $@; false; }

quiet_cmd_lzma = LZMA $@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
static int do_iminfo(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1962,6 +1962,51 @@ static const char *fit_get_image_type_pr
--- a/boot/image-fit.c
+++ b/boot/image-fit.c
@@ -1993,6 +1993,51 @@ static const char *fit_get_image_type_pr
return "unknown";
}

Expand Down Expand Up @@ -122,7 +122,7 @@
int arch, int image_type, int bootstage_id,
--- a/include/image.h
+++ b/include/image.h
@@ -996,6 +996,7 @@ int fit_parse_subimage(const char *spec,
@@ -952,6 +952,7 @@ int fit_parse_subimage(const char *spec,
ulong *addr, const char **image_name);

int fit_get_subimage_count(const void *fit, int images_noffset);
Expand Down
10 changes: 5 additions & 5 deletions package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -484,6 +484,12 @@ config CMD_ENV_EXISTS
@@ -483,6 +483,12 @@ config CMD_ENV_EXISTS
Check if a variable is defined in the environment for use in
shell scripting.

Expand All @@ -15,7 +15,7 @@
help
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -473,6 +473,60 @@ int do_env_ask(struct cmd_tbl *cmdtp, in
@@ -408,6 +408,60 @@ int do_env_ask(struct cmd_tbl *cmdtp, in
}
#endif

Expand Down Expand Up @@ -76,7 +76,7 @@
#if defined(CONFIG_CMD_ENV_CALLBACK)
static int print_static_binding(const char *var_name, const char *callback_name,
void *priv)
@@ -1377,6 +1431,9 @@ static struct cmd_tbl cmd_env_sub[] = {
@@ -1189,6 +1243,9 @@ static struct cmd_tbl cmd_env_sub[] = {
U_BOOT_CMD_MKENT(load, 1, 0, do_env_load, "", ""),
#endif
U_BOOT_CMD_MKENT(print, CONFIG_SYS_MAXARGS, 1, do_env_print, "", ""),
Expand All @@ -86,7 +86,7 @@
#if defined(CONFIG_CMD_RUN)
U_BOOT_CMD_MKENT(run, CONFIG_SYS_MAXARGS, 1, do_run, "", ""),
#endif
@@ -1465,6 +1522,9 @@ static char env_help_text[] =
@@ -1277,6 +1334,9 @@ static char env_help_text[] =
#if defined(CONFIG_CMD_NVEDIT_EFI)
"env print -e [-guid guid] [-n] [name ...] - print UEFI environment\n"
#endif
Expand All @@ -96,7 +96,7 @@
#if defined(CONFIG_CMD_RUN)
"env run var [...] - run commands in an environment variable\n"
#endif
@@ -1574,6 +1634,17 @@ U_BOOT_CMD(
@@ -1386,6 +1446,17 @@ U_BOOT_CMD(
);
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
env_relocate();
return 0;
}
--- a/board/mediatek/mt7622/Kconfig
+++ b/board/mediatek/mt7622/Kconfig
@@ -14,4 +14,8 @@ config MTK_BROM_HEADER_INFO
string
default "media=nor"
--- a/arch/arm/mach-mediatek/Kconfig
+++ b/arch/arm/mach-mediatek/Kconfig
@@ -115,4 +115,8 @@ config MTK_BROM_HEADER_INFO
default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183
default "lk=1" if TARGET_MT7623

+config RESET_BUTTON_LABEL
+ string "Button to trigger factory reset"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
--- a/board/mediatek/mt7623/Kconfig
+++ b/board/mediatek/mt7623/Kconfig
@@ -10,4 +10,8 @@ config MTK_BROM_HEADER_INFO
string
default "lk=1"

+config RESET_BUTTON_LABEL
+ string "Button to trigger factory reset"
+ default "reset"
+
endif
--- a/board/mediatek/mt7623/mt7623_rfb.c
+++ b/board/mediatek/mt7623/mt7623_rfb.c
@@ -4,8 +4,17 @@
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/drivers/mtd/spi/spi-nor-ids.c
+++ b/drivers/mtd/spi/spi-nor-ids.c
@@ -353,6 +353,8 @@ const struct flash_info spi_nor_ids[] =
@@ -369,6 +369,8 @@ const struct flash_info spi_nor_ids[] =
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
},
{ INFO("w25q256", 0xef4019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
Expand Down
Loading

0 comments on commit 145d896

Please sign in to comment.