]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
8 months agox86: Drop message about features being missing with 64-bit
Simon Glass [Fri, 15 Dec 2023 04:19:14 +0000 (21:19 -0700)]
x86: Drop message about features being missing with 64-bit

At this point most things work, including booting a distro, so drop
this message.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 months agopxe: Allow booting without CMDLINE for the zboot method
Simon Glass [Fri, 15 Dec 2023 04:19:13 +0000 (21:19 -0700)]
pxe: Allow booting without CMDLINE for the zboot method

Use zboot_run() to boot rather than the command line. This allows
extlinux to be used (on x86) without CMDLINE being enabled.

Collect any error but do not return it, to match the existing code.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 months agopxe: Allow booting without CMDLINE for bootm methods
Simon Glass [Fri, 15 Dec 2023 04:19:12 +0000 (21:19 -0700)]
pxe: Allow booting without CMDLINE for bootm methods

Use bootm_run() and booti_run() to boot rather than the command line.
This allows extlinux to be used without CMDLINE being enabled.

Collect any error but do not return it, to match the existing code.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 months agopxe: Move calculation of FDT file into a function
Simon Glass [Fri, 15 Dec 2023 04:19:11 +0000 (21:19 -0700)]
pxe: Move calculation of FDT file into a function

This code undertakes a separate task from the main logic of
label_run_boot() so move it into its own function.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 months agopxe: Refactor to avoid over-using bootm_argv
Simon Glass [Fri, 15 Dec 2023 04:19:10 +0000 (21:19 -0700)]
pxe: Refactor to avoid over-using bootm_argv

The bootm_argv[3] expression is used in many places. It is the FDT
address, so use that name throughout.

Assign it to bootm_argv[3] only at the end, when all the conditions are
resolved.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 months agopxe: Refactor to reduce the size of label_boot()
Simon Glass [Fri, 15 Dec 2023 04:19:09 +0000 (21:19 -0700)]
pxe: Refactor to reduce the size of label_boot()

This function is far too long and complicated. Split out the part
which actually calls the boot commands into a separate function.

Change a strncpy() to strlcpy() to keep checkpatch happy.

No functional change is intended.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 months agopxe: Use strlcpy() instead of strcpy() in label_boot()
Simon Glass [Fri, 15 Dec 2023 04:19:08 +0000 (21:19 -0700)]
pxe: Use strlcpy() instead of strcpy() in label_boot()

The intention here is to nul-terminate the result string, so use the
correct function for that.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 months agodoc: Mention fastboot dependency on CMDLINE
Simon Glass [Fri, 15 Dec 2023 04:19:07 +0000 (21:19 -0700)]
doc: Mention fastboot dependency on CMDLINE

The fastboot 'boot' command only supports running a U-Boot command if
CONFIG_CMDLINE is enabled. Mention this in the documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
8 months agofastboot: Remove dependencies on CMDLINE
Simon Glass [Fri, 15 Dec 2023 04:19:06 +0000 (21:19 -0700)]
fastboot: Remove dependencies on CMDLINE

It is possible to boot a kernel without CMDLINE being enabled. Update
the implementation to handle this, and drop the condition from the
FASTBOOT config.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
8 months agobootm: Make cmdline optional with bootm_boot_start()
Simon Glass [Fri, 15 Dec 2023 04:19:05 +0000 (21:19 -0700)]
bootm: Make cmdline optional with bootm_boot_start()

Allow the default command line to be used when booting the OS. This is
needed by fastboot.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 months agofastboot: Change fastboot_buf_addr to an address
Simon Glass [Fri, 15 Dec 2023 04:19:04 +0000 (21:19 -0700)]
fastboot: Change fastboot_buf_addr to an address

Given the name of this variable, it should be an address, not a
pointer. Update this, to make it easier to use with sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Dmitrii Merkurev <dimorinny@google.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3
8 months agoboot: Update SYS_BOOTM_LEN to depend on BOOTM
Simon Glass [Fri, 15 Dec 2023 04:19:03 +0000 (21:19 -0700)]
boot: Update SYS_BOOTM_LEN to depend on BOOTM

Use the new CONFIG_BOOTM symbol to determine whether SYS_BOOT_LEN is
visible or not, since we want to support decompression when CMDLINE is
disabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 months agotreewide: Make arch-specific bootm code depend on BOOTM
Simon Glass [Fri, 15 Dec 2023 04:19:02 +0000 (21:19 -0700)]
treewide: Make arch-specific bootm code depend on BOOTM

Allow these functions to be compiled in when CONFIG_BOOTM is enabled,
even if CONFIG_CMD_BOOTM is not.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@kernel-space.org>
8 months agobootm: Make OS booting dependent on BOOTM
Simon Glass [Fri, 15 Dec 2023 04:19:01 +0000 (21:19 -0700)]
bootm: Make OS booting dependent on BOOTM

Booting an OS does not require the 'bootm' command, so change the
condition for these options.

Move them into boot/ so they don't depend on CMDLINE

Note that CMD_BOOTM_PRE_LOAD has been put directly into the bootm code
so will need some additional refactoring (and a test!) to allow it to
change over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 months agobootm: Add a Kconfig option for bootm functionality
Simon Glass [Fri, 15 Dec 2023 04:19:00 +0000 (21:19 -0700)]
bootm: Add a Kconfig option for bootm functionality

Create a separate Kconfig option which enables the bootm logic,
separate from the 'bootm' command. This will eventually allow booting
without CMDLINE enabled.

Update boards which disable CMD_BOOTM to disable BOOTM instead, since
CMD_BOOTM now depends on BOOTM

Signed-off-by: Simon Glass <sjg@chromium.org>
8 months agoboot: Reorder FIT and BOOTSTD to be first
Simon Glass [Fri, 15 Dec 2023 04:18:59 +0000 (21:18 -0700)]
boot: Reorder FIT and BOOTSTD to be first

The boot menu shows Android first and then a timestamp option. Move
these later since they are less commonly used.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agosandbox: Add a dummy booti command
Simon Glass [Mon, 2 Oct 2023 01:15:24 +0000 (19:15 -0600)]
sandbox: Add a dummy booti command

Add basic sandbox support for 'booti' so we can start to boot the test
ARMbian image. This is helpful in checking that it is parsed correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agovideo: Add a function to clear the display
Simon Glass [Mon, 2 Oct 2023 01:15:23 +0000 (19:15 -0600)]
video: Add a function to clear the display

Move the code from the 'cls' command into the console file, so it can
be called from elsewhere.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agotest: print: Skip test on x86
Simon Glass [Mon, 2 Oct 2023 01:15:22 +0000 (19:15 -0600)]
test: print: Skip test on x86

These tests cannot work on x86 machines as memory at address zero is
not writable. Add a condition to skip these.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agotest: lmb: Move tests into the lib suite
Simon Glass [Mon, 2 Oct 2023 01:15:21 +0000 (19:15 -0600)]
test: lmb: Move tests into the lib suite

These tests are marked as driver model tests, but have nothing to do
with driver model. As a result, they are run as part of 'ut dm' which
only exists for sandbox.

Move them to the 'lib' suite and drop the requirement for initing
devices, since they don't use devices.

Also put the lib_test_lmb_max_regions() macro inside the same #ifdef
as its function, to avoid a build error if the condition is false.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agotest: event: Only run test_event_probe() on sandbox
Simon Glass [Mon, 2 Oct 2023 01:15:20 +0000 (19:15 -0600)]
test: event: Only run test_event_probe() on sandbox

This needs test devices which are only present on sandbox. Add a check
for this and skip just this test if running on a real board.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agotest: font: Add dependencies on fonts
Simon Glass [Mon, 2 Oct 2023 01:15:19 +0000 (19:15 -0600)]
test: font: Add dependencies on fonts

The font test needs two fonts. If one is not available, skip out early,
to avoid an error.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agotest: fdt: Add a special case for real boards
Simon Glass [Mon, 2 Oct 2023 01:15:18 +0000 (19:15 -0600)]
test: fdt: Add a special case for real boards

The error that this test checks for is only shown on sandbox. For real
boards, there is normally no error. Add a special case to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agotest: bdinfo: Add missing asserts
Simon Glass [Mon, 2 Oct 2023 01:15:17 +0000 (19:15 -0600)]
test: bdinfo: Add missing asserts

Calling into sub-test functions should be done using ut_assertok() so
that the test exits immediately on failure. Add those which are
missing.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agotest: Handle use of stack pointer in bdinfo
Simon Glass [Mon, 2 Oct 2023 01:15:16 +0000 (19:15 -0600)]
test: Handle use of stack pointer in bdinfo

This test assumes that the stack pointer is the same across two calls
to lmb_init_and_reserve() but this is not the case on x86, for example.

Add a special case to handle this, along with a detailed comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agotest: Run bootstd tests only on sandbox
Simon Glass [Mon, 2 Oct 2023 01:15:15 +0000 (19:15 -0600)]
test: Run bootstd tests only on sandbox

These make use of disk images which are not available on reak boards.
Add a new Kconfig to ensure these tests only run where they are valid.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agotest: Make UT_LIB_ASN1 depend on sandbox
Simon Glass [Mon, 2 Oct 2023 01:15:14 +0000 (19:15 -0600)]
test: Make UT_LIB_ASN1 depend on sandbox

This doesn't seem to work on a real board, so use the test on sandbox
only.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agotest: Add helper to skip to partial console line
Simon Glass [Mon, 2 Oct 2023 01:15:13 +0000 (19:15 -0600)]
test: Add helper to skip to partial console line

Sometimes we need to skip to a line but it includes addresses or other
information which can vary depending on the runtime conditions.

Add a new ut_assert_skip_to_linen() which is similar to the existing
ut_assert_skip_to_line() function but only checks that the console line
matches up to the length of the provided string.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agotest: Add a new suite for commands
Simon Glass [Mon, 2 Oct 2023 01:15:12 +0000 (19:15 -0600)]
test: Add a new suite for commands

Add a new suite for 'cmd' tests, used for testing commands. These are
kept in the test/cmd directory.

For now it is empty, but it will be used for coreboot-command tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agoMerge patch series "bootm: Refactoring to reduce reliance on CMDLINE (part A)"
Tom Rini [Wed, 13 Dec 2023 16:51:53 +0000 (11:51 -0500)]
Merge patch series "bootm: Refactoring to reduce reliance on CMDLINE (part A)"

To quote the author:

It would be useful to be able to boot an OS when CONFIG_CMDLINE is
disabled. This could allow reduced code size.

Standard boot provides a way to handle programmatic boot, without
scripts, so such a feature is possible. The main impediment is the
inability to use the booting features of U-Boot without a command line.
So the solution is to avoid passing command arguments and the like to
code in boot/

A similar process has taken place with filesystems, for example, where
we have (somewhat) separate Kconfig options for the filesystem commands
and the filesystems themselves.

This series starts the process of refactoring the bootm logic so that
it can be called from standard boot without using the command line.
Mostly it removes the use of argc, argv and cmdtbl from the internal
logic.

Some limited tidy-up is included, but this is kept to smaller patches,
rather than trying to remove all #ifdefs etc. Some function comments
are added, however.

A simple programmatic boot is provided as a starting point.

This work will likely take many series, so this is just the start.

Size growth with this series for firefly-rk3288 (Thumb2) is:

       arm: (for 1/1 boards) all +23.0 rodata -49.0 text +72.0

This should be removed by:

   https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/11

but it is not included in this series as it is already large enough.

No functional change is intended in this series.

Changes in v3:
- Add a panic if programmatic boot fails
- Drop RFC tag

Changes in v2:
- Add new patch to adjust position of unmap_sysmem() in boot_get_kernel()
- Add new patch to obtain command arguments
- Fix 'boot_find_os' typo
- Pass in the command name
- Use the command table to provide the command name, instead of "bootm"

12 months agocommand: Introduce functions to obtain command arguments
Simon Glass [Sat, 18 Nov 2023 21:05:20 +0000 (14:05 -0700)]
command: Introduce functions to obtain command arguments

Add some functions which provide an argument to a command, or NULL if
the argument does not exist.

Use the same numbering as argv[] since it seems less confusing than the
previous idea.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
12 months agobootstd: Introduce programmatic boot
Simon Glass [Sat, 18 Nov 2023 21:05:19 +0000 (14:05 -0700)]
bootstd: Introduce programmatic boot

At present bootstd requires CONFIG_CMDLINE to operate. Add a new
'programmatic' boot which can be used when no command line is available.
For now it does almost nothing, since most bootmeths require the
command line.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agobootm: Reduce arguments to bootm_find_other()
Simon Glass [Sat, 18 Nov 2023 21:05:18 +0000 (14:05 -0700)]
bootm: Reduce arguments to bootm_find_other()

Rather than passing the full list of command arguments, pass only those
which are needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Add a function to check overlap
Simon Glass [Sat, 18 Nov 2023 21:05:17 +0000 (14:05 -0700)]
bootm: Add a function to check overlap

Move this code into a function to reduce code size and make it easier
to understand. Drop the unnecessary 0x to help a little with code size.

Use this in bootm_find_images()

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Adjust the parameters of bootm_find_images()
Simon Glass [Sat, 18 Nov 2023 21:05:16 +0000 (14:05 -0700)]
bootm: Adjust the parameters of bootm_find_images()

Rather than passing it all the command-line args, pass in the pieces
that it needs. These are the image address, the ramdisk address/name
and the FDT address/name.

Ultimately this will allow usage of this function without being called
from the command line.

Move the function comment to the header file and tidy it a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agobootm: optee: Drop special call to bootm_find_other()
Simon Glass [Sat, 18 Nov 2023 21:05:15 +0000 (14:05 -0700)]
bootm: optee: Drop special call to bootm_find_other()

The normal bootm flow calls bootm_find_other() can call the
BOOTM_STATE_FINDOTHER state as part of its processing. Fix the
condition there so that this hack can be removed.

Also drop the confusing check for the OS type, since do_bootm_tee() is
only called if the condition is met - see bootm_os_get_boot_func()

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agobootm: efi: Drop special call to bootm_find_other()
Simon Glass [Sat, 18 Nov 2023 21:05:14 +0000 (14:05 -0700)]
bootm: efi: Drop special call to bootm_find_other()

The normal bootm flow calls bootm_find_other() can call the
BOOTM_STATE_FINDOTHER state as part of its processing. Fix the
condition there so that this hack can be removed.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agobootm: Simplify Android ramdisk addr in bootm_find_images()
Simon Glass [Sat, 18 Nov 2023 21:05:13 +0000 (14:05 -0700)]
bootm: Simplify Android ramdisk addr in bootm_find_images()

The Android mechanism uses the loadaddr envrionment-variable to get the
load address, if none is provided. This is equivalent to
image_load_addr so use that instead, converting it to a string as
needed.

This change will permit passing img_addr to this function, in a future
change.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Reduce arguments to boot_get_loadables()
Simon Glass [Sat, 18 Nov 2023 21:05:12 +0000 (14:05 -0700)]
bootm: Reduce arguments to boot_get_loadables()

This function only uses two arguments. The 'arch' always has a constant
value, so drop it. This simplifies the function call.

Tidy up the function comment while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Reduce arguments to boot_get_fpga()
Simon Glass [Sat, 18 Nov 2023 21:05:11 +0000 (14:05 -0700)]
bootm: Reduce arguments to boot_get_fpga()

This function only uses two arguments. The 'arch' always has a constant
value, so drop it. This simplifies the function call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Reduce arguments to boot_get_fdt()
Simon Glass [Sat, 18 Nov 2023 21:05:10 +0000 (14:05 -0700)]
bootm: Reduce arguments to boot_get_fdt()

This function only uses one argument from bootm (argv[2]) so pass it in
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Pass image buffer to boot_get_fdt()
Simon Glass [Sat, 18 Nov 2023 21:05:09 +0000 (14:05 -0700)]
bootm: Pass image buffer to boot_get_fdt()

Rather than having boot_get_fdt() calculate this, move the calculation
into the caller. This removes the access to argv[0] in this function,
so we can later refactor it to just accept argv[2] instead of the whole
argv[].

Move the function comment to the header file and fix the u8 argument,
while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Drop #ifdef in bootm_find_images()
Simon Glass [Sat, 18 Nov 2023 21:05:08 +0000 (14:05 -0700)]
bootm: Drop #ifdef in bootm_find_images()

The OF_LIBFDT #ifdef makes it harder to use a local variable for that
code block. Convert it to if() instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agofdt: Allow use of fdt_support inside if() statements
Simon Glass [Sat, 18 Nov 2023 21:05:07 +0000 (14:05 -0700)]
fdt: Allow use of fdt_support inside if() statements

Most of the fdt_support.h header file is included only if OF_LIBFDT or
OF_CONTROL are enabled. This means that calling functions defined in
that file must happen inside an #ifdef

This is unnecessary, so reduce the condition to just !USE_HOSTCC

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Reduce arguments to boot_get_ramdisk()
Simon Glass [Sat, 18 Nov 2023 21:05:06 +0000 (14:05 -0700)]
bootm: Reduce arguments to boot_get_ramdisk()

This function normally only uses one argument so pass it in directly.
Move comments to the header file so could one day include these
functions in API docs. Fix up the u8 argument while here, since it
avoids the compiler having to mask the value on some machines.

The Android case here is bit strange, since it can use argv[0], so deal
with that in the caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Reduce arguments to bootm_find_os()
Simon Glass [Sat, 18 Nov 2023 21:05:05 +0000 (14:05 -0700)]
bootm: Reduce arguments to bootm_find_os()

This function only uses one argument so pass it in directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Move error printing out of boot_get_kernel()
Simon Glass [Sat, 18 Nov 2023 21:05:04 +0000 (14:05 -0700)]
bootm: Move error printing out of boot_get_kernel()

The same error message is printed in two places. Move it out to the
caller so we can avoid passing in the command name. Leave the bootstage
handling where it is.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootstage: Drop BOOTSTAGE_ID_FIT_KERNEL_INFO
Simon Glass [Sat, 18 Nov 2023 21:05:03 +0000 (14:05 -0700)]
bootstage: Drop BOOTSTAGE_ID_FIT_KERNEL_INFO

This is a misnomer since we don't necessarily know that the image is a
FIT. Use the existing BOOTSTAGE_ID_CHECK_IMAGETYPE instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Use the error return from boot_get_kernel()
Simon Glass [Sat, 18 Nov 2023 21:05:02 +0000 (14:05 -0700)]
bootm: Use the error return from boot_get_kernel()

Rather than looking for a zero-sized image, use the error code returned
to determine if things are OK.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Adjust position of unmap_sysmem() in boot_get_kernel()
Simon Glass [Sat, 18 Nov 2023 21:05:01 +0000 (14:05 -0700)]
bootm: Adjust position of unmap_sysmem() in boot_get_kernel()

These unmaps should happen regardless of the return value. Move them
before the 'return' statement.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Adjust boot_get_kernel() to return an error
Simon Glass [Sat, 18 Nov 2023 21:05:00 +0000 (14:05 -0700)]
bootm: Adjust boot_get_kernel() to return an error

This function obtains lots of error codes and then throws them away.
Update it to return the error, moving the image pointer to an
argument.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agoimage: Document error codes from fit_image_load()
Simon Glass [Sat, 18 Nov 2023 21:04:59 +0000 (14:04 -0700)]
image: Document error codes from fit_image_load()

Put a list of these in the function documentation so it is easier to
decode what went wrong.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Reduce arguments to boot_get_kernel()
Simon Glass [Sat, 18 Nov 2023 21:04:58 +0000 (14:04 -0700)]
bootm: Reduce arguments to boot_get_kernel()

This function only uses one argument and just needs to know the name of
the command which called it. Adjust the function to use only what it
needs. This will make it easier to call from a non-command context.

Tidy up the function comment while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agoimage: Tidy up genimg_get_kernel_addr_fit()
Simon Glass [Sat, 18 Nov 2023 21:04:57 +0000 (14:04 -0700)]
image: Tidy up genimg_get_kernel_addr_fit()

This function does not modify its first argument, so mark it const. Also
move the comments to the header file and expand them to provide more
useful information.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Move boot_get_kernel() higher in the file
Simon Glass [Sat, 18 Nov 2023 21:04:56 +0000 (14:04 -0700)]
bootm: Move boot_get_kernel() higher in the file

Move this code and image_get_kernel() higher in the file to avoid the
need for a forward declaration.

No attempt is made to remove #ifdefs or adjust the code in any other
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Simplify arguments for bootm_pre_load()
Simon Glass [Sat, 18 Nov 2023 21:04:55 +0000 (14:04 -0700)]
bootm: Simplify arguments for bootm_pre_load()

Move the argument decoding to the caller, to avoid needing to pass the
command-line arguments.

Add a function comment while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Drop arguments from bootm_start()
Simon Glass [Sat, 18 Nov 2023 21:04:54 +0000 (14:04 -0700)]
bootm: Drop arguments from bootm_start()

This function does not use its arguments. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
12 months agobootstd: Add missing header file from bootdev.h
Simon Glass [Sat, 18 Nov 2023 21:04:53 +0000 (14:04 -0700)]
bootstd: Add missing header file from bootdev.h

Add a dm/uclass-id.h to the bootdev header file, since it uses
enum uclass_id

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
12 months agotreewide: Tidy up semicolon after command macros
Simon Glass [Sat, 18 Nov 2023 21:04:52 +0000 (14:04 -0700)]
treewide: Tidy up semicolon after command macros

The U_BOOT_CMD_COMPLETE() macro has a semicolon at the end, perhaps
inadvertently. Some code has taken advantage of this.

Tidy this up by dropping the semicolon from the macro and adding it to
macro invocations as required.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
12 months agommc: env: Unify the U_BOOT_ENV_LOCATION conditions
Simon Glass [Sat, 18 Nov 2023 21:04:51 +0000 (14:04 -0700)]
mmc: env: Unify the U_BOOT_ENV_LOCATION conditions

The declaration of U_BOOT_ENV_LOCATION() uses a different #ifdef
condition from the code it calls. Use the same condition to avoid a
build warning if CONFIG_CMD_SAVEENV is disabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
12 months agoREADME: Correct docs for CONFIG_SPL_BUILD
Simon Glass [Sat, 18 Nov 2023 21:04:50 +0000 (14:04 -0700)]
README: Correct docs for CONFIG_SPL_BUILD

This option is defined in both SPL and TPL builds, so correct the docs
related to this. Also point to spl_phase() which is normally a better
option. Mention VPL as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
12 months agoarm: x86: Drop discarding of command linker-lists
Simon Glass [Sat, 18 Nov 2023 21:04:49 +0000 (14:04 -0700)]
arm: x86: Drop discarding of command linker-lists

Since we can now cleanly disable CMDLINE when needed, drop the rules
which discard the command code.  It will not be built in the first
place.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
12 months agoMerge patch series "some LED patches"
Tom Rini [Wed, 13 Dec 2023 16:25:18 +0000 (11:25 -0500)]
Merge patch series "some LED patches"

To quote the author:

I wanted to add support for ti,lp5562, and found an old submission
from Doug. While trying to modify that to work in current U-Boot, I
found a problem with the "move label handling to core" patches.

Patch 1 is a prerequisite for the ti,lp5562 driver, which turned out
to be needed by Christian as well.

Patch 2 is an attempt at (quick-)fixing the mentioned "move label
handling to core" problem. The real fix consists of changing remaining
drivers to not bind the same driver to the top node as to the child
nodes, but I can't test those other drivers.

Patch 3 introduces a helper which should allow removing some
boilerplate in most individual drivers, and 4,5 apply that in the gpio
and pwm drivers. Converting remaining drivers is trivial, but left out
for now.

Finally patch 6 is the reworked lp5562 driver. While I've changed it
to match existing DT bindings (with the goal of making it work with
our .dts that is known to work with the linux driver), most of the
logic is unchanged from Doug's original patch, so he is still listed
as author.

Changes in v2: Interchange order of patches 1 and 2, add a few R-bs,
and try to trim down the commit message in patch 2.

12 months agoled: add TI LP5562 LED driver
Doug Zobel [Fri, 17 Nov 2023 11:38:11 +0000 (12:38 +0100)]
led: add TI LP5562 LED driver

Driver for the TI LP5562 4 channel LED controller. Supports
independent on/off control of all 4 channels. Supports LED_BLINK on 3
independent channels: blue/green/red. The white channel can blink, but
shares the blue channel blink rate.

Heavily based on patch originally from Doug Zobel [1].

I have modified it so it matches the DT bindings in the linux tree,
and also follows the linux driver implementation more closely. This
should address Tom's concerns, and also matches my goal of making the
U-Boot driver work with our existing .dts which is known to work in
linux.

As our boards only have the R,G,B outputs connected, I have not
actually tested how the white channel behaves, but the R,G,B work
exactly as expected.

[1] https://lore.kernel.org/u-boot/1547150757-1561-1-git-send-email-douglas.zobel@climate.com/

Cc: Doug Zobel <douglas.zobel@climate.com>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
12 months agoled: led_pwm: use led_bind_generic() helper
Rasmus Villemoes [Fri, 17 Nov 2023 11:38:10 +0000 (12:38 +0100)]
led: led_pwm: use led_bind_generic() helper

Use the helper led_bind_generic() to reduce code duplication.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 months agoled: led_gpio: use led_bind_generic() helper
Rasmus Villemoes [Fri, 17 Nov 2023 11:38:09 +0000 (12:38 +0100)]
led: led_gpio: use led_bind_generic() helper

Use the helper led_bind_generic() to reduce code duplication.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 months agoled: introduce led_bind_generic()
Rasmus Villemoes [Fri, 17 Nov 2023 11:38:08 +0000 (12:38 +0100)]
led: introduce led_bind_generic()

All existing drivers in drivers/led/ contain a .bind method that does
exactly the same thing, with just the actual driver name
differing. Create a helper so all those individual methods can be
changed to one-liners.

Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
12 months agoled-uclass: do not create fallback label for top-level node
Rasmus Villemoes [Fri, 17 Nov 2023 11:38:07 +0000 (12:38 +0100)]
led-uclass: do not create fallback label for top-level node

Many existing drivers, and led-uclass itself, rely on uc_plat->label
being NULL for the device representing the top node, as opposed to the
child nodes representing individual LEDs. This means that the drivers
whose .probe methods rely on this were broken by commit 83c63f0d1185
("led: Move OF "label" property parsing to core"), and also that the top
node wrongly shows up with 'led list'.

Binding the same driver to the top node as to the individual child
nodes is arguably wrong, and the approach of using a UCLASS_NOP driver
for the top node is probably better - this has for example been done in
commit 01074697801b ("led: gpio: Use NOP uclass driver for top-level
node") and commit 910b01c27c04 ("drivers: led: bcm6753: do not use null
label to find the top")

Until remaining affected drivers are fixed, we can use a heuristic
that only sets the label to the fallback value derived from the node
name if the node does not have a "compatible" property - i.e., if it
has been bound to the LED driver explicitly via
device_bind_driver_to_node(). This is similar to what commit
e3aa76644c2a ("led: gpio: Check device compatible string to determine
the top level node") did for gpio_led, but that fix was then supplanted
by commit 01074697801b ("led: gpio: Use NOP uclass driver for top-level
node")

Fixes: 83c63f0d1185 ("led: Move OF "label" property parsing to core")
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
12 months agoled-uclass: honour ->label field populated by driver's own .bind
Rasmus Villemoes [Fri, 17 Nov 2023 11:38:06 +0000 (12:38 +0100)]
led-uclass: honour ->label field populated by driver's own .bind

If the driver's own .bind method has populated uc_plat->label, don't
override that. This is necessary for an upcoming driver for ti,lp5562,
where the DT binding unfortunately says to use "chan-name" and not
"label".

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
12 months agotest: bdinfo: Handle systems without getopt
Marek Vasut [Sun, 10 Dec 2023 15:01:56 +0000 (16:01 +0100)]
test: bdinfo: Handle systems without getopt

Systems without getopt support fall back to plain full bdinfo print,
handle such a case, which occurs e.g. with sandbox_flattree_defconfig .

Fixes: 8827a3871452 ("test: bdinfo: Test bdinfo -h")
Fixes: 2696f3ab8101 ("test: bdinfo: Test bdinfo -m")
Fixes: 3ff2d796a6f2 ("test: bdinfo: Test bdinfo -e")
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
12 months agotest/py: Disable error E0611 in two cases for pylint
Tom Rini [Sat, 9 Dec 2023 19:52:46 +0000 (14:52 -0500)]
test/py: Disable error E0611 in two cases for pylint

Recently pylint has started to complain about:
No name 'fs_helper' in module 'tests' (no-name-in-module)

Due to:
from tests import fs_helper

However, we have:
test/py/tests/fs_helper.py

And since we do not want to add a dummy test/py/tests/__init__.py to
silence this warning we instead just disable it as needed.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoMerge patch series "cmd: bdinfo: Optionally use getopt and implement bdinfo -a"
Tom Rini [Sat, 9 Dec 2023 13:42:49 +0000 (08:42 -0500)]
Merge patch series "cmd: bdinfo: Optionally use getopt and implement bdinfo -a"

Clean up our bdinfo command a bit and introduce "bdinfo -a"

12 months agotest: bdinfo: Test bdinfo -e
Marek Vasut [Sat, 7 Oct 2023 21:41:06 +0000 (23:41 +0200)]
test: bdinfo: Test bdinfo -e

The bdinfo -e should print only the board ethernet settings.
Test the expected output.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
12 months agotest: bdinfo: Test bdinfo -m
Marek Vasut [Sat, 7 Oct 2023 21:41:05 +0000 (23:41 +0200)]
test: bdinfo: Test bdinfo -m

The bdinfo -m should print only the board memory layout.
Test the expected output.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
12 months agotest: bdinfo: Test bdinfo -h
Marek Vasut [Sat, 7 Oct 2023 21:41:04 +0000 (23:41 +0200)]
test: bdinfo: Test bdinfo -h

The bdinfo -h should print error message that -h is an unknown
parameter and then command help text. Test the expected output.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
12 months agotest: bdinfo: Test both bdinfo and bdinfo -a
Marek Vasut [Sat, 7 Oct 2023 21:41:03 +0000 (23:41 +0200)]
test: bdinfo: Test both bdinfo and bdinfo -a

Factor out the core of test for all bdinfo output into bdinfo_test_all()
and then reuse it to verify that both 'bdinfo' and 'bdinfo -a' print all
the bdinfo output.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
12 months agotest: bdinfo: Rename bdinfo_test_move() to bdinfo_test_full()
Marek Vasut [Sat, 7 Oct 2023 21:41:02 +0000 (23:41 +0200)]
test: bdinfo: Rename bdinfo_test_move() to bdinfo_test_full()

Rename bdinfo_test_move() to bdinfo_test_full(). The former is a
remnant of deriving this test from another test. No functional
change.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
12 months agoconfigs: sandbox: Enable GETOPT for sandbox and sandbox64 target
Marek Vasut [Sat, 7 Oct 2023 21:41:01 +0000 (23:41 +0200)]
configs: sandbox: Enable GETOPT for sandbox and sandbox64 target

Enable GETOPT so that 'bdinfo' command with getopt() support can be
tested in CI.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
12 months agocmd: bdinfo: Implement support for printing ethernet settings via bdinfo -e
Marek Vasut [Sat, 7 Oct 2023 21:41:00 +0000 (23:41 +0200)]
cmd: bdinfo: Implement support for printing ethernet settings via bdinfo -e

Add support for printing ethernet settings only via 'bdinfo -e' .

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
12 months agocmd: bdinfo: Implement support for printing memory layout via bdinfo -m
Marek Vasut [Sat, 7 Oct 2023 21:40:59 +0000 (23:40 +0200)]
cmd: bdinfo: Implement support for printing memory layout via bdinfo -m

Add support for printing memory layout only via 'bdinfo -m' .

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
12 months agocmd: bdinfo: Optionally use getopt and implement bdinfo -a
Marek Vasut [Sat, 7 Oct 2023 21:40:58 +0000 (23:40 +0200)]
cmd: bdinfo: Optionally use getopt and implement bdinfo -a

Add optional support for getopt() and in case this is enabled via
GETOPT configuration option, implement support for 'bdinfo -a'.
The 'bdinfo -a' behaves exactly like bdinfo and prints 'all' the
bdinfo information. This is implemented in preparation for other
more fine-grained options.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
12 months agoMerge tag 'v2024.01-rc4' into next
Tom Rini [Tue, 5 Dec 2023 02:39:57 +0000 (21:39 -0500)]
Merge tag 'v2024.01-rc4' into next

Prepare v2024.01-rc4

# -----BEGIN PGP SIGNATURE-----
#
# iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmVuHrwACgkQFHw5/5Y0
# tyy3Tgv+LB/X0ZR3IHnu1mvQ7kpOFvAjjKr0BUpcEEzsrDZeJnS6sy06m+REez2E
# UmuLeKFj5NUCYXNKtxn2+gVnJt8Tk6ftxhMTiZHmR4Y4NVc5aPtqYmVsv6Q29j0U
# mcg7AGcZTniu9/naNM+ZcDeHzLDAB0whmE9eVfixXVgyitILoLHNdFiQ7W4oR7Kh
# /mBgdMDBS3rqiRi6CuqKUnl4ADX8T3AXaSfi3hqOC5Pj+HPkZSUfyWx31mu9mN1D
# wXTHASZX06Dop25fm/ZSdWk1blBw29WqRiJBdwNatvyC5pqMsotTvAfH2AcHBEYg
# tpoper+WDOBAipt6b6Y1B7q4VPvJ97L9dFCAYqN0nGCe+rkdi+k+cly7M6Ye9xLt
# e7rVUfnKgIMP8jkLcVBYoWkFY5FiJ82O5qjoF5N3dAuHeWacDFsB5TugDTOQvblH
# LWCmcIyU1N9Ma/Ib0rTvNduvpBUYBKXYlD1+rjPZUbTUnfc79mf+ReFpcoW6Kxh+
# bkz81p8P
# =ebIZ
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 04 Dec 2023 01:47:24 PM EST
# gpg:                using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

12 months agoPrepare v2024.01-rc4
Tom Rini [Mon, 4 Dec 2023 18:46:56 +0000 (13:46 -0500)]
Prepare v2024.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoefi_loader: generated SMBIOS table below 4 GiB
Heinrich Schuchardt [Mon, 20 Nov 2023 22:25:58 +0000 (23:25 +0100)]
efi_loader: generated SMBIOS table below 4 GiB

We currently use an outdated format 32-bit format for SMBIOS tables.
So we must allocate SMBIOS tables below 4 GiB.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
12 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-watchdog
Tom Rini [Mon, 4 Dec 2023 18:37:18 +0000 (13:37 -0500)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-watchdog

- Correct watchdog timeout print message (Chanho Park)

12 months agowatchdog: Correct watchdog timeout print message
Chanho Park [Sun, 3 Dec 2023 08:30:40 +0000 (17:30 +0900)]
watchdog: Correct watchdog timeout print message

The wdt_start function takes timeout_ms as a parameter and starts the
watchdog with this value. However, when you output the message, it shows
the default timeout value for the watchdog device.
So this patch fixes that part to output the correct timeout value.

Before -->
StarFive # wdt start 3000
WDT:   Started watchdog@13070000 without servicing  (60s timeout)

After -->
StarFive # wdt start 3000
WDT:   Started watchdog@13070000 without servicing  (3s timeout)

Fixes: c2fd0ca1a822 ("watchdog: Integrate watchdog triggering into the cyclic framework")
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Reviewed-by: Stefan Roese <sr@denx.de>
12 months agoMerge branch 'master-rpc-off' of https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sun, 3 Dec 2023 21:30:32 +0000 (16:30 -0500)]
Merge branch 'master-rpc-off' of https://source.denx.de/u-boot/custodians/u-boot-sh

12 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Sat, 2 Dec 2023 18:37:27 +0000 (13:37 -0500)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-usb

- USB XHCI fixes

12 months agoARM: dts: renesas: Disable RPC driver on R8A779G0 V4H White Hawk board
Cong Dang [Mon, 19 Jun 2023 22:41:50 +0000 (00:41 +0200)]
ARM: dts: renesas: Disable RPC driver on R8A779G0 V4H White Hawk board

As requirement of CR side, QSPI Flash usage via RPC driver shall
be disabled and leaving the control of this module to CR side.
Perform DT modification to disable the RPC SPI.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Cong Dang <cong.dang.xn@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
[Marek: Do not modify defconfig, modify the DT instead, this way
        the RPC SPI can be enabled without recompiling the U-Boot
itself. Update commit message accordingly.]

12 months agoARM: dts: renesas: Clean up R8A779G0 V4H RPC SPI DT node
Marek Vasut [Mon, 19 Jun 2023 22:41:49 +0000 (00:41 +0200)]
ARM: dts: renesas: Clean up R8A779G0 V4H RPC SPI DT node

Use the phandle reference to &rpc node in arch/arm/dts/r8a779g0.dtsi
and remove properties which are already in arch/arm/dts/r8a779g0.dtsi.
No functional change and no resulting DT change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
12 months agousb: USB_XHCI_PCI depends on PCI
Heinrich Schuchardt [Mon, 20 Nov 2023 14:56:36 +0000 (15:56 +0100)]
usb: USB_XHCI_PCI depends on PCI

Compiling with CONFIG_USB_XHCI_PCI and CONFIG_PCI=n results in

    usb/host/xhci-pci.c:48:(.text.xhci_pci_probe+0x44):
    undefined reference to `dm_pci_write_config32

Add the missing Kconfig dependency.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Marek Vasut <marex@denx.de>
12 months agousb: dwc3-generic: Use combined glue and ctrl node for RK3588
Jonas Karlman [Sun, 12 Nov 2023 15:25:25 +0000 (15:25 +0000)]
usb: dwc3-generic: Use combined glue and ctrl node for RK3588

Like Rockchip RK3328 and RK3568, the RK3588 also have a single node to
represent the glue and ctrl for USB 3.0.

Use rk_ops as driver data to select correct ctrl node for RK3588 DWC3.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Marek Vasut <marex@denx.de>
12 months agousb: storage: Use the correct CBW lengths
Hector Martin [Sun, 29 Oct 2023 07:23:30 +0000 (16:23 +0900)]
usb: storage: Use the correct CBW lengths

USB UFI uses fixed 12-byte commands (as does RBC, which is not
supported), but SCSI does not have this limitation. Use the correct
command block lengths depending on the subclass.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
12 months agousb: hub: Add missing reset recovery delay
Hector Martin [Sun, 29 Oct 2023 07:09:09 +0000 (16:09 +0900)]
usb: hub: Add missing reset recovery delay

Some devices like YubiKeys need more time before SET_ADDRESS. The spec
says we need to wait 10ms.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
12 months agousb: xhci: Fix DMA address calculation in queue_trb
Hector Martin [Sun, 29 Oct 2023 06:37:44 +0000 (15:37 +0900)]
usb: xhci: Fix DMA address calculation in queue_trb

We need to get the DMA address before incrementing the pointer, as that
might move us onto another segment.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
12 months agousb: xhci: Do not panic on event timeouts
Hector Martin [Sun, 29 Oct 2023 06:37:43 +0000 (15:37 +0900)]
usb: xhci: Do not panic on event timeouts

Now that we always check the return value, just return NULL on timeouts.
We can still log the error since this is a problem, but it's not reason
to panic.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
12 months agousb: xhci: Fail on attempt to queue TRBs to a halted endpoint
Hector Martin [Sun, 29 Oct 2023 06:37:42 +0000 (15:37 +0900)]
usb: xhci: Fail on attempt to queue TRBs to a halted endpoint

This isn't going to work, don't pretend it will and then end up timing
out.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
12 months agousb: xhci: Recover from halted bulk endpoints
Hector Martin [Sun, 29 Oct 2023 06:37:41 +0000 (15:37 +0900)]
usb: xhci: Recover from halted bulk endpoints

There is currently no codepath to recover from this case. In principle
we could require that the upper layer do this explicitly, but let's just
do it in xHCI when the next bulk transfer is started, since that
reasonably implies whatever caused the problem has been dealt with.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
12 months agousb: xhci: Allow context state errors when halting an endpoint
Hector Martin [Sun, 29 Oct 2023 06:37:40 +0000 (15:37 +0900)]
usb: xhci: Allow context state errors when halting an endpoint

There is a race where an endpoint may halt by itself while we are trying
to halt it, which results in a context state error. See xHCI 4.6.9 which
mentions this case.

This also avoids BUGging when we attempt to stop an endpoint which was
already stopped to begin with, which is probably a bug elsewhere but
not a good reason to crash.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>
12 months agousb: xhci: Better error handling in abort_td()
Hector Martin [Sun, 29 Oct 2023 06:37:39 +0000 (15:37 +0900)]
usb: xhci: Better error handling in abort_td()

If the xHC has a problem with our STOP ENDPOINT command, it is likely to
return a completion directly instead of first a transfer event for the
in-progress transfer. Handle that more gracefully.

We still BUG() on the error code, but at least we don't end up timing
out on the event and ending up with unexpected event errors.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>