diff options
Diffstat (limited to 'common/fdt_support.c')
| -rw-r--r-- | common/fdt_support.c | 26 | 
1 files changed, 23 insertions, 3 deletions
| diff --git a/common/fdt_support.c b/common/fdt_support.c index 19b2ef6ea4b..46aa84220b2 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -1196,13 +1196,13 @@ int fdt_alloc_phandle(void *blob)  }  /* - * fdt_create_phandle: Create a phandle property for the given node + * fdt_set_phandle: Create a phandle property for the given node   *   * @fdt: ptr to device tree   * @nodeoffset: node to update   * @phandle: phandle value to set (must be unique) -*/ -int fdt_create_phandle(void *fdt, int nodeoffset, uint32_t phandle) + */ +int fdt_set_phandle(void *fdt, int nodeoffset, uint32_t phandle)  {  	int ret; @@ -1235,6 +1235,26 @@ int fdt_create_phandle(void *fdt, int nodeoffset, uint32_t phandle)  	return ret;  } +/* + * fdt_create_phandle: Create a phandle property for the given node + * + * @fdt: ptr to device tree + * @nodeoffset: node to update + */ +int fdt_create_phandle(void *fdt, int nodeoffset) +{ +	/* see if there is a phandle already */ +	int phandle = fdt_get_phandle(fdt, nodeoffset); + +	/* if we got 0, means no phandle so create one */ +	if (phandle == 0) { +		phandle = fdt_alloc_phandle(fdt); +		fdt_set_phandle(fdt, nodeoffset, phandle); +	} + +	return phandle; +} +  #if defined(CONFIG_VIDEO)  int fdt_add_edid(void *blob, const char *compat, unsigned char *edid_buf)  { | 
