aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/dtc/libfdt/libfdt.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-05 22:33:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-05 22:33:07 -0400
commit3ef2bc099d1cce09e2844467e2ced98e1a44609d (patch)
treebe3d1ea5da1ba9f3a664d5da7f34574bb7930ce7 /scripts/dtc/libfdt/libfdt.h
parent2eecf3a49f1ff24c6116c954dd74e83f227fc716 (diff)
parent17a70355ea576843a7ac851f1db26872a50b2850 (diff)
Merge tag 'devicetree-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
Pull DeviceTree updates from Rob Herring: - fix sparse warnings in drivers/of/ - add more overlay unittests - update dtc to v1.4.4-8-g756ffc4f52f6. This adds more checks on dts files such as unit-address formatting and stricter character sets for node and property names - add a common DT modalias function - move trivial-devices.txt up and out of i2c dir - ARM NVIC interrupt controller binding - vendor prefixes for Sensirion, Dioo, Nordic, ROHM - correct some binding file locations * tag 'devicetree-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (24 commits) of: fix sparse warnings in fdt, irq, reserved mem, and resolver code of: fix sparse warning in of_pci_range_parser_one of: fix sparse warnings in of_find_next_cache_node of/unittest: Missing unlocks on error of: fix uninitialized variable warning for overlay test of: fix unittest build without CONFIG_OF_OVERLAY of: Add unit tests for applying overlays of: per-file dtc compiler flags fpga: region: add missing DT documentation for config complete timeout of: Add vendor prefix for ROHM Semiconductor of: fix "/cpus" reference leak in of_numa_parse_cpu_nodes() of: Add vendor prefix for Nordic Semiconductor dt-bindings: arm,nvic: Binding for ARM NVIC interrupt controller on Cortex-M dtc: update warning settings for new bus and node/property name checks scripts/dtc: Update to upstream version v1.4.4-8-g756ffc4f52f6 scripts/dtc: automate getting dtc version and log in update script of: Add function for generating a DT modalias with a newline of: fix of_device_get_modalias returned length when truncating buffers Documentation: devicetree: move trivial-devices out of I2C realm dt-bindings: add vendor prefix for Dioo ..
Diffstat (limited to 'scripts/dtc/libfdt/libfdt.h')
-rw-r--r--scripts/dtc/libfdt/libfdt.h51
1 files changed, 50 insertions, 1 deletions
diff --git a/scripts/dtc/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h
index b842b156fa17..ba86caa73d01 100644
--- a/scripts/dtc/libfdt/libfdt.h
+++ b/scripts/dtc/libfdt/libfdt.h
@@ -143,7 +143,9 @@
143/* Low-level functions (you probably don't need these) */ 143/* Low-level functions (you probably don't need these) */
144/**********************************************************************/ 144/**********************************************************************/
145 145
146#ifndef SWIG /* This function is not useful in Python */
146const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen); 147const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
148#endif
147static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) 149static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
148{ 150{
149 return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen); 151 return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
@@ -210,7 +212,6 @@ int fdt_next_subnode(const void *fdt, int offset);
210/**********************************************************************/ 212/**********************************************************************/
211/* General functions */ 213/* General functions */
212/**********************************************************************/ 214/**********************************************************************/
213
214#define fdt_get_header(fdt, field) \ 215#define fdt_get_header(fdt, field) \
215 (fdt32_to_cpu(((const struct fdt_header *)(fdt))->field)) 216 (fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
216#define fdt_magic(fdt) (fdt_get_header(fdt, magic)) 217#define fdt_magic(fdt) (fdt_get_header(fdt, magic))
@@ -354,8 +355,10 @@ int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
354 * useful for finding subnodes based on a portion of a larger string, 355 * useful for finding subnodes based on a portion of a larger string,
355 * such as a full path. 356 * such as a full path.
356 */ 357 */
358#ifndef SWIG /* Not available in Python */
357int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, 359int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
358 const char *name, int namelen); 360 const char *name, int namelen);
361#endif
359/** 362/**
360 * fdt_subnode_offset - find a subnode of a given node 363 * fdt_subnode_offset - find a subnode of a given node
361 * @fdt: pointer to the device tree blob 364 * @fdt: pointer to the device tree blob
@@ -391,7 +394,9 @@ int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
391 * Identical to fdt_path_offset(), but only consider the first namelen 394 * Identical to fdt_path_offset(), but only consider the first namelen
392 * characters of path as the path name. 395 * characters of path as the path name.
393 */ 396 */
397#ifndef SWIG /* Not available in Python */
394int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen); 398int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
399#endif
395 400
396/** 401/**
397 * fdt_path_offset - find a tree node by its full path 402 * fdt_path_offset - find a tree node by its full path
@@ -550,10 +555,12 @@ const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
550 * Identical to fdt_get_property(), but only examine the first namelen 555 * Identical to fdt_get_property(), but only examine the first namelen
551 * characters of name for matching the property name. 556 * characters of name for matching the property name.
552 */ 557 */
558#ifndef SWIG /* Not available in Python */
553const struct fdt_property *fdt_get_property_namelen(const void *fdt, 559const struct fdt_property *fdt_get_property_namelen(const void *fdt,
554 int nodeoffset, 560 int nodeoffset,
555 const char *name, 561 const char *name,
556 int namelen, int *lenp); 562 int namelen, int *lenp);
563#endif
557 564
558/** 565/**
559 * fdt_get_property - find a given property in a given node 566 * fdt_get_property - find a given property in a given node
@@ -624,8 +631,10 @@ static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
624 * -FDT_ERR_BADSTRUCTURE, 631 * -FDT_ERR_BADSTRUCTURE,
625 * -FDT_ERR_TRUNCATED, standard meanings 632 * -FDT_ERR_TRUNCATED, standard meanings
626 */ 633 */
634#ifndef SWIG /* This function is not useful in Python */
627const void *fdt_getprop_by_offset(const void *fdt, int offset, 635const void *fdt_getprop_by_offset(const void *fdt, int offset,
628 const char **namep, int *lenp); 636 const char **namep, int *lenp);
637#endif
629 638
630/** 639/**
631 * fdt_getprop_namelen - get property value based on substring 640 * fdt_getprop_namelen - get property value based on substring
@@ -638,6 +647,7 @@ const void *fdt_getprop_by_offset(const void *fdt, int offset,
638 * Identical to fdt_getprop(), but only examine the first namelen 647 * Identical to fdt_getprop(), but only examine the first namelen
639 * characters of name for matching the property name. 648 * characters of name for matching the property name.
640 */ 649 */
650#ifndef SWIG /* Not available in Python */
641const void *fdt_getprop_namelen(const void *fdt, int nodeoffset, 651const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
642 const char *name, int namelen, int *lenp); 652 const char *name, int namelen, int *lenp);
643static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset, 653static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
@@ -647,6 +657,7 @@ static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
647 return (void *)(uintptr_t)fdt_getprop_namelen(fdt, nodeoffset, name, 657 return (void *)(uintptr_t)fdt_getprop_namelen(fdt, nodeoffset, name,
648 namelen, lenp); 658 namelen, lenp);
649} 659}
660#endif
650 661
651/** 662/**
652 * fdt_getprop - retrieve the value of a given property 663 * fdt_getprop - retrieve the value of a given property
@@ -707,8 +718,10 @@ uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
707 * Identical to fdt_get_alias(), but only examine the first namelen 718 * Identical to fdt_get_alias(), but only examine the first namelen
708 * characters of name for matching the alias name. 719 * characters of name for matching the alias name.
709 */ 720 */
721#ifndef SWIG /* Not available in Python */
710const char *fdt_get_alias_namelen(const void *fdt, 722const char *fdt_get_alias_namelen(const void *fdt,
711 const char *name, int namelen); 723 const char *name, int namelen);
724#endif
712 725
713/** 726/**
714 * fdt_get_alias - retrieve the path referenced by a given alias 727 * fdt_get_alias - retrieve the path referenced by a given alias
@@ -1106,10 +1119,12 @@ int fdt_size_cells(const void *fdt, int nodeoffset);
1106 * of the name. It is useful when you want to manipulate only one value of 1119 * of the name. It is useful when you want to manipulate only one value of
1107 * an array and you have a string that doesn't end with \0. 1120 * an array and you have a string that doesn't end with \0.
1108 */ 1121 */
1122#ifndef SWIG /* Not available in Python */
1109int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset, 1123int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
1110 const char *name, int namelen, 1124 const char *name, int namelen,
1111 uint32_t idx, const void *val, 1125 uint32_t idx, const void *val,
1112 int len); 1126 int len);
1127#endif
1113 1128
1114/** 1129/**
1115 * fdt_setprop_inplace - change a property's value, but not its size 1130 * fdt_setprop_inplace - change a property's value, but not its size
@@ -1139,8 +1154,10 @@ int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
1139 * -FDT_ERR_BADSTRUCTURE, 1154 * -FDT_ERR_BADSTRUCTURE,
1140 * -FDT_ERR_TRUNCATED, standard meanings 1155 * -FDT_ERR_TRUNCATED, standard meanings
1141 */ 1156 */
1157#ifndef SWIG /* Not available in Python */
1142int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, 1158int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
1143 const void *val, int len); 1159 const void *val, int len);
1160#endif
1144 1161
1145/** 1162/**
1146 * fdt_setprop_inplace_u32 - change the value of a 32-bit integer property 1163 * fdt_setprop_inplace_u32 - change the value of a 32-bit integer property
@@ -1527,6 +1544,36 @@ static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
1527#define fdt_setprop_string(fdt, nodeoffset, name, str) \ 1544#define fdt_setprop_string(fdt, nodeoffset, name, str) \
1528 fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1) 1545 fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
1529 1546
1547
1548/**
1549 * fdt_setprop_empty - set a property to an empty value
1550 * @fdt: pointer to the device tree blob
1551 * @nodeoffset: offset of the node whose property to change
1552 * @name: name of the property to change
1553 *
1554 * fdt_setprop_empty() sets the value of the named property in the
1555 * given node to an empty (zero length) value, or creates a new empty
1556 * property if it does not already exist.
1557 *
1558 * This function may insert or delete data from the blob, and will
1559 * therefore change the offsets of some existing nodes.
1560 *
1561 * returns:
1562 * 0, on success
1563 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1564 * contain the new property value
1565 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1566 * -FDT_ERR_BADLAYOUT,
1567 * -FDT_ERR_BADMAGIC,
1568 * -FDT_ERR_BADVERSION,
1569 * -FDT_ERR_BADSTATE,
1570 * -FDT_ERR_BADSTRUCTURE,
1571 * -FDT_ERR_BADLAYOUT,
1572 * -FDT_ERR_TRUNCATED, standard meanings
1573 */
1574#define fdt_setprop_empty(fdt, nodeoffset, name) \
1575 fdt_setprop((fdt), (nodeoffset), (name), NULL, 0)
1576
1530/** 1577/**
1531 * fdt_appendprop - append to or create a property 1578 * fdt_appendprop - append to or create a property
1532 * @fdt: pointer to the device tree blob 1579 * @fdt: pointer to the device tree blob
@@ -1704,8 +1751,10 @@ int fdt_delprop(void *fdt, int nodeoffset, const char *name);
1704 * creating subnodes based on a portion of a larger string, such as a 1751 * creating subnodes based on a portion of a larger string, such as a
1705 * full path. 1752 * full path.
1706 */ 1753 */
1754#ifndef SWIG /* Not available in Python */
1707int fdt_add_subnode_namelen(void *fdt, int parentoffset, 1755int fdt_add_subnode_namelen(void *fdt, int parentoffset,
1708 const char *name, int namelen); 1756 const char *name, int namelen);
1757#endif
1709 1758
1710/** 1759/**
1711 * fdt_add_subnode - creates a new node 1760 * fdt_add_subnode - creates a new node