platform/kernel/u-boot.git
18 months agoeficonfig: add vertical scroll support
Masahisa Kojima [Tue, 24 Jan 2023 06:56:15 +0000 (15:56 +0900)]
eficonfig: add vertical scroll support

The current eficonfig menu does not support vertical scroll,
so it can not display the menu entries greater than
the console row size.

This commit add the vertial scroll support.
The console size is retrieved by
SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode() service, then
calculates the row size for menu entry by subtracting
menu header and description row size from the console row size.
"start" and "end" are added in the efimenu structure.
"start" keeps the menu entry index at the top, "end" keeps
the bottom menu entry index. item_data_print() menu function
only draws the menu entry between "start" and "end".

This commit also fixes the issue that "Save" and "Quit"
entries can be moved by BKEY_PLUS in change boot order menu.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
18 months agoeficonfig: refactor change boot order implementation
Masahisa Kojima [Tue, 24 Jan 2023 06:56:14 +0000 (15:56 +0900)]
eficonfig: refactor change boot order implementation

This commit removes the change boot order specific
menu implementation. The change boot order implementation
calls eficonfig_process_common() same as other menus.

The change boot order menu requires own item_data_print
and item_choice implementation, but display_statusline
function can be a same function as other menus.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
18 months agoeficonfig: refactor eficonfig_process_common function
Masahisa Kojima [Tue, 24 Jan 2023 06:56:13 +0000 (15:56 +0900)]
eficonfig: refactor eficonfig_process_common function

Current change boot order implementation does not call
eficonfig_process_common() and call own menu functions
for display_statusline, item_data_print and item_choice.
Change boot order functionality should call
eficonfig_process_common() to improve maintenanceability.

This commit is a preparation to remove the change boot
order specific implementation. The menu functions
(display_statusline, item_data_print and item_choice) are
added as argument of eficonfig_process_common().
The menu description string displayed at the bottom of
the menu is also added as argument.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
18 months agoefi_loader: fix comment in ESRT code
Heinrich Schuchardt [Mon, 23 Jan 2023 23:25:23 +0000 (00:25 +0100)]
efi_loader: fix comment in ESRT code

There is no variable num_pages in function efi_esrt_allocate_install().

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
18 months agoREADME: remove 'U-Boot Porting Guide' section
Heinrich Schuchardt [Wed, 25 Jan 2023 19:00:23 +0000 (20:00 +0100)]
README: remove 'U-Boot Porting Guide' section

This section does not match the standards of our documentation.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
18 months agodoc: move directory hierarchy to HTML
Heinrich Schuchardt [Wed, 25 Jan 2023 18:15:02 +0000 (19:15 +0100)]
doc: move directory hierarchy to HTML

Move section 'Directory hierarchy' from file README to the HTML
documentation.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agoREADME: remove section 'Versioning'
Heinrich Schuchardt [Wed, 25 Jan 2023 18:15:01 +0000 (19:15 +0100)]
README: remove section 'Versioning'

The information is already maintained in doc/develop/release_cycle.rst.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agodoc: move 'Reproducible builds'
Heinrich Schuchardt [Wed, 25 Jan 2023 18:15:00 +0000 (19:15 +0100)]
doc: move 'Reproducible builds'

Move the README section to the HTML documentation.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agoREADME: replace references to CHANGELOG
Heinrich Schuchardt [Wed, 25 Jan 2023 18:14:59 +0000 (19:14 +0100)]
README: replace references to CHANGELOG

Board configurations are in configs/ and not in the Makefile.

git log is the adequate way to identify who contributed to our source.
scripts/get_maintainer.pl is the correct way to identify maintainers.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agoREADME: remove NetBSD section
Heinrich Schuchardt [Wed, 25 Jan 2023 18:14:58 +0000 (19:14 +0100)]
README: remove NetBSD section

The information in this section is outdated.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agoREADME: rework contribution advices
Heinrich Schuchardt [Wed, 25 Jan 2023 18:14:57 +0000 (19:14 +0100)]
README: rework contribution advices

Remove description of coding standards and patch submission process.
Link to the relevant HTML documentation instead.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agoREADME: correct path to sandbox.rst
Heinrich Schuchardt [Wed, 25 Jan 2023 18:14:56 +0000 (19:14 +0100)]
README: correct path to sandbox.rst

sandbox.rst was moved.

Fixes: 2851cc94f301 ("dm: Add documentation for host command and implementation")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agodoc: man-page for mtest
Heinrich Schuchardt [Thu, 26 Jan 2023 18:40:35 +0000 (19:40 +0100)]
doc: man-page for mtest

Provide a man-page for the mtest command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
18 months agodoc: add rst references to distro documentation in stm32mp1 board
Patrick Delaunay [Tue, 24 Jan 2023 09:16:02 +0000 (10:16 +0100)]
doc: add rst references to distro documentation in stm32mp1 board

Use internal rst reference with :doc: to have a link to distro.rst page
in the generated U-Boot documentation.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agodoc: rework doc/mkeficapsule.1
Heinrich Schuchardt [Sun, 22 Jan 2023 10:27:10 +0000 (11:27 +0100)]
doc: rework doc/mkeficapsule.1

* Indicate the location of the directory for EFI capsules.
* Improve the readability.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
18 months agodoc: update font man-page
Heinrich Schuchardt [Sat, 21 Jan 2023 16:18:14 +0000 (17:18 +0100)]
doc: update font man-page

* add return values
* move configuration to separate section to match other man-pages
* fix typo

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agospl: doc: use correct name in jump_to_image_optee() description
Ovidiu Panait [Sun, 22 Jan 2023 17:57:13 +0000 (19:57 +0200)]
spl: doc: use correct name in jump_to_image_optee() description

The actual function being documented is jump_to_image_optee(), not
jump_to_image_linux().

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
18 months agodoc: sleep man-page
Heinrich Schuchardt [Sat, 21 Jan 2023 15:24:03 +0000 (16:24 +0100)]
doc: sleep man-page

Provide a man-page for the sleep command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agodoc: example heading should be h2
Heinrich Schuchardt [Sat, 21 Jan 2023 09:25:04 +0000 (10:25 +0100)]
doc: example heading should be h2

The 'Example' heading should be on a lower level than 'bdinfo command'.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agoevent: Document dynamic event handlers
Simon Glass [Fri, 20 Jan 2023 21:46:05 +0000 (14:46 -0700)]
event: Document dynamic event handlers

Add mention of this feature in the event documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agodoc: sl-mx8mm: Add CROSS_COMPILE to U-Boot make call and improve comment
Frieder Schrempf [Thu, 19 Jan 2023 11:20:39 +0000 (12:20 +0100)]
doc: sl-mx8mm: Add CROSS_COMPILE to U-Boot make call and improve comment

Add the CROSS_COMPILE flag as we assume we build in a cross environment.
Also improve the comment about copying the binary to SD card.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
18 months agodoc: sl-mx8mm: Add guide for copying the bootloader to SPI NOR
Frieder Schrempf [Thu, 19 Jan 2023 11:20:38 +0000 (12:20 +0100)]
doc: sl-mx8mm: Add guide for copying the bootloader to SPI NOR

This adds a guide for copying the raw bootloader image on the SD card
to the SPI NOR using U-Boot itself.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
18 months agodoc: sl-mx8mm: Update references to latest DDR firmware 8.18
Frieder Schrempf [Thu, 19 Jan 2023 11:20:37 +0000 (12:20 +0100)]
doc: sl-mx8mm: Update references to latest DDR firmware 8.18

Use the latest firmware available from NXP.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
18 months agodoc: sl-mx8mm: Update the NXP TF-A source reference
Frieder Schrempf [Thu, 19 Jan 2023 11:20:36 +0000 (12:20 +0100)]
doc: sl-mx8mm: Update the NXP TF-A source reference

Use the latest version of the NXP TF-A code and add a note about
quirks with GCC 12.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Convert Note: to ..note::
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
18 months agodoc: sl-mx8mm: Add note about using cross toolchain
Frieder Schrempf [Thu, 19 Jan 2023 11:20:35 +0000 (12:20 +0100)]
doc: sl-mx8mm: Add note about using cross toolchain

This clarifies the usage of a cross toolchain to build U-Boot
and TF-A.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
18 months agodoc: sl-mx8mm: Mention OSM 1.1 support
Frieder Schrempf [Thu, 19 Jan 2023 11:20:34 +0000 (12:20 +0100)]
doc: sl-mx8mm: Mention OSM 1.1 support

The latest revision of the SoM is compliant to OSM 1.1.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
18 months agocmd: fix mtest on 64 bit systems
Heinrich Schuchardt [Thu, 26 Jan 2023 23:38:50 +0000 (00:38 +0100)]
cmd: fix mtest on 64 bit systems

* Use 16 digits on 64 bit systems.
* Use 64 bit patterns on 64 bit systems.
* Expect the sign bit in bit 63 on 64 bit systems.
* Adjust the formatting of a constant.
* Always print result on new line

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Stefan Roese <sr@denx.de>
18 months agoMerge tag 'dm-pull-26jan23' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Fri, 27 Jan 2023 02:57:38 +0000 (21:57 -0500)]
Merge tag 'dm-pull-26jan23' of https://source.denx.de/u-boot/custodians/u-boot-dm

FIT improvements with split-elf, especially for Rockchip
Binman positioning by ELF symbol

18 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-spi
Tom Rini [Thu, 26 Jan 2023 18:07:06 +0000 (13:07 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-spi

- fix return code of sf command (Heinrich)
- fix register reads in STIG Mode (Dhruva)
- Infineon s25fs256t support (Takahiro)

18 months agobinman: Fix a test-coverage regression
Simon Glass [Mon, 23 Jan 2023 18:29:41 +0000 (11:29 -0700)]
binman: Fix a test-coverage regression

Unfortunately a recent patch snuck through without the require test
coverage. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 571bc4e67d3 ("binman: Support positioning an entry by and ELF symbol")

18 months agodm: core: Use full printf() format when possible
Samuel Holland [Sat, 21 Jan 2023 23:30:12 +0000 (17:30 -0600)]
dm: core: Use full printf() format when possible

Use a more accurate check for determining if the full format string will
be handled correctly, since SPL_USE_TINY_PRINTF can be disabled.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agobinman: Add 'min-size' entry property
Samuel Holland [Sat, 21 Jan 2023 23:25:16 +0000 (17:25 -0600)]
binman: Add 'min-size' entry property

This property sets the minimum size of an entry, including padding but
not alignment. It can be used to reserve space for growth of an entry,
or to enforce a minimum offset for later entries in the section.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agorockchip: Use atf as firmware and move u-boot to loadables in FIT
Jonas Karlman [Sat, 21 Jan 2023 19:02:26 +0000 (19:02 +0000)]
rockchip: Use atf as firmware and move u-boot to loadables in FIT

The FIT generated after the switch to using binman is using different
values for firmware and loadables properties compared to the old script.

With the old script:
 firmware = "atf-1";
 loadables = "u-boot", "atf-2", ...;

After switch to binman:
 firmware = "u-boot";
 loadables = "atf-1", "atf-2", ...;

This change result in SPL jumping directly into U-Boot proper instead of
initializing TF-A.

With this patch the properties change back to:
 firmware = "atf-1";
 loatables = "u-boot", "atf-2", ...;

Fixes: e0c0efff2a02 ("rockchip: Support building the all output files in binman")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agobinman: Add support for selecting firmware to use with split-elf
Jonas Karlman [Sat, 21 Jan 2023 19:02:12 +0000 (19:02 +0000)]
binman: Add support for selecting firmware to use with split-elf

In some cases it is desired for SPL to start TF-A instead of U-Boot
proper. Add support for a new property fit,firmware that picks a
valid entry and prepends the remaining valid entries to the
loadables list generated by the split-elf generator.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agorockchip: Add sha256 hash to FIT images
Jonas Karlman [Sat, 21 Jan 2023 19:01:59 +0000 (19:01 +0000)]
rockchip: Add sha256 hash to FIT images

Add sha256 hash to FIT images when CONFIG_SPL_FIT_SIGNATURE=y.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agobinman: Add special subnodes to the nodes generated by split-elf
Jonas Karlman [Sat, 21 Jan 2023 19:01:48 +0000 (19:01 +0000)]
binman: Add special subnodes to the nodes generated by split-elf

Special nodes, hash and signature, is not being added to the nodes
generated for each segment in split-elf operation.

Copy the subnode logic used in _gen_fdt_nodes to _gen_split_elf to
ensure special nodes are added to the generated nodes.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agorockchip: Align FIT image data to SD/MMC block length
Jonas Karlman [Sat, 21 Jan 2023 19:01:39 +0000 (19:01 +0000)]
rockchip: Align FIT image data to SD/MMC block length

SPL load FIT images by reading the data aligned to block length.
Block length aligned image data is read directly to the load address.
Unaligned image data is written to an offset of the load address and
then the data is memcpy to the load address.

This adds a small overhead of having to memcpy unaligned data, something
that normally is not an issue.

However, TF-A may have a segment that should be loaded into SRAM, e.g.
vendor TF-A for RK3568 has a 8KiB segment that should be loaded into the
8KiB PMU SRAM. Having the image data for such segment unaligned result
in segment being written to and memcpy from beyond the SRAM boundary, in
the end this results in invalid data in SRAM.

Aligning the FIT and its external data to MMC block length to work
around such issue.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agobinman: Add support for align argument to mkimage tool
Jonas Karlman [Sat, 21 Jan 2023 19:01:39 +0000 (19:01 +0000)]
binman: Add support for align argument to mkimage tool

Add support to indicate what alignment to use for the FIT and its
external data. Pass the alignment to mkimage via the -B flag.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agomtd: spi-nor: Add support for Infineon s25fs256t
Takahiro Kuwano [Mon, 19 Dec 2022 01:28:21 +0000 (10:28 +0900)]
mtd: spi-nor: Add support for Infineon s25fs256t

Infineon S25FS256T is 256Mbit Quad SPI NOR flash. The key features and
differences comparing to other Spansion/Cypress flash familes are:
  - 4-byte address mode by factory default
  - Quad mode is enabled by factory default
  - Supports mixture of 128KB and 64KB sectors by OTP configuration
    (this patch supports uniform 128KB only)

Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
18 months agomtd: spi-nor: Rename s25hx_t prefix
Takahiro Kuwano [Mon, 19 Dec 2022 01:28:20 +0000 (10:28 +0900)]
mtd: spi-nor: Rename s25hx_t prefix

Rename s25hx_t prefix to s25 so that the single set of fixup hooks can
support all other S25 families.

Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Acked-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
18 months agocmd: fix return code of 'sf erase'
Heinrich Schuchardt [Mon, 2 Jan 2023 17:21:16 +0000 (18:21 +0100)]
cmd: fix return code of 'sf erase'

If the offset or the size passed to the 'sf erase' command exceeds
the size of the SPI flash displaying the command usage is not
helpful. Return CMD_RET_FAILURE instead of CMD_RET_USAGE.

Use the CMD_RET_* constants instead of 0, 1, -1.

Simplify a logical expression in the final return statement.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
18 months agocmd: simplify do_spi_flash()
Heinrich Schuchardt [Mon, 2 Jan 2023 17:21:15 +0000 (18:21 +0100)]
cmd: simplify do_spi_flash()

CMD_RET_USAGE == -1. The special handling of this value at the end of
do_spi_flash() does not make any sense.

To avoid future confusion use the CMD_RET_* constants and simplify the
code.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
18 months agocmd: fix return code of 'sf write' and 'sf read'
Heinrich Schuchardt [Mon, 2 Jan 2023 17:21:14 +0000 (18:21 +0100)]
cmd: fix return code of 'sf write' and 'sf read'

If the offset or the size passed to the 'sf write' or 'sf read' command
exceeds the size of the SPI flash displaying the command usage is not
helpful. Return CMD_RET_FAILURE instead of CMD_RET_USAGE.

Use the CMD_RET_* constants instead of 0, 1, -1.

Simplify a logical expression in the final return statement.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
18 months agospi: cadence_qspi: use STIG mode for small reads
Dhruva Gole [Tue, 3 Jan 2023 06:31:12 +0000 (12:01 +0530)]
spi: cadence_qspi: use STIG mode for small reads

Fix the issue where some flash chips like cypress S25HS256T return the
value of the same register over and over in DAC mode.

For example in the TI K3-AM62x Processors refer [0] Technical Reference
Manual there is a layer of digital logic in front of the QSPI/OSPI
Drive when used in DAC mode. This is part of the Flash Subsystem (FSS)
which provides access to external Flash devices.

The FSS0_0_SYSCONFIG Register (Offset = 4h) has a BIT Field for
OSPI_32B_DISABLE_MODE which has a Reset value = 0. This means, OSPI 32bit
mode enabled by default.

Thus, by default controller operates in 32 bit mode causing it to always
align all data to 4 bytes from a 4byte aligned address. In some flash
chips like cypress for example if we try to read some regs in DAC mode
then it keeps sending the value of the first register that was requested
and inorder to read the next reg, we have to stop and re-initiate a new
transaction.

This causes wrong register values to be read than what is desired when
registers are read in DAC mode. Hence if the data.nbytes is very less
then prefer STIG mode for such small reads.

[0] https://www.ti.com/lit/ug/spruiv7a/spruiv7a.pdf

Tested-by: Vaishnav Achath <vaishnav.a@ti.com>
Signed-off-by: Dhruva Gole <d-gole@ti.com>
[jagan: add tab space for comments]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
18 months agospi: cadence_qspi: setup ADDR Bits in cmd reads
Dhruva Gole [Tue, 3 Jan 2023 06:31:11 +0000 (12:01 +0530)]
spi: cadence_qspi: setup ADDR Bits in cmd reads

Setup the Addr bit field while issuing register reads in STIG mode. This
is needed for example flashes like cypress define in their transaction
table that to read any register there is 1 cmd byte and a few more address
bytes trailing the cmd byte. Absence of addr bytes will obviously fail
to read correct data from flash register that maybe requested by flash
driver because the controller doesn't even specify which address of the
flash register the read is being requested from.

Signed-off-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
18 months agomtd: spi-nor-core: Make CFRx reg fields generic
Takahiro Kuwano [Fri, 20 Jan 2023 03:28:22 +0000 (12:28 +0900)]
mtd: spi-nor-core: Make CFRx reg fields generic

Cypress defines two flavors of configuration registers, volatile and
non volatile, and both use the same bit fields. Rename the bitfields in
the configuration registers so that they can be used for both flavors.

Suggested-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
18 months agomtd: spi-nor-core: Consider reserved bits in CFR5 register
Takahiro Kuwano [Fri, 20 Jan 2023 03:28:21 +0000 (12:28 +0900)]
mtd: spi-nor-core: Consider reserved bits in CFR5 register

CFR5[6] is reserved bit and must be always 1. Set it to comply with flash
requirements. While fixing SPINOR_REG_CYPRESS_CFR5V_OCT_DTR_EN definition,
stop using magic numbers and describe the missing bit fields in CFR5
register. This is useful for both readability and future possible addition
of Octal STR mode support.

Fixes: ea9a22f7e79c ("mtd: spi-nor-core: Add support for Cypress Semper flash")
Suggested-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
18 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 26 Jan 2023 15:24:13 +0000 (10:24 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- marvell: a38x: Add support for DDR4 (Tony)
- kirkwood: Use Kirkwood common early malloc (Tony)

18 months agospi: Add Socionext F_OSPI SPI flash controller driver
Kunihiko Hayashi [Tue, 29 Nov 2022 02:17:09 +0000 (11:17 +0900)]
spi: Add Socionext F_OSPI SPI flash controller driver

Introduce Socionext F_OSPI controller driver. This controller is used to
communicate with slave devices such as SPI flash memories. It supports
4 slave devices and up to 8-bit wide bus, but supports master mode only.

This driver uses spi-mem framework for SPI flash memory access, and
can only operate indirect access mode and single data rate mode.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
18 months agodrivers: spi: sh_qspi.c: Use log_warning() instead of printf()
Pengfei Fan [Fri, 9 Dec 2022 01:39:51 +0000 (09:39 +0800)]
drivers: spi: sh_qspi.c: Use log_warning() instead of printf()

Use log_warning() instead of printf() to print out driver information

Signed-off-by: Pengfei Fan <fanpengfei1@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
18 months agodrivers: spi: fix some typos
Pengfei Fan [Fri, 9 Dec 2022 01:39:50 +0000 (09:39 +0800)]
drivers: spi: fix some typos

Fix some typos in spi drivers

Signed-off-by: Pengfei Fan <fanpengfei1@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
18 months agoarm: kirkwood: Use Kirkwood common early malloc area for various Kirkwood boards
Tony Dinh [Mon, 23 Jan 2023 08:39:34 +0000 (00:39 -0800)]
arm: kirkwood: Use Kirkwood common early malloc area for various Kirkwood boards

For Kirkwood boards, it is necessary to have early malloc in DRAM area
when Driver Model for Serial is enabled. This patch removes individual
board settings for early malloc in various Kirkwood boards, and uses the
Kirkwood commonly defined settings in arch/arm/mach-kirkwood/Kconfig.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
18 months agoddr: marvell: a38x: Add support for DDR4 from Marvell mv-ddr-marvell repository
Tony Dinh [Thu, 19 Jan 2023 03:03:04 +0000 (19:03 -0800)]
ddr: marvell: a38x: Add support for DDR4 from Marvell mv-ddr-marvell repository

This syncs drivers/ddr/marvell/a38x/ with the master branch of repository
https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git

up to the commit "mv_ddr: a3700: Use the right size for memset to not overflow"
d5acc10c287e40cc2feeb28710b92e45c93c702c

This patch was created by following steps:

1. Replace all a38x files in U-Boot tree by files from upstream github
Marvell mv-ddr-marvell repository.

2. Run following command to omit portions not relevant for a38x, ddr3, and ddr4:

files=drivers/ddr/marvell/a38x/*
unifdef -m -UMV_DDR -UMV_DDR_ATF -UCONFIG_APN806 \
-UCONFIG_MC_STATIC -UCONFIG_MC_STATIC_PRINT -UCONFIG_PHY_STATIC \
-UCONFIG_PHY_STATIC_PRINT -UCONFIG_CUSTOMER_BOARD_SUPPORT \
-UCONFIG_A3700 -UA3900 -UA80X0 -UA70X0 -DCONFIG_ARMADA_38X -UCONFIG_ARMADA_39X \
-UCONFIG_64BIT $files

3. Manually change license to SPDX-License-Identifier
(upstream license in  upstream github repository contains long license
texts and U-Boot is using just SPDX-License-Identifier.

After applying this patch, a38x, ddr3, and ddr4 code in upstream Marvell github
repository and in U-Boot would be fully identical. So in future applying
above steps could be used to sync code again.

The only change in this patch are:
1. Some fixes with include files.
2. Some function return and basic type defines changes in
mv_ddr_plat.c (to correct Marvell bug).
3. Remove of dead code in newly copied files (as a result of the
filter script stripping out everything other than a38x, dd3, and ddr4).

Reference:
    "ddr: marvell: a38x: Sync code with Marvell mv-ddr-marvell repository"
    https://source.denx.de/u-boot/u-boot/-/commit/107c3391b95bcc2ba09a876da4fa0c31b6c1e460

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
18 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Wed, 25 Jan 2023 02:07:01 +0000 (21:07 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-sunxi

This contains some fixes, and the first bunch of some clean up patches
to get rid of legacy GPIO and PMIC code.
Highlight is the DM AXP PMIC driver, which is required to convert some
drivers over to use DM regulators, and also is required to get rid
of some less optimal PMIC setup code in Trusted Firmware. This isn't
enabled by any defconfig yet, but can be enabled manually and works. For
the full glory some patches are still missing, and this requires more
testing, which would be simpler if the core code is upstream.

18 months agoMerge branch '2023-01-24-bootstd-allow-migration-from-distro_bootcmd-script'
Tom Rini [Tue, 24 Jan 2023 19:04:14 +0000 (14:04 -0500)]
Merge branch '2023-01-24-bootstd-allow-migration-from-distro_bootcmd-script'

To quote the author:
So far, standard boot does not replicate all the of the functionality
of the distro_bootcmd scripts. In particular it lacks some bootdevs and
some of the bootmeths are incomplete.

Also there is currently no internal mechanism to enumerate buses in order
to discover bootdevs, e.g. with USB.

This series addresses these shortcomings:

- Adds the concept of a 'bootdev hunter' to enumerate buses, etc. in an
  effort to find bootdevs of a certain priority
- Adds bootdevs for SCSI, IDE, NVMe, virtio, SPI flash
- Handles PXE and DHCP properly
- Supports reading the device tree with EFI and reading scripts from the
  network

It also tidies up label processing, so it is possible to use:

   bootflow scan mmc2

to scan just one MMC device (with BOOTSTD_FULL).

As before this implementation still relies on CONFIG_CMDLINE being
enabled, mostly for the network stack. Further work would be required to
disentangle that.

Quite a few tests are added but there are some gaps:

- SPI flash bootdev
- EFI FDT loading

Note that SATA works via SCSI (CONFIG_SCSI_AHCI) and does not use
driver model. Only pogo_v4 seems to be affected. Probably all thats is
needed is to call bootdev_setup_sibling_blk() in the Marvell SATA driver.

Also, while it would be possible to init MMC in a bootdev hunter, there is
no point since U-Boot always inits MMC on startup, if present.

With this series it should be possible to migrate boards to standard boot
by removing the inclusion of config_distro_bootcmd.h and instead adding
a suitable value for boot_targets to the environment, e.g.:

   boot_targets=mmc1 mmc0 nvme scsi usb pxe dhcp spi

Thus it is possible to boot automatically without scripts and boards can
use a text-based environment instead of the config.h files.

To demonstrate this, rockpro64-rk3399 is migrated to standard boot in this
series. Full migration could probably be automated using a script, similar
in concept to moveconfig:

   - obtain the board environment via 'make u-boot-initial-env'
   - get the value of "boot_targets"
   - drop config_distro_bootcmd.h from the config.h file
   - rebuild again to get the environment without distro scripts
   - write the environment (adding boot_targets) to board.env
   - remove CONFIG_EXTRA_ENV_SETTINGS from the config.h file

18 months agorockchip: Convert rockpro64-rk3399 to use standard boot
Simon Glass [Tue, 17 Jan 2023 17:48:20 +0000 (10:48 -0700)]
rockchip: Convert rockpro64-rk3399 to use standard boot

Drop the use of scripts and rely on standard boot for all operation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
18 months agobootstd: Update documentation for new features
Simon Glass [Tue, 17 Jan 2023 17:48:19 +0000 (10:48 -0700)]
bootstd: Update documentation for new features

Document the hunters and the new way that iteration works.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Add a little more logging of bootflows
Simon Glass [Tue, 17 Jan 2023 17:48:18 +0000 (10:48 -0700)]
bootstd: Add a little more logging of bootflows

Add some logging to aid debugging of problems with bootflows.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Record the bootdevs used during scanning
Simon Glass [Tue, 17 Jan 2023 17:48:17 +0000 (10:48 -0700)]
bootstd: Record the bootdevs used during scanning

Add a way to record the bootdevs used when scanning for bootflows. This is
useful for testing.

Enable this only with BOOTSTD_FULL and do the same for the progress
reporting.

Re-enable and update the affected tests now that we have this feature.

For bootdev_test_order_default() there is no-longer any support for using
the bootdev aliases to specify an ordering, so drop that part of the test.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Drop the old bootflow_scan_first()
Simon Glass [Tue, 17 Jan 2023 17:48:16 +0000 (10:48 -0700)]
bootstd: Drop the old bootflow_scan_first()

This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Allow scanning a single bootdev label
Simon Glass [Tue, 17 Jan 2023 17:48:15 +0000 (10:48 -0700)]
bootstd: Allow scanning a single bootdev label

We want to support scanning a single label, like 'mmc' or 'usb0'. Add
this feature by plumbing the label through to the iterator, setting a
flag to indicate that only siblings of the initial device should be used.

This means that scanning a bootdev by its name is not supported anymore.
That feature doesn't seem very useful in practice, so it is no great loss.

Add a test for bootdev_find_by_any() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Switch bootdev scanning to use labels
Simon Glass [Tue, 17 Jan 2023 17:48:14 +0000 (10:48 -0700)]
bootstd: Switch bootdev scanning to use labels

At present we set up the bootdev order at the start, then scan the
bootdevs one by one.

However this approach cannot be used with hunters, since the bootdevs may
not exist until the hunter is used. Nor can we just run all the hunters at
the start, since that violate's U-Boot's 'lazy init' requirement. It also
increases boot time.

So we need to adjust the algorithm to scan by labels instead. As a first
step, drop the dev_order[] array in favour of a list of labels. Update the
name of bootdev_setup_iter_order() to better reflect what it does.

Update some related comments and log messages. Also disable a few tests
until a later commit where we can use them.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Add a hunter for the extension feature
Simon Glass [Tue, 17 Jan 2023 17:48:13 +0000 (10:48 -0700)]
bootstd: Add a hunter for the extension feature

This needs to run before any bootdev is used, so add a hunter for it.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agoextension: Refactor to allow non-command usage
Simon Glass [Tue, 17 Jan 2023 17:48:12 +0000 (10:48 -0700)]
extension: Refactor to allow non-command usage

The current extension code is designed to be used from commands. We want
to add a boot driver which uses it. To help with this, split the code into
the command processing and a function which actually does the scan.

Really the extension code should be in common/ or use driver model, but
this is a start.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Allow iterating to the next bootdev priortiy
Simon Glass [Tue, 17 Jan 2023 17:48:11 +0000 (10:48 -0700)]
bootstd: Allow iterating to the next bootdev priortiy

Add a function which moves to the next priority to be processed.

This works by storing the current priority in the bootflow iterator. The
logic to set this up is included in a subsequent commit.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Allow iterating to the next label in a list
Simon Glass [Tue, 17 Jan 2023 17:48:10 +0000 (10:48 -0700)]
bootstd: Allow iterating to the next label in a list

Add a function which moves to the next label in a list of labels. This
allows processing the boot_targets environment variable.

This works using a new label list in the bootflow iterator. The logic to
set this up is included in a subsequent commit.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Allow hunting for a bootdev by label
Simon Glass [Tue, 17 Jan 2023 17:48:09 +0000 (10:48 -0700)]
bootstd: Allow hunting for a bootdev by label

Add a function to hunt for a bootdev label and find the bootdev produced
by the hunter (or already present).

Add a few extra flags so that we can distinguish between "mmc1", "mmc" and
"1" which all need to be handled differently.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Add a new pre-scan priority for bootdevs
Simon Glass [Tue, 17 Jan 2023 17:48:08 +0000 (10:48 -0700)]
bootstd: Add a new pre-scan priority for bootdevs

We need extensions to be set up before we start trying to boot any of the
bootdevs. Add a new priority before all the others for tht sort of thing.
Also add a 'none' option, so that the first one is not 0.

While we are here, comment enum bootdev_prio_t fully and expand the test
for the 'bootdev hunt' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Allow hunting for bootdevs of a given priority
Simon Glass [Tue, 17 Jan 2023 17:48:07 +0000 (10:48 -0700)]
bootstd: Allow hunting for bootdevs of a given priority

Add a way to run the hunter function for a particular priority, so that
new bootdevs can be found.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Use hunters when scanning for bootflows
Simon Glass [Tue, 17 Jan 2023 17:48:06 +0000 (10:48 -0700)]
bootstd: Use hunters when scanning for bootflows

Add a flag to control whether hunters are used when scanning for
bootflows. Enable it by default and tidy up the flag comments a little.

Fow now this has no effect, until a future patch enables this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Treat DHCP and PXE as bootdev labels
Simon Glass [Tue, 17 Jan 2023 17:48:05 +0000 (10:48 -0700)]
bootstd: Treat DHCP and PXE as bootdev labels

These are associated with the ethernet boot device but do not match its
uclass name, so handle them as special cases.

Provide a way to pass flags through with the bootdev so that we know
how to process it. The flags are checked by the bootmeths, to ensure that
only the selected bootmeth is used.

While these both use the network device, they work quite differently. It
is common to run only one of these, or to run PXE before DHCP. Provide
bootflow flags to control which methods are used. Check these in the two
bootmeths so that only the chosen one is used.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Support reading a script from network or SPI flash
Simon Glass [Tue, 17 Jan 2023 17:48:04 +0000 (10:48 -0700)]
bootstd: Support reading a script from network or SPI flash

At present this bootmeth only supports a block device and the sandbox
host filesystem. Add support for obtaining the script from a network
device. Also implement the set_bootflow() method so that it is easy
for other bootdevs (such as enabling SPI flash to support scripts).

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Add a SPI flash bootdev
Simon Glass [Tue, 17 Jan 2023 17:48:03 +0000 (10:48 -0700)]
bootstd: Add a SPI flash bootdev

Add a bootdev for SPI flash so that these devices can be used with
standard boot. It only supports loading a script.

Add a special case for the label, since we want to use "spi", not
"spi_flash".

Enable the new bootdev on sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agosandbox: Allow SPI flash bootdevs to be disabled for tests
Simon Glass [Tue, 17 Jan 2023 17:48:02 +0000 (10:48 -0700)]
sandbox: Allow SPI flash bootdevs to be disabled for tests

Most tests don't want these and they can create a lot of noise. Add a way
to disable them. Use that in tests, with a flag provided to enable them
for tests that need this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Add a new bootmeth method to set the bootflow
Simon Glass [Tue, 17 Jan 2023 17:48:01 +0000 (10:48 -0700)]
bootstd: Add a new bootmeth method to set the bootflow

Normally the bootmeth driver reads the bootflow from the bootdev, since
it knows the correct way to do it.

However it is easier for some bootdevs to handle this themselves. For
example, reading from SPI flash is quite different from other devices.

Add a way for the bootdev to pass a bootflow to the bootmeth, so that
this can be supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Move label parsing into its own function
Simon Glass [Tue, 17 Jan 2023 17:48:00 +0000 (10:48 -0700)]
bootstd: Move label parsing into its own function

This is complicated enough to merit its own function, particularly as we
are about to add to it. Create a new label_to_uclass() function to decode
a label.

Also update the code to ignore an empty label or one consisting of just a
number.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Update docs on bootmeth_try_file() for sandbox
Simon Glass [Tue, 17 Jan 2023 17:47:59 +0000 (10:47 -0700)]
bootstd: Update docs on bootmeth_try_file() for sandbox

Mention that this function is also used with a NULL block devices to
access files on the host, when using sandbox.

Update the comment on struct bootflow also.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Set the distro_bootpart env var with scripts
Simon Glass [Tue, 17 Jan 2023 17:47:58 +0000 (10:47 -0700)]
bootstd: Set the distro_bootpart env var with scripts

This environment variable is supposed to be set so that the script knows
which partition holds the script. Set it before invoking the script.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Support reading the device tree with EFI
Simon Glass [Tue, 17 Jan 2023 17:47:57 +0000 (10:47 -0700)]
bootstd: Support reading the device tree with EFI

With EFI booting the device tree is required but is not actually specified
in any way. The normal method is to use a fdtfile environment variable to
get the filename, then look for that file on the media.

Implement this in the bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Include the device tree in the bootflow
Simon Glass [Tue, 17 Jan 2023 17:47:56 +0000 (10:47 -0700)]
bootstd: Include the device tree in the bootflow

Some bootmeths provide a way to load a device tree as well as the base
OS image. Add a way to store this in the bootflow. Update the
'bootflow info' command to show this information.

Note that the device tree is not allocated, but instead is stored at
an address provided by an environment variable. This may need to be
adjusted at some point, but for now it works well and fits in with the
existing distro-boot scripts.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Allow reading an EFI file from the network
Simon Glass [Tue, 17 Jan 2023 17:47:55 +0000 (10:47 -0700)]
bootstd: Allow reading an EFI file from the network

At present this bootmeth only supports reading from a filesystem. Add
support for reading from a network also, using DHCP with autoload.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Rename bootdev checkers
Simon Glass [Tue, 17 Jan 2023 17:47:54 +0000 (10:47 -0700)]
bootstd: Rename bootdev checkers

These functions return 0 if the check passes, so the names are somewhat
confusing. Rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agoata: Don't try to use non-existent ports
Simon Glass [Tue, 17 Jan 2023 17:47:53 +0000 (10:47 -0700)]
ata: Don't try to use non-existent ports

The controller indicates the number of ports but also has a port map
which specifies which ports are actually valid. Make use of this to
avoid trying to send commands to an invalid port.

This avoids a crash on some controllers.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Add a virtio bootdev
Simon Glass [Tue, 17 Jan 2023 17:47:52 +0000 (10:47 -0700)]
bootstd: Add a virtio bootdev

Add a bootdev for virtio so that these devices can be used with standard
boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agovirtio: Add a block device
Simon Glass [Tue, 17 Jan 2023 17:47:51 +0000 (10:47 -0700)]
virtio: Add a block device

The test code for virtio is fairly simplistic and does not actually create
a block device. Add a way to specify the device type in the device tree.
Add a block device so that we can do more testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agovirtio: Avoid strange behaviour on removal
Simon Glass [Tue, 17 Jan 2023 17:47:50 +0000 (10:47 -0700)]
virtio: Avoid strange behaviour on removal

This device does a check on removal which is better handled in the actual
test. Move it.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agovirtio: Fix returning -ENODEV
Simon Glass [Tue, 17 Jan 2023 17:47:49 +0000 (10:47 -0700)]
virtio: Fix returning -ENODEV

This has a special meaning in driver model. There is clearly a device, so
it does not make sense to return this error code. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agovirtio: Avoid repeating a long expression
Simon Glass [Tue, 17 Jan 2023 17:47:48 +0000 (10:47 -0700)]
virtio: Avoid repeating a long expression

Use a local variable to hold this name, to reduce the amount of code that
needs to be read.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Add an NVMe bootdev
Simon Glass [Tue, 17 Jan 2023 17:47:47 +0000 (10:47 -0700)]
bootstd: Add an NVMe bootdev

Add a bootdev for NVMe so that these devices can be used with standard
boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Add an IDE bootdev
Simon Glass [Tue, 17 Jan 2023 17:47:46 +0000 (10:47 -0700)]
bootstd: Add an IDE bootdev

Add a bootdev for IDE so that these devices can be used with standard
boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Add a SCSI bootdev
Simon Glass [Tue, 17 Jan 2023 17:47:45 +0000 (10:47 -0700)]
bootstd: Add a SCSI bootdev

Add a bootdev for SCSI so that these devices can be used with standard
boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agoscsi: Remove all children of SCSI devices before rescanning
Simon Glass [Tue, 17 Jan 2023 17:47:44 +0000 (10:47 -0700)]
scsi: Remove all children of SCSI devices before rescanning

At present this only unbinds block devices of a certain type. But SCSI
device can have different types of children, including bootdevs.

Unbind all children so tht everything is clean and ready for a new scan.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agoscsi: Correct allocation of block-device name
Simon Glass [Tue, 17 Jan 2023 17:47:43 +0000 (10:47 -0700)]
scsi: Correct allocation of block-device name

This should be allocated so that it does not go out of scope. Fix this and
set the log category while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Only scan bootable partitions
Simon Glass [Tue, 17 Jan 2023 17:47:42 +0000 (10:47 -0700)]
bootstd: Only scan bootable partitions

At present all partitions are scanned, whether marked bootable or not.
Use only bootable partitions, defaulting to partition 1 if none is
found.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agopart: Add a function to find the first bootable partition
Simon Glass [Tue, 17 Jan 2023 17:47:41 +0000 (10:47 -0700)]
part: Add a function to find the first bootable partition

If a disk has a bootable partition we are expected to use it to locate the
boot files. Add a function to find it.

To test this, update mmc1 to have two paritions, fixing up other tests
accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Add a hunter for ethernet
Simon Glass [Tue, 17 Jan 2023 17:47:40 +0000 (10:47 -0700)]
bootstd: Add a hunter for ethernet

Sometimes ethernet devices are attached to PCI. Since it is quick to scan,
add this into the ethernet hunter.

Run dhcp to establish the network connection. Drop this from the bootdev
since that is not needed now. Update a log message for clarity.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agonet: Add a function to run dhcp
Simon Glass [Tue, 17 Jan 2023 17:47:39 +0000 (10:47 -0700)]
net: Add a function to run dhcp

At present this must be done by executing the command. Also it involves
fiddling with the environment to determine the correct autoload behaviour.

Ideally it should be possible to run network operations without even
having the command line present (CONFIG_CMDLINE).

For now, add a function to handle DHCP, so it can be called from a bootdev
more easily.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
18 months agobootstd: Add an MMC hunter
Simon Glass [Tue, 17 Jan 2023 17:47:38 +0000 (10:47 -0700)]
bootstd: Add an MMC hunter

Add a hunter for MMC. This doesn't do anything at present, since MMC is
currently set up when U-Boot starts. If MMC moves to lazy init then we can
add a hunter function.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agobootstd: Add a USB hunter
Simon Glass [Tue, 17 Jan 2023 17:47:37 +0000 (10:47 -0700)]
bootstd: Add a USB hunter

Add a hunter for USB which enumerates the bus to find new bootdevs.

Update the tests and speed up bootdev_test_prio() while we are here, by
dropping the USB delays.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agotest: Add a generic function to skip delays
Simon Glass [Tue, 17 Jan 2023 17:47:36 +0000 (10:47 -0700)]
test: Add a generic function to skip delays

At present this feature is sandbox-specific. For running tests on boards,
we need a nop version. Add one.

Signed-off-by: Simon Glass <sjg@chromium.org>