From 1d1c54f458abfb63cace544f97f491ae04f56409 Mon Sep 17 00:00:00 2001 From: Harrison Mutai Date: Tue, 4 Feb 2025 17:58:39 +0000 Subject: bloblist: fix typo in code comments Fix the two typos in the spelling of same and set in common/Kconfig and include/bloblist.h. Signed-off-by: Harrison Mutai --- include/bloblist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/bloblist.h b/include/bloblist.h index f999391f74b..03d9862c0f1 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -463,7 +463,7 @@ int bloblist_init(void); /** * bloblist_maybe_init() - Init the bloblist system if not already done * - * Calls bloblist_init() if the GD_FLG_BLOBLIST_READY flag is not et + * Calls bloblist_init() if the GD_FLG_BLOBLIST_READY flag is not set * * Return: 0 if OK, -ve on error */ -- cgit v1.2.3 From 581b3035a898db8d3ff95f9c5aec6f094062d4e2 Mon Sep 17 00:00:00 2001 From: Harrison Mutai Date: Tue, 4 Feb 2025 17:58:40 +0000 Subject: board: vexpress64: default to hardware device tree When booting into the Linux kernel with semi-hosting, use the device tree provided by hardware unless one is provided in the current directory. Signed-off-by: Harrison Mutai Reviewed-by: Linus Walleij --- include/configs/vexpress_aemv8.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/configs/vexpress_aemv8.h b/include/configs/vexpress_aemv8.h index b5a17f93efc..5eee13b3fc0 100644 --- a/include/configs/vexpress_aemv8.h +++ b/include/configs/vexpress_aemv8.h @@ -181,12 +181,14 @@ " if load hostfs - ${kernel_addr_r} ${kernel_name}; then" \ " setenv fdt_high 0xffffffffffffffff;" \ " setenv initrd_high 0xffffffffffffffff;" \ - " load hostfs - ${fdt_addr_r} ${fdtfile};" \ + " if test -n load hostfs - ${fdt_addr_r} ${fdtfile}; then" \ + " fdt move $fdtcontroladdr $fdt_addr_r;" \ + " fi;" \ " load hostfs - ${ramdisk_addr_r} ${ramdisk_name};" \ " fdt addr ${fdt_addr_r};" \ " fdt resize;" \ " fdt chosen ${ramdisk_addr_r} ${filesize};" \ - " booti $kernel_addr_r - $fdt_addr_r;" \ + " booti $kernel_addr_r - ${fdt_addr_r};" \ " fi;" \ "fi\0" #define BOOTENV_DEV_NAME_SMH(devtypeu, devtypel, instance) "smh " -- cgit v1.2.3 From 5f6a59e03eff0f29295ce12b3807cbac7334e0aa Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 7 Feb 2025 11:30:35 -0700 Subject: test: Keep track of suite duration Show the time taken by each test suite with 'ut all' and the total time for all suites. Take care to remove any sandbox time-offset from the values. Fix the comment-format on timer_test_add_offset() while we are here. Signed-off-by: Simon Glass --- include/test/test.h | 4 ++++ include/time.h | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/test/test.h b/include/test/test.h index bac43c81d63..25c7712d160 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -16,11 +16,15 @@ * @skip_count: Number of tests that were skipped * @test_count: Number of tests run. If a test is run muiltiple times, only one * is counted + * @start: Timer value when test started + * @duration_ms: Suite duration in milliseconds */ struct ut_stats { int fail_count; int skip_count; int test_count; + ulong start; + ulong duration_ms; }; /* diff --git a/include/time.h b/include/time.h index 3b2ba091247..f5b86bf70fe 100644 --- a/include/time.h +++ b/include/time.h @@ -28,7 +28,7 @@ uint64_t get_timer_us(uint64_t base); */ unsigned long get_timer_us_long(unsigned long base); -/* +/** * timer_test_add_offset() * * Allow tests to add to the time reported through lib/time.c functions @@ -36,6 +36,19 @@ unsigned long get_timer_us_long(unsigned long base); */ void timer_test_add_offset(unsigned long offset); +#ifdef CONFIG_SANDBOX +/** + * timer_test_get_offset() + * + * Get the total offset currently being added the time + * + * Return:: number of milliseconds the system time has been advanced + */ +ulong timer_test_get_offset(void); +#else +static inline ulong timer_test_get_offset(void) { return 0; } +#endif + /** * usec_to_tick() - convert microseconds to clock ticks * -- cgit v1.2.3 From b85df267e1f9f6f53086875975b8e4b24570365d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 7 Feb 2025 11:30:36 -0700 Subject: test: Show the average time per test Show the average duration of a test, so we can keep track of how it is trending. Report the suite with the longest average test to encourage people to improve it. Add a function to update the stats based on the results from a single suite and another to show the summary information. Make this optional, since sandbox's SPL tests do not have a timer driver and people may want to print results without times. Signed-off-by: Simon Glass --- include/test/test.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/test/test.h b/include/test/test.h index 25c7712d160..877fda8d5aa 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -33,6 +33,8 @@ struct ut_stats { * @cur: Statistics for the current run * @total: Statistics for all test runs * @run_count: Number of times ut_run_list() has been called + * @worst: Sute which had the first per-text run time + * @worst_ms: Time taken by that test * @start: Store the starting mallinfo when doing leak test * @of_live: true to use livetree if available, false to use flattree * @of_root: Record of the livetree root node (used for setting up tests) @@ -56,6 +58,8 @@ struct unit_test_state { struct ut_stats cur; struct ut_stats total; int run_count; + const struct suite *worst; + int worst_ms; struct mallinfo start; struct device_node *of_root; bool of_live; -- cgit v1.2.3 From c908ecb7b51e886469c4fc8eb5492bdbda55b871 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 7 Feb 2025 11:30:38 -0700 Subject: test: Support an init/uninit functions for test suites Some suites need things to be set up before they can run. Add a way to declare an init function using the UNIT_TEST_INIT() macro. The init function is just like any other test, but is always placed first so that it runs before all the other test functions in the suite. Add an uninit function as well, to clean up after the test. Signed-off-by: Simon Glass --- include/test/test.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'include') diff --git a/include/test/test.h b/include/test/test.h index 877fda8d5aa..0f2b68a5dee 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -100,6 +100,8 @@ enum ut_flags { UTF_ETH_BOOTDEV = BIT(9), /* enable Ethernet bootdevs */ UTF_SF_BOOTDEV = BIT(10), /* enable SPI flash bootdevs */ UFT_BLOBLIST = BIT(11), /* test changes gd->bloblist */ + UTF_INIT = BIT(12), /* test inits a suite */ + UTF_UNINIT = BIT(13), /* test uninits a suite */ }; /** @@ -147,6 +149,24 @@ struct unit_test { .func = _name, \ } +/* init function for unit-test suite (the 'A' makes it first) */ +#define UNIT_TEST_INIT(_name, _flags, _suite) \ + ll_entry_declare(struct unit_test, A ## _name, ut_ ## _suite) = { \ + .file = __FILE__, \ + .name = #_name, \ + .flags = (_flags) | UTF_INIT, \ + .func = _name, \ + } + +/* uninit function for unit-test suite (the 'aaa' makes it last) */ +#define UNIT_TEST_UNINIT(_name, _flags, _suite) \ + ll_entry_declare(struct unit_test, zzz ## _name, ut_ ## _suite) = { \ + .file = __FILE__, \ + .name = #_name, \ + .flags = (_flags) | UTF_UNINIT, \ + .func = _name, \ + } + /* Get the start of a list of unit tests for a particular suite */ #define UNIT_TEST_SUITE_START(_suite) \ ll_entry_start(struct unit_test, ut_ ## _suite) -- cgit v1.2.3 From ea29bad9cff2fd88d172276b58859f01649fe444 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 7 Feb 2025 11:30:39 -0700 Subject: test: Tweak FDT-overlay tests Use fdt_overlay consistently in the identifiers and file/dir names. Signed-off-by: Simon Glass --- include/test/fdt_overlay.h | 15 +++++++++++++++ include/test/overlay.h | 15 --------------- include/test/suites.h | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 include/test/fdt_overlay.h delete mode 100644 include/test/overlay.h (limited to 'include') diff --git a/include/test/fdt_overlay.h b/include/test/fdt_overlay.h new file mode 100644 index 00000000000..34e8020a496 --- /dev/null +++ b/include/test/fdt_overlay.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2016 NextThing Co + * Copyright (c) 2016 Free Electrons + */ + +#ifndef __TEST_OVERLAY_H__ +#define __TEST_OVERLAY_H__ + +#include + +/* Declare a new FDT-overlay test */ +#define FDT_OVERLAY_TEST(_name, _flags) UNIT_TEST(_name, _flags, fdt_overlay) + +#endif /* __TEST_OVERLAY_H__ */ diff --git a/include/test/overlay.h b/include/test/overlay.h deleted file mode 100644 index 5dc98399ce7..00000000000 --- a/include/test/overlay.h +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright (c) 2016 NextThing Co - * Copyright (c) 2016 Free Electrons - */ - -#ifndef __TEST_OVERLAY_H__ -#define __TEST_OVERLAY_H__ - -#include - -/* Declare a new environment test */ -#define OVERLAY_TEST(_name, _flags) UNIT_TEST(_name, _flags, overlay) - -#endif /* __TEST_OVERLAY_H__ */ diff --git a/include/test/suites.h b/include/test/suites.h index 774dd893378..dce720b4e78 100644 --- a/include/test/suites.h +++ b/include/test/suites.h @@ -36,8 +36,8 @@ int cmd_ut_category(struct unit_test_state *uts, const char *name, int do_ut_bootstd(struct unit_test_state *uts, struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); +int do_ut_fdt_overlay(struct unit_test_state *uts, struct cmd_tbl *cmdtp, + int flag, int argc, char *const argv[]); int do_ut_optee(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); -int do_ut_overlay(struct unit_test_state *uts, struct cmd_tbl *cmdtp, int flag, - int argc, char *const argv[]); #endif /* __TEST_SUITES_H__ */ -- cgit v1.2.3 From a7290bc4b7248118046f748d80088a40f9171576 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 7 Feb 2025 11:30:46 -0700 Subject: test: Update fdt_overlay to do init from tests Rather than having an init function and then running the tests, create a test-init function to do it. This will allow us to get rid of the command function. Signed-off-by: Simon Glass --- include/test/fdt_overlay.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/test/fdt_overlay.h b/include/test/fdt_overlay.h index 34e8020a496..251ad0ec97a 100644 --- a/include/test/fdt_overlay.h +++ b/include/test/fdt_overlay.h @@ -12,4 +12,8 @@ /* Declare a new FDT-overlay test */ #define FDT_OVERLAY_TEST(_name, _flags) UNIT_TEST(_name, _flags, fdt_overlay) +/* Declare init for FDT-overlay test */ +#define FDT_OVERLAY_TEST_INIT(_name, _flags) \ + UNIT_TEST_INIT(_name, _flags, fdt_overlay) + #endif /* __TEST_OVERLAY_H__ */ -- cgit v1.2.3 From ba1112839ace31b4aed85506cf5fe74256c597df Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 7 Feb 2025 11:30:47 -0700 Subject: test: Drop the function for running fdt_overlay tests Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass --- include/test/suites.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/test/suites.h b/include/test/suites.h index dce720b4e78..78f5cdb4bdf 100644 --- a/include/test/suites.h +++ b/include/test/suites.h @@ -36,8 +36,6 @@ int cmd_ut_category(struct unit_test_state *uts, const char *name, int do_ut_bootstd(struct unit_test_state *uts, struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); -int do_ut_fdt_overlay(struct unit_test_state *uts, struct cmd_tbl *cmdtp, - int flag, int argc, char *const argv[]); int do_ut_optee(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); #endif /* __TEST_SUITES_H__ */ -- cgit v1.2.3 From 7e1c6bd0778baffd90164e69f1d5f8ea8729a5ae Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 7 Feb 2025 11:30:49 -0700 Subject: test: Drop the function for running bootstd tests Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass --- include/test/suites.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/test/suites.h b/include/test/suites.h index 78f5cdb4bdf..692633dcaa4 100644 --- a/include/test/suites.h +++ b/include/test/suites.h @@ -34,8 +34,6 @@ int cmd_ut_category(struct unit_test_state *uts, const char *name, const char *prefix, struct unit_test *tests, int n_ents, int argc, char *const argv[]); -int do_ut_bootstd(struct unit_test_state *uts, struct cmd_tbl *cmdtp, int flag, - int argc, char *const argv[]); int do_ut_optee(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); #endif /* __TEST_SUITES_H__ */ -- cgit v1.2.3 From 1c05e2c0eb9cd449a743d49c89a777b6bc803a15 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 7 Feb 2025 11:30:50 -0700 Subject: test: Update optee to do init and uninit from tests Rather than having an init function and then running the tests, create a test-init function to do it. This will allow us to get rid of the command function. Fix the comment abotu 'environment' while we are here. Signed-off-by: Simon Glass --- include/test/optee.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/test/optee.h b/include/test/optee.h index f4255b39ee3..0a548a59e83 100644 --- a/include/test/optee.h +++ b/include/test/optee.h @@ -8,7 +8,9 @@ #include -/* Declare a new environment test */ +/* Declare a new optee test */ #define OPTEE_TEST(_name, _flags) UNIT_TEST(_name, _flags, optee) +#define OPTEE_TEST_INIT(_name, _flags) UNIT_TEST_INIT(_name, _flags, optee) +#define OPTEE_TEST_UNINIT(_name, _flags) UNIT_TEST_UNINIT(_name, _flags, optee) #endif /* __TEST_OPTEE_H__ */ -- cgit v1.2.3 From daf583a3174f1c0ea7a617e6a5bb1b83051dfbad Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 7 Feb 2025 11:30:52 -0700 Subject: test: Drop the function for running optee tests Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass --- include/test/suites.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/test/suites.h b/include/test/suites.h index 692633dcaa4..a2f982bf6fa 100644 --- a/include/test/suites.h +++ b/include/test/suites.h @@ -34,6 +34,4 @@ int cmd_ut_category(struct unit_test_state *uts, const char *name, const char *prefix, struct unit_test *tests, int n_ents, int argc, char *const argv[]); -int do_ut_optee(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); - #endif /* __TEST_SUITES_H__ */ -- cgit v1.2.3 From 59713c412aeb2f1cafd42a77c948ce92d387de44 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 7 Feb 2025 11:30:54 -0700 Subject: test: Drop support for test commands Now that everything is using the new test-suite features, drop support for running commands. Fix a missing closing-bracket while we are here. Signed-off-by: Simon Glass --- include/test/suites.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include') diff --git a/include/test/suites.h b/include/test/suites.h index a2f982bf6fa..687a8a13e7f 100644 --- a/include/test/suites.h +++ b/include/test/suites.h @@ -7,14 +7,9 @@ #ifndef __TEST_SUITES_H__ #define __TEST_SUITES_H__ -struct cmd_tbl; struct unit_test; struct unit_test_state; -/* 'command' functions normally called do_xxx where xxx is the command name */ -typedef int (*ut_cmd_func)(struct unit_test_state *uts, struct cmd_tbl *cmd, - int flags, int argc, char *const argv[]); - /** * cmd_ut_category() - Run a category of unit tests * -- cgit v1.2.3 From 854225191af5527619fcc944d38f2e2fd5d3ced1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 7 Feb 2025 11:30:55 -0700 Subject: test: Make cmd_ut_category() static This function is not used outside the cmd_ut file anymore, so make it static. Signed-off-by: Simon Glass --- include/test/suites.h | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'include') diff --git a/include/test/suites.h b/include/test/suites.h index 687a8a13e7f..f817da747c2 100644 --- a/include/test/suites.h +++ b/include/test/suites.h @@ -7,26 +7,4 @@ #ifndef __TEST_SUITES_H__ #define __TEST_SUITES_H__ -struct unit_test; -struct unit_test_state; - -/** - * cmd_ut_category() - Run a category of unit tests - * - * @uts: Unit-test state, which must be ready for use, i.e. ut_init_state() - * has been called. The caller is responsible for calling - * ut_uninit_state() after this function returns - * @name: Category name - * @prefix: Prefix of test name - * @tests: List of tests to run - * @n_ents: Number of tests in @tests - * @argc: Argument count provided. Must be >= 1. If this is 1 then all - * tests are run, otherwise only the one named @argv[1] is run. - * @argv: Arguments: argv[1] is the test to run (if @argc >= 2) - * Return: 0 if OK, CMD_RET_FAILURE on failure - */ -int cmd_ut_category(struct unit_test_state *uts, const char *name, - const char *prefix, struct unit_test *tests, int n_ents, - int argc, char *const argv[]); - #endif /* __TEST_SUITES_H__ */ -- cgit v1.2.3 From 32aba887e3d7cbcdf8fd98c107aaa79f3bd44a16 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 7 Feb 2025 11:30:56 -0700 Subject: test: Drop suites.h This file is empty now. Remove it and its uses. Signed-off-by: Simon Glass --- include/test/suites.h | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 include/test/suites.h (limited to 'include') diff --git a/include/test/suites.h b/include/test/suites.h deleted file mode 100644 index f817da747c2..00000000000 --- a/include/test/suites.h +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * (C) Copyright 2015 - * Joe Hershberger, National Instruments, joe.hershberger@ni.com - */ - -#ifndef __TEST_SUITES_H__ -#define __TEST_SUITES_H__ - -#endif /* __TEST_SUITES_H__ */ -- cgit v1.2.3 From 940135eea5df45ac8101af3c3af2aa54762d9747 Mon Sep 17 00:00:00 2001 From: Tomas Peterka Date: Fri, 31 Jan 2025 11:08:44 +0100 Subject: Kconfig: Move CONFIG_BOOTCOUNT_ALTBOOTCMD to Kconfig Add CONFIG_BOOTCOUNT_ALTBOOTCMD so the developer is able to add custom altbootcmd via Kconfig when they enable BOOTCOUNT. With this now in Kconfig, we need to move it from environment files / config.h files and in to the defconfig file. This was done by generating u-boot-initial-env for all platforms before the Kconfig change, to extract altbootcmd values and then again after to compare the result. [trini: Perform migration to defconfigs, reword commit message] Signed-off-by: Tom Rini --- include/configs/am335x_guardian.h | 5 ----- include/configs/bk4r1.h | 2 -- include/configs/brppt2.h | 1 - include/configs/display5.h | 1 - include/configs/ge_b1x5v2.h | 8 -------- include/configs/ge_bx50v3.h | 8 -------- include/configs/imx6-engicam.h | 1 - include/configs/imx6q-bosch-acc.h | 3 +-- include/configs/imx8mm-mx8menlo.h | 8 -------- include/configs/imx8mm_data_modul_edm_sbc.h | 1 - include/configs/imx8mp_data_modul_edm_sbc.h | 1 - include/configs/imx8mp_dhcom_pdk2.h | 1 - include/configs/m53menlo.h | 7 ------- include/configs/mx53ppd.h | 8 -------- include/configs/siemens-am33x-common.h | 1 - include/configs/siemens-env-common.h | 1 - include/configs/snapper9g45.h | 3 +-- include/env/pg-wcom/common.env | 1 - include/env_default.h | 3 +++ 19 files changed, 5 insertions(+), 59 deletions(-) (limited to 'include') diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index 96efd38594a..385dec2ff4f 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -63,11 +63,6 @@ "fi; " \ "setenv extrabootargs $extrabootargs \"swi_attached\"; " \ "fi;" \ - "run bootcmd_ubifs0;\0" \ - "altbootcmd=" \ - "setenv boot_syslinux_conf \"extlinux/extlinux-rollback.conf\"; " \ - "run distro_bootcmd; " \ - "setenv boot_syslinux_conf \"extlinux/extlinux.conf\"; " \ "run bootcmd_ubifs0;\0" #endif /* ! CONFIG_XPL_BUILD */ diff --git a/include/configs/bk4r1.h b/include/configs/bk4r1.h index 5df8d03c706..6d24c5decd5 100644 --- a/include/configs/bk4r1.h +++ b/include/configs/bk4r1.h @@ -16,8 +16,6 @@ #define BK4_EXTRA_ENV_SETTINGS \ "bootlimit=3\0" \ "eraseuserdata=false\0" \ - "altbootcmd=led 5 on; " \ - "boot\0" \ "set_gpio103=mw 0x400ff0c4 0x0080; mw 0x4004819C 0x000011bf\0" \ "set_gpio102=mw 0x400ff0c4 0x40; mw 0x40048198 0x000011bf\0" \ "set_gpio96=mw 0x40048180 0x282; mw 0x400ff0c4 0x1\0"\ diff --git a/include/configs/brppt2.h b/include/configs/brppt2.h index d01f0d37316..93559a171ae 100644 --- a/include/configs/brppt2.h +++ b/include/configs/brppt2.h @@ -64,7 +64,6 @@ BUR_COMMON_ENV \ " do echo \"### booting ${target} ###\"; run b_${target};" \ " if test ${b_break} = 1; then; exit; fi; done\0" \ "loaddev=mmc 0\0" \ -"altbootcmd=setenv b_mode 0; run b_default;\0" \ "bootlimit=1\0" \ "net2nor=sf probe && dhcp &&" \ " tftp ${loadaddr} SPL && sf erase 0 +${filesize} &&" \ diff --git a/include/configs/display5.h b/include/configs/display5.h index 51fa2b03a2e..98b1e5af2c0 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -170,7 +170,6 @@ "display=tianma-tm070-800x480\0" \ "board=display5\0" \ "mmcdev=0\0" \ - "altbootcmd=run recovery\0" \ "bootdelay=1\0" \ "baudrate=115200\0" \ "ethact=FEC\0" \ diff --git a/include/configs/ge_b1x5v2.h b/include/configs/ge_b1x5v2.h index f3d85c9c11e..5e3f67124c0 100644 --- a/include/configs/ge_b1x5v2.h +++ b/include/configs/ge_b1x5v2.h @@ -82,14 +82,6 @@ "doboot=" \ "echo Booting from mmc:${mmcdev}:${mmcpart} ...; " \ "run helix;\0" \ - "altbootcmd=" \ - "setenv mmcpart 1; run hasfirstboot || setenv mmcpart 2; " \ - "run hasfirstboot || setenv mmcpart 0; " \ - "if test ${mmcpart} != 0; then " \ - "setenv bootcause REVERT; " \ - "run swappartitions loadimage doboot; " \ - "fi; " \ - "run failbootcmd\0" \ "tryboot=" \ "setenv mmcpart 1; run hasfirstboot || setenv mmcpart 2; " \ "run loadimage || run swappartitions && run loadimage || " \ diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h index 07b36706e56..c8ef048bd43 100644 --- a/include/configs/ge_bx50v3.h +++ b/include/configs/ge_bx50v3.h @@ -67,14 +67,6 @@ "Try again, or contact GE Service for support.\"; " \ "bootcount reset; " \ "while true; do sleep 1; done; \0" \ - "altbootcmd=" \ - "run doquiet; " \ - "setenv partnum 1; run hasfirstboot || setenv partnum 2; " \ - "run hasfirstboot || setenv partnum 0; " \ - "if test ${partnum} != 0; then " \ - "run swappartitions loadimage doboot; " \ - "fi; " \ - "run failbootcmd\0" \ "loadimage=" \ "ext2load ${dev} ${devnum}:${partnum} ${loadaddr} ${image}\0" \ "doboot=" \ diff --git a/include/configs/imx6-engicam.h b/include/configs/imx6-engicam.h index 786b70fe064..3d5701c636c 100644 --- a/include/configs/imx6-engicam.h +++ b/include/configs/imx6-engicam.h @@ -47,7 +47,6 @@ "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ "loadfit=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${fit_image}\0" \ - "altbootcmd=run recoveryboot\0"\ "fitboot=echo Booting FIT image from mmc ...; " \ "run mmcargs; " \ "bootm ${loadaddr}\0" \ diff --git a/include/configs/imx6q-bosch-acc.h b/include/configs/imx6q-bosch-acc.h index 64ddbf711d3..84da8250684 100644 --- a/include/configs/imx6q-bosch-acc.h +++ b/include/configs/imx6q-bosch-acc.h @@ -42,8 +42,7 @@ "env_persisted=0\0" \ "env_persist=if test ${env_persisted} != 1; " \ "then env set env_persisted 1; run save_env; fi;\0" \ - "save_env=env save; env save\0" \ - "altbootcmd=run handle_ustate; run switch_bootset; run save_env; run bootcmd\0" + "save_env=env save; env save\0" #define CFG_ENV_FLAGS_LIST_STATIC \ "bootset:bw," \ diff --git a/include/configs/imx8mm-mx8menlo.h b/include/configs/imx8mm-mx8menlo.h index 7058d632d67..626ccae7205 100644 --- a/include/configs/imx8mm-mx8menlo.h +++ b/include/configs/imx8mm-mx8menlo.h @@ -18,14 +18,6 @@ "devtype=mmc\0" \ "devnum=1\0" \ "distro_bootpart=1\0" \ - "altbootcmd=" \ - "mmc partconf 0 mmcpart ; " \ - "if test ${mmcpart} -eq 1 ; then " \ - "mmc partconf 0 1 2 0 ; " \ - "else " \ - "mmc partconf 0 1 1 0 ; " \ - "fi ; " \ - "boot\0" \ "boot_file=fitImage\0" \ "console=ttymxc0\0" \ "fdt_addr=0x43000000\0" \ diff --git a/include/configs/imx8mm_data_modul_edm_sbc.h b/include/configs/imx8mm_data_modul_edm_sbc.h index 57ecb5e2190..5ce4219912f 100644 --- a/include/configs/imx8mm_data_modul_edm_sbc.h +++ b/include/configs/imx8mm_data_modul_edm_sbc.h @@ -34,7 +34,6 @@ #define CFG_SYS_FSL_ESDHC_ADDR 0 #define CFG_EXTRA_ENV_SETTINGS \ - "altbootcmd=run bootcmd\0" \ "bootlimit=3\0" \ "devtype=mmc\0" \ "devpart=1\0" \ diff --git a/include/configs/imx8mp_data_modul_edm_sbc.h b/include/configs/imx8mp_data_modul_edm_sbc.h index de5bdd30e18..58a03b35ac4 100644 --- a/include/configs/imx8mp_data_modul_edm_sbc.h +++ b/include/configs/imx8mp_data_modul_edm_sbc.h @@ -24,7 +24,6 @@ #define FEC_QUIRK_ENET_MAC #define CFG_EXTRA_ENV_SETTINGS \ - "altbootcmd=run bootcmd\0" \ "bootlimit=3\0" \ "devtype=mmc\0" \ "devpart=1\0" \ diff --git a/include/configs/imx8mp_dhcom_pdk2.h b/include/configs/imx8mp_dhcom_pdk2.h index c848fce8bda..f3e239d780f 100644 --- a/include/configs/imx8mp_dhcom_pdk2.h +++ b/include/configs/imx8mp_dhcom_pdk2.h @@ -28,7 +28,6 @@ #define CFG_SYS_FSL_ESDHC_ADDR 0 #define CFG_EXTRA_ENV_SETTINGS \ - "altbootcmd=run bootcmd ; reset\0" \ "bootlimit=3\0" \ "dfu_alt_info=" \ /* RAM block at DRAM offset 256..768 MiB */ \ diff --git a/include/configs/m53menlo.h b/include/configs/m53menlo.h index 1ea4fa59fd5..a6aafb51854 100644 --- a/include/configs/m53menlo.h +++ b/include/configs/m53menlo.h @@ -93,13 +93,6 @@ "splashfile=boot/usplash.bmp.gz\0" \ "splashimage=0x88000000\0" \ "splashpos=m,m\0" \ - "altbootcmd=" \ - "if test ${mmcpart} -eq 1 ; then " \ - "setenv mmcpart 2 ; " \ - "else " \ - "setenv mmcpart 1 ; " \ - "fi ; " \ - "boot\0" \ "stdout=serial,vidconsole\0" \ "stderr=serial,vidconsole\0" \ "addcons=" \ diff --git a/include/configs/mx53ppd.h b/include/configs/mx53ppd.h index 6d1f669de50..3707de254e1 100644 --- a/include/configs/mx53ppd.h +++ b/include/configs/mx53ppd.h @@ -59,14 +59,6 @@ "Try again, or contact GE Service for support.\"; " \ "bootcount reset; " \ "while true; do sleep 1; done; \0" \ - "altbootcmd=" \ - "run doquiet; " \ - "setenv partnum 1; run hasfirstboot || setenv partnum 2; " \ - "run hasfirstboot || setenv partnum 0; " \ - "if test ${partnum} != 0; then " \ - "run swappartitions loadimage doboot; " \ - "fi; " \ - "run failbootcmd\0" \ "loadimage=" \ "ext2load ${dev} ${devnum}:${partnum} ${loadaddr} ${image}\0" \ "doboot=" \ diff --git a/include/configs/siemens-am33x-common.h b/include/configs/siemens-am33x-common.h index 74b7fe85800..a918dc1350c 100644 --- a/include/configs/siemens-am33x-common.h +++ b/include/configs/siemens-am33x-common.h @@ -128,7 +128,6 @@ "verify=no \0" \ "project_dir=targetdir\0" \ "upgrade_available=0\0" \ - "altbootcmd=run bootcmd\0" \ "partitionset_active=A\0" \ "loadaddr=0x82000000\0" \ "kloadaddr=0x81000000\0" \ diff --git a/include/configs/siemens-env-common.h b/include/configs/siemens-env-common.h index 36fa5d936f7..c028823e1eb 100644 --- a/include/configs/siemens-env-common.h +++ b/include/configs/siemens-env-common.h @@ -183,7 +183,6 @@ "rootfs_name=/dev/mmcblk0\0" \ "upgrade_available=0\0" \ "bootlimit=3\0" \ - "altbootcmd=run bootcmd\0" \ "optargs=\0" \ /**********************************************************************/ diff --git a/include/configs/snapper9g45.h b/include/configs/snapper9g45.h index df8ed451a43..8ea708d0e92 100644 --- a/include/configs/snapper9g45.h +++ b/include/configs/snapper9g45.h @@ -58,8 +58,7 @@ "boot_tftp=setenv bootargs $bootargs_def ip=any nfsroot=$nfsroot; setenv autoload y && bootp && bootm\0" \ "boot_usb=setenv bootargs $bootargs_def; usb start && usb storage && fatload usb 0:1 $loadaddr dds-xm200.bin && bootm\0" \ "boot_mmc=setenv bootargs $bootargs_def; mmc rescan && fatload mmc 0:1 $loadaddr dds-xm200.bin && bootm\0" \ - "bootcmd=run boot_mmc ; run boot_usb ; run boot_working ; run boot_safe\0" \ - "altbootcmd=run boot_mmc ; run boot_usb ; run boot_safe ; run boot_working\0" + "bootcmd=run boot_mmc ; run boot_usb ; run boot_working ; run boot_safe\0" /* Console settings */ diff --git a/include/env/pg-wcom/common.env b/include/env/pg-wcom/common.env index 4b660cebd67..5f2ba1c4090 100644 --- a/include/env/pg-wcom/common.env +++ b/include/env/pg-wcom/common.env @@ -22,7 +22,6 @@ add_default=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${ WCOM_UBI_LINUX_MTD addpanic=setenv bootargs ${bootargs} panic=1 panic_on_oops=1 -altbootcmd=run bootcmd backup_bank=0 boot=bootm ${load_addr_r} - ${fdt_addr_r} diff --git a/include/env_default.h b/include/env_default.h index aa3dd40f3fa..60c39f9853f 100644 --- a/include/env_default.h +++ b/include/env_default.h @@ -115,6 +115,9 @@ const char default_environment[] = { #if defined(CONFIG_BOOTCOUNT_BOOTLIMIT) && (CONFIG_BOOTCOUNT_BOOTLIMIT > 0) "bootlimit=" __stringify(CONFIG_BOOTCOUNT_BOOTLIMIT)"\0" #endif +#ifdef CONFIG_BOOTCOUNT_ALTBOOTCMD + "altbootcmd=" CONFIG_BOOTCOUNT_ALTBOOTCMD "\0" +#endif #ifdef CONFIG_MTDIDS_DEFAULT "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" #endif -- cgit v1.2.3 From 6799f09069f402a33c9cb202b71e144497bd9b7a Mon Sep 17 00:00:00 2001 From: Raymond Mao Date: Wed, 19 Feb 2025 16:02:19 -0800 Subject: bloblist: refactor xferlist and bloblist Refactor the xferlist to remove the relocating when bloblist passed from the boot args. Refactor bloblist init to use incoming standard passage by default if a valid transfer list exists in the boot args. For bloblist relocation, use the actual total size if it has a smaller BLOBLIST_SIZE_RELOC. Signed-off-by: Raymond Mao Suggested-by: Ilias Apalodimas --- include/bloblist.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/bloblist.h b/include/bloblist.h index 03d9862c0f1..ff9d5549052 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -483,19 +483,18 @@ static inline int bloblist_maybe_init(void) * @rfdt: Register that holds the FDT base address. * @rzero: Register that must be zero. * @rsig: Register that holds signature and register conventions version. + * @xlist: Register that holds the transfer list. * Return: 0 if OK, -EIO if the bloblist is not compliant to the register * conventions. */ -int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig); +int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig, ulong xlist); /** - * xferlist_from_boot_arg() - Get bloblist from the boot args and relocate it - * to the specified address. + * xferlist_from_boot_arg() - Get bloblist from the boot args. * - * @addr: Address for the bloblist - * @size: Size of space reserved for the bloblist + * @addr: Address of the bloblist * Return: 0 if OK, else on error */ -int xferlist_from_boot_arg(ulong addr, ulong size); +int xferlist_from_boot_arg(ulong *addr); #endif /* __BLOBLIST_H */ -- cgit v1.2.3 From 03a76b1a737fc9cf511aa7520999968ec3d2fd78 Mon Sep 17 00:00:00 2001 From: Raymond Mao Date: Wed, 19 Feb 2025 16:02:20 -0800 Subject: bloblist: kconfig for mandatory incoming standard passage In previous commit, incoming standard passage is used by default when initializing the bloblist, so explicitly BLOBLIST_PASSAGE is no more needed. Rename it as BLOBLIST_PASSAGE_MANDATORY to determine the behaviors when an incoming transfer list does not exist or is invalid. When it is selected, incoming standard passage is mandatory and U-Boot will report an error when a valid incoming transfer list is missing. Signed-off-by: Raymond Mao --- include/bloblist.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/bloblist.h b/include/bloblist.h index ff9d5549052..414fb9b6e40 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -449,9 +449,8 @@ int bloblist_reloc(void *to, uint to_size); * If CONFIG_BLOBLIST_ALLOC is selected, it allocates memory for a bloblist of * size CONFIG_BLOBLIST_SIZE. * - * If CONFIG_BLOBLIST_PASSAGE is selected, it uses the bloblist in the incoming - * standard passage. The size is detected automatically so CONFIG_BLOBLIST_SIZE - * can be 0. + * If CONFIG_BLOBLIST_PASSAGE_MANDATORY is selected, bloblist in the incoming + * standard passage is mandatorily required. * * Sets GD_FLG_BLOBLIST_READY in global_data flags on success * -- cgit v1.2.3 From ed5754354b85ac82940370816c7ac677c52cc26b Mon Sep 17 00:00:00 2001 From: Sinthu Raja Date: Tue, 11 Feb 2025 15:19:29 +0530 Subject: include: configs: Override get_fit_config to get FIT config for AM57x Kernel commit 837833a724b7 ("environment: ti: Add get_fit_config command to get FIT config string") introduced "get_fit_config" in ti_armv7_common.h to mangle the fdtfile name when used to select a config node from the OE made FIT image. However, the ti_armv7_common.h is common for both K3 and AM57xx platforms. AM57xx platforms' fdtfile name does not have '/' and "conf-" prefix so the setexpr command fails and boot hangs. Override the get_fit_config in AM57x specific config header to get the correct FIT config name. Signed-off-by: Sinthu Raja Signed-off-by: Anurag Dutta --- include/configs/ti_omap5_common.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h index 26b6c1cd188..d315a52f36f 100644 --- a/include/configs/ti_omap5_common.h +++ b/include/configs/ti_omap5_common.h @@ -251,6 +251,7 @@ DEFAULT_LINUX_BOOT_ENV \ DEFAULT_MMC_TI_ARGS \ DEFAULT_FIT_TI_ARGS \ + "get_fit_config=setenv name_fit_config ${fdtfile}\0" \ DEFAULT_COMMON_BOOT_TI_ARGS \ DEFAULT_FDT_TI_ARGS \ DFUARGS \ -- cgit v1.2.3 From e2aebbaa401e43f6d2efdb913908e17261452e6a Mon Sep 17 00:00:00 2001 From: Sinthu Raja Date: Tue, 11 Feb 2025 15:19:30 +0530 Subject: configs: omap5: Enable custom mmc boot to distroboot for AM57x TI AM57x boards use a custom (though family common to TI boards) mechanism for booting Linux. Add support to enable custom MMC boot as a default option along with the distroboot approach. Also, add supporting mmc boot environment variables which shall be used for custom MMC boot Signed-off-by: Sinthu Raja Signed-off-by: Anurag Dutta --- include/configs/ti_omap5_common.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h index d315a52f36f..ef97711e644 100644 --- a/include/configs/ti_omap5_common.h +++ b/include/configs/ti_omap5_common.h @@ -240,16 +240,31 @@ "echo WARNING: Could not determine device tree to use; fi; \0" #define BOOT_TARGET_DEVICES(func) \ + func(TI_MMC, ti_mmc, na) \ func(MMC, mmc, 0) \ func(MMC, mmc, 1) \ func(PXE, pxe, na) \ func(DHCP, dhcp, na) +#define BOOTENV_DEV_TI_MMC(devtypeu, devtypel, instance) \ + "bootcmd_ti_mmc= run get_name_kern; run mmcboot\0" + +#define BOOTENV_DEV_NAME_TI_MMC(devtyeu, devtypel, instance) \ + "ti_mmc " + #include #define CFG_EXTRA_ENV_SETTINGS \ DEFAULT_LINUX_BOOT_ENV \ DEFAULT_MMC_TI_ARGS \ + "bootpart=0:2\0" \ + "bootdir=/boot\0" \ + "get_name_kern=" \ + "if test $boot_fit -eq 1; then " \ + "setenv bootfile fitImage; " \ + "else " \ + "setenv bootfile zImage; " \ + "fi\0" \ DEFAULT_FIT_TI_ARGS \ "get_fit_config=setenv name_fit_config ${fdtfile}\0" \ DEFAULT_COMMON_BOOT_TI_ARGS \ -- cgit v1.2.3 From b165582b3f37ec7bf9dc6d7f7e4fe9fc2a12f01b Mon Sep 17 00:00:00 2001 From: Sinthu Raja Date: Tue, 11 Feb 2025 15:19:31 +0530 Subject: include: configs: omap5: Add support for FDT overlay As AM57x uses overlays for display and camera interfaces, add support to load DT overlay files to MMC boot. Signed-off-by: Sinthu Raja Signed-off-by: Anurag Dutta --- include/configs/ti_omap5_common.h | 11 +++++++++++ include/env/ti/mmc.h | 1 + 2 files changed, 12 insertions(+) (limited to 'include') diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h index ef97711e644..39102f15eb9 100644 --- a/include/configs/ti_omap5_common.h +++ b/include/configs/ti_omap5_common.h @@ -239,6 +239,16 @@ "if test $fdtfile = undefined; then " \ "echo WARNING: Could not determine device tree to use; fi; \0" +#define GET_OVERLAY_MMC_TI_ARGS \ + "get_overlay_mmc=" \ + "fdt address ${fdtaddr};" \ + "fdt resize 0x100000;" \ + "for overlay in $name_overlays;" \ + "do;" \ + "load mmc ${bootpart} ${dtboaddr} ${bootdir}/dtb/${overlay} &&" \ + "fdt apply ${dtboaddr};" \ + "done;\0" \ + #define BOOT_TARGET_DEVICES(func) \ func(TI_MMC, ti_mmc, na) \ func(MMC, mmc, 0) \ @@ -269,6 +279,7 @@ "get_fit_config=setenv name_fit_config ${fdtfile}\0" \ DEFAULT_COMMON_BOOT_TI_ARGS \ DEFAULT_FDT_TI_ARGS \ + GET_OVERLAY_MMC_TI_ARGS \ DFUARGS \ NETARGS \ NANDARGS \ diff --git a/include/env/ti/mmc.h b/include/env/ti/mmc.h index d07189baaf4..dbb0e3559ea 100644 --- a/include/env/ti/mmc.h +++ b/include/env/ti/mmc.h @@ -44,6 +44,7 @@ "mmcloados=" \ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ "if run loadfdt; then " \ + "run get_overlay_mmc;" \ "bootz ${loadaddr} - ${fdtaddr}; " \ "else " \ "if test ${boot_fdt} = try; then " \ -- cgit v1.2.3 From 77718437862ee849bd8818c482208aaa92363c8d Mon Sep 17 00:00:00 2001 From: Paul HENRYS Date: Wed, 12 Feb 2025 10:31:21 +0100 Subject: rsa: Add rsa_verify_openssl() to use openssl for host builds rsa_verify_openssl() is used in lib/rsa/rsa-verify.c to authenticate data when building host tools. Signed-off-by: Paul HENRYS --- include/image.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include') diff --git a/include/image.h b/include/image.h index 8a9f779d3ff..54b1557d6c6 100644 --- a/include/image.h +++ b/include/image.h @@ -1687,6 +1687,24 @@ struct sig_header_s { */ int image_pre_load(ulong addr); +#if defined(USE_HOSTCC) +/** + * rsa_verify_openssl() - Verify a signature against some data with openssl API + * + * Verify a RSA PKCS1.5/PSS signature against an expected hash. + * + * @info: Specifies the key and algorithms + * @region: Pointer to the input data + * @region_count: Number of region + * @sig: Signature + * @sig_len: Number of bytes in the signature + * Return: 0 if verified, -ve on error + */ +int rsa_verify_openssl(struct image_sign_info *info, + const struct image_region region[], int region_count, + uint8_t *sig, uint sig_len); +#endif + /** * fit_image_verify_required_sigs() - Verify signatures marked as 'required' * -- cgit v1.2.3 From 523a56cc54637a0c04a1e87c262599faf26d7d69 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Mon, 24 Feb 2025 10:32:04 -0600 Subject: Revert "Merge patch series "Add preload_check_sign tool"" This reverts commit c8750efe02c20725388dd4279896aaf306acfad4, reversing changes made to 8c6cf8aeea7e57ca686de8b765e4baf3a7ef1fa7. Unfortunately these changes do not build on macOS hosts. Signed-off-by: Tom Rini --- include/image.h | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'include') diff --git a/include/image.h b/include/image.h index 54b1557d6c6..8a9f779d3ff 100644 --- a/include/image.h +++ b/include/image.h @@ -1687,24 +1687,6 @@ struct sig_header_s { */ int image_pre_load(ulong addr); -#if defined(USE_HOSTCC) -/** - * rsa_verify_openssl() - Verify a signature against some data with openssl API - * - * Verify a RSA PKCS1.5/PSS signature against an expected hash. - * - * @info: Specifies the key and algorithms - * @region: Pointer to the input data - * @region_count: Number of region - * @sig: Signature - * @sig_len: Number of bytes in the signature - * Return: 0 if verified, -ve on error - */ -int rsa_verify_openssl(struct image_sign_info *info, - const struct image_region region[], int region_count, - uint8_t *sig, uint sig_len); -#endif - /** * fit_image_verify_required_sigs() - Verify signatures marked as 'required' * -- cgit v1.2.3 From 9f12a3265c009238be8f5b82702cc5802dc98b0b Mon Sep 17 00:00:00 2001 From: Alif Zakuan Yuslaimi Date: Tue, 18 Feb 2025 16:35:10 +0800 Subject: configs: socfpga: soc64: agilex5: Enable QSPI boot with UBI / UBIFS Add the required configuration in the U-Boot env to enable Linux QSPI boot with UBI / UBIFS. Signed-off-by: Alif Zakuan Yuslaimi Signed-off-by: Tien Fong Chee Reviewed-by: Tien Fong Chee --- include/configs/socfpga_soc64_common.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/configs/socfpga_soc64_common.h b/include/configs/socfpga_soc64_common.h index b7ee1dbf201..5ed17671f79 100644 --- a/include/configs/socfpga_soc64_common.h +++ b/include/configs/socfpga_soc64_common.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 * * Copyright (C) 2017-2024 Intel Corporation + * Copyright (C) 2025 Altera Corporation * */ @@ -56,6 +57,11 @@ #define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \ "bootcmd_qspi=ubi detach; sf probe && " \ + "setenv mtdids 'nor0=nor0,nand0=nand.0' && " \ + "setenv mtdparts 'mtdparts=nor0:66m(u-boot),190m(root); " \ + "nand.0:2m(nand_uboot),500m(nand_root)' && " \ + "env select UBI; saveenv && " \ + "ubi part root && " \ "if ubi part root && ubi readvol ${scriptaddr} script; " \ "then echo QSPI: Running script from UBIFS; " \ "elif sf read ${scriptaddr} ${qspiscriptaddr} ${scriptsize}; " \ -- cgit v1.2.3 From 8cc464c334553e571d002081ba0089edb9afc1e6 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 22 Feb 2025 21:33:19 +0100 Subject: net: miiphybb: Drop bb_miiphy_init() and .init callback The .init callback is not called by any function, drop it. There are no more users of the init callback, drop the entire mechanism. Reviewed-by: Paul Barker Signed-off-by: Marek Vasut --- include/miiphy.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'include') diff --git a/include/miiphy.h b/include/miiphy.h index 1e6c7041fdc..0464f5dc219 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -65,7 +65,6 @@ void mdio_list_devices(void); struct bb_miiphy_bus { char name[MDIO_NAME_LEN]; - int (*init)(struct bb_miiphy_bus *bus); int (*mdio_active)(struct bb_miiphy_bus *bus); int (*mdio_tristate)(struct bb_miiphy_bus *bus); int (*set_mdio)(struct bb_miiphy_bus *bus, int v); @@ -78,15 +77,6 @@ struct bb_miiphy_bus { extern struct bb_miiphy_bus bb_miiphy_buses[]; extern int bb_miiphy_buses_num; -/** - * bb_miiphy_init() - Initialize bit-banged MII bus driver - * - * It is called during the generic post-relocation init sequence. - * - * Return: 0 if OK - */ -int bb_miiphy_init(void); - int bb_miiphy_read(struct mii_dev *miidev, int addr, int devad, int reg); int bb_miiphy_write(struct mii_dev *miidev, int addr, int devad, int reg, u16 value); -- cgit v1.2.3 From f15919436bea3336f2dcb86f564180aceccc9c47 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 22 Feb 2025 21:33:22 +0100 Subject: net: miiphy: Introduce mdio_init() Introduce mdio_init() split off from mdio_alloc(), which is used to initialize already allocated struct mii_dev. Reviewed-by: Paul Barker Signed-off-by: Marek Vasut --- include/miiphy.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/miiphy.h b/include/miiphy.h index 0464f5dc219..40eb14669b8 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -44,6 +44,7 @@ struct phy_device *mdio_phydev_for_ethname(const char *devname); void miiphy_listdev(void); +void mdio_init(struct mii_dev *bus); struct mii_dev *mdio_alloc(void); void mdio_free(struct mii_dev *bus); int mdio_register(struct mii_dev *bus); -- cgit v1.2.3 From 1b879bf5552bce022350bb96d616e5b2838af952 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 22 Feb 2025 21:33:23 +0100 Subject: net: miiphybb: Introduce bb_miiphy_alloc()/bb_miiphy_free() wrappers Introduce bb_miiphy_alloc()/bb_miiphy_free() wrappers to allocate and free struct bb_miiphy_bus. Make struct bb_miiphy_bus wrap struct mii_dev, which will become useful later in bb_miiphy_bus accessors, which would be able to access struct bb_miiphy_bus using container_of, even if the PHY stack only passes in the inner struct mii_dev . Reviewed-by: Paul Barker Signed-off-by: Marek Vasut --- include/miiphy.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/miiphy.h b/include/miiphy.h index 40eb14669b8..42300ee5386 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -73,11 +73,15 @@ struct bb_miiphy_bus { int (*set_mdc)(struct bb_miiphy_bus *bus, int v); int (*delay)(struct bb_miiphy_bus *bus); void *priv; + struct mii_dev mii; }; extern struct bb_miiphy_bus bb_miiphy_buses[]; extern int bb_miiphy_buses_num; +struct bb_miiphy_bus *bb_miiphy_alloc(void); +void bb_miiphy_free(struct bb_miiphy_bus *bus); + int bb_miiphy_read(struct mii_dev *miidev, int addr, int devad, int reg); int bb_miiphy_write(struct mii_dev *miidev, int addr, int devad, int reg, u16 value); -- cgit v1.2.3 From a23f9a786b010177839d6fe9f67c717f17f74368 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 22 Feb 2025 21:33:29 +0100 Subject: net: miiphybb: Drop name field from struct bb_miiphy_bus The struct bb_miiphy_bus embeds struct struct mii_dev, which already contains one copy of name field. Drop the duplicate top level copy of name field. The a38x code does static assignment of disparate names, use snprintf(...) to fill in matching name in probe to avoid any breakage. Reviewed-by: Paul Barker Signed-off-by: Marek Vasut --- include/miiphy.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/miiphy.h b/include/miiphy.h index 42300ee5386..efeff8ae70b 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -65,7 +65,6 @@ void mdio_list_devices(void); #define BB_MII_DEVNAME "bb_miiphy" struct bb_miiphy_bus { - char name[MDIO_NAME_LEN]; int (*mdio_active)(struct bb_miiphy_bus *bus); int (*mdio_tristate)(struct bb_miiphy_bus *bus); int (*set_mdio)(struct bb_miiphy_bus *bus, int v); -- cgit v1.2.3 From 4e6fed49becc7e8d9639966fd34695583192a3ee Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 22 Feb 2025 21:33:33 +0100 Subject: net: miiphybb: Drop bb_miiphy_buses and bb_miiphy_buses_num Neither bb_miiphy_buses nor bb_miiphy_buses_num are used anymore. Drop both of them. Reviewed-by: Paul Barker Signed-off-by: Marek Vasut --- include/miiphy.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/miiphy.h b/include/miiphy.h index efeff8ae70b..b879fd16ae3 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -75,9 +75,6 @@ struct bb_miiphy_bus { struct mii_dev mii; }; -extern struct bb_miiphy_bus bb_miiphy_buses[]; -extern int bb_miiphy_buses_num; - struct bb_miiphy_bus *bb_miiphy_alloc(void); void bb_miiphy_free(struct bb_miiphy_bus *bus); -- cgit v1.2.3 From 6b654ac5a6afa8e03d4d093be7cf27965b5c3c04 Mon Sep 17 00:00:00 2001 From: Baocheng Su Date: Tue, 18 Feb 2025 10:36:10 +0800 Subject: smbios: Fill UUID from sysinfo when available Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will be first used by the IOT2050 boards. Signed-off-by: Li Hua Qian Signed-off-by: Jan Kiszka Signed-off-by: Baocheng Su --- include/sysinfo.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/sysinfo.h b/include/sysinfo.h index ba2ac273e8e..14e923c6589 100644 --- a/include/sysinfo.h +++ b/include/sysinfo.h @@ -57,6 +57,7 @@ enum sysinfo_id { SYSID_SM_SYSTEM_WAKEUP, SYSID_SM_SYSTEM_SKU, SYSID_SM_SYSTEM_FAMILY, + SYSID_SM_SYSTEM_UUID, /* Baseboard (or Module) Information (Type 2) */ SYSID_SM_BASEBOARD_MANUFACTURER, -- cgit v1.2.3 From 920629c5942dc458b2b818a59ba789601185a101 Mon Sep 17 00:00:00 2001 From: Baocheng Su Date: Tue, 18 Feb 2025 10:36:11 +0800 Subject: sysinfo: Add API for accessing data elements This commit introduces a new API to the sysinfo module, allowing access to data elements. This is particularly useful for handling data with multiple instances, such as MAC addresses. Signed-off-by: Baocheng Su --- include/sysinfo.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'include') diff --git a/include/sysinfo.h b/include/sysinfo.h index 14e923c6589..2866ac293cb 100644 --- a/include/sysinfo.h +++ b/include/sysinfo.h @@ -152,6 +152,7 @@ enum sysinfo_id { /* For show_board_info() */ SYSID_BOARD_MODEL, SYSID_BOARD_MANUFACTURER, + SYSID_BOARD_MAC_ADDR, SYSID_PRIOR_STAGE_VERSION, SYSID_PRIOR_STAGE_DATE, @@ -221,6 +222,30 @@ struct sysinfo_ops { */ int (*get_data)(struct udevice *dev, int id, void **data, size_t *size); + /** + * get_item_count() - Get the item count of the specific data area that + * describes the hardware setup. + * @dev: The sysinfo instance to gather the data. + * @id: A unique identifier for the data area to be get. + * + * Return: non-negative item count if OK, -ve on error. + */ + int (*get_item_count)(struct udevice *dev, int id); + + /** + * get_data_by_index() - Get a data value by index from the platform. + * + * @dev: The sysinfo instance to gather the data. + * @id: A unique identifier for the data area to be get. + * @index: The item index, starting from 0. + * @data: Pointer to the address of the data area. + * @size: Pointer to the size of the data area. + * + * Return: 0 if OK, -ve on error. + */ + int (*get_data_by_index)(struct udevice *dev, int id, int index, + void **data, size_t *size); + /** * get_fit_loadable - Get the name of an image to load from FIT * This function can be used to provide the image names based on runtime @@ -304,6 +329,32 @@ int sysinfo_get_str(struct udevice *dev, int id, size_t size, char *val); */ int sysinfo_get_data(struct udevice *dev, int id, void **data, size_t *size); +/** + * sysinfo_get_item_count() - Get the item count of the specific data area that + * describes the hardware setup. + * @dev: The sysinfo instance to gather the data. + * @id: A unique identifier for the data area to be get. + * + * Return: non-negative item count if OK, -EPERM if called before + * sysinfo_detect(), else -ve on error. + */ +int sysinfo_get_item_count(struct udevice *dev, int id); + +/** + * sysinfo_get_data_by_index() - Get a data value by index from the platform. + * + * @dev: The sysinfo instance to gather the data. + * @id: A unique identifier for the data area to be get. + * @index: The item index, starting from 0. + * @data: Pointer to the address of the data area. + * @size: Pointer to the size of the data area. + * + * Return: 0 if OK, -EPERM if called before sysinfo_detect(), else -ve on + * error. + */ +int sysinfo_get_data_by_index(struct udevice *dev, int id, int index, + void **data, size_t *size); + /** * sysinfo_get() - Return the sysinfo device for the sysinfo in question. * @devp: Pointer to structure to receive the sysinfo device. @@ -365,6 +416,18 @@ static inline int sysinfo_get_data(struct udevice *dev, int id, void **data, return -ENOSYS; } +static inline int sysinfo_get_item_count(struct udevice *dev, int id) +{ + return -ENOSYS; +} + +static inline int sysinfo_get_data_by_index(struct udevice *dev, int id, + int index, void **data, + size_t *size) +{ + return -ENOSYS; +} + static inline int sysinfo_get(struct udevice **devp) { return -ENOSYS; -- cgit v1.2.3 From c01d633c750e44780843845944256b93869c2b6f Mon Sep 17 00:00:00 2001 From: Baocheng Su Date: Tue, 18 Feb 2025 10:36:12 +0800 Subject: sysinfo: Add SYSID_BOARD_RAM_SIZE_MB Add a new field SYSID_BOARD_RAM_SIZE_MB to sysinfo structure to store the size of RAM in MB. dram_init can use this field to get the RAM size via sysinfo driver. Signed-off-by: Baocheng Su --- include/sysinfo.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/sysinfo.h b/include/sysinfo.h index 2866ac293cb..e87cf969fcd 100644 --- a/include/sysinfo.h +++ b/include/sysinfo.h @@ -153,6 +153,7 @@ enum sysinfo_id { SYSID_BOARD_MODEL, SYSID_BOARD_MANUFACTURER, SYSID_BOARD_MAC_ADDR, + SYSID_BOARD_RAM_SIZE_MB, SYSID_PRIOR_STAGE_VERSION, SYSID_PRIOR_STAGE_DATE, -- cgit v1.2.3 From 942c8c8e669739d2e8dec67a7ed90158defc93ed Mon Sep 17 00:00:00 2001 From: Paul HENRYS Date: Mon, 24 Feb 2025 22:20:50 +0100 Subject: rsa: Add rsa_verify_openssl() to use openssl for host builds rsa_verify_openssl() is used in lib/rsa/rsa-verify.c to authenticate data when building host tools. Signed-off-by: Paul HENRYS --- include/image.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include') diff --git a/include/image.h b/include/image.h index 07912606f33..c1db8383459 100644 --- a/include/image.h +++ b/include/image.h @@ -1688,6 +1688,24 @@ struct sig_header_s { */ int image_pre_load(ulong addr); +#if defined(USE_HOSTCC) +/** + * rsa_verify_openssl() - Verify a signature against some data with openssl API + * + * Verify a RSA PKCS1.5/PSS signature against an expected hash. + * + * @info: Specifies the key and algorithms + * @region: Pointer to the input data + * @region_count: Number of region + * @sig: Signature + * @sig_len: Number of bytes in the signature + * Return: 0 if verified, -ve on error + */ +int rsa_verify_openssl(struct image_sign_info *info, + const struct image_region region[], int region_count, + uint8_t *sig, uint sig_len); +#endif + /** * fit_image_verify_required_sigs() - Verify signatures marked as 'required' * -- cgit v1.2.3 From d9c149664fa7a0c2eabfc046dcf89637f655364b Mon Sep 17 00:00:00 2001 From: Gabriel Dalimonte Date: Mon, 17 Feb 2025 13:26:43 -0500 Subject: fs: add rename infrastructure The selection for *rename as the name for the rename/move operation derives from the POSIX specification where they name the function rename/renameat. [1] This aligns with Linux where the syscalls for renaming/moving also use the rename/renameat naming. [1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/rename.html Signed-off-by: Gabriel Dalimonte Acked-by: Ilias Apalodimas --- include/fs.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/fs.h b/include/fs.h index 2474880385d..5b272eb9f5e 100644 --- a/include/fs.h +++ b/include/fs.h @@ -86,7 +86,7 @@ int fs_set_blk_dev_with_part(struct blk_desc *desc, int part); * * Many file functions implicitly call fs_close(), e.g. fs_closedir(), * fs_exist(), fs_ln(), fs_ls(), fs_mkdir(), fs_read(), fs_size(), fs_write(), - * fs_unlink(). + * fs_unlink(), fs_rename(). */ void fs_close(void); @@ -270,6 +270,18 @@ int fs_unlink(const char *filename); */ int fs_mkdir(const char *filename); +/** + * fs_rename - rename/move a file or directory + * + * @old_path: existing path of the file/directory to rename + * @new_path: new path of the file/directory. If this points to an existing + * file or empty directory, the existing file/directory will be unlinked. + * If this points to a non-empty directory, the rename will fail. + * + * Return: 0 on success, -1 on error conditions + */ +int fs_rename(const char *old_path, const char *new_path); + /* * Common implementation for various filesystem commands, optionally limited * to a specific filesystem type via the fstype parameter. -- cgit v1.2.3 From 06159a1465fc97d8d7b72b9bea39a396f6e7057c Mon Sep 17 00:00:00 2001 From: Gabriel Dalimonte Date: Mon, 17 Feb 2025 13:26:44 -0500 Subject: fs: fat: add rename The implementation roughly follows the POSIX specification for rename() [1]. The ordering of operations attempting to minimize the chance for data loss in unexpected circumstances. The 'mv' command was implemented as a front end for the rename operation as that is what most users are likely familiar with in terms of behavior. The 'FAT_RENAME' Kconfig option was added to prevent code size increase on size-oriented builds like SPL. [1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/rename.html Signed-off-by: Gabriel Dalimonte --- include/fat.h | 1 + include/fs.h | 2 ++ 2 files changed, 3 insertions(+) (limited to 'include') diff --git a/include/fat.h b/include/fat.h index 3dce99a23cf..ca97880de12 100644 --- a/include/fat.h +++ b/include/fat.h @@ -206,6 +206,7 @@ int fat_opendir(const char *filename, struct fs_dir_stream **dirsp); int fat_readdir(struct fs_dir_stream *dirs, struct fs_dirent **dentp); void fat_closedir(struct fs_dir_stream *dirs); int fat_unlink(const char *filename); +int fat_rename(const char *old_path, const char *new_path); int fat_mkdir(const char *dirname); void fat_close(void); void *fat_next_cluster(fat_itr *itr, unsigned int *nbytes); diff --git a/include/fs.h b/include/fs.h index 5b272eb9f5e..54449faf2e5 100644 --- a/include/fs.h +++ b/include/fs.h @@ -302,6 +302,8 @@ int do_mkdir(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[], int fstype); int do_ln(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[], int fstype); +int do_mv(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[], + int fstype); /* * Determine the UUID of the specified filesystem and print it. Optionally it is -- cgit v1.2.3 From e6883b6b30784a529fbccd74f3226ad493d15116 Mon Sep 17 00:00:00 2001 From: Svyatoslav Ryhel Date: Fri, 7 Mar 2025 10:59:57 +0200 Subject: sandbox: remap memory load addresses The existing memory layout places the bloblist at 0xb000 and the fdt at 0x100, resulting in a 0xaf00 size constraint for the fdt. This constraint has been reached. Lets modify the layout by moving the bloblist to 0x100, device tree to 0x1000 and placing early memory allocation after pre-console buffer at 0xf4000. This should guarantee sufficient memory allocation for future expansion. Signed-off-by: Svyatoslav Ryhel --- include/configs/sandbox.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 2372485c84e..db2ac7f83bb 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -6,7 +6,7 @@ #ifndef __CONFIG_H #define __CONFIG_H -#define CFG_MALLOC_F_ADDR 0x0010000 +#define CFG_MALLOC_F_ADDR 0x000f4000 /* Size of our emulated memory */ #define SB_CONCAT(x, y) x ## y -- cgit v1.2.3 From 9057077cf4e10611b8a553520c77cd1936c9cdeb Mon Sep 17 00:00:00 2001 From: Svyatoslav Ryhel Date: Sat, 15 Feb 2025 19:46:29 +0200 Subject: core: ofnode: add of_graph parsing helpers Add a mostly complete list of ofnode analogs of of_graph parsing helpers. Signed-off-by: Svyatoslav Ryhel --- include/dm/ofnode_graph.h | 90 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 include/dm/ofnode_graph.h (limited to 'include') diff --git a/include/dm/ofnode_graph.h b/include/dm/ofnode_graph.h new file mode 100644 index 00000000000..908c990a3f3 --- /dev/null +++ b/include/dm/ofnode_graph.h @@ -0,0 +1,90 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2025 Svyatoslav Ryhel + */ + +#ifndef _DM_OFNODE_GRAPH_H +#define _DM_OFNODE_GRAPH_H + +#include + +/** + * ofnode_graph_get_endpoint_count() - get the number of endpoints in a device ofnode + * @parent: ofnode to the device containing ports and endpoints + * + * Return: count of endpoint of this device ofnode + */ +unsigned int ofnode_graph_get_endpoint_count(ofnode parent); + +/** + * ofnode_graph_get_port_count() - get the number of port in a device or ports ofnode + * @parent: ofnode to the device or ports node + * + * Return: count of port of this device or ports node + */ +unsigned int ofnode_graph_get_port_count(ofnode parent); + +/** + * ofnode_graph_get_port_by_id() - get the port matching a given id + * @parent: parent ofnode + * @id: id of the port + * + * Return: ofnode in given port. + */ +ofnode ofnode_graph_get_port_by_id(ofnode parent, u32 id); + +/** + * ofnode_graph_get_endpoint_by_regs() - get the endpoint matching a given id + * @parent: parent ofnode + * @reg_id: id of the port + * @id: id for the endpoint + * + * Return: ofnode in given endpoint or NULL if not found. + * reg and port_reg are ignored when they are -1. + */ +ofnode ofnode_graph_get_endpoint_by_regs(ofnode parent, u32 reg_id, u32 id); + +/** + * ofnode_graph_get_remote_endpoint() - get remote endpoint node + * @endoint: ofnode of a local endpoint + * + * Return: Remote endpoint ofnode linked with local endpoint. + */ +ofnode ofnode_graph_get_remote_endpoint(ofnode endpoint); + +/** + * ofnode_graph_get_port_parent() - get port's parent node + * @endpoint: ofnode of a local endpoint + * + * Return: device ofnode associated with endpoint + */ +ofnode ofnode_graph_get_port_parent(ofnode endpoint); + +/** + * ofnode_graph_get_remote_port_parent() - get remote port's parent ofnode + * @endoint: ofnode of a local endpoint + * + * Return: device ofnode associated with endpoint linked to local endpoint. + */ +ofnode ofnode_graph_get_remote_port_parent(ofnode endpoint); + +/** + * ofnode_graph_get_remote_port() - get remote port ofnode + * @endoint: ofnode of a local endpoint + * + * Return: port ofnode associated with remote endpoint node linked + * to local endpoint. + */ +ofnode ofnode_graph_get_remote_port(ofnode endpoint); + +/** + * ofnode_graph_get_remote_node() - get remote parent ofnode for given port/endpoint + * @parent: parent ofnode containing graph port/endpoint + * @port: identifier (value of reg property) of the parent port ofnode + * @endpoint: identifier (value of reg property) of the endpoint ofnode + * + * Return: device ofnode associated with endpoint linked to local endpoint. + */ +ofnode ofnode_graph_get_remote_node(ofnode parent, u32 port, u32 endpoint); + +#endif -- cgit v1.2.3 From ab516f5e279d178ea71e453501917e56a88ae4d8 Mon Sep 17 00:00:00 2001 From: Svyatoslav Ryhel Date: Fri, 14 Feb 2025 10:57:05 +0200 Subject: video: bridge-uclass: add get_display_timing ops Add get_display_timing ops for internal bridges linked to panels that do not support EDID (MIPI-DSI panels for example) or have EDID not routed. Tested-by: Dang Huynh (PineTab 2) Signed-off-by: Svyatoslav Ryhel Reviewed-by: Simon Glass --- include/video_bridge.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'include') diff --git a/include/video_bridge.h b/include/video_bridge.h index 3b429eac578..7158deb299a 100644 --- a/include/video_bridge.h +++ b/include/video_bridge.h @@ -53,6 +53,19 @@ struct video_bridge_ops { */ int (*set_backlight)(struct udevice *dev, int percent); + /** + * get_display_timing() - Get display timings from bridge. + * + * @dev: Bridge device containing the linked display timings + * @tim: Place to put timings + * @return 0 if OK, -ve on error + * + * This call it totally optional and useful mainly for integrated + * bridges with fixed output device. + */ + int (*get_display_timing)(struct udevice *dev, + struct display_timing *timing); + /** * read_edid() - Read information from EDID * @@ -98,6 +111,14 @@ int video_bridge_set_active(struct udevice *dev, bool active); */ int video_bridge_check_attached(struct udevice *dev); +/** + * video_bridge_get_display_timing() - Get display timings from bridge. + * + * @dev: Bridge device containing the linked display timings + * Return: 0 if OK, -ve on error + */ +int video_bridge_get_display_timing(struct udevice *dev, + struct display_timing *timing); /** * video_bridge_read_edid() - Read information from EDID * -- cgit v1.2.3 From 7cd5a6cb6cc017fb850d4669170cd14ca21c5443 Mon Sep 17 00:00:00 2001 From: Svyatoslav Ryhel Date: Fri, 21 Feb 2025 13:09:30 +0200 Subject: video: bridge-uclass: add inline fallbacks of video bridge functions Hide video bridge functions behind config condition and add inline fallbacks to avoid erroring out when using header without config enabled. Signed-off-by: Svyatoslav Ryhel Reviewed-by: Simon Glass --- include/video_bridge.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'include') diff --git a/include/video_bridge.h b/include/video_bridge.h index 7158deb299a..00e9804565c 100644 --- a/include/video_bridge.h +++ b/include/video_bridge.h @@ -80,6 +80,7 @@ struct video_bridge_ops { #define video_bridge_get_ops(dev) \ ((struct video_bridge_ops *)(dev)->driver->ops) +#if CONFIG_IS_ENABLED(VIDEO_BRIDGE) /** * video_bridge_attach() - attach a video bridge * @@ -128,5 +129,37 @@ int video_bridge_get_display_timing(struct udevice *dev, * Return: number of bytes read, <=0 for error */ int video_bridge_read_edid(struct udevice *dev, u8 *buf, int buf_size); +#else +static inline int video_bridge_attach(struct udevice *dev) +{ + return -ENOSYS; +} + +static inline int video_bridge_set_backlight(struct udevice *dev, int percent) +{ + return -ENOSYS; +} + +static inline int video_bridge_set_active(struct udevice *dev, bool active) +{ + return -ENOSYS; +} + +static inline int video_bridge_check_attached(struct udevice *dev) +{ + return -ENOSYS; +} + +static inline int video_bridge_get_display_timing(struct udevice *dev, + struct display_timing *timing) +{ + return -ENOSYS; +} + +static inline int video_bridge_read_edid(struct udevice *dev, u8 *buf, int buf_size) +{ + return -ENOSYS; +} +#endif /* CONFIG_VIDEO_BRIDGE */ #endif -- cgit v1.2.3 From 74829b4d93dcdaab5b87f8432b62bf198895c692 Mon Sep 17 00:00:00 2001 From: Adriano Cordova Date: Mon, 3 Mar 2025 11:13:11 -0300 Subject: efi_loader: expose symbols to be used by the EFI network stack The following symbols are exposed: - efi_reinstall_protocol_interface This is done so that the device path protocol interface of the network device can be changed internally by u-boot when a new bootfile gets downloaded. - eth_set_dev To support multiple network udevices - efi_close_event This comes in preparation to support unregistering an EFI network device from the EFI network stack when the underlying U-boot device gets removed - efi_[dis]connect_controller The EFI network driver uses ConnectController to add a NIC to the EFI network stack. - efi_uninstall_protocol_interface connect_controler for the efi network driver can install protocols, which need to be uninstalled in disconnect_controller - EFI_SIMPLE_NETWORK_PROTOCOL_GUID Signed-off-by: Adriano Cordova --- include/efi_loader.h | 17 +++++++++++++++++ include/net-common.h | 1 + 2 files changed, 18 insertions(+) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index 1d75d97ebbc..6a17a41dbad 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -321,6 +321,8 @@ extern const efi_guid_t efi_guid_host_dev; #endif /* GUID of the EFI_BLOCK_IO_PROTOCOL */ extern const efi_guid_t efi_block_io_guid; +/* GUID of the EFI_SIMPLE_NETWORK_PROTOCOL */ +extern const efi_guid_t efi_net_guid; extern const efi_guid_t efi_global_variable_guid; extern const efi_guid_t efi_guid_console_control; extern const efi_guid_t efi_guid_device_path; @@ -733,6 +735,10 @@ efi_status_t efi_search_protocol(const efi_handle_t handle, efi_status_t efi_add_protocol(const efi_handle_t handle, const efi_guid_t *protocol, void *protocol_interface); +/* Uninstall new protocol on a handle */ +efi_status_t efi_uninstall_protocol + (efi_handle_t handle, const efi_guid_t *protocol, + void *protocol_interface, bool preserve); /* Reinstall a protocol on a handle */ efi_status_t EFIAPI efi_reinstall_protocol_interface( efi_handle_t handle, @@ -748,6 +754,15 @@ efi_status_t EFIAPI efi_install_multiple_protocol_interfaces(efi_handle_t *handle, ...); efi_status_t EFIAPI efi_uninstall_multiple_protocol_interfaces(efi_handle_t handle, ...); +/* Connect and disconnect controller */ +efi_status_t EFIAPI efi_connect_controller(efi_handle_t controller_handle, + efi_handle_t *driver_image_handle, + struct efi_device_path *remain_device_path, + bool recursive); +efi_status_t EFIAPI efi_disconnect_controller( + efi_handle_t controller_handle, + efi_handle_t driver_image_handle, + efi_handle_t child_handle); /* Get handles that support a given protocol */ efi_status_t EFIAPI efi_locate_handle_buffer( enum efi_locate_search_type search_type, @@ -768,6 +783,8 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl, void *context), void *notify_context, const efi_guid_t *group, struct efi_event **event); +/* Call this to close an event */ +efi_status_t EFIAPI efi_close_event(struct efi_event *event); /* Call this to set a timer */ efi_status_t efi_set_timer(struct efi_event *event, enum efi_timer_delay type, uint64_t trigger_time); diff --git a/include/net-common.h b/include/net-common.h index 29d31f37263..1d507b13b06 100644 --- a/include/net-common.h +++ b/include/net-common.h @@ -291,6 +291,7 @@ struct eth_ops { #define eth_get_ops(dev) ((struct eth_ops *)(dev)->driver->ops) struct udevice *eth_get_dev(void); /* get the current device */ +void eth_set_dev(struct udevice *dev); /* set a device */ unsigned char *eth_get_ethaddr(void); /* get the current device MAC */ int eth_rx(void); /* Check for received packets */ void eth_halt(void); /* stop SCC */ -- cgit v1.2.3 From 6a832d4b2e5d4d1ebc9d036afcc02d9550257ab2 Mon Sep 17 00:00:00 2001 From: Adriano Cordova Date: Mon, 3 Mar 2025 11:13:13 -0300 Subject: efi_loader: efi_net: Add efi_net_do_start() to efi_net.c This gets called each time a payload is to get executed by bootefi. For now this only updates the PXE IP address. Signed-off-by: Adriano Cordova --- include/efi_loader.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index 6a17a41dbad..c2fb3e66eb9 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -650,6 +650,7 @@ int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc, efi_status_t efi_gop_register(void); /* Called by bootefi to make the network interface available */ efi_status_t efi_net_register(void); +efi_status_t efi_net_do_start(void); /* Called by efi_net_register to make the ip4 config2 protocol available */ efi_status_t efi_ipconfig_register(const efi_handle_t handle, struct efi_ip4_config2_protocol *ip4config); -- cgit v1.2.3 From 267b0a7ddf89d414000d98345aa3222c7e01ff38 Mon Sep 17 00:00:00 2001 From: Adriano Cordova Date: Mon, 3 Mar 2025 11:13:14 -0300 Subject: efi_loader: efi_device_path: Pass net udevice as argument In preparation to support multiple EFI net objects, support constructing device paths using an ethernet device different than the default. Add a udevice argument to the device path generation, and keep the callsites with eth_get_dev() to preserve existing functionality. Signed-off-by: Adriano Cordova --- include/efi_loader.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index c2fb3e66eb9..47c043460eb 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -925,8 +925,8 @@ struct efi_device_path *efi_dp_from_part(struct blk_desc *desc, int part); struct efi_device_path *efi_dp_part_node(struct blk_desc *desc, int part); struct efi_device_path *efi_dp_from_file(const struct efi_device_path *dp, const char *path); -struct efi_device_path *efi_dp_from_eth(void); -struct efi_device_path *efi_dp_from_http(const char *server); +struct efi_device_path *efi_dp_from_eth(struct udevice *dev); +struct efi_device_path *efi_dp_from_http(const char *server, struct udevice *dev); struct efi_device_path *efi_dp_from_mem(uint32_t mem_type, uint64_t start_address, size_t size); -- cgit v1.2.3 From dd5d82a599953945e881fdd1f9dd8227c1232ae7 Mon Sep 17 00:00:00 2001 From: Adriano Cordova Date: Mon, 3 Mar 2025 11:13:15 -0300 Subject: efi_loader: efi_net: Add device path cache In preparation to support mutiple efi net udevices. Add a device path cache to support device paths from multiple ethernet udevices. The device paths can be added to the cache before EFI gets initialized and the protocols get installed. Signed-off-by: Adriano Cordova --- include/efi_loader.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index 47c043460eb..d387e583f20 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -129,15 +129,17 @@ static inline void efi_set_bootdev(const char *dev, const char *devnr, #if CONFIG_IS_ENABLED(NETDEVICES) && CONFIG_IS_ENABLED(EFI_LOADER) /* Call this to update the current device path of the efi net device */ -efi_status_t efi_net_set_dp(const char *dev, const char *server); +efi_status_t efi_net_new_dp(const char *dev, const char *server, struct udevice *udev); /* Call this to get the current device path of the efi net device */ -void efi_net_get_dp(struct efi_device_path **dp); +void efi_net_dp_from_dev(struct efi_device_path **dp, struct udevice *udev, bool cache_only); void efi_net_get_addr(struct efi_ipv4_address *ip, struct efi_ipv4_address *mask, - struct efi_ipv4_address *gw); + struct efi_ipv4_address *gw, + struct udevice *dev); void efi_net_set_addr(struct efi_ipv4_address *ip, struct efi_ipv4_address *mask, - struct efi_ipv4_address *gw); + struct efi_ipv4_address *gw, + struct udevice *dev); efi_status_t efi_net_do_request(u8 *url, enum efi_http_method method, void **buffer, u32 *status_code, ulong *file_size, char *headers_buffer); #define MAX_HTTP_HEADERS_SIZE SZ_64K @@ -151,13 +153,16 @@ struct http_header { void efi_net_parse_headers(ulong *num_headers, struct http_header *headers); #else -static inline void efi_net_get_dp(struct efi_device_path **dp) { } +static inline void efi_net_dp_from_dev(struct efi_device_path **dp, + struct udevice *udev, bool cache_only) { } static inline void efi_net_get_addr(struct efi_ipv4_address *ip, struct efi_ipv4_address *mask, - struct efi_ipv4_address *gw) { } + struct efi_ipv4_address *gw, + struct udevice *dev) { } static inline void efi_net_set_addr(struct efi_ipv4_address *ip, struct efi_ipv4_address *mask, - struct efi_ipv4_address *gw) { } + struct efi_ipv4_address *gw, + struct udevice *dev) { } #endif /* Maximum number of configuration tables */ @@ -649,8 +654,8 @@ int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc, /* Called by bootefi to make GOP (graphical) interface available */ efi_status_t efi_gop_register(void); /* Called by bootefi to make the network interface available */ -efi_status_t efi_net_register(void); -efi_status_t efi_net_do_start(void); +efi_status_t efi_net_register(struct udevice *dev); +efi_status_t efi_net_do_start(struct udevice *dev); /* Called by efi_net_register to make the ip4 config2 protocol available */ efi_status_t efi_ipconfig_register(const efi_handle_t handle, struct efi_ip4_config2_protocol *ip4config); -- cgit v1.2.3 From 79aec250c2bdf6df5f2eff80b477a29750d63377 Mon Sep 17 00:00:00 2001 From: Adriano Cordova Date: Mon, 3 Mar 2025 11:13:17 -0300 Subject: efi_loader: efi_net: Add support for multiple efi_net_obj Add support for multiple efi_net_obj structs in efi_net.c. This comes in preparation for an EFI network driver supporting multiple network interfaces. For now the EFI network stack still registers a single ethernet udevice as an EFI network device even if multiple are present, namely the one that was the current device at the moment of EFI initialization. Signed-off-by: Adriano Cordova --- include/efi_loader.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index d387e583f20..995ae3357ec 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -140,8 +140,11 @@ void efi_net_set_addr(struct efi_ipv4_address *ip, struct efi_ipv4_address *mask, struct efi_ipv4_address *gw, struct udevice *dev); +#if IS_ENABLED(CONFIG_EFI_HTTP_PROTOCOL) efi_status_t efi_net_do_request(u8 *url, enum efi_http_method method, void **buffer, - u32 *status_code, ulong *file_size, char *headers_buffer); + u32 *status_code, ulong *file_size, char *headers_buffer, + struct efi_service_binding_protocol *parent); +#endif #define MAX_HTTP_HEADERS_SIZE SZ_64K #define MAX_HTTP_HEADERS 100 #define MAX_HTTP_HEADER_NAME 128 -- cgit v1.2.3 From 7082c9e656a824ecf5dfc2d59d2ce17f730c5d4a Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 2 Mar 2025 15:21:19 +0100 Subject: common: clean up setjmp.h Separate setjmp.h into an architecture independent part and an architecture specific part. This simplifies moving from using struct jmp_buf_data directly to using type jmp_buf in our code which is the C compliant way. Reviewed-by: Jerome Forissier Signed-off-by: Heinrich Schuchardt --- include/interrupt.h | 2 +- include/setjmp.h | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 include/setjmp.h (limited to 'include') diff --git a/include/interrupt.h b/include/interrupt.h index 46ef2e196d4..6ea28b54a56 100644 --- a/include/interrupt.h +++ b/include/interrupt.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ -#include +#include /** * struct resume_data - data for resume after interrupt diff --git a/include/setjmp.h b/include/setjmp.h new file mode 100644 index 00000000000..37d3a8af85d --- /dev/null +++ b/include/setjmp.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef _SETJMP_H_ +#define _SETJMP_H_ 1 + +#ifdef CONFIG_HAVE_SETJMP +#include +#else +struct jmp_buf_data { +}; +#endif + +/** + * typedef jmp_buf - information needed to restore a calling environment + */ +typedef struct jmp_buf_data jmp_buf[1]; + +/** + * setjmp() - prepare for a long jump + * + * Registers, the stack pointer, and the return address are saved in the + * jump bufffer. The function returns zero afterwards. When longjmp() is + * executed the function returns a second time with a non-zero value. + * + * @env: jump buffer used to store register values + * Return: 0 after setting up jump buffer, non-zero after longjmp() + */ +int setjmp(jmp_buf env); + +/** + * longjmp() - long jump + * + * Jump back to the address and the register state saved by setjmp(). + * + * @env: jump buffer + * @val: value to be returned by setjmp(), 0 is replaced by 1 + */ +void longjmp(jmp_buf env, int val); + +#endif /* _SETJMP_H_ */ -- cgit v1.2.3 From f2806157472bf96a211c4d0319283a6a79614854 Mon Sep 17 00:00:00 2001 From: Yao Zi Date: Sun, 2 Mar 2025 15:21:20 +0100 Subject: efi_loader: Clean up usage of structure jmp_buf_data Structure jmp_buf_data provides the underlying format of jmp_buf, which we actually don't care about. Clean up existing code to use the standard jmp_buf type. This introduces no functional change. Signed-off-by: Yao Zi Reviewed-by: Jerome Forissier Reviewed-by: Ilias Apalodimas --- include/efi_loader.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index 995ae3357ec..e9c10819ba2 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -15,13 +15,13 @@ #include #include #include +#include #include #include #include struct blk_desc; struct bootflow; -struct jmp_buf_data; #if CONFIG_IS_ENABLED(EFI_LOADER) @@ -495,7 +495,7 @@ struct efi_loaded_image_obj { efi_status_t *exit_status; efi_uintn_t *exit_data_size; u16 **exit_data; - struct jmp_buf_data *exit_jmp; + jmp_buf *exit_jmp; EFIAPI efi_status_t (*entry)(efi_handle_t image_handle, struct efi_system_table *st); u16 image_type; -- cgit v1.2.3 From 6689b0c955f1ec885ed1acafc7c5d7c1565dbe63 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 27 Feb 2025 14:51:01 -0600 Subject: usb: gadget: Remove the legacy usbtty driver The lone user of this driver has been removed for some time. Remove this driver as well. Signed-off-by: Tom Rini Reviewed-by: Mattijs Korpershoek Link: https://lore.kernel.org/r/20250227205101.4127604-2-trini@konsulko.com Signed-off-by: Mattijs Korpershoek --- include/serial.h | 20 -------------------- include/stdio_dev.h | 1 - 2 files changed, 21 deletions(-) (limited to 'include') diff --git a/include/serial.h b/include/serial.h index e5f6d984d28..0a707ca730d 100644 --- a/include/serial.h +++ b/include/serial.h @@ -48,26 +48,6 @@ extern int serial_assign(const char *name); extern void serial_reinit_all(void); int serial_initialize(void); -/* For usbtty */ -#ifdef CONFIG_USB_TTY - -struct stdio_dev; - -int usbtty_getc(struct stdio_dev *dev); -void usbtty_putc(struct stdio_dev *dev, const char c); -void usbtty_puts(struct stdio_dev *dev, const char *str); -int usbtty_tstc(struct stdio_dev *dev); - -#else - -/* stubs */ -#define usbtty_getc(dev) 0 -#define usbtty_putc(dev, a) -#define usbtty_puts(dev, a) -#define usbtty_tstc(dev) 0 - -#endif /* CONFIG_USB_TTY */ - struct udevice; enum serial_par { diff --git a/include/stdio_dev.h b/include/stdio_dev.h index 4e3c4708f80..f7f9c10199e 100644 --- a/include/stdio_dev.h +++ b/include/stdio_dev.h @@ -101,7 +101,6 @@ struct stdio_dev *stdio_clone(struct stdio_dev *dev); int drv_lcd_init(void); int drv_video_init(void); int drv_keyboard_init(void); -int drv_usbtty_init(void); int drv_usbacm_init(void); int drv_nc_init(void); int drv_jtag_console_init(void); -- cgit v1.2.3 From d41adba55337b3f01b773ddda37be1be5b5b0054 Mon Sep 17 00:00:00 2001 From: Svyatoslav Ryhel Date: Sat, 16 Nov 2024 14:33:47 +0200 Subject: board: xiaomi: mocha: add Xiaomi Mi Pad A0101 support The Mi Pad is a tablet computer based on Nvidia Tegra K1 SoC which originally ran the Android operating system. The Mi Pad has a 7.9" IPS display with 1536 x 2048 (324 ppi) resolution. 2 GB of RAM and 16/64 GB of internal memory that can be supplemented with a microSDXC card giving up to 128 GB of additional storage. Signed-off-by: Svyatoslav Ryhel --- include/configs/mocha.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 include/configs/mocha.h (limited to 'include') diff --git a/include/configs/mocha.h b/include/configs/mocha.h new file mode 100644 index 00000000000..1c2eb906085 --- /dev/null +++ b/include/configs/mocha.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2010-2013, NVIDIA CORPORATION. All rights reserved. + * + * Copyright (c) 2024, Svyatoslav Ryhel + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#include "tegra124-common.h" + +/* High-level configuration options */ +#define CFG_TEGRA_BOARD_STRING "Xiaomi Mocha" + +/* Board-specific serial config */ +#define CFG_SYS_NS16550_COM1 NV_PA_APB_UARTD_BASE + +#ifdef CONFIG_TEGRA_SUPPORT_NON_SECURE + #define CFG_PRAM 0x38400 /* 225 MB */ +#endif + +#include "tegra-common-post.h" + +#endif /* __CONFIG_H */ -- cgit v1.2.3 From c9671c9036d465e0681d947b0b7a76019a096758 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 2 Mar 2025 02:24:42 +0100 Subject: net: miiphybb: Split off struct bb_miiphy_bus_ops Move miiphybb operations into separate struct bb_miiphy_bus_ops structure, add pointer to struct bb_miiphy_bus_ops into the base struct bb_miiphy_bus and access the ops through this pointer in miiphybb generic code. The variable reshuffling in miiphybb.c cannot be easily avoided. Signed-off-by: Marek Vasut Reviewed-by: Paul Barker --- include/miiphy.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/miiphy.h b/include/miiphy.h index f2ff7506ee8..5fd86bef882 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -62,14 +62,20 @@ void mdio_list_devices(void); #define BB_MII_DEVNAME "bb_miiphy" -struct bb_miiphy_bus { +struct bb_miiphy_bus; + +struct bb_miiphy_bus_ops { int (*mdio_active)(struct bb_miiphy_bus *bus); int (*mdio_tristate)(struct bb_miiphy_bus *bus); int (*set_mdio)(struct bb_miiphy_bus *bus, int v); int (*get_mdio)(struct bb_miiphy_bus *bus, int *v); int (*set_mdc)(struct bb_miiphy_bus *bus, int v); int (*delay)(struct bb_miiphy_bus *bus); +}; + +struct bb_miiphy_bus { void *priv; + const struct bb_miiphy_bus_ops *ops; struct mii_dev mii; }; -- cgit v1.2.3 From c5318bdcf80965fddccf68146c7838816aedb154 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 2 Mar 2025 02:24:44 +0100 Subject: net: miiphybb: Pass struct bb_miiphy_bus_ops directly to bb_miiphy_read/write() The access to struct bb_miiphy_bus_ops via ops pointer in struct bb_miiphy_bus is not necessary with wrappers added in previous patch. Pass the ops pointer directly to both bb_miiphy_read() and bb_miiphy_write() functions. Signed-off-by: Marek Vasut Reviewed-by: Paul Barker --- include/miiphy.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/miiphy.h b/include/miiphy.h index 5fd86bef882..31d81b4b551 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -75,16 +75,16 @@ struct bb_miiphy_bus_ops { struct bb_miiphy_bus { void *priv; - const struct bb_miiphy_bus_ops *ops; struct mii_dev mii; }; struct bb_miiphy_bus *bb_miiphy_alloc(void); void bb_miiphy_free(struct bb_miiphy_bus *bus); -int bb_miiphy_read(struct mii_dev *miidev, int addr, int devad, int reg); -int bb_miiphy_write(struct mii_dev *miidev, int addr, int devad, int reg, - u16 value); +int bb_miiphy_read(struct mii_dev *miidev, const struct bb_miiphy_bus_ops *ops, + int addr, int devad, int reg); +int bb_miiphy_write(struct mii_dev *miidev, const struct bb_miiphy_bus_ops *ops, + int addr, int devad, int reg, u16 value); #endif /* phy seed setup */ -- cgit v1.2.3 From 7cded10da35730ff27062d19b8ad72242be8038f Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 2 Mar 2025 02:24:45 +0100 Subject: net: miiphybb: Pass struct mii_dev directly to bb_miiphy_read/write() Access to MDIO bus private data can be provided by both struct mii_dev .priv member and struct bb_miiphy_bus .priv member, use the former directly and remove .priv from the later. Drop unused bb_miiphy_getbus(). This removes any dependency on struct bb_miiphy_bus from the miiphybb code, except for helper functions which will be removed later. Signed-off-by: Marek Vasut Reviewed-by: Paul Barker --- include/miiphy.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/miiphy.h b/include/miiphy.h index 31d81b4b551..9b8b42799c2 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -65,12 +65,12 @@ void mdio_list_devices(void); struct bb_miiphy_bus; struct bb_miiphy_bus_ops { - int (*mdio_active)(struct bb_miiphy_bus *bus); - int (*mdio_tristate)(struct bb_miiphy_bus *bus); - int (*set_mdio)(struct bb_miiphy_bus *bus, int v); - int (*get_mdio)(struct bb_miiphy_bus *bus, int *v); - int (*set_mdc)(struct bb_miiphy_bus *bus, int v); - int (*delay)(struct bb_miiphy_bus *bus); + int (*mdio_active)(struct mii_dev *miidev); + int (*mdio_tristate)(struct mii_dev *miidev); + int (*set_mdio)(struct mii_dev *miidev, int v); + int (*get_mdio)(struct mii_dev *miidev, int *v); + int (*set_mdc)(struct mii_dev *miidev, int v); + int (*delay)(struct mii_dev *miidev); }; struct bb_miiphy_bus { -- cgit v1.2.3 From 596d67e5163834893e9b59d7a5cb9e9a1cd8bc24 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 2 Mar 2025 02:24:46 +0100 Subject: net: miiphybb: Drop priv from struct bb_miiphy_bus Remove the priv member from struct bb_miiphy_bus and its assignment from drivers. This turns struct bb_miiphy_bus int struct mii_dev wrapper, to be cleaned up next. Signed-off-by: Marek Vasut Reviewed-by: Paul Barker --- include/miiphy.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/miiphy.h b/include/miiphy.h index 9b8b42799c2..d2678379a1b 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -74,7 +74,6 @@ struct bb_miiphy_bus_ops { }; struct bb_miiphy_bus { - void *priv; struct mii_dev mii; }; -- cgit v1.2.3 From 256306593ecdde5fe01ecc5108d564e76ea8ba65 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 2 Mar 2025 02:24:51 +0100 Subject: net: miiphybb: Drop bb_miiphy_alloc()/bb_miiphy_free() and struct bb_miiphy_bus These functions are no longer necessary, remove them. The struct bb_miiphy_bus is no longer necessary either, remove it as well. Signed-off-by: Marek Vasut Reviewed-by: Paul Barker --- include/miiphy.h | 9 --------- 1 file changed, 9 deletions(-) (limited to 'include') diff --git a/include/miiphy.h b/include/miiphy.h index d2678379a1b..dc8ae0caca6 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -62,8 +62,6 @@ void mdio_list_devices(void); #define BB_MII_DEVNAME "bb_miiphy" -struct bb_miiphy_bus; - struct bb_miiphy_bus_ops { int (*mdio_active)(struct mii_dev *miidev); int (*mdio_tristate)(struct mii_dev *miidev); @@ -73,13 +71,6 @@ struct bb_miiphy_bus_ops { int (*delay)(struct mii_dev *miidev); }; -struct bb_miiphy_bus { - struct mii_dev mii; -}; - -struct bb_miiphy_bus *bb_miiphy_alloc(void); -void bb_miiphy_free(struct bb_miiphy_bus *bus); - int bb_miiphy_read(struct mii_dev *miidev, const struct bb_miiphy_bus_ops *ops, int addr, int devad, int reg); int bb_miiphy_write(struct mii_dev *miidev, const struct bb_miiphy_bus_ops *ops, -- cgit v1.2.3 From 33ccfae85372285690d8bd8256d994d7cb917cbf Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 2 Mar 2025 02:24:52 +0100 Subject: net: miiphybb: Drop mdio_init() Inline mdio_init() back into mdio_alloc(), separate access to mdio_init() is no longer necessary. Signed-off-by: Marek Vasut Reviewed-by: Paul Barker --- include/miiphy.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/miiphy.h b/include/miiphy.h index dc8ae0caca6..00d0b9b6a43 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -42,7 +42,6 @@ struct phy_device *mdio_phydev_for_ethname(const char *devname); void miiphy_listdev(void); -void mdio_init(struct mii_dev *bus); struct mii_dev *mdio_alloc(void); void mdio_free(struct mii_dev *bus); int mdio_register(struct mii_dev *bus); -- cgit v1.2.3 From a0ffd8d7cd8efb8b348c07fa18a610a4534f9bea Mon Sep 17 00:00:00 2001 From: Greg Malysa Date: Wed, 26 Feb 2025 12:30:24 -0500 Subject: doc: Add dt-bindings and descriptions for ADI SC5xx-family pinctrl This adds the necessary dt-bindings and documentation to use the ADI SC5xx pinctrl driver in a device tree. It is not yet available upstream in the Linux kernel. Eventually, it will be moved there. Signed-off-by: Vasileios Bimpikas Signed-off-by: Utsav Agarwal Signed-off-by: Arturs Artamonovs Signed-off-by: Greg Malysa --- include/dt-bindings/pinctrl/adi-adsp.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 include/dt-bindings/pinctrl/adi-adsp.h (limited to 'include') diff --git a/include/dt-bindings/pinctrl/adi-adsp.h b/include/dt-bindings/pinctrl/adi-adsp.h new file mode 100644 index 00000000000..7dc8a1ef5c4 --- /dev/null +++ b/include/dt-bindings/pinctrl/adi-adsp.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * (C) Copyright 2022 - Analog Devices, Inc. + * + * Written and/or maintained by Timesys Corporation + * + * Contact: Nathan Barrett-Morrison + * Contact: Greg Malysa + * + */ + +#ifndef DT_BINDINGS_PINCTRL_ADI_ADSP +#define DT_BINDINGS_PINCTRL_ADI_ADSP + +#define ADI_ADSP_PIN(port, pin) (16 * ((port) - 'A') + (pin)) +#define ADI_ADSP_PINFUNC_ALT0 0 +#define ADI_ADSP_PINFUNC_ALT1 1 +#define ADI_ADSP_PINFUNC_ALT2 2 +#define ADI_ADSP_PINFUNC_ALT3 3 + +#endif -- cgit v1.2.3 From 569dceef2e57c76c9439ea9eb8ca6019cedf7c5d Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 27 Feb 2025 09:29:42 -0600 Subject: mmc: fsl_esdhc: Migrate ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE to Kconfig The flag for enabling the ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE quirk can be handled easily enough in Kconfig. This lets us remove a function but not obviously correct usage of the IS_ENABLED() macro. Signed-off-by: Tom Rini Reviewed-by: Peng Fan --- include/configs/imxrt1020-evk.h | 2 -- include/configs/imxrt1050-evk.h | 2 -- include/configs/imxrt1170-evk.h | 2 -- 3 files changed, 6 deletions(-) (limited to 'include') diff --git a/include/configs/imxrt1020-evk.h b/include/configs/imxrt1020-evk.h index cd6af93454b..aec12082b95 100644 --- a/include/configs/imxrt1020-evk.h +++ b/include/configs/imxrt1020-evk.h @@ -9,8 +9,6 @@ #include -#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 1 - #define PHYS_SDRAM 0x80000000 #define PHYS_SDRAM_SIZE (32 * 1024 * 1024) diff --git a/include/configs/imxrt1050-evk.h b/include/configs/imxrt1050-evk.h index c520c2fc203..5b8d6a7ac05 100644 --- a/include/configs/imxrt1050-evk.h +++ b/include/configs/imxrt1050-evk.h @@ -9,8 +9,6 @@ #include -#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 1 - #define PHYS_SDRAM 0x80000000 #define PHYS_SDRAM_SIZE (32 * 1024 * 1024) diff --git a/include/configs/imxrt1170-evk.h b/include/configs/imxrt1170-evk.h index 1ccaa15bc11..f821212765c 100644 --- a/include/configs/imxrt1170-evk.h +++ b/include/configs/imxrt1170-evk.h @@ -10,8 +10,6 @@ #include -#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 1 - /* * Configuration of the external SDRAM memory */ -- cgit v1.2.3 From 1c7d0c411c033f7158dccc34c795951b667dd591 Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Thu, 20 Feb 2025 15:54:40 +0200 Subject: arm: Prepare linker scripts for memory permissions Upcoming patches are switching the memory mappings to RW, RO, RX after the U-Boot binary and its data are relocated. Add annotations in the linker scripts to and mark text, data, rodata sections and align them to a page boundary. It's worth noting that .efi_runtime memory permissions are left untouched for now. There's two problems with EFI currently. The first problem is that we bundle data, rodata and text in a single .efi_runtime section which also must be close to .text for now. As a result we also dont change the permissions for anything contained in CPUDIR/start.o. In order to fix that we have to decoule .text_rest, .text and .efi_runtime and have the runtime services on their own section with proper memory permission annotations (efi_rodata etc). The efi runtime regions (.efi_runtime_rel) can be relocated by the OS when the latter is calling SetVirtualAddressMap. Which means we have to configure those pages as RX for U-Boot but convert them to RWX just before ExitBootServices. It also needs extra code in efi_tuntime relocation code since R_AARCH64_NONE are emitted as well if we page align the section. Due to the above ignore EFI for now and fix it later once we have the rest in place. Acked-by: Jerome Forissier Tested-by: Neil Armstrong # on AML-S905X-CC Reviewed-by: Richard Henderson Signed-off-by: Ilias Apalodimas --- include/asm-generic/sections.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 3fd5c772a1a..024b1adde27 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -23,6 +23,7 @@ extern char __kprobes_text_start[], __kprobes_text_end[]; extern char __entry_text_start[], __entry_text_end[]; extern char __initdata_begin[], __initdata_end[]; extern char __start_rodata[], __end_rodata[]; +extern char __start_data[], __end_data[]; extern char __efi_helloworld_begin[]; extern char __efi_helloworld_end[]; extern char __efi_var_file_begin[]; @@ -63,6 +64,7 @@ static inline int arch_is_kernel_data(unsigned long addr) /* Start of U-Boot text region */ extern char __text_start[]; +extern char __text_end[]; /* This marks the text region which must be relocated */ extern char __image_copy_start[], __image_copy_end[]; -- cgit v1.2.3 From ec1c6cfb1cfce92909a248f10c36bd8b18894d7e Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Thu, 20 Feb 2025 15:54:42 +0200 Subject: treewide: Add a function to change page permissions For armv8 we are adding proper page permissions for the relocated U-Boot binary. Add a weak function that can be used across architectures to change the page permissions Tested-by: Neil Armstrong # on AML-S905X-CC Signed-off-by: Ilias Apalodimas --- include/cpu_func.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include') diff --git a/include/cpu_func.h b/include/cpu_func.h index 7e81c4364a7..70a41ead3f7 100644 --- a/include/cpu_func.h +++ b/include/cpu_func.h @@ -69,6 +69,23 @@ void flush_dcache_range(unsigned long start, unsigned long stop); void invalidate_dcache_range(unsigned long start, unsigned long stop); void invalidate_dcache_all(void); void invalidate_icache_all(void); + +enum pgprot_attrs { + MMU_ATTR_RO, + MMU_ATTR_RX, + MMU_ATTR_RW, +}; + +/** pgprot_set_attrs() - Set page table permissions + * + * @addr: Physical address start + * @size: size of memory to change + * @perm: New permissions + * + * Return: 0 on success, error otherwise. + **/ +int pgprot_set_attrs(phys_addr_t addr, size_t size, enum pgprot_attrs perm); + /** * noncached_init() - Initialize non-cached memory region * -- cgit v1.2.3 From ebc41cadc6bf9cdd092469c779557a40293b882e Mon Sep 17 00:00:00 2001 From: Dinesh Maniyam Date: Thu, 27 Feb 2025 00:18:17 +0800 Subject: drivers: mtd: nand: Add driver for Cadence Nand Enable driver for Cadence NAND for the family device agilex5. This driver is leveraged from the path /drivers/mtd/nand/raw/cadence-nand-controller.c from the stable version 6.11.2. Signed-off-by: Dinesh Maniyam --- include/cadence-nand.h | 527 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/mtd/rawnand.h | 1 + 2 files changed, 528 insertions(+) create mode 100644 include/cadence-nand.h (limited to 'include') diff --git a/include/cadence-nand.h b/include/cadence-nand.h new file mode 100644 index 00000000000..7973e5b55bf --- /dev/null +++ b/include/cadence-nand.h @@ -0,0 +1,527 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Cadence NAND flash controller driver + * + * Copyright (C) 2019 Cadence + * + * Author: Piotr Sroka + * + */ + +#ifndef _CADENCE_NAND_H_ +#define _CADENCE_NAND_H_ +#include +#include +#include +#include + +/* + * HPNFC can work in 3 modes: + * - PIO - can work in master or slave DMA + * - CDMA - needs Master DMA for accessing command descriptors. + * - Generic mode - can use only slave DMA. + * CDMA and PIO modes can be used to execute only base commands. + * CDMA and PIO modes can be used to execute only base commands. + * Generic mode can be used to execute any command + * on NAND flash memory. Driver uses CDMA mode for + * block erasing, page reading, page programing. + * Generic mode is used for executing rest of commands. + */ + +#define DMA_DATA_SIZE_ALIGN 8 + +/* Register definition. */ +/* + * Command register 0. + * Writing data to this register will initiate a new transaction + * of the NF controller. + */ +#define CMD_REG0 0x0000 +/* Command type field mask. */ +#define CMD_REG0_CT GENMASK(31, 30) +/* Command type CDMA. */ +#define CMD_REG0_CT_CDMA 0uL +/* Command type generic. */ +#define CMD_REG0_CT_GEN 3uL +/* Command thread number field mask. */ +#define CMD_REG0_TN GENMASK(27, 24) + +/* Command register 2. */ +#define CMD_REG2 0x0008 +/* Command register 3. */ +#define CMD_REG3 0x000C +/* Pointer register to select which thread status will be selected. */ +#define CMD_STATUS_PTR 0x0010 +/* Command status register for selected thread. */ +#define CMD_STATUS 0x0014 + +/* Interrupt status register. */ +#define INTR_STATUS 0x0110 +#define INTR_STATUS_SDMA_ERR BIT(22) +#define INTR_STATUS_SDMA_TRIGG BIT(21) +#define INTR_STATUS_UNSUPP_CMD BIT(19) +#define INTR_STATUS_DDMA_TERR BIT(18) +#define INTR_STATUS_CDMA_TERR BIT(17) +#define INTR_STATUS_CDMA_IDL BIT(16) + +/* Interrupt enable register. */ +#define INTR_ENABLE 0x0114 +#define INTR_ENABLE_INTR_EN BIT(31) + +/* Controller internal state. */ +#define CTRL_STATUS 0x0118 +#define CTRL_STATUS_INIT_COMP BIT(9) +#define CTRL_STATUS_CTRL_BUSY BIT(8) + +/* Command Engine threads state. */ +#define TRD_STATUS 0x0120 + +/* Command Engine interrupt thread error status. */ +#define TRD_ERR_INT_STATUS 0x0128 +/* Command Engine interrupt thread error enable. */ +#define TRD_ERR_INT_STATUS_EN 0x0130 +/* Command Engine interrupt thread complete status. */ +#define TRD_COMP_INT_STATUS 0x0138 + +/* + * Transfer config 0 register. + * Configures data transfer parameters. + */ +#define TRAN_CFG_0 0x0400 +/* Offset value from the beginning of the page. */ +#define TRAN_CFG_0_OFFSET GENMASK(31, 16) +/* Numbers of sectors to transfer within singlNF device's page. */ +#define TRAN_CFG_0_SEC_CNT GENMASK(7, 0) + +/* + * Transfer config 1 register. + * Configures data transfer parameters. + */ +#define TRAN_CFG_1 0x0404 +/* Size of last data sector. */ +#define TRAN_CFG_1_LAST_SEC_SIZE GENMASK(31, 16) +/* Size of not-last data sector. */ +#define TRAN_CFG_1_SECTOR_SIZE GENMASK(15, 0) + +/* ECC engine configuration register 0. */ +#define ECC_CONFIG_0 0x0428 +/* Correction strength. */ +#define ECC_CONFIG_0_CORR_STR GENMASK(10, 8) +/* Enable erased pages detection mechanism. */ +#define ECC_CONFIG_0_ERASE_DET_EN BIT(1) +/* Enable controller ECC check bits generation and correction. */ +#define ECC_CONFIG_0_ECC_EN BIT(0) + +/* ECC engine configuration register 1. */ +#define ECC_CONFIG_1 0x042C + +/* Multiplane settings register. */ +#define MULTIPLANE_CFG 0x0434 +/* Cache operation settings. */ +#define CACHE_CFG 0x0438 + +/* Transferred data block size for the slave DMA module. */ +#define SDMA_SIZE 0x0440 + +/* Thread number associated with transferred data block + * for the slave DMA module. + */ +#define SDMA_TRD_NUM 0x0444 +/* Thread number mask. */ +#define SDMA_TRD_NUM_SDMA_TRD GENMASK(2, 0) + +#define CONTROL_DATA_CTRL 0x0494 +/* Thread number mask. */ +#define CONTROL_DATA_CTRL_SIZE GENMASK(15, 0) + +#define CTRL_VERSION 0x800 +#define CTRL_VERSION_REV GENMASK(7, 0) + +/* Available hardware features of the controller. */ +#define CTRL_FEATURES 0x804 +/* Support for NV-DDR2/3 work mode. */ +#define CTRL_FEATURES_NVDDR_2_3 BIT(28) +/* Support for NV-DDR work mode. */ +#define CTRL_FEATURES_NVDDR BIT(27) +/* Support for asynchronous work mode. */ +#define CTRL_FEATURES_ASYNC BIT(26) +/* Support for asynchronous work mode. */ +#define CTRL_FEATURES_N_BANKS GENMASK(25, 24) +/* Slave and Master DMA data width. */ +#define CTRL_FEATURES_DMA_DWITH64 BIT(21) +/* Availability of Control Data feature.*/ +#define CTRL_FEATURES_CONTROL_DATA BIT(10) + +/* BCH Engine identification register 0 - correction strengths. */ +#define BCH_CFG_0 0x838 +#define BCH_CFG_0_CORR_CAP_0 GENMASK(7, 0) +#define BCH_CFG_0_CORR_CAP_1 GENMASK(15, 8) +#define BCH_CFG_0_CORR_CAP_2 GENMASK(23, 16) +#define BCH_CFG_0_CORR_CAP_3 GENMASK(31, 24) + +/* BCH Engine identification register 1 - correction strengths. */ +#define BCH_CFG_1 0x83C +#define BCH_CFG_1_CORR_CAP_4 GENMASK(7, 0) +#define BCH_CFG_1_CORR_CAP_5 GENMASK(15, 8) +#define BCH_CFG_1_CORR_CAP_6 GENMASK(23, 16) +#define BCH_CFG_1_CORR_CAP_7 GENMASK(31, 24) + +/* BCH Engine identification register 2 - sector sizes. */ +#define BCH_CFG_2 0x840 +#define BCH_CFG_2_SECT_0 GENMASK(15, 0) +#define BCH_CFG_2_SECT_1 GENMASK(31, 16) + +/* BCH Engine identification register 3. */ +#define BCH_CFG_3 0x844 +#define BCH_CFG_3_METADATA_SIZE GENMASK(23, 16) + +/* Ready/Busy# line status. */ +#define RBN_SETINGS 0x1004 + +/* Common settings. */ +#define COMMON_SET 0x1008 +/* 16 bit device connected to the NAND Flash interface. */ +#define COMMON_SET_DEVICE_16BIT BIT(8) + +/* Skip_bytes registers. */ +#define SKIP_BYTES_CONF 0x100C +#define SKIP_BYTES_MARKER_VALUE GENMASK(31, 16) +#define SKIP_BYTES_NUM_OF_BYTES GENMASK(7, 0) + +#define SKIP_BYTES_OFFSET 0x1010 +#define SKIP_BYTES_OFFSET_VALUE GENMASK(23, 0) + +/* Timings configuration. */ +#define ASYNC_TOGGLE_TIMINGS 0x101c +#define ASYNC_TOGGLE_TIMINGS_TRH GENMASK(28, 24) +#define ASYNC_TOGGLE_TIMINGS_TRP GENMASK(20, 16) +#define ASYNC_TOGGLE_TIMINGS_TWH GENMASK(12, 8) +#define ASYNC_TOGGLE_TIMINGS_TWP GENMASK(4, 0) + +#define TIMINGS0 0x1024 +#define TIMINGS0_TADL GENMASK(31, 24) +#define TIMINGS0_TCCS GENMASK(23, 16) +#define TIMINGS0_TWHR GENMASK(15, 8) +#define TIMINGS0_TRHW GENMASK(7, 0) + +#define TIMINGS1 0x1028 +#define TIMINGS1_TRHZ GENMASK(31, 24) +#define TIMINGS1_TWB GENMASK(23, 16) +#define TIMINGS1_TVDLY GENMASK(7, 0) + +#define TIMINGS2 0x102c +#define TIMINGS2_TFEAT GENMASK(25, 16) +#define TIMINGS2_CS_HOLD_TIME GENMASK(13, 8) +#define TIMINGS2_CS_SETUP_TIME GENMASK(5, 0) + +/* Configuration of the resynchronization of slave DLL of PHY. */ +#define DLL_PHY_CTRL 0x1034 +#define DLL_PHY_CTRL_DLL_RST_N BIT(24) +#define DLL_PHY_CTRL_EXTENDED_WR_MODE BIT(17) +#define DLL_PHY_CTRL_EXTENDED_RD_MODE BIT(16) +#define DLL_PHY_CTRL_RS_HIGH_WAIT_CNT GENMASK(11, 8) +#define DLL_PHY_CTRL_RS_IDLE_CNT GENMASK(7, 0) + +/* TODO: - Identify better way to handle PHY address */ +#define PHY_OFFSET 0x10000 + +/* Register controlling DQ related timing. */ +#define PHY_DQ_TIMING PHY_OFFSET + 0x2000 +/* Register controlling DSQ related timing. */ +#define PHY_DQS_TIMING PHY_OFFSET + 0x2004 +#define PHY_DQS_TIMING_DQS_SEL_OE_END GENMASK(3, 0) +#define PHY_DQS_TIMING_PHONY_DQS_SEL BIT(16) +#define PHY_DQS_TIMING_USE_PHONY_DQS BIT(20) + +/* Register controlling the gate and loopback control related timing. */ +#define PHY_GATE_LPBK_CTRL PHY_OFFSET + 0x2008 +#define PHY_GATE_LPBK_CTRL_RDS GENMASK(24, 19) + +/* Register holds the control for the master DLL logic. */ +#define PHY_DLL_MASTER_CTRL PHY_OFFSET + 0x200C +#define PHY_DLL_MASTER_CTRL_BYPASS_MODE BIT(23) + +/* Register holds the control for the slave DLL logic. */ +#define PHY_DLL_SLAVE_CTRL PHY_OFFSET + 0x2010 + +/* This register handles the global control settings for the PHY. */ +#define PHY_CTRL PHY_OFFSET + 0x2080 +#define PHY_CTRL_SDR_DQS BIT(14) +#define PHY_CTRL_PHONY_DQS GENMASK(9, 4) + +/* + * This register handles the global control settings + * for the termination selects for reads. + */ +#define PHY_TSEL PHY_OFFSET + 0x2084 + +/* Generic command layout. */ +#define GCMD_LAY_CS GENMASK_ULL(11, 8) +/* + * This bit informs the minicotroller if it has to wait for tWB + * after sending the last CMD/ADDR/DATA in the sequence. + */ +#define GCMD_LAY_TWB BIT_ULL(6) +/* Type of generic instruction. */ +#define GCMD_LAY_INSTR GENMASK_ULL(5, 0) + +/* Generic CMD sequence type. */ +#define GCMD_LAY_INSTR_CMD 0 +/* Generic ADDR sequence type. */ +#define GCMD_LAY_INSTR_ADDR 1 +/* Generic data transfer sequence type. */ +#define GCMD_LAY_INSTR_DATA 2 + +/* Input part of generic command type of input is command. */ +#define GCMD_LAY_INPUT_CMD GENMASK_ULL(23, 16) + +/* Generic command address sequence - address fields. */ +#define GCMD_LAY_INPUT_ADDR GENMASK_ULL(63, 16) +/* Generic command address sequence - address size. */ +#define GCMD_LAY_INPUT_ADDR_SIZE GENMASK_ULL(13, 11) + +/* Transfer direction field of generic command data sequence. */ +#define GCMD_DIR BIT_ULL(11) +/* Read transfer direction of generic command data sequence. */ +#define GCMD_DIR_READ 0 +/* Write transfer direction of generic command data sequence. */ +#define GCMD_DIR_WRITE 1 + +/* ECC enabled flag of generic command data sequence - ECC enabled. */ +#define GCMD_ECC_EN BIT_ULL(12) +/* Generic command data sequence - sector size. */ +#define GCMD_SECT_SIZE GENMASK_ULL(31, 16) +/* Generic command data sequence - sector count. */ +#define GCMD_SECT_CNT GENMASK_ULL(39, 32) +/* Generic command data sequence - last sector size. */ +#define GCMD_LAST_SIZE GENMASK_ULL(55, 40) + +/* CDMA descriptor fields. */ +/* Erase command type of CDMA descriptor. */ +#define CDMA_CT_ERASE 0x1000 +/* Program page command type of CDMA descriptor. */ +#define CDMA_CT_WR 0x2100 +/* Read page command type of CDMA descriptor. */ +#define CDMA_CT_RD 0x2200 + +/* Flash pointer memory shift. */ +#define CDMA_CFPTR_MEM_SHIFT 24 +/* Flash pointer memory mask. */ +#define CDMA_CFPTR_MEM GENMASK(26, 24) + +/* + * Command DMA descriptor flags. If set causes issue interrupt after + * the completion of descriptor processing. + */ +#define CDMA_CF_INT BIT(8) +/* + * Command DMA descriptor flags - the next descriptor + * address field is valid and descriptor processing should continue. + */ +#define CDMA_CF_CONT BIT(9) +/* DMA master flag of command DMA descriptor. */ +#define CDMA_CF_DMA_MASTER BIT(10) + +/* Operation complete status of command descriptor. */ +#define CDMA_CS_COMP BIT(15) +/* Operation complete status of command descriptor. */ +/* Command descriptor status - operation fail. */ +#define CDMA_CS_FAIL BIT(14) +/* Command descriptor status - page erased. */ +#define CDMA_CS_ERP BIT(11) +/* Command descriptor status - timeout occurred. */ +#define CDMA_CS_TOUT BIT(10) +/* + * Maximum amount of correction applied to one ECC sector. + * It is part of command descriptor status. + */ +#define CDMA_CS_MAXERR GENMASK(9, 2) +/* Command descriptor status - uncorrectable ECC error. */ +#define CDMA_CS_UNCE BIT(1) +/* Command descriptor status - descriptor error. */ +#define CDMA_CS_ERR BIT(0) + +/* Status of operation - OK. */ +#define STAT_OK 0 +/* Status of operation - FAIL. */ +#define STAT_FAIL 2 +/* Status of operation - uncorrectable ECC error. */ +#define STAT_ECC_UNCORR 3 +/* Status of operation - page erased. */ +#define STAT_ERASED 5 +/* Status of operation - correctable ECC error. */ +#define STAT_ECC_CORR 6 +/* Status of operation - unsuspected state. */ +#define STAT_UNKNOWN 7 +/* Status of operation - operation is not completed yet. */ +#define STAT_BUSY 0xFF + +#define BCH_MAX_NUM_CORR_CAPS 8 +#define BCH_MAX_NUM_SECTOR_SIZES 2 + +#define ONE_CYCLE 1 +#define TIMEOUT_US 1000000 + +struct cadence_nand_timings { + u32 async_toggle_timings; + u32 timings0; + u32 timings1; + u32 timings2; + u32 dll_phy_ctrl; + u32 phy_ctrl; + u32 phy_dqs_timing; + u32 phy_gate_lpbk_ctrl; +}; + +/* Command DMA descriptor. */ +struct cadence_nand_cdma_desc { + /* Next descriptor address. */ + u64 next_pointer; + + /* Flash address is a 32-bit address comprising of BANK and ROW ADDR. */ + u32 flash_pointer; + /*field appears in HPNFC version 13*/ + u16 bank; + u16 rsvd0; + + /* Operation the controller needs to perform. */ + u16 command_type; + u16 rsvd1; + /* Flags for operation of this command. */ + u16 command_flags; + u16 rsvd2; + + /* System/host memory address required for data DMA commands. */ + u64 memory_pointer; + + /* Status of operation. */ + u32 status; + u32 rsvd3; + + /* Address pointer to sync buffer location. */ + u64 sync_flag_pointer; + + /* Controls the buffer sync mechanism. */ + u32 sync_arguments; + u32 rsvd4; + + /* Control data pointer. */ + u64 ctrl_data_ptr; +}; + +/* Interrupt status. */ +struct cadence_nand_irq_status { + /* Thread operation complete status. */ + u32 trd_status; + /* Thread operation error. */ + u32 trd_error; + /* Controller status. */ + u32 status; +}; + +/* Cadence NAND flash controller capabilities get from driver data. */ +struct cadence_nand_dt_devdata { + /* Skew value of the output signals of the NAND Flash interface. */ + u32 if_skew; + /* It informs if slave DMA interface is connected to DMA engine. */ + unsigned int has_dma:1; +}; + +/* Cadence NAND flash controller capabilities read from registers. */ +struct cdns_nand_caps { + /* Maximum number of banks supported by hardware. */ + u8 max_banks; + /* Slave and Master DMA data width in bytes (4 or 8). */ + u8 data_dma_width; + /* Control Data feature supported. */ + bool data_control_supp; + /* Is PHY type DLL. */ + bool is_phy_type_dll; +}; + +struct cadence_nand_info { + struct nand_hw_control controller; + struct udevice *dev; + struct reset_ctl softphy_reset; + struct reset_ctl nand_reset; + struct cadence_nand_cdma_desc *cdma_desc; + /* IP capability. */ + const struct cadence_nand_dt_devdata *caps1; + struct cdns_nand_caps caps2; + u8 ctrl_rev; + dma_addr_t dma_cdma_desc; + /* command interface buffers */ + u8 *buf; + u32 buf_size; + u8 *stat; + + u8 curr_corr_str_idx; + + /* Register interface. */ + void __iomem *reg; + + struct { + void __iomem *virt; + dma_addr_t dma; + } io; + + int irq; + /* Interrupts that have happened. */ + struct cadence_nand_irq_status irq_status; + /* Interrupts we are waiting for. */ + struct cadence_nand_irq_status irq_mask; + + int ecc_strengths[BCH_MAX_NUM_CORR_CAPS]; + struct nand_ecc_step_info ecc_stepinfos[BCH_MAX_NUM_SECTOR_SIZES]; + struct nand_ecc_caps ecc_caps; + + int curr_trans_type; + + struct clk clk; + u32 nf_clk_rate; + /* + * Estimated Board delay. The value includes the total + * round trip delay for the signals and is used for deciding on values + * associated with data read capture. + */ + u32 board_delay; + + struct nand_chip *selected_chip; + + unsigned long assigned_cs; + struct list_head chips; + u8 bch_metadata_size; +}; + +struct cdns_nand_chip { + struct cadence_nand_timings timings; + struct nand_chip chip; + u8 nsels; + struct list_head node; + + /* + * part of oob area of NAND flash memory page. + * This part is available for user to read or write. + */ + u32 avail_oob_size; + + /* Sector size. There are few sectors per mtd->writesize */ + u32 sector_size; + u32 sector_count; + + /* Offset of BBM. */ + u8 bbm_offs; + /* Number of bytes reserved for BBM. */ + u8 bbm_len; + /* ECC strength index. */ + u8 corr_str_idx; + + u8 cs[]; +}; + +struct ecc_info { + int (*calc_ecc_bytes)(int step_size, int strength); + int max_step_size; +}; + +#endif /*_CADENCE_NAND_H_*/ diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index 2d85b392465..3bb0a3679f9 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h @@ -981,6 +981,7 @@ struct nand_chip { struct nand_bbt_descr *bbt_md; struct nand_bbt_descr *badblock_pattern; + int cur_cs; void *priv; -- cgit v1.2.3 From ac682c4da990c9235c0e890241491fcd52aa731b Mon Sep 17 00:00:00 2001 From: Dinesh Maniyam Date: Thu, 27 Feb 2025 00:18:18 +0800 Subject: drivers: mtd: nand: cadence: Add support for read status command Add support for read status command in Cadence NAND driver. This status bit is important to check whether the flash is write-protected. Signed-off-by: Dinesh Maniyam --- include/cadence-nand.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/cadence-nand.h b/include/cadence-nand.h index 7973e5b55bf..27ed217b1ed 100644 --- a/include/cadence-nand.h +++ b/include/cadence-nand.h @@ -454,6 +454,8 @@ struct cadence_nand_info { u8 *buf; u32 buf_size; u8 *stat; + u8 cmd; + u32 buf_index; u8 curr_corr_str_idx; -- cgit v1.2.3 From 597fe4098dabdd05c44ec1d68e990a61798cad38 Mon Sep 17 00:00:00 2001 From: Dinesh Maniyam Date: Thu, 27 Feb 2025 00:18:28 +0800 Subject: drivers: mtd: nand: base: Add support for Hardware ECC for check bad block Leverage linux code to support hardware ECC interface to verify nand bad block. Signed-off-by: Dinesh Maniyam --- include/linux/mtd/rawnand.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index 3bb0a3679f9..3e80b134063 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h @@ -131,6 +131,17 @@ void nand_wait_ready(struct mtd_info *mtd); #define NAND_DATA_IFACE_CHECK_ONLY -1 +/* + * There are different places where the manufacturer stores the factory bad + * block markers. + * + * Position within the block: Each of these pages needs to be checked for a + * bad block marking pattern. + */ +#define NAND_BBM_FIRSTPAGE BIT(24) +#define NAND_BBM_SECONDPAGE BIT(25) +#define NAND_BBM_LASTPAGE BIT(26) + /* * Constants for ECC_MODES */ -- cgit v1.2.3 From b27c94958b976213e3f21e53943a699ffa53f16e Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Mon, 3 Mar 2025 13:15:15 -0600 Subject: board: beagle: Add support for BeagleY-AI Basic board support for BeagleY-AI. Information on this board can be found at https://beagleboard.org/beagley-ai Signed-off-by: Robert Nelson Signed-off-by: Nishanth Menon Signed-off-by: Andrew Davis --- include/configs/beagley_ai.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 include/configs/beagley_ai.h (limited to 'include') diff --git a/include/configs/beagley_ai.h b/include/configs/beagley_ai.h new file mode 100644 index 00000000000..a7072a094c5 --- /dev/null +++ b/include/configs/beagley_ai.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Configuration header file for BeagleY-AI + * + * Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/ + */ + +#ifndef __CONFIG_BEAGLEY_AI_H +#define __CONFIG_BEAGLEY_AI_H + +/* Now for the remaining common defines */ +#include + +#endif /* __CONFIG_BEAGLEY_AI_H */ -- cgit v1.2.3 From 7193c252db3578766a3d7fb4019a27fb16b418f8 Mon Sep 17 00:00:00 2001 From: Wadim Egorov Date: Wed, 5 Mar 2025 05:58:27 +0100 Subject: include: configs: phycore-am62ax: Define capsule FW names Define firmware names for phycore-am62ax capsules. Signed-off-by: Wadim Egorov --- include/configs/phycore_am62ax.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/configs/phycore_am62ax.h b/include/configs/phycore_am62ax.h index 661ba8f73ca..4f612d2c2ce 100644 --- a/include/configs/phycore_am62ax.h +++ b/include/configs/phycore_am62ax.h @@ -12,4 +12,8 @@ /* DDR Configuration */ #define CFG_SYS_SDRAM_BASE 0x80000000 +#define PHYCORE_AM6XX_FW_NAME_TIBOOT3 u"PHYCORE_AM62AX_TIBOOT3" +#define PHYCORE_AM6XX_FW_NAME_SPL u"PHYCORE_AM62AX_SPL" +#define PHYCORE_AM6XX_FW_NAME_UBOOT u"PHYCORE_AM62AX_UBOOT" + #endif /* __PHYCORE_AM62AX_H */ -- cgit v1.2.3 From 7719682164ee3d8a21e3b5d62d8eb28f0acbd45d Mon Sep 17 00:00:00 2001 From: Wadim Egorov Date: Wed, 5 Mar 2025 05:58:31 +0100 Subject: board: phytec: phycore_am62x: Use custom k3_dfu.env fragment TI's k3_dfu.env includes redundant dfu_alt_info_* data, some of which is incompatible with our board configuration. Replace it with a custom variant that better aligns with our setup, ensuring correct offsets and eliminating unnecessary entries. Signed-off-by: Wadim Egorov --- include/env/phytec/k3_dfu.env | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 include/env/phytec/k3_dfu.env (limited to 'include') diff --git a/include/env/phytec/k3_dfu.env b/include/env/phytec/k3_dfu.env new file mode 100644 index 00000000000..0cba87da99d --- /dev/null +++ b/include/env/phytec/k3_dfu.env @@ -0,0 +1,3 @@ +dfu_alt_info_ram= + tispl.bin ram 0x80080000 0x200000; + u-boot.img ram 0x81000000 0x400000 -- cgit v1.2.3 From 95641f4bf98d3c90bfc4ae94515c98c440ffb2e1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Mar 2025 17:24:56 -0700 Subject: x86: Rename zboot_run() to zboot_run_args() Rename this function so we can (later) create a zboot_run() function which looks the same as bootm_run() Signed-off-by: Simon Glass --- include/bootm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/bootm.h b/include/bootm.h index 61160705215..154fb98cfcd 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -273,7 +273,7 @@ int bootm_process_cmdline(char *buf, int maxlen, int flags); int bootm_process_cmdline_env(int flags); /** - * zboot_run() - Run through the various steps to boot a zimage + * zboot_run_args() - Run through the various steps to boot a zimage * * Boot a zimage, given the component parts * @@ -289,8 +289,8 @@ int bootm_process_cmdline_env(int flags); * to use for booting * Return: -EFAULT on error (normally it does not return) */ -int zboot_run(ulong addr, ulong size, ulong initrd, ulong initrd_size, - ulong base, char *cmdline); +int zboot_run_args(ulong addr, ulong size, ulong initrd, ulong initrd_size, + ulong base, char *cmdline); /* * zimage_get_kernel_version() - Get the version string from a kernel -- cgit v1.2.3 From 75e85df7963f57e4bb80b3d805ba2295b1843911 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Mar 2025 17:24:58 -0700 Subject: x86: Move x86 zboot state into struct bootm_info This structure is supposed to handle any type of booting programmatically, i.e. without needing a command to be executed. Move the x86-specific members into it and use it instead of struct zboot_state. Provide a macro so access is possible without adding lots of #ifdefs to the code. This will allow the struct to be used for all four types of booting (bootm, bootz, booti and zboot). Call bootm_init() to init the state, to match other boot methods. Note that some rationalisation could be performed on this. But this is tricky since addresses are stored as strings in several places. Also some strings combine multiple arguments into one. So to keep this task somewhat manageable, we content ourselves with just getting everything into the same struct Signed-off-by: Simon Glass --- include/bootm.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'include') diff --git a/include/bootm.h b/include/bootm.h index 154fb98cfcd..5fa9761629e 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -44,6 +44,21 @@ struct cmd_tbl; * @argc: Number of arguments to the command (excluding the actual command). * This is 0 if there are no arguments * @argv: NULL-terminated list of arguments, or NULL if there are no arguments + * + * For zboot: + * @bzimage_addr: Address of the bzImage to boot, or 0 if the image has already + * been loaded and does not exist (as a cohesive whole) in memory + * @bzimage_size: Size of the bzImage, or 0 to detect this + * @initrd_addr: Address of the initial ramdisk, or 0 if none + * @initrd_size: Size of the initial ramdisk, or 0 if none + * @load_address: Address where the bzImage is moved before booting, either + * BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR + * This is set up when loading the zimage + * @base_ptr: Pointer to the boot parameters, typically at address + * DEFAULT_SETUP_BASE + * This is set up when loading the zimage + * @cmdline: Environment variable containing the 'override' command line, or + * NULL to use the one in the setup block */ struct bootm_info { const char *addr_img; @@ -54,8 +69,26 @@ struct bootm_info { const char *cmd_name; int argc; char *const *argv; + + /* zboot items */ +#ifdef CONFIG_X86 + ulong bzimage_addr; + ulong bzimage_size; + ulong initrd_addr; + ulong initrd_size; + ulong load_address; + struct boot_params *base_ptr; + const char *cmdline; +#endif }; +/* macro to allow setting fields in generic code */ +#ifdef CONFIG_X86 +#define bootm_x86_set(_bmi, _field, _val) (_bmi)->_field = (_val) +#else +#define bootm_x86_set(_bmi, _field, _val) +#endif + /** * bootm_init() - Set up a bootm_info struct with useful defaults * -- cgit v1.2.3 From 4e36b1739b03e81ff395959b58fe33e67c4d2233 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Mar 2025 17:25:00 -0700 Subject: x86: Move the bootm state for zimage into cmd/ Rather than holding the state in the implementation code, move it to the command code. The state is now passed to the implementation functions and can there (with future work) be pass in from bootstd, without going through the commands. Signed-off-by: Simon Glass --- include/bootm.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/bootm.h b/include/bootm.h index 5fa9761629e..fe7f80b88a5 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -92,6 +92,8 @@ struct bootm_info { /** * bootm_init() - Set up a bootm_info struct with useful defaults * + * @bmi: Bootm information + * * Set up the struct with default values for all members: * @boot_progress is set to true and @images is set to the global images * variable. Everything else is set to NULL except @argc which is 0 @@ -107,7 +109,7 @@ void bootm_init(struct bootm_info *bmi); * - disabled interrupts. * * @flag: Flags indicating what to do (BOOTM_STATE_...) - * bmi: Bootm information + * @bmi: Bootm information * Return: 1 on error. On success the OS boots so this function does * not return. */ @@ -340,11 +342,13 @@ const char *zimage_get_kernel_version(struct boot_params *params, * * This shows all available information in a zimage that has been loaded. * + * @bmi: Bootm information * @base_ptr: Pointer to the boot parameters, typically at address * DEFAULT_SETUP_BASE * @show_cmdline: true to show the full command line */ -void zimage_dump(struct boot_params *base_ptr, bool show_cmdline); +void zimage_dump(struct bootm_info *bmi, struct boot_params *base_ptr, + bool show_cmdline); /* * bootm_boot_start() - Boot an image at the given address -- cgit v1.2.3 From c73da92304280b229e3d8dfd565fae5a24fe3ce8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Mar 2025 17:25:02 -0700 Subject: x86: Drop the unnecessary base_ptr argument to zboot_dump() This value is include the bootm_info, so drop the unnecessary parameter. Signed-off-by: Simon Glass --- include/bootm.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/bootm.h b/include/bootm.h index fe7f80b88a5..c471615b08c 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -342,13 +342,10 @@ const char *zimage_get_kernel_version(struct boot_params *params, * * This shows all available information in a zimage that has been loaded. * - * @bmi: Bootm information - * @base_ptr: Pointer to the boot parameters, typically at address - * DEFAULT_SETUP_BASE + * @bmi: Bootm information, with valid base_ptr * @show_cmdline: true to show the full command line */ -void zimage_dump(struct bootm_info *bmi, struct boot_params *base_ptr, - bool show_cmdline); +void zimage_dump(struct bootm_info *bmi, bool show_cmdline); /* * bootm_boot_start() - Boot an image at the given address -- cgit v1.2.3 From 7f10a7fe126dce5644d933af693eda40497d7755 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Mar 2025 17:25:07 -0700 Subject: bootm: Allow building bootm.c without CONFIG_SYS_BOOTM_LEN This code cannot be compiled by boards which don't have this option. Add an accessor in the header file to avoid another #ifdef Signed-off-by: Simon Glass Reviewed-by: Quentin Schulz --- include/bootm.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/bootm.h b/include/bootm.h index c471615b08c..d174f18ac18 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -89,6 +89,14 @@ struct bootm_info { #define bootm_x86_set(_bmi, _field, _val) #endif +static inline ulong bootm_len(void) +{ +#ifdef CONFIG_SYS_BOOTM_LEN + return CONFIG_SYS_BOOTM_LEN; +#endif + return 0; +} + /** * bootm_init() - Set up a bootm_info struct with useful defaults * -- cgit v1.2.3 From 3c7b13b075488ebcff2923b0a7b46cc11f39285e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Mar 2025 17:25:08 -0700 Subject: boot: Convert IMAGE_FORMAT into an enum Use an enum so it is clearer that these options are related. Update genimg_get_format(), tidy up the function comment and move it to the header file, since it is exported. Signed-off-by: Simon Glass --- include/image.h | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/image.h b/include/image.h index c1db8383459..dc1a7c307cc 100644 --- a/include/image.h +++ b/include/image.h @@ -598,10 +598,12 @@ int boot_get_setup(struct bootm_headers *images, uint8_t arch, ulong *setup_star ulong *setup_len); /* Image format types, returned by _get_format() routine */ -#define IMAGE_FORMAT_INVALID 0x00 -#define IMAGE_FORMAT_LEGACY 0x01 /* legacy image_header based format */ -#define IMAGE_FORMAT_FIT 0x02 /* new, libfdt based format */ -#define IMAGE_FORMAT_ANDROID 0x03 /* Android boot image */ +enum image_fmt_t { + IMAGE_FORMAT_INVALID, + IMAGE_FORMAT_LEGACY, /* legacy image_header based format */ + IMAGE_FORMAT_FIT, /* new, libfdt based format */ + IMAGE_FORMAT_ANDROID, /* Android boot image */ +}; /** * genimg_get_kernel_addr_fit() - Parse FIT specifier @@ -630,7 +632,21 @@ ulong genimg_get_kernel_addr_fit(const char *const img_addr, const char **fit_uname_kernel); ulong genimg_get_kernel_addr(char * const img_addr); -int genimg_get_format(const void *img_addr); + +/** + * genimg_get_format - get image format type + * @img_addr: image start address + * Return: image format type or IMAGE_FORMAT_INVALID if no image is present + * + * genimg_get_format() checks whether provided address points to a valid + * legacy or FIT image. + * + * New uImage format and FDT blob are based on a libfdt. FDT blob + * may be passed directly or embedded in a FIT image. In both situations + * genimg_get_format() must be able to dectect libfdt header. + */ +enum image_fmt_t genimg_get_format(const void *img_addr); + int genimg_has_config(struct bootm_headers *images); /** -- cgit v1.2.3 From 098407e67390ed0c369029bab0777a51e5a7bad2 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Mar 2025 17:25:09 -0700 Subject: boot: arm: riscv: sandbox: Add a format for the booti file Arm invented a new format for arm64 and something similar is also used with RISC-V. Add this to the list of supported formats and provide a way for the format to be detected on both architectures. Update the genimg_get_format() function to support this. Fix up switch() statements which don't currently mention this format. Booti does not support a ramdisk, so this can be ignored. Signed-off-by: Simon Glass --- include/image.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/image.h b/include/image.h index dc1a7c307cc..f8f2c887a4b 100644 --- a/include/image.h +++ b/include/image.h @@ -603,6 +603,7 @@ enum image_fmt_t { IMAGE_FORMAT_LEGACY, /* legacy image_header based format */ IMAGE_FORMAT_FIT, /* new, libfdt based format */ IMAGE_FORMAT_ANDROID, /* Android boot image */ + IMAGE_FORMAT_BOOTI, /* Arm64/RISC-V boot image */ }; /** @@ -649,6 +650,14 @@ enum image_fmt_t genimg_get_format(const void *img_addr); int genimg_has_config(struct bootm_headers *images); +/** + * booti_is_valid() - Check if an image appears to be an Arm64 image + * + * @img: Pointer to image + * Return: true if the image has the Arm64 magic + */ +bool booti_is_valid(const void *img); + /** * boot_get_fpga() - Locate the FPGA image * -- cgit v1.2.3 From d6bb0ea535e4384ed1975ee9c755488f5036a79e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Mar 2025 17:25:10 -0700 Subject: boot: Support booti format in bootm At present the booti format is handled separately, in its own command. Provide a way to boot uncompressed booti images within the bootm code, so that eventually we can boot these images without CONFIG_CMDLINE Update bootm_init() to attach the images for all formats which use them. Add some debugging while we are here. Signed-off-by: Simon Glass --- include/image.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/image.h b/include/image.h index f8f2c887a4b..5b9bd6a9649 100644 --- a/include/image.h +++ b/include/image.h @@ -244,7 +244,7 @@ enum image_type_t { * New IDs *MUST* be appended at the end of the list and *NEVER* * inserted for backward compatibility. */ -enum { +enum image_comp_t { IH_COMP_NONE = 0, /* No Compression Used */ IH_COMP_GZIP, /* gzip Compression Used */ IH_COMP_BZIP2, /* bzip2 Compression Used */ -- cgit v1.2.3 From ecd50bb4643c9052e5f8b6171ab6c3905ed0ca70 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Mar 2025 17:25:11 -0700 Subject: boot: Support compressed booti images in bootm A compressed booti image relies on the compression-format's header at the start to indicate which compression algorithm is used. We don't support this elsewhere in U-Boot, so assume that a compressed file is always a booti file. Once it is compressed, a check is made to make sure that it actually is. Simplify the implementation by adding a new function which returns the booti image-type if compression is detected. Signed-off-by: Simon Glass --- include/image.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/image.h b/include/image.h index 5b9bd6a9649..2455baa6667 100644 --- a/include/image.h +++ b/include/image.h @@ -648,6 +648,17 @@ ulong genimg_get_kernel_addr(char * const img_addr); */ enum image_fmt_t genimg_get_format(const void *img_addr); +/** + * genimg_get_format_comp() - Like genimg_get_format() but adds compressed booti + * + * If a compressed file is detected (with image_decomp_type()) and + * CONFIG_CMD_BOOTI is enabled, then this returns IMAGE_FORMAT_BOOTI + * + * @img_addr: image start address + * Return: image format type or IMAGE_FORMAT_INVALID if no image is present + */ +enum image_fmt_t genimg_get_format_comp(const void *img_addr); + int genimg_has_config(struct bootm_headers *images); /** -- cgit v1.2.3 From e2e87b840162ddf4ec8df3f235be98a74a964509 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Mar 2025 17:25:14 -0700 Subject: boot: pxe: Refactor label_run_boot() to avoid cmdline Adjust the remaining call in this function to use the bootm API. This will allow PXE to work without the command line. Signed-off-by: Simon Glass --- include/bootm.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/bootm.h b/include/bootm.h index d174f18ac18..465577a66f5 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -315,6 +315,15 @@ int bootm_process_cmdline(char *buf, int maxlen, int flags); */ int bootm_process_cmdline_env(int flags); +/** + * zboot_run() - Run through the various steps to boot a zimage + * + * @bmi: Bootm information, with bzimage_size, initrd_addr, initrd_size and + * cmdline set up. If base_ptr is 0, then bzimage_addr must be set to the start + * of the bzImage. Otherwise base_ptr and load_address must be provided. + */ +int zboot_run(struct bootm_info *bmi); + /** * zboot_run_args() - Run through the various steps to boot a zimage * -- cgit v1.2.3 From 0f094b8b146679c3980cd2febde4e902bbc4405d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Mar 2025 17:25:23 -0700 Subject: net: Provide a function to run network operations Add a new netboot_run() function which can be used for simple network operations, such as loading a file. Put the implementation in an internal function, used by the existing code. Place this function into the net/ code, so that it does not need the command line to be available. Document which network operations are supported, i.e. a limited subset, for now. For the one board which uses lwip, it is not quite clear how to avoid using the cmdline interface. This will need some discussion. Signed-off-by: Simon Glass --- include/net-common.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'include') diff --git a/include/net-common.h b/include/net-common.h index 29d31f37263..210042fc337 100644 --- a/include/net-common.h +++ b/include/net-common.h @@ -474,6 +474,36 @@ int net_init(void); enum proto_t; int net_loop(enum proto_t protocol); +/* internal function: do not use! */ +int netboot_run_(enum proto_t proto, ulong addr, const char *fname, ulong size, + bool fname_explicit, bool ipv6); + +/** + * netboot_run() - Run a network operation + * + * The following proto values are NOT supported: + * PING, since net_ping_ip cannot be set + * NETCONS, since its parameters cannot bet set + * RS, since first_call cannot be set, along with perhaps other things + * UDP, since udp_ops cannot be set + * DNS, since net_dns_resolve and net_dns_env_var cannot be set + * WGET, since DNS must be done first and that is not supported + * DHCP6, since the required parameters cannot be passed in + * + * To support one of these, either add the required arguments or perhaps a + * separate function and a struct to hold the information. + * + * @proto: Operation to run: TFTPGET, FASTBOOT_UDP, FASTBOOT_TCP, BOOTP, + * TFTPPUT, RARP, NFS, DHCP + * @addr: Load/save address + * @fname: Filename + * @size: Save size (not used for TFTPGET) + * @ipv6: true to use IPv6, false to use IPv4 + * Return 0 on success, else -ve error code + */ +int netboot_run(enum proto_t proto, ulong addr, const char *fname, ulong size, + bool ipv6); + /** * dhcp_run() - Run DHCP on the current ethernet device * -- cgit v1.2.3 From b85fe01d7df253a86aa61e0a6ed88971ffe44aac Mon Sep 17 00:00:00 2001 From: Paul Barker Date: Tue, 11 Mar 2025 20:57:43 +0000 Subject: reset: rzg2l-usbphy-ctrl: Add new driver Add a new driver to control the USB 2.0 PHY reset controller on the Renesas RZ/G2L and related SoCs. Signed-off-by: Paul Barker Reviewed-by: Marek Vasut --- include/renesas/rzg2l-usbphy.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 include/renesas/rzg2l-usbphy.h (limited to 'include') diff --git a/include/renesas/rzg2l-usbphy.h b/include/renesas/rzg2l-usbphy.h new file mode 100644 index 00000000000..1a46b585f17 --- /dev/null +++ b/include/renesas/rzg2l-usbphy.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * RZ/G2L USB PHY common definitions + * + * Copyright (C) 2021-2023 Renesas Electronics Corp. + */ + +#ifndef RENESAS_RZG2L_USBPHY_H +#define RENESAS_RZG2L_USBPHY_H + +#include + +struct rzg2l_usbphy_ctrl_priv { + fdt_addr_t regs; +}; + +#endif /* RENESAS_RZG2L_USBPHY_H */ -- cgit v1.2.3 From 985dc81a1d962a04ad1084bc4fe912492c8fe463 Mon Sep 17 00:00:00 2001 From: Paul Barker Date: Fri, 28 Feb 2025 12:47:52 +0000 Subject: net: phy: Port set/clear bits from Linux To simply porting phy drivers from Linux to U-Boot, define phy_set_bits() and phy_clear_bits() functions with a similar API to those used in Linux. The U-Boot versions of these functions include the `devad` argument which is not present in the Linux versions, to keep them aligned with the other phy functions in U-Boot. Reviewed-by: Marek Vasut Signed-off-by: Paul Barker --- include/phy.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'include') diff --git a/include/phy.h b/include/phy.h index 36785031eeb..36354aaf774 100644 --- a/include/phy.h +++ b/include/phy.h @@ -333,6 +333,30 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); +/** + * phy_set_bits - Convenience function for setting bits in a PHY register + * @phydev: the phy_device struct + * @devad: The MMD to read from + * @regnum: register number to write + * @val: bits to set + */ +static inline int phy_set_bits(struct phy_device *phydev, int devad, u32 regnum, u16 val) +{ + return phy_modify(phydev, devad, regnum, 0, val); +} + +/** + * phy_clear_bits - Convenience function for clearing bits in a PHY register + * @phydev: the phy_device struct + * @devad: The MMD to write to + * @regnum: register number to write + * @val: bits to clear + */ +static inline int phy_clear_bits(struct phy_device *phydev, int devad, u32 regnum, u16 val) +{ + return phy_modify(phydev, devad, regnum, val, 0); +} + /** * U_BOOT_PHY_DRIVER() - Declare a new U-Boot driver * @__name: name of the driver -- cgit v1.2.3 From 03f61b153965101f21783e8e6a1e5e86496598ff Mon Sep 17 00:00:00 2001 From: Svyatoslav Ryhel Date: Wed, 5 Mar 2025 15:05:30 +0200 Subject: board: ouya: add Ouya Game Console support The Ouya microconsole is build on Nvidia Tegra 3 (T33) SoC, featuring a quad-core 1.7 GHz ARM Cortex-A9 CPU and a ULP GeForce GPU, paired with 1GB of DDR3 RAM and 8GB of internal flash storage. Running a modified Android 4.1 (Jelly Bean) OS with a custom launcher, it aimed for open-source gaming via a digital storefront. This implementation is mostly based on upstream Linux device tree and fragments of work done by previous developers. Co-developed-by: Peter Geis Signed-off-by: Peter Geis Signed-off-by: Svyatoslav Ryhel --- include/configs/ouya.h | 23 +++++++++++++++++++++++ include/env/nvidia/prod_upd.env | 5 +++-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 include/configs/ouya.h (limited to 'include') diff --git a/include/configs/ouya.h b/include/configs/ouya.h new file mode 100644 index 00000000000..cc86c1002e3 --- /dev/null +++ b/include/configs/ouya.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * (C) Copyright 2010,2012 + * NVIDIA Corporation + * + * (C) Copyright 2025 + * Svyatoslav Ryhel + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#include "tegra30-common.h" + +/* High-level configuration options */ +#define CFG_TEGRA_BOARD_STRING "Ouya Game Console" + +/* Board-specific serial config */ +#define CFG_SYS_NS16550_COM1 NV_PA_APB_UARTD_BASE + +#include "tegra-common-post.h" + +#endif /* __CONFIG_H */ diff --git a/include/env/nvidia/prod_upd.env b/include/env/nvidia/prod_upd.env index f4e381994be..6a457d1b75b 100644 --- a/include/env/nvidia/prod_upd.env +++ b/include/env/nvidia/prod_upd.env @@ -3,6 +3,7 @@ boot_block_size=0x1000 bootloader_file=u-boot-dtb-tegra.bin spi_size=0x400000 boot_dev=0 +boot_interface=mmc flash_uboot=echo Preparing RAM; mw ${kernel_addr_r} 0 ${boot_block_size_r}; @@ -11,9 +12,9 @@ flash_uboot=echo Preparing RAM; mmc dev 0 1; mmc read ${kernel_addr_r} 0 ${boot_block_size}; echo Reading bootloader; - if load mmc ${boot_dev}:1 ${ramdisk_addr_r} ${bootloader_file}; + if load ${boot_interface} ${boot_dev}:1 ${ramdisk_addr_r} ${bootloader_file}; then echo Calculating bootloader size; - size mmc ${boot_dev}:1 ${bootloader_file}; + size ${boot_interface} ${boot_dev}:1 ${bootloader_file}; ebtupdate ${kernel_addr_r} ${ramdisk_addr_r} ${filesize}; echo Writing bootloader to eMMC; mmc dev 0 1; -- cgit v1.2.3 From dda454e933c636b225eef325f5f2b815ed01ac2e Mon Sep 17 00:00:00 2001 From: Adam Ford Date: Tue, 18 Mar 2025 18:38:33 -0500 Subject: serial: mxc: Support bulk enabling clocks Depending on the platform, there may be multiple clock sources required to enable a UART. Use the bulk functions to get and enable the clocks when the UART probes. This can facilitate the removal of functions to manually enable the clock. This is made dependent on CLK_CCF which is used on imx6q, imx8m[mnqp], several imxrt, imx9. If/when the UART clock registration is done for older boards, this limitation could be updated. Signed-off-by: Adam Ford Reviewed-by: Peng Fan --- include/dm/platform_data/serial_mxc.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/dm/platform_data/serial_mxc.h b/include/dm/platform_data/serial_mxc.h index cc59eeb1dd1..52657aa3deb 100644 --- a/include/dm/platform_data/serial_mxc.h +++ b/include/dm/platform_data/serial_mxc.h @@ -9,6 +9,9 @@ /* Information about a serial port */ struct mxc_serial_plat { struct mxc_uart *reg; /* address of registers in physical memory */ +#if CONFIG_IS_ENABLED(CLK_CCF) + struct clk_bulk clks; +#endif bool use_dte; }; -- cgit v1.2.3 From 1054163c4dc79eef2732d1129990d47827ae1c06 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 23 Mar 2025 16:58:30 +0100 Subject: clk: Add clk_resolve_parent_clk() Add clk_resolve_parent_clk() to resolve parent clock udevice name based on clock-names DT property. This is used in SoC clock drivers to look up the clock name in clock tables, which matches a clock name in DT clock-names property, and convert it into udevice name which is used by U-Boot clock framework to look up parent clock in e.g. clk_register() using uclass_get_device_by_name(UCLASS_CLK, parent_name, &parent); Signed-off-by: Marek Vasut --- include/clk.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/clk.h b/include/clk.h index 045e923a529..a6ef4e02692 100644 --- a/include/clk.h +++ b/include/clk.h @@ -350,6 +350,15 @@ static inline int clk_get_by_name_nodev_optional(ofnode node, const char *name, return ret; } +/** + * clk_resolve_parent_clk - Determine name of clock udevice based on clock-names + * @dev: The client udevice. + * @name: The name of the clock to look up. + * + * Return name of the clock udevice which represents clock with clock-names name. + */ +const char *clk_resolve_parent_clk(struct udevice *dev, const char *name); + /** * enum clk_defaults_stage - What stage clk_set_defaults() is called at * @CLK_DEFAULTS_PRE: Called before probe. Setting of defaults for clocks owned -- cgit v1.2.3 From 54a4c83b12ae81289df93c048c4dd6f62481d242 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 23 Mar 2025 16:58:32 +0100 Subject: clk: clk-mux: Use struct udevice instead of struct device Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-mux registration. Signed-off-by: Marek Vasut --- include/linux/clk-provider.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 59f9c241b84..f27878ae6fa 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -242,7 +242,7 @@ struct clk *clk_register_divider(struct device *dev, const char *name, void __iomem *reg, u8 shift, u8 width, u8 clk_divider_flags); -struct clk *clk_register_mux(struct device *dev, const char *name, +struct clk *clk_register_mux(struct udevice *dev, const char *name, const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u8 width, -- cgit v1.2.3 From aee51ad0d945cf3ffbad143adb76aba40f66ecb7 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 23 Mar 2025 16:58:36 +0100 Subject: clk: clk-gate: Use struct udevice instead of struct device Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-gate registration. Signed-off-by: Marek Vasut --- include/linux/clk-provider.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index f27878ae6fa..e282be12897 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -105,7 +105,7 @@ struct clk_gate { #define CLK_GATE_HIWORD_MASK BIT(1) extern const struct clk_ops clk_gate_ops; -struct clk *clk_register_gate(struct device *dev, const char *name, +struct clk *clk_register_gate(struct udevice *dev, const char *name, const char *parent_name, unsigned long flags, void __iomem *reg, u8 bit_idx, u8 clk_gate_flags, spinlock_t *lock); -- cgit v1.2.3 From 45c6b6a850895b58d39ca1906a741ebc8563f4bc Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 23 Mar 2025 16:58:42 +0100 Subject: clk: clk-composite: Use struct udevice instead of struct device Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-composite registration. Signed-off-by: Marek Vasut --- include/linux/clk-provider.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index e282be12897..d44ead53079 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -223,7 +223,7 @@ struct clk_composite { #define to_clk_composite(_clk) container_of(_clk, struct clk_composite, clk) -struct clk *clk_register_composite(struct device *dev, const char *name, +struct clk *clk_register_composite(struct udevice *dev, const char *name, const char * const *parent_names, int num_parents, struct clk *mux_clk, const struct clk_ops *mux_ops, struct clk *rate_clk, const struct clk_ops *rate_ops, -- cgit v1.2.3 From e14dd5c35aa8098b024257d9ee0073d1ba6e0281 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 23 Mar 2025 16:58:48 +0100 Subject: clk: clk-divider: Use struct udevice instead of struct device Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-divider clock registration. Signed-off-by: Marek Vasut --- include/linux/clk-provider.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index d44ead53079..198f3ff0e42 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -237,7 +237,7 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name, const char *parent_name, unsigned long flags, unsigned int mult, unsigned int div); -struct clk *clk_register_divider(struct device *dev, const char *name, +struct clk *clk_register_divider(struct udevice *dev, const char *name, const char *parent_name, unsigned long flags, void __iomem *reg, u8 shift, u8 width, u8 clk_divider_flags); -- cgit v1.2.3 From 1987fa7b344bdde12e0b07194b462388fe562954 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 23 Mar 2025 16:58:51 +0100 Subject: clk: clk-fixed-factor: Use struct udevice instead of struct device Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-fixed-factor registration. Signed-off-by: Marek Vasut --- include/linux/clk-provider.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 198f3ff0e42..5ea2171492e 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -233,7 +233,7 @@ struct clk *clk_register_composite(struct udevice *dev, const char *name, int clk_register(struct clk *clk, const char *drv_name, const char *name, const char *parent_name); -struct clk *clk_register_fixed_factor(struct device *dev, const char *name, +struct clk *clk_register_fixed_factor(struct udevice *dev, const char *name, const char *parent_name, unsigned long flags, unsigned int mult, unsigned int div); -- cgit v1.2.3 From 2fb72968ce491f30b0e09fcd4486ee07b5581b33 Mon Sep 17 00:00:00 2001 From: Jimmy Ho Date: Mon, 10 Mar 2025 09:47:48 +0800 Subject: RISCV: config: Remove CFG_SYS_SDRAM_BASE Remove CFG_SYS_SDRAM_BASE so that we can get DRAM base from dt instead of compile time config. Removing this config helps the u-boot more portable. Signed-off-by: Jimmy Ho Reviewed-by: Leo Yu-Chi Liang --- include/configs/sifive-unleashed.h | 1 - include/configs/sifive-unmatched.h | 1 - 2 files changed, 2 deletions(-) (limited to 'include') diff --git a/include/configs/sifive-unleashed.h b/include/configs/sifive-unleashed.h index 2996b375723..cd8d0438ba6 100644 --- a/include/configs/sifive-unleashed.h +++ b/include/configs/sifive-unleashed.h @@ -11,7 +11,6 @@ #include -#define CFG_SYS_SDRAM_BASE 0x80000000 #define RISCV_MMODE_TIMERBASE 0x2000000 #define RISCV_MMODE_TIMEROFF 0xbff8 diff --git a/include/configs/sifive-unmatched.h b/include/configs/sifive-unmatched.h index 27e0912665b..e0064edc5c9 100644 --- a/include/configs/sifive-unmatched.h +++ b/include/configs/sifive-unmatched.h @@ -11,6 +11,5 @@ #include -#define CFG_SYS_SDRAM_BASE 0x80000000 #endif /* __SIFIVE_UNMATCHED_H */ -- cgit v1.2.3 From a8c9451f052c55648d173690bbf8f0d6d281e65a Mon Sep 17 00:00:00 2001 From: Huan Zhou Date: Tue, 11 Mar 2025 09:38:48 +0800 Subject: riscv: dt-binding: k1: Add reset driver binding definition Add dt-binding for reset driver. Signed-off-by: Huan Zhou Reviewed-by: Leo Yu-Chi Liang --- include/dt-bindings/reset/spacemit-k1-reset.h | 118 ++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 include/dt-bindings/reset/spacemit-k1-reset.h (limited to 'include') diff --git a/include/dt-bindings/reset/spacemit-k1-reset.h b/include/dt-bindings/reset/spacemit-k1-reset.h new file mode 100644 index 00000000000..74db58b27ef --- /dev/null +++ b/include/dt-bindings/reset/spacemit-k1-reset.h @@ -0,0 +1,118 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2022 Spacemit Inc. + * Copyright (C) 2025 Huan Zhou + */ + +#ifndef __DT_BINDINGS_RESET_SAPCEMIT_K1_H__ +#define __DT_BINDINGS_RESET_SAPCEMIT_K1_H__ +/* APBC */ +#define RESET_UART1 1 +#define RESET_UART2 2 +#define RESET_GPIO 3 +#define RESET_PWM0 4 +#define RESET_PWM1 5 +#define RESET_PWM2 6 +#define RESET_PWM3 7 +#define RESET_PWM4 8 +#define RESET_PWM5 9 +#define RESET_PWM6 10 +#define RESET_PWM7 11 +#define RESET_PWM8 12 +#define RESET_PWM9 13 +#define RESET_PWM10 14 +#define RESET_PWM11 15 +#define RESET_PWM12 16 +#define RESET_PWM13 17 +#define RESET_PWM14 18 +#define RESET_PWM15 19 +#define RESET_PWM16 20 +#define RESET_PWM17 21 +#define RESET_PWM18 22 +#define RESET_PWM19 23 +#define RESET_SSP3 24 +#define RESET_UART3 25 +#define RESET_RTC 26 +#define RESET_TWSI0 27 +#define RESET_TIMERS1 28 +#define RESET_AIB 29 +#define RESET_TIMERS2 30 +#define RESET_ONEWIRE 31 +#define RESET_SSPA0 32 +#define RESET_SSPA1 33 +#define RESET_DRO 34 +#define RESET_IR 35 +#define RESET_TWSI1 36 +#define RESET_TSEN 37 +#define RESET_TWSI2 38 +#define RESET_TWSI4 39 +#define RESET_TWSI5 40 +#define RESET_TWSI6 41 +#define RESET_TWSI7 42 +#define RESET_TWSI8 43 +#define RESET_IPC_AP2AUD 44 +#define RESET_UART4 45 +#define RESET_UART5 46 +#define RESET_UART6 47 +#define RESET_UART7 48 +#define RESET_UART8 49 +#define RESET_UART9 50 +#define RESET_CAN0 51 + +/* MPMU */ +#define RESET_WDT 52 + +/* APMU */ +#define RESET_JPG 53 +#define RESET_CSI 54 +#define RESET_CCIC2_PHY 55 +#define RESET_CCIC3_PHY 56 +#define RESET_ISP 57 +#define RESET_ISP_AHB 58 +#define RESET_ISP_CI 59 +#define RESET_ISP_CPP 60 +#define RESET_LCD 61 +#define RESET_DSI_ESC 62 +#define RESET_V2D 63 +#define RESET_MIPI 64 +#define RESET_LCD_SPI 65 +#define RESET_LCD_SPI_BUS 66 +#define RESET_LCD_SPI_HBUS 67 +#define RESET_LCD_MCLK 68 +#define RESET_CCIC_4X 69 +#define RESET_CCIC1_PHY 70 +#define RESET_SDH_AXI 71 +#define RESET_SDH0 72 +#define RESET_SDH1 73 +#define RESET_USB_AXI 74 +#define RESET_USBP1_AXI 75 +#define RESET_USB3_0 76 +#define RESET_QSPI 77 +#define RESET_QSPI_BUS 78 +#define RESET_DMA 79 +#define RESET_AES 80 +#define RESET_VPU 81 +#define RESET_GPU 82 +#define RESET_SDH2 83 +#define RESET_MC 84 +#define RESET_EM_AXI 85 +#define RESET_EM 86 +#define RESET_AUDIO_SYS 87 +#define RESET_HDMI 88 +#define RESET_PCIE0 89 +#define RESET_PCIE1 90 +#define RESET_PCIE2 91 +#define RESET_EMAC0 92 +#define RESET_EMAC1 93 + +/* APBC2 */ +#define RESET_SEC_UART1 94 +#define RESET_SEC_SSP2 95 +#define RESET_SEC_TWSI3 96 +#define RESET_SEC_RTC 97 +#define RESET_SEC_TIMERS0 98 +#define RESET_SEC_KPC 99 +#define RESET_SEC_GPIO 100 +#define RESET_NUMBER 101 + +#endif -- cgit v1.2.3 From 9c407347b496124849665aca6b76f48118891707 Mon Sep 17 00:00:00 2001 From: Masahisa Kojima Date: Mon, 17 Mar 2025 14:03:57 +0530 Subject: fdt: add support for adding pmem nodes One of the problems an OS may face, when running in EFI, is that a mounted ISO, after calling ExitBootServices goes away, if that ISO is resident in RAM memory as a ramdisk. ACPI has NFIT and NVDIMM support to provide ramdisks to the OS, but we don't have anything in place for DTs. Linux and device trees have support for persistent memory devices. So add a function that can inject a pmem node in a DT, so we can pass information on the ramdisk the OS. Signed-off-by: Masahisa Kojima Signed-off-by: Sughosh Ganu Reviewed-by: Ilias Apalodimas Signed-off-by: Ilias Apalodimas --- include/fdt_support.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include') diff --git a/include/fdt_support.h b/include/fdt_support.h index f0ad2e6b365..049190cf3d7 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -471,6 +471,20 @@ int fdt_valid(struct fdt_header **blobp); */ int fdt_get_cells_len(const void *blob, char *nr_cells_name); +/** + * fdt_fixup_pmem_region() - add a pmem node on the device tree + * + * This functions adds/updates a pmem node to the device tree. + * Usually used with EFI installers to preserve installer + * images + * + * @fdt: device tree provided by caller + * @addr: start address of the pmem node + * @size: size of the memory of the pmem node + * Return: 0 on success or < 0 on failure + */ +int fdt_fixup_pmem_region(void *fdt, u64 pmem_start, u64 pmem_size); + #endif /* !USE_HOSTCC */ #ifdef USE_HOSTCC -- cgit v1.2.3 From c5f6542aa8ae93b7705e27103a9fdaf8445e2915 Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Mon, 17 Mar 2025 14:03:58 +0530 Subject: efi_loader: allow for removal of memory from the EFI map With upcoming changes supporting pmem nodes, we need to remove the pmem area from the EFI memory map. Rename efi_add_memory_map_pg() to efi_update_memory_map(), and allow removing memory from the EFI memory map. Signed-off-by: Sughosh Ganu Signed-off-by: Ilias Apalodimas --- include/efi_loader.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index e9c10819ba2..5f769786786 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -878,6 +878,21 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size, /* Adds a range into the EFI memory map */ efi_status_t efi_add_memory_map(u64 start, u64 size, int memory_type); +/** + * efi_update_memory_map() - update the memory map by adding/removing pages + * + * @start: start address, must be a multiple of + * EFI_PAGE_SIZE + * @pages: number of pages to add + * @memory_type: type of memory added + * @overlap_conventional: region may only overlap free(conventional) + * memory + * @remove: remove memory map + * Return: status code + */ +efi_status_t efi_update_memory_map(u64 start, u64 pages, int memory_type, + bool overlap_conventional, bool remove); + /* Called by board init to initialize the EFI drivers */ efi_status_t efi_driver_init(void); /* Called when a block device is added */ -- cgit v1.2.3 From 54c39bf104017e3a0b30fdff6104141b719af9ef Mon Sep 17 00:00:00 2001 From: Sughosh Ganu Date: Mon, 17 Mar 2025 14:04:01 +0530 Subject: blkmap: add an attribute to preserve the mem mapping Some blkmap memory mapped devices might have to be relevant even after U-Boot passes control to the next image as part of the platform boot. An example of such a mapping would be an OS installer ISO image, information for which has to be provided to the OS kernel. Use the 'preserve' attribute for such mappings. The code for adding a pmem node to the device-tree then checks if this attribute is set, and adds a node only for mappings which have this attribute. Signed-off-by: Sughosh Ganu Reviewed-by: Tobias Waldekranz Reviewed-by: Ilias Apalodimas Signed-off-by: Ilias Apalodimas --- include/blkmap.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/blkmap.h b/include/blkmap.h index d53095437fa..754d8671b01 100644 --- a/include/blkmap.h +++ b/include/blkmap.h @@ -60,10 +60,12 @@ int blkmap_map_mem(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, * @blknr: Start block number of the mapping * @blkcnt: Number of blocks to map * @paddr: The target physical memory address of the mapping + * @preserve: Mapping intended to be preserved for subsequent stages, + * like the OS (e.g. ISO installer) * Returns: 0 on success, negative error code on failure */ int blkmap_map_pmem(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, - phys_addr_t paddr); + phys_addr_t paddr, bool preserve); /** * blkmap_from_label() - Find blkmap from label -- cgit v1.2.3 From 61e0a20aecf4af6cdc223bd8cd1bd82fe5e3d9f6 Mon Sep 17 00:00:00 2001 From: Sughosh Ganu Date: Mon, 17 Mar 2025 14:04:02 +0530 Subject: blkmap: pass information on ISO image to the OS The EFI HTTP boot puts the ISO installer image at some location in memory. Information about this image has to be passed on to the OS kernel, which is done by adding a persistent memory(pmem) node to the devicetree(DT) that is passed to the OS. The OS kernel then gets information about the presence of this ISO image and proceeds with the installation. In U-Boot, this ISO image gets mounted as a memory mapped blkmap device slice, with the 'preserve' attribute. Add a helper function which iterates through all such slices, and invokes a callback. The callback adds the pmem node to the DT and removes the corresponding memory region from the EFI memory map. Invoke this helper function as part of the DT fixup which happens before booting the OS. Signed-off-by: Sughosh Ganu Reviewed-by: Tobias Waldekranz Signed-off-by: Ilias Apalodimas --- include/blkmap.h | 29 +++++++++++++++++++++++++++++ include/efi.h | 13 +++++++++++++ 2 files changed, 42 insertions(+) (limited to 'include') diff --git a/include/blkmap.h b/include/blkmap.h index 754d8671b01..57555fda4fb 100644 --- a/include/blkmap.h +++ b/include/blkmap.h @@ -7,6 +7,7 @@ #ifndef _BLKMAP_H #define _BLKMAP_H +#include #include /** @@ -104,4 +105,32 @@ int blkmap_destroy(struct udevice *dev); int blkmap_create_ramdisk(const char *label, ulong image_addr, ulong image_size, struct udevice **devp); +/** + * blkmap_get_preserved_pmem_slices() - Look for memory mapped preserved slices + * @cb: Callback function to call for the blkmap slice + * @ctx: Argument to be passed to the callback function + * + * The function is used to iterate through all the blkmap slices, looking + * specifically for memory mapped blkmap mapping which has been + * created with the preserve attribute. The function looks for such slices + * with the relevant attributes and then calls the callback function which + * then does additional configuration as needed. The callback function is + * invoked for all the discovered slices, unless there is an error returned + * by the callback, in which case the function returns that error. + * + * The callback function has the following arguments + * @ctx: Argument to be passed to the callback function + * @addr: Start address of the memory mapped slice + * @size: Size of the memory mapped slice + * + * Typically, the callback will perform some configuration needed for the + * information passed on to it. An example of this would be setting up the + * pmem node in a device-tree(passed through the ctx argument) with the + * parameters passed on to the callback. + * + * Return: 0 on success, negative error on failure + */ +int blkmap_get_preserved_pmem_slices(int (*cb)(void *ctx, u64 addr, + u64 size), void *ctx); + #endif /* _BLKMAP_H */ diff --git a/include/efi.h b/include/efi.h index d005cb6181e..f9bbb175c3a 100644 --- a/include/efi.h +++ b/include/efi.h @@ -705,4 +705,17 @@ static inline bool efi_use_host_arch(void) */ int efi_get_pxe_arch(void); +/** + * fdt_efi_pmem_setup() - Pmem setup in DT and EFI memory map + * @fdt: Devicetree to add the pmem nodes to + * + * Iterate through all the blkmap devices, look for BLKMAP_MEM devices, + * and add pmem nodes corresponding to the blkmap slice to the + * devicetree along with removing the corresponding region from the + * EFI memory map. + * + * Returns: 0 on success, negative error on failure + */ +int fdt_efi_pmem_setup(void *fdt); + #endif /* _LINUX_EFI_H */ -- cgit v1.2.3 From 8a0e6212bb5ef547712e922a41555eb7d1aee1ab Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Fri, 17 Jan 2025 08:28:56 +0100 Subject: dm: clarify DM_FLAG_PROBE_AFTER_BIND behaviour The DM_FLAG_PROBE_AFTER_BIND flag only makes sense on a per-device basis, however recently added documentation as well as some confused drivers imply that it might be added to a driver definition, this does nothing. Clarify the new documentation and expand on the comment by the definition to point people in the right direction. Signed-off-by: Caleb Connolly Reviewed-by: Simon Glass Acked-by: Michal Simek --- include/dm/device.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/dm/device.h b/include/dm/device.h index add67f9ec06..678cd83c271 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -81,7 +81,10 @@ struct driver_info; */ #define DM_FLAG_VITAL (1 << 14) -/* Device must be probed after it was bound */ +/* Device must be probed after it was bound. This flag is per-device and does + * nothing if set on a U_BOOT_DRIVER() definition. Apply it with + * dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND) in the devices bind function. + */ #define DM_FLAG_PROBE_AFTER_BIND (1 << 15) /* -- cgit v1.2.3 From bcb8cac2d550b6decfbcb2985be276afbec296cf Mon Sep 17 00:00:00 2001 From: Anshul Dalal Date: Tue, 11 Mar 2025 10:14:12 +0530 Subject: config: falcon: move CFG_SYS_SPI_* to Kconfig CFG_SYS_SPI_* are used in falcon boot to specify the offsets and size of the respective payloads. This patch moves them to Kconfig keeping the values consistent for each of the affected boards. Reviewed-by: Tom Rini Reviewed-by: Fabio Estevam Signed-off-by: Anshul Dalal --- include/configs/am57xx_evm.h | 16 ---------------- include/configs/display5.h | 5 ----- include/configs/dra7xx_evm.h | 16 ---------------- include/configs/xea.h | 8 -------- include/configs/xilinx_zynqmp.h | 6 ------ include/configs/zynq-common.h | 8 -------- 6 files changed, 59 deletions(-) (limited to 'include') diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h index aa31f3b05a0..266b77fbf68 100644 --- a/include/configs/am57xx_evm.h +++ b/include/configs/am57xx_evm.h @@ -37,20 +37,4 @@ /* CPSW Ethernet */ -/* - * Default to using SPI for environment, etc. - * 0x000000 - 0x040000 : QSPI.SPL (256KiB) - * 0x040000 - 0x140000 : QSPI.u-boot (1MiB) - * 0x140000 - 0x1C0000 : QSPI.u-boot-spl-os (512KiB) - * 0x1C0000 - 0x1D0000 : QSPI.u-boot-env (64KiB) - * 0x1D0000 - 0x1E0000 : QSPI.u-boot-env.backup1 (64KiB) - * 0x1E0000 - 0x9E0000 : QSPI.kernel (8MiB) - * 0x9E0000 - 0x2000000 : USERLAND - */ -#define CFG_SYS_SPI_KERNEL_OFFS 0x1E0000 -#define CFG_SYS_SPI_ARGS_OFFS 0x140000 -#define CFG_SYS_SPI_ARGS_SIZE 0x80000 - -/* SPI SPL */ - #endif /* __CONFIG_AM57XX_EVM_H */ diff --git a/include/configs/display5.h b/include/configs/display5.h index 98b1e5af2c0..19d71d6066f 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -29,11 +29,6 @@ * 0x1F00000 - 0x2000000 : SPI.factory (1MiB) */ -/* Below values are "dummy" - only to avoid build break */ -#define CFG_SYS_SPI_KERNEL_OFFS 0x150000 -#define CFG_SYS_SPI_ARGS_OFFS 0x140000 -#define CFG_SYS_SPI_ARGS_SIZE 0x10000 - #define CFG_MXC_UART_BASE UART5_BASE /* MMC Configs */ diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h index 96dcd731cb6..3c960ca2ce2 100644 --- a/include/configs/dra7xx_evm.h +++ b/include/configs/dra7xx_evm.h @@ -47,22 +47,6 @@ #include -/* - * Default to using SPI for environment, etc. - * 0x000000 - 0x040000 : QSPI.SPL (256KiB) - * 0x040000 - 0x140000 : QSPI.u-boot (1MiB) - * 0x140000 - 0x1C0000 : QSPI.u-boot-spl-os (512KiB) - * 0x1C0000 - 0x1D0000 : QSPI.u-boot-env (64KiB) - * 0x1D0000 - 0x1E0000 : QSPI.u-boot-env.backup1 (64KiB) - * 0x1E0000 - 0x9E0000 : QSPI.kernel (8MiB) - * 0x9E0000 - 0x2000000 : USERLAND - */ -#define CFG_SYS_SPI_KERNEL_OFFS 0x1E0000 -#define CFG_SYS_SPI_ARGS_OFFS 0x140000 -#define CFG_SYS_SPI_ARGS_SIZE 0x80000 - -/* SPI SPL */ - /* NAND support */ #ifdef CONFIG_MTD_RAW_NAND /* NAND: device related configs */ diff --git a/include/configs/xea.h b/include/configs/xea.h index 00d62748733..21454d13d21 100644 --- a/include/configs/xea.h +++ b/include/configs/xea.h @@ -12,14 +12,6 @@ #ifndef __CONFIGS_XEA_H__ #define __CONFIGS_XEA_H__ -#include - -/* SPL */ - -#define CFG_SYS_SPI_KERNEL_OFFS SZ_1M -#define CFG_SYS_SPI_ARGS_OFFS SZ_512K -#define CFG_SYS_SPI_ARGS_SIZE SZ_32K - /* Memory configuration */ #define PHYS_SDRAM_1 0x40000000 /* Base address */ #define PHYS_SDRAM_1_SIZE 0x10000000 /* Max 256 MB RAM */ diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h index 13941ba3589..ec78f2ee8ed 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -194,12 +194,6 @@ "dfu_bufsiz=0x1000\0" #endif -#if defined(CONFIG_SPL_SPI_FLASH_SUPPORT) -# define CFG_SYS_SPI_KERNEL_OFFS 0x80000 -# define CFG_SYS_SPI_ARGS_OFFS 0xa0000 -# define CFG_SYS_SPI_ARGS_SIZE 0xa0000 -#endif - #ifdef CONFIG_SPL_SYS_MALLOC_SIMPLE # error "Disable CONFIG_SPL_SYS_MALLOC_SIMPLE. Full malloc needs to be used" #endif diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h index 37c77aa1611..93ae5891a07 100644 --- a/include/configs/zynq-common.h +++ b/include/configs/zynq-common.h @@ -191,14 +191,6 @@ /* Not using MMC raw mode - just for compilation purpose */ -/* qspi mode is working fine */ -#ifdef CONFIG_ZYNQ_QSPI -#define CFG_SYS_SPI_ARGS_OFFS 0x200000 -#define CFG_SYS_SPI_ARGS_SIZE 0x80000 -#define CFG_SYS_SPI_KERNEL_OFFS (CFG_SYS_SPI_ARGS_OFFS + \ - CFG_SYS_SPI_ARGS_SIZE) -#endif - /* SP location before relocation, must use scratch RAM */ /* 3 * 64kB blocks of OCM - one is on the top because of bootrom */ -- cgit v1.2.3 From 793e327e2ca947a293c0eb5beb5eef27744385f0 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 14 Mar 2025 19:59:21 +0100 Subject: airoha: Add initial support for Airoha AN7581 SoC Add initial support for Airoha AN7581 SoC. This adds the initial Kconfig and Makefile entry for the SoC, an U-Boot specific DTSI and initial config for it. Also add the initial code for CPU and RAM initialization. Signed-off-by: Christian Marangi --- include/configs/an7581.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 include/configs/an7581.h (limited to 'include') diff --git a/include/configs/an7581.h b/include/configs/an7581.h new file mode 100644 index 00000000000..64f04c9d9a5 --- /dev/null +++ b/include/configs/an7581.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Configuration for Airoha AN7581 + */ + +#ifndef __AN7581_H +#define __AN7581_H + +#include + +#define CFG_SYS_UBOOT_BASE CONFIG_TEXT_BASE + +#define CFG_SYS_INIT_RAM_ADDR CONFIG_TEXT_BASE +#define CFG_SYS_INIT_RAM_SIZE SZ_2M + +/* DRAM */ +#define CFG_SYS_SDRAM_BASE 0x80000000 + +#endif -- cgit v1.2.3 From be96ac51ec68fe669c33b1d0ffe5c1aed06afebe Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 17 Mar 2025 04:12:43 +0100 Subject: linux: Add generic struct stat {} Add generic implementation of struct stat {} imported from Linux 6.13.y commit 27560b371ab8 ("fs: pack struct kstat better"). This can be used by filesystem code imported from elsewhere. Now struct stat {} becomes available on all supported architectures. Signed-off-by: Marek Vasut --- include/linux/stat.h | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/linux/stat.h b/include/linux/stat.h index 5eba6334e60..b65bff7e97d 100644 --- a/include/linux/stat.h +++ b/include/linux/stat.h @@ -65,9 +65,7 @@ struct stat { unsigned long __unused5; }; -#endif /* __PPC__ */ - -#if defined (__ARM__) || defined (__I386__) || defined (__M68K__) || defined (__bfin__) ||\ +#elif defined (__ARM__) || defined (__I386__) || defined (__M68K__) || defined (__bfin__) ||\ defined (__microblaze__) || defined (__nios2__) struct stat { @@ -93,9 +91,7 @@ struct stat { unsigned long __unused5; }; -#endif /* __ARM__ */ - -#if defined (__MIPS__) +#elif defined (__MIPS__) struct stat { dev_t st_dev; @@ -124,9 +120,7 @@ struct stat { long st_pad4[14]; }; -#endif /* __MIPS__ */ - -#if defined(__SH__) || defined(__XTENSA__) +#elif defined(__SH__) || defined(__XTENSA__) struct stat { unsigned long st_dev; @@ -149,7 +143,38 @@ struct stat { unsigned long __unused5; }; -#endif /* __SH__ || __XTENSA__ */ +#else + +/* + * Everybody gets this wrong and has to stick with it for all + * eternity. Hopefully, this version gets used by new architectures + * so they don't fall into the same traps. + * + */ +struct stat { + unsigned long st_dev; /* Device. */ + unsigned long st_ino; /* File serial number. */ + unsigned int st_mode; /* File mode. */ + unsigned int st_nlink; /* Link count. */ + unsigned int st_uid; /* User ID of the file's owner. */ + unsigned int st_gid; /* Group ID of the file's group. */ + unsigned long st_rdev; /* Device number, if device. */ + unsigned long __pad1; + long st_size; /* Size of file, in bytes. */ + int st_blksize; /* Optimal block size for I/O. */ + int __pad2; + long st_blocks; /* Number 512-byte blocks allocated. */ + long st_atime; /* Time of last access. */ + unsigned long st_atime_nsec; + long st_mtime; /* Time of last modification. */ + unsigned long st_mtime_nsec; + long st_ctime; /* Time of last status change. */ + unsigned long st_ctime_nsec; + unsigned int __unused4; + unsigned int __unused5; +}; + +#endif #ifdef __cplusplus } -- cgit v1.2.3 From 9e0e0ff2601d76b0f9b6fed40c55967b1256c427 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 17 Mar 2025 04:12:44 +0100 Subject: fs: Add generic fs_devread() implementation Add generic implementation of write into a block device to be used by filesystem implementations. This is a pair function for already existing fs_devread(). Signed-off-by: Marek Vasut --- include/fs_internal.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/fs_internal.h b/include/fs_internal.h index 07f6bc5ea40..351582db61a 100644 --- a/include/fs_internal.h +++ b/include/fs_internal.h @@ -12,5 +12,7 @@ int fs_devread(struct blk_desc *, struct disk_partition *, lbaint_t, int, int, char *); +int fs_devwrite(struct blk_desc *, struct disk_partition *, lbaint_t, int, int, + const char *); #endif /* __U_BOOT_FS_INTERNAL_H__ */ -- cgit v1.2.3 From b86a651b646c0c676ab2746344edb2d7e5d81e98 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 17 Mar 2025 04:12:46 +0100 Subject: fs: exfat: Add U-Boot porting layer Add U-Boot adjustments to the libexfat code and integrate the result into U-Boot filesystem layer. This provides full read-write exfat support for U-Boot available via generic filesystem interface. FS_DIRENT_NAME_LEN is increased to 1024 in case exfat is enabled, because EXFAT can use UTF16 names, which do not fit into current FS_DIRENT_NAME_LEN. To avoid affecting every configuration, increase FS_DIRENT_NAME_LEN only in case EXFAT is enabled. Example usage via sandbox, assuming disk.img with one exfat partition: Drive info: $ ./u-boot -Tc 'host bind 0 ../disk.img ; host info 0' dev blocks blksz label path 0 262144 512 0 ../disk.img List files: $ ./u-boot -Tc 'host bind 0 ../disk.img ; ls host 0:1 /api' 475 Kconfig 230 Makefile 1873 README ... 10 file(s), 0 dir(s) Load and checksum a file: $ ./u-boot -Tc 'host bind 0 ../disk.img ; load host 0:1 $loadaddr .config ; \ crc32 $loadaddr $filesize' 56724 bytes read in 1 ms (54.1 MiB/s) crc32 for 00000000 ... 0000dd93 ==> b2e847c9 $ crc32 .config b2e847c9 Load .config file to RAM, store the file into FS as /newconfig, load the /newconfig into RAM and checksum the file: $ ./u-boot -Tc 'host bind 0 ../disk.img ; load host 0:1 $loadaddr .config ; \ save host 0:1 $loadaddr /newconfig $filesize ; \ load host 0:1 0x10000 /newconfig ; \ crc32 0x10000 $filesize' 56724 bytes read in 1 ms (54.1 MiB/s) 56724 bytes written in 0 ms 56724 bytes read in 0 ms crc32 for 00010000 ... 0001dd93 ==> b2e847c9 Remove file 3.txt and create new directory /newdir: $ ./u-boot -Tc 'host bind 0 ../disk.img ; ls host 0:1 / ; \ rm host 0:1 3.txt ; mkdir host 0:1 /newdir ; \ ls host 0:1 /' ... 0 1.txt 0 2.txt 0 3.txt 0 4.txt 0 5.txt 7 file(s), 4 dir(s) ... 0 1.txt 0 2.txt newdir/ 0 4.txt 0 5.txt 6 file(s), 5 dir(s) Acked-by: Tom Rini Signed-off-by: Marek Vasut --- include/exfat.h | 24 ++++++++++++++++++++++++ include/fs.h | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 include/exfat.h (limited to 'include') diff --git a/include/exfat.h b/include/exfat.h new file mode 100644 index 00000000000..7e43beeb348 --- /dev/null +++ b/include/exfat.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _EXFAT_H_ +#define _EXFAT_H_ + +struct disk_partition; + +int exfat_fs_opendir(const char *filename, struct fs_dir_stream **dirsp); +int exfat_fs_readdir(struct fs_dir_stream *dirs, struct fs_dirent **dentp); +int exfat_fs_ls(const char *dirname); +int exfat_fs_probe(struct blk_desc *fs_dev_desc, + struct disk_partition *fs_partition); +int exfat_fs_read(const char *filename, void *buf, loff_t offset, + loff_t len, loff_t *actread); +int exfat_fs_size(const char *filename, loff_t *size); +int exfat_fs_exists(const char *filename); +void exfat_fs_close(void); +void exfat_fs_closedir(struct fs_dir_stream *dirs); + +int exfat_fs_unlink(const char *filename); +int exfat_fs_mkdir(const char *dirname); +int exfat_fs_write(const char *filename, void *buf, loff_t offset, + loff_t len, loff_t *actwrite); + +#endif /* _EXFAT_H */ diff --git a/include/fs.h b/include/fs.h index 54449faf2e5..731aaa02637 100644 --- a/include/fs.h +++ b/include/fs.h @@ -18,6 +18,7 @@ struct cmd_tbl; #define FS_TYPE_SQUASHFS 6 #define FS_TYPE_EROFS 7 #define FS_TYPE_SEMIHOSTING 8 +#define FS_TYPE_EXFAT 9 struct blk_desc; @@ -173,7 +174,7 @@ int fs_write(const char *filename, ulong addr, loff_t offset, loff_t len, #define FS_DT_REG 8 /* regular file */ #define FS_DT_LNK 10 /* symbolic link */ -#define FS_DIRENT_NAME_LEN 256 +#define FS_DIRENT_NAME_LEN CONFIG_IS_ENABLED(FS_EXFAT, (1024), (256)) /** * struct fs_dirent - directory entry -- cgit v1.2.3 From 96aa0719b7af4da74197122ac0d7f644023786c1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 15 Mar 2025 14:25:22 +0000 Subject: sandbox: Correct a typo in mapmem This should say 'cast', not 'case', so fix it. Signed-off-by: Simon Glass --- include/mapmem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/mapmem.h b/include/mapmem.h index f496c96d16c..8ec03d59f0b 100644 --- a/include/mapmem.h +++ b/include/mapmem.h @@ -33,7 +33,7 @@ static inline phys_addr_t map_to_sysmem(const void *ptr) * nomap_sysmem() - pass through an address unchanged * * This is used to indicate an address which should NOT be mapped, e.g. in - * SMBIOS tables. Using this function instead of a case shows that the sandbox + * SMBIOS tables. Using this function instead of a cast shows that the sandbox * conversion has been done */ static inline void *nomap_sysmem(phys_addr_t paddr, unsigned long len) -- cgit v1.2.3 From 8d6097d30041e8b0f0238a30e877967895f738f3 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 15 Mar 2025 14:25:57 +0000 Subject: acpi: Mark struct acpi_rsdp as packed At present the size of this struct is too large on 64-bit machines. Annotate it with __packed to fix this. Signed-off-by: Simon Glass --- include/acpi/acpi_table.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/acpi/acpi_table.h b/include/acpi/acpi_table.h index b8b1f1338c6..8ef19adc990 100644 --- a/include/acpi/acpi_table.h +++ b/include/acpi/acpi_table.h @@ -36,7 +36,7 @@ struct acpi_ctx; * RSDP (Root System Description Pointer) * Note: ACPI 1.0 didn't have length, xsdt_address, and ext_checksum */ -struct acpi_rsdp { +struct __packed acpi_rsdp { char signature[8]; /* RSDP signature */ u8 checksum; /* Checksum of the first 20 bytes */ char oem_id[6]; /* OEM ID */ -- cgit v1.2.3 From 6acb0d28b06c408740e8b80e4015e1e656c7faf4 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 15 Mar 2025 14:25:58 +0000 Subject: boot: Consider non-bootable partitions Any 'bootable' flag in a DOS partition causes boostd to only scan bootable partitions for that media. This can mean that extlinux.conf files on the root disk are missed. Put this logic behind a flag and update the documentation. For now, the flag is enabled, to preserve the existing behaviour of bootstd which is to ignore non-bootable partitions so long as there is at least one bootable partition on the disk. Future work may provide a command (or some other mechanism) to control this. Signed-off-by: Simon Glass --- include/bootflow.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/bootflow.h b/include/bootflow.h index 480cf8a5af1..d408b8c85bd 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -160,6 +160,7 @@ struct bootflow_img { * before using it * @BOOTFLOWIF_ALL: Return bootflows with errors as well * @BOOTFLOWIF_HUNT: Hunt for new bootdevs using the bootdrv hunters + * @BOOTFLOWIF_ONLY_BOOTABLE: Only consider partitions marked 'bootable' * * Internal flags: * @BOOTFLOWIF_SINGLE_DEV: (internal) Just scan one bootdev @@ -176,6 +177,7 @@ enum bootflow_iter_flags_t { BOOTFLOWIF_SHOW = 1 << 1, BOOTFLOWIF_ALL = 1 << 2, BOOTFLOWIF_HUNT = 1 << 3, + BOOTFLOWIF_ONLY_BOOTABLE = BIT(4), /* * flags used internally by standard boot - do not set these when -- cgit v1.2.3 From 199648bac156daaaad1c66c52dcd33250a272e69 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 15 Mar 2025 14:25:59 +0000 Subject: boot: Handle running out of labels If only a single label is provided in the list, bootdev_next_label() does not operate correctly and reads beyond the end of the pointer list. Fix this by adding a new check. Also add a note to convert this array to an alist Signed-off-by: Simon Glass --- include/bootstd.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/bootstd.h b/include/bootstd.h index 3398e48e88b..2bc464756dd 100644 --- a/include/bootstd.h +++ b/include/bootstd.h @@ -22,6 +22,9 @@ struct udevice; * This is attached to the (only) bootstd device, so there is only one instance * of this struct. It provides overall information about bootdevs and bootflows. * + * TODO(sjg@chromium.org): Convert prefixes, bootdev_order and env_order to use + * alist + * * @prefixes: NULL-terminated list of prefixes to use for bootflow filenames, * e.g. "/", "/boot/"; NULL if none * @bootdev_order: Order to use for bootdevs (or NULL if none), with each item -- cgit v1.2.3 From 4662e5286aa259e158f314157d0d8f2ad213a321 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 18 Mar 2025 16:20:42 +0100 Subject: membuff: Rename functions to have membuf_ prefix The double 'f' is not necessary and is a bit annoying as elsewhere in U-Boot we use 'buf'. Rename all the functions before it is used more widely. Signed-off-by: Simon Glass --- include/membuff.h | 82 +++++++++++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'include') diff --git a/include/membuff.h b/include/membuff.h index 4eba626ce1c..c7370e1c072 100644 --- a/include/membuff.h +++ b/include/membuff.h @@ -6,8 +6,8 @@ * Copyright (c) 1992 Simon Glass */ -#ifndef _MEMBUFF_H -#define _MEMBUFF_H +#ifndef _membuf_H +#define _membuf_H /** * @struct membuff: holds the state of a membuff - it is used for input and @@ -37,16 +37,16 @@ struct membuff { }; /** - * membuff_purge() - reset a membuff to the empty state + * membuf_purge() - reset a membuff to the empty state * * Initialise head and tail pointers so that the membuff becomes empty. * * @mb: membuff to purge */ -void membuff_purge(struct membuff *mb); +void membuf_purge(struct membuff *mb); /** - * membuff_putraw() - find out where bytes can be written + * membuf_putraw() - find out where bytes can be written * * Work out where in the membuff some data could be written. Return a pointer * to the address and the number of bytes which can be written there. If @@ -64,10 +64,10 @@ void membuff_purge(struct membuff *mb); * @data: the address data can be written to * Return: number of bytes which can be written */ -int membuff_putraw(struct membuff *mb, int maxlen, bool update, char **data); +int membuf_putraw(struct membuff *mb, int maxlen, bool update, char **data); /** - * membuff_getraw() - find and return a pointer to available bytes + * membuf_getraw() - find and return a pointer to available bytes * * Returns a pointer to any valid input data in the given membuff and * optionally marks it as read. Note that not all input data may not be @@ -82,37 +82,37 @@ int membuff_putraw(struct membuff *mb, int maxlen, bool update, char **data); * @data: returns address of data in input membuff * Return: the number of bytes available at *@data */ -int membuff_getraw(struct membuff *mb, int maxlen, bool update, char **data); +int membuf_getraw(struct membuff *mb, int maxlen, bool update, char **data); /** - * membuff_putbyte() - Writes a byte to a membuff + * membuf_putbyte() - Writes a byte to a membuff * * @mb: membuff to adjust * @ch: byte to write * Return: true on success, false if membuff is full */ -bool membuff_putbyte(struct membuff *mb, int ch); +bool membuf_putbyte(struct membuff *mb, int ch); /** * @mb: membuff to adjust - * membuff_getbyte() - Read a byte from the membuff + * membuf_getbyte() - Read a byte from the membuff * Return: the byte read, or -1 if the membuff is empty */ -int membuff_getbyte(struct membuff *mb); +int membuf_getbyte(struct membuff *mb); /** - * membuff_peekbyte() - check the next available byte + * membuf_peekbyte() - check the next available byte * - * Return the next byte which membuff_getbyte() would return, without + * Return the next byte which membuf_getbyte() would return, without * removing it from the membuff. * * @mb: membuff to adjust * Return: the byte peeked, or -1 if the membuff is empty */ -int membuff_peekbyte(struct membuff *mb); +int membuf_peekbyte(struct membuff *mb); /** - * membuff_get() - get data from a membuff + * membuf_get() - get data from a membuff * * Copies any available data (up to @maxlen bytes) to @buff and removes it * from the membuff. @@ -122,10 +122,10 @@ int membuff_peekbyte(struct membuff *mb); * @maxlen: maximum number of bytes to read * Return: the number of bytes read */ -int membuff_get(struct membuff *mb, char *buff, int maxlen); +int membuf_get(struct membuff *mb, char *buff, int maxlen); /** - * membuff_put() - write data to a membuff + * membuf_put() - write data to a membuff * * Writes some data to a membuff. Returns the number of bytes added. If this * is less than @lnehgt, then the membuff got full @@ -135,36 +135,36 @@ int membuff_get(struct membuff *mb, char *buff, int maxlen); * @length: number of bytes to write from 'data' * Return: the number of bytes added */ -int membuff_put(struct membuff *mb, const char *buff, int length); +int membuf_put(struct membuff *mb, const char *buff, int length); /** - * membuff_isempty() - check if a membuff is empty + * membuf_isempty() - check if a membuff is empty * * @mb: membuff to check * Return: true if empty, else false */ -bool membuff_isempty(struct membuff *mb); +bool membuf_isempty(struct membuff *mb); /** - * membuff_avail() - check available data in a membuff + * membuf_avail() - check available data in a membuff * * @mb: membuff to check * Return: number of bytes of data available */ -int membuff_avail(struct membuff *mb); +int membuf_avail(struct membuff *mb); /** - * membuff_size() - get the size of a membuff + * membuf_size() - get the size of a membuff * * Note that a membuff can only old data up to one byte less than its size. * * @mb: membuff to check * Return: total size */ -int membuff_size(struct membuff *mb); +int membuf_size(struct membuff *mb); /** - * membuff_makecontig() - adjust all membuff data to be contiguous + * membuf_makecontig() - adjust all membuff data to be contiguous * * This places all data in a membuff into a single contiguous lump, if * possible @@ -172,18 +172,18 @@ int membuff_size(struct membuff *mb); * @mb: membuff to adjust * Return: true on success */ -bool membuff_makecontig(struct membuff *mb); +bool membuf_makecontig(struct membuff *mb); /** - * membuff_free() - find the number of bytes that can be written to a membuff + * membuf_free() - find the number of bytes that can be written to a membuff * * @mb: membuff to check * Return: returns the number of bytes free in a membuff */ -int membuff_free(struct membuff *mb); +int membuf_free(struct membuff *mb); /** - * membuff_readline() - read a line of text from a membuff + * membuf_readline() - read a line of text from a membuff * * Reads a line of text of up to 'maxlen' characters from a membuff and puts * it in @str. Any character less than @minch is assumed to be the end of @@ -196,10 +196,10 @@ int membuff_free(struct membuff *mb); * Return: number of bytes read (including terminator) if a line has been * read, 0 if nothing was there or line didn't fit when must_fit is set */ -int membuff_readline(struct membuff *mb, char *str, int maxlen, int minch, bool must_fit); +int membuf_readline(struct membuff *mb, char *str, int maxlen, int minch, bool must_fit); /** - * membuff_extend_by() - expand a membuff + * membuf_extend_by() - expand a membuff * * Extends a membuff by the given number of bytes * @@ -209,38 +209,38 @@ int membuff_readline(struct membuff *mb, char *str, int maxlen, int minch, bool * Return: 0 if the expand succeeded, -ENOMEM if not enough memory, -E2BIG * if the the size would exceed @max */ -int membuff_extend_by(struct membuff *mb, int by, int max); +int membuf_extend_by(struct membuff *mb, int by, int max); /** - * membuff_init() - set up a new membuff using an existing membuff + * membuf_init() - set up a new membuff using an existing membuff * * @mb: membuff to set up * @buff: Address of buffer * @size: Size of buffer */ -void membuff_init(struct membuff *mb, char *buff, int size); +void membuf_init(struct membuff *mb, char *buff, int size); /** - * membuff_uninit() - clear a membuff so it can no longer be used + * membuf_uninit() - clear a membuff so it can no longer be used * * @mb: membuff to uninit */ -void membuff_uninit(struct membuff *mb); +void membuf_uninit(struct membuff *mb); /** - * membuff_new() - create a new membuff + * membuf_new() - create a new membuff * * @mb: membuff to init * @size: size of membuff to create * Return: 0 if OK, -ENOMEM if out of memory */ -int membuff_new(struct membuff *mb, int size); +int membuf_new(struct membuff *mb, int size); /** - * membuff_dispose() - free memory allocated to a membuff and uninit it + * membuf_dispose() - free memory allocated to a membuff and uninit it * * @mb: membuff to dispose */ -void membuff_dispose(struct membuff *mb); +void membuf_dispose(struct membuff *mb); #endif -- cgit v1.2.3 From 9ca1789ff099a364c6e16dcb6f6ad2e8677f32f1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 18 Mar 2025 16:20:43 +0100 Subject: membuff: Rename the files to membuf Rename the C and header files to use the membuf basename, to match the functions. Add a MAINTAINERS entry while we are here. Signed-off-by: Simon Glass --- include/asm-generic/global_data.h | 2 +- include/membuf.h | 246 ++++++++++++++++++++++++++++++++++++++ include/membuff.h | 246 -------------------------------------- 3 files changed, 247 insertions(+), 247 deletions(-) create mode 100644 include/membuf.h delete mode 100644 include/membuff.h (limited to 'include') diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 789adf2c3f9..18d94592b03 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/membuf.h b/include/membuf.h new file mode 100644 index 00000000000..c7370e1c072 --- /dev/null +++ b/include/membuf.h @@ -0,0 +1,246 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2015 Google, Inc + * Written by Simon Glass + * + * Copyright (c) 1992 Simon Glass + */ + +#ifndef _membuf_H +#define _membuf_H + +/** + * @struct membuff: holds the state of a membuff - it is used for input and + * output buffers. The buffer extends from @start to (@start + @size - 1). + * Data in the buffer extends from @tail to @head: it is written in at + * @head and read out from @tail. The membuff is empty when @head == @tail + * and full when adding another character would make @head == @tail. We + * therefore waste one character in the membuff to avoid having an extra flag + * to determine whether (when @head == @tail) the membuff is empty or full. + * + * xxxxxx data + * ...... empty + * + * .............xxxxxxxxxxxxxxxx......................... + * ^ ^ + * tail head + * + * xxxxxxxxxxxxx................xxxxxxxxxxxxxxxxxxxxxxxxx + * ^ ^ + * head tail + */ +struct membuff { + char *start; /** the start of the buffer */ + char *end; /** the end of the buffer (start + length) */ + char *head; /** current buffer head */ + char *tail; /** current buffer tail */ +}; + +/** + * membuf_purge() - reset a membuff to the empty state + * + * Initialise head and tail pointers so that the membuff becomes empty. + * + * @mb: membuff to purge + */ +void membuf_purge(struct membuff *mb); + +/** + * membuf_putraw() - find out where bytes can be written + * + * Work out where in the membuff some data could be written. Return a pointer + * to the address and the number of bytes which can be written there. If + * @update is true, the caller must then write the data immediately, since + * the membuff is updated as if the write has been done, + * + * Note that because the spare space in a membuff may not be contiguous, this + * function may not return @maxlen even if there is enough space in the + * membuff. However, by calling this function twice (with @update == true), + * you will get access to all the spare space. + * + * @mb: membuff to adjust + * @maxlen: the number of bytes we want to write + * @update: true to update the membuff as if the write happened, false to not + * @data: the address data can be written to + * Return: number of bytes which can be written + */ +int membuf_putraw(struct membuff *mb, int maxlen, bool update, char **data); + +/** + * membuf_getraw() - find and return a pointer to available bytes + * + * Returns a pointer to any valid input data in the given membuff and + * optionally marks it as read. Note that not all input data may not be + * returned, since data is not necessarily contiguous in the membuff. However, + * if you call this function twice (with @update == true) you are guaranteed + * to get all available data, in at most two installments. + * + * @mb: membuff to adjust + * @maxlen: maximum number of bytes to get + * @update: true to update the membuff as if the bytes have been read (use + * false to check bytes without reading them) + * @data: returns address of data in input membuff + * Return: the number of bytes available at *@data + */ +int membuf_getraw(struct membuff *mb, int maxlen, bool update, char **data); + +/** + * membuf_putbyte() - Writes a byte to a membuff + * + * @mb: membuff to adjust + * @ch: byte to write + * Return: true on success, false if membuff is full + */ +bool membuf_putbyte(struct membuff *mb, int ch); + +/** + * @mb: membuff to adjust + * membuf_getbyte() - Read a byte from the membuff + * Return: the byte read, or -1 if the membuff is empty + */ +int membuf_getbyte(struct membuff *mb); + +/** + * membuf_peekbyte() - check the next available byte + * + * Return the next byte which membuf_getbyte() would return, without + * removing it from the membuff. + * + * @mb: membuff to adjust + * Return: the byte peeked, or -1 if the membuff is empty + */ +int membuf_peekbyte(struct membuff *mb); + +/** + * membuf_get() - get data from a membuff + * + * Copies any available data (up to @maxlen bytes) to @buff and removes it + * from the membuff. + * + * @mb: membuff to adjust + * @Buff: address of membuff to transfer bytes to + * @maxlen: maximum number of bytes to read + * Return: the number of bytes read + */ +int membuf_get(struct membuff *mb, char *buff, int maxlen); + +/** + * membuf_put() - write data to a membuff + * + * Writes some data to a membuff. Returns the number of bytes added. If this + * is less than @lnehgt, then the membuff got full + * + * @mb: membuff to adjust + * @data: the data to write + * @length: number of bytes to write from 'data' + * Return: the number of bytes added + */ +int membuf_put(struct membuff *mb, const char *buff, int length); + +/** + * membuf_isempty() - check if a membuff is empty + * + * @mb: membuff to check + * Return: true if empty, else false + */ +bool membuf_isempty(struct membuff *mb); + +/** + * membuf_avail() - check available data in a membuff + * + * @mb: membuff to check + * Return: number of bytes of data available + */ +int membuf_avail(struct membuff *mb); + +/** + * membuf_size() - get the size of a membuff + * + * Note that a membuff can only old data up to one byte less than its size. + * + * @mb: membuff to check + * Return: total size + */ +int membuf_size(struct membuff *mb); + +/** + * membuf_makecontig() - adjust all membuff data to be contiguous + * + * This places all data in a membuff into a single contiguous lump, if + * possible + * + * @mb: membuff to adjust + * Return: true on success + */ +bool membuf_makecontig(struct membuff *mb); + +/** + * membuf_free() - find the number of bytes that can be written to a membuff + * + * @mb: membuff to check + * Return: returns the number of bytes free in a membuff + */ +int membuf_free(struct membuff *mb); + +/** + * membuf_readline() - read a line of text from a membuff + * + * Reads a line of text of up to 'maxlen' characters from a membuff and puts + * it in @str. Any character less than @minch is assumed to be the end of + * line character + * + * @mb: membuff to adjust + * @str: Place to put the line + * @maxlen: Maximum line length (excluding terminator) + * @must_fit: If true then str is empty if line doesn't fit + * Return: number of bytes read (including terminator) if a line has been + * read, 0 if nothing was there or line didn't fit when must_fit is set + */ +int membuf_readline(struct membuff *mb, char *str, int maxlen, int minch, bool must_fit); + +/** + * membuf_extend_by() - expand a membuff + * + * Extends a membuff by the given number of bytes + * + * @mb: membuff to adjust + * @by: Number of bytes to increase the size by + * @max: Maximum size to allow + * Return: 0 if the expand succeeded, -ENOMEM if not enough memory, -E2BIG + * if the the size would exceed @max + */ +int membuf_extend_by(struct membuff *mb, int by, int max); + +/** + * membuf_init() - set up a new membuff using an existing membuff + * + * @mb: membuff to set up + * @buff: Address of buffer + * @size: Size of buffer + */ +void membuf_init(struct membuff *mb, char *buff, int size); + +/** + * membuf_uninit() - clear a membuff so it can no longer be used + * + * @mb: membuff to uninit + */ +void membuf_uninit(struct membuff *mb); + +/** + * membuf_new() - create a new membuff + * + * @mb: membuff to init + * @size: size of membuff to create + * Return: 0 if OK, -ENOMEM if out of memory + */ +int membuf_new(struct membuff *mb, int size); + +/** + * membuf_dispose() - free memory allocated to a membuff and uninit it + * + * @mb: membuff to dispose + */ +void membuf_dispose(struct membuff *mb); + +#endif diff --git a/include/membuff.h b/include/membuff.h deleted file mode 100644 index c7370e1c072..00000000000 --- a/include/membuff.h +++ /dev/null @@ -1,246 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright (c) 2015 Google, Inc - * Written by Simon Glass - * - * Copyright (c) 1992 Simon Glass - */ - -#ifndef _membuf_H -#define _membuf_H - -/** - * @struct membuff: holds the state of a membuff - it is used for input and - * output buffers. The buffer extends from @start to (@start + @size - 1). - * Data in the buffer extends from @tail to @head: it is written in at - * @head and read out from @tail. The membuff is empty when @head == @tail - * and full when adding another character would make @head == @tail. We - * therefore waste one character in the membuff to avoid having an extra flag - * to determine whether (when @head == @tail) the membuff is empty or full. - * - * xxxxxx data - * ...... empty - * - * .............xxxxxxxxxxxxxxxx......................... - * ^ ^ - * tail head - * - * xxxxxxxxxxxxx................xxxxxxxxxxxxxxxxxxxxxxxxx - * ^ ^ - * head tail - */ -struct membuff { - char *start; /** the start of the buffer */ - char *end; /** the end of the buffer (start + length) */ - char *head; /** current buffer head */ - char *tail; /** current buffer tail */ -}; - -/** - * membuf_purge() - reset a membuff to the empty state - * - * Initialise head and tail pointers so that the membuff becomes empty. - * - * @mb: membuff to purge - */ -void membuf_purge(struct membuff *mb); - -/** - * membuf_putraw() - find out where bytes can be written - * - * Work out where in the membuff some data could be written. Return a pointer - * to the address and the number of bytes which can be written there. If - * @update is true, the caller must then write the data immediately, since - * the membuff is updated as if the write has been done, - * - * Note that because the spare space in a membuff may not be contiguous, this - * function may not return @maxlen even if there is enough space in the - * membuff. However, by calling this function twice (with @update == true), - * you will get access to all the spare space. - * - * @mb: membuff to adjust - * @maxlen: the number of bytes we want to write - * @update: true to update the membuff as if the write happened, false to not - * @data: the address data can be written to - * Return: number of bytes which can be written - */ -int membuf_putraw(struct membuff *mb, int maxlen, bool update, char **data); - -/** - * membuf_getraw() - find and return a pointer to available bytes - * - * Returns a pointer to any valid input data in the given membuff and - * optionally marks it as read. Note that not all input data may not be - * returned, since data is not necessarily contiguous in the membuff. However, - * if you call this function twice (with @update == true) you are guaranteed - * to get all available data, in at most two installments. - * - * @mb: membuff to adjust - * @maxlen: maximum number of bytes to get - * @update: true to update the membuff as if the bytes have been read (use - * false to check bytes without reading them) - * @data: returns address of data in input membuff - * Return: the number of bytes available at *@data - */ -int membuf_getraw(struct membuff *mb, int maxlen, bool update, char **data); - -/** - * membuf_putbyte() - Writes a byte to a membuff - * - * @mb: membuff to adjust - * @ch: byte to write - * Return: true on success, false if membuff is full - */ -bool membuf_putbyte(struct membuff *mb, int ch); - -/** - * @mb: membuff to adjust - * membuf_getbyte() - Read a byte from the membuff - * Return: the byte read, or -1 if the membuff is empty - */ -int membuf_getbyte(struct membuff *mb); - -/** - * membuf_peekbyte() - check the next available byte - * - * Return the next byte which membuf_getbyte() would return, without - * removing it from the membuff. - * - * @mb: membuff to adjust - * Return: the byte peeked, or -1 if the membuff is empty - */ -int membuf_peekbyte(struct membuff *mb); - -/** - * membuf_get() - get data from a membuff - * - * Copies any available data (up to @maxlen bytes) to @buff and removes it - * from the membuff. - * - * @mb: membuff to adjust - * @Buff: address of membuff to transfer bytes to - * @maxlen: maximum number of bytes to read - * Return: the number of bytes read - */ -int membuf_get(struct membuff *mb, char *buff, int maxlen); - -/** - * membuf_put() - write data to a membuff - * - * Writes some data to a membuff. Returns the number of bytes added. If this - * is less than @lnehgt, then the membuff got full - * - * @mb: membuff to adjust - * @data: the data to write - * @length: number of bytes to write from 'data' - * Return: the number of bytes added - */ -int membuf_put(struct membuff *mb, const char *buff, int length); - -/** - * membuf_isempty() - check if a membuff is empty - * - * @mb: membuff to check - * Return: true if empty, else false - */ -bool membuf_isempty(struct membuff *mb); - -/** - * membuf_avail() - check available data in a membuff - * - * @mb: membuff to check - * Return: number of bytes of data available - */ -int membuf_avail(struct membuff *mb); - -/** - * membuf_size() - get the size of a membuff - * - * Note that a membuff can only old data up to one byte less than its size. - * - * @mb: membuff to check - * Return: total size - */ -int membuf_size(struct membuff *mb); - -/** - * membuf_makecontig() - adjust all membuff data to be contiguous - * - * This places all data in a membuff into a single contiguous lump, if - * possible - * - * @mb: membuff to adjust - * Return: true on success - */ -bool membuf_makecontig(struct membuff *mb); - -/** - * membuf_free() - find the number of bytes that can be written to a membuff - * - * @mb: membuff to check - * Return: returns the number of bytes free in a membuff - */ -int membuf_free(struct membuff *mb); - -/** - * membuf_readline() - read a line of text from a membuff - * - * Reads a line of text of up to 'maxlen' characters from a membuff and puts - * it in @str. Any character less than @minch is assumed to be the end of - * line character - * - * @mb: membuff to adjust - * @str: Place to put the line - * @maxlen: Maximum line length (excluding terminator) - * @must_fit: If true then str is empty if line doesn't fit - * Return: number of bytes read (including terminator) if a line has been - * read, 0 if nothing was there or line didn't fit when must_fit is set - */ -int membuf_readline(struct membuff *mb, char *str, int maxlen, int minch, bool must_fit); - -/** - * membuf_extend_by() - expand a membuff - * - * Extends a membuff by the given number of bytes - * - * @mb: membuff to adjust - * @by: Number of bytes to increase the size by - * @max: Maximum size to allow - * Return: 0 if the expand succeeded, -ENOMEM if not enough memory, -E2BIG - * if the the size would exceed @max - */ -int membuf_extend_by(struct membuff *mb, int by, int max); - -/** - * membuf_init() - set up a new membuff using an existing membuff - * - * @mb: membuff to set up - * @buff: Address of buffer - * @size: Size of buffer - */ -void membuf_init(struct membuff *mb, char *buff, int size); - -/** - * membuf_uninit() - clear a membuff so it can no longer be used - * - * @mb: membuff to uninit - */ -void membuf_uninit(struct membuff *mb); - -/** - * membuf_new() - create a new membuff - * - * @mb: membuff to init - * @size: size of membuff to create - * Return: 0 if OK, -ENOMEM if out of memory - */ -int membuf_new(struct membuff *mb, int size); - -/** - * membuf_dispose() - free memory allocated to a membuff and uninit it - * - * @mb: membuff to dispose - */ -void membuf_dispose(struct membuff *mb); - -#endif -- cgit v1.2.3 From 68b0af2127dbd7b304f897f4796c6eb86fd74402 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 18 Mar 2025 16:20:44 +0100 Subject: membuf: Rename struct Rename the struct to match the function prefix and filenames. Signed-off-by: Simon Glass --- include/asm-generic/global_data.h | 4 ++-- include/membuf.h | 42 +++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 23 deletions(-) (limited to 'include') diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 18d94592b03..506ee51cdb0 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -316,14 +316,14 @@ struct global_data { * * This buffer is used to collect output during console recording. */ - struct membuff console_out; + struct membuf console_out; /** * @console_in: input buffer for console recording * * If console recording is activated, this buffer can be used to * emulate input. */ - struct membuff console_in; + struct membuf console_in; #endif #if CONFIG_IS_ENABLED(VIDEO) /** diff --git a/include/membuf.h b/include/membuf.h index c7370e1c072..17616d5577e 100644 --- a/include/membuf.h +++ b/include/membuf.h @@ -10,7 +10,7 @@ #define _membuf_H /** - * @struct membuff: holds the state of a membuff - it is used for input and + * @struct membuf: holds the state of a membuff - it is used for input and * output buffers. The buffer extends from @start to (@start + @size - 1). * Data in the buffer extends from @tail to @head: it is written in at * @head and read out from @tail. The membuff is empty when @head == @tail @@ -29,7 +29,7 @@ * ^ ^ * head tail */ -struct membuff { +struct membuf { char *start; /** the start of the buffer */ char *end; /** the end of the buffer (start + length) */ char *head; /** current buffer head */ @@ -43,7 +43,7 @@ struct membuff { * * @mb: membuff to purge */ -void membuf_purge(struct membuff *mb); +void membuf_purge(struct membuf *mb); /** * membuf_putraw() - find out where bytes can be written @@ -64,7 +64,7 @@ void membuf_purge(struct membuff *mb); * @data: the address data can be written to * Return: number of bytes which can be written */ -int membuf_putraw(struct membuff *mb, int maxlen, bool update, char **data); +int membuf_putraw(struct membuf *mb, int maxlen, bool update, char **data); /** * membuf_getraw() - find and return a pointer to available bytes @@ -82,7 +82,7 @@ int membuf_putraw(struct membuff *mb, int maxlen, bool update, char **data); * @data: returns address of data in input membuff * Return: the number of bytes available at *@data */ -int membuf_getraw(struct membuff *mb, int maxlen, bool update, char **data); +int membuf_getraw(struct membuf *mb, int maxlen, bool update, char **data); /** * membuf_putbyte() - Writes a byte to a membuff @@ -91,14 +91,14 @@ int membuf_getraw(struct membuff *mb, int maxlen, bool update, char **data); * @ch: byte to write * Return: true on success, false if membuff is full */ -bool membuf_putbyte(struct membuff *mb, int ch); +bool membuf_putbyte(struct membuf *mb, int ch); /** * @mb: membuff to adjust * membuf_getbyte() - Read a byte from the membuff * Return: the byte read, or -1 if the membuff is empty */ -int membuf_getbyte(struct membuff *mb); +int membuf_getbyte(struct membuf *mb); /** * membuf_peekbyte() - check the next available byte @@ -109,7 +109,7 @@ int membuf_getbyte(struct membuff *mb); * @mb: membuff to adjust * Return: the byte peeked, or -1 if the membuff is empty */ -int membuf_peekbyte(struct membuff *mb); +int membuf_peekbyte(struct membuf *mb); /** * membuf_get() - get data from a membuff @@ -122,7 +122,7 @@ int membuf_peekbyte(struct membuff *mb); * @maxlen: maximum number of bytes to read * Return: the number of bytes read */ -int membuf_get(struct membuff *mb, char *buff, int maxlen); +int membuf_get(struct membuf *mb, char *buff, int maxlen); /** * membuf_put() - write data to a membuff @@ -135,7 +135,7 @@ int membuf_get(struct membuff *mb, char *buff, int maxlen); * @length: number of bytes to write from 'data' * Return: the number of bytes added */ -int membuf_put(struct membuff *mb, const char *buff, int length); +int membuf_put(struct membuf *mb, const char *buff, int length); /** * membuf_isempty() - check if a membuff is empty @@ -143,7 +143,7 @@ int membuf_put(struct membuff *mb, const char *buff, int length); * @mb: membuff to check * Return: true if empty, else false */ -bool membuf_isempty(struct membuff *mb); +bool membuf_isempty(struct membuf *mb); /** * membuf_avail() - check available data in a membuff @@ -151,7 +151,7 @@ bool membuf_isempty(struct membuff *mb); * @mb: membuff to check * Return: number of bytes of data available */ -int membuf_avail(struct membuff *mb); +int membuf_avail(struct membuf *mb); /** * membuf_size() - get the size of a membuff @@ -161,7 +161,7 @@ int membuf_avail(struct membuff *mb); * @mb: membuff to check * Return: total size */ -int membuf_size(struct membuff *mb); +int membuf_size(struct membuf *mb); /** * membuf_makecontig() - adjust all membuff data to be contiguous @@ -172,7 +172,7 @@ int membuf_size(struct membuff *mb); * @mb: membuff to adjust * Return: true on success */ -bool membuf_makecontig(struct membuff *mb); +bool membuf_makecontig(struct membuf *mb); /** * membuf_free() - find the number of bytes that can be written to a membuff @@ -180,7 +180,7 @@ bool membuf_makecontig(struct membuff *mb); * @mb: membuff to check * Return: returns the number of bytes free in a membuff */ -int membuf_free(struct membuff *mb); +int membuf_free(struct membuf *mb); /** * membuf_readline() - read a line of text from a membuff @@ -196,7 +196,7 @@ int membuf_free(struct membuff *mb); * Return: number of bytes read (including terminator) if a line has been * read, 0 if nothing was there or line didn't fit when must_fit is set */ -int membuf_readline(struct membuff *mb, char *str, int maxlen, int minch, bool must_fit); +int membuf_readline(struct membuf *mb, char *str, int maxlen, int minch, bool must_fit); /** * membuf_extend_by() - expand a membuff @@ -209,7 +209,7 @@ int membuf_readline(struct membuff *mb, char *str, int maxlen, int minch, bool m * Return: 0 if the expand succeeded, -ENOMEM if not enough memory, -E2BIG * if the the size would exceed @max */ -int membuf_extend_by(struct membuff *mb, int by, int max); +int membuf_extend_by(struct membuf *mb, int by, int max); /** * membuf_init() - set up a new membuff using an existing membuff @@ -218,14 +218,14 @@ int membuf_extend_by(struct membuff *mb, int by, int max); * @buff: Address of buffer * @size: Size of buffer */ -void membuf_init(struct membuff *mb, char *buff, int size); +void membuf_init(struct membuf *mb, char *buff, int size); /** * membuf_uninit() - clear a membuff so it can no longer be used * * @mb: membuff to uninit */ -void membuf_uninit(struct membuff *mb); +void membuf_uninit(struct membuf *mb); /** * membuf_new() - create a new membuff @@ -234,13 +234,13 @@ void membuf_uninit(struct membuff *mb); * @size: size of membuff to create * Return: 0 if OK, -ENOMEM if out of memory */ -int membuf_new(struct membuff *mb, int size); +int membuf_new(struct membuf *mb, int size); /** * membuf_dispose() - free memory allocated to a membuff and uninit it * * @mb: membuff to dispose */ -void membuf_dispose(struct membuff *mb); +void membuf_dispose(struct membuf *mb); #endif -- cgit v1.2.3 From f48f1705c357605f05f5a47b84c1c89dc33bec35 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 18 Mar 2025 16:20:45 +0100 Subject: membuf: Include stdbool This uses a bool type so include the required header. Signed-off-by: Simon Glass --- include/membuf.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/membuf.h b/include/membuf.h index 17616d5577e..636ed703ee7 100644 --- a/include/membuf.h +++ b/include/membuf.h @@ -9,6 +9,8 @@ #ifndef _membuf_H #define _membuf_H +#include + /** * @struct membuf: holds the state of a membuff - it is used for input and * output buffers. The buffer extends from @start to (@start + @size - 1). -- cgit v1.2.3 From da8694a7d2cc9fdfd67e8a039ba1e70bdd543d0b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 18 Mar 2025 16:20:48 +0100 Subject: membuf: Minor code-style improvements Show the start in end in the comment. Comment a missing variable in membuf_readline() and fix its line length. Signed-off-by: Simon Glass --- include/membuf.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/membuf.h b/include/membuf.h index 636ed703ee7..46764690f53 100644 --- a/include/membuf.h +++ b/include/membuf.h @@ -25,7 +25,7 @@ * * .............xxxxxxxxxxxxxxxx......................... * ^ ^ - * tail head + * ^start tail head ^end * * xxxxxxxxxxxxx................xxxxxxxxxxxxxxxxxxxxxxxxx * ^ ^ @@ -194,11 +194,13 @@ int membuf_free(struct membuf *mb); * @mb: membuff to adjust * @str: Place to put the line * @maxlen: Maximum line length (excluding terminator) + * @minch: Minimum ASCII character to permit as part of the line (e.g. ' ') * @must_fit: If true then str is empty if line doesn't fit * Return: number of bytes read (including terminator) if a line has been * read, 0 if nothing was there or line didn't fit when must_fit is set */ -int membuf_readline(struct membuf *mb, char *str, int maxlen, int minch, bool must_fit); +int membuf_readline(struct membuf *mb, char *str, int maxlen, int minch, + bool must_fit); /** * membuf_extend_by() - expand a membuff -- cgit v1.2.3 From 578e7882bfb79848ff91cd65a5ebf4e795d26bb5 Mon Sep 17 00:00:00 2001 From: Harsha Vardhan V M Date: Wed, 19 Mar 2025 14:17:12 +0530 Subject: cmd: fuse: Add fuse writebuff sub-system command Add CMD_FUSE_WRITEBUFF config option to add and enable fuse writebuff sub-system command. Add fuse_writebuff function to be invoked on writebuff command. Signed-off-by: Harsha Vardhan V M Reviewed-by: Tom Rini --- include/fuse.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/fuse.h b/include/fuse.h index 4519821af7e..902b5f56a74 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -12,6 +12,7 @@ #define _FUSE_H_ #include +#include /* * Read/Sense/Program/Override interface: @@ -25,5 +26,13 @@ int fuse_read(u32 bank, u32 word, u32 *val); int fuse_sense(u32 bank, u32 word, u32 *val); int fuse_prog(u32 bank, u32 word, u32 val); int fuse_override(u32 bank, u32 word, u32 val); +#ifdef CONFIG_CMD_FUSE_WRITEBUFF +int fuse_writebuff(ulong addr); +#else +static inline int fuse_writebuff(ulong addr) +{ + return -EPERM; +} +#endif /* CONFIG_CMD_FUSE_WRITEBUFF */ #endif /* _FUSE_H_ */ -- cgit v1.2.3 From 33d84771e9dd7478344040765cff1b7b9b7c51a3 Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Tue, 18 Mar 2025 10:41:38 -0700 Subject: Fix EFI boot file name definition for 64-bit x86 This change aligns the preprocessor directive with the standard configuration flag used for detecting 64-bit x86 architecture. Signed-off-by: Jeremy Compostella Reviewed-by: Simon Glass --- include/config_distro_bootcmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 0a4e4b8ff85..8ac3a4feeb8 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -112,7 +112,7 @@ #define BOOTEFI_NAME "bootarm.efi" #elif defined(CONFIG_X86_RUN_32BIT) #define BOOTEFI_NAME "bootia32.efi" -#elif defined(CONFIG_X86_RUN_64BIT) +#elif defined(CONFIG_X86_64) #define BOOTEFI_NAME "bootx64.efi" #elif defined(CONFIG_ARCH_RV32I) #define BOOTEFI_NAME "bootriscv32.efi" -- cgit v1.2.3 From f892a7f397a66d8d09f418d1e0e06dfb48bac27d Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Mon, 7 Apr 2025 12:35:13 -0600 Subject: Revert "Merge patch series "pxe: Precursor series for supporting read_all() in extlinux / PXE"" This reverts commit 8bc3542384e3a1219e5ffb62b79d16dddc1b1fb9, reversing changes made to 698edd63eca090a2e299cd3facf90a0b97bed677. There are still problems with this series to work out. Link: https://lore.kernel.org/u-boot/CAFLszTjw_MJbK9tpzVYi3XKGazcv55auBAdgVzcAVUta7dRqcg@mail.gmail.com/ Signed-off-by: Tom Rini --- include/bootm.h | 63 +++++----------------------------------------------- include/image.h | 48 +++++---------------------------------- include/net-common.h | 30 ------------------------- 3 files changed, 12 insertions(+), 129 deletions(-) (limited to 'include') diff --git a/include/bootm.h b/include/bootm.h index 465577a66f5..61160705215 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -44,21 +44,6 @@ struct cmd_tbl; * @argc: Number of arguments to the command (excluding the actual command). * This is 0 if there are no arguments * @argv: NULL-terminated list of arguments, or NULL if there are no arguments - * - * For zboot: - * @bzimage_addr: Address of the bzImage to boot, or 0 if the image has already - * been loaded and does not exist (as a cohesive whole) in memory - * @bzimage_size: Size of the bzImage, or 0 to detect this - * @initrd_addr: Address of the initial ramdisk, or 0 if none - * @initrd_size: Size of the initial ramdisk, or 0 if none - * @load_address: Address where the bzImage is moved before booting, either - * BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR - * This is set up when loading the zimage - * @base_ptr: Pointer to the boot parameters, typically at address - * DEFAULT_SETUP_BASE - * This is set up when loading the zimage - * @cmdline: Environment variable containing the 'override' command line, or - * NULL to use the one in the setup block */ struct bootm_info { const char *addr_img; @@ -69,39 +54,11 @@ struct bootm_info { const char *cmd_name; int argc; char *const *argv; - - /* zboot items */ -#ifdef CONFIG_X86 - ulong bzimage_addr; - ulong bzimage_size; - ulong initrd_addr; - ulong initrd_size; - ulong load_address; - struct boot_params *base_ptr; - const char *cmdline; -#endif }; -/* macro to allow setting fields in generic code */ -#ifdef CONFIG_X86 -#define bootm_x86_set(_bmi, _field, _val) (_bmi)->_field = (_val) -#else -#define bootm_x86_set(_bmi, _field, _val) -#endif - -static inline ulong bootm_len(void) -{ -#ifdef CONFIG_SYS_BOOTM_LEN - return CONFIG_SYS_BOOTM_LEN; -#endif - return 0; -} - /** * bootm_init() - Set up a bootm_info struct with useful defaults * - * @bmi: Bootm information - * * Set up the struct with default values for all members: * @boot_progress is set to true and @images is set to the global images * variable. Everything else is set to NULL except @argc which is 0 @@ -117,7 +74,7 @@ void bootm_init(struct bootm_info *bmi); * - disabled interrupts. * * @flag: Flags indicating what to do (BOOTM_STATE_...) - * @bmi: Bootm information + * bmi: Bootm information * Return: 1 on error. On success the OS boots so this function does * not return. */ @@ -318,15 +275,6 @@ int bootm_process_cmdline_env(int flags); /** * zboot_run() - Run through the various steps to boot a zimage * - * @bmi: Bootm information, with bzimage_size, initrd_addr, initrd_size and - * cmdline set up. If base_ptr is 0, then bzimage_addr must be set to the start - * of the bzImage. Otherwise base_ptr and load_address must be provided. - */ -int zboot_run(struct bootm_info *bmi); - -/** - * zboot_run_args() - Run through the various steps to boot a zimage - * * Boot a zimage, given the component parts * * @addr: Address where the bzImage is moved before booting, either @@ -341,8 +289,8 @@ int zboot_run(struct bootm_info *bmi); * to use for booting * Return: -EFAULT on error (normally it does not return) */ -int zboot_run_args(ulong addr, ulong size, ulong initrd, ulong initrd_size, - ulong base, char *cmdline); +int zboot_run(ulong addr, ulong size, ulong initrd, ulong initrd_size, + ulong base, char *cmdline); /* * zimage_get_kernel_version() - Get the version string from a kernel @@ -359,10 +307,11 @@ const char *zimage_get_kernel_version(struct boot_params *params, * * This shows all available information in a zimage that has been loaded. * - * @bmi: Bootm information, with valid base_ptr + * @base_ptr: Pointer to the boot parameters, typically at address + * DEFAULT_SETUP_BASE * @show_cmdline: true to show the full command line */ -void zimage_dump(struct bootm_info *bmi, bool show_cmdline); +void zimage_dump(struct boot_params *base_ptr, bool show_cmdline); /* * bootm_boot_start() - Boot an image at the given address diff --git a/include/image.h b/include/image.h index 2455baa6667..c1db8383459 100644 --- a/include/image.h +++ b/include/image.h @@ -244,7 +244,7 @@ enum image_type_t { * New IDs *MUST* be appended at the end of the list and *NEVER* * inserted for backward compatibility. */ -enum image_comp_t { +enum { IH_COMP_NONE = 0, /* No Compression Used */ IH_COMP_GZIP, /* gzip Compression Used */ IH_COMP_BZIP2, /* bzip2 Compression Used */ @@ -598,13 +598,10 @@ int boot_get_setup(struct bootm_headers *images, uint8_t arch, ulong *setup_star ulong *setup_len); /* Image format types, returned by _get_format() routine */ -enum image_fmt_t { - IMAGE_FORMAT_INVALID, - IMAGE_FORMAT_LEGACY, /* legacy image_header based format */ - IMAGE_FORMAT_FIT, /* new, libfdt based format */ - IMAGE_FORMAT_ANDROID, /* Android boot image */ - IMAGE_FORMAT_BOOTI, /* Arm64/RISC-V boot image */ -}; +#define IMAGE_FORMAT_INVALID 0x00 +#define IMAGE_FORMAT_LEGACY 0x01 /* legacy image_header based format */ +#define IMAGE_FORMAT_FIT 0x02 /* new, libfdt based format */ +#define IMAGE_FORMAT_ANDROID 0x03 /* Android boot image */ /** * genimg_get_kernel_addr_fit() - Parse FIT specifier @@ -633,42 +630,9 @@ ulong genimg_get_kernel_addr_fit(const char *const img_addr, const char **fit_uname_kernel); ulong genimg_get_kernel_addr(char * const img_addr); - -/** - * genimg_get_format - get image format type - * @img_addr: image start address - * Return: image format type or IMAGE_FORMAT_INVALID if no image is present - * - * genimg_get_format() checks whether provided address points to a valid - * legacy or FIT image. - * - * New uImage format and FDT blob are based on a libfdt. FDT blob - * may be passed directly or embedded in a FIT image. In both situations - * genimg_get_format() must be able to dectect libfdt header. - */ -enum image_fmt_t genimg_get_format(const void *img_addr); - -/** - * genimg_get_format_comp() - Like genimg_get_format() but adds compressed booti - * - * If a compressed file is detected (with image_decomp_type()) and - * CONFIG_CMD_BOOTI is enabled, then this returns IMAGE_FORMAT_BOOTI - * - * @img_addr: image start address - * Return: image format type or IMAGE_FORMAT_INVALID if no image is present - */ -enum image_fmt_t genimg_get_format_comp(const void *img_addr); - +int genimg_get_format(const void *img_addr); int genimg_has_config(struct bootm_headers *images); -/** - * booti_is_valid() - Check if an image appears to be an Arm64 image - * - * @img: Pointer to image - * Return: true if the image has the Arm64 magic - */ -bool booti_is_valid(const void *img); - /** * boot_get_fpga() - Locate the FPGA image * diff --git a/include/net-common.h b/include/net-common.h index 6a39091a5d4..1d507b13b06 100644 --- a/include/net-common.h +++ b/include/net-common.h @@ -475,36 +475,6 @@ int net_init(void); enum proto_t; int net_loop(enum proto_t protocol); -/* internal function: do not use! */ -int netboot_run_(enum proto_t proto, ulong addr, const char *fname, ulong size, - bool fname_explicit, bool ipv6); - -/** - * netboot_run() - Run a network operation - * - * The following proto values are NOT supported: - * PING, since net_ping_ip cannot be set - * NETCONS, since its parameters cannot bet set - * RS, since first_call cannot be set, along with perhaps other things - * UDP, since udp_ops cannot be set - * DNS, since net_dns_resolve and net_dns_env_var cannot be set - * WGET, since DNS must be done first and that is not supported - * DHCP6, since the required parameters cannot be passed in - * - * To support one of these, either add the required arguments or perhaps a - * separate function and a struct to hold the information. - * - * @proto: Operation to run: TFTPGET, FASTBOOT_UDP, FASTBOOT_TCP, BOOTP, - * TFTPPUT, RARP, NFS, DHCP - * @addr: Load/save address - * @fname: Filename - * @size: Save size (not used for TFTPGET) - * @ipv6: true to use IPv6, false to use IPv4 - * Return 0 on success, else -ve error code - */ -int netboot_run(enum proto_t proto, ulong addr, const char *fname, ulong size, - bool ipv6); - /** * dhcp_run() - Run DHCP on the current ethernet device * -- cgit v1.2.3