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>
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>
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.
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Simon Glass [Tue, 17 Jan 2023 17:47:35 +0000 (10:47 -0700)]
dm: usb: Mark the device name as alloced when binding
Since usb_find_and_bind_driver() allocates the device name it should tell
driver about that, to avoid memory leaks. Fix this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:34 +0000 (10:47 -0700)]
bootstd: Support running bootdev hunters
Add a way to run a bootdev hunter to find bootdevs of a certain type. Add
this to the 'bootdev hunt' command. Test for this are added in a later
patch, since a useful test needs some hunters to work with.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:33 +0000 (10:47 -0700)]
bootstd: Add the concept of a bootdev hunter
Some bootdevs must be enumerated before they appear. For example, USB
bootdevs are not visible until USB is enumerated.
With standard boot this needs to happen automatically, since we only
want to enumerate a bus if it is needed.
Add a way to define bootdev 'hunters' which can be used to hunt for
bootdevs of a given type. Track which ones have been used and add a
command to list them.
Include a clang work-around which seems to be needed.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:32 +0000 (10:47 -0700)]
efi: Improve logging in efi_disk
When this fails it can be time-consuming to debug. Add some debugging
to help with this. Also try to return error codes instead of just using
-1.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:31 +0000 (10:47 -0700)]
event: Correct duplicate log message in event_notify()
Use a different one for each call.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:30 +0000 (10:47 -0700)]
lib: Support printing an error string
It is often useful to show an error code to give the user a clue as to
what went wrong. When error strings are compiled into U-Boot it is
possible to show a message as well.
But at present it is not very convenient, since code must check if the
error strings are present, then obtain the error string and use it in
a printf() string.
Add a %dE option which shows an error code along with an error string,
if available. This makes it easy to show one or both.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:29 +0000 (10:47 -0700)]
sandbox: Enable the Ethernet bootdev
This bootdev is disabled at present since it messes with the tests. Now
that there is a way to disable networking at runtime, enable the driver.
This allows running tests with it if necessary.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:28 +0000 (10:47 -0700)]
sandbox: Allow ethernet bootdevs to be disabled for tests
Most tests don't want these and 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>
Simon Glass [Tue, 17 Jan 2023 17:47:27 +0000 (10:47 -0700)]
sandbox: Allow ethernet to be disabled at runtime
For bootstd tests it is seldom useful to have ethernet enabled. Add a way
to disable it, so that ethernet operations like tftpboot do nothing.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:26 +0000 (10:47 -0700)]
bootstd: Add a default method to get bootflows
The code in these functions turns out to often be the same. Add a default
get_bootflow() function and allow the drivers to select it by setting
the method to NULL.
This saves a little code space.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:25 +0000 (10:47 -0700)]
dm: mmc: Use bootdev_setup_sibling_blk()
At present MMC uses the bootdev_setup_for_dev() function to set up the
bootdev. This is because MMC only has one block-device child, so does not
need to worry about naming of the bootdev.
However this inconsistency with other bootdevs that use block devices is a
bit annoying. The only real reason for it is to have a name like
'mmc0.bootdev' instead of 'mmc0.blk.bootdev'.
Update bootdev_setup_sibling_blk() to drop '.blk' from the name where it
appears, thus removing the only reason to use the bootdev_setup_for_dev().
Switch MMC over to the subling function.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:24 +0000 (10:47 -0700)]
ide: Drop non-DM code for BLK
We require CONFIG_BLK to be enabled now, so this code is unused. Drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:23 +0000 (10:47 -0700)]
dm: test: Correct ordering of DM setup
We must call dm_scan_other() after devices from the device tree have been
created, since that function behaves differently if there is no bootstd
device.
Adjust the logic to achieve this.
Also fix the bootflow_system() test which was relying on this broken
behaviour.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:22 +0000 (10:47 -0700)]
dm: part: Update test to use mmc2
At present this test sets up a partition table on mmc1. But this is used
by the bootstd tests, so it is not possible to run those after this test
has run, without restarting the Python test harness.
This is inconvenient when running tests repeatedly with 'ut dm'. Move the
test to use mmc2, which is not used by anything.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:21 +0000 (10:47 -0700)]
vbe: sandbox: Drop VBE node in chosen
This is not needed anymore since VBE creates the node when it sets up the
OS requests. Drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:20 +0000 (10:47 -0700)]
vbe: Avoid a build failure when bloblist is not enabled
This needs to be able to work (at least partially) without the bloblist
active. Add a condition for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:19 +0000 (10:47 -0700)]
sandbox: mmc: Start off with a zeroed file
When running multiple tests the mmc emulator calls malloc() to obtain the
memory for its disk image. Since the memory is not cleared, it is possible
that it happens to contain a partition table.
The dm_test_part() test (for one) relies on mmc0 being empty on startup.
Zero the memory to ensure that it is.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:18 +0000 (10:47 -0700)]
test: Drop duplicate restore of DM state
This code is present twice. Fix it so that it is only executed once.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:17 +0000 (10:47 -0700)]
test: Fix the help for the ut command
The font help has an incorrect newline. Fix it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes:
cdd964e3801 ("test: Tidy up help for ut command")
Simon Glass [Tue, 17 Jan 2023 17:47:16 +0000 (10:47 -0700)]
bootstd: Simplify locating existing bootdevs
There is no point in trying to match the alias order for bootdevs, since
build_order() either sorts them by priority, uses the boot_targets
environment variable or the bootdev-order property.
Just use the iterator instead, to simplify the code.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:15 +0000 (10:47 -0700)]
bootstd: Remove special-case code for boot_targets
Rather than implement this as its own case in build_order(), process the
boot_targets environment variable in the bootstd_get_bootdev_order()
function. This allows build_order() to be simplified.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:14 +0000 (10:47 -0700)]
lib: Add a function to split a string into substrings
Some environment variables provide a space-separated list of strings. It
is easier to process these when they are broken out into an array of
strings.
Add a utility function to handle this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:13 +0000 (10:47 -0700)]
dm: test: Correct assertion in dm_test_part()
This obscures the line number. Update the test to avoid make sure that
the line which failed is displayed, so it is possible to diagnose the
failure.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:12 +0000 (10:47 -0700)]
dm: core: Support sorting devices with dm tree
Add a -s flag to sort the top-level devices in order of uclass ID.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Tue, 17 Jan 2023 17:47:11 +0000 (10:47 -0700)]
dm: core: Correct ordering of uclasses IDs
A few of these are out of order. Fix them.
Signed-off-by: Simon Glass <sjg@chromium.org>
Jernej Skrabec [Mon, 28 Nov 2022 07:02:26 +0000 (01:02 -0600)]
video: sunxi: dw-hdmi: Read address from DT node
Currently HDMI controller MMIO address is hardcoded. Change that so
address is read from DT node. That will make adding support for new
variants a bit easier.
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Jernej Skrabec [Mon, 28 Nov 2022 07:02:25 +0000 (01:02 -0600)]
video: sunxi: dw-hdmi: Probe driver by compatible
Currently the sunxi dw-hdmi driver is probed unconditionally,
even if there is no such device.
Switch the driver to probing via a compatible string. This brings many
benefits; the driver is only probed when needed, and now it can read the
DT node.
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Samuel Holland [Mon, 28 Nov 2022 07:02:24 +0000 (01:02 -0600)]
clk: sunxi: Add DE2 display-related clocks/resets
Add clock/reset definitions for display-related peripherals, including
the display engine, TCONs, and DSI and HDMI encoders, so those drivers
can be converted to DM clock consumers instead of directly manipulating
the CCU registers.
Signed-off-by: Samuel Holland <samuel@sholland.org>
Samuel Holland [Sat, 21 Jan 2023 23:13:06 +0000 (17:13 -0600)]
power: pmic: axp: Bind regulators from the DT
Now that a regulator driver exists for this PMIC, hook it up to the
device tree "regulators" subnodes.
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Samuel Holland [Sat, 21 Jan 2023 23:13:05 +0000 (17:13 -0600)]
power: regulator: Add a driver for AXP PMIC regulators
This driver handles most voltage regulators found in X-Powers AXP PMICs.
It is based on, and intended to replace, the regulator driver in TF-A.
AXP PMIC regulators can be divided into 6 categories:
- Switches without voltage control => fully supported.
- Single linear range => fully supported.
- Two linear ranges, "step" and "2 * step" => fully supported.
- Two linear ranges, "step" and "5 * step" => only the first range is
supported. No boards are known to use the second range.
- Non-linear voltage values => fully supported.
- LDOs shared with GPIO pins => not supported.
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Samuel Holland [Sat, 21 Jan 2023 23:13:04 +0000 (17:13 -0600)]
power: pmic: axp: Provide a variant ID in the driver data
Subordinate regulator drivers can use this enumerated ID instead of
matching the compatible string again.
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Fri, 25 Nov 2022 01:38:06 +0000 (01:38 +0000)]
sunxi: eMMC: support TOC0 on boot partitions
To determine whether we have been booted from an eMMC boot partition, we
replay some of the checks that the BROM must have done to successfully
load the SPL. This involves a checksum check, which currently relies on
the SPL being wrapped in an "eGON" header.
If a board has secure boot enabled, the BROM will only accept the "TOC0"
format, which is internally very different, but uses the same
checksumming algorithm. Actually the only difference for calculating the
checksum is that the size of the SPL is stored at a different offset.
Do a header check to determine whether we deal with an eGON or TOC0
format, then set the SPL size accordingly. The rest of the code is
unchanged.
This fixes booting from an eMMC boot partition on devices with secure
boot enabled, like the Remix Mini PC.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Andre Przywara [Wed, 13 Jul 2022 16:21:45 +0000 (17:21 +0100)]
sunxi: remove CONFIG_MMC?_CD_PIN
For legacy reasons we were defining the card detect GPIO for all sunxi
boards in each board's defconfig.
There is actually no need for a card-detect check in the SPL code (which
consequently has been removed already), and also in U-Boot proper we
have DM code to query the CD GPIO name from the device tree.
That means we don't have any user of that information left, so can
remove the definitions from the defconfigs.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
Andre Przywara [Wed, 13 Jul 2022 16:21:44 +0000 (17:21 +0100)]
sunxi: mmc: group non-DM specific functions
As the SPL code for sunxi boards does not use the driver model, we have
two mmc_ops structures, one for DM, one for non-DM. The actual hardware
access code is shared, with the respective callback functions using that
common code.
To make this more obvious and easier to read, reorder the functions to
group them: we first have the common code, then the non-DM bits, and
the proper DM implementation at the end.
Also document this structure in the comment at the beginning of the file.
No functional change intended.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
Andre Przywara [Wed, 13 Jul 2022 16:21:43 +0000 (17:21 +0100)]
sunxi: mmc: ignore card detect in SPL
The sunxi MMC code does not use the DM in the SPL, as we don't have a
device tree available that early, also no space for it.
This also means we cannot access the card-detect GPIO information from
there, so we have Kconfig symbols called CONFIG_MMCx_CD_PIN, which each
board has to define. This is a burden, also requires extra GPIO code in
the SPL.
As the SPL is the natural successor of the BootROM (from which we are
loaded), we can actually ignore the CD pin completely, as this is what
the BootROM does as well: CD GPIOs are board specific, but the BootROM
is not, so accesses the MMC devices anyway.
Also, as we must have been loaded from an MMC device when reaching this
code, there must have been a card in the slot.
Remove the card detect code from the non-DM implementation of the sunxi
MMC driver, to get rid of this unneeded code.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
Andre Przywara [Wed, 13 Jul 2022 15:27:58 +0000 (16:27 +0100)]
sunxi: fel: drop redundant "control register" save/restore
For some reasons shrouded in mystery, the code saving the FEL state was
saving the SCTLR register twice, with the second copy trying to justify
itself by using its ancient "control register" alias name.
Drop the redundant second copy, both from the fel_stash data structure,
and also the code saving and restoring it.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
Andre Przywara [Wed, 13 Jul 2022 15:27:57 +0000 (16:27 +0100)]
sunxi: h616: lower SPL stack address to avoid BROM data
When using the USB OTG FEL mode on the Allwinner H616, the BootROM
stores some data at the end of SRAM C. This is also the location where
we place the initial SPL stack, so it will overwrite this data.
We still need the BROM code after running the SPL, so should leave that
area alone.
Interestingly this does not seem to have an adverse effect, I guess on
the "way out" (when we return to FEL after the SPL has run), this data
is not needed by the BROM, for just the trailing end of the USB operation.
However this is still wrong, and we should not clobber BROM data.
Lower the SPL stack address to be situated right below the swap buffers
we use in sunxi-fel: that should be out of the way of everyone else.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
Andre Przywara [Wed, 13 Jul 2022 15:27:56 +0000 (16:27 +0100)]
sunxi: armv8: fel: load only 32-bit values
Both the values and the MMIO addresses that we need during the 64-bit FEL
restore are smaller than 2^32, so we don't need to do any 64-bit loads.
Change the loads to only load 32 bits worth of data, that saves us some
bytes for storing the values.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
Andre Przywara [Fri, 16 Dec 2022 23:55:17 +0000 (23:55 +0000)]
sunxi: f1c100s: Drop no-MMC hack
When support for the Allwinner F1C100s SoC was originally introduced,
its DT lacked any MMC nodes, which upset our sunxi-u-boot.dtsi overlay,
when it tried to add an alias to the SD card. To quickly fix this back
then, we guarded that alias with a preprocessor macro.
Now the F1C100s family has gained MMC nodes, so we don't need the
special treatment anymore. Just remove this guard.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Andre Przywara [Fri, 16 Dec 2022 23:34:47 +0000 (23:34 +0000)]
sunxi: f1c100s: re-enable SYSRESET
The SoC .dtsi originally submitted for the Allwinner F1C100s had the
wrong compatible string for the watchdog, which broke U-Boot's reset
functionality. To quickly fix this, we disable CONFIG_SYSRESET in
cfcf1952c11e6ffcbbf88 ("sunxi: f1c100s: Drop SYSRESET to enable reset
functionality"), so that U-Boot's hardcoded reset driver could take over.
After this was properly fixed in the devicetree, we reverted that patch
in
92373de041ea ("Revert "sunxi: f1c100s: Drop SYSRESET to enable reset
functionality"), however this line sneaked back in with
d0ee7f295d74
("Convert CONFIG_SYS_PBSIZE to Kconfig"), so during a Kconfig update.
Remove this line (again), to use the proper reset driver.
Fixes:
d0ee7f295d74 ("Convert CONFIG_SYS_PBSIZE to Kconfig")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Tom Rini [Fri, 20 Jan 2023 19:23:20 +0000 (14:23 -0500)]
Merge tag 'efi-2023-04-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2023-04-rc1-2
Documentation
* man-pages for source, blkcache, bdinfo
* fix references to distro documentation
UEFI:
* allow clear screen by scrolling
* ensure that file ubootefi.var is created
* fix CapsuleMax variable reporting
Others:
* reduce verbosity of fat_read_file()
Tom Rini [Fri, 20 Jan 2023 19:21:38 +0000 (14:21 -0500)]
Merge branch '2023-01-20-finish-CONFIG-migration-work'
- Merge in the final batch of CONFIG to Kconfig/CFG migration work. This
includes a fix for a number of ns16550 or similar UARTs due to a
migration bug. We also pull in a revert for enabling CONFIG_VIDEO on
tools-only_defconfig.
Fabio Estevam [Thu, 19 Jan 2023 01:23:21 +0000 (22:23 -0300)]
Revert "config: tools only: add VIDEO to build bmp_logo"
This reverts commit
1cfba53ca46cade2dbf4e067afc8c19e72909a4b.
Since commit
1cfba53ca46c ("config: tools only: add VIDEO to build
bmp_logo") the build of tools-only_defconfig fails:
| /bin/sh: line 1: tools/bmp_logo: No such file or directory
This has been noticed in OpenEmbedded and Debian [1].
Revert it for now.
[1] https://lists.denx.de/pipermail/u-boot/2023-January/504758.html
Signed-off-by: Fabio Estevam <festevam@denx.de>
Tom Rini [Tue, 10 Jan 2023 16:19:46 +0000 (11:19 -0500)]
CI: Make check for new defined CONFIG symbols even more robust
Now that all remaining in-tree cases where we define or undef a CONFIG
symbol have been migrated to Kconfig or renamed to CFG we can make the
CI check more robust. We will exclude the doc, tools and arch/arm/dts
directories from this check as they are special cases. Further, we can
exclude the scripts/kconfig/lkc.h and include/linux/kconfig.h files as
the CONFIG values they define are special tooling cases and not real
symbols.
In the case of docs, the only places that currently fail this test are
old documentation that should be rewritten so that we can remove this
special case.
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini [Tue, 10 Jan 2023 16:19:45 +0000 (11:19 -0500)]
global: Finish CONFIG -> CFG migration
At this point, the remaining places where we have a symbol that is
defined as CONFIG_... are in fairly odd locations. While as much dead
code has been removed as possible, some of these locations are simply
less obvious at first. In other cases, this code is used, but was
defined in such a way as to have been missed by earlier checks. Perform
a rename of all such remaining symbols to be CFG_... rather than
CONFIG_...
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini [Tue, 10 Jan 2023 16:19:44 +0000 (11:19 -0500)]
watchdog: Clean up defaults for imx_watchdog / ulp_wdog
In imx_watchdog, clean up the comment to just note the range now, as we
do not need to set the default here as Kconfig does this for us. For
ulp_wdog, set the default value via Kconfig instead.
Cc: Stefan Roese <sr@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tom Rini [Tue, 10 Jan 2023 16:19:43 +0000 (11:19 -0500)]
usbtty: Remove default CONFIG_USBD_* values
For this legacy driver, the only user sets these values in Kconfig, so
we can remove them from the header.
Signed-off-by: Tom Rini <trini@konsulko.com>
Tom Rini [Tue, 10 Jan 2023 16:19:42 +0000 (11:19 -0500)]
nxp: Finish migration of SYS_FSL_SRDS_[12] to Kconfig
As this is used on both ARM and PowerPC platforms, this needs to be
listed in arch/Kconfig.nxp and match how they're currently used by
select'ing them under the required PowerPC ARCH_xxx options.
Signed-off-by: Tom Rini <trini@konsulko.com>
Tom Rini [Tue, 10 Jan 2023 16:19:41 +0000 (11:19 -0500)]
nxp: Finish migration of SYS_FSL_IFC_BANK_COUNT to Kconfig
As this is used on both ARM and PowerPC platforms, this needs to be
asked in arch/Kconfig.nxp. Set the PowerPC defaults based on
arch/powerpc/include/asm/config_mpc85xx.h and remove the default set in
drivers/mtd/nand/raw/fsl_ifc_nand.c
Signed-off-by: Tom Rini <trini@konsulko.com>
Tom Rini [Tue, 10 Jan 2023 16:19:40 +0000 (11:19 -0500)]
net: phy: mv88e61xx: Finish migration of MV88E61XX_FIXED_PORTS
Set the default for MV88E61XX_FIXED_PORTS to 0x0 in Kconfig, and move
the comment from code to the help to explain what this does.
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Tom Rini [Tue, 10 Jan 2023 16:19:39 +0000 (11:19 -0500)]
fsl-layerscape: Rework usage of CONFIG_CLUSTER_CLK_FREQ
In the case where CONFIG_CLUSTER_CLK_FREQ is not defined, simply set
cluster_clk to get_board_sys_clk().
Signed-off-by: Tom Rini <trini@konsulko.com>