summaryrefslogtreecommitdiff
path: root/include/dm/read.h
Commit message (Collapse)AuthorAgeFilesLines
* include: dm: Fix 'devioe'/'devuce' typosMario Six2018-01-281-4/+4
| | | | | | | | There are some typos in the documentation of some functions in read.h; fix those. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Simon Glass <sjg@chromium.org>
* Merge git://git.denx.de/u-boot-mmcTom Rini2018-01-241-0/+16
|\
| * dm: add dev_read_u32()Masahiro Yamada2018-01-221-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | dev_read_u32_default() always returns something even when the property is missing. So, it is impossible to do nothing in the case. One solution is to use ofnode_read_u32() instead, but adding dev_read_u32() will be helpful. BTW, Linux has an equvalent function, device_property_read_u32(); it is clearer that it reads a property. I cannot understand the behavior of dev_read_u32() from its name. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
* | core: Add {ofnode, dev}_translate_address functionsMario Six2018-01-211-0/+17
|/ | | | | Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mario Six <mario.six@gdsys.cc>
* dm: core: Add functions to get strings and the string count from a stringlistJean-Jacques Hiblot2017-09-221-0/+36
| | | | | | | | | dev_read_string_count() is used to get the number of strings in a stringlist. dev_read_string_index() is used to get a string in the stringlist based on its position in the list. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* dm: core: add dev_read_addr_ptr()Philipp Tomsich2017-09-181-0/+15
| | | | | | | | | | The dev_read_addr_ptr() mimics the behaviour of the devfdt_get_addr_ptr(), retrieving the first address of the node's reg-property and returning it as a pointer (or NULL on failure). Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* ofnode: add {ofnode, dev}_read_resource_byname()Masahiro Yamada2017-08-291-1/+19
| | | | | | | | | | | Linux supports platform_get_resource_byname() to look up a resource by name. We want a similar helper. It is useful when a device node has named register regions. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* Merge git://git.denx.de/u-boot-usbTom Rini2017-07-291-0/+25
|\
| * dm: core: add ofnode_count_phandle_with_args()Patrice Chotard2017-07-281-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function is usefull to get phandle number contained in a property list. For example, this allows to allocate the right amount of memory to keep clock's reference contained into the "clocks" property. To implement it, either of_count_phandle_with_args() or fdtdec_parse_phandle_with_args() are used respectively for live tree and flat tree. By passing index = -1, these 2 functions returns the number of phandle contained into the property list. Add also the dev_count_phandle_with_args() based on ofnode_count_phandle_with_args() Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | dm: core: Add ofnode_read_resource()Simon Glass2017-07-281-10/+16
| | | | | | | | | | | | | | | | | | | | | | We sometimes need to read a resource from an arbitrary node. In any case for consistency we should not put the live-tree switching code in a dev_read_...() function. Update this to suit. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Tested-on: Beaver, Jetson-TK1 Tested-by: Stephen Warren <swarren@nvidia.com>
* | dm: ofnode: change return type of dev_read_prop() to opaque pointerMasahiro Yamada2017-07-281-3/+3
|/ | | | | | | | DT property values can be strings as well as integers. This is why of_get_property/fdt_getprop returns an opaque pointer. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: ofnode: rename ofnode_read_prop() to ofnode_get_property()Masahiro Yamada2017-07-111-1/+1
| | | | | | | | | | | | | This function returns the pointer to the value of a node property. The current name ofnode_read_prop() is confusing. Follow the naming of_get_property() from Linux. The return type (const u32 *) is wrong. DT property values can be strings as well as integers. This is why of_get_property/fdt_getprop returns an opaque pointer. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: core: Add functions to obtain node's address/size cellsSimon Glass2017-07-111-0/+32
| | | | | | | | | | | | | | | | The of_n_addr_cells() and of_n_size_cells() functions are useful for getting the size of addresses in a node, but in a few places U-Boot needs to obtain the actual property value for a node without walking up the stack. Add functions for this and just the existing code to use it. Add a comment to the existing ofnode functions which do not do the right thing with a flat tree. This fixes a problem reading PCI addresses. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Tested-on: Beaver, Jetson-TK1
* dm: core: Add dev_read_enabled() to check if a device is enabledSimon Glass2017-07-111-0/+18
| | | | | | | | | | | | This function allows a device's status to be read. This indicates whether the device should be enabled or disabled. Note: In normal operation disabled devices will not be present in the driver-model tree. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Tested-on: Beaver, Jetson-TK1
* dm: core: Add dev_read_resource() to read device resourcesSimon Glass2017-07-111-0/+12
| | | | | | | | | | | | | Add a function which reads resources from a device, such as the device hardware address. This uses the "reg" property in the device. Unlike other functions there is little sense in inlining this when livetree is not being used because it has some logic in it and this would just bloat the code size. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Tested-on: Beaver, Jetson-TK1
* dm: core: Implement live tree 'read' functionsSimon Glass2017-06-011-92/+148
| | | | | | | When the live tree is supported some functions need to change a little. Add an implementation which is used when not inlining these functions. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Add device-based 'read' functions to access DTSimon Glass2017-06-011-0/+383
It is common to read a device-tree property from the node associated with a device. Add convenience functions to do this so that drivers do not need to deal with accessing the ofnode from the device. These functions all start with 'dev_read_' to provide consistent naming for all functions which read information from a device's device tree node. These are inlined when using the flat DT to save code size. The live tree implementation is added in a later commit. Signed-off-by: Simon Glass <sjg@chromium.org>