From c8da6513c054c150640e8ad12185bd53ae1852fc Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 9 Jul 2020 15:57:56 +0200 Subject: [PATCH 001/117] xilinx: Setup bootm variables On system with PL DDR which is placed before PS DDR in DT env_get_bootm_size() and env_get_bootm_low() without specifying bootm_low and bootm_size variables are taking by default gd->bd->bi_dram[0].start and gd->bd->bi_dram[0].size. As you see 0 means bank 0 which doesn't need to be PS ddr and even can be memory above 39bit VA which is what U-Boot supports now. That's why setup bootm variables based on ram_base/ram_size setting to make sure that boot images are placed to the same location as U-Boot is placed. This location should be by default location where OS can boot from. Signed-off-by: Michal Simek --- board/xilinx/common/board.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 0469e2e7ac9..3bca3a25a97 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -86,5 +86,8 @@ int board_late_init_xilinx(void) initrd_hi = round_down(initrd_hi, SZ_16M); env_set_addr("initrd_high", (void *)initrd_hi); + env_set_addr("bootm_low", (void *)gd->ram_base); + env_set_addr("bootm_size", (void *)gd->ram_size); + return 0; } From 664e16ce99a0c04ba7ea06892ebafdc2071aefe9 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 6 Aug 2020 15:18:36 +0200 Subject: [PATCH 002/117] xilinx: kconfig: Change Kconfig dependencies for Xilinx drivers Zynq/ZynqMP/Versal IPs should be possible to called also from Microblaze in PL and vice versa. That's why change dependencies and do not limit enabling just for some platforms. Signed-off-by: Michal Simek Reviewed-by: Heiko Schocher --- drivers/gpio/Kconfig | 4 ++-- drivers/i2c/Kconfig | 2 +- drivers/mmc/Kconfig | 1 - drivers/net/Kconfig | 6 +++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 11e9a17f972..202fcc6f475 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -381,8 +381,8 @@ config MVEBU_GPIO config ZYNQ_GPIO bool "Zynq GPIO driver" - depends on DM_GPIO && (ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL) - default y + depends on DM_GPIO + default y if ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL help Supports GPIO access on Zynq SoC. diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index dec6dc9dfa4..8ae54e1e93b 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -88,7 +88,7 @@ config SYS_I2C_FSL config SYS_I2C_CADENCE tristate "Cadence I2C Controller" - depends on DM_I2C && (ARCH_ZYNQ || ARM64) + depends on DM_I2C help Say yes here to select Cadence I2C Host Controller. This controller is e.g. used by Xilinx Zynq. diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index 556b3ac4897..c29d1ea680e 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -653,7 +653,6 @@ config TEGRA124_MMC_DISABLE_EXT_LOOPBACK config MMC_SDHCI_ZYNQ bool "Arasan SDHCI controller support" - depends on ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL depends on DM_MMC && OF_CONTROL && BLK depends on MMC_SDHCI help diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index ecd779d979e..039f9fb0589 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -519,7 +519,7 @@ config TULIP This driver supports DEC DC2114x Fast ethernet chips. config XILINX_AXIEMAC - depends on DM_ETH && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP) + depends on DM_ETH select PHYLIB select MII bool "Xilinx AXI Ethernet" @@ -527,7 +527,7 @@ config XILINX_AXIEMAC This MAC is present in Xilinx Microblaze, Zynq and ZynqMP SoCs. config XILINX_EMACLITE - depends on DM_ETH && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP || MIPS) + depends on DM_ETH select PHYLIB select MII bool "Xilinx Ethernetlite" @@ -535,7 +535,7 @@ config XILINX_EMACLITE This MAC is present in Xilinx Microblaze, Zynq and ZynqMP SoCs. config ZYNQ_GEM - depends on DM_ETH && (ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL) + depends on DM_ETH select PHYLIB bool "Xilinx Ethernet GEM" help From 834de8984241efaa7124358f4aafd2e2cb803b50 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 18 Aug 2020 14:15:01 +0200 Subject: [PATCH 003/117] xilinx: Enable preboot feature for ZynqMP and Versal Enable preboot functionality for ZynqMP and Versal platforms. Signed-off-by: Michal Simek --- configs/xilinx_versal_virt_defconfig | 1 + configs/xilinx_zynqmp_virt_defconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/configs/xilinx_versal_virt_defconfig b/configs/xilinx_versal_virt_defconfig index 5075cf2f688..49138278f1e 100644 --- a/configs/xilinx_versal_virt_defconfig +++ b/configs/xilinx_versal_virt_defconfig @@ -9,6 +9,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_BOOTDELAY=5 +CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_BOARD_EARLY_INIT_R=y CONFIG_SYS_PROMPT="Versal> " diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig index cf07df8145c..7ed88ae0940 100644 --- a/configs/xilinx_zynqmp_virt_defconfig +++ b/configs/xilinx_zynqmp_virt_defconfig @@ -15,6 +15,7 @@ CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x10000000 +CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_BOARD_EARLY_INIT_F=y CONFIG_BOARD_EARLY_INIT_R=y From 1b208d59bac12da6f8bd2f7d9e9482fa16340705 Mon Sep 17 00:00:00 2001 From: Igor Lantsman Date: Wed, 24 Jun 2020 14:33:46 +0200 Subject: [PATCH 004/117] arm64: zynqmp: Fix set_fdtfile() not to break u-boots DTB Origin function was calling strsep which replaced delimiter ',' by a null byte ('\0'). Operation was done directly on FDT which ends up with the following behavior: ZynqMP> printenv fdtfile fdtfile=xilinx/zynqmp.dtb ZynqMP> fdt addr $fdtcontroladdr ZynqMP> fdt print / compatible compatible = "xlnx", "zynqmp" As is visible fdtfile was correctly composed but a null byte caused that xlnx was separated from zynqmp. This hasn't been spotted because in all Xilinx DTs there are at least 3 compatible string and only the first one was affected by this issue. But for systems which only had one compatible string "xlnx,zynqmp" it was causing an issue when U-Boot's DT was used by Linux kernel. The patch removes strsep calling and strchr is called instead which just locate the first char after deliminator ',' (variable called "name"). And using this pointer in fdtfile composing. Fixes: 91d7e0c47f51 ("arm64: zynqmp: Create fdtfile from compatible string") Reported-by: Igor Lantsman Signed-off-by: Igor Lantsman Signed-off-by: Michal Simek --- board/xilinx/zynqmp/zynqmp.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index ebb71729081..8a4df6fc1ab 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -541,23 +541,30 @@ static int set_fdtfile(void) char *compatible, *fdtfile; const char *suffix = ".dtb"; const char *vendor = "xilinx/"; + int fdt_compat_len; if (env_get("fdtfile")) return 0; - compatible = (char *)fdt_getprop(gd->fdt_blob, 0, "compatible", NULL); - if (compatible) { + compatible = (char *)fdt_getprop(gd->fdt_blob, 0, "compatible", + &fdt_compat_len); + if (compatible && fdt_compat_len) { + char *name; + debug("Compatible: %s\n", compatible); - /* Discard vendor prefix */ - strsep(&compatible, ","); + name = strchr(compatible, ','); + if (!name) + return -EINVAL; - fdtfile = calloc(1, strlen(vendor) + strlen(compatible) + + name++; + + fdtfile = calloc(1, strlen(vendor) + strlen(name) + strlen(suffix) + 1); if (!fdtfile) return -ENOMEM; - sprintf(fdtfile, "%s%s%s", vendor, compatible, suffix); + sprintf(fdtfile, "%s%s%s", vendor, name, suffix); env_set("fdtfile", fdtfile); free(fdtfile); From 526a67eb35cb1b6cea2b269c9690550dee232b74 Mon Sep 17 00:00:00 2001 From: T Karthik Reddy Date: Wed, 24 Jun 2020 03:23:57 -0600 Subject: [PATCH 005/117] xilinx: versal: Add new versal loadpdi command Versal loadpdi command is used for loading secure & non-secure pdi images. Signed-off-by: T Karthik Reddy Signed-off-by: Michal Simek --- arch/arm/Kconfig | 1 + board/xilinx/versal/Kconfig | 14 +++++ board/xilinx/versal/Makefile | 1 + board/xilinx/versal/cmds.c | 105 +++++++++++++++++++++++++++++++++++ 4 files changed, 121 insertions(+) create mode 100644 board/xilinx/versal/Kconfig create mode 100644 board/xilinx/versal/cmds.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 84018516668..a3930b57141 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1962,6 +1962,7 @@ source "board/vscom/baltos/Kconfig" source "board/xilinx/Kconfig" source "board/xilinx/zynq/Kconfig" source "board/xilinx/zynqmp/Kconfig" +source "board/xilinx/versal/Kconfig" source "board/phytium/durian/Kconfig" source "board/xen/xenguest_arm64/Kconfig" diff --git a/board/xilinx/versal/Kconfig b/board/xilinx/versal/Kconfig new file mode 100644 index 00000000000..c0cccc2068b --- /dev/null +++ b/board/xilinx/versal/Kconfig @@ -0,0 +1,14 @@ +# Copyright (c) 2020, Xilinx, Inc. +# +# SPDX-License-Identifier: GPL-2.0 + +if ARCH_VERSAL + +config CMD_VERSAL + bool "Enable Versal specific commands" + default y + depends on ZYNQMP_FIRMWARE + help + Enable Versal specific commands. + +endif diff --git a/board/xilinx/versal/Makefile b/board/xilinx/versal/Makefile index e9307d7fa69..90e03431540 100644 --- a/board/xilinx/versal/Makefile +++ b/board/xilinx/versal/Makefile @@ -5,4 +5,5 @@ # obj-y := board.o +obj-$(CONFIG_CMD_VERSAL) += cmds.o obj-y += ../common/board.o diff --git a/board/xilinx/versal/cmds.c b/board/xilinx/versal/cmds.c new file mode 100644 index 00000000000..981c80ee474 --- /dev/null +++ b/board/xilinx/versal/cmds.c @@ -0,0 +1,105 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * (C) Copyright 2020 Xilinx, Inc. + * Michal Simek + */ + +#include +#include +#include +#include +#include +#include +#include + +static int do_versal_load_pdi(struct cmd_tbl *cmdtp, int flag, int argc, + char * const argv[]) +{ + u32 buf_lo, buf_hi; + u32 ret_payload[5]; + ulong addr, *pdi_buf; + size_t len; + int ret; + + if (argc != cmdtp->maxargs) { + debug("pdi_load: incorrect parameters passed\n"); + return CMD_RET_USAGE; + } + + addr = simple_strtol(argv[2], NULL, 16); + if (!addr) { + debug("pdi_load: zero pdi_data address\n"); + return CMD_RET_USAGE; + } + + len = simple_strtoul(argv[3], NULL, 16); + if (!len) { + debug("pdi_load: zero size\n"); + return CMD_RET_USAGE; + } + + pdi_buf = (ulong *)ALIGN((ulong)addr, ARCH_DMA_MINALIGN); + if ((ulong)addr != (ulong)pdi_buf) { + memcpy((void *)pdi_buf, (void *)addr, len); + debug("Pdi addr:0x%lx aligned to 0x%lx\n", + addr, (ulong)pdi_buf); + } + + flush_dcache_range((ulong)pdi_buf, (ulong)pdi_buf + len); + + buf_lo = lower_32_bits((ulong)pdi_buf); + buf_hi = upper_32_bits((ulong)pdi_buf); + + ret = xilinx_pm_request(VERSAL_PM_LOAD_PDI, VERSAL_PM_PDI_TYPE, buf_lo, + buf_hi, 0, ret_payload); + if (ret) + printf("PDI load failed with err: 0x%08x\n", ret); + + return ret; +} + +static struct cmd_tbl cmd_versal_sub[] = { + U_BOOT_CMD_MKENT(loadpdi, 4, 1, do_versal_load_pdi, "", ""), +}; + +/** + * do_versal - Handle the "versal" command-line command + * @cmdtp: Command data struct pointer + * @flag: Command flag + * @argc: Command-line argument count + * @argv: Array of command-line arguments + * + * Processes the versal specific commands + * + * Return: return 0 on success, Error value if command fails. + * CMD_RET_USAGE incase of incorrect/missing parameters. + */ +static int do_versal(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + struct cmd_tbl *c; + int ret = CMD_RET_USAGE; + + if (argc < 2) + return CMD_RET_USAGE; + + c = find_cmd_tbl(argv[1], &cmd_versal_sub[0], + ARRAY_SIZE(cmd_versal_sub)); + if (c) + ret = c->cmd(c, flag, argc, argv); + + return cmd_process_error(c, ret); +} + +#ifdef CONFIG_SYS_LONGHELP +static char versal_help_text[] = + "loadpdi addr len - Load pdi image\n" + "load pdi image at ddr address 'addr' with pdi image size 'len'\n" +; +#endif + +U_BOOT_CMD(versal, 4, 1, do_versal, + "versal sub-system", + versal_help_text +) + From 11b1dcec09f035e3b70a2fc63913ab00991ecba7 Mon Sep 17 00:00:00 2001 From: Ibai Erkiaga Date: Thu, 2 Jul 2020 00:10:58 +0100 Subject: [PATCH 006/117] versal: fix versal PM ret payload size The PM return payload size is defined as 4 bytes for Versal arquitecture while the PM calls implemented both in the Versal clock driver and ZynqMP firmware driver expects 5 bytes length. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- arch/arm/mach-versal/include/mach/sys_proto.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-versal/include/mach/sys_proto.h b/arch/arm/mach-versal/include/mach/sys_proto.h index 31af049a21c..cfd480bec17 100644 --- a/arch/arm/mach-versal/include/mach/sys_proto.h +++ b/arch/arm/mach-versal/include/mach/sys_proto.h @@ -8,7 +8,7 @@ enum { TCM_SPLIT, }; -#define PAYLOAD_ARG_CNT 4U +#define PAYLOAD_ARG_CNT 5U void tcm_init(u8 mode); void mem_map_fill(void); From 7fce7396659c162f55b1747d84599d822b11c6a7 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 9 Jul 2020 14:09:52 +0200 Subject: [PATCH 007/117] lib: fdt: Introduce fdtdec_setup_mem_size_base_lowest() New function should be called from board dram_init() because it initialized gd->ram_base/ram_size. It finds the lowest available memory. On systems with multiple memory nodes finding out the first memory node by fdtdec_setup_mem_size_base() is not enough because this memory can be above actual U-Boot VA mapping. Currently only mapping till 39bit is supported (Full 44bit mapping was removed by commit 7985cdf74b28 ("arm64: Remove non-full-va map code")). If DT starts with the first memory node above 39bit address then system can be unpredictable. The function is available only when multiple memory bank support is enabled. Calling fdtdec_setup_memory_banksize() from dram_init() is not possible because fdtdec_setup_memory_banksize() is saving dram information to bd structure which is placed on stack but not initialized at this time. Also stack is placed at location setup in dram_init(). Signed-off-by: Michal Simek Reviewed-by: Simon Glass --- include/fdtdec.h | 17 +++++++++++++++++ lib/fdtdec.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/include/fdtdec.h b/include/fdtdec.h index 760b392bdfb..bc79389260a 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -926,6 +926,23 @@ int fdtdec_decode_display_timing(const void *blob, int node, int index, */ int fdtdec_setup_mem_size_base(void); +/** + * fdtdec_setup_mem_size_base_lowest() - decode and setup gd->ram_size and + * gd->ram_start by lowest available memory base + * + * Decode the /memory 'reg' property to determine the lowest start of the memory + * bank bank and populate the global data with it. + * + * This function should be called from a boards dram_init(). This helper + * function allows for boards to query the device tree for DRAM size and start + * address instead of hard coding the value in the case where the memory size + * and start address cannot be detected automatically. + * + * @return 0 if OK, -EINVAL if the /memory node or reg property is missing or + * invalid + */ +int fdtdec_setup_mem_size_base_lowest(void); + /** * fdtdec_setup_memory_banksize() - decode and populate gd->bd->bi_dram * diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 78576b530fd..da94bc5e15a 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1106,6 +1106,51 @@ int fdtdec_setup_memory_banksize(void) return 0; } + +int fdtdec_setup_mem_size_base_lowest(void) +{ + int bank, ret, mem, reg = 0; + struct fdt_resource res; + unsigned long base; + phys_size_t size; + const void *blob = gd->fdt_blob; + + gd->ram_base = (unsigned long)~0; + + mem = get_next_memory_node(blob, -1); + if (mem < 0) { + debug("%s: Missing /memory node\n", __func__); + return -EINVAL; + } + + for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) { + ret = fdt_get_resource(blob, mem, "reg", reg++, &res); + if (ret == -FDT_ERR_NOTFOUND) { + reg = 0; + mem = get_next_memory_node(blob, mem); + if (mem == -FDT_ERR_NOTFOUND) + break; + + ret = fdt_get_resource(blob, mem, "reg", reg++, &res); + if (ret == -FDT_ERR_NOTFOUND) + break; + } + if (ret != 0) + return -EINVAL; + + base = (unsigned long)res.start; + size = (phys_size_t)(res.end - res.start + 1); + + if (gd->ram_base > base && size) { + gd->ram_base = base; + gd->ram_size = size; + debug("%s: Initial DRAM base %lx size %lx\n", + __func__, base, (unsigned long)size); + } + } + + return 0; +} #endif #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) From c2f0950c33ef9d89573609b6352a9964af8833a1 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 10 Jul 2020 13:34:44 +0200 Subject: [PATCH 008/117] lib: fdt: Convert fdtdes_setup_mem..() to livetree API Convert fdtdec_setup_mem_size_base(), get_next_memory_node(), fdtdec_setup_memory_banksize() and fdtdec_setup_mem_size_base_lowest() to livetree API. Tested on ZynqMP zcu104 board. Signed-off-by: Michal Simek Reviewed-by: Simon Glass --- lib/fdtdec.c | 67 +++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/lib/fdtdec.c b/lib/fdtdec.c index da94bc5e15a..30a1c6a217b 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -24,6 +24,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -1032,16 +1033,17 @@ int fdtdec_decode_display_timing(const void *blob, int parent, int index, int fdtdec_setup_mem_size_base(void) { - int ret, mem; - struct fdt_resource res; + int ret; + ofnode mem; + struct resource res; - mem = fdt_path_offset(gd->fdt_blob, "/memory"); - if (mem < 0) { + mem = ofnode_path("/memory"); + if (!ofnode_valid(mem)) { debug("%s: Missing /memory node\n", __func__); return -EINVAL; } - ret = fdt_get_resource(gd->fdt_blob, mem, "reg", 0, &res); + ret = ofnode_read_resource(mem, 0, &res); if (ret != 0) { debug("%s: Unable to decode first memory bank\n", __func__); return -EINVAL; @@ -1057,42 +1059,42 @@ int fdtdec_setup_mem_size_base(void) #if defined(CONFIG_NR_DRAM_BANKS) -static int get_next_memory_node(const void *blob, int mem) +ofnode get_next_memory_node(ofnode mem) { do { - mem = fdt_node_offset_by_prop_value(gd->fdt_blob, mem, - "device_type", "memory", 7); - } while (!fdtdec_get_is_enabled(blob, mem)); + mem = ofnode_by_prop_value(mem, "device_type", "memory", 7); + } while (!ofnode_is_available(mem)); return mem; } int fdtdec_setup_memory_banksize(void) { - int bank, ret, mem, reg = 0; - struct fdt_resource res; + int bank, ret, reg = 0; + struct resource res; + ofnode mem = ofnode_null(); - mem = get_next_memory_node(gd->fdt_blob, -1); - if (mem < 0) { + mem = get_next_memory_node(mem); + if (!ofnode_valid(mem)) { debug("%s: Missing /memory node\n", __func__); return -EINVAL; } for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) { - ret = fdt_get_resource(gd->fdt_blob, mem, "reg", reg++, &res); - if (ret == -FDT_ERR_NOTFOUND) { + ret = ofnode_read_resource(mem, reg++, &res); + if (ret < 0) { reg = 0; - mem = get_next_memory_node(gd->fdt_blob, mem); - if (mem == -FDT_ERR_NOTFOUND) + mem = get_next_memory_node(mem); + if (ofnode_valid(mem)) break; - ret = fdt_get_resource(gd->fdt_blob, mem, "reg", reg++, &res); - if (ret == -FDT_ERR_NOTFOUND) + ret = ofnode_read_resource(mem, reg++, &res); + if (ret < 0) break; } - if (ret != 0) { + + if (ret != 0) return -EINVAL; - } gd->bd->bi_dram[bank].start = (phys_addr_t)res.start; gd->bd->bi_dram[bank].size = @@ -1109,32 +1111,33 @@ int fdtdec_setup_memory_banksize(void) int fdtdec_setup_mem_size_base_lowest(void) { - int bank, ret, mem, reg = 0; - struct fdt_resource res; + int bank, ret, reg = 0; + struct resource res; unsigned long base; phys_size_t size; - const void *blob = gd->fdt_blob; + ofnode mem = ofnode_null(); gd->ram_base = (unsigned long)~0; - mem = get_next_memory_node(blob, -1); - if (mem < 0) { + mem = get_next_memory_node(mem); + if (!ofnode_valid(mem)) { debug("%s: Missing /memory node\n", __func__); return -EINVAL; } for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) { - ret = fdt_get_resource(blob, mem, "reg", reg++, &res); - if (ret == -FDT_ERR_NOTFOUND) { + ret = ofnode_read_resource(mem, reg++, &res); + if (ret < 0) { reg = 0; - mem = get_next_memory_node(blob, mem); - if (mem == -FDT_ERR_NOTFOUND) + mem = get_next_memory_node(mem); + if (ofnode_valid(mem)) break; - ret = fdt_get_resource(blob, mem, "reg", reg++, &res); - if (ret == -FDT_ERR_NOTFOUND) + ret = ofnode_read_resource(mem, reg++, &res); + if (ret < 0) break; } + if (ret != 0) return -EINVAL; From 22b6bb6ccd65e9d57b284895401de6b35d3b5ed9 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 10 Jul 2020 12:42:09 +0200 Subject: [PATCH 009/117] xilinx: versal: Use lowest memory for U-Boot Find and use the lowest memory for Versal to make sure that we keep u-boot as low as possible and never use memory above u-boot's maximum VA mapping. Signed-off-by: Michal Simek --- board/xilinx/versal/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index 45cf1d2d0ca..3dc7044b213 100644 --- a/board/xilinx/versal/board.c +++ b/board/xilinx/versal/board.c @@ -229,7 +229,7 @@ int dram_init_banksize(void) int dram_init(void) { - if (fdtdec_setup_mem_size_base() != 0) + if (fdtdec_setup_mem_size_base_lowest() != 0) return -EINVAL; return 0; From 8d00d224c97b3c871afa12ce53249fef99ee403a Mon Sep 17 00:00:00 2001 From: Ashok Reddy Soma Date: Mon, 6 Apr 2020 07:58:32 -0600 Subject: [PATCH 010/117] arm64: zynqmp: Reduce malloc memory for mini QSPI configuration Mini U-boot runs on lower foot print of 256KB OCM. Hence 8K memory for malloc may not be required. Reduce it by 1.5K. Signed-off-by: Ashok Reddy Soma Signed-off-by: Michal Simek --- include/configs/xilinx_zynqmp_mini_qspi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/configs/xilinx_zynqmp_mini_qspi.h b/include/configs/xilinx_zynqmp_mini_qspi.h index 129af6e9329..205ddb4ae09 100644 --- a/include/configs/xilinx_zynqmp_mini_qspi.h +++ b/include/configs/xilinx_zynqmp_mini_qspi.h @@ -13,6 +13,6 @@ #include #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + 0x20000) -#define CONFIG_SYS_MALLOC_LEN 0x2000 +#define CONFIG_SYS_MALLOC_LEN 0x1a00 #endif /* __CONFIG_ZYNQMP_MINI_QSPI_H */ From 9643000e1402b7f1bb2961166d4ab03785893b7a Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 15 Jul 2020 15:43:52 +0200 Subject: [PATCH 011/117] xilinx: Align dfu ram with booti command Image should be loaded to 0x80000 address and not to $kernel_addr_r. Also kernel_addr, fdt_addr and fdt_size in zynqmp case are not defined that's why define it to be aligned with Versal. Signed-off-by: Michal Simek --- include/configs/xilinx_versal.h | 2 +- include/configs/xilinx_zynqmp.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/configs/xilinx_versal.h b/include/configs/xilinx_versal.h index 804525dcad2..32cd5b21f7b 100644 --- a/include/configs/xilinx_versal.h +++ b/include/configs/xilinx_versal.h @@ -54,7 +54,7 @@ #define DFU_ALT_INFO_RAM \ "dfu_ram_info=" \ "setenv dfu_alt_info " \ - "Image ram $kernel_addr_r $kernel_size_r\\\\;" \ + "Image ram 80000 $kernel_size_r\\\\;" \ "system.dtb ram $fdt_addr_r $fdt_size_r\0" \ "dfu_ram=run dfu_ram_info && dfu 0 ram 0\0" \ "thor_ram=run dfu_ram_info && thordown 0 ram 0\0" diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h index 72aea1285f9..bbcdc48c749 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -58,8 +58,8 @@ #define DFU_ALT_INFO_RAM \ "dfu_ram_info=" \ "setenv dfu_alt_info " \ - "Image ram $kernel_addr $kernel_size\\\\;" \ - "system.dtb ram $fdt_addr $fdt_size\0" \ + "Image ram 80000 $kernel_size_r\\\\;" \ + "system.dtb ram $fdt_addr_r $fdt_size_r\0" \ "dfu_ram=run dfu_ram_info && dfu 0 ram 0\0" \ "thor_ram=run dfu_ram_info && thordown 0 ram 0\0" @@ -101,8 +101,10 @@ #define ENV_MEM_LAYOUT_SETTINGS \ "fdt_high=10000000\0" \ "fdt_addr_r=0x40000000\0" \ + "fdt_size_r=0x400000\0" \ "pxefile_addr_r=0x10000000\0" \ "kernel_addr_r=0x18000000\0" \ + "kernel_size_r=0x10000000\0" \ "scriptaddr=0x20000000\0" \ "ramdisk_addr_r=0x02100000\0" \ "script_size_f=0x80000\0" \ From 2d06361a11e88e6ca5bbd11e3ed5717d7715bfe1 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 15 Jul 2020 14:20:34 +0200 Subject: [PATCH 012/117] xilinx: zynqmp: Enable DFU tftp support Enable DFU tftp support for firmware update. Fill dfu_ram_tftp variable to have command present for showing how to use it. boot FIT image has been created from below fragment. Key part is that type of image has to be firmware. Also based on experiment load property is completely ignored and base addresses are taken from dfu_alt_info variable. $ cat update_uboot.its /dts-v1/; / { description = "Automatic U-Boot update"; #address-cells = <1>; images { Image { description = "Kernel"; data = /incbin/("/tftpboot/Image"); compression = "none"; arch = "arm64"; type = "firmware"; os = "linux"; load = <0x80000>; entry = <0x80000>; hash-1 { algo = "sha1"; }; }; system.dtb { description = "DTB"; data = /incbin/("/tftpboot/system.dtb"); compression = "none"; arch = "arm64"; type = "firmware"; load = <0>; hash-1 { algo = "sha1"; }; }; }; }; $ mkimage -f update_uboot.its /tftpboot/boot When U-Boot starts get IP address and server IP. dhcp setenv serverip 192.168.0.105 And then run prepared command. run dfu_ram_tftp Signed-off-by: Michal Simek --- configs/xilinx_zynqmp_virt_defconfig | 1 + include/configs/xilinx_zynqmp.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig index 7ed88ae0940..a0984c80453 100644 --- a/configs/xilinx_zynqmp_virt_defconfig +++ b/configs/xilinx_zynqmp_virt_defconfig @@ -66,6 +66,7 @@ CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SCSI_AHCI=y CONFIG_SATA_CEVA=y CONFIG_CLK_ZYNQMP=y +CONFIG_DFU_TFTP=y CONFIG_DFU_RAM=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_FLASH=y diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h index bbcdc48c749..7c24bf632e3 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -61,7 +61,9 @@ "Image ram 80000 $kernel_size_r\\\\;" \ "system.dtb ram $fdt_addr_r $fdt_size_r\0" \ "dfu_ram=run dfu_ram_info && dfu 0 ram 0\0" \ - "thor_ram=run dfu_ram_info && thordown 0 ram 0\0" + "thor_ram=run dfu_ram_info && thordown 0 ram 0\0" \ + "dfu_ram_tftp=run dfu_ram_info && setenv updatefile boot && " \ + "setenv loadaddr 10000000 && dfu tftp ram 0\0" #define DFU_ALT_INFO \ DFU_ALT_INFO_RAM From f692b479f02d9b2689b0686f1f6ff2f06c6ecc59 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 28 May 2020 11:48:55 +0200 Subject: [PATCH 013/117] i2c: eeprom: Use reg property instead of offset and size Remove adhoc dt binding for fixed-partition definition for i2c eeprom. fixed-partition are using reg property instead of offset/size pair. Signed-off-by: Michal Simek Reviewed-by: Simon Glass --- arch/arm/dts/imx53-ppd-uboot.dtsi | 12 ++++++------ arch/arm/dts/imx6q-bx50v3-uboot.dtsi | 10 +++++----- arch/sandbox/dts/test.dts | 13 +++++++++++++ configs/sandbox_defconfig | 1 + drivers/misc/i2c_eeprom.c | 15 ++++++++------- test/dm/bootcount.c | 8 ++++++++ 6 files changed, 41 insertions(+), 18 deletions(-) diff --git a/arch/arm/dts/imx53-ppd-uboot.dtsi b/arch/arm/dts/imx53-ppd-uboot.dtsi index d38a1bc264c..d61b7cb8764 100644 --- a/arch/arm/dts/imx53-ppd-uboot.dtsi +++ b/arch/arm/dts/imx53-ppd-uboot.dtsi @@ -24,15 +24,15 @@ &eeprom { partitions { compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - vpd { - offset = <0>; - size = <1022>; + vpd@0 { + reg = <0 1022>; }; - bootcount: bootcount { - offset = <1022>; - size = <2>; + bootcount: bootcount@1022 { + reg = <1022 2>; }; }; }; diff --git a/arch/arm/dts/imx6q-bx50v3-uboot.dtsi b/arch/arm/dts/imx6q-bx50v3-uboot.dtsi index df446e0ed14..01321cab781 100644 --- a/arch/arm/dts/imx6q-bx50v3-uboot.dtsi +++ b/arch/arm/dts/imx6q-bx50v3-uboot.dtsi @@ -23,15 +23,15 @@ &eeprom { partitions { compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - vpd { - offset = <0>; - size = <1022>; + vpd@0 { + reg = <0 1022>; }; bootcount: bootcount { - offset = <1022>; - size = <2>; + reg = <1022 2>; }; }; }; diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 491893a17dc..692c3775dde 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -415,6 +415,14 @@ reg = <0x2c>; compatible = "i2c-eeprom"; sandbox,emul = <&emul_eeprom>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + bootcount_i2c: bootcount@10 { + reg = <10 2>; + }; + }; }; rtc_0: rtc@43 { @@ -462,6 +470,11 @@ offset = <0x13>; }; + bootcount { + compatible = "u-boot,bootcount-i2c-eeprom"; + i2c-eeprom = <&bootcount_i2c>; + }; + adc@0 { compatible = "sandbox,adc"; vdd-supply = <&buck2>; diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index fe111289049..acd70933359 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -119,6 +119,7 @@ CONFIG_DM_BOOTCOUNT=y CONFIG_DM_BOOTCOUNT_RTC=y CONFIG_BUTTON=y CONFIG_BUTTON_GPIO=y +CONFIG_DM_BOOTCOUNT_I2C_EEPROM=y CONFIG_CLK=y CONFIG_CLK_COMPOSITE_CCF=y CONFIG_SANDBOX_CLK_CCF=y diff --git a/drivers/misc/i2c_eeprom.c b/drivers/misc/i2c_eeprom.c index 45c34d388c8..3651ba4871e 100644 --- a/drivers/misc/i2c_eeprom.c +++ b/drivers/misc/i2c_eeprom.c @@ -301,19 +301,20 @@ static int i2c_eeprom_partition_probe(struct udevice *dev) static int i2c_eeprom_partition_ofdata_to_platdata(struct udevice *dev) { struct i2c_eeprom_partition *priv = dev_get_priv(dev); - u32 offset, size; + u32 reg[2]; int ret; - ret = dev_read_u32(dev, "offset", &offset); + ret = dev_read_u32_array(dev, "reg", reg, 2); if (ret) return ret; - ret = dev_read_u32(dev, "size", &size); - if (ret) - return ret; + if (!reg[1]) + return -EINVAL; - priv->offset = offset; - priv->size = size; + priv->offset = reg[0]; + priv->size = reg[1]; + + debug("%s: base %x, size %x\n", __func__, priv->offset, priv->size); return 0; } diff --git a/test/dm/bootcount.c b/test/dm/bootcount.c index f911984698d..e0c47b5d7a6 100644 --- a/test/dm/bootcount.c +++ b/test/dm/bootcount.c @@ -25,6 +25,14 @@ static int dm_test_bootcount(struct unit_test_state *uts) ut_assertok(dm_bootcount_get(dev, &val)); ut_assert(val == 0xab); + ut_assertok(uclass_get_device(UCLASS_BOOTCOUNT, 1, &dev)); + ut_assertok(dm_bootcount_set(dev, 0)); + ut_assertok(dm_bootcount_get(dev, &val)); + ut_assert(val == 0); + ut_assertok(dm_bootcount_set(dev, 0xab)); + ut_assertok(dm_bootcount_get(dev, &val)); + ut_assert(val == 0xab); + return 0; } From 01a6da166102f5751985efef4504ac3c2c094d61 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 22 Jul 2020 17:42:43 +0200 Subject: [PATCH 014/117] xilinx: Fix xlnx,mio_bank property s/xlnx,mio_bank/xlnx,mio-bank/g DT binding is describing mio-bank not mio_bank that's why fix all DTSes and also driver itself. Signed-off-by: Michal Simek Acked-by: Peng Fan --- arch/arm/dts/avnet-ultrazedev-cc-v1.0-ultrazedev-som-v1.0.dts | 2 +- arch/arm/dts/avnet-ultrazedev-som-v1.0.dtsi | 2 +- arch/arm/dts/versal-mini-emmc0.dts | 2 +- arch/arm/dts/versal-mini-emmc1.dts | 2 +- arch/arm/dts/zynqmp-e-a2197-00-revA.dts | 2 +- arch/arm/dts/zynqmp-g-a2197-00-revA.dts | 2 +- arch/arm/dts/zynqmp-m-a2197-01-revA.dts | 4 ++-- arch/arm/dts/zynqmp-m-a2197-02-revA.dts | 4 ++-- arch/arm/dts/zynqmp-m-a2197-03-revA.dts | 4 ++-- arch/arm/dts/zynqmp-p-a2197-00-revA.dts | 4 ++-- arch/arm/dts/zynqmp-topic-miamimp-xilinx-xdp-v1r1.dts | 4 ++-- arch/arm/dts/zynqmp-zc1751-xm015-dc1.dts | 4 ++-- arch/arm/dts/zynqmp-zcu100-revC.dts | 4 ++-- arch/arm/dts/zynqmp-zcu102-revA.dts | 2 +- arch/arm/dts/zynqmp-zcu104-revA.dts | 2 +- arch/arm/dts/zynqmp-zcu104-revC.dts | 2 +- arch/arm/dts/zynqmp-zcu106-revA.dts | 2 +- arch/arm/dts/zynqmp-zcu111-revA.dts | 2 +- arch/arm/dts/zynqmp-zcu1275-revB.dts | 2 +- arch/arm/dts/zynqmp-zcu1285-revA.dts | 2 +- arch/arm/dts/zynqmp-zcu208-revA.dts | 2 +- arch/arm/dts/zynqmp-zcu216-revA.dts | 2 +- drivers/mmc/zynq_sdhci.c | 2 +- 23 files changed, 30 insertions(+), 30 deletions(-) diff --git a/arch/arm/dts/avnet-ultrazedev-cc-v1.0-ultrazedev-som-v1.0.dts b/arch/arm/dts/avnet-ultrazedev-cc-v1.0-ultrazedev-som-v1.0.dts index ac641ff1a58..85ab9e9e29a 100644 --- a/arch/arm/dts/avnet-ultrazedev-cc-v1.0-ultrazedev-som-v1.0.dts +++ b/arch/arm/dts/avnet-ultrazedev-cc-v1.0-ultrazedev-som-v1.0.dts @@ -51,7 +51,7 @@ /* microSD card slot */ &sdhci1 { status = "okay"; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; clock-frequency = <199998000>; max-frequency = <50000000>; no-1-8-v; diff --git a/arch/arm/dts/avnet-ultrazedev-som-v1.0.dtsi b/arch/arm/dts/avnet-ultrazedev-som-v1.0.dtsi index b635db649f4..cbcb290a5c8 100644 --- a/arch/arm/dts/avnet-ultrazedev-som-v1.0.dtsi +++ b/arch/arm/dts/avnet-ultrazedev-som-v1.0.dtsi @@ -51,6 +51,6 @@ /* Micron MTFC8GAKAJCN-4M 8 GB eMMC */ &sdhci0 { status = "okay"; - xlnx,mio_bank = <0>; + xlnx,mio-bank = <0>; clock-frequency = <199998000>; }; diff --git a/arch/arm/dts/versal-mini-emmc0.dts b/arch/arm/dts/versal-mini-emmc0.dts index 7f57d232b7f..7826a282134 100644 --- a/arch/arm/dts/versal-mini-emmc0.dts +++ b/arch/arm/dts/versal-mini-emmc0.dts @@ -43,7 +43,7 @@ clocks = <&clk25 &clk25>; xlnx,device_id = <0>; no-1-8-v; - xlnx,mio_bank = <0>; + xlnx,mio-bank = <0>; #stream-id-cells = <1>; }; }; diff --git a/arch/arm/dts/versal-mini-emmc1.dts b/arch/arm/dts/versal-mini-emmc1.dts index 4e0758f6189..2f28f856a6a 100644 --- a/arch/arm/dts/versal-mini-emmc1.dts +++ b/arch/arm/dts/versal-mini-emmc1.dts @@ -43,7 +43,7 @@ clocks = <&clk25 &clk25>; xlnx,device_id = <1>; no-1-8-v; - xlnx,mio_bank = <0>; + xlnx,mio-bank = <0>; #stream-id-cells = <1>; }; }; diff --git a/arch/arm/dts/zynqmp-e-a2197-00-revA.dts b/arch/arm/dts/zynqmp-e-a2197-00-revA.dts index c260411d757..a8bbb14f6cd 100644 --- a/arch/arm/dts/zynqmp-e-a2197-00-revA.dts +++ b/arch/arm/dts/zynqmp-e-a2197-00-revA.dts @@ -131,7 +131,7 @@ status = "okay"; no-1-8-v; disable-wp; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; }; &gem0 { diff --git a/arch/arm/dts/zynqmp-g-a2197-00-revA.dts b/arch/arm/dts/zynqmp-g-a2197-00-revA.dts index 09da60b1007..9468dc574fd 100644 --- a/arch/arm/dts/zynqmp-g-a2197-00-revA.dts +++ b/arch/arm/dts/zynqmp-g-a2197-00-revA.dts @@ -70,7 +70,7 @@ non-removable; disable-wp; bus-width = <8>; - xlnx,mio_bank = <0>; + xlnx,mio-bank = <0>; }; &uart0 { /* uart0 MIO38-39 */ diff --git a/arch/arm/dts/zynqmp-m-a2197-01-revA.dts b/arch/arm/dts/zynqmp-m-a2197-01-revA.dts index e295bac128c..66ea02e5be7 100644 --- a/arch/arm/dts/zynqmp-m-a2197-01-revA.dts +++ b/arch/arm/dts/zynqmp-m-a2197-01-revA.dts @@ -89,7 +89,7 @@ non-removable; disable-wp; bus-width = <8>; - xlnx,mio_bank = <0>; /* FIXME tap delay */ + xlnx,mio-bank = <0>; /* FIXME tap delay */ }; &uart0 { /* uart0 MIO38-39 */ @@ -106,7 +106,7 @@ status = "disable"; no-1-8-v; disable-wp; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; }; &gem0 { diff --git a/arch/arm/dts/zynqmp-m-a2197-02-revA.dts b/arch/arm/dts/zynqmp-m-a2197-02-revA.dts index bd2c1a46bd8..46ec427648f 100644 --- a/arch/arm/dts/zynqmp-m-a2197-02-revA.dts +++ b/arch/arm/dts/zynqmp-m-a2197-02-revA.dts @@ -85,7 +85,7 @@ non-removable; disable-wp; bus-width = <8>; - xlnx,mio_bank = <0>; /* FIXME tap delay */ + xlnx,mio-bank = <0>; /* FIXME tap delay */ }; &uart0 { /* uart0 MIO38-39 */ @@ -102,7 +102,7 @@ status = "disable"; no-1-8-v; disable-wp; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; }; &gem0 { diff --git a/arch/arm/dts/zynqmp-m-a2197-03-revA.dts b/arch/arm/dts/zynqmp-m-a2197-03-revA.dts index 700197c1f3e..6eb58e6701a 100644 --- a/arch/arm/dts/zynqmp-m-a2197-03-revA.dts +++ b/arch/arm/dts/zynqmp-m-a2197-03-revA.dts @@ -85,7 +85,7 @@ non-removable; disable-wp; bus-width = <8>; - xlnx,mio_bank = <0>; /* FIXME tap delay */ + xlnx,mio-bank = <0>; /* FIXME tap delay */ }; &uart0 { /* uart0 MIO38-39 */ @@ -102,7 +102,7 @@ status = "disable"; no-1-8-v; disable-wp; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; }; &gem0 { diff --git a/arch/arm/dts/zynqmp-p-a2197-00-revA.dts b/arch/arm/dts/zynqmp-p-a2197-00-revA.dts index d49b632a1d3..4f7824ae400 100644 --- a/arch/arm/dts/zynqmp-p-a2197-00-revA.dts +++ b/arch/arm/dts/zynqmp-p-a2197-00-revA.dts @@ -50,7 +50,7 @@ non-removable; disable-wp; bus-width = <8>; - xlnx,mio_bank = <0>; + xlnx,mio-bank = <0>; }; &uart0 { /* uart0 MIO38-39 */ @@ -67,7 +67,7 @@ status = "okay"; no-1-8-v; disable-wp; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; }; &gem0 { diff --git a/arch/arm/dts/zynqmp-topic-miamimp-xilinx-xdp-v1r1.dts b/arch/arm/dts/zynqmp-topic-miamimp-xilinx-xdp-v1r1.dts index 0ee8c62f6b9..a377f27c50d 100644 --- a/arch/arm/dts/zynqmp-topic-miamimp-xilinx-xdp-v1r1.dts +++ b/arch/arm/dts/zynqmp-topic-miamimp-xilinx-xdp-v1r1.dts @@ -97,13 +97,13 @@ non-removable; disable-wp; /* We don't have a write-protect detection */ bus-width = <8>; - xlnx,mio_bank = <0>; + xlnx,mio-bank = <0>; }; /* SD1 with level shifter */ &sdhci1 { status = "okay"; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; disable-wp; /* We don't have a write-protect detection */ bus-width = <4>; }; diff --git a/arch/arm/dts/zynqmp-zc1751-xm015-dc1.dts b/arch/arm/dts/zynqmp-zc1751-xm015-dc1.dts index 0805b93c4ac..e2428ec974a 100644 --- a/arch/arm/dts/zynqmp-zc1751-xm015-dc1.dts +++ b/arch/arm/dts/zynqmp-zc1751-xm015-dc1.dts @@ -148,7 +148,7 @@ &sdhci0 { status = "okay"; bus-width = <8>; - xlnx,mio_bank = <0>; + xlnx,mio-bank = <0>; }; /* SD1 with level shifter */ @@ -158,7 +158,7 @@ * This property should be removed for supporting UHS mode */ no-1-8-v; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; }; &uart0 { diff --git a/arch/arm/dts/zynqmp-zcu100-revC.dts b/arch/arm/dts/zynqmp-zcu100-revC.dts index 1726edf78ed..d6c914c917f 100644 --- a/arch/arm/dts/zynqmp-zcu100-revC.dts +++ b/arch/arm/dts/zynqmp-zcu100-revC.dts @@ -259,13 +259,13 @@ status = "okay"; no-1-8-v; disable-wp; - xlnx,mio_bank = <0>; + xlnx,mio-bank = <0>; }; &sdhci1 { status = "okay"; bus-width = <0x4>; - xlnx,mio_bank = <0>; + xlnx,mio-bank = <0>; non-removable; disable-wp; cap-power-off-card; diff --git a/arch/arm/dts/zynqmp-zcu102-revA.dts b/arch/arm/dts/zynqmp-zcu102-revA.dts index d250681600a..ed036e68f5e 100644 --- a/arch/arm/dts/zynqmp-zcu102-revA.dts +++ b/arch/arm/dts/zynqmp-zcu102-revA.dts @@ -660,7 +660,7 @@ * removed for supporting UHS mode */ no-1-8-v; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; }; &serdes { diff --git a/arch/arm/dts/zynqmp-zcu104-revA.dts b/arch/arm/dts/zynqmp-zcu104-revA.dts index a4bd6b800a1..cb8ffdff977 100644 --- a/arch/arm/dts/zynqmp-zcu104-revA.dts +++ b/arch/arm/dts/zynqmp-zcu104-revA.dts @@ -249,7 +249,7 @@ &sdhci1 { status = "okay"; no-1-8-v; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; disable-wp; }; diff --git a/arch/arm/dts/zynqmp-zcu104-revC.dts b/arch/arm/dts/zynqmp-zcu104-revC.dts index d4b3769a27c..e203280f0ec 100644 --- a/arch/arm/dts/zynqmp-zcu104-revC.dts +++ b/arch/arm/dts/zynqmp-zcu104-revC.dts @@ -262,7 +262,7 @@ &sdhci1 { status = "okay"; no-1-8-v; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; disable-wp; }; diff --git a/arch/arm/dts/zynqmp-zcu106-revA.dts b/arch/arm/dts/zynqmp-zcu106-revA.dts index 221685fd23b..1dff845ceeb 100644 --- a/arch/arm/dts/zynqmp-zcu106-revA.dts +++ b/arch/arm/dts/zynqmp-zcu106-revA.dts @@ -657,7 +657,7 @@ * This property should be removed for supporting UHS mode */ no-1-8-v; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; }; &serdes { diff --git a/arch/arm/dts/zynqmp-zcu111-revA.dts b/arch/arm/dts/zynqmp-zcu111-revA.dts index 63e285fe9a9..82e6c8d3cdf 100644 --- a/arch/arm/dts/zynqmp-zcu111-revA.dts +++ b/arch/arm/dts/zynqmp-zcu111-revA.dts @@ -568,7 +568,7 @@ * This property should be removed for supporting UHS mode */ no-1-8-v; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; }; &serdes { diff --git a/arch/arm/dts/zynqmp-zcu1275-revB.dts b/arch/arm/dts/zynqmp-zcu1275-revB.dts index 430fc5adb42..b612215f40e 100644 --- a/arch/arm/dts/zynqmp-zcu1275-revB.dts +++ b/arch/arm/dts/zynqmp-zcu1275-revB.dts @@ -80,5 +80,5 @@ * removed for supporting UHS mode */ no-1-8-v; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; }; diff --git a/arch/arm/dts/zynqmp-zcu1285-revA.dts b/arch/arm/dts/zynqmp-zcu1285-revA.dts index d8b9cb1a9e1..f041df83dab 100644 --- a/arch/arm/dts/zynqmp-zcu1285-revA.dts +++ b/arch/arm/dts/zynqmp-zcu1285-revA.dts @@ -245,5 +245,5 @@ * This property should be removed for supporting UHS mode */ no-1-8-v; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; }; diff --git a/arch/arm/dts/zynqmp-zcu208-revA.dts b/arch/arm/dts/zynqmp-zcu208-revA.dts index 118a2de96b3..124219314b8 100644 --- a/arch/arm/dts/zynqmp-zcu208-revA.dts +++ b/arch/arm/dts/zynqmp-zcu208-revA.dts @@ -565,7 +565,7 @@ * This property should be removed for supporting UHS mode */ no-1-8-v; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; }; &serdes { diff --git a/arch/arm/dts/zynqmp-zcu216-revA.dts b/arch/arm/dts/zynqmp-zcu216-revA.dts index e454bfcba79..511727fa955 100644 --- a/arch/arm/dts/zynqmp-zcu216-revA.dts +++ b/arch/arm/dts/zynqmp-zcu216-revA.dts @@ -569,7 +569,7 @@ * This property should be removed for supporting UHS mode */ no-1-8-v; - xlnx,mio_bank = <1>; + xlnx,mio-bank = <1>; }; &serdes { diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index 43b9f215229..6505527616d 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -276,7 +276,7 @@ static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev) return PTR_ERR(priv->host->ioaddr); priv->deviceid = dev_read_u32_default(dev, "xlnx,device_id", -1); - priv->bank = dev_read_u32_default(dev, "xlnx,mio_bank", -1); + priv->bank = dev_read_u32_default(dev, "xlnx,mio-bank", -1); return 0; } From e8deb2218509ffe686601b7e51091407fda58fbf Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 22 Jul 2020 17:46:31 +0200 Subject: [PATCH 015/117] mmc: zynq: Fix default value for xlnx,mio-bank DT binding is saying that default value is 0 not -1 that's why fix it. Signed-off-by: Michal Simek Acked-by: Peng Fan --- drivers/mmc/zynq_sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index 6505527616d..e9381b94930 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -276,7 +276,7 @@ static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev) return PTR_ERR(priv->host->ioaddr); priv->deviceid = dev_read_u32_default(dev, "xlnx,device_id", -1); - priv->bank = dev_read_u32_default(dev, "xlnx,mio-bank", -1); + priv->bank = dev_read_u32_default(dev, "xlnx,mio-bank", 0); return 0; } From f6cccbb5f24ff7a19be84fb755d8566aee647244 Mon Sep 17 00:00:00 2001 From: Ibai Erkiaga Date: Tue, 4 Aug 2020 23:17:26 +0100 Subject: [PATCH 016/117] xilinx: zynqmp: synchronize firmware call return payload Removes duplicated definition of PAYLOAD_ARG_CNT and define it in the firmware driver. Additionally fixes payload buffer declarations without macro usage Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- arch/arm/mach-versal/include/mach/sys_proto.h | 2 -- arch/arm/mach-zynqmp/include/mach/sys_proto.h | 2 -- board/xilinx/versal/cmds.c | 2 +- drivers/fpga/versalpl.c | 2 +- include/zynqmp_firmware.h | 9 +++++++++ 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-versal/include/mach/sys_proto.h b/arch/arm/mach-versal/include/mach/sys_proto.h index cfd480bec17..05934c28d67 100644 --- a/arch/arm/mach-versal/include/mach/sys_proto.h +++ b/arch/arm/mach-versal/include/mach/sys_proto.h @@ -8,7 +8,5 @@ enum { TCM_SPLIT, }; -#define PAYLOAD_ARG_CNT 5U - void tcm_init(u8 mode); void mem_map_fill(void); diff --git a/arch/arm/mach-zynqmp/include/mach/sys_proto.h b/arch/arm/mach-zynqmp/include/mach/sys_proto.h index 2974ffbc2f5..4078f958fc6 100644 --- a/arch/arm/mach-zynqmp/include/mach/sys_proto.h +++ b/arch/arm/mach-zynqmp/include/mach/sys_proto.h @@ -7,8 +7,6 @@ #ifndef _ASM_ARCH_SYS_PROTO_H #define _ASM_ARCH_SYS_PROTO_H -#define PAYLOAD_ARG_CNT 5 - #define ZYNQMP_CSU_SILICON_VER_MASK 0xF #define KEY_PTR_LEN 32 diff --git a/board/xilinx/versal/cmds.c b/board/xilinx/versal/cmds.c index 981c80ee474..f5735d0c62c 100644 --- a/board/xilinx/versal/cmds.c +++ b/board/xilinx/versal/cmds.c @@ -16,7 +16,7 @@ static int do_versal_load_pdi(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) { u32 buf_lo, buf_hi; - u32 ret_payload[5]; + u32 ret_payload[PAYLOAD_ARG_CNT]; ulong addr, *pdi_buf; size_t len; int ret; diff --git a/drivers/fpga/versalpl.c b/drivers/fpga/versalpl.c index 8e2ef4f0da9..c44a7d34557 100644 --- a/drivers/fpga/versalpl.c +++ b/drivers/fpga/versalpl.c @@ -32,7 +32,7 @@ static int versal_load(xilinx_desc *desc, const void *buf, size_t bsize, ulong bin_buf; int ret; u32 buf_lo, buf_hi; - u32 ret_payload[5]; + u32 ret_payload[PAYLOAD_ARG_CNT]; bin_buf = versal_align_dma_buffer((ulong *)buf, bsize); diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h index 93d771ece26..2c44951f861 100644 --- a/include/zynqmp_firmware.h +++ b/include/zynqmp_firmware.h @@ -77,6 +77,15 @@ enum pm_api_id { #define PMUFW_V1_0 ((1 << ZYNQMP_PM_VERSION_MAJOR_SHIFT) | 0) +/* + * Return payload size + * Not every firmware call expects the same amount of return bytes, however the + * firmware driver always copies 5 bytes from RX buffer to the ret_payload + * buffer. Therefore allocating with this defined value is recommended to avoid + * overflows. + */ +#define PAYLOAD_ARG_CNT 5U + unsigned int zynqmp_firmware_version(void); void zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size); int xilinx_pm_request(u32 api_id, u32 arg0, u32 arg1, u32 arg2, From 2eabb6bfeac791e44b1900fbe86977fd8638e16e Mon Sep 17 00:00:00 2001 From: Ibai Erkiaga Date: Tue, 4 Aug 2020 23:17:27 +0100 Subject: [PATCH 017/117] xilinx: zynqmp: merge firmware calls for EL2 and EL3 This patch merges ZynqMP firmware calls under xilinx_pm_request in order to make trainsparent the EL. Calls at EL3 are send through IPI messages and EL2 through SMC calls. The EL2 call uses fixed payload and arg size as the EL3 call. The firmware is capable to handle PMUFW_PAYLOAD_ARG_CNT bytes but the firmware API is limited by the SMC call size. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- drivers/firmware/firmware-zynqmp.c | 86 +++++++++++++++--------------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c index 66edc169301..903a8f58782 100644 --- a/drivers/firmware/firmware-zynqmp.c +++ b/drivers/firmware/firmware-zynqmp.c @@ -37,6 +37,7 @@ static int ipi_req(const u32 *req, size_t req_len, u32 *res, size_t res_maxlen) if (!(zynqmp_power.tx_chan.dev) || !(&zynqmp_power.rx_chan.dev)) return -EINVAL; + debug("%s, Sending IPI message with ID: 0x%0x\n", __func__, req[0]); msg.buf = (u32 *)req; msg.len = req_len; ret = mbox_send(&zynqmp_power.tx_chan, &msg); @@ -54,14 +55,6 @@ static int ipi_req(const u32 *req, size_t req_len, u32 *res, size_t res_maxlen) return ret; } -static int send_req(const u32 *req, size_t req_len, u32 *res, size_t res_maxlen) -{ - if (IS_ENABLED(CONFIG_SPL_BUILD) || current_el() == 3) - return ipi_req(req, req_len, res, res_maxlen); - - return xilinx_pm_request(req[0], 0, 0, 0, 0, res); -} - unsigned int zynqmp_firmware_version(void) { int ret; @@ -74,9 +67,9 @@ unsigned int zynqmp_firmware_version(void) * asking PMUFW again. **/ if (pm_api_version == ZYNQMP_PM_VERSION_INVALID) { - const u32 request[] = { PM_GET_API_VERSION }; - ret = send_req(request, ARRAY_SIZE(request), ret_payload, 2); + ret = xilinx_pm_request(PM_GET_API_VERSION, 0, 0, 0, 0, + ret_payload); if (ret) panic("PMUFW is not found - Please load it!\n"); @@ -97,16 +90,13 @@ unsigned int zynqmp_firmware_version(void) */ void zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size) { - const u32 request[] = { - PM_SET_CONFIGURATION, - (u32)((u64)cfg_obj) - }; - u32 response = 0; int err; + u32 ret_payload[PAYLOAD_ARG_CNT]; printf("Loading new PMUFW cfg obj (%ld bytes)\n", size); - err = send_req(request, ARRAY_SIZE(request), &response, 1); + err = xilinx_pm_request(PM_SET_CONFIGURATION, (u32)(u64)cfg_obj, 0, 0, + 0, ret_payload); if (err == XST_PM_NO_ACCESS) { printf("PMUFW no permission to change config object\n"); return; @@ -115,10 +105,10 @@ void zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size) if (err) printf("Cannot load PMUFW configuration object (%d)\n", err); - if (response) - printf("PMUFW returned 0x%08x status!\n", response); + if (ret_payload[0]) + printf("PMUFW returned 0x%08x status!\n", ret_payload[0]); - if ((err || response) && IS_ENABLED(CONFIG_SPL_BUILD)) + if ((err || ret_payload[0]) && IS_ENABLED(CONFIG_SPL_BUILD)) panic("PMUFW config object loading failed in EL3\n"); } @@ -164,32 +154,44 @@ U_BOOT_DRIVER(zynqmp_power) = { int __maybe_unused xilinx_pm_request(u32 api_id, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 *ret_payload) { - /* - * Added SIP service call Function Identifier - * Make sure to stay in x0 register - */ - struct pt_regs regs; + debug("%s at EL%d, API ID: 0x%0x\n", __func__, current_el(), api_id); - if (current_el() == 3) { - printf("%s: Can't call SMC from EL3 context\n", __func__); + if (IS_ENABLED(CONFIG_SPL_BUILD) || current_el() == 3) { +#if defined(CONFIG_ZYNQMP_IPI) + /* + * Use fixed payload and arg size as the EL2 call. The firmware + * is capable to handle PMUFW_PAYLOAD_ARG_CNT bytes but the + * firmware API is limited by the SMC call size + */ + u32 regs[] = {api_id, arg0, arg1, arg2, arg3}; + + ipi_req(regs, PAYLOAD_ARG_CNT, ret_payload, PAYLOAD_ARG_CNT); +#else return -EPERM; +#endif + } else { + /* + * Added SIP service call Function Identifier + * Make sure to stay in x0 register + */ + struct pt_regs regs; + + regs.regs[0] = PM_SIP_SVC | api_id; + regs.regs[1] = ((u64)arg1 << 32) | arg0; + regs.regs[2] = ((u64)arg3 << 32) | arg2; + + smc_call(®s); + + if (ret_payload) { + ret_payload[0] = (u32)regs.regs[0]; + ret_payload[1] = upper_32_bits(regs.regs[0]); + ret_payload[2] = (u32)regs.regs[1]; + ret_payload[3] = upper_32_bits(regs.regs[1]); + ret_payload[4] = (u32)regs.regs[2]; + } + } - - regs.regs[0] = PM_SIP_SVC | api_id; - regs.regs[1] = ((u64)arg1 << 32) | arg0; - regs.regs[2] = ((u64)arg3 << 32) | arg2; - - smc_call(®s); - - if (ret_payload) { - ret_payload[0] = (u32)regs.regs[0]; - ret_payload[1] = upper_32_bits(regs.regs[0]); - ret_payload[2] = (u32)regs.regs[1]; - ret_payload[3] = upper_32_bits(regs.regs[1]); - ret_payload[4] = (u32)regs.regs[2]; - } - - return regs.regs[0]; + return (ret_payload) ? ret_payload[0] : 0; } static const struct udevice_id zynqmp_firmware_ids[] = { From 21c2fc7c6a685aa2c1f95d3d23dd7494b5c2dd43 Mon Sep 17 00:00:00 2001 From: Ibai Erkiaga Date: Tue, 4 Aug 2020 23:17:28 +0100 Subject: [PATCH 018/117] xilinx: zynqmp: get chip ID using firmware driver Current implementation for getting chip ID uses either raw access on EL3 or a SMC call to get the silicon information. Following change simplifies the code using always the firmware driver. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- board/xilinx/zynqmp/zynqmp.c | 77 ++++++++++++------------------------ 1 file changed, 26 insertions(+), 51 deletions(-) diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 8a4df6fc1ab..cf5febc4c41 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -199,60 +199,34 @@ static const struct { int chip_id(unsigned char id) { - struct pt_regs regs; int val = -EINVAL; + u32 ret_payload[PAYLOAD_ARG_CNT]; - if (current_el() != 3) { - regs.regs[0] = ZYNQMP_SIP_SVC_CSU_DMA_CHIPID; - regs.regs[1] = 0; - regs.regs[2] = 0; - regs.regs[3] = 0; + xilinx_pm_request(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload); - smc_call(®s); - - /* - * SMC returns: - * regs[0][31:0] = status of the operation - * regs[0][63:32] = CSU.IDCODE register - * regs[1][31:0] = CSU.version register - * regs[1][63:32] = CSU.IDCODE2 register - */ - switch (id) { - case IDCODE: - regs.regs[0] = upper_32_bits(regs.regs[0]); - regs.regs[0] &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK | - ZYNQMP_CSU_IDCODE_SVD_MASK; - regs.regs[0] >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT; - val = regs.regs[0]; - break; - case VERSION: - regs.regs[1] = lower_32_bits(regs.regs[1]); - regs.regs[1] &= ZYNQMP_CSU_SILICON_VER_MASK; - val = regs.regs[1]; - break; - case IDCODE2: - regs.regs[1] = lower_32_bits(regs.regs[1]); - regs.regs[1] >>= ZYNQMP_CSU_VERSION_EMPTY_SHIFT; - val = regs.regs[1]; - break; - default: - printf("%s, Invalid Req:0x%x\n", __func__, id); - } - } else { - switch (id) { - case IDCODE: - val = readl(ZYNQMP_CSU_IDCODE_ADDR); - val &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK | - ZYNQMP_CSU_IDCODE_SVD_MASK; - val >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT; - break; - case VERSION: - val = readl(ZYNQMP_CSU_VER_ADDR); - val &= ZYNQMP_CSU_SILICON_VER_MASK; - break; - default: - printf("%s, Invalid Req:0x%x\n", __func__, id); - } + /* + * Firmware returns: + * payload[0][31:0] = status of the operation + * payload[1]] = IDCODE + * payload[2][19:0] = Version + * payload[2][28:20] = EXTENDED_IDCODE + * payload[2][29] = PL_INIT + */ + switch (id) { + case IDCODE: + val = ret_payload[1]; + val &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK | + ZYNQMP_CSU_IDCODE_SVD_MASK; + val >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT; + break; + case VERSION: + val = ret_payload[2] & ZYNQMP_CSU_SILICON_VER_MASK; + break; + case IDCODE2: + val = ret_payload[2] >> ZYNQMP_CSU_VERSION_EMPTY_SHIFT; + break; + default: + printf("%s, Invalid Req:0x%x\n", __func__, id); } return val; @@ -277,6 +251,7 @@ static char *zynqmp_get_silicon_idcode_name(void) id = chip_id(IDCODE); ver = chip_id(IDCODE2); + debug("%s, ID: 0x%0X, Ver: 0x%0X\r\n", __func__, id, ver); for (i = 0; i < ARRAY_SIZE(zynqmp_devices); i++) { if (zynqmp_devices[i].id == id) { From 4b2ad7b1111fe05e7e0b68922048210a5dfd04b0 Mon Sep 17 00:00:00 2001 From: Ibai Erkiaga Date: Tue, 4 Aug 2020 23:17:29 +0100 Subject: [PATCH 019/117] xilinx: zynqmp: get chip ID at EL3 Modify the board init function to allow getting the chip ID when U-Boot proper is executed at EL3. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- board/xilinx/zynqmp/zynqmp.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index cf5febc4c41..2b95a61dd0a 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -362,12 +362,10 @@ int board_init(void) #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \ !defined(CONFIG_SPL_BUILD) || (defined(CONFIG_SPL_FPGA_SUPPORT) && \ defined(CONFIG_SPL_BUILD)) - if (current_el() != 3) { - zynqmppl.name = zynqmp_get_silicon_idcode_name(); - printf("Chip ID:\t%s\n", zynqmppl.name); - fpga_init(); - fpga_add(fpga_xilinx, &zynqmppl); - } + zynqmppl.name = zynqmp_get_silicon_idcode_name(); + printf("Chip ID:\t%s\n", zynqmppl.name); + fpga_init(); + fpga_add(fpga_xilinx, &zynqmppl); #endif if (current_el() == 3) From 050f10f103cdf88704af962262f1131870894367 Mon Sep 17 00:00:00 2001 From: Ibai Erkiaga Date: Tue, 4 Aug 2020 23:17:30 +0100 Subject: [PATCH 020/117] xilinx: zynqmp: remove chip_id function Remove chip_id function and integrate the firmware call in the zynqmp_get_silicon_idcode_name function. The change avoids querying the firmware twice and makes the code bit more clear. Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- arch/arm/mach-zynqmp/include/mach/sys_proto.h | 1 - board/xilinx/zynqmp/zynqmp.c | 57 +++++++------------ 2 files changed, 20 insertions(+), 38 deletions(-) diff --git a/arch/arm/mach-zynqmp/include/mach/sys_proto.h b/arch/arm/mach-zynqmp/include/mach/sys_proto.h index 4078f958fc6..f2b3ceab135 100644 --- a/arch/arm/mach-zynqmp/include/mach/sys_proto.h +++ b/arch/arm/mach-zynqmp/include/mach/sys_proto.h @@ -49,7 +49,6 @@ int zynqmp_mmio_read(const u32 address, u32 *value); void initialize_tcm(bool mode); void mem_map_fill(void); -int chip_id(unsigned char id); #if defined(CONFIG_SYS_MEM_RSVD_FOR_MMU) || defined(CONFIG_DEFINE_TCM_OCM_MMAP) void tcm_init(u8 mode); #endif diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 2b95a61dd0a..2a430a9e463 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -197,41 +197,6 @@ static const struct { }; #endif -int chip_id(unsigned char id) -{ - int val = -EINVAL; - u32 ret_payload[PAYLOAD_ARG_CNT]; - - xilinx_pm_request(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload); - - /* - * Firmware returns: - * payload[0][31:0] = status of the operation - * payload[1]] = IDCODE - * payload[2][19:0] = Version - * payload[2][28:20] = EXTENDED_IDCODE - * payload[2][29] = PL_INIT - */ - switch (id) { - case IDCODE: - val = ret_payload[1]; - val &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK | - ZYNQMP_CSU_IDCODE_SVD_MASK; - val >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT; - break; - case VERSION: - val = ret_payload[2] & ZYNQMP_CSU_SILICON_VER_MASK; - break; - case IDCODE2: - val = ret_payload[2] >> ZYNQMP_CSU_VERSION_EMPTY_SHIFT; - break; - default: - printf("%s, Invalid Req:0x%x\n", __func__, id); - } - - return val; -} - #define ZYNQMP_VERSION_SIZE 9 #define ZYNQMP_PL_STATUS_BIT 9 #define ZYNQMP_IPDIS_VCU_BIT 8 @@ -248,9 +213,27 @@ static char *zynqmp_get_silicon_idcode_name(void) u32 i, id, ver, j; char *buf; static char name[ZYNQMP_VERSION_SIZE]; + u32 ret_payload[PAYLOAD_ARG_CNT]; + + xilinx_pm_request(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload); + + /* + * Firmware returns: + * payload[0][31:0] = status of the operation + * payload[1]] = IDCODE + * payload[2][19:0] = Version + * payload[2][28:20] = EXTENDED_IDCODE + * payload[2][29] = PL_INIT + */ + + /* Get IDCODE field */ + id = ret_payload[1]; + id &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK | ZYNQMP_CSU_IDCODE_SVD_MASK; + id >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT; + + /* Shift silicon version info */ + ver = ret_payload[2] >> ZYNQMP_CSU_VERSION_EMPTY_SHIFT; - id = chip_id(IDCODE); - ver = chip_id(IDCODE2); debug("%s, ID: 0x%0X, Ver: 0x%0X\r\n", __func__, id, ver); for (i = 0; i < ARRAY_SIZE(zynqmp_devices); i++) { From de4f748ef5b834b3e7cea24449b7e74341a9111a Mon Sep 17 00:00:00 2001 From: Ibai Erkiaga Date: Tue, 4 Aug 2020 23:17:32 +0100 Subject: [PATCH 021/117] xilinx: zynqmp: fix incorrect map not align with IPI HW Current IPI module register description is not align with IPI HW. The registers with the wrong offset are not used so it does not cause real issues. This patch aligns the register description. Additionally comments added to explain why recv function does not check any flag prior copying rx data. Fixes: 660b0c77d816 ("mailbox: zynqmp: ipi mailbox driver") Signed-off-by: Ibai Erkiaga Signed-off-by: Michal Simek --- drivers/mailbox/zynqmp-ipi.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/mailbox/zynqmp-ipi.c b/drivers/mailbox/zynqmp-ipi.c index f206a27a79e..746377e557c 100644 --- a/drivers/mailbox/zynqmp-ipi.c +++ b/drivers/mailbox/zynqmp-ipi.c @@ -24,10 +24,12 @@ struct ipi_int_regs { u32 trig; /* 0x0 */ u32 obs; /* 0x4 */ - u32 ist; /* 0x8 */ - u32 imr; /* 0xC */ - u32 ier; /* 0x10 */ - u32 idr; /* 0x14 */ + u32 dummy0; + u32 dummy1; + u32 isr; /* 0x10 */ + u32 imr; /* 0x14 */ + u32 ier; /* 0x18 */ + u32 idr; /* 0x1C */ }; #define ipi_int_apu ((struct ipi_int_regs *)IPI_INT_REG_BASE_APU) @@ -66,6 +68,10 @@ static int zynqmp_ipi_recv(struct mbox_chan *chan, void *data) struct zynqmp_ipi *zynqmp = dev_get_priv(chan->dev); u32 *mbx = (u32 *)zynqmp->local_res_regs; + /* + * PMU Firmware does not trigger IPI interrupt for API call responses so + * there is no need to check ISR flags + */ for (size_t i = 0; i < msg->len; i++) msg->buf[i] = readl(&mbx[i]); From d5c42ec31b004218666b60ab990c1b56d5b09050 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 3 Aug 2020 15:14:24 +0200 Subject: [PATCH 022/117] xilinx: versal: Enable i2c misc eeprom driver Enable this driver to be able to work with i2c based eeproms on Versal. Signed-off-by: Michal Simek --- configs/xilinx_versal_virt_defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/xilinx_versal_virt_defconfig b/configs/xilinx_versal_virt_defconfig index 49138278f1e..4c463f48eed 100644 --- a/configs/xilinx_versal_virt_defconfig +++ b/configs/xilinx_versal_virt_defconfig @@ -44,6 +44,9 @@ CONFIG_FPGA_VERSALPL=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_CADENCE=y CONFIG_MISC=y +CONFIG_I2C_EEPROM=y +CONFIG_SYS_I2C_EEPROM_ADDR=0x0 +CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW=0x0 CONFIG_MMC_IO_VOLTAGE=y CONFIG_MMC_UHS_SUPPORT=y CONFIG_MMC_HS400_SUPPORT=y From 62b96262b6dad1000b1ed2fec8664c2757585061 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 28 Jul 2020 12:45:47 +0200 Subject: [PATCH 023/117] xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating variables with run time information. Signed-off-by: Michal Simek --- arch/arm/Kconfig | 3 +++ board/xilinx/versal/board.c | 3 +++ board/xilinx/zynq/board.c | 9 +++++++++ board/xilinx/zynqmp/zynqmp.c | 3 +++ 4 files changed, 18 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index a3930b57141..9b8dadce837 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1085,6 +1085,7 @@ config ARCH_VERSAL select DM_SERIAL select OF_CONTROL imply BOARD_LATE_INIT + imply ENV_VARS_UBOOT_RUNTIME_CONFIG config ARCH_VF610 bool "Freescale Vybrid" @@ -1120,6 +1121,7 @@ config ARCH_ZYNQ imply CMD_CLK imply CMD_DM imply CMD_SPL + imply ENV_VARS_UBOOT_RUNTIME_CONFIG imply FAT_WRITE config ARCH_ZYNQMP_R5 @@ -1159,6 +1161,7 @@ config ARCH_ZYNQMP select ZYNQMP_IPI imply BOARD_LATE_INIT imply CMD_DM + imply ENV_VARS_UBOOT_RUNTIME_CONFIG imply FAT_WRITE imply MP imply DM_USB_GADGET diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index 3dc7044b213..a5ca4ca8740 100644 --- a/board/xilinx/versal/board.c +++ b/board/xilinx/versal/board.c @@ -116,6 +116,9 @@ int board_late_init(void) return 0; } + if (!CONFIG_IS_ENABLED(ENV_VARS_UBOOT_RUNTIME_CONFIG)) + return 0; + bootmode = versal_get_bootmode(); puts("Bootmode: "); diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 2164eac8d51..7ac069aaafd 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,14 @@ int board_late_init(void) char *new_targets; char *env_targets; + if (!(gd->flags & GD_FLG_ENV_DEFAULT)) { + debug("Saved variables - Skipping\n"); + return 0; + } + + if (!CONFIG_IS_ENABLED(ENV_VARS_UBOOT_RUNTIME_CONFIG)) + return 0; + switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) { case ZYNQ_BM_QSPI: mode = "qspi"; diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 2a430a9e463..b4e7301d509 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -568,6 +568,9 @@ int board_late_init(void) return 0; } + if (!CONFIG_IS_ENABLED(ENV_VARS_UBOOT_RUNTIME_CONFIG)) + return 0; + ret = set_fdtfile(); if (ret) return ret; From 9fea3b18d65d412c386319360d641c9c47122ec2 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 3 Aug 2020 12:59:28 +0200 Subject: [PATCH 024/117] xilinx: Change logic around zynq_board_read_rom_ethaddr() There is no reason to build private function when CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET is not defined. There is already weak function which handles default case properly. Signed-off-by: Michal Simek --- board/xilinx/common/board.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 3bca3a25a97..0782d08ee3f 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -13,11 +13,10 @@ #include #include "board.h" +#if defined(CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET) int zynq_board_read_rom_ethaddr(unsigned char *ethaddr) { int ret = -EINVAL; - -#if defined(CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET) struct udevice *dev; ofnode eeprom; @@ -37,10 +36,10 @@ int zynq_board_read_rom_ethaddr(unsigned char *ethaddr) debug("%s: I2C EEPROM MAC address read failed\n", __func__); else debug("%s: I2C EEPROM MAC %pM\n", __func__, ethaddr); -#endif return ret; } +#endif #if defined(CONFIG_OF_BOARD) || defined(CONFIG_OF_SEPARATE) void *board_fdt_blob_setup(void) From 0bfb43dfc14ec4ca5a07f5d22063f1869c45de45 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 12 Aug 2020 12:04:50 +0200 Subject: [PATCH 025/117] xilinx: common: Get rid of fdt_high variable There is no need to setup this variable if bootm_low and bootm_size variable are properly setup. If fdt_high variable is missing U-Boot is asking LMB to return free memory which is not used. Signed-off-by: Michal Simek --- include/configs/xilinx_versal.h | 1 - include/configs/xilinx_zynqmp.h | 1 - include/configs/zynq-common.h | 1 - 3 files changed, 3 deletions(-) diff --git a/include/configs/xilinx_versal.h b/include/configs/xilinx_versal.h index 32cd5b21f7b..d7255a05dff 100644 --- a/include/configs/xilinx_versal.h +++ b/include/configs/xilinx_versal.h @@ -79,7 +79,6 @@ #define CONFIG_CLOCKS #define ENV_MEM_LAYOUT_SETTINGS \ - "fdt_high=10000000\0" \ "fdt_addr_r=0x40000000\0" \ "fdt_size_r=0x400000\0" \ "pxefile_addr_r=0x10000000\0" \ diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h index 7c24bf632e3..15ad4198a6b 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -101,7 +101,6 @@ #define CONFIG_CLOCKS #define ENV_MEM_LAYOUT_SETTINGS \ - "fdt_high=10000000\0" \ "fdt_addr_r=0x40000000\0" \ "fdt_size_r=0x400000\0" \ "pxefile_addr_r=0x10000000\0" \ diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h index 79c75784f2b..1607a8d0651 100644 --- a/include/configs/zynq-common.h +++ b/include/configs/zynq-common.h @@ -196,7 +196,6 @@ /* Default environment */ #ifndef CONFIG_EXTRA_ENV_SETTINGS #define CONFIG_EXTRA_ENV_SETTINGS \ - "fdt_high=0x20000000\0" \ "scriptaddr=0x20000\0" \ "script_size_f=0x40000\0" \ "fdt_addr_r=0x1f00000\0" \ From 653809f43f4d1872825ca281e488b1e7b56b9e95 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 12 Aug 2020 12:11:06 +0200 Subject: [PATCH 026/117] xilinx: common: Get rid of initrd_high variable setup When bootm_low/bootm_size are setup properly there is no need to setup any initrd_high address. Location for initrd is determined through LMB. Signed-off-by: Michal Simek --- board/xilinx/common/board.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 0782d08ee3f..901591ba2a8 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -77,14 +77,8 @@ void *board_fdt_blob_setup(void) int board_late_init_xilinx(void) { - ulong initrd_hi; - env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET); - initrd_hi = gd->start_addr_sp - CONFIG_STACK_SIZE; - initrd_hi = round_down(initrd_hi, SZ_16M); - env_set_addr("initrd_high", (void *)initrd_hi); - env_set_addr("bootm_low", (void *)gd->ram_base); env_set_addr("bootm_size", (void *)gd->ram_size); From ca0f616530316f324516fd91a2d90e0449f1e526 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 12 Aug 2020 12:16:49 +0200 Subject: [PATCH 027/117] xilinx: common: Check return value from variable setup env_set..() can failed that's why check return status and report it back to make sure that user is aware that's something went wrong. Signed-off-by: Michal Simek --- board/xilinx/common/board.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 901591ba2a8..581c88ad49a 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -77,10 +77,15 @@ void *board_fdt_blob_setup(void) int board_late_init_xilinx(void) { - env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET); + u32 ret = 0; - env_set_addr("bootm_low", (void *)gd->ram_base); - env_set_addr("bootm_size", (void *)gd->ram_size); + ret |= env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET); + + ret |= env_set_addr("bootm_low", (void *)gd->ram_base); + ret |= env_set_addr("bootm_size", (void *)gd->ram_size); + + if (ret) + printf("%s: Saving run time variables FAILED\n", __func__); return 0; } From 2570cc6430cf191b2b0f71b9dcfed46c94a645dc Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 12 Aug 2020 12:17:53 +0200 Subject: [PATCH 028/117] xilinx: common: Change bootm_size variable setting Linux kernel for arm32 requires dtb and initrd to be placed in low memory to work properly. This requirement is described in chapter 4b) and 5) in Linux documentation (Documentation/arm/booting.rst). There is an issue on arm32 with 2GB of memory that bootm_size is bigger than Linux lowmem (for example with VMSPLIT_3G). That's why limit bootm size on these systems not to be above 768MB. Signed-off-by: Michal Simek --- board/xilinx/common/board.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 581c88ad49a..eab389d049f 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -78,11 +78,15 @@ void *board_fdt_blob_setup(void) int board_late_init_xilinx(void) { u32 ret = 0; + phys_size_t bootm_size = gd->ram_size; + + if (CONFIG_IS_ENABLED(ARCH_ZYNQ)) + bootm_size = min(bootm_size, (phys_size_t)(SZ_512M + SZ_256M)); ret |= env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET); ret |= env_set_addr("bootm_low", (void *)gd->ram_base); - ret |= env_set_addr("bootm_size", (void *)gd->ram_size); + ret |= env_set_addr("bootm_size", (void *)bootm_size); if (ret) printf("%s: Saving run time variables FAILED\n", __func__); From 620bb46eaddd8f8ee361b47e56d57fd50a29b005 Mon Sep 17 00:00:00 2001 From: Faiz Abbas Date: Thu, 23 Jul 2020 09:42:19 +0530 Subject: [PATCH 029/117] mmc: sdhci: Enable high speed conditional on the corresponding bit The capabilities register has a field to indicate whether the host supports high speed mode or not. Add high speed host_caps based on this bit instead of enabling it by default. Signed-off-by: Faiz Abbas Reviewed-by: Michal Simek Tested-by: Michal Simek (zcu104 with sdhci-caps-mask = <0 0x200000>;) --- drivers/mmc/sdhci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index ff871f82523..fe3d677bcfa 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -843,7 +843,10 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host, if (host->quirks & SDHCI_QUIRK_BROKEN_VOLTAGE) cfg->voltages |= host->voltages; - cfg->host_caps |= MMC_MODE_HS | MMC_MODE_HS_52MHz | MMC_MODE_4BIT; + if (caps & SDHCI_CAN_DO_HISPD) + cfg->host_caps |= MMC_MODE_HS | MMC_MODE_HS_52MHz; + + cfg->host_caps |= MMC_MODE_4BIT; /* Since Host Controller Version3.0 */ if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) { From b5a3387dc163dbb958c362d95ddc7415bebdca61 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 29 Jul 2020 15:42:26 +0200 Subject: [PATCH 030/117] mmc: sdhci: Use upper/lower_32_bits macros Instead of recasting and shifting use macros which are designed for taking upper/lower 32bit value from 64bit variable. Signed-off-by: Michal Simek --- drivers/mmc/sdhci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index fe3d677bcfa..7673219fb33 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -748,9 +748,9 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host, "sdhci-caps-mask", 0); dt_caps = dev_read_u64_default(host->mmc->dev, "sdhci-caps", 0); - caps = ~(u32)dt_caps_mask & + caps = ~lower_32_bits(dt_caps_mask) & sdhci_readl(host, SDHCI_CAPABILITIES); - caps |= (u32)dt_caps; + caps |= lower_32_bits(dt_caps); #else caps = sdhci_readl(host, SDHCI_CAPABILITIES); #endif @@ -793,9 +793,9 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host, /* Check whether the clock multiplier is supported or not */ if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) { #if CONFIG_IS_ENABLED(DM_MMC) - caps_1 = ~(u32)(dt_caps_mask >> 32) & + caps_1 = ~upper_32_bits(dt_caps_mask) & sdhci_readl(host, SDHCI_CAPABILITIES_1); - caps_1 |= (u32)(dt_caps >> 32); + caps_1 |= upper_32_bits(dt_caps); #else caps_1 = sdhci_readl(host, SDHCI_CAPABILITIES_1); #endif From 29af2ac48c8f910cc2efc8099323f9d619fb2bd5 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 23 Jul 2020 09:24:06 +0200 Subject: [PATCH 031/117] clk: versal: Move pm_query_id out of clock driver There is no reason to have firmware specific structure in clock driver. Move it to generic location and also initialize enum values which is based on https://lore.kernel.org/linux-arm-kernel/20200318125003.GA2727094@kroah.com/ recommended way to go to make sure that values guaranteed by compiler. Signed-off-by: Michal Simek --- drivers/clk/clk_versal.c | 17 ----------------- include/zynqmp_firmware.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/clk/clk_versal.c b/drivers/clk/clk_versal.c index 6f82b60f04d..d93b860aed3 100644 --- a/drivers/clk/clk_versal.c +++ b/drivers/clk/clk_versal.c @@ -68,23 +68,6 @@ #define CLOCK_NODE_TYPE_DIV 4 #define CLOCK_NODE_TYPE_GATE 6 -enum pm_query_id { - PM_QID_INVALID, - PM_QID_CLOCK_GET_NAME, - PM_QID_CLOCK_GET_TOPOLOGY, - PM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS, - PM_QID_CLOCK_GET_PARENTS, - PM_QID_CLOCK_GET_ATTRIBUTES, - PM_QID_PINCTRL_GET_NUM_PINS, - PM_QID_PINCTRL_GET_NUM_FUNCTIONS, - PM_QID_PINCTRL_GET_NUM_FUNCTION_GROUPS, - PM_QID_PINCTRL_GET_FUNCTION_NAME, - PM_QID_PINCTRL_GET_FUNCTION_GROUPS, - PM_QID_PINCTRL_GET_PIN_GROUPS, - PM_QID_CLOCK_GET_NUM_CLOCKS, - PM_QID_CLOCK_GET_MAX_DIVISOR, -}; - enum clk_type { CLK_TYPE_OUTPUT, CLK_TYPE_EXTERNAL, diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h index 2c44951f861..f6f82bf8828 100644 --- a/include/zynqmp_firmware.h +++ b/include/zynqmp_firmware.h @@ -62,6 +62,23 @@ enum pm_api_id { PM_API_MAX, }; +enum pm_query_id { + PM_QID_INVALID = 0, + PM_QID_CLOCK_GET_NAME = 1, + PM_QID_CLOCK_GET_TOPOLOGY = 2, + PM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS = 3, + PM_QID_CLOCK_GET_PARENTS = 4, + PM_QID_CLOCK_GET_ATTRIBUTES = 5, + PM_QID_PINCTRL_GET_NUM_PINS = 6, + PM_QID_PINCTRL_GET_NUM_FUNCTIONS = 7, + PM_QID_PINCTRL_GET_NUM_FUNCTION_GROUPS = 8, + PM_QID_PINCTRL_GET_FUNCTION_NAME = 9, + PM_QID_PINCTRL_GET_FUNCTION_GROUPS = 10, + PM_QID_PINCTRL_GET_PIN_GROUPS = 11, + PM_QID_CLOCK_GET_NUM_CLOCKS = 12, + PM_QID_CLOCK_GET_MAX_DIVISOR = 13, +}; + #define PM_SIP_SVC 0xc2000000 #define ZYNQMP_PM_VERSION_MAJOR 1 From d6092e3229440502b7aa9fbe9ae07b5d0da25e12 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Tue, 11 Aug 2020 14:44:30 +0800 Subject: [PATCH 032/117] rockchip: dts: rk3399-evb: add sdmmc node The sdmmc node is missing after the dts sync patch: 167efc2c7a arm64: dts: rk3399: Sync v5.7-rc1 from Linux But we still need it for boot from SD card, so add it. Signed-off-by: Kever Yang --- arch/arm/dts/rk3399-evb-u-boot.dtsi | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm/dts/rk3399-evb-u-boot.dtsi b/arch/arm/dts/rk3399-evb-u-boot.dtsi index 1be54feacc0..8056dc843e7 100644 --- a/arch/arm/dts/rk3399-evb-u-boot.dtsi +++ b/arch/arm/dts/rk3399-evb-u-boot.dtsi @@ -37,3 +37,16 @@ dr_mode = "host"; status = "okay"; }; + +&sdmmc { + u-boot,dm-pre-reloc; + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + cd-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; + disable-wp; + max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4>; + status = "okay"; +}; From 5c5435093a6c0a6995351b64c6b8b08fe7d6bf59 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Tue, 11 Aug 2020 14:47:01 +0800 Subject: [PATCH 033/117] rockchip: config: evb-rk3399: Add rockchip dwmmc support This enable support for SD card on evb-rk3399. Signed-off-by: Kever Yang --- configs/evb-rk3399_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig index 509c86b81bf..909c68822cc 100644 --- a/configs/evb-rk3399_defconfig +++ b/configs/evb-rk3399_defconfig @@ -30,6 +30,7 @@ CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_MISC=y CONFIG_MMC_DW=y +CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_SF_DEFAULT_SPEED=20000000 From e2f8ba8a5f5b100f08118793743cfe5064b8c381 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Thu, 20 Aug 2020 17:31:16 +0800 Subject: [PATCH 034/117] rockchip: rk3188: Fix the code support for SPL_LED Fix the build error for the wrong code when CONFIG_SPL_LED is enabled. Signed-off-by: Kever Yang --- arch/arm/mach-rockchip/rk3188/rk3188.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-rockchip/rk3188/rk3188.c b/arch/arm/mach-rockchip/rk3188/rk3188.c index 1b2f4a47571..222953ab94a 100644 --- a/arch/arm/mach-rockchip/rk3188/rk3188.c +++ b/arch/arm/mach-rockchip/rk3188/rk3188.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -105,6 +106,7 @@ int rk_board_late_init(void) } #ifdef CONFIG_SPL_BUILD +DECLARE_GLOBAL_DATA_PTR; static int setup_led(void) { #ifdef CONFIG_SPL_LED @@ -120,7 +122,7 @@ static int setup_led(void) debug("%s: get=%d\n", __func__, ret); return ret; } - ret = led_set_on(dev, 1); + ret = led_set_state(dev, LEDST_ON); if (ret) return ret; #endif From b5b81f2490628650137c9fee3679c995f5fac757 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Thu, 20 Aug 2020 17:32:52 +0800 Subject: [PATCH 035/117] rockchip: firefly-rk3288: Fix the code support for SPL_LED Fix the build error for the wrong code when CONFIG_SPL_LED is enabled. Signed-off-by: Kever Yang --- board/firefly/firefly-rk3288/firefly-rk3288.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/board/firefly/firefly-rk3288/firefly-rk3288.c b/board/firefly/firefly-rk3288/firefly-rk3288.c index 1965985a0f4..bd8a32cf7b3 100644 --- a/board/firefly/firefly-rk3288/firefly-rk3288.c +++ b/board/firefly/firefly-rk3288/firefly-rk3288.c @@ -5,9 +5,11 @@ #include #include +#include #include #ifdef CONFIG_SPL_BUILD +DECLARE_GLOBAL_DATA_PTR; static int setup_led(void) { #ifdef CONFIG_SPL_LED @@ -23,7 +25,7 @@ static int setup_led(void) debug("%s: get=%d\n", __func__, ret); return ret; } - ret = led_set_on(dev, 1); + ret = led_set_state(dev, LEDST_ON); if (ret) return ret; #endif From ae6b33dcc342e8539f4f69aba238748e9e89280a Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 25 Jul 2020 21:38:49 +0200 Subject: [PATCH 036/117] dm: fix ofnode_read_addr/size_cells() In the case of the live tree ofnode_read_addr_cells() and ofnode_read_size_cells() return the #address-cells and #size-cells defined in the parent node. With the patch the same is done for a non-live tree. The only consumer of these functions is currently the CFI flash driver. This patch fixes the incorrect parsing of the device tree leading to 'saveenv' failing on qemu_arm64_defconfig. For testing qemu-system-aarch64 has to be called with -drive if=pflash,format=raw,index=1,file=envstore.img to provide the flash memory. envstore.img must be 64 MiB large. Signed-off-by: Heinrich Schuchardt Reviewed-by: Stefan Roese --- drivers/core/ofnode.c | 20 ++++++++++++++------ include/dm/read.h | 10 ++++++---- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index c37afa1fe6f..d02d8d33fef 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -776,18 +776,26 @@ int ofnode_read_pci_vendev(ofnode node, u16 *vendor, u16 *device) int ofnode_read_addr_cells(ofnode node) { - if (ofnode_is_np(node)) + if (ofnode_is_np(node)) { return of_n_addr_cells(ofnode_to_np(node)); - else /* NOTE: this call should walk up the parent stack */ - return fdt_address_cells(gd->fdt_blob, ofnode_to_offset(node)); + } else { + int parent = fdt_parent_offset(gd->fdt_blob, + ofnode_to_offset(node)); + + return fdt_address_cells(gd->fdt_blob, parent); + } } int ofnode_read_size_cells(ofnode node) { - if (ofnode_is_np(node)) + if (ofnode_is_np(node)) { return of_n_size_cells(ofnode_to_np(node)); - else /* NOTE: this call should walk up the parent stack */ - return fdt_size_cells(gd->fdt_blob, ofnode_to_offset(node)); + } else { + int parent = fdt_parent_offset(gd->fdt_blob, + ofnode_to_offset(node)); + + return fdt_size_cells(gd->fdt_blob, parent); + } } int ofnode_read_simple_addr_cells(ofnode node) diff --git a/include/dm/read.h b/include/dm/read.h index 487ec9e9c93..cac7dd5f187 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -878,14 +878,16 @@ static inline int dev_count_phandle_with_args(const struct udevice *dev, static inline int dev_read_addr_cells(const struct udevice *dev) { - /* NOTE: this call should walk up the parent stack */ - return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev)); + int parent = fdt_parent_offset(gd->fdt_blob, dev_of_offset(dev)); + + return fdt_address_cells(gd->fdt_blob, parent); } static inline int dev_read_size_cells(const struct udevice *dev) { - /* NOTE: this call should walk up the parent stack */ - return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev)); + int parent = fdt_parent_offset(gd->fdt_blob, dev_of_offset(dev)); + + return fdt_size_cells(gd->fdt_blob, parent); } static inline int dev_read_simple_addr_cells(const struct udevice *dev) From 84f8e36f03fafa7e2e2ff822db90fefa6bd5f350 Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Tue, 28 Jul 2020 09:13:31 +0200 Subject: [PATCH 037/117] cmd: bind: allow to bind driver with driver data Initial implementation invokes device_bind_with_driver_data() with driver_data parameter equal to 0. For driver with driver data, the bind command can't bind correctly this driver or even worse causes data abort as shown below: As example, for debug purpose on STM32MP1 platform, ethernet (dwc_eth_qos.c) driver needed to be unbinded/binded. This driver is using driver data: static const struct udevice_id eqos_ids[] = { { .compatible = "nvidia,tegra186-eqos", .data = (ulong)&eqos_tegra186_config }, { .compatible = "snps,dwmac-4.20a", .data = (ulong)&eqos_stm32_config }, { } }; After unbinding/binding this driver and probing it (with the dhcp command), we got a prefetch abort as below: STM32MP> unbind eth ethernet@5800a000 STM32MP> bind /soc/ethernet@5800a000 eth_eqos STM32MP> dhcp prefetch abort pc : [<4310801c>] lr : [] reloc pc : [<035ba01c>] lr : [] sp : fdaf19b0 ip : ffcea83c fp : 00000001 r10: ffcfd4a0 r9 : fdaffed0 r8 : 00000000 r7 : ffcff304 r6 : fdc63220 r5 : 00000000 r4 : fdc5b108 r3 : 43108020 r2 : 00003d39 r1 : ffcea544 r0 : fdc63220 Flags: nZCv IRQs off FIQs off Mode SVC_32 Code: data abort pc : [] lr : [] reloc pc : [] lr : [] sp : fdaf18b8 ip : 00000000 fp : 00000001 r10: ffcd69b2 r9 : fdaffed0 r8 : ffcd69aa r7 : 00000000 r6 : 00000008 r5 : 4310801c r4 : fffffffc r3 : 00000001 r2 : 00000028 r1 : 00000000 r0 : 00000006 Flags: NzCv IRQs on FIQs on Mode SVC_32 (T) Code: 2f00 d1e9 2c00 dce9 (f855) 2024 Resetting CPU ... Signed-off-by: Patrice Chotard Cc: Jean-Jacques Hiblot Reviewed-by: Simon Glass Reviewed-by: Simon Glass --- cmd/bind.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/bind.c b/cmd/bind.c index 068b1399ab1..af2f22cc4c3 100644 --- a/cmd/bind.c +++ b/cmd/bind.c @@ -8,6 +8,7 @@ #include #include #include +#include #include static int bind_by_class_index(const char *uclass, int index, @@ -151,8 +152,8 @@ static int bind_by_node_path(const char *path, const char *drv_name) } ofnode = ofnode_path(path); - ret = device_bind_with_driver_data(parent, drv, ofnode_get_name(ofnode), - 0, ofnode, &dev); + ret = lists_bind_fdt(parent, ofnode, &dev, false); + if (!dev || ret) { printf("Unable to bind. err:%d\n", ret); return ret; From cfa3ed4390c158b527bdb2ceceacf7eabae1b01e Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Tue, 28 Jul 2020 09:13:32 +0200 Subject: [PATCH 038/117] sandbox: phy: add driver_data for bind test cmd Add driver data to existing compatible string "sandbox,phy". Add an additional compatible string without driver_data This will verify that bind command parses, finds and passes the correct driver data to device_bind_with_driver_data() by using driver_data in the second sandbox_phy_ids table entry. In sandbox_phy_bind() a check is added to validate driver_data content. Signed-off-by: Patrice Chotard Reviewed-by: Simon Glass --- drivers/phy/sandbox-phy.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/phy/sandbox-phy.c b/drivers/phy/sandbox-phy.c index 84ff5c6275b..5f36da7692b 100644 --- a/drivers/phy/sandbox-phy.c +++ b/drivers/phy/sandbox-phy.c @@ -8,6 +8,8 @@ #include #include +#define DRIVER_DATA 0x12345678 + struct sandbox_phy_priv { bool initialized; bool on; @@ -71,6 +73,14 @@ static int sandbox_phy_exit(struct phy *phy) return 0; } +static int sandbox_phy_bind(struct udevice *dev) +{ + if (dev_get_driver_data(dev) != DRIVER_DATA) + return -ENODATA; + + return 0; +} + static int sandbox_phy_probe(struct udevice *dev) { struct sandbox_phy_priv *priv = dev_get_priv(dev); @@ -90,13 +100,19 @@ static struct phy_ops sandbox_phy_ops = { }; static const struct udevice_id sandbox_phy_ids[] = { - { .compatible = "sandbox,phy" }, + { .compatible = "sandbox,phy_no_driver_data", + }, + + { .compatible = "sandbox,phy", + .data = DRIVER_DATA + }, { } }; U_BOOT_DRIVER(phy_sandbox) = { .name = "phy_sandbox", .id = UCLASS_PHY, + .bind = sandbox_phy_bind, .of_match = sandbox_phy_ids, .ops = &sandbox_phy_ops, .probe = sandbox_phy_probe, From 1f0d5885dbbd669400e5d8cfdb3998c7945e0a7a Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Tue, 28 Jul 2020 09:13:33 +0200 Subject: [PATCH 039/117] sandbox: dts: Add compatible string for bind-test node Usage of lists_bind_fdt() in bind command imposes to add a compatible string for bind-test node. Others impacts are: - bind-test node is binded at sandbox start, so no need to bind it in test_bind_unbind_with_node() test. - As explained just above, after sandbox start, now a phy exist. In test/dm/phy.c, it was verified that a third phy didn't exist, now we must verified that a fourth phy doesn't exist. Signed-off-by: Patrice Chotard Reviewed-by: Simon Glass --- arch/sandbox/dts/test.dts | 1 + test/dm/phy.c | 2 +- test/py/tests/test_bind.py | 3 --- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 692c3775dde..1d8956abbeb 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -149,6 +149,7 @@ }; bind-test { + compatible = "simple-bus"; bind-test-child1 { compatible = "sandbox,phy"; #phy-cells = <1>; diff --git a/test/dm/phy.c b/test/dm/phy.c index 75d05a14c03..ecbd47bf12f 100644 --- a/test/dm/phy.c +++ b/test/dm/phy.c @@ -47,7 +47,7 @@ static int dm_test_phy_base(struct unit_test_state *uts) ut_assert(phy2.dev != phy3.dev); /* Try to get a non-existing phy */ - ut_asserteq(-ENODEV, uclass_get_device(UCLASS_PHY, 3, &dev)); + ut_asserteq(-ENODEV, uclass_get_device(UCLASS_PHY, 4, &dev)); ut_asserteq(-ENODATA, generic_phy_get_by_name(parent, "phy_not_existing", &phy1_method1)); diff --git a/test/py/tests/test_bind.py b/test/py/tests/test_bind.py index e9681c69c54..1de125ce459 100644 --- a/test/py/tests/test_bind.py +++ b/test/py/tests/test_bind.py @@ -25,9 +25,6 @@ def in_tree(response, name, uclass, drv, depth, last_child): @pytest.mark.buildconfigspec('cmd_bind') def test_bind_unbind_with_node(u_boot_console): - #bind /bind-test. Device should come up as well as its children - response = u_boot_console.run_command('bind /bind-test simple_bus') - assert response == '' tree = u_boot_console.run_command('dm tree') assert in_tree(tree, 'bind-test', 'simple_bus', 'simple_bus', 0, True) assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, False) From e37d4c4fd2c8b3db43faa4e36641b72a2c0ea69f Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Tue, 28 Jul 2020 09:13:34 +0200 Subject: [PATCH 040/117] test/py: Update test_bind As bind-test is now binded at sandbox startup and no more by test_bind.py, bind-test nodes are not located at the end of "dm tree" output, but can be located everywhere in the tree, so bind-test output could either be: simple_bus 0 [ ] generic_simple_bus |-- bind-test phy 0 [ ] phy_sandbox | |-- bind-test-child1 simple_bus 1 [ ] generic_simple_bus | `-- bind-test-child2 or: simple_bus 5 [ ] generic_simple_bus `-- bind-test phy 2 [ ] phy_sandbox |-- bind-test-child1 simple_bus 6 [ ] generic_simple_bus `-- bind-test-child2 in_tree() function need to be updated to take care of that change. Signed-off-by: Patrice Chotard Reviewed-by: Simon Glass --- test/py/tests/test_bind.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/py/tests/test_bind.py b/test/py/tests/test_bind.py index 1de125ce459..5e73d403618 100644 --- a/test/py/tests/test_bind.py +++ b/test/py/tests/test_bind.py @@ -7,13 +7,16 @@ import re def in_tree(response, name, uclass, drv, depth, last_child): lines = [x.strip() for x in response.splitlines()] - leaf = ' ' * 4 * depth; - if not last_child: - leaf = leaf + r'\|' - else: - leaf = leaf + '`' + leaf = '' + if depth != 0: + leaf = ' ' + ' ' * (depth - 1) ; + if not last_child: + leaf = leaf + r'\|' + else: + leaf = leaf + '`' + leaf = leaf + '-- ' + name - line = (r' *{:10.10} [0-9]* \[ [ +] \] {:20.20} {}$' + line = (r' *{:10.10} [0-9]* \[ [ +] \] {:20.20} [` |]{}$' .format(uclass, drv, leaf)) prog = re.compile(line) for l in lines: From 02291d83fdaaf30e355eb7cef05581ec086962bd Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Tue, 28 Jul 2020 09:13:35 +0200 Subject: [PATCH 041/117] doc: add bind/unbind command documentation Add documentation in doc/drivel-model for the bind/unbind command. Part of this documentation is extracted from original patch commit message: commit 49c752c93a78 ("cmd: Add bind/unbind commands to bind a device to a driver from the command line") Signed-off-by: Patrice Chotard Reviewed-by: Simon Glass --- doc/driver-model/bind.rst | 49 ++++++++++++++++++++++++++++++++++++++ doc/driver-model/index.rst | 1 + 2 files changed, 50 insertions(+) create mode 100644 doc/driver-model/bind.rst diff --git a/doc/driver-model/bind.rst b/doc/driver-model/bind.rst new file mode 100644 index 00000000000..e3e9cb4d3c5 --- /dev/null +++ b/doc/driver-model/bind.rst @@ -0,0 +1,49 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. sectionauthor:: Patrice Chotard + +Binding/unbinding a driver +========================== + +This document aims to describe the bind and unbind commands. + +For debugging purpose, it should be useful to bind or unbind a driver from +the U-boot command line. + +The unbind command calls the remove device driver callback and unbind the +device from its driver. + +The bind command binds a device to its driver. + +In some cases it can be useful to be able to bind a device to a driver from +the command line. +The obvious example is for versatile devices such as USB gadget. +Another use case is when the devices are not yet ready at startup and +require some setup before the drivers are bound (ex: FPGA which bitsream is +fetched from a mass storage or ethernet) + +usage: + +bind +bind + +unbind +unbind +unbind + +Where: + - is the node's device tree path + - is one of the class available in the list given by the "dm uclass" + command or first column of "dm tree" command. + - is the index of the parent's node (second column of "dm tree" output). + - is the driver name to bind given by the "dm drivers" command or the by + the fourth column of "dm tree" output. + +example: + +bind usb_dev_generic 0 usb_ether +unbind usb_dev_generic 0 usb_ether +or +unbind eth 1 + +bind /ocp/omap_dwc3@48380000/usb@48390000 usb_ether +unbind /ocp/omap_dwc3@48380000/usb@48390000 diff --git a/doc/driver-model/index.rst b/doc/driver-model/index.rst index f17c72ce69d..c9faf0a5910 100644 --- a/doc/driver-model/index.rst +++ b/doc/driver-model/index.rst @@ -6,6 +6,7 @@ Driver Model .. toctree:: :maxdepth: 2 + bind debugging design ethernet From 3fe69d3764c3ca6f304c51faa6aae7a84f1fa56c Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Mon, 3 Aug 2020 22:17:35 +0300 Subject: [PATCH 042/117] dm: core: Fix devfdt_get_addr_ptr return value According to the description of devfdt_get_addr_ptr, this function should return NULL on failure, but currently it returns (void *)FDT_ADDR_T_NONE. Fix this by making devfdt_get_addr_ptr return NULL on failure, as described in the function comments. Also, update the drivers currently checking (void *)FDT_ADDR_T_NONE to check for NULL. Signed-off-by: Ovidiu Panait Reviewed-by: Simon Glass --- drivers/clk/aspeed/clk_ast2500.c | 4 ++-- drivers/core/fdtaddr.c | 4 +++- drivers/i2c/ast_i2c.c | 4 ++-- drivers/pinctrl/mvebu/pinctrl-mvebu.c | 2 +- drivers/timer/ast_timer.c | 4 ++-- drivers/watchdog/ast_wdt.c | 4 ++-- include/dm/read.h | 4 +--- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/clk/aspeed/clk_ast2500.c b/drivers/clk/aspeed/clk_ast2500.c index ccfeded30c5..284f5f58d6e 100644 --- a/drivers/clk/aspeed/clk_ast2500.c +++ b/drivers/clk/aspeed/clk_ast2500.c @@ -498,8 +498,8 @@ static int ast2500_clk_ofdata_to_platdata(struct udevice *dev) struct ast2500_clk_priv *priv = dev_get_priv(dev); priv->scu = devfdt_get_addr_ptr(dev); - if (IS_ERR(priv->scu)) - return PTR_ERR(priv->scu); + if (!priv->scu) + return -EINVAL; return 0; } diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c index dfcb868f650..8b48aa5bc5b 100644 --- a/drivers/core/fdtaddr.c +++ b/drivers/core/fdtaddr.c @@ -154,7 +154,9 @@ fdt_addr_t devfdt_get_addr(const struct udevice *dev) void *devfdt_get_addr_ptr(const struct udevice *dev) { - return (void *)(uintptr_t)devfdt_get_addr_index(dev, 0); + fdt_addr_t addr = devfdt_get_addr_index(dev, 0); + + return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr; } void *devfdt_remap_addr_index(const struct udevice *dev, int index) diff --git a/drivers/i2c/ast_i2c.c b/drivers/i2c/ast_i2c.c index 214362d04bb..253e653666a 100644 --- a/drivers/i2c/ast_i2c.c +++ b/drivers/i2c/ast_i2c.c @@ -93,8 +93,8 @@ static int ast_i2c_ofdata_to_platdata(struct udevice *dev) int ret; priv->regs = devfdt_get_addr_ptr(dev); - if (IS_ERR(priv->regs)) - return PTR_ERR(priv->regs); + if (!priv->regs) + return -EINVAL; ret = clk_get_by_index(dev, 0, &priv->clk); if (ret < 0) { diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c index 2206e958ec7..ac0377e7968 100644 --- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c +++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c @@ -194,7 +194,7 @@ int mvebu_pinctl_probe(struct udevice *dev) } priv->base_reg = devfdt_get_addr_ptr(dev); - if (priv->base_reg == (void *)FDT_ADDR_T_NONE) { + if (!priv->base_reg) { debug("%s: Failed to get base address\n", __func__); return -EINVAL; } diff --git a/drivers/timer/ast_timer.c b/drivers/timer/ast_timer.c index 3838601f54d..9f28cbfcf9a 100644 --- a/drivers/timer/ast_timer.c +++ b/drivers/timer/ast_timer.c @@ -65,8 +65,8 @@ static int ast_timer_ofdata_to_platdata(struct udevice *dev) struct ast_timer_priv *priv = dev_get_priv(dev); priv->regs = devfdt_get_addr_ptr(dev); - if (IS_ERR(priv->regs)) - return PTR_ERR(priv->regs); + if (!priv->regs) + return -EINVAL; priv->tmc = ast_get_timer_counter(priv->regs, AST_TICK_TIMER); diff --git a/drivers/watchdog/ast_wdt.c b/drivers/watchdog/ast_wdt.c index 7e11465a570..a21f9a4d140 100644 --- a/drivers/watchdog/ast_wdt.c +++ b/drivers/watchdog/ast_wdt.c @@ -91,8 +91,8 @@ static int ast_wdt_ofdata_to_platdata(struct udevice *dev) struct ast_wdt_priv *priv = dev_get_priv(dev); priv->regs = devfdt_get_addr_ptr(dev); - if (IS_ERR(priv->regs)) - return PTR_ERR(priv->regs); + if (!priv->regs) + return -EINVAL; return 0; } diff --git a/include/dm/read.h b/include/dm/read.h index cac7dd5f187..0a7aacd2d04 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -802,9 +802,7 @@ static inline fdt_addr_t dev_read_addr(const struct udevice *dev) static inline void *dev_read_addr_ptr(const struct udevice *dev) { - void *addr = devfdt_get_addr_ptr(dev); - - return ((fdt_addr_t)(uintptr_t)addr == FDT_ADDR_T_NONE) ? NULL : addr; + return devfdt_get_addr_ptr(dev); } static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev) From 6e64830f0bca623180d5d1667df02c288616ea5c Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Mon, 3 Aug 2020 22:17:36 +0300 Subject: [PATCH 043/117] test: dm: Add test case for devfdt_get_addr_ptr Add flat tree test case to cover devfdt_get_addr_ptr function. Signed-off-by: Ovidiu Panait Reviewed-by: Simon Glass --- test/dm/test-fdt.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index ac8ce99f512..04802deb7fc 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -619,6 +619,24 @@ static int dm_test_fdt_translation(struct unit_test_state *uts) } DM_TEST(dm_test_fdt_translation, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +static int dm_test_fdt_get_addr_ptr_flat(struct unit_test_state *uts) +{ + struct udevice *gpio, *dev; + void *ptr; + + /* Test for missing reg property */ + ut_assertok(uclass_first_device_err(UCLASS_GPIO, &gpio)); + ut_assertnull(devfdt_get_addr_ptr(gpio)); + + ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev)); + ptr = devfdt_get_addr_ptr(dev); + ut_asserteq_ptr((void *)0x8000, ptr); + + return 0; +} +DM_TEST(dm_test_fdt_get_addr_ptr_flat, + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_FLAT_TREE); + static int dm_test_fdt_remap_addr_flat(struct unit_test_state *uts) { struct udevice *dev; From 0cbf3e08fc735b54e7918138e73b34870a213333 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 4 Aug 2020 14:14:41 +0900 Subject: [PATCH 044/117] gpio: at91: use dev_read_addr() to get base address It is strange to use devfdt_get_addr_ptr(), then cast the pointer back to uint32 because you could use devfdt_get_addr() without casting. Convert it to dev_read_addr(), which is capable to CONFIG_OF_LIVE. Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass --- drivers/gpio/at91_gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index 4a8b2e6ff61..ef7984374b1 100644 --- a/drivers/gpio/at91_gpio.c +++ b/drivers/gpio/at91_gpio.c @@ -606,7 +606,7 @@ static int at91_gpio_probe(struct udevice *dev) clk_free(&clk); #if CONFIG_IS_ENABLED(OF_CONTROL) - plat->base_addr = (uint32_t)devfdt_get_addr_ptr(dev); + plat->base_addr = dev_read_addr(dev); #endif plat->bank_name = at91_get_bank_name(plat->base_addr); port->regs = (struct at91_port *)plat->base_addr; From 1450bff3e4719d1b34189bf62ad19d0e3c10a548 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 4 Aug 2020 14:14:42 +0900 Subject: [PATCH 045/117] ata: mvebu: use dev_read_addr() to get base address It is strange to use devfdt_get_addr_ptr(), then cast the pointer back to ulong because you could use devfdt_get_addr() without casting. Convert it to dev_read_addr(), which is capable to CONFIG_OF_LIVE. Signed-off-by: Masahiro Yamada Reviewed-by: Stefan Roese --- drivers/ata/ahci_mvebu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c index 8be1826d405..7d82d2ea3ff 100644 --- a/drivers/ata/ahci_mvebu.c +++ b/drivers/ata/ahci_mvebu.c @@ -39,7 +39,7 @@ static int mvebu_ahci_probe(struct udevice *dev) */ board_ahci_enable(); - ahci_probe_scsi(dev, (ulong)devfdt_get_addr_ptr(dev)); + ahci_probe_scsi(dev, dev_read_addr(dev)); return 0; } From 702e57e113d85fef60ebe9e5c87194414666cfac Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 4 Aug 2020 14:14:43 +0900 Subject: [PATCH 046/117] treewide: convert devfdt_get_addr_ptr() to dev_read_addr_ptr() When you enable CONFIG_OF_LIVE, you will end up with a lot of conversions. To help this tedious work, this commit converts devfdt_get_addr_ptr() to dev_read_addr_ptr() by coccinelle. I also removed redundant casts because dev_read_addr_ptr() returns an opaque pointer. To generate this commit, I ran the following semantic patch excluding include/dm/. @@ type T; expression dev; @@ -(T *)devfdt_get_addr_ptr(dev) +dev_read_addr_ptr(dev) @@ expression dev; @@ -devfdt_get_addr_ptr(dev) +dev_read_addr_ptr(dev) Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass --- drivers/clk/aspeed/clk_ast2500.c | 2 +- drivers/clk/at91/pmc.c | 4 ++-- drivers/gpio/hsdk-creg-gpio.c | 2 +- drivers/i2c/ast_i2c.c | 2 +- drivers/i2c/designware_i2c.c | 2 +- drivers/i2c/mv_i2c.c | 2 +- drivers/i2c/mvtwsi.c | 4 ++-- drivers/mmc/gen_atmel_mci.c | 2 +- drivers/mmc/snps_dw_mmc.c | 2 +- drivers/pinctrl/mvebu/pinctrl-mvebu.c | 2 +- drivers/reset/reset-socfpga.c | 2 +- drivers/serial/serial_mvebu_a3700.c | 2 +- drivers/spi/uniphier_spi.c | 2 +- drivers/sysreset/sysreset_socfpga.c | 2 +- drivers/timer/ast_timer.c | 2 +- drivers/timer/atmel_pit_timer.c | 2 +- drivers/usb/host/ehci-zynq.c | 2 +- drivers/watchdog/ast_wdt.c | 2 +- 18 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/clk/aspeed/clk_ast2500.c b/drivers/clk/aspeed/clk_ast2500.c index 284f5f58d6e..d1940f18849 100644 --- a/drivers/clk/aspeed/clk_ast2500.c +++ b/drivers/clk/aspeed/clk_ast2500.c @@ -497,7 +497,7 @@ static int ast2500_clk_ofdata_to_platdata(struct udevice *dev) { struct ast2500_clk_priv *priv = dev_get_priv(dev); - priv->scu = devfdt_get_addr_ptr(dev); + priv->scu = dev_read_addr_ptr(dev); if (!priv->scu) return -EINVAL; diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c index 54ae0d281d0..ca90abef2d5 100644 --- a/drivers/clk/at91/pmc.c +++ b/drivers/clk/at91/pmc.c @@ -41,7 +41,7 @@ int at91_pmc_core_probe(struct udevice *dev) dev = dev_get_parent(dev); - plat->reg_base = (struct at91_pmc *)devfdt_get_addr_ptr(dev); + plat->reg_base = dev_read_addr_ptr(dev); return 0; } @@ -116,7 +116,7 @@ int at91_clk_probe(struct udevice *dev) dev_periph_container = dev_get_parent(dev); dev_pmc = dev_get_parent(dev_periph_container); - plat->reg_base = (struct at91_pmc *)devfdt_get_addr_ptr(dev_pmc); + plat->reg_base = dev_read_addr_ptr(dev_pmc); return 0; } diff --git a/drivers/gpio/hsdk-creg-gpio.c b/drivers/gpio/hsdk-creg-gpio.c index d9df804f639..35b114904d5 100644 --- a/drivers/gpio/hsdk-creg-gpio.c +++ b/drivers/gpio/hsdk-creg-gpio.c @@ -83,7 +83,7 @@ static int hsdk_creg_gpio_probe(struct udevice *dev) u32 shift, bit_per_gpio, activate, deactivate, gpio_count; const u8 *defaults; - hcg->regs = (u32 *)devfdt_get_addr_ptr(dev); + hcg->regs = dev_read_addr_ptr(dev); gpio_count = dev_read_u32_default(dev, "gpio-count", 1); shift = dev_read_u32_default(dev, "gpio-first-shift", 0); bit_per_gpio = dev_read_u32_default(dev, "gpio-bit-per-line", 1); diff --git a/drivers/i2c/ast_i2c.c b/drivers/i2c/ast_i2c.c index 253e653666a..2cdfb5561b7 100644 --- a/drivers/i2c/ast_i2c.c +++ b/drivers/i2c/ast_i2c.c @@ -92,7 +92,7 @@ static int ast_i2c_ofdata_to_platdata(struct udevice *dev) struct ast_i2c_priv *priv = dev_get_priv(dev); int ret; - priv->regs = devfdt_get_addr_ptr(dev); + priv->regs = dev_read_addr_ptr(dev); if (!priv->regs) return -EINVAL; diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c index cf892c69d9f..569a5d39b49 100644 --- a/drivers/i2c/designware_i2c.c +++ b/drivers/i2c/designware_i2c.c @@ -768,7 +768,7 @@ int designware_i2c_ofdata_to_platdata(struct udevice *bus) int ret; if (!priv->regs) - priv->regs = (struct i2c_regs *)devfdt_get_addr_ptr(bus); + priv->regs = dev_read_addr_ptr(bus); dev_read_u32(bus, "i2c-scl-rising-time-ns", &priv->scl_rise_time_ns); dev_read_u32(bus, "i2c-scl-falling-time-ns", &priv->scl_fall_time_ns); dev_read_u32(bus, "i2c-sda-hold-time-ns", &priv->sda_hold_time_ns); diff --git a/drivers/i2c/mv_i2c.c b/drivers/i2c/mv_i2c.c index 59675d8d574..82e8fdac413 100644 --- a/drivers/i2c/mv_i2c.c +++ b/drivers/i2c/mv_i2c.c @@ -580,7 +580,7 @@ static int mv_i2c_probe(struct udevice *bus) { struct mv_i2c_priv *priv = dev_get_priv(bus); - priv->base = (void *)devfdt_get_addr_ptr(bus); + priv->base = dev_read_addr_ptr(bus); return 0; } diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c index d3cc9b9d838..fdb8fd42e5c 100644 --- a/drivers/i2c/mvtwsi.c +++ b/drivers/i2c/mvtwsi.c @@ -798,7 +798,7 @@ static int mvtwsi_i2c_ofdata_to_platdata(struct udevice *bus) { struct mvtwsi_i2c_dev *dev = dev_get_priv(bus); - dev->base = devfdt_get_addr_ptr(bus); + dev->base = dev_read_addr_ptr(bus); if (!dev->base) return -ENOMEM; @@ -820,7 +820,7 @@ static void twsi_disable_i2c_slave(struct mvtwsi_registers *twsi) static int mvtwsi_i2c_bind(struct udevice *bus) { - struct mvtwsi_registers *twsi = devfdt_get_addr_ptr(bus); + struct mvtwsi_registers *twsi = dev_read_addr_ptr(bus); /* Disable the hidden slave in i2c0 of these platforms */ if ((IS_ENABLED(CONFIG_ARMADA_38X) || IS_ENABLED(CONFIG_ARCH_KIRKWOOD)) diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c index 9d20e283839..0a347b2fb20 100644 --- a/drivers/mmc/gen_atmel_mci.c +++ b/drivers/mmc/gen_atmel_mci.c @@ -592,7 +592,7 @@ static int atmel_mci_probe(struct udevice *dev) if (ret) return ret; - plat->mci = (struct atmel_mci *)devfdt_get_addr_ptr(dev); + plat->mci = dev_read_addr_ptr(dev); atmel_mci_setup_cfg(dev); diff --git a/drivers/mmc/snps_dw_mmc.c b/drivers/mmc/snps_dw_mmc.c index c606ef011bf..4b468a1f3db 100644 --- a/drivers/mmc/snps_dw_mmc.c +++ b/drivers/mmc/snps_dw_mmc.c @@ -83,7 +83,7 @@ static int snps_dwmmc_ofdata_to_platdata(struct udevice *dev) u32 fifo_depth; int ret; - host->ioaddr = devfdt_get_addr_ptr(dev); + host->ioaddr = dev_read_addr_ptr(dev); /* * If fifo-depth is unset don't set fifoth_val - we will try to diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c index ac0377e7968..146f5c6e426 100644 --- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c +++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c @@ -193,7 +193,7 @@ int mvebu_pinctl_probe(struct udevice *dev) return -EINVAL; } - priv->base_reg = devfdt_get_addr_ptr(dev); + priv->base_reg = dev_read_addr_ptr(dev); if (!priv->base_reg) { debug("%s: Failed to get base address\n", __func__); return -EINVAL; diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c index 830eda9430e..1849db4da9b 100644 --- a/drivers/reset/reset-socfpga.c +++ b/drivers/reset/reset-socfpga.c @@ -118,7 +118,7 @@ static int socfpga_reset_probe(struct udevice *dev) u32 modrst_offset; void __iomem *membase; - membase = devfdt_get_addr_ptr(dev); + membase = dev_read_addr_ptr(dev); modrst_offset = dev_read_u32_default(dev, "altr,modrst-offset", 0x10); data->modrst_base = membase + modrst_offset; diff --git a/drivers/serial/serial_mvebu_a3700.c b/drivers/serial/serial_mvebu_a3700.c index 7e4cd6c4b49..fb43f88eaf6 100644 --- a/drivers/serial/serial_mvebu_a3700.c +++ b/drivers/serial/serial_mvebu_a3700.c @@ -104,7 +104,7 @@ static int mvebu_serial_ofdata_to_platdata(struct udevice *dev) { struct mvebu_platdata *plat = dev_get_platdata(dev); - plat->base = devfdt_get_addr_ptr(dev); + plat->base = dev_read_addr_ptr(dev); return 0; } diff --git a/drivers/spi/uniphier_spi.c b/drivers/spi/uniphier_spi.c index 114bd8abd7a..b6456685f8d 100644 --- a/drivers/spi/uniphier_spi.c +++ b/drivers/spi/uniphier_spi.c @@ -368,7 +368,7 @@ static int uniphier_spi_ofdata_to_platdata(struct udevice *bus) const void *blob = gd->fdt_blob; int node = dev_of_offset(bus); - plat->base = devfdt_get_addr_ptr(bus); + plat->base = dev_read_addr_ptr(bus); plat->frequency = fdtdec_get_int(blob, node, "spi-max-frequency", 12500000); diff --git a/drivers/sysreset/sysreset_socfpga.c b/drivers/sysreset/sysreset_socfpga.c index 178bcb227ff..67cec6563a2 100644 --- a/drivers/sysreset/sysreset_socfpga.c +++ b/drivers/sysreset/sysreset_socfpga.c @@ -40,7 +40,7 @@ static int socfpga_sysreset_probe(struct udevice *dev) { struct socfpga_sysreset_data *data = dev_get_priv(dev); - data->rstmgr_base = devfdt_get_addr_ptr(dev); + data->rstmgr_base = dev_read_addr_ptr(dev); return 0; } diff --git a/drivers/timer/ast_timer.c b/drivers/timer/ast_timer.c index 9f28cbfcf9a..e3132497404 100644 --- a/drivers/timer/ast_timer.c +++ b/drivers/timer/ast_timer.c @@ -64,7 +64,7 @@ static int ast_timer_ofdata_to_platdata(struct udevice *dev) { struct ast_timer_priv *priv = dev_get_priv(dev); - priv->regs = devfdt_get_addr_ptr(dev); + priv->regs = dev_read_addr_ptr(dev); if (!priv->regs) return -EINVAL; diff --git a/drivers/timer/atmel_pit_timer.c b/drivers/timer/atmel_pit_timer.c index 70511697fef..843d670b5e2 100644 --- a/drivers/timer/atmel_pit_timer.c +++ b/drivers/timer/atmel_pit_timer.c @@ -64,7 +64,7 @@ static int atmel_pit_ofdata_to_platdata(struct udevice *dev) { struct atmel_pit_platdata *plat = dev_get_platdata(dev); - plat->regs = (struct atmel_pit_regs *)devfdt_get_addr_ptr(dev); + plat->regs = dev_read_addr_ptr(dev); return 0; } diff --git a/drivers/usb/host/ehci-zynq.c b/drivers/usb/host/ehci-zynq.c index 939c30999ee..80f1d6fd97c 100644 --- a/drivers/usb/host/ehci-zynq.c +++ b/drivers/usb/host/ehci-zynq.c @@ -25,7 +25,7 @@ static int ehci_zynq_ofdata_to_platdata(struct udevice *dev) { struct zynq_ehci_priv *priv = dev_get_priv(dev); - priv->ehci = (struct usb_ehci *)devfdt_get_addr_ptr(dev); + priv->ehci = dev_read_addr_ptr(dev); if (!priv->ehci) return -EINVAL; diff --git a/drivers/watchdog/ast_wdt.c b/drivers/watchdog/ast_wdt.c index a21f9a4d140..9b83d2ad442 100644 --- a/drivers/watchdog/ast_wdt.c +++ b/drivers/watchdog/ast_wdt.c @@ -90,7 +90,7 @@ static int ast_wdt_ofdata_to_platdata(struct udevice *dev) { struct ast_wdt_priv *priv = dev_get_priv(dev); - priv->regs = devfdt_get_addr_ptr(dev); + priv->regs = dev_read_addr_ptr(dev); if (!priv->regs) return -EINVAL; From 87d43329ef7698eab5b090a91228269c39643122 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Aug 2020 13:27:46 -0600 Subject: [PATCH 047/117] binman: Move GetEntryModules() to control When binman is installed its main program is in a different directory to its modules. This means that __file__ is different and we cannot use it to obtain the path to etype/ from main.py To fix this, move the function to the 'control' module, since it is installed with all the other modules, including the etype/ directory. Signed-off-by: Simon Glass --- tools/binman/control.py | 13 +++++++++++++ tools/binman/ftest.py | 5 ++--- tools/binman/main.py | 16 ++-------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tools/binman/control.py b/tools/binman/control.py index 343b0a0c35b..69c36ed6582 100644 --- a/tools/binman/control.py +++ b/tools/binman/control.py @@ -6,6 +6,7 @@ # from collections import OrderedDict +import glob import os import sys from patman import tools @@ -51,6 +52,18 @@ def _FindBinmanNode(dtb): return node return None +def GetEntryModules(include_testing=True): + """Get a set of entry class implementations + + Returns: + Set of paths to entry class filenames + """ + our_path = os.path.dirname(os.path.realpath(__file__)) + glob_list = glob.glob(os.path.join(our_path, 'etype/*.py')) + return set([os.path.splitext(os.path.basename(item))[0] + for item in glob_list + if include_testing or '_testing' not in item]) + def WriteEntryDocs(modules, test_missing=None): """Write out documentation for all entries diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index bf7f59fb841..fedcc1ada1b 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -24,7 +24,6 @@ from binman import control from binman import elf from binman import elf_test from binman import fmap_util -from binman import main from binman import state from dtoc import fdt from dtoc import fdt_util @@ -1440,14 +1439,14 @@ class TestFunctional(unittest.TestCase): def testEntryDocs(self): """Test for creation of entry documentation""" with test_util.capture_sys_output() as (stdout, stderr): - control.WriteEntryDocs(main.GetEntryModules()) + control.WriteEntryDocs(control.GetEntryModules()) self.assertTrue(len(stdout.getvalue()) > 0) def testEntryDocsMissing(self): """Test handling of missing entry documentation""" with self.assertRaises(ValueError) as e: with test_util.capture_sys_output() as (stdout, stderr): - control.WriteEntryDocs(main.GetEntryModules(), 'u_boot') + control.WriteEntryDocs(control.GetEntryModules(), 'u_boot') self.assertIn('Documentation is missing for modules: u_boot', str(e.exception)) diff --git a/tools/binman/main.py b/tools/binman/main.py index e543a7d06a7..3e463b0119b 100755 --- a/tools/binman/main.py +++ b/tools/binman/main.py @@ -10,7 +10,6 @@ """See README for more information""" from distutils.sysconfig import get_python_lib -import glob import os import site import sys @@ -78,20 +77,9 @@ def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath): return test_util.ReportResult('binman', test_name, result) -def GetEntryModules(include_testing=True): - """Get a set of entry class implementations - - Returns: - Set of paths to entry class filenames - """ - glob_list = glob.glob(os.path.join(our_path, 'etype/*.py')) - return set([os.path.splitext(os.path.basename(item))[0] - for item in glob_list - if include_testing or '_testing' not in item]) - def RunTestCoverage(toolpath): """Run the tests and check that we get 100% coverage""" - glob_list = GetEntryModules(False) + glob_list = control.GetEntryModules(False) all_set = set([os.path.splitext(os.path.basename(item))[0] for item in glob_list if '_testing' not in item]) extra_args = '' @@ -127,7 +115,7 @@ def RunBinman(args): args.toolpath) elif args.cmd == 'entry-docs': - control.WriteEntryDocs(GetEntryModules()) + control.WriteEntryDocs(control.GetEntryModules()) else: try: From 07237988dcf88366ce4182eceac698cf1e97afc5 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Aug 2020 13:27:47 -0600 Subject: [PATCH 048/117] binman: Correct some import statements Some of these were not converted when binman moved to use absolute paths. Fix them. Also drop the import of 'test' which is a directory, not a module. Signed-off-by: Simon Glass --- tools/binman/control.py | 4 ++-- tools/binman/ftest.py | 2 +- tools/binman/image_test.py | 2 +- tools/binman/main.py | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/binman/control.py b/tools/binman/control.py index 69c36ed6582..60e89d3776b 100644 --- a/tools/binman/control.py +++ b/tools/binman/control.py @@ -123,7 +123,7 @@ def ReadEntry(image_fname, entry_path, decomp=True): data extracted from the entry """ global Image - from image import Image + from binman.image import Image image = Image.FromFile(image_fname) entry = image.FindEntryPath(entry_path) @@ -496,7 +496,7 @@ def Binman(args): return 0 # Put these here so that we can import this module without libfdt - from image import Image + from binman.image import Image from binman import state if args.cmd in ['ls', 'extract', 'replace']: diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index fedcc1ada1b..5f650b5f94c 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -29,7 +29,7 @@ from dtoc import fdt from dtoc import fdt_util from binman.etype import fdtmap from binman.etype import image_header -from image import Image +from binman.image import Image from patman import command from patman import test_util from patman import tools diff --git a/tools/binman/image_test.py b/tools/binman/image_test.py index f85c3c51c0f..e351fa84ab3 100644 --- a/tools/binman/image_test.py +++ b/tools/binman/image_test.py @@ -6,7 +6,7 @@ import unittest -from image import Image +from binman.image import Image from patman.test_util import capture_sys_output class TestImage(unittest.TestCase): diff --git a/tools/binman/main.py b/tools/binman/main.py index 3e463b0119b..8c1e478d54c 100755 --- a/tools/binman/main.py +++ b/tools/binman/main.py @@ -61,7 +61,6 @@ def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath): from binman import fdt_test from binman import ftest from binman import image_test - from binman import test import doctest result = unittest.TestResult() From 946ec8503737e4d9b2e9474939312c393ca092c0 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Aug 2020 13:27:48 -0600 Subject: [PATCH 049/117] dtoc: Add a setup script for Python Allow dtoc to be installed by adding a suitable setup.py script. Signed-off-by: Simon Glass --- tools/dtoc/setup.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tools/dtoc/setup.py diff --git a/tools/dtoc/setup.py b/tools/dtoc/setup.py new file mode 100644 index 00000000000..5e092fe0872 --- /dev/null +++ b/tools/dtoc/setup.py @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0+ + +from distutils.core import setup +setup(name='dtoc', + version='1.0', + license='GPL-2.0+', + scripts=['dtoc'], + packages=['dtoc'], + package_dir={'dtoc': ''}, + package_data={'dtoc': ['README']}, + classifiers=['Environment :: Console', + 'Topic :: Software Development :: Embedded Systems']) From 02c102074ddc0721db881118db6ffdc2fbb05ebb Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Aug 2020 13:27:49 -0600 Subject: [PATCH 050/117] binman: Add a setup script for Python Allow binman to be installed by adding a suitable setup.py script. Signed-off-by: Simon Glass --- tools/binman/setup.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tools/binman/setup.py diff --git a/tools/binman/setup.py b/tools/binman/setup.py new file mode 100644 index 00000000000..fe408ed6911 --- /dev/null +++ b/tools/binman/setup.py @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0+ + +from distutils.core import setup +setup(name='binman', + version='1.0', + license='GPL-2.0+', + scripts=['binman'], + packages=['binman', 'binman.etype'], + package_dir={'binman': ''}, + package_data={'binman': ['README', 'README.entries']}, + classifiers=['Environment :: Console', + 'Topic :: Software Development :: Embedded Systems']) From 78237828a3b20d993670e1beeacb5089d40c5e53 Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Mon, 17 Aug 2020 21:27:50 +0300 Subject: [PATCH 051/117] board_f: Remove dead code from init_func_i2c Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD") init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because of this, the second ifdef within becomes pointless: #if defined(CONFIG_SYS_I2C) static int init_func_i2c(void) #ifdef CONFIG_SYS_I2C ... #else ... #endif } #endif Remove the dead #else preprocessor code. Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD") Signed-off-by: Ovidiu Panait --- common/board_f.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index 3932e0c69dd..d3444c7edc9 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -254,11 +254,7 @@ __weak int dram_init_banksize(void) static int init_func_i2c(void) { puts("I2C: "); -#ifdef CONFIG_SYS_I2C i2c_init_all(); -#else - i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); -#endif puts("ready\n"); return 0; } From a4020350289c520e896fd6180e510be557ed3bf9 Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Mon, 17 Aug 2020 21:27:51 +0300 Subject: [PATCH 052/117] sandbox: u-boot.lds: Remove bogus __bss_start symbol The sections described in the sandbox linker script are inserted before data section via "INSERT BEFORE .data;". Running readelf -S on sandbox u-boot binary shows that the bss section is located after the data section: Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align ... [25] .u_boot_list PROGBITS 000000000041d1c8 0021d1c8 000000000000dd90 0000000000000000 WA 0 0 8 [26] _u_boot_sandbox_g PROGBITS 000000000042af58 0022af58 00000000000000a0 0000000000000000 WA 0 0 8 [27] .data PROGBITS 000000000042b000 0022b000 000000000000f708 0000000000000000 WA 0 0 32 [28] .bss NOBITS 000000000043a720 0023a708 0000000000018930 0000000000000000 WA 0 0 32 This means that the __bss_start assignment in the linker script is bogus, as the actual bss section start is located elsewhere. Remove this assignment, as the __bss_start symbol is not used on sandbox anyway. Signed-off-by: Ovidiu Panait --- arch/sandbox/cpu/u-boot-spl.lds | 2 -- arch/sandbox/cpu/u-boot.lds | 2 -- 2 files changed, 4 deletions(-) diff --git a/arch/sandbox/cpu/u-boot-spl.lds b/arch/sandbox/cpu/u-boot-spl.lds index c60eb109b15..649abeb5ee7 100644 --- a/arch/sandbox/cpu/u-boot-spl.lds +++ b/arch/sandbox/cpu/u-boot-spl.lds @@ -16,8 +16,6 @@ SECTIONS __u_boot_sandbox_option_start = .; _u_boot_sandbox_getopt : { KEEP(*(.u_boot_sandbox_getopt)) } __u_boot_sandbox_option_end = .; - - __bss_start = .; } INSERT AFTER .data; diff --git a/arch/sandbox/cpu/u-boot.lds b/arch/sandbox/cpu/u-boot.lds index 6a26c27e8e2..936da5e1402 100644 --- a/arch/sandbox/cpu/u-boot.lds +++ b/arch/sandbox/cpu/u-boot.lds @@ -44,8 +44,6 @@ SECTIONS { *(.__efi_runtime_rel_stop) } - - __bss_start = .; } INSERT BEFORE .data; From a7fc1e12ad970c2c02b2728b23ae26008f55c9db Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Sun, 23 Aug 2020 13:06:36 -0400 Subject: [PATCH 053/117] Convert CONFIG_NETCONSOLE to Kconfig This converts the following to Kconfig: CONFIG_NETCONSOLE Signed-off-by: Tom Rini --- arch/arm/mach-kirkwood/include/mach/config.h | 1 - configs/SBx81LIFKW_defconfig | 1 + configs/SBx81LIFXCAT_defconfig | 1 + configs/brppt1_mmc_defconfig | 1 + configs/brppt1_nand_defconfig | 1 + configs/brppt1_spi_defconfig | 1 + configs/brppt2_defconfig | 1 + configs/d2net_v2_defconfig | 1 + configs/db-88f6281-bp-nand_defconfig | 1 + configs/db-88f6281-bp-spi_defconfig | 1 + configs/dns325_defconfig | 1 + configs/dockstar_defconfig | 1 + configs/dreamplug_defconfig | 1 + configs/ds109_defconfig | 1 + configs/edminiv2_defconfig | 1 + configs/goflexhome_defconfig | 1 + configs/guruplug_defconfig | 1 + configs/gwventana_emmc_defconfig | 1 + configs/gwventana_gw5904_defconfig | 1 + configs/gwventana_nand_defconfig | 1 + configs/ib62x0_defconfig | 1 + configs/iconnect_defconfig | 1 + configs/inetspace_v2_defconfig | 1 + configs/km_kirkwood_128m16_defconfig | 1 + configs/km_kirkwood_defconfig | 1 + configs/km_kirkwood_pci_defconfig | 1 + configs/kmcoge5un_defconfig | 1 + configs/kmnusa_defconfig | 1 + configs/kmsuse2_defconfig | 1 + configs/lschlv2_defconfig | 1 + configs/lsxhl_defconfig | 1 + configs/mx6qsabrelite_defconfig | 1 + configs/nas220_defconfig | 1 + configs/net2big_v2_defconfig | 1 + configs/netspace_lite_v2_defconfig | 1 + configs/netspace_max_v2_defconfig | 1 + configs/netspace_mini_v2_defconfig | 1 + configs/netspace_v2_defconfig | 1 + configs/nitrogen6dl2g_defconfig | 1 + configs/nitrogen6dl_defconfig | 1 + configs/nitrogen6q2g_defconfig | 1 + configs/nitrogen6q_defconfig | 1 + configs/nitrogen6s1g_defconfig | 1 + configs/nitrogen6s_defconfig | 1 + configs/novena_defconfig | 1 + configs/nsa310s_defconfig | 1 + configs/openrd_base_defconfig | 1 + configs/openrd_client_defconfig | 1 + configs/openrd_ultimate_defconfig | 1 + configs/pogo_e02_defconfig | 1 + configs/sansa_fuze_plus_defconfig | 1 + configs/sheevaplug_defconfig | 1 + configs/xfi3_defconfig | 1 + include/configs/SBx81LIFKW.h | 1 - include/configs/SBx81LIFXCAT.h | 1 - include/configs/bur_cfg_common.h | 1 - include/configs/dns325.h | 1 - include/configs/edb93xx.h | 1 - include/configs/edminiv2.h | 1 - include/configs/gw_ventana.h | 1 - include/configs/lacie_kw.h | 1 - include/configs/nitrogen6x.h | 1 - include/configs/novena.h | 1 - include/configs/nsa310s.h | 1 - include/configs/sansa_fuze_plus.h | 2 -- include/configs/xfi3.h | 2 -- 66 files changed, 52 insertions(+), 16 deletions(-) diff --git a/arch/arm/mach-kirkwood/include/mach/config.h b/arch/arm/mach-kirkwood/include/mach/config.h index beedc125b63..3bd032e0879 100644 --- a/arch/arm/mach-kirkwood/include/mach/config.h +++ b/arch/arm/mach-kirkwood/include/mach/config.h @@ -58,7 +58,6 @@ * Ethernet Driver configuration */ #ifdef CONFIG_CMD_NET -#define CONFIG_NETCONSOLE /* include NetConsole support */ #define CONFIG_SYS_FAULT_ECHO_LINK_DOWN /* detect link using phy */ #define CONFIG_RESET_PHY_R /* use reset_phy() to init mv8831116 PHY */ #endif /* CONFIG_CMD_NET */ diff --git a/configs/SBx81LIFKW_defconfig b/configs/SBx81LIFKW_defconfig index f5143b231b6..a1abbc13bf2 100644 --- a/configs/SBx81LIFKW_defconfig +++ b/configs/SBx81LIFKW_defconfig @@ -30,6 +30,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=20000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_DM_PCA953X=y CONFIG_DM_I2C=y diff --git a/configs/SBx81LIFXCAT_defconfig b/configs/SBx81LIFXCAT_defconfig index b2c3b1bde3d..81e09074832 100644 --- a/configs/SBx81LIFXCAT_defconfig +++ b/configs/SBx81LIFXCAT_defconfig @@ -32,6 +32,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=20000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_DM_PCA953X=y CONFIG_DM_I2C=y diff --git a/configs/brppt1_mmc_defconfig b/configs/brppt1_mmc_defconfig index 48c1b16cf85..6ecea550f19 100644 --- a/configs/brppt1_mmc_defconfig +++ b/configs/brppt1_mmc_defconfig @@ -74,6 +74,7 @@ CONFIG_SYS_MMC_ENV_DEV=1 CONFIG_SYS_MMC_ENV_PART=2 CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y diff --git a/configs/brppt1_nand_defconfig b/configs/brppt1_nand_defconfig index 7c04ea194e9..5dfe1ac3062 100644 --- a/configs/brppt1_nand_defconfig +++ b/configs/brppt1_nand_defconfig @@ -75,6 +75,7 @@ CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y diff --git a/configs/brppt1_spi_defconfig b/configs/brppt1_spi_defconfig index bc0ae75d7dc..fa8ef5bb458 100644 --- a/configs/brppt1_spi_defconfig +++ b/configs/brppt1_spi_defconfig @@ -81,6 +81,7 @@ CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y diff --git a/configs/brppt2_defconfig b/configs/brppt2_defconfig index d6f7ea2bc72..4d5cd44ca80 100644 --- a/configs/brppt2_defconfig +++ b/configs/brppt2_defconfig @@ -65,6 +65,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_NETCONSOLE=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_SPL_DM_SEQ_ALIAS=y # CONFIG_OF_TRANSLATE is not set diff --git a/configs/d2net_v2_defconfig b/configs/d2net_v2_defconfig index be8cfa2d603..0b6b907a8e1 100644 --- a/configs/d2net_v2_defconfig +++ b/configs/d2net_v2_defconfig @@ -40,6 +40,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=20000000 CONFIG_ENV_ADDR=0x70000 +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_SATA_MV=y CONFIG_BLK=y diff --git a/configs/db-88f6281-bp-nand_defconfig b/configs/db-88f6281-bp-nand_defconfig index b690cd24baa..4fff3269aff 100644 --- a/configs/db-88f6281-bp-nand_defconfig +++ b/configs/db-88f6281-bp-nand_defconfig @@ -39,6 +39,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_MVSATA_IDE=y CONFIG_MTD=y diff --git a/configs/db-88f6281-bp-spi_defconfig b/configs/db-88f6281-bp-spi_defconfig index 90d6259150b..07e9db7f41b 100644 --- a/configs/db-88f6281-bp-spi_defconfig +++ b/configs/db-88f6281-bp-spi_defconfig @@ -39,6 +39,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_MVSATA_IDE=y CONFIG_MTD=y diff --git a/configs/dns325_defconfig b/configs/dns325_defconfig index 63743f8844a..8a04e1492c0 100644 --- a/configs/dns325_defconfig +++ b/configs/dns325_defconfig @@ -34,6 +34,7 @@ CONFIG_ISO_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_MVSATA_IDE=y CONFIG_BLK=y diff --git a/configs/dockstar_defconfig b/configs/dockstar_defconfig index 44327cd21e6..0b434f46a09 100644 --- a/configs/dockstar_defconfig +++ b/configs/dockstar_defconfig @@ -30,6 +30,7 @@ CONFIG_ISO_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y +CONFIG_NETCONSOLE=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y diff --git a/configs/dreamplug_defconfig b/configs/dreamplug_defconfig index ea8c2522c04..2c27726fcde 100644 --- a/configs/dreamplug_defconfig +++ b/configs/dreamplug_defconfig @@ -32,6 +32,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=50000000 CONFIG_ENV_ADDR=0x100000 +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_MVSATA_IDE=y CONFIG_BLK=y diff --git a/configs/ds109_defconfig b/configs/ds109_defconfig index e4948873782..e412e3f5937 100644 --- a/configs/ds109_defconfig +++ b/configs/ds109_defconfig @@ -28,6 +28,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=50000000 CONFIG_ENV_ADDR=0x3D0000 +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_MVSATA_IDE=y CONFIG_BLK=y diff --git a/configs/edminiv2_defconfig b/configs/edminiv2_defconfig index 7c9cfdd0345..916775e9ed1 100644 --- a/configs/edminiv2_defconfig +++ b/configs/edminiv2_defconfig @@ -31,6 +31,7 @@ CONFIG_ISO_PARTITION=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_ENV_ADDR=0xFFF84000 +CONFIG_NETCONSOLE=y CONFIG_MVSATA_IDE=y # CONFIG_MMC is not set CONFIG_MTD_NOR_FLASH=y diff --git a/configs/goflexhome_defconfig b/configs/goflexhome_defconfig index 694268233a6..b271822dcbf 100644 --- a/configs/goflexhome_defconfig +++ b/configs/goflexhome_defconfig @@ -35,6 +35,7 @@ CONFIG_ISO_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_MVSATA_IDE=y CONFIG_BLK=y diff --git a/configs/guruplug_defconfig b/configs/guruplug_defconfig index 5833f127331..f7e934bcf89 100644 --- a/configs/guruplug_defconfig +++ b/configs/guruplug_defconfig @@ -36,6 +36,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_MVSATA_IDE=y CONFIG_BLK=y diff --git a/configs/gwventana_emmc_defconfig b/configs/gwventana_emmc_defconfig index 537cbdf1521..497a54ba5d5 100644 --- a/configs/gwventana_emmc_defconfig +++ b/configs/gwventana_emmc_defconfig @@ -67,6 +67,7 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_PART=1 +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_DWC_AHSATA=y CONFIG_SUPPORT_EMMC_RPMB=y diff --git a/configs/gwventana_gw5904_defconfig b/configs/gwventana_gw5904_defconfig index 16ac54fb45c..d9352eb727e 100644 --- a/configs/gwventana_gw5904_defconfig +++ b/configs/gwventana_gw5904_defconfig @@ -67,6 +67,7 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_PART=1 +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_DWC_AHSATA=y CONFIG_SUPPORT_EMMC_RPMB=y diff --git a/configs/gwventana_nand_defconfig b/configs/gwventana_nand_defconfig index 94d42a415fb..f618b74a9dd 100644 --- a/configs/gwventana_nand_defconfig +++ b/configs/gwventana_nand_defconfig @@ -69,6 +69,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_DWC_AHSATA=y CONFIG_SUPPORT_EMMC_RPMB=y diff --git a/configs/ib62x0_defconfig b/configs/ib62x0_defconfig index 52dba55e66e..1fbf03442d0 100644 --- a/configs/ib62x0_defconfig +++ b/configs/ib62x0_defconfig @@ -34,6 +34,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_MVSATA_IDE=y # CONFIG_MMC is not set CONFIG_MTD=y diff --git a/configs/iconnect_defconfig b/configs/iconnect_defconfig index 6b484c83a3b..d3aea6ead2e 100644 --- a/configs/iconnect_defconfig +++ b/configs/iconnect_defconfig @@ -30,6 +30,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y diff --git a/configs/inetspace_v2_defconfig b/configs/inetspace_v2_defconfig index 6871adc9c16..819f5e0cea7 100644 --- a/configs/inetspace_v2_defconfig +++ b/configs/inetspace_v2_defconfig @@ -40,6 +40,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=20000000 CONFIG_ENV_ADDR=0x70000 +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_SATA_MV=y CONFIG_BLK=y diff --git a/configs/km_kirkwood_128m16_defconfig b/configs/km_kirkwood_128m16_defconfig index 50bcb79865f..3416c575f69 100644 --- a/configs/km_kirkwood_128m16_defconfig +++ b/configs/km_kirkwood_128m16_defconfig @@ -38,6 +38,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_EEPROM=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_RAM=y # CONFIG_MMC is not set diff --git a/configs/km_kirkwood_defconfig b/configs/km_kirkwood_defconfig index bf732c82341..51d41cc9944 100644 --- a/configs/km_kirkwood_defconfig +++ b/configs/km_kirkwood_defconfig @@ -38,6 +38,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_EEPROM=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_RAM=y # CONFIG_MMC is not set diff --git a/configs/km_kirkwood_pci_defconfig b/configs/km_kirkwood_pci_defconfig index 2cf3a994a65..80ff773ca01 100644 --- a/configs/km_kirkwood_pci_defconfig +++ b/configs/km_kirkwood_pci_defconfig @@ -39,6 +39,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_EEPROM=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_RAM=y # CONFIG_MMC is not set diff --git a/configs/kmcoge5un_defconfig b/configs/kmcoge5un_defconfig index 97b10af42e5..51721bb497f 100644 --- a/configs/kmcoge5un_defconfig +++ b/configs/kmcoge5un_defconfig @@ -42,6 +42,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_RAM=y # CONFIG_MMC is not set diff --git a/configs/kmnusa_defconfig b/configs/kmnusa_defconfig index 2b3a3d2c73f..96200b5fd71 100644 --- a/configs/kmnusa_defconfig +++ b/configs/kmnusa_defconfig @@ -42,6 +42,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_RAM=y # CONFIG_MMC is not set diff --git a/configs/kmsuse2_defconfig b/configs/kmsuse2_defconfig index 82dc9ff2e21..b5c7ebfa79f 100644 --- a/configs/kmsuse2_defconfig +++ b/configs/kmsuse2_defconfig @@ -43,6 +43,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_RAM=y # CONFIG_MMC is not set diff --git a/configs/lschlv2_defconfig b/configs/lschlv2_defconfig index 133905010bb..80ab7108dec 100644 --- a/configs/lschlv2_defconfig +++ b/configs/lschlv2_defconfig @@ -33,6 +33,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_SATA_MV=y CONFIG_BLK=y diff --git a/configs/lsxhl_defconfig b/configs/lsxhl_defconfig index e52ed1872c7..6c8a9e1277c 100644 --- a/configs/lsxhl_defconfig +++ b/configs/lsxhl_defconfig @@ -33,6 +33,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_SATA_MV=y CONFIG_BLK=y diff --git a/configs/mx6qsabrelite_defconfig b/configs/mx6qsabrelite_defconfig index 216e21ad79d..3e874593a7f 100644 --- a/configs/mx6qsabrelite_defconfig +++ b/configs/mx6qsabrelite_defconfig @@ -42,6 +42,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_DWC_AHSATA=y CONFIG_USB_FUNCTION_FASTBOOT=y diff --git a/configs/nas220_defconfig b/configs/nas220_defconfig index 8b4385b2db2..e89b6b9e14d 100644 --- a/configs/nas220_defconfig +++ b/configs/nas220_defconfig @@ -36,6 +36,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_MVSATA_IDE=y CONFIG_BLK=y diff --git a/configs/net2big_v2_defconfig b/configs/net2big_v2_defconfig index 13e7956780c..e2e8341a4e6 100644 --- a/configs/net2big_v2_defconfig +++ b/configs/net2big_v2_defconfig @@ -40,6 +40,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=20000000 CONFIG_ENV_ADDR=0x70000 +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_SATA_MV=y CONFIG_BLK=y diff --git a/configs/netspace_lite_v2_defconfig b/configs/netspace_lite_v2_defconfig index d8b5ce20ec1..ce681ce5385 100644 --- a/configs/netspace_lite_v2_defconfig +++ b/configs/netspace_lite_v2_defconfig @@ -40,6 +40,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=20000000 CONFIG_ENV_ADDR=0x70000 +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_SATA_MV=y CONFIG_BLK=y diff --git a/configs/netspace_max_v2_defconfig b/configs/netspace_max_v2_defconfig index 3168641272b..af55d385d49 100644 --- a/configs/netspace_max_v2_defconfig +++ b/configs/netspace_max_v2_defconfig @@ -40,6 +40,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=20000000 CONFIG_ENV_ADDR=0x70000 +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_SATA_MV=y CONFIG_BLK=y diff --git a/configs/netspace_mini_v2_defconfig b/configs/netspace_mini_v2_defconfig index 6d07e873dd5..45c16d9d166 100644 --- a/configs/netspace_mini_v2_defconfig +++ b/configs/netspace_mini_v2_defconfig @@ -38,6 +38,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=20000000 CONFIG_ENV_ADDR=0x70000 +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_SATA_MV=y CONFIG_BLK=y diff --git a/configs/netspace_v2_defconfig b/configs/netspace_v2_defconfig index e99ea75b01d..6b813b5c844 100644 --- a/configs/netspace_v2_defconfig +++ b/configs/netspace_v2_defconfig @@ -40,6 +40,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=20000000 CONFIG_ENV_ADDR=0x70000 +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_SATA_MV=y CONFIG_BLK=y diff --git a/configs/nitrogen6dl2g_defconfig b/configs/nitrogen6dl2g_defconfig index 3131c51bded..1c1016a4173 100644 --- a/configs/nitrogen6dl2g_defconfig +++ b/configs/nitrogen6dl2g_defconfig @@ -46,6 +46,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0x12000000 diff --git a/configs/nitrogen6dl_defconfig b/configs/nitrogen6dl_defconfig index 86c2c4ff13d..310d42eb487 100644 --- a/configs/nitrogen6dl_defconfig +++ b/configs/nitrogen6dl_defconfig @@ -46,6 +46,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0x12000000 diff --git a/configs/nitrogen6q2g_defconfig b/configs/nitrogen6q2g_defconfig index 16cf5f3e5b1..545548eb693 100644 --- a/configs/nitrogen6q2g_defconfig +++ b/configs/nitrogen6q2g_defconfig @@ -47,6 +47,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_DWC_AHSATA=y CONFIG_USB_FUNCTION_FASTBOOT=y diff --git a/configs/nitrogen6q_defconfig b/configs/nitrogen6q_defconfig index ea9098ad68a..0846b40e932 100644 --- a/configs/nitrogen6q_defconfig +++ b/configs/nitrogen6q_defconfig @@ -47,6 +47,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_DWC_AHSATA=y CONFIG_USB_FUNCTION_FASTBOOT=y diff --git a/configs/nitrogen6s1g_defconfig b/configs/nitrogen6s1g_defconfig index 8a67b419e0f..05ba13a9a2e 100644 --- a/configs/nitrogen6s1g_defconfig +++ b/configs/nitrogen6s1g_defconfig @@ -46,6 +46,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0x12000000 diff --git a/configs/nitrogen6s_defconfig b/configs/nitrogen6s_defconfig index 71dff7ae857..b28cd640bee 100644 --- a/configs/nitrogen6s_defconfig +++ b/configs/nitrogen6s_defconfig @@ -46,6 +46,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0x12000000 diff --git a/configs/novena_defconfig b/configs/novena_defconfig index 33cda1b383c..20c3aa1af9b 100644 --- a/configs/novena_defconfig +++ b/configs/novena_defconfig @@ -48,6 +48,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_DWC_AHSATA=y CONFIG_FSL_USDHC=y diff --git a/configs/nsa310s_defconfig b/configs/nsa310s_defconfig index d9470f171ae..bec1707ddc1 100644 --- a/configs/nsa310s_defconfig +++ b/configs/nsa310s_defconfig @@ -31,6 +31,7 @@ CONFIG_ISO_PARTITION=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_MVSATA_IDE=y # CONFIG_MMC is not set CONFIG_MTD=y diff --git a/configs/openrd_base_defconfig b/configs/openrd_base_defconfig index e0309db43ff..ebe22ab877d 100644 --- a/configs/openrd_base_defconfig +++ b/configs/openrd_base_defconfig @@ -36,6 +36,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_MVSATA_IDE=y # CONFIG_MMC_HW_PARTITIONING is not set CONFIG_MTD=y diff --git a/configs/openrd_client_defconfig b/configs/openrd_client_defconfig index 2bf18dbe66c..04fcea2d0d4 100644 --- a/configs/openrd_client_defconfig +++ b/configs/openrd_client_defconfig @@ -36,6 +36,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_MVSATA_IDE=y # CONFIG_MMC_HW_PARTITIONING is not set CONFIG_MTD=y diff --git a/configs/openrd_ultimate_defconfig b/configs/openrd_ultimate_defconfig index 35962333ea4..de7526dd708 100644 --- a/configs/openrd_ultimate_defconfig +++ b/configs/openrd_ultimate_defconfig @@ -36,6 +36,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_MVSATA_IDE=y # CONFIG_MMC_HW_PARTITIONING is not set CONFIG_MTD=y diff --git a/configs/pogo_e02_defconfig b/configs/pogo_e02_defconfig index ee76b44382b..34d1226686e 100644 --- a/configs/pogo_e02_defconfig +++ b/configs/pogo_e02_defconfig @@ -30,6 +30,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y diff --git a/configs/sansa_fuze_plus_defconfig b/configs/sansa_fuze_plus_defconfig index 1b5288ca9ad..0cf85955844 100644 --- a/configs/sansa_fuze_plus_defconfig +++ b/configs/sansa_fuze_plus_defconfig @@ -34,6 +34,7 @@ CONFIG_CMD_EXT2=y CONFIG_CMD_FAT=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_MXS_GPIO=y CONFIG_MMC_MXS=y CONFIG_CONS_INDEX=0 diff --git a/configs/sheevaplug_defconfig b/configs/sheevaplug_defconfig index 40d50d66e57..34da356b8e2 100644 --- a/configs/sheevaplug_defconfig +++ b/configs/sheevaplug_defconfig @@ -37,6 +37,7 @@ CONFIG_ISO_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y +CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_MVSATA_IDE=y CONFIG_MTD=y diff --git a/configs/xfi3_defconfig b/configs/xfi3_defconfig index bc95e19c28d..c529f2f06dd 100644 --- a/configs/xfi3_defconfig +++ b/configs/xfi3_defconfig @@ -31,6 +31,7 @@ CONFIG_CMD_EXT2=y CONFIG_CMD_FAT=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NETCONSOLE=y CONFIG_MXS_GPIO=y CONFIG_MMC_MXS=y CONFIG_CONS_INDEX=0 diff --git a/include/configs/SBx81LIFKW.h b/include/configs/SBx81LIFKW.h index b85f2716435..eaa6b9246c9 100644 --- a/include/configs/SBx81LIFKW.h +++ b/include/configs/SBx81LIFKW.h @@ -84,7 +84,6 @@ * Ethernet Driver configuration */ #ifdef CONFIG_CMD_NET -#define CONFIG_NETCONSOLE /* include NetConsole support */ #define CONFIG_NET_MULTI /* specify more that one ports available */ #define CONFIG_MVGBE /* Enable kirkwood Gbe Controller Driver */ #define CONFIG_MVGBE_PORTS {1, 0} /* enable a single port */ diff --git a/include/configs/SBx81LIFXCAT.h b/include/configs/SBx81LIFXCAT.h index 84f24400fa9..c0dc3d38c12 100644 --- a/include/configs/SBx81LIFXCAT.h +++ b/include/configs/SBx81LIFXCAT.h @@ -84,7 +84,6 @@ * Ethernet Driver configuration */ #ifdef CONFIG_CMD_NET -#define CONFIG_NETCONSOLE /* include NetConsole support */ #define CONFIG_NET_MULTI /* specify more that one ports available */ #define CONFIG_MVGBE /* Enable kirkwood Gbe Controller Driver */ #define CONFIG_MVGBE_PORTS {1, 0} /* enable a single port */ diff --git a/include/configs/bur_cfg_common.h b/include/configs/bur_cfg_common.h index 325ef1e754c..05915b4cffd 100644 --- a/include/configs/bur_cfg_common.h +++ b/include/configs/bur_cfg_common.h @@ -27,7 +27,6 @@ #define CONFIG_NET_RETRY_COUNT 10 /* Network console */ -#define CONFIG_NETCONSOLE 1 #define CONFIG_BOOTP_MAY_FAIL /* if we don't have DHCP environment */ /* As stated above, the following choices are optional. */ diff --git a/include/configs/dns325.h b/include/configs/dns325.h index 62107625e25..ea8d28b5b53 100644 --- a/include/configs/dns325.h +++ b/include/configs/dns325.h @@ -33,7 +33,6 @@ */ #ifdef CONFIG_CMD_NET #define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */ -#define CONFIG_NETCONSOLE #endif /* diff --git a/include/configs/edb93xx.h b/include/configs/edb93xx.h index 3b35b5ce11c..2f302b921bc 100644 --- a/include/configs/edb93xx.h +++ b/include/configs/edb93xx.h @@ -83,7 +83,6 @@ /* Network hardware configuration */ #define CONFIG_DRIVER_EP93XX_MAC #define CONFIG_MII_SUPPRESS_PREAMBLE -#undef CONFIG_NETCONSOLE /* SDRAM configuration */ #if defined(CONFIG_EDB9301) || defined(CONFIG_EDB9302) || \ diff --git a/include/configs/edminiv2.h b/include/configs/edminiv2.h index 19a923b5013..dd16e3fbda4 100644 --- a/include/configs/edminiv2.h +++ b/include/configs/edminiv2.h @@ -114,7 +114,6 @@ #define CONFIG_SKIP_LOCAL_MAC_RANDOMIZATION /* don't randomize MAC */ #define CONFIG_PHY_BASE_ADR 0x8 #define CONFIG_RESET_PHY_R /* use reset_phy() to init mv8831116 PHY */ -#define CONFIG_NETCONSOLE /* include NetConsole support */ #define CONFIG_SYS_FAULT_ECHO_LINK_DOWN /* detect link using phy */ #endif diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h index a666d420e4b..76883601073 100644 --- a/include/configs/gw_ventana.h +++ b/include/configs/gw_ventana.h @@ -115,7 +115,6 @@ #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) #define CONFIG_MXC_USB_FLAGS 0 #define CONFIG_USBD_HS -#define CONFIG_NETCONSOLE /* Framebuffer and LCD */ #define CONFIG_VIDEO_LOGO diff --git a/include/configs/lacie_kw.h b/include/configs/lacie_kw.h index 031bc995e3b..420c1d49b08 100644 --- a/include/configs/lacie_kw.h +++ b/include/configs/lacie_kw.h @@ -77,7 +77,6 @@ */ #ifdef CONFIG_CMD_NET #define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */ -#define CONFIG_NETCONSOLE #endif /* diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h index 0598224f667..fdcf43f44d1 100644 --- a/include/configs/nitrogen6x.h +++ b/include/configs/nitrogen6x.h @@ -17,7 +17,6 @@ #define CONFIG_SYS_MALLOC_LEN (10 * 1024 * 1024) #define CONFIG_USBD_HS -#define CONFIG_NETCONSOLE #define CONFIG_MXC_UART_BASE UART2_BASE diff --git a/include/configs/novena.h b/include/configs/novena.h index 62faef0703e..8aabf06fa2a 100644 --- a/include/configs/novena.h +++ b/include/configs/novena.h @@ -98,7 +98,6 @@ #define CONFIG_MXC_USB_FLAGS 0 /* Gadget part */ #define CONFIG_USBD_HS -#define CONFIG_NETCONSOLE #endif /* Video output */ diff --git a/include/configs/nsa310s.h b/include/configs/nsa310s.h index 13812c43a12..1cb0d68b5af 100644 --- a/include/configs/nsa310s.h +++ b/include/configs/nsa310s.h @@ -40,7 +40,6 @@ /* Ethernet driver configuration */ #ifdef CONFIG_CMD_NET -#define CONFIG_NETCONSOLE #define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */ #define CONFIG_PHY_BASE_ADR 1 #define CONFIG_RESET_PHY_R diff --git a/include/configs/sansa_fuze_plus.h b/include/configs/sansa_fuze_plus.h index 5b0ea9a335e..853a89ced12 100644 --- a/include/configs/sansa_fuze_plus.h +++ b/include/configs/sansa_fuze_plus.h @@ -31,8 +31,6 @@ #ifdef CONFIG_CMD_USB #define CONFIG_EHCI_MXS_PORT0 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1 - -#define CONFIG_NETCONSOLE #endif /* The rest of the configuration is shared */ diff --git a/include/configs/xfi3.h b/include/configs/xfi3.h index 4fc7154fff5..80849129b93 100644 --- a/include/configs/xfi3.h +++ b/include/configs/xfi3.h @@ -31,8 +31,6 @@ #ifdef CONFIG_CMD_USB #define CONFIG_EHCI_MXS_PORT0 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1 - -#define CONFIG_NETCONSOLE #endif /* The rest of the configuration is shared */ From a38cc1726b65e63e77724c8bf4aa449cfe5cf21f Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 11 Aug 2020 11:23:34 -0600 Subject: [PATCH 054/117] moveconfig: Skip binary and ELF files Add a few more file extensions to the list of files that should not be processed. This avoids unicode errors, for example. Signed-off-by: Simon Glass --- tools/moveconfig.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 36361f9ed1b..9514d9a00cb 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -666,7 +666,8 @@ def cleanup_headers(configs, options): if dirpath == os.path.join('include', 'generated'): continue for filename in filenames: - if not filename.endswith(('~', '.dts', '.dtsi')): + if not filename.endswith(('~', '.dts', '.dtsi', '.bin', + '.elf')): header_path = os.path.join(dirpath, filename) # This file contains UTF-16 data and no CONFIG symbols if header_path == 'include/video_font_data.h': From 35bd70c5107f0cfa610b5c7074a7ee2a60d5d82f Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 11 Aug 2020 11:23:35 -0600 Subject: [PATCH 055/117] Convert CONFIG_SPLASH_SCREEN et al to Kconfig This converts the following to Kconfig: CONFIG_SPLASH_SCREEN CONFIG_SPLASH_SCREEN_ALIGN CONFIG_SPLASHIMAGE_GUARD CONFIG_SPLASH_SOURCE Signed-off-by: Simon Glass --- README | 42 ------------ configs/apalis_imx6_defconfig | 2 + configs/aristainetos2_defconfig | 2 + configs/aristainetos2b_defconfig | 2 + configs/aristainetos2bcsl_defconfig | 2 + configs/aristainetos2c_defconfig | 2 + configs/cgtqmx6eval_defconfig | 2 + configs/cm_fx6_defconfig | 2 + configs/colibri-imx6ull_defconfig | 2 + configs/colibri_imx6_defconfig | 2 + configs/colibri_imx7_defconfig | 2 + configs/colibri_imx7_emmc_defconfig | 2 + configs/colibri_vf_defconfig | 1 + configs/dms-ba16-1g_defconfig | 2 + configs/dms-ba16_defconfig | 2 + configs/eb_cpu5282_defconfig | 1 + configs/eb_cpu5282_internal_defconfig | 1 + configs/imx6dl_icore_nand_defconfig | 2 + configs/imx6q_icore_nand_defconfig | 2 + configs/imx6qdl_icore_mmc_defconfig | 2 + configs/imx6qdl_icore_nand_defconfig | 2 + configs/imxrt1050-evk_defconfig | 2 + configs/khadas-vim3_defconfig | 2 + configs/khadas-vim3l_defconfig | 2 + configs/libretech-ac_defconfig | 2 + configs/libretech-cc_defconfig | 2 + configs/libretech-s905d-pc_defconfig | 2 + configs/libretech-s912-pc_defconfig | 2 + configs/m53menlo_defconfig | 4 ++ configs/marsboard_defconfig | 2 + configs/mx23evk_defconfig | 1 + configs/mx28evk_auart_console_defconfig | 1 + configs/mx28evk_defconfig | 1 + configs/mx28evk_nand_defconfig | 1 + configs/mx28evk_spi_defconfig | 1 + configs/mx51evk_defconfig | 1 + configs/mx53loco_defconfig | 1 + configs/mx6cuboxi_defconfig | 2 + configs/mx6qsabrelite_defconfig | 2 + configs/mx6sabreauto_defconfig | 2 + configs/mx6sabresd_defconfig | 2 + configs/mx6sxsabresd_defconfig | 2 + configs/mx6ul_14x14_evk_defconfig | 2 + configs/mx6ul_9x9_evk_defconfig | 2 + configs/mx7dsabresd_defconfig | 2 + configs/mx7dsabresd_qspi_defconfig | 2 + configs/nitrogen6dl2g_defconfig | 2 + configs/nitrogen6dl_defconfig | 2 + configs/nitrogen6q2g_defconfig | 2 + configs/nitrogen6q_defconfig | 2 + configs/nitrogen6s1g_defconfig | 2 + configs/nitrogen6s_defconfig | 2 + configs/nokia_rx51_defconfig | 1 + configs/novena_defconfig | 1 + configs/odroid-c2_defconfig | 2 + configs/odroid-c4_defconfig | 2 + configs/opos6uldev_defconfig | 3 + configs/pico-dwarf-imx6ul_defconfig | 2 + configs/pico-dwarf-imx7d_defconfig | 2 + configs/pico-hobbit-imx6ul_defconfig | 2 + configs/pico-hobbit-imx7d_defconfig | 2 + configs/pico-imx6_defconfig | 2 + configs/pico-imx6ul_defconfig | 2 + configs/pico-imx7d_bl33_defconfig | 2 + configs/pico-imx7d_defconfig | 2 + configs/pico-nymph-imx7d_defconfig | 2 + configs/pico-pi-imx6ul_defconfig | 2 + configs/pico-pi-imx7d_defconfig | 2 + configs/pxm2_defconfig | 2 + configs/riotboard_defconfig | 2 + configs/riotboard_spl_defconfig | 2 + configs/rut_defconfig | 2 + configs/s5p4418_nanopi2_defconfig | 3 + configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + configs/sei510_defconfig | 2 + configs/sei610_defconfig | 2 + configs/stm32f746-disco_defconfig | 2 + configs/stm32f769-disco_defconfig | 2 + configs/wandboard_defconfig | 2 + drivers/video/Kconfig | 85 +++++++++++++++++++++++++ include/configs/M52277EVB.h | 1 - include/configs/advantech_dms-ba16.h | 2 - include/configs/apalis_imx6.h | 2 - include/configs/aristainetos2.h | 2 - include/configs/cgtqmx6eval.h | 2 - include/configs/cm_fx6.h | 2 - include/configs/colibri-imx6ull.h | 2 - include/configs/colibri_imx6.h | 2 - include/configs/colibri_imx7.h | 2 - include/configs/colibri_vf.h | 1 - include/configs/eb_cpu5282.h | 1 - include/configs/embestmx6boards.h | 2 - include/configs/gw_ventana.h | 1 - include/configs/imx6-engicam.h | 2 - include/configs/imxrt1050-evk.h | 2 - include/configs/m53menlo.h | 4 -- include/configs/meson64.h | 2 - include/configs/mx23evk.h | 1 - include/configs/mx28evk.h | 1 - include/configs/mx51evk.h | 1 - include/configs/mx53loco.h | 1 - include/configs/mx6cuboxi.h | 2 - include/configs/mx6sabre_common.h | 2 - include/configs/mx6sxsabresd.h | 2 - include/configs/mx6ul_14x14_evk.h | 2 - include/configs/mx7dsabresd.h | 2 - include/configs/nitrogen6x.h | 2 - include/configs/nokia_rx51.h | 1 - include/configs/novena.h | 1 - include/configs/opos6uldev.h | 3 - include/configs/pico-imx6.h | 2 - include/configs/pico-imx6ul.h | 2 - include/configs/pico-imx7d.h | 2 - include/configs/pxm2.h | 2 - include/configs/rut.h | 2 - include/configs/s5p4418_nanopi2.h | 4 -- include/configs/sandbox.h | 1 - include/configs/stm32f746-disco.h | 2 - include/configs/wandboard.h | 2 - scripts/config_whitelist.txt | 4 -- 122 files changed, 234 insertions(+), 118 deletions(-) diff --git a/README b/README index 121dc4966af..6cb0567ba66 100644 --- a/README +++ b/README @@ -1250,48 +1250,6 @@ The following options need to be configured: Enables an 'i2c edid' command which can read EDID information over I2C from an attached LCD display. -- Splash Screen Support: CONFIG_SPLASH_SCREEN - - If this option is set, the environment is checked for - a variable "splashimage". If found, the usual display - of logo, copyright and system information on the LCD - is suppressed and the BMP image at the address - specified in "splashimage" is loaded instead. The - console is redirected to the "nulldev", too. This - allows for a "silent" boot where a splash screen is - loaded very quickly after power-on. - - CONFIG_SPLASHIMAGE_GUARD - - If this option is set, then U-Boot will prevent the environment - variable "splashimage" from being set to a problematic address - (see doc/README.displaying-bmps). - This option is useful for targets where, due to alignment - restrictions, an improperly aligned BMP image will cause a data - abort. If you think you will not have problems with unaligned - accesses (for example because your toolchain prevents them) - there is no need to set this option. - - CONFIG_SPLASH_SCREEN_ALIGN - - If this option is set the splash image can be freely positioned - on the screen. Environment variable "splashpos" specifies the - position as "x,y". If a positive number is given it is used as - number of pixel from left/top. If a negative number is given it - is used as number of pixel from right/bottom. You can also - specify 'm' for centering the image. - - Example: - setenv splashpos m,m - => image at center of screen - - setenv splashpos 30,20 - => image at x = 30 and y = 20 - - setenv splashpos -10,m - => vertically centered image - at x = dspWidth - bmpWidth - 9 - - Gzip compressed BMP image support: CONFIG_VIDEO_BMP_GZIP If this option is set, additionally to standard BMP diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig index 22ddbe71ba9..084e36e9296 100644 --- a/configs/apalis_imx6_defconfig +++ b/configs/apalis_imx6_defconfig @@ -103,4 +103,6 @@ CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP32 is not set CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/aristainetos2_defconfig b/configs/aristainetos2_defconfig index 18312f921a3..ff309bf0729 100644 --- a/configs/aristainetos2_defconfig +++ b/configs/aristainetos2_defconfig @@ -111,5 +111,7 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_DISPLAY=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_IMX_WATCHDOG=y # CONFIG_EFI_LOADER is not set diff --git a/configs/aristainetos2b_defconfig b/configs/aristainetos2b_defconfig index 82280bc0005..f72323b069e 100644 --- a/configs/aristainetos2b_defconfig +++ b/configs/aristainetos2b_defconfig @@ -105,5 +105,7 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_DISPLAY=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_IMX_WATCHDOG=y # CONFIG_EFI_LOADER is not set diff --git a/configs/aristainetos2bcsl_defconfig b/configs/aristainetos2bcsl_defconfig index 377228306b7..152ef1e9327 100644 --- a/configs/aristainetos2bcsl_defconfig +++ b/configs/aristainetos2bcsl_defconfig @@ -105,5 +105,7 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_DISPLAY=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_IMX_WATCHDOG=y # CONFIG_EFI_LOADER is not set diff --git a/configs/aristainetos2c_defconfig b/configs/aristainetos2c_defconfig index 63914535ea0..47f5a2c1c19 100644 --- a/configs/aristainetos2c_defconfig +++ b/configs/aristainetos2c_defconfig @@ -111,5 +111,7 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_DISPLAY=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_IMX_WATCHDOG=y # CONFIG_EFI_LOADER is not set diff --git a/configs/cgtqmx6eval_defconfig b/configs/cgtqmx6eval_defconfig index 520991869e0..9f589dbea12 100644 --- a/configs/cgtqmx6eval_defconfig +++ b/configs/cgtqmx6eval_defconfig @@ -90,4 +90,6 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y # CONFIG_PANEL is not set CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT=y diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig index 3b168180411..4c0b46e46d3 100644 --- a/configs/cm_fx6_defconfig +++ b/configs/cm_fx6_defconfig @@ -94,4 +94,6 @@ CONFIG_USB_KEYBOARD=y CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y CONFIG_DM_VIDEO=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SOURCE=y CONFIG_FDT_FIXUP_PARTITIONS=y diff --git a/configs/colibri-imx6ull_defconfig b/configs/colibri-imx6ull_defconfig index a1f6cf1a16d..6079b57958b 100644 --- a/configs/colibri-imx6ull_defconfig +++ b/configs/colibri-imx6ull_defconfig @@ -91,5 +91,7 @@ CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_FDT_FIXUP_PARTITIONS=y diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig index 9506b91f3d2..f266c0af405 100644 --- a/configs/colibri_imx6_defconfig +++ b/configs/colibri_imx6_defconfig @@ -101,4 +101,6 @@ CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP32 is not set CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig index ae58505eba1..f33ca11a4ac 100644 --- a/configs/colibri_imx7_defconfig +++ b/configs/colibri_imx7_defconfig @@ -91,5 +91,7 @@ CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_FDT_FIXUP_PARTITIONS=y diff --git a/configs/colibri_imx7_emmc_defconfig b/configs/colibri_imx7_emmc_defconfig index c4bcc67ced6..e4b0c99d4f7 100644 --- a/configs/colibri_imx7_emmc_defconfig +++ b/configs/colibri_imx7_emmc_defconfig @@ -87,4 +87,6 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x4000 CONFIG_CI_UDC=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/colibri_vf_defconfig b/configs/colibri_vf_defconfig index a67e2e29bad..b145b9f6992 100644 --- a/configs/colibri_vf_defconfig +++ b/configs/colibri_vf_defconfig @@ -96,6 +96,7 @@ CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP8 is not set # CONFIG_VIDEO_BPP16 is not set CONFIG_VIDEO_FSL_DCU_FB=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_FDT_FIXUP_PARTITIONS=y # CONFIG_EFI_UNICODE_CAPITALIZATION is not set diff --git a/configs/dms-ba16-1g_defconfig b/configs/dms-ba16-1g_defconfig index 8dcbf527b2d..ca538e09df9 100644 --- a/configs/dms-ba16-1g_defconfig +++ b/configs/dms-ba16-1g_defconfig @@ -60,4 +60,6 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT=y diff --git a/configs/dms-ba16_defconfig b/configs/dms-ba16_defconfig index f26f66837fe..50d6db02ebd 100644 --- a/configs/dms-ba16_defconfig +++ b/configs/dms-ba16_defconfig @@ -59,4 +59,6 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT=y diff --git a/configs/eb_cpu5282_defconfig b/configs/eb_cpu5282_defconfig index 65bc7a0eb6a..339366b2bd5 100644 --- a/configs/eb_cpu5282_defconfig +++ b/configs/eb_cpu5282_defconfig @@ -34,3 +34,4 @@ CONFIG_MCFFEC=y CONFIG_MII=y CONFIG_VIDEO=y # CONFIG_CFB_CONSOLE is not set +CONFIG_SPLASH_SCREEN=y diff --git a/configs/eb_cpu5282_internal_defconfig b/configs/eb_cpu5282_internal_defconfig index 4a17ad79540..3c474b48fed 100644 --- a/configs/eb_cpu5282_internal_defconfig +++ b/configs/eb_cpu5282_internal_defconfig @@ -33,3 +33,4 @@ CONFIG_MCFFEC=y CONFIG_MII=y CONFIG_VIDEO=y # CONFIG_CFB_CONSOLE is not set +CONFIG_SPLASH_SCREEN=y diff --git a/configs/imx6dl_icore_nand_defconfig b/configs/imx6dl_icore_nand_defconfig index 9fde251387d..15775c1e083 100644 --- a/configs/imx6dl_icore_nand_defconfig +++ b/configs/imx6dl_icore_nand_defconfig @@ -63,3 +63,5 @@ CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP32 is not set CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/imx6q_icore_nand_defconfig b/configs/imx6q_icore_nand_defconfig index 9fe5c8f058c..47a84515f07 100644 --- a/configs/imx6q_icore_nand_defconfig +++ b/configs/imx6q_icore_nand_defconfig @@ -64,3 +64,5 @@ CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP32 is not set CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/imx6qdl_icore_mmc_defconfig b/configs/imx6qdl_icore_mmc_defconfig index 4f236399e1b..ea9a48c83c9 100644 --- a/configs/imx6qdl_icore_mmc_defconfig +++ b/configs/imx6qdl_icore_mmc_defconfig @@ -80,4 +80,6 @@ CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP32 is not set CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_IMX_WATCHDOG=y diff --git a/configs/imx6qdl_icore_nand_defconfig b/configs/imx6qdl_icore_nand_defconfig index 9fe5c8f058c..47a84515f07 100644 --- a/configs/imx6qdl_icore_nand_defconfig +++ b/configs/imx6qdl_icore_nand_defconfig @@ -64,3 +64,5 @@ CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP32 is not set CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/imxrt1050-evk_defconfig b/configs/imxrt1050-evk_defconfig index 0139e73fa82..3f7b6704597 100644 --- a/configs/imxrt1050-evk_defconfig +++ b/configs/imxrt1050-evk_defconfig @@ -68,6 +68,8 @@ CONFIG_SPL_TIMER=y CONFIG_DM_VIDEO=y CONFIG_BACKLIGHT_GPIO=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_SHA1=y CONFIG_SHA256=y CONFIG_HEXDUMP=y diff --git a/configs/khadas-vim3_defconfig b/configs/khadas-vim3_defconfig index 53a703403bd..a39e0f9c9f5 100644 --- a/configs/khadas-vim3_defconfig +++ b/configs/khadas-vim3_defconfig @@ -71,4 +71,6 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_MESON=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/khadas-vim3l_defconfig b/configs/khadas-vim3l_defconfig index 45b52e4ee11..57cc383b9d2 100644 --- a/configs/khadas-vim3l_defconfig +++ b/configs/khadas-vim3l_defconfig @@ -71,4 +71,6 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_MESON=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/libretech-ac_defconfig b/configs/libretech-ac_defconfig index 38034883e8a..d5a812c3d81 100644 --- a/configs/libretech-ac_defconfig +++ b/configs/libretech-ac_defconfig @@ -80,4 +80,6 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_MESON=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/libretech-cc_defconfig b/configs/libretech-cc_defconfig index 7e388ae57b2..dce861b8aa1 100644 --- a/configs/libretech-cc_defconfig +++ b/configs/libretech-cc_defconfig @@ -63,4 +63,6 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_MESON=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/libretech-s905d-pc_defconfig b/configs/libretech-s905d-pc_defconfig index b2b9a48b412..225a21f0ff4 100644 --- a/configs/libretech-s905d-pc_defconfig +++ b/configs/libretech-s905d-pc_defconfig @@ -73,4 +73,6 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_MESON=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/libretech-s912-pc_defconfig b/configs/libretech-s912-pc_defconfig index a156610ea3e..005dc0b25e9 100644 --- a/configs/libretech-s912-pc_defconfig +++ b/configs/libretech-s912-pc_defconfig @@ -72,4 +72,6 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_MESON=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/m53menlo_defconfig b/configs/m53menlo_defconfig index 43d369c525e..db3a739af13 100644 --- a/configs/m53menlo_defconfig +++ b/configs/m53menlo_defconfig @@ -100,5 +100,9 @@ CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP32 is not set CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASHIMAGE_GUARD=y +CONFIG_SPLASH_SCREEN_ALIGN=y +CONFIG_SPLASH_SOURCE=y CONFIG_WATCHDOG_TIMEOUT_MSECS=8000 CONFIG_IMX_WATCHDOG=y diff --git a/configs/marsboard_defconfig b/configs/marsboard_defconfig index 0d2b9b3cf75..241f2ea125a 100644 --- a/configs/marsboard_defconfig +++ b/configs/marsboard_defconfig @@ -49,4 +49,6 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y # CONFIG_PANEL is not set CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT=y diff --git a/configs/mx23evk_defconfig b/configs/mx23evk_defconfig index 227c6272641..51f4a0fb737 100644 --- a/configs/mx23evk_defconfig +++ b/configs/mx23evk_defconfig @@ -38,4 +38,5 @@ CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_VIDEO=y +CONFIG_SPLASH_SCREEN=y CONFIG_OF_LIBFDT=y diff --git a/configs/mx28evk_auart_console_defconfig b/configs/mx28evk_auart_console_defconfig index 289342fe2f7..6e0a2377518 100644 --- a/configs/mx28evk_auart_console_defconfig +++ b/configs/mx28evk_auart_console_defconfig @@ -57,4 +57,5 @@ CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_ETHER_SMSC95XX=y CONFIG_VIDEO=y +CONFIG_SPLASH_SCREEN=y CONFIG_OF_LIBFDT=y diff --git a/configs/mx28evk_defconfig b/configs/mx28evk_defconfig index bf2442ed817..abfdb26b2df 100644 --- a/configs/mx28evk_defconfig +++ b/configs/mx28evk_defconfig @@ -57,4 +57,5 @@ CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_ETHER_SMSC95XX=y CONFIG_VIDEO=y +CONFIG_SPLASH_SCREEN=y CONFIG_OF_LIBFDT=y diff --git a/configs/mx28evk_nand_defconfig b/configs/mx28evk_nand_defconfig index 7b7822e5151..8aecb8bd445 100644 --- a/configs/mx28evk_nand_defconfig +++ b/configs/mx28evk_nand_defconfig @@ -58,4 +58,5 @@ CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_ETHER_SMSC95XX=y CONFIG_VIDEO=y +CONFIG_SPLASH_SCREEN=y CONFIG_OF_LIBFDT=y diff --git a/configs/mx28evk_spi_defconfig b/configs/mx28evk_spi_defconfig index 5692baa23cd..c4cba183bf7 100644 --- a/configs/mx28evk_spi_defconfig +++ b/configs/mx28evk_spi_defconfig @@ -54,4 +54,5 @@ CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_ETHER_SMSC95XX=y CONFIG_VIDEO=y +CONFIG_SPLASH_SCREEN=y CONFIG_OF_LIBFDT=y diff --git a/configs/mx51evk_defconfig b/configs/mx51evk_defconfig index f626aca910e..343816f89f3 100644 --- a/configs/mx51evk_defconfig +++ b/configs/mx51evk_defconfig @@ -38,4 +38,5 @@ CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_ETHER_SMSC95XX=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y CONFIG_OF_LIBFDT=y diff --git a/configs/mx53loco_defconfig b/configs/mx53loco_defconfig index 2b17bbc3edc..0d366c29fb2 100644 --- a/configs/mx53loco_defconfig +++ b/configs/mx53loco_defconfig @@ -39,4 +39,5 @@ CONFIG_USB_ETHER_ASIX=y CONFIG_USB_ETHER_MCS7830=y CONFIG_USB_ETHER_SMSC95XX=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y CONFIG_OF_LIBFDT=y diff --git a/configs/mx6cuboxi_defconfig b/configs/mx6cuboxi_defconfig index dcc28c576e2..c0800cb0e04 100644 --- a/configs/mx6cuboxi_defconfig +++ b/configs/mx6cuboxi_defconfig @@ -77,3 +77,5 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y # CONFIG_PANEL is not set CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/mx6qsabrelite_defconfig b/configs/mx6qsabrelite_defconfig index 3e874593a7f..cf82f8d04b4 100644 --- a/configs/mx6qsabrelite_defconfig +++ b/configs/mx6qsabrelite_defconfig @@ -79,3 +79,5 @@ CONFIG_USB_ETH_CDC=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/mx6sabreauto_defconfig b/configs/mx6sabreauto_defconfig index 0065a3417d5..386cc54f201 100644 --- a/configs/mx6sabreauto_defconfig +++ b/configs/mx6sabreauto_defconfig @@ -104,3 +104,5 @@ CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP32 is not set CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig index 69e11422053..0cae3e01361 100644 --- a/configs/mx6sabresd_defconfig +++ b/configs/mx6sabresd_defconfig @@ -113,3 +113,5 @@ CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP32 is not set CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/mx6sxsabresd_defconfig b/configs/mx6sxsabresd_defconfig index ee498fdbbf6..f02b0ca5188 100644 --- a/configs/mx6sxsabresd_defconfig +++ b/configs/mx6sxsabresd_defconfig @@ -73,3 +73,5 @@ CONFIG_USB_STORAGE=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_VIDEO=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/mx6ul_14x14_evk_defconfig b/configs/mx6ul_14x14_evk_defconfig index c60e69d445d..412995e99e9 100644 --- a/configs/mx6ul_14x14_evk_defconfig +++ b/configs/mx6ul_14x14_evk_defconfig @@ -89,3 +89,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/mx6ul_9x9_evk_defconfig b/configs/mx6ul_9x9_evk_defconfig index 025165787ba..587b71f32b2 100644 --- a/configs/mx6ul_9x9_evk_defconfig +++ b/configs/mx6ul_9x9_evk_defconfig @@ -79,3 +79,5 @@ CONFIG_DM_USB=y CONFIG_USB_STORAGE=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/mx7dsabresd_defconfig b/configs/mx7dsabresd_defconfig index 03f311000eb..e4655c222fe 100644 --- a/configs/mx7dsabresd_defconfig +++ b/configs/mx7dsabresd_defconfig @@ -85,4 +85,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_VIDEO=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_ERRNO_STR=y diff --git a/configs/mx7dsabresd_qspi_defconfig b/configs/mx7dsabresd_qspi_defconfig index ae90ef5221f..56a8b6bf444 100644 --- a/configs/mx7dsabresd_qspi_defconfig +++ b/configs/mx7dsabresd_qspi_defconfig @@ -92,4 +92,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_VIDEO=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_ERRNO_STR=y diff --git a/configs/nitrogen6dl2g_defconfig b/configs/nitrogen6dl2g_defconfig index 1c1016a4173..a61786272d6 100644 --- a/configs/nitrogen6dl2g_defconfig +++ b/configs/nitrogen6dl2g_defconfig @@ -80,3 +80,5 @@ CONFIG_USB_ETH_CDC=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/nitrogen6dl_defconfig b/configs/nitrogen6dl_defconfig index 310d42eb487..44e08615a3c 100644 --- a/configs/nitrogen6dl_defconfig +++ b/configs/nitrogen6dl_defconfig @@ -80,3 +80,5 @@ CONFIG_USB_ETH_CDC=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/nitrogen6q2g_defconfig b/configs/nitrogen6q2g_defconfig index 545548eb693..8e3b5563d08 100644 --- a/configs/nitrogen6q2g_defconfig +++ b/configs/nitrogen6q2g_defconfig @@ -82,3 +82,5 @@ CONFIG_USB_ETH_CDC=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/nitrogen6q_defconfig b/configs/nitrogen6q_defconfig index 0846b40e932..637b2bbda5d 100644 --- a/configs/nitrogen6q_defconfig +++ b/configs/nitrogen6q_defconfig @@ -82,3 +82,5 @@ CONFIG_USB_ETH_CDC=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/nitrogen6s1g_defconfig b/configs/nitrogen6s1g_defconfig index 05ba13a9a2e..e8058f53f95 100644 --- a/configs/nitrogen6s1g_defconfig +++ b/configs/nitrogen6s1g_defconfig @@ -80,3 +80,5 @@ CONFIG_USB_ETH_CDC=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/nitrogen6s_defconfig b/configs/nitrogen6s_defconfig index b28cd640bee..fef66550b83 100644 --- a/configs/nitrogen6s_defconfig +++ b/configs/nitrogen6s_defconfig @@ -80,3 +80,5 @@ CONFIG_USB_ETH_CDC=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/nokia_rx51_defconfig b/configs/nokia_rx51_defconfig index 3a1b1dae72e..098009e6103 100644 --- a/configs/nokia_rx51_defconfig +++ b/configs/nokia_rx51_defconfig @@ -57,4 +57,5 @@ CONFIG_TWL4030_USB=y CONFIG_VIDEO=y CONFIG_CFB_CONSOLE_ANSI=y # CONFIG_VGA_AS_SINGLE_DEVICE is not set +CONFIG_SPLASH_SCREEN=y # CONFIG_GZIP is not set diff --git a/configs/novena_defconfig b/configs/novena_defconfig index 20c3aa1af9b..15382638a9a 100644 --- a/configs/novena_defconfig +++ b/configs/novena_defconfig @@ -78,3 +78,4 @@ CONFIG_USB_ETHER_SMSC95XX=y # CONFIG_VIDEO_BPP32 is not set CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y diff --git a/configs/odroid-c2_defconfig b/configs/odroid-c2_defconfig index 49a5f0855f1..3c53233dcce 100644 --- a/configs/odroid-c2_defconfig +++ b/configs/odroid-c2_defconfig @@ -56,5 +56,7 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_MESON=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SMBIOS_MANUFACTURER="Hardkernel Co., Ltd." diff --git a/configs/odroid-c4_defconfig b/configs/odroid-c4_defconfig index 4d112d34901..bf79d7424a9 100644 --- a/configs/odroid-c4_defconfig +++ b/configs/odroid-c4_defconfig @@ -58,4 +58,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_DM_VIDEO=y CONFIG_VIDEO_MESON=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/opos6uldev_defconfig b/configs/opos6uldev_defconfig index ba85932b4dd..2a2e65b447a 100644 --- a/configs/opos6uldev_defconfig +++ b/configs/opos6uldev_defconfig @@ -105,5 +105,8 @@ CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP8 is not set # CONFIG_VIDEO_BPP32 is not set CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y +CONFIG_SPLASH_SOURCE=y CONFIG_OF_LIBFDT_OVERLAY=y # CONFIG_EFI_LOADER is not set diff --git a/configs/pico-dwarf-imx6ul_defconfig b/configs/pico-dwarf-imx6ul_defconfig index 4f01ae00990..ac2edc097f4 100644 --- a/configs/pico-dwarf-imx6ul_defconfig +++ b/configs/pico-dwarf-imx6ul_defconfig @@ -69,3 +69,5 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_VIDEO=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/pico-dwarf-imx7d_defconfig b/configs/pico-dwarf-imx7d_defconfig index ff4a409077d..6d1d68e3e54 100644 --- a/configs/pico-dwarf-imx7d_defconfig +++ b/configs/pico-dwarf-imx7d_defconfig @@ -78,3 +78,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/pico-hobbit-imx6ul_defconfig b/configs/pico-hobbit-imx6ul_defconfig index f8aaf9b6fa8..195a83c9098 100644 --- a/configs/pico-hobbit-imx6ul_defconfig +++ b/configs/pico-hobbit-imx6ul_defconfig @@ -72,3 +72,5 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_VIDEO=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/pico-hobbit-imx7d_defconfig b/configs/pico-hobbit-imx7d_defconfig index d522d23b979..db30fd504df 100644 --- a/configs/pico-hobbit-imx7d_defconfig +++ b/configs/pico-hobbit-imx7d_defconfig @@ -78,3 +78,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/pico-imx6_defconfig b/configs/pico-imx6_defconfig index 23165443986..33adef86078 100644 --- a/configs/pico-imx6_defconfig +++ b/configs/pico-imx6_defconfig @@ -88,3 +88,5 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y # CONFIG_PANEL is not set CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index 5c841c3e4b0..da51e378eb4 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -74,3 +74,5 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_VIDEO=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/pico-imx7d_bl33_defconfig b/configs/pico-imx7d_bl33_defconfig index 7be0a0af9d6..e9194f82e9b 100644 --- a/configs/pico-imx7d_bl33_defconfig +++ b/configs/pico-imx7d_bl33_defconfig @@ -74,4 +74,6 @@ CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/pico-imx7d_defconfig b/configs/pico-imx7d_defconfig index e4acb0be57e..a9a1a01ec62 100644 --- a/configs/pico-imx7d_defconfig +++ b/configs/pico-imx7d_defconfig @@ -78,3 +78,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/pico-nymph-imx7d_defconfig b/configs/pico-nymph-imx7d_defconfig index ff4a409077d..6d1d68e3e54 100644 --- a/configs/pico-nymph-imx7d_defconfig +++ b/configs/pico-nymph-imx7d_defconfig @@ -78,3 +78,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/pico-pi-imx6ul_defconfig b/configs/pico-pi-imx6ul_defconfig index 1d1b8d5bf71..be2b709a4d5 100644 --- a/configs/pico-pi-imx6ul_defconfig +++ b/configs/pico-pi-imx6ul_defconfig @@ -72,3 +72,5 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_VIDEO=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/pico-pi-imx7d_defconfig b/configs/pico-pi-imx7d_defconfig index 34a100da9bc..3768314bd95 100644 --- a/configs/pico-pi-imx7d_defconfig +++ b/configs/pico-pi-imx7d_defconfig @@ -78,3 +78,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/pxm2_defconfig b/configs/pxm2_defconfig index e65905548b1..d66a2114d58 100644 --- a/configs/pxm2_defconfig +++ b/configs/pxm2_defconfig @@ -104,3 +104,5 @@ CONFIG_VIDEO=y # CONFIG_VIDEO_SW_CURSOR is not set CONFIG_SYS_CONSOLE_BG_COL=0xff CONFIG_SYS_CONSOLE_FG_COL=0x00 +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/riotboard_defconfig b/configs/riotboard_defconfig index e9d0933616d..4b4120c6765 100644 --- a/configs/riotboard_defconfig +++ b/configs/riotboard_defconfig @@ -50,4 +50,6 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y # CONFIG_PANEL is not set CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT=y diff --git a/configs/riotboard_spl_defconfig b/configs/riotboard_spl_defconfig index 08150ed1c1b..29629f06bbb 100644 --- a/configs/riotboard_spl_defconfig +++ b/configs/riotboard_spl_defconfig @@ -60,5 +60,7 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y # CONFIG_PANEL is not set CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT=y CONFIG_SPL_OF_LIBFDT=y diff --git a/configs/rut_defconfig b/configs/rut_defconfig index c8527cacaaf..1eefb89760c 100644 --- a/configs/rut_defconfig +++ b/configs/rut_defconfig @@ -104,3 +104,5 @@ CONFIG_VIDEO=y # CONFIG_VIDEO_SW_CURSOR is not set CONFIG_SYS_CONSOLE_BG_COL=0xff CONFIG_SYS_CONSOLE_FG_COL=0x00 +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/configs/s5p4418_nanopi2_defconfig b/configs/s5p4418_nanopi2_defconfig index 96a5c668372..3b2169195cf 100644 --- a/configs/s5p4418_nanopi2_defconfig +++ b/configs/s5p4418_nanopi2_defconfig @@ -52,4 +52,7 @@ CONFIG_VIDEO_NX=y CONFIG_VIDEO_NX_RGB=y CONFIG_VIDEO_NX_LVDS=y CONFIG_VIDEO_NX_HDMI=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y +CONFIG_SPLASH_SOURCE=y CONFIG_ERRNO_STR=y diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index fae36664189..c3ca796d511 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -214,6 +214,7 @@ CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y CONFIG_VIDEO_SANDBOX_SDL=y CONFIG_OSD=y CONFIG_SANDBOX_OSD=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_WDT=y CONFIG_WDT_SANDBOX=y CONFIG_FS_CBFS=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index acd70933359..41de434d1ab 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -247,6 +247,7 @@ CONFIG_VIDEO_SANDBOX_SDL=y CONFIG_VIDEO_DSI_HOST_SANDBOX=y CONFIG_OSD=y CONFIG_SANDBOX_OSD=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_W1=y CONFIG_W1_GPIO=y CONFIG_W1_EEPROM=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index 5ce74ed1cf9..6d8e827aebc 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -210,6 +210,7 @@ CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y CONFIG_VIDEO_SANDBOX_SDL=y CONFIG_OSD=y CONFIG_SANDBOX_OSD=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_FS_CBFS=y CONFIG_FS_CRAMFS=y # CONFIG_SPL_USE_TINY_PRINTF is not set diff --git a/configs/sei510_defconfig b/configs/sei510_defconfig index 40631d29681..8ee3a138e1d 100644 --- a/configs/sei510_defconfig +++ b/configs/sei510_defconfig @@ -78,4 +78,6 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_MESON=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/sei610_defconfig b/configs/sei610_defconfig index 39d36b1be19..43932b4c960 100644 --- a/configs/sei610_defconfig +++ b/configs/sei610_defconfig @@ -78,4 +78,6 @@ CONFIG_DM_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_MESON=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/stm32f746-disco_defconfig b/configs/stm32f746-disco_defconfig index 8a54d827aca..4b2b8587f82 100644 --- a/configs/stm32f746-disco_defconfig +++ b/configs/stm32f746-disco_defconfig @@ -60,4 +60,6 @@ CONFIG_BACKLIGHT_GPIO=y CONFIG_VIDEO_STM32=y CONFIG_VIDEO_STM32_MAX_XRES=480 CONFIG_VIDEO_STM32_MAX_YRES=640 +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/stm32f769-disco_defconfig b/configs/stm32f769-disco_defconfig index 8dd83af20bd..bed5a773e10 100644 --- a/configs/stm32f769-disco_defconfig +++ b/configs/stm32f769-disco_defconfig @@ -62,4 +62,6 @@ CONFIG_VIDEO_STM32=y CONFIG_VIDEO_STM32_DSI=y CONFIG_VIDEO_STM32_MAX_XRES=480 CONFIG_VIDEO_STM32_MAX_YRES=800 +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/wandboard_defconfig b/configs/wandboard_defconfig index 5ff1b15fb39..672a9c4a1a2 100644 --- a/configs/wandboard_defconfig +++ b/configs/wandboard_defconfig @@ -78,3 +78,5 @@ CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP32 is not set CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_IPUV3=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 55f4fa42abf..e2e1f9c476b 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -854,4 +854,89 @@ config IHS_VIDEO_OUT out On-screen Display (OSD) used on gdsys FPGAs to control dynamic textual overlays of the display outputs. +config SPLASH_SCREEN + bool "Show a splash-screen image" + help + If this option is set, the environment is checked for a variable + "splashimage". If found, the usual display of logo, copyright and + system information on the LCD is suppressed and the BMP image at the + address specified in "splashimage" is loaded instead. The console is + redirected to the "nulldev", too. This allows for a "silent" boot + where a splash screen is loaded very quickly after power-on. + + The splash_screen_prepare() function is a weak function defined in + common/splash.c. It is called as part of the splash screen display + sequence. It gives the board an opportunity to prepare the splash + image data before it is processed and sent to the frame buffer by + U-Boot. Define your own version to use this feature. + +config SPLASHIMAGE_GUARD + bool "Support unaligned BMP images" + depends on SPLASH_SCREEN + help + If this option is set, then U-Boot will prevent the environment + variable "splashimage" from being set to a problematic address + (see doc/README.displaying-bmps). + + This option is useful for targets where, due to alignment + restrictions, an improperly aligned BMP image will cause a data + abort. If you think you will not have problems with unaligned + accesses (for example because your toolchain prevents them) + there is no need to set this option. + +config SPLASH_SCREEN_ALIGN + bool "Allow positioning the splash image anywhere on the display" + depends on SPLASH_SCREEN || CMD_BMP + help + If this option is set the splash image can be freely positioned + on the screen. Environment variable "splashpos" specifies the + position as "x,y". If a positive number is given it is used as + number of pixel from left/top. If a negative number is given it + is used as number of pixel from right/bottom. You can also + specify 'm' for centering the image. + + Example: + setenv splashpos m,m + => image at center of screen + + setenv splashpos 30,20 + => image at x = 30 and y = 20 + + setenv splashpos -10,m + => vertically centered image + at x = dspWidth - bmpWidth - 9 + +config SPLASH_SOURCE + bool "Control the source of the splash image" + depends on SPLASH_SCREEN + help + Use the splash_source.c library. This library provides facilities to + declare board specific splash image locations, routines for loading + splash image from supported locations, and a way of controlling the + selected splash location using the "splashsource" environment + variable. + + This CONFIG works as follows: + + - If splashsource is set to a supported location name as defined by + board code, use that splash location. + - If splashsource is undefined, use the first splash location as + default. + - If splashsource is set to an unsupported value, do not load a splash + screen. + + A splash source location can describe either storage with raw data, a + storage formatted with a file system or a FIT image. In case of a + filesystem, the splash screen data is loaded as a file. The name of + the splash screen file can be controlled with the environment variable + "splashfile". + + To enable loading the splash image from a FIT image, CONFIG_FIT must + be enabled. The FIT image has to start at the 'offset' field address + in the selected splash location. The name of splash image within the + FIT shall be specified by the environment variable "splashfile". + + In case the environment variable "splashfile" is not defined the + default name 'splash.bmp' will be used. + endmenu diff --git a/include/configs/M52277EVB.h b/include/configs/M52277EVB.h index 8a52f809c7c..0428be729b2 100644 --- a/include/configs/M52277EVB.h +++ b/include/configs/M52277EVB.h @@ -74,7 +74,6 @@ /* LCD */ #ifdef CONFIG_CMD_BMP -#define CONFIG_SPLASH_SCREEN #define CONFIG_LCD_LOGO #define CONFIG_SHARP_LQ035Q7DH06 #endif diff --git a/include/configs/advantech_dms-ba16.h b/include/configs/advantech_dms-ba16.h index 181af9a3f6d..07d804cbcbf 100644 --- a/include/configs/advantech_dms-ba16.h +++ b/include/configs/advantech_dms-ba16.h @@ -198,8 +198,6 @@ /* Framebuffer */ #define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_LOGO #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h index f3156b02c9c..9bc70f979ab 100644 --- a/include/configs/apalis_imx6.h +++ b/include/configs/apalis_imx6.h @@ -68,8 +68,6 @@ /* Framebuffer and LCD */ #define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE #define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_LOGO #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/aristainetos2.h b/include/configs/aristainetos2.h index 2674cb8b76b..fd28f44ae31 100644 --- a/include/configs/aristainetos2.h +++ b/include/configs/aristainetos2.h @@ -438,8 +438,6 @@ /* Framebuffer */ /* check this console not needed, after test remove it */ -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_IMX_VIDEO_SKIP #define CONFIG_VIDEO_LOGO #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/cgtqmx6eval.h b/include/configs/cgtqmx6eval.h index d2a0f95c0f8..9d0f516b7dc 100644 --- a/include/configs/cgtqmx6eval.h +++ b/include/configs/cgtqmx6eval.h @@ -61,8 +61,6 @@ /* Framebuffer */ #define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_LOGO #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h index 7d0f551e4ff..6915dcb6615 100644 --- a/include/configs/cm_fx6.h +++ b/include/configs/cm_fx6.h @@ -204,8 +204,6 @@ /* Display */ #define CONFIG_IMX_HDMI -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SOURCE #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_LOGO diff --git a/include/configs/colibri-imx6ull.h b/include/configs/colibri-imx6ull.h index c80fb96fe2c..2fdcdefa32d 100644 --- a/include/configs/colibri-imx6ull.h +++ b/include/configs/colibri-imx6ull.h @@ -153,8 +153,6 @@ #define CONFIG_VIDEO_MXS #define MXS_LCDIF_BASE MX6UL_LCDIF1_BASE_ADDR #define CONFIG_VIDEO_LOGO -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h index 7091766fef2..13b03a594e7 100644 --- a/include/configs/colibri_imx6.h +++ b/include/configs/colibri_imx6.h @@ -56,8 +56,6 @@ /* Framebuffer and LCD */ #define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE #define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_LOGO #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h index 8fff2e15b78..79aa735ccba 100644 --- a/include/configs/colibri_imx7.h +++ b/include/configs/colibri_imx7.h @@ -216,8 +216,6 @@ #if defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO) #define CONFIG_VIDEO_MXS #define CONFIG_VIDEO_LOGO -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/colibri_vf.h b/include/configs/colibri_vf.h index 87c37ea0a5f..86d4621f857 100644 --- a/include/configs/colibri_vf.h +++ b/include/configs/colibri_vf.h @@ -19,7 +19,6 @@ #define CONFIG_SKIP_LOWLEVEL_INIT #ifdef CONFIG_VIDEO_FSL_DCU_FB -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_VIDEO_LOGO #define CONFIG_VIDEO_BMP_LOGO #define CONFIG_SYS_FSL_DCU_LE diff --git a/include/configs/eb_cpu5282.h b/include/configs/eb_cpu5282.h index 3dab93418a2..db92bbd49a4 100644 --- a/include/configs/eb_cpu5282.h +++ b/include/configs/eb_cpu5282.h @@ -27,7 +27,6 @@ #define CONFIG_BOOT_RETRY_TIME -1 #define CONFIG_RESET_TO_RETRY -#define CONFIG_SPLASH_SCREEN #define CONFIG_HW_WATCHDOG diff --git a/include/configs/embestmx6boards.h b/include/configs/embestmx6boards.h index 8148453d931..ef4ea9a29bf 100644 --- a/include/configs/embestmx6boards.h +++ b/include/configs/embestmx6boards.h @@ -73,8 +73,6 @@ /* Framebuffer */ #define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_LOGO #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h index 76883601073..a92157d52cb 100644 --- a/include/configs/gw_ventana.h +++ b/include/configs/gw_ventana.h @@ -121,7 +121,6 @@ #define CONFIG_IMX_HDMI #define CONFIG_IMX_VIDEO_SKIP #define CONFIG_VIDEO_BMP_LOGO -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_HIDE_LOGO_VERSION /* Custom config to hide U-boot version */ /* Miscellaneous configurable options */ diff --git a/include/configs/imx6-engicam.h b/include/configs/imx6-engicam.h index 9bd81e28d67..13cd54a8dc1 100644 --- a/include/configs/imx6-engicam.h +++ b/include/configs/imx6-engicam.h @@ -165,8 +165,6 @@ #ifdef CONFIG_VIDEO_IPUV3 # define CONFIG_IMX_VIDEO_SKIP -# define CONFIG_SPLASH_SCREEN -# define CONFIG_SPLASH_SCREEN_ALIGN # define CONFIG_BMP_16BPP # define CONFIG_VIDEO_BMP_RLE8 # define CONFIG_VIDEO_LOGO diff --git a/include/configs/imxrt1050-evk.h b/include/configs/imxrt1050-evk.h index 4fbcda9581c..559e6880b7d 100644 --- a/include/configs/imxrt1050-evk.h +++ b/include/configs/imxrt1050-evk.h @@ -31,8 +31,6 @@ #ifdef CONFIG_DM_VIDEO #define CONFIG_VIDEO_MXS #define CONFIG_VIDEO_LOGO -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/m53menlo.h b/include/configs/m53menlo.h index 5542ea60174..c15e7d22bc8 100644 --- a/include/configs/m53menlo.h +++ b/include/configs/m53menlo.h @@ -128,9 +128,6 @@ */ #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_GZIP -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASHIMAGE_GUARD -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_LOGO #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (2 << 20) @@ -138,7 +135,6 @@ /* LVDS display */ #define CONFIG_SYS_LDB_CLOCK 33260000 #define CONFIG_IMX_VIDEO_SKIP -#define CONFIG_SPLASH_SOURCE /* IIM Fuses */ #define CONFIG_FSL_IIM diff --git a/include/configs/meson64.h b/include/configs/meson64.h index 50707a31978..c895a24eca3 100644 --- a/include/configs/meson64.h +++ b/include/configs/meson64.h @@ -22,8 +22,6 @@ #define CONFIG_BMP_16BPP #define CONFIG_BMP_24BPP #define CONFIG_BMP_32BPP -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define STDOUT_CFG "vidconsole,serial" #else #define STDOUT_CFG "serial" diff --git a/include/configs/mx23evk.h b/include/configs/mx23evk.h index cc634d00422..8f170b25297 100644 --- a/include/configs/mx23evk.h +++ b/include/configs/mx23evk.h @@ -31,7 +31,6 @@ /* Framebuffer support */ #ifdef CONFIG_VIDEO #define CONFIG_VIDEO_LOGO -#define CONFIG_SPLASH_SCREEN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_GZIP diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h index 1a9e6a457af..d65f6a900f9 100644 --- a/include/configs/mx28evk.h +++ b/include/configs/mx28evk.h @@ -52,7 +52,6 @@ /* Framebuffer support */ #ifdef CONFIG_VIDEO #define CONFIG_VIDEO_LOGO -#define CONFIG_SPLASH_SCREEN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_GZIP diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h index bf4661b4539..58712926b4d 100644 --- a/include/configs/mx51evk.h +++ b/include/configs/mx51evk.h @@ -66,7 +66,6 @@ /* Framebuffer and LCD */ #define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_LOGO diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h index 97adcd5265b..90d800cd254 100644 --- a/include/configs/mx53loco.h +++ b/include/configs/mx53loco.h @@ -177,7 +177,6 @@ /* Framebuffer and LCD */ #define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_LOGO diff --git a/include/configs/mx6cuboxi.h b/include/configs/mx6cuboxi.h index b03129bfc6a..20b757e621b 100644 --- a/include/configs/mx6cuboxi.h +++ b/include/configs/mx6cuboxi.h @@ -30,8 +30,6 @@ /* Framebuffer */ #define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_LOGO #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/mx6sabre_common.h b/include/configs/mx6sabre_common.h index 94a7e0587d5..ecf4681c1f7 100644 --- a/include/configs/mx6sabre_common.h +++ b/include/configs/mx6sabre_common.h @@ -170,8 +170,6 @@ /* Framebuffer */ #define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_LOGO #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h index 4a521ec80d9..441ea3d4df5 100644 --- a/include/configs/mx6sxsabresd.h +++ b/include/configs/mx6sxsabresd.h @@ -176,8 +176,6 @@ #ifdef CONFIG_VIDEO #define CONFIG_VIDEO_MXS #define CONFIG_VIDEO_LOGO -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/mx6ul_14x14_evk.h b/include/configs/mx6ul_14x14_evk.h index 6f1e0d878da..68e1db52c73 100644 --- a/include/configs/mx6ul_14x14_evk.h +++ b/include/configs/mx6ul_14x14_evk.h @@ -183,8 +183,6 @@ #if defined(CONFIG_DM_VIDEO) #define CONFIG_VIDEO_MXS #define CONFIG_VIDEO_LOGO -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/mx7dsabresd.h b/include/configs/mx7dsabresd.h index 98fab6b83de..16b8c07f324 100644 --- a/include/configs/mx7dsabresd.h +++ b/include/configs/mx7dsabresd.h @@ -141,8 +141,6 @@ #ifdef CONFIG_VIDEO #define CONFIG_VIDEO_MXS #define CONFIG_VIDEO_LOGO -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h index fdcf43f44d1..f1780b2391a 100644 --- a/include/configs/nitrogen6x.h +++ b/include/configs/nitrogen6x.h @@ -57,8 +57,6 @@ /* Framebuffer and LCD */ #define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_VIDEO_BMP_GZIP #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (6 * 1024 * 1024) #define CONFIG_BMP_16BPP diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h index cc55777ec05..c86c4294137 100644 --- a/include/configs/nokia_rx51.h +++ b/include/configs/nokia_rx51.h @@ -101,7 +101,6 @@ #define CONFIG_VIDEO_LOGO #define VIDEO_FB_16BPP_PIXEL_SWAP #define VIDEO_FB_16BPP_WORD_SWAP -#define CONFIG_SPLASH_SCREEN /* functions for cfb_console */ #define VIDEO_KBD_INIT_FCT rx51_kp_init() diff --git a/include/configs/novena.h b/include/configs/novena.h index 8aabf06fa2a..b648c7bc868 100644 --- a/include/configs/novena.h +++ b/include/configs/novena.h @@ -102,7 +102,6 @@ /* Video output */ #define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_LOGO #define CONFIG_IMX_HDMI diff --git a/include/configs/opos6uldev.h b/include/configs/opos6uldev.h index 69f5e9f96ab..8dfd5bede3c 100644 --- a/include/configs/opos6uldev.h +++ b/include/configs/opos6uldev.h @@ -45,9 +45,6 @@ #ifndef CONFIG_SPL_BUILD #ifdef CONFIG_DM_VIDEO #define CONFIG_VIDEO_LOGO -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN -#define CONFIG_SPLASH_SOURCE #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_LOGO #define CONFIG_BMP_16BPP diff --git a/include/configs/pico-imx6.h b/include/configs/pico-imx6.h index 7403c544a49..289c1cac669 100644 --- a/include/configs/pico-imx6.h +++ b/include/configs/pico-imx6.h @@ -144,8 +144,6 @@ /* Framebuffer */ #define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_LOGO #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index d712b638b4c..5211970a83c 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -147,8 +147,6 @@ #ifdef CONFIG_VIDEO #define CONFIG_VIDEO_MXS #define CONFIG_VIDEO_LOGO -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index f1b2ad4480c..12417dfeded 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -143,8 +143,6 @@ #ifdef CONFIG_DM_VIDEO #define CONFIG_VIDEO_MXS #define CONFIG_VIDEO_LOGO -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/pxm2.h b/include/configs/pxm2.h index ab9c116034f..588eb282a17 100644 --- a/include/configs/pxm2.h +++ b/include/configs/pxm2.h @@ -114,8 +114,6 @@ #if defined(CONFIG_VIDEO) #define CONFIG_VIDEO_DA8XX -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_VIDEO_LOGO #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/rut.h b/include/configs/rut.h index 0dcdb101a04..7e1e8f428eb 100644 --- a/include/configs/rut.h +++ b/include/configs/rut.h @@ -107,8 +107,6 @@ #if defined(CONFIG_VIDEO) #define CONFIG_VIDEO_DA8XX -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_VIDEO_LOGO #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_LOGO diff --git a/include/configs/s5p4418_nanopi2.h b/include/configs/s5p4418_nanopi2.h index b54d2da9b46..8577729d654 100644 --- a/include/configs/s5p4418_nanopi2.h +++ b/include/configs/s5p4418_nanopi2.h @@ -152,8 +152,6 @@ #define CONFIG_VIDEO_LOGO -#define CONFIG_SPLASH_SCREEN - #ifdef CONFIG_VIDEO_LOGO #ifdef CONFIG_DM_VIDEO @@ -161,8 +159,6 @@ #endif #ifdef CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SOURCE 1 -#define CONFIG_SPLASH_SCREEN_ALIGN 1 #define SPLASH_FILE logo.bmp #endif diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 6b858112a26..5554313810c 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -81,7 +81,6 @@ #define LCD_BPP LCD_COLOR16 #define CONFIG_LCD_BMP_RLE8 #define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_KEYBOARD diff --git a/include/configs/stm32f746-disco.h b/include/configs/stm32f746-disco.h index f7a713dd22a..74abf95ce93 100644 --- a/include/configs/stm32f746-disco.h +++ b/include/configs/stm32f746-disco.h @@ -81,8 +81,6 @@ #define CONFIG_BMP_16BPP #define CONFIG_BMP_24BPP #define CONFIG_BMP_32BPP -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #endif #endif /* __CONFIG_H */ diff --git a/include/configs/wandboard.h b/include/configs/wandboard.h index df13e3da537..5506c1a028a 100644 --- a/include/configs/wandboard.h +++ b/include/configs/wandboard.h @@ -38,8 +38,6 @@ /* Framebuffer */ #define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_LOGO #define CONFIG_VIDEO_BMP_LOGO diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index e2db424fd5e..5c6790bd8df 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1584,10 +1584,6 @@ CONFIG_SPI_HALF_DUPLEX CONFIG_SPI_IDLE_VAL CONFIG_SPI_LENGTH CONFIG_SPI_N25Q256A_RESET -CONFIG_SPLASHIMAGE_GUARD -CONFIG_SPLASH_SCREEN -CONFIG_SPLASH_SCREEN_ALIGN -CONFIG_SPLASH_SOURCE CONFIG_SPLL_FREQ CONFIG_SPL_ CONFIG_SPL_ATMEL_SIZE From 7e15638d609182b651480b1054b60bf40bd0c6fd Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 11 Aug 2020 11:23:36 -0600 Subject: [PATCH 056/117] Convert CONFIG_SYS_DEVICE_NULLDEV to Kconfig This converts the following to Kconfig: CONFIG_SYS_DEVICE_NULLDEV Signed-off-by: Simon Glass --- common/Kconfig | 16 ++++++++++++++++ configs/M5249EVB_defconfig | 1 + configs/colibri_pxa270_defconfig | 1 + doc/README.silent | 2 +- include/configs/M5249EVB.h | 2 -- include/configs/colibri_pxa270.h | 2 -- scripts/config_whitelist.txt | 1 - 7 files changed, 19 insertions(+), 6 deletions(-) diff --git a/common/Kconfig b/common/Kconfig index 62d78c5bd73..5a6d0e0e79b 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -635,6 +635,22 @@ config SYS_STDIO_DEREGISTER removed (for example a USB keyboard) then this option can be enabled to ensure this is handled correctly. +config SPL_SYS_STDIO_DEREGISTER + bool "Allow deregistering stdio devices in SPL" + help + Generally there is no need to deregister stdio devices since they + are never deactivated. But if a stdio device is used which can be + removed (for example a USB keyboard) then this option can be + enabled to ensure this is handled correctly. This is very rarely + needed in SPL. + +config SYS_DEVICE_NULLDEV + bool "Enable a null device for stdio" + help + Enable creation of a "nulldev" stdio device. This allows silent + operation of the console by setting stdout to "nulldev". Enable + this to use a serial console under board control. + endmenu menu "Logging" diff --git a/configs/M5249EVB_defconfig b/configs/M5249EVB_defconfig index d4871c60c70..8f8a4a6bad5 100644 --- a/configs/M5249EVB_defconfig +++ b/configs/M5249EVB_defconfig @@ -5,6 +5,7 @@ CONFIG_ENV_SECT_SIZE=0x2000 CONFIG_TARGET_M5249EVB=y CONFIG_DEFAULT_DEVICE_TREE="M5249EVB" CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_SYS_DEVICE_NULLDEV=y # CONFIG_DISPLAY_BOARDINFO is not set # CONFIG_CMDLINE_EDITING is not set # CONFIG_AUTOBOOT is not set diff --git a/configs/colibri_pxa270_defconfig b/configs/colibri_pxa270_defconfig index 89e05608423..2865730b8ff 100644 --- a/configs/colibri_pxa270_defconfig +++ b/configs/colibri_pxa270_defconfig @@ -10,6 +10,7 @@ CONFIG_ENV_SECT_SIZE=0x40000 CONFIG_ENV_VARS_UBOOT_CONFIG=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=tty0 console=ttyS0,115200" +CONFIG_SYS_DEVICE_NULLDEV=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y # CONFIG_CMDLINE_EDITING is not set diff --git a/doc/README.silent b/doc/README.silent index 6d90a0ec403..00288e03b01 100644 --- a/doc/README.silent +++ b/doc/README.silent @@ -19,7 +19,7 @@ The following actions are taken if "silent" is set at boot time: - When the console devices have been initialized, "stdout" and "stderr" are set to "nulldev", so subsequent messages are suppressed automatically. Make sure to enable "nulldev" by - #defining CONFIG_SYS_DEVICE_NULLDEV in your board config file. + enabling CONFIG_SYS_DEVICE_NULLDEV in your board defconfig file. - When booting a linux kernel, the "bootargs" are fixed up so that the argument "console=" will be in the command line, no matter how diff --git a/include/configs/M5249EVB.h b/include/configs/M5249EVB.h index de7132940c1..1a1a1107654 100644 --- a/include/configs/M5249EVB.h +++ b/include/configs/M5249EVB.h @@ -31,8 +31,6 @@ */ #undef CONFIG_BOOTP_BOOTFILESIZE -#define CONFIG_SYS_DEVICE_NULLDEV 1 /* include nulldev device */ - #define CONFIG_SYS_LOAD_ADDR 0x200000 /* default load address */ /* diff --git a/include/configs/colibri_pxa270.h b/include/configs/colibri_pxa270.h index 4686b8946e3..3dedcdaad28 100644 --- a/include/configs/colibri_pxa270.h +++ b/include/configs/colibri_pxa270.h @@ -69,8 +69,6 @@ #define CONFIG_BOOTP_BOOTFILESIZE #endif -#define CONFIG_SYS_DEVICE_NULLDEV 1 - /* * Clock Configuration */ diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 5c6790bd8df..14d5e4c1757 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -2117,7 +2117,6 @@ CONFIG_SYS_DEBUG_SERVER_FW_IN_NOR CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS CONFIG_SYS_DEFAULT_VIDEO_MODE CONFIG_SYS_DEF_EEPROM_ADDR -CONFIG_SYS_DEVICE_NULLDEV CONFIG_SYS_DFU_DATA_BUF_SIZE CONFIG_SYS_DFU_MAX_FILE_SIZE CONFIG_SYS_DIAG_ADDR From 3ca0609adc726ed829325ef6363d6ff5402ea9bb Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 11 Aug 2020 11:23:37 -0600 Subject: [PATCH 057/117] stdio: Tidy up use of CONFIG_SYS_DEVICE_NULLDEV Now that this is in Kconfig we can move the logic at the top of the file to Kconfig, and use if() instead of #if. Update the file with these changes. Signed-off-by: Simon Glass --- common/Kconfig | 1 + common/stdio.c | 30 ++++++++++-------------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/common/Kconfig b/common/Kconfig index 5a6d0e0e79b..8f61aa76024 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -646,6 +646,7 @@ config SPL_SYS_STDIO_DEREGISTER config SYS_DEVICE_NULLDEV bool "Enable a null device for stdio" + default y if SPLASH_SCREEN || SYS_STDIO_DEREGISTER help Enable creation of a "nulldev" stdio device. This allows silent operation of the console by setting stdout to "nulldev". Enable diff --git a/common/stdio.c b/common/stdio.c index 2119204b982..33a795e7bb4 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -31,15 +31,6 @@ static struct stdio_dev devs; struct stdio_dev *stdio_devices[] = { NULL, NULL, NULL }; char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" }; -#if defined(CONFIG_SPLASH_SCREEN) && !defined(CONFIG_SYS_DEVICE_NULLDEV) -#define CONFIG_SYS_DEVICE_NULLDEV 1 -#endif - -#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) -#define CONFIG_SYS_DEVICE_NULLDEV 1 -#endif - -#ifdef CONFIG_SYS_DEVICE_NULLDEV static void nulldev_putc(struct stdio_dev *dev, const char c) { /* nulldev is empty! */ @@ -55,7 +46,6 @@ static int nulldev_input(struct stdio_dev *dev) /* nulldev is empty! */ return 0; } -#endif static void stdio_serial_putc(struct stdio_dev *dev, const char c) { @@ -96,18 +86,18 @@ static void drv_system_init (void) dev.tstc = stdio_serial_tstc; stdio_register (&dev); -#ifdef CONFIG_SYS_DEVICE_NULLDEV - memset (&dev, 0, sizeof (dev)); + if (CONFIG_IS_ENABLED(SYS_DEVICE_NULLDEV)) { + memset(&dev, '\0', sizeof(dev)); - strcpy (dev.name, "nulldev"); - dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT; - dev.putc = nulldev_putc; - dev.puts = nulldev_puts; - dev.getc = nulldev_input; - dev.tstc = nulldev_input; + strcpy(dev.name, "nulldev"); + dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT; + dev.putc = nulldev_putc; + dev.puts = nulldev_puts; + dev.getc = nulldev_input; + dev.tstc = nulldev_input; - stdio_register (&dev); -#endif + stdio_register(&dev); + } } /************************************************************************** From 3bcd0ced15ca5234ad217ac20fb0ebe55a2995bb Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 11 Aug 2020 11:23:38 -0600 Subject: [PATCH 058/117] stdio: Drop #ifdefs in the header file These prevent the use of IS_ENABLED() and are unnecessary. Drop them and fix a few code-style nits nearby. Signed-off-by: Simon Glass --- include/stdio_dev.h | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/include/stdio_dev.h b/include/stdio_dev.h index cd0cd601bff..b61c0c6ceff 100644 --- a/include/stdio_dev.h +++ b/include/stdio_dev.h @@ -57,7 +57,7 @@ extern char *stdio_names[MAX_FILES]; /* * PROTOTYPES */ -int stdio_register (struct stdio_dev * dev); +int stdio_register(struct stdio_dev *dev); int stdio_register_dev(struct stdio_dev *dev, struct stdio_dev **devp); /** @@ -82,35 +82,19 @@ int stdio_add_devices(void); */ int stdio_init(void); -void stdio_print_current_devices(void); -#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) +void stdio_print_current_devices(void); int stdio_deregister(const char *devname, int force); int stdio_deregister_dev(struct stdio_dev *dev, int force); -#endif -struct list_head* stdio_get_list(void); -struct stdio_dev* stdio_get_by_name(const char* name); -struct stdio_dev* stdio_clone(struct stdio_dev *dev); +struct list_head *stdio_get_list(void); +struct stdio_dev *stdio_get_by_name(const char *name); +struct stdio_dev *stdio_clone(struct stdio_dev *dev); -#ifdef CONFIG_LCD -int drv_lcd_init (void); -#endif -#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) -int drv_video_init (void); -#endif -#ifdef CONFIG_KEYBOARD -int drv_keyboard_init (void); -#endif -#ifdef CONFIG_USB_TTY -int drv_usbtty_init (void); -#endif -#ifdef CONFIG_NETCONSOLE -int drv_nc_init (void); -#endif -#ifdef CONFIG_JTAG_CONSOLE -int drv_jtag_console_init (void); -#endif -#ifdef CONFIG_CBMEM_CONSOLE +int drv_lcd_init(void); +int drv_video_init(void); +int drv_keyboard_init(void); +int drv_usbtty_init(void); +int drv_nc_init(void); +int drv_jtag_console_init(void); int cbmemc_init(void); -#endif #endif From 5d4b6b17488575e7d81229454f53bea9300d1adb Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 11 Aug 2020 11:23:39 -0600 Subject: [PATCH 059/117] stdio: Update to use compiler for Kconfig checks Drop use of the preprocessor where possible. Signed-off-by: Simon Glass --- common/stdio.c | 170 ++++++++++++++++++++++++------------------------- 1 file changed, 82 insertions(+), 88 deletions(-) diff --git a/common/stdio.c b/common/stdio.c index 33a795e7bb4..1921dc67194 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -18,10 +18,7 @@ #include #include #include - -#if defined(CONFIG_SYS_I2C) #include -#endif #include @@ -109,7 +106,6 @@ struct list_head* stdio_get_list(void) return &(devs.list); } -#ifdef CONFIG_DM_VIDEO /** * stdio_probe_device() - Find a device which provides the given stdio device * @@ -160,7 +156,6 @@ static int stdio_probe_device(const char *name, enum uclass_id id, return 0; } -#endif struct stdio_dev *stdio_get_by_name(const char *name) { @@ -175,22 +170,23 @@ struct stdio_dev *stdio_get_by_name(const char *name) if (strcmp(sdev->name, name) == 0) return sdev; } -#ifdef CONFIG_DM_VIDEO - /* - * We did not find a suitable stdio device. If there is a video - * driver with a name starting with 'vidconsole', we can try probing - * that in the hope that it will produce the required stdio device. - * - * This function is sometimes called with the entire value of - * 'stdout', which may include a list of devices separate by commas. - * Obviously this is not going to work, so we ignore that case. The - * call path in that case is console_init_r() -> search_device() -> - * stdio_get_by_name(). - */ - if (!strncmp(name, "vidconsole", 10) && !strchr(name, ',') && - !stdio_probe_device(name, UCLASS_VIDEO, &sdev)) - return sdev; -#endif + if (IS_ENABLED(CONFIG_DM_VIDEO)) { + /* + * We did not find a suitable stdio device. If there is a video + * driver with a name starting with 'vidconsole', we can try + * probing that in the hope that it will produce the required + * stdio device. + * + * This function is sometimes called with the entire value of + * 'stdout', which may include a list of devices separate by + * commas. Obviously this is not going to work, so we ignore + * that case. The call path in that case is + * console_init_r() -> search_device() -> stdio_get_by_name() + */ + if (!strncmp(name, "vidconsole", 10) && !strchr(name, ',') && + !stdio_probe_device(name, UCLASS_VIDEO, &sdev)) + return sdev; + } return NULL; } @@ -234,7 +230,6 @@ int stdio_register(struct stdio_dev *dev) /* deregister the device "devname". * returns 0 if success, -1 if device is assigned and 1 if devname not found */ -#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) int stdio_deregister_dev(struct stdio_dev *dev, int force) { int l; @@ -281,7 +276,6 @@ int stdio_deregister(const char *devname, int force) return stdio_deregister_dev(dev, force); } -#endif /* CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) */ int stdio_init_tables(void) { @@ -305,87 +299,87 @@ int stdio_init_tables(void) int stdio_add_devices(void) { -#ifdef CONFIG_DM_KEYBOARD struct udevice *dev; struct uclass *uc; int ret; - /* - * For now we probe all the devices here. At some point this should be - * done only when the devices are required - e.g. we have a list of - * input devices to start up in the stdin environment variable. That - * work probably makes more sense when stdio itself is converted to - * driver model. - * - * TODO(sjg@chromium.org): Convert changing uclass_first_device() etc. - * to return the device even on error. Then we could use that here. - */ - ret = uclass_get(UCLASS_KEYBOARD, &uc); - if (ret) - return ret; - - /* Don't report errors to the caller - assume that they are non-fatal */ - uclass_foreach_dev(dev, uc) { - ret = device_probe(dev); + if (IS_ENABLED(CONFIG_DM_KEYBOARD)) { + /* + * For now we probe all the devices here. At some point this + * should be done only when the devices are required - e.g. we + * have a list of input devices to start up in the stdin + * environment variable. That work probably makes more sense + * when stdio itself is converted to driver model. + * + * TODO(sjg@chromium.org): Convert changing + * uclass_first_device() etc. to return the device even on + * error. Then we could use that here. + */ + ret = uclass_get(UCLASS_KEYBOARD, &uc); if (ret) - printf("Failed to probe keyboard '%s'\n", dev->name); + return ret; + + /* + * Don't report errors to the caller - assume that they are + * non-fatal + */ + uclass_foreach_dev(dev, uc) { + ret = device_probe(dev); + if (ret) + printf("Failed to probe keyboard '%s'\n", + dev->name); + } } -#endif #ifdef CONFIG_SYS_I2C i2c_init_all(); -#else #endif -#ifdef CONFIG_DM_VIDEO - /* - * If the console setting is not in environment variables then - * console_init_r() will not be calling iomux_doenv() (which calls - * search_device()). So we will not dynamically add devices by - * calling stdio_probe_device(). - * - * So just probe all video devices now so that whichever one is - * required will be available. - */ -#ifndef CONFIG_SYS_CONSOLE_IS_IN_ENV - struct udevice *vdev; -# ifndef CONFIG_DM_KEYBOARD - int ret; -# endif + if (IS_ENABLED(CONFIG_DM_VIDEO)) { + /* + * If the console setting is not in environment variables then + * console_init_r() will not be calling iomux_doenv() (which + * calls search_device()). So we will not dynamically add + * devices by calling stdio_probe_device(). + * + * So just probe all video devices now so that whichever one is + * required will be available. + */ + struct udevice *vdev; + int ret; + + if (!IS_ENABLED(CONFIG_SYS_CONSOLE_IS_IN_ENV)) { + for (ret = uclass_first_device(UCLASS_VIDEO, &vdev); + vdev; + ret = uclass_next_device(&vdev)) + ; + if (ret) + printf("%s: Video device failed (ret=%d)\n", + __func__, ret); + } + if (IS_ENABLED(CONFIG_SPLASH_SCREEN) && + IS_ENABLED(CONFIG_CMD_BMP)) + splash_display(); + } else { + if (IS_ENABLED(CONFIG_LCD)) + drv_lcd_init(); + if (IS_ENABLED(CONFIG_VIDEO) || IS_ENABLED(CONFIG_CFB_CONSOLE)) + drv_video_init(); + } - for (ret = uclass_first_device(UCLASS_VIDEO, &vdev); - vdev; - ret = uclass_next_device(&vdev)) - ; - if (ret) - printf("%s: Video device failed (ret=%d)\n", __func__, ret); -#endif /* !CONFIG_SYS_CONSOLE_IS_IN_ENV */ -#if defined(CONFIG_SPLASH_SCREEN) && defined(CONFIG_CMD_BMP) - splash_display(); -#endif /* CONFIG_SPLASH_SCREEN && CONFIG_CMD_BMP */ -#else -# if defined(CONFIG_LCD) - drv_lcd_init (); -# endif -# if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) - drv_video_init (); -# endif -#endif /* CONFIG_DM_VIDEO */ #if defined(CONFIG_KEYBOARD) && !defined(CONFIG_DM_KEYBOARD) - drv_keyboard_init (); + drv_keyboard_init(); #endif - drv_system_init (); - serial_stdio_init (); + drv_system_init(); + serial_stdio_init(); #ifdef CONFIG_USB_TTY - drv_usbtty_init (); -#endif -#ifdef CONFIG_NETCONSOLE - drv_nc_init (); + drv_usbtty_init(); #endif + if (IS_ENABLED(CONFIG_NETCONSOLE)) + drv_nc_init(); #ifdef CONFIG_JTAG_CONSOLE - drv_jtag_console_init (); -#endif -#ifdef CONFIG_CBMEM_CONSOLE - cbmemc_init(); + drv_jtag_console_init(); #endif + if (IS_ENABLED(CONFIG_CBMEM_CONSOLE)) + cbmemc_init(); return 0; } From 18c587d0992858936600100bee033b73d03c2100 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 11 Aug 2020 11:23:40 -0600 Subject: [PATCH 060/117] stdio: Drop brackets around &devs.list These brackets are not needed. Drop them. Signed-off-by: Simon Glass --- common/stdio.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/stdio.c b/common/stdio.c index 1921dc67194..d67ea60d6c6 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -103,7 +103,7 @@ static void drv_system_init (void) */ struct list_head* stdio_get_list(void) { - return &(devs.list); + return &devs.list; } /** @@ -165,7 +165,7 @@ struct stdio_dev *stdio_get_by_name(const char *name) if (!name) return NULL; - list_for_each(pos, &(devs.list)) { + list_for_each(pos, &devs.list) { sdev = list_entry(pos, struct stdio_dev, list); if (strcmp(sdev->name, name) == 0) return sdev; @@ -215,7 +215,7 @@ int stdio_register_dev(struct stdio_dev *dev, struct stdio_dev **devp) _dev = stdio_clone(dev); if(!_dev) return -ENODEV; - list_add_tail(&(_dev->list), &(devs.list)); + list_add_tail(&_dev->list, &devs.list); if (devp) *devp = _dev; @@ -251,11 +251,11 @@ int stdio_deregister_dev(struct stdio_dev *dev, int force) sizeof(temp_names[l])); } - list_del(&(dev->list)); + list_del(&dev->list); free(dev); /* reassign Device list */ - list_for_each(pos, &(devs.list)) { + list_for_each(pos, &devs.list) { dev = list_entry(pos, struct stdio_dev, list); for (l=0 ; l< MAX_FILES; l++) { if(strcmp(dev->name, temp_names[l]) == 0) @@ -292,7 +292,7 @@ int stdio_init_tables(void) #endif /* CONFIG_NEEDS_MANUAL_RELOC */ /* Initialize the list */ - INIT_LIST_HEAD(&(devs.list)); + INIT_LIST_HEAD(&devs.list); return 0; } From 4225f2f520f2557fb671e1aa02f9ef8090491be5 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 11 Aug 2020 11:23:41 -0600 Subject: [PATCH 061/117] stdio: Tidy up the coding style Bring the coding style in this file up to the current level. Signed-off-by: Simon Glass --- common/stdio.c | 37 ++++++++++++++++--------------------- include/stdio_dev.h | 9 +++++++++ 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/common/stdio.c b/common/stdio.c index d67ea60d6c6..84c36a735c0 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -191,16 +191,15 @@ struct stdio_dev *stdio_get_by_name(const char *name) return NULL; } -struct stdio_dev* stdio_clone(struct stdio_dev *dev) +struct stdio_dev *stdio_clone(struct stdio_dev *dev) { struct stdio_dev *_dev; - if(!dev) + if (!dev) return NULL; _dev = calloc(1, sizeof(struct stdio_dev)); - - if(!_dev) + if (!_dev) return NULL; memcpy(_dev, dev, sizeof(struct stdio_dev)); @@ -213,7 +212,7 @@ int stdio_register_dev(struct stdio_dev *dev, struct stdio_dev **devp) struct stdio_dev *_dev; _dev = stdio_clone(dev); - if(!_dev) + if (!_dev) return -ENODEV; list_add_tail(&_dev->list, &devs.list); if (devp) @@ -227,41 +226,38 @@ int stdio_register(struct stdio_dev *dev) return stdio_register_dev(dev, NULL); } -/* deregister the device "devname". - * returns 0 if success, -1 if device is assigned and 1 if devname not found - */ int stdio_deregister_dev(struct stdio_dev *dev, int force) { - int l; struct list_head *pos; char temp_names[3][16]; + int i; /* get stdio devices (ListRemoveItem changes the dev list) */ - for (l=0 ; l< MAX_FILES; l++) { - if (stdio_devices[l] == dev) { + for (i = 0 ; i < MAX_FILES; i++) { + if (stdio_devices[i] == dev) { if (force) { - strcpy(temp_names[l], "nulldev"); + strcpy(temp_names[i], "nulldev"); continue; } /* Device is assigned -> report error */ - return -1; + return -EBUSY; } - memcpy (&temp_names[l][0], - stdio_devices[l]->name, - sizeof(temp_names[l])); + memcpy(&temp_names[i][0], stdio_devices[i]->name, + sizeof(temp_names[i])); } list_del(&dev->list); free(dev); - /* reassign Device list */ + /* reassign device list */ list_for_each(pos, &devs.list) { dev = list_entry(pos, struct stdio_dev, list); - for (l=0 ; l< MAX_FILES; l++) { - if(strcmp(dev->name, temp_names[l]) == 0) - stdio_devices[l] = dev; + for (i = 0 ; i < MAX_FILES; i++) { + if (strcmp(dev->name, temp_names[i]) == 0) + stdio_devices[i] = dev; } } + return 0; } @@ -270,7 +266,6 @@ int stdio_deregister(const char *devname, int force) struct stdio_dev *dev; dev = stdio_get_by_name(devname); - if (!dev) /* device not found */ return -ENODEV; diff --git a/include/stdio_dev.h b/include/stdio_dev.h index b61c0c6ceff..48871a6a22b 100644 --- a/include/stdio_dev.h +++ b/include/stdio_dev.h @@ -84,6 +84,15 @@ int stdio_init(void); void stdio_print_current_devices(void); int stdio_deregister(const char *devname, int force); + +/** + * stdio_deregister_dev() - deregister the device "devname". + * + * @dev: Stdio device to deregister + * @force: true to force deregistration even if in use + * + * returns 0 on success, -EBUSY if device is assigned + */ int stdio_deregister_dev(struct stdio_dev *dev, int force); struct list_head *stdio_get_list(void); struct stdio_dev *stdio_get_by_name(const char *name); From 6befc1f900db638ae54ea1bbab51a42cd1d5a153 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 15 Feb 2020 21:27:38 +0100 Subject: [PATCH 062/117] clk: ICS8N3QV01 remove superfluous code Do not calculate a unused value of n which is overwritten in both branches of the subsequent if statement. Identified by cppcheck. Signed-off-by: Heinrich Schuchardt Reviewed-by: Lukasz Majewski --- drivers/clk/ics8n3qv01.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/clk/ics8n3qv01.c b/drivers/clk/ics8n3qv01.c index 4f80bf6e522..76b27ad7fd0 100644 --- a/drivers/clk/ics8n3qv01.c +++ b/drivers/clk/ics8n3qv01.c @@ -82,7 +82,6 @@ static int ics8n3qv01_calc_parameters(uint fout, uint *_mint, uint *_mfrac, uint n, foutiic, fvcoiic, mint; u64 mfrac; - n = (2215000000U + fout / 2) / fout; if (fout < 417000000U) n = 2 * ((2215000000U / 2 + fout / 2) / fout); else From d71fac847904af35ebf8c47c42ccf9ee442190b3 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Mon, 24 Feb 2020 14:55:24 +0100 Subject: [PATCH 063/117] clk: imx6: Add definition for IMX6QDL_CLK_ENET clock After commit 673f6597321d ("net: fec_mxc: support i.MX8M with CLK_CCF") all NXP boards, which are not IMX8 and in the same time are supporting CCF need to provide IMX6QDL_CLK_ENET. This change defines the missing clock in i.MX6Q's CCF. Signed-off-by: Lukasz Majewski --- drivers/clk/imx/clk-imx6q.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c index 11d194363d3..d954af9a07b 100644 --- a/drivers/clk/imx/clk-imx6q.c +++ b/drivers/clk/imx/clk-imx6q.c @@ -183,6 +183,7 @@ static int imx6q_clk_probe(struct udevice *dev) clk_dm(IMX6QDL_CLK_I2C2, imx_clk_gate2("i2c2", "ipg_per", base + 0x70, 8)); + clk_dm(IMX6QDL_CLK_ENET, imx_clk_gate2("enet", "ipg", base + 0x6c, 10)); return 0; } From 8d540ccb1128bac033eac77be997d28a1236d9f4 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Mon, 24 Feb 2020 14:55:25 +0100 Subject: [PATCH 064/117] clk: imx: Add support for pllv3 enet clock This code has been ported from Linux kernel v5.5.5 (tag) and has been adjusted to U-Boot's DM. It adds support for correct recognition of IMX_PLLV3_ENET flag in the clk-pllv3.c driver. Signed-off-by: Lukasz Majewski --- drivers/clk/imx/clk-pllv3.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c index b4a9d587e1b..feacaee1c42 100644 --- a/drivers/clk/imx/clk-pllv3.c +++ b/drivers/clk/imx/clk-pllv3.c @@ -20,6 +20,7 @@ #define UBOOT_DM_CLK_IMX_PLLV3_SYS "imx_clk_pllv3_sys" #define UBOOT_DM_CLK_IMX_PLLV3_USB "imx_clk_pllv3_usb" #define UBOOT_DM_CLK_IMX_PLLV3_AV "imx_clk_pllv3_av" +#define UBOOT_DM_CLK_IMX_PLLV3_ENET "imx_clk_pllv3_enet" #define PLL_NUM_OFFSET 0x10 #define PLL_DENOM_OFFSET 0x20 @@ -36,6 +37,7 @@ struct clk_pllv3 { u32 enable_bit; u32 div_mask; u32 div_shift; + unsigned long ref_clock; }; #define to_clk_pllv3(_clk) container_of(_clk, struct clk_pllv3, clk) @@ -232,6 +234,19 @@ static const struct clk_ops clk_pllv3_av_ops = { .set_rate = clk_pllv3_av_set_rate, }; +static ulong clk_pllv3_enet_get_rate(struct clk *clk) +{ + struct clk_pllv3 *pll = to_clk_pllv3(clk); + + return pll->ref_clock; +} + +static const struct clk_ops clk_pllv3_enet_ops = { + .enable = clk_pllv3_generic_enable, + .disable = clk_pllv3_generic_disable, + .get_rate = clk_pllv3_enet_get_rate, +}; + struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name, const char *parent_name, void __iomem *base, u32 div_mask) @@ -269,6 +284,10 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name, pll->div_shift = 0; pll->powerup_set = false; break; + case IMX_PLLV3_ENET: + drv_name = UBOOT_DM_CLK_IMX_PLLV3_ENET; + pll->ref_clock = 500000000; + break; default: kfree(pll); return ERR_PTR(-ENOTSUPP); @@ -314,3 +333,9 @@ U_BOOT_DRIVER(clk_pllv3_av) = { .ops = &clk_pllv3_av_ops, .flags = DM_FLAG_PRE_RELOC, }; + +U_BOOT_DRIVER(clk_pllv3_enet) = { + .name = UBOOT_DM_CLK_IMX_PLLV3_ENET, + .id = UCLASS_CLK, + .ops = &clk_pllv3_enet_ops, +}; From 32f462ba3bf0c8794653e6ff92ca5cbec9856c54 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Mon, 24 Feb 2020 14:55:26 +0100 Subject: [PATCH 065/117] clk: imx6: Add definition for IMX6QDL_CLK_ENET_REF clock After commit 673f6597321d ("net: fec_mxc: support i.MX8M with CLK_CCF") all NXP boards, which are not IMX8 and in the same time are supporting CCF need to provide PTP clock. On the i.MX6Q this clock is provided with IMX6QDL_CLK_ENET_REF in the Linux kernel's CCF. Code in this change models the simplest case when enet reference clock is generated from 'osc' clock. Signed-off-by: Lukasz Majewski --- drivers/clk/imx/clk-imx6q.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c index d954af9a07b..5343036babd 100644 --- a/drivers/clk/imx/clk-imx6q.c +++ b/drivers/clk/imx/clk-imx6q.c @@ -113,6 +113,10 @@ static int imx6q_clk_probe(struct udevice *dev) imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0)); clk_dm(IMX6QDL_CLK_PLL2_PFD2_396M, imx_clk_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2)); + clk_dm(IMX6QDL_CLK_PLL6, + imx_clk_pllv3(IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0, 0x3)); + clk_dm(IMX6QDL_CLK_PLL6_ENET, + imx_clk_gate("pll6_enet", "pll6", base + 0xe0, 13)); /* CCM clocks */ base = dev_read_addr_ptr(dev); @@ -184,6 +188,9 @@ static int imx6q_clk_probe(struct udevice *dev) imx_clk_gate2("i2c2", "ipg_per", base + 0x70, 8)); clk_dm(IMX6QDL_CLK_ENET, imx_clk_gate2("enet", "ipg", base + 0x6c, 10)); + clk_dm(IMX6QDL_CLK_ENET_REF, + imx_clk_fixed_factor("enet_ref", "pll6_enet", 1, 1)); + return 0; } From cd16c57bd0d6c498d5c180d70c6f0f690e9c32de Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Mon, 13 Apr 2020 14:36:26 +0200 Subject: [PATCH 066/117] dm: test: clk: add the test for the ccf gated clock Unlike the other clock types, in the case of the gated clock, a new driver has been developed which does not use the registering routine provided by the common clock framework. The addition of the ecspi0 clock to sandbox therefore allows testing the ccf gate clock. Signed-off-by: Dario Binacchi Reviewed-by: Simon Glass --- drivers/clk/clk_sandbox_ccf.c | 4 ++++ include/sandbox-clk.h | 8 ++++++++ test/dm/clk_ccf.c | 8 ++++++++ 3 files changed, 20 insertions(+) diff --git a/drivers/clk/clk_sandbox_ccf.c b/drivers/clk/clk_sandbox_ccf.c index 0619d04f0ec..e90b860257f 100644 --- a/drivers/clk/clk_sandbox_ccf.c +++ b/drivers/clk/clk_sandbox_ccf.c @@ -250,6 +250,10 @@ static int sandbox_clk_ccf_probe(struct udevice *dev) clk_dm(SANDBOX_CLK_ECSPI_ROOT, sandbox_clk_divider("ecspi_root", "pll3_60m", ®, 19, 6)); + reg = 0; + clk_dm(SANDBOX_CLK_ECSPI0, + sandbox_clk_gate("ecspi0", "ecspi_root", ®, 0, 0)); + clk_dm(SANDBOX_CLK_ECSPI1, sandbox_clk_gate2("ecspi1", "ecspi_root", base + 0x6c, 0)); diff --git a/include/sandbox-clk.h b/include/sandbox-clk.h index 296cddfbb0e..c2616c27a44 100644 --- a/include/sandbox-clk.h +++ b/include/sandbox-clk.h @@ -50,6 +50,14 @@ static inline struct clk *sandbox_clk_divider(const char *name, reg, shift, width, 0); } +static inline struct clk *sandbox_clk_gate(const char *name, const char *parent, + void __iomem *reg, u8 bit_idx, + u8 clk_gate_flags) +{ + return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, + reg, bit_idx, clk_gate_flags, NULL); +} + struct clk *sandbox_clk_register_gate2(struct device *dev, const char *name, const char *parent_name, unsigned long flags, diff --git a/test/dm/clk_ccf.c b/test/dm/clk_ccf.c index 050fa804533..960cb2db0d4 100644 --- a/test/dm/clk_ccf.c +++ b/test/dm/clk_ccf.c @@ -39,6 +39,14 @@ static int dm_test_clk_ccf(struct unit_test_state *uts) rate = clk_get_parent_rate(clk); ut_asserteq(rate, 20000000); + /* test the gate of CCF */ + ret = clk_get_by_id(SANDBOX_CLK_ECSPI0, &clk); + ut_assertok(ret); + ut_asserteq_str("ecspi0", clk->dev->name); + + rate = clk_get_parent_rate(clk); + ut_asserteq(rate, 20000000); + /* Test the mux of CCF */ ret = clk_get_by_id(SANDBOX_CLK_USDHC1_SEL, &clk); ut_assertok(ret); From 16bdc85b488dd2f9463a71d6aa09bdf5ea9a9978 Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Mon, 13 Apr 2020 14:36:27 +0200 Subject: [PATCH 067/117] clk: set flags in the ccf registration routines The top-level framework flags are passed as parameter to the common clock framework (ccf) registration routines without being used. Checks of the flags setting added by the patch have been added in the ccf test. Signed-off-by: Dario Binacchi --- drivers/clk/clk-composite.c | 1 + drivers/clk/clk-divider.c | 1 + drivers/clk/clk-fixed-factor.c | 1 + drivers/clk/clk-gate.c | 1 + drivers/clk/clk-mux.c | 1 + drivers/clk/clk_sandbox_ccf.c | 3 ++- test/dm/clk_ccf.c | 7 +++++++ 7 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c index 819bfca2fcf..7e99c5b910d 100644 --- a/drivers/clk/clk-composite.c +++ b/drivers/clk/clk-composite.c @@ -145,6 +145,7 @@ struct clk *clk_register_composite(struct device *dev, const char *name, } clk = &composite->clk; + clk->flags = flags; ret = clk_register(clk, UBOOT_DM_CLK_COMPOSITE, name, parent_names[clk_composite_get_parent(clk)]); if (ret) { diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 34658536c48..8f59d7fb72c 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -212,6 +212,7 @@ static struct clk *_register_divider(struct device *dev, const char *name, /* register the clock */ clk = &div->clk; + clk->flags = flags; ret = clk_register(clk, UBOOT_DM_CLK_CCF_DIVIDER, name, parent_name); if (ret) { diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c index 0eb24b87fc3..8d9823bdab9 100644 --- a/drivers/clk/clk-fixed-factor.c +++ b/drivers/clk/clk-fixed-factor.c @@ -49,6 +49,7 @@ struct clk *clk_hw_register_fixed_factor(struct device *dev, fix->mult = mult; fix->div = div; clk = &fix->clk; + clk->flags = flags; ret = clk_register(clk, UBOOT_DM_CLK_IMX_FIXED_FACTOR, name, parent_name); diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index 98e4b80b32f..006d3b6629c 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -142,6 +142,7 @@ struct clk *clk_register_gate(struct device *dev, const char *name, #endif clk = &gate->clk; + clk->flags = flags; ret = clk_register(clk, UBOOT_DM_CLK_GATE, name, parent_name); if (ret) { diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 26991a5bc8f..679d66a85b8 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -185,6 +185,7 @@ struct clk *clk_hw_register_mux_table(struct device *dev, const char *name, #endif clk = &mux->clk; + clk->flags = flags; /* * Read the current mux setup - so we assign correct parent. diff --git a/drivers/clk/clk_sandbox_ccf.c b/drivers/clk/clk_sandbox_ccf.c index e90b860257f..fedcdd40448 100644 --- a/drivers/clk/clk_sandbox_ccf.c +++ b/drivers/clk/clk_sandbox_ccf.c @@ -130,6 +130,7 @@ struct clk *sandbox_clk_register_gate2(struct device *dev, const char *name, gate->state = 0; clk = &gate->clk; + clk->flags = flags; ret = clk_register(clk, "sandbox_clk_gate2", name, parent_name); if (ret) { @@ -272,7 +273,7 @@ static int sandbox_clk_ccf_probe(struct udevice *dev) reg = BIT(28) | BIT(24) | BIT(16); clk_dm(SANDBOX_CLK_I2C, sandbox_clk_composite("i2c", i2c_sels, ARRAY_SIZE(i2c_sels), - ®, 0)); + ®, CLK_SET_RATE_UNGATE)); clk_dm(SANDBOX_CLK_I2C_ROOT, sandbox_clk_gate2("i2c_root", "i2c", base + 0x7c, 0)); diff --git a/test/dm/clk_ccf.c b/test/dm/clk_ccf.c index 960cb2db0d4..242d2d756fd 100644 --- a/test/dm/clk_ccf.c +++ b/test/dm/clk_ccf.c @@ -30,11 +30,13 @@ static int dm_test_clk_ccf(struct unit_test_state *uts) ret = clk_get_by_id(SANDBOX_CLK_ECSPI_ROOT, &clk); ut_assertok(ret); ut_asserteq_str("ecspi_root", clk->dev->name); + ut_asserteq(CLK_SET_RATE_PARENT, clk->flags); /* Test for clk_get_parent_rate() */ ret = clk_get_by_id(SANDBOX_CLK_ECSPI1, &clk); ut_assertok(ret); ut_asserteq_str("ecspi1", clk->dev->name); + ut_asserteq(CLK_SET_RATE_PARENT, clk->flags); rate = clk_get_parent_rate(clk); ut_asserteq(rate, 20000000); @@ -43,6 +45,7 @@ static int dm_test_clk_ccf(struct unit_test_state *uts) ret = clk_get_by_id(SANDBOX_CLK_ECSPI0, &clk); ut_assertok(ret); ut_asserteq_str("ecspi0", clk->dev->name); + ut_asserteq(CLK_SET_RATE_PARENT, clk->flags); rate = clk_get_parent_rate(clk); ut_asserteq(rate, 20000000); @@ -51,6 +54,7 @@ static int dm_test_clk_ccf(struct unit_test_state *uts) ret = clk_get_by_id(SANDBOX_CLK_USDHC1_SEL, &clk); ut_assertok(ret); ut_asserteq_str("usdhc1_sel", clk->dev->name); + ut_asserteq(CLK_SET_RATE_NO_REPARENT, clk->flags); rate = clk_get_parent_rate(clk); ut_asserteq(rate, 60000000); @@ -58,17 +62,20 @@ static int dm_test_clk_ccf(struct unit_test_state *uts) ret = clk_get_by_id(SANDBOX_CLK_USDHC2_SEL, &clk); ut_assertok(ret); ut_asserteq_str("usdhc2_sel", clk->dev->name); + ut_asserteq(CLK_SET_RATE_NO_REPARENT, clk->flags); rate = clk_get_parent_rate(clk); ut_asserteq(rate, 80000000); pclk = clk_get_parent(clk); ut_asserteq_str("pll3_80m", pclk->dev->name); + ut_asserteq(CLK_SET_RATE_PARENT, pclk->flags); /* Test the composite of CCF */ ret = clk_get_by_id(SANDBOX_CLK_I2C, &clk); ut_assertok(ret); ut_asserteq_str("i2c", clk->dev->name); + ut_asserteq(CLK_SET_RATE_UNGATE, clk->flags); rate = clk_get_rate(clk); ut_asserteq(rate, 60000000); From 7b0830d41f9e0350207ae3f5137ad8c50731374b Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Sat, 2 May 2020 17:38:11 +0200 Subject: [PATCH 068/117] clk: fix the console output of clk_register The parent->name variable can be used only in case the uclass_get_device_by_name routine returns successfully. Signed-off-by: Dario Binacchi --- drivers/clk/clk.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 0f55ba751c0..786f4e887e7 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -22,13 +22,13 @@ int clk_register(struct clk *clk, const char *drv_name, ret = uclass_get_device_by_name(UCLASS_CLK, parent_name, &parent); if (ret) { - printf("%s: name: %s parent: %s [0x%p]\n", - __func__, name, parent->name, parent); + printf("%s: failed to get %s device (parent of %s)\n", + __func__, parent_name, name); + } else { + debug("%s: name: %s parent: %s [0x%p]\n", __func__, name, + parent->name, parent); } - debug("%s: name: %s parent: %s [0x%p]\n", __func__, name, parent->name, - parent); - drv = lists_driver_lookup_name(drv_name); if (!drv) { printf("%s: %s is not a valid driver name\n", From 76eaa2d0ed655da19fc1ea00cab054e19be33ecc Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Sat, 2 May 2020 17:58:31 +0200 Subject: [PATCH 069/117] clk: ccf: mux: change include order Apply u-boot coding style on include files order. Signed-off-by: Dario Binacchi --- drivers/clk/clk-mux.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 679d66a85b8..69f1e9cc99c 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -22,16 +22,16 @@ */ #include -#include -#include +#include #include #include #include #include +#include +#include #include -#include -#include "clk.h" #include +#include "clk.h" #define UBOOT_DM_CLK_CCF_MUX "ccf_clk_mux" From 40559d277481a47abc8e42f287fd67a19e9592d9 Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Sat, 2 May 2020 17:58:32 +0200 Subject: [PATCH 070/117] clk: ccf: mux: fix typo Close the opening bracket. Signed-off-by: Dario Binacchi --- drivers/clk/clk-mux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 69f1e9cc99c..978f3a8a14f 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -191,7 +191,7 @@ struct clk *clk_hw_register_mux_table(struct device *dev, const char *name, * Read the current mux setup - so we assign correct parent. * * Changing parent would require changing internals of udevice struct - * for the corresponding clock (to do that define .set_parent() method. + * for the corresponding clock (to do that define .set_parent() method). */ ret = clk_register(clk, UBOOT_DM_CLK_CCF_MUX, name, parent_names[clk_mux_get_parent(clk)]); From e3b5d74c778a8782f763412679ca4c3cb2d496c3 Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Sat, 2 May 2020 17:58:33 +0200 Subject: [PATCH 071/117] clk: ccf: mux: fix access to the sandbox register The tests developed for the mux clock are run on the sandbox. They don't call the clk_mux_set_parent routine and therefore they do not detect this error. Signed-off-by: Dario Binacchi --- drivers/clk/clk-mux.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 978f3a8a14f..e10baaf83b4 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -131,12 +131,20 @@ static int clk_mux_set_parent(struct clk *clk, struct clk *parent) if (mux->flags & CLK_MUX_HIWORD_MASK) { reg = mux->mask << (mux->shift + 16); } else { +#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF) + reg = mux->io_mux_val; +#else reg = readl(mux->reg); +#endif reg &= ~(mux->mask << mux->shift); } val = val << mux->shift; reg |= val; +#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF) + mux->io_mux_val = reg; +#else writel(reg, mux->reg); +#endif return 0; } From 12d152620d9de9ea966e1136b7f48f641c981bac Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Wed, 3 Jun 2020 15:36:25 +0200 Subject: [PATCH 072/117] clk: ccf: mux: change the get_rate helper The previous version of the get_rate helper does not work if the mux clock parent is changed after the probe. This error has not been detected because this condition has not been tested. The error occurs because the set_parent helper does not change the parent of the clock device but only the clock selection register. Since changing the parent of a probed device can be tricky, the new version of the get_rate helper provides the rate of the selected clock and not that of the parent. Signed-off-by: Dario Binacchi --- drivers/clk/clk-mux.c | 26 +++++++++++++++++++++++++- test/dm/clk_ccf.c | 24 ++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index e10baaf83b4..ec8017b7d2f 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -149,8 +149,32 @@ static int clk_mux_set_parent(struct clk *clk, struct clk *parent) return 0; } +static ulong clk_mux_get_rate(struct clk *clk) +{ + struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ? + dev_get_clk_ptr(clk->dev) : clk); + struct udevice *parent; + struct clk *pclk; + int err, index; + + index = clk_mux_get_parent(clk); + if (index >= mux->num_parents) + return -EFAULT; + + err = uclass_get_device_by_name(UCLASS_CLK, mux->parent_names[index], + &parent); + if (err) + return err; + + pclk = dev_get_clk_ptr(parent); + if (!pclk) + return -ENODEV; + + return clk_get_rate(pclk); +} + const struct clk_ops clk_mux_ops = { - .get_rate = clk_generic_get_rate, + .get_rate = clk_mux_get_rate, .set_parent = clk_mux_set_parent, }; diff --git a/test/dm/clk_ccf.c b/test/dm/clk_ccf.c index 242d2d756fd..32bc4d2b8a0 100644 --- a/test/dm/clk_ccf.c +++ b/test/dm/clk_ccf.c @@ -59,6 +59,18 @@ static int dm_test_clk_ccf(struct unit_test_state *uts) rate = clk_get_parent_rate(clk); ut_asserteq(rate, 60000000); + rate = clk_get_rate(clk); + ut_asserteq(rate, 60000000); + + ret = clk_get_by_id(SANDBOX_CLK_PLL3_80M, &pclk); + ut_assertok(ret); + + ret = clk_set_parent(clk, pclk); + ut_assertok(ret); + + rate = clk_get_rate(clk); + ut_asserteq(rate, 80000000); + ret = clk_get_by_id(SANDBOX_CLK_USDHC2_SEL, &clk); ut_assertok(ret); ut_asserteq_str("usdhc2_sel", clk->dev->name); @@ -71,6 +83,18 @@ static int dm_test_clk_ccf(struct unit_test_state *uts) ut_asserteq_str("pll3_80m", pclk->dev->name); ut_asserteq(CLK_SET_RATE_PARENT, pclk->flags); + rate = clk_get_rate(clk); + ut_asserteq(rate, 80000000); + + ret = clk_get_by_id(SANDBOX_CLK_PLL3_60M, &pclk); + ut_assertok(ret); + + ret = clk_set_parent(clk, pclk); + ut_assertok(ret); + + rate = clk_get_rate(clk); + ut_asserteq(rate, 60000000); + /* Test the composite of CCF */ ret = clk_get_by_id(SANDBOX_CLK_I2C, &clk); ut_assertok(ret); From cc6328412c3ba40c324f531fa5648d08573db110 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Thu, 30 Jul 2020 14:04:09 +0200 Subject: [PATCH 073/117] cmd: clk: cosmetic: correct code alignment in show_clks Correct code alignment in show_clks() function. Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- cmd/clk.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/cmd/clk.c b/cmd/clk.c index 439736d0724..ba4540334ab 100644 --- a/cmd/clk.c +++ b/cmd/clk.c @@ -25,24 +25,24 @@ static void show_clks(struct udevice *dev, int depth, int last_flag) if (device_get_uclass_id(dev) == UCLASS_CLK && clkp) { rate = clk_get_rate(clkp); - printf(" %-12u %8d ", rate, clkp->enable_count); + printf(" %-12u %8d ", rate, clkp->enable_count); - for (i = depth; i >= 0; i--) { - is_last = (last_flag >> i) & 1; - if (i) { - if (is_last) - printf(" "); - else - printf("| "); - } else { - if (is_last) - printf("`-- "); - else - printf("|-- "); + for (i = depth; i >= 0; i--) { + is_last = (last_flag >> i) & 1; + if (i) { + if (is_last) + printf(" "); + else + printf("| "); + } else { + if (is_last) + printf("`-- "); + else + printf("|-- "); + } } - } - printf("%s\n", dev->name); + printf("%s\n", dev->name); } list_for_each_entry(child, &dev->child_head, sibling_node) { From 689ca8c5d123445a1d23f515fd1c8fb407cfb622 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Thu, 30 Jul 2020 14:04:10 +0200 Subject: [PATCH 074/117] cmd: clk: correctly handle depth for clk dump Update depth only when clock uclass is found to have correct display of command "clk dump". Without this patch, the displayed depth is the binding depth for all the uclass and that can be strange as only clock uclass nodes are displayed. Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- cmd/clk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/clk.c b/cmd/clk.c index ba4540334ab..e3c3d2f9bb2 100644 --- a/cmd/clk.c +++ b/cmd/clk.c @@ -23,6 +23,7 @@ static void show_clks(struct udevice *dev, int depth, int last_flag) clkp = dev_get_clk_ptr(dev); if (device_get_uclass_id(dev) == UCLASS_CLK && clkp) { + depth++; rate = clk_get_rate(clkp); printf(" %-12u %8d ", rate, clkp->enable_count); @@ -47,7 +48,7 @@ static void show_clks(struct udevice *dev, int depth, int last_flag) list_for_each_entry(child, &dev->child_head, sibling_node) { is_last = list_is_last(&child->sibling_node, &dev->child_head); - show_clks(child, depth + 1, (last_flag << 1) | is_last); + show_clks(child, depth, (last_flag << 1) | is_last); } } From ebd3f1f0d032cc35dfb8d03da7f7ade6e9a51aef Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Mon, 24 Aug 2020 11:12:18 +0200 Subject: [PATCH 075/117] clk: ccf: Add missing #include to clk-mux.c After adding custom get_rate helper function it was necessary to include to avoid warnings about missing uclass_get_device_by_name. Signed-off-by: Lukasz Majewski Series-to: u-boot --- drivers/clk/clk-mux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index ec8017b7d2f..7a5ee7a45fc 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include From 72e1fcacff273f1aa5faa02a75ab5a737f6c698f Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 15 Aug 2020 23:10:22 +0200 Subject: [PATCH 076/117] efi_loader: document parameters of do_bootefi_exec() Add the missing description of the load_options parameter. Signed-off-by: Heinrich Schuchardt --- cmd/bootefi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index fbfed54e857..06563d28ca9 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -304,7 +304,11 @@ efi_status_t efi_install_fdt(void *fdt) /** * do_bootefi_exec() - execute EFI binary * + * The image indicated by @handle is started. When it returns the allocated + * memory for the @load_options is freed. + * * @handle: handle of loaded image + * @load_options: load options * Return: status code * * Load the EFI binary into a newly assigned memory unwinding the relocation From dd12c6a4463ff62271a783772b92571dab3b56fb Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 15 Aug 2020 23:09:35 +0200 Subject: [PATCH 077/117] efi_loader: remove empty comment line Remove a line leading to a warning in make htmldocs. Signed-off-by: Heinrich Schuchardt --- include/efi_variable.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/efi_variable.h b/include/efi_variable.h index 60491cb6402..4704a3c16e6 100644 --- a/include/efi_variable.h +++ b/include/efi_variable.h @@ -274,7 +274,6 @@ efi_get_next_variable_name_mem(efi_uintn_t *variable_name_size, u16 *variable_na * @data: buffer to which the variable value is copied * @timep: authentication time (seconds since start of epoch) * Return: status code - */ efi_status_t __efi_runtime efi_get_variable_mem(u16 *variable_name, const efi_guid_t *vendor, u32 *attributes, From ebcbfc7d6de20b094090da3aa3b944cfd8103baa Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 16 Aug 2020 12:27:19 +0200 Subject: [PATCH 078/117] doc: update UEFI documentation * UEFI variables can be persisted * describe that the sequence of files loaded before bootefi matters Signed-off-by: Heinrich Schuchardt --- doc/uefi/uefi.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/uefi/uefi.rst b/doc/uefi/uefi.rst index a72e729cc82..728f7bf4e0a 100644 --- a/doc/uefi/uefi.rst +++ b/doc/uefi/uefi.rst @@ -59,6 +59,10 @@ Below you find the output of an example session starting GRUB:: 120832 bytes read in 7 ms (16.5 MiB/s) => bootefi ${kernel_addr_r} ${fdt_addr_r} +The bootefi command uses the device, the file name, and the file size +(environment variable 'filesize') of the most recently loaded file when setting +up the binary for execution. So the UEFI binary should be loaded last. + The environment variable 'bootargs' is passed as load options in the UEFI system table. The Linux kernel EFI stub uses the load options as command line arguments. @@ -217,13 +221,13 @@ which has to be enabled via CONFIG_SUPPORT_EMMC_RPMB=y. Executing the boot manager ~~~~~~~~~~~~~~~~~~~~~~~~~~ -The UEFI specification foresees to define boot entries and boot sequence via UEFI -variables. Booting according to these variables is possible via:: +The UEFI specification foresees to define boot entries and boot sequence via +UEFI variables. Booting according to these variables is possible via:: bootefi bootmgr [fdt address] -As of U-Boot v2018.03 UEFI variables are not persisted and cannot be set at -runtime. +As of U-Boot v2020.10 UEFI variables cannot be set at runtime. The U-Boot +command 'efidebug' can be used to set the variables. Executing the built in hello world application ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From f03a879d67261b587a88e8e475596c1bbe7e6111 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 22 Aug 2020 08:29:53 +0200 Subject: [PATCH 079/117] efi_loader: ResetSystem() should not hang If ResetSystem() is not implemented at runtime, it should return instead of hanging in an endless loop. This allows the operating system to reset the system by other means as Linux does. It also matches what EDK II suggests in comments for functions ResetShutdown() and ResetWarm() in OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_runtime.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 78fd8014d90..dea2b4e5eea 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -365,7 +365,9 @@ out: * efi_reset_system() - reset system * * This function implements the ResetSystem() runtime service after - * SetVirtualAddressMap() is called. It only executes an endless loop. + * SetVirtualAddressMap() is called. As this placeholder cannot reset the + * system it simply return to the caller. + * * Boards may override the helpers below to implement reset functionality. * * See the Unified Extensible Firmware Interface (UEFI) specification for @@ -381,8 +383,7 @@ void __weak __efi_runtime EFIAPI efi_reset_system( efi_status_t reset_status, unsigned long data_size, void *reset_data) { - /* Nothing we can do */ - while (1) { } + return; } /** From c06867d7f8f64606a16ce45e8ac07fdc3ace4f13 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 20 Aug 2020 12:16:54 +0200 Subject: [PATCH 080/117] efi_selftest: add a test for ResetSystem() The unit test will reset the system by calling the ResetSystem() runtime service before or after ExitBootServices() according to the users choice by setting environment variable efi_selftest to: * 'reset system' or * 'reset system runtime'. Signed-off-by: Heinrich Schuchardt --- lib/efi_selftest/Makefile | 1 + lib/efi_selftest/efi_selftest_reset.c | 58 +++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 lib/efi_selftest/efi_selftest_reset.c diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index 45ce6859b86..85fe8e1216a 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -31,6 +31,7 @@ efi_selftest_mem.o \ efi_selftest_memory.o \ efi_selftest_open_protocol.o \ efi_selftest_register_notify.o \ +efi_selftest_reset.o \ efi_selftest_set_virtual_address_map.o \ efi_selftest_textinput.o \ efi_selftest_textinputex.o \ diff --git a/lib/efi_selftest/efi_selftest_reset.c b/lib/efi_selftest/efi_selftest_reset.c new file mode 100644 index 00000000000..8b6ac24cb15 --- /dev/null +++ b/lib/efi_selftest/efi_selftest_reset.c @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * efi_selftest_reset + * + * Copyright (c) 2020 Heinrich Schuchardt + * + * This test checks the following service at boot time or runtime: + * ResetSystem() + */ + +#include + +static struct efi_runtime_services *runtime; + +/* + * Setup unit test. + * + * @handle: handle of the loaded image + * @systable: system table + * @return: EFI_ST_SUCCESS for success + */ +static int setup(const efi_handle_t handle, + const struct efi_system_table *systable) +{ + runtime = systable->runtime; + return EFI_ST_SUCCESS; +} + +/* + * Execute unit test. + * + * @return: EFI_ST_SUCCESS for success + */ +static int execute(void) +{ + u16 reset_data[] = L"Reset by selftest"; + + runtime->reset_system(EFI_RESET_COLD, EFI_SUCCESS, + sizeof(reset_data), reset_data); + efi_st_error("Reset failed.\n"); + return EFI_ST_FAILURE; +} + +EFI_UNIT_TEST(reset) = { + .name = "reset system", + .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, + .setup = setup, + .execute = execute, + .on_request = true, +}; + +EFI_UNIT_TEST(resetrt) = { + .name = "reset system runtime", + .phase = EFI_SETUP_BEFORE_BOOTTIME_EXIT, + .setup = setup, + .execute = execute, + .on_request = true, +}; From fa63753f86ccf912d2553934ee6aec787030fa8a Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 22 Aug 2020 09:14:56 +0200 Subject: [PATCH 081/117] efi_selftest: substitute ResetSystem() by do_reset() If ResetSystem() is not implemented at runtime, call do_reset() after test completion. Signed-off-by: Heinrich Schuchardt --- lib/efi_selftest/efi_selftest.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c index 5b01610eca1..6eec8ae2a7c 100644 --- a/lib/efi_selftest/efi_selftest.c +++ b/lib/efi_selftest/efi_selftest.c @@ -5,6 +5,7 @@ * Copyright (c) 2017 Heinrich Schuchardt */ +#include #include #include @@ -309,8 +310,13 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle, /* Reset system */ efi_st_printf("Preparing for reset. Press any key...\n"); efi_st_get_key(); - runtime->reset_system(EFI_RESET_WARM, EFI_NOT_READY, - sizeof(reset_message), reset_message); + + if (IS_ENABLED(CONFIG_EFI_HAVE_RUNTIME_RESET)) + runtime->reset_system(EFI_RESET_WARM, EFI_NOT_READY, + sizeof(reset_message), reset_message); + else + do_reset(NULL, 0, 0, NULL); + efi_st_printf("\n"); efi_st_error("Reset failed\n"); From ed0b10722c880d82e5da2a357122f5ae0e53d4db Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 23 Aug 2020 09:54:44 +0200 Subject: [PATCH 082/117] include: kernel.h: define SSIZE_MAX Define SSIZE_MAX, the largest value fitting into a variable of type ssize_t. Signed-off-by: Heinrich Schuchardt --- include/linux/kernel.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index b88c2100659..3e71d61074b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -19,6 +19,9 @@ #ifndef SIZE_MAX #define SIZE_MAX (~(size_t)0) #endif +#ifndef SSIZE_MAX +#define SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1)) +#endif #define U8_MAX ((u8)~0U) #define S8_MAX ((s8)(U8_MAX>>1)) From 5cad4a30932a31f1646510d35af7e9e36f71708a Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 23 Aug 2020 10:49:46 +0200 Subject: [PATCH 083/117] efi_loader: efi_dp_check_length() We need to check that device paths provided via UEFI variables are not malformed. Provide function efi_dp_check_length() to check if a device path has an end node within a given number of bytes. Signed-off-by: Heinrich Schuchardt --- include/efi_loader.h | 2 ++ lib/efi_loader/efi_device_path.c | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/include/efi_loader.h b/include/efi_loader.h index 50a17a33ca4..0baa1d2324c 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -631,6 +631,8 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, const char *path, struct efi_device_path **device, struct efi_device_path **file); +ssize_t efi_dp_check_length(const struct efi_device_path *dp, + const size_t maxlen); #define EFI_DP_TYPE(_dp, _type, _subtype) \ (((_dp)->type == DEVICE_PATH_TYPE_##_type) && \ diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 7ae14f34239..8a5c13c4241 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -1127,3 +1127,36 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, return EFI_SUCCESS; } + +/** + * efi_dp_check_length() - check length of a device path + * + * @dp: pointer to device path + * @maxlen: maximum length of the device path + * Return: + * * length of the device path if it is less or equal @maxlen + * * -1 if the device path is longer then @maxlen + * * -1 if a device path node has a length of less than 4 + * * -EINVAL if maxlen exceeds SSIZE_MAX + */ +ssize_t efi_dp_check_length(const struct efi_device_path *dp, + const size_t maxlen) +{ + ssize_t ret = 0; + u16 len; + + if (maxlen > SSIZE_MAX) + return -EINVAL; + for (;;) { + len = dp->length; + if (len < 4) + return -1; + ret += len; + if (ret > maxlen) + return -1; + if (dp->type == DEVICE_PATH_TYPE_END && + dp->sub_type == DEVICE_PATH_SUB_TYPE_END) + return ret; + dp = (const struct efi_device_path *)((const u8 *)dp + len); + } +} From 5bba77e48be801176a55223b1f76bc44e8e1b3cb Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 23 Aug 2020 10:53:50 +0200 Subject: [PATCH 084/117] test: unit test for efi_dp_check_length() Provide a unit test for function efi_dp_check_length(). Signed-off-by: Heinrich Schuchardt --- test/lib/Makefile | 1 + test/lib/efi_device_path.c | 50 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 test/lib/efi_device_path.c diff --git a/test/lib/Makefile b/test/lib/Makefile index b6a0a208c5e..ada62fe46b7 100644 --- a/test/lib/Makefile +++ b/test/lib/Makefile @@ -3,6 +3,7 @@ # (C) Copyright 2018 # Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc obj-y += cmd_ut_lib.o +obj-$(CONFIG_EFI_LOADER) += efi_device_path.o obj-$(CONFIG_EFI_SECURE_BOOT) += efi_image_region.o obj-y += hexdump.o obj-y += lmb.o diff --git a/test/lib/efi_device_path.c b/test/lib/efi_device_path.c new file mode 100644 index 00000000000..24e2f23c5af --- /dev/null +++ b/test/lib/efi_device_path.c @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Test device path functions + * + * Copyright (c) 2020 Heinrich Schuchardt + */ + +#include +#include +#include +#include +#include + +static int lib_test_efi_dp_check_length(struct unit_test_state *uts) +{ + /* end of device path */ + u8 d1[] __aligned(2) = { + 0x7f, 0xff, 0x04, 0x00 }; + /* device path node with length less then 4 */ + u8 d2[] __aligned(2) = { + 0x01, 0x02, 0x02, 0x00, 0x04, 0x00, 0x7f, 0xff, 0x04, 0x00 }; + /* well formed device path */ + u8 d3[] __aligned(2) = { + 0x03, 0x02, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x7f, 0xff, 0x04, 0x00 }; + + struct efi_device_path *p1 = (struct efi_device_path *)d1; + struct efi_device_path *p2 = (struct efi_device_path *)d2; + struct efi_device_path *p3 = (struct efi_device_path *)d3; + + ut_asserteq((ssize_t)-EINVAL, efi_dp_check_length(p1, SIZE_MAX)); + ut_asserteq((ssize_t)sizeof(d1), efi_dp_check_length(p1, sizeof(d1))); + ut_asserteq((ssize_t)sizeof(d1), + efi_dp_check_length(p1, sizeof(d1) + 4)); + ut_asserteq((ssize_t)-1, efi_dp_check_length(p1, sizeof(d1) - 1)); + + ut_asserteq((ssize_t)-1, efi_dp_check_length(p2, sizeof(d2))); + + ut_asserteq((ssize_t)-1, efi_dp_check_length(p3, sizeof(d3) - 1)); + ut_asserteq((ssize_t)sizeof(d3), efi_dp_check_length(p3, sizeof(d3))); + ut_asserteq((ssize_t)sizeof(d3), efi_dp_check_length(p3, SSIZE_MAX)); + ut_asserteq((ssize_t)-EINVAL, + efi_dp_check_length(p3, (size_t)SSIZE_MAX + 1)); + ut_asserteq((ssize_t)sizeof(d3), + efi_dp_check_length(p3, sizeof(d3) + 4)); + + return 0; +} + +LIB_TEST(lib_test_efi_dp_check_length, 0); From 15d8f008dc577bbef6ad98494c28553558941420 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 23 Aug 2020 10:59:17 +0200 Subject: [PATCH 085/117] efi_loader: validate device path length in boot manager Bootxxxx variables are provided by the user and therefore cannot be trusted. We have to validate them before usage. A device path provided by a Bootxxxx variable must have an end node within the indicated device path length. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_bootmgr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c index 1e06e609639..61dc72a23da 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -105,10 +105,8 @@ efi_status_t efi_deserialize_load_option(struct efi_load_option *lo, u8 *data, if (*size < len) return EFI_INVALID_PARAMETER; lo->file_path = (struct efi_device_path *)data; - /* - * TODO: validate device path. There should be an end node within - * the indicated file_path_length. - */ + if (efi_dp_check_length(lo->file_path, len) < 0) + return EFI_INVALID_PARAMETER; data += len; *size -= len; From 2b3fbcb59f4174e455a6285eaddf1426ed3e76c5 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 24 Aug 2020 08:27:49 +0200 Subject: [PATCH 086/117] efi_loader: use ':' as separator for setenv -i setenv -e -i
, can be used to set a UEFI variable from memory. For separating an address and a size we use ':' in most commands. Let's do the same for setenv -e -i. Signed-off-by: Heinrich Schuchardt --- cmd/nvedit_efi.c | 2 +- doc/uefi/uefi.rst | 6 +- .../py/tests/test_efi_secboot/test_authvar.py | 60 +++++++++---------- test/py/tests/test_efi_secboot/test_signed.py | 46 +++++++------- .../test_efi_secboot/test_signed_intca.py | 24 ++++---- .../tests/test_efi_secboot/test_unsigned.py | 18 +++--- 6 files changed, 78 insertions(+), 78 deletions(-) diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c index 8e31f43e1f9..094c0e80987 100644 --- a/cmd/nvedit_efi.c +++ b/cmd/nvedit_efi.c @@ -473,7 +473,7 @@ int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc, argc--; argv++; addr = simple_strtoul(argv[0], &ep, 16); - if (*ep != ',') + if (*ep != ':') return CMD_RET_USAGE; /* 0 should be allowed for delete */ diff --git a/doc/uefi/uefi.rst b/doc/uefi/uefi.rst index 728f7bf4e0a..07eb3f01b4e 100644 --- a/doc/uefi/uefi.rst +++ b/doc/uefi/uefi.rst @@ -173,11 +173,11 @@ Sign an image with one of the keys in "db" on your host Now in U-Boot install the keys on your board:: fatload mmc 0:1 PK.auth - setenv -e -nv -bs -rt -at -i ,$filesize PK + setenv -e -nv -bs -rt -at -i :$filesize PK fatload mmc 0:1 KEK.auth - setenv -e -nv -bs -rt -at -i ,$filesize KEK + setenv -e -nv -bs -rt -at -i :$filesize KEK fatload mmc 0:1 db.auth - setenv -e -nv -bs -rt -at -i ,$filesize db + setenv -e -nv -bs -rt -at -i :$filesize db Set up boot parameters on your board:: diff --git a/test/py/tests/test_efi_secboot/test_authvar.py b/test/py/tests/test_efi_secboot/test_authvar.py index d0c6b9035b1..f99b8270a64 100644 --- a/test/py/tests/test_efi_secboot/test_authvar.py +++ b/test/py/tests/test_efi_secboot/test_authvar.py @@ -38,14 +38,14 @@ class TestEfiAuthVar(object): # Test Case 1b, PK without AUTHENTICATED_WRITE_ACCESS output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -i 4000000,$filesize PK']) + 'setenv -e -nv -bs -rt -i 4000000:$filesize PK']) assert 'Failed to set EFI variable' in ''.join(output) with u_boot_console.log.section('Test Case 1c'): # Test Case 1c, install PK output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK', 'printenv -e -n PK']) assert 'PK:' in ''.join(output) @@ -60,24 +60,24 @@ class TestEfiAuthVar(object): # Test Case 1d, db/dbx without KEK output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db']) assert 'Failed to set EFI variable' in ''.join(output) output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx']) assert 'Failed to set EFI variable' in ''.join(output) with u_boot_console.log.section('Test Case 1e'): # Test Case 1e, install KEK output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -i 4000000,$filesize KEK']) + 'setenv -e -nv -bs -rt -i 4000000:$filesize KEK']) assert 'Failed to set EFI variable' in ''.join(output) output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'printenv -e -n KEK']) assert 'KEK:' in ''.join(output) @@ -89,12 +89,12 @@ class TestEfiAuthVar(object): # Test Case 1f, install db output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -i 4000000,$filesize db']) + 'setenv -e -nv -bs -rt -i 4000000:$filesize db']) assert 'Failed to set EFI variable' in ''.join(output) output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'printenv -e -n -guid d719b2cb-3d3a-4596-a3bc-dad00e67656f db']) assert 'Failed to set EFI variable' not in ''.join(output) assert 'db:' in ''.join(output) @@ -107,12 +107,12 @@ class TestEfiAuthVar(object): # Test Case 1g, install dbx output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 dbx.auth', - 'setenv -e -nv -bs -rt -i 4000000,$filesize dbx']) + 'setenv -e -nv -bs -rt -i 4000000:$filesize dbx']) assert 'Failed to set EFI variable' in ''.join(output) output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 dbx.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx', 'printenv -e -n -guid d719b2cb-3d3a-4596-a3bc-dad00e67656f dbx']) assert 'Failed to set EFI variable' not in ''.join(output) assert 'dbx:' in ''.join(output) @@ -132,32 +132,32 @@ class TestEfiAuthVar(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK', 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'printenv -e -n -guid d719b2cb-3d3a-4596-a3bc-dad00e67656f db']) assert 'Failed to set EFI variable' not in ''.join(output) assert 'db:' in ''.join(output) output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db1.auth', - 'setenv -e -nv -bs -rt -i 4000000,$filesize db']) + 'setenv -e -nv -bs -rt -i 4000000:$filesize db']) assert 'Failed to set EFI variable' in ''.join(output) with u_boot_console.log.section('Test Case 2b'): # Test Case 2b, update without correct signature output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db.esl', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db']) assert 'Failed to set EFI variable' in ''.join(output) with u_boot_console.log.section('Test Case 2c'): # Test Case 2c, update with correct signature output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db1.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'printenv -e -n -guid d719b2cb-3d3a-4596-a3bc-dad00e67656f db']) assert 'Failed to set EFI variable' not in ''.join(output) assert 'db:' in ''.join(output) @@ -173,32 +173,32 @@ class TestEfiAuthVar(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK', 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'printenv -e -n -guid d719b2cb-3d3a-4596-a3bc-dad00e67656f db']) assert 'Failed to set EFI variable' not in ''.join(output) assert 'db:' in ''.join(output) output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db1.auth', - 'setenv -e -nv -bs -rt -a -i 4000000,$filesize db']) + 'setenv -e -nv -bs -rt -a -i 4000000:$filesize db']) assert 'Failed to set EFI variable' in ''.join(output) with u_boot_console.log.section('Test Case 3b'): # Test Case 3b, update without correct signature output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db.esl', - 'setenv -e -nv -bs -rt -at -a -i 4000000,$filesize db']) + 'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize db']) assert 'Failed to set EFI variable' in ''.join(output) with u_boot_console.log.section('Test Case 3c'): # Test Case 3c, update with correct signature output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db1.auth', - 'setenv -e -nv -bs -rt -at -a -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize db', 'printenv -e -n -guid d719b2cb-3d3a-4596-a3bc-dad00e67656f db']) assert 'Failed to set EFI variable' not in ''.join(output) assert 'db:' in ''.join(output) @@ -214,11 +214,11 @@ class TestEfiAuthVar(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK', 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'printenv -e -n -guid d719b2cb-3d3a-4596-a3bc-dad00e67656f db']) assert 'Failed to set EFI variable' not in ''.join(output) assert 'db:' in ''.join(output) @@ -248,18 +248,18 @@ class TestEfiAuthVar(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK', 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'printenv -e -n PK']) assert 'Failed to set EFI variable' not in ''.join(output) assert 'PK:' in ''.join(output) output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 PK_null.esl', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK', 'printenv -e -n PK']) assert 'Failed to set EFI variable' in ''.join(output) assert 'PK:' in ''.join(output) @@ -268,7 +268,7 @@ class TestEfiAuthVar(object): # Test Case 5b, Uninstall PK with correct signature output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 PK_null.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK', 'printenv -e -n PK']) assert 'Failed to set EFI variable' not in ''.join(output) assert '\"PK\" not defined' in ''.join(output) diff --git a/test/py/tests/test_efi_secboot/test_signed.py b/test/py/tests/test_efi_secboot/test_signed.py index 1443ba7b62b..863685e215b 100644 --- a/test/py/tests/test_efi_secboot/test_signed.py +++ b/test/py/tests/test_efi_secboot/test_signed.py @@ -53,9 +53,9 @@ class TestEfiSignedImage(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ 'efidebug boot add 1 HELLO1 host 0:1 /helloworld.efi.signed ""', @@ -74,7 +74,7 @@ class TestEfiSignedImage(object): # Test Case 2b, authenticated by db output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ 'efidebug boot next 2', @@ -97,11 +97,11 @@ class TestEfiSignedImage(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx', 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ 'efidebug boot add 1 HELLO host 0:1 /helloworld.efi.signed ""', @@ -114,7 +114,7 @@ class TestEfiSignedImage(object): # Test Case 3b, rejected by dbx even if db allows output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ 'efidebug boot next 1', @@ -133,13 +133,13 @@ class TestEfiSignedImage(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 dbx_hash.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx', 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ 'efidebug boot add 1 HELLO host 0:1 /helloworld.efi.signed ""', @@ -162,11 +162,11 @@ class TestEfiSignedImage(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ 'efidebug boot add 1 HELLO host 0:1 /helloworld.efi.signed_2sigs ""', @@ -178,7 +178,7 @@ class TestEfiSignedImage(object): # Test Case 5b, authenticated if both signatures are verified output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db1.auth', - 'setenv -e -nv -bs -rt -at -a -i 4000000,$filesize db']) + 'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize db']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ 'efidebug boot next 1', @@ -190,7 +190,7 @@ class TestEfiSignedImage(object): # certificate) is revoked output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 dbx_hash.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ 'efidebug boot next 1', @@ -201,7 +201,7 @@ class TestEfiSignedImage(object): # Test Case 5d, rejected if both of signatures are revoked output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 dbx_hash1.auth', - 'setenv -e -nv -bs -rt -at -a -i 4000000,$filesize dbx']) + 'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize dbx']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ 'efidebug boot next 1', @@ -220,11 +220,11 @@ class TestEfiSignedImage(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 db_hello_signed.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ 'efidebug boot add 1 HELLO host 0:1 /helloworld.efi.signed ""', @@ -236,7 +236,7 @@ class TestEfiSignedImage(object): # Test Case 6b, rejected by TEST_db certificate in dbx output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 dbx_db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ 'efidebug boot next 1', @@ -248,9 +248,9 @@ class TestEfiSignedImage(object): # Test Case 6c, rejected by image's digest in dbx output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'fatload host 0:1 4000000 dbx_hello_signed.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ 'efidebug boot next 1', diff --git a/test/py/tests/test_efi_secboot/test_signed_intca.py b/test/py/tests/test_efi_secboot/test_signed_intca.py index 1e5f4d04b3c..70d6be00e8a 100644 --- a/test/py/tests/test_efi_secboot/test_signed_intca.py +++ b/test/py/tests/test_efi_secboot/test_signed_intca.py @@ -31,11 +31,11 @@ class TestEfiSignedImageIntca(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 db_c.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ @@ -64,9 +64,9 @@ class TestEfiSignedImageIntca(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ @@ -80,7 +80,7 @@ class TestEfiSignedImageIntca(object): # Test Case 2b, signed and authenticated by root CA output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db_b.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'efidebug boot next 1', 'efidebug test bootmgr']) assert '\'HELLO_abc\' failed' in ''.join(output) @@ -90,7 +90,7 @@ class TestEfiSignedImageIntca(object): # Test Case 2c, signed and authenticated by root CA output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db_c.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'efidebug boot next 1', 'efidebug test bootmgr']) assert 'Hello, world!' in ''.join(output) @@ -106,13 +106,13 @@ class TestEfiSignedImageIntca(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 dbx_b.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx', 'fatload host 0:1 4000000 db_c.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ @@ -128,7 +128,7 @@ class TestEfiSignedImageIntca(object): # Test Case 3b, revoked by root CA in dbx output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 dbx_c.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx', 'efidebug boot next 1', 'efidebug test bootmgr']) assert '\'HELLO_abc\' failed' in ''.join(output) diff --git a/test/py/tests/test_efi_secboot/test_unsigned.py b/test/py/tests/test_efi_secboot/test_unsigned.py index c4c3f4c2023..56f56e19eb8 100644 --- a/test/py/tests/test_efi_secboot/test_unsigned.py +++ b/test/py/tests/test_efi_secboot/test_unsigned.py @@ -29,9 +29,9 @@ class TestEfiUnsignedImage(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ @@ -56,11 +56,11 @@ class TestEfiUnsignedImage(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 db_hello.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ @@ -80,11 +80,11 @@ class TestEfiUnsignedImage(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 db_hello.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx', 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK', 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ @@ -102,7 +102,7 @@ class TestEfiUnsignedImage(object): # Test Case 3b, rejected by dbx even if db allows output = u_boot_console.run_command_list([ 'fatload host 0:1 4000000 db_hello.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db']) + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db']) assert 'Failed to set EFI variable' not in ''.join(output) output = u_boot_console.run_command_list([ From e61b41517d2a91080f6416fdfb46efab9e5a55b4 Mon Sep 17 00:00:00 2001 From: Usama Arif Date: Tue, 11 Aug 2020 15:46:03 +0100 Subject: [PATCH 087/117] avb: Make AVB independent of fastboot AVB only uses CONFIG_FASTBOOT_BUF_ADDR from fastboot for memory. This memory is used for assigning temporary buffers. This can be assigned a new variable and used as CONFIG_AVB_BUF_ADDR. This is to support future boards that support AVB but dont support USB and therefore dont support FASTBOOT. Signed-off-by: Usama Arif Cc: Igor Opaniuk Reviewed-by: Tom Rini Acked-by: Igor Opaniuk [trini: Change defaults] Signed-off-by: Tom Rini --- common/Kconfig | 20 +++++++++++++++++++- common/avb_verify.c | 1 - include/avb_verify.h | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/common/Kconfig b/common/Kconfig index 8f61aa76024..c58f08ba91b 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1003,7 +1003,7 @@ config HASH config AVB_VERIFY bool "Build Android Verified Boot operations" - depends on LIBAVB && FASTBOOT + depends on LIBAVB depends on PARTITION_UUIDS help This option enables compilation of bootloader-dependent operations, @@ -1012,6 +1012,24 @@ config AVB_VERIFY * Helpers to access MMC, similar to drivers/fastboot/fb_mmc.c. * Helpers to alloc/init/free avb ops. +if AVB_VERIFY + +config AVB_BUF_ADDR + hex "Define AVB buffer address" + default FASTBOOT_BUF_ADDR + help + AVB requires a buffer for memory transactions. This variable defines the + buffer address. + +config AVB_BUF_SIZE + hex "Define AVB buffer SIZE" + default FASTBOOT_BUF_SIZE + help + AVB requires a buffer for memory transactions. This variable defines the + buffer size. + +endif # AVB_VERIFY + config SPL_HASH bool # "Support hashing API (SHA1, SHA256, etc.)" help diff --git a/common/avb_verify.c b/common/avb_verify.c index a2b739626b5..db10d0f21fc 100644 --- a/common/avb_verify.c +++ b/common/avb_verify.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include diff --git a/include/avb_verify.h b/include/avb_verify.h index a8d7090f794..1e787ba6668 100644 --- a/include/avb_verify.h +++ b/include/avb_verify.h @@ -72,12 +72,12 @@ static inline uint64_t calc_offset(struct mmc_part *part, int64_t offset) static inline size_t get_sector_buf_size(void) { - return (size_t)CONFIG_FASTBOOT_BUF_SIZE; + return (size_t)CONFIG_AVB_BUF_SIZE; } static inline void *get_sector_buf(void) { - return map_sysmem(CONFIG_FASTBOOT_BUF_ADDR, CONFIG_FASTBOOT_BUF_SIZE); + return map_sysmem(CONFIG_AVB_BUF_ADDR, CONFIG_AVB_BUF_SIZE); } static inline bool is_buf_unaligned(void *buffer) From 565add124de00c994652a0d2d6d1eb6b2a7c9553 Mon Sep 17 00:00:00 2001 From: Usama Arif Date: Wed, 12 Aug 2020 16:12:53 +0100 Subject: [PATCH 088/117] board: armltd: Add support for Total Compute platform Total Compute is based on ARM architecture and has the following features enabled in u-boot: - PL011 UART - PL180 MMC - NOR Flash - FIT image with Signature - AVB Signed-off-by: Usama Arif Reviewed-by: Tom Rini --- arch/arm/Kconfig | 11 +++ arch/arm/dts/Makefile | 2 + arch/arm/dts/total_compute.dts | 48 ++++++++++++ arch/arm/include/asm/gpio.h | 2 +- board/armltd/total_compute/Kconfig | 12 +++ board/armltd/total_compute/MAINTAINERS | 7 ++ board/armltd/total_compute/Makefile | 6 ++ board/armltd/total_compute/total_compute.c | 67 ++++++++++++++++ configs/total_compute_defconfig | 53 +++++++++++++ include/configs/total_compute.h | 89 ++++++++++++++++++++++ 10 files changed, 296 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/total_compute.dts create mode 100644 board/armltd/total_compute/Kconfig create mode 100644 board/armltd/total_compute/MAINTAINERS create mode 100644 board/armltd/total_compute/Makefile create mode 100644 board/armltd/total_compute/total_compute.c create mode 100644 configs/total_compute_defconfig create mode 100644 include/configs/total_compute.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 9b8dadce837..c5ebd59d340 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1198,6 +1198,15 @@ config TARGET_VEXPRESS64_JUNO select USB select DM_USB +config TARGET_TOTAL_COMPUTE + bool "Support Total Compute Platform" + select ARM64 + select PL01X_SERIAL + select DM + select DM_SERIAL + select DM_MMC + select DM_GPIO + config TARGET_LS2080A_EMU bool "Support ls2080a_emu" select ARCH_LS2080A @@ -1904,6 +1913,8 @@ source "arch/arm/mach-imx/Kconfig" source "arch/arm/mach-nexell/Kconfig" +source "board/armltd/total_compute/Kconfig" + source "board/bosch/shc/Kconfig" source "board/bosch/guardian/Kconfig" source "board/CarMediaLab/flea3/Kconfig" diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index b2b5360f6d8..4bdfdf123d6 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -981,6 +981,8 @@ dtb-$(CONFIG_TARGET_VEXPRESS_CA5X2) += vexpress-v2p-ca5s.dtb dtb-$(CONFIG_TARGET_VEXPRESS_CA9X4) += vexpress-v2p-ca9.dtb dtb-$(CONFIG_TARGET_VEXPRESS_CA15_TC2) += vexpress-v2p-ca15_a7.dtb +dtb-$(CONFIG_TARGET_TOTAL_COMPUTE) += total_compute.dtb + dtb-$(CONFIG_TARGET_DURIAN) += phytium-durian.dtb dtb-$(CONFIG_TARGET_PRESIDIO_ASIC) += ca-presidio-engboard.dtb diff --git a/arch/arm/dts/total_compute.dts b/arch/arm/dts/total_compute.dts new file mode 100644 index 00000000000..4399269a441 --- /dev/null +++ b/arch/arm/dts/total_compute.dts @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2020 Arm Limited + */ + +/dts-v1/; + +/ { + model = "total_compute"; + compatible = "arm,total_compute"; + #address-cells = <2>; + #size-cells = <2>; + + sysreg: sysreg@1c010000 { + compatible = "arm,vexpress-sysreg"; + reg = <0x0 0x001c010000 0x0 0x1000>; + gpio-controller; + #gpio-cells = <2>; + }; + + fixed_3v3: v2m-3v3 { + compatible = "regulator-fixed"; + regulator-name = "3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + mmci@1c050000 { + compatible = "arm,pl180", "arm,primecell"; + reg = <0x0 0x001c050000 0x0 0x1000>; + cd-gpios = <&sysreg 0 0>; + arm,primecell-periphid = <0x00880180>; + wp-gpios = <&sysreg 1 0>; + bus-width = <8>; + max-frequency = <12000000>; + vmmc-supply = <&fixed_3v3>; + clocks = <&clock24mhz>, <&clock24mhz>; + clock-names = "mclk", "apb_pclk"; + }; + + clock24mhz: clock24mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + clock-output-names = "bp:clock24mhz"; + }; +}; diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h index 7dc87afb83a..6ecb876eda5 100644 --- a/arch/arm/include/asm/gpio.h +++ b/arch/arm/include/asm/gpio.h @@ -3,7 +3,7 @@ !defined(CONFIG_ARCH_BCM6858) && !defined(CONFIG_ARCH_BCM63158) && \ !defined(CONFIG_ARCH_ROCKCHIP) && !defined(CONFIG_ARCH_ASPEED) && \ !defined(CONFIG_ARCH_U8500) && !defined(CONFIG_CORTINA_PLATFORM) && \ - !defined(CONFIG_TARGET_BCMNS3) + !defined(CONFIG_TARGET_BCMNS3) && !defined(CONFIG_TARGET_TOTAL_COMPUTE) #include #endif #include diff --git a/board/armltd/total_compute/Kconfig b/board/armltd/total_compute/Kconfig new file mode 100644 index 00000000000..62e6e6f4ac3 --- /dev/null +++ b/board/armltd/total_compute/Kconfig @@ -0,0 +1,12 @@ +if TARGET_TOTAL_COMPUTE + +config SYS_BOARD + default "total_compute" + +config SYS_VENDOR + default "armltd" + +config SYS_CONFIG_NAME + default "total_compute" + +endif diff --git a/board/armltd/total_compute/MAINTAINERS b/board/armltd/total_compute/MAINTAINERS new file mode 100644 index 00000000000..3dc1cd188ab --- /dev/null +++ b/board/armltd/total_compute/MAINTAINERS @@ -0,0 +1,7 @@ +TOTAL_COMPUTE BOARD +M: Usama Arif +S: Maintained +F: board/armltd/total_compute/ +F: include/configs/total_compute.h +F: configs/total_compute_defconfig +F: arch/arm/dts/total_compute.dts diff --git a/board/armltd/total_compute/Makefile b/board/armltd/total_compute/Makefile new file mode 100644 index 00000000000..8b104584312 --- /dev/null +++ b/board/armltd/total_compute/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright 2020 Arm Limited +# Usama Arif + +obj-y := total_compute.o diff --git a/board/armltd/total_compute/total_compute.c b/board/armltd/total_compute/total_compute.c new file mode 100644 index 00000000000..0be6435fe3b --- /dev/null +++ b/board/armltd/total_compute/total_compute.c @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2020 Arm Limited + * Usama Arif + */ + +#include +#include +#include +#include + +static const struct pl01x_serial_platdata serial_platdata = { + .base = UART0_BASE, + .type = TYPE_PL011, + .clock = CONFIG_PL011_CLOCK, +}; + +U_BOOT_DEVICE(total_compute_serials) = { + .name = "serial_pl01x", + .platdata = &serial_platdata, +}; + +static struct mm_region total_compute_mem_map[] = { + { + .virt = 0x0UL, + .phys = 0x0UL, + .size = 0x80000000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + .virt = 0x80000000UL, + .phys = 0x80000000UL, + .size = 0xff80000000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_INNER_SHARE + }, { + /* List terminator */ + 0, + } +}; + +struct mm_region *mem_map = total_compute_mem_map; + +int board_init(void) +{ + return 0; +} + +int dram_init(void) +{ + gd->ram_size = PHYS_SDRAM_1_SIZE; + return 0; +} + +int dram_init_banksize(void) +{ + gd->bd->bi_dram[0].start = PHYS_SDRAM_1; + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; + + return 0; +} + +/* Nothing to be done here as handled by PSCI interface */ +void reset_cpu(ulong addr) +{ +} diff --git a/configs/total_compute_defconfig b/configs/total_compute_defconfig new file mode 100644 index 00000000000..e36d701ff49 --- /dev/null +++ b/configs/total_compute_defconfig @@ -0,0 +1,53 @@ +CONFIG_ARM=y +CONFIG_TARGET_TOTAL_COMPUTE=y +CONFIG_SYS_TEXT_BASE=0xe0000000 +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_ENV_SIZE=0x2a00000 +CONFIG_NR_DRAM_BANKS=2 +CONFIG_DEFAULT_DEVICE_TREE="total_compute" +CONFIG_DISTRO_DEFAULTS=y +CONFIG_ANDROID_BOOT_IMAGE=y +CONFIG_FIT=y +CONFIG_FIT_SIGNATURE=y +CONFIG_LEGACY_IMAGE_FORMAT=y +CONFIG_BOOTDELAY=5 +CONFIG_USE_BOOTARGS=y +CONFIG_BOOTARGS="console=ttyAMA0 debug user_debug=31 earlycon=pl011,0x7ff80000 loglevel=9 androidboot.hardware=total_compute video=640x480-32@60 androidboot.boot_devices=1c050000.mmci ip=dhcp androidboot.selinux=permissive" +# CONFIG_USE_BOOTCOMMAND is not set +# CONFIG_DISPLAY_CPUINFO is not set +# CONFIG_DISPLAY_BOARDINFO is not set +CONFIG_AVB_VERIFY=y +CONFIG_AVB_BUF_ADDR=0x90000000 +CONFIG_AVB_BUF_SIZE=0x10000000 +CONFIG_SYS_PROMPT="TOTAL_COMPUTE# " +# CONFIG_CMD_CONSOLE is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_EDITENV is not set +CONFIG_CMD_MEMTEST=y +CONFIG_SYS_MEMTEST_START=0x80000000 +CONFIG_SYS_MEMTEST_END=0xff000000 +CONFIG_CMD_ARMFLASH=y +CONFIG_CMD_GPT=y +# CONFIG_RANDOM_UUID is not set +# CONFIG_CMD_LOADS is not set +CONFIG_CMD_MMC=y +# CONFIG_CMD_ITEST is not set +# CONFIG_CMD_SETEXPR is not set +CONFIG_CMD_CACHE=y +# CONFIG_CMD_MISC is not set +CONFIG_CMD_AVB=y +CONFIG_CMD_UBI=y +# CONFIG_ISO_PARTITION is not set +CONFIG_OF_CONTROL=y +# CONFIG_NET is not set +CONFIG_CLK=y +# CONFIG_MMC_WRITE is not set +CONFIG_ARM_PL180_MMCI=y +CONFIG_MTD=y +CONFIG_MTD_NOR_FLASH=y +CONFIG_FLASH_CFI_DRIVER=y +CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y +CONFIG_SYS_FLASH_PROTECTION=y +CONFIG_SYS_FLASH_CFI=y +CONFIG_LIBAVB=y +CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/include/configs/total_compute.h b/include/configs/total_compute.h new file mode 100644 index 00000000000..cc93f1930a1 --- /dev/null +++ b/include/configs/total_compute.h @@ -0,0 +1,89 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Configuration for Total Compute platform. Parts were derived from other ARM + * configurations. + * (C) Copyright 2020 Arm Limited + * Usama Arif + */ + +#ifndef __TOTAL_COMPUTE_H +#define __TOTAL_COMPUTE_H + +#define CONFIG_REMAKE_ELF + +/* Link Definitions */ +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x7fff0) + +#define CONFIG_SYS_BOOTM_LEN (64 << 20) + +#define UART0_BASE 0x7ff80000 + +/* Size of malloc() pool */ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (8 << 20)) + +/* PL011 Serial Configuration */ +#define CONFIG_PL011_CLOCK 7372800 + +/* Miscellaneous configurable options */ +#define CONFIG_SYS_LOAD_ADDR 0x90000000 + +/* Physical Memory Map */ +#define PHYS_SDRAM_1 0x80000000 +/* Top 48MB reserved for secure world use */ +#define DRAM_SEC_SIZE 0x03000000 +#define PHYS_SDRAM_1_SIZE 0x80000000 - DRAM_SEC_SIZE +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 + +#define CONFIG_ARM_PL180_MMCI_BASE 0x001c050000 +#define CONFIG_SYS_MMC_MAX_BLK_COUNT 127 +#define CONFIG_ARM_PL180_MMCI_CLOCK_FREQ 12000000 + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "bootm_size=0x20000000\0" \ + "load_addr=0xa0000000\0" \ + "kernel_addr_r=0x80080000\0" \ + "initrd_addr_r=0x88000000\0" \ + "fdt_addr_r=0x83000000\0" +/* + * If vbmeta partition is present, boot Android with verification using AVB. + * Else if system partition is present (no vbmeta partition), boot Android + * without verification (for development purposes). + * Else boot FIT image. + */ +#define CONFIG_BOOTCOMMAND \ + "if part number mmc 0 vbmeta is_avb; then" \ + " echo MMC with vbmeta partition detected.;" \ + " echo starting Android Verified boot.;" \ + " avb init 0; " \ + " if avb verify; then " \ + " set bootargs $bootargs $avb_bootargs; " \ + " part start mmc 0 boot boot_start; " \ + " part size mmc 0 boot boot_size; " \ + " mmc read ${load_addr} ${boot_start} ${boot_size}; " \ + " bootm ${load_addr} ${load_addr} ${fdt_addr_r}; " \ + " else; " \ + " echo AVB verification failed.; " \ + " exit; " \ + " fi; " \ + "elif part number mmc 0 system is_non_avb_android; then " \ + " booti ${kernel_addr_r} ${initrd_addr_r} ${fdt_addr_r};" \ + "else;" \ + " echo Booting FIT image.;" \ + " bootm ${load_addr} ${load_addr} ${fdt_addr_r}; " \ + "fi;" + +/* Monitor Command Prompt */ +#define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */ +#define CONFIG_SYS_MAXARGS 64 /* max command args */ + +#define CONFIG_SYS_FLASH_BASE 0x0C000000 +/* 256 x 256KiB sectors */ +#define CONFIG_SYS_MAX_FLASH_SECT 256 + +#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_32BIT +#define CONFIG_SYS_MAX_FLASH_BANKS 1 + +#define CONFIG_SYS_FLASH_EMPTY_INFO /* flinfo indicates empty blocks */ +#define FLASH_MAX_SECTOR_SIZE 0x00040000 + +#endif /* __TOTAL_COMPUTE_H */ From 10e4d64e345b6b684d27d3da6ed8d887c8e45f76 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 13 Aug 2020 12:43:22 +0200 Subject: [PATCH 089/117] firmware: psci: Do not bind driver if U-Boot runs in EL3 There is no reason to bind psci driver if U-Boot runs in EL3 because SMC/HVC instructions can't be called. That's why detect this state and don't let user to crash from prompt by performing reset or poweroff commands (if enabled). Signed-off-by: Michal Simek --- drivers/firmware/psci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index 7d2e49fd3e3..68953cc4f4e 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -19,6 +19,7 @@ #include #include #include +#include #define DRIVER_NAME "psci" @@ -73,6 +74,11 @@ static int psci_probe(struct udevice *dev) { const char *method; +#if defined(CONFIG_ARM64) + if (current_el() == 3) + return -EINVAL; +#endif + method = ofnode_read_string(dev_ofnode(dev), "method"); if (!method) { pr_warn("missing \"method\" property\n"); From 4a1f0b80adfc9465e8a3efcb884d397e5ab7f07f Mon Sep 17 00:00:00 2001 From: John Chau Date: Mon, 17 Aug 2020 15:53:01 +0800 Subject: [PATCH 090/117] cmd: fix clone coverity scan This patch fixes coverity scan MISSING_BREAK issues, and also an error on block size check. Signed-off-by: John Chau --- cmd/clone.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/clone.c b/cmd/clone.c index 97747f8f080..32473a032c1 100644 --- a/cmd/clone.c +++ b/cmd/clone.c @@ -38,7 +38,7 @@ static int do_clone(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv srcbz = srcdesc->blksz; destbz = destdesc->blksz; - if ((srcbz * (buffersize / srcbz) != buffersize) && + if ((srcbz * (buffersize / srcbz) != buffersize) || (destbz * (buffersize / destbz) != buffersize)) { printf("failed: cannot match device block sizes\n"); return 1; @@ -55,10 +55,12 @@ static int do_clone(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv switch (unit[0]) { case 'g': case 'G': - requested *= 1024; + requested *= 1024 * 1024 * 1024; + break; case 'm': case 'M': - requested *= 1024; + requested *= 1024 * 1024; + break; case 'k': case 'K': requested *= 1024; From 10f7cf5f12a8721d6c985d4de11dac4d19e0e47e Mon Sep 17 00:00:00 2001 From: Joao Marcos Costa Date: Tue, 18 Aug 2020 17:17:21 +0200 Subject: [PATCH 091/117] fs/squashfs: Add init and clean-up functions to decompression Add sqfs_decompressor_init() and sqfs_decompressor_cleanup(). These functions are called respectively in sqfs_probe() and sqfs_close(). For now, only ZSTD requires an initialization logic. ZSTD support will be added in a follow-up commit. Move squashfs_ctxt definition to sqfs_filesystem.h. This structure is passed to sqfs_decompressor_init() and sqfs_decompressor_cleanup(), so it can no longer be local to sqfs.c. Signed-off-by: Joao Marcos Costa --- fs/squashfs/sqfs.c | 15 +++++++++------ fs/squashfs/sqfs_decompressor.c | 34 ++++++++++++++++++++++++++++++--- fs/squashfs/sqfs_decompressor.h | 3 +++ fs/squashfs/sqfs_filesystem.h | 9 ++++++++- 4 files changed, 51 insertions(+), 10 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 340e5ebdb9d..598b42cd341 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -23,12 +23,6 @@ #include "sqfs_filesystem.h" #include "sqfs_utils.h" -struct squashfs_ctxt { - struct disk_partition cur_part_info; - struct blk_desc *cur_dev; - struct squashfs_super_block *sblk; -}; - static struct squashfs_ctxt ctxt; static int sqfs_disk_read(__u32 block, __u32 nr_blocks, void *buf) @@ -1023,6 +1017,14 @@ int sqfs_probe(struct blk_desc *fs_dev_desc, struct disk_partition *fs_partition ctxt.sblk = sblk; + ret = sqfs_decompressor_init(&ctxt); + + if (ret) { + ctxt.cur_dev = NULL; + free(ctxt.sblk); + return -EINVAL; + } + return 0; } @@ -1525,6 +1527,7 @@ void sqfs_close(void) { free(ctxt.sblk); ctxt.cur_dev = NULL; + sqfs_decompressor_cleanup(&ctxt); } void sqfs_closedir(struct fs_dir_stream *dirs) diff --git a/fs/squashfs/sqfs_decompressor.c b/fs/squashfs/sqfs_decompressor.c index 09ca6cf6d0c..633a8a18183 100644 --- a/fs/squashfs/sqfs_decompressor.c +++ b/fs/squashfs/sqfs_decompressor.c @@ -14,9 +14,37 @@ #endif #include "sqfs_decompressor.h" -#include "sqfs_filesystem.h" #include "sqfs_utils.h" +int sqfs_decompressor_init(struct squashfs_ctxt *ctxt) +{ + u16 comp_type = get_unaligned_le16(&ctxt->sblk->compression); + + switch (comp_type) { +#if IS_ENABLED(CONFIG_ZLIB) + case SQFS_COMP_ZLIB: + break; +#endif + default: + printf("Error: unknown compression type.\n"); + return -EINVAL; + } + + return 0; +} + +void sqfs_decompressor_cleanup(struct squashfs_ctxt *ctxt) +{ + u16 comp_type = get_unaligned_le16(&ctxt->sblk->compression); + + switch (comp_type) { +#if IS_ENABLED(CONFIG_ZLIB) + case SQFS_COMP_ZLIB: + break; +#endif + } +} + #if IS_ENABLED(CONFIG_ZLIB) static void zlib_decompression_status(int ret) { @@ -35,14 +63,14 @@ static void zlib_decompression_status(int ret) #endif int sqfs_decompress(u16 comp_type, void *dest, unsigned long *dest_len, - void *source, u32 lenp) + void *source, u32 src_len) { int ret = 0; switch (comp_type) { #if IS_ENABLED(CONFIG_ZLIB) case SQFS_COMP_ZLIB: - ret = uncompress(dest, dest_len, source, lenp); + ret = uncompress(dest, dest_len, source, src_len); if (ret) { zlib_decompression_status(ret); return -EINVAL; diff --git a/fs/squashfs/sqfs_decompressor.h b/fs/squashfs/sqfs_decompressor.h index 378965dda8e..450257e5cee 100644 --- a/fs/squashfs/sqfs_decompressor.h +++ b/fs/squashfs/sqfs_decompressor.h @@ -9,6 +9,7 @@ #define SQFS_DECOMPRESSOR_H #include +#include "sqfs_filesystem.h" #define SQFS_COMP_ZLIB 1 #define SQFS_COMP_LZMA 2 @@ -54,5 +55,7 @@ union squashfs_compression_opts { int sqfs_decompress(u16 comp_type, void *dest, unsigned long *dest_len, void *source, u32 lenp); +int sqfs_decompressor_init(struct squashfs_ctxt *ctxt); +void sqfs_decompressor_cleanup(struct squashfs_ctxt *ctxt); #endif /* SQFS_DECOMPRESSOR_H */ diff --git a/fs/squashfs/sqfs_filesystem.h b/fs/squashfs/sqfs_filesystem.h index d63e3a41adf..ff2b0b1d34e 100644 --- a/fs/squashfs/sqfs_filesystem.h +++ b/fs/squashfs/sqfs_filesystem.h @@ -9,8 +9,9 @@ #define SQFS_FILESYSTEM_H #include -#include #include +#include +#include #define SQFS_UNCOMPRESSED_DATA 0x0002 #define SQFS_MAGIC_NUMBER 0x73717368 @@ -72,6 +73,12 @@ struct squashfs_super_block { __le64 export_table_start; }; +struct squashfs_ctxt { + struct disk_partition cur_part_info; + struct blk_desc *cur_dev; + struct squashfs_super_block *sblk; +}; + struct squashfs_directory_index { u32 index; u32 start; From cdc114415cb9b326545aaaf6226ed3622e057067 Mon Sep 17 00:00:00 2001 From: Joao Marcos Costa Date: Tue, 18 Aug 2020 17:17:22 +0200 Subject: [PATCH 092/117] fs/squashfs: replace sqfs_decompress() parameter Replace 'u16 comp_type' by a reference to squashfs_ctxt structure. Signed-off-by: Joao Marcos Costa --- fs/squashfs/sqfs.c | 25 +++++++++---------------- fs/squashfs/sqfs_decompressor.c | 5 +++-- fs/squashfs/sqfs_decompressor.h | 4 ++-- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 598b42cd341..9bd7b98d88a 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -104,9 +104,7 @@ static int sqfs_frag_lookup(u32 inode_fragment_index, struct squashfs_super_block *sblk = ctxt.sblk; unsigned long dest_len; int block, offset, ret; - u16 header, comp_type; - - comp_type = get_unaligned_le16(&sblk->compression); + u16 header; if (inode_fragment_index >= get_unaligned_le32(&sblk->fragments)) return -EINVAL; @@ -165,7 +163,7 @@ static int sqfs_frag_lookup(u32 inode_fragment_index, if (SQFS_COMPRESSED_METADATA(header)) { src_len = SQFS_METADATA_SIZE(header); dest_len = SQFS_METADATA_BLOCK_SIZE; - ret = sqfs_decompress(comp_type, entries, &dest_len, metadata, + ret = sqfs_decompress(&ctxt, entries, &dest_len, metadata, src_len); if (ret) { ret = -EINVAL; @@ -629,13 +627,12 @@ static int sqfs_read_inode_table(unsigned char **inode_table) { struct squashfs_super_block *sblk = ctxt.sblk; u64 start, n_blks, table_offset, table_size; - int j, ret = 0, metablks_count, comp_type; + int j, ret = 0, metablks_count; unsigned char *src_table, *itb; u32 src_len, dest_offset = 0; unsigned long dest_len; bool compressed; - comp_type = get_unaligned_le16(&sblk->compression); table_size = get_unaligned_le64(&sblk->directory_table_start) - get_unaligned_le64(&sblk->inode_table_start); start = get_unaligned_le64(&sblk->inode_table_start) / @@ -680,7 +677,7 @@ static int sqfs_read_inode_table(unsigned char **inode_table) sqfs_read_metablock(itb, table_offset, &compressed, &src_len); if (compressed) { dest_len = SQFS_METADATA_BLOCK_SIZE; - ret = sqfs_decompress(comp_type, *inode_table + + ret = sqfs_decompress(&ctxt, *inode_table + dest_offset, &dest_len, src_table, src_len); if (ret) { @@ -711,15 +708,13 @@ free_itb: static int sqfs_read_directory_table(unsigned char **dir_table, u32 **pos_list) { u64 start, n_blks, table_offset, table_size; - int j, ret = 0, metablks_count = -1, comp_type; struct squashfs_super_block *sblk = ctxt.sblk; + int j, ret = 0, metablks_count = -1; unsigned char *src_table, *dtb; u32 src_len, dest_offset = 0; unsigned long dest_len; bool compressed; - comp_type = get_unaligned_le16(&sblk->compression); - /* DIRECTORY TABLE */ table_size = get_unaligned_le64(&sblk->fragment_table_start) - get_unaligned_le64(&sblk->directory_table_start); @@ -773,7 +768,7 @@ static int sqfs_read_directory_table(unsigned char **dir_table, u32 **pos_list) sqfs_read_metablock(dtb, table_offset, &compressed, &src_len); if (compressed) { dest_len = SQFS_METADATA_BLOCK_SIZE; - ret = sqfs_decompress(comp_type, *dir_table + + ret = sqfs_decompress(&ctxt, *dir_table + (j * SQFS_METADATA_BLOCK_SIZE), &dest_len, src_table, src_len); if (ret) { @@ -1197,7 +1192,7 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len, char *dir, *fragment_block, *datablock = NULL, *data_buffer = NULL; char *fragment, *file, *resolved, *data; u64 start, n_blks, table_size, data_offset, table_offset; - int ret, j, i_number, comp_type, datablk_count = 0; + int ret, j, i_number, datablk_count = 0; struct squashfs_super_block *sblk = ctxt.sblk; struct squashfs_fragment_block_entry frag_entry; struct squashfs_file_info finfo = {0}; @@ -1213,8 +1208,6 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len, *actread = 0; - comp_type = get_unaligned_le16(&sblk->compression); - /* * sqfs_opendir will uncompress inode and directory tables, and will * return a pointer to the directory that contains the requested file. @@ -1346,7 +1339,7 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len, /* Load the data */ if (SQFS_COMPRESSED_BLOCK(finfo.blk_sizes[j])) { dest_len = get_unaligned_le32(&sblk->block_size); - ret = sqfs_decompress(comp_type, datablock, &dest_len, + ret = sqfs_decompress(&ctxt, datablock, &dest_len, data, table_size); if (ret) goto free_buffer; @@ -1396,7 +1389,7 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len, goto free_fragment; } - ret = sqfs_decompress(comp_type, fragment_block, &dest_len, + ret = sqfs_decompress(&ctxt, fragment_block, &dest_len, (void *)fragment + table_offset, frag_entry.size); if (ret) { diff --git a/fs/squashfs/sqfs_decompressor.c b/fs/squashfs/sqfs_decompressor.c index 633a8a18183..cf388ace587 100644 --- a/fs/squashfs/sqfs_decompressor.c +++ b/fs/squashfs/sqfs_decompressor.c @@ -62,9 +62,10 @@ static void zlib_decompression_status(int ret) } #endif -int sqfs_decompress(u16 comp_type, void *dest, unsigned long *dest_len, - void *source, u32 src_len) +int sqfs_decompress(struct squashfs_ctxt *ctxt, void *dest, + unsigned long *dest_len, void *source, u32 src_len) { + u16 comp_type = get_unaligned_le16(&ctxt->sblk->compression); int ret = 0; switch (comp_type) { diff --git a/fs/squashfs/sqfs_decompressor.h b/fs/squashfs/sqfs_decompressor.h index 450257e5cee..892cfb69744 100644 --- a/fs/squashfs/sqfs_decompressor.h +++ b/fs/squashfs/sqfs_decompressor.h @@ -53,8 +53,8 @@ union squashfs_compression_opts { struct squashfs_lzo_opts *lzo; }; -int sqfs_decompress(u16 comp_type, void *dest, unsigned long *dest_len, - void *source, u32 lenp); +int sqfs_decompress(struct squashfs_ctxt *ctxt, void *dest, + unsigned long *dest_len, void *source, u32 src_len); int sqfs_decompressor_init(struct squashfs_ctxt *ctxt); void sqfs_decompressor_cleanup(struct squashfs_ctxt *ctxt); From 9c948f536fec115b590760c2e9e333945dfde990 Mon Sep 17 00:00:00 2001 From: Joao Marcos Costa Date: Tue, 18 Aug 2020 17:17:23 +0200 Subject: [PATCH 093/117] fs/squashfs: add support for ZSTD decompression Add call to ZSTD's ZSTD_decompressDCtx(). In this use case, the caller can upper bound the decompressed size, which will be the SquashFS data block (or metadata block) size, so there is no need to use streaming API. Add ZSTD's worskpace to squashfs_ctxt structure. Signed-off-by: Joao Marcos Costa --- fs/squashfs/sqfs_decompressor.c | 42 +++++++++++++++++++++++++++++++++ fs/squashfs/sqfs_filesystem.h | 3 +++ 2 files changed, 45 insertions(+) diff --git a/fs/squashfs/sqfs_decompressor.c b/fs/squashfs/sqfs_decompressor.c index cf388ace587..9457ee5f0f9 100644 --- a/fs/squashfs/sqfs_decompressor.c +++ b/fs/squashfs/sqfs_decompressor.c @@ -13,6 +13,10 @@ #include #endif +#if IS_ENABLED(CONFIG_ZSTD) +#include +#endif + #include "sqfs_decompressor.h" #include "sqfs_utils.h" @@ -24,6 +28,13 @@ int sqfs_decompressor_init(struct squashfs_ctxt *ctxt) #if IS_ENABLED(CONFIG_ZLIB) case SQFS_COMP_ZLIB: break; +#endif +#if IS_ENABLED(CONFIG_ZSTD) + case SQFS_COMP_ZSTD: + ctxt->zstd_workspace = malloc(ZSTD_DCtxWorkspaceBound()); + if (!ctxt->zstd_workspace) + return -ENOMEM; + break; #endif default: printf("Error: unknown compression type.\n"); @@ -41,6 +52,11 @@ void sqfs_decompressor_cleanup(struct squashfs_ctxt *ctxt) #if IS_ENABLED(CONFIG_ZLIB) case SQFS_COMP_ZLIB: break; +#endif +#if IS_ENABLED(CONFIG_ZSTD) + case SQFS_COMP_ZSTD: + free(ctxt->zstd_workspace); + break; #endif } } @@ -62,6 +78,22 @@ static void zlib_decompression_status(int ret) } #endif +#if IS_ENABLED(CONFIG_ZSTD) +static int sqfs_zstd_decompress(struct squashfs_ctxt *ctxt, void *dest, + unsigned long dest_len, void *source, u32 src_len) +{ + ZSTD_DCtx *ctx; + size_t wsize; + int ret; + + wsize = ZSTD_DCtxWorkspaceBound(); + ctx = ZSTD_initDCtx(ctxt->zstd_workspace, wsize); + ret = ZSTD_decompressDCtx(ctx, dest, dest_len, source, src_len); + + return ZSTD_isError(ret); +} +#endif /* CONFIG_ZSTD */ + int sqfs_decompress(struct squashfs_ctxt *ctxt, void *dest, unsigned long *dest_len, void *source, u32 src_len) { @@ -79,6 +111,16 @@ int sqfs_decompress(struct squashfs_ctxt *ctxt, void *dest, break; #endif +#if IS_ENABLED(CONFIG_ZSTD) + case SQFS_COMP_ZSTD: + ret = sqfs_zstd_decompress(ctxt, dest, *dest_len, source, src_len); + if (ret) { + printf("ZSTD Error code: %d\n", ZSTD_getErrorCode(ret)); + return -EINVAL; + } + + break; +#endif default: printf("Error: unknown compression type.\n"); return -EINVAL; diff --git a/fs/squashfs/sqfs_filesystem.h b/fs/squashfs/sqfs_filesystem.h index ff2b0b1d34e..856cd15e349 100644 --- a/fs/squashfs/sqfs_filesystem.h +++ b/fs/squashfs/sqfs_filesystem.h @@ -77,6 +77,9 @@ struct squashfs_ctxt { struct disk_partition cur_part_info; struct blk_desc *cur_dev; struct squashfs_super_block *sblk; +#if IS_ENABLED(CONFIG_ZSTD) + void *zstd_workspace; +#endif }; struct squashfs_directory_index { From 6dfed163bd842bf98fd17875067bf8643819a879 Mon Sep 17 00:00:00 2001 From: Joao Marcos Costa Date: Tue, 18 Aug 2020 17:17:24 +0200 Subject: [PATCH 094/117] fs/squashfs: add support for LZO decompression Add call to lzo's lzo1x_decompress_safe() into sqfs_decompress(). U-Boot's LZO sources may still have some unsolved issues that could make the decompression crash when dealing with fragmented files, so those should be avoided. The "-no-fragments" option can be passed to mksquashfs. Signed-off-by: Joao Marcos Costa --- fs/squashfs/sqfs_decompressor.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/fs/squashfs/sqfs_decompressor.c b/fs/squashfs/sqfs_decompressor.c index 9457ee5f0f9..d69ddb24a41 100644 --- a/fs/squashfs/sqfs_decompressor.c +++ b/fs/squashfs/sqfs_decompressor.c @@ -9,6 +9,11 @@ #include #include #include + +#if IS_ENABLED(CONFIG_LZO) +#include +#endif + #if IS_ENABLED(CONFIG_ZLIB) #include #endif @@ -25,6 +30,10 @@ int sqfs_decompressor_init(struct squashfs_ctxt *ctxt) u16 comp_type = get_unaligned_le16(&ctxt->sblk->compression); switch (comp_type) { +#if IS_ENABLED(CONFIG_LZO) + case SQFS_COMP_LZO: + break; +#endif #if IS_ENABLED(CONFIG_ZLIB) case SQFS_COMP_ZLIB: break; @@ -49,6 +58,10 @@ void sqfs_decompressor_cleanup(struct squashfs_ctxt *ctxt) u16 comp_type = get_unaligned_le16(&ctxt->sblk->compression); switch (comp_type) { +#if IS_ENABLED(CONFIG_LZO) + case SQFS_COMP_LZO: + break; +#endif #if IS_ENABLED(CONFIG_ZLIB) case SQFS_COMP_ZLIB: break; @@ -101,6 +114,18 @@ int sqfs_decompress(struct squashfs_ctxt *ctxt, void *dest, int ret = 0; switch (comp_type) { +#if IS_ENABLED(CONFIG_LZO) + case SQFS_COMP_LZO: { + size_t lzo_dest_len = *dest_len; + ret = lzo1x_decompress_safe(source, src_len, dest, &lzo_dest_len); + if (ret) { + printf("LZO decompression failed. Error code: %d\n", ret); + return -EINVAL; + } + + break; + } +#endif #if IS_ENABLED(CONFIG_ZLIB) case SQFS_COMP_ZLIB: ret = uncompress(dest, dest_len, source, src_len); From 91f6c1ca2e4400f30b5faee04f1dd9001abd326f Mon Sep 17 00:00:00 2001 From: Joao Marcos Costa Date: Tue, 18 Aug 2020 17:17:25 +0200 Subject: [PATCH 095/117] test/py: Add tests for LZO and ZSTD Improve SquashFS tests architecture. Add 'Compression' class. LZO algorithm may crash if the file is fragmented, so the fragments are disabled when testing LZO. Signed-off-by: Joao Marcos Costa --- .../test_fs/test_squashfs/sqfs_common.py | 74 ++++++++++++++----- .../test_fs/test_squashfs/test_sqfs_load.py | 40 ++++++---- .../test_fs/test_squashfs/test_sqfs_ls.py | 33 ++++++--- 3 files changed, 101 insertions(+), 46 deletions(-) diff --git a/test/py/tests/test_fs/test_squashfs/sqfs_common.py b/test/py/tests/test_fs/test_squashfs/sqfs_common.py index 2dc344d1b24..c96f92c1d8f 100644 --- a/test/py/tests/test_fs/test_squashfs/sqfs_common.py +++ b/test/py/tests/test_fs/test_squashfs/sqfs_common.py @@ -5,6 +5,7 @@ import os import random import string +import subprocess def sqfs_get_random_letters(size): letters = [] @@ -19,24 +20,57 @@ def sqfs_generate_file(path, size): file.write(content) file.close() -# generate image with three files and a symbolic link -def sqfs_generate_image(cons): - src = os.path.join(cons.config.build_dir, "sqfs_src/") - dest = os.path.join(cons.config.build_dir, "sqfs") - os.mkdir(src) - sqfs_generate_file(src + "frag_only", 100) - sqfs_generate_file(src + "blks_frag", 5100) - sqfs_generate_file(src + "blks_only", 4096) - os.symlink("frag_only", src + "sym") - os.system("mksquashfs " + src + " " + dest + " -b 4096 -always-use-fragments") +class Compression: + def __init__(self, name, files, sizes, block_size = 4096): + self.name = name + self.files = files + self.sizes = sizes + self.mksquashfs_opts = " -b " + str(block_size) + " -comp " + self.name -# removes all files created by sqfs_generate_image() -def sqfs_clean(cons): - src = os.path.join(cons.config.build_dir, "sqfs_src/") - dest = os.path.join(cons.config.build_dir, "sqfs") - os.remove(src + "frag_only") - os.remove(src + "blks_frag") - os.remove(src + "blks_only") - os.remove(src + "sym") - os.rmdir(src) - os.remove(dest) + def add_opt(self, opt): + self.mksquashfs_opts += " " + opt + + def gen_image(self, build_dir): + src = os.path.join(build_dir, "sqfs_src/") + os.mkdir(src) + for (f, s) in zip(self.files, self.sizes): + sqfs_generate_file(src + f, s) + + # the symbolic link always targets the first file + os.symlink(self.files[0], src + "sym") + + sqfs_img = os.path.join(build_dir, "sqfs-" + self.name) + i_o = src + " " + sqfs_img + opts = self.mksquashfs_opts + try: + subprocess.run(["mksquashfs " + i_o + opts], shell = True, check = True) + except: + print("mksquashfs error. Compression type: " + self.name) + raise RuntimeError + + def clean_source(self, build_dir): + src = os.path.join(build_dir, "sqfs_src/") + for f in self.files: + os.remove(src + f) + os.remove(src + "sym") + os.rmdir(src) + + def cleanup(self, build_dir): + self.clean_source(build_dir) + sqfs_img = os.path.join(build_dir, "sqfs-" + self.name) + os.remove(sqfs_img) + +files = ["blks_only", "blks_frag", "frag_only"] +sizes = [4096, 5100, 100] +gzip = Compression("gzip", files, sizes) +zstd = Compression("zstd", files, sizes) +lzo = Compression("lzo", files, sizes) + +# use fragment blocks for files larger than block_size +gzip.add_opt("-always-use-fragments") +zstd.add_opt("-always-use-fragments") + +# avoid fragments if lzo is used +lzo.add_opt("-no-fragments") + +comp_opts = [gzip, zstd, lzo] diff --git a/test/py/tests/test_fs/test_squashfs/test_sqfs_load.py b/test/py/tests/test_fs/test_squashfs/test_sqfs_load.py index eb1baae5c52..9e900623846 100644 --- a/test/py/tests/test_fs/test_squashfs/test_sqfs_load.py +++ b/test/py/tests/test_fs/test_squashfs/test_sqfs_load.py @@ -12,23 +12,35 @@ from sqfs_common import * @pytest.mark.buildconfigspec('fs_squashfs') @pytest.mark.requiredtool('mksquashfs') def test_sqfs_load(u_boot_console): - cons = u_boot_console - sqfs_generate_image(cons) + build_dir = u_boot_console.config.build_dir command = "sqfsload host 0 $kernel_addr_r " - path = os.path.join(cons.config.build_dir, "sqfs") - try: + for opt in comp_opts: + # generate and load the squashfs image + try: + opt.gen_image(build_dir) + except RuntimeError: + opt.clean_source(build_dir) + # skip unsupported compression types + continue + + path = os.path.join(build_dir, "sqfs-" + opt.name) output = u_boot_console.run_command("host bind 0 " + path) + output = u_boot_console.run_command(command + "xxx") assert "File not found." in output - output = u_boot_console.run_command(command + "frag_only") - assert "100 bytes read in" in output - output = u_boot_console.run_command(command + "blks_frag") - assert "5100 bytes read in" in output - output = u_boot_console.run_command(command + "blks_only") - assert "4096 bytes read in" in output + + for (f, s) in zip(opt.files, opt.sizes): + try: + output = u_boot_console.run_command(command + f) + assert str(s) in output + except: + assert False + opt.cleanup(build_dir) + + # test symbolic link output = u_boot_console.run_command(command + "sym") - assert "100 bytes read in" in output - except: - sqfs_clean(cons) - sqfs_clean(cons) + assert str(opt.sizes[0]) in output + + # remove generated files + opt.cleanup(build_dir) diff --git a/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py b/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py index 3a7b75c778f..a0dca2e2fc8 100644 --- a/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py +++ b/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py @@ -12,16 +12,25 @@ from sqfs_common import * @pytest.mark.buildconfigspec('fs_squashfs') @pytest.mark.requiredtool('mksquashfs') def test_sqfs_ls(u_boot_console): - cons = u_boot_console - sqfs_generate_image(cons) - path = os.path.join(cons.config.build_dir, "sqfs") - try: + build_dir = u_boot_console.config.build_dir + for opt in comp_opts: + try: + opt.gen_image(build_dir) + except RuntimeError: + opt.clean_source(build_dir) + # skip unsupported compression types + continue + path = os.path.join(build_dir, "sqfs-" + opt.name) output = u_boot_console.run_command("host bind 0 " + path) - output = u_boot_console.run_command("sqfsls host 0") - assert "4 file(s), 0 dir(s)" in output - assert " sym" in output - output = u_boot_console.run_command("sqfsls host 0 xxx") - assert "** Cannot find directory. **" in output - except: - sqfs_clean(cons) - sqfs_clean(cons) + + try: + # list files in root directory + output = u_boot_console.run_command("sqfsls host 0") + assert str(len(opt.files) + 1) + " file(s), 0 dir(s)" in output + assert " sym" in output + output = u_boot_console.run_command("sqfsls host 0 xxx") + assert "** Cannot find directory. **" in output + except: + opt.cleanup(build_dir) + assert False + opt.cleanup(build_dir) From 6b0ddd1fbc6c8f7cbd0418e8a87d02404ad3dd9b Mon Sep 17 00:00:00 2001 From: AKASHI Takahiro Date: Wed, 19 Aug 2020 18:07:32 +0900 Subject: [PATCH 096/117] virtio_blk: set log2blksz correctly 'log2blksz' in blk_desc structure must always be initialized, otherwise it will cause a lot of weird failures in file operations. For example, fs_set_blk_dev[_with_part]() examines a block device against every file system with its probe function. In particular, ext4 file system's ext4_probe() will calls fs_devread() to fetch a super block. If log2blksz is 0, the actual 'read' size, i.e. block_len >> log2blksz, is much bigger than a buffer's size, and it can end up with memory corruption. Signed-off-by: AKASHI Takahiro Fixes: f4802209e59d ("virtio: Add block driver support") Reviewed-by: Bin Meng --- drivers/virtio/virtio_blk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/virtio/virtio_blk.c b/drivers/virtio/virtio_blk.c index 992118c6075..1799f5c5eb3 100644 --- a/drivers/virtio/virtio_blk.c +++ b/drivers/virtio/virtio_blk.c @@ -115,6 +115,7 @@ static int virtio_blk_probe(struct udevice *dev) return ret; desc->blksz = 512; + desc->log2blksz = 9; virtio_cread(dev, struct virtio_blk_config, capacity, &cap); desc->lba = cap; From c9875a5fe85901b272c8e7db1b9bce513f02f1af Mon Sep 17 00:00:00 2001 From: Joao Marcos Costa Date: Wed, 19 Aug 2020 18:28:41 +0200 Subject: [PATCH 097/117] fs/squashfs: Fix Coverity Scan defects Fix defects such as uninitialized variables and untrusted pointer operations. Most part of the tainted variables and the related defects actually comes from Linux's macro get_unaligned_le**, extensively used in SquashFS code. Add sanity checks for those variables. Signed-off-by: Joao Marcos Costa --- fs/squashfs/sqfs.c | 40 +++++++++++++++++++++++++++++----------- fs/squashfs/sqfs_dir.c | 3 +++ fs/squashfs/sqfs_inode.c | 5 ++++- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 9bd7b98d88a..f67f7c4a40a 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -154,6 +154,11 @@ static int sqfs_frag_lookup(u32 inode_fragment_index, header = get_unaligned_le16(metadata_buffer + table_offset); metadata = metadata_buffer + table_offset + SQFS_HEADER_SIZE; + if (!metadata) { + ret = -ENOMEM; + goto free_buffer; + } + entries = malloc(SQFS_METADATA_BLOCK_SIZE); if (!entries) { ret = -ENOMEM; @@ -272,8 +277,8 @@ static int sqfs_join(char **strings, char *dest, int start, int end, */ static int sqfs_tokenize(char **tokens, int count, const char *str) { + int i, j, ret = 0; char *aux, *strc; - int i, j; strc = strdup(str); if (!strc) @@ -282,8 +287,8 @@ static int sqfs_tokenize(char **tokens, int count, const char *str) if (!strcmp(strc, "/")) { tokens[0] = strdup(strc); if (!tokens[0]) { - free(strc); - return -ENOMEM; + ret = -ENOMEM; + goto free_strc; } } else { for (j = 0; j < count; j++) { @@ -292,15 +297,16 @@ static int sqfs_tokenize(char **tokens, int count, const char *str) if (!tokens[j]) { for (i = 0; i < j; i++) free(tokens[i]); - free(strc); - return -ENOMEM; + ret = -ENOMEM; + goto free_strc; } } } +free_strc: free(strc); - return 0; + return ret; } /* @@ -428,9 +434,9 @@ static int sqfs_search_dir(struct squashfs_dir_stream *dirs, char **token_list, { struct squashfs_super_block *sblk = ctxt.sblk; char *path, *target, **sym_tokens, *res, *rem; + struct squashfs_ldir_inode *ldir = NULL; int j, ret, new_inode_number, offset; struct squashfs_symlink_inode *sym; - struct squashfs_ldir_inode *ldir; struct squashfs_dir_inode *dir; struct fs_dir_stream *dirsp; struct fs_dirent *dent; @@ -630,7 +636,7 @@ static int sqfs_read_inode_table(unsigned char **inode_table) int j, ret = 0, metablks_count; unsigned char *src_table, *itb; u32 src_len, dest_offset = 0; - unsigned long dest_len; + unsigned long dest_len = 0; bool compressed; table_size = get_unaligned_le64(&sblk->directory_table_start) - @@ -685,6 +691,7 @@ static int sqfs_read_inode_table(unsigned char **inode_table) goto free_itb; } + dest_offset += dest_len; } else { memcpy(*inode_table + (j * SQFS_METADATA_BLOCK_SIZE), src_table, src_len); @@ -694,7 +701,7 @@ static int sqfs_read_inode_table(unsigned char **inode_table) * Offsets to the decompression destination, to the metadata * buffer 'itb' and to the decompression source, respectively. */ - dest_offset += dest_len; + table_offset += src_len + SQFS_HEADER_SIZE; src_table += src_len + SQFS_HEADER_SIZE; } @@ -712,7 +719,7 @@ static int sqfs_read_directory_table(unsigned char **dir_table, u32 **pos_list) int j, ret = 0, metablks_count = -1; unsigned char *src_table, *dtb; u32 src_len, dest_offset = 0; - unsigned long dest_len; + unsigned long dest_len = 0; bool compressed; /* DIRECTORY TABLE */ @@ -781,6 +788,8 @@ static int sqfs_read_directory_table(unsigned char **dir_table, u32 **pos_list) dest_offset += dest_len; break; } + + dest_offset += dest_len; } else { memcpy(*dir_table + (j * SQFS_METADATA_BLOCK_SIZE), src_table, src_len); @@ -790,7 +799,6 @@ static int sqfs_read_directory_table(unsigned char **dir_table, u32 **pos_list) * Offsets to the decompression destination, to the metadata * buffer 'dtb' and to the decompression source, respectively. */ - dest_offset += dest_len; table_offset += src_len + SQFS_HEADER_SIZE; src_table += src_len + SQFS_HEADER_SIZE; } @@ -1138,6 +1146,9 @@ static int sqfs_get_regfile_info(struct squashfs_reg_inode *reg, finfo->start = get_unaligned_le32(®->start_block); finfo->frag = SQFS_IS_FRAGMENTED(get_unaligned_le32(®->fragment)); + if (finfo->size < 1 || finfo->offset < 0 || finfo->start < 0) + return -EINVAL; + if (finfo->frag) { datablk_count = finfo->size / le32_to_cpu(blksz); ret = sqfs_frag_lookup(get_unaligned_le32(®->fragment), @@ -1145,6 +1156,8 @@ static int sqfs_get_regfile_info(struct squashfs_reg_inode *reg, if (ret < 0) return -EINVAL; finfo->comp = true; + if (fentry->size < 1 || fentry->start < 0) + return -EINVAL; } else { datablk_count = DIV_ROUND_UP(finfo->size, le32_to_cpu(blksz)); } @@ -1168,6 +1181,9 @@ static int sqfs_get_lregfile_info(struct squashfs_lreg_inode *lreg, finfo->start = get_unaligned_le64(&lreg->start_block); finfo->frag = SQFS_IS_FRAGMENTED(get_unaligned_le32(&lreg->fragment)); + if (finfo->size < 1 || finfo->offset < 0 || finfo->start < 0) + return -EINVAL; + if (finfo->frag) { datablk_count = finfo->size / le32_to_cpu(blksz); ret = sqfs_frag_lookup(get_unaligned_le32(&lreg->fragment), @@ -1175,6 +1191,8 @@ static int sqfs_get_lregfile_info(struct squashfs_lreg_inode *lreg, if (ret < 0) return -EINVAL; finfo->comp = true; + if (fentry->size < 1 || fentry->start < 0) + return -EINVAL; } else { datablk_count = DIV_ROUND_UP(finfo->size, le32_to_cpu(blksz)); } diff --git a/fs/squashfs/sqfs_dir.c b/fs/squashfs/sqfs_dir.c index 5f7660aeae8..00d2891e7da 100644 --- a/fs/squashfs/sqfs_dir.c +++ b/fs/squashfs/sqfs_dir.c @@ -53,6 +53,9 @@ int sqfs_dir_offset(void *dir_i, u32 *m_list, int m_count) return -EINVAL; } + if (offset < 0) + return -EINVAL; + for (j = 0; j < m_count; j++) { if (m_list[j] == start_block) return (++j * SQFS_METADATA_BLOCK_SIZE) + offset; diff --git a/fs/squashfs/sqfs_inode.c b/fs/squashfs/sqfs_inode.c index b037a9b2ac2..1387779a85f 100644 --- a/fs/squashfs/sqfs_inode.c +++ b/fs/squashfs/sqfs_inode.c @@ -138,11 +138,14 @@ void *sqfs_find_inode(void *inode_table, int inode_number, __le32 inode_count, int sqfs_read_metablock(unsigned char *file_mapping, int offset, bool *compressed, u32 *data_size) { - unsigned char *data; + const unsigned char *data; u16 header; data = file_mapping + offset; header = get_unaligned((u16 *)data); + if (!header || !data) + return -EINVAL; + *compressed = SQFS_COMPRESSED_METADATA(header); *data_size = SQFS_METADATA_SIZE(header); From 626892a779addb9604387ece522e3410d3ef3aa5 Mon Sep 17 00:00:00 2001 From: Frank Wunderlich Date: Thu, 20 Aug 2020 16:37:52 +0200 Subject: [PATCH 098/117] phy: mtk-tphy: make shared reg optional for v1 make the shared reg optional when version is v1 for sata Suggested-by: Chunfeng Yun Signed-off-by: Frank Wunderlich Reviewed-by: Chunfeng Yun --- drivers/phy/phy-mtk-tphy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/phy/phy-mtk-tphy.c b/drivers/phy/phy-mtk-tphy.c index 326227a30dd..3d7b9cd2b12 100644 --- a/drivers/phy/phy-mtk-tphy.c +++ b/drivers/phy/phy-mtk-tphy.c @@ -698,11 +698,10 @@ static int mtk_tphy_probe(struct udevice *dev) tphy->dev = dev; tphy->version = dev_get_driver_data(dev); - /* v1 has shared banks */ + /* v1 has shared banks for usb/pcie mode, */ + /* but not for sata mode */ if (tphy->version == MTK_TPHY_V1) { tphy->sif_base = dev_read_addr_ptr(dev); - if (!tphy->sif_base) - return -ENOENT; } dev_for_each_subnode(subnode, dev) { From a300d696caee9e97da5a0b835451d27c98e07f8f Mon Sep 17 00:00:00 2001 From: Frank Wunderlich Date: Thu, 20 Aug 2020 16:37:53 +0200 Subject: [PATCH 099/117] reset: drop unnecessary comment for pciesys after review from sam this comment should be removed Signed-off-by: Frank Wunderlich --- drivers/clk/mediatek/clk-mt7622.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/clk/mediatek/clk-mt7622.c b/drivers/clk/mediatek/clk-mt7622.c index d53ed691892..a1a35f72a33 100644 --- a/drivers/clk/mediatek/clk-mt7622.c +++ b/drivers/clk/mediatek/clk-mt7622.c @@ -599,7 +599,6 @@ static int mt7622_pciesys_bind(struct udevice *dev) int ret = 0; if (IS_ENABLED(CONFIG_RESET_MEDIATEK)) { -// PCIESYS uses in linux also 0x34 = ETHSYS reset controller ret = mediatek_reset_bind(dev, ETHSYS_HIFSYS_RST_CTRL_OFS, 1); if (ret) debug("Warning: failed to bind reset controller\n"); From a7e0ef15ddee2751110766e2abc010d2ec9325f8 Mon Sep 17 00:00:00 2001 From: Frank Wunderlich Date: Thu, 20 Aug 2020 16:37:54 +0200 Subject: [PATCH 100/117] ahci: mediatek: fix copyright and author-lines after review of sam copyright should be on one line and link should not between author lines just remove the link and put ryder first as he is author of linux-driver Signed-off-by: Frank Wunderlich --- drivers/ata/mtk_ahci.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/ata/mtk_ahci.c b/drivers/ata/mtk_ahci.c index 8e09c5f9e63..4ad260a5bb9 100644 --- a/drivers/ata/mtk_ahci.c +++ b/drivers/ata/mtk_ahci.c @@ -2,12 +2,10 @@ /* * MTK SATA platform driver * - * (C) Copyright 2020 - * Mediatek + * Copyright (C) 2020 MediaTek Inc. * - * Author: Frank Wunderlich - * based on https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/ata/ahci_mtk.c * Author: Ryder Lee + * Author: Frank Wunderlich */ #include From 9f25aa13ea2f106885ea52a1039b9c6e7a677a35 Mon Sep 17 00:00:00 2001 From: Frank Wunderlich Date: Thu, 20 Aug 2020 16:37:55 +0200 Subject: [PATCH 101/117] clk: mt7622: add needed clocks for ssusb-node MT7622 needs additional clock definitions to work properly Signed-off-by: Frank Wunderlich --- drivers/clk/mediatek/clk-mt7622.c | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/drivers/clk/mediatek/clk-mt7622.c b/drivers/clk/mediatek/clk-mt7622.c index a1a35f72a33..02461491078 100644 --- a/drivers/clk/mediatek/clk-mt7622.c +++ b/drivers/clk/mediatek/clk-mt7622.c @@ -521,6 +521,20 @@ static const struct mtk_gate_regs sgmii_cg_regs = { .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \ } +static const struct mtk_gate_regs ssusb_cg_regs = { + .set_ofs = 0x30, + .clr_ofs = 0x30, + .sta_ofs = 0x30, +}; + +#define GATE_SSUSB(_id, _parent, _shift) { \ + .id = _id, \ + .parent = _parent, \ + .regs = &ssusb_cg_regs, \ + .shift = _shift, \ + .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \ +} + static const struct mtk_gate sgmii_cgs[] = { GATE_SGMII(CLK_SGMII_TX250M_EN, CLK_TOP_SSUSB_TX250M, 2), GATE_SGMII(CLK_SGMII_RX250M_EN, CLK_TOP_SSUSB_EQ_RX250M, 3), @@ -528,6 +542,15 @@ static const struct mtk_gate sgmii_cgs[] = { GATE_SGMII(CLK_SGMII_CDR_FB, CLK_TOP_SSUSB_CDR_FB, 5), }; +static const struct mtk_gate ssusb_cgs[] = { + GATE_SSUSB(CLK_SSUSB_U2_PHY_1P_EN, CLK_TOP_TO_U2_PHY_1P, 0), + GATE_SSUSB(CLK_SSUSB_U2_PHY_EN, CLK_TOP_TO_U2_PHY, 1), + GATE_SSUSB(CLK_SSUSB_REF_EN, CLK_TOP_TO_USB3_REF, 5), + GATE_SSUSB(CLK_SSUSB_SYS_EN, CLK_TOP_TO_USB3_SYS, 6), + GATE_SSUSB(CLK_SSUSB_MCU_EN, CLK_TOP_AXI_SEL, 7), + GATE_SSUSB(CLK_SSUSB_DMA_EN, CLK_TOP_HIF_SEL, 8), +}; + static const struct mtk_clk_tree mt7622_clk_tree = { .xtal_rate = 25 * MHZ, .xtal2_rate = 25 * MHZ, @@ -630,6 +653,11 @@ static int mt7622_sgmiisys_probe(struct udevice *dev) return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, sgmii_cgs); } +static int mt7622_ssusbsys_probe(struct udevice *dev) +{ + return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, ssusb_cgs); +} + static const struct udevice_id mt7622_apmixed_compat[] = { { .compatible = "mediatek,mt7622-apmixedsys" }, { } @@ -670,6 +698,11 @@ static const struct udevice_id mt7622_mcucfg_compat[] = { { } }; +static const struct udevice_id mt7622_ssusbsys_compat[] = { + { .compatible = "mediatek,mt7622-ssusbsys" }, + { } +}; + U_BOOT_DRIVER(mtk_mcucfg) = { .name = "mt7622-mcucfg", .id = UCLASS_SYSCON, @@ -746,3 +779,12 @@ U_BOOT_DRIVER(mtk_clk_sgmiisys) = { .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, }; + +U_BOOT_DRIVER(mtk_clk_ssusbsys) = { + .name = "mt7622-clock-ssusbsys", + .id = UCLASS_CLK, + .of_match = mt7622_ssusbsys_compat, + .probe = mt7622_ssusbsys_probe, + .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .ops = &mtk_clk_gate_ops, +}; From 28e1b1df3bccc0fd47e9c2a2b058c0680b930e23 Mon Sep 17 00:00:00 2001 From: Frank Wunderlich Date: Thu, 20 Aug 2020 16:37:56 +0200 Subject: [PATCH 102/117] arm: dts: rename mt7622-bpi-r64.dts rename mt7622-bpi-r64.dts to mt7622-bananapi-bpi-r64.dts to follow naming convensions Signed-off-by: Frank Wunderlich --- arch/arm/dts/Makefile | 2 +- .../arm/dts/{mt7622-bpi-r64.dts => mt7622-bananapi-bpi-r64.dts} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename arch/arm/dts/{mt7622-bpi-r64.dts => mt7622-bananapi-bpi-r64.dts} (100%) diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 4bdfdf123d6..f8f529435bf 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -962,7 +962,7 @@ dtb-$(CONFIG_SOC_K3_J721E) += k3-j721e-common-proc-board.dtb \ dtb-$(CONFIG_ARCH_MEDIATEK) += \ mt7622-rfb.dtb \ mt7623a-unielec-u7623-02-emmc.dtb \ - mt7622-bpi-r64.dtb \ + mt7622-bananapi-bpi-r64.dtb \ mt7623n-bananapi-bpi-r2.dtb \ mt7629-rfb.dtb \ mt8512-bm1-emmc.dtb \ diff --git a/arch/arm/dts/mt7622-bpi-r64.dts b/arch/arm/dts/mt7622-bananapi-bpi-r64.dts similarity index 100% rename from arch/arm/dts/mt7622-bpi-r64.dts rename to arch/arm/dts/mt7622-bananapi-bpi-r64.dts From a13666b20598a77931c6d9642ba9e8870d85e797 Mon Sep 17 00:00:00 2001 From: Frank Wunderlich Date: Thu, 20 Aug 2020 16:37:57 +0200 Subject: [PATCH 103/117] arm: dts: mt7622: add USB nodes Add DTS nodes for MT7622/BPI-R64 Signed-off-by: Frank Wunderlich Reviewed-by: Chunfeng Yun --- arch/arm/dts/mt7622-bananapi-bpi-r64.dts | 8 ++++ arch/arm/dts/mt7622-rfb.dts | 8 ++++ arch/arm/dts/mt7622.dtsi | 56 ++++++++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/arch/arm/dts/mt7622-bananapi-bpi-r64.dts b/arch/arm/dts/mt7622-bananapi-bpi-r64.dts index 51287cea3ac..4f2f04851d1 100644 --- a/arch/arm/dts/mt7622-bananapi-bpi-r64.dts +++ b/arch/arm/dts/mt7622-bananapi-bpi-r64.dts @@ -244,3 +244,11 @@ output-low; }; }; + +&ssusb { + status = "okay"; +}; + +&u3phy { + status = "okay"; +}; diff --git a/arch/arm/dts/mt7622-rfb.dts b/arch/arm/dts/mt7622-rfb.dts index 317fc78abda..ef7d0f0270e 100644 --- a/arch/arm/dts/mt7622-rfb.dts +++ b/arch/arm/dts/mt7622-rfb.dts @@ -222,3 +222,11 @@ full-duplex; }; }; + +&ssusb { + status = "okay"; +}; + +&u3phy { + status = "okay"; +}; diff --git a/arch/arm/dts/mt7622.dtsi b/arch/arm/dts/mt7622.dtsi index c43ad657029..d8885458091 100644 --- a/arch/arm/dts/mt7622.dtsi +++ b/arch/arm/dts/mt7622.dtsi @@ -192,6 +192,14 @@ status = "disabled"; }; + ssusbsys: ssusbsys@1a000000 { + compatible = "mediatek,mt7622-ssusbsys", + "syscon"; + reg = <0x1a000000 0x1000>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + pciesys: pciesys@1a100800 { compatible = "mediatek,mt7622-pciesys", "syscon"; reg = <0x1a100800 0x1000>; @@ -302,6 +310,54 @@ }; }; + ssusb: usb@1a0c0000 { + compatible = "mediatek,mt7622-xhci", + "mediatek,mtk-xhci"; + reg = <0x1a0c0000 0x01000>, + <0x1a0c4700 0x0100>; + reg-names = "mac", "ippc"; + interrupts = ; + power-domains = <&scpsys MT7629_POWER_DOMAIN_HIF1>; + clocks = <&ssusbsys CLK_SSUSB_SYS_EN>, + <&ssusbsys CLK_SSUSB_REF_EN>, + <&ssusbsys CLK_SSUSB_MCU_EN>, + <&ssusbsys CLK_SSUSB_DMA_EN>; + clock-names = "sys_ck", "ref_ck", "mcu_ck", "dma_ck"; + phys = <&u2port0 PHY_TYPE_USB2>, + <&u3port0 PHY_TYPE_USB3>, + <&u2port1 PHY_TYPE_USB2>; + status = "disabled"; + }; + + u3phy: usb-phy@1a0c4000 { + compatible = "mediatek,mt7622-u3phy", + "mediatek,generic-tphy-v1"; + reg = <0x1a0c4000 0x700>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + status = "disabled"; + + u2port0: usb-phy@1a0c4800 { + reg = <0x1a0c4800 0x0100>; + #phy-cells = <1>; + clocks = <&ssusbsys CLK_SSUSB_U2_PHY_EN>; + clock-names = "ref"; + }; + + u3port0: usb-phy@1a0c4900 { + reg = <0x1a0c4900 0x0700>; + #phy-cells = <1>; + }; + + u2port1: usb-phy@1a0c5000 { + reg = <0x1a0c5000 0x0100>; + #phy-cells = <1>; + clocks = <&ssusbsys CLK_SSUSB_U2_PHY_1P_EN>; + clock-names = "ref"; + }; + }; + ethsys: syscon@1b000000 { compatible = "mediatek,mt7622-ethsys", "syscon"; reg = <0x1b000000 0x1000>; From 35051db978b5f9ecd773601e5e596dbe092ab8d1 Mon Sep 17 00:00:00 2001 From: Frank Wunderlich Date: Thu, 20 Aug 2020 16:37:58 +0200 Subject: [PATCH 104/117] arm: dts: mt7623: add USB nodes This adds USB nodes for MT7623/BPI-R2 Signed-off-by: Frank Wunderlich Reviewed-by: Chunfeng Yun --- arch/arm/dts/mt7623.dtsi | 46 ++++++++++++++++++++++++ arch/arm/dts/mt7623n-bananapi-bpi-r2.dts | 16 +++++++++ 2 files changed, 62 insertions(+) diff --git a/arch/arm/dts/mt7623.dtsi b/arch/arm/dts/mt7623.dtsi index 0452889ef80..b5a802552b1 100644 --- a/arch/arm/dts/mt7623.dtsi +++ b/arch/arm/dts/mt7623.dtsi @@ -352,6 +352,52 @@ }; }; + usb1: usb@1a1c0000 { + compatible = "mediatek,mt7623-xhci", "mediatek,mtk-xhci"; + reg = <0x1a1c0000 0x1000>, <0x1a1c4700 0x0100>; + reg-names = "mac", "ippc"; + power-domains = <&scpsys MT7623_POWER_DOMAIN_HIF>; + clocks = <&hifsys CLK_HIFSYS_USB0PHY>, <&topckgen CLK_TOP_ETHIF_SEL>; + clock-names = "sys_ck", "ref_ck"; + phys = <&u2port0 PHY_TYPE_USB2>, <&u3port0 PHY_TYPE_USB3>; + status = "disabled"; + }; + + u3phy1: usb-phy@1a1c4000 { + compatible = "mediatek,mt7623-tphy", "mediatek,generic-tphy-v1"; + + reg = <0x1a1c4000 0x0700>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + status = "disabled"; + + u2port0: usb-phy@1a1c4800 { + reg = <0x1a1c4800 0x0100>; + #phy-cells = <1>; + clocks = <&topckgen CLK_TOP_USB_PHY48M>; + clock-names = "ref"; + }; + + u3port0: usb-phy@1a1c4900 { + reg = <0x1a1c4900 0x0700>; + #phy-cells = <1>; + clocks = <&clk26m>; + clock-names = "ref"; + }; + }; + + usb2: usb@1a240000 { + compatible = "mediatek,mt7623-xhci", "mediatek,mtk-xhci"; + reg = <0x1a240000 0x1000>, <0x1a244700 0x0100>; + reg-names = "mac", "ippc"; + power-domains = <&scpsys MT7623_POWER_DOMAIN_HIF>; + clocks = <&hifsys CLK_HIFSYS_USB1PHY>, <&topckgen CLK_TOP_ETHIF_SEL>; + clock-names = "sys_ck", "ref_ck"; + phys = <&u2port1 PHY_TYPE_USB2>, <&u3port1 PHY_TYPE_USB3>; + status = "disabled"; + }; + u3phy2: usb-phy@1a244000 { compatible = "mediatek,generic-tphy-v1"; reg = <0x1a244000 0x0700>; diff --git a/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts index bcedcf20f13..ef073696273 100644 --- a/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts +++ b/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts @@ -248,3 +248,19 @@ pinctrl-0 = <&uart2_pins_a>; status = "okay"; }; + +&usb1 { + status = "okay"; +}; + +&u3phy1 { + status = "okay"; +}; + +&usb2 { + status = "okay"; +}; + +&u3phy2 { + status = "okay"; +}; From 4da1365d5cabcf25fc57f2abf6931d5a6cfc23a3 Mon Sep 17 00:00:00 2001 From: Anastasiia Lukianenko Date: Fri, 21 Aug 2020 12:10:00 +0300 Subject: [PATCH 105/117] board: xen: Remove unnecessary CONFIG_BOARD_EARLY_INIT_F define and board_early_init_f function Signed-off-by: Anastasiia Lukianenko Reviewed-by: Tom Rini --- board/xen/xenguest_arm64/xenguest_arm64.c | 5 ----- include/configs/xenguest_arm64.h | 2 -- 2 files changed, 7 deletions(-) diff --git a/board/xen/xenguest_arm64/xenguest_arm64.c b/board/xen/xenguest_arm64/xenguest_arm64.c index cce54369bb3..4660f3fff20 100644 --- a/board/xen/xenguest_arm64/xenguest_arm64.c +++ b/board/xen/xenguest_arm64/xenguest_arm64.c @@ -184,11 +184,6 @@ int ft_board_setup(void *blob, struct bd_info *bd) return 0; } -int board_early_init_f(void) -{ - return 0; -} - int print_cpuinfo(void) { printf("Xen virtual CPU\n"); diff --git a/include/configs/xenguest_arm64.h b/include/configs/xenguest_arm64.h index db3059a82c6..e88ab87a1d0 100644 --- a/include/configs/xenguest_arm64.h +++ b/include/configs/xenguest_arm64.h @@ -9,8 +9,6 @@ #include #endif -#define CONFIG_BOARD_EARLY_INIT_F - #define CONFIG_EXTRA_ENV_SETTINGS #undef CONFIG_NR_DRAM_BANKS From 607274f7f67e14aca0f0d1cde55569faa48f0183 Mon Sep 17 00:00:00 2001 From: Anastasiia Lukianenko Date: Fri, 21 Aug 2020 12:10:01 +0300 Subject: [PATCH 106/117] MAINTAINERS: Add maintainers to XEN section Signed-off-by: Anastasiia Lukianenko Reviewed-by: Simon Glass --- MAINTAINERS | 16 ++++++++++++++++ board/xen/xenguest_arm64/MAINTAINERS | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 17ac45587b7..bebe87b4d1f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1097,6 +1097,22 @@ T: git https://gitlab.denx.de/u-boot/custodians/u-boot-x86.git F: arch/x86/ F: cmd/x86/ +XEN +M: Anastasiia Lukianenko +M: Oleksandr Andrushchenko +S: Maintained +F: arch/arm/cpu/armv8/xen/ +F: arch/arm/include/asm/xen.h +F: arch/arm/include/asm/xen/ +F: cmd/pvblock.c +F: drivers/serial/serial_xen.c +F: drivers/xen/ +F: include/pvblock.h +F: include/xen/ +F: include/xen.h +F: lib/sscanf.c +F: test/lib/sscanf.c + XTENSA M: Max Filippov S: Maintained diff --git a/board/xen/xenguest_arm64/MAINTAINERS b/board/xen/xenguest_arm64/MAINTAINERS index 787e9e0d0e1..264920e240f 100644 --- a/board/xen/xenguest_arm64/MAINTAINERS +++ b/board/xen/xenguest_arm64/MAINTAINERS @@ -1,5 +1,6 @@ XEN GUEST FOR ARM64 -M: Andrii Anisov +M: Anastasiia Lukianenko +M: Oleksandr Andrushchenko S: Maintained F: board/xen/xenguest_arm64/ F: doc/board/xen/ From 32eac63af3287674f73933dfff6eae22a5b77c76 Mon Sep 17 00:00:00 2001 From: Anastasiia Lukianenko Date: Fri, 21 Aug 2020 12:10:02 +0300 Subject: [PATCH 107/117] board: xen: Remove CONFIG_CMD_RUN define and clean xenguest_arm64_defconfig CONFIG_CMD_RUN is set on by default in Kconfig. Create xenguest_arm64_defconfig by using savedefconfig to avoid unnecessary options. Signed-off-by: Anastasiia Lukianenko Reviewed-by: Simon Glass --- configs/xenguest_arm64_defconfig | 75 ++++++++++++-------------------- include/configs/xenguest_arm64.h | 2 - 2 files changed, 27 insertions(+), 50 deletions(-) diff --git a/configs/xenguest_arm64_defconfig b/configs/xenguest_arm64_defconfig index 46473c251da..042ea79729d 100644 --- a/configs/xenguest_arm64_defconfig +++ b/configs/xenguest_arm64_defconfig @@ -1,60 +1,39 @@ CONFIG_ARM=y CONFIG_POSITION_INDEPENDENT=y +CONFIG_TARGET_XENGUEST_ARM64=y CONFIG_SYS_TEXT_BASE=0x40080000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_IDENT_STRING=" xenguest" -CONFIG_TARGET_XENGUEST_ARM64=y CONFIG_BOOTDELAY=10 - CONFIG_SYS_PROMPT="xenguest# " - -CONFIG_CMD_NET=n -CONFIG_CMD_BDI=n -CONFIG_CMD_BOOTD=n -CONFIG_CMD_BOOTEFI=n -CONFIG_CMD_BOOTEFI_HELLO_COMPILE=n -CONFIG_CMD_ELF=n +# CONFIG_CMD_BDI is not set +# CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_GO is not set +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_EXPORTENV is not set +# CONFIG_CMD_IMPORTENV is not set +# CONFIG_CMD_EDITENV is not set +# CONFIG_CMD_SAVEENV is not set +# CONFIG_CMD_ENV_EXISTS is not set +# CONFIG_CMD_CRC32 is not set +# CONFIG_CMD_LZMADEC is not set +# CONFIG_CMD_UNZIP is not set +# CONFIG_CMD_LOADB is not set +# CONFIG_CMD_LOADS is not set +CONFIG_CMD_PVBLOCK=y +# CONFIG_CMD_ECHO is not set +# CONFIG_CMD_ITEST is not set +# CONFIG_CMD_SOURCE is not set +# CONFIG_CMD_SETEXPR is not set +# CONFIG_CMD_NET is not set +# CONFIG_CMD_MISC is not set CONFIG_CMD_EXT4=y CONFIG_CMD_FAT=y -CONFIG_CMD_GO=n -CONFIG_CMD_RUN=n -CONFIG_CMD_IMI=n -CONFIG_CMD_IMLS=n -CONFIG_CMD_XIMG=n -CONFIG_CMD_EXPORTENV=n -CONFIG_CMD_IMPORTENV=n -CONFIG_CMD_EDITENV=n -CONFIG_CMD_ENV_EXISTS=n -CONFIG_CMD_MEMORY=y -CONFIG_CMD_CRC32=n -CONFIG_CMD_DM=n -CONFIG_CMD_LOADB=n -CONFIG_CMD_LOADS=n -CONFIG_CMD_FLASH=n -CONFIG_CMD_GPT=n -CONFIG_CMD_FPGA=n -CONFIG_CMD_ECHO=n -CONFIG_CMD_ITEST=n -CONFIG_CMD_SOURCE=n -CONFIG_CMD_SETEXPR=n -CONFIG_CMD_MISC=n -CONFIG_CMD_UNZIP=n -CONFIG_CMD_LZMADEC=n -CONFIG_CMD_SAVEENV=n -CONFIG_CMD_UMS=n - -CONFIG_CMD_PVBLOCK=y - -#CONFIG_USB=n -# CONFIG_ISO_PARTITION is not set - -#CONFIG_EFI_PARTITION=y -# CONFIG_EFI_LOADER is not set - +CONFIG_OF_BOARD=y CONFIG_DM=y # CONFIG_MMC is not set -CONFIG_DM_SERIAL=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set - -CONFIG_OF_BOARD=y -CONFIG_OF_LIBFDT=y +CONFIG_DM_SERIAL=y +# CONFIG_EFI_LOADER is not set diff --git a/include/configs/xenguest_arm64.h b/include/configs/xenguest_arm64.h index e88ab87a1d0..f3092cb2f8f 100644 --- a/include/configs/xenguest_arm64.h +++ b/include/configs/xenguest_arm64.h @@ -39,8 +39,6 @@ #define CONFIG_CMDLINE_TAG 1 #define CONFIG_INITRD_TAG 1 -#define CONFIG_CMD_RUN - #undef CONFIG_EXTRA_ENV_SETTINGS #define CONFIG_EXTRA_ENV_SETTINGS \ "loadimage=ext4load pvblock 0 0x90000000 /boot/Image;\0" \ From d226b3cd259baa8f39c595f1176d4770000cfcd5 Mon Sep 17 00:00:00 2001 From: Anastasiia Lukianenko Date: Fri, 21 Aug 2020 12:10:03 +0300 Subject: [PATCH 108/117] board: xen: Remove unnecessary CONFIG_INITRD_TAG and CONFIG_CMDLINE_TAG Signed-off-by: Anastasiia Lukianenko Reviewed-by: Simon Glass --- include/configs/xenguest_arm64.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/configs/xenguest_arm64.h b/include/configs/xenguest_arm64.h index f3092cb2f8f..c44381e966c 100644 --- a/include/configs/xenguest_arm64.h +++ b/include/configs/xenguest_arm64.h @@ -36,9 +36,6 @@ #define CONFIG_OF_SYSTEM_SETUP -#define CONFIG_CMDLINE_TAG 1 -#define CONFIG_INITRD_TAG 1 - #undef CONFIG_EXTRA_ENV_SETTINGS #define CONFIG_EXTRA_ENV_SETTINGS \ "loadimage=ext4load pvblock 0 0x90000000 /boot/Image;\0" \ From 3337b291442e31b1db0ff5975f74fec7d9741794 Mon Sep 17 00:00:00 2001 From: Anastasiia Lukianenko Date: Fri, 21 Aug 2020 12:10:04 +0300 Subject: [PATCH 109/117] xen: Code style conformity Cleaning up the following: ERROR: do not use assignment in if condition #281: FILE: drivers/xen/pvblock.c:260: + if ((err = xenbus_switch_state(XBT_NIL, nodename, CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "err" #52: FILE: drivers/xen/pvblock.c:298: + if (err != NULL) { ERROR: do not use assignment in if condition #176: FILE: drivers/xen/gnttab.c:103: + if ((flags = nflags) & (GTF_reading | GTF_writing)) { WARNING: Missing or malformed SPDX-License-Identifier tag in line 1 #329: FILE: include/xen/gnttab.h:1: +/* WARNING: Misplaced SPDX-License-Identifier tag - use line 1 instead #330: FILE: include/xen/gnttab.h:2: + * SPDX-License-Identifier: GPL-2.0 ERROR: do not use assignment in if condition #630: FILE: lib/sscanf.c:558: + if ((n = inr) < width) { Signed-off-by: Anastasiia Lukianenko Reviewed-by: Simon Glass --- drivers/xen/gnttab.c | 3 ++- drivers/xen/pvblock.c | 12 ++++++------ include/xen/gnttab.h | 3 +-- lib/sscanf.c | 3 ++- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/xen/gnttab.c b/drivers/xen/gnttab.c index becf7a79fbf..9bf1091ab32 100644 --- a/drivers/xen/gnttab.c +++ b/drivers/xen/gnttab.c @@ -100,7 +100,8 @@ int gnttab_end_access(grant_ref_t ref) nflags = gnttab_table[ref].flags; do { - if ((flags = nflags) & (GTF_reading | GTF_writing)) { + flags = nflags; + if ((flags) & (GTF_reading | GTF_writing)) { printf("WARNING: g.e. still in use! (%x)\n", flags); return 0; } diff --git a/drivers/xen/pvblock.c b/drivers/xen/pvblock.c index 76e82fbf41d..1b3325bbe2a 100644 --- a/drivers/xen/pvblock.c +++ b/drivers/xen/pvblock.c @@ -294,8 +294,8 @@ static void shutdown_blkfront(struct blkfront_dev *dev) snprintf(path, sizeof(path), "%s/state", dev->backend); snprintf(nodename, sizeof(nodename), "%s/state", dev->nodename); - if ((err = xenbus_switch_state(XBT_NIL, nodename, - XenbusStateClosing)) != NULL) { + err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosing); + if (err) { printf("%s: error changing state to %d: %s\n", __func__, XenbusStateClosing, err); goto close; @@ -306,8 +306,8 @@ static void shutdown_blkfront(struct blkfront_dev *dev) err = xenbus_wait_for_state_change(path, &state); free(err); - if ((err = xenbus_switch_state(XBT_NIL, nodename, - XenbusStateClosed)) != NULL) { + err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosed); + if (err) { printf("%s: error changing state to %d: %s\n", __func__, XenbusStateClosed, err); goto close; @@ -319,8 +319,8 @@ static void shutdown_blkfront(struct blkfront_dev *dev) free(err); } - if ((err = xenbus_switch_state(XBT_NIL, nodename, - XenbusStateInitialising)) != NULL) { + err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateInitialising); + if (err) { printf("%s: error changing state to %d: %s\n", __func__, XenbusStateInitialising, err); goto close; diff --git a/include/xen/gnttab.h b/include/xen/gnttab.h index db1d5361fed..db615004aa5 100644 --- a/include/xen/gnttab.h +++ b/include/xen/gnttab.h @@ -1,5 +1,4 @@ -/* - * SPDX-License-Identifier: GPL-2.0 +/* SPDX-License-Identifier: GPL-2.0 * * (C) 2006, Steven Smith * (C) 2006, Grzegorz Milos diff --git a/lib/sscanf.c b/lib/sscanf.c index d1e2dc272cc..4c35c035fe1 100644 --- a/lib/sscanf.c +++ b/lib/sscanf.c @@ -555,7 +555,8 @@ literal: if (flags & SUPPRESS) { size_t sum = 0; - if ((n = inr) < width) { + n = inr; + if (n < width) { sum += n; width -= n; inp += n; From 52dc7ae74918d01fa55ca103841a0eaa0dfa7409 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Tue, 18 Aug 2020 01:09:20 -0700 Subject: [PATCH 110/117] riscv: fu540: Use correct API to get L2 cache controller base address At present fdtdec_get_addr() is used to get L2 cache controller base address. This only works for a fixed #address-cells and #size-cells. Change to use fdtdec_get_addr_size_auto_parent() instead. Signed-off-by: Bin Meng Reviewed-by: Rick Chen Reviewed-by: Pragnesh Patel --- arch/riscv/cpu/fu540/cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/cpu/fu540/cache.c b/arch/riscv/cpu/fu540/cache.c index 54de14238cc..78f5ad9d602 100644 --- a/arch/riscv/cpu/fu540/cache.c +++ b/arch/riscv/cpu/fu540/cache.c @@ -35,7 +35,8 @@ int cache_enable_ways(void) if (node < 0) return node; - base = fdtdec_get_addr(blob, node, "reg"); + base = fdtdec_get_addr_size_auto_parent(blob, 0, node, "reg", 0, + NULL, false); if (base == FDT_ADDR_T_NONE) return FDT_ADDR_T_NONE; From 3ab260105214d56a419c84e6dacbb8ae514548f1 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Tue, 18 Aug 2020 01:09:21 -0700 Subject: [PATCH 111/117] ram: sifive: Fix compiler warnings for 32-bit priv->info.size is of type 'size_t' but the length modifier is l. Fix this by casting priv->info.size. Note 'z' cannot be used as the modifier as SPL does not support that. Signed-off-by: Bin Meng Reviewed-by: Rick Chen Reviewed-by: Pragnesh Patel --- drivers/ram/sifive/fu540_ddr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ram/sifive/fu540_ddr.c b/drivers/ram/sifive/fu540_ddr.c index 2eef1e75658..5ff88692a81 100644 --- a/drivers/ram/sifive/fu540_ddr.c +++ b/drivers/ram/sifive/fu540_ddr.c @@ -316,12 +316,12 @@ static int fu540_ddr_setup(struct udevice *dev) priv->info.size = get_ram_size((long *)priv->info.base, ddr_size); - debug("%s : %lx\n", __func__, priv->info.size); + debug("%s : %lx\n", __func__, (uintptr_t)priv->info.size); /* check memory access for all memory */ if (priv->info.size != ddr_size) { printf("DDR invalid size : 0x%lx, expected 0x%lx\n", - priv->info.size, (uintptr_t)ddr_size); + (uintptr_t)priv->info.size, (uintptr_t)ddr_size); return -EINVAL; } From 183f1e27123769c41b3a73b92839497d4812f790 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 28 Jul 2020 17:52:23 +0200 Subject: [PATCH 112/117] clk: kendryte/pll.h: do not redefine nop() The kendryte PLL code uses nop as barrier. The macro is not defined for the sandbox on x86 but is defined on RISC-V. Signed-off-by: Heinrich Schuchardt Reviewed-by: Sean Anderson Reviewed-by: Bin Meng --- include/kendryte/pll.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/kendryte/pll.h b/include/kendryte/pll.h index c8e3200799e..55a40b9c979 100644 --- a/include/kendryte/pll.h +++ b/include/kendryte/pll.h @@ -7,6 +7,7 @@ #include #include +#include #define K210_PLL_CLKR GENMASK(3, 0) #define K210_PLL_CLKF GENMASK(9, 4) @@ -43,9 +44,13 @@ struct k210_pll_config { #ifdef CONFIG_UNIT_TEST TEST_STATIC int k210_pll_calc_config(u32 rate, u32 rate_in, struct k210_pll_config *best); + +#ifndef nop #define nop() #endif +#endif + extern const struct clk_ops k210_pll_ops; struct clk *k210_register_pll_struct(const char *name, const char *parent_name, From 092f15aee5bdebc010ad99120bab96162d9c64c8 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 15 Aug 2020 09:49:26 +0200 Subject: [PATCH 113/117] riscv: fix building with CONFIG_SPL_SMP=n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building with CONFIG_SPL_SMP=n results in: arch/riscv/lib/spl.c: In function ‘jump_to_image_no_args’: arch/riscv/lib/spl.c:33:6: error: unused variable ‘ret’ [-Werror=unused-variable] 33 | int ret; | ^~~ Define the variable ret as __maybe_unused. Fixes: 191636e44898 ("riscv: Introduce SPL_SMP Kconfig option for U-Boot SPL") Fixes: 8c59f2023cc8 ("riscv: add SPL support") Signed-off-by: Heinrich Schuchardt Reviewed-by: Bin Meng Reviewed-by: Simon Glass Reviewed-by: Rick Chen Reviewed-by: Pragnesh Patel --- arch/riscv/lib/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/lib/spl.c b/arch/riscv/lib/spl.c index e24ec5a46c0..5e19d0f36ab 100644 --- a/arch/riscv/lib/spl.c +++ b/arch/riscv/lib/spl.c @@ -39,7 +39,7 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) { typedef void __noreturn (*image_entry_riscv_t)(ulong hart, void *dtb); void *fdt_blob; - int ret; + __maybe_unused int ret; #if CONFIG_IS_ENABLED(LOAD_FIT) || CONFIG_IS_ENABLED(LOAD_FIT_FULL) fdt_blob = spl_image->fdt_addr; From 27cef4e4a3ba791078534fda1dbeb814bd530ad5 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 17 Aug 2020 12:35:39 +0200 Subject: [PATCH 114/117] configs: defconfig for Sipeed Maix in S-mode Provide a defconfig that can be used to build U-Boot for the Maix boards running upon OpenSBI. Update the documentation. Signed-off-by: Heinrich Schuchardt Reviewed-by: Bin Meng Reviewed-by: Sean Anderson --- board/sipeed/maix/MAINTAINERS | 2 +- configs/sipeed_maix_smode_defconfig | 10 ++++++ doc/board/sipeed/maix.rst | 49 +++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 configs/sipeed_maix_smode_defconfig diff --git a/board/sipeed/maix/MAINTAINERS b/board/sipeed/maix/MAINTAINERS index e7bb9ec4330..0778af7a552 100644 --- a/board/sipeed/maix/MAINTAINERS +++ b/board/sipeed/maix/MAINTAINERS @@ -4,7 +4,7 @@ S: Maintained F: arch/riscv/dts/k210.dtsi F: arch/riscv/dts/k210-maix-bit.dts F: board/sipeed/maix/ -F: configs/sipeed_maix_bitm_defconfig +F: configs/sipeed_maix*_defconfig F: doc/board/sipeed/ F: include/configs/sipeed-maix.h F: include/dt-bindings/*/k210-sysctl.h diff --git a/configs/sipeed_maix_smode_defconfig b/configs/sipeed_maix_smode_defconfig new file mode 100644 index 00000000000..2516bb72582 --- /dev/null +++ b/configs/sipeed_maix_smode_defconfig @@ -0,0 +1,10 @@ +CONFIG_RISCV=y +CONFIG_SYS_TEXT_BASE=0x80020000 +CONFIG_TARGET_SIPEED_MAIX=y +CONFIG_ARCH_RV64I=y +CONFIG_RISCV_SMODE=y +CONFIG_STACK_SIZE=0x100000 +# CONFIG_NET is not set +# CONFIG_INPUT is not set +# CONFIG_DM_ETH is not set +# CONFIG_EFI_UNICODE_CAPITALIZATION is not set diff --git a/doc/board/sipeed/maix.rst b/doc/board/sipeed/maix.rst index b1894f3a6fa..efcde9aebf7 100644 --- a/doc/board/sipeed/maix.rst +++ b/doc/board/sipeed/maix.rst @@ -75,6 +75,49 @@ console shall be opened immediately. Boot output should look like the following: Err: serial@38000000 => +OpenSBI +^^^^^^^ + +OpenSBI is an open source supervisor execution environment implementing the +RISC-V Supervisor Binary Interface Specification [1]. One of its features is +to intercept run-time exceptions, e.g. for unaligned access or illegal +instructions, and to emulate the failing instructions. + +The OpenSBI source can be downloaded via: + +.. code-block:: bash + + git clone https://github.com/riscv/opensbi + +As OpenSBI will be loaded at 0x80000000 we have to adjust the U-Boot text base. +Furthermore we have to enable building U-Boot for S-mode:: + + CONFIG_SYS_TEXT_BASE=0x80020000 + CONFIG_RISCV_SMODE=y + +Both settings are contained in sipeed_maix_smode_defconfig so we can build +U-Boot with: + +.. code-block:: bash + + make sipeed_maix_smode_defconfig + make + +To build OpenSBI with U-Boot as a payload: + +.. code-block:: bash + + cd opensbi + make \ + PLATFORM=kendryte/k210 \ + FW_PAYLOAD=y \ + FW_PAYLOAD_OFFSET=0x20000 \ + FW_PAYLOAD_PATH=/u-boot-dtb.bin + +The value of FW_PAYLOAD_OFFSET must match CONFIG_SYS_TEXT_BASE - 0x80000000. + +The file to flash is build/platform/kendryte/k210/firmware/fw_payload.bin. + Loading Images ^^^^^^^^^^^^^^ @@ -363,3 +406,9 @@ Address Size Description interrupts) 0x8801f000 0x1000 credits ========== ========= =========== + +Links +----- + +[1] https://github.com/riscv/riscv-sbi-doc + RISC-V Supervisor Binary Interface Specification From c92b50a44b95e706b9c0c97544bd7504fe6d36e9 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 20 Aug 2020 19:43:39 +0200 Subject: [PATCH 115/117] cmd: provide command sbi Provide a command to display information about the SBI implementation. The output might look like: => sbi SBI 0.2 OpenSBI Extensions: sbi_set_timer sbi_console_putchar sbi_console_getchar sbi_clear_ipi sbi_send_ipi sbi_remote_fence_i sbi_remote_sfence_vma sbi_remote_sfence_vma_asid sbi_shutdown SBI Base Functionality Timer Extension IPI Extension RFENCE Extension Hart State Management Extension The command can be used to construct a unit test checking that the communication with the SEE is working. Signed-off-by: Heinrich Schuchardt Reviewed-by: Atish Patra Reviewed-by: Bin Meng Tested-by: Bin Meng Reviewed-by: Pragnesh Patel Tested-by: Pragnesh Patel Reviewed-by: Rick Chen Tested-by: Rick Chen --- arch/riscv/include/asm/sbi.h | 2 + arch/riscv/lib/sbi.c | 36 ++++++++++++++++ cmd/Kconfig | 6 +++ cmd/riscv/Makefile | 1 + cmd/riscv/sbi.c | 82 ++++++++++++++++++++++++++++++++++++ 5 files changed, 127 insertions(+) create mode 100644 cmd/riscv/sbi.c diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index 08e1ac0c0e2..53ca316180e 100644 --- a/arch/riscv/include/asm/sbi.h +++ b/arch/riscv/include/asm/sbi.h @@ -115,6 +115,8 @@ void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask, unsigned long asid); #endif void sbi_set_timer(uint64_t stime_value); +long sbi_get_spec_version(void); +int sbi_get_impl_id(void); int sbi_probe_extension(int ext); #endif diff --git a/arch/riscv/lib/sbi.c b/arch/riscv/lib/sbi.c index 8fbc23839dd..77845a73ca3 100644 --- a/arch/riscv/lib/sbi.c +++ b/arch/riscv/lib/sbi.c @@ -53,6 +53,42 @@ void sbi_set_timer(uint64_t stime_value) #endif } +/** + * sbi_get_spec_version() - get current SBI specification version + * + * Return: version id + */ +long sbi_get_spec_version(void) +{ + struct sbiret ret; + + ret = sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_GET_SPEC_VERSION, + 0, 0, 0, 0, 0, 0); + if (!ret.error) + if (ret.value) + return ret.value; + + return -ENOTSUPP; +} + +/** + * sbi_get_impl_id() - get SBI implementation ID + * + * Return: implementation ID + */ +int sbi_get_impl_id(void) +{ + struct sbiret ret; + + ret = sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_GET_IMP_ID, + 0, 0, 0, 0, 0, 0); + if (!ret.error) + if (ret.value) + return ret.value; + + return -ENOTSUPP; +} + /** * sbi_probe_extension() - Check if an SBI extension ID is supported or not. * @extid: The extension ID to be probed. diff --git a/cmd/Kconfig b/cmd/Kconfig index 9ad511aa176..30c26b5d2bc 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -270,6 +270,12 @@ config SPL_CMD_TLV_EEPROM help Read system EEPROM data block in ONIE Tlvinfo format from SPL. +config CMD_SBI + bool "sbi" + depends on RISCV_SMODE && SBI_V02 + help + Display information about the SBI implementation. + endmenu menu "Boot commands" diff --git a/cmd/riscv/Makefile b/cmd/riscv/Makefile index 24df023ece9..1e6ac364e34 100644 --- a/cmd/riscv/Makefile +++ b/cmd/riscv/Makefile @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0+ obj-$(CONFIG_CMD_EXCEPTION) += exception.o +obj-$(CONFIG_CMD_SBI) += sbi.o diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c new file mode 100644 index 00000000000..e66fc8e41d2 --- /dev/null +++ b/cmd/riscv/sbi.c @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * The 'sbi' command displays information about the SBI implementation. + * + * Copyright (c) 2020, Heinrich Schuchardt + */ + +#include +#include +#include + +struct sbi_ext { + const u32 id; + const char *name; +}; + +static struct sbi_ext extensions[] = { + { 0x00000000, "sbi_set_timer" }, + { 0x00000001, "sbi_console_putchar" }, + { 0x00000002, "sbi_console_getchar" }, + { 0x00000003, "sbi_clear_ipi" }, + { 0x00000004, "sbi_send_ipi" }, + { 0x00000005, "sbi_remote_fence_i" }, + { 0x00000006, "sbi_remote_sfence_vma" }, + { 0x00000007, "sbi_remote_sfence_vma_asid" }, + { 0x00000008, "sbi_shutdown" }, + { 0x00000010, "SBI Base Functionality" }, + { 0x54494D45, "Timer Extension" }, + { 0x00735049, "IPI Extension" }, + { 0x52464E43, "RFENCE Extension" }, + { 0x0048534D, "Hart State Management Extension" }, +}; + +static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + int i; + long ret; + + ret = sbi_get_spec_version(); + if (ret >= 0) + printf("SBI %ld.%ld\n", ret >> 24, ret & 0xffffff); + ret = sbi_get_impl_id(); + if (ret >= 0) { + switch (ret) { + case 0: + printf("Berkeley Boot Loader (BBL)\n"); + break; + case 1: + printf("OpenSBI\n"); + break; + case 2: + printf("Xvisor\n"); + break; + case 3: + printf("KVM\n"); + break; + default: + printf("Unknown implementation\n"); + break; + } + } + printf("Extensions:\n"); + for (i = 0; i < ARRAY_SIZE(extensions); ++i) { + ret = sbi_probe_extension(extensions[i].id); + if (ret > 0) + printf(" %s\n", extensions[i].name); + } + return 0; +} + +#ifdef CONFIG_SYS_LONGHELP +static char sbi_help_text[] = + "- display SBI spec version, implementation, and available extensions"; + +#endif + +U_BOOT_CMD_COMPLETE( + sbi, 1, 0, do_sbi, + "display SBI information", + sbi_help_text, NULL +); From af03bde0fa69c5287854b12badafc75b92dc84c3 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Thu, 23 Jul 2020 14:09:36 +0200 Subject: [PATCH 116/117] i2c: octeon_i2c: Misc fixes for ARM Octeon TX2 support This patch fixes a few issues noticed, when testing this new driver on ARM Octeon TX2 again. Here the details: - Remove "common.h" header inclusion - Use correct THP define on Octeon TX2 - Octeon TX2 uses the same compatible as Octeon TX. We can't distinguish both platforms this way. Remove the unused "cavium,thunder2-99xx-twsi" compatible and add a check to the Octeon TX2 specific "cavium,thunderx-i2c" so that the correct driver data is selected. - Removed "struct pci_device_id" definition and U_BOOT_PCI_DEVICE() as its not needed for the PCI based probing on Octeon TX2 Signed-off-by: Stefan Roese Cc: Heiko Schocher Cc: Daniel Schwierzeck Cc: Suneel Garapati Cc: Aaron Williams Cc: Chandrakala Chavva Reviewed-by: Daniel Schwierzeck Reviewed-by: Heiko Schocher --- drivers/i2c/octeon_i2c.c | 59 ++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/drivers/i2c/octeon_i2c.c b/drivers/i2c/octeon_i2c.c index c11d6ff93d1..23dcb1563ea 100644 --- a/drivers/i2c/octeon_i2c.c +++ b/drivers/i2c/octeon_i2c.c @@ -3,11 +3,10 @@ * Copyright (C) 2018 Marvell International Ltd. */ -#include #include #include #include -#include +#include #include #include #include @@ -749,6 +748,27 @@ static int octeon_i2c_set_bus_speed(struct udevice *bus, unsigned int speed) return 0; } +static const struct octeon_i2c_data i2c_octeon_data = { + .probe = PROBE_DT, + .reg_offs = 0x0000, + .thp = 3, + .clk_method = CLK_METHOD_OCTEON, +}; + +static const struct octeon_i2c_data i2c_octeontx_data = { + .probe = PROBE_PCI, + .reg_offs = 0x1000, + .thp = 24, + .clk_method = CLK_METHOD_OCTEON, +}; + +static const struct octeon_i2c_data i2c_octeontx2_data = { + .probe = PROBE_PCI, + .reg_offs = 0x1000, + .thp = 3, + .clk_method = CLK_METHOD_OCTEONTX2, +}; + /** * Driver probe function * @@ -761,6 +781,10 @@ static int octeon_i2c_probe(struct udevice *dev) u32 i2c_slave_addr; int ret; + /* Octeon TX2 needs a different data struct */ + if (device_is_compatible(dev, "cavium,thunderx-i2c")) + dev->driver_data = (long)&i2c_octeontx2_data; + twsi->data = (const struct octeon_i2c_data *)dev_get_driver_data(dev); if (twsi->data->probe == PROBE_PCI) { @@ -798,34 +822,11 @@ static const struct dm_i2c_ops octeon_i2c_ops = { .set_bus_speed = octeon_i2c_set_bus_speed, }; -static const struct octeon_i2c_data i2c_octeon_data = { - .probe = PROBE_DT, - .reg_offs = 0x0000, - .thp = 3, - .clk_method = CLK_METHOD_OCTEON, -}; - -static const struct octeon_i2c_data i2c_octeontx_data = { - .probe = PROBE_PCI, - .reg_offs = 0x8000, - .thp = 3, - .clk_method = CLK_METHOD_OCTEON, -}; - -static const struct octeon_i2c_data i2c_octeontx2_data = { - .probe = PROBE_PCI, - .reg_offs = 0x8000, - .thp = 24, - .clk_method = CLK_METHOD_OCTEONTX2, -}; - static const struct udevice_id octeon_i2c_ids[] = { { .compatible = "cavium,octeon-7890-twsi", .data = (ulong)&i2c_octeon_data }, { .compatible = "cavium,thunder-8890-twsi", .data = (ulong)&i2c_octeontx_data }, - { .compatible = "cavium,thunder2-99xx-twsi", - .data = (ulong)&i2c_octeontx2_data }, { } }; @@ -837,11 +838,3 @@ U_BOOT_DRIVER(octeon_pci_twsi) = { .priv_auto_alloc_size = sizeof(struct octeon_twsi), .ops = &octeon_i2c_ops, }; - -static struct pci_device_id octeon_twsi_supported[] = { - { PCI_VDEVICE(CAVIUM, PCI_DEVICE_ID_CAVIUM_TWSI), - .driver_data = (ulong)&i2c_octeontx2_data }, - { }, -}; - -U_BOOT_PCI_DEVICE(octeon_pci_twsi, octeon_twsi_supported); From 660606091f12320210cb7ced018788b8028aab5f Mon Sep 17 00:00:00 2001 From: "Trommel, Kees (Contractor)" Date: Mon, 3 Aug 2020 14:49:47 +0000 Subject: [PATCH 117/117] Link failure with CONFIG_SPL and CONFIG_I2C_MUX_PCA954x Fix for the case of a U-Boot configuration with CONFIG_SPL, CONFIG_I2C_MUX, CONFIG_I2C_MUX_PCA954x, no CONFIG_SPL_DM and no CONFIG_SPL_I2C_MUX. Without this fix linking of pca954x fails because dm_write_i2c does not exist because CONFIG_SPL_DM is not defined. Signed-off-by: Kees Trommel Cc: Heiko Schocher --- drivers/i2c/Makefile | 2 +- drivers/i2c/muxes/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index e851ec462ec..f7b27864488 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -46,4 +46,4 @@ obj-$(CONFIG_SYS_I2C_VERSATILE) += i2c-versatile.o obj-$(CONFIG_SYS_I2C_XILINX_XIIC) += xilinx_xiic.o obj-$(CONFIG_TEGRA186_BPMP_I2C) += tegra186_bpmp_i2c.o -obj-$(CONFIG_I2C_MUX) += muxes/ +obj-$(CONFIG_$(SPL_)I2C_MUX) += muxes/ diff --git a/drivers/i2c/muxes/Makefile b/drivers/i2c/muxes/Makefile index 68ed9b547dd..b690821199f 100644 --- a/drivers/i2c/muxes/Makefile +++ b/drivers/i2c/muxes/Makefile @@ -2,6 +2,6 @@ # # Copyright (c) 2015 Google, Inc obj-$(CONFIG_I2C_ARB_GPIO_CHALLENGE) += i2c-arb-gpio-challenge.o -obj-$(CONFIG_$(SPL_)I2C_MUX) += i2c-mux-uclass.o +obj-$(CONFIG_I2C_MUX) += i2c-mux-uclass.o obj-$(CONFIG_I2C_MUX_PCA954x) += pca954x.o obj-$(CONFIG_I2C_MUX_GPIO) += i2c-mux-gpio.o