aboutsummaryrefslogtreecommitdiff
path: root/include/dm
AgeCommit message (Collapse)AuthorFilesLines
2023-05-04dm: core: fix introduce uclass_get_device_by_of_pathHeinrich Schuchardt1-1/+1
Correct the function documentation. Fixes: ca031c082700 ("dm: core: introduce uclass_get_device_by_of_path()") Reported-by: Tom Rini <trini@konsulko.com> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-05-02dm: extcon: add an uclass for extconSvyatoslav Ryhel1-0/+1
Add a new simple uclass for extcon. Currently all setup is done in the probe. Uclass struct and ops are empty for now. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28dm: core: introduce uclass_get_device_by_of_path()Rasmus Villemoes1-0/+17
There's quite a few instances of board-specific code doing off = fdt_path_offset(gd->fdt_blob, ...); ... ret = uclass_get_device_by_of_offset(..., off, &dev); looking for an eeprom or a pmic via some alias. Such code can be simplified a little if we have a helper for directly getting a device via device tree path (including being given as an alias). Implement it in terms of ofnode rather than raw offsets so that this will work whether live tree is enabled or not. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2023-04-27drivers/mtd/nvmxip: introduce NVM XIP block storage emulationAbdellatif El Khlifi1-0/+1
add block storage emulation for NVM XIP flash devices Some paltforms such as Corstone-1000 need to see NVM XIP raw flash as a block storage device with read only capability. Here NVM flash devices are devices with addressable memory (e.g: QSPI NOR flash). The implementation is generic and can be used by different platforms. Two drivers are provided as follows. nvmxip-blk : a generic block driver allowing to read from the XIP flash nvmxip Uclass driver : When a device is described in the DT and associated with UCLASS_NVMXIP, the Uclass creates a block device and binds it with the nvmxip-blk. Platforms can use multiple NVM XIP devices at the same time by defining a DT node for each one of them. Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
2023-04-07serial: sh: Add HSCIF support for R-Car SoCHai Pham1-0/+1
Provide the basic HSCIF support for R-Car SoC. Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Signed-off-by: Hai Pham <hai.pham.ud@renesas.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> [Marek: Fill in HSSRR offset for Gen2 and SCBRR calculation for Gen2 and Gen3] Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-05blk: blkmap: Add basic infrastructureTobias Waldekranz1-0/+1
blkmaps are loosely modeled on Linux's device mapper subsystem. The basic idea is that you can create virtual block devices whose blocks can be backed by a plethora of sources that are user configurable. This change just adds the basic infrastructure for creating and removing blkmap devices. Subsequent changes will extend this to add support for actual mappings. Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-14dm: treewide: Complete migration to new driver model schemaSimon Glass2-6/+6
Update various build and test components to use the new schema. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-04drivers: core: ofnode: Add panel timing decode.Nikhil M Jain2-0/+32
ofnode_decode_display_timing supports reading timing parameters from subnode of display-timings node, for displays supporting multiple resolution, in case if a display supports single resolution, it fails reading directly from display-timings node, to support it ofnode_decode_panel_timing is added. Signed-off-by: Nikhil M Jain <n-jain1@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-27iommu: Add DMA mapping operationsMark Kettenis1-0/+4
In order to support IOMMUs in non-bypass mode we need device ops to map and unmap DMA memory. The map operation enters a mapping for a region specified by CPU address and size into the translation table of the IOMMU and returns a DMA address suitable for programming the device to do DMA. The unmap operation removes this mapping from the translation table of the IOMMU. Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2023-01-23dm: core: Support sorting devices with dm treeSimon Glass1-2/+6
Add a -s flag to sort the top-level devices in order of uclass ID. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23dm: core: Correct ordering of uclasses IDsSimon Glass1-2/+2
A few of these are out of order. Fix them. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-12-07net: ethoc: Remove non-DM_ETH codeTom Rini1-4/+0
As DM_ETH is required for all network drivers, it's now safe to remove the non-DM_ETH support code. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-05arm: lpc32xx: Remove unused hsuart driverTom Rini1-18/+0
This driver is not enabled in any config currently, remove it. Cc: Trevor Woerner <twoerner@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2022-11-07dm: sandbox: Create a new HOST uclassSimon Glass1-0/+1
Sandbox supports block devices which can access files on the host machine. At present there is no uclass for this. The devices are attached to the root devic. The block-device type is therefore set to UCLASS_ROOT which is confusing. Block devices should be attached to a 'media' device instead, something which handles access to the actual media and provides the block driver for the block device. Create a new uclass to handle this. It supports two operations, to attach and detach a file on the host machine. For now this is not fully plumbed in. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31FWU: Add FWU metadata structure and driver for accessing metadataSughosh Ganu1-0/+1
In the FWU Multi Bank Update feature, the information about the updatable images is stored as part of the metadata, which is stored on a dedicated partition. Add the metadata structure, and a driver model uclass which provides functions to access the metadata. These are generic API's, and implementations can be added based on parameters like how the metadata partition is accessed and what type of storage device houses the metadata. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2022-10-29dm: core: Do not stop uclass iteration on errorMichal Suchanek1-7/+6
When probing a device fails NULL pointer is returned, and following devices in uclass list cannot be iterated. Skip to next device on error instead. With that the only condition under which these simple iteration functions return error is when the dm is not initialized at uclass_get time. This is not all that interesting, change return type to void. Fixes: 6494d708bf ("dm: Add base driver model support") Signed-off-by: Michal Suchanek <msuchanek@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29dm: core: Add note about device_probe idempotenceMichal Suchanek1-2/+2
device_probe returns early when the device is already activated. Add a note to the documentation that it can be used on already activated devices. Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2022-10-29dm: core: Document return value of device bind functionsMichal Suchanek1-0/+2
These functions use device_bind_with_driver_data internally, copy the return value description. Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2022-10-29dm: core: Switch uclass_*_device_err to use uclass_*_device_checkMichal Suchanek1-4/+8
Clarify documentation, fix a few more cases that could be broken by the change. Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2022-10-26dm: memory: Introduce new uclassRoger Quadros1-0/+1
Introduce UCLASS_MEMORY for future Memory Controller device drivers. Signed-off-by: Roger Quadros <rogerq@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-17dm: core: Update docs about oftree_from_fdt()Simon Glass1-0/+3
Update this function's comment and also the livetree documentation, so it is clear when to use the function. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-17dm: core: Switch uclass_*_device_err to use uclass_*_device_checkMichal Suchanek1-11/+11
The _err variant iterators use the simple iterators without suffix as basis. However, there is no user that uclass_next_device_err for iteration, many users of uclass_first_device_err use it to get the first and (assumed) only device of an uclass, and a couple that use uclass_next_device_err to get the device following a known device in the uclass list. While there are some truly singleton device classes in which more than one device cannot exist these are quite rare, and most classes can have multiple devices even if it is not the case on the SoC's EVB. In a later patch the simple iterators will be updated to not stop on error and return next device instead. With this in many cases the code that expects the first device or an error if it fails to probe may get the next device instead. Use the _check iterators as the basis of _err iterators to preserve the old behavior. Signed-off-by: Michal Suchanek <msuchanek@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-17dm: core: Switch uclass_foreach_dev_probe to use simple iteratorMichal Suchanek1-2/+2
The return value is not used for anythig, and in a later patch the behavior of the _err iterator will change in an incompatible way. Signed-off-by: Michal Suchanek <msuchanek@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org> Update pvblock_probe() to avoid using internal var: Signed-off-by: Simon Glass <sjg@chromium.org>
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-29dm: 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-29dm: 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-29dm: 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-29dm: 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-29dm: 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-29dm: 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-29dm: 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-29dm: 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-29dm: 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-29dm: 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-29dm: 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-29dm: 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-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>
2022-09-29dm: core: Pass a root node to of_find_node_by_phandle()Simon Glass2-1/+5
This function currently assumes that the control FDT is used. Update it to allow a root node to be passed, so it can work with any tree. Also add a comment to ofnode_get_by_phandle() so that its purpose is clear. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-14dm: core: Add functions to read 8/16-bit integersStefan Herbrechtsmeier3-0/+137
Add functions to read 8/16-bit integers like the existing functions for 32/64-bit to simplify read of 8/16-bit integers from device tree properties. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Add support for writing u32 with ofnodeSimon Glass1-0/+10
Add a new function to write an integer to an ofnode (live tree or flat tree). Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Allow writing to a flat tree with ofnodeSimon Glass2-0/+30
In generally it is not permitted to implement an ofnode function only for flat tree or live tree. Both must be supported. Also the code for live tree access should be in of_access.c rather than ofnode.c which is really just for holding the API-conversion code. Update ofnode_write_prop() accordingly and fix the test so it can work with flat tree too. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Swap parameters of ofnode_write_prop()Simon Glass1-3/+3
It is normal for the length to come after the value in libfdt. Follow this same convention with ofnode. Signed-off-by: Simon Glass <sjg@chromium.org>