|
|
@ -148,23 +148,104 @@ static inline const char *of_node_full_name(const struct device_node *np) |
|
|
|
|
|
|
|
const char *of_prop_next_string(struct property *prop, const char *cur); |
|
|
|
|
|
|
|
int of_device_is_compatible(const struct device_node *device, |
|
|
|
const char *compat); |
|
|
|
int of_device_is_compatible(const struct device_node *device, const char *compat); |
|
|
|
|
|
|
|
const void *__of_get_property(const struct device_node *np, const char *name, int *lenp); |
|
|
|
|
|
|
|
int of_n_addr_cells(struct device_node *np); |
|
|
|
int of_n_size_cells(struct device_node *np); |
|
|
|
|
|
|
|
unsigned long long of_read_number(const int *cell, int size); |
|
|
|
struct device_node *of_get_parent(const struct device_node *node); |
|
|
|
|
|
|
|
int of_property_read_string_helper(const struct device_node *np, |
|
|
|
const char *propname, const char **out_strs, |
|
|
|
size_t sz, int skip); |
|
|
|
int of_property_read_string_helper(const struct device_node *np, const char *propname, const char **out_strs, size_t sz, int skip); |
|
|
|
|
|
|
|
struct property *of_find_property(const struct device_node *np, const char *name, int *lenp); |
|
|
|
|
|
|
|
int of_property_read_variable_u8_array(const struct device_node *np, const char *propname, unsigned char *out_values, size_t sz_min, size_t sz_max); |
|
|
|
int of_property_read_variable_u16_array(const struct device_node *np, const char *propname, unsigned short *out_values, size_t sz_min, size_t sz_max); |
|
|
|
int of_property_read_variable_u32_array(const struct device_node *np, const char *propname, unsigned int *out_values, size_t sz_min, size_t sz_max); |
|
|
|
|
|
|
|
/**
|
|
|
|
* of_property_read_u32_array - Find and read an array of 32 bit integers |
|
|
|
* from a property. |
|
|
|
* |
|
|
|
* @np: device node from which the property value is to be read. |
|
|
|
* @propname: name of the property to be searched. |
|
|
|
* @out_values: pointer to return value, modified only if return value is 0. |
|
|
|
* @sz: number of array elements to read |
|
|
|
* |
|
|
|
* Search for a property in a device node and read 32-bit value(s) from |
|
|
|
* it. Returns 0 on success, -EINVAL if the property does not exist, |
|
|
|
* -ENODATA if property does not have a value, and -EOVERFLOW if the |
|
|
|
* property data isn't large enough. |
|
|
|
* |
|
|
|
* The out_values is modified only if a valid u32 value can be decoded. |
|
|
|
*/ |
|
|
|
static inline int of_property_read_u32_array(const struct device_node *np, const char *propname, unsigned int *out_values, size_t sz) |
|
|
|
{ |
|
|
|
int ret = of_property_read_variable_u32_array(np, propname, out_values, sz, 0); |
|
|
|
if (ret >= 0) |
|
|
|
return 0; |
|
|
|
else |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
struct property *of_find_property(const struct device_node *np, |
|
|
|
const char *name, |
|
|
|
int *lenp); |
|
|
|
/**
|
|
|
|
* of_property_read_u16_array - Find and read an array of u16 from a property. |
|
|
|
* |
|
|
|
* @np: device node from which the property value is to be read. |
|
|
|
* @propname: name of the property to be searched. |
|
|
|
* @out_values: pointer to return value, modified only if return value is 0. |
|
|
|
* @sz: number of array elements to read |
|
|
|
* |
|
|
|
* Search for a property in a device node and read 16-bit value(s) from |
|
|
|
* it. Returns 0 on success, -EINVAL if the property does not exist, |
|
|
|
* -ENODATA if property does not have a value, and -EOVERFLOW if the |
|
|
|
* property data isn't large enough. |
|
|
|
* |
|
|
|
* dts entry of array should be like: |
|
|
|
* property = /bits/ 16 <0x5000 0x6000 0x7000>; |
|
|
|
* |
|
|
|
* The out_values is modified only if a valid u16 value can be decoded. |
|
|
|
*/ |
|
|
|
static inline int of_property_read_u16_array(const struct device_node *np, |
|
|
|
const char *propname, |
|
|
|
unsigned short *out_values, size_t sz) |
|
|
|
{ |
|
|
|
int ret = of_property_read_variable_u16_array(np, propname, out_values, |
|
|
|
sz, 0); |
|
|
|
if (ret >= 0) |
|
|
|
return 0; |
|
|
|
else |
|
|
|
return ret; |
|
|
|
} |
|
|
|
/**
|
|
|
|
* of_property_read_u8_array - Find and read an array of u8 from a property. |
|
|
|
* |
|
|
|
* @np: device node from which the property value is to be read. |
|
|
|
* @propname: name of the property to be searched. |
|
|
|
* @out_values: pointer to return value, modified only if return value is 0. |
|
|
|
* @sz: number of array elements to read |
|
|
|
* |
|
|
|
* Search for a property in a device node and read 8-bit value(s) from |
|
|
|
* it. Returns 0 on success, -EINVAL if the property does not exist, |
|
|
|
* -ENODATA if property does not have a value, and -EOVERFLOW if the |
|
|
|
* property data isn't large enough. |
|
|
|
* |
|
|
|
* dts entry of array should be like: |
|
|
|
* property = /bits/ 8 <0x50 0x60 0x70>; |
|
|
|
* |
|
|
|
* The out_values is modified only if a valid u8 value can be decoded. |
|
|
|
*/ |
|
|
|
static inline int of_property_read_u8_array(const struct device_node *np, const char *propname, unsigned char *out_values, size_t sz) |
|
|
|
{ |
|
|
|
int ret = of_property_read_variable_u8_array(np, propname, out_values, sz, 0); |
|
|
|
if (ret >= 0) |
|
|
|
return 0; |
|
|
|
else |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
/**
|
|
|
|
* of_property_read_string_index() - Find and read a string from a multiple |
|
|
@ -184,9 +265,7 @@ struct property *of_find_property(const struct device_node *np, |
|
|
|
* |
|
|
|
* The out_string pointer is modified only if a valid string can be decoded. |
|
|
|
*/ |
|
|
|
static inline int of_property_read_string_index(const struct device_node *np, |
|
|
|
const char *propname, |
|
|
|
int index, const char **output) |
|
|
|
static inline int of_property_read_string_index(const struct device_node *np, const char *propname, int index, const char **output) |
|
|
|
{ |
|
|
|
int rc = of_property_read_string_helper(np, propname, output, 1, index); |
|
|
|
return rc < 0 ? rc : 0; |
|
|
@ -200,14 +279,33 @@ static inline int of_property_read_string_index(const struct device_node *np, |
|
|
|
* Search for a property in a device node. |
|
|
|
* Returns true if the property exists false otherwise. |
|
|
|
*/ |
|
|
|
static inline int of_property_read_bool(const struct device_node *np, |
|
|
|
const char *propname) |
|
|
|
static inline int of_property_read_bool(const struct device_node *np, const char *propname) |
|
|
|
{ |
|
|
|
struct property *prop = of_find_property(np, propname, NULL); |
|
|
|
|
|
|
|
return prop ? 1 : 0; |
|
|
|
} |
|
|
|
|
|
|
|
static inline int of_property_read_u8(const struct device_node *np, const char *propname, unsigned char *out_value) |
|
|
|
{ |
|
|
|
return of_property_read_u8_array(np, propname, out_value, 1); |
|
|
|
} |
|
|
|
|
|
|
|
static inline int of_property_read_u16(const struct device_node *np, const char *propname, unsigned short *out_value) |
|
|
|
{ |
|
|
|
return of_property_read_u16_array(np, propname, out_value, 1); |
|
|
|
} |
|
|
|
|
|
|
|
static inline int of_property_read_u32(const struct device_node *np, const char *propname, unsigned int *out_value) |
|
|
|
{ |
|
|
|
return of_property_read_u32_array(np, propname, out_value, 1); |
|
|
|
} |
|
|
|
|
|
|
|
static inline int of_property_read_s32(const struct device_node *np, const char *propname, signed int *out_value) |
|
|
|
{ |
|
|
|
return of_property_read_u32(np, propname, (unsigned int*) out_value); |
|
|
|
} |
|
|
|
|
|
|
|
struct device_node *__of_find_all_nodes(struct device_node *prev); |
|
|
|
|
|
|
|
#define for_each_of_allnodes_from(from, dn) \ |
|
|
@ -232,6 +330,6 @@ void of_alias_scan(void * (*dt_alloc)(uint32_t size, uint32_t align)); |
|
|
|
struct device_node *of_get_next_parent(struct device_node *node); |
|
|
|
|
|
|
|
int unflatten_device_tree(void *mempos); |
|
|
|
|
|
|
|
const char * of_fdt_get_machine_name(void *mempos); |
|
|
|
#endif |
|
|
|
|
|
|
|