All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] fdt: introduce fdt_create_phandle()
@ 2011-05-10 20:14 Timur Tabi
  2011-05-10 20:14 ` [U-Boot] [PATCH 2/2] [v2] powerpc/85xx: add support the ePAPR "phandle" property Timur Tabi
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Timur Tabi @ 2011-05-10 20:14 UTC (permalink / raw)
  To: u-boot

The ePAPR specification says that phandle properties should be called
"phandle", and not "linux,phandle".  To facilitate the migration from
"linux,phandle" to "phandle", introduce function fdt_create_phandle(), which
creates a phandle in a given node.  For now, we create both the "phandle" and
"linux,phandle" properties.  A later version of this function will remove
support for "linux,phandle".

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 common/fdt_support.c  |   40 ++++++++++++++++++++++++++++++++++++++++
 include/fdt_support.h |    1 +
 2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 85715ff..dd9deaf 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1201,6 +1201,46 @@ int fdt_alloc_phandle(void *blob)
 	return phandle + 1;
 }
 
+/*
+ * fdt_create_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 ret;
+
+#ifdef DEBUG
+	int off = fdt_node_offset_by_phandle(fdt, phandle);
+
+	if ((off >= 0) && (off != nodeoffset)) {
+		char buf[64];
+
+		fdt_get_path(fdt, nodeoffset, buf, sizeof(buf));
+		printf("Trying to update node %s with phandle %u ",
+		       buf, phandle);
+
+		fdt_get_path(fdt, off, buf, sizeof(buf));
+		printf("that already exists in node %s.\n", buf);
+		return -FDT_ERR_BADPHANDLE;
+	}
+#endif
+
+	ret = fdt_setprop_cell(fdt, nodeoffset, "phandle", phandle);
+	if (ret < 0)
+		return ret;
+
+	/*
+	 * For now, also set the deprecated "linux,phandle" property, so that we
+	 * don't break older kernels.
+	 */
+	ret = fdt_setprop_cell(fdt, nodeoffset, "linux,phandle", phandle);
+
+	return ret;
+}
+
 #if defined(CONFIG_VIDEO)
 int fdt_add_edid(void *blob, const char *compat, unsigned char *edid_buf)
 {
diff --git a/include/fdt_support.h b/include/fdt_support.h
index ce6817b..366062f 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -88,6 +88,7 @@ u64 fdt_translate_address(void *blob, int node_offset, const u32 *in_addr);
 int fdt_node_offset_by_compat_reg(void *blob, const char *compat,
 					phys_addr_t compat_off);
 int fdt_alloc_phandle(void *blob);
+int fdt_create_phandle(void *fdt, int nodeoffset, uint32_t phandle);
 int fdt_add_edid(void *blob, const char *compat, unsigned char *buf);
 
 #endif /* ifdef CONFIG_OF_LIBFDT */
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/2] [v2] powerpc/85xx: add support the ePAPR "phandle" property
  2011-05-10 20:14 [U-Boot] [PATCH 1/2] fdt: introduce fdt_create_phandle() Timur Tabi
@ 2011-05-10 20:14 ` Timur Tabi
  2011-05-10 20:24   ` Wolfgang Denk
  2011-07-14 13:31 ` [U-Boot] [PATCH 1/2] fdt: introduce fdt_create_phandle() Kumar Gala
  2011-07-15  2:58 ` Jerry Van Baren
  2 siblings, 1 reply; 7+ messages in thread
From: Timur Tabi @ 2011-05-10 20:14 UTC (permalink / raw)
  To: u-boot

The ePAPR specification says that phandle properties should be called
"phandle", and not "linux,phandle".  To facilitate the migration from
"linux,phandle" to "phandle", we update fdt_qportal() to use the new function,
fdt_create_phandle().  This function abstracts the creation of phandle
properties.

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 arch/powerpc/cpu/mpc85xx/portals.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/portals.c b/arch/powerpc/cpu/mpc85xx/portals.c
index c014163..4325f45 100644
--- a/arch/powerpc/cpu/mpc85xx/portals.c
+++ b/arch/powerpc/cpu/mpc85xx/portals.c
@@ -151,8 +151,9 @@ static int fdt_qportal(void *blob, int off, int id, char *name,
 			dev_handle = fdt_get_phandle(blob, dev_off);
 			if (dev_handle <= 0) {
 				dev_handle = fdt_alloc_phandle(blob);
-				fdt_setprop_cell(blob, dev_off,
-					"linux,phandle", dev_handle);
+				ret = fdt_create_phandle(blob, dev_off, dev_handle);
+				if (ret < 0)
+					return ret;
 			}
 
 			ret = fdt_setprop(blob, childoff, "dev-handle",
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/2] [v2] powerpc/85xx: add support the ePAPR "phandle" property
  2011-05-10 20:14 ` [U-Boot] [PATCH 2/2] [v2] powerpc/85xx: add support the ePAPR "phandle" property Timur Tabi
@ 2011-05-10 20:24   ` Wolfgang Denk
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2011-05-10 20:24 UTC (permalink / raw)
  To: u-boot

Dear Timur Tabi,

In message <1305058491-19720-2-git-send-email-timur@freescale.com> you wrote:
> The ePAPR specification says that phandle properties should be called
> "phandle", and not "linux,phandle".  To facilitate the migration from
> "linux,phandle" to "phandle", we update fdt_qportal() to use the new function,
> fdt_create_phandle().  This function abstracts the creation of phandle
> properties.
> 
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
>  arch/powerpc/cpu/mpc85xx/portals.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/cpu/mpc85xx/portals.c b/arch/powerpc/cpu/mpc85xx/portals.c
> index c014163..4325f45 100644
> --- a/arch/powerpc/cpu/mpc85xx/portals.c
> +++ b/arch/powerpc/cpu/mpc85xx/portals.c
> @@ -151,8 +151,9 @@ static int fdt_qportal(void *blob, int off, int id, char *name,
>  			dev_handle = fdt_get_phandle(blob, dev_off);
>  			if (dev_handle <= 0) {
>  				dev_handle = fdt_alloc_phandle(blob);
> -				fdt_setprop_cell(blob, dev_off,
> -					"linux,phandle", dev_handle);
> +				ret = fdt_create_phandle(blob, dev_off, dev_handle);

Line too long.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Power is danger.
	-- The Centurion, "Balance of Terror", stardate 1709.2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/2] fdt: introduce fdt_create_phandle()
  2011-05-10 20:14 [U-Boot] [PATCH 1/2] fdt: introduce fdt_create_phandle() Timur Tabi
  2011-05-10 20:14 ` [U-Boot] [PATCH 2/2] [v2] powerpc/85xx: add support the ePAPR "phandle" property Timur Tabi
@ 2011-07-14 13:31 ` Kumar Gala
  2011-07-14 14:01   ` Gerald Van Baren
  2011-07-15  2:58 ` Jerry Van Baren
  2 siblings, 1 reply; 7+ messages in thread
From: Kumar Gala @ 2011-07-14 13:31 UTC (permalink / raw)
  To: u-boot


On May 10, 2011, at 3:14 PM, Timur Tabi wrote:

> The ePAPR specification says that phandle properties should be called
> "phandle", and not "linux,phandle".  To facilitate the migration from
> "linux,phandle" to "phandle", introduce function fdt_create_phandle(), which
> creates a phandle in a given node.  For now, we create both the "phandle" and
> "linux,phandle" properties.  A later version of this function will remove
> support for "linux,phandle".
> 
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
> common/fdt_support.c  |   40 ++++++++++++++++++++++++++++++++++++++++
> include/fdt_support.h |    1 +
> 2 files changed, 41 insertions(+), 0 deletions(-)

Jerry,

Any comments on this?

- k

> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index 85715ff..dd9deaf 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -1201,6 +1201,46 @@ int fdt_alloc_phandle(void *blob)
> 	return phandle + 1;
> }
> 
> +/*
> + * fdt_create_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 ret;
> +
> +#ifdef DEBUG
> +	int off = fdt_node_offset_by_phandle(fdt, phandle);
> +
> +	if ((off >= 0) && (off != nodeoffset)) {
> +		char buf[64];
> +
> +		fdt_get_path(fdt, nodeoffset, buf, sizeof(buf));
> +		printf("Trying to update node %s with phandle %u ",
> +		       buf, phandle);
> +
> +		fdt_get_path(fdt, off, buf, sizeof(buf));
> +		printf("that already exists in node %s.\n", buf);
> +		return -FDT_ERR_BADPHANDLE;
> +	}
> +#endif
> +
> +	ret = fdt_setprop_cell(fdt, nodeoffset, "phandle", phandle);
> +	if (ret < 0)
> +		return ret;
> +
> +	/*
> +	 * For now, also set the deprecated "linux,phandle" property, so that we
> +	 * don't break older kernels.
> +	 */
> +	ret = fdt_setprop_cell(fdt, nodeoffset, "linux,phandle", phandle);
> +
> +	return ret;
> +}
> +
> #if defined(CONFIG_VIDEO)
> int fdt_add_edid(void *blob, const char *compat, unsigned char *edid_buf)
> {
> diff --git a/include/fdt_support.h b/include/fdt_support.h
> index ce6817b..366062f 100644
> --- a/include/fdt_support.h
> +++ b/include/fdt_support.h
> @@ -88,6 +88,7 @@ u64 fdt_translate_address(void *blob, int node_offset, const u32 *in_addr);
> int fdt_node_offset_by_compat_reg(void *blob, const char *compat,
> 					phys_addr_t compat_off);
> int fdt_alloc_phandle(void *blob);
> +int fdt_create_phandle(void *fdt, int nodeoffset, uint32_t phandle);
> int fdt_add_edid(void *blob, const char *compat, unsigned char *buf);
> 
> #endif /* ifdef CONFIG_OF_LIBFDT */
> -- 
> 1.7.3.4
> 
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/2] fdt: introduce fdt_create_phandle()
  2011-07-14 13:31 ` [U-Boot] [PATCH 1/2] fdt: introduce fdt_create_phandle() Kumar Gala
@ 2011-07-14 14:01   ` Gerald Van Baren
  2011-07-14 14:19     ` Kumar Gala
  0 siblings, 1 reply; 7+ messages in thread
From: Gerald Van Baren @ 2011-07-14 14:01 UTC (permalink / raw)
  To: u-boot

On 07/14/2011 09:31 AM, Kumar Gala wrote:
>
> On May 10, 2011, at 3:14 PM, Timur Tabi wrote:
>
>> The ePAPR specification says that phandle properties should be called
>> "phandle", and not "linux,phandle".  To facilitate the migration from
>> "linux,phandle" to "phandle", introduce function fdt_create_phandle(), which
>> creates a phandle in a given node.  For now, we create both the "phandle" and
>> "linux,phandle" properties.  A later version of this function will remove
>> support for "linux,phandle".
>>
>> Signed-off-by: Timur Tabi<timur@freescale.com>
>> ---
>> common/fdt_support.c  |   40 ++++++++++++++++++++++++++++++++++++++++
>> include/fdt_support.h |    1 +
>> 2 files changed, 41 insertions(+), 0 deletions(-)
>
> Jerry,
>
> Any comments on this?
>
> - k

I put it in my todo list on patchworks.  What I have queued are two 
patches from upstream
   0329-Support-ePAPR-compliant-phandle-properties.patch
   0344-libfdt-Implement-property-iteration-functions.patch
and...

[U-Boot,v2] Add uboot "fdt_high" enviroment variable 	2011-07-09 	David 
A. Long 	gvb 	New
[U-Boot,2/2,v3] powerpc/85xx: add support the ePAPR "phandle" property 
2011-05-10 	Timur Tabi 	gvb 	New
[U-Boot,1/2] fdt: introduce fdt_create_phandle() 	2011-05-10 	Timur 
Tabi 	gvb 	New
[U-Boot,1/2] fdt: add prototype for fdt_increase_size() 	2011-05-03 
Timur Tabi 	gvb 	New
[U-Boot,1/2,v2] fdt: introduce fdt_verify_alias_address() and 
fdt_get_base_address() 	2011-05-03 	Timur Tabi 	gvb 	New

Hollor if I'm missing something.

Thanks,
gvb

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/2] fdt: introduce fdt_create_phandle()
  2011-07-14 14:01   ` Gerald Van Baren
@ 2011-07-14 14:19     ` Kumar Gala
  0 siblings, 0 replies; 7+ messages in thread
From: Kumar Gala @ 2011-07-14 14:19 UTC (permalink / raw)
  To: u-boot


On Jul 14, 2011, at 9:01 AM, Gerald Van Baren wrote:

> On 07/14/2011 09:31 AM, Kumar Gala wrote:
>> 
>> On May 10, 2011, at 3:14 PM, Timur Tabi wrote:
>> 
>>> The ePAPR specification says that phandle properties should be called
>>> "phandle", and not "linux,phandle".  To facilitate the migration from
>>> "linux,phandle" to "phandle", introduce function fdt_create_phandle(), which
>>> creates a phandle in a given node.  For now, we create both the "phandle" and
>>> "linux,phandle" properties.  A later version of this function will remove
>>> support for "linux,phandle".
>>> 
>>> Signed-off-by: Timur Tabi<timur@freescale.com>
>>> ---
>>> common/fdt_support.c  |   40 ++++++++++++++++++++++++++++++++++++++++
>>> include/fdt_support.h |    1 +
>>> 2 files changed, 41 insertions(+), 0 deletions(-)
>> 
>> Jerry,
>> 
>> Any comments on this?
>> 
>> - k
> 
> I put it in my todo list on patchworks.  What I have queued are two 
> patches from upstream
>   0329-Support-ePAPR-compliant-phandle-properties.patch
>   0344-libfdt-Implement-property-iteration-functions.patch
> and...
> 
> [U-Boot,v2] Add uboot "fdt_high" enviroment variable 	2011-07-09 	David 
> A. Long 	gvb 	New
> [U-Boot,2/2,v3] powerpc/85xx: add support the ePAPR "phandle" property 
> 2011-05-10 	Timur Tabi 	gvb 	New
> [U-Boot,1/2] fdt: introduce fdt_create_phandle() 	2011-05-10 	Timur 
> Tabi 	gvb 	New
> [U-Boot,1/2] fdt: add prototype for fdt_increase_size() 	2011-05-03 
> Timur Tabi 	gvb 	New
> [U-Boot,1/2,v2] fdt: introduce fdt_verify_alias_address() and 
> fdt_get_base_address() 	2011-05-03 	Timur Tabi 	gvb 	New

I'd add:

http://patchwork.ozlabs.org/patch/103598/

at least for a review/ack.

- k

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/2] fdt: introduce fdt_create_phandle()
  2011-05-10 20:14 [U-Boot] [PATCH 1/2] fdt: introduce fdt_create_phandle() Timur Tabi
  2011-05-10 20:14 ` [U-Boot] [PATCH 2/2] [v2] powerpc/85xx: add support the ePAPR "phandle" property Timur Tabi
  2011-07-14 13:31 ` [U-Boot] [PATCH 1/2] fdt: introduce fdt_create_phandle() Kumar Gala
@ 2011-07-15  2:58 ` Jerry Van Baren
  2 siblings, 0 replies; 7+ messages in thread
From: Jerry Van Baren @ 2011-07-15  2:58 UTC (permalink / raw)
  To: u-boot

On 05/10/2011 04:14 PM, Timur Tabi wrote:
> The ePAPR specification says that phandle properties should be called
> "phandle", and not "linux,phandle".  To facilitate the migration from
> "linux,phandle" to "phandle", introduce function fdt_create_phandle(), which
> creates a phandle in a given node.  For now, we create both the "phandle" and
> "linux,phandle" properties.  A later version of this function will remove
> support for "linux,phandle".
>
> Signed-off-by: Timur Tabi<timur@freescale.com>
> ---
>   common/fdt_support.c  |   40 ++++++++++++++++++++++++++++++++++++++++
>   include/fdt_support.h |    1 +
>   2 files changed, 41 insertions(+), 0 deletions(-)

Applied to u-boot-fdt.

Thanks,
gvb

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-07-15  2:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-10 20:14 [U-Boot] [PATCH 1/2] fdt: introduce fdt_create_phandle() Timur Tabi
2011-05-10 20:14 ` [U-Boot] [PATCH 2/2] [v2] powerpc/85xx: add support the ePAPR "phandle" property Timur Tabi
2011-05-10 20:24   ` Wolfgang Denk
2011-07-14 13:31 ` [U-Boot] [PATCH 1/2] fdt: introduce fdt_create_phandle() Kumar Gala
2011-07-14 14:01   ` Gerald Van Baren
2011-07-14 14:19     ` Kumar Gala
2011-07-15  2:58 ` Jerry Van Baren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.