Commit graph

82288 commits

Author SHA1 Message Date
Pali Rohár
8092d1dd41 arm: mvebu: Add support for specifying VHV_Enable GPIO
VHV_Enable GPIO is required to enable during eFuse programming on Armada
SoCs not from 3700 family. Add support for enabling and disabling VHV pin
via GPIO during eFuse programming, when specified.

All details are in Marvell AN-389: ARMADA VHV Power document
(Doc. No. MV-S302545-00 Rev. C, August 2, 2016).

Note that due to HW Errata 3.6 eFuse erroneous burning (Ref #: HWE-3718342)
VHV power must be disabled while core voltage is off to prevent erroneous
eFuse programming.

This is specified in Marvell ARMADA 380/385/388 Functional Errata,
Guidelines, and Restrictions document
(Doc. No. MV-S501377-00 Rev. D, December 1, 2016).

Signed-off-by: Pali Rohár <pali@kernel.org>
2022-10-06 10:15:35 +02:00
Pali Rohár
3b44b3fdf2 arm: mvebu: Add support for programming LD0 and LD1 eFuse
This patch implements LD eFuse programming support. Armada 385 contains two
LD eFuse lines, each is 256 bit long with one additional lock bit. LD 0
line is mapped to U-Boot fuse bank 64 and LD 1 line to fuse bank 65. U-Boot
32-bit fuse words 0-8 are mapped to LD eFuse line bits 0-255. U-Boot fuse
word 9 is mapped to LD eFuse line lock bit.

So to program LD 1 General Purpose Data line, use U-Boot fuse command:

    => fuse prog -y 65 0 0x76543210
    => fuse prog -y 65 1 0xfedcba98
    => fuse prog -y 65 2 0x76543210
    => fuse prog -y 65 3 0xfedcba98
    => fuse prog -y 65 4 0x76543210
    => fuse prog -y 65 5 0xfedcba98
    => fuse prog -y 65 6 0x76543210
    => fuse prog -y 65 7 0xfedcba98
    => fuse prog -y 65 8 0x1

Signed-off-by: Pali Rohár <pali@kernel.org>
2022-10-06 10:15:35 +02:00
Stefan Roese
37bb396669 timer: orion-timer: Only init timer once
Move the code making sure that the timer is initialized only once into
orion_timer_init(), which is called from timer_early_init() and from
orion_timer_probe(). This way the timer is not re-initialized.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Michael Walle <michael@walle.cc>
Cc: Pali Rohár <pali@kernel.org>
2022-10-06 10:15:35 +02:00
Stefan Roese
2de00f342f arm: mvebu: Remove timer.c
Since the move to CONFIG_TIMER with support for CONFIG_TIMER_EARLY, this
platform specific init_timer() function is not needed any more. Let's
remove it completely.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Michael Walle <michael@walle.cc>
Cc: Pali Rohár <pali@kernel.org>
2022-10-06 10:15:35 +02:00
Pali Rohár
cbd0043e20 tools: kwbimage: Verify maximal kwbimage header size
BootROM loads kwbimage header to L2-SRAM and BootROM reserve only 192 kB for it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2022-10-06 10:15:35 +02:00
Chris Packham
1ba0018218 mtd: nand: pxa3xx: simplify ECC hardware parameters
Replace the if/else chain in pxa_ecc_init() with a lookup table. This
makes the code more concise and hopefully easier to follow. Remove the
unused ecc_layout tables and replace it with a single dummy one (the
pxa3xx driver has never used this but the mtd subsystem expects it to be
provided).

Tested on an Allied Telesis x530 switch with Micron MT29F2G08ABAEAWP
NAND Flash.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2022-10-06 10:15:34 +02:00
Holger Brunck
88383fd864 board/km: remove kirkwood boards
These boards are out of maintenance and can be removed.

Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2022-10-06 10:13:38 +02:00
Ashok Reddy Soma
5ccf97aeb0 arm64: dts: Remove unused property device_id
Device tree property "xlnx,device_id" is not used anymore, remove it.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20220930092548.18453-4-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2022-10-05 11:36:54 +02:00
Ashok Reddy Soma
aba0e6510f mmc: zynq_sdhci: Read power-domains id from DT and use
Firmware calls need node_id which is basically "power-domains" id.
At present static values are used based on the "device_id" property of
dt.
Instead of this, read "power-domains" id from dt and use it. Add a
element called node_id in priv structure and read it from dt. Replace
static node_id with this priv->node_id across the driver.

Since "device_id" is not used anywhere else simply remove it.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20220930092548.18453-3-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2022-10-05 11:36:54 +02:00
Ashok Reddy Soma
cbdee4d5e8 mmc: zynq_sdhci: Change node_id prototype to u32
In Versal platform power domain node_id is bigger than u8, hence
change prototype to u32 to accommodate. Change u8 to u32 in the function
prototypes that use node_id and remove casting to u32 from
xilinx_pm_request() call parameters.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20220930092548.18453-2-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2022-10-05 11:36:54 +02:00
Venkatesh Yadav Abbarapu
9a082d2548 net: Fix static checker warnings
Here are the smatch warning messages:

drivers/net/xilinx_axi_emac.c:324 axiemac_phy_init()
error: 'phydev' dereferencing possible ERR_PTR()

drivers/net/zynq_gem.c:340 zynq_phy_init()
error: 'priv->phydev' dereferencing possible ERR_PTR()

Fix by adding error checking before dereferencing the pointer.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20220929045605.23964-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2022-10-05 11:36:54 +02:00
Venkatesh Yadav Abbarapu
e1a193b951 xilinx: common: Fix static checker warnings
Avoid signed extension for uuid and byte.

Eliminate the below smatch warnings:
board/xilinx/common/board.c:128 xilinx_eeprom_legacy_cleanup()
warn: impossible condition '(byte == 255) => ((-128)-127 == 255)'

board/xilinx/common/board.c:466 board_late_init_xilinx()
warn: argument 3 to %02x specifier has type 'char'
board/xilinx/common/board.c:466 board_late_init_xilinx()
warn: argument 4 to %02x specifier has type 'char'

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20220926065242.4355-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2022-10-05 11:36:54 +02:00
Samuel Obuch
f4cf004d27 net: emaclite: fix handling for IP packets with specific lengths
The maximum length is capped similarly to the emaclite_send function.
Avoid integer underflow for values of ip->ip_len < 30, the minimum
length of an IP packet is 21 bytes.

Signed-off-by: Samuel Obuch <samuel.obuch@codasip.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Link: https://lore.kernel.org/r/20220927112103.155689-3-samuel.obuch@codasip.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2022-10-05 11:36:54 +02:00
Samuel Obuch
3d1700296c net: emaclite: fix xemaclite_alignedread/write functions
Use __raw_read* and __raw_write* functions to ensure read/write
is passed to the memory-mapped regions, as non-volatile accesses
may get optimised out.

Signed-off-by: Samuel Obuch <samuel.obuch@codasip.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Link: https://lore.kernel.org/r/20220927112103.155689-2-samuel.obuch@codasip.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2022-10-05 11:36:54 +02:00
Samuel Obuch
078d8eb5bb net: emaclite: enable for more architectures
Function ioremap_nocache seems to be defined only for MIPS and Microblaze
architectures. Therefore, the function call in the emaclite driver causes
this driver to be unusable with other architectures, for example RISC-V.

Use ioremap function instead of ioremap_nocache, and include linux/io.h
instead of asm/io.h, so that ioremap function is automatically created,
if not defined by the architecture. We can switch to the ioremap function,
as Microblaze's ioremap_nocache is just empty and in MIPS implementations
of ioremap_nocache and ioremap are the same.

Signed-off-by: Samuel Obuch <samuel.obuch@codasip.com>
Link: https://lore.kernel.org/r/20220927112103.155689-1-samuel.obuch@codasip.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2022-10-05 11:36:54 +02:00
Ashok Reddy Soma
ef2896a4d2 firmware: zynqmp: Change loadable config object from APU_0 to OCM_BANK_0
To check dynamic loading of config object, currently APU_0 is used.
Suggestion from pmwfw team is to load OCM_BANK_0 and check for
XST_PM_NO_ACCESS error only to skip future config objects. Other errors
should not be considered for skipping. Change from NODE_APU_0 to
NODE_OCM_BANK_0 and check for XST_PM_NO_ACCESS to skip future config
objects.

Add ":  " to printf statement when there is no permission to load config
object, to align with PMUFW version print.

Update kernel doc for return value for zynqmp_pmufw_load_config_object().

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/2784018844ba4afced0e3edff76bdbfe532f517d.1664523444.git.michal.simek@amd.com
2022-10-05 11:36:54 +02:00
Michal Simek
52a504c5c0 ARM: zynq: Define rtc alias on zc702/zc706
Define rtc alias on zc702/zc706 boards.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/47df614929d49af9f562c103defb92900de9d3e1.1664279424.git.michal.simek@amd.com
2022-10-05 08:43:54 +02:00
Michal Simek
ce92321559 ARM: zynq: Point via nvmem0 alias to eeprom on zc702/zc706
EEPROM stores identification information about board like a board name,
revision, serial number and ethernet MAC address. U-Boot is capable to read
nvmemX aliases and read/display provided information when nvmem alias link
is described.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c63bba87d0400b6bd0f5651fac21d525f12288f5.1664265311.git.michal.simek@amd.com
2022-10-05 08:43:54 +02:00
Michal Simek
2fe55d1827 xilinx: zynq: Enable early eeprom decoding
Xilinx Zynq evaluation boards have factory program content in eeprom.
Enable reading and decoding eeprom content to get information about board
name, revision and especially getting ethernet mac address.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/db334bd3c0a377074a43b7ae479fade98efb545f.1664265344.git.michal.simek@amd.com
2022-10-05 08:43:53 +02:00
Alexander Dahl
1323d08bdf dm: fpga: Introduce new uclass
For future DM based FPGA drivers and for now to have a meaningful
logging class for old FPGA drivers.

Suggested-by: Michal Simek <michal.simek@amd.com>
Suggested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Dahl <post@lespocky.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/20220930120430.42307-2-post@lespocky.de
Signed-off-by: Michal Simek <michal.simek@amd.com>
2022-10-05 08:43:53 +02:00
Tom Rini
2d45913534 Merge branch 'next' 2022-10-03 15:39:46 -04:00
Tom Rini
4debc57a3d Prepare v2022.10
Signed-off-by: Tom Rini <trini@konsulko.com>
2022-10-03 15:25:32 -04:00
Fabio Estevam
0bd7811ca9 imx8mn-ddr4-evk-u-boot: Fix broken boot
When the imx8mn.dtsi file was pulled in from Linux, the UARTs
were moved into an spba sub-node which wasn't being included
in the SPL device tree.  This meant the references to the UART
weren't being handled properly and when booting the system would
constantly reboot.  Fix this by adding the spba node to the spl
device tree to restore normal booting.

Based on the patch from Adam Ford for the imx8mn-beacon-kit-u-boot
board.

Fixes: 4e5114daf9 ("imx8mn: synchronise device tree with linux")
Signed-off-by: Fabio Estevam <festevam@denx.de>
2022-10-03 13:38:42 -04:00
Fabio Estevam
a2bf0373b8 imx8mn-venice-u-boot: Fix broken boot
When the imx8mn.dtsi file was pulled in from Linux, the UARTs
were moved into an spba sub-node which wasn't being included
in the SPL device tree.  This meant the references to the UART
weren't being handled properly and when booting the system would
constantly reboot.  Fix this by adding the spba node to the spl
device tree to restore normal booting.

Based on the patch from Adam Ford for the imx8mn-beacon-kit-u-boot
board.

Fixes: 4e5114daf9 ("imx8mn: synchronise device tree with linux")
Signed-off-by: Fabio Estevam <festevam@denx.de>
2022-10-03 13:38:22 -04:00
Tom Rini
6ee6e15975 Merge branch '2022-09-29-dm-core-support-multiple-device-trees-in-ofnode' into next
To quote the author:
At present the ofnode interface is somewhat limited, in that it cannot
access the device tree provided by the OS, only the one used by U-Boot
itself (assuming these are separate). This prevents using ofnode functions
to handle device tree fixups, i.e. ft_board_setup() and the like.

The ofnode interface was introduced to allow a consistent API to access
the device tree, whether a flat tree or a live tree (OF_LIVE) is in use.

With the flat tree, adding nodes and properties at the start of the tree
(as often happens when writing to the /chosen node) requires copying a
lot of data for each operation. With live tree, such operations are
quite a bit faster, since there is no memory copying required. This has to
be weighed against the required memory allocation with OF_LIVE, as well
as the cost of unflattening and flattening the device tree which U-Boot
is running.

This series enables support for access to multiple device trees with the
ofnode interface. This is already available to some extent with OF_LIVE,
but some of the ofnode functions need changes to allow the tree to be
specified.

The mechanism works by using the top 1-4 bits of the device tree offset.
The sign bit is not affected, since negative values must be supported.

With this implemented, it becomes possible to use the ofnode interface
to do device tree fixups. The only current user is the EVT_FT_FIXUP
event.

This has two main benefits:

- ofnode can now be used everywhere, in preference to the libfdt calls
- live tree can eventually be used everywhere, with potential speed
  improvements when larger number of fixups are used

This series is only a step along the way. Firstly, while it is possible
to access the 'fix-up' tree using OF_LIVE, most of the fixup functions use
flat tree directly, rather than the ofnode interface. These need to be
updated. Also the tree must be flattened again before it is passed to the
OS. This is not currently implemented.

With OFNODE_MULTI_TREE disabled this has almost no effect on code size:
around 4 bytes if EVENT is enabled, 0 if not. With the feature enabled,
the increase is around 700 bytes, e.g. on venice2:

$ buildman -b ofn2a venice2 -sS --step 0
Summary of 2 commits for 1 boards (1 thread, 64 jobs per thread)
01: image: Drop some other #ifdefs in image-board.c
       arm:  w+   venice2
48: wip
       arm: (for 1/1 boards) all +668.0 text +668.0

This size increase is not too bad, considering the extra functionality,
but is too large to enable everywhere. So for now this features needs to
be opt-in only, based on EVENT.
2022-09-30 15:52:10 -04:00
Tom Rini
d3ccdc0fce Pull request for efi-2022-10-rc6
Documentation:
 
 * doc: improve description of autostart
 
 UEFI:
 
 * prefix test functions with efi_st_ in the LoadImage unit test
 * avoid a warning message in efi_initrd_deregister()
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmM2ofgACgkQxIHbvCwF
 GsQaTw//RqZXBeSxG8Iac231Vd9kSSyDHF+RqhGfgGDnf9n3P2Gi9D9Bs3SwKWx/
 aoBTy/O1TQzkG6CoNIIzcQiCR+aqIhDLrO5YfLIbmqWgG4zjpl1+w76NFZiThuJC
 RA+IUutwBKChXGpLARn3Wnz58e6upRmbwJC8NbHA+qvvKaMSsBIht5NXoBO1yTrV
 qeZEi/WvH6THuh7EjXHObrLcocrg2iQ1b9ydr+o/Y3tR4wZp/vZTeE76UrXv3IJk
 37GjcmLj+DW5078IG7p2ThoX0/D81JS/cnLCjoCooGBN4ZUBf3XJxP60hYZG2h6E
 hf2B8ExPMhM1pAhFNWbHhZii3FXzqUtyDFf7ICMn39B8mVN/20X6/Tto8UOst/Q7
 BBie39eVAkGCbJxQf0MGDjeql3TpfEHxKEZfnAjJAOql05hewvDPxz6VVgtnlIXw
 WWFZ2WOlc/RX8AZhwIChDXRXlIGyX3lV8xnbSZxR3XNDbxwTGMTbbXb26PIbZXXs
 2qU7iyKyMv2AS+jOY9tKN/DwEUaLmXXxm7Rrjibkzx2eEiQHG2make4uXBFMBv/3
 jykzStGdKK74jiievLm/JtbfwSVFvg/eG9Cf+QG+9tyK/tns+c4SVuNAHTTyUKKx
 w80f4gaC787M2MajI5FrCCvpoiw0UNOKXeoSpraefIVyb7WL3vs=
 =+0LE
 -----END PGP SIGNATURE-----

Merge tag 'efi-2022-10-rc6' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-10-rc6

Documentation:

* doc: improve description of autostart

UEFI:

* prefix test functions with efi_st_ in the LoadImage unit test
* avoid a warning message in efi_initrd_deregister()
2022-09-30 08:30:38 -04:00
Simon Glass
db1ef1e12b dm: core: Support copying properties with ofnode
Add a function to copy properties from one node to another.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
0b58eaa89c dm: core: Allow copying ofnode property data when writing
At present ofnode_write_prop() is inconsistent between livetree and
flattree, in that livetree requires the caller to ensure the property
value is stable (e.g. in rodata or allocated) but flattree does not, since
it makes a copy.

This makes the API call a bit painful to use, since the caller must do
different things depending on OF_LIVE.

Add a new 'copy' argument which tells the function to make a copy if
needed. Add some tests to cover this behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
0d63213c1e vbe: Allow test to run with live/flat tree
This test can operate in all conditions now. Update the test and comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
47a677c2eb dm: core: Expand ofnode tests
The current tests do not cover all functions, nor do they cover the new
multi-tree functionality. Add and update the tests accordingly and update
the 'future work' notes in the documentation.

There is a still more testing needed for the failure cases, since at
present some ofnode functions return a libfdt error code instead of
converting it to an errno.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
88a1ae8172 dm: core: Create a function to get a live tree in a test
Move this logic out of the test into separate functions, so we can use it
in other tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
988f146855 dm: core: Update comments for default-FDT ofnode functions
Some ofnode functions can only operate on the default device tree, i.e.
U-Boot's control FDT. Add comments to that effect. Fix up the reference to
device tree bindings while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
5e96925ba5 dm: core: Complete phandle implementation using the other FDT
We need to be able to look up phandles in any FDT, not just the control
FDT. Use the 'other' FDT to test this, with a helper function which gets
this as an oftree that can then we used as needed.

Add a few more tests and some comments at the top of the file, to explain
what is going on.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
92291652b5 dm: core: Add the ofnode multi-tree implementation
Add the logic to redirect requests for the device tree through a function
which can look up the tree ID. This works by using the top bits of
ofnode.of_offset to encode a tree.

It is assumed that there will only be a few device trees used at runtime,
typically the control FDT (always tree ID 0) and possibly a separate FDT
to be passed the OS.

The maximum number of device trees supported at runtime is 8, with this
implementation. That would use bits 30:28 of the node-offset value,
meaning that the positive offset range is limited to bits 27:0, versus
30:1 with this feature disabled. That still allows a device tree of up
to 256MB, which should be enough for most FITs. Larger ones can be
supported by using external data with the FIT, or by enabling OF_LIVE.

Update the documentation a little and fix up the comment for
ofnode_valid().

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
41b65d68ec dm: core: Add definitions for multiple ofnode trees
At present, unless OF_LIVE is enabled, ofnode only supports access to one
device tree, the control FDT. This is because only the node offset is
encoded in ofnode, with the tree being implicit.

This makes ofnode (without OF_LIVE) unsuitable for device tree fixups, as
implemented by ft_board_setup() and other such functions.

To solve this, we can use the top bits of the node offset to hold a tree
ID.

Add the definitions for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
b7bd94f1a8 dm: core: Split ofnode_path_root() into two functions
This function turns out to be a little confusing since it looks up a path
and also registers the tree. Split it into two, one that gets the root
node and one that looks up a path, so the purpose is clear.

Registering the tree will happen in a function to be added in a later
patch, called oftree_from_fdt().

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
2187cb7e4a dm: core: Allow obtaining a node offset in the same tree
In some cases we want to obtain an ofnode in the same tree as a different
ofnode, such as when looking up a subnode. At present this is trivial,
since there is only one tree. When there are multiple trees, this
implementation will change.

Also move the ofnode_to_offset() function up higher in the header file,
since we will need to provide a different implementation with multiple
trees.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
928d267aee dm: core: Add a way to look up a phandle in an oftree
When we have multiple trees, the ofnode logic needs to be told which one
to use. Create a new function which takes an oftree argument, along with
a helper to obtain the FDT pointer from an oftree.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
085d59411c dm: core: Add ofnode functions to obtain an oftree
At present dm_test_ofnode_root() does this manually. Add some inline
functions to handle it, so this code can be centralised.

Add oftree functions to produce a null tree and to check whether a tree
is valid or not.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
a3f50d0386 dm: core: Add an ofnode function to obtain the flat tree
The flat device tree is assumed to be the control FDT but this is not
always the case. Update the ofnode implementation to obtain the node via
an function call so we can eventually add support for selecting different
trees.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
ee88ba71ac dm: core: Provide a way to reset the device tree
At present there is only one device tree used by the ofnode functions,
except for some esoteric use of live tree. In preparation for supporting
more than one, add a way to reset the list of device trees.

For now this does nothing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:43 -04:00
Simon Glass
66d0d0c188 dm: core: Expand integer-reading tests
The current tests do not cover all the behaviour. Add some more.

Tidy up a few inconsistencies between livetree and flattree which come to
light with these tests. Also drop the -ENODATA error since it is never
actually returned.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 22:43:42 -04:00
Heinrich Schuchardt
8d805929b1 efi_loader: fix efi_initrd_deregister()
Don't try to delete a non-existent handle.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-09-30 02:03:23 +02:00
Heinrich Schuchardt
0dfc4c84d8 efi_selftest: prefix test functions with efi_st_
An upcoming patch set creates a global function flush(). To make debugging
easier we should not use the same name for a static function.

Rename static functions in the LoadImage() unit test adding an efi_st_
prefix.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-09-30 02:03:23 +02:00
Heinrich Schuchardt
0e21943b94 doc: improve description of autostart
Complete the list of commands influenced by the autostart environment
variable.

Make it clearer what values qualifies at 'yes'.

Eventually the list of environment variables is to be alphabetically
sorted. Move autostart up.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-30 02:03:23 +02:00
Simon Glass
8909066199 dm: core: Drop ofnode_is_available()
This function is also available as ofnode_is_enabled(), so use that
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 16:11:31 -04:00
Simon Glass
52ad21aa2c dm: core: Add a macro to iterate through properties
Add a 'for_each' macro like we have for nodes.

Fix the comment for struct ofprop while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 16:11:15 -04:00
Simon Glass
f46ec93ed5 dm: core: Avoid creating a name property when unflattening
The current implementation creates a 'name' value for every node. This
is not needed for the latest device tree format, which includes a name in
the node header.

Adjust the code to point the name at the node header instead.

Also simplify ofnode_get_name(), now that we can rely on it to set the
name correctly. Update the comment to make it clear what name the root
node has.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 16:11:14 -04:00
Simon Glass
9243224687 dm: core: Rename ofnode_get_property_by_prop()
The current name is quite unwieldy. Change it to use an ofprop_ prefix
and shorten it. Fix the return-value comment while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 16:11:14 -04:00
Simon Glass
4b1f571465 dm: core: Rename ofnode_get_first/next_property()
Drop the 'get' in these names since it does not fit with the rest of
the API.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 16:11:14 -04:00