Commit graph

6473 commits

Author SHA1 Message Date
Philip Oberfichtner
2fc8638403 usb: Assimilate usb_get_descriptor() to linux
Before this commit, usb_get_descriptor() failed for some flakey USB
devices. We hereby adopt the more robust linux implementation [1].

For instance, for the "Alcor Micro Corp. Flash Drive" (VID 0x058f, PID
0x6387), the following behavior occurs from time to time:

=> usb start
starting USB...
Bus xhci_pci: Register 10000840 NbrPorts 16
Starting the controller
USB XHCI 1.20
scanning bus xhci_pci for devices... usb_new_device: Cannot read configuration, skipping device 058f:6387

Signed-off-by: Philip Oberfichtner <pro@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>

[1] From a38297e3fb012 (Linux 6.9), see
    https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/core/message.c?h=v6.9#n781
2024-07-06 14:45:34 +02:00
Rasmus Villemoes
a8729a260b global_data.h: drop write-only field dm_root_f
The dm_root_f field seems to be entirely write-only and hence
redundant, unless 'git grep' fails to find some access generated via
preprocessor token concatenation or similar.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03 07:36:33 +01:00
Tom Rini
65fbdab272 Merge branch 'next' 2024-07-01 15:00:56 -06:00
Heinrich Schuchardt
a5e31659cf spl: correct link to FIT specification
Replace the invalid link to the FIT file format specification.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-06-30 13:58:31 +02:00
Simon Glass
024767e66d spl: Allow ATF to work when dcache is disabled
The dcache may not be enabled in SPL. Add a check to avoid trying to
use an undefined function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2024-06-28 13:54:52 -06:00
Tom Rini
a7eada2432 Prepare v2024.07-rc5
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmZ5yTEACgkQFHw5/5Y0
 tywDtwv6AhYfLbudtOBBnDzEaZ0oC3ZbxfqwvSq4A16ftZoKdzv6stXLJg4L4nJ2
 u5OQo9DuSw+x1bE1bTo/ajumwJyymZ1SqQJZ7MlGJ/+ZARSpKOsN9J9JWNY9n2Ew
 A0PQ20WcDX93QjEMnS2cxfNx7jOBkKsWXAkgQ/K4ITxBmne55ioPmJvzxhGyHkPJ
 +JtOSEJxhHiFhxHy4ptb1sQSYs6wHxHt/im88CutyG/hYjaXp0xiuLQMXoIg4sQT
 P7Y4AtvDEjD6/y4VHG7Hg04pZMv255zQAGm2dlmOeOUT+Hsi0E9xrEnT7q0WOcjV
 tkx5HjxkLyGiQbHB4UFip8u/xfJb432HNGifCBBuIA6CP4zrM7VoKrs2Ql9xQ7UV
 mNFHPnwr5K0Ge+QvmJS9RgCfqFk+UgcfFHh+ReDVCGeW8WYfDNJzvfpx+UsrB98b
 APJ9JxnVmOo5WlA5FSLDrod2l4WXrLL8jo6LdxAKJWZTLWddpL2y/AA39lVq76vi
 EnSUt2Mf
 =t6QJ
 -----END PGP SIGNATURE-----

Merge tag 'v2024.07-rc5' into next

Prepare v2024.07-rc5
2024-06-24 13:34:52 -06:00
Jiaxun Yang
1fd754cebd cyclic: Rise default CYCLIC_MAX_CPU_TIME_US to 5000
The default value CYCLIC_MAX_CPU_TIME_US was 1000, which is
a little bit too low for slower hardware and sandbox.

On my MIPS Boston FPGA board with interaptiv CPU, wdt_cyclic
can easily take 3200 us to run.

On azure pipeline sandbox_clang, wdt_cyclic some times goes
beyond 1300 us.

Raise default value to 5000, which is the value already taken
by octeon_nic32. This is still sufficent to maintain system
responsiveness.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2024-06-18 12:34:37 +02:00
Tom Rini
f1de28e67a AMD/Xilinx changes for v2024.10-rc1
common:
 - spl: Introduce SoC specific init function
 
 xilinx:
 - Enable FF-A and NVMEM
 - Rename spl_board_init() to spl_soc_init()
 
 zynqmp:
 - DT alignments
 - Enable reset from SPL
 - Enable USB3 for KD240
 - Align multiboot register on Kria for proper reboot
 - Allow multiboot environment write even in saved environment
 - Move zynqmp commands from board/ to arch/
 - Clean up xilinx_zynqmp.h
 
 versal:
 - Do not prioritize boot device if driver is not enabled
 
 versal-net:
 - Setup location for redundant variables in SPI
 
 versal2:
 - Add support for new SOC
 
 mmc:
 - Fix tap delay for SD on Versal NET
 
 spi:
 - Add SPI_NOR_OCTAL_READ flag for mx66uw2g345gx0 flash part
 
 gpio:
 - Cover MODEPIN firmware dependency
 -----BEGIN PGP SIGNATURE-----
 
 iF0EABECAB0WIQQbPNTMvXmYlBPRwx7KSWXLKUoMIQUCZnBfewAKCRDKSWXLKUoM
 Ib/7AJ0cn3q7lMpxbSbRj33oftI8Vy8+owCeN35Nl8TN9l/DHbfusER4uVfnOVw=
 =YMIB
 -----END PGP SIGNATURE-----

Merge tag 'xilinx-for-v2024.10-rc1' of https://source.denx.de/u-boot/custodians/u-boot-microblaze into next

AMD/Xilinx changes for v2024.10-rc1

common:
- spl: Introduce SoC specific init function

xilinx:
- Enable FF-A and NVMEM
- Rename spl_board_init() to spl_soc_init()

zynqmp:
- DT alignments
- Enable reset from SPL
- Enable USB3 for KD240
- Align multiboot register on Kria for proper reboot
- Allow multiboot environment write even in saved environment
- Move zynqmp commands from board/ to arch/
- Clean up xilinx_zynqmp.h

versal:
- Do not prioritize boot device if driver is not enabled

versal-net:
- Setup location for redundant variables in SPI

versal2:
- Add support for new SOC

mmc:
- Fix tap delay for SD on Versal NET

spi:
- Add SPI_NOR_OCTAL_READ flag for mx66uw2g345gx0 flash part

gpio:
- Cover MODEPIN firmware dependency
2024-06-17 11:01:35 -06:00
Lukas Funke
52ef6a9cb8 spl: Introduce SoC specific init function
Some architectures use spl_board_init() in their SoC specific
implementation. Board developers should be able to add board specific
implementation via spl_board_init(). Hence, introduce a spl_soc_init()
method which is called right before spl_board_init() for SoC
specific implementation.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Link: https://lore.kernel.org/r/20240327121153.2455126-2-lukas.funke-oss@weidmueller.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2024-06-17 16:02:29 +02:00
Tom Rini
e242cd9513 Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-watchdog into next
- misc cyclic infrastructure improvements (Rasmus)
- watchdog_reset cleanup (Rasmus)

CI: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=369&view=results
2024-06-16 09:10:13 -06:00
Rasmus Villemoes
008c4b3c31 cyclic: make clients embed a struct cyclic_info in their own data structure
There are of course not a whole lot of examples in-tree yet, but
before they appear, let's make this API change: Instead of separately
allocating a 'struct cyclic_info', make the users embed such an
instance in their own structure, and make the convention that the
callback simply receives the 'struct cyclic_info *', from which the
clients can get their own data using the container_of() macro.

This has a number of advantages.

First, it means cyclic_register() simply cannot fail, simplifying the
code. The necessary storage will simply be allocated automatically
when the client's own structure is allocated (often via
uclass_priv_auto or similar).

Second, code for which CONFIG_CYCLIC is just an option can more easily
be written without #ifdefs, if we just provide an empty struct
cyclic_info {}. For example, the nested CONFIG_IS_ENABLED()s in
https://lore.kernel.org/u-boot/20240316201416.211480-1-marek.vasut+renesas@mailbox.org/
are mostly due to the existence of the 'struct cyclic_info *' member
being guarded by #ifdef CONFIG_CYCLIC.

And we do probably want to avoid the extra memory overhead of that
member when !CONFIG_CYCLIC. But that is automatic if, instead of a
'struct cyclic_info *', one simply embeds a 'struct cyclic_info',
which will have size 0 when !CONFIG_CYCLIC. Also, the no-op
cyclic_register() function can just unconditionally be called, and the
compiler will see that (1) the callback is referenced, so not emit a
warning for a maybe-unused function and (2) see that it can actually
never be reached, so not emit any code for it.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2024-06-16 12:13:44 +02:00
Rasmus Villemoes
3a11eada38 cyclic: stop strdup'ing name in cyclic_register()
We are not checking the return value of strdup(), nor
freeing the string in cyclic_unregister().

However, all current users either pass a string literal or the
dev->name of the client device. So in all cases the name string will
live at least as long as the cyclic_info is registered, so just make
that a requirement.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2024-06-16 12:13:38 +02:00
Tom Rini
281a80c483 Merge patch series "efi_loader: select BLK not depends on BLK"
Tom Rini <trini@konsulko.com> says:

Rework how the BLK symbol is used now that so much DM migration has been
completed.
2024-06-14 12:59:06 -06:00
Tom Rini
9c9e667965 spl: nvme: Make this depend on SPL_BLK
As this is an SPL related driver, and in SPL enabling SPL_BLK is
optional, make this depend on the correct symbol.

Signed-off-by: Tom Rini <trini@konsulko.com>
2024-06-14 10:39:35 -06:00
Vignesh Raghavendra
081b97c3b3 spl: Kconfig: ARCH_K3: Set default SPL_STACK_R_MALLOC_SIMPLE_LEN for R5 build
All ARCH_K3 platforms need about of 2MB of malloc space post
reallocation. Since, this space is allocated from SDRAM, provide a
generous 2MB space by default.

Platforms requiring more than 2MB can override in defconfig as needed.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
2024-06-13 16:29:26 -06:00
Tom Rini
77ba281c91 Merge patch series "'eeprom' command improvements"
Marek Behún <kabel@kernel.org> says:

This series contains improvements for the 'eeprom' command:
- refactors
- fixes
- improvements
- ability to use driver model EEPROMs (uclass UCLASS_I2C_EEPROM)
- more flexible EEPROM layout support

It should not cause any behavior change for any existing board.

This series is a dependency for some DDR issue fixes for Turris Omnia.
I will be sending that one separately.

github PR link (with CI):
  https://github.com/u-boot/u-boot/pull/540
- there is a failure for
    test.py for sandbox sandbox_clang
  but it seems unrelated to these changes
2024-06-07 10:48:41 -06:00
Marek Behún
951dc4e077 common: eeprom_field: Drop unnecessary comparison
The byte variable is of type unsigned char, it is never less than zero.
The error case is handled by *endptr, so drop the comparison altogether.

Signed-off-by: Marek Behún <kabel@kernel.org>
2024-06-07 10:47:59 -06:00
Marek Behún
96dfa5869d common: eeprom_field: Fix updating binary field
The __eeprom_field_update_bin() function is expected to parse a hex
string into bytes (potentially in reverse order), but the
simple_strtoul() function is given 0 as base. This does not work since
the string does not contain '0x' prefix. Add explicit base 16.

Signed-off-by: Marek Behún <kabel@kernel.org>
2024-06-07 10:47:59 -06:00
Marek Behún
15378a3fe1 common: eeprom_layout: Split field finding code from the field update function
Split the eeprom layout field finding code from the
eeprom_layout_update_field() function in order to make it usable in
alternative implementations of update method.

Signed-off-by: Marek Behún <kabel@kernel.org>
2024-06-07 10:47:59 -06:00
Marek Behún
a804c8dc5f common: eeprom_layout: Assign default layout methods and parameters before specific ones
Assign the default eeprom layout parameter .data_size and methods
.print() and .update() before calling eeprom_layout_assign() in
eeprom_layout_setup().

This allows eeprom_layout_assign() to overwrite these if needed.

Signed-off-by: Marek Behún <kabel@kernel.org>
2024-06-07 10:47:59 -06:00
Raymond Mao
cb73fe9eea include: Move snprintf to stdio.h
Move snprintf to stdio.h since it is needed by exteranl libraries.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-05-22 08:55:29 -06:00
Tom Rini
d678a59d2d Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d, reversing
changes made to 2ee6f3a5f7.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19 08:16:36 -06:00
Tom Rini
6a7185887b global: Make <asm/global_data.h> include <asm/u-boot.h>
This follows the example of RISC-V where <asm/global_data.h> includes
<asm/u-boot.h> directly as "gd" includes a reference to bd_info already
and so the first must include the second anyhow. We then remove
<asm/u-boot.h> from all of the places which include references to "gd"
an so have <asm/global_data.h> already.

Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-06 15:07:48 -06:00
Tom Rini
a79fc7a79c common: Remove <common.h> and add needed includes
Remove <common.h> from all "commmon/" files and when needed add
missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-06 15:05:04 -06:00
Jagan Teki
f343dccaf1 rockchip: Enable preconsole for rk3328
Enable and set the start address of pre-console buffer for RK3328.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
2024-04-21 09:07:00 +02:00
Tom Rini
b03b49046a Merge https://source.denx.de/u-boot/custodians/u-boot-usb 2024-04-14 15:58:31 -06:00
Tom Rini
977fc15e98 Merge patch series "mcheck implementation for U-Boot"
Eugene Uriev <eugeneuriev@gmail.com> says:

There was no "mcheck" for U-Boot before.

Since U-Boot has only 1 thread, and normally makes 4000+ - 6000+
mallocs, it's better to use havier canaries to protect heap-chunks.
My variant uses 2x8 = 16byte-long protector. And
the multiplier could be changed to tune speed/protection tradeoff.
This protects not only against memset()-s, but against "near" wild
pointers too, and makes more probable to catch "distant" ones.

The core file of the set is included into the C-file, not complied
separately in order to enable (potential) coexisting of
mcheck-protectors, e.g. malloc_simple(.) and dlmalloc simultaneously.

My tests were for ARM SoC, 64bit, so the patch is
aware of alignment.

Primary this patch is for using by developers: to verify,
if a change doesn't break the heap integrity.
By default the mcheck is disabled and wouldn't affect the boot.

I used pedantic mode, canary=16byte, registry-size=6608.
For my system the overhead was 230ms.
2024-04-12 16:23:19 -06:00
Eugene Uriev
707a6dfb2b mcheck: let mcheck_abortfunc_t print the pointer
Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12 16:23:06 -06:00
Eugene Uriev
a0ff152d4f mcheck: add stats, add a comment with test results
My tests have been run on an U-Boot (of older version)
for ARM (64bits).

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12 16:23:06 -06:00
Eugene Uriev
7bceb16106 mcheck: introduce mcheck_on_ramrelocation(.)
The using of pre-reloc/malloc_simple heap is
too hard to follow after the relocation.

So lets drop it from the pedantic registry
and switch to dlmalloc, when moved.

The offset is ignored, but kept in the API
for the probable case, when that early
heap is relocated too.

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12 16:23:06 -06:00
Eugene Uriev
18c1bfafe0 mcheck: add pedantic mode support
The pedantic mode is run-time contolled, so
appropriate registry take place everytime.

Maybe it's worth to use compile-time control only.
So, the registry could be optimized out by an #ifdef.

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12 16:23:06 -06:00
Eugene Uriev
ae838768d7 mcheck: support memalign
Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12 16:23:06 -06:00
Eugene Uriev
151493a875 mcheck: integrate mcheck into dlmalloc.c
This changes are probable worth to be generalized in a
separate .h-file so, making it able to cover
libc-mallocs and others, without too much copy-paste.

But the malloc<=>mALLOc substitutions interfere
with an elegant way to do this.

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12 16:23:06 -06:00
Eugene Uriev
7dafc5c925 mcheck: introduce essentials of mcheck
The core part of mcheck, but without memalign.
memalign - to be added in ensuing commits.

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12 16:23:06 -06:00
Eugene Uriev
dfba071ddc mcheck: Use memset/memcpy instead of MALLOC_ZERO/MALLOC_COPY for mcheck.
These fast helpers sometimes breach mem-chunk boundaries.
Thus they trigger mcheck alarm. Standard ones are accurate though.

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12 16:23:06 -06:00
Eugene Uriev
c82ff48115 mcheck: prepare +1 tier for mcheck-wrappers, in dl-*alloc commands
Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12 16:23:06 -06:00
Heinrich Schuchardt
d2e4b2fa04 cli: always show cursor
We may enter the command line interface in a state where on the remote
console the cursor is not shown. Send an escape sequence to enable it.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-04-12 08:53:31 -06:00
Janne Grunau
63f6a449bf usb: kbd: Add probe quirk for Apple and Keychron keyboards
Those keyboards do not return the current device state. Polling will
timeout unless there are key presses. This is not a problem during
operation but the initial device state query during probing will fail.
Skip this step in usb_kbd_probe_dev() to make these devices useable.
Not all Apple keyboards behave like this. A keyboard with USB
vendor/product ID 05ac:0221 is reported to work with the current code.
Unfortunately some Keychron keyboards "re-use" Apple's vendor ID and
show the same behavior (Keychron C2, 05ac:024f for example).

Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Janne Grunau <j@jannau.net>
2024-04-12 14:53:13 +02:00
Janne Grunau
575c68279c usb: kbd: support Apple Magic Keyboards (2021)
Apple USB keyboards (Magic Keyboard from 2021 (product id 0x029c)) carry
the HID keyboard boot protocol on the second interface descriptor.
Probe via vendor and product IDs since the class/subclass/protocol match
uses the first interface descriptor.
Probe the two first interface descriptors for the HID keyboard boot
protocol.

USB configuration descriptor for reference:

| Bus 003 Device 002: ID 05ac:029c Apple, Inc. Magic Keyboard
| Device Descriptor:
|   bLength                18
|   bDescriptorType         1
|   bcdUSB               2.00
|   bDeviceClass            0 [unknown]
|   bDeviceSubClass         0 [unknown]
|   bDeviceProtocol         0
|   bMaxPacketSize0        64
|   idVendor           0x05ac Apple, Inc.
|   idProduct          0x029c Magic Keyboard
|   bcdDevice            3.90
|   iManufacturer           1 Apple Inc.
|   iProduct                2 Magic Keyboard
|   iSerial                 3 ...
|   bNumConfigurations      1
|   Configuration Descriptor:
|     bLength                 9
|     bDescriptorType         2
|     wTotalLength       0x003b
|     bNumInterfaces          2
|     bConfigurationValue     1
|     iConfiguration          4 Keyboard
|     bmAttributes         0xa0
|       (Bus Powered)
|       Remote Wakeup
|     MaxPower              500mA
|     Interface Descriptor:
|       bLength                 9
|       bDescriptorType         4
|       bInterfaceNumber        0
|       bAlternateSetting       0
|       bNumEndpoints           1
|       bInterfaceClass         3 Human Interface Device
|       bInterfaceSubClass      0 [unknown]
|       bInterfaceProtocol      0
|       iInterface              5 Device Management
|         HID Device Descriptor:
|           bLength                 9
|           bDescriptorType        33
|           bcdHID               1.10
|           bCountryCode            0 Not supported
|           bNumDescriptors         1
|           bDescriptorType        34 Report
|           wDescriptorLength      83
|           Report Descriptors:
|             ** UNAVAILABLE **
|       Endpoint Descriptor:
|         bLength                 7
|         bDescriptorType         5
|         bEndpointAddress     0x81  EP 1 IN
|         bmAttributes            3
|           Transfer Type            Interrupt
|           Synch Type               None
|           Usage Type               Data
|         wMaxPacketSize     0x0010  1x 16 bytes
|         bInterval               8
|     Interface Descriptor:
|       bLength                 9
|       bDescriptorType         4
|       bInterfaceNumber        1
|       bAlternateSetting       0
|       bNumEndpoints           1
|       bInterfaceClass         3 Human Interface Device
|       bInterfaceSubClass      1 Boot Interface Subclass
|       bInterfaceProtocol      1 Keyboard
|       iInterface              6 Keyboard / Boot
|         HID Device Descriptor:
|           bLength                 9
|           bDescriptorType        33
|           bcdHID               1.10
|           bCountryCode           13 International (ISO)
|           bNumDescriptors         1
|           bDescriptorType        34 Report
|           wDescriptorLength     207
|           Report Descriptors:
|             ** UNAVAILABLE **
|       Endpoint Descriptor:
|         bLength                 7
|         bDescriptorType         5
|         bEndpointAddress     0x82  EP 2 IN
|         bmAttributes            3
|           Transfer Type            Interrupt
|           Synch Type               None
|           Usage Type               Data
|         wMaxPacketSize     0x0010  1x 16 bytes
|         bInterval               8

Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Janne Grunau <j@jannau.net>
2024-04-12 14:53:13 +02:00
Janne Grunau
18f288b8d4 usb: Add environment based device ignorelist
Add the environment variable "usb_ignorelist" to prevent USB devices
listed in it from being bound to drivers. This allows to ignore devices
which are undesirable or trigger bugs in u-boot's USB stack.
Devices emulating keyboards are one example of undesirable devices as
u-boot currently supports only a single USB keyboard device. Most
commonly, people run into this with Yubikeys, so let's ignore those in
the default environment.

Based on previous USB keyboard specific patches for the same purpose.

Link: https://lore.kernel.org/u-boot/7ab604fb-0fec-4f5e-8708-7a3a7e2cb568@denx.de/
Reviewed-by: Neal Gompa <neal@gompa.dev>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Janne Grunau <j@jannau.net>
2024-04-12 14:53:13 +02:00
Tom Rini
d312d9831f Merge branch 'next'
Merge in all changes from the next branch now that the release is out.
2024-04-02 07:03:25 -04:00
Randolph
0cfe1bc6ed spl: riscv: opensbi: fix check of PAYLOAD_ARGS_ADDR
When Falcon Mode is enabled on RISC-V, use CONFIG_VAL
to check PAYLOAD_ARGS_ADDR, not CONFIG_IS_ENABLED.

Fixes: 10c4ab898c ("spl: riscv: falcon: move fdt blob to specified address")
Signed-off-by: Randolph <randolph@andestech.com>
Tested-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2024-03-26 17:31:24 +08:00
Caleb Connolly
d47e1fa819 test: dm: add button_cmd test
Add a test for the button_cmd feature. This validates that commands can
be mapped to two buttons, that the correct command runs based on which
button is pressed, that only 1 command is run, and that no command runs
if button_cmd_0_name is wrong or unset.

Additionally, fix a potential uninitialised variable use caught by these
tests, the btn variable in get_button_cmd() is assumed to be null if
button_get_by_label() fails, but it's actually used uninitialised in
that case.

CONFIG_BUTTON is now enabled automatically and was removed when running
save_defconfig.

Fixes: e761035b64 ("boot: add support for button commands")
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2024-03-20 17:13:05 -04:00
Leo Yu-Chi Liang
aeda4ccf3c spl: Improve error message for SPL memory allocation
There could be two memory allocation scheme in SPL phase.
Explicitly print the corresponding error message.

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2024-03-20 17:12:38 -04:00
Hanyuan Zhao
421359ac52 cli: allow users to determine history buffer allocation method
This commit allows users to choose the appropriate memory
allocation method between static allocated and dynamically
calloc. The previous static-array way will not obviously
contribute to the final binary size since it is uninitialized,
and might have better performance than the dynamical one.
Now we provide the users with both the two options.

Signed-off-by: Hanyuan Zhao <hanyuan-z@qq.com>
2024-03-13 12:40:43 -04:00
Hanyuan Zhao
4495134030 cli: panic when failed to allocate memory for the history buffer
This commit simply modifies the history initialize function,
replacing the return value by panic with reasons. The calling
chains of hist_init don't have steps explicitly throwing or
dealing with the ENOMEM error, and once the init fails, the
whole system is died. Using panic here to provide error
information instead.

Signed-off-by: Hanyuan Zhao <hanyuan-z@qq.com>
2024-03-13 12:40:43 -04:00
Igor Opaniuk
6ec3f92089 cmd: md5sum: use hash_command
Drop old implementation and use hash_command() instead, as
how it's currently done for crc32 and sha1sum cmds.

Test:
=> md5sum 0x60000000 0x200
md5 for 60000000 ... 600001ff ==> e6bbbe95f5b41996f4a9b9af7bbd4050

Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
2024-03-07 09:23:10 -05:00
Maks Mishin
606867c849 autoboot: Add check for result of malloc_cache_aligned()
Return value of a function 'malloc_cache_aligned'
is dereferenced at autoboot.c:207 without checking for NULL,
but it is usually checked for this function.

Found by RASU JSC.

Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
2024-03-07 07:59:17 -05:00
Thomas Weißschuh
39162d9348 log: fixup log_head after relocating global data
When `gd` is relocated during `spl_relocate_stack_gd()` the
doubly-linked circular list in the `log_head` member is broken.

The last element of the list should point back to the initial
`list_head`, but as the initial `list_head` is moved the pointer becomes
stale. As a result the loop in `log_dispatch` would never finish.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
2024-03-02 12:26:56 -05:00
Stefan Bosch
d819250c2a common: board_f: change calculation of gd->mon_len to fix s5p4418 reloc
ARCH_NEXELL: Change calculation of monitor length (gd->mon_len) to fix
relocation at boards with s5p4418-SoC (ARCH_NEXELL). At s5p4418, _start
is after the header (NSIH). Therefore the monitor length has to be
calculated using __image_copy_start instead of _start in order the
whole monitor code is relocated.

Signed-off-by: Stefan Bosch <stefan_b@posteo.net>
2024-03-01 18:34:08 -05:00