From 814774c07617465f735644fb4f6352a4e50fb286 Mon Sep 17 00:00:00 2001 From: Lars Feyaerts Date: Mon, 2 Oct 2023 10:00:13 +0200 Subject: [PATCH 01/29] checkpatch: skip fdtdec_* check for tools Have checkpatch.pl skip warnings for use of fdtdec_* functions in ooling; livetree isn't used there. Signed-off-by: Lars Feyaerts Reviewed-by: Simon Glass --- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 62b764f6c38..488d73a0ed7 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2606,8 +2606,8 @@ sub u_boot_line { "Possible new uclass - make sure to add a sandbox driver, plus a test in test/dm/.c\n" . $herecurr); } - # try to get people to use the livetree API - if ($line =~ /^\+.*fdtdec_/) { + # try to get people to use the livetree API, except when changing tooling + if ($line =~ /^\+.*fdtdec_/ && $realfile !~ /^tools\//) { WARN("LIVETREE", "Use the livetree API (dev_read_...)\n" . $herecurr); } From 4860ee9b09e00ded5e9dfb5d418283dc2840bf1e Mon Sep 17 00:00:00 2001 From: Lars Feyaerts Date: Mon, 2 Oct 2023 10:00:14 +0200 Subject: [PATCH 02/29] mkimage: allow internalization of data-position Make it possible for data that was externalized using a static external position (-p) to be internalized. Enables the ability to convert existing FIT images built with -p to be converted to a FIT image where the data is internal, to be converted to a FIT image where the data is external relative to the end of the FIT (-E) or change the initial static external position to a different static external position (-p). Removing the original external-data-related properties ensures that they're not present after conversion. Without this, they would still be present in the resulting FIT even if the FIT has been, for example, internalized. Signed-off-by: Lars Feyaerts Reviewed-by: Simon Glass --- doc/mkimage.1 | 19 +++++++++++++++++++ tools/fit_image.c | 26 +++++++++++++++++++++----- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/doc/mkimage.1 b/doc/mkimage.1 index 76c7859bb03..d0a038a880a 100644 --- a/doc/mkimage.1 +++ b/doc/mkimage.1 @@ -860,6 +860,25 @@ verify signatures is added to u\-boot.dtb with required = "conf" property. \-K u\-boot.dtb -r kernel.itb .EE .RE +.P +Convert an existing FIT image from any of the three types of data storage +(internal, external data-offset or external data-position) to another type +of data storage. +.RS +.P +.EX +\fB// convert FIT from internal data to data-position +\fBmkimage -p 0x20000 -F internal_data.itb +.EE +.EX +\fB// convert FIT from data-position to data-offset +\fBmkimage -E -F external_data-position.itb +.EE +.EX +\fB// convert FIT from data-offset to internal data +\fBmkimage -F external_data-offset.itb +.EE +.RE . .SH SEE ALSO .BR dtc (1), diff --git a/tools/fit_image.c b/tools/fit_image.c index 9fe69ea0d9f..10f36e93422 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -616,6 +616,8 @@ err: static int fit_import_data(struct image_tool_params *params, const char *fname) { void *fdt, *old_fdt; + void *data = NULL; + const char *ext_data_prop = NULL; int fit_size, new_size, size, data_base; int fd; struct stat sbuf; @@ -659,14 +661,28 @@ static int fit_import_data(struct image_tool_params *params, const char *fname) int buf_ptr; int len; - buf_ptr = fdtdec_get_int(fdt, node, "data-offset", -1); - len = fdtdec_get_int(fdt, node, "data-size", -1); - if (buf_ptr == -1 || len == -1) + /* + * FIT_DATA_OFFSET_PROP and FIT_DATA_POSITION_PROP are never both present, + * but if they are, prefer FIT_DATA_OFFSET_PROP as it was there first + */ + buf_ptr = fdtdec_get_int(fdt, node, FIT_DATA_POSITION_PROP, -1); + if (buf_ptr != -1) { + ext_data_prop = FIT_DATA_POSITION_PROP; + data = old_fdt + buf_ptr; + } + buf_ptr = fdtdec_get_int(fdt, node, FIT_DATA_OFFSET_PROP, -1); + if (buf_ptr != -1) { + ext_data_prop = FIT_DATA_OFFSET_PROP; + data = old_fdt + data_base + buf_ptr; + } + len = fdtdec_get_int(fdt, node, FIT_DATA_SIZE_PROP, -1); + if (!data || len == -1) continue; debug("Importing data size %x\n", len); - ret = fdt_setprop(fdt, node, "data", - old_fdt + data_base + buf_ptr, len); + ret = fdt_setprop(fdt, node, FIT_DATA_PROP, data, len); + ret = fdt_delprop(fdt, node, ext_data_prop); + if (ret) { debug("%s: Failed to write property: %s\n", __func__, fdt_strerror(ret)); From 2d307fb9ed2065cc1596a3c4263e55d1cae6799d Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 3 Oct 2023 03:09:01 +0200 Subject: [PATCH 03/29] input: avoid NULL dereference Before using the result of env_get("stdin") we must check if it is NULL. Avoid #if. This resolves the -Wunused-but-set-variable issue and we don't need a dummy assignment in the else branch. Anyway this warning is disabled in the Makefile. For sake of readability use an early return after the configuration check. Checking CONFIG_SPL_BUILD is incorrect as env_get() is only defined if CONFIG_$(SPL_TPL)ENV_SUPPORT=y. Fixes: 985ca3945fa3 ("spl: input: Allow input in SPL and TPL") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass Reviewed-by: Tom Rini --- drivers/input/input.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index a4341e8c7ce..8a6506e7c6f 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -669,17 +669,22 @@ int input_stdio_register(struct stdio_dev *dev) int error; error = stdio_register(dev); -#if !defined(CONFIG_SPL_BUILD) || CONFIG_IS_ENABLED(ENV_SUPPORT) - /* check if this is the standard input device */ - if (!error && strcmp(env_get("stdin"), dev->name) == 0) { - /* reassign the console */ - if (OVERWRITE_CONSOLE || - console_assign(stdin, dev->name)) - return -1; + + if (!CONFIG_IS_ENABLED(ENV_SUPPORT)) + return 0; + + if (!error) { + const char *cstdin; + + /* check if this is the standard input device */ + cstdin = env_get("stdin"); + if (cstdin && !strcmp(cstdin, dev->name)) { + /* reassign the console */ + if (OVERWRITE_CONSOLE || + console_assign(stdin, dev->name)) + return -1; + } } -#else - error = error; -#endif return 0; } From 357f4fb0bdc5ca1e6e881638b7089444f07b99d3 Mon Sep 17 00:00:00 2001 From: Masahisa Kojima Date: Tue, 3 Oct 2023 11:29:57 +0900 Subject: [PATCH 04/29] board: synquacer: set actual gd->ram_top and gd->ram_size Current gd->ram_size and gd->ram_top reflect only the first DRAM bank even if the SynQuacer Developerbox could have up to three DRAM banks. With the commit 06d514d77c37 ("lmb: consider EFI memory map"), the first DRAM bank indicates <4GB address, so whole >4GB memory is marked as EFI_BOOT_SERVICES_DATA and it results that U-Boot can not access >4GB memory. Since 64-bits DRAM address is fully available on the SynQuacer Developerbox, let's set the installed DIMM information to gd->ram_top and gd->ram_size. Signed-off-by: Masahisa Kojima Acked-by: Jassi Brar --- board/socionext/developerbox/developerbox.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/board/socionext/developerbox/developerbox.c b/board/socionext/developerbox/developerbox.c index 204e5a41a5b..9585944d80c 100644 --- a/board/socionext/developerbox/developerbox.c +++ b/board/socionext/developerbox/developerbox.c @@ -145,13 +145,27 @@ int dram_init(void) { struct draminfo *synquacer_draminfo = (void *)SQ_DRAMINFO_BASE; struct draminfo_entry *ent = synquacer_draminfo->entry; + unsigned long size = 0; + int i; - gd->ram_size = ent[0].size; + for (i = 0; i < synquacer_draminfo->nr_regions; i++) + size += ent[i].size; + + gd->ram_size = size; gd->ram_base = ent[0].base; return 0; } +phys_addr_t board_get_usable_ram_top(phys_size_t total_size) +{ + struct draminfo *synquacer_draminfo = (void *)SQ_DRAMINFO_BASE; + struct draminfo_entry *ent = synquacer_draminfo->entry; + + return ent[synquacer_draminfo->nr_regions - 1].base + + ent[synquacer_draminfo->nr_regions - 1].size; +} + int dram_init_banksize(void) { struct draminfo *synquacer_draminfo = (void *)SQ_DRAMINFO_BASE; From 0501c997a0aa647ec6995a6e662b677db037ee5c Mon Sep 17 00:00:00 2001 From: Andrii Chepurnyi Date: Tue, 3 Oct 2023 08:58:28 +0000 Subject: [PATCH 05/29] board: xen: introduce virtio-blk support Added new xenguest_arm64_virtio_defconfig which enables support for virtio-blk using various types of transport like virtio-pci, vrtio-mmio. Currently supported: up to 2 PCI host bridges and 10 MMIO devices. Note: DT parsing code was partly taken from pci-uclass.c Limitation: All memory regions should be below 4GB address space. Signed-off-by: Andrii Chepurnyi --- board/xen/xenguest_arm64/MAINTAINERS | 1 + board/xen/xenguest_arm64/xenguest_arm64.c | 108 +++++++++++++++++++++- configs/xenguest_arm64_virtio_defconfig | 63 +++++++++++++ doc/board/xen/xenguest_arm64.rst | 2 + include/configs/xenguest_arm64.h | 10 +- 5 files changed, 181 insertions(+), 3 deletions(-) create mode 100644 configs/xenguest_arm64_virtio_defconfig diff --git a/board/xen/xenguest_arm64/MAINTAINERS b/board/xen/xenguest_arm64/MAINTAINERS index 264920e240f..7a317366ec4 100644 --- a/board/xen/xenguest_arm64/MAINTAINERS +++ b/board/xen/xenguest_arm64/MAINTAINERS @@ -6,3 +6,4 @@ F: board/xen/xenguest_arm64/ F: doc/board/xen/ F: include/configs/xenguest_arm64.h F: configs/xenguest_arm64_defconfig +F: configs/xenguest_arm64_virtio_defconfig diff --git a/board/xen/xenguest_arm64/xenguest_arm64.c b/board/xen/xenguest_arm64/xenguest_arm64.c index 6e10bba76b7..244070a242d 100644 --- a/board/xen/xenguest_arm64/xenguest_arm64.c +++ b/board/xen/xenguest_arm64/xenguest_arm64.c @@ -8,12 +8,15 @@ */ #include +#include #include #include #include #include #include #include +#include +#include #include #include @@ -49,7 +52,14 @@ void *board_fdt_blob_setup(int *err) return (void *)rom_pointer[0]; } -#define MAX_MEM_MAP_REGIONS 5 +/* + * MAX_MEM_MAP_REGIONS should respect to: + * 3 Xen related regions + * 6 regions for 2 PCI Host bridges + * 10 regions for MMIO devices + * 2 memory regions + */ +#define MAX_MEM_MAP_REGIONS 22 static struct mm_region xen_mem_map[MAX_MEM_MAP_REGIONS]; struct mm_region *mem_map = xen_mem_map; @@ -63,6 +73,93 @@ static int get_next_memory_node(const void *blob, int mem) return mem; } +#ifdef CONFIG_VIRTIO_BLK +#ifdef CONFIG_VIRTIO_PCI +static void add_pci_mem_map(const void *blob, int *cnt) +{ + struct fdt_resource reg_res; + int node = -1, len = 0, cells_per_record = 0, max_regions = 0; + int pci_addr_cells = 0, addr_cells = 0, size_cells = 0; + + while ((node = fdt_node_offset_by_prop_value(blob, node, "compatible", + "pci-host-ecam-generic", + sizeof("pci-host-ecam-generic"))) >= 0) { + if ((*cnt) >= MAX_MEM_MAP_REGIONS || + fdt_get_resource(blob, node, "reg", 0, ®_res) < 0) + return; + + xen_mem_map[*cnt].virt = reg_res.start; + xen_mem_map[*cnt].phys = reg_res.start; + xen_mem_map[*cnt].size = fdt_resource_size(®_res); + xen_mem_map[*cnt].attrs = (PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_INNER_SHARE); + (*cnt)++; + + const u32 *prop = fdt_getprop(blob, node, "ranges", &len); + + if (!prop) + return; + + pci_addr_cells = fdt_address_cells(blob, node); + addr_cells = fdt_address_cells(blob, 0); + size_cells = fdt_size_cells(blob, node); + + /* PCI addresses are always 3-cells */ + len /= sizeof(u32); + cells_per_record = pci_addr_cells + addr_cells + size_cells; + max_regions = len / cells_per_record + CONFIG_NR_DRAM_BANKS; + + for (int i = 0; i < max_regions; i++, len -= cells_per_record) { + u64 pci_addr, addr, size; + int space_code; + u32 flags; + + if (((*cnt) >= MAX_MEM_MAP_REGIONS) || len < cells_per_record) + return; + + flags = fdt32_to_cpu(prop[0]); + space_code = (flags >> 24) & 3; + pci_addr = fdtdec_get_number(prop + 1, 2); + prop += pci_addr_cells; + addr = fdtdec_get_number(prop, addr_cells); + prop += addr_cells; + size = fdtdec_get_number(prop, size_cells); + prop += size_cells; + + xen_mem_map[*cnt].virt = addr; + xen_mem_map[*cnt].phys = addr; + xen_mem_map[*cnt].size = size; + xen_mem_map[*cnt].attrs = (PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_INNER_SHARE); + (*cnt)++; + } + } +} +#endif + +#ifdef CONFIG_VIRTIO_MMIO +static void add_mmio_mem_map(const void *blob, int *cnt) +{ + int node = -1; + struct fdt_resource reg_res; + + if ((*cnt) >= MAX_MEM_MAP_REGIONS) + return; + while ((node = fdt_node_offset_by_prop_value(blob, node, "compatible", "virtio,mmio", + sizeof("virtio,mmio"))) >= 0) { + if (fdt_get_resource(blob, node, "reg", 0, ®_res) < 0) + return; + xen_mem_map[*cnt].virt = reg_res.start; + xen_mem_map[*cnt].phys = reg_res.start; + xen_mem_map[*cnt].size = roundup(fdt_resource_size(®_res), PAGE_SIZE); + xen_mem_map[*cnt].attrs = (PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_INNER_SHARE); + (*cnt)++; + } +} +#endif +#endif + static int setup_mem_map(void) { int i = 0, ret, mem, reg = 0; @@ -72,6 +169,7 @@ static int setup_mem_map(void) phys_addr_t gnttab_base; phys_size_t gnttab_sz; + memset(xen_mem_map, 0, sizeof(xen_mem_map)); /* * Add "magic" region which is used by Xen to provide some essentials * for the guest: we need console and xenstore. @@ -143,6 +241,14 @@ static int setup_mem_map(void) xen_mem_map[i].attrs = (PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_INNER_SHARE); } +#ifdef CONFIG_VIRTIO_BLK +#ifdef CONFIG_VIRTIO_PCI + add_pci_mem_map(blob, &i); +#endif +#ifdef CONFIG_VIRTIO_MMIO + add_mmio_mem_map(blob, &i); +#endif +#endif return 0; } diff --git a/configs/xenguest_arm64_virtio_defconfig b/configs/xenguest_arm64_virtio_defconfig new file mode 100644 index 00000000000..b812cf4fe84 --- /dev/null +++ b/configs/xenguest_arm64_virtio_defconfig @@ -0,0 +1,63 @@ +CONFIG_ARM=y +CONFIG_POSITION_INDEPENDENT=y +CONFIG_TARGET_XENGUEST_ARM64=y +CONFIG_TEXT_BASE=0x40080000 +CONFIG_SYS_MALLOC_LEN=0x2000000 +CONFIG_SYS_MALLOC_F_LEN=0x400 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_DEFAULT_DEVICE_TREE="xenguest-arm64" +CONFIG_SYS_PROMPT="xenguest# " +CONFIG_IDENT_STRING=" xenguest" +CONFIG_SYS_LOAD_ADDR=0x40000000 +CONFIG_OF_SYSTEM_SETUP=y +CONFIG_BOOTDELAY=10 +CONFIG_SYS_MAXARGS=64 +CONFIG_SYS_PBSIZE=1051 +#CONFIG_SYS_CBSIZE=512 +# CONFIG_CMD_BDI is not set +# CONFIG_CMD_BOOTD is not set +CONFIG_SYS_BOOTM_LEN=0x800000 +# 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_ECHO is not set +# CONFIG_CMD_ITEST is not set +# CONFIG_CMD_SOURCE is not set +# CONFIG_CMD_SETEXPR is not set +# CONFIG_CMD_SLEEP is not set +CONFIG_CMD_EXT4=y +CONFIG_CMD_FAT=y +# CONFIG_NET is not set +# CONFIG_MMC is not set +# CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_DM_SERIAL=y +CONFIG_PHYS_64BIT=y +CONFIG_PCI=y +CONFIG_CMD_PCI=y +CONFIG_PCIE_ECAM_GENERIC=y +CONFIG_PCI_REGION_MULTI_ENTRY=y +CONFIG_PCI_INIT_R=y +CONFIG_PCI_PNP=y +CONFIG_DM_PCI_COMPAT=y +CONFIG_SYS_PCI_64BIT=y +CONFIG_VIRTIO=y +CONFIG_VIRTIO_MMIO=y +CONFIG_VIRTIO_PCI=y +CONFIG_VIRTIO_BLK=y +CONFIG_CMD_VIRTIO=y +# CONFIG_VIRTIO_PCI_LEGACY is not set +# CONFIG_VIRTIO_NET is not set +# CONFIG_VIRTIO_RNG is not set +CONFIG_CMD_GPT=y +CONFIG_PARTITION_TYPE_GUID=y diff --git a/doc/board/xen/xenguest_arm64.rst b/doc/board/xen/xenguest_arm64.rst index e9bdaf7ffb2..92be9d43769 100644 --- a/doc/board/xen/xenguest_arm64.rst +++ b/doc/board/xen/xenguest_arm64.rst @@ -23,6 +23,7 @@ previously done by NXP [4]: - PV block device frontend driver with XenStore based device enumeration and UCLASS_PVBLOCK class; - PV serial console device frontend driver; +- Virtio block device support; - Xen hypervisor support with minimal set of the essential headers adapted from the Linux kernel; - Xen grant table support; @@ -34,6 +35,7 @@ previously done by NXP [4]: define any start addresses at compile time which is up to Xen to choose at run-time; - new defconfig introduced: xenguest_arm64_defconfig. +- new defconfig introduced: xenguest_arm64_virtio_defconfig. Board limitations diff --git a/include/configs/xenguest_arm64.h b/include/configs/xenguest_arm64.h index bc268d25dc3..3dce25b60e7 100644 --- a/include/configs/xenguest_arm64.h +++ b/include/configs/xenguest_arm64.h @@ -14,9 +14,15 @@ #undef CFG_SYS_SDRAM_BASE #undef CFG_EXTRA_ENV_SETTINGS + +#ifdef CONFIG_VIRTIO_BLK #define CFG_EXTRA_ENV_SETTINGS \ - "loadimage=ext4load pvblock 0 0x90000000 /boot/Image;\0" \ - "pvblockboot=run loadimage;" \ + "virtioboot=virtio scan; ext4load virtio 0 0x90000000 /boot/Image;" \ + "booti 0x90000000 - ${fdtcontroladdr};\0" +#else +#define CFG_EXTRA_ENV_SETTINGS \ + "pvblockboot=ext4load pvblock 0 0x90000000 /boot/Image;" \ "booti 0x90000000 - 0x88000000;\0" +#endif #endif /* __XENGUEST_ARM64_H */ From 20535a3369d9ca3e3d6dd880c5fa23115a8b3fbd Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Tue, 3 Oct 2023 12:02:17 +0200 Subject: [PATCH 06/29] Makefile: make u-boot-initial-env target depend explicitly on scripts_basic We're seeing sporadic errors like ENVC include/generated/env.txt HOSTCC scripts/basic/fixdep ENVP include/generated/env.in ENVT include/generated/environment.h HOSTCC tools/printinitialenv /bin/sh: 1: scripts/basic/fixdep: not found make[1]: *** [scripts/Makefile.host:95: tools/printinitialenv] Error 127 make[1]: *** Deleting file 'tools/printinitialenv' make: *** [Makefile:2446: u-boot-initial-env] Error 2 make: *** Waiting for unfinished jobs.... where sometimes the "fixdep: not found" is instead "fixdep: Permission denied" and the Error 127 becomes 126. This smells like a race condition, and indeed it is: Currently, u-boot-initial-env is a prerequisite of the envtools target, which also lists scripts_basic as a prerequisite: envtools: u-boot-initial-env scripts_basic $(version_h) $(timestamp_h) tools/version.h $(Q)$(MAKE) $(build)=tools/env However, the u-boot-initial-env rule involves building the printinitialenv helper, which in turn is built using an if_changed_dep rule. That means we must ensure scripts/basic/fixdep is built and ready before trying to build printinitialenv, i.e. the u-boot-initial-env rule itself must depend on the phony scripts_basic target. Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9d2e31e494a..b204a500438 100644 --- a/Makefile +++ b/Makefile @@ -2447,7 +2447,7 @@ cmd_genenv = \ sed -e '/^\s*$$/d' | \ sort -t '=' -k 1,1 -s -o $@ -u-boot-initial-env: $(env_h) FORCE +u-boot-initial-env: scripts_basic $(env_h) FORCE $(Q)$(MAKE) $(build)=tools $(objtree)/tools/printinitialenv $(call if_changed,genenv) From 538b97dd5d6be8206b532664cf616c567434368d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Veronese?= Date: Wed, 4 Oct 2023 00:14:26 +0200 Subject: [PATCH 07/29] spi: mtk_spim: prevent global pll clock override MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With commit 793e62301180 ("spi: mtk_spim: get spi clk rate only once") a new system to calculate the SPI clocks has been added. Unfortunately, the do_div macro overrides the global priv->pll_clk_rate field. This will cause to have a reduced clock rate on each subsequent SPI call. Signed-off-by: Valerio 'ftp21' Mancini Signed-off-by: Nicolò Veronese --- drivers/spi/mtk_spim.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/spi/mtk_spim.c b/drivers/spi/mtk_spim.c index 418e586b91d..90f4c3cecb9 100644 --- a/drivers/spi/mtk_spim.c +++ b/drivers/spi/mtk_spim.c @@ -409,7 +409,7 @@ static int mtk_spim_transfer_wait(struct spi_slave *slave, { struct udevice *bus = dev_get_parent(slave->dev); struct mtk_spim_priv *priv = dev_get_priv(bus); - u32 sck_l, sck_h, clk_count, reg; + u32 pll_clk, sck_l, sck_h, clk_count, reg; ulong us = 1; int ret = 0; @@ -418,11 +418,12 @@ static int mtk_spim_transfer_wait(struct spi_slave *slave, else clk_count = op->data.nbytes; + pll_clk = priv->pll_clk_rate; sck_l = readl(priv->base + SPI_CFG2_REG) >> SPI_CFG2_SCK_LOW_OFFSET; sck_h = readl(priv->base + SPI_CFG2_REG) & SPI_CFG2_SCK_HIGH_MASK; - do_div(priv->pll_clk_rate, sck_l + sck_h + 2); + do_div(pll_clk, sck_l + sck_h + 2); - us = CLK_TO_US(priv->pll_clk_rate, clk_count * 8); + us = CLK_TO_US(pll_clk, clk_count * 8); us += 1000 * 1000; /* 1s tolerance */ if (us > UINT_MAX) From 53a1eb994aeaa8d17643aff573086666ef0cc541 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Thu, 5 Oct 2023 06:37:17 +0200 Subject: [PATCH 08/29] arm: dts: k3-am65-iot2050: Fix boot Since commit 9e644284ab812 ("dm: core: Report bootph-pre-ram/sram node as pre-reloc after relocation") A53 u-boot proper is broken. This is because nodes marked as 'bootph-pre-ram' are not available at u-boot proper before relocation. To fix this we mark all nodes in u-boot.dtsi as 'bootph-all'. Signed-off-by: Jan Kiszka Reviewed-by: Roger Quadros Reviewed-by: Nishanth Menon --- .../dts/k3-am65-iot2050-common-u-boot.dtsi | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/arch/arm/dts/k3-am65-iot2050-common-u-boot.dtsi b/arch/arm/dts/k3-am65-iot2050-common-u-boot.dtsi index 082a3c89d0f..d53f133cd63 100644 --- a/arch/arm/dts/k3-am65-iot2050-common-u-boot.dtsi +++ b/arch/arm/dts/k3-am65-iot2050-common-u-boot.dtsi @@ -15,18 +15,18 @@ }; leds { - bootph-pre-ram; + bootph-all; status-led-red { - bootph-pre-ram; + bootph-all; }; status-led-green { - bootph-pre-ram; + bootph-all; }; }; }; &cbass_mcu { - bootph-pre-ram; + bootph-all; mcu_navss: bus@28380000 { ringacc@2b800000 { @@ -53,70 +53,70 @@ }; &cbass_wakeup { - bootph-pre-ram; + bootph-all; }; &cbass_main { - bootph-pre-ram; + bootph-all; main_navss: bus@30800000 { - bootph-pre-ram; + bootph-all; }; }; &wkup_pmx0 { - bootph-pre-ram; + bootph-all; mcu-fss0-ospi0-pins-default { - bootph-pre-ram; + bootph-all; }; }; &main_pmx0 { - bootph-pre-ram; + bootph-all; main-uart1-pins-default { - bootph-pre-ram; + bootph-all; }; }; &main_uart1 { - bootph-pre-ram; + bootph-all; current-speed = <115200>; }; &wkup_gpio0 { - bootph-pre-ram; + bootph-all; }; &ospi0 { - bootph-pre-ram; + bootph-all; flash@0 { - bootph-pre-ram; + bootph-all; }; }; &secure_proxy_main { - bootph-pre-ram; + bootph-all; }; &dmsc { - bootph-pre-ram; + bootph-all; k3_sysreset: sysreset-controller { compatible = "ti,sci-sysreset"; - bootph-pre-ram; + bootph-all; }; }; &k3_pds { - bootph-pre-ram; + bootph-all; }; &k3_clks { - bootph-pre-ram; + bootph-all; }; &k3_reset { - bootph-pre-ram; + bootph-all; }; &fss { - bootph-pre-ram; + bootph-all; }; From b362ceb4896faf37130686357df7e821fe96421d Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Thu, 5 Oct 2023 06:37:25 +0200 Subject: [PATCH 09/29] board: siemens: iot2050: Fix logical bug in PG1/PG2 detection This caused the wrong fdtfile to be set and was failing to apply M.2 settings. Fixes: badaa1f6a7a9 ("boards: siemens: iot2050: Unify PG1 and PG2/M.2 configurations again") Signed-off-by: Jan Kiszka --- board/siemens/iot2050/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/siemens/iot2050/board.c b/board/siemens/iot2050/board.c index 15f5310c7bf..e35e55fb5de 100644 --- a/board/siemens/iot2050/board.c +++ b/board/siemens/iot2050/board.c @@ -160,7 +160,7 @@ static bool board_is_sr1(void) struct iot2050_info *info = IOT2050_INFO_DATA; return info->magic == IOT2050_INFO_MAGIC && - strstr((char *)info->name, "-PG2") != NULL; + strstr((char *)info->name, "-PG2") == NULL; } static bool board_is_m2(void) From 693886856a668790debd72ffea1905ae849d5bc5 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Thu, 5 Oct 2023 09:21:17 -0500 Subject: [PATCH 10/29] arm: mach-k3: Remove secure device makefile This is now done using binman but this file was leftover and is now unused, remove it. Signed-off-by: Andrew Davis Reviewed-by: Neha Malcom Francis --- MAINTAINERS | 1 - arch/arm/mach-k3/config_secure.mk | 44 ------------------------------- 2 files changed, 45 deletions(-) delete mode 100644 arch/arm/mach-k3/config_secure.mk diff --git a/MAINTAINERS b/MAINTAINERS index efa71db652f..7201fbe9734 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1548,7 +1548,6 @@ F: arch/arm/mach-omap2/omap5/sec_entry_cpu1.S F: arch/arm/mach-omap2/sec-common.c F: arch/arm/mach-omap2/config_secure.mk F: arch/arm/mach-k3/security.c -F: arch/arm/mach-k3/config_secure.mk F: configs/am335x_hs_evm_defconfig F: configs/am335x_hs_evm_uart_defconfig F: configs/am43xx_hs_evm_defconfig diff --git a/arch/arm/mach-k3/config_secure.mk b/arch/arm/mach-k3/config_secure.mk deleted file mode 100644 index 9cc1f9eb24f..00000000000 --- a/arch/arm/mach-k3/config_secure.mk +++ /dev/null @@ -1,44 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2018 Texas Instruments, Incorporated - http://www.ti.com/ -# Andrew F. Davis - -quiet_cmd_k3secureimg = SECURE $@ -ifneq ($(TI_SECURE_DEV_PKG),) -ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh),) -cmd_k3secureimg = $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh \ - $< $@ \ - $(if $(KBUILD_VERBOSE:1=), >/dev/null) -else -cmd_k3secureimg = echo "WARNING:" \ - "$(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh not found." \ - "$@ was NOT secured!"; cp $< $@ -endif -else -cmd_k3secureimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \ - "variable must be defined for TI secure devices." \ - "$@ was NOT secured!"; cp $< $@ -endif - -%.dtb_HS: %.dtb FORCE - $(call if_changed,k3secureimg) - -$(obj)/u-boot-spl-nodtb.bin_HS: $(obj)/u-boot-spl-nodtb.bin FORCE - $(call if_changed,k3secureimg) - -tispl.bin_HS: $(obj)/u-boot-spl-nodtb.bin_HS $(patsubst %,$(obj)/dts/%.dtb_HS,$(subst ",,$(CONFIG_SPL_OF_LIST))) $(SPL_ITS) FORCE - $(call if_changed,mkfitimage) - -MKIMAGEFLAGS_u-boot.img_HS = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ - -a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ - -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \ - $(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST))) - -OF_LIST_TARGETS = $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) -$(OF_LIST_TARGETS): dtbs - -u-boot-nodtb.bin_HS: u-boot-nodtb.bin FORCE - $(call if_changed,k3secureimg) - -u-boot.img_HS: u-boot-nodtb.bin_HS u-boot.img $(patsubst %.dtb,%.dtb_HS,$(OF_LIST_TARGETS)) FORCE - $(call if_changed,mkimage) From 9214da7b931e7ee150a2f1da80af2a20ce8194ab Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Thu, 5 Oct 2023 13:15:14 -0500 Subject: [PATCH 11/29] arm: dts: k3-j721e-sk/common-proc-board: Fix boot Since commit 9e644284ab81 ("dm: core: Report bootph-pre-ram/sram node as pre-reloc after relocation") A53 u-boot proper is broken. This is because nodes marked as 'bootph-pre-ram' are not available at u-boot proper before relocation. To fix this we mark all nodes in u-boot.dtsi as 'bootph-all'. Fixes: 69b19ca67bcb ("arm: dts: k3-j721e: Sync with v6.6-rc1") Cc: Neha Francis Signed-off-by: Nishanth Menon Tested-by: Tom Rini # J721E-EVM GP Tested-by: Neha Malcom Francis Reviewed-by: Roger Quadros --- .../k3-j721e-common-proc-board-u-boot.dtsi | 82 +++++++++---------- arch/arm/dts/k3-j721e-sk-u-boot.dtsi | 70 ++++++++-------- 2 files changed, 76 insertions(+), 76 deletions(-) diff --git a/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi b/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi index c638af63c18..cd95907b981 100644 --- a/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi +++ b/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi @@ -6,27 +6,27 @@ #include "k3-j721e-binman.dtsi" &cbass_main { - bootph-pre-ram; + bootph-all; }; &main_navss { - bootph-pre-ram; + bootph-all; }; &cbass_mcu_wakeup { - bootph-pre-ram; + bootph-all; chipid@43000014 { - bootph-pre-ram; + bootph-all; }; }; &mcu_navss { - bootph-pre-ram; + bootph-all; }; &mcu_ringacc { - bootph-pre-ram; + bootph-all; }; &mcu_udmap { @@ -38,144 +38,144 @@ <0x0 0x28400000 0x0 0x2000>; reg-names = "gcfg", "rchan", "rchanrt", "tchan", "tchanrt", "rflow"; - bootph-pre-ram; + bootph-all; }; &secure_proxy_main { - bootph-pre-ram; + bootph-all; }; &dmsc { - bootph-pre-ram; + bootph-all; k3_sysreset: sysreset-controller { compatible = "ti,sci-sysreset"; - bootph-pre-ram; + bootph-all; }; }; &k3_pds { - bootph-pre-ram; + bootph-all; }; &k3_clks { - bootph-pre-ram; + bootph-all; }; &k3_reset { - bootph-pre-ram; + bootph-all; }; &wkup_pmx0 { - bootph-pre-ram; + bootph-all; }; &main_pmx0 { - bootph-pre-ram; + bootph-all; }; &main_uart0 { - bootph-pre-ram; + bootph-all; }; &mcu_uart0 { - bootph-pre-ram; + bootph-all; }; &main_sdhci0 { - bootph-pre-ram; + bootph-all; }; &main_sdhci1 { - bootph-pre-ram; + bootph-all; }; &main_uart0_pins_default { - bootph-pre-ram; + bootph-all; }; &main_usbss0_pins_default { - bootph-pre-ram; + bootph-all; }; &usbss0 { - bootph-pre-ram; + bootph-all; }; &usb0 { dr_mode = "peripheral"; - bootph-pre-ram; + bootph-all; }; &main_mmc1_pins_default { - bootph-pre-ram; + bootph-all; }; &wkup_i2c0_pins_default { - bootph-pre-ram; + bootph-all; }; &wkup_uart0 { - bootph-pre-ram; + bootph-all; status = "okay"; }; &wkup_i2c0 { - bootph-pre-ram; + bootph-all; status = "okay"; }; &main_i2c0 { - bootph-pre-ram; + bootph-all; }; &main_i2c0_pins_default { - bootph-pre-ram; + bootph-all; }; &main_esm { - bootph-pre-ram; + bootph-all; }; &exp2 { - bootph-pre-ram; + bootph-all; }; &mcu_fss0_ospi0_pins_default { - bootph-pre-ram; + bootph-all; }; &fss { - bootph-pre-ram; + bootph-all; }; &wkup_gpio0 { - bootph-pre-ram; + bootph-all; }; &ospi0 { - bootph-pre-ram; + bootph-all; flash@0 { - bootph-pre-ram; + bootph-all; }; }; &ospi1 { - bootph-pre-ram; + bootph-all; flash@0 { - bootph-pre-ram; + bootph-all; }; }; &mcu_fss0_hpb0_pins_default { - bootph-pre-ram; + bootph-all; }; &wkup_gpio_pins_default { - bootph-pre-ram; + bootph-all; }; &mcu_fss0_ospi1_pins_default { - bootph-pre-ram; + bootph-all; }; diff --git a/arch/arm/dts/k3-j721e-sk-u-boot.dtsi b/arch/arm/dts/k3-j721e-sk-u-boot.dtsi index 57da7c210a8..370fe5190b2 100644 --- a/arch/arm/dts/k3-j721e-sk-u-boot.dtsi +++ b/arch/arm/dts/k3-j721e-sk-u-boot.dtsi @@ -6,27 +6,27 @@ #include "k3-j721e-binman.dtsi" &cbass_main { - bootph-pre-ram; + bootph-all; }; &main_navss { - bootph-pre-ram; + bootph-all; }; &cbass_mcu_wakeup { - bootph-pre-ram; + bootph-all; chipid@43000014 { - bootph-pre-ram; + bootph-all; }; }; &mcu_navss { - bootph-pre-ram; + bootph-all; }; &mcu_ringacc { - bootph-pre-ram; + bootph-all; }; &mcu_udmap { @@ -38,120 +38,120 @@ <0x0 0x28400000 0x0 0x2000>; reg-names = "gcfg", "rchan", "rchanrt", "tchan", "tchanrt", "rflow"; - bootph-pre-ram; + bootph-all; }; &secure_proxy_main { - bootph-pre-ram; + bootph-all; }; &dmsc { - bootph-pre-ram; + bootph-all; k3_sysreset: sysreset-controller { compatible = "ti,sci-sysreset"; - bootph-pre-ram; + bootph-all; }; }; &k3_pds { - bootph-pre-ram; + bootph-all; }; &k3_clks { - bootph-pre-ram; + bootph-all; }; &k3_reset { - bootph-pre-ram; + bootph-all; }; &wkup_pmx0 { - bootph-pre-ram; + bootph-all; }; &main_pmx0 { - bootph-pre-ram; + bootph-all; }; &main_uart0 { - bootph-pre-ram; + bootph-all; }; &mcu_uart0 { - bootph-pre-ram; + bootph-all; }; &main_sdhci1 { - bootph-pre-ram; + bootph-all; }; &main_uart0_pins_default { - bootph-pre-ram; + bootph-all; }; &main_usbss0_pins_default { - bootph-pre-ram; + bootph-all; }; &usbss0 { - bootph-pre-ram; + bootph-all; }; &usb0 { dr_mode = "host"; - bootph-pre-ram; + bootph-all; }; &main_usbss1_pins_default { - bootph-pre-ram; + bootph-all; }; &usbss1 { - bootph-pre-ram; + bootph-all; }; &usb1 { dr_mode = "host"; - bootph-pre-ram; + bootph-all; }; &main_mmc1_pins_default { - bootph-pre-ram; + bootph-all; }; &wkup_i2c0_pins_default { - bootph-pre-ram; + bootph-all; }; &wkup_i2c0 { - bootph-pre-ram; + bootph-all; }; &wkup_uart0 { - bootph-pre-ram; + bootph-all; status = "okay"; }; &mcu_fss0_ospi0_pins_default { - bootph-pre-ram; + bootph-all; }; &fss { - bootph-pre-ram; + bootph-all; }; &main_esm { - bootph-pre-ram; + bootph-all; }; &ospi0 { - bootph-pre-ram; + bootph-all; flash@0 { - bootph-pre-ram; + bootph-all; partition@3fc0000 { - bootph-pre-ram; + bootph-all; }; }; }; From 1786861415f4494a38630584a8fbc9c939a024ce Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Sat, 7 Oct 2023 22:01:56 -0400 Subject: [PATCH 12/29] malloc: Enable assertions if UNIT_TEST is enabled dlmalloc has some sanity checks it performs on free() which can help detect memory corruption. However, they are only enabled if DEBUG is defined before including common.h. Define DEBUG earlier if UNIT_TEST is enabled so that assertions are enabled in sandbox. Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- common/dlmalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 87a09d38fb3..de3f04225f4 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -8,14 +8,14 @@ * as file malloc-2.6.6.c. */ -#include -#include -#include - #if CONFIG_IS_ENABLED(UNIT_TEST) #define DEBUG #endif +#include +#include +#include + #include #include #include From 5be1fef7f3a4d4580f20e8c78292659fe9043dc0 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Tue, 10 Oct 2023 13:13:04 +0200 Subject: [PATCH 13/29] arm: dts: k3-am625-verdin: fix boot A53 U-Boot proper got broken because nodes marked as 'bootph-pre-ram' are no longer available in U-Boot proper before relocation. Fix this by marking all nodes in u-boot.dtsi as 'bootph-all'. Fixes: 9e644284ab812 ("dm: core: Report bootph-pre-ram/sram node as pre-reloc after relocation") Signed-off-by: Marcel Ziswiler --- .../dts/k3-am625-verdin-wifi-dev-u-boot.dtsi | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/arch/arm/dts/k3-am625-verdin-wifi-dev-u-boot.dtsi b/arch/arm/dts/k3-am625-verdin-wifi-dev-u-boot.dtsi index 5d564603eb2..afa24d07a4c 100644 --- a/arch/arm/dts/k3-am625-verdin-wifi-dev-u-boot.dtsi +++ b/arch/arm/dts/k3-am625-verdin-wifi-dev-u-boot.dtsi @@ -17,49 +17,49 @@ }; memory@80000000 { - bootph-pre-ram; + bootph-all; }; }; &cbass_main { - bootph-pre-ram; + bootph-all; timer@2400000 { clock-frequency = <25000000>; - bootph-pre-ram; + bootph-all; }; }; &cbass_mcu { - bootph-pre-ram; + bootph-all; }; &cbass_wakeup { - bootph-pre-ram; + bootph-all; }; &chipid { - bootph-pre-ram; + bootph-all; }; &cpsw3g { - bootph-pre-ram; + bootph-all; }; &cpsw3g_phy0 { - bootph-pre-ram; + bootph-all; }; &cpsw3g_phy1 { - bootph-pre-ram; + bootph-all; }; &cpsw_port1 { - bootph-pre-ram; + bootph-all; }; &cpsw_port2 { - bootph-pre-ram; + bootph-all; }; /* MDIO, shared by Verdin ETH_1 (On-module PHY) and Verdin ETH_2_RGMII */ @@ -67,40 +67,40 @@ /delete-property/ assigned-clocks; /delete-property/ assigned-clock-parents; /delete-property/ assigned-clock-rates; - bootph-pre-ram; + bootph-all; }; &dmsc { - bootph-pre-ram; + bootph-all; k3_sysreset: sysreset-controller { compatible = "ti,sci-sysreset"; - bootph-pre-ram; + bootph-all; }; }; &dmss { - bootph-pre-ram; + bootph-all; }; &fss { - bootph-pre-ram; + bootph-all; }; &k3_clks { - bootph-pre-ram; + bootph-all; }; &k3_pds { - bootph-pre-ram; + bootph-all; }; &k3_reset { - bootph-pre-ram; + bootph-all; }; &main_gpio0 { - bootph-pre-ram; + bootph-all; }; /* On-module I2C - PMIC_I2C */ @@ -130,53 +130,53 @@ }; &main_pmx0 { - bootph-pre-ram; + bootph-all; }; /* Verdin UART_3, used as the Linux console */ &main_uart0 { - bootph-pre-ram; + bootph-all; }; /* Verdin UART_1 */ &main_uart1 { - bootph-pre-ram; + bootph-all; }; &mcu_pmx0 { - bootph-pre-ram; + bootph-all; }; &pinctrl_ctrl_sleep_moci { - bootph-pre-ram; + bootph-all; }; &pinctrl_i2c0 { - bootph-pre-ram; + bootph-all; }; &pinctrl_i2c1 { - bootph-pre-ram; + bootph-all; }; &pinctrl_sdhci0 { - bootph-pre-ram; + bootph-all; }; &pinctrl_uart0 { - bootph-pre-ram; + bootph-all; }; &pinctrl_uart1 { - bootph-pre-ram; + bootph-all; }; &pinctrl_wkup_uart0 { - bootph-pre-ram; + bootph-all; }; &sdhci0 { - bootph-pre-ram; + bootph-all; }; &sdhci2 { @@ -184,18 +184,18 @@ }; &secure_proxy_main { - bootph-pre-ram; + bootph-all; }; &verdin_ctrl_sleep_moci { - bootph-pre-ram; + bootph-all; }; &wkup_conf { - bootph-pre-ram; + bootph-all; }; /* Verdin UART_2 */ &wkup_uart0 { - bootph-pre-ram; + bootph-all; }; From 6442434d5184188871a33154b610f7ffdb13a406 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 24 Aug 2023 19:39:24 -0600 Subject: [PATCH 14/29] bootstd: Drop some TODOs The existing TODOs are done, so remove them. Add another that came up today. Signed-off-by: Simon Glass --- doc/develop/bootstd.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/develop/bootstd.rst b/doc/develop/bootstd.rst index 6172dc906bd..51cd5736627 100644 --- a/doc/develop/bootstd.rst +++ b/doc/develop/bootstd.rst @@ -781,9 +781,7 @@ To do Some things that need to be done to completely replace the distro-boot scripts: -- add bootdev drivers for dhcp, sata, scsi, ide, virtio -- PXE boot for EFI -- support for loading U-Boot scripts +- implement extensions (devicetree overlays with add-on boards) Other ideas: From 0cf1a136d861533645b901d5d3f09a1908883a63 Mon Sep 17 00:00:00 2001 From: Roman Azarenko Date: Fri, 25 Aug 2023 10:10:14 +0200 Subject: [PATCH 15/29] tools: ensure zeroed padding in external FIT images Padding the header of an external FIT image is achieved by truncating the existing temporary FIT file to match the required alignment before appending image data. Reusing an existing file this way means that the padding will likely contain a portion of the original data not overwritten by the new header. Zero out any data past the end of the new header, and stop at either the end of the desired padding, or the end of the old FIT file, whichever comes first. Fixes: 7946a814a319 ("Revert "mkimage: fit: Do not tail-pad fitImage with external data"") Signed-off-by: Roman Azarenko Reviewed-by: Simon Glass --- tools/fit_image.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/fit_image.c b/tools/fit_image.c index 10f36e93422..71e031c8550 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -497,7 +497,7 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname) { void *buf = NULL; int buf_ptr; - int fit_size, new_size; + int fit_size, unpadded_size, new_size, pad_boundary; int fd; struct stat sbuf; void *fdt; @@ -564,9 +564,13 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname) /* Pack the FDT and place the data after it */ fdt_pack(fdt); - new_size = fdt_totalsize(fdt); - new_size = ALIGN(new_size, align_size); + unpadded_size = fdt_totalsize(fdt); + new_size = ALIGN(unpadded_size, align_size); fdt_set_totalsize(fdt, new_size); + if (unpadded_size < fit_size) { + pad_boundary = new_size < fit_size ? new_size : fit_size; + memset(fdt + unpadded_size, 0, pad_boundary - unpadded_size); + } debug("Size reduced from %x to %x\n", fit_size, fdt_totalsize(fdt)); debug("External data size %x\n", buf_ptr); munmap(fdt, sbuf.st_size); From 31565bb0aa2d76b6941e96bcdbd204bae49ca828 Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Wed, 30 Aug 2023 12:32:30 +0100 Subject: [PATCH 16/29] driver: rng: Add DM_RNG interface for ARMv8.5 RNDR registers The ARMv8.5 architecture extension defines architectural RNDR/RNDRRS system registers, that provide 64 bits worth of randomness on every read. Since it's an extension, and implementing it is optional, there is a field in the ID_AA64ISAR0_EL1 ID register to query the availability of those registers. Add a UCLASS_RNG driver that returns entropy via repeated reads from those system registers, if the extension is implemented. The driver always binds, but checks the availability in the probe() routine. This helps systems which suffer from low boot entropy, since U-Boot can provide entropy via the generic UEFI entropy gathering protocol to the OS, at an early stage. Signed-off-by: Andre Przywara Reviewed-by: Simon Glass --- arch/arm/include/asm/system.h | 1 + drivers/rng/Kconfig | 6 +++ drivers/rng/Makefile | 1 + drivers/rng/arm_rndr.c | 82 +++++++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 drivers/rng/arm_rndr.c diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h index 87d1c77e8b1..0eae857e73a 100644 --- a/arch/arm/include/asm/system.h +++ b/arch/arm/include/asm/system.h @@ -84,6 +84,7 @@ #define HCR_EL2_HCD_DIS (1 << 29) /* Hypervisor Call disabled */ #define HCR_EL2_AMO_EL2 (1 << 5) /* Route SErrors to EL2 */ +#define ID_AA64ISAR0_EL1_RNDR (0xFUL << 60) /* RNDR random registers */ /* * ID_AA64ISAR1_EL1 bits definitions */ diff --git a/drivers/rng/Kconfig b/drivers/rng/Kconfig index 24666bff987..994cc35b274 100644 --- a/drivers/rng/Kconfig +++ b/drivers/rng/Kconfig @@ -76,6 +76,12 @@ config RNG_SMCCC_TRNG Enable random number generator for platforms that support Arm SMCCC TRNG interface. +config RNG_ARM_RNDR + bool "Generic ARMv8.5 RNDR register" + depends on DM_RNG && ARM64 + help + Use the ARMv8.5 RNDR register to provide random numbers. + config TPM_RNG bool "Enable random number generator on TPM device" depends on TPM diff --git a/drivers/rng/Makefile b/drivers/rng/Makefile index 192f911e155..47b323e61ee 100644 --- a/drivers/rng/Makefile +++ b/drivers/rng/Makefile @@ -13,4 +13,5 @@ obj-$(CONFIG_RNG_STM32) += stm32_rng.o obj-$(CONFIG_RNG_ROCKCHIP) += rockchip_rng.o obj-$(CONFIG_RNG_IPROC200) += iproc_rng200.o obj-$(CONFIG_RNG_SMCCC_TRNG) += smccc_trng.o +obj-$(CONFIG_RNG_ARM_RNDR) += arm_rndr.o obj-$(CONFIG_TPM_RNG) += tpm_rng.o diff --git a/drivers/rng/arm_rndr.c b/drivers/rng/arm_rndr.c new file mode 100644 index 00000000000..55989743eae --- /dev/null +++ b/drivers/rng/arm_rndr.c @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023, Arm Ltd. + * + * Use the (optional) ARMv8.5 RNDR register to provide random numbers to + * U-Boot's UCLASS_RNG users. + * Detection is done at runtime using the CPU ID registers. + */ + +#define LOG_CATEGORY UCLASS_RNG + +#include +#include +#include +#include +#include + +#define DRIVER_NAME "arm-rndr" + +static bool cpu_has_rndr(void) +{ + uint64_t reg; + + __asm__ volatile("mrs %0, ID_AA64ISAR0_EL1\n" : "=r" (reg)); + return !!(reg & ID_AA64ISAR0_EL1_RNDR); +} + +/* + * The system register name is RNDR, but this isn't widely known among older + * toolchains, and also triggers errors because of it being an architecture + * extension. Since we check the availability of the register before, it's + * fine to use here, though. + */ +#define RNDR "S3_3_C2_C4_0" + +static uint64_t read_rndr(void) +{ + uint64_t reg; + + __asm__ volatile("mrs %0, " RNDR "\n" : "=r" (reg)); + + return reg; +} + +static int arm_rndr_read(struct udevice *dev, void *data, size_t len) +{ + uint64_t random; + + while (len) { + int tocopy = min(sizeof(uint64_t), len); + + random = read_rndr(); + memcpy(data, &random, tocopy); + len -= tocopy; + data += tocopy; + } + + return 0; +} + +static const struct dm_rng_ops arm_rndr_ops = { + .read = arm_rndr_read, +}; + +static int arm_rndr_probe(struct udevice *dev) +{ + if (!cpu_has_rndr()) + return -ENODEV; + + return 0; +} + +U_BOOT_DRIVER(arm_rndr) = { + .name = DRIVER_NAME, + .id = UCLASS_RNG, + .ops = &arm_rndr_ops, + .probe = arm_rndr_probe, +}; + +U_BOOT_DRVINFO(cpu_arm_rndr) = { + .name = DRIVER_NAME, +}; From d1ca61ca7e7be080374c1d7e882c4d8aa7d7b70f Mon Sep 17 00:00:00 2001 From: Paul Barker Date: Fri, 1 Sep 2023 15:28:59 +0100 Subject: [PATCH 17/29] env: Improve ENV_OFFSET help message When reading Kconfig help messages to understand ENV_OFFSET and ENV_OFFSET_REDUND, developers may not realise that they need to also look at the chosen ENV_IS_IN_* options to see how the offsets will be interpreted. Signed-off-by: Paul Barker Reviewed-by: Simon Glass --- env/Kconfig | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/env/Kconfig b/env/Kconfig index 67b819d47a2..f5f09692332 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -576,7 +576,12 @@ config ENV_OFFSET default 0x260000 if ARCH_OMAP2PLUS default 0x1080000 if MICROBLAZE && ENV_IS_IN_SPI_FLASH help - Offset from the start of the device (or partition) + Offset from the start of the device (or partition). + + This offset may be interpreted differently depending on the chosen + ENV_IS_IN_* options. For example, for ENV_IS_IN_MMC=y, this offset may + be negative to indicate an offset backwards from the end of the + partition. See the relevant help messages for more details. config ENV_OFFSET_REDUND hex "Redundant environment offset" @@ -588,6 +593,11 @@ config ENV_OFFSET_REDUND Offset from the start of the device (or partition) of the redundant environment location. + This offset may be interpreted differently depending on the chosen + ENV_IS_IN_* options. For example, for ENV_IS_IN_MMC=y, this offset may + be negative to indicate an offset backwards from the end of the + partition. See the relevant help messages for more details. + config ENV_SIZE hex "Environment Size" default 0x40000 if ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP From e65f6ba08b4c75f1703d05b9524413da3c052b5e Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Tue, 5 Sep 2023 15:48:08 +0200 Subject: [PATCH 18/29] event: Rename rest of EVENT_SPY to EVENT_SPY_FULL or EVENT_SPY* Fix up remaining occurances of EVENT_SPY with no suffix. Fixes: 6c4cad7438 ("event: Rename EVENT_SPY to EVENT_SPY_FULL") Signed-off-by: Marek Vasut Reviewed-by: Simon Glass --- common/Kconfig | 4 ++-- include/event.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/Kconfig b/common/Kconfig index 5e79b542217..93c96f23b01 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -620,7 +620,7 @@ config EVENT_DYNAMIC bool help Enable this to support adding an event spy at runtime, without adding - it to the EVENT_SPY() linker list. This increases code size slightly + it to the EVENT_SPY*() linker list. This increases code size slightly but provides more flexibility for boards and subsystems that need it. config EVENT_DEBUG @@ -648,7 +648,7 @@ config SPL_EVENT_DYNAMIC depends on SPL_EVENT && EVENT_DYNAMIC help Enable this to support adding an event spy at runtime, without adding - it to the EVENT_SPY() linker list. This increases code size slightly + it to the EVENT_SPY*() linker list. This increases code size slightly but provides more flexibility for boards and subsystems that need it. endif # EVENT diff --git a/include/event.h b/include/event.h index be4cefd6ae8..c5646b713ad 100644 --- a/include/event.h +++ b/include/event.h @@ -282,9 +282,9 @@ static inline const char *event_spy_id(struct evspy_info *spy) * { * return sandbox_early_getopt_check(); * } - * EVENT_SPY(EVT_MISC_INIT_F, sandbox_misc_init_f); + * EVENT_SPY_FULL(EVT_MISC_INIT_F, sandbox_misc_init_f); * - * where EVENT_SPY uses ll_entry_declare() + * where EVENT_SPY_FULL uses ll_entry_declare() * * In this case, LTO decides to drop the sandbox_misc_init_f() function * (which is fine) but then drops the linker-list entry too. This means From 0f2f5191e5352cc70e5a2a226cfd8529e28a3199 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Wed, 6 Sep 2023 23:50:34 +0200 Subject: [PATCH 19/29] arm: apple: Add initial Apple M2 Ultra support Apple's M2 Ultra SoC are somewhat similar to the M1 Ultra but needs a tweaked memory map as the M2 Pro/Max SoCs. USB, NVMe, UART, WDT and PCIe are working with the existing drivers. Signed-off-by: Janne Grunau Reviewed-by: Mark Kettenis --- arch/arm/mach-apple/board.c | 183 ++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/board.c index d5019481184..47393babbc6 100644 --- a/arch/arm/mach-apple/board.c +++ b/arch/arm/mach-apple/board.c @@ -444,6 +444,187 @@ static struct mm_region t6020_mem_map[] = { } }; +/* Apple M2 Ultra */ + +static struct mm_region t6022_mem_map[] = { + { + /* I/O */ + .virt = 0x280000000, + .phys = 0x280000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0x340000000, + .phys = 0x340000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0x380000000, + .phys = 0x380000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0x580000000, + .phys = 0x580000000, + .size = SZ_512M, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* PCIE */ + .virt = 0x5a0000000, + .phys = 0x5a0000000, + .size = SZ_512M, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRE) | + PTE_BLOCK_INNER_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* PCIE */ + .virt = 0x5c0000000, + .phys = 0x5c0000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRE) | + PTE_BLOCK_INNER_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0x700000000, + .phys = 0x700000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0xb00000000, + .phys = 0xb00000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0xf00000000, + .phys = 0xf00000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0x1300000000, + .phys = 0x1300000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0x2280000000, + .phys = 0x2280000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0x2340000000, + .phys = 0x2340000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0x2380000000, + .phys = 0x2380000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0x2580000000, + .phys = 0x2580000000, + .size = SZ_512M, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* PCIE */ + .virt = 0x25a0000000, + .phys = 0x25a0000000, + .size = SZ_512M, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRE) | + PTE_BLOCK_INNER_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* PCIE */ + .virt = 0x25c0000000, + .phys = 0x25c0000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRE) | + PTE_BLOCK_INNER_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0x2700000000, + .phys = 0x2700000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0x2b00000000, + .phys = 0x2b00000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0x2f00000000, + .phys = 0x2f00000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* I/O */ + .virt = 0x3300000000, + .phys = 0x3300000000, + .size = SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* RAM */ + .virt = 0x10000000000, + .phys = 0x10000000000, + .size = 16UL * SZ_1G, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_INNER_SHARE + }, { + /* Framebuffer */ + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) | + PTE_BLOCK_INNER_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* List terminator */ + 0, + } +}; + struct mm_region *mem_map; int board_init(void) @@ -488,6 +669,8 @@ void build_mem_map(void) else if (of_machine_is_compatible("apple,t6020") || of_machine_is_compatible("apple,t6021")) mem_map = t6020_mem_map; + else if (of_machine_is_compatible("apple,t6022")) + mem_map = t6022_mem_map; else panic("Unsupported SoC\n"); From 7efe195096b28d0372178310807a7b7f767dff10 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Mon, 25 Sep 2023 10:09:05 +0200 Subject: [PATCH 20/29] arm: dts: imx8mm-cl-iot-gate: rename overlay sources to .dtso Distinguish more clearly between source files meant for producing .dtb from those meant for producing .dtbo. No functional change, as we currently have rules for producing a foo.dtbo from either foo.dts or foo.dtso. Note that in the linux tree, all device tree overlay sources have been renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit 81d362732bac). So this is also a step towards staying closer to linux with respect to both Kbuild and device tree sources. Signed-off-by: Rasmus Villemoes --- ...-cl-iot-gate-ied-adc0.dts => imx8mm-cl-iot-gate-ied-adc0.dtso} | 0 ...-cl-iot-gate-ied-adc1.dts => imx8mm-cl-iot-gate-ied-adc1.dtso} | 0 ...-cl-iot-gate-ied-can0.dts => imx8mm-cl-iot-gate-ied-can0.dtso} | 0 ...-cl-iot-gate-ied-can1.dts => imx8mm-cl-iot-gate-ied-can1.dtso} | 0 ...-cl-iot-gate-ied-tpm0.dts => imx8mm-cl-iot-gate-ied-tpm0.dtso} | 0 ...-cl-iot-gate-ied-tpm1.dts => imx8mm-cl-iot-gate-ied-tpm1.dtso} | 0 .../{imx8mm-cl-iot-gate-ied.dts => imx8mm-cl-iot-gate-ied.dtso} | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename arch/arm/dts/{imx8mm-cl-iot-gate-ied-adc0.dts => imx8mm-cl-iot-gate-ied-adc0.dtso} (100%) rename arch/arm/dts/{imx8mm-cl-iot-gate-ied-adc1.dts => imx8mm-cl-iot-gate-ied-adc1.dtso} (100%) rename arch/arm/dts/{imx8mm-cl-iot-gate-ied-can0.dts => imx8mm-cl-iot-gate-ied-can0.dtso} (100%) rename arch/arm/dts/{imx8mm-cl-iot-gate-ied-can1.dts => imx8mm-cl-iot-gate-ied-can1.dtso} (100%) rename arch/arm/dts/{imx8mm-cl-iot-gate-ied-tpm0.dts => imx8mm-cl-iot-gate-ied-tpm0.dtso} (100%) rename arch/arm/dts/{imx8mm-cl-iot-gate-ied-tpm1.dts => imx8mm-cl-iot-gate-ied-tpm1.dtso} (100%) rename arch/arm/dts/{imx8mm-cl-iot-gate-ied.dts => imx8mm-cl-iot-gate-ied.dtso} (100%) diff --git a/arch/arm/dts/imx8mm-cl-iot-gate-ied-adc0.dts b/arch/arm/dts/imx8mm-cl-iot-gate-ied-adc0.dtso similarity index 100% rename from arch/arm/dts/imx8mm-cl-iot-gate-ied-adc0.dts rename to arch/arm/dts/imx8mm-cl-iot-gate-ied-adc0.dtso diff --git a/arch/arm/dts/imx8mm-cl-iot-gate-ied-adc1.dts b/arch/arm/dts/imx8mm-cl-iot-gate-ied-adc1.dtso similarity index 100% rename from arch/arm/dts/imx8mm-cl-iot-gate-ied-adc1.dts rename to arch/arm/dts/imx8mm-cl-iot-gate-ied-adc1.dtso diff --git a/arch/arm/dts/imx8mm-cl-iot-gate-ied-can0.dts b/arch/arm/dts/imx8mm-cl-iot-gate-ied-can0.dtso similarity index 100% rename from arch/arm/dts/imx8mm-cl-iot-gate-ied-can0.dts rename to arch/arm/dts/imx8mm-cl-iot-gate-ied-can0.dtso diff --git a/arch/arm/dts/imx8mm-cl-iot-gate-ied-can1.dts b/arch/arm/dts/imx8mm-cl-iot-gate-ied-can1.dtso similarity index 100% rename from arch/arm/dts/imx8mm-cl-iot-gate-ied-can1.dts rename to arch/arm/dts/imx8mm-cl-iot-gate-ied-can1.dtso diff --git a/arch/arm/dts/imx8mm-cl-iot-gate-ied-tpm0.dts b/arch/arm/dts/imx8mm-cl-iot-gate-ied-tpm0.dtso similarity index 100% rename from arch/arm/dts/imx8mm-cl-iot-gate-ied-tpm0.dts rename to arch/arm/dts/imx8mm-cl-iot-gate-ied-tpm0.dtso diff --git a/arch/arm/dts/imx8mm-cl-iot-gate-ied-tpm1.dts b/arch/arm/dts/imx8mm-cl-iot-gate-ied-tpm1.dtso similarity index 100% rename from arch/arm/dts/imx8mm-cl-iot-gate-ied-tpm1.dts rename to arch/arm/dts/imx8mm-cl-iot-gate-ied-tpm1.dtso diff --git a/arch/arm/dts/imx8mm-cl-iot-gate-ied.dts b/arch/arm/dts/imx8mm-cl-iot-gate-ied.dtso similarity index 100% rename from arch/arm/dts/imx8mm-cl-iot-gate-ied.dts rename to arch/arm/dts/imx8mm-cl-iot-gate-ied.dtso From 35c4bccd890cff6c10b47b77b2b8a2bb6292ae35 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Mon, 25 Sep 2023 10:09:06 +0200 Subject: [PATCH 21/29] iot2050: rename overlay sources to .dtso Distinguish more clearly between source files meant for producing .dtb from those meant for producing .dtbo. No functional change, as we currently have rules for producing a foo.dtbo from either foo.dts or foo.dtso. Note that in the linux tree, all device tree overlay sources have been renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit 81d362732bac). So this is also a step towards staying closer to linux with respect to both Kbuild and device tree sources. Signed-off-by: Rasmus Villemoes Reviewed-by: Jan Kiszka --- ... => k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-overlay.dtso} | 0 ...y.dts => k3-am6548-iot2050-advanced-m2-bkey-usb3-overlay.dtso} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename arch/arm/dts/{k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-overlay.dts => k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-overlay.dtso} (100%) rename arch/arm/dts/{k3-am6548-iot2050-advanced-m2-bkey-usb3-overlay.dts => k3-am6548-iot2050-advanced-m2-bkey-usb3-overlay.dtso} (100%) diff --git a/arch/arm/dts/k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-overlay.dts b/arch/arm/dts/k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-overlay.dtso similarity index 100% rename from arch/arm/dts/k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-overlay.dts rename to arch/arm/dts/k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-overlay.dtso diff --git a/arch/arm/dts/k3-am6548-iot2050-advanced-m2-bkey-usb3-overlay.dts b/arch/arm/dts/k3-am6548-iot2050-advanced-m2-bkey-usb3-overlay.dtso similarity index 100% rename from arch/arm/dts/k3-am6548-iot2050-advanced-m2-bkey-usb3-overlay.dts rename to arch/arm/dts/k3-am6548-iot2050-advanced-m2-bkey-usb3-overlay.dtso From e6e3a3d9fc96eaf459312bd657757260153360e2 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Mon, 25 Sep 2023 10:09:07 +0200 Subject: [PATCH 22/29] arm64: zynqmp: rename overlay sources to .dtso Distinguish more clearly between source files meant for producing .dtb from those meant for producing .dtbo. No functional change, as we currently have rules for producing a foo.dtbo from either foo.dts or foo.dtso. Note that in the linux tree, all device tree overlay sources have been renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit 81d362732bac). So this is also a step towards staying closer to linux with respect to both Kbuild and device tree sources. Signed-off-by: Rasmus Villemoes --- .../dts/{zynqmp-sck-kr-g-revA.dts => zynqmp-sck-kr-g-revA.dtso} | 0 .../dts/{zynqmp-sck-kr-g-revB.dts => zynqmp-sck-kr-g-revB.dtso} | 0 .../dts/{zynqmp-sck-kv-g-revA.dts => zynqmp-sck-kv-g-revA.dtso} | 0 .../dts/{zynqmp-sck-kv-g-revB.dts => zynqmp-sck-kv-g-revB.dtso} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename arch/arm/dts/{zynqmp-sck-kr-g-revA.dts => zynqmp-sck-kr-g-revA.dtso} (100%) rename arch/arm/dts/{zynqmp-sck-kr-g-revB.dts => zynqmp-sck-kr-g-revB.dtso} (100%) rename arch/arm/dts/{zynqmp-sck-kv-g-revA.dts => zynqmp-sck-kv-g-revA.dtso} (100%) rename arch/arm/dts/{zynqmp-sck-kv-g-revB.dts => zynqmp-sck-kv-g-revB.dtso} (100%) diff --git a/arch/arm/dts/zynqmp-sck-kr-g-revA.dts b/arch/arm/dts/zynqmp-sck-kr-g-revA.dtso similarity index 100% rename from arch/arm/dts/zynqmp-sck-kr-g-revA.dts rename to arch/arm/dts/zynqmp-sck-kr-g-revA.dtso diff --git a/arch/arm/dts/zynqmp-sck-kr-g-revB.dts b/arch/arm/dts/zynqmp-sck-kr-g-revB.dtso similarity index 100% rename from arch/arm/dts/zynqmp-sck-kr-g-revB.dts rename to arch/arm/dts/zynqmp-sck-kr-g-revB.dtso diff --git a/arch/arm/dts/zynqmp-sck-kv-g-revA.dts b/arch/arm/dts/zynqmp-sck-kv-g-revA.dtso similarity index 100% rename from arch/arm/dts/zynqmp-sck-kv-g-revA.dts rename to arch/arm/dts/zynqmp-sck-kv-g-revA.dtso diff --git a/arch/arm/dts/zynqmp-sck-kv-g-revB.dts b/arch/arm/dts/zynqmp-sck-kv-g-revB.dtso similarity index 100% rename from arch/arm/dts/zynqmp-sck-kv-g-revB.dts rename to arch/arm/dts/zynqmp-sck-kv-g-revB.dtso From 01bf2e2eb3ef9b8ad0f8a132f09955b6911a6908 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Mon, 25 Sep 2023 10:09:08 +0200 Subject: [PATCH 23/29] sandbox: rename overlay sources to .dtso Distinguish more clearly between source files meant for producing .dtb from those meant for producing .dtbo. No functional change, as we currently have rules for producing a foo.dtbo from either foo.dts or foo.dtso. Note that in the linux tree, all device tree overlay sources have been renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit 81d362732bac). So this is also a step towards staying closer to linux with respect to both Kbuild and device tree sources. Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- arch/sandbox/dts/{overlay0.dts => overlay0.dtso} | 0 arch/sandbox/dts/{overlay1.dts => overlay1.dtso} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename arch/sandbox/dts/{overlay0.dts => overlay0.dtso} (100%) rename arch/sandbox/dts/{overlay1.dts => overlay1.dtso} (100%) diff --git a/arch/sandbox/dts/overlay0.dts b/arch/sandbox/dts/overlay0.dtso similarity index 100% rename from arch/sandbox/dts/overlay0.dts rename to arch/sandbox/dts/overlay0.dtso diff --git a/arch/sandbox/dts/overlay1.dts b/arch/sandbox/dts/overlay1.dtso similarity index 100% rename from arch/sandbox/dts/overlay1.dts rename to arch/sandbox/dts/overlay1.dtso From 4fb7e570d6bc3658e581937940de8cde52bd4103 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Mon, 25 Sep 2023 10:09:09 +0200 Subject: [PATCH 24/29] doc: use .dtso as extension for device tree overlay sources Moving towards using .dtso for overlay sources, update the documentation examples to follow that pattern. Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- doc/develop/uefi/uefi.rst | 4 ++-- doc/usage/fdt_overlays.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst index 68f9b332d15..f8510d31d7a 100644 --- a/doc/develop/uefi/uefi.rst +++ b/doc/develop/uefi/uefi.rst @@ -594,10 +594,10 @@ To insert the lowest supported version into a dtb .. code-block:: console - $ dtc -@ -I dts -O dtb -o version.dtbo version.dts + $ dtc -@ -I dts -O dtb -o version.dtbo version.dtso $ fdtoverlay -i orig.dtb -o new.dtb -v version.dtbo -where version.dts looks like:: +where version.dtso looks like:: /dts-v1/; /plugin/; diff --git a/doc/usage/fdt_overlays.rst b/doc/usage/fdt_overlays.rst index 7f113edae37..81d0d37f3f1 100644 --- a/doc/usage/fdt_overlays.rst +++ b/doc/usage/fdt_overlays.rst @@ -43,7 +43,7 @@ traditional binary device-tree. For example: $ dtc -@ -I dts -O dtb -o base.dtb base.dts -**overlay.dts** +**overlay.dtso** :: @@ -63,7 +63,7 @@ traditional binary device-tree. For example: .. code-block:: console - $ dtc -@ -I dts -O dtb -o overlay.dtbo overlay.dts + $ dtc -@ -I dts -O dtb -o overlay.dtbo overlay.dtso Ways to Utilize Overlays in U-Boot ---------------------------------- From 4cb6c8e5f0de3c4c5f9eba51c6a1610934a8cf77 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Thu, 28 Sep 2023 10:02:57 +0200 Subject: [PATCH 25/29] mkimage: update man page and -h output The man page correctly said that -B was ignored without -E, while the `mkimage -h` output suggested otherwise. Now that -B can actually be used by itself, update the man page. While at it, also amend the `mkimage -h` line to mention the connection with -E. The FDT header is a fixed 40 bytes, so its size cannot (and is not) modified, while its alignment is a property of the address in RAM one loads the FIT to, so not something mkimage can affect in any way. (In the file itself, the header is of course at offset 0, which has all possible alignments already.) Reported-by: Sean Anderson Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- doc/mkimage.1 | 6 ++++-- tools/mkimage.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/mkimage.1 b/doc/mkimage.1 index d0a038a880a..c1903896f3d 100644 --- a/doc/mkimage.1 +++ b/doc/mkimage.1 @@ -281,8 +281,10 @@ properties. A \(oqdata-offset\(cq of 0 indicates that it starts in the first .BI \-B " alignment" .TQ .BI \-\-alignment " alignment" -The alignment, in hexadecimal, that external data will be aligned to. This -option only has an effect when \-E is specified. +The alignment, in hexadecimal, that the FDT structure will be aligned +to. With +.BR \-E , +also specifies the alignment for the external data. . .TP .BI \-p " external-position" diff --git a/tools/mkimage.c b/tools/mkimage.c index 6dfe3e1d42d..a5979fa6fd7 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -112,7 +112,7 @@ static void usage(const char *msg) " -f => input filename for FIT source\n" " -i => input filename for ramdisk file\n" " -E => place data outside of the FIT structure\n" - " -B => align size in hex for FIT structure and header\n" + " -B => align size in hex for FIT structure and, with -E, for the external data\n" " -b => append the device tree binary to the FIT\n" " -t => update the timestamp in the FIT\n"); #ifdef CONFIG_FIT_SIGNATURE From 89cfa35bfc4c5bcabdcf31c8e4631e0dddd508c3 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Sat, 30 Sep 2023 16:45:46 -0400 Subject: [PATCH 26/29] misc: fs_loader: Fix alignment of fs_loader driver DM_DRIVER_GET will redeclare the fs_loader driver without the correct alignment. This causes GCC to use the default section alignment of 32 bytes. This in turn creates a gap in the linker list due to the padding required to achieve the correct alignment, corrupting all further entries. Use DM_DRIVER_REF instead, which doesn't redeclare anything. Fixes: 0998a20cfc6 ("misc: fs_loader: Add function to get the chosen loader") Signed-off-by: Sean Anderson --- drivers/misc/fs_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c index ccf5c7a8037..1ffc199ba1e 100644 --- a/drivers/misc/fs_loader.c +++ b/drivers/misc/fs_loader.c @@ -316,7 +316,7 @@ int get_fs_loader(struct udevice **dev) return ret; /* Just create a new device */ - ret = device_bind(dm_root(), DM_DRIVER_GET(fs_loader), "default-loader", + ret = device_bind(dm_root(), DM_DRIVER_REF(fs_loader), "default-loader", &default_plat, ofnode_null(), dev); if (ret) return ret; From 3d5e52bd97f747694fac9259b4d2879a48256a7b Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Sun, 1 Oct 2023 23:52:12 +0100 Subject: [PATCH 27/29] ARM: psci: move GIC address override to Kconfig As the code to switch an ARM core from secure to the non-secure state needs to know the base address of the Generic Interrupt Controller (GIC), we read an Arm Cortex defined system register that is supposed to hold that base address. However there are SoCs out there that get this wrong, and this CBAR register either reads as 0 or points to the wrong address. To accommodate those systems, so far we use a macro defined in some platform specific header files, for affected boards. To simplify future extensions, replace that macro with a Kconfig variable that holds this override address, and define a default value for SoCs that need it. Signed-off-by: Andre Przywara Reviewed-by: Sam Edwards --- arch/arm/cpu/armv7/Kconfig | 10 ++++++++++ arch/arm/cpu/armv7/nonsec_virt.S | 4 ++-- arch/arm/cpu/armv7/virt-v7.c | 4 ++-- include/configs/arndale.h | 3 --- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/arch/arm/cpu/armv7/Kconfig b/arch/arm/cpu/armv7/Kconfig index ccc2f208677..f015d133cb0 100644 --- a/arch/arm/cpu/armv7/Kconfig +++ b/arch/arm/cpu/armv7/Kconfig @@ -58,6 +58,16 @@ config ARMV7_SECURE_MAX_SIZE default 0x3c00 if MACH_SUN8I && MACH_SUN8I_H3 default 0x10000 +config ARM_GIC_BASE_ADDRESS + hex + depends on ARMV7_NONSEC + depends on ARCH_EXYNOS5 + default 0x10480000 if ARCH_EXYNOS5 + help + Override the GIC base address if the Arm Cortex defined + CBAR/PERIPHBASE system register holds the wrong value. + Used by the PSCI code to configure the secure side of the GIC. + config ARMV7_VIRT bool "Enable support for hardware virtualization" if EXPERT depends on CPU_V7_HAS_VIRT && ARMV7_NONSEC diff --git a/arch/arm/cpu/armv7/nonsec_virt.S b/arch/arm/cpu/armv7/nonsec_virt.S index 9004074da2c..bed40fa3d99 100644 --- a/arch/arm/cpu/armv7/nonsec_virt.S +++ b/arch/arm/cpu/armv7/nonsec_virt.S @@ -112,8 +112,8 @@ ENTRY(_do_nonsec_entry) ENDPROC(_do_nonsec_entry) .macro get_cbar_addr addr -#ifdef CFG_ARM_GIC_BASE_ADDRESS - ldr \addr, =CFG_ARM_GIC_BASE_ADDRESS +#ifdef CONFIG_ARM_GIC_BASE_ADDRESS + ldr \addr, =CONFIG_ARM_GIC_BASE_ADDRESS #else mrc p15, 4, \addr, c15, c0, 0 @ read CBAR bfc \addr, #0, #15 @ clear reserved bits diff --git a/arch/arm/cpu/armv7/virt-v7.c b/arch/arm/cpu/armv7/virt-v7.c index c82b215b6f9..5ffeca13d91 100644 --- a/arch/arm/cpu/armv7/virt-v7.c +++ b/arch/arm/cpu/armv7/virt-v7.c @@ -26,8 +26,8 @@ static unsigned int read_id_pfr1(void) static unsigned long get_gicd_base_address(void) { -#ifdef CFG_ARM_GIC_BASE_ADDRESS - return CFG_ARM_GIC_BASE_ADDRESS + GIC_DIST_OFFSET; +#ifdef CONFIG_ARM_GIC_BASE_ADDRESS + return CONFIG_ARM_GIC_BASE_ADDRESS + GIC_DIST_OFFSET; #else unsigned periphbase; diff --git a/include/configs/arndale.h b/include/configs/arndale.h index b56effcd411..fa642564f4b 100644 --- a/include/configs/arndale.h +++ b/include/configs/arndale.h @@ -18,7 +18,4 @@ #define CFG_SMP_PEN_ADDR 0x02020000 -/* The PERIPHBASE in the CBAR register is wrong on the Arndale, so override it */ -#define CFG_ARM_GIC_BASE_ADDRESS 0x10480000 - #endif /* __CONFIG_H */ From a5b85ec4066043d14fcbdc38ebd29d43d3a837e2 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Thu, 3 Aug 2023 09:54:40 -0500 Subject: [PATCH 28/29] configs: am65x: Merge the HS and non-HS defconfigs K3 devices have runtime type board detection. Make the default defconfig include the secure configuration. Then remove the HS specific config. Non-HS devices will continue to boot due to runtime device type detection. Signed-off-by: Andrew Davis Tested-by: Tom Rini Reviewed-by: Manorit Chawdhry --- MAINTAINERS | 2 - configs/am65x_evm_a53_defconfig | 3 +- configs/am65x_evm_r5_defconfig | 1 + configs/am65x_evm_r5_usbdfu_defconfig | 1 + configs/am65x_evm_r5_usbmsc_defconfig | 1 + configs/am65x_hs_evm_a53_defconfig | 158 -------------------------- configs/am65x_hs_evm_r5_defconfig | 135 ---------------------- 7 files changed, 5 insertions(+), 296 deletions(-) delete mode 100644 configs/am65x_hs_evm_a53_defconfig delete mode 100644 configs/am65x_hs_evm_r5_defconfig diff --git a/MAINTAINERS b/MAINTAINERS index 7201fbe9734..7d5d05320c0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1560,8 +1560,6 @@ F: configs/k2hk_hs_evm_defconfig F: configs/k2e_hs_evm_defconfig F: configs/k2g_hs_evm_defconfig F: configs/k2l_hs_evm_defconfig -F: configs/am65x_hs_evm_r5_defconfig -F: configs/am65x_hs_evm_a53_defconfig TPM DRIVERS M: Ilias Apalodimas diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig index 19db33b9174..ef06aeb64e7 100644 --- a/configs/am65x_evm_a53_defconfig +++ b/configs/am65x_evm_a53_defconfig @@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_SKIP_LOWLEVEL_INIT=y CONFIG_ARCH_K3=y +CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL_LIBCOMMON_SUPPORT=y @@ -34,7 +35,7 @@ CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000 CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_SYSTEM_SETUP=y -CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern" +CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run init_${boot}; run boot_rprocs; if test ${boot_fit} -eq 1; then run get_fit_${boot}; run get_overlaystring; run run_fit; else; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern; fi;" CONFIG_LOGLEVEL=7 CONFIG_CONSOLE_MUX=y CONFIG_SPL_MAX_SIZE=0x58000 diff --git a/configs/am65x_evm_r5_defconfig b/configs/am65x_evm_r5_defconfig index b2f1e721b36..1f466df6cc9 100644 --- a/configs/am65x_evm_r5_defconfig +++ b/configs/am65x_evm_r5_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y +CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x55000 CONFIG_SPL_GPIO=y diff --git a/configs/am65x_evm_r5_usbdfu_defconfig b/configs/am65x_evm_r5_usbdfu_defconfig index f610b2dd94e..ab3f93eda49 100644 --- a/configs/am65x_evm_r5_usbdfu_defconfig +++ b/configs/am65x_evm_r5_usbdfu_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y +CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x55000 CONFIG_SPL_GPIO=y diff --git a/configs/am65x_evm_r5_usbmsc_defconfig b/configs/am65x_evm_r5_usbmsc_defconfig index 57a0e729e2a..f84e3a0aa6c 100644 --- a/configs/am65x_evm_r5_usbmsc_defconfig +++ b/configs/am65x_evm_r5_usbmsc_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y +CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x55000 CONFIG_SPL_GPIO=y diff --git a/configs/am65x_hs_evm_a53_defconfig b/configs/am65x_hs_evm_a53_defconfig deleted file mode 100644 index 7714c4d7368..00000000000 --- a/configs/am65x_hs_evm_a53_defconfig +++ /dev/null @@ -1,158 +0,0 @@ -CONFIG_ARM=y -CONFIG_SKIP_LOWLEVEL_INIT=y -CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y -CONFIG_SYS_MALLOC_LEN=0x2000000 -CONFIG_SYS_MALLOC_F_LEN=0x8000 -CONFIG_SPL_LIBCOMMON_SUPPORT=y -CONFIG_SPL_LIBGENERIC_SUPPORT=y -CONFIG_NR_DRAM_BANKS=2 -CONFIG_SOC_K3_AM654=y -CONFIG_TARGET_AM654_A53_EVM=y -CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y -CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000 -CONFIG_ENV_SIZE=0x20000 -CONFIG_ENV_OFFSET=0x680000 -CONFIG_DM_GPIO=y -CONFIG_SPL_DM_SPI=y -CONFIG_DEFAULT_DEVICE_TREE="k3-am654-base-board" -CONFIG_SPL_TEXT_BASE=0x80080000 -CONFIG_OF_LIBFDT_OVERLAY=y -CONFIG_DM_RESET=y -CONFIG_SPL_MMC=y -CONFIG_SPL_SERIAL=y -CONFIG_SPL_DRIVERS_MISC=y -CONFIG_SPL_STACK_R_ADDR=0x82000000 -CONFIG_ENV_OFFSET_REDUND=0x6A0000 -CONFIG_SPL_FS_FAT=y -CONFIG_SPL_LIBDISK_SUPPORT=y -CONFIG_SPL_SPI_FLASH_SUPPORT=y -CONFIG_SPL_SPI=y -# CONFIG_PSCI_RESET is not set -CONFIG_PCI=y -# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set -CONFIG_SPL_LOAD_FIT=y -CONFIG_DISTRO_DEFAULTS=y -CONFIG_OF_SYSTEM_SETUP=y -CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_fit_${boot}; run get_overlaystring; run run_fit" -CONFIG_LOGLEVEL=7 -CONFIG_CONSOLE_MUX=y -CONFIG_SPL_MAX_SIZE=0x58000 -CONFIG_SPL_HAS_BSS_LINKER_SECTION=y -CONFIG_SPL_BSS_START_ADDR=0x80a00000 -CONFIG_SPL_BSS_MAX_SIZE=0x80000 -CONFIG_SPL_SYS_MALLOC_SIMPLE=y -CONFIG_SPL_STACK_R=y -CONFIG_SPL_SYS_MALLOC=y -CONFIG_SPL_SYS_MALLOC_SIZE=0x800000 -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400 -CONFIG_SPL_DMA=y -CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img" -CONFIG_SPL_I2C=y -CONFIG_SPL_DM_MAILBOX=y -CONFIG_SPL_MTD_SUPPORT=y -CONFIG_SPL_DM_SPI_FLASH=y -CONFIG_SPL_DM_RESET=y -CONFIG_SPL_POWER_DOMAIN=y -# CONFIG_SPL_SPI_FLASH_TINY is not set -CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y -CONFIG_SPL_SPI_LOAD=y -CONFIG_SYS_SPI_U_BOOT_OFFS=0x280000 -CONFIG_SPL_YMODEM_SUPPORT=y -CONFIG_SYS_MAXARGS=64 -CONFIG_CMD_ASKENV=y -CONFIG_CMD_DFU=y -CONFIG_CMD_GPT=y -CONFIG_CMD_I2C=y -CONFIG_CMD_MMC=y -CONFIG_CMD_PCI=y -CONFIG_CMD_REMOTEPROC=y -CONFIG_CMD_USB=y -CONFIG_CMD_TIME=y -CONFIG_MTDIDS_DEFAULT="nor0=47040000.spi.0" -CONFIG_MTDPARTS_DEFAULT="mtdparts=47040000.spi.0:512k(ospi.tiboot3),2m(ospi.tispl),4m(ospi.u-boot),128k(ospi.env),128k(ospi.env.backup),1m(ospi.sysfw),-@8m(ospi.rootfs)" -CONFIG_CMD_UBI=y -# CONFIG_ISO_PARTITION is not set -CONFIG_OF_CONTROL=y -CONFIG_SPL_OF_CONTROL=y -CONFIG_SPL_MULTI_DTB_FIT=y -CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y -CONFIG_ENV_OVERWRITE=y -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_NET_RANDOM_ETHADDR=y -CONFIG_SPL_DM=y -CONFIG_SPL_DM_SEQ_ALIAS=y -CONFIG_SPL_REGMAP=y -CONFIG_SPL_OF_TRANSLATE=y -CONFIG_CLK=y -CONFIG_SPL_CLK=y -CONFIG_CLK_TI_SCI=y -CONFIG_DFU_MMC=y -CONFIG_DFU_RAM=y -CONFIG_DFU_SF=y -CONFIG_SYS_DFU_DATA_BUF_SIZE=0x20000 -CONFIG_SYS_DFU_MAX_FILE_SIZE=0x800000 -CONFIG_DMA_CHANNELS=y -CONFIG_TI_K3_NAVSS_UDMA=y -CONFIG_TI_SCI_PROTOCOL=y -CONFIG_DM_PCA953X=y -CONFIG_DM_I2C=y -CONFIG_I2C_SET_DEFAULT_BUS_NUM=y -CONFIG_SYS_I2C_OMAP24XX=y -CONFIG_DM_MAILBOX=y -CONFIG_K3_SEC_PROXY=y -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_ADMA=y -CONFIG_SPL_MMC_SDHCI_ADMA=y -CONFIG_MMC_SDHCI_AM654=y -CONFIG_MTD=y -CONFIG_DM_MTD=y -CONFIG_DM_SPI_FLASH=y -CONFIG_SPI_FLASH_SFDP_SUPPORT=y -CONFIG_SPI_FLASH_STMICRO=y -# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set -CONFIG_SPI_FLASH_MTD=y -CONFIG_PHY_TI_DP83867=y -CONFIG_PHY_FIXED=y -CONFIG_E1000=y -CONFIG_CMD_E1000=y -CONFIG_TI_AM65_CPSW_NUSS=y -CONFIG_PCI_KEYSTONE=y -CONFIG_PHY=y -CONFIG_AM654_PHY=y -CONFIG_OMAP_USB2_PHY=y -CONFIG_PINCTRL=y -# CONFIG_PINCTRL_GENERIC is not set -CONFIG_SPL_PINCTRL=y -# CONFIG_SPL_PINCTRL_GENERIC is not set -CONFIG_PINCTRL_SINGLE=y -CONFIG_POWER_DOMAIN=y -CONFIG_TI_SCI_POWER_DOMAIN=y -CONFIG_REMOTEPROC_TI_K3_R5F=y -CONFIG_RESET_TI_SCI=y -CONFIG_DM_SERIAL=y -CONFIG_SOC_DEVICE=y -CONFIG_SOC_DEVICE_TI_K3=y -CONFIG_SOC_TI=y -CONFIG_SPI=y -CONFIG_DM_SPI=y -CONFIG_CADENCE_QSPI=y -CONFIG_SYSRESET=y -CONFIG_SPL_SYSRESET=y -CONFIG_SYSRESET_TI_SCI=y -CONFIG_USB=y -CONFIG_DM_USB_GADGET=y -CONFIG_USB_XHCI_HCD=y -CONFIG_USB_XHCI_DWC3=y -CONFIG_USB_DWC3=y -CONFIG_USB_DWC3_GENERIC=y -CONFIG_USB_KEYBOARD=y -CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" -CONFIG_USB_GADGET_VENDOR_NUM=0x0451 -CONFIG_USB_GADGET_PRODUCT_NUM=0x6162 -CONFIG_USB_GADGET_DOWNLOAD=y diff --git a/configs/am65x_hs_evm_r5_defconfig b/configs/am65x_hs_evm_r5_defconfig deleted file mode 100644 index 8b3b3fcb136..00000000000 --- a/configs/am65x_hs_evm_r5_defconfig +++ /dev/null @@ -1,135 +0,0 @@ -CONFIG_ARM=y -CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y -CONFIG_SYS_MALLOC_LEN=0x2000000 -CONFIG_SYS_MALLOC_F_LEN=0x55000 -CONFIG_SPL_GPIO=y -CONFIG_SPL_LIBCOMMON_SUPPORT=y -CONFIG_SPL_LIBGENERIC_SUPPORT=y -CONFIG_NR_DRAM_BANKS=2 -CONFIG_SOC_K3_AM654=y -CONFIG_K3_EARLY_CONS=y -CONFIG_TARGET_AM654_R5_EVM=y -CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y -CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x41c7effc -CONFIG_ENV_SIZE=0x20000 -CONFIG_DM_GPIO=y -CONFIG_SPL_DM_SPI=y -CONFIG_DEFAULT_DEVICE_TREE="k3-am654-r5-base-board" -CONFIG_SPL_TEXT_BASE=0x41c00000 -CONFIG_DM_RESET=y -CONFIG_SPL_MMC=y -CONFIG_SPL_SERIAL=y -CONFIG_SPL_DRIVERS_MISC=y -CONFIG_SPL_STACK_R_ADDR=0x82000000 -CONFIG_SPL_FS_FAT=y -CONFIG_SPL_LIBDISK_SUPPORT=y -CONFIG_SPL_SPI_FLASH_SUPPORT=y -CONFIG_SPL_SPI=y -# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set -CONFIG_SPL_LOAD_FIT=y -CONFIG_USE_BOOTCOMMAND=y -# CONFIG_DISPLAY_CPUINFO is not set -CONFIG_SPL_MAX_SIZE=0x58000 -CONFIG_SPL_HAS_BSS_LINKER_SECTION=y -CONFIG_SPL_BSS_START_ADDR=0x41c7effc -CONFIG_SPL_BSS_MAX_SIZE=0xc00 -CONFIG_SPL_STACK_R=y -CONFIG_SPL_SEPARATE_BSS=y -CONFIG_SPL_SYS_MALLOC=y -CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y -CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000 -CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000 -CONFIG_SPL_EARLY_BSS=y -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400 -CONFIG_SPL_DMA=y -CONFIG_SPL_I2C=y -CONFIG_SPL_DM_MAILBOX=y -CONFIG_SPL_DM_SPI_FLASH=y -CONFIG_SPL_DM_RESET=y -CONFIG_SPL_POWER_DOMAIN=y -CONFIG_SPL_RAM_SUPPORT=y -CONFIG_SPL_RAM_DEVICE=y -CONFIG_SPL_REMOTEPROC=y -# CONFIG_SPL_SPI_FLASH_TINY is not set -CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y -CONFIG_SPL_SPI_LOAD=y -CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000 -CONFIG_SPL_YMODEM_SUPPORT=y -CONFIG_HUSH_PARSER=y -CONFIG_SYS_MAXARGS=64 -CONFIG_CMD_BOOTZ=y -CONFIG_SYS_BOOTM_LEN=0x4000000 -CONFIG_CMD_ASKENV=y -CONFIG_CMD_GPT=y -CONFIG_CMD_I2C=y -CONFIG_CMD_MMC=y -CONFIG_CMD_REMOTEPROC=y -# CONFIG_CMD_SETEXPR is not set -CONFIG_CMD_TIME=y -CONFIG_CMD_FAT=y -CONFIG_OF_CONTROL=y -CONFIG_SPL_OF_CONTROL=y -CONFIG_SPL_MULTI_DTB_FIT=y -CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y -CONFIG_ENV_OVERWRITE=y -CONFIG_ENV_IS_IN_FAT=y -CONFIG_ENV_FAT_DEVICE_AND_PART="1:1" -CONFIG_SYS_RELOC_GD_ENV_ADDR=y -CONFIG_SPL_DM=y -CONFIG_SPL_DM_SEQ_ALIAS=y -CONFIG_REGMAP=y -CONFIG_SPL_REGMAP=y -CONFIG_SPL_OF_TRANSLATE=y -CONFIG_CLK=y -CONFIG_SPL_CLK=y -CONFIG_CLK_TI_SCI=y -CONFIG_DMA_CHANNELS=y -CONFIG_TI_K3_NAVSS_UDMA=y -CONFIG_TI_SCI_PROTOCOL=y -CONFIG_DA8XX_GPIO=y -CONFIG_DM_I2C=y -CONFIG_I2C_SET_DEFAULT_BUS_NUM=y -CONFIG_SYS_I2C_OMAP24XX=y -CONFIG_DM_MAILBOX=y -CONFIG_K3_SEC_PROXY=y -CONFIG_K3_AVS0=y -CONFIG_MMC_SDHCI=y -CONFIG_SPL_MMC_SDHCI_ADMA=y -CONFIG_MMC_SDHCI_AM654=y -CONFIG_DM_SPI_FLASH=y -CONFIG_SPI_FLASH_SFDP_SUPPORT=y -CONFIG_SPI_FLASH_STMICRO=y -# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set -CONFIG_PINCTRL=y -# CONFIG_PINCTRL_GENERIC is not set -CONFIG_SPL_PINCTRL=y -# CONFIG_SPL_PINCTRL_GENERIC is not set -CONFIG_PINCTRL_SINGLE=y -CONFIG_POWER_DOMAIN=y -CONFIG_TI_SCI_POWER_DOMAIN=y -CONFIG_DM_REGULATOR=y -CONFIG_SPL_DM_REGULATOR=y -CONFIG_DM_REGULATOR_GPIO=y -CONFIG_SPL_DM_REGULATOR_GPIO=y -CONFIG_DM_REGULATOR_TPS62360=y -CONFIG_RAM=y -CONFIG_SPL_RAM=y -CONFIG_K3_SYSTEM_CONTROLLER=y -CONFIG_REMOTEPROC_TI_K3_ARM64=y -CONFIG_RESET_TI_SCI=y -CONFIG_DM_SERIAL=y -CONFIG_SOC_DEVICE=y -CONFIG_SOC_DEVICE_TI_K3=y -CONFIG_SOC_TI=y -CONFIG_SPI=y -CONFIG_DM_SPI=y -CONFIG_CADENCE_QSPI=y -CONFIG_SYSRESET=y -CONFIG_SPL_SYSRESET=y -CONFIG_SYSRESET_TI_SCI=y -CONFIG_TIMER=y -CONFIG_SPL_TIMER=y -CONFIG_OMAP_TIMER=y -CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 From 1a1d48e36a1b185884e82d72457f7a274e4d1857 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Thu, 3 Aug 2023 09:54:41 -0500 Subject: [PATCH 29/29] configs: Make TI_SECURE_DEVICE default for K3 All K3 boards now are secure by default, instead of setting this in each defconfig, make it implied by the ARCH config. The only exception is IOT2050, which I do not believe will have any problems with being a TI_SECURE_DEVICE, but for now turn it off to keep its config the same. Signed-off-by: Andrew Davis Tested-by: Tom Rini --- arch/arm/Kconfig | 1 + configs/am62ax_evm_a53_defconfig | 1 - configs/am62ax_evm_r5_defconfig | 1 - configs/am62x_evm_a53_defconfig | 1 - configs/am62x_evm_r5_defconfig | 1 - configs/am64x_evm_a53_defconfig | 1 - configs/am64x_evm_r5_defconfig | 1 - configs/iot2050_defconfig | 1 + configs/j7200_evm_a72_defconfig | 1 - configs/j7200_evm_r5_defconfig | 1 - configs/j721e_evm_a72_defconfig | 1 - configs/j721e_evm_r5_defconfig | 1 - configs/j721s2_evm_a72_defconfig | 1 - configs/j721s2_evm_r5_defconfig | 1 - 14 files changed, 2 insertions(+), 12 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 7b0978447f1..531b081de99 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -787,6 +787,7 @@ config ARCH_K3 select FIT select REGEX select FIT_SIGNATURE if ARM64 + imply TI_SECURE_DEVICE config ARCH_OMAP2PLUS bool "TI OMAP2+" diff --git a/configs/am62ax_evm_a53_defconfig b/configs/am62ax_evm_a53_defconfig index 773cf3a591c..d0a34c75505 100644 --- a/configs/am62ax_evm_a53_defconfig +++ b/configs/am62ax_evm_a53_defconfig @@ -1,6 +1,5 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y diff --git a/configs/am62ax_evm_r5_defconfig b/configs/am62ax_evm_r5_defconfig index 2c53673debb..d52de8bf8be 100644 --- a/configs/am62ax_evm_r5_defconfig +++ b/configs/am62ax_evm_r5_defconfig @@ -1,6 +1,5 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_F_LEN=0x9000 CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig index a2729c1d0e3..df2511546ea 100644 --- a/configs/am62x_evm_a53_defconfig +++ b/configs/am62x_evm_a53_defconfig @@ -1,6 +1,5 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y diff --git a/configs/am62x_evm_r5_defconfig b/configs/am62x_evm_r5_defconfig index ae3789bad3d..9ec3d562e71 100644 --- a/configs/am62x_evm_r5_defconfig +++ b/configs/am62x_evm_r5_defconfig @@ -1,6 +1,5 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_LEN=0x08000000 CONFIG_SYS_MALLOC_F_LEN=0x9000 CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/am64x_evm_a53_defconfig b/configs/am64x_evm_a53_defconfig index 9c41055b1e9..e92a651416a 100644 --- a/configs/am64x_evm_a53_defconfig +++ b/configs/am64x_evm_a53_defconfig @@ -1,7 +1,6 @@ CONFIG_ARM=y CONFIG_SKIP_LOWLEVEL_INIT=y CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL_GPIO=y diff --git a/configs/am64x_evm_r5_defconfig b/configs/am64x_evm_r5_defconfig index ddc41480583..0f9757b52e6 100644 --- a/configs/am64x_evm_r5_defconfig +++ b/configs/am64x_evm_r5_defconfig @@ -1,6 +1,5 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x80000 CONFIG_SPL_GPIO=y diff --git a/configs/iot2050_defconfig b/configs/iot2050_defconfig index 3cc0154e35e..c2def974efa 100644 --- a/configs/iot2050_defconfig +++ b/configs/iot2050_defconfig @@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_SKIP_LOWLEVEL_INIT=y CONFIG_ARCH_K3=y +# CONFIG_TI_SECURE_DEVICE is not set CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL_GPIO=y diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig index 481289d12ef..cb4a141675d 100644 --- a/configs/j7200_evm_a72_defconfig +++ b/configs/j7200_evm_a72_defconfig @@ -1,6 +1,5 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL_GPIO=y diff --git a/configs/j7200_evm_r5_defconfig b/configs/j7200_evm_r5_defconfig index 42ff450aa08..d25dd8134b6 100644 --- a/configs/j7200_evm_r5_defconfig +++ b/configs/j7200_evm_r5_defconfig @@ -1,6 +1,5 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x70000 CONFIG_SPL_GPIO=y diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig index 5d4fcafee86..99e0e168ebf 100644 --- a/configs/j721e_evm_a72_defconfig +++ b/configs/j721e_evm_a72_defconfig @@ -1,6 +1,5 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL_GPIO=y diff --git a/configs/j721e_evm_r5_defconfig b/configs/j721e_evm_r5_defconfig index 4d2eefc6ef0..e76ab5997fe 100644 --- a/configs/j721e_evm_r5_defconfig +++ b/configs/j721e_evm_r5_defconfig @@ -1,6 +1,5 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x70000 CONFIG_SPL_GPIO=y diff --git a/configs/j721s2_evm_a72_defconfig b/configs/j721s2_evm_a72_defconfig index ded61b6c91e..876f07816a2 100644 --- a/configs/j721s2_evm_a72_defconfig +++ b/configs/j721s2_evm_a72_defconfig @@ -1,6 +1,5 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL_GPIO=y diff --git a/configs/j721s2_evm_r5_defconfig b/configs/j721s2_evm_r5_defconfig index 6fd90defd59..48587270b81 100644 --- a/configs/j721s2_evm_r5_defconfig +++ b/configs/j721s2_evm_r5_defconfig @@ -1,6 +1,5 @@ CONFIG_ARM=y CONFIG_ARCH_K3=y -CONFIG_TI_SECURE_DEVICE=y CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x10000 CONFIG_SPL_GPIO=y