From 585a2aaac2ac043540b6f2e148de79517ce3a683 Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Fri, 20 Oct 2023 16:46:31 -0500 Subject: [PATCH 01/30] arm: exynos: Include missing CPU header in soc.c samsung_get_base_swreset() is called in soc.c, but corresponding header with its prototype is not included. Fix this to avoid possible build errors. Signed-off-by: Sam Protsenko Signed-off-by: Minkyu Kang --- arch/arm/mach-exynos/soc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-exynos/soc.c b/arch/arm/mach-exynos/soc.c index a07c87a2c8e..6fe61cf9288 100644 --- a/arch/arm/mach-exynos/soc.c +++ b/arch/arm/mach-exynos/soc.c @@ -9,6 +9,7 @@ #include #include #include +#include #ifdef CONFIG_TARGET_ESPRESSO7420 /* From c9ab9f30c8e41426d9d028821895ef3853f683fc Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Fri, 20 Oct 2023 16:46:32 -0500 Subject: [PATCH 02/30] arm: exynos: Include missing CPU header in gpio.h arch/arm/include/asm/arch/gpio.h relies on definitions from cpu.h. Include it explicitly in gpio.h. Otherwise next build error may occur: In file included from ./arch/arm/include/asm/gpio.h:7, from include/cros_ec.h:14, from board/samsung/common/board.c:8: ./arch/arm/include/asm/arch/gpio.h:1357:4: error: 'EXYNOS4_GPIO_PART1_BASE' undeclared here (not in a function); did you mean 'EXYNOS4_GPIO_MAX_PORT'? 1357 | { EXYNOS4_GPIO_PART1_BASE, EXYNOS4_GPIO_MAX_PORT_PART_1 }, | ^~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Sam Protsenko Signed-off-by: Minkyu Kang --- arch/arm/mach-exynos/include/mach/gpio.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-exynos/include/mach/gpio.h b/arch/arm/mach-exynos/include/mach/gpio.h index f9975d7919f..9eeeb769996 100644 --- a/arch/arm/mach-exynos/include/mach/gpio.h +++ b/arch/arm/mach-exynos/include/mach/gpio.h @@ -8,6 +8,9 @@ #define __ASM_ARCH_GPIO_H #ifndef __ASSEMBLY__ + +#include + struct s5p_gpio_bank { unsigned int con; unsigned int dat; From 11bd2787deff113634cb9f330d9287e6d3d76e9e Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Fri, 20 Oct 2023 16:46:33 -0500 Subject: [PATCH 03/30] watchdog: s5p_wdt: Include missing CPU header s5p watchdog driver calls samsung_get_base_watchdog() function, but its prototype is not included. That might lead to build warnings like this: drivers/watchdog/s5p_wdt.c: In function 'wdt_stop': drivers/watchdog/s5p_wdt.c:16:26: warning: implicit declaration of function 'samsung_get_base_watchdog' [-Wimplicit-function-declaration] 16 | (struct s5p_watchdog *)samsung_get_base_watchdog(); | ^~~~~~~~~~~~~~~~~~~~~~~~~ Include asm/arch/cpu.h to fix that issue. Signed-off-by: Sam Protsenko Signed-off-by: Minkyu Kang --- drivers/watchdog/s5p_wdt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/s5p_wdt.c b/drivers/watchdog/s5p_wdt.c index 5ad7d2609f0..80524a00101 100644 --- a/drivers/watchdog/s5p_wdt.c +++ b/drivers/watchdog/s5p_wdt.c @@ -6,6 +6,7 @@ #include #include +#include #include #define PRESCALER_VAL 255 From 08cfa971a717ff6aedf52066efb9e227eaa7aac4 Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Mon, 30 Oct 2023 11:55:02 -0500 Subject: [PATCH 04/30] exynos: Avoid duplicate reset_cpu with SYSRESET enabled The sysreset uclass unconditionally provides a definition of the reset_cpu() function. So does the exynos soc code. Fix the build with SYSRESET enabled by omitting the function from the soc code in that case. The code still needs to be kept around for use in SPL. This commit was inspired by commit 6e19dc84c14b ("sunxi: Avoid duplicate reset_cpu with SYSRESET enabled"). Signed-off-by: Sam Protsenko Reviewed-by: Tom Rini Signed-off-by: Minkyu Kang --- arch/arm/mach-exynos/soc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-exynos/soc.c b/arch/arm/mach-exynos/soc.c index 6fe61cf9288..aff2b5e1b6e 100644 --- a/arch/arm/mach-exynos/soc.c +++ b/arch/arm/mach-exynos/soc.c @@ -21,12 +21,14 @@ extern void _main(void); void *secondary_boot_addr = (void *)_main; #endif /* CONFIG_TARGET_ESPRESSO7420 */ +#if !CONFIG_IS_ENABLED(SYSRESET) void reset_cpu(void) { #ifdef CONFIG_CPU_V7A writel(0x1, samsung_get_base_swreset()); #endif } +#endif #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) void enable_caches(void) From 2227f4c0afed9fef940ace67d1482417eb876316 Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Tue, 7 Nov 2023 11:34:17 -0600 Subject: [PATCH 05/30] serial: s5p: Fix clk_get_by_index() error code check clk_get_by_index() returns negative number on error. Assigning it to unsigned int makes the subsequent "ret < 0" check always false, leading in turn to possible unhandled errors. Change 'ret' variable type to signed int so the code checks and handles clk_get_by_index() return code properly. Signed-off-by: Sam Protsenko Fixes: cf75cdf96ef2 ("serial: s5p: use clock api to get clock rate") Signed-off-by: Minkyu Kang --- drivers/serial/serial_s5p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index 7aeb8c0f8cb..fe52580d64d 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -118,7 +118,7 @@ int s5p_serial_setbrg(struct udevice *dev, int baudrate) #if IS_ENABLED(CONFIG_CLK_EXYNOS) || IS_ENABLED(CONFIG_ARCH_APPLE) struct clk clk; - u32 ret; + int ret; ret = clk_get_by_index(dev, 1, &clk); if (ret < 0) From f655090901dce2a3890efb07c3f341d5b8bc2ae9 Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Tue, 7 Nov 2023 15:22:00 -0600 Subject: [PATCH 06/30] clk: exynos: Add header guard for clk-pll.h The clk-pll.h is going to be included in multiple files soon. Add missing header guard to prevent possible build errors in future. Signed-off-by: Sam Protsenko Fixes: 166097e87753 ("clk: exynos: add clock driver for Exynos7420 Soc") Reviewed-by: Sean Anderson Signed-off-by: Minkyu Kang --- drivers/clk/exynos/clk-pll.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clk/exynos/clk-pll.h b/drivers/clk/exynos/clk-pll.h index c79aac44258..7b7af5e6761 100644 --- a/drivers/clk/exynos/clk-pll.h +++ b/drivers/clk/exynos/clk-pll.h @@ -5,4 +5,9 @@ * Thomas Abraham */ +#ifndef __EXYNOS_CLK_PLL_H +#define __EXYNOS_CLK_PLL_H + unsigned long pll145x_get_rate(unsigned int *con1, unsigned long fin_freq); + +#endif /* __EXYNOS_CLK_PLL_H */ From a0615ffc99a5c5e23b9fe5a8116fc265483be2bd Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Tue, 7 Nov 2023 13:05:58 -0600 Subject: [PATCH 07/30] serial: s5p: Remove common.h inclusion It's not really needed here anymore. Remove it, as common.h is going away at some point. Signed-off-by: Sam Protsenko Reviewed-by: Simon Glass Signed-off-by: Minkyu Kang --- drivers/serial/serial_s5p.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index fe52580d64d..17721553567 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -7,7 +7,6 @@ * based on drivers/serial/s3c64xx.c */ -#include #include #include #include From 5ad21de6bae0a6d51d4b0ff8eedfb795ed2d4581 Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Tue, 7 Nov 2023 13:05:59 -0600 Subject: [PATCH 08/30] serial: s5p: Use livetree API to get "id" property Use dev_read_u8_default() instead of fdtdec_get_int() to read the "id" property from device tree, as suggested in [1]. dev_* API is already used in this driver, so there is no reason to stick to fdtdec_* API. This also fixes checkpatch warning: WARNING: Use the livetree API (dev_read_...) [1] doc/develop/driver-model/livetree.rst Signed-off-by: Sam Protsenko Reviewed-by: Simon Glass Signed-off-by: Minkyu Kang --- drivers/serial/serial_s5p.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index 17721553567..c57bdd059ea 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -20,8 +20,6 @@ #include #include -DECLARE_GLOBAL_DATA_PTR; - enum { PORT_S5P = 0, PORT_S5L @@ -220,8 +218,7 @@ static int s5p_serial_of_to_plat(struct udevice *dev) plat->reg = (struct s5p_uart *)addr; plat->reg_width = dev_read_u32_default(dev, "reg-io-width", 1); - plat->port_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), - "id", dev_seq(dev)); + plat->port_id = dev_read_u8_default(dev, "id", dev_seq(dev)); if (port_type == PORT_S5L) { plat->rx_fifo_count_shift = S5L_RX_FIFO_COUNT_SHIFT; From e79f630dbf67a402aff7b34f743064eeb2569ea1 Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Tue, 7 Nov 2023 13:06:00 -0600 Subject: [PATCH 09/30] serial: s5p: Use named constants for register values Get rid of magic numbers in s5p_serial_init() when writing to UART registers. While at it, use BIT() macro for existing constants when appropriate. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Simon Glass Signed-off-by: Minkyu Kang --- drivers/serial/serial_s5p.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index c57bdd059ea..6d316ccaf31 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -25,19 +25,28 @@ enum { PORT_S5L }; +#define UFCON_FIFO_EN BIT(0) +#define UFCON_RX_FIFO_RESET BIT(1) +#define UMCON_RESET_VAL 0x0 +#define ULCON_WORD_8_BIT 0x3 +#define UCON_RX_IRQ_OR_POLLING BIT(0) +#define UCON_TX_IRQ_OR_POLLING BIT(2) +#define UCON_RX_ERR_IRQ_EN BIT(6) +#define UCON_TX_IRQ_LEVEL BIT(9) + #define S5L_RX_FIFO_COUNT_SHIFT 0 #define S5L_RX_FIFO_COUNT_MASK (0xf << S5L_RX_FIFO_COUNT_SHIFT) -#define S5L_RX_FIFO_FULL (1 << 8) +#define S5L_RX_FIFO_FULL BIT(8) #define S5L_TX_FIFO_COUNT_SHIFT 4 #define S5L_TX_FIFO_COUNT_MASK (0xf << S5L_TX_FIFO_COUNT_SHIFT) -#define S5L_TX_FIFO_FULL (1 << 9) +#define S5L_TX_FIFO_FULL BIT(9) #define S5P_RX_FIFO_COUNT_SHIFT 0 #define S5P_RX_FIFO_COUNT_MASK (0xff << S5P_RX_FIFO_COUNT_SHIFT) -#define S5P_RX_FIFO_FULL (1 << 8) +#define S5P_RX_FIFO_FULL BIT(8) #define S5P_TX_FIFO_COUNT_SHIFT 16 #define S5P_TX_FIFO_COUNT_MASK (0xff << S5P_TX_FIFO_COUNT_SHIFT) -#define S5P_TX_FIFO_FULL (1 << 24) +#define S5P_TX_FIFO_FULL BIT(24) /* Information about a serial port */ struct s5p_serial_plat { @@ -80,13 +89,15 @@ static const int udivslot[] = { static void __maybe_unused s5p_serial_init(struct s5p_uart *uart) { - /* enable FIFOs, auto clear Rx FIFO */ - writel(0x3, &uart->ufcon); - writel(0, &uart->umcon); - /* 8N1 */ - writel(0x3, &uart->ulcon); + /* Enable FIFOs, auto clear Rx FIFO */ + writel(UFCON_FIFO_EN | UFCON_RX_FIFO_RESET, &uart->ufcon); + /* No auto flow control, disable nRTS signal */ + writel(UMCON_RESET_VAL, &uart->umcon); + /* 8N1, no parity bit */ + writel(ULCON_WORD_8_BIT, &uart->ulcon); /* No interrupts, no DMA, pure polling */ - writel(0x245, &uart->ucon); + writel(UCON_RX_IRQ_OR_POLLING | UCON_TX_IRQ_OR_POLLING | + UCON_RX_ERR_IRQ_EN | UCON_TX_IRQ_LEVEL, &uart->ucon); } static void __maybe_unused s5p_serial_baud(struct s5p_uart *uart, u8 reg_width, From a627f2802a71afe7fec28d2a9b514dc37f1b8f20 Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Tue, 7 Nov 2023 13:06:01 -0600 Subject: [PATCH 10/30] serial: s5p: Improve coding style Just some minor style fixes. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Simon Glass Signed-off-by: Minkyu Kang --- drivers/serial/serial_s5p.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index 6d316ccaf31..c24d9bca84c 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -50,9 +50,9 @@ enum { /* Information about a serial port */ struct s5p_serial_plat { - struct s5p_uart *reg; /* address of registers in physical memory */ - u8 reg_width; /* register width */ - u8 port_id; /* uart port number */ + struct s5p_uart *reg; /* address of registers in physical memory */ + u8 reg_width; /* register width */ + u8 port_id; /* uart port number */ u8 rx_fifo_count_shift; u8 tx_fifo_count_shift; u32 rx_fifo_count_mask; @@ -65,7 +65,7 @@ struct s5p_serial_plat { * The coefficient, used to calculate the baudrate on S5P UARTs is * calculated as * C = UBRDIV * 16 + number_of_set_bits_in_UDIVSLOT - * however, section 31.6.11 of the datasheet doesn't recomment using 1 for 1, + * however, section 31.6.11 of the datasheet doesn't recommend using 1 for 1, * 3 for 2, ... (2^n - 1) for n, instead, they suggest using these constants: */ static const int udivslot[] = { @@ -251,10 +251,10 @@ static int s5p_serial_of_to_plat(struct udevice *dev) } static const struct dm_serial_ops s5p_serial_ops = { - .putc = s5p_serial_putc, - .pending = s5p_serial_pending, - .getc = s5p_serial_getc, - .setbrg = s5p_serial_setbrg, + .putc = s5p_serial_putc, + .pending = s5p_serial_pending, + .getc = s5p_serial_getc, + .setbrg = s5p_serial_setbrg, }; static const struct udevice_id s5p_serial_ids[] = { @@ -264,13 +264,13 @@ static const struct udevice_id s5p_serial_ids[] = { }; U_BOOT_DRIVER(serial_s5p) = { - .name = "serial_s5p", - .id = UCLASS_SERIAL, - .of_match = s5p_serial_ids, - .of_to_plat = s5p_serial_of_to_plat, + .name = "serial_s5p", + .id = UCLASS_SERIAL, + .of_match = s5p_serial_ids, + .of_to_plat = s5p_serial_of_to_plat, .plat_auto = sizeof(struct s5p_serial_plat), - .probe = s5p_serial_probe, - .ops = &s5p_serial_ops, + .probe = s5p_serial_probe, + .ops = &s5p_serial_ops, }; #endif @@ -298,10 +298,12 @@ static inline void _debug_uart_putc(int ch) struct s5p_uart *uart = (struct s5p_uart *)CONFIG_VAL(DEBUG_UART_BASE); #if IS_ENABLED(CONFIG_ARCH_APPLE) - while (readl(&uart->ufstat) & S5L_TX_FIFO_FULL); + while (readl(&uart->ufstat) & S5L_TX_FIFO_FULL) + ; writel(ch, &uart->utxh); #else - while (readl(&uart->ufstat) & S5P_TX_FIFO_FULL); + while (readl(&uart->ufstat) & S5P_TX_FIFO_FULL) + ; writeb(ch, &uart->utxh); #endif } From 33e7ca5a9b6a0dc1c894c14fd8e29b816f9a6f55 Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Tue, 7 Nov 2023 14:13:49 -0600 Subject: [PATCH 11/30] serial: s5p: Use dev_read_addr_ptr() to get base address As the address read from device tree is being cast to a pointer, it's better to use dev_read_addr_ptr() API for getting that address. The more detailed explanation can be found in commit a12a73b66476 ("drivers: use dev_read_addr_ptr when cast to pointer"). Signed-off-by: Sam Protsenko Reviewed-by: Simon Glass Signed-off-by: Minkyu Kang --- drivers/serial/serial_s5p.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index c24d9bca84c..7d04dcff54f 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -221,13 +221,11 @@ static int s5p_serial_of_to_plat(struct udevice *dev) { struct s5p_serial_plat *plat = dev_get_plat(dev); const ulong port_type = dev_get_driver_data(dev); - fdt_addr_t addr; - addr = dev_read_addr(dev); - if (addr == FDT_ADDR_T_NONE) + plat->reg = dev_read_addr_ptr(dev); + if (!plat->reg) return -EINVAL; - plat->reg = (struct s5p_uart *)addr; plat->reg_width = dev_read_u32_default(dev, "reg-io-width", 1); plat->port_id = dev_read_u8_default(dev, "id", dev_seq(dev)); From 6219b47c4d9142a792db9d7b27eb0b5ef11be1b5 Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Thu, 9 Nov 2023 14:13:12 -0600 Subject: [PATCH 12/30] board: samsung: Fix SYS_CONFIG_NAME configs in axy17lte Kconfig There is a couple of issues related to SYS_CONFIG_NAME config in axy17lte Kconfig. 1. The global SYS_CONFIG_NAME in axy17lte Kconfig overrides SYS_CONFIG_NAME for all boards specified after this line in arch/arm/mach-exynos/Kconfig: source "board/samsung/axy17lte/Kconfig" Right now it's the last 'source' line there, so the issue is not reproducible. But once some board is moved or added after this line the next build error will happen: GEN include/autoconf.mk.dep In file included from ./include/common.h:16: include/config.h:3:10: fatal error: configs/exynos78x0-common.h.h: No such file or directory 3 | #include | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. That's happening because axy17lte Kconfig defines SYS_CONFIG_NAME option in global namespace (not guarded with any "if TARGET_..."), so it basically rewrites the correct SYS_CONFIG_NAME defined in the hypothetical boards which might appear after axy17lte in mach-exynos Kconfig. 2. Another side of the issue is that SYS_CONFIG_NAME is defined incorrectly in axy17lte Kconfig: config SYS_CONFIG_NAME default "exynos78x0-common.h" The .h extension should not have been specified there. It's leading to a build error, as the generated include file has a double '.h' extension. 3. Each target in axy17lte/Kconfig defines its own SYS_CONFIG_NAME. But all of those in fact incorrect, as corresponding include/configs/.h header files don't exist. 4. The global SYS_CONFIG_NAME pretty much repeats the help description from arch/Kconfig and doc/README.kconfig. Corresponding defconfig files (a*y17lte_defconfig) fix above issues by overriding SYS_CONFIG_NAME and correctly setting it to "exynos78x0-common". Fix all mentioned issues by removing the incorrect global SYS_CONFIG_NAME and instead specifying it (correctly) in SYS_CONFIG_NAME options for each target instead. Signed-off-by: Sam Protsenko Fixes: 3e2095e960b4 ("board: samsung: add support for Galaxy A series of 2017 (a5y17lte)") Signed-off-by: Minkyu Kang --- board/samsung/axy17lte/Kconfig | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/board/samsung/axy17lte/Kconfig b/board/samsung/axy17lte/Kconfig index a018547ff5d..64a4ffa7e67 100644 --- a/board/samsung/axy17lte/Kconfig +++ b/board/samsung/axy17lte/Kconfig @@ -1,11 +1,3 @@ -config SYS_CONFIG_NAME - string "Board configuration name" - default "exynos78x0-common.h" - help - This option contains information about board configuration name. - Based on this option include/configs/.h header - will be used for board configuration. - if TARGET_A5Y17LTE config SYS_BOARD default "axy17lte" @@ -16,7 +8,7 @@ config SYS_VENDOR default "samsung" config SYS_CONFIG_NAME - default "a5y17lte" + default "exynos78x0-common" config EXYNOS7880 bool "Exynos 7880 SOC support" @@ -33,7 +25,7 @@ config SYS_VENDOR default "samsung" config SYS_CONFIG_NAME - default "a5y17lte" + default "exynos78x0-common" config EXYNOS7880 bool "Exynos 7880 SOC support" @@ -50,7 +42,7 @@ config SYS_VENDOR default "samsung" config SYS_CONFIG_NAME - default "a3y17lte" + default "exynos78x0-common" config EXYNOS7870 bool "Exynos 7870 SOC support" From 470682ace1e03a6573d6eef9a00b524d608ddfa7 Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Thu, 9 Nov 2023 14:13:13 -0600 Subject: [PATCH 13/30] configs: Remove unneeded SYS_CONFIG_NAME from a*y17lte defconfigs As correct default SYS_CONFIG_NAME value is now set in board/samsung/axy17lte/Kconfig (in commit "board: samsung: Fix SYS_CONFIG_NAME configs in axy17lte Kconfig"), the SYS_CONFIG_NAME option can be safely removed from all a*y17lte defconfigs. That removal doesn't change resulting .config files. Signed-off-by: Sam Protsenko Signed-off-by: Minkyu Kang --- configs/a3y17lte_defconfig | 1 - configs/a5y17lte_defconfig | 1 - configs/a7y17lte_defconfig | 1 - 3 files changed, 3 deletions(-) diff --git a/configs/a3y17lte_defconfig b/configs/a3y17lte_defconfig index 42fcd2a3d31..043f3a04db8 100644 --- a/configs/a3y17lte_defconfig +++ b/configs/a3y17lte_defconfig @@ -1,5 +1,4 @@ CONFIG_ARM=y -CONFIG_SYS_CONFIG_NAME="exynos78x0-common" CONFIG_SKIP_LOWLEVEL_INIT=y CONFIG_COUNTER_FREQUENCY=26000000 CONFIG_ARCH_EXYNOS=y diff --git a/configs/a5y17lte_defconfig b/configs/a5y17lte_defconfig index 3b80536c12c..14590f65e9c 100644 --- a/configs/a5y17lte_defconfig +++ b/configs/a5y17lte_defconfig @@ -1,5 +1,4 @@ CONFIG_ARM=y -CONFIG_SYS_CONFIG_NAME="exynos78x0-common" CONFIG_SKIP_LOWLEVEL_INIT=y CONFIG_COUNTER_FREQUENCY=26000000 CONFIG_ARCH_EXYNOS=y diff --git a/configs/a7y17lte_defconfig b/configs/a7y17lte_defconfig index 9390e35057e..ccb0bf2e805 100644 --- a/configs/a7y17lte_defconfig +++ b/configs/a7y17lte_defconfig @@ -1,5 +1,4 @@ CONFIG_ARM=y -CONFIG_SYS_CONFIG_NAME="exynos78x0-common" CONFIG_SKIP_LOWLEVEL_INIT=y CONFIG_COUNTER_FREQUENCY=26000000 CONFIG_ARCH_EXYNOS=y From 43f2873fa98b1da6eb56d756315c7bd7db63db27 Mon Sep 17 00:00:00 2001 From: Svyatoslav Ryhel Date: Tue, 31 Oct 2023 20:46:50 +0200 Subject: [PATCH 14/30] MAINTAINERS: Step up as co-maintainer of Tegra SOC platform Update maintainers for Tegra SoC platform. Include device trees and drivers which contain tegra in the name. Signed-off-by: Svyatoslav Ryhel --- MAINTAINERS | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 7c1cb2dc4dc..9f74c0aacaa 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -667,11 +667,14 @@ F: drivers/video/sunxi/ F: tools/sunxi* ARM TEGRA -M: Tom Warren +M: Thierry Reding +M: Svyatoslav Ryhel S: Maintained T: git https://source.denx.de/u-boot/custodians/u-boot-tegra.git -F: arch/arm/mach-tegra/ +F: arch/arm/dts/tegra* F: arch/arm/include/asm/arch-tegra*/ +F: arch/arm/mach-tegra/ +F: drivers/*/tegra* ARM TI M: Tom Rini From 8d1e03f984c7467d7c8883f15dea14b2f8b4c0e2 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Sun, 29 Oct 2023 15:37:38 +0900 Subject: [PATCH 15/30] usb: xhci: Guard all calls to xhci_wait_for_event xhci_wait_for_event returns NULL on timeout, so the caller always has to check for that. This addresses immediate explosions in this part of the code when timeouts happen, but not the root cause for the timeout. Signed-off-by: Hector Martin Reviewed-by: Marek Vasut --- drivers/usb/host/xhci-ring.c | 15 +++++++++++++++ drivers/usb/host/xhci.c | 9 +++++++++ 2 files changed, 24 insertions(+) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index c8260cbdf94..d0960812a47 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -511,6 +511,9 @@ static void reset_ep(struct usb_device *udev, int ep_index) printf("Resetting EP %d...\n", ep_index); xhci_queue_command(ctrl, 0, udev->slot_id, ep_index, TRB_RESET_EP); event = xhci_wait_for_event(ctrl, TRB_COMPLETION); + if (!event) + return; + field = le32_to_cpu(event->trans_event.flags); BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id); xhci_acknowledge_event(ctrl); @@ -519,6 +522,9 @@ static void reset_ep(struct usb_device *udev, int ep_index) (void *)((uintptr_t)ring->enqueue | ring->cycle_state)); xhci_queue_command(ctrl, addr, udev->slot_id, ep_index, TRB_SET_DEQ); event = xhci_wait_for_event(ctrl, TRB_COMPLETION); + if (!event) + return; + BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags)) != udev->slot_id || GET_COMP_CODE(le32_to_cpu( event->event_cmd.status)) != COMP_SUCCESS); @@ -544,6 +550,9 @@ static void abort_td(struct usb_device *udev, int ep_index) xhci_queue_command(ctrl, 0, udev->slot_id, ep_index, TRB_STOP_RING); event = xhci_wait_for_event(ctrl, TRB_TRANSFER); + if (!event) + return; + field = le32_to_cpu(event->trans_event.flags); BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id); BUG_ON(TRB_TO_EP_INDEX(field) != ep_index); @@ -552,6 +561,9 @@ static void abort_td(struct usb_device *udev, int ep_index) xhci_acknowledge_event(ctrl); event = xhci_wait_for_event(ctrl, TRB_COMPLETION); + if (!event) + return; + BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags)) != udev->slot_id || GET_COMP_CODE(le32_to_cpu( event->event_cmd.status)) != COMP_SUCCESS); @@ -561,6 +573,9 @@ static void abort_td(struct usb_device *udev, int ep_index) (void *)((uintptr_t)ring->enqueue | ring->cycle_state)); xhci_queue_command(ctrl, addr, udev->slot_id, ep_index, TRB_SET_DEQ); event = xhci_wait_for_event(ctrl, TRB_COMPLETION); + if (!event) + return; + BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags)) != udev->slot_id || GET_COMP_CODE(le32_to_cpu( event->event_cmd.status)) != COMP_SUCCESS); diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 5cacf0769ec..d13cbff9b37 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -451,6 +451,9 @@ static int xhci_configure_endpoints(struct usb_device *udev, bool ctx_change) xhci_queue_command(ctrl, in_ctx->dma, udev->slot_id, 0, ctx_change ? TRB_EVAL_CONTEXT : TRB_CONFIG_EP); event = xhci_wait_for_event(ctrl, TRB_COMPLETION); + if (!event) + return -ETIMEDOUT; + BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags)) != udev->slot_id); @@ -647,6 +650,9 @@ static int xhci_address_device(struct usb_device *udev, int root_portnr) xhci_queue_command(ctrl, virt_dev->in_ctx->dma, slot_id, 0, TRB_ADDR_DEV); event = xhci_wait_for_event(ctrl, TRB_COMPLETION); + if (!event) + return -ETIMEDOUT; + BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags)) != slot_id); switch (GET_COMP_CODE(le32_to_cpu(event->event_cmd.status))) { @@ -722,6 +728,9 @@ static int _xhci_alloc_device(struct usb_device *udev) xhci_queue_command(ctrl, 0, 0, 0, TRB_ENABLE_SLOT); event = xhci_wait_for_event(ctrl, TRB_COMPLETION); + if (!event) + return -ETIMEDOUT; + BUG_ON(GET_COMP_CODE(le32_to_cpu(event->event_cmd.status)) != COMP_SUCCESS); From 2526cd993272966606cb64b1898343e6963fb1d9 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Sun, 29 Oct 2023 15:37:39 +0900 Subject: [PATCH 16/30] usb: xhci: Better error handling in abort_td() If the xHC has a problem with our STOP ENDPOINT command, it is likely to return a completion directly instead of first a transfer event for the in-progress transfer. Handle that more gracefully. We still BUG() on the error code, but at least we don't end up timing out on the event and ending up with unexpected event errors. Signed-off-by: Hector Martin Reviewed-by: Marek Vasut --- drivers/usb/host/xhci-ring.c | 34 ++++++++++++++++++++++------------ include/usb/xhci.h | 2 ++ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index d0960812a47..d21e76e0bdb 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -466,7 +466,8 @@ union xhci_trb *xhci_wait_for_event(struct xhci_ctrl *ctrl, trb_type expected) continue; type = TRB_FIELD_TO_TYPE(le32_to_cpu(event->event_cmd.flags)); - if (type == expected) + if (type == expected || + (expected == TRB_NONE && type != TRB_PORT_STATUS)) return event; if (type == TRB_PORT_STATUS) @@ -544,27 +545,36 @@ static void abort_td(struct usb_device *udev, int ep_index) struct xhci_ctrl *ctrl = xhci_get_ctrl(udev); struct xhci_ring *ring = ctrl->devs[udev->slot_id]->eps[ep_index].ring; union xhci_trb *event; + trb_type type; u64 addr; u32 field; xhci_queue_command(ctrl, 0, udev->slot_id, ep_index, TRB_STOP_RING); - event = xhci_wait_for_event(ctrl, TRB_TRANSFER); + event = xhci_wait_for_event(ctrl, TRB_NONE); if (!event) return; - field = le32_to_cpu(event->trans_event.flags); - BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id); - BUG_ON(TRB_TO_EP_INDEX(field) != ep_index); - BUG_ON(GET_COMP_CODE(le32_to_cpu(event->trans_event.transfer_len - != COMP_STOP))); - xhci_acknowledge_event(ctrl); + type = TRB_FIELD_TO_TYPE(le32_to_cpu(event->event_cmd.flags)); + if (type == TRB_TRANSFER) { + field = le32_to_cpu(event->trans_event.flags); + BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id); + BUG_ON(TRB_TO_EP_INDEX(field) != ep_index); + BUG_ON(GET_COMP_CODE(le32_to_cpu(event->trans_event.transfer_len + != COMP_STOP))); + xhci_acknowledge_event(ctrl); - event = xhci_wait_for_event(ctrl, TRB_COMPLETION); - if (!event) - return; + event = xhci_wait_for_event(ctrl, TRB_COMPLETION); + if (!event) + return; + type = TRB_FIELD_TO_TYPE(le32_to_cpu(event->event_cmd.flags)); - BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags)) + } else { + printf("abort_td: Expected a TRB_TRANSFER TRB first\n"); + } + + BUG_ON(type != TRB_COMPLETION || + TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags)) != udev->slot_id || GET_COMP_CODE(le32_to_cpu( event->event_cmd.status)) != COMP_SUCCESS); xhci_acknowledge_event(ctrl); diff --git a/include/usb/xhci.h b/include/usb/xhci.h index 4a4ac10229a..04d16a256bb 100644 --- a/include/usb/xhci.h +++ b/include/usb/xhci.h @@ -901,6 +901,8 @@ union xhci_trb { /* TRB type IDs */ typedef enum { + /* reserved, used as a software sentinel */ + TRB_NONE = 0, /* bulk, interrupt, isoc scatter/gather, and control data stage */ TRB_NORMAL = 1, /* setup stage for control transfers */ From 6f64f0ae230f9e8f68c5d9bf56ffee438fa60a6a Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Sun, 29 Oct 2023 15:37:40 +0900 Subject: [PATCH 17/30] usb: xhci: Allow context state errors when halting an endpoint There is a race where an endpoint may halt by itself while we are trying to halt it, which results in a context state error. See xHCI 4.6.9 which mentions this case. This also avoids BUGging when we attempt to stop an endpoint which was already stopped to begin with, which is probably a bug elsewhere but not a good reason to crash. Signed-off-by: Hector Martin Reviewed-by: Marek Vasut --- drivers/usb/host/xhci-ring.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index d21e76e0bdb..e02a6e300c4 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -545,6 +545,7 @@ static void abort_td(struct usb_device *udev, int ep_index) struct xhci_ctrl *ctrl = xhci_get_ctrl(udev); struct xhci_ring *ring = ctrl->devs[udev->slot_id]->eps[ep_index].ring; union xhci_trb *event; + xhci_comp_code comp; trb_type type; u64 addr; u32 field; @@ -573,10 +574,11 @@ static void abort_td(struct usb_device *udev, int ep_index) printf("abort_td: Expected a TRB_TRANSFER TRB first\n"); } + comp = GET_COMP_CODE(le32_to_cpu(event->event_cmd.status)); BUG_ON(type != TRB_COMPLETION || TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags)) - != udev->slot_id || GET_COMP_CODE(le32_to_cpu( - event->event_cmd.status)) != COMP_SUCCESS); + != udev->slot_id || (comp != COMP_SUCCESS && comp + != COMP_CTX_STATE)); xhci_acknowledge_event(ctrl); addr = xhci_trb_virt_to_dma(ring->enq_seg, From 9d88bd4dcf1628bf129163eb5a25c48068423601 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Sun, 29 Oct 2023 15:37:41 +0900 Subject: [PATCH 18/30] usb: xhci: Recover from halted bulk endpoints There is currently no codepath to recover from this case. In principle we could require that the upper layer do this explicitly, but let's just do it in xHCI when the next bulk transfer is started, since that reasonably implies whatever caused the problem has been dealt with. Signed-off-by: Hector Martin Reviewed-by: Marek Vasut --- drivers/usb/host/xhci-ring.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index e02a6e300c4..db8b8f20025 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -671,6 +671,14 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe, ep_ctx = xhci_get_ep_ctx(ctrl, virt_dev->out_ctx, ep_index); + /* + * If the endpoint was halted due to a prior error, resume it before + * the next transfer. It is the responsibility of the upper layer to + * have dealt with whatever caused the error. + */ + if ((le32_to_cpu(ep_ctx->ep_info) & EP_STATE_MASK) == EP_STATE_HALTED) + reset_ep(udev, ep_index); + ring = virt_dev->eps[ep_index].ring; /* * How much data is (potentially) left before the 64KB boundary? From fb5502be2544f9c3a7f662e6618e26f0831d242d Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Sun, 29 Oct 2023 15:37:42 +0900 Subject: [PATCH 19/30] usb: xhci: Fail on attempt to queue TRBs to a halted endpoint This isn't going to work, don't pretend it will and then end up timing out. Signed-off-by: Hector Martin Reviewed-by: Marek Vasut --- drivers/usb/host/xhci-ring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index db8b8f20025..a969eafdc8e 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -243,7 +243,8 @@ static int prepare_ring(struct xhci_ctrl *ctrl, struct xhci_ring *ep_ring, puts("WARN waiting for error on ep to be cleared\n"); return -EINVAL; case EP_STATE_HALTED: - puts("WARN halted endpoint, queueing URB anyway.\n"); + puts("WARN endpoint is halted\n"); + return -EINVAL; case EP_STATE_STOPPED: case EP_STATE_RUNNING: debug("EP STATE RUNNING.\n"); From 2fd7037122a920ae22377b06aa5b32651cc71f13 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Sun, 29 Oct 2023 15:37:43 +0900 Subject: [PATCH 20/30] usb: xhci: Do not panic on event timeouts Now that we always check the return value, just return NULL on timeouts. We can still log the error since this is a problem, but it's not reason to panic. Signed-off-by: Hector Martin Reviewed-by: Marek Vasut --- drivers/usb/host/xhci-ring.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index a969eafdc8e..ae0ab5744df 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -494,8 +494,9 @@ union xhci_trb *xhci_wait_for_event(struct xhci_ctrl *ctrl, trb_type expected) if (expected == TRB_TRANSFER) return NULL; - printf("XHCI timeout on event type %d... cannot recover.\n", expected); - BUG(); + printf("XHCI timeout on event type %d...\n", expected); + + return NULL; } /* From a14843fdac24bf18bd58152b959ca0425adaa1e4 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Sun, 29 Oct 2023 15:37:44 +0900 Subject: [PATCH 21/30] usb: xhci: Fix DMA address calculation in queue_trb We need to get the DMA address before incrementing the pointer, as that might move us onto another segment. Signed-off-by: Hector Martin Reviewed-by: Marek Vasut --- drivers/usb/host/xhci-ring.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index ae0ab5744df..b60661fe05e 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -202,6 +202,7 @@ static dma_addr_t queue_trb(struct xhci_ctrl *ctrl, struct xhci_ring *ring, bool more_trbs_coming, unsigned int *trb_fields) { struct xhci_generic_trb *trb; + dma_addr_t addr; int i; trb = &ring->enqueue->generic; @@ -211,9 +212,11 @@ static dma_addr_t queue_trb(struct xhci_ctrl *ctrl, struct xhci_ring *ring, xhci_flush_cache((uintptr_t)trb, sizeof(struct xhci_generic_trb)); + addr = xhci_trb_virt_to_dma(ring->enq_seg, (union xhci_trb *)trb); + inc_enq(ctrl, ring, more_trbs_coming); - return xhci_trb_virt_to_dma(ring->enq_seg, (union xhci_trb *)trb); + return addr; } /** From b5999f8f6ca89223b70ec3038fcfe9dbb6c67475 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Sun, 29 Oct 2023 16:09:09 +0900 Subject: [PATCH 22/30] usb: hub: Add missing reset recovery delay Some devices like YubiKeys need more time before SET_ADDRESS. The spec says we need to wait 10ms. Signed-off-by: Hector Martin Reviewed-by: Marek Vasut --- common/usb_hub.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/usb_hub.c b/common/usb_hub.c index 85c0822d8b7..70279f301d5 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -395,6 +395,13 @@ int usb_hub_port_connect_change(struct usb_device *dev, int port) break; } + /* + * USB 2.0 7.1.7.5: devices must be able to accept a SetAddress() + * request (refer to Section 11.24.2 and Section 9.4 respectively) + * after the reset recovery time 10 ms + */ + mdelay(10); + #if CONFIG_IS_ENABLED(DM_USB) struct udevice *child; From 75aabe595f2641a671a2da7e304e4779084a4238 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Sun, 29 Oct 2023 16:23:30 +0900 Subject: [PATCH 23/30] usb: storage: Use the correct CBW lengths USB UFI uses fixed 12-byte commands (as does RBC, which is not supported), but SCSI does not have this limitation. Use the correct command block lengths depending on the subclass. Signed-off-by: Hector Martin Reviewed-by: Marek Vasut --- common/usb_storage.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/common/usb_storage.c b/common/usb_storage.c index 35c656db0dc..774d5bdf54b 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -102,6 +102,7 @@ struct us_data { trans_reset transport_reset; /* reset routine */ trans_cmnd transport; /* transport routine */ unsigned short max_xfer_blk; /* maximum transfer blocks */ + bool cmd12; /* use 12-byte commands (RBC/UFI) */ }; #if !CONFIG_IS_ENABLED(BLK) @@ -359,7 +360,7 @@ static void usb_show_srb(struct scsi_cmd *pccb) { int i; printf("SRB: len %d datalen 0x%lX\n ", pccb->cmdlen, pccb->datalen); - for (i = 0; i < 12; i++) + for (i = 0; i < pccb->cmdlen; i++) printf("%02X ", pccb->cmd[i]); printf("\n"); } @@ -898,7 +899,7 @@ do_retry: psrb->cmd[4] = 18; psrb->datalen = 18; psrb->pdata = &srb->sense_buf[0]; - psrb->cmdlen = 12; + psrb->cmdlen = us->cmd12 ? 12 : 6; /* issue the command */ result = usb_stor_CB_comdat(psrb, us); debug("auto request returned %d\n", result); @@ -999,7 +1000,7 @@ static int usb_inquiry(struct scsi_cmd *srb, struct us_data *ss) srb->cmd[1] = srb->lun << 5; srb->cmd[4] = 36; srb->datalen = 36; - srb->cmdlen = 12; + srb->cmdlen = ss->cmd12 ? 12 : 6; i = ss->transport(srb, ss); debug("inquiry returns %d\n", i); if (i == 0) @@ -1024,7 +1025,7 @@ static int usb_request_sense(struct scsi_cmd *srb, struct us_data *ss) srb->cmd[4] = 18; srb->datalen = 18; srb->pdata = &srb->sense_buf[0]; - srb->cmdlen = 12; + srb->cmdlen = ss->cmd12 ? 12 : 6; ss->transport(srb, ss); debug("Request Sense returned %02X %02X %02X\n", srb->sense_buf[2], srb->sense_buf[12], @@ -1042,7 +1043,7 @@ static int usb_test_unit_ready(struct scsi_cmd *srb, struct us_data *ss) srb->cmd[0] = SCSI_TST_U_RDY; srb->cmd[1] = srb->lun << 5; srb->datalen = 0; - srb->cmdlen = 12; + srb->cmdlen = ss->cmd12 ? 12 : 6; if (ss->transport(srb, ss) == USB_STOR_TRANSPORT_GOOD) { ss->flags |= USB_READY; return 0; @@ -1074,7 +1075,7 @@ static int usb_read_capacity(struct scsi_cmd *srb, struct us_data *ss) srb->cmd[0] = SCSI_RD_CAPAC; srb->cmd[1] = srb->lun << 5; srb->datalen = 8; - srb->cmdlen = 12; + srb->cmdlen = ss->cmd12 ? 12 : 10; if (ss->transport(srb, ss) == USB_STOR_TRANSPORT_GOOD) return 0; } while (retry--); @@ -1094,7 +1095,7 @@ static int usb_read_10(struct scsi_cmd *srb, struct us_data *ss, srb->cmd[5] = ((unsigned char) (start)) & 0xff; srb->cmd[7] = ((unsigned char) (blocks >> 8)) & 0xff; srb->cmd[8] = (unsigned char) blocks & 0xff; - srb->cmdlen = 12; + srb->cmdlen = ss->cmd12 ? 12 : 10; debug("read10: start %lx blocks %x\n", start, blocks); return ss->transport(srb, ss); } @@ -1111,7 +1112,7 @@ static int usb_write_10(struct scsi_cmd *srb, struct us_data *ss, srb->cmd[5] = ((unsigned char) (start)) & 0xff; srb->cmd[7] = ((unsigned char) (blocks >> 8)) & 0xff; srb->cmd[8] = (unsigned char) blocks & 0xff; - srb->cmdlen = 12; + srb->cmdlen = ss->cmd12 ? 12 : 10; debug("write10: start %lx blocks %x\n", start, blocks); return ss->transport(srb, ss); } @@ -1417,6 +1418,11 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, printf("Sorry, protocol %d not yet supported.\n", ss->subclass); return 0; } + + /* UFI uses 12-byte commands (like RBC, unlike SCSI) */ + if (ss->subclass == US_SC_UFI) + ss->cmd12 = true; + if (ss->ep_int) { /* we had found an interrupt endpoint, prepare irq pipe * set up the IRQ pipe and handler From 6e91df96dccf3326925e40b43635743352edec86 Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Sun, 12 Nov 2023 15:25:25 +0000 Subject: [PATCH 24/30] usb: dwc3-generic: Use combined glue and ctrl node for RK3588 Like Rockchip RK3328 and RK3568, the RK3588 also have a single node to represent the glue and ctrl for USB 3.0. Use rk_ops as driver data to select correct ctrl node for RK3588 DWC3. Signed-off-by: Jonas Karlman Reviewed-by: Kever Yang Reviewed-by: Marek Vasut --- drivers/usb/dwc3/dwc3-generic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index 744fde80694..6fb2de8a5ac 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -610,6 +610,7 @@ static const struct udevice_id dwc3_glue_ids[] = { { .compatible = "rockchip,rk3328-dwc3", .data = (ulong)&rk_ops }, { .compatible = "rockchip,rk3399-dwc3" }, { .compatible = "rockchip,rk3568-dwc3", .data = (ulong)&rk_ops }, + { .compatible = "rockchip,rk3588-dwc3", .data = (ulong)&rk_ops }, { .compatible = "qcom,dwc3" }, { .compatible = "fsl,imx8mp-dwc3", .data = (ulong)&imx8mp_ops }, { .compatible = "fsl,imx8mq-dwc3" }, From 493e0e2577bfe11b3065a30a6f5c827f95c1df94 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 20 Nov 2023 15:56:36 +0100 Subject: [PATCH 25/30] usb: USB_XHCI_PCI depends on PCI Compiling with CONFIG_USB_XHCI_PCI and CONFIG_PCI=n results in usb/host/xhci-pci.c:48:(.text.xhci_pci_probe+0x44): undefined reference to `dm_pci_write_config32 Add the missing Kconfig dependency. Signed-off-by: Heinrich Schuchardt Reviewed-by: Mark Kettenis Reviewed-by: Marek Vasut --- drivers/usb/host/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index b501ea514bc..35610ffc2b3 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -90,7 +90,7 @@ config USB_XHCI_OMAP config USB_XHCI_PCI bool "Support for PCI-based xHCI USB controller" - depends on DM_USB + depends on DM_USB && PCI default y if X86 help Enables support for the PCI-based xHCI controller. From b95a250805f083325fa47f47f53591fa7d658903 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Tue, 20 Jun 2023 00:41:49 +0200 Subject: [PATCH 26/30] ARM: dts: renesas: Clean up R8A779G0 V4H RPC SPI DT node Use the phandle reference to &rpc node in arch/arm/dts/r8a779g0.dtsi and remove properties which are already in arch/arm/dts/r8a779g0.dtsi. No functional change and no resulting DT change. Signed-off-by: Marek Vasut --- arch/arm/dts/r8a779g0-u-boot.dtsi | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/arch/arm/dts/r8a779g0-u-boot.dtsi b/arch/arm/dts/r8a779g0-u-boot.dtsi index 150657fad54..cc8becac996 100644 --- a/arch/arm/dts/r8a779g0-u-boot.dtsi +++ b/arch/arm/dts/r8a779g0-u-boot.dtsi @@ -7,20 +7,10 @@ #include "r8a779x-u-boot.dtsi" -/ { - soc { - rpc: spi@ee200000 { - compatible = "renesas,r8a779g0-rpc-if", "renesas,rcar-gen4-rpc-if"; - reg = <0 0xee200000 0 0x200>, <0 0x08000000 0 0x04000000>; - interrupts = ; - clocks = <&cpg CPG_MOD 629>; - power-domains = <&sysc R8A779G0_PD_ALWAYS_ON>; - resets = <&cpg 629>; - bank-width = <2>; - num-cs = <1>; - status = "disabled"; - }; - }; +&rpc { + reg = <0 0xee200000 0 0x200>, <0 0x08000000 0 0x04000000>; + bank-width = <2>; + num-cs = <1>; }; &extalr_clk { From 13bdb6a269108d3f9b953bf4b73079d66ecc37af Mon Sep 17 00:00:00 2001 From: Cong Dang Date: Tue, 20 Jun 2023 00:41:50 +0200 Subject: [PATCH 27/30] ARM: dts: renesas: Disable RPC driver on R8A779G0 V4H White Hawk board As requirement of CR side, QSPI Flash usage via RPC driver shall be disabled and leaving the control of this module to CR side. Perform DT modification to disable the RPC SPI. Reviewed-by: Marek Vasut Signed-off-by: Cong Dang Signed-off-by: Marek Vasut [Marek: Do not modify defconfig, modify the DT instead, this way the RPC SPI can be enabled without recompiling the U-Boot itself. Update commit message accordingly.] --- arch/arm/dts/r8a779g0-white-hawk-u-boot.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/dts/r8a779g0-white-hawk-u-boot.dts b/arch/arm/dts/r8a779g0-white-hawk-u-boot.dts index efc1b9519ef..bd756036645 100644 --- a/arch/arm/dts/r8a779g0-white-hawk-u-boot.dts +++ b/arch/arm/dts/r8a779g0-white-hawk-u-boot.dts @@ -28,7 +28,7 @@ #address-cells = <1>; #size-cells = <0>; spi-max-frequency = <40000000>; - status = "okay"; + status = "disabled"; spi-flash@0 { #address-cells = <1>; From a341a0e01f8087904eccbf3fe7baba63a62f9674 Mon Sep 17 00:00:00 2001 From: Chanho Park Date: Sun, 3 Dec 2023 17:30:40 +0900 Subject: [PATCH 28/30] watchdog: Correct watchdog timeout print message The wdt_start function takes timeout_ms as a parameter and starts the watchdog with this value. However, when you output the message, it shows the default timeout value for the watchdog device. So this patch fixes that part to output the correct timeout value. Before --> StarFive # wdt start 3000 WDT: Started watchdog@13070000 without servicing (60s timeout) After --> StarFive # wdt start 3000 WDT: Started watchdog@13070000 without servicing (3s timeout) Fixes: c2fd0ca1a822 ("watchdog: Integrate watchdog triggering into the cyclic framework") Signed-off-by: Chanho Park Reviewed-by: Stefan Roese --- drivers/watchdog/wdt-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c index ed329284dec..417e8d7eef9 100644 --- a/drivers/watchdog/wdt-uclass.c +++ b/drivers/watchdog/wdt-uclass.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -141,7 +142,7 @@ int wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags) printf("WDT: Started %s with%s servicing %s (%ds timeout)\n", dev->name, IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", - str, priv->timeout); + str, (u32)lldiv(timeout_ms, 1000)); } return ret; From 89cb3a9f0a5583d6a2197de64a22ef1e4d2e220b Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 20 Nov 2023 23:25:58 +0100 Subject: [PATCH 29/30] efi_loader: generated SMBIOS table below 4 GiB We currently use an outdated format 32-bit format for SMBIOS tables. So we must allocate SMBIOS tables below 4 GiB. Signed-off-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas Tested-by: Ilias Apalodimas --- lib/efi_loader/efi_smbios.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/efi_loader/efi_smbios.c b/lib/efi_loader/efi_smbios.c index 48446f654d9..0fbf51b98d0 100644 --- a/lib/efi_loader/efi_smbios.c +++ b/lib/efi_loader/efi_smbios.c @@ -49,25 +49,27 @@ efi_status_t efi_smbios_register(void) static int install_smbios_table(void) { - ulong addr; - void *buf; + u64 addr; + efi_status_t ret; if (!IS_ENABLED(CONFIG_GENERATE_SMBIOS_TABLE) || IS_ENABLED(CONFIG_X86)) return 0; - /* Align the table to a 4KB boundary to keep EFI happy */ - buf = memalign(SZ_4K, TABLE_SIZE); - if (!buf) + addr = SZ_4G; + ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS, + EFI_RUNTIME_SERVICES_DATA, + efi_size_in_pages(TABLE_SIZE), &addr); + if (ret != EFI_SUCCESS) return log_msg_ret("mem", -ENOMEM); - addr = map_to_sysmem(buf); + addr = map_to_sysmem((void *)(uintptr_t)addr); if (!write_smbios_table(addr)) { log_err("Failed to write SMBIOS table\n"); return log_msg_ret("smbios", -EINVAL); } /* Make a note of where we put it */ - log_debug("SMBIOS tables written to %lx\n", addr); + log_debug("SMBIOS tables written to %llx\n", addr); gd->arch.smbios_start = addr; return 0; From 2f0282922b2c458eea7f85c500a948a587437b63 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Mon, 4 Dec 2023 13:46:56 -0500 Subject: [PATCH 30/30] Prepare v2024.01-rc4 Signed-off-by: Tom Rini --- Makefile | 2 +- doc/develop/release_cycle.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a581110c158..750bbdb1b71 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ VERSION = 2024 PATCHLEVEL = 01 SUBLEVEL = -EXTRAVERSION = -rc3 +EXTRAVERSION = -rc4 NAME = # *DOCUMENTATION* diff --git a/doc/develop/release_cycle.rst b/doc/develop/release_cycle.rst index 600bf627418..37e9fc1a34d 100644 --- a/doc/develop/release_cycle.rst +++ b/doc/develop/release_cycle.rst @@ -70,7 +70,7 @@ For the next scheduled release, release candidates were made on:: * U-Boot v2024.01-rc3 was released on Mon 20 November 2023. -.. * U-Boot v2024.01-rc4 was released on Mon 04 December 2023. +* U-Boot v2024.01-rc4 was released on Mon 04 December 2023. .. * U-Boot v2024.01-rc5 was released on Mon 18 December 2023.