]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 years agoserial: Update NS16550_t and struct NS16550
Simon Glass [Wed, 23 Dec 2020 02:30:18 +0000 (19:30 -0700)]
serial: Update NS16550_t and struct NS16550

Typedefs should not be used in U-Boot and structs should be lower case.
Update the code to use struct ns16550 consistently.

Put a header guard on the file while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agoMakefile: Use common args for dtoc
Simon Glass [Wed, 23 Dec 2020 02:30:16 +0000 (19:30 -0700)]
Makefile: Use common args for dtoc

At present the dtoc commmand line is repeated twice in the Makefile. Use a
variable to avoid this, so it is easier to add more conditional arguments.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMakefile: Tidy up SPL dtb production
Simon Glass [Wed, 23 Dec 2020 02:30:15 +0000 (19:30 -0700)]
Makefile: Tidy up SPL dtb production

Use the SPL_NAME variable to simplify the rules. Drop the SPL targets
clean-files since the SPL and TPL dts/ directories are removed by
existing rules. Move the SPL rules into a new spl_dtbs to avoid the
complicated $(if) construct.

Also drop unused pieces from the 'targets' variable.

With this, SPL and TPL have separate dtbs which respect the various
u-boot,dm-spl / u-boot,dm-tpl tags.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMakefile: Build SPL dtbs in the spl/ directory
Simon Glass [Wed, 23 Dec 2020 02:30:14 +0000 (19:30 -0700)]
Makefile: Build SPL dtbs in the spl/ directory

Rather than putting these in the top-level dts/ directory (which is
intended for U-Boot proper), put them in the correct subdirectory for
SPL (either spl/ or tpl/). This is where other SPL targets are kept,
so this is more consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMakefile: Build a separate .dtb for TPL
Simon Glass [Wed, 23 Dec 2020 02:30:13 +0000 (19:30 -0700)]
Makefile: Build a separate .dtb for TPL

At present both SPL and TPL use the same devicetree binary. While there
is logic to run fdtgrep separately on each one, it does not actually
happen.

Add a new TPL rule and use that instead. Make this rule conditional on
there actually being a TPL. Do the same for SPL for consistency.

Note that the SPL and TPL dtbs are build by a Makefule rule used for
U-Boot proper. This is the 'dtbs' target in dts/Makefile. So the check
for CONFIG_TPL_BUILD in cmd_fdtgrep never actually works at present.

We don't support CONFIG_OF_EMBED for TPL at present.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMerge tag 'efi-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi into...
Tom Rini [Fri, 1 Jan 2021 03:28:09 +0000 (22:28 -0500)]
Merge tag 'efi-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi into next

Pull request for UEFI sub-system for next

* UEFI capsule authentication
* UEFI capsule update on QEMU ARM
* fsuuid command for FAT file system
* bug fixes

3 years agoqemu: arm64: Add documentation for capsule update
Sughosh Ganu [Wed, 30 Dec 2020 13:57:12 +0000 (19:27 +0530)]
qemu: arm64: Add documentation for capsule update

Add documentation highlighting the steps for using the uefi capsule
update feature for updating the u-boot firmware image.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agoefidebug: capsule: Add a command to update capsule on disk
Sughosh Ganu [Wed, 30 Dec 2020 13:57:11 +0000 (19:27 +0530)]
efidebug: capsule: Add a command to update capsule on disk

Add a efidebug subcommand to initiate a firmware update using the efi
firmware management protocol(fmp) set_image routine.

The firmware update can be initiated through

'efidebug capsule disk-update'

This would locate the efi capsule file on the efi system partition,
and call the platform's set_image fmp routine to initiate the firmware
update.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agoefi_loader: Enable uefi capsule authentication
Sughosh Ganu [Wed, 30 Dec 2020 13:57:10 +0000 (19:27 +0530)]
efi_loader: Enable uefi capsule authentication

Add support for enabling uefi capsule authentication. This feature is
enabled by setting the environment variable
"capsule_authentication_enabled".

The following configs are needed for enabling uefi capsule update and
capsule authentication features on the platform.

CONFIG_EFI_HAVE_CAPSULE_SUPPORT=y
CONFIG_EFI_CAPSULE_ON_DISK=y
CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT=y
CONFIG_EFI_CAPSULE_FIRMWARE=y
CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
CONFIG_EFI_CAPSULE_AUTHENTICATE=y

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agoefi: capsule: Add support for uefi capsule authentication
Sughosh Ganu [Wed, 30 Dec 2020 13:57:09 +0000 (19:27 +0530)]
efi: capsule: Add support for uefi capsule authentication

Add support for authenticating uefi capsules. Most of the signature
verification functionality is shared with the uefi secure boot
feature.

The root certificate containing the public key used for the signature
verification is stored as part of the device tree blob. The root
certificate is stored as an efi signature list(esl) file -- this file
contains the x509 certificate which is the root certificate.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agoefi_loader: Re-factor code to build the signature store from efi signature list
Sughosh Ganu [Wed, 30 Dec 2020 13:57:08 +0000 (19:27 +0530)]
efi_loader: Re-factor code to build the signature store from efi signature list

The efi_sigstore_parse_sigdb function reads the uefi authenticated
variable, stored in the signature database format and builds the
signature store structure. Factor out the code for building
the signature store. This can then be used by the capsule
authentication routine to build the signature store even when the
signature database is not stored as an uefi authenticated variable

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agoefi_loader: Make the pkcs7 header parsing function an extern
Sughosh Ganu [Wed, 30 Dec 2020 13:57:07 +0000 (19:27 +0530)]
efi_loader: Make the pkcs7 header parsing function an extern

The pkcs7 header parsing functionality is pretty generic, and can be
used by other features like capsule authentication. Make the function
an extern, also changing it's name to efi_parse_pkcs7_header

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agodfu_mtd: Add provision to unlock mtd device
Sughosh Ganu [Wed, 30 Dec 2020 13:57:06 +0000 (19:27 +0530)]
dfu_mtd: Add provision to unlock mtd device

Prior to writing to an mtd device, mtd_erase is called. This call
fails in case the sector being erased is locked. Call mtd_unlock to
unlock the region which is to be erased and later written to. Lock the
region once the write to the region has completed.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agoefi_loader: Add logic to parse EDKII specific fmp payload header
Sughosh Ganu [Wed, 30 Dec 2020 13:57:05 +0000 (19:27 +0530)]
efi_loader: Add logic to parse EDKII specific fmp payload header

When building the capsule using scripts in edk2, a fmp header is
added on top of the binary payload. Add logic to detect presence of
the header. When present, the pointer to the image needs to be
adjusted as per the size of the header to point to the actual binary
payload.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agofsp: Move and rename fsp_types.h file
Sughosh Ganu [Wed, 30 Dec 2020 13:57:04 +0000 (19:27 +0530)]
fsp: Move and rename fsp_types.h file

The fsp_types.h header file contains macros for building signatures of
different widths. These signature macros are architecture agnostic,
and can be used in all places which use signatures in a data
structure. Move and rename the fsp_types.h under the common include
header.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoqemu: common: Set dfu_alt_info variable for the platform
Sughosh Ganu [Wed, 30 Dec 2020 13:57:03 +0000 (19:27 +0530)]
qemu: common: Set dfu_alt_info variable for the platform

The dfu framework uses the dfu_alt_info environment variable to get
information that is needed for performing the firmware update. Add
logic to set the dfu_alt_info for the qemu arm64 platform to reflect
the two mtd partitions created for the u-boot env and the firmware
image. This can be subsequently extended for other qemu architectures
which need this variable set.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agoqemu: common: Add support for dynamic mtdparts for the platform
Sughosh Ganu [Wed, 30 Dec 2020 13:57:02 +0000 (19:27 +0530)]
qemu: common: Add support for dynamic mtdparts for the platform

Add support for setting the default values for mtd partitions on the
platform. This would be used for updating the firmware image using
uefi capsule update with the dfu mtd backend driver.

Currently, values have been defined for the qemu arm64 platform, with
default values defined for the mtd partitions based on the NOR
flash. This can be subsequently extended for other qemu architectures
which need mtdparts set.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agocrypto: Fix the logic to calculate hash with authattributes set
Sughosh Ganu [Wed, 30 Dec 2020 13:57:01 +0000 (19:27 +0530)]
crypto: Fix the logic to calculate hash with authattributes set

RFC 2315 Section 9.3 describes the message digesting process. The
digest calculated depends on whether the authenticated attributes are
present. In case of a scenario where the authenticated attributes are
present, the message digest that gets signed and is part of the pkcs7
message is computed from the auth attributes rather than the contents
field.

Check if the auth attributes are present, and if set, use the auth
attributes to compute the hash that would be compared with the
encrypted hash on the pkcs7 message.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agoqemu: arm: Initialise virtio devices in board_late_init
Sughosh Ganu [Wed, 30 Dec 2020 13:57:00 +0000 (19:27 +0530)]
qemu: arm: Initialise virtio devices in board_late_init

On the qemu arm platform, the virtio devices are initialised in the
board_init function, which gets called before the initr_pci. With
this sequence, the virtio block devices on the pci bus are not
initialised. Move the initialisation of the virtio devices to
board_late_init which gets called after the call to initr_pci.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agomkeficapsule: Add support for embedding public key in a dtb
Sughosh Ganu [Wed, 30 Dec 2020 13:56:59 +0000 (19:26 +0530)]
mkeficapsule: Add support for embedding public key in a dtb

Add options for embedding the public key esl(efi signature list) file
to the platform's dtb. The esl file is then retrieved and used for
authenticating the capsule to be used for updating firmare components
on the platform.

The esl file can now be embedded in the dtb by invoking the following
command
mkeficapsule -K <pub_key.esl> -D <dtb>

In the scenario where the esl file is to be embedded in an overlay,
this can be done through the following command
mkeficapsule -O -K <pub_key.esl> -D <dtb>

This will create a node named 'signature' in the dtb, and the esl file
will be stored as 'capsule-key'

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agoefi_loader: event queueing
Heinrich Schuchardt [Sun, 27 Dec 2020 23:25:34 +0000 (00:25 +0100)]
efi_loader: event queueing

When a new event is queued we have to process the event queue by calling
efi_process_event_queue(). But there is not reason to call the function
when the event is not queueable.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: Add size checks to efi_create_indexed_name()
Ilias Apalodimas [Thu, 31 Dec 2020 10:26:46 +0000 (12:26 +0200)]
efi_loader: Add size checks to efi_create_indexed_name()

Although the function description states the caller must provide a
sufficient buffer, it's better to have in function checks that the
destination buffer can hold the intended value.

So let's add an extra argument with the buffer size and check that
before doing any copying.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: Remove unconditional installation of file2 protocol for initrd
Ilias Apalodimas [Wed, 30 Dec 2020 15:07:14 +0000 (17:07 +0200)]
efi_loader: Remove unconditional installation of file2 protocol for initrd

Up to now we install the EFI_LOAD_FILE2_PROTOCOL to load an initrd
unconditionally. Although we correctly return various EFI exit codes
depending on the file status (i.e EFI_NO_MEDIA, EFI_NOT_FOUND etc), the
kernel loader only falls back to the cmdline interpreted initrd if the
protocol is not installed.

This creates a problem for EFI installers, since they won't be able to
load their own initrd and start the installation.

A following patch introduces a different logic where we search for an
initrd path defined in an EFI variable named 'Initrd####'.
If the bootmgr is used to launch the EFI payload, we'll will try to match
the BootCurrent value and find the corresponding initrd
(i.e Boot0000 -> Initrd0000 etc). If the file is found, we'll install
the required protocol which the kernel's efi-stub can use and load our
initrd.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: Remove unused headers from efi_load_initrd.c
Ilias Apalodimas [Thu, 31 Dec 2020 10:33:23 +0000 (12:33 +0200)]
efi_loader: Remove unused headers from efi_load_initrd.c

dm.h and env.h serve no purpose here. Remove them and sort the
remaining in alphabetical order.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: use after free in efi_exit()
Heinrich Schuchardt [Mon, 28 Dec 2020 22:24:40 +0000 (23:24 +0100)]
efi_loader: use after free in efi_exit()

Do not use data from the loaded image object after deleting it.

Fixes: 126a43f15b36 ("efi_loader: unload applications upon Exit()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: describe struct efi_loaded_image_obj
Heinrich Schuchardt [Mon, 28 Dec 2020 21:42:51 +0000 (22:42 +0100)]
efi_loader: describe struct efi_loaded_image_obj

Add the missing description of some fields of struct efi_loaded_image_obj.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: efi_signal_event() fix comment typos
Heinrich Schuchardt [Sun, 27 Dec 2020 23:59:09 +0000 (00:59 +0100)]
efi_loader: efi_signal_event() fix comment typos

Add missing commas.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: avoid invalid free
Heinrich Schuchardt [Sun, 27 Dec 2020 14:46:00 +0000 (15:46 +0100)]
efi_loader: avoid invalid free

load_options passed from do_efibootmgr() to do_bootefi_exec() may contain
invalid data from the stack which will lead to an invalid free().

Fixes: 0ad64007feb9 ("efi_loader: set load options in boot manager")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: escape key handling
Heinrich Schuchardt [Sun, 27 Dec 2020 13:47:50 +0000 (14:47 +0100)]
efi_loader: escape key handling

Up to now the escape key was not correctly detected in UEFI applications.
We had to hit it twice for a single escape to be recognized.

Use a 10 ms delay to detect if we are dealing with the escape key or an
escape sequence.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: missing parentheses after if
Heinrich Schuchardt [Sun, 27 Dec 2020 14:33:09 +0000 (15:33 +0100)]
efi_loader: missing parentheses after if

IS_ENABLED() contains parentheses. But we should still put extra
parentheses around it in an if statement for readability.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs/fat: implement fsuuid command
Heinrich Schuchardt [Wed, 30 Dec 2020 23:38:13 +0000 (00:38 +0100)]
fs/fat: implement fsuuid command

The FAT file system does not have a UUID but a 4 byte volume ID.
Let the fsuuid command show it in XXXX-XXXX format.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: eliminate DIRENTSPERBLOCK() macro
Heinrich Schuchardt [Fri, 25 Dec 2020 13:30:04 +0000 (14:30 +0100)]
fs: fat: eliminate DIRENTSPERBLOCK() macro

The FAT filesystem implementation uses several marcros referring to a magic
variable name mydata which renders the code less readable. Eliminate one of
them which is only used for a debug() statement.

Use log_debug() instead of debug().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoefi_loader: Extra checks while opening an OPTEE session
Ilias Apalodimas [Wed, 23 Dec 2020 11:25:00 +0000 (13:25 +0200)]
efi_loader: Extra checks while opening an OPTEE session

When opening an OP-TEE session we need to check the internal return
value of OP-TEE call arguments as well the return code of the
function itself.
The code was also ignoring to close the OP-TEE session in case the
shared memory registration failed.

Fixes: f042e47e8fb43 ("efi_loader: Implement EFI variable handling via OP-TEE")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: make variable store size customizable
Heinrich Schuchardt [Sun, 20 Dec 2020 10:05:38 +0000 (11:05 +0100)]
efi_loader: make variable store size customizable

Currently the size of the buffer to keep UEFI variables in memory is fixed
at 16384 bytes. This size has proven to be too small for some use cases.

Make the size of the memory buffer for UEFI variables customizable.

Reported-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
4 years agoMerge tag 'dm-next-23dec20' of git://git.denx.de/u-boot-dm into next
Tom Rini [Wed, 23 Dec 2020 23:10:15 +0000 (18:10 -0500)]
Merge tag 'dm-next-23dec20' of git://git.denx.de/u-boot-dm into next

dm: New sequence number implementation
SPI handling of bus with different-speed devices
patman supression of sign-offs

4 years agodm: core: Inline a few ofnode functions in SPL
Simon Glass [Thu, 17 Dec 2020 00:25:06 +0000 (17:25 -0700)]
dm: core: Inline a few ofnode functions in SPL

A recent change to unify the flattree/livetree code introduced a small
size increase in SPL on some boards. For example SPL code size for
px30-core-ctouch2-px30 increased by 40 bytes.

To address this we can take advantage of the fact that some of the ofnode
functions are only called a few times in SPL, so it is worth inlining
them.

Add new Kconfig options to control this. These functions are not inlined
for U-Boot proper, since this increases code size.

Fixes: 2ebea5eaebf ("dm: core: Combine the flattree and livetree binding code")
Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobuildman: Remove output binaries before building
Simon Glass [Thu, 17 Dec 2020 00:24:17 +0000 (17:24 -0700)]
buildman: Remove output binaries before building

Buildman reuses build directories from previous builds to avoid the cost
of 'make mrproper' for every build. If the previous build produced an SPL
image but the current one does not, the SPL image will remain and buildman
will think it is a result of building the current board.

Remove these files before building, to avoid this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: spi: Fix spi_free_slave() freed memory write
Niel Fourie [Wed, 16 Dec 2020 11:11:52 +0000 (12:11 +0100)]
dm: spi: Fix spi_free_slave() freed memory write

Remove setting slave->dev to NULL after the device_remove() call.

The slave pointer points to dev->parent_priv, which has already
been freed by device_free(), called from device_remove() in the
preceding line. Writing to slave->dev may cause corruption of the
dlmalloc free chunk forward pointer of the previously freed chunk.

Signed-off-by: Niel Fourie <lusus@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotest: dm: spi: Add testcase for spi_claim_bus()
Ovidiu Panait [Mon, 14 Dec 2020 17:06:51 +0000 (19:06 +0200)]
test: dm: spi: Add testcase for spi_claim_bus()

Add testcase for spi_claim_bus(), which checks that sandbox spi bus
speed/mode settings are updated correctly when multiple slaves use
the bus consecutively. The following configurations are used for the
two spi slaves involved:
  * different max_hz / different modes
  * different max_hz / same modes
  * different modes / same max_hz

asm/test.h header is added in order to be able to retrieve the current
speed/mode of the sandbox spi bus, via sandbox_spi_get_{speed, mode}.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agospi: spi-uclass: Fix spi_claim_bus() speed/mode setup logic
Ovidiu Panait [Mon, 14 Dec 2020 17:06:50 +0000 (19:06 +0200)]
spi: spi-uclass: Fix spi_claim_bus() speed/mode setup logic

Currently, when different spi slaves claim the bus consecutively using
spi_claim_bus(), spi_set_speed_mode() will only be executed on the first
two calls, leaving the bus in a bad state starting with the third call.

This patch drops spi_slave->speed member and adds caching of bus
speed/mode in dm_spi_bus struct. It also updates spi_claim_bus() to call
spi_set_speed_mode() if either speed or mode is different from what the
bus is currently configured for. Current behavior is to only take into
account the speed, but not the mode, which seems wrong.

Fixes: 60e2809a848 ("dm: spi: Avoid setting the speed with every transfer")
Reviewed-by: Simon Glass <sjg@chromium.org>
Reported-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reported-by: Moshe, Yaniv <yanivmo@amazon.com>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
4 years agotest: spi: Add sandbox_spi_get_{speed, mode} interface
Ovidiu Panait [Mon, 14 Dec 2020 17:06:49 +0000 (19:06 +0200)]
test: spi: Add sandbox_spi_get_{speed, mode} interface

Introduce sandbox_spi_get_{speed, mode} public interface to retrieve the
sandbox spi bus internal state. They are meant to be used in sandbox spi
testcases.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agospi: sandbox_spi: Implement speed/mode setup
Ovidiu Panait [Mon, 14 Dec 2020 17:06:48 +0000 (19:06 +0200)]
spi: sandbox_spi: Implement speed/mode setup

Implement sandbox_spi_set_{speed, mode} routines, to be able to keep track
of the current bus speed/mode. This will help determine whether the values
passed from dm_spi_claim_bus() are valid.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
4 years agosandbox: test: Add a second SPI slave on sandbox_spi bus
Ovidiu Panait [Mon, 14 Dec 2020 17:06:47 +0000 (19:06 +0200)]
sandbox: test: Add a second SPI slave on sandbox_spi bus

Place a second spi slave on the sandbox_spi bus, to be used by the
spi_claim_bus() testcase we are about to introduce. We need to make sure
that jumping between slaves calling spi_claim_bus() sets the bus speed and
mode appropriately. Use different max-hz and mode properties for this new
slave.

Also, update sandbox_spi cs_info call to allow activity on CS0/CS1 and
adapt dm_test_spi_find() testcase for this new setup.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: spi: Drop unused sandbox_spi_parse_spec function
Ovidiu Panait [Mon, 14 Dec 2020 17:06:46 +0000 (19:06 +0200)]
sandbox: spi: Drop unused sandbox_spi_parse_spec function

Commit 1289e96797bf ("sandbox: spi: Drop command-line SPI option") dropped
support for specifying SPI devices on the command line, removing the only
user of sandbox_spi_parse_spec(). Remove the function too.

Fixes: 1289e96797bf ("sandbox: spi: Drop command-line SPI option")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: implement invalidate_icache_all()
Heinrich Schuchardt [Wed, 9 Dec 2020 18:42:44 +0000 (19:42 +0100)]
sandbox: implement invalidate_icache_all()

Before executing code that we have loaded from a file we need to flush the
data cache and invalidate the instruction flash.

Implement functions flush_cache() and invalidate_icache_all().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agofdt: Use phandle to distinguish DT nodes with same name
Aswath Govindraju [Thu, 3 Dec 2020 05:25:45 +0000 (10:55 +0530)]
fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoCommon:fdt: Check for error return value
Hongwei Zhang [Wed, 2 Dec 2020 19:47:03 +0000 (14:47 -0500)]
Common:fdt: Check for error return value

Check for negative return value of fdt_noffset from calling
boot_get_fdt_fit().

Signed-off-by: Hongwei Zhang <hongweiz@ami.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: implement runtime system reset
Heinrich Schuchardt [Wed, 2 Dec 2020 15:22:11 +0000 (16:22 +0100)]
sandbox: implement runtime system reset

Implement a reset function that we can call after ExitBootServices(),
when all driver model devices are gone.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoconfigs: sandbox: activate DEBUG_UART
Patrick Delaunay [Fri, 27 Nov 2020 10:49:29 +0000 (11:49 +0100)]
configs: sandbox: activate DEBUG_UART

Add CONFIG_DEBUG_UART=y for all sandbox defconfig
as it is already done in sandbox_defconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Add project-default for 'gcc'
Philipp Tomsich [Tue, 24 Nov 2020 17:14:53 +0000 (18:14 +0100)]
patman: Add project-default for 'gcc'

Add defaults for FSF/GNU projects, such as gcc, that provide sensible
settings for those projects.

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Add --no-signoff to suppress adding signoffs
Philipp Tomsich [Tue, 24 Nov 2020 17:14:52 +0000 (18:14 +0100)]
patman: Add --no-signoff to suppress adding signoffs

To enable use of patman with FSF/GNU projects, such as GCC or
Binutils, no Signed-off-by may be added.  This adds a command
line flag '--no-signoff' to suppress adding signoffs in patman
when processing commits.

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix patman testBranch() test:
Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: Update documentation for new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:33 +0000 (21:20 -0700)]
dm: Update documentation for new sequence numbers

Update the driver model documention to describe how sequence numbers now
work.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Drop seq and req_seq
Simon Glass [Thu, 17 Dec 2020 04:20:32 +0000 (21:20 -0700)]
dm: core: Drop seq and req_seq

Now that migration to the new sequence numbers is complete, drop the old
fields. Add a test that covers the new behaviour.

Also drop the check for OF_PRIOR_STAGE since we always assign sequence
numbers now.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocmd: Drop use of old sequence numbers in commands
Simon Glass [Thu, 17 Dec 2020 04:20:31 +0000 (21:20 -0700)]
cmd: Drop use of old sequence numbers in commands

Several commands use sequence numbers. Update them to use the new ones.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Update uclass_find_next_free_req_seq() for new scheme
Simon Glass [Thu, 17 Dec 2020 04:20:30 +0000 (21:20 -0700)]
dm: core: Update uclass_find_next_free_req_seq() for new scheme

This function current deals with req_seq which is deprecated. Update it to
use the new sequence numbers, putting them above existing aliases. Rename
the function to make this clear.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: Drop the unused arg in uclass_find_device_by_seq()
Simon Glass [Thu, 17 Dec 2020 04:20:29 +0000 (21:20 -0700)]
dm: Drop the unused arg in uclass_find_device_by_seq()

Now that there is only one sequence number (rather than both requested and
assigned ones) we can simplify this function. Also update its caller to
simplify the logic.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: Drop uclass_resolve_seq()
Simon Glass [Thu, 17 Dec 2020 04:20:28 +0000 (21:20 -0700)]
dm: Drop uclass_resolve_seq()

This function is not needed anymore. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: test: Add a test for DM_UC_FLAG_NO_AUTO_SEQ
Simon Glass [Thu, 17 Dec 2020 04:20:27 +0000 (21:20 -0700)]
dm: test: Add a test for DM_UC_FLAG_NO_AUTO_SEQ

Check that this flag operates as expected. This patch is not earlier in
this series since is uses the new behaviour of dev_seq().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: Switch over to use new sequence number for dev_seq()
Simon Glass [Thu, 17 Dec 2020 04:20:26 +0000 (21:20 -0700)]
dm: Switch over to use new sequence number for dev_seq()

Update this function to use the new sequence number and fix up the test
that deals with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopinctrl: Update for new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:25 +0000 (21:20 -0700)]
pinctrl: Update for new sequence numbers

Use the dev_seq() sequence number in all cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agogpio: Update for new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:24 +0000 (21:20 -0700)]
gpio: Update for new sequence numbers

Use the dev_seq() sequence number in all cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agox86: Simplify acpi_device_infer_name()
Simon Glass [Thu, 17 Dec 2020 04:20:23 +0000 (21:20 -0700)]
x86: Simplify acpi_device_infer_name()

There is no-longer any need to check if sequence numbers are valid, since
this is ensured by driver model. Drop the unwanted logic.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agox86: Drop unnecessary mp_init logic
Simon Glass [Thu, 17 Dec 2020 04:20:22 +0000 (21:20 -0700)]
x86: Drop unnecessary mp_init logic

Now that sequence numbers are set up when devices are bound, this code is
not needed. Also, we should use dev_seq() instead of req_seq. Update the
whole file accordingly.

Also fix up APL cpu while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agousb: Update for new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:21 +0000 (21:20 -0700)]
usb: Update for new sequence numbers

Use the new sequence number in all cases. Since all devices are assigned
a number when bound, this hack should not be needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agousb: ehci-mx6: Drop assignment of sequence number
Simon Glass [Thu, 17 Dec 2020 04:20:20 +0000 (21:20 -0700)]
usb: ehci-mx6: Drop assignment of sequence number

This hack cannot work in the new sequence-numbering scheme. Remove it
while we wait for the maintainer to complete DM conversion as noted in
the existing comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agospi: Update for new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:19 +0000 (21:20 -0700)]
spi: Update for new sequence numbers

Use the new sequence number in all cases. Drop the rockchip case because
the sequence number should be 0 anyway, and assigning to the sequence
number is not permitted.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopci: Update to use new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:18 +0000 (21:20 -0700)]
pci: Update to use new sequence numbers

Now that we know the sequence number at bind time, there is no need for
special-case code in dm_pci_hose_probe_bus().

Note: the PCI_CAP_ID_EA code may need a look, but there are no test
failures so I have left it as is.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Allow manual sequence numbering
Simon Glass [Thu, 17 Dec 2020 04:20:17 +0000 (21:20 -0700)]
dm: core: Allow manual sequence numbering

Some buses have their own rules which require assigning sequence numbers
with a bus-specific algorithm. For example, PCI requires that sub-buses
are numbered higher than their parent buses, meaning effectively that
parent buses must be numbered only after all of their child buses have
been numbered.

Add a uclass flag to indicate that driver model should not assign sequence
numbers. In this case, the uclass must do it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agonet: Update to use new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:16 +0000 (21:20 -0700)]
net: Update to use new sequence numbers

Checking for seq == -1 is effectively checking that the device is
activated. The new sequence numbers are never -1 for a bound device, so
update the check.

Also drop the note about valid sequence numbers so it is accurate with the
new approach.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoi2c: Update for new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:15 +0000 (21:20 -0700)]
i2c: Update for new sequence numbers

Use the new sequence number in all cases. Drop the logic to check for a
valid number in designware_i2c, since it will always be valid.

Also drop the numbering in the uclass, since we can rely on driver
model giving us the right sequence numbers.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoocteon: Don't attempt to set the sequence number
Simon Glass [Thu, 17 Dec 2020 04:20:14 +0000 (21:20 -0700)]
octeon: Don't attempt to set the sequence number

Several Octeon drivers operate by setting the sequence number of their
device. This should not be needed with the new sequence number setup. Also
it is not permitted. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: test: Drop assumptions of no sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:13 +0000 (21:20 -0700)]
dm: test: Drop assumptions of no sequence numbers

Drop code in a few tests which assumes that sequence numbers are only
valid when a device is probed.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: Fix return value in dev_read_alias_seq()
Simon Glass [Thu, 17 Dec 2020 04:20:12 +0000 (21:20 -0700)]
dm: Fix return value in dev_read_alias_seq()

This should return 0 on success but currently does not. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Switch binding to use new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:11 +0000 (21:20 -0700)]
dm: core: Switch binding to use new sequence numbers

Update the core logic to use the new approach. For now the old code is
left as is. Update one test so it still passes.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: test: Check all devices have a sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:10 +0000 (21:20 -0700)]
dm: test: Check all devices have a sequence numbers

Add a test that the new sequence numbers work as expected. Every device
should get one.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Add a new sequence number for devices
Simon Glass [Thu, 17 Dec 2020 04:20:09 +0000 (21:20 -0700)]
dm: core: Add a new sequence number for devices

At present each device has two sequence numbers, with 'req_seq' being
set up at bind time and 'seq' at probe time. The idea is that devices
can 'request' a sequence number and then the conflicts are resolved when
the device is probed.

This makes things complicated in a few cases, since we don't really know
what the sequence number will end up being. We want to honour the
bind-time requests if at all possible, but in fact the only source of
these at present is the devicetree aliases. Since we have the devicetree
available at bind time, we may as well just use it, in the hope that the
required processing will turn out to be useful later (i.e. the device
actually gets used).

Add a new 'sqq' member, the bind-time sequence number. It operates in
parallel to the old values for now. All devices get a valid sqq value,
i.e. it is never -1.

Drop an #ifdef while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Update uclass_find_next_free_req_seq() args
Simon Glass [Thu, 17 Dec 2020 04:20:08 +0000 (21:20 -0700)]
dm: core: Update uclass_find_next_free_req_seq() args

At present this is passed a uclass ID and it has to do a lookup. The
callers all have the uclass pointer, except for the I2C uclass where the
code will soon be deleted.

Update the argument to a uclass * instead of an ID since it is more
efficient.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: Avoid accessing seq directly
Simon Glass [Thu, 17 Dec 2020 04:20:07 +0000 (21:20 -0700)]
dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agolinker_lists: Fix alignment issue
Simon Glass [Thu, 17 Dec 2020 04:20:06 +0000 (21:20 -0700)]
linker_lists: Fix alignment issue

The linker script uses alphabetic sorting to group the different linker
lists together. Each group has its own struct and potentially its own
alignment. But when the linker packs the structs together it cannot ensure
that a linker list starts on the expected alignment boundary.

For example, if the first list has a struct size of 8 and we place 3 of
them in the image, that means that the next struct will start at offset
0x18 from the start of the linker_list section. If the next struct has
a size of 16 then it will start at an 8-byte aligned offset, but not a
16-byte aligned offset.

With sandbox on x86_64, a reference to a linker list item using
ll_entry_get() can force alignment of that particular linker_list item,
if it is in the same file as the linker_list item is declared.

Consider this example, where struct driver is 0x80 bytes:

ll_entry_declare(struct driver, fred, driver)

...

void *p = ll_entry_get(struct driver, fred, driver)

If these two lines of code are in the same file, then the entry is forced
to be aligned at the 'struct driver' alignment, which is 16 bytes. If the
second line of code is in a different file, then no action is taken, since
the compiler cannot update the alignment of the linker_list item.

In the first case, an 8-byte 'fill' region is added:

 .u_boot_list_2_driver_2_testbus_drv
                0x0000000000270018       0x80 test/built-in.o
                0x0000000000270018                _u_boot_list_2_driver_2_testbus_drv
 .u_boot_list_2_driver_2_testfdt1_drv
                0x0000000000270098       0x80 test/built-in.o
                0x0000000000270098                _u_boot_list_2_driver_2_testfdt1_drv
 *fill*         0x0000000000270118        0x8
 .u_boot_list_2_driver_2_testfdt_drv
                0x0000000000270120       0x80 test/built-in.o
                0x0000000000270120                _u_boot_list_2_driver_2_testfdt_drv
 .u_boot_list_2_driver_2_testprobe_drv
                0x00000000002701a0       0x80 test/built-in.o
                0x00000000002701a0                _u_boot_list_2_driver_2_testprobe_drv

With this, the linker_list no-longer works since items after testfdt1_drv
are not at the expected address.

Ideally we would have a way to tell gcc not to align structs in this way.
It is not clear how we could do this, and in any case it would require us
to adjust every struct used by the linker_list feature.

One possible fix is to force each separate linker_list to start on the
largest possible boundary that can be required by the compiler. However
that does not seem to work on x86_64, which uses 16-byte alignment in this
case but needs 32-byte alignment.

So add a Kconfig option to handle this. Set the default value to 4 so
as to avoid changing platforms that don't need it.

Update the ll_entry_start() accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoMerge tag 'dm-pull-14dec20' of git://git.denx.de/u-boot-dm into next
Tom Rini [Mon, 14 Dec 2020 23:57:57 +0000 (18:57 -0500)]
Merge tag 'dm-pull-14dec20' of git://git.denx.de/u-boot-dm into next

Driver model tidy-up for livetree
Driver model big rename for consistency
Python 3 clean-ups for patman
Update sandbox serial driver to use membuff

4 years agocheckpatch: Add warnings for unexpected struct names
Simon Glass [Thu, 3 Dec 2020 23:55:24 +0000 (16:55 -0700)]
checkpatch: Add warnings for unexpected struct names

As a way of keeping the driver declarations more consistent, add a warning
if the struct used does not end with _priv or _plat.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: treewide: Rename ..._platdata variables to just ..._plat
Simon Glass [Thu, 3 Dec 2020 23:55:23 +0000 (16:55 -0700)]
dm: treewide: Rename ..._platdata variables to just ..._plat

Try to maintain some consistency between these variables by using _plat as
a suffix for them.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: treewide: Update 'auto' declarations to be on one line
Simon Glass [Thu, 3 Dec 2020 23:55:22 +0000 (16:55 -0700)]
dm: treewide: Update 'auto' declarations to be on one line

Fix up the code style for those declarations that should now fit onto one
line, which is all of them that currently do not.

This is needed for dtoc to detect the structs correctly, at present.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: treewide: Rename ofdata_to_platdata() to of_to_plat()
Simon Glass [Thu, 3 Dec 2020 23:55:21 +0000 (16:55 -0700)]
dm: treewide: Rename ofdata_to_platdata() to of_to_plat()

This name is far too long. Rename it to remove the 'data' bits. This makes
it consistent with the platdata->plat rename.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: treewide: Rename dev_get_platdata() to dev_get_plat()
Simon Glass [Thu, 3 Dec 2020 23:55:20 +0000 (16:55 -0700)]
dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: Rename 'platdata_size' to 'plat_size'
Simon Glass [Thu, 3 Dec 2020 23:55:19 +0000 (16:55 -0700)]
dm: Rename 'platdata_size' to 'plat_size'

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: treewide: Rename 'platdata' variables to just 'plat'
Simon Glass [Thu, 3 Dec 2020 23:55:18 +0000 (16:55 -0700)]
dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: treewide: Rename auto_alloc_size members to be shorter
Simon Glass [Thu, 3 Dec 2020 23:55:17 +0000 (16:55 -0700)]
dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodtoc: Tidy up more Python style in dtb_platdata
Simon Glass [Thu, 3 Dec 2020 23:55:16 +0000 (16:55 -0700)]
dtoc: Tidy up more Python style in dtb_platdata

Update this file to reduce the number of pylint warnings. Also add a few
missing comments while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Drop unused parameter from dm_extended_scan_fdt()
Simon Glass [Sun, 29 Nov 2020 00:50:10 +0000 (17:50 -0700)]
dm: core: Drop unused parameter from dm_extended_scan_fdt()

This doesn't need to be passed the devicetree anymore. Drop it.
Also rename the function to drop the _fdt suffix.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Drop unused parameter from dm_scan_fdt()
Simon Glass [Sun, 29 Nov 2020 00:50:09 +0000 (17:50 -0700)]
dm: core: Drop unused parameter from dm_scan_fdt()

This doesn't need to be passed the devicetree anymore. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Combine the flattree and livetree binding code
Simon Glass [Sun, 29 Nov 2020 00:50:08 +0000 (17:50 -0700)]
dm: core: Combine the flattree and livetree binding code

At present there are two copies of this code. With ofnode we can combine
them to reduce duplication. Update the dm_scan_fdt_node() function and
adjust its callers.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Add an ofnode function to get the devicetree root
Simon Glass [Sun, 29 Nov 2020 00:50:07 +0000 (17:50 -0700)]
dm: core: Add an ofnode function to get the devicetree root

This is needed in at least one place. Avoid the conditional code in root.c
by adding this inline function.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Drop device_bind_offset()
Simon Glass [Sun, 29 Nov 2020 00:50:06 +0000 (17:50 -0700)]
dm: core: Drop device_bind_offset()

This function is not needed since the standard device_bind() can be used
instead. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Drop dev_set_of_offset()
Simon Glass [Sun, 29 Nov 2020 00:50:05 +0000 (17:50 -0700)]
dm: core: Drop dev_set_of_offset()

This pre-livetree function is not needed anymore. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: Drop uses of dev_set_of_offset()
Simon Glass [Sun, 29 Nov 2020 00:50:04 +0000 (17:50 -0700)]
dm: Drop uses of dev_set_of_offset()

The need for this can be avoided by passing the correct node to the
device_bind() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: Remove uses of device_bind_offset()
Simon Glass [Sun, 29 Nov 2020 00:50:03 +0000 (17:50 -0700)]
dm: Remove uses of device_bind_offset()

This function is not needed since the standard device_bind() can be used
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Add a livetree function to check node status
Simon Glass [Sun, 29 Nov 2020 00:50:02 +0000 (17:50 -0700)]
dm: core: Add a livetree function to check node status

Add a way to find out if a node is enabled or not, based on its 'status'
property.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Rename device_bind_ofnode() to device_bind()
Simon Glass [Sun, 29 Nov 2020 00:50:01 +0000 (17:50 -0700)]
dm: core: Rename device_bind_ofnode() to device_bind()

This is the standard function to use when binding devices. Drop the
'_ofnode' suffix to make this clear.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Rename device_bind() to device_bind_offset()
Simon Glass [Sun, 29 Nov 2020 00:50:00 +0000 (17:50 -0700)]
dm: core: Rename device_bind() to device_bind_offset()

This function is not necessary anymore, since device_bind_ofnode() does
the same thing and works with both flattree and livetree.

Rename it to indicate that it is special.

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