From 46d940ce716ccf1e07469a7ad77be4a9ecc4d349 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 14 Apr 2022 11:34:47 -0400 Subject: [PATCH 01/21] sandbox: Increase default SYS_MALLOC_LEN Increase the malloc pool on sandbox in order to avoid spurious errors such as: ___________________ test_ut[ut_dm_dm_test_video_comp_bmp32] ____________________ test/py/tests/test_ut.py:43: in test_ut assert output.endswith('Failures: 0') E AssertionError: assert False E + where False = ('Failures: 0') E + where = 'Test: dm_test_video_comp_bmp32: video.c\r\r\nSDL renderer does not exist\r\r\ntest/dm/video.c:86, compress_frame_buff..._test_video_comp_bmp32(): 2024 == compress_frame_buffer(uts, dev): Expected 0x7e8 (2024), got 0x1 (1)\r\r\nFailures: 2'.endswith Cc: Ramon Fried Reviewed-by: Simon Glass Signed-off-by: Tom Rini --- Kconfig | 1 + configs/sandbox64_defconfig | 1 - configs/sandbox_defconfig | 1 - configs/sandbox_flattree_defconfig | 1 - configs/sandbox_noinst_defconfig | 1 - configs/sandbox_spl_defconfig | 1 - 6 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Kconfig b/Kconfig index 0ee3068b9a6..b45e60a75b9 100644 --- a/Kconfig +++ b/Kconfig @@ -263,6 +263,7 @@ config SYS_MALLOC_F_LEN config SYS_MALLOC_LEN hex "Define memory for Dynamic allocation" + default 0x4000000 if SANDBOX default 0x2000000 if ARCH_ROCKCHIP || ARCH_OMAP2PLUS || ARCH_MESON default 0x200000 if ARCH_BMIPS || X86 default 0x120000 if MACH_SUNIV diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 88f9ecbb7fc..a13fa2e2c51 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -1,5 +1,4 @@ CONFIG_SYS_TEXT_BASE=0 -CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x2000 CONFIG_DEFAULT_DEVICE_TREE="sandbox64" diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index cb8d590eb64..4d3e4f317fc 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -1,5 +1,4 @@ CONFIG_SYS_TEXT_BASE=0 -CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x2000 CONFIG_DEFAULT_DEVICE_TREE="sandbox" diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index 24b272068a1..d799f7ddcad 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -1,5 +1,4 @@ CONFIG_SYS_TEXT_BASE=0 -CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x2000 CONFIG_DEFAULT_DEVICE_TREE="sandbox" diff --git a/configs/sandbox_noinst_defconfig b/configs/sandbox_noinst_defconfig index 9eefe4f1051..c9430da0f09 100644 --- a/configs/sandbox_noinst_defconfig +++ b/configs/sandbox_noinst_defconfig @@ -1,5 +1,4 @@ CONFIG_SYS_TEXT_BASE=0x200000 -CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SPL_GPIO=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index 0092fea76ba..13a76e89ea5 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -1,5 +1,4 @@ CONFIG_SYS_TEXT_BASE=0x200000 -CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SPL_GPIO=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y From 585fc1c8c535380e1ace681e34bb1e3c9e8bc7ae Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Tue, 29 Mar 2022 13:29:35 +0200 Subject: [PATCH 02/21] arm: apple: Add M1 Ultra support The M1 Ultra consists of two M1 Max dies. The second die's I/O is at a consistent offset of 0x2000000000. Signed-off-by: Janne Grunau Reviewed-by: Mark Kettenis --- arch/arm/mach-apple/board.c | 167 ++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/board.c index 722dff1f64c..ffc1301cf57 100644 --- a/arch/arm/mach-apple/board.c +++ b/arch/arm/mach-apple/board.c @@ -177,6 +177,171 @@ static struct mm_region t6000_mem_map[] = { } }; +/* Apple M1 Ultra */ + +static struct mm_region t6002_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 = 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 = 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) @@ -216,6 +381,8 @@ void build_mem_map(void) mem_map = t6000_mem_map; else if (of_machine_is_compatible("apple,t6001")) mem_map = t6000_mem_map; + else if (of_machine_is_compatible("apple,t6002")) + mem_map = t6002_mem_map; else panic("Unsupported SoC\n"); From e9598cfb283b4df080976c73493eff4b5fd62791 Mon Sep 17 00:00:00 2001 From: Dave Gerlach Date: Fri, 1 Apr 2022 20:02:48 -0500 Subject: [PATCH 03/21] power: domain: ti: Extend use of PTCMD and PTSTAT registers for high PDs It is possible for power domain IDs to be great than 31. If this happens, the PTCMD and PTSTAT registers must overflow into adjacent corresponding PTCMD_H and PTSTAT_H registers for each. Update the driver to account for this. Signed-off-by: Dave Gerlach --- drivers/power/domain/ti-power-domain.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/power/domain/ti-power-domain.c b/drivers/power/domain/ti-power-domain.c index a7dadf2eea7..752e76b3996 100644 --- a/drivers/power/domain/ti-power-domain.c +++ b/drivers/power/domain/ti-power-domain.c @@ -16,7 +16,9 @@ #include #define PSC_PTCMD 0x120 +#define PSC_PTCMD_H 0x124 #define PSC_PTSTAT 0x128 +#define PSC_PTSTAT_H 0x12C #define PSC_PDSTAT 0x200 #define PSC_PDCTL 0x300 #define PSC_MDSTAT 0x800 @@ -120,10 +122,17 @@ static int ti_power_domain_probe(struct udevice *dev) static int ti_pd_wait(struct ti_pd *pd) { u32 ptstat; + u32 pdoffset = 0; + u32 ptstatreg = PSC_PTSTAT; int ret; - ret = readl_poll_timeout(pd->psc->base + PSC_PTSTAT, ptstat, - !(ptstat & BIT(pd->id)), PD_TIMEOUT); + if (pd->id > 31) { + pdoffset = 32; + ptstatreg = PSC_PTSTAT_H; + } + + ret = readl_poll_timeout(pd->psc->base + ptstatreg, ptstat, + !(ptstat & BIT(pd->id - pdoffset)), PD_TIMEOUT); if (ret) printf("%s: psc%d, pd%d failed to transition.\n", __func__, @@ -134,7 +143,15 @@ static int ti_pd_wait(struct ti_pd *pd) static void ti_pd_transition(struct ti_pd *pd) { - psc_write(BIT(pd->id), pd->psc, PSC_PTCMD); + u32 pdoffset = 0; + u32 ptcmdreg = PSC_PTCMD; + + if (pd->id > 31) { + pdoffset = 32; + ptcmdreg = PSC_PTCMD_H; + } + + psc_write(BIT(pd->id - pdoffset), pd->psc, ptcmdreg); } u8 ti_pd_state(struct ti_pd *pd) From aecb338163e2fe55e32d3e2039af737a8bfaaa19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sun, 3 Apr 2022 00:36:34 +0200 Subject: [PATCH 04/21] misc: atsha204a: Fix big endian support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Callers of function atsha204a_crc16() expect to return value in host cpu endianity. So remove cpu_to_le16() conversion. Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese Reviewed-by: Marek Behún --- drivers/misc/atsha204a-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/atsha204a-i2c.c b/drivers/misc/atsha204a-i2c.c index b89463babb5..63fe541dade 100644 --- a/drivers/misc/atsha204a-i2c.c +++ b/drivers/misc/atsha204a-i2c.c @@ -146,7 +146,7 @@ static u16 atsha204a_crc16(const u8 *buffer, size_t len) while (len--) crc = crc16_byte(crc, *buffer++); - return cpu_to_le16(crc); + return crc; } static int atsha204a_send(struct udevice *dev, const u8 *buf, u8 len) From 83c63f0d11856ab5664506f0dd12d7d76c46a3a4 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 4 Apr 2022 01:18:02 +0200 Subject: [PATCH 05/21] led: Move OF "label" property parsing to core Every driver in drivers/led/ currently does some form of "label" OF property parsing in its bind() callback. Move this label parsing to LED core, since this "label" OF property is a generic property. This permits code deduplication in subseuqent patches. Signed-off-by: Marek Vasut Cc: Alex Nemirovsky Cc: Patrick Delaunay Cc: Philippe Reynes Cc: Sean Anderson Cc: Simon Glass Cc: Steven Lawrance --- drivers/led/led-uclass.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c index 7e298dbb06f..2f4aa18fb10 100644 --- a/drivers/led/led-uclass.c +++ b/drivers/led/led-uclass.c @@ -95,8 +95,20 @@ int led_default_state(void) return ret; } +static int led_post_bind(struct udevice *dev) +{ + struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); + + uc_plat->label = dev_read_string(dev, "label"); + if (!uc_plat->label) + uc_plat->label = ofnode_get_name(dev_ofnode(dev)); + + return 0; +} + UCLASS_DRIVER(led) = { .id = UCLASS_LED, .name = "led", .per_device_plat_auto = sizeof(struct led_uc_plat), + .post_bind = led_post_bind, }; From 9183fb45b8a91cc0d54cd94d4c165dd73c4cfba1 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 4 Apr 2022 01:18:03 +0200 Subject: [PATCH 06/21] led: bcm6328: Drop duplicate OF "label" property parsing The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver. Signed-off-by: Marek Vasut Cc: Alex Nemirovsky Cc: Patrick Delaunay Cc: Philippe Reynes Cc: Sean Anderson Cc: Simon Glass Cc: Steven Lawrance --- drivers/led/led_bcm6328.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/led/led_bcm6328.c b/drivers/led/led_bcm6328.c index bf8207d638d..f59a92fb1fd 100644 --- a/drivers/led/led_bcm6328.c +++ b/drivers/led/led_bcm6328.c @@ -204,26 +204,14 @@ static int bcm6328_led_bind(struct udevice *parent) ofnode node; dev_for_each_subnode(node, parent) { - struct led_uc_plat *uc_plat; struct udevice *dev; - const char *label; int ret; - label = ofnode_read_string(node, "label"); - if (!label) { - debug("%s: node %s has no label\n", __func__, - ofnode_get_name(node)); - return -EINVAL; - } - ret = device_bind_driver_to_node(parent, "bcm6328-led", ofnode_get_name(node), node, &dev); if (ret) return ret; - - uc_plat = dev_get_uclass_plat(dev); - uc_plat->label = label; } return 0; From 93c3722085eeb038b0c087e20ee48de626318eda Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 4 Apr 2022 01:18:04 +0200 Subject: [PATCH 07/21] led: bcm6358: Drop duplicate OF "label" property parsing The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver. Signed-off-by: Marek Vasut Cc: Alex Nemirovsky Cc: Patrick Delaunay Cc: Philippe Reynes Cc: Sean Anderson Cc: Simon Glass Cc: Steven Lawrance --- drivers/led/led_bcm6358.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/led/led_bcm6358.c b/drivers/led/led_bcm6358.c index 3e57cdfd17d..25aa3994d0e 100644 --- a/drivers/led/led_bcm6358.c +++ b/drivers/led/led_bcm6358.c @@ -174,26 +174,14 @@ static int bcm6358_led_bind(struct udevice *parent) ofnode node; dev_for_each_subnode(node, parent) { - struct led_uc_plat *uc_plat; struct udevice *dev; - const char *label; int ret; - label = ofnode_read_string(node, "label"); - if (!label) { - debug("%s: node %s has no label\n", __func__, - ofnode_get_name(node)); - return -EINVAL; - } - ret = device_bind_driver_to_node(parent, "bcm6358-led", ofnode_get_name(node), node, &dev); if (ret) return ret; - - uc_plat = dev_get_uclass_plat(dev); - uc_plat->label = label; } return 0; From fec91564788260dc4ba344373b442559e413adf4 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 4 Apr 2022 01:18:05 +0200 Subject: [PATCH 08/21] led: bcm6858: Drop duplicate OF "label" property parsing The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver. Signed-off-by: Marek Vasut Cc: Alex Nemirovsky Cc: Patrick Delaunay Cc: Philippe Reynes Cc: Sean Anderson Cc: Simon Glass Cc: Steven Lawrance --- drivers/led/led_bcm6858.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/led/led_bcm6858.c b/drivers/led/led_bcm6858.c index 3ca6c5b8a9e..6b3698674b9 100644 --- a/drivers/led/led_bcm6858.c +++ b/drivers/led/led_bcm6858.c @@ -241,26 +241,14 @@ static int bcm6858_led_bind(struct udevice *parent) ofnode node; dev_for_each_subnode(node, parent) { - struct led_uc_plat *uc_plat; struct udevice *dev; - const char *label; int ret; - label = ofnode_read_string(node, "label"); - if (!label) { - debug("%s: node %s has no label\n", __func__, - ofnode_get_name(node)); - return -EINVAL; - } - ret = device_bind_driver_to_node(parent, "bcm6858-led", ofnode_get_name(node), node, &dev); if (ret) return ret; - - uc_plat = dev_get_uclass_plat(dev); - uc_plat->label = label; } return 0; From c6db8eb4f61a390539ccf39dcd056250b110a804 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 4 Apr 2022 01:18:06 +0200 Subject: [PATCH 09/21] led: cortina: Drop duplicate OF "label" property parsing The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver. Signed-off-by: Marek Vasut Cc: Alex Nemirovsky Cc: Patrick Delaunay Cc: Philippe Reynes Cc: Sean Anderson Cc: Simon Glass Cc: Steven Lawrance --- drivers/led/led_cortina.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/led/led_cortina.c b/drivers/led/led_cortina.c index 598c0a03db5..bcbe78d632a 100644 --- a/drivers/led/led_cortina.c +++ b/drivers/led/led_cortina.c @@ -256,25 +256,14 @@ static int cortina_led_bind(struct udevice *parent) ofnode node; dev_for_each_subnode(node, parent) { - struct led_uc_plat *uc_plat; struct udevice *dev; - const char *label; int ret; - label = ofnode_read_string(node, "label"); - if (!label) { - debug("%s: node %s has no label\n", __func__, - ofnode_get_name(node)); - return -EINVAL; - } - ret = device_bind_driver_to_node(parent, "ca-leds", ofnode_get_name(node), node, &dev); if (ret) return ret; - uc_plat = dev_get_uclass_plat(dev); - uc_plat->label = label; } return 0; From 4228023eff7e94500137ce9e30687c00ffb4dd4f Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 14 Apr 2022 10:13:53 -0400 Subject: [PATCH 10/21] led: bcm6753: Drop duplicate OF "label" property parsing The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver. Signed-off-by: Tom Rini --- drivers/led/led_bcm6753.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/led/led_bcm6753.c b/drivers/led/led_bcm6753.c index a32bd8204fa..88b650cbfca 100644 --- a/drivers/led/led_bcm6753.c +++ b/drivers/led/led_bcm6753.c @@ -229,26 +229,14 @@ static int bcm6753_led_bind(struct udevice *parent) ofnode node; dev_for_each_subnode(node, parent) { - struct led_uc_plat *uc_plat; struct udevice *dev; - const char *label; int ret; - label = ofnode_read_string(node, "label"); - if (!label) { - debug("%s: node %s has no label\n", __func__, - ofnode_get_name(node)); - return -EINVAL; - } - ret = device_bind_driver_to_node(parent, "bcm6753-led", ofnode_get_name(node), node, &dev); if (ret) return ret; - - uc_plat = dev_get_uclass_plat(dev); - uc_plat->label = label; } return 0; From d797dd4c1ecf2b83eba4d2f618e6b1b5394beb95 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 14 Apr 2022 10:14:22 -0400 Subject: [PATCH 11/21] led: pwm: Drop duplicate OF "label" property parsing The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver. Signed-off-by: Tom Rini --- drivers/led/led_pwm.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/led/led_pwm.c b/drivers/led/led_pwm.c index 4e502722587..10bd1636c38 100644 --- a/drivers/led/led_pwm.c +++ b/drivers/led/led_pwm.c @@ -151,21 +151,11 @@ static int led_pwm_bind(struct udevice *parent) int ret; dev_for_each_subnode(node, parent) { - struct led_uc_plat *uc_plat; - const char *label; - - label = ofnode_read_string(node, "label"); - if (!label) - label = ofnode_get_name(node); - ret = device_bind_driver_to_node(parent, LEDS_PWM_DRIVER_NAME, ofnode_get_name(node), node, &dev); if (ret) return ret; - - uc_plat = dev_get_uclass_plat(dev); - uc_plat->label = label; } return 0; } From 2d1deaf88edc1182372794c79f43c6aa6c163d8e Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 4 Apr 2022 01:18:07 +0200 Subject: [PATCH 12/21] led: gpio: Drop duplicate OF "label" property parsing The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver. Signed-off-by: Marek Vasut Cc: Alex Nemirovsky Cc: Patrick Delaunay Cc: Philippe Reynes Cc: Sean Anderson Cc: Simon Glass Cc: Steven Lawrance --- drivers/led/led_gpio.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/led/led_gpio.c b/drivers/led/led_gpio.c index 67ece3cbcd0..958dbd31e77 100644 --- a/drivers/led/led_gpio.c +++ b/drivers/led/led_gpio.c @@ -95,19 +95,11 @@ static int led_gpio_bind(struct udevice *parent) int ret; dev_for_each_subnode(node, parent) { - struct led_uc_plat *uc_plat; - const char *label; - - label = ofnode_read_string(node, "label"); - if (!label) - label = ofnode_get_name(node); ret = device_bind_driver_to_node(parent, "gpio_led", ofnode_get_name(node), node, &dev); if (ret) return ret; - uc_plat = dev_get_uclass_plat(dev); - uc_plat->label = label; } return 0; From 72675b063b6ede269a8edee29575ade02c21b58d Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 4 Apr 2022 01:23:27 +0200 Subject: [PATCH 13/21] led: Configure LED default-state on boot In case the DT LED subnode contains "default-state" property set to either "on" or "off", probe the LED driver and configure the LED state automatically. Signed-off-by: Marek Vasut Cc: Alex Nemirovsky Cc: Patrick Delaunay Cc: Philippe Reynes Cc: Sean Anderson Cc: Simon Glass Cc: Steven Lawrance [trini: Update the relevant test now that we have support] Signed-off-by: Tom Rini --- drivers/led/led-uclass.c | 57 ++++++++++++++++++++++------------------ include/led.h | 38 ++++++++++++++------------- test/cmd/pinmux.c | 2 +- 3 files changed, 53 insertions(+), 44 deletions(-) diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c index 2f4aa18fb10..5d7bf40896b 100644 --- a/drivers/led/led-uclass.c +++ b/drivers/led/led-uclass.c @@ -66,43 +66,49 @@ int led_set_period(struct udevice *dev, int period_ms) } #endif +/* This is superseded by led_post_bind()/led_post_probe() below. */ int led_default_state(void) { - struct udevice *dev; - struct uclass *uc; - const char *default_state; - int ret; - - ret = uclass_get(UCLASS_LED, &uc); - if (ret) - return ret; - for (uclass_find_first_device(UCLASS_LED, &dev); - dev; - uclass_find_next_device(&dev)) { - default_state = dev_read_string(dev, "default-state"); - if (!default_state) - continue; - ret = device_probe(dev); - if (ret) - return ret; - if (!strncmp(default_state, "on", 2)) - led_set_state(dev, LEDST_ON); - else if (!strncmp(default_state, "off", 3)) - led_set_state(dev, LEDST_OFF); - /* default-state = "keep" : device is only probed */ - } - - return ret; + return 0; } static int led_post_bind(struct udevice *dev) { struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); + const char *default_state; uc_plat->label = dev_read_string(dev, "label"); if (!uc_plat->label) uc_plat->label = ofnode_get_name(dev_ofnode(dev)); + uc_plat->default_state = LEDST_COUNT; + + default_state = dev_read_string(dev, "default-state"); + if (!default_state) + return 0; + + if (!strncmp(default_state, "on", 2)) + uc_plat->default_state = LEDST_ON; + else if (!strncmp(default_state, "off", 3)) + uc_plat->default_state = LEDST_OFF; + else + return 0; + + /* + * In case the LED has default-state DT property, trigger + * probe() to configure its default state during startup. + */ + return device_probe(dev); +} + +static int led_post_probe(struct udevice *dev) +{ + struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); + + if (uc_plat->default_state == LEDST_ON || + uc_plat->default_state == LEDST_OFF) + led_set_state(dev, uc_plat->default_state); + return 0; } @@ -111,4 +117,5 @@ UCLASS_DRIVER(led) = { .name = "led", .per_device_plat_auto = sizeof(struct led_uc_plat), .post_bind = led_post_bind, + .post_probe = led_post_probe, }; diff --git a/include/led.h b/include/led.h index 8eeb5a7c6d3..43acca85719 100644 --- a/include/led.h +++ b/include/led.h @@ -9,24 +9,6 @@ struct udevice; -/** - * struct led_uc_plat - Platform data the uclass stores about each device - * - * @label: LED label - */ -struct led_uc_plat { - const char *label; -}; - -/** - * struct led_uc_priv - Private data the uclass stores about each device - * - * @period_ms: Flash period in milliseconds - */ -struct led_uc_priv { - int period_ms; -}; - enum led_state_t { LEDST_OFF = 0, LEDST_ON = 1, @@ -38,6 +20,26 @@ enum led_state_t { LEDST_COUNT, }; +/** + * struct led_uc_plat - Platform data the uclass stores about each device + * + * @label: LED label + * @default_state: LED default state + */ +struct led_uc_plat { + const char *label; + enum led_state_t default_state; +}; + +/** + * struct led_uc_priv - Private data the uclass stores about each device + * + * @period_ms: Flash period in milliseconds + */ +struct led_uc_priv { + int period_ms; +}; + struct led_ops { /** * set_state() - set the state of an LED diff --git a/test/cmd/pinmux.c b/test/cmd/pinmux.c index ba338b8dce8..de3bb0d2f97 100644 --- a/test/cmd/pinmux.c +++ b/test/cmd/pinmux.c @@ -16,7 +16,7 @@ static int dm_test_cmd_pinmux_status_pinname(struct unit_test_state *uts) /* Test that 'pinmux status ' displays the selected pin. */ console_record_reset(); run_command("pinmux status a5", 0); - ut_assert_nextlinen("a5 : gpio input ."); + ut_assert_nextlinen("a5 : gpio output ."); ut_assert_console_end(); console_record_reset(); From af298f3dcdae31b49791ff7aa1a6d75a27e57f3a Mon Sep 17 00:00:00 2001 From: Alexandre Besnard Date: Mon, 4 Apr 2022 17:50:14 +0200 Subject: [PATCH 14/21] cmd: ubi.c: skip part command if right partition is already attached Attaching a UBI partition may take a while, since scanning the memory is required. It thus makes sense to avoid a detach/scan/attach cycle when the right partition is already attached, and let the calling process call 'detach' beforehand if it needs it. This commit checks for the currently attached UBI partition, and skips reattaching if not needed, showing an information. Signed-off-by: Alexandre Besnard --- cmd/ubi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/ubi.c b/cmd/ubi.c index fe8ac58bac0..fccbfdf48d9 100644 --- a/cmd/ubi.c +++ b/cmd/ubi.c @@ -511,6 +511,11 @@ int ubi_part(char *part_name, const char *vid_header_offset) struct mtd_info *mtd; int err = 0; + if (ubi && ubi->mtd && !strcmp(ubi->mtd->name, part_name)) { + printf("UBI partition '%s' already selected\n", part_name); + return 0; + } + ubi_detach(); mtd_probe_devices(); From 2c777488b6709dea4aadfdadbbfccc0de751a022 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Mon, 4 Apr 2022 14:17:57 -0400 Subject: [PATCH 15/21] serial: Fix _serial_puts using \n\r instead of \r\n A string like "test\n" would be broken up into the following sequence of prints by _serial_puts: puts("test\n") putc('\r') Although functionally this is the same as \r\n, it is not the standard sequence and caused tests to fail. Fix this by excluding the '\n' from the initial print. The above string will now be broken up like puts("test") puts("\r\n") Since we may now need to call ops->puts twice (with the associated retry logic), break that part of the function off into a helper. Fixes: 7a76347189 ("serial: dm: Add support for puts") Signed-off-by: Sean Anderson --- drivers/serial/serial-uclass.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 10d6b800e2f..30650e37b0d 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -198,6 +198,22 @@ static void _serial_putc(struct udevice *dev, char ch) } while (err == -EAGAIN); } +static int __serial_puts(struct udevice *dev, const char *str, size_t len) +{ + struct dm_serial_ops *ops = serial_get_ops(dev); + + do { + ssize_t written = ops->puts(dev, str, len); + + if (written < 0) + return written; + str += written; + len -= written; + } while (len); + + return 0; +} + static void _serial_puts(struct udevice *dev, const char *str) { struct dm_serial_ops *ops = serial_get_ops(dev); @@ -210,19 +226,15 @@ static void _serial_puts(struct udevice *dev, const char *str) do { const char *newline = strchrnul(str, '\n'); - size_t len = newline - str + !!*newline; + size_t len = newline - str; - do { - ssize_t written = ops->puts(dev, str, len); + if (__serial_puts(dev, str, len)) + return; - if (written < 0) - return; - str += written; - len -= written; - } while (len); + if (*newline && __serial_puts(dev, "\r\n", 2)) + return; - if (*newline) - _serial_putc(dev, '\r'); + str += len + !!*newline; } while (*str); } From efa51f2bd641965f91550e1f7eeec14b5746db87 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Mon, 4 Apr 2022 14:17:58 -0400 Subject: [PATCH 16/21] serial: sandbox: Implement puts This implements puts for sandbox. It is fairly straightforward, except that we break out the shared color printing functionality into its own function. Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- drivers/serial/Kconfig | 1 + drivers/serial/sandbox.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 286c99800f0..6b189f8be05 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -779,6 +779,7 @@ config S5P_SERIAL config SANDBOX_SERIAL bool "Sandbox UART support" depends on SANDBOX + imply SERIAL_PUTS help Select this to enable a seral UART for sandbox. This is required to operate correctly, otherwise you will see no serial output from diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c index 0b1756f5c0c..50cf2c74a79 100644 --- a/drivers/serial/sandbox.c +++ b/drivers/serial/sandbox.c @@ -67,7 +67,7 @@ static int sandbox_serial_remove(struct udevice *dev) return 0; } -static int sandbox_serial_putc(struct udevice *dev, const char ch) +static void sandbox_print_color(struct udevice *dev) { struct sandbox_serial_priv *priv = dev_get_priv(dev); struct sandbox_serial_plat *plat = dev_get_plat(dev); @@ -78,7 +78,13 @@ static int sandbox_serial_putc(struct udevice *dev, const char ch) priv->start_of_line = false; output_ansi_colour(plat->colour); } +} +static int sandbox_serial_putc(struct udevice *dev, const char ch) +{ + struct sandbox_serial_priv *priv = dev_get_priv(dev); + + sandbox_print_color(dev); os_write(1, &ch, 1); if (ch == '\n') priv->start_of_line = true; @@ -86,6 +92,18 @@ static int sandbox_serial_putc(struct udevice *dev, const char ch) return 0; } +static ssize_t sandbox_serial_puts(struct udevice *dev, const char *s, + size_t len) +{ + struct sandbox_serial_priv *priv = dev_get_priv(dev); + + sandbox_print_color(dev); + if (s[len - 1] == '\n') + priv->start_of_line = true; + + return os_write(1, s, len); +} + static int sandbox_serial_pending(struct udevice *dev, bool input) { struct sandbox_serial_priv *priv = dev_get_priv(dev); @@ -212,6 +230,7 @@ static int sandbox_serial_of_to_plat(struct udevice *dev) static const struct dm_serial_ops sandbox_serial_ops = { .putc = sandbox_serial_putc, + .puts = sandbox_serial_puts, .pending = sandbox_serial_pending, .getc = sandbox_serial_getc, .getconfig = sandbox_serial_getconfig, From 679190c41a25592103e711718c93d2655d344713 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Mon, 4 Apr 2022 14:17:59 -0400 Subject: [PATCH 17/21] test: serial: Add test for putc/puts This adds a test to ensure that puts is equivalent to putc called in a loop. We don't verify the contents of the message to avoid having to record console output a second time (though that could be added in the future). The globals are initialized to non-zero values to avoid a warning; in particular, the character count is off-by-one (but we always make relative measurements). Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- arch/sandbox/include/asm/serial.h | 22 +++++++++++++++++++++ drivers/serial/sandbox.c | 33 +++++++++++++++++++++++++++---- test/dm/serial.c | 19 ++++++++++++++++++ 3 files changed, 70 insertions(+), 4 deletions(-) diff --git a/arch/sandbox/include/asm/serial.h b/arch/sandbox/include/asm/serial.h index bc82aebd0ea..16589a1b219 100644 --- a/arch/sandbox/include/asm/serial.h +++ b/arch/sandbox/include/asm/serial.h @@ -16,6 +16,28 @@ struct sandbox_serial_plat { int colour; /* Text colour to use for output, -1 for none */ }; +/** + * sandbox_serial_written() - Get the total number of characters written + * + * This returns the number of characters written by the sandbox serial + * device. It is intended for performing tests of the serial subsystem + * where a console buffer cannot be used. The absolute number should not be + * relied upon; call this function twice and compare the difference. + * + * Return: The number of characters written + */ +size_t sandbox_serial_written(void); + +/** + * sandbox_serial_endisable() - Enable or disable serial output + * @enabled: Whether serial output should be enabled or not + * + * This allows tests to enable or disable the sandbox serial output. All + * processes relating to writing output (except the actual writing) will be + * performed. + */ +void sandbox_serial_endisable(bool enabled); + /** * struct sandbox_serial_priv - Private data for this driver * diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c index 50cf2c74a79..e726e19c46f 100644 --- a/drivers/serial/sandbox.c +++ b/drivers/serial/sandbox.c @@ -23,6 +23,19 @@ DECLARE_GLOBAL_DATA_PTR; +static size_t _sandbox_serial_written = 1; +static bool sandbox_serial_enabled = true; + +size_t sandbox_serial_written(void) +{ + return _sandbox_serial_written; +} + +void sandbox_serial_endisable(bool enabled) +{ + sandbox_serial_enabled = enabled; +} + /** * output_ansi_colour() - Output an ANSI colour code * @@ -84,11 +97,14 @@ static int sandbox_serial_putc(struct udevice *dev, const char ch) { struct sandbox_serial_priv *priv = dev_get_priv(dev); - sandbox_print_color(dev); - os_write(1, &ch, 1); if (ch == '\n') priv->start_of_line = true; + if (sandbox_serial_enabled) { + sandbox_print_color(dev); + os_write(1, &ch, 1); + } + _sandbox_serial_written += 1; return 0; } @@ -96,12 +112,21 @@ static ssize_t sandbox_serial_puts(struct udevice *dev, const char *s, size_t len) { struct sandbox_serial_priv *priv = dev_get_priv(dev); + ssize_t ret; - sandbox_print_color(dev); if (s[len - 1] == '\n') priv->start_of_line = true; - return os_write(1, s, len); + if (sandbox_serial_enabled) { + sandbox_print_color(dev); + ret = os_write(1, s, len); + if (ret < 0) + return ret; + } else { + ret = len; + } + _sandbox_serial_written += ret; + return ret; } static int sandbox_serial_pending(struct udevice *dev, bool input) diff --git a/test/dm/serial.c b/test/dm/serial.c index 0662b5f09b8..37d17a65f16 100644 --- a/test/dm/serial.c +++ b/test/dm/serial.c @@ -7,14 +7,22 @@ #include #include #include +#include #include #include #include +static const char test_message[] = + "This is a test message\n" + "consisting of multiple lines\n"; + static int dm_test_serial(struct unit_test_state *uts) { + int i; struct serial_device_info info_serial = {0}; struct udevice *dev_serial; + size_t start, putc_written; + uint value_serial; ut_assertok(uclass_get_device_by_name(UCLASS_SERIAL, "serial", @@ -66,6 +74,17 @@ static int dm_test_serial(struct unit_test_state *uts) SERIAL_8_BITS, SERIAL_TWO_STOP))); + /* Verify that putc and puts print the same number of characters */ + sandbox_serial_endisable(false); + start = sandbox_serial_written(); + for (i = 0; i < sizeof(test_message) - 1; i++) + serial_putc(test_message[i]); + putc_written = sandbox_serial_written(); + serial_puts(test_message); + sandbox_serial_endisable(true); + ut_asserteq(putc_written - start, + sandbox_serial_written() - putc_written); + return 0; } From 34855b39beb63ca3cdeabbd704ea610268837ced Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Mon, 4 Apr 2022 14:18:00 -0400 Subject: [PATCH 18/21] serial: smh: Implement puts for DM This adds an implementation of puts for DM. The implementation is not as clean as for the non-DM puts because we have to handle non-nul-terminated string. We also handle short writes (though these are probably very unusual). Signed-off-by: Sean Anderson --- drivers/serial/Kconfig | 1 + drivers/serial/serial_semihosting.c | 31 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 6b189f8be05..dc514c95d33 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -834,6 +834,7 @@ config SH_SCIF_CLK_FREQ config SEMIHOSTING_SERIAL bool "Semihosting UART support" depends on SEMIHOSTING && !SERIAL_RX_BUFFER + imply SERIAL_PUTS help Select this to enable a serial UART using semihosting. Special halt instructions will be issued which an external debugger (such as a diff --git a/drivers/serial/serial_semihosting.c b/drivers/serial/serial_semihosting.c index 62b1b2241b3..4328b3dac5b 100644 --- a/drivers/serial/serial_semihosting.c +++ b/drivers/serial/serial_semihosting.c @@ -5,12 +5,14 @@ #include #include +#include #include #include /** * struct smh_serial_priv - Semihosting serial private data * @infd: stdin file descriptor (or error) + * @outfd: stdout file descriptor (or error) */ struct smh_serial_priv { int infd; @@ -36,8 +38,36 @@ static int smh_serial_putc(struct udevice *dev, const char ch) return 0; } +static ssize_t smh_serial_puts(struct udevice *dev, const char *s, size_t len) +{ + int ret; + struct smh_serial_priv *priv = dev_get_priv(dev); + unsigned long written; + + if (priv->outfd < 0) { + char *buf; + + /* Try and avoid a copy if we can */ + if (!s[len + 1]) { + smh_puts(s); + return len; + } + + buf = strndup(s, len); + smh_puts(buf); + free(buf); + return len; + } + + ret = smh_write(priv->outfd, s, len, &written); + if (written) + return written; + return ret; +} + static const struct dm_serial_ops smh_serial_ops = { .putc = smh_serial_putc, + .puts = smh_serial_puts, .getc = smh_serial_getc, }; @@ -53,6 +83,7 @@ static int smh_serial_probe(struct udevice *dev) struct smh_serial_priv *priv = dev_get_priv(dev); priv->infd = smh_open(":tt", MODE_READ); + priv->outfd = smh_open(":tt", MODE_WRITE); return 0; } From 2df59b2bd4bf0dee0884fc774591eedd232141e6 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Mon, 4 Apr 2022 14:43:51 -0400 Subject: [PATCH 19/21] Remove duplication of table_compute_checksum function It seems like there was some merge error when first cleaning up and sharing this function. We have both an inline version of the function in include/tables_csum.h and a non-inline version in lib/tables_csum.c. Rework things so that we only have the non-inline version (due to number of calls, we should not inline this). Fixes: 1befb38b8682 ("x86: Move table csum into separate file") Fixes: 2b445e4d3194 ("x86: Move table csum into separate header") Cc: Alexander Graf Signed-off-by: Tom Rini --- arch/sandbox/include/asm/tables.h | 0 arch/x86/include/asm/tables.h | 13 ------------- drivers/misc/qfw.c | 3 --- include/tables_csum.h | 23 ++++++++++++----------- 4 files changed, 12 insertions(+), 27 deletions(-) delete mode 100644 arch/sandbox/include/asm/tables.h diff --git a/arch/sandbox/include/asm/tables.h b/arch/sandbox/include/asm/tables.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/arch/x86/include/asm/tables.h b/arch/x86/include/asm/tables.h index aa938837b65..37be01240db 100644 --- a/arch/x86/include/asm/tables.h +++ b/arch/x86/include/asm/tables.h @@ -16,19 +16,6 @@ /* SeaBIOS expects coreboot tables at address range 0x0000-0x1000 */ #define CB_TABLE_ADDR 0x800 -/** - * table_compute_checksum() - Compute a table checksum - * - * This computes an 8-bit checksum for the configuration table. - * All bytes in the configuration table, including checksum itself and - * reserved bytes must add up to zero. - * - * @v: configuration table base address - * @len: configuration table size - * @return: the 8-bit checksum - */ -u8 table_compute_checksum(void *v, int len); - /** * table_fill_string() - Fill a string with pad in the configuration table * diff --git a/drivers/misc/qfw.c b/drivers/misc/qfw.c index 677841aac5e..1d54b7542b8 100644 --- a/drivers/misc/qfw.c +++ b/drivers/misc/qfw.c @@ -15,9 +15,6 @@ #include #include #include -#ifdef CONFIG_GENERATE_ACPI_TABLE -#include -#endif #if defined(CONFIG_GENERATE_ACPI_TABLE) && !defined(CONFIG_SANDBOX) /* diff --git a/include/tables_csum.h b/include/tables_csum.h index 5f7edc419ba..4812333093a 100644 --- a/include/tables_csum.h +++ b/include/tables_csum.h @@ -6,16 +6,17 @@ #ifndef _TABLES_CSUM_H_ #define _TABLES_CSUM_H_ -static inline u8 table_compute_checksum(void *v, int len) -{ - u8 *bytes = v; - u8 checksum = 0; - int i; - - for (i = 0; i < len; i++) - checksum -= bytes[i]; - - return checksum; -} +/** + * table_compute_checksum() - Compute a table checksum + * + * This computes an 8-bit checksum for the configuration table. + * All bytes in the configuration table, including checksum itself and + * reserved bytes must add up to zero. + * + * @v: configuration table base address + * @len: configuration table size + * @return: the 8-bit checksum + */ +u8 table_compute_checksum(void *v, int len); #endif From 5bbaba6e29fc0d92ff0201bd7066c021a6dd8727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Tue, 5 Apr 2022 15:48:32 +0200 Subject: [PATCH 20/21] fs: Allow to compile FS_FAT only for proper U-Boot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CONFIG_SPL_FS_FAT cannot be disabled when CONFIG_FS_FAT is enabled. Fix it. Signed-off-by: Pali Rohár --- fs/fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fs.c b/fs/fs.c index c3a2ed97541..2b0a242e8c7 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -177,7 +177,7 @@ struct fstype_info { }; static struct fstype_info fstypes[] = { -#ifdef CONFIG_FS_FAT +#if CONFIG_IS_ENABLED(FS_FAT) { .fstype = FS_TYPE_FAT, .name = "fat", From b8617df6d5c8afb74ae8bb4b732a8b56b4f5e9ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Tue, 5 Apr 2022 15:49:24 +0200 Subject: [PATCH 21/21] fs: Allow to compile CMD_UBIFS when SPL is enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently there is no UBIFS support in SPL. But macro CONFIG_CMD_UBIFS is defined also when building SPL. when both CMD_UBIFS and SPL are enabled then build process throw compile error. Fix check for ubifs code in fstypes[] to allow compiling CMD_UBIFS only in proper U-Boot. Signed-off-by: Pali Rohár --- fs/fs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/fs.c b/fs/fs.c index 2b0a242e8c7..c67a1c7876a 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -267,6 +267,7 @@ static struct fstype_info fstypes[] = { .ln = fs_ln_unsupported, }, #endif +#ifndef CONFIG_SPL_BUILD #ifdef CONFIG_CMD_UBIFS { .fstype = FS_TYPE_UBIFS, @@ -286,6 +287,7 @@ static struct fstype_info fstypes[] = { .ln = fs_ln_unsupported, }, #endif +#endif #ifdef CONFIG_FS_BTRFS { .fstype = FS_TYPE_BTRFS,