platform/kernel/u-boot.git
3 years agodm: core: Access device ofnode through functions
Simon Glass [Sat, 19 Dec 2020 17:40:14 +0000 (10:40 -0700)]
dm: core: Access device ofnode through functions

At present ofnode is present in the device even if it is never used. With
of-platdata this field is not used, so can be removed. In preparation for
this, change the access to go through inline functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Use dev_has_ofnode() instead of dev_of_valid()
Simon Glass [Sat, 19 Dec 2020 17:40:13 +0000 (10:40 -0700)]
dm: core: Use dev_has_ofnode() instead of dev_of_valid()

We have two functions which do the same thing. Standardise on
dev_has_ofnode() since there is no such thing as an 'invalid' ofnode in
normal operation: it is either null or missing.

Also move the functions into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agodm: core: Rename dev_has_of_node() to dev_has_ofnode()
Simon Glass [Sat, 19 Dec 2020 17:40:12 +0000 (10:40 -0700)]
dm: core: Rename dev_has_of_node() to dev_has_ofnode()

We use 'ofnode' rather than 'of_node' in U-Boot. Rename this function to
fit.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Rename device flags to indicate it is private
Simon Glass [Sat, 19 Dec 2020 17:40:11 +0000 (10:40 -0700)]
dm: core: Rename device flags to indicate it is private

To avoid having people accidentally access this member, add a trailing
underscore.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Access device flags through functions
Simon Glass [Sat, 19 Dec 2020 17:40:10 +0000 (10:40 -0700)]
dm: core: Access device flags through functions

At present flags are stored as part of the device. In preparation for
storing them separately, change the access to go through inline functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Rename sqq to seq_
Simon Glass [Sat, 19 Dec 2020 17:40:09 +0000 (10:40 -0700)]
dm: core: Rename sqq to seq_

Now that the sequence-numbering migration is complete, rename this member
back to seq_, adding an underscore to indicate it is internal to driver
model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agodm: core: Split out alloc code into a new function
Simon Glass [Sat, 19 Dec 2020 17:40:08 +0000 (10:40 -0700)]
dm: core: Split out alloc code into a new function

Add a new function to handle the allocation of private/platform data for
a device. This will make it easier to skip this feature when using the new
of-platdata.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: Drop rtc from SPL
Simon Glass [Sat, 19 Dec 2020 17:40:07 +0000 (10:40 -0700)]
x86: Drop rtc from SPL

The RTC is not currently used in SPL. Drop it so that it does not take up
space.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: coral: Remove unwanted nodes from SPL/TPL
Simon Glass [Sat, 19 Dec 2020 17:40:06 +0000 (10:40 -0700)]
x86: coral: Remove unwanted nodes from SPL/TPL

Some devices are not needed in SPL/TPL. For TPL this causes the
generation of unnecessary of-platadata structs. Make some adjustments to
fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: apl: Adjust how the UART gets its platform data
Simon Glass [Sat, 19 Dec 2020 17:40:05 +0000 (10:40 -0700)]
x86: apl: Adjust how the UART gets its platform data

At present this driver calls malloc() to start a new platform data
structure, fills it in and tells driver model to use it.

We want to avoid malloc, particularly with the new version of of-platdata.
Create a new struct which encompasses both the dtd struct and the ns16550
one, to avoid this. Unfortunately we must copy the data into the right
place for the ns16550 driver. Add some comments about this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: sysreset: Move priv/plat structs to headers
Simon Glass [Sat, 19 Dec 2020 17:40:04 +0000 (10:40 -0700)]
x86: sysreset: Move priv/plat structs to headers

With the new of-platdata, these need to be available to dt_platdata.c
so must be in header files. Move them and add the dtd struct too.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agodm: core: Move priv/plat structs for simple_bus to headers
Simon Glass [Sat, 19 Dec 2020 17:40:03 +0000 (10:40 -0700)]
dm: core: Move priv/plat structs for simple_bus to headers

With the new of-platdata, these need to be available to dt_platdata.c
so must be in header files. Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: apl: Use struct spi_nor instead of struct spi_flash
Simon Glass [Sat, 19 Dec 2020 17:40:02 +0000 (10:40 -0700)]
x86: apl: Use struct spi_nor instead of struct spi_flash

This construct effectively uses struct spi_nor due to a #define in
spi-nor.h so we may as well use that struct here. This allows dtoc to
parse it correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agospi: Tweak a few strange SPI NOR features for of-platdata
Simon Glass [Sat, 19 Dec 2020 17:40:01 +0000 (10:40 -0700)]
spi: Tweak a few strange SPI NOR features for of-platdata

The #define of one struct to another has been around for a while. It
confuses dtoc and makes it think that struct spi_flash does not exist.

Make a few changes to improve things while we wait for migration to be
completed:

- Move the 'struct spi_flash' to column 1 so dtoc scans it
- Remove the #define when compiling dt-platdata.c
- Update the strange mtd_get/set_of_node() functions
- Use struct spi_nor in the drivers, so dtoc sees the correct struct

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agospi: Tidy up get/set of device node
Simon Glass [Sat, 19 Dec 2020 17:40:00 +0000 (10:40 -0700)]
spi: Tidy up get/set of device node

This code is a bit odd in that it only reads and updates the livetree
version of the device ofnode. This means it won't work with flattree.
Update the code to work as it was presumably intended.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: spl: Move priv/plat structs to headers
Simon Glass [Sat, 19 Dec 2020 17:39:59 +0000 (10:39 -0700)]
x86: spl: Move priv/plat structs to headers

With the new of-platdata, these need to be available to dt_platdata.c
so must be in header files. Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: Move priv/plat structs for intel_common to headers
Simon Glass [Sat, 19 Dec 2020 17:39:58 +0000 (10:39 -0700)]
x86: Move priv/plat structs for intel_common to headers

With the new of-platdata, these need to be available to dt_platdata.c
so must be in header files. Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: apl: Move priv/plat structs to headers
Simon Glass [Sat, 19 Dec 2020 17:39:57 +0000 (10:39 -0700)]
x86: apl: Move priv/plat structs to headers

With the new of-platdata, these need to be available to dt_platdata.c
so must be in header files. Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Update dts files to reduce SPL size
Simon Glass [Sat, 19 Dec 2020 17:39:56 +0000 (10:39 -0700)]
sandbox: Update dts files to reduce SPL size

At present there are require a few devices in the devicetree which are
not actually used in SPL. This will cause problems with the new
of-platdata, since it will try to instantiate devices which are not
compiled into U-Boot.

Update the devicetree to remove these devices from SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Add a compatible string for spltest
Simon Glass [Sat, 19 Dec 2020 17:39:55 +0000 (10:39 -0700)]
sandbox: Add a compatible string for spltest

At present this driver does not have a compatible string. For it to be
used with the coming of-platadata, it must have one. Update it
accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: i2c: Move priv into a header file
Simon Glass [Sat, 19 Dec 2020 17:39:54 +0000 (10:39 -0700)]
sandbox: i2c: Move priv into a header file

Move this struct into a header file so that dtoc can include it in its
dt-platdata.c file.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: serial: Move priv into a header file
Simon Glass [Sat, 19 Dec 2020 17:39:53 +0000 (10:39 -0700)]
sandbox: serial: Move priv into a header file

Move this struct into a header file so that dtoc can include it in its
dt-platdata.c file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agosandbox: remove ram buffer file when U-Boot is loaded by SPL
Patrick Delaunay [Fri, 20 Nov 2020 08:48:33 +0000 (09:48 +0100)]
sandbox: remove ram buffer file when U-Boot is loaded by SPL

Update management of "--rm_memory" sandbox's option and force
this option when U-Boot is loaded by SPL in os_spl_to_uboot()
and remove the ram file after reading in main() as described
in option help message: "Remove memory file after reading".

This patch avoids that the file "/tmp/u-boot.mem.XXXXXX" [created in
os_jump_to_file() when U-Boot is loaded by SPL] is never deleted
because state_uninit() is not called after U-Boot execution
(CtrlC or with running pytest for example).

This issue is reproduced by
> build-sandbox_spl/spl/u-boot-spl
  and CtrlC in U-Bot console

> make qcheck

One temp file is created after each SPL and U-Boot execution
(7 tims in qcheck after test_handoff.py, test_ofplatdata.py,
 test_spl.py execution).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agox86: Fix header guard in asm/pmu.h
Simon Glass [Wed, 23 Dec 2020 15:11:33 +0000 (08:11 -0700)]
x86: Fix header guard in asm/pmu.h

This has the wrong name. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: tpl: Remove unwanted devicetree string
Simon Glass [Wed, 23 Dec 2020 15:11:32 +0000 (08:11 -0700)]
x86: tpl: Remove unwanted devicetree string

Update this driver to use of_match_ptr().

This reduces the TPL binary size by about 32 bytes.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: pinctrl: Drop unlikely error messages from TPL
Simon Glass [Wed, 23 Dec 2020 15:11:31 +0000 (08:11 -0700)]
x86: pinctrl: Drop unlikely error messages from TPL

These errors are only really for development purposes. Drop them to reduce
the size of TPL. The error numbers are still reported.

This reduces the TPL binary size on coral by about 160 bytes.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: apl: Reduce size for TPL
Simon Glass [Wed, 23 Dec 2020 15:11:30 +0000 (08:11 -0700)]
x86: apl: Reduce size for TPL

Update various drivers to use of_match_ptr() and to avoid including debug
strings in TPL. Omit the WiFi driver entirely, since it is not used in
TPL.

This reduces the TPL binary size by about 608 bytes.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: apl: Update hostbridge to remove unwanted TPL code
Simon Glass [Wed, 23 Dec 2020 15:11:29 +0000 (08:11 -0700)]
x86: apl: Update hostbridge to remove unwanted TPL code

At present several strings from this file appear in the TPL binary. Add
preprocessor checks to drop them.

This reduces the TPL binary size by about 128 bytes.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: coral: Move fsp-m settings to a subnode
Simon Glass [Wed, 23 Dec 2020 15:11:28 +0000 (08:11 -0700)]
x86: coral: Move fsp-m settings to a subnode

At present these settings are in the node for host-bridge and so are
visible in TPL as well as SPL. But they are only used for SPL.

Move them to a subnode so that TPL does not included them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: Move call64 into its own section
Simon Glass [Wed, 23 Dec 2020 15:11:27 +0000 (08:11 -0700)]
x86: Move call64 into its own section

When this code is not used (e.g. by TPL) we want it to be excluded from
the image. Put it in its own section so that this happens.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: apl: Use const for driver operations
Simon Glass [Wed, 23 Dec 2020 15:11:26 +0000 (08:11 -0700)]
x86: apl: Use const for driver operations

Update these declarations to const to ensure that the data ends up in the
rodata section.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Convert _drivers to a dict
Simon Glass [Wed, 23 Dec 2020 15:11:23 +0000 (08:11 -0700)]
dtoc: Convert _drivers to a dict

At present this member holds a simple list of driver names. Update it to
be a dict of DriverInfo, with the name being the key. This will allow more
information to be added about each driver, in future patches.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Output the struct values in a separate function
Simon Glass [Wed, 23 Dec 2020 15:11:22 +0000 (08:11 -0700)]
dtoc: Output the struct values in a separate function

Reduce the length of output_node() futher by moving the struct-output
functionality into a two separate functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Output the device in a separate function
Simon Glass [Wed, 23 Dec 2020 15:11:21 +0000 (08:11 -0700)]
dtoc: Output the device in a separate function

Reduce the length of output_node() by moving the device-output
functionality into a separate function.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Make _output_list a top-level function
Simon Glass [Wed, 23 Dec 2020 15:11:20 +0000 (08:11 -0700)]
dtoc: Make _output_list a top-level function

It is annoying to have this function inside its parent since it makes the
parent longer and hard to read. Move it to the top level.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Fix a few pylint warnings in dtb_platdata
Simon Glass [Wed, 23 Dec 2020 15:11:19 +0000 (08:11 -0700)]
dtoc: Fix a few pylint warnings in dtb_platdata

These have crept in again. Update the file to fix all but these ones:

   dtb_platdata.py:143:0: R0902: Too many instance attributes (10/7)
      (too-many-instance-attributes)
   dtb_platdata.py:713:0: R0913: Too many arguments (6/5)
      (too-many-arguments)

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Move some test drivers into their own file
Simon Glass [Wed, 23 Dec 2020 15:11:18 +0000 (08:11 -0700)]
test: Move some test drivers into their own file

At present several test drivers are part of the test file itself. Some of
these are useful for of-platdata tests. Separate them out so we can use
them for other things also.

A few adjustments are needed so this driver can build for sandbox_spl as
well.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Use a simple variable to record removed device
Simon Glass [Wed, 23 Dec 2020 15:11:17 +0000 (08:11 -0700)]
test: Use a simple variable to record removed device

At present the entire test state is effective passed into a test driver
just to record which device was removed. This is unnecessary and makes it
harder to track what is going on.

Use a simple boolean instead.

Also drop the unused 'removed' member while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotimer: Use a shorter error in TPL
Simon Glass [Wed, 23 Dec 2020 15:11:16 +0000 (08:11 -0700)]
timer: Use a shorter error in TPL

This error should not happen in normal use. Reduce the length of it to
save space in the image.

Add an empty spl.h file to sh since it appears to lack this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoarc: m68k: nds32: nios2: sh: xtensa: Add empty spl.h header
Simon Glass [Wed, 23 Dec 2020 15:11:15 +0000 (08:11 -0700)]
arc: m68k: nds32: nios2: sh: xtensa: Add empty spl.h header

At present it is not possible to include spl.h in on these architectures
since the asm/spl.h file is not present. We want to be able to use the
spl_phase() function, so add empty headers to make things build.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosysreset: Use a shorter error with SPL
Simon Glass [Wed, 23 Dec 2020 15:11:14 +0000 (08:11 -0700)]
sysreset: Use a shorter error with SPL

Use a minimal error message to save space. Sort the header files while we
are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopinctrl: Drop post_bind() method when not needed
Simon Glass [Wed, 23 Dec 2020 15:11:13 +0000 (08:11 -0700)]
pinctrl: Drop post_bind() method when not needed

This is not used with of-platdata, so remove it in that case.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Rename the priv/plat members
Simon Glass [Wed, 23 Dec 2020 02:30:30 +0000 (19:30 -0700)]
dm: core: Rename the priv/plat members

These are supposed to be private to driver model, not accessed by any code
outside. Add a trailing underscore to indicate this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Use access methods for dev/uclass private data
Simon Glass [Wed, 23 Dec 2020 02:30:29 +0000 (19:30 -0700)]
dm: core: Use access methods for dev/uclass private data

Use these functions in the core code as much as possible. With this, there
are only two places where each priv/plat pointer is accessed, one for read
and one for write.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Use access methods for dev/uclass private data
Simon Glass [Wed, 23 Dec 2020 02:30:28 +0000 (19:30 -0700)]
dm: Use access methods for dev/uclass private data

Most drivers use these access methods but a few do not. Update them.

In some cases the access is not permitted, so mark those with a FIXME tag
for the maintainer to check.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pratyush Yadav <p.yadav@ti.com>
3 years agodm: core: Add functions to set priv/plat
Simon Glass [Wed, 23 Dec 2020 02:30:27 +0000 (19:30 -0700)]
dm: core: Add functions to set priv/plat

This should not normally be needed in drivers, but add accessors for the
few cases that exist.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add function to access uclass priv
Simon Glass [Wed, 23 Dec 2020 02:30:26 +0000 (19:30 -0700)]
dm: core: Add function to access uclass priv

Add functions so this information is not accessed directly. This will be
needed for of-platdata which stores it in a different place.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: apl: Drop support for !OF_PLATDATA_PARENT
Simon Glass [Wed, 23 Dec 2020 02:30:25 +0000 (19:30 -0700)]
x86: apl: Drop support for !OF_PLATDATA_PARENT

This code was kept around after of-platdata started supporting parent
devices. That feature seems stable now, so let's drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Only include simple-bus devicetree id when needed
Simon Glass [Wed, 23 Dec 2020 02:30:24 +0000 (19:30 -0700)]
dm: core: Only include simple-bus devicetree id when needed

This is not needed when of-platdata is in use. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Use 'uclass_driver' for the uclass linker_list
Simon Glass [Wed, 23 Dec 2020 02:30:23 +0000 (19:30 -0700)]
dm: core: Use 'uclass_driver' for the uclass linker_list

At present the name 'uclass_driver' is used for the uclass linker list.
This does not follow the convention of using the struct name. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Support dm_dump_all() in SPL
Simon Glass [Wed, 23 Dec 2020 02:30:22 +0000 (19:30 -0700)]
dm: core: Support dm_dump_all() in SPL

At present the output from this function is hard to read in SPL, due to
(intended) limitations in SPL's printf() function. Add an SPL version so
it is clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agospl: Drop bd_info in the data section
Simon Glass [Wed, 23 Dec 2020 02:30:21 +0000 (19:30 -0700)]
spl: Drop bd_info in the data section

This uses up space in the SPL binary but it always starts as zero. Also
some boards cannot support data in TPL (e.g. Intel Apollo Lake).

Use malloc() to allocate this structure instead, by moving the init a
little later, after malloc() is inited. Make this function optional since
it pulls in malloc().

This reduces the TPL binary size on coral by about 64 bytes

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Drop unnecessary test node
Simon Glass [Wed, 23 Dec 2020 02:30:20 +0000 (19:30 -0700)]
sandbox: Drop unnecessary test node

The spl-test4 node deliberately has an invalid compatible string. This
causes a warning from dtoc and the check it does is not really necessary.
Drop it, to avoid the warning and associated confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoserial: Rename ns16550 functions to lower case
Simon Glass [Wed, 23 Dec 2020 02:30:19 +0000 (19:30 -0700)]
serial: Rename ns16550 functions to lower case

Lower case should be used for function names. Update this driver and its
callers accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
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>
3 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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>