Lines Matching +full:int +full:- +full:property

7  * SPDX-License-Identifier:	GPL-2.0+
22 return ofnode_to_np(dev->node); in dev_np()
32 * dev_ofnode() - get the DT node reference associated with a udevice
39 return dev->node; in dev_ofnode()
49 * dev_read_u32_default() - read a 32-bit integer from a device's DT property
51 * @dev: device to read DT property from
52 * @propname: name of the property to read from
53 * @def: default value to return if the property has no value
54 * @return property value, or @def if not found
56 int dev_read_u32_default(struct udevice *dev, const char *propname, int def);
59 * dev_read_s32_default() - read a signed 32-bit integer from a device's DT property
61 * @dev: device to read DT property from
62 * @propname: name of the property to read from
63 * @def: default value to return if the property has no value
64 * @return property value, or @def if not found
66 int dev_read_s32_default(struct udevice *dev, const char *propname, int def);
69 * dev_read_string() - Read a string from a device's DT property
71 * @dev: device to read DT property from
72 * @propname: name of the property to read
73 * @return string from property value, or NULL if there is no such property
78 * dev_read_bool() - read a boolean value from a device's DT property
80 * @dev: device to read DT property from
81 * @propname: name of property to read
82 * @return true if property is present (meaning true), false if not present
87 * dev_read_subnode() - find a named subnode of a device
97 * dev_read_size() - read the size of a property
100 * @propname: property to check
101 * @return size of property if present, or -EINVAL if not
103 int dev_read_size(struct udevice *dev, const char *propname);
106 * dev_read_addr_index() - Get the indexed reg property of a device
109 * @index: the 'reg' property can hold a list of <addr, size> pairs
114 fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);
117 * dev_read_addr() - Get the reg property of a device
126 * dev_read_addr_ptr() - Get the reg property of a device
136 * dev_read_addr_size() - get address and size from a device property
138 * This does no address translation. It simply reads an property that contains
142 * @propname: property to read
150 * dev_read_name() - get the name of a device's node
158 * dev_read_stringlist_search() - find string in a string list and return index
160 * Note that it is possible for this function to succeed on property values
161 * that are not NUL-terminated. That's because the function will stop after
163 * small-valued cell properties, such as #address-cells, when searching for
167 * @propname: name of the property containing the string list
172 * -ENODATA if the property is not found
173 * -EINVAL on some other error
175 int dev_read_stringlist_search(struct udevice *dev, const char *property,
179 * dev_read_string_index() - obtain an indexed string from a string list
182 * @propname: name of the property containing the string list
187 * length of string, if found or -ve error value if not found
189 int dev_read_string_index(struct udevice *dev, const char *propname, int index,
193 * dev_read_string_count() - find the number of strings in a string list
196 * @propname: name of the property containing the string list
198 * number of strings in the list, or -ve error value if not found
200 int dev_read_string_count(struct udevice *dev, const char *propname);
202 * dev_read_phandle_with_args() - Find a node pointed by phandle in a list
208 * Caller is responsible to call of_node_put() on the returned out_args->np
214 * #list-cells = <2>;
218 * #list-cells = <1>;
226 * dev_read_phandle_with_args(dev, "list", "#list-cells", 0, 1, &args);
229 * @list_name: property name that contains a list
230 * @cells_name: property name that specifies phandles' arguments count
234 * @return 0 on success (with @out_args filled out if not NULL), -ENOENT if
235 * @list_name does not exist, -EINVAL if a phandle was not found,
239 int dev_read_phandle_with_args(struct udevice *dev, const char *list_name,
240 const char *cells_name, int cell_count,
241 int index,
245 * dev_count_phandle_with_args() - Return phandle number in a list
247 * This function is usefull to get phandle number contained in a property list.
249 * clock's reference contained into the "clocks" property.
253 * @list_name: property name that contains a list
254 * @cells_name: property name that specifies phandles' arguments count
259 int dev_count_phandle_with_args(struct udevice *dev, const char *list_name,
263 * dev_read_addr_cells() - Get the number of address cells for a device's node
265 * This walks back up the tree to find the closest #address-cells property
271 int dev_read_addr_cells(struct udevice *dev);
274 * dev_remap_addr_index() - Get the indexed reg property of a device
275 * as a memory-mapped I/O pointer
278 * @index: the 'reg' property can hold a list of <addr, size> pairs
283 void *dev_remap_addr_index(struct udevice *dev, int index);
286 * dev_read_size_cells() - Get the number of size cells for a device's node
288 * This walks back up the tree to find the closest #size-cells property
294 int dev_read_size_cells(struct udevice *dev);
297 * dev_read_addr_cells() - Get the address cells property in a node
304 int dev_read_simple_addr_cells(struct udevice *dev);
307 * dev_read_size_cells() - Get the size cells property in a node
314 int dev_read_simple_size_cells(struct udevice *dev);
317 * dev_read_phandle() - Get the phandle from a device
322 int dev_read_phandle(struct udevice *dev);
325 * dev_read_prop()- - read a property from a device's node
328 * @propname: property to read
330 * @return pointer to property, or NULL if not found
332 const void *dev_read_prop(struct udevice *dev, const char *propname, int *lenp);
335 * dev_read_first_prop()- get the reference of the first property
337 * Get reference to the first property of the node, it is used to iterate
338 * and read all the property with dev_read_prop_by_prop().
342 * @return 0 if OK, -ve on error. -FDT_ERR_NOTFOUND if not found
344 int dev_read_first_prop(struct udevice *dev, struct ofprop *prop);
347 * ofnode_get_next_property() - get the reference of the next property
349 * Get reference to the next property of the node, it is used to iterate
350 * and read all the property with dev_read_prop_by_prop().
353 * @return 0 if OK, -ve on error. -FDT_ERR_NOTFOUND if not found
355 int dev_read_next_prop(struct ofprop *prop);
358 * dev_read_prop_by_prop() - get a pointer to the value of a property
360 * Get value for the property identified by the provided reference.
362 * @prop: reference on property
363 * @propname: If non-NULL, place to property name on success,
364 * @lenp: If non-NULL, place to put length on success
365 * @return 0 if OK, -ve on error. -FDT_ERR_NOTFOUND if not found
368 const char **propname, int *lenp);
371 * dev_read_alias_seq() - Get the alias sequence number of a node
379 * @return 0 if a sequence was found, -ve if not
381 int dev_read_alias_seq(struct udevice *dev, int *devnump);
384 * dev_read_u32_array() - Find and read an array of 32 bit integers
386 * Search for a property in a device node and read 32-bit value(s) from
392 * @propname: name of the property to read
395 * @return 0 on success, -EINVAL if the property does not exist, -ENODATA if
396 * property does not have a value, and -EOVERFLOW if the property data isn't
399 int dev_read_u32_array(struct udevice *dev, const char *propname,
403 * dev_write_u32_array() - Find and write an array of 32 bit integers
405 * Search for a property in a device node and write 32-bit value(s) to
411 * @propname: name of the property to read
414 * @return 0 on success, -EINVAL if the property does not exist, -ENODATA if
415 * property does not have a value, and -EOVERFLOW if the property data isn't
418 int dev_write_u32_array(struct udevice *dev, const char *propname,
422 * dev_read_first_subnode() - find the first subnode of a device's node
431 * ofnode_next_subnode() - find the next sibling of a subnode
440 * dev_read_u8_array_ptr() - find an 8-bit array
442 * Look up a device's node property and return a pointer to its contents as a
443 * byte array of given length. The property must have at least enough data
448 * @propname: name of property to find
450 * @return pointer to byte array if found, or NULL if the property is not
457 * dev_read_enabled() - check whether a node is enabled
459 * This looks for a 'status' property. If this exists, then returns 1 if
460 * the status is 'ok' and 0 otherwise. If there is no status property,
467 int dev_read_enabled(struct udevice *dev);
470 * dev_read_resource() - obtain an indexed resource from a device.
477 int dev_read_resource(struct udevice *dev, uint index, struct resource *res);
480 * dev_read_resource_byname() - obtain a named resource from a device.
487 int dev_read_resource_byname(struct udevice *dev, const char *name,
491 * dev_translate_address() - Tranlate a device-tree address
493 * Translate an address from the device-tree into a CPU physical address. This
504 static inline int dev_read_u32_default(struct udevice *dev, in dev_read_u32_default()
505 const char *propname, int def) in dev_read_u32_default()
527 static inline int dev_read_size(struct udevice *dev, const char *propname) in dev_read_size()
532 static inline fdt_addr_t dev_read_addr_index(struct udevice *dev, int index) in dev_read_addr_index()
561 static inline int dev_read_stringlist_search(struct udevice *dev, in dev_read_stringlist_search()
568 static inline int dev_read_string_index(struct udevice *dev, in dev_read_string_index()
569 const char *propname, int index, in dev_read_string_index()
575 static inline int dev_read_string_count(struct udevice *dev, in dev_read_string_count()
581 static inline int dev_read_phandle_with_args(struct udevice *dev, in dev_read_phandle_with_args()
582 const char *list_name, const char *cells_name, int cell_count, in dev_read_phandle_with_args()
583 int index, struct ofnode_phandle_args *out_args) in dev_read_phandle_with_args()
590 static inline int dev_count_phandle_with_args(struct udevice *dev, in dev_count_phandle_with_args()
597 static inline int dev_read_addr_cells(struct udevice *dev) in dev_read_addr_cells()
600 return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev)); in dev_read_addr_cells()
603 static inline void *dev_remap_addr_index(struct udevice *dev, int index) in dev_remap_addr_index()
608 static inline int dev_read_size_cells(struct udevice *dev) in dev_read_size_cells()
611 return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev)); in dev_read_size_cells()
614 static inline int dev_read_simple_addr_cells(struct udevice *dev) in dev_read_simple_addr_cells()
616 return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev)); in dev_read_simple_addr_cells()
619 static inline int dev_read_simple_size_cells(struct udevice *dev) in dev_read_simple_size_cells()
621 return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev)); in dev_read_simple_size_cells()
624 static inline int dev_read_phandle(struct udevice *dev) in dev_read_phandle()
626 return fdt_get_phandle(gd->fdt_blob, dev_of_offset(dev)); in dev_read_phandle()
630 const char *propname, int *lenp) in dev_read_prop()
635 static inline int dev_read_first_prop(struct udevice *dev, struct ofprop *prop) in dev_read_first_prop()
640 static inline int dev_read_next_prop(struct ofprop *prop) in dev_read_next_prop()
647 int *lenp) in dev_read_prop_by_prop()
652 static inline int dev_read_alias_seq(struct udevice *dev, int *devnump) in dev_read_alias_seq()
654 return fdtdec_get_alias_seq(gd->fdt_blob, dev->uclass->uc_drv->name, in dev_read_alias_seq()
658 static inline int dev_read_u32_array(struct udevice *dev, const char *propname, in dev_read_u32_array()
662 return -EINVAL; in dev_read_u32_array()
682 static inline int dev_read_enabled(struct udevice *dev) in dev_read_enabled()
684 return fdtdec_get_is_enabled(gd->fdt_blob, dev_of_offset(dev)); in dev_read_enabled()
687 static inline int dev_read_resource(struct udevice *dev, uint index, in dev_read_resource()
693 static inline int dev_read_resource_byname(struct udevice *dev, in dev_read_resource_byname()
708 * dev_for_each_subnode() - Helper function to iterate through subnodes
711 * device-tree node.
722 * dev_for_each_property() - Helper function to iterate through property
724 * This creates a for() loop which works through the property in a device's
725 * device-tree node.
727 * @prop: struct ofprop holding the current property
731 for (int ret_prop = dev_read_first_prop(dev, &prop); \