1
0
Fork 0

Revert "of/fdt: Remove dead code and mark functions with __init"

This reverts commit 9b4d2b635b.

Those APIs are needed by i.MX PM codes
5.4-rM2-2.2.x-imx-squashed
Dong Aisheng 2019-07-02 17:35:31 +08:00
parent 194fc9c9db
commit c54a998d8d
2 changed files with 43 additions and 5 deletions

View File

@ -39,7 +39,7 @@
* memory entries in the /memory node. This function may be called
* any time after initial_boot_param is set.
*/
void __init of_fdt_limit_memory(int limit)
void of_fdt_limit_memory(int limit)
{
int memory;
int len;
@ -111,6 +111,25 @@ static int of_fdt_is_compatible(const void *blob,
return 0;
}
/**
* of_fdt_is_big_endian - Return true if given node needs BE MMIO accesses
* @blob: A device tree blob
* @node: node to test
*
* Returns true if the node has a "big-endian" property, or if the kernel
* was compiled for BE *and* the node has a "native-endian" property.
* Returns false otherwise.
*/
bool of_fdt_is_big_endian(const void *blob, unsigned long node)
{
if (fdt_getprop(blob, node, "big-endian", NULL))
return true;
if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) &&
fdt_getprop(blob, node, "native-endian", NULL))
return true;
return false;
}
static bool of_fdt_device_is_available(const void *blob, unsigned long node)
{
const char *status = fdt_getprop(blob, node, "status", NULL);
@ -127,8 +146,8 @@ static bool of_fdt_device_is_available(const void *blob, unsigned long node)
/**
* of_fdt_match - Return true if node matches a list of compatible values
*/
static int __init of_fdt_match(const void *blob, unsigned long node,
const char *const *compat)
int of_fdt_match(const void *blob, unsigned long node,
const char *const *compat)
{
unsigned int tmp, score = 0;
@ -741,7 +760,7 @@ int __init of_scan_flat_dt_subnodes(unsigned long parent,
* @return offset of the subnode, or -FDT_ERR_NOTFOUND if there is none
*/
int __init of_get_flat_dt_subnode_by_name(unsigned long node, const char *uname)
int of_get_flat_dt_subnode_by_name(unsigned long node, const char *uname)
{
return fdt_subnode_offset(initial_boot_params, node, uname);
}
@ -754,6 +773,14 @@ unsigned long __init of_get_flat_dt_root(void)
return 0;
}
/**
* of_get_flat_dt_size - Return the total size of the FDT
*/
int __init of_get_flat_dt_size(void)
{
return fdt_totalsize(initial_boot_params);
}
/**
* of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr
*
@ -779,7 +806,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
/**
* of_flat_dt_match - Return true if node matches a list of compatible values
*/
static int __init of_flat_dt_match(unsigned long node, const char *const *compat)
int __init of_flat_dt_match(unsigned long node, const char *const *compat)
{
return of_fdt_match(initial_boot_params, node, compat);
}

View File

@ -23,6 +23,15 @@
struct device_node;
/* For scanning an arbitrary device-tree at any time */
extern char *of_fdt_get_string(const void *blob, u32 offset);
extern void *of_fdt_get_property(const void *blob,
unsigned long node,
const char *name,
int *size);
extern bool of_fdt_is_big_endian(const void *blob,
unsigned long node);
extern int of_fdt_match(const void *blob, unsigned long node,
const char *const *compat);
extern void *of_fdt_unflatten_tree(const unsigned long *blob,
struct device_node *dad,
struct device_node **mynodes);
@ -55,7 +64,9 @@ extern int of_get_flat_dt_subnode_by_name(unsigned long node,
extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
int *size);
extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
extern int of_flat_dt_match(unsigned long node, const char *const *matches);
extern unsigned long of_get_flat_dt_root(void);
extern int of_get_flat_dt_size(void);
extern uint32_t of_get_flat_dt_phandle(unsigned long node);
extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,