From 66899c8d193352f0fee17a1ed5cdeabc3e028540 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Mon, 21 Mar 2022 22:36:05 +0100 Subject: arm: apple: Increase RTKit timeout The firmware on larger NVMe drives needs more than 100ms to come up. Change the timeout to 1s. Signed-off-by: Hector Martin Signed-off-by: Mark Kettenis Reviewed-by: Simon Glass --- arch/arm/mach-apple/rtkit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-apple/rtkit.c b/arch/arm/mach-apple/rtkit.c index dff475cab7d..2dcb8bdd3e4 100644 --- a/arch/arm/mach-apple/rtkit.c +++ b/arch/arm/mach-apple/rtkit.c @@ -170,7 +170,7 @@ wait_epmap: pwrstate = APPLE_RTKIT_PWR_STATE_SLEEP; while (pwrstate != APPLE_RTKIT_PWR_STATE_ON) { - ret = mbox_recv(chan, &msg, 100000); + ret = mbox_recv(chan, &msg, 1000000); if (ret < 0) return ret; -- cgit v1.2.3 From 8b9c77053cb4292309f9046df99861c0ed4756b0 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Mon, 21 Mar 2022 22:41:18 +0100 Subject: arm: apple: Fix mem layout The current approach for setting the environment variables that describe the memory layout runs the risk of overlapping with reserved memory regions. Use the lmb code to derive the addresses for these variables instead. Signed-off-by: Mark Kettenis Reviewed-by: Simon Glass --- arch/arm/mach-apple/board.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/board.c index 54005f3adf0..722dff1f64c 100644 --- a/arch/arm/mach-apple/board.c +++ b/arch/arm/mach-apple/board.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -266,32 +267,27 @@ u64 get_page_table_size(void) return SZ_256K; } +#define KERNEL_COMP_SIZE SZ_128M + int board_late_init(void) { - unsigned long base; - unsigned long top; + struct lmb lmb; u32 status = 0; - /* Reserve 4M each for scriptaddr and pxefile_addr_r at the top of RAM - * at least 1M below the stack. - */ - top = gd->start_addr_sp - CONFIG_STACK_SIZE - SZ_8M - SZ_1M; - top = ALIGN_DOWN(top, SZ_8M); - - status |= env_set_hex("scriptaddr", top + SZ_4M); - status |= env_set_hex("pxefile_addr_r", top); + lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob); /* somewhat based on the Linux Kernel boot requirements: * align by 2M and maximal FDT size 2M */ - base = ALIGN(gd->ram_base, SZ_2M); - - status |= env_set_hex("fdt_addr_r", base); - status |= env_set_hex("kernel_addr_r", base + SZ_2M); - status |= env_set_hex("ramdisk_addr_r", base + SZ_128M); - status |= env_set_hex("loadaddr", base + SZ_2G); - status |= env_set_hex("kernel_comp_addr_r", base + SZ_2G - SZ_128M); - status |= env_set_hex("kernel_comp_size", SZ_128M); + status |= env_set_hex("loadaddr", lmb_alloc(&lmb, SZ_1G, SZ_2M)); + status |= env_set_hex("fdt_addr_r", lmb_alloc(&lmb, SZ_2M, SZ_2M)); + status |= env_set_hex("kernel_addr_r", lmb_alloc(&lmb, SZ_128M, SZ_2M)); + status |= env_set_hex("ramdisk_addr_r", lmb_alloc(&lmb, SZ_1G, SZ_2M)); + status |= env_set_hex("kernel_comp_addr_r", + lmb_alloc(&lmb, KERNEL_COMP_SIZE, SZ_2M)); + status |= env_set_hex("kernel_comp_size", KERNEL_COMP_SIZE); + status |= env_set_hex("scriptaddr", lmb_alloc(&lmb, SZ_4M, SZ_2M)); + status |= env_set_hex("pxefile_addr_r", lmb_alloc(&lmb, SZ_4M, SZ_2M)); if (status) log_warning("late_init: Failed to set run time variables\n"); -- cgit v1.2.3 From 0652d44bec7d5af0d0381e1ad6ed2b25a6389178 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 19 Mar 2022 13:33:25 +0100 Subject: Makefile: add drivers/video/u_boot_logo.S to clean make sandbox_defconfig make mrproper make tests fails with ../drivers/video/u_boot_logo.S: Assembler messages: ../drivers/video/u_boot_logo.S:5: Error: file not found: drivers/video/u_boot_logo.bmp We have to delete the generated file. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 14fd2868ebe..ba9c3f62d09 100644 --- a/Makefile +++ b/Makefile @@ -2186,7 +2186,8 @@ CLEAN_DIRS += $(MODVERDIR) \ $(foreach d, spl tpl, $(patsubst %,$d/%, \ $(filter-out include, $(shell ls -1 $d 2>/dev/null)))) -CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h tools/version.h \ +CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h \ + drivers/video/u_boot_logo.S tools/version.h \ u-boot* MLO* SPL System.map fit-dtb.blob* \ u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log \ lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl.bin* \ -- cgit v1.2.3 From d66b0f5dd7a9662f8c9c3d11e6ad351acc1ce630 Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Fri, 25 Mar 2022 10:51:46 +0100 Subject: Fix URLs to old freescale git repos Freescale git repos are now on source.codeaurora.org. Signed-off-by: Pali Rohár --- doc/README.mpc85xx-sd-spi-boot | 2 +- drivers/misc/mxc_ocotp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/README.mpc85xx-sd-spi-boot b/doc/README.mpc85xx-sd-spi-boot index e3f580446a1..329de4e6c4c 100644 --- a/doc/README.mpc85xx-sd-spi-boot +++ b/doc/README.mpc85xx-sd-spi-boot @@ -14,7 +14,7 @@ Where to get boot_format: ======================== you can browse it online at: -http://git.freescale.com/git/cgit.cgi/ppc/sdk/boot-format.git/ +https://source.codeaurora.org/external/qoriq/qoriq-yocto-sdk/boot-format Building ======== diff --git a/drivers/misc/mxc_ocotp.c b/drivers/misc/mxc_ocotp.c index b1893a5c7eb..8ee18f29d9b 100644 --- a/drivers/misc/mxc_ocotp.c +++ b/drivers/misc/mxc_ocotp.c @@ -6,7 +6,7 @@ * Based on Dirk Behme's * https://github.com/dirkbehme/u-boot-imx6/blob/28b17e9/drivers/misc/imx_otp.c, * which is based on Freescale's - * http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/drivers/misc/imx_otp.c?h=imx_v2009.08_1.1.0&id=9aa74e6, + * https://source.codeaurora.org/external/imx/uboot-imx/tree/drivers/misc/imx_otp.c?id=9aa74e6, * which is: * Copyright (C) 2011 Freescale Semiconductor, Inc. */ -- cgit v1.2.3 From 408e2d5a224d8c62beae4cb1e7a3804abbbb123f Mon Sep 17 00:00:00 2001 From: Jérôme Carretero Date: Wed, 16 Mar 2022 15:35:36 -0400 Subject: boot: image: fixup zstd decompression buffer initialization typo The code was mistakenly initializing the input buffer twice. Tested to be working on BeagleBone by adjusting CONFIG_SYS_BOOTM_LEN to 64MiB (probably works with less) and preparing uImage with: cat arch/arm/boot/Image \ | zstd --ultra -22 --zstd=windowLog=22 \ > linux.bin.zst mkimage -A arm -T kernel uImage -C zstd -d linux.bin.zst \ -a 0x80008000 -e 0x80008000 Without the windowLog restriction, bootm fails with a zstd decompression error 7 (window too large), which I haven't troubleshooted. There should be a bit more documentation on the feature... Reviewed-by: Simon Glass Fixes: 458b30af66c image: Update image_decomp() to avoid ifdefs --- boot/image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/image.c b/boot/image.c index 07fa2d3160d..121df0c8384 100644 --- a/boot/image.c +++ b/boot/image.c @@ -500,7 +500,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type, struct abuf in, out; abuf_init_set(&in, image_buf, image_len); - abuf_init_set(&in, load_buf, unc_len); + abuf_init_set(&out, load_buf, unc_len); ret = zstd_decompress(&in, &out); if (ret >= 0) { image_len = ret; -- cgit v1.2.3 From ed48490f8d3f8715b23071a8a1cbe5bba8c8626e Mon Sep 17 00:00:00 2001 From: Han Xu Date: Fri, 25 Mar 2022 08:36:38 -0500 Subject: mtd: gpmi: fix the bch setting backward compatible issue Previous u-boot code changed the default bch setting behavior and caused backward compatible issue. This fix choose the legacy bch geometry back again as the default option. If the minimum ecc strength that NAND chips required need to be chosen, it can be enabled by either adding DT flag "fsl,use-minimum-ecc" or CONFIG_NAND_MXS_USE_MINIMUM_ECC in configs. The unused flag "fsl,legacy-bch-geometry" get removed. Fixes: 51cdf83eea (mtd: gpmi: provide the option to use legacy bch geometry) Fixes: 616f03daba (mtd: gpmi: change the BCH layout setting for large oob NAND) Tested-by: Tim Harvey Tested-by: Sean Nyekjaer Signed-off-by: Han Xu Reviewed-by: Miquel Raynal --- drivers/mtd/nand/raw/mxs_nand.c | 71 +++++++++++++++++++++++++++++++++----- drivers/mtd/nand/raw/mxs_nand_dt.c | 2 -- include/mxs_nand.h | 2 -- 3 files changed, 62 insertions(+), 13 deletions(-) diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c index 748056a43e6..ee5d7fde9ce 100644 --- a/drivers/mtd/nand/raw/mxs_nand.c +++ b/drivers/mtd/nand/raw/mxs_nand.c @@ -195,6 +195,7 @@ static inline int mxs_nand_legacy_calc_ecc_layout(struct bch_geometry *geo, struct nand_chip *chip = mtd_to_nand(mtd); struct mxs_nand_info *nand_info = nand_get_controller_data(chip); unsigned int block_mark_bit_offset; + int corr, ds_corr; /* The default for the length of Galois Field. */ geo->gf_len = 13; @@ -225,6 +226,17 @@ static inline int mxs_nand_legacy_calc_ecc_layout(struct bch_geometry *geo, geo->ecc_strength = min(round_down(geo->ecc_strength, 2), nand_info->max_ecc_strength_supported); + /* check ecc strength, same as nand_ecc_is_strong_enough() did*/ + if (chip->ecc_step_ds) { + corr = mtd->writesize * geo->ecc_strength / + geo->ecc_chunkn_size; + ds_corr = mtd->writesize * chip->ecc_strength_ds / + chip->ecc_step_ds; + if (corr < ds_corr || + geo->ecc_strength < chip->ecc_strength_ds) + return -EINVAL; + } + block_mark_bit_offset = mtd->writesize * 8 - (geo->ecc_strength * geo->gf_len * (geo->ecc_chunk_count - 1) + MXS_NAND_METADATA_SIZE * 8); @@ -1111,6 +1123,7 @@ static int mxs_nand_set_geometry(struct mtd_info *mtd, struct bch_geometry *geo) struct nand_chip *chip = mtd_to_nand(mtd); struct nand_chip *nand = mtd_to_nand(mtd); struct mxs_nand_info *nand_info = nand_get_controller_data(nand); + int err; if (chip->ecc_strength_ds > nand_info->max_ecc_strength_supported) { printf("unsupported NAND chip, minimum ecc required %d\n" @@ -1118,19 +1131,57 @@ static int mxs_nand_set_geometry(struct mtd_info *mtd, struct bch_geometry *geo) return -EINVAL; } - if ((!(chip->ecc_strength_ds > 0 && chip->ecc_step_ds > 0) && - mtd->oobsize < 1024) || nand_info->legacy_bch_geometry) { - dev_warn(mtd->dev, "use legacy bch geometry\n"); - return mxs_nand_legacy_calc_ecc_layout(geo, mtd); + /* use the legacy bch setting by default */ + if ((!nand_info->use_minimum_ecc && mtd->oobsize < 1024) || + !(chip->ecc_strength_ds > 0 && chip->ecc_step_ds > 0)) { + dev_dbg(mtd->dev, "use legacy bch geometry\n"); + err = mxs_nand_legacy_calc_ecc_layout(geo, mtd); + if (!err) + return 0; } - if (mtd->oobsize > 1024 || chip->ecc_step_ds < mtd->oobsize) - return mxs_nand_calc_ecc_for_large_oob(geo, mtd); + /* for large oob nand */ + if (mtd->oobsize > 1024) { + dev_dbg(mtd->dev, "use large oob bch geometry\n"); + err = mxs_nand_calc_ecc_for_large_oob(geo, mtd); + if (!err) + return 0; + } - return mxs_nand_calc_ecc_layout_by_info(geo, mtd, - chip->ecc_strength_ds, chip->ecc_step_ds); + /* otherwise use the minimum ecc nand chips required */ + dev_dbg(mtd->dev, "use minimum ecc bch geometry\n"); + err = mxs_nand_calc_ecc_layout_by_info(geo, mtd, chip->ecc_strength_ds, + chip->ecc_step_ds); - return 0; + if (err) + dev_err(mtd->dev, "none of the bch geometry setting works\n"); + + return err; +} + +void mxs_nand_dump_geo(struct mtd_info *mtd) +{ + struct nand_chip *nand = mtd_to_nand(mtd); + struct mxs_nand_info *nand_info = nand_get_controller_data(nand); + struct bch_geometry *geo = &nand_info->bch_geometry; + + dev_dbg(mtd->dev, "BCH Geometry :\n" + "GF Length\t\t: %u\n" + "ECC Strength\t\t: %u\n" + "ECC for Meta\t\t: %u\n" + "ECC Chunk0 Size\t\t: %u\n" + "ECC Chunkn Size\t\t: %u\n" + "ECC Chunk Count\t\t: %u\n" + "Block Mark Byte Offset\t: %u\n" + "Block Mark Bit Offset\t: %u\n", + geo->gf_len, + geo->ecc_strength, + geo->ecc_for_meta, + geo->ecc_chunk0_size, + geo->ecc_chunkn_size, + geo->ecc_chunk_count, + geo->block_mark_byte_offset, + geo->block_mark_bit_offset); } /* @@ -1159,6 +1210,8 @@ int mxs_nand_setup_ecc(struct mtd_info *mtd) if (ret) return ret; + mxs_nand_dump_geo(mtd); + /* Configure BCH and set NFC geometry */ mxs_reset_block(&bch_regs->hw_bch_ctrl_reg); diff --git a/drivers/mtd/nand/raw/mxs_nand_dt.c b/drivers/mtd/nand/raw/mxs_nand_dt.c index 878796d5552..b9833a646f0 100644 --- a/drivers/mtd/nand/raw/mxs_nand_dt.c +++ b/drivers/mtd/nand/raw/mxs_nand_dt.c @@ -92,8 +92,6 @@ static int mxs_nand_dt_probe(struct udevice *dev) info->use_minimum_ecc = dev_read_bool(dev, "fsl,use-minimum-ecc"); - info->legacy_bch_geometry = dev_read_bool(dev, "fsl,legacy-bch-geometry"); - if (IS_ENABLED(CONFIG_CLK) && IS_ENABLED(CONFIG_IMX8)) { /* Assigned clock already set clock */ struct clk gpmi_clk; diff --git a/include/mxs_nand.h b/include/mxs_nand.h index 66c909318d1..741dc8734ea 100644 --- a/include/mxs_nand.h +++ b/include/mxs_nand.h @@ -44,8 +44,6 @@ struct mxs_nand_info { struct udevice *dev; unsigned int max_ecc_strength_supported; bool use_minimum_ecc; - /* legacy bch geometry flag */ - bool legacy_bch_geometry; int cur_chip; uint32_t cmd_queue_len; -- cgit v1.2.3