platform/kernel/u-boot.git
2 years agobinman: Update fit to use node instead of subnode
Simon Glass [Sun, 6 Mar 2022 03:19:10 +0000 (20:19 -0700)]
binman: Update fit to use node instead of subnode

It doesn't make sense to use 'subnode' as a function parameter since it
is just a 'node' so far as the function is concerned. Update two functions
to use 'node' instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Add a consistent way to report errors with fit
Simon Glass [Sun, 6 Mar 2022 03:19:09 +0000 (20:19 -0700)]
binman: Add a consistent way to report errors with fit

Add a new function to handling reporting errors within a particular
subnode of the FIT description. This can be used to make the format of
these errors consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Fix some pylint warnings in fit
Simon Glass [Sun, 6 Mar 2022 03:19:08 +0000 (20:19 -0700)]
binman: Fix some pylint warnings in fit

Some warnings have crept in, so fix those that are easy to fix.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Update fit to move node reading into the ReadNode() method
Simon Glass [Sun, 6 Mar 2022 03:19:07 +0000 (20:19 -0700)]
binman: Update fit to move node reading into the ReadNode() method

This should not be done in the constructor. Move it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Read the fit entries only once
Simon Glass [Sun, 6 Mar 2022 03:19:06 +0000 (20:19 -0700)]
binman: Read the fit entries only once

At present the entries are read twice, once by the entry_Section class
and once by the FIT implementation. This is harmless but can be confusing
when debugging. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Allow mkimage to use a non-zero fake-blob size
Simon Glass [Sun, 6 Mar 2022 03:19:05 +0000 (20:19 -0700)]
binman: Allow mkimage to use a non-zero fake-blob size

Unfortunately mkimage gets upset with zero-sized files. Update the
ObtainContents() method to support specifying the size, if a fake blob is
created.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Make fake blobs zero-sized by default
Simon Glass [Sun, 6 Mar 2022 03:19:04 +0000 (20:19 -0700)]
binman: Make fake blobs zero-sized by default

On x86 devices having even a small amount of data can cause an overlap
between regions. For example, bayleybay complains when the intel-vga
region overlaps with u-boot-ucode:

   ImagePos    Offset      Size  Name
   <none>    00000000  00800000  main-section
   <none>     ff800000  00000080  intel-descriptor
   <none>     ff800400  00000080  intel-me
   <none>     fff00000  00098f24  u-boot-with-ucode-ptr
   <none>     fff98f24  00001aa0  u-boot-dtb-with-ucode
   <none>     fff9a9d0  0002a000  u-boot-ucode
   <none>     fffb0000  00000080  intel-vga
   ...

It is safer to use an empty file in most cases. Add an option to set the
size for those uses that need it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Change how faked blobs are created
Simon Glass [Sun, 6 Mar 2022 03:19:03 +0000 (20:19 -0700)]
binman: Change how faked blobs are created

At present fake blobs are created but internally an empty blob is used.
Change it to use the contents of the faked file. Also return whether the
blob was faked, in case the caller needs to know that.

Add a TODO to put fake blobs in their own directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Rename tools parameter to btools
Simon Glass [Sun, 6 Mar 2022 03:19:02 +0000 (20:19 -0700)]
binman: Rename tools parameter to btools

This shadows the patman.tools library so rename it to avoid a pylint
warning.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Refactor fit to generate output at the end
Simon Glass [Sun, 6 Mar 2022 03:19:01 +0000 (20:19 -0700)]
binman: Refactor fit to generate output at the end

At present the fit implementation creates the output tree while
scanning the FIT description. Then it updates the tree later when the
data is known.

This works, but is a bit confusing, since it requires mixing the scanning
code with the generation code, with a fix-up step at the end.

It is actually possible to do this in two phases, one to scan everything
and the other to generate the FIT. Thus the FIT is generated in one pass,
when everything is known.

Update the code accordingly. The only functional change is that the 'data'
property for each node are now last instead of first, which is really a
more natural position. Update the affected test to deal with this.

One wrinkle is that the calculated properties (image-pos, size and offset)
are now added before the FIT is generated. so we must filter these out
when copying properties from the binman description to the FIT.

Most of the change here is splitting out some of the code from the
ReadEntries() implementation into _BuildInput(). So despite the large
diff, most of the code is the same. It is not feasible to split this patch
up, so far as I can tell.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Rename ExpandEntries to gen_entries
Simon Glass [Sun, 6 Mar 2022 03:19:00 +0000 (20:19 -0700)]
binman: Rename ExpandEntries to gen_entries

Leave the 'expand' term for use by entry types which have an expanded
version of themselves. Rename this method to indicate that it generates
subentries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Rename ExpandToLimit to extend_to_limit
Simon Glass [Sun, 6 Mar 2022 03:18:59 +0000 (20:18 -0700)]
binman: Rename ExpandToLimit to extend_to_limit

The word 'expand' is used for entries which generate subentries. It is
also used for entries that can have an '_expanded' version which is used
to break out its contents.

Rather than talking about expanding an entry's size, use the term
'extending'. It is slightly more precise and avoids the above conflicts.

This change renders the old 'expand-size' property invalid, so add an
error check for that.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Tweak collect_contents_to_file() and docs
Simon Glass [Sun, 6 Mar 2022 03:18:58 +0000 (20:18 -0700)]
binman: Tweak collect_contents_to_file() and docs

Update the return value of this function, fix the 'create' typo and
update the documentation for clarity.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agoelf: Rename load_segments() and module failure
Simon Glass [Sun, 6 Mar 2022 03:18:57 +0000 (20:18 -0700)]
elf: Rename load_segments() and module failure

Rename this function to make it clear that it only reads loadable
segments. Also update the error for missing module to better match the
message emitted by Python.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agodtoc: Tidy up implementation of AddStringList()
Simon Glass [Sun, 6 Mar 2022 03:18:56 +0000 (20:18 -0700)]
dtoc: Tidy up implementation of AddStringList()

Refactor this to avoid a loop. Also add a test for an empty string.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agospl: Correct Kconfig help for TPL_BINMAN_SYMBOLS
Simon Glass [Sun, 6 Mar 2022 03:18:55 +0000 (20:18 -0700)]
spl: Correct Kconfig help for TPL_BINMAN_SYMBOLS

Fix the help which should refer to TPL, not SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agomoveconfig: Use re.fullmatch() to avoid extra check
Simon Glass [Sun, 6 Mar 2022 03:18:54 +0000 (20:18 -0700)]
moveconfig: Use re.fullmatch() to avoid extra check

Simplify the code by using the available function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agomoveconfig: Remove remove_defconfig()
Simon Glass [Sun, 6 Mar 2022 03:18:53 +0000 (20:18 -0700)]
moveconfig: Remove remove_defconfig()

This is not necessary if simpler code is used. Use the split function and
drop the unnecessary []

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agodtoc: Make GetArgs() more flexible
Simon Glass [Sun, 6 Mar 2022 03:18:52 +0000 (20:18 -0700)]
dtoc: Make GetArgs() more flexible

At present it is not possible to have arguments which include spaces.
Update the function to only split the args if the property is a single
string. This is a bit inconsistent, but might still be useful.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agopatman: Define Commit.path in the constructor
Simon Glass [Thu, 3 Mar 2022 02:12:24 +0000 (19:12 -0700)]
patman: Define Commit.path in the constructor

It is good practice to init all variables in the constructor and pylint
sometimes checks this. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Tom Rini <trini@konsulko.com>
2 years agosandbox: test: Tidy up spl_test_load() calls
Simon Glass [Mon, 28 Feb 2022 22:13:49 +0000 (15:13 -0700)]
sandbox: test: Tidy up spl_test_load() calls

Use the new sandbox_find_next_phase() function, which does what is needed
here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Slow down the LCD sync rate
Simon Glass [Mon, 28 Feb 2022 22:13:48 +0000 (15:13 -0700)]
sandbox: Slow down the LCD sync rate

There is seldom a need to refresh at 100Hz and it uses a lot of CPU.
Reduce the rate to 10Hz which seems to be adequate.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Open host file for read-only access if needed
Simon Glass [Mon, 28 Feb 2022 22:13:47 +0000 (15:13 -0700)]
sandbox: Open host file for read-only access if needed

Some files cannot be written but read-only access is still useful for
tests. Add a fallback to read-only access when needed.

This is useful in CI when opening a large data file provided by docker,
where read/write access would result in copying the file, thus needing
a lot of extra disk space.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Add the handoff header for spl
Simon Glass [Mon, 28 Feb 2022 22:13:46 +0000 (15:13 -0700)]
sandbox: Add the handoff header for spl

This defines a function declared in handoff.h so add the header.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Show a message when writing out the ram buffer
Simon Glass [Mon, 28 Feb 2022 22:13:45 +0000 (15:13 -0700)]
sandbox: Show a message when writing out the ram buffer

If state is not being written, but RAM is, we should still show a message,
so it is clear that this is happening.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Include also subnodes in generator nodes
Jan Kiszka [Mon, 28 Feb 2022 16:06:20 +0000 (17:06 +0100)]
binman: Include also subnodes in generator nodes

This allows to prefill fdt and config nodes with hash and signature
subnodes. It's just important to place the child nodes last so that
hashes do not come before the data - would be disliked by mkimage.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotools: binman: main.py: add build-sandbox in sys.path
Philippe Reynes [Thu, 27 Jan 2022 14:03:13 +0000 (15:03 +0100)]
tools: binman: main.py: add build-sandbox in sys.path

Adds build-sandbox in sys.path to look for libfdt,
otherwise py_test can't use binman.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Complete elf test coverage
Simon Glass [Sat, 19 Mar 2022 01:19:49 +0000 (19:19 -0600)]
binman: Complete elf test coverage

Add coverage for the new elf functions needed for the event_dump.py
script.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMerge tag 'xilinx-for-v2022.07-rc1' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Wed, 16 Mar 2022 16:52:02 +0000 (12:52 -0400)]
Merge tag 'xilinx-for-v2022.07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2022.07-rc1

microblaze:
- Add support for reserved memory

xilinx:
- Update FRU code with MAC reading

zynqmp:
- Remove double AMS setting
- DT updates (mostly for SOMs)
- Add support for zcu106 rev 1.0

zynq:
- Update nand binding

nand:
- Aligned zynq_nand to upstream DT binding

net:
- Add support for ethernet-phy-id

mmc:
- Workaround CD in zynq_sdhci driver also for ZynqMP
- Add support for dynamic/run-time SD config for SOMs

gpio:
- Add driver for slg7xl45106

firmware:
- Add support for dynamic SD config

power-domain:
- Update zynqmp driver with the latest firmware

video:
- Add skeleton driver for DP and DPDMA

i2c:
- Fix i2c to work with QEMU

pinctrl:
- Add driver for zynqmp pinctrl driver

2 years agoarm64: zynqmp: Add pinctrl emmc description to SM-K26
Michal Simek [Mon, 14 Mar 2022 14:26:11 +0000 (15:26 +0100)]
arm64: zynqmp: Add pinctrl emmc description to SM-K26

Production SOM has emmc on it and make sense to describe pin description to
be able use EMMC if it is not configured via psu_init.
(Still some regs are not handled but this is one step in that direction)

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/3545a0f08d342de98efc82b78f5725eda091555a.1647267969.git.michal.simek@xilinx.com
2 years agoMerge branch '2022-03-15-add-erofs-support' into next
Tom Rini [Wed, 16 Mar 2022 12:09:12 +0000 (08:09 -0400)]
Merge branch '2022-03-15-add-erofs-support' into next

- Add erofs support

2 years agotest/py: Add tests for the erofs
Huang Jianan [Sat, 26 Feb 2022 07:05:51 +0000 (15:05 +0800)]
test/py: Add tests for the erofs

Add Python scripts to test 'ls' and 'load' commands, as well as
test related filesystem functions.

Signed-off-by: Huang Jianan <jnhuang95@gmail.com>
2 years agofs/erofs: add filesystem commands
Huang Jianan [Sat, 26 Feb 2022 07:05:50 +0000 (15:05 +0800)]
fs/erofs: add filesystem commands

Add 'ls' and 'load' commands.

Signed-off-by: Huang Jianan <jnhuang95@gmail.com>
2 years agofs/erofs: add lz4 decompression support
Huang Jianan [Sat, 26 Feb 2022 07:05:49 +0000 (15:05 +0800)]
fs/erofs: add lz4 decompression support

Support EROFS lz4 compressed files.

Signed-off-by: Huang Jianan <jnhuang95@gmail.com>
2 years agolib/lz4: update LZ4 decompressor module
Huang Jianan [Sat, 26 Feb 2022 07:05:48 +0000 (15:05 +0800)]
lib/lz4: update LZ4 decompressor module

Update the LZ4 compression module based on LZ4 v1.8.3 in order to
use the newest LZ4_decompress_safe_partial() which can now decode
exactly the nb of bytes requested.

Signed-off-by: Huang Jianan <jnhuang95@gmail.com>
2 years agofs/erofs: add erofs filesystem support
Huang Jianan [Sat, 26 Feb 2022 07:05:47 +0000 (15:05 +0800)]
fs/erofs: add erofs filesystem support

This patch mainly deals with uncompressed files.

Signed-off-by: Huang Jianan <jnhuang95@gmail.com>
2 years agoCI, Docker: Update to latest focal tag
Tom Rini [Tue, 15 Mar 2022 20:18:16 +0000 (16:18 -0400)]
CI, Docker: Update to latest focal tag

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMerge tag 'v2022.04-rc4' into next
Tom Rini [Mon, 14 Mar 2022 21:40:36 +0000 (17:40 -0400)]
Merge tag 'v2022.04-rc4' into next

Prepare v2022.04-rc4

2 years agoPrepare v2022.04-rc4
Tom Rini [Mon, 14 Mar 2022 20:39:08 +0000 (16:39 -0400)]
Prepare v2022.04-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMerge branch '2022-03-14-regression-fixes'
Tom Rini [Mon, 14 Mar 2022 18:04:55 +0000 (14:04 -0400)]
Merge branch '2022-03-14-regression-fixes'

- Regression fixes for RK3399 eMMC, j721e Sierra SerDes driver,
  vexpress64 autoboot and tbs2910 image size

2 years agoboard: tbs2910: Enable Link Time Optimizations in defconfig
Soeren Moch [Mon, 14 Mar 2022 08:26:25 +0000 (09:26 +0100)]
board: tbs2910: Enable Link Time Optimizations in defconfig

This saves about 12 kBytes image size and helps to stay within the
size limit.

Suggested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Soeren Moch <smoch@web.de>
2 years agovexpress64: fvp: Fix automatic boot
Andre Przywara [Fri, 4 Mar 2022 16:30:08 +0000 (16:30 +0000)]
vexpress64: fvp: Fix automatic boot

Commit 90f262a6951f ("vexpress64: Clean up BASE_FVP boot configuration")
cleaned up the usage of default address variables, but missed to update
the address for the kernel in the FVP's bootcmd definition.

Change ${kernel_addr} to read ${kernel_addr_r} to bring back the
automated boot for the fastmodel.
Also use "setenv" instead of the potentially ambiguous "set" on the way.

Fixes: 90f262a6951f ("vexpress64: Clean up BASE_FVP boot configuration")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoboard: ti: j721e: evm.c: Fix the probing of in Sierra SerDes0
Aswath Govindraju [Fri, 4 Mar 2022 12:15:26 +0000 (17:45 +0530)]
board: ti: j721e: evm.c: Fix the probing of in Sierra SerDes0

Initialization and power on operations of links have been moved under the
link device in the Sierra SerDes driver. Also, the UCLASS of
sierra_phy_provider has been changed to UCLASS_MISC.

Therefore, fix the probing of SerDes0 instance accordingly.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Georgi Vlaev <g-vlaev@ti.com>
2 years agophy: cadence: Sierra: Move the link operations from serdes phy to link device
Aswath Govindraju [Fri, 4 Mar 2022 12:15:25 +0000 (17:45 +0530)]
phy: cadence: Sierra: Move the link operations from serdes phy to link device

In commit 6f46c7441a9f ("phy: cadence: Sierra: Add a UCLASS_PHY device for
links"), a separate udevice of type UCLASS_PHY was created for each link.
Therefore, move the corresponding link operations under the link device.

Also, change the uclass of sierra phy to UCLASS_MISC as it is no longer the
phy device.

Fixes: 6f46c7441a9f ("phy: cadence: Sierra: Add a UCLASS_PHY device for links")
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Georgi Vlaev <g-vlaev@ti.com>
2 years agorockchip: sdhci: Fix RK3399 eMMC PHY power cycling
Alper Nebi Yasak [Fri, 28 Jan 2022 22:42:37 +0000 (01:42 +0300)]
rockchip: sdhci: Fix RK3399 eMMC PHY power cycling

The Rockchip RK3399 eMMC PHY has to be power-cycled while changing its
clock speed to some higher speeds. This is dependent on the desired
SDHCI clock speed, and it looks like the PHY should be powered off while
setting the SDHCI clock in these cases.

Commit ac804143cfd1 ("mmc: rockchip_sdhci: add phy and clock config for
rk3399") attempts to do this in the set_ios_post() hook by setting the
SDHCI clock once more while the PHY is turned off/on as necessary, as
the SDHCI framework does not provide a way to override how it sets its
clock. However, the commit breaks reinitializing the eMMC on a few
boards including chromebook_kevin and reportedly ROCKPro64.

This patch reworks the power cycling to utilize the SDHCI framework
slightly better (using the set_control_reg() hook to power off the PHY
and set_ios_post() hook to power it back on) which happens to fix the
issue, at least on a chromebook_kevin.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Mon, 14 Mar 2022 15:24:20 +0000 (11:24 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- kwboot: Misc minor improvement and fixes, e.g. mix of arguments (Pali)
- PCI: a37xx: Remap IO space to bus address 0x0 (Pali)

2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Mon, 14 Mar 2022 14:57:15 +0000 (10:57 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-x86

- Trivial fixes for x86

2 years agoarm64: zynqmp: Fix i2c addresses for zynqmp-p-a2197
Michal Simek [Mon, 7 Mar 2022 07:53:38 +0000 (08:53 +0100)]
arm64: zynqmp: Fix i2c addresses for zynqmp-p-a2197

After double checking some i2c addresses are not correct. It is visible
from i2c dump

ZynqMP> i2c bus
Bus 3: i2c@ff020000
   74: i2c-mux@74, offset len 1, flags 0
Bus 5: i2c@ff020000->i2c-mux@74->i2c@0
Bus 6: i2c@ff020000->i2c-mux@74->i2c@2
Bus 7: i2c@ff020000->i2c-mux@74->i2c@1
Bus 8: i2c@ff020000->i2c-mux@74->i2c@3
Bus 4: i2c@ff030000  (active 4)
   74: i2c-mux@74, offset len 1, flags 0
Bus 9: i2c@ff030000->i2c-mux@74->i2c@0
Bus 10: i2c@ff030000->i2c-mux@74->i2c@3
Bus 11: i2c@ff030000->i2c-mux@74->i2c@4
Bus 12: i2c@ff030000->i2c-mux@74->i2c@5  (active 12)
   51: generic_51, offset len 1, flags 0
   60: generic_60, offset len 1, flags 0
   74: generic_74, offset len 1, flags 0
Bus 13: i2c@ff030000->i2c-mux@74->i2c@6  (active 13)
   51: generic_51, offset len 1, flags 0
   5d: generic_5d, offset len 1, flags 0
   74: generic_74, offset len 1, flags 0
ZynqMP> i2c dev 4
Setting bus to 4
ZynqMP> i2c mw 74 0 18
ZynqMP> i2c probe
Valid chip addresses: 18 36 37 50 51 60 74
ZynqMP> i2c mw 74 0 20
ZynqMP> i2c probe
Valid chip addresses: 51 60 74

where it is clear that si570 (u5) is at 0x60 address and 8t49n240 (u39) is
also at address 0x60 based on log above.
i2c address 0x74 is i2c mux and 0x51 is eeprom.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/0a198e9d993411e41473d130d5a5c20b6dc83458.1646639616.git.michal.simek@xilinx.com
2 years agopinctrl: zynqmp: Add pinctrl driver
Ashok Reddy Soma [Wed, 23 Feb 2022 14:23:05 +0000 (15:23 +0100)]
pinctrl: zynqmp: Add pinctrl driver

Add pinctrl driver for Xilinx ZynqMP SOC. This driver is compatible with
linux device tree parameters for configuring pinmux and pinconf.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/2d7eefa83c8c0129f7243a25de56a289e948f6c6.1645626183.git.michal.simek@xilinx.com
2 years agopinctrl: Increase length of pinmux status buffer
Ashok Reddy Soma [Wed, 23 Feb 2022 14:23:04 +0000 (15:23 +0100)]
pinctrl: Increase length of pinmux status buffer

Xilinx ZynqMP SOC can set 6 parameters for its pins. pinmux status
command will print the status of these parameters for each pin. But
current print buffer length is only 40 characters long, increase it
to 80 to print all the parameters.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/3a6be84c8354f38754a9838670cc0319e84f29e8.1645626183.git.michal.simek@xilinx.com
2 years agocmd: test: pinmux: Do not check all empty spaces
Michal Simek [Mon, 7 Mar 2022 15:48:17 +0000 (16:48 +0100)]
cmd: test: pinmux: Do not check all empty spaces

There is really no value to check empty spaces. That's why use
ut_assert_nextlinen() instead of ut_assert_nextline().
This change ensures that PINMUX_SIZE can be increased without changing
tests.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Link: https://lore.kernel.org/r/03aecf4c67ec8d72bf2a90baf1516fc5bd300fe0.1646668094.git.michal.simek@xilinx.com
2 years agoMerge branch '2022-03-10-platform-updates' into next
Tom Rini [Mon, 14 Mar 2022 13:05:06 +0000 (09:05 -0400)]
Merge branch '2022-03-10-platform-updates' into next

- Assorted TI omap3, j7 platform updates
- Phytium Pomelo board

2 years agoarm: a37xx: Remap IO space to bus address 0x0
Pali Rohár [Mon, 7 Mar 2022 18:12:59 +0000 (19:12 +0100)]
arm: a37xx: Remap IO space to bus address 0x0

Remap PCI I/O space to the bus address 0x0 in the Armada 37xx device-tree
in order to support legacy I/O port based cards which have hardcoded I/O
ports in low address space.

Some legacy PCI I/O based cards do not support 32-bit I/O addressing.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Allow to mix positional arguments with option -b
Pali Rohár [Mon, 7 Mar 2022 18:03:09 +0000 (19:03 +0100)]
tools: kwboot: Allow to mix positional arguments with option -b

Commit 9e6d71d2b55f ("tools: kwboot: Allow to use -b without image path as
the last getopt() option") broke usage of kwboot with following arguments:

  kwboot -t -B 115200 /dev/ttyUSB0 -b u-boot-spl.kwb

Fix parsing of option -b with optional argument again.

Fixes: 9e6d71d2b55f ("tools: kwboot: Allow to use -b without image path as the last getopt() option")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reported-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Tony Dinh <mibodhi at gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Check if baudrate value is supported before sending image
Pali Rohár [Mon, 7 Mar 2022 18:03:08 +0000 (19:03 +0100)]
tools: kwboot: Check if baudrate value is supported before sending image

Call kwboot_open_tty() which baudrate value which was specified at the
command line by option -B. This function returns error if baudrate is not
supported by selected tty device.

Initial baudrate for image transfer is always 115200, so call
kwboot_tty_change_baudrate() with value 115200 immediately after
kwboot_open_tty() if baudrate specified by option -B is different than
115200.

This makes kwboot fail immediately, informing that baudrate is unsupported,
instead of failing only after the first part of image is already sent.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Allow to specify custom baudrate only in supported operations
Pali Rohár [Mon, 7 Mar 2022 18:03:07 +0000 (19:03 +0100)]
tools: kwboot: Allow to specify custom baudrate only in supported operations

Custom baudrate different than 115200 may be specified only when kwboot is
not going to send boot/debug message pattern or when it is going to send
boot message pattern with image file (in which case baudrate change happens
after sending kwbimage header). BootROM detects boot/debug message pattern
only at baudrate 115200.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agox86: Correct the coreboot header file in MAINTAINERS
Simon Glass [Sun, 13 Mar 2022 06:03:28 +0000 (23:03 -0700)]
x86: Correct the coreboot header file in MAINTAINERS

This board has its own config header file. Correct it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agox86: Add an enum name for the GNVS firmware type
Simon Glass [Sun, 13 Mar 2022 06:03:27 +0000 (23:03 -0700)]
x86: Add an enum name for the GNVS firmware type

This enum is currently anonymous. Add a name so it can be used in the
code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agoMerge tag 'efi-2022-04-rc3-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sun, 13 Mar 2022 12:18:17 +0000 (08:18 -0400)]
Merge tag 'efi-2022-04-rc3-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-04-rc3-2

Documentation:
* Fix description for SiFive Unmatched
* Add libgnutls28-dev to build dependencies

UEFI
* Avoid possibly invalid GUID pointers for protocol interfaces

Other
* Serial console support for cls command

2 years agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-spi
Tom Rini [Sat, 12 Mar 2022 12:20:29 +0000 (07:20 -0500)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-spi

- sunXi SPI fixups (Andre)
- bcm iproc qspi (Rayagonda)

2 years agoefi_loader: copy GUID in InstallProtocolInterface()
Heinrich Schuchardt [Wed, 9 Mar 2022 18:56:23 +0000 (19:56 +0100)]
efi_loader: copy GUID in InstallProtocolInterface()

InstallProtocolInterface() is called with a pointer to the protocol GUID.
There is not guarantee that the memory used by the caller for the protocol
GUID stays allocated. To play it safe the GUID should be copied to U-Boot's
internal structures.

Reported-by: Joerie de Gram <j.de.gram@gmail.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodoc: add libgnutls28-dev to build dependencies
Heinrich Schuchardt [Sat, 12 Mar 2022 10:56:23 +0000 (11:56 +0100)]
doc: add libgnutls28-dev to build dependencies

mkeficapsule requires package libgnutls28-dev for building

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodoc: path to u-boot-spl.bin on SiFive Unmatched board
Heinrich Schuchardt [Thu, 10 Mar 2022 10:32:49 +0000 (11:32 +0100)]
doc: path to u-boot-spl.bin on SiFive Unmatched board

u-boot-spl.bin is built in spl/.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agocmd: add serial console support for the cls command
Heinrich Schuchardt [Fri, 11 Feb 2022 17:11:05 +0000 (18:11 +0100)]
cmd: add serial console support for the cls command

Currently the cls command does not support the serial console

The screen can be cleared in the video uclass, the colored frame buffer
console, and the serial console by sending the same escape sequence.
This reduces the cls command to a single printf() statement on most
boards.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agomtd: spi-nor-ids: Enable quad read for Gigadevice gd25lq128
Niklas Cassel [Thu, 3 Mar 2022 18:26:39 +0000 (18:26 +0000)]
mtd: spi-nor-ids: Enable quad read for Gigadevice gd25lq128

The Gigadevice gd25lq128 serial flash exists in different versions,
all which identify themselves using the same JEDEC id.

gd25lq128c:
https://www.gigadevice.com/datasheet/gd25lq128

gd25lq128d:
https://www.gigadevice.com/datasheet/gd25lq128d

However, all versions support quad read, so enable it.
Tested and verified on the Sipeed MAix BiT board.

Fixes: 30b9a28a3f2d ("mtd: spi-nor-ids: Add Gigadevice gd25lq128 ID")
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agoarm: add initial support for the Phytium Pomelo Board
weichangzheng [Wed, 2 Mar 2022 07:09:05 +0000 (15:09 +0800)]
arm: add initial support for the Phytium Pomelo Board

This adds platform code and the device tree for the Phytium Pomelo Board.
The initial support comprises the UART and the PCIE.

Signed-off-by: weichangzheng <nicholas_zheng@outlook.com>
2 years agoARM: mach-omap2: omap3: Make clock functions static
Adam Ford [Sat, 5 Mar 2022 14:25:23 +0000 (08:25 -0600)]
ARM: mach-omap2: omap3: Make clock functions static

get_osc_clk_speed and get_sys_clkin_sel are only used in
one file.  Make them static.

Tested on OMAP3530, DM3730, AM3517.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agoARM: am3517_evm: Remove hard-coded pin muxing
Adam Ford [Sat, 26 Feb 2022 21:17:24 +0000 (15:17 -0600)]
ARM: am3517_evm: Remove hard-coded pin muxing

With updated device trees now supporting pinmuxing for USB,
ethernet, MMC, and other peripherals necessary to start MLO
and U-Boot, the hard-coded pinmux options can be removed since
they are now handed by DM and only muxed when the respective
peripheral needs it.

Signed-off-by: Adam Ford <aford173@gmail.com>
Tested-by: Derald D. Woods <woods.technical@gmail.com>
2 years agoARM: dts: am3517-evm: Sync DTS with Linux 5.17-rc5
Adam Ford [Sat, 26 Feb 2022 21:17:23 +0000 (15:17 -0600)]
ARM: dts: am3517-evm: Sync DTS with Linux 5.17-rc5

Sync the am3517-evm device tree files with those from Linux
5.17-rc5 with some additional fixes for pinmuxing Ethernet and
moving the pinmux references to the respective peripherals.

Signed-off-by: Adam Ford <aford173@gmail.com>
Tested-by: Derald D. Woods <woods.technical@gmail.com>
2 years agoARM: dts: logicpd-torpedo: Resyc DTS files with Linux 5.17-rc5
Adam Ford [Sat, 26 Feb 2022 17:01:21 +0000 (11:01 -0600)]
ARM: dts: logicpd-torpedo: Resyc DTS files with Linux 5.17-rc5

Resyc DTS files with Linux 5.17-rc5.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agoARM: omap3_logic: Remove hard-coded USB muxing
Adam Ford [Sat, 26 Feb 2022 16:49:48 +0000 (10:49 -0600)]
ARM: omap3_logic: Remove hard-coded USB muxing

With recent fixes to USB pinmuxing in the device trees, there
is no need to hard-code the pinmuxing in this table.  It is
all handled in DM now.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agoARM: dts: logicpd-som-lv: Resync DTS files with Linux 5.17-rc5
Adam Ford [Sat, 26 Feb 2022 16:49:47 +0000 (10:49 -0600)]
ARM: dts: logicpd-som-lv: Resync DTS files with Linux 5.17-rc5

Resync the DTS files for the Logic PD SOM-LV with Linux 5.17-rc5
with some additional pending changes to address issues with
wrong pin-muxing on the OMAP35.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agoARM: am3517-evm: Remove more non-DM legacy ethernet reset code
Adam Ford [Sat, 26 Feb 2022 16:13:09 +0000 (10:13 -0600)]
ARM: am3517-evm: Remove more non-DM legacy ethernet reset code

The ethernet controller is DM compliant, and the device tree
defines it.  There is no need to manually handle pulling
the ethernet out of reset.

Signed-off-by: Adam Ford <aford173@gmail.com>
Tested-by: Derald D. Woods <woods.technical@gmail.com>
2 years agoconfigs: j721e_hs_evm_a72_defconfig: Add command for initializing QSGMII PHY
Aswath Govindraju [Tue, 22 Feb 2022 05:19:05 +0000 (10:49 +0530)]
configs: j721e_hs_evm_a72_defconfig: Add command for initializing QSGMII PHY

QSGMII PHY present on the j721e common processor board requires
to be initialized before the core boots up. Therefore, run the
corresponding command during boot to do the same.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
2 years agoconfigs: j721e_evm_a72_defconfig: Fix the bootcmd
Aswath Govindraju [Tue, 22 Feb 2022 05:19:04 +0000 (10:49 +0530)]
configs: j721e_evm_a72_defconfig: Fix the bootcmd

Add the command "boot_rprocs" that is required for booting remote
processors in U-Boot.

Fixes: 5980925e2a5a ("include: configs: j721e_evm: Add support to boot ethfw core in j721e")
Reported-by: Jesse Villarreal <jesse.villarreal@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
2 years agoinclude: configs: j721e_evm.h: Fix the env variable corresponding to QSGMII PHY init
Aswath Govindraju [Tue, 22 Feb 2022 05:19:03 +0000 (10:49 +0530)]
include: configs: j721e_evm.h: Fix the env variable corresponding to QSGMII PHY init

QSGMII PHY initialization should only be done for J721E EVMs and not for
J721E-SK boards. Therefore, fix the environment variables accordingly.

Also, by default remote processors should not be booted in U-Boot but
rather be left to the users to enable this by setting dorprocboot.
Therefore, remove dorprocboot that is being set by default.

Fixes: 5980925e2a5a ("include: configs: j721e_evm: Add support to boot ethfw core in j721e")
Reported-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
2 years agoram: aspeed: Rework kconfig options
Joel Stanley [Wed, 16 Feb 2022 07:53:22 +0000 (18:23 +1030)]
ram: aspeed: Rework kconfig options

Ensure the ASPEED related options are grouped together under the RAM
option when enabling support.

This also makes some minor grammar corrections and renames options so
they present cleanly in menuconfig.

There should be no functional change to the configuration or binary.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Dylan Hung <dylan_hung@aspeedtech.com>
2 years agoARM: omap3_beagle: Enable DM_PMIC and DM_REGULATOR
Romain Naour [Fri, 25 Feb 2022 11:18:34 +0000 (12:18 +0100)]
ARM: omap3_beagle: Enable DM_PMIC and DM_REGULATOR

Enabling DM_PMIC, DM_REGULATOR_FIXED, and DM_REGULATOR_GPIO
gives us the ability to better monitor voltages and enable
hardware through the device tree. The TL4030 (TPS65950) is
not yet migrated to DM, so this patch only enables the fixed
and GPIO controlled regulators.

Based on commit [1][2].

[1] a40d3cc845756e1e38af5ac31986539417e64abb
[2] 2448e42d73fb91e4b56bb41b2677e18ab99a6c83

Signed-off-by: Romain Naour <romain.naour@gmail.com>
2 years agoARM: omap3_beagle: Enable Pinctrl
Romain Naour [Fri, 25 Feb 2022 11:18:33 +0000 (12:18 +0100)]
ARM: omap3_beagle: Enable Pinctrl

The simple pinctrl driver currently available works with the omap3.
Enabling this will use the device tree to automatically set the
pin-muxing for various drivers.

Based on commit: 57dbf754e37d3347cad441f3869bf72c0d726a71

Signed-off-by: Romain Naour <romain.naour@gmail.com>
2 years agoARM: omap3_beagle: Power on MMC when setting up PMIC
Romain Naour [Fri, 25 Feb 2022 11:18:32 +0000 (12:18 +0100)]
ARM: omap3_beagle: Power on MMC when setting up PMIC

The PMIC enables power to the MMC card by default, but depending
on the state it was left when restarted, it's possible the MMC
may be powered down.

This patch patch explicitly tells the twl4030 to power the MMC.

Based on commits [1][2].

[1] 64fd2d26140aa72b43428d079974f7c0e7f88353
[2] 27b653449178e80b333e7bc5a81eed3bd1bd6861

Signed-off-by: Romain Naour <romain.naour@gmail.com>
2 years agoARM: omap3_beagle: Remove non-DM initialization
Romain Naour [Fri, 25 Feb 2022 11:18:31 +0000 (12:18 +0100)]
ARM: omap3_beagle: Remove non-DM initialization

With DM_MMC working for both SPL and U-Boot, this patch removes
the legacy style of initializing the MMC driver.

Based on omap3_logic: 42140dd0962bc134c0aad27524d0f4cc3955f255.

Signed-off-by: Romain Naour <romain.naour@gmail.com>
2 years agoMerge branch '2022-03-09-events-subsystem' into next
Tom Rini [Thu, 10 Mar 2022 13:28:40 +0000 (08:28 -0500)]
Merge branch '2022-03-09-events-subsystem' into next

To quote the author:
It is a common need in U-Boot to have one subsystem notify another
when something happens. An example is reading a partition table when a
new block device is set up.

It is also common to add weak functions and 'hook' functions to modify
how U-Boot works. See for example ft_board_setup() and the like.

U-Boot would benefit from a generic mechanism to handle these cases,
with the ability to hook into various 'events' in a
subsystem-independent and transparent way.

This series provides a way to create and dispatch events, with a way of
registering a 'spy' which watches for events of different types. This
allows 'hook' functions to be created in a generic way.

It also includes a script to list the hooks in an image, which is a bit
easier to debug than weak functions, as well as an 'event' command to
do the same from within U-Boot.

These 'static' events can be used to replace hooks like misc_init_f(),
for example. Also included is basic support for 'dynamic' events, where
a spy can be registered at runtime. The need for this is still being
figured out.

2 years agoevent: Add documentation
Simon Glass [Fri, 4 Mar 2022 15:43:08 +0000 (08:43 -0700)]
event: Add documentation

Add documentation for events, including the event command.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoevent: Add a script to decode the event-spy list
Simon Glass [Fri, 4 Mar 2022 15:43:07 +0000 (08:43 -0700)]
event: Add a script to decode the event-spy list

For debugging and dicoverability it is useful to be able to see a list of
each event spy in a U-Boot ELF file. Add a script which shows this, along
with the event type and the source location. This makes events a little
easier to use than weak functions, for example.

Add a basic sandbox test as well. We could provide a test for other
boards, but for now, few use events.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoevent: Add a command
Simon Glass [Fri, 4 Mar 2022 15:43:06 +0000 (08:43 -0700)]
event: Add a command

Add a command to show the available events.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoevent: Convert arch_cpu_init_dm() to use events
Simon Glass [Fri, 4 Mar 2022 15:43:05 +0000 (08:43 -0700)]
event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoevent: Convert misc_init_f() to use events
Simon Glass [Fri, 4 Mar 2022 15:43:04 +0000 (08:43 -0700)]
event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoevent: Add events for device probe/remove
Simon Glass [Fri, 4 Mar 2022 15:43:03 +0000 (08:43 -0700)]
event: Add events for device probe/remove

Generate events when devices are probed or removed, allowing hooks
to be added for these situations.

This is controlled by the DM_EVENT config option.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoevent: Set up the event system on start-up
Simon Glass [Fri, 4 Mar 2022 15:43:02 +0000 (08:43 -0700)]
event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoevent: Add a simple test
Simon Glass [Fri, 4 Mar 2022 15:43:01 +0000 (08:43 -0700)]
event: Add a simple test

Add a test for event registration and activation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoevent: Add basic support for events
Simon Glass [Fri, 4 Mar 2022 15:43:00 +0000 (08:43 -0700)]
event: Add basic support for events

Add a way to create and dispatch events without needing to allocate
memory. Also add a way to 'spy' on events, thus allowing 'hooks' to be
created.

Use a linker list for static events, which we can use to replace functions
like arch_cpu_init_f(). Allow an EVENT_DEBUG option which makes it
easier to see what is going on at runtime, but uses more code space.

Dynamic events allow the creation of a spy at runtime. This is not always
necessary, but can be enabled with EVENT_DYNAMIC if needed.

A 'test' event is the only option for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Expand elf support a little
Simon Glass [Fri, 4 Mar 2022 15:42:59 +0000 (08:42 -0700)]
binman: Expand elf support a little

Allow finding a symbol by its address. Also export the function to get
the file offset of a particular address, so it can be used by a script to
be added.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: start: Sort the header files
Simon Glass [Fri, 4 Mar 2022 15:42:58 +0000 (08:42 -0700)]
sandbox: start: Sort the header files

These header files don't follow the correct order. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosunxi: boards: Enable SPI flash support in U-Boot proper
Andre Przywara [Tue, 11 Jan 2022 12:46:06 +0000 (12:46 +0000)]
sunxi: boards: Enable SPI flash support in U-Boot proper

Some sunxi boards ship with SPI flash, which allows booting through the
BootROM. We cover this functionality by a separate SPL "mini" driver.
Separately we have a proper DM_SPI driver for U-Boot proper, which
provides access to the SPI flash through the "sf" command. That allows
to update the firmware on the SPI flash, also to store the environment
there.

However only very few boards actually enable support for U-Boot proper,
even though that would work and the SPL part is configured.

Use the cleaned up configuration scheme to enable SPI flash on those
boards which mention a SPI flash in their .dts, or which use the SPL SPI
support.

Out of the box this would enable storing the environment on the SPI
flash, and allows people to read or write the flash from U-Boot, for
instance to update the SPI flash when booted via an SD card.

For this to actually work there must be a "spi0" alias in the DT, which
most boards are missing. But this should be addressed separately.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agoenv: sunxi: enable ENV_IS_IN_SPI_FLASH
Andre Przywara [Tue, 11 Jan 2022 12:46:05 +0000 (12:46 +0000)]
env: sunxi: enable ENV_IS_IN_SPI_FLASH

Now that sunxi uses CONFIG_SPI more sanely, and can also now properly
load the environment from SPI flash, let's enable the symbol that
actually considers the SPI flash when accessing the environment.

As this symbol depends on CONFIG_SPI, which we now only enable if the
board has a SPI flash, we can make if "default y" for all Allwinner
boards.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agosunxi: use boot source for determining environment location
Andre Przywara [Tue, 11 Jan 2022 12:46:04 +0000 (12:46 +0000)]
sunxi: use boot source for determining environment location

Currently we only support to load the environment from raw MMC or FAT
locations on Allwinner boards. With the advent of SPI flash we probably
also want to support using the environment there, so we need to become
a bit more flexible.

Change the environment priority function to take the boot source into
account. When booted from eMMC or SD card, we use FAT or MMC, if
configured, as before.
If we are booted from SPI flash, we try to use the environment from
there, if possible. The same is true for NAND flash booting, although
this is somewhat theoretical right now (as untested).

This way we can use the same image for SD and SPI flash booting, which
allows us to simply copy a booted image from SD card to the SPI flash,
for instance.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agoenv: sunxi: Define location in SPI flash
Andre Przywara [Tue, 11 Jan 2022 12:46:03 +0000 (12:46 +0000)]
env: sunxi: Define location in SPI flash

To allow loading and storing the environment from SPI flash, adjust the
raw offset variables for Allwinner boards to make sense there.

U-Boot (including SPL and other blobs) is loaded from the beginning of
SPI flash, so move the environment location as far back as possible, to
not create unnecessary limits. As those offsets are shared with (now
mostly unused) raw MMC environment, we should respect the common one
megabyte limit, which also makes sense on SPI flash.

So limit the environment for those raw locations to 64KB, and place it
just below 1MB (@960KB).

Those values are currently unused, unless someone forcibly enables the
raw MMC environment. In this case it would break as of now, as the
current offset of 544KB is far too low for the current (arm64) U-Boot
proper.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agosunxi: Kconfig: Fix up SPI configuration
Andre Przywara [Tue, 11 Jan 2022 12:46:02 +0000 (12:46 +0000)]
sunxi: Kconfig: Fix up SPI configuration

Commit 7945caf22c44 ("arm: sunxi: Enable SPI/SPI-FLASH support for A64")
selected CONFIG_SPI by default on all Allwinner A64 boards, even though
only 4 out of the 14 A64 boards have a SPI flash chip. All other SoCs
had to manually select DM_SPI and friends, even though they are a
platform property (the sunxi SPI driver is DM_SPI only).

Clean this up to allow easy selection of SPI flash support in U-Boot
proper, by selecting DM_SPI and DM_SPI_FLASH *if* CONFIG_SPI is
selected, for *all* Allwinner SoCs. This simplifies the defconfig for
two Libretech boards already.

Also remove the forced CONFIG_SPI from the A64 Kconfig, instead let the
four boards which allow SPI booting select this explicitly.

Any board wishing to support SPI flash in U-Boot proper now just defines
CONFIG_SPI and CONFIG_SPI_FLASH_<vendor> in its defconfig, Kconfig takes
care of the rest.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agonet: phy: Add support for ethernet-phy-id with gpio reset
Michal Simek [Wed, 23 Feb 2022 14:45:42 +0000 (15:45 +0100)]
net: phy: Add support for ethernet-phy-id with gpio reset

Ethernet phy like dp83867 is using strapping resistors to setup PHY
address. On Xilinx boards strapping is setup on wires which are connected
to SOC where internal pull ups/downs influnce phy address. That's why there
is a need to setup pins properly (via pinctrl driver for example) and then
perform phy reset. I can be workarounded by reset gpio done for mdio bus
but this is not working properly when multiply phys sitting on the same
bus. That's why it needs to be done via ethernet-phy-id driver where dt
binding has gpio reset per phy.

DT binding is available here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/net/ethernet-phy.yaml

The driver is are reading the vendor and device id from valid phy node
using ofnode_read_eth_phy_id() and creating a phy device.
Kconfig PHY_ETHERNET_ID symbol is used because not every platform has gpio
support.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Link: https://lore.kernel.org/r/70ab7d71c812b2c972d48c129e416c921af0d7f5.1645627539.git.michal.simek@xilinx.com
2 years agonet: phy: Remove static return type for phy_device_create()
Michal Simek [Wed, 23 Feb 2022 14:45:41 +0000 (15:45 +0100)]
net: phy: Remove static return type for phy_device_create()

Remove static return type for phy_device_create() to avoid file scope for
this function. Also add required prototype in phy.h.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Link: https://lore.kernel.org/r/1517f4053403fbd53e899d500e7485d068a4f0b6.1645627539.git.michal.simek@xilinx.com