aboutsummaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)Author
2024-07-06usb: Assimilate usb_get_descriptor() to linuxPhilip Oberfichtner
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-03global_data.h: drop write-only field dm_root_fRasmus Villemoes
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-01Merge branch 'next'Tom Rini
2024-06-30spl: correct link to FIT specificationHeinrich Schuchardt
Replace the invalid link to the FIT file format specification. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-06-28spl: Allow ATF to work when dcache is disabledSimon Glass
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-24Merge tag 'v2024.07-rc5' into nextTom Rini
Prepare v2024.07-rc5
2024-06-18cyclic: Rise default CYCLIC_MAX_CPU_TIME_US to 5000Jiaxun Yang
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-17Merge tag 'xilinx-for-v2024.10-rc1' of ↵Tom Rini
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-17spl: Introduce SoC specific init functionLukas Funke
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-16Merge branch 'next' of ↵Tom Rini
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-16cyclic: make clients embed a struct cyclic_info in their own data structureRasmus Villemoes
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-16cyclic: stop strdup'ing name in cyclic_register()Rasmus Villemoes
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-14Merge patch series "efi_loader: select BLK not depends on BLK"Tom Rini
Tom Rini <trini@konsulko.com> says: Rework how the BLK symbol is used now that so much DM migration has been completed.
2024-06-14spl: nvme: Make this depend on SPL_BLKTom Rini
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-13spl: Kconfig: ARCH_K3: Set default SPL_STACK_R_MALLOC_SIMPLE_LEN for R5 buildVignesh Raghavendra
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-07Merge patch series "'eeprom' command improvements"Tom Rini
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-07common: eeprom_field: Drop unnecessary comparisonMarek Behún
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-07common: eeprom_field: Fix updating binary fieldMarek Behún
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-07common: eeprom_layout: Split field finding code from the field update functionMarek Behún
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-07common: eeprom_layout: Assign default layout methods and parameters before ↵Marek Behún
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-05-22include: Move snprintf to stdio.hRaymond Mao
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-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
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 c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-06global: Make <asm/global_data.h> include <asm/u-boot.h>Tom Rini
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-06common: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from all "commmon/" files and when needed add missing include files directly. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-04-21rockchip: Enable preconsole for rk3328Jagan Teki
Enable and set the start address of pre-console buffer for RK3328. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
2024-04-14Merge https://source.denx.de/u-boot/custodians/u-boot-usbTom Rini
2024-04-12Merge patch series "mcheck implementation for U-Boot"Tom Rini
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-12mcheck: let mcheck_abortfunc_t print the pointerEugene Uriev
Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12mcheck: add stats, add a comment with test resultsEugene Uriev
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-12mcheck: introduce mcheck_on_ramrelocation(.)Eugene Uriev
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-12mcheck: add pedantic mode supportEugene Uriev
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-12mcheck: support memalignEugene Uriev
Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12mcheck: integrate mcheck into dlmalloc.cEugene Uriev
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-12mcheck: introduce essentials of mcheckEugene Uriev
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-12mcheck: Use memset/memcpy instead of MALLOC_ZERO/MALLOC_COPY for mcheck.Eugene Uriev
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-12mcheck: prepare +1 tier for mcheck-wrappers, in dl-*alloc commandsEugene Uriev
Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12cli: always show cursorHeinrich Schuchardt
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-12usb: kbd: Add probe quirk for Apple and Keychron keyboardsJanne Grunau
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-12usb: kbd: support Apple Magic Keyboards (2021)Janne Grunau
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-12usb: Add environment based device ignorelistJanne Grunau
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-02Merge branch 'next'Tom Rini
Merge in all changes from the next branch now that the release is out.
2024-03-26spl: riscv: opensbi: fix check of PAYLOAD_ARGS_ADDRRandolph
When Falcon Mode is enabled on RISC-V, use CONFIG_VAL to check PAYLOAD_ARGS_ADDR, not CONFIG_IS_ENABLED. Fixes: 10c4ab898c25 ("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-20test: dm: add button_cmd testCaleb Connolly
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: e761035b6423 ("boot: add support for button commands") Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2024-03-20spl: Improve error message for SPL memory allocationLeo Yu-Chi Liang
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-13cli: allow users to determine history buffer allocation methodHanyuan Zhao
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-13cli: panic when failed to allocate memory for the history bufferHanyuan Zhao
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-07cmd: md5sum: use hash_commandIgor Opaniuk
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-07autoboot: Add check for result of malloc_cache_aligned()Maks Mishin
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-02log: fixup log_head after relocating global dataThomas Weißschuh
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-01common: board_f: change calculation of gd->mon_len to fix s5p4418 relocStefan Bosch
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>