public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] fdt helper cleanup related to phandle support.
@ 2011-08-01  6:22 Kumar Gala
  2011-08-01  6:23 ` [U-Boot] [PATCH 1/2] fdt: Rename fdt_create_phandle to fdt_set_phandle Kumar Gala
  2011-08-26 19:11 ` [U-Boot] [PATCH 0/2] fdt helper cleanup related to phandle support Kumar Gala
  0 siblings, 2 replies; 6+ messages in thread
From: Kumar Gala @ 2011-08-01  6:22 UTC (permalink / raw)
  To: u-boot

Jerry,

Please review and Ack.  I would like this to go via 85xx tree as the
fman ethernet driver code depends on these changes.

thanks

- k

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

* [U-Boot] [PATCH 1/2] fdt: Rename fdt_create_phandle to fdt_set_phandle
  2011-08-01  6:22 [U-Boot] [PATCH 0/2] fdt helper cleanup related to phandle support Kumar Gala
@ 2011-08-01  6:23 ` Kumar Gala
  2011-08-01  6:23   ` [U-Boot] [PATCH 2/2] fdt: Add new fdt_create_phandle helper Kumar Gala
  2011-08-02  2:14   ` [U-Boot] [PATCH 1/2] fdt: Rename fdt_create_phandle to fdt_set_phandle Jerry Van Baren
  2011-08-26 19:11 ` [U-Boot] [PATCH 0/2] fdt helper cleanup related to phandle support Kumar Gala
  1 sibling, 2 replies; 6+ messages in thread
From: Kumar Gala @ 2011-08-01  6:23 UTC (permalink / raw)
  To: u-boot

The old fdt_create_phandle didn't actually create a phandle it just
set one.  We'll introduce a new helper that actually does creation.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/cpu/mpc85xx/portals.c |    2 +-
 common/fdt_support.c               |    6 +++---
 include/fdt_support.h              |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/portals.c b/arch/powerpc/cpu/mpc85xx/portals.c
index 65635e7..418dd9d 100644
--- a/arch/powerpc/cpu/mpc85xx/portals.c
+++ b/arch/powerpc/cpu/mpc85xx/portals.c
@@ -151,7 +151,7 @@ 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);
-				ret = fdt_create_phandle(blob, dev_off,
+				ret = fdt_set_phandle(blob, dev_off,
 							 dev_handle);
 				if (ret < 0)
 					return ret;
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 19b2ef6..8f7323d 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;
 
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 863024f..fdb9307 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -89,7 +89,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_set_phandle(void *fdt, int nodeoffset, uint32_t phandle);
 int fdt_add_edid(void *blob, const char *compat, unsigned char *buf);
 
 int fdt_verify_alias_address(void *fdt, int anode, const char *alias,
-- 
1.7.3.4

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

* [U-Boot] [PATCH 2/2] fdt: Add new fdt_create_phandle helper
  2011-08-01  6:23 ` [U-Boot] [PATCH 1/2] fdt: Rename fdt_create_phandle to fdt_set_phandle Kumar Gala
@ 2011-08-01  6:23   ` Kumar Gala
  2011-08-02  2:15     ` Jerry Van Baren
  2011-08-02  2:14   ` [U-Boot] [PATCH 1/2] fdt: Rename fdt_create_phandle to fdt_set_phandle Jerry Van Baren
  1 sibling, 1 reply; 6+ messages in thread
From: Kumar Gala @ 2011-08-01  6:23 UTC (permalink / raw)
  To: u-boot

Add a helper function that will return a phandle value for the given
node.  If the node doesn't have a phandle already one will be created.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 common/fdt_support.c  |   20 ++++++++++++++++++++
 include/fdt_support.h |    1 +
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 8f7323d..46aa842 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1235,6 +1235,26 @@ int fdt_set_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)
 {
diff --git a/include/fdt_support.h b/include/fdt_support.h
index fdb9307..8f06aac 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -90,6 +90,7 @@ 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_set_phandle(void *fdt, int nodeoffset, uint32_t phandle);
+int fdt_create_phandle(void *fdt, int nodeoffset);
 int fdt_add_edid(void *blob, const char *compat, unsigned char *buf);
 
 int fdt_verify_alias_address(void *fdt, int anode, const char *alias,
-- 
1.7.3.4

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

* [U-Boot] [PATCH 1/2] fdt: Rename fdt_create_phandle to fdt_set_phandle
  2011-08-01  6:23 ` [U-Boot] [PATCH 1/2] fdt: Rename fdt_create_phandle to fdt_set_phandle Kumar Gala
  2011-08-01  6:23   ` [U-Boot] [PATCH 2/2] fdt: Add new fdt_create_phandle helper Kumar Gala
@ 2011-08-02  2:14   ` Jerry Van Baren
  1 sibling, 0 replies; 6+ messages in thread
From: Jerry Van Baren @ 2011-08-02  2:14 UTC (permalink / raw)
  To: u-boot

On 08/01/2011 02:23 AM, Kumar Gala wrote:
> The old fdt_create_phandle didn't actually create a phandle it just
> set one.  We'll introduce a new helper that actually does creation.
>
> Signed-off-by: Kumar Gala<galak@kernel.crashing.org>

Acked-by: Gerald Van Baren <vanbaren@cideas.com>

> ---
>   arch/powerpc/cpu/mpc85xx/portals.c |    2 +-
>   common/fdt_support.c               |    6 +++---
>   include/fdt_support.h              |    2 +-
>   3 files changed, 5 insertions(+), 5 deletions(-)

[snip]

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

* [U-Boot] [PATCH 2/2] fdt: Add new fdt_create_phandle helper
  2011-08-01  6:23   ` [U-Boot] [PATCH 2/2] fdt: Add new fdt_create_phandle helper Kumar Gala
@ 2011-08-02  2:15     ` Jerry Van Baren
  0 siblings, 0 replies; 6+ messages in thread
From: Jerry Van Baren @ 2011-08-02  2:15 UTC (permalink / raw)
  To: u-boot

On 08/01/2011 02:23 AM, Kumar Gala wrote:
> Add a helper function that will return a phandle value for the given
> node.  If the node doesn't have a phandle already one will be created.
>
> Signed-off-by: Kumar Gala<galak@kernel.crashing.org>

Acked-by: Gerald Van Baren <vanbaren@cideas.com>

> ---
>   common/fdt_support.c  |   20 ++++++++++++++++++++
>   include/fdt_support.h |    1 +
>   2 files changed, 21 insertions(+), 0 deletions(-)

[snip]

Thanks,
gvb

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

* [U-Boot] [PATCH 0/2] fdt helper cleanup related to phandle support.
  2011-08-01  6:22 [U-Boot] [PATCH 0/2] fdt helper cleanup related to phandle support Kumar Gala
  2011-08-01  6:23 ` [U-Boot] [PATCH 1/2] fdt: Rename fdt_create_phandle to fdt_set_phandle Kumar Gala
@ 2011-08-26 19:11 ` Kumar Gala
  1 sibling, 0 replies; 6+ messages in thread
From: Kumar Gala @ 2011-08-26 19:11 UTC (permalink / raw)
  To: u-boot


On Aug 1, 2011, at 1:22 AM, Kumar Gala wrote:

> Jerry,
> 
> Please review and Ack.  I would like this to go via 85xx tree as the
> fman ethernet driver code depends on these changes.
> 
> thanks

applied to 85xx next

- k

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

end of thread, other threads:[~2011-08-26 19:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-01  6:22 [U-Boot] [PATCH 0/2] fdt helper cleanup related to phandle support Kumar Gala
2011-08-01  6:23 ` [U-Boot] [PATCH 1/2] fdt: Rename fdt_create_phandle to fdt_set_phandle Kumar Gala
2011-08-01  6:23   ` [U-Boot] [PATCH 2/2] fdt: Add new fdt_create_phandle helper Kumar Gala
2011-08-02  2:15     ` Jerry Van Baren
2011-08-02  2:14   ` [U-Boot] [PATCH 1/2] fdt: Rename fdt_create_phandle to fdt_set_phandle Jerry Van Baren
2011-08-26 19:11 ` [U-Boot] [PATCH 0/2] fdt helper cleanup related to phandle support Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox