From dd83c1c865f5bd94efae10d4a8e519ad08c8486b Mon Sep 17 00:00:00 2001 From: Prasanth Babu Mantena Date: Mon, 30 Oct 2023 22:34:58 +0530 Subject: [PATCH 01/13] board: ti: common: board_detect: Fix EEPROM offset read for 1-byte EEPROM detection logic in ti_i2c_eeprom_get() involves reading the total size and the 1-byte size with an offset 1. The commit 9f393a2d7af8 ("board: ti: common: board_detect: Fix EEPROM read quirk for 2-byte") that attempts to fix this uses a wrong pointer to compare. The value with one offset is read into offset_test, but the pointer used to match was still ep, resulting in an invalid comparison of the values. The intent is to identify bad 2-byte addressing eeproms that get stuck on the successive reads. Fixes: 9f393a2d7af8 (board: ti: common: board_detect: Fix EEPROM read quirk for 2-byte) Signed-off-by: Prasanth Babu Mantena Tested-by: Matwey V. Kornilov Reviewed-by: Neha Malcom Francis --- board/ti/common/board_detect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c index 0ec6d1aaf4c..38e23ccbb67 100644 --- a/board/ti/common/board_detect.c +++ b/board/ti/common/board_detect.c @@ -129,7 +129,7 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, rc = dm_i2c_read(dev, 0x1, &offset_test, sizeof(offset_test)); - if (*((u32 *)ep) != (header & 0xFF)) + if (offset_test != ((header >> 8) & 0xFF)) one_byte_addressing = false; /* Corrupted data??? */ @@ -181,7 +181,7 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, rc = i2c_read(dev_addr, 0x1, byte, &offset_test, sizeof(offset_test)); - if (*((u32 *)ep) != (header & 0xFF)) + if (offset_test != ((header >> 8) & 0xFF)) one_byte_addressing = false; /* Corrupted data??? */ From cc7e3d1929342f9beb998933e26ce5e89d52a8fb Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 15 Jan 2024 14:46:56 +0100 Subject: [PATCH 02/13] cmd: increase default for SYS_MAXARGS The value of CONFIG SYS_MAXARGS limits the usability of the 'for' command. The current default of 16 is too low for some use case. Cf. https://bugs.launchpad.net/snap-core18/+bug/1910094 Increase the default to 64. Reported-by: Dave Jones Signed-off-by: Heinrich Schuchardt --- cmd/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index 58ab357c707..06aae30df30 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -94,7 +94,7 @@ config SYS_PROMPT_HUSH_PS2 config SYS_MAXARGS int "Maximum number arguments accepted by commands" - default 16 + default 64 config SYS_XTRACE bool "Command execution tracer" From e2e69291ee6031eccf50113fdd12099a1a7d44ba Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Thu, 18 Jan 2024 19:10:47 +0100 Subject: [PATCH 03/13] headers: don't depend on errno.h being available These headers follow the pattern: | #if CONFIG_IS_ENABLED(FANCY_FEATURE) | void foo(void); | #else | static inline void foo(void) { return -ENOSYS; } | #endif In the #else path ENOSYS is used, however linux/errno.h is not included. If errno.h has not been included already the compiler errors out even if the inline function is not referenced. Make those headers self contained. Signed-off-by: Max Krummenacher Reviewed-by: Francesco Dolcini Reviewed-by: Tom Rini --- include/dfu.h | 1 + include/dm/pinctrl.h | 2 ++ include/hwspinlock.h | 2 ++ include/i2c_eeprom.h | 2 ++ include/nvmem.h | 2 ++ include/power-domain.h | 2 ++ include/power/regulator.h | 2 ++ include/remoteproc.h | 1 + include/soc.h | 2 ++ include/spi-mem.h | 2 ++ include/sysinfo.h | 2 ++ include/tlv_eeprom.h | 2 ++ 12 files changed, 22 insertions(+) diff --git a/include/dfu.h b/include/dfu.h index 2f42781888a..fa1918cd663 100644 --- a/include/dfu.h +++ b/include/dfu.h @@ -10,6 +10,7 @@ #ifndef __DFU_ENTITY_H_ #define __DFU_ENTITY_H_ +#include #include #include #include diff --git a/include/dm/pinctrl.h b/include/dm/pinctrl.h index 70d8cc5ecac..e41baea6200 100644 --- a/include/dm/pinctrl.h +++ b/include/dm/pinctrl.h @@ -6,6 +6,8 @@ #ifndef __PINCTRL_H #define __PINCTRL_H +#include + #define PINNAME_SIZE 10 #define PINMUX_SIZE 90 diff --git a/include/hwspinlock.h b/include/hwspinlock.h index d8556c0b4b4..dd5135442ec 100644 --- a/include/hwspinlock.h +++ b/include/hwspinlock.h @@ -6,6 +6,8 @@ #ifndef _HWSPINLOCK_H_ #define _HWSPINLOCK_H_ +#include + /** * Implement a hwspinlock uclass. * Hardware spinlocks are used to perform hardware protection of diff --git a/include/i2c_eeprom.h b/include/i2c_eeprom.h index 32dcb034973..cba991e3574 100644 --- a/include/i2c_eeprom.h +++ b/include/i2c_eeprom.h @@ -6,6 +6,8 @@ #ifndef __I2C_EEPROM #define __I2C_EEPROM +#include + struct udevice; struct i2c_eeprom_ops { diff --git a/include/nvmem.h b/include/nvmem.h index 822e698bdd4..e6a8a98828b 100644 --- a/include/nvmem.h +++ b/include/nvmem.h @@ -6,6 +6,8 @@ #ifndef NVMEM_H #define NVMEM_H +#include + /** * DOC: Design * diff --git a/include/power-domain.h b/include/power-domain.h index 2ff6c77cd76..18525073e5e 100644 --- a/include/power-domain.h +++ b/include/power-domain.h @@ -6,6 +6,8 @@ #ifndef _POWER_DOMAIN_H #define _POWER_DOMAIN_H +#include + /** * A power domain is a portion of an SoC or chip that is powered by a * switchable source of power. In many cases, software has control over the diff --git a/include/power/regulator.h b/include/power/regulator.h index 200652cb3d7..bb07a814c79 100644 --- a/include/power/regulator.h +++ b/include/power/regulator.h @@ -7,6 +7,8 @@ #ifndef _INCLUDE_REGULATOR_H_ #define _INCLUDE_REGULATOR_H_ +#include + struct udevice; /** diff --git a/include/remoteproc.h b/include/remoteproc.h index a11dc8a9b6c..91a88791a47 100644 --- a/include/remoteproc.h +++ b/include/remoteproc.h @@ -14,6 +14,7 @@ * platforms have moved to dm/fdt. */ #include /* For platform data support - non dt world */ +#include /** * struct fw_rsc_hdr - firmware resource entry header diff --git a/include/soc.h b/include/soc.h index 850db28b76a..b8cfc507706 100644 --- a/include/soc.h +++ b/include/soc.h @@ -7,6 +7,8 @@ #ifndef __SOC_H #define __SOC_H +#include + #define SOC_MAX_STR_SIZE 128 struct udevice; diff --git a/include/spi-mem.h b/include/spi-mem.h index b07cf2ed83d..3c8e95b6f53 100644 --- a/include/spi-mem.h +++ b/include/spi-mem.h @@ -11,6 +11,8 @@ #ifndef __UBOOT_SPI_MEM_H #define __UBOOT_SPI_MEM_H +#include + struct udevice; #define SPI_MEM_OP_CMD(__opcode, __buswidth) \ diff --git a/include/sysinfo.h b/include/sysinfo.h index f2c1aa29d18..524c7d6b223 100644 --- a/include/sysinfo.h +++ b/include/sysinfo.h @@ -7,6 +7,8 @@ #ifndef __SYSINFO_H__ #define __SYSINFO_H__ +#include + struct udevice; /* diff --git a/include/tlv_eeprom.h b/include/tlv_eeprom.h index fd45e5f6ebb..2b1e19b2bdd 100644 --- a/include/tlv_eeprom.h +++ b/include/tlv_eeprom.h @@ -7,6 +7,8 @@ #ifndef __TLV_EEPROM_H_ #define __TLV_EEPROM_H_ +#include + /* * The Definition of the TlvInfo EEPROM format can be found at onie.org or * github.com/onie From a1f466a9400a5e9570909414af7dc4681284c444 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Wed, 17 Jan 2024 11:16:46 +0100 Subject: [PATCH 04/13] board: verdin-am62: improve comment on usb phy core voltage TI recommends to clear the bit independent of the used voltage. So the comment which claims to do it due to the core voltage at 0.85V is bogus. See https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1252724/am625-usb-phy-core-voltage-selection-and-vdda_core_usb-mismatch Signed-off-by: Max Krummenacher --- board/toradex/verdin-am62/verdin-am62.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/board/toradex/verdin-am62/verdin-am62.c b/board/toradex/verdin-am62/verdin-am62.c index 2718263eb19..e948fc16ba9 100644 --- a/board/toradex/verdin-am62/verdin-am62.c +++ b/board/toradex/verdin-am62/verdin-am62.c @@ -102,12 +102,13 @@ void spl_board_init(void) { u32 val; - /* Set USB0 PHY core voltage to 0.85V */ + /* Clear USB0_PHY_CTRL_CORE_VOLTAGE */ + /* TI recommends to clear the bit independent of VDDA_CORE_USB */ val = readl(CTRLMMR_USB0_PHY_CTRL); val &= ~(CORE_VOLTAGE); writel(val, CTRLMMR_USB0_PHY_CTRL); - /* Set USB1 PHY core voltage to 0.85V */ + /* Clear USB1_PHY_CTRL_CORE_VOLTAGE */ val = readl(CTRLMMR_USB1_PHY_CTRL); val &= ~(CORE_VOLTAGE); writel(val, CTRLMMR_USB1_PHY_CTRL); From 9c68b0427cd75b22758f8b262a6b9e8bcca64320 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Wed, 17 Jan 2024 11:16:47 +0100 Subject: [PATCH 05/13] arm: mach-k3: am62: move device identification accessor functions to header mach-k3/am625_fdt.c does fdt fixup depending on fields in the device identification register. Move the accessors to the device identification register as inline functions into the am62_hardware.h header, so that they can be used for other functionality. Signed-off-by: Max Krummenacher --- arch/arm/mach-k3/am625_fdt.c | 23 ------------------- arch/arm/mach-k3/include/mach/am62_hardware.h | 23 +++++++++++++++++++ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/arch/arm/mach-k3/am625_fdt.c b/arch/arm/mach-k3/am625_fdt.c index 37806907af1..970dd3447de 100644 --- a/arch/arm/mach-k3/am625_fdt.c +++ b/arch/arm/mach-k3/am625_fdt.c @@ -38,29 +38,6 @@ static void fdt_fixup_pru_node_am625(void *blob, int has_pru) fdt_del_node_path(blob, "/bus@f0000/pruss@30040000"); } -static int k3_get_core_nr(void) -{ - u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID); - - return (full_devid & JTAG_DEV_CORE_NR_MASK) >> JTAG_DEV_CORE_NR_SHIFT; -} - -static int k3_has_pru(void) -{ - u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID); - u32 feature_mask = (full_devid & JTAG_DEV_FEATURES_MASK) >> - JTAG_DEV_FEATURES_SHIFT; - - return !(feature_mask & JTAG_DEV_FEATURE_NO_PRU); -} - -static int k3_has_gpu(void) -{ - u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID); - - return (full_devid & JTAG_DEV_GPU_MASK) >> JTAG_DEV_GPU_SHIFT; -} - int ft_system_setup(void *blob, struct bd_info *bd) { fdt_fixup_cores_nodes_am625(blob, k3_get_core_nr()); diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h b/arch/arm/mach-k3/include/mach/am62_hardware.h index acd2d109c2c..ea5bcf5d3de 100644 --- a/arch/arm/mach-k3/include/mach/am62_hardware.h +++ b/arch/arm/mach-k3/include/mach/am62_hardware.h @@ -79,6 +79,29 @@ #define TI_SRAM_SCRATCH_BOARD_EEPROM_START 0x43c30000 +static inline int k3_get_core_nr(void) +{ + u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID); + + return (full_devid & JTAG_DEV_CORE_NR_MASK) >> JTAG_DEV_CORE_NR_SHIFT; +} + +static inline int k3_has_pru(void) +{ + u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID); + u32 feature_mask = (full_devid & JTAG_DEV_FEATURES_MASK) >> + JTAG_DEV_FEATURES_SHIFT; + + return !(feature_mask & JTAG_DEV_FEATURE_NO_PRU); +} + +static inline int k3_has_gpu(void) +{ + u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID); + + return (full_devid & JTAG_DEV_GPU_MASK) >> JTAG_DEV_GPU_SHIFT; +} + #if defined(CONFIG_SYS_K3_SPL_ATF) && !defined(__ASSEMBLY__) static const u32 put_device_ids[] = {}; From 00812e2257c95556af5fce5a131fbbcbc14d7615 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Wed, 17 Jan 2024 11:16:48 +0100 Subject: [PATCH 06/13] arm: mach-k3: am62: provide more soc feature info accessors Add two functions, one which returns the SoC speed grade and one which returns the SoC operating temperature range. Signed-off-by: Max Krummenacher --- arch/arm/mach-k3/include/mach/am62_hardware.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h b/arch/arm/mach-k3/include/mach/am62_hardware.h index ea5bcf5d3de..54380f36e16 100644 --- a/arch/arm/mach-k3/include/mach/am62_hardware.h +++ b/arch/arm/mach-k3/include/mach/am62_hardware.h @@ -86,6 +86,22 @@ static inline int k3_get_core_nr(void) return (full_devid & JTAG_DEV_CORE_NR_MASK) >> JTAG_DEV_CORE_NR_SHIFT; } +static inline char k3_get_speed_grade(void) +{ + u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID); + u32 speed_grade = (full_devid & JTAG_DEV_SPEED_MASK) >> + JTAG_DEV_SPEED_SHIFT; + + return 'A' - 1 + speed_grade; +} + +static inline int k3_get_temp_grade(void) +{ + u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID); + + return (full_devid & JTAG_DEV_TEMP_MASK) >> JTAG_DEV_TEMP_SHIFT; +} + static inline int k3_has_pru(void) { u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID); From d2099587d661c6ca2309256c0e04c06e26c8d34c Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Wed, 17 Jan 2024 11:16:49 +0100 Subject: [PATCH 07/13] board: verdin-am62: set cpu core voltage depending on speed grade Speed grade T requires the VDD_CORE voltage to be 0.85V if using the maximum core frequency. Speed grades G, K, S allow the VDD_CORE voltage to be 0.75V up to the maximum core frequency but allow to run at 0.85V. For efficiency in manufacturing and code maintenance we use 0.85V for the PMIC defaults and device tree settings and dynamically adjust the voltage in the PMIC and device tree to 0.75V for lower speed SKU to gain more than 100mW power consumption reduction. Signed-off-by: Max Krummenacher --- board/toradex/verdin-am62/verdin-am62.c | 47 +++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/board/toradex/verdin-am62/verdin-am62.c b/board/toradex/verdin-am62/verdin-am62.c index e948fc16ba9..395eb365a0b 100644 --- a/board/toradex/verdin-am62/verdin-am62.c +++ b/board/toradex/verdin-am62/verdin-am62.c @@ -14,10 +14,13 @@ #include #include #include +#include #include #include "../common/tdx-cfg-block.h" +#define VDD_CORE_REG "buck1" + DECLARE_GLOBAL_DATA_PTR; int board_init(void) @@ -50,9 +53,37 @@ int board_fit_config_name_match(const char *name) } #endif +static u32 get_vdd_core_nominal(void) +{ + int core_uvolt; + + switch (k3_get_speed_grade()) { + case 'G': + case 'K': + case 'S': + core_uvolt = 750000; + break; + case 'T': + default: + core_uvolt = 850000; + break; + } + return core_uvolt; +} + #if IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_OF_BOARD_SETUP) int ft_board_setup(void *blob, struct bd_info *bd) { + int core_uvolt; + + core_uvolt = get_vdd_core_nominal(); + if (core_uvolt != 850000) { + do_fixup_by_path_u32(blob, "/bus@f0000/i2c@20000000/pmic@30/regulators/buck1", + "regulator-max-microvolt", core_uvolt, 0); + do_fixup_by_path_u32(blob, "/bus@f0000/i2c@20000000/pmic@30/regulators/buck1", + "regulator-min-microvolt", core_uvolt, 0); + } + return ft_common_board_setup(blob, bd); } #endif @@ -87,6 +118,22 @@ static void select_dt_from_module_version(void) int board_late_init(void) { + int ret; + int core_uvolt; + struct udevice *dev = NULL; + + core_uvolt = get_vdd_core_nominal(); + if (core_uvolt != 850000) { + /* Set CPU core voltage to 0.75V for slower speed grades */ + ret = regulator_get_by_devname(VDD_CORE_REG, &dev); + if (ret) + pr_err("VDD CORE Regulator get error: %d\n", ret); + + ret = regulator_set_value_force(dev, core_uvolt); + if (ret) + pr_err("VDD CORE Regulator value setting error: %d\n", ret); + } + select_dt_from_module_version(); return 0; From 983d6e5bf05a106478e8827b5bc02a6a0b627f36 Mon Sep 17 00:00:00 2001 From: Svyatoslav Ryhel Date: Wed, 17 Jan 2024 12:55:46 +0200 Subject: [PATCH 08/13] cmd: bootmenu: rename U-Boot console to Exit It seems that the U-Boot console entry of the bootmenu has lost its original meaning. Now, even if it is chosen, the probability that you will enter the actual U-Boot console is quite low. Boot env, bootflow, bootcommand script may appear, but not the actual console. Hence, let's remove ambiguity and name this entry by what it actually does: 'Exit' the bootmenu. Signed-off-by: Svyatoslav Ryhel --- cmd/bootmenu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c index 987b16889f8..78184fccab2 100644 --- a/cmd/bootmenu.c +++ b/cmd/bootmenu.c @@ -119,7 +119,7 @@ static char *bootmenu_choice_entry(void *data) iter = iter->next; return iter->key; case BKEY_QUIT: - /* Quit by choosing the last entry - U-Boot console */ + /* Quit by choosing the last entry */ iter = menu->first; while (iter->next) iter = iter->next; @@ -361,15 +361,15 @@ static struct bootmenu_data *bootmenu_create(int delay) } #endif - /* Add U-Boot console entry at the end */ + /* Add Exit entry at the end */ if (i <= MAX_COUNT - 1) { entry = malloc(sizeof(struct bootmenu_entry)); if (!entry) goto cleanup; - /* Add Quit entry if entering U-Boot console is disabled */ + /* Add Quit entry if exiting bootmenu is disabled */ if (!IS_ENABLED(CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE)) - entry->title = strdup("U-Boot console"); + entry->title = strdup("Exit"); else entry->title = strdup("Quit"); @@ -532,7 +532,7 @@ static enum bootmenu_ret bootmenu_show(int delay) title = strdup(iter->title); command = strdup(iter->command); - /* last entry is U-Boot console or Quit */ + /* last entry exits bootmenu */ if (iter->num == iter->menu->count - 1) { ret = BOOTMENU_RET_QUIT; goto cleanup; From 9152a51e3c3af8cd766dfaad50aa5bb97678378c Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Wed, 17 Jan 2024 13:37:13 +0100 Subject: [PATCH 09/13] common: console: Fix print complete stdio device list In case CONSOLE_MUX and SYS_CONSOLE_IS_IN_ENV are on and stdin or stdout or stderr are missing in environment, as fallback, get these either from stdio_devices[std] or stdio_devices[std]->name. Fixes: 6b343ab38d ("console: Print out complete stdio device list") Signed-off-by: Patrice Chotard Reviewed-by: Bin Meng Reviewed-by: Marek Vasut --- common/console.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/common/console.c b/common/console.c index cad65891fc9..aa3053bc441 100644 --- a/common/console.c +++ b/common/console.c @@ -1049,9 +1049,16 @@ int console_clear(void) return 0; } +static char *get_stdio(const u8 std) +{ + return stdio_devices[std] ? stdio_devices[std]->name : "No devices available!"; +} + static void stdio_print_current_devices(void) { - char *stdinname, *stdoutname, *stderrname; + char *stdinname = NULL; + char *stdoutname = NULL; + char *stderrname = NULL; if (CONFIG_IS_ENABLED(CONSOLE_MUX) && CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV)) { @@ -1059,22 +1066,12 @@ static void stdio_print_current_devices(void) stdinname = env_get("stdin"); stdoutname = env_get("stdout"); stderrname = env_get("stderr"); - - stdinname = stdinname ? : "No input devices available!"; - stdoutname = stdoutname ? : "No output devices available!"; - stderrname = stderrname ? : "No error devices available!"; - } else { - stdinname = stdio_devices[stdin] ? - stdio_devices[stdin]->name : - "No input devices available!"; - stdoutname = stdio_devices[stdout] ? - stdio_devices[stdout]->name : - "No output devices available!"; - stderrname = stdio_devices[stderr] ? - stdio_devices[stderr]->name : - "No error devices available!"; } + stdinname = stdinname ? : get_stdio(stdin); + stdoutname = stdoutname ? : get_stdio(stdout); + stderrname = stderrname ? : get_stdio(stderr); + /* Print information */ puts("In: "); printf("%s\n", stdinname); From 3d878b83d091a202c67cc3184ba8f37ad79f2307 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 18 Jan 2024 12:10:07 -0500 Subject: [PATCH 10/13] docker: Add tools/buildman/requirements.txt to the cache As we have had this file for a while now, we should include installing and populating our pip cache from here as well. Signed-off-by: Tom Rini --- tools/docker/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 0e2dd0a6a94..6122776bc64 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -240,12 +240,14 @@ USER uboot:uboot # COPY / ADD directives don't work as we need them to. RUN wget -O /tmp/pytest-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/test/py/requirements.txt RUN wget -O /tmp/sphinx-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/doc/sphinx/requirements.txt +RUN wget -O /tmp/buildman-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/tools/buildman/requirements.txt RUN virtualenv -p /usr/bin/python3 /tmp/venv && \ . /tmp/venv/bin/activate && \ pip install -r /tmp/pytest-requirements.txt \ - -r /tmp/sphinx-requirements.txt && \ + -r /tmp/sphinx-requirements.txt \ + -r /tmp/buildman-requirements.txt && \ deactivate && \ - rm -rf /tmp/venv /tmp/pytest-requirements.txt /tmp/sphinx-requirements.txt + rm -rf /tmp/venv /tmp/*-requirements.txt # Create the buildman config file RUN /bin/echo -e "[toolchain]\nroot = /usr" > ~/.buildman From 3150da34c2689b28154432c4b863e01ab92d3214 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 18 Jan 2024 18:54:50 +0100 Subject: [PATCH 11/13] lib: add comment in utf8_to_utf32_stream() The logic of utf8_to_utf32_stream() is not easy to understand. Add a comment. Signed-off-by: Heinrich Schuchardt --- lib/charset.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/charset.c b/lib/charset.c index 89057ef7ce2..2b43175b1d9 100644 --- a/lib/charset.c +++ b/lib/charset.c @@ -570,6 +570,10 @@ int utf8_to_utf32_stream(u8 c, char *buffer) } if (pos == end) return 0; + /* + * Appending the byte lead to an invalid UTF-8 byte sequence. + * Consider it as the start of a new code sequence. + */ *buffer = 0; } } From aeba385e41673d6d2687f4dd60a7946cc7726509 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 18 Jan 2024 18:57:12 +0100 Subject: [PATCH 12/13] test: enhance unicode_test_utf8_to_utf32_stream() Additionally test a UTF-8 string where each code point translates to three UTF-8 bytes. Signed-off-by: Heinrich Schuchardt --- test/unicode_ut.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/unicode_ut.c b/test/unicode_ut.c index 1d0d90c2d73..47c3f52774c 100644 --- a/test/unicode_ut.c +++ b/test/unicode_ut.c @@ -752,9 +752,10 @@ static int unicode_test_utf8_to_utf32_stream(struct unit_test_state *uts) const u32 u1[] = {0x55, 0x2D, 0x42, 0x6F, 0x6F, 0x74, 0x0000}; const u32 u2[] = {0x6B, 0x61, 0x66, 0x62, 0xE1, 0x74, 0x75, 0x72, 0x00}; - const u32 u3[] = {0x0392, 0x20, 0x69, 0x73, 0x20, 0x6E, 0x6F, 0x74, - 0x20, 0x42, 0x00}; + const u32 u3[] = {0x6f5c, 0x6c34, 0x8266}; const u32 u4[] = {0x6A, 0x32, 0x6C, 0x00}; + const u32 u5[] = {0x0392, 0x20, 0x69, 0x73, 0x20, 0x6E, 0x6F, 0x74, + 0x20, 0x42, 0x00}; memset(buf, 0, sizeof(buf)); utf8_to_utf32_stream_helper(d1, buf); @@ -765,9 +766,13 @@ static int unicode_test_utf8_to_utf32_stream(struct unit_test_state *uts) ut_asserteq_mem(u2, buf, sizeof(u2)); memset(buf, 0, sizeof(buf)); - utf8_to_utf32_stream_helper(d5, buf); + utf8_to_utf32_stream_helper(d3, buf); ut_asserteq_mem(u3, buf, sizeof(u3)); + memset(buf, 0, sizeof(buf)); + utf8_to_utf32_stream_helper(d5, buf); + ut_asserteq_mem(u5, buf, sizeof(u5)); + memset(buf, 0, sizeof(buf)); utf8_to_utf32_stream_helper(j2, buf); ut_asserteq_mem(u4, buf, sizeof(u4)); From 53c3e386063b9e1ab955d4658a035f1eea8a1cc0 Mon Sep 17 00:00:00 2001 From: Yang Xiwen Date: Fri, 19 Jan 2024 20:49:17 +0800 Subject: [PATCH 13/13] reset: reset-hisilicon: also handle #reset-cells = <2> It's also valid to have #reset-cells = <2> while the third arg defaults to ASSERT_SET. Signed-off-by: Yang Xiwen --- drivers/reset/reset-hisilicon.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/reset/reset-hisilicon.c b/drivers/reset/reset-hisilicon.c index 8152cec2271..85e02b296b0 100644 --- a/drivers/reset/reset-hisilicon.c +++ b/drivers/reset/reset-hisilicon.c @@ -49,7 +49,18 @@ static int hisi_reset_assert(struct reset_ctl *rst) static int hisi_reset_of_xlate(struct reset_ctl *rst, struct ofnode_phandle_args *args) { - if (args->args_count != 3) { + unsigned long polarity; + + switch (args->args_count) { + case 2: + polarity = ASSERT_SET; + break; + + case 3: + polarity = args->args[2]; + break; + + default: debug("Invalid args_count: %d\n", args->args_count); return -EINVAL; } @@ -57,7 +68,7 @@ static int hisi_reset_of_xlate(struct reset_ctl *rst, /* Use .data field as register offset and .id field as bit shift */ rst->data = args->args[0]; rst->id = args->args[1]; - rst->polarity = args->args[2]; + rst->polarity = polarity; return 0; }