uboot-mediatek: update to v2025.07
Update to the latest version.
Suppressed patch:
  100-04-env-add-support-for-generic-MTD-device.patch[1]
[1] 03fb08d4ae
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
			
			
This commit is contained in:
		| @@ -1,8 +1,8 @@ | ||||
| include $(TOPDIR)/rules.mk | ||||
| include $(INCLUDE_DIR)/kernel.mk | ||||
|  | ||||
| PKG_VERSION:=2025.04 | ||||
| PKG_HASH:=439d3bef296effd54130be6a731c5b118be7fddd7fcc663ccbc5fb18294d8718 | ||||
| PKG_VERSION:=2025.07 | ||||
| PKG_HASH:=0f933f6c5a426895bf306e93e6ac53c60870e4b54cda56d95211bec99e63bec7 | ||||
| PKG_BUILD_DEPENDS:=!(TARGET_ramips||TARGET_mediatek_mt7623):arm-trusted-firmware-tools/host | ||||
|  | ||||
| UBOOT_USE_INTREE_DTC:=1 | ||||
|   | ||||
| @@ -1,390 +0,0 @@ | ||||
| From efc3e6f5d29f87a433b42f15a0b87e04b7cd498d Mon Sep 17 00:00:00 2001 | ||||
| From: Weijie Gao <weijie.gao@mediatek.com> | ||||
| Date: Wed, 3 Mar 2021 10:11:32 +0800 | ||||
| Subject: [PATCH 38/71] env: add support for generic MTD device | ||||
|  | ||||
| Add an env driver for generic MTD device. | ||||
|  | ||||
| Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
| --- | ||||
|  cmd/nvedit.c           |   3 +- | ||||
|  env/Kconfig            |  37 +++++- | ||||
|  env/Makefile           |   1 + | ||||
|  env/env.c              |   3 + | ||||
|  env/mtd.c              | 256 +++++++++++++++++++++++++++++++++++++++++ | ||||
|  include/env_internal.h |   1 + | ||||
|  tools/Makefile         |   1 + | ||||
|  7 files changed, 299 insertions(+), 3 deletions(-) | ||||
|  create mode 100644 env/mtd.c | ||||
|  | ||||
| --- a/env/Kconfig | ||||
| +++ b/env/Kconfig | ||||
| @@ -74,7 +74,7 @@ config ENV_IS_DEFAULT | ||||
|  		     !ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \ | ||||
|  		     !ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \ | ||||
|  		     !ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \ | ||||
| -		     !ENV_IS_IN_UBI | ||||
| +		     !ENV_IS_IN_UBI && !ENV_IS_IN_MTD | ||||
|  	select ENV_IS_NOWHERE | ||||
|   | ||||
|  config ENV_IS_NOWHERE | ||||
| @@ -267,6 +267,27 @@ config ENV_IS_IN_MMC | ||||
|  	  offset: "u-boot,mmc-env-offset", "u-boot,mmc-env-offset-redundant". | ||||
|  	  CONFIG_ENV_OFFSET and CONFIG_ENV_OFFSET_REDUND are not used. | ||||
|   | ||||
| +config ENV_IS_IN_MTD | ||||
| +	bool "Environment in a MTD device" | ||||
| +	depends on !CHAIN_OF_TRUST | ||||
| +	depends on MTD | ||||
| +	help | ||||
| +	  Define this if you have a MTD device which you want to use for | ||||
| +	  the environment. | ||||
| + | ||||
| +	  - CONFIG_ENV_MTD_NAME: | ||||
| +	  - CONFIG_ENV_OFFSET: | ||||
| +	  - CONFIG_ENV_SIZE: | ||||
| + | ||||
| +	  These three #defines specify the MTD device where the environment | ||||
| +	  is stored, offset and size of the environment area within the MTD | ||||
| +	  device. CONFIG_ENV_OFFSET must be aligned to an erase block boundary. | ||||
| + | ||||
| +	  - CONFIG_ENV_SIZE_REDUND: | ||||
| + | ||||
| +	  This #define specify the maximum size allowed for read/write/erase | ||||
| +	  with skipped bad blocks starting from ENV_OFFSET. | ||||
| + | ||||
|  config ENV_IS_IN_NAND | ||||
|  	bool "Environment in a NAND device" | ||||
|  	depends on !CHAIN_OF_TRUST | ||||
| @@ -574,10 +595,16 @@ config ENV_ADDR_REDUND | ||||
|  	  Offset from the start of the device (or partition) of the redundant | ||||
|  	  environment location. | ||||
|   | ||||
| +config ENV_MTD_NAME | ||||
| +	string "Name of the MTD device storing the environment" | ||||
| +	depends on ENV_IS_IN_MTD | ||||
| +	help | ||||
| +	  Name of the MTD device that stores the environment | ||||
| + | ||||
|  config ENV_OFFSET | ||||
|  	hex "Environment offset" | ||||
|  	depends on ENV_IS_IN_EEPROM || ENV_IS_IN_MMC || ENV_IS_IN_NAND || \ | ||||
| -		    ENV_IS_IN_SPI_FLASH | ||||
| +		    ENV_IS_IN_SPI_FLASH || ENV_IS_IN_MTD | ||||
|  	default 0x3f8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC | ||||
|  	default 0x140000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH | ||||
|  	default 0xF0000 if ARCH_SUNXI | ||||
| @@ -635,6 +662,12 @@ config ENV_SECT_SIZE | ||||
|  	help | ||||
|  	  Size of the sector containing the environment. | ||||
|   | ||||
| +config ENV_SIZE_REDUND | ||||
| +	hex "Redundant environment size" | ||||
| +	depends on ENV_IS_IN_MTD | ||||
| +	help | ||||
| +	  The maximum size allowed for read/write/erase with skipped bad blocks. | ||||
| + | ||||
|  config ENV_UBI_PART | ||||
|  	string "UBI partition name" | ||||
|  	depends on ENV_IS_IN_UBI | ||||
| --- a/env/Makefile | ||||
| +++ b/env/Makefile | ||||
| @@ -24,6 +24,7 @@ obj-$(CONFIG_$(PHASE_)ENV_IS_NOWHERE) += | ||||
|  obj-$(CONFIG_$(PHASE_)ENV_IS_IN_MMC) += mmc.o | ||||
|  obj-$(CONFIG_$(PHASE_)ENV_IS_IN_FAT) += fat.o | ||||
|  obj-$(CONFIG_$(PHASE_)ENV_IS_IN_EXT4) += ext4.o | ||||
| +obj-$(CONFIG_$(PHASE_)ENV_IS_IN_MTD) += mtd.o | ||||
|  obj-$(CONFIG_$(PHASE_)ENV_IS_IN_NAND) += nand.o | ||||
|  obj-$(CONFIG_$(PHASE_)ENV_IS_IN_SPI_FLASH) += sf.o | ||||
|  obj-$(CONFIG_$(PHASE_)ENV_IS_IN_FLASH) += flash.o | ||||
| --- a/env/env.c | ||||
| +++ b/env/env.c | ||||
| @@ -46,6 +46,9 @@ static enum env_location env_locations[] | ||||
|  #ifdef CONFIG_ENV_IS_IN_MMC | ||||
|  	ENVL_MMC, | ||||
|  #endif | ||||
| +#ifdef CONFIG_ENV_IS_IN_MTD | ||||
| +	ENVL_MTD, | ||||
| +#endif | ||||
|  #ifdef CONFIG_ENV_IS_IN_NAND | ||||
|  	ENVL_NAND, | ||||
|  #endif | ||||
| --- /dev/null | ||||
| +++ b/env/mtd.c | ||||
| @@ -0,0 +1,256 @@ | ||||
| +/* SPDX-License-Identifier: GPL-2.0 */ | ||||
| +/* | ||||
| + * Copyright (C) 2021 MediaTek Inc. All Rights Reserved. | ||||
| + * | ||||
| + * Author: Weijie Gao <weijie.gao@mediatek.com> | ||||
| + */ | ||||
| + | ||||
| +#include <command.h> | ||||
| +#include <env.h> | ||||
| +#include <env_internal.h> | ||||
| +#include <errno.h> | ||||
| +#include <linux/kernel.h> | ||||
| +#include <linux/stddef.h> | ||||
| +#include <linux/types.h> | ||||
| +#include <linux/mtd/mtd.h> | ||||
| +#include <malloc.h> | ||||
| +#include <memalign.h> | ||||
| +#include <mtd.h> | ||||
| +#include <search.h> | ||||
| + | ||||
| +#if CONFIG_ENV_SIZE_REDUND < CONFIG_ENV_SIZE | ||||
| +#undef CONFIG_ENV_SIZE_REDUND | ||||
| +#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE | ||||
| +#endif | ||||
| + | ||||
| +#if defined(ENV_IS_EMBEDDED) | ||||
| +env_t *env_ptr = &environment; | ||||
| +#else /* ! ENV_IS_EMBEDDED */ | ||||
| +env_t *env_ptr; | ||||
| +#endif /* ENV_IS_EMBEDDED */ | ||||
| + | ||||
| +DECLARE_GLOBAL_DATA_PTR; | ||||
| + | ||||
| +static int env_mtd_init(void) | ||||
| +{ | ||||
| +#if defined(ENV_IS_EMBEDDED) | ||||
| +	int crc1_ok = 0, crc2_ok = 0; | ||||
| +	env_t *tmp_env1; | ||||
| + | ||||
| +	tmp_env1 = env_ptr; | ||||
| +	crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc; | ||||
| + | ||||
| +	if (!crc1_ok && !crc2_ok) { | ||||
| +		gd->env_addr	= 0; | ||||
| +		gd->env_valid	= ENV_INVALID; | ||||
| + | ||||
| +		return 0; | ||||
| +	} else if (crc1_ok && !crc2_ok) { | ||||
| +		gd->env_valid = ENV_VALID; | ||||
| +	} | ||||
| + | ||||
| +	if (gd->env_valid == ENV_VALID) | ||||
| +		env_ptr = tmp_env1; | ||||
| + | ||||
| +	gd->env_addr = (ulong)env_ptr->data; | ||||
| + | ||||
| +#else /* ENV_IS_EMBEDDED */ | ||||
| +	gd->env_addr	= (ulong)&default_environment[0]; | ||||
| +	gd->env_valid	= ENV_VALID; | ||||
| +#endif /* ENV_IS_EMBEDDED */ | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static struct mtd_info *env_mtd_get_dev(void) | ||||
| +{ | ||||
| +	struct mtd_info *mtd; | ||||
| + | ||||
| +	mtd_probe_devices(); | ||||
| + | ||||
| +	mtd = get_mtd_device_nm(CONFIG_ENV_MTD_NAME); | ||||
| +	if (IS_ERR(mtd) || !mtd) { | ||||
| +		printf("MTD device '%s' not found\n", CONFIG_ENV_MTD_NAME); | ||||
| +		return NULL; | ||||
| +	} | ||||
| + | ||||
| +	return mtd; | ||||
| +} | ||||
| + | ||||
| +static inline bool mtd_addr_is_block_aligned(struct mtd_info *mtd, u64 addr) | ||||
| +{ | ||||
| +	return (addr & mtd->erasesize_mask) == 0; | ||||
| +} | ||||
| + | ||||
| +static int mtd_io_skip_bad(struct mtd_info *mtd, bool read, loff_t offset, | ||||
| +			   size_t length, size_t redund, u8 *buffer) | ||||
| +{ | ||||
| +	struct mtd_oob_ops io_op = {}; | ||||
| +	size_t remaining = length; | ||||
| +	loff_t off, end; | ||||
| +	int ret; | ||||
| + | ||||
| +	io_op.mode = MTD_OPS_PLACE_OOB; | ||||
| +	io_op.len = mtd->writesize; | ||||
| +	io_op.datbuf = (void *)buffer; | ||||
| + | ||||
| +	/* Search for the first good block after the given offset */ | ||||
| +	off = offset; | ||||
| +	end = (off + redund) | (mtd->erasesize - 1); | ||||
| +	while (mtd_block_isbad(mtd, off) && off < end) | ||||
| +		off += mtd->erasesize; | ||||
| + | ||||
| +	/* Reached end position */ | ||||
| +	if (off >= end) | ||||
| +		return -EIO; | ||||
| + | ||||
| +	/* Loop over the pages to do the actual read/write */ | ||||
| +	while (remaining) { | ||||
| +		/* Skip the block if it is bad */ | ||||
| +		if (mtd_addr_is_block_aligned(mtd, off) && | ||||
| +		    mtd_block_isbad(mtd, off)) { | ||||
| +			off += mtd->erasesize; | ||||
| +			continue; | ||||
| +		} | ||||
| + | ||||
| +		if (read) | ||||
| +			ret = mtd_read_oob(mtd, off, &io_op); | ||||
| +		else | ||||
| +			ret = mtd_write_oob(mtd, off, &io_op); | ||||
| + | ||||
| +		if (ret) { | ||||
| +			printf("Failure while %s at offset 0x%llx\n", | ||||
| +			       read ? "reading" : "writing", off); | ||||
| +			break; | ||||
| +		} | ||||
| + | ||||
| +		off += io_op.retlen; | ||||
| +		remaining -= io_op.retlen; | ||||
| +		io_op.datbuf += io_op.retlen; | ||||
| +		io_op.oobbuf += io_op.oobretlen; | ||||
| + | ||||
| +		/* Reached end position */ | ||||
| +		if (off >= end) | ||||
| +			return -EIO; | ||||
| +	} | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +#ifdef CONFIG_CMD_SAVEENV | ||||
| +static int mtd_erase_skip_bad(struct mtd_info *mtd, loff_t offset, | ||||
| +			      size_t length, size_t redund) | ||||
| +{ | ||||
| +	struct erase_info erase_op = {}; | ||||
| +	loff_t end = (offset + redund) | (mtd->erasesize - 1); | ||||
| +	int ret; | ||||
| + | ||||
| +	erase_op.mtd = mtd; | ||||
| +	erase_op.addr = offset; | ||||
| +	erase_op.len = length; | ||||
| + | ||||
| +	while (erase_op.len) { | ||||
| +		ret = mtd_erase(mtd, &erase_op); | ||||
| + | ||||
| +		/* Abort if its not a bad block error */ | ||||
| +		if (ret != -EIO) | ||||
| +			return ret; | ||||
| + | ||||
| +		printf("Skipping bad block at 0x%08llx\n", erase_op.fail_addr); | ||||
| + | ||||
| +		/* Skip bad block and continue behind it */ | ||||
| +		erase_op.len -= erase_op.fail_addr - erase_op.addr; | ||||
| +		erase_op.len -= mtd->erasesize; | ||||
| +		erase_op.addr = erase_op.fail_addr + mtd->erasesize; | ||||
| + | ||||
| +		/* Reached end position */ | ||||
| +		if (erase_op.addr >= end) | ||||
| +			return -EIO; | ||||
| +	} | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static int env_mtd_save(void) | ||||
| +{ | ||||
| +	ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1); | ||||
| +	struct mtd_info *mtd; | ||||
| +	int ret = 0; | ||||
| + | ||||
| +	ret = env_export(env_new); | ||||
| +	if (ret) | ||||
| +		return ret; | ||||
| + | ||||
| +	mtd = env_mtd_get_dev(); | ||||
| +	if (!mtd) | ||||
| +		return 1; | ||||
| + | ||||
| +	printf("Erasing on MTD device '%s'... ", mtd->name); | ||||
| + | ||||
| +	ret = mtd_erase_skip_bad(mtd, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, | ||||
| +				 CONFIG_ENV_SIZE_REDUND); | ||||
| + | ||||
| +	puts(ret ? "FAILED\n" : "OK\n"); | ||||
| + | ||||
| +	if (ret) { | ||||
| +		put_mtd_device(mtd); | ||||
| +		return 1; | ||||
| +	} | ||||
| + | ||||
| +	printf("Writing to MTD device '%s'... ", mtd->name); | ||||
| + | ||||
| +	ret = mtd_io_skip_bad(mtd, false, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, | ||||
| +			      CONFIG_ENV_SIZE_REDUND, (u8 *)env_new); | ||||
| + | ||||
| +	puts(ret ? "FAILED\n" : "OK\n"); | ||||
| + | ||||
| +	put_mtd_device(mtd); | ||||
| + | ||||
| +	return !!ret; | ||||
| +} | ||||
| +#endif /* CONFIG_CMD_SAVEENV */ | ||||
| + | ||||
| +static int readenv(size_t offset, u_char *buf) | ||||
| +{ | ||||
| +	struct mtd_info *mtd; | ||||
| +	int ret; | ||||
| + | ||||
| +	mtd = env_mtd_get_dev(); | ||||
| +	if (!mtd) | ||||
| +		return 1; | ||||
| + | ||||
| +	ret = mtd_io_skip_bad(mtd, true, offset, CONFIG_ENV_SIZE, | ||||
| +			      CONFIG_ENV_SIZE_REDUND, buf); | ||||
| + | ||||
| +	put_mtd_device(mtd); | ||||
| + | ||||
| +	return !!ret; | ||||
| +} | ||||
| + | ||||
| +static int env_mtd_load(void) | ||||
| +{ | ||||
| +#if !defined(ENV_IS_EMBEDDED) | ||||
| +	ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE); | ||||
| +	int ret; | ||||
| + | ||||
| +	ret = readenv(CONFIG_ENV_OFFSET, (u_char *)buf); | ||||
| +	if (ret) { | ||||
| +		env_set_default("readenv() failed", 0); | ||||
| +		return -EIO; | ||||
| +	} | ||||
| + | ||||
| +	return env_import(buf, 1, H_EXTERNAL); | ||||
| +#endif /* ! ENV_IS_EMBEDDED */ | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +U_BOOT_ENV_LOCATION(mtd) = { | ||||
| +	.location	= ENVL_MTD, | ||||
| +	ENV_NAME("MTD") | ||||
| +	.load		= env_mtd_load, | ||||
| +#if defined(CONFIG_CMD_SAVEENV) | ||||
| +	.save		= env_save_ptr(env_mtd_save), | ||||
| +#endif | ||||
| +	.init		= env_mtd_init, | ||||
| +}; | ||||
| --- a/include/env_internal.h | ||||
| +++ b/include/env_internal.h | ||||
| @@ -108,6 +108,7 @@ enum env_location { | ||||
|  	ENVL_FAT, | ||||
|  	ENVL_FLASH, | ||||
|  	ENVL_MMC, | ||||
| +	ENVL_MTD, | ||||
|  	ENVL_NAND, | ||||
|  	ENVL_NVRAM, | ||||
|  	ENVL_ONENAND, | ||||
| --- a/tools/Makefile | ||||
| +++ b/tools/Makefile | ||||
| @@ -37,6 +37,7 @@ subdir-$(HOST_TOOLS_ALL) += gdb | ||||
|  ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y | ||||
|  ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y | ||||
|  ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y | ||||
| +ENVCRC-$(CONFIG_ENV_IS_IN_MTD) = y | ||||
|  ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y | ||||
|  ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y | ||||
|  ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y | ||||
| @@ -13,7 +13,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  | ||||
| --- a/common/board_r.c | ||||
| +++ b/common/board_r.c | ||||
| @@ -378,6 +378,20 @@ static int initr_nand(void) | ||||
| @@ -399,6 +399,20 @@ static int initr_nand(void) | ||||
|  } | ||||
|  #endif | ||||
|   | ||||
| @@ -34,13 +34,13 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  #if defined(CONFIG_CMD_ONENAND) | ||||
|  /* go init the NAND */ | ||||
|  static int initr_onenand(void) | ||||
| @@ -693,6 +707,9 @@ static init_fnc_t init_sequence_r[] = { | ||||
|  #ifdef CONFIG_CMD_ONENAND | ||||
|  	initr_onenand, | ||||
| @@ -718,6 +732,9 @@ static void initcall_run_r(void) | ||||
|  #if CONFIG_IS_ENABLED(CMD_ONENAND) | ||||
|  	INITCALL(initr_onenand); | ||||
|  #endif | ||||
| +#ifdef CONFIG_NMBM_MTD | ||||
| +	initr_nmbm, | ||||
| +#if CONFIG_IS_ENABLED(NMBM_MTD) | ||||
| +	INITCALL(initr_nmbm); | ||||
| +#endif | ||||
|  #ifdef CONFIG_MMC | ||||
|  	initr_mmc, | ||||
|  #if CONFIG_IS_ENABLED(MMC) | ||||
|  	INITCALL(initr_mmc); | ||||
|  #endif | ||||
|   | ||||
| @@ -15,7 +15,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  | ||||
| --- a/cmd/Kconfig | ||||
| +++ b/cmd/Kconfig | ||||
| @@ -1525,6 +1525,12 @@ config CMD_NAND_WATCH | ||||
| @@ -1535,6 +1535,12 @@ config CMD_NAND_WATCH | ||||
|   | ||||
|  endif # CMD_NAND | ||||
|   | ||||
|   | ||||
| @@ -27,7 +27,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  	select ENV_IS_NOWHERE | ||||
|   | ||||
|  config ENV_IS_NOWHERE | ||||
| @@ -318,6 +318,21 @@ config ENV_IS_IN_NAND | ||||
| @@ -297,6 +297,21 @@ config ENV_IS_IN_NAND | ||||
|  	  Currently, CONFIG_ENV_OFFSET_REDUND is not supported when | ||||
|  	  using CONFIG_ENV_OFFSET_OOB. | ||||
|   | ||||
| @@ -49,7 +49,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  config ENV_RANGE | ||||
|  	hex "Length of the region in which the environment can be written" | ||||
|  	depends on ENV_IS_IN_NAND | ||||
| @@ -604,7 +619,7 @@ config ENV_MTD_NAME | ||||
| @@ -596,7 +611,7 @@ config ENV_ADDR_REDUND | ||||
|  config ENV_OFFSET | ||||
|  	hex "Environment offset" | ||||
|  	depends on ENV_IS_IN_EEPROM || ENV_IS_IN_MMC || ENV_IS_IN_NAND || \ | ||||
| @@ -60,17 +60,17 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  	default 0xF0000 if ARCH_SUNXI | ||||
| --- a/env/Makefile | ||||
| +++ b/env/Makefile | ||||
| @@ -26,6 +26,7 @@ obj-$(CONFIG_$(PHASE_)ENV_IS_IN_FAT) += | ||||
| @@ -25,6 +25,7 @@ obj-$(CONFIG_$(PHASE_)ENV_IS_IN_MMC) += | ||||
|  obj-$(CONFIG_$(PHASE_)ENV_IS_IN_FAT) += fat.o | ||||
|  obj-$(CONFIG_$(PHASE_)ENV_IS_IN_EXT4) += ext4.o | ||||
|  obj-$(CONFIG_$(PHASE_)ENV_IS_IN_MTD) += mtd.o | ||||
|  obj-$(CONFIG_$(PHASE_)ENV_IS_IN_NAND) += nand.o | ||||
| +obj-$(CONFIG_$(PHASE_)ENV_IS_IN_NMBM) += nmbm.o | ||||
|  obj-$(CONFIG_$(PHASE_)ENV_IS_IN_SPI_FLASH) += sf.o | ||||
|  obj-$(CONFIG_$(PHASE_)ENV_IS_IN_MTD) += mtd.o | ||||
|  obj-$(CONFIG_$(PHASE_)ENV_IS_IN_FLASH) += flash.o | ||||
|   | ||||
| --- a/env/env.c | ||||
| +++ b/env/env.c | ||||
| @@ -52,6 +52,9 @@ static enum env_location env_locations[] | ||||
| @@ -49,6 +49,9 @@ static enum env_location env_locations[] | ||||
|  #ifdef CONFIG_ENV_IS_IN_NAND | ||||
|  	ENVL_NAND, | ||||
|  #endif | ||||
| @@ -240,9 +240,9 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
| +}; | ||||
| --- a/include/env_internal.h | ||||
| +++ b/include/env_internal.h | ||||
| @@ -110,6 +110,7 @@ enum env_location { | ||||
| @@ -109,6 +109,7 @@ enum env_location { | ||||
|  	ENVL_FLASH, | ||||
|  	ENVL_MMC, | ||||
|  	ENVL_MTD, | ||||
|  	ENVL_NAND, | ||||
| +	ENVL_NMBM, | ||||
|  	ENVL_NVRAM, | ||||
| @@ -250,9 +250,9 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  	ENVL_REMOTE, | ||||
| --- a/tools/Makefile | ||||
| +++ b/tools/Makefile | ||||
| @@ -39,6 +39,7 @@ ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y | ||||
| @@ -38,6 +38,7 @@ ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y | ||||
|  ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y | ||||
|  ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y | ||||
|  ENVCRC-$(CONFIG_ENV_IS_IN_MTD) = y | ||||
|  ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y | ||||
| +ENVCRC-$(CONFIG_ENV_IS_IN_NMBM) = y | ||||
|  ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y | ||||
|   | ||||
| @@ -26,7 +26,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  | ||||
| --- a/cmd/Kconfig | ||||
| +++ b/cmd/Kconfig | ||||
| @@ -1525,6 +1525,14 @@ config CMD_NAND_WATCH | ||||
| @@ -1535,6 +1535,14 @@ config CMD_NAND_WATCH | ||||
|   | ||||
|  endif # CMD_NAND | ||||
|   | ||||
|   | ||||
| @@ -13,7 +13,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  | ||||
| --- a/drivers/mtd/spi/spi-nor-core.c | ||||
| +++ b/drivers/mtd/spi/spi-nor-core.c | ||||
| @@ -3248,6 +3248,100 @@ static int spi_nor_init_params(struct sp | ||||
| @@ -3262,6 +3262,100 @@ static int spi_nor_init_params(struct sp | ||||
|  	return 0; | ||||
|  } | ||||
|   | ||||
| @@ -114,7 +114,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  static int spi_nor_hwcaps2cmd(u32 hwcaps, const int table[][2], size_t size) | ||||
|  { | ||||
|  	size_t i; | ||||
| @@ -4450,6 +4544,7 @@ int spi_nor_scan(struct spi_nor *nor) | ||||
| @@ -4486,6 +4580,7 @@ int spi_nor_scan(struct spi_nor *nor) | ||||
|  	nor->write = spi_nor_write_data; | ||||
|  	nor->read_reg = spi_nor_read_reg; | ||||
|  	nor->write_reg = spi_nor_write_reg; | ||||
|   | ||||
| @@ -36,14 +36,11 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  	else if (IS_ENABLED(CONFIG_CMD_SF_TEST) && !strcmp(cmd, "test")) | ||||
|  		ret = do_spi_flash_test(argc, argv); | ||||
|  	else | ||||
| @@ -643,8 +653,9 @@ U_BOOT_LONGHELP(sf, | ||||
| @@ -638,6 +648,7 @@ U_BOOT_LONGHELP(sf, | ||||
|  	"sf update addr offset|partition len	- erase and write `len' bytes from memory\n" | ||||
|  	"					  at `addr' to flash at `offset'\n" | ||||
|  	"					  or to start of mtd `partition'\n" | ||||
| +	"sf uuid				- read uuid from flash\n" | ||||
|  #ifdef CONFIG_SPI_FLASH_LOCK | ||||
|  	"sf protect lock/unlock sector len	- protect/unprotect 'len' bytes starting\n" | ||||
|  	"					  at address 'sector'" | ||||
|  #endif | ||||
|  #ifdef CONFIG_CMD_SF_TEST | ||||
| -	"\nsf test offset len		- run a very basic destructive test" | ||||
| +	"\nsf test offset len			- run a very basic destructive test" | ||||
|  #endif | ||||
| +	"\nsf uuid					- read uuid from flash" | ||||
|  	); | ||||
|   | ||||
|  U_BOOT_CMD( | ||||
|   | ||||
| @@ -18,7 +18,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  | ||||
| --- a/arch/arm/dts/Makefile | ||||
| +++ b/arch/arm/dts/Makefile | ||||
| @@ -1136,6 +1136,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
| @@ -1119,6 +1119,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
|  	mt7622-bananapi-bpi-r64.dtb \ | ||||
|  	mt7623n-bananapi-bpi-r2.dtb \ | ||||
|  	mt7981-rfb.dtb \ | ||||
|   | ||||
| @@ -46,7 +46,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  		INFO("gd25lq128", 0xc86018, 0, 64 * 1024, 256, | ||||
|  			SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | | ||||
|  			SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) | ||||
| @@ -520,6 +527,16 @@ const struct flash_info spi_nor_ids[] = | ||||
| @@ -525,6 +532,16 @@ const struct flash_info spi_nor_ids[] = | ||||
|  			SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) | ||||
|  	}, | ||||
|  	{ | ||||
| @@ -63,7 +63,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  		INFO("w25q128jw", 0xef8018, 0, 64 * 1024, 256, | ||||
|  			SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | | ||||
|  			SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) | ||||
| @@ -583,6 +600,11 @@ const struct flash_info spi_nor_ids[] = | ||||
| @@ -588,6 +605,11 @@ 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) }, | ||||
|   | ||||
| @@ -15,7 +15,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  | ||||
| --- a/drivers/mmc/Kconfig | ||||
| +++ b/drivers/mmc/Kconfig | ||||
| @@ -868,6 +868,14 @@ config MMC_MTK | ||||
| @@ -879,6 +879,14 @@ config MMC_MTK | ||||
|  	  This is needed if support for any SD/SDIO/MMC devices is required. | ||||
|  	  If unsure, say N. | ||||
|   | ||||
| @@ -32,7 +32,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  config FSL_SDHC_V2_3 | ||||
| --- a/drivers/mmc/Makefile | ||||
| +++ b/drivers/mmc/Makefile | ||||
| @@ -85,3 +85,7 @@ obj-$(CONFIG_RENESAS_SDHI)		+= tmio-comm | ||||
| @@ -86,3 +86,7 @@ obj-$(CONFIG_RENESAS_SDHI)		+= tmio-comm | ||||
|  obj-$(CONFIG_MMC_BCM2835)		+= bcm2835_sdhost.o | ||||
|  obj-$(CONFIG_MMC_MTK)			+= mtk-sd.o | ||||
|  obj-$(CONFIG_MMC_SDHCI_F_SDH30)		+= f_sdh30.o | ||||
|   | ||||
| @@ -14,7 +14,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> | ||||
|  | ||||
| --- a/env/Kconfig | ||||
| +++ b/env/Kconfig | ||||
| @@ -701,6 +701,12 @@ config ENV_UBI_VOLUME_REDUND | ||||
| @@ -687,6 +687,12 @@ config ENV_UBI_VOLUME_REDUND | ||||
|  	help | ||||
|  	  Name of the redundant volume that you want to store the environment in. | ||||
|   | ||||
|   | ||||
| @@ -6,7 +6,7 @@ Signed-off-by: Dim Fish <dimfish@gmail.com> | ||||
|  | ||||
| --- a/drivers/mtd/nand/spi/foresee.c | ||||
| +++ b/drivers/mtd/nand/spi/foresee.c | ||||
| @@ -22,8 +22,8 @@ static SPINAND_OP_VARIANTS(write_cache_v | ||||
| @@ -24,8 +24,8 @@ static SPINAND_OP_VARIANTS(write_cache_v | ||||
|  		SPINAND_PROG_LOAD(true, 0, NULL, 0)); | ||||
|   | ||||
|  static SPINAND_OP_VARIANTS(update_cache_variants, | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| --- a/tools/image-host.c | ||||
| +++ b/tools/image-host.c | ||||
| @@ -1175,6 +1175,7 @@ static int fit_config_add_verification_d | ||||
| @@ -1189,6 +1189,7 @@ static int fit_config_add_verification_d | ||||
|   * 2) get public key (X509_get_pubkey) | ||||
|   * 3) provide der format (d2i_RSAPublicKey) | ||||
|   */ | ||||
| @@ -8,7 +8,7 @@ | ||||
|  static int read_pub_key(const char *keydir, const void *name, | ||||
|  			unsigned char **pubkey, int *pubkey_len) | ||||
|  { | ||||
| @@ -1228,6 +1229,13 @@ err_cert: | ||||
| @@ -1242,6 +1243,13 @@ err_cert: | ||||
|  	fclose(f); | ||||
|  	return ret; | ||||
|  } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| --- a/cmd/Kconfig | ||||
| +++ b/cmd/Kconfig | ||||
| @@ -707,6 +707,12 @@ config CMD_ENV_EXISTS | ||||
| @@ -709,6 +709,12 @@ config CMD_ENV_EXISTS | ||||
|  	  Check if a variable is defined in the environment for use in | ||||
|  	  shell scripting. | ||||
|   | ||||
|   | ||||
| @@ -6,6 +6,6 @@ | ||||
|  	lbaint_t blk = 0, blk_r = 0; | ||||
| -	int timeout_ms = 1000; | ||||
| +	int timeout_ms = blkcnt; | ||||
|  	u32 grpcnt; | ||||
|   | ||||
|   | ||||
|  	if (!mmc) | ||||
|  		return -1; | ||||
|   | ||||
| @@ -16,7 +16,7 @@ Reviewed-by: Tom Rini <trini@konsulko.com> | ||||
|  | ||||
| --- a/boot/image-fdt.c | ||||
| +++ b/boot/image-fdt.c | ||||
| @@ -613,6 +613,12 @@ int image_setup_libfdt(struct bootm_head | ||||
| @@ -614,6 +614,12 @@ int image_setup_libfdt(struct bootm_head | ||||
|  					images->fit_uname_cfg, | ||||
|  					strlen(images->fit_uname_cfg) + 1, 1); | ||||
|   | ||||
|   | ||||
| @@ -48,7 +48,7 @@ | ||||
|  #ifdef CONFIG_ENABLE_NAND_NMBM | ||||
| --- a/arch/arm/mach-mediatek/Kconfig | ||||
| +++ b/arch/arm/mach-mediatek/Kconfig | ||||
| @@ -170,4 +170,11 @@ config MTK_TZ_MOVABLE | ||||
| @@ -165,4 +165,11 @@ config MTK_TZ_MOVABLE | ||||
|  	select OF_SYSTEM_SETUP | ||||
|  	bool | ||||
|   | ||||
|   | ||||
| @@ -331,7 +331,7 @@ | ||||
| +}; | ||||
| --- a/arch/arm/dts/Makefile | ||||
| +++ b/arch/arm/dts/Makefile | ||||
| @@ -1134,6 +1134,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
| @@ -1117,6 +1117,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
|  	mt7622-rfb.dtb \ | ||||
|  	mt7623a-unielec-u7623-02-emmc.dtb \ | ||||
|  	mt7622-bananapi-bpi-r64.dtb \ | ||||
|   | ||||
| @@ -742,7 +742,7 @@ | ||||
| +}; | ||||
| --- a/arch/arm/dts/Makefile | ||||
| +++ b/arch/arm/dts/Makefile | ||||
| @@ -1135,6 +1135,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
| @@ -1118,6 +1118,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
|  	mt7623a-unielec-u7623-02-emmc.dtb \ | ||||
|  	mt7622-bananapi-bpi-r64.dtb \ | ||||
|  	mt7622-linksys-e8450-ubi.dtb \ | ||||
| @@ -920,7 +920,7 @@ | ||||
|   | ||||
|  DECLARE_GLOBAL_DATA_PTR; | ||||
|   | ||||
| @@ -402,6 +403,20 @@ static int initr_onenand(void) | ||||
| @@ -423,6 +424,20 @@ static int initr_onenand(void) | ||||
|  } | ||||
|  #endif | ||||
|   | ||||
| @@ -941,13 +941,13 @@ | ||||
|  #ifdef CONFIG_MMC | ||||
|  static int initr_mmc(void) | ||||
|  { | ||||
| @@ -710,6 +725,9 @@ static init_fnc_t init_sequence_r[] = { | ||||
|  #ifdef CONFIG_NMBM_MTD | ||||
|  	initr_nmbm, | ||||
| @@ -735,6 +750,9 @@ static void initcall_run_r(void) | ||||
|  #if CONFIG_IS_ENABLED(NMBM_MTD) | ||||
|  	INITCALL(initr_nmbm); | ||||
|  #endif | ||||
| +#ifdef CONFIG_SPI_FLASH | ||||
| +	initr_spiflash, | ||||
| +#if CONFIG_IS_ENABLED(SPI_FLASH) | ||||
| +	INITCALL(initr_spiflash); | ||||
| +#endif | ||||
|  #ifdef CONFIG_MMC | ||||
|  	initr_mmc, | ||||
|  #if CONFIG_IS_ENABLED(MMC) | ||||
|  	INITCALL(initr_mmc); | ||||
|  #endif | ||||
|   | ||||
| @@ -22,7 +22,7 @@ Subject: [PATCH] add support for RAVPower RP-WD009 | ||||
|  | ||||
| --- a/arch/mips/dts/Makefile | ||||
| +++ b/arch/mips/dts/Makefile | ||||
| @@ -26,6 +26,7 @@ dtb-$(CONFIG_TARGET_OCTEON_EBB7304) += m | ||||
| @@ -25,6 +25,7 @@ dtb-$(CONFIG_TARGET_OCTEON_EBB7304) += m | ||||
|  dtb-$(CONFIG_TARGET_OCTEON_NIC23) += mrvl,octeon-nic23.dtb | ||||
|  dtb-$(CONFIG_BOARD_NETGEAR_CG3100D) += netgear,cg3100d.dtb | ||||
|  dtb-$(CONFIG_BOARD_NETGEAR_DGND3700V2) += netgear,dgnd3700v2.dtb | ||||
|   | ||||
| @@ -15,7 +15,7 @@ Subject: [PATCH] add xiaomi redmi ax6s | ||||
|  | ||||
| --- a/arch/arm/dts/Makefile | ||||
| +++ b/arch/arm/dts/Makefile | ||||
| @@ -1137,6 +1137,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
| @@ -1120,6 +1120,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ | ||||
|  	mt7622-linksys-e8450-ubi.dtb \ | ||||
|  	mt7622-ubnt-unifi-6-lr.dtb \ | ||||
|  	mt7622-ubnt-unifi-6-lr-v3.dtb \ | ||||
|   | ||||
| @@ -13,42 +13,42 @@ Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com> | ||||
|  | ||||
| --- a/common/board_r.c | ||||
| +++ b/common/board_r.c | ||||
| @@ -681,19 +681,13 @@ static init_fnc_t init_sequence_r[] = { | ||||
|  	serial_initialize, | ||||
|  	initr_announce, | ||||
|  	dm_announce, | ||||
| @@ -691,19 +691,13 @@ static void initcall_run_r(void) | ||||
|  	INITCALL(serial_initialize); | ||||
|  	INITCALL(initr_announce); | ||||
|  	INITCALL(dm_announce); | ||||
| -#if CONFIG_IS_ENABLED(WDT) | ||||
| -	initr_watchdog, | ||||
| -	INITCALL(initr_watchdog); | ||||
| -#endif | ||||
| -	INIT_FUNC_WATCHDOG_RESET | ||||
|  	arch_initr_trap, | ||||
|  #if defined(CONFIG_BOARD_EARLY_INIT_R) | ||||
|  	board_early_init_r, | ||||
| -	WATCHDOG_RESET(); | ||||
|  	INITCALL(arch_initr_trap); | ||||
|  #if CONFIG_IS_ENABLED(BOARD_EARLY_INIT_R) | ||||
|  	INITCALL(board_early_init_r); | ||||
|  #endif | ||||
| -	INIT_FUNC_WATCHDOG_RESET | ||||
|  #ifdef CONFIG_POST | ||||
|  	post_output_backlog, | ||||
| -	WATCHDOG_RESET(); | ||||
|  #if CONFIG_IS_ENABLED(POST) | ||||
|  	INITCALL(post_output_backlog); | ||||
|  #endif | ||||
| -	INIT_FUNC_WATCHDOG_RESET | ||||
|  #if defined(CONFIG_PCI_INIT_R) && defined(CONFIG_SYS_EARLY_PCI_INIT) | ||||
| -	WATCHDOG_RESET(); | ||||
|  #if CONFIG_IS_ENABLED(PCI_INIT_R) && CONFIG_IS_ENABLED(SYS_EARLY_PCI_INIT) | ||||
|  	/* | ||||
|  	 * Do early PCI configuration _before_ the flash gets initialised, | ||||
| @@ -708,7 +702,6 @@ static init_fnc_t init_sequence_r[] = { | ||||
|  #ifdef CONFIG_MTD_NOR_FLASH | ||||
|  	initr_flash, | ||||
| @@ -718,7 +712,6 @@ static void initcall_run_r(void) | ||||
|  #if CONFIG_IS_ENABLED(MTD_NOR_FLASH) | ||||
|  	INITCALL(initr_flash); | ||||
|  #endif | ||||
| -	INIT_FUNC_WATCHDOG_RESET | ||||
|  #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86) | ||||
| -	WATCHDOG_RESET(); | ||||
|  #if CONFIG_IS_ENABLED(PPC) || CONFIG_IS_ENABLED(M68K) || CONFIG_IS_ENABLED(X86) | ||||
|  	/* initialize higher level parts of CPU like time base and timers */ | ||||
|  	cpu_init_r, | ||||
| @@ -737,6 +730,10 @@ static init_fnc_t init_sequence_r[] = { | ||||
|  #ifdef CONFIG_PVBLOCK | ||||
|  	initr_pvblock, | ||||
|  	INITCALL(cpu_init_r); | ||||
| @@ -744,6 +737,10 @@ static void initcall_run_r(void) | ||||
|  #if CONFIG_IS_ENABLED(PVBLOCK) | ||||
|  	INITCALL(initr_pvblock); | ||||
|  #endif | ||||
| +#if CONFIG_IS_ENABLED(WDT) | ||||
| +	initr_watchdog, | ||||
| +	INITCALL(initr_watchdog); | ||||
| +#endif | ||||
| +	INIT_FUNC_WATCHDOG_RESET | ||||
|  	initr_env, | ||||
|  #ifdef CONFIG_SYS_MALLOC_BOOTPARAMS | ||||
|  	initr_malloc_bootparams, | ||||
| +	WATCHDOG_RESET(); | ||||
|  	INITCALL(initr_env); | ||||
|  #if CONFIG_IS_ENABLED(SYS_MALLOC_BOOTPARAMS) | ||||
|  	INITCALL(initr_malloc_bootparams); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Shiji Yang
					Shiji Yang