summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)AuthorFilesLines
2022-10-11image-pre-load: Move macros/definitions to image.hSteven Lawrance1-0/+43
Putting these definitions in a header will allow signatures to be validated independently of bootm. Signed-off-by: Steven Lawrance <steven.lawrance@softathome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-11Merge tag 'xilinx-for-v2023.01-rc1-v3' of ↵Tom Rini1-0/+1
https://source.denx.de/u-boot/custodians/u-boot-microblaze Xilinx changes for v2023.01-rc1 (round 3) fpga: - Create new uclass - Get rid of FPGA_DEBUG and use logging infrastructure zynq: - Enable early EEPROM decoding - Some DT updates zynqmp: - Use OCM_BANK_0 to check config loading permission - Change config object loading in SPL - Some DT updates net: - emaclite: Enable driver for RISC-V xilinx: - Fix static checker warnings - Fix GCC12 warning sdhci: - Read PD id from DT
2022-10-10Merge https://source.denx.de/u-boot/custodians/u-boot-usbTom Rini1-0/+30
2022-10-10phy: Add generic_{setup,shutdown}_phy() helpersPatrice Chotard1-0/+30
In drivers usb/host/{ehci,ohci}-generic.c, {ehci,ohci}_setup_phy() and {ehci,ohci}_shutdown_phy() shares 95% of common code. Factorize this code in new generic_{setup,shudown}_phy() functions. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org>
2022-10-10efi_loader: internal CloseProtocolHeinrich Schuchardt1-5/+4
Allow avoiding using EFI_CALL() when closing a protocol by providing an internal function. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-10-10efi_loader: don't export efi_remove_all_protocolsHeinrich Schuchardt1-2/+0
This function is only used inside efi_boottime.c and is not safe to use outside of this context. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-10-10Merge tag 'u-boot-nand-20221009' of ↵Tom Rini3-2/+35
https://source.denx.de/u-boot/custodians/u-boot-nand-flash - mtd: Update the function name to 'rfree' - Support NAND ONFI EDO mode for imx8mn architecture - dm: clk: add missing stub when CONFIG_CLK is deactivated
2022-10-09mtd: Update the function name to 'rfree'Fabio Estevam1-1/+1
Since commit 8d38a8459b0d ("mtd: Rename free() to rfree()") the function has been renamed to rfree(), so update the description inside the mtd_oob_region structure as well. Fixes: 8d38a8459b0d ("mtd: Rename free() to rfree()") Reported-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> Signed-off-by: Fabio Estevam <festevam@denx.de> Acked-by: Michael Trimarchi <michael@amarulasolutions.com> Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2022-10-09mtd: mxs_nand: Support EDO mode for imx8mn architectureMichael Trimarchi1-0/+3
Add support for imx8mn architecture in order to run the NAND in fast edo mode. Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com> Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2022-10-09dm: clk: add missing stub when CONFIG_CLK is deactivatedDario Binacchi1-1/+31
Add missing stub for functions [devm_]clk_...() when CONFIG_CLK is deactivated. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Reviewed-by: Sean Anderson <seanga2@gmail.com>
2022-10-07Merge tag 'efi-2023-01-rc1' of ↵Tom Rini3-20/+38
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2023-01-rc1 UEFI: * Provide driver binding protocol to registered events for block devices * Code simplification and refactoring * Fix pylint errors in test_efi_secboot Other: * Improve checks for register ranges
2022-10-07arm: nuvoton: Add support for Nuvoton NPCM845 BMCJim Liu3-0/+211
Add basic support for the Nuvoton NPCM845 EVB (Arbel). Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
2022-10-07common/board_f: introduce arch_setup_dest_addr()Ovidiu Panait1-0/+13
In order to move ppc-specific code out of setup_dest_addr(), provide an arch-specific variant arch_setup_dest_addr(), that can be used by architecture code to fix up the initial reloc address. It is called at the end of setup_dest_addr() initcall and the default implementation is a nop stub. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
2022-10-06efi_loader: define internal implementations of install/uninstallmultipleIlias Apalodimas2-2/+6
A following patch is cleaning up the core EFI code trying to remove sequences of efi_create_handle, efi_add_protocol. Although this works fine there's a problem with the latter since it is usually combined with efi_delete_handle() which blindly removes all protocols on a handle and deletes the handle. We should try to adhere to the EFI spec which only deletes a handle if the last instance of a protocol has been removed. Another problem is that efi_delete_handle() never checks for opened protocols, but the EFI spec defines that the caller is responsible for ensuring that there are no references to a protocol interface that is going to be removed. So let's fix this by replacing all callsites of efi_create_handle(), efi_add_protocol() , efi_delete_handle() with Install/UninstallMultipleProtocol. In order to do that redefine functions that can be used by the U-Boot proper internally and add '_ext' variants that will be used from the EFI API Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2022-10-06efi_driver: move event registration to driverHeinrich Schuchardt1-2/+5
Move the registration of events for the addition and removal of block devices to the block device driver. Here we can add a reference to the EFI Driver Binding protocol as context. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-10-06efi_driver: add init function to EFI block driverHeinrich Schuchardt1-0/+3
For handling added and removed block devices we need to register events which has to be done when the driver is installed. This patch only creates an empty init function that will be filled with code later on. The function needs to be called before any EFI block devices are used. Move the efi_driver_init() call to early init. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-10-06efi_driver: provide driver binding protocol to bind functionHeinrich Schuchardt1-14/+15
DisconnectController() is based on the open protocol information created when the driver opens a protocol with BY_CHILD_CONTROLLER or BY_DRIVER. To create an open protocol information it is required to supply the handle of the driver as agent handle. This information is available as field DriverBindingHandle in the driver binding protocol. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-10-06doc: documentation of EFI driver binding protocolHeinrich Schuchardt1-7/+12
* Convert code comments in include/efi_driver.h to Sphinx style. * Add include/efi_driver.h to the HTML documentation. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-10-06efi_driver: fix error handlingHeinrich Schuchardt1-1/+1
If creating the block device fails, * delete all created objects and references * close the protocol interface on the controller Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-10-06efi_loader: function to unlink udevice and handleHeinrich Schuchardt1-0/+1
When deleting a device or a handle we must remove the link between the two to avoid dangling references. Provide function efi_unlink_dev() for this purpose. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-10-06efi: Add string conversion helperPaul Barker1-1/+2
Signed-off-by: Paul Barker <paul.barker@sancloud.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2022-10-06board/km: remove kirkwood boardsHolger Brunck2-276/+0
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-05dm: fpga: Introduce new uclassAlexander Dahl1-0/+1
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-09-30dm: core: Support copying properties with ofnodeSimon Glass1-0/+16
Add a function to copy properties from one node to another. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-30dm: core: Allow copying ofnode property data when writingSimon Glass1-4/+8
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-30dm: core: Update comments for default-FDT ofnode functionsSimon Glass1-3/+15
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-30dm: core: Complete phandle implementation using the other FDTSimon Glass1-0/+5
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-30dm: core: Add the ofnode multi-tree implementationSimon Glass1-47/+64
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-30dm: core: Add definitions for multiple ofnode treesSimon Glass1-2/+31
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-30dm: core: Split ofnode_path_root() into two functionsSimon Glass1-3/+13
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-30dm: core: Allow obtaining a node offset in the same treeSimon Glass1-12/+32
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-30dm: core: Add a way to look up a phandle in an oftreeSimon Glass1-0/+25
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-30dm: core: Add ofnode functions to obtain an oftreeSimon Glass1-0/+63
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-30dm: core: Add an ofnode function to obtain the flat treeSimon Glass1-0/+19
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-30dm: core: Provide a way to reset the device treeSimon Glass1-0/+8
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-30dm: core: Expand integer-reading testsSimon Glass2-10/+8
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-29dm: core: Drop ofnode_is_available()Simon Glass1-8/+0
This function is also available as ofnode_is_enabled(), so use that instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29dm: core: Add a macro to iterate through propertiesSimon Glass2-1/+39
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-29dm: core: Avoid creating a name property when unflatteningSimon Glass1-1/+1
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-29dm: core: Rename ofnode_get_property_by_prop()Simon Glass2-8/+8
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-29dm: core: Rename ofnode_get_first/next_property()Simon Glass2-7/+7
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-29dm: core: Reduce code size with dev_of_offset()Simon Glass1-3/+3
Update the function to mark it with the const attribute. Also avoid calling it multiple times in the devfdt_get_addr_index() function. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29sandbox: test: Provide an easy way to use the other FDTSimon Glass1-0/+3
Add a test flag which indicates that the 'other' FDT should be set up ready for use. Handle this by copying in the FDT, unflattening it for livetree tests. Free the structures when the tests have run. We cannot use the other FDT unless we are using live tree or OFNODE_MULTI_TREE is enabled, since only one tree is supported by the ofnode interface in that case. Add this condition into ut_run_test_live_flat() and update the comments. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29sandbox: Support setting up the other FDT for testingSimon Glass1-2/+17
Provide a way to copy over the 'other' FDT when running tests. This loads it and allocates memory for the copy, if not done already, then does the copy. Avoid using U-Boot's malloc() pool for these copies, at least for now, since they are part of the test system. Tidy up the cpu.c header files while here. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29test: Drop the UT_TESTF_LIVE_OR_FLAT flagSimon Glass1-2/+0
This was a workaround for a rare situation. Now that it will be more common and we have a proper fix, drop the flag. We can run both types of tests in the same sandbox executable, even if the flat device tree is modified. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29test: Detect a change in the device treeSimon Glass1-0/+4
If the device tree changes during a test and we cannot restore it, mark it as such so that future tests which need the live tree are skipped. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29test: Make a copy of the device tree before running a testSimon Glass1-0/+6
When the flat device tree changes it can mess up the live tree since that uses the flat tree for its strings. This affects only a few sandbox tests which modify the device tree, but the number will grow as ofnode support for writing improves. While the control FDT is not intended to change while U-Boot is running, some tests do so. For example, the ofnode interface only supports modifying properties in the control FDT, so tests must use that. To solve this problem, keep a copy of the FDT and restore it as needed when the test is finished. The copy only happens on sandbox (except SPL builds), to reduce memory usage and because these tests are not useful on other boards. For other boards, a checksum is taken to ensure that nothing changes. It would be possible to always checksum the FDT on sandbox and only restore it if needed, but this is slightly slower than restoring it every time, at least with crc8. Move the code which checks for success to the very end, for clarity. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29dm: core: Drop the const from ofnodeSimon Glass2-21/+3
Now that we support writing to ofnodes, the const is not accurate. Drop it to avoid undesirable casting. Also drop the ofnode_to_npw() which is now the same as ofnode_to_np(). Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29dm: core: Allow adding ofnode subnodesSimon Glass2-0/+28
Add this feature to the ofnode interface, supporting both livetree and flattree. If the node exists it is returned, along with a -EEXIST error. Update the functions it calls to handle this too. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29dm: core: Document the livetree structures properlySimon Glass1-2/+13
Clarify the data structure so it is easier for people to understand, particularly the corner cases. Signed-off-by: Simon Glass <sjg@chromium.org>