diff mbox series

[U-Boot,v3,2/2] core: ofnode: Add ofnode_get_addr_size_index

Message ID 1542608088-27843-3-git-send-email-j-keerthy@ti.com
State Accepted
Delegated to: Simon Glass
Headers show
Series core: ofnode: Fix ofnode_get_addr_index function | expand

Commit Message

J, KEERTHY Nov. 19, 2018, 6:14 a.m. UTC
Add ofnode_get_addr_size_index function to fetch the address
and size of the reg space based on index.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 drivers/core/ofnode.c | 14 ++++++++++----
 include/dm/ofnode.h   | 14 ++++++++++++++
 2 files changed, 24 insertions(+), 4 deletions(-)

Comments

Simon Glass Nov. 29, 2018, 5:42 p.m. UTC | #1
Add ofnode_get_addr_size_index function to fetch the address
and size of the reg space based on index.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 drivers/core/ofnode.c | 14 ++++++++++----
 include/dm/ofnode.h   | 14 ++++++++++++++
 2 files changed, 24 insertions(+), 4 deletions(-)

Applied to u-boot-dm/master, thanks!
Lokesh Vutla Dec. 10, 2018, 1:45 p.m. UTC | #2
Hi Simon,

On 29/11/18 11:12 PM, sjg@google.com wrote:
> Add ofnode_get_addr_size_index function to fetch the address
> and size of the reg space based on index.
> 
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> ---
>   drivers/core/ofnode.c | 14 ++++++++++----
>   include/dm/ofnode.h   | 14 ++++++++++++++
>   2 files changed, 24 insertions(+), 4 deletions(-)
> 
> Applied to u-boot-dm/master, thanks!
> 

I do not see this patch in master branch. Any reason why this is dropped?

Thanks and regards,
Lokesh
Tom Rini Dec. 10, 2018, 1:55 p.m. UTC | #3
On Mon, Dec 10, 2018 at 07:15:17PM +0530, Lokesh Vutla wrote:
> Hi Simon,
> 
> On 29/11/18 11:12 PM, sjg@google.com wrote:
> >Add ofnode_get_addr_size_index function to fetch the address
> >and size of the reg space based on index.
> >
> >Signed-off-by: Keerthy <j-keerthy@ti.com>
> >---
> >  drivers/core/ofnode.c | 14 ++++++++++----
> >  include/dm/ofnode.h   | 14 ++++++++++++++
> >  2 files changed, 24 insertions(+), 4 deletions(-)
> >
> >Applied to u-boot-dm/master, thanks!
> >
> 
> I do not see this patch in master branch. Any reason why this is dropped?

As I reported in https://patchwork.ozlabs.org/patch/1005644/ this breaks
test.py on sandbox for non-obvious reasons and Keerthy said they'll look
into it.
J, KEERTHY Feb. 21, 2019, 10:41 a.m. UTC | #4
On 10/12/18 7:25 PM, Tom Rini wrote:
> On Mon, Dec 10, 2018 at 07:15:17PM +0530, Lokesh Vutla wrote:
>> Hi Simon,
>>
>> On 29/11/18 11:12 PM, sjg@google.com wrote:
>>> Add ofnode_get_addr_size_index function to fetch the address
>>> and size of the reg space based on index.
>>>
>>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>>> ---
>>>  drivers/core/ofnode.c | 14 ++++++++++----
>>>  include/dm/ofnode.h   | 14 ++++++++++++++
>>>  2 files changed, 24 insertions(+), 4 deletions(-)
>>>
>>> Applied to u-boot-dm/master, thanks!
>>>
>>
>> I do not see this patch in master branch. Any reason why this is dropped?
> 
> As I reported in https://patchwork.ozlabs.org/patch/1005644/ this breaks
> test.py on sandbox for non-obvious reasons and Keerthy said they'll look
> into it.

Tom,

Failing case as pointed previously:

https://travis-ci.org/trini/u-boot/jobs/461494951

I applied the same patch on latest master and here are the results:

https://travis-ci.org/lokeshvutla/u-boot/builds/496417722


the clang test.py test cases pass with this patch applied on latest
master. Please let me know if this patch still causes issues if i need
to trigger different tests.

I will resend this patch on top of master if your tests are okay.

Regards,
Keerthy
>
diff mbox series

Patch

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 0e584c1..db29a33 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -251,17 +251,16 @@  int ofnode_read_size(ofnode node, const char *propname)
 	return -EINVAL;
 }
 
-fdt_addr_t ofnode_get_addr_index(ofnode node, int index)
+fdt_addr_t ofnode_get_addr_size_index(ofnode node, int index, fdt_size_t *size)
 {
 	int na, ns;
-	fdt_size_t size;
 
 	if (ofnode_is_np(node)) {
 		const __be32 *prop_val;
 		uint flags;
 
 		prop_val = of_get_address(ofnode_to_np(node), index,
-					  (u64 *)&size, &flags);
+					  (u64 *)size, &flags);
 		if (!prop_val)
 			return FDT_ADDR_T_NONE;
 
@@ -278,12 +277,19 @@  fdt_addr_t ofnode_get_addr_index(ofnode node, int index)
 		ns = ofnode_read_simple_size_cells(ofnode_get_parent(node));
 		return fdtdec_get_addr_size_fixed(gd->fdt_blob,
 						  ofnode_to_offset(node), "reg",
-						  index, na, ns, &size, true);
+						  index, na, ns, size, true);
 	}
 
 	return FDT_ADDR_T_NONE;
 }
 
+fdt_addr_t ofnode_get_addr_index(ofnode node, int index)
+{
+	fdt_size_t size;
+
+	return ofnode_get_addr_size_index(node, index, &size);
+}
+
 fdt_addr_t ofnode_get_addr(ofnode node)
 {
 	return ofnode_get_addr_index(node, 0);
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 2fc9fa3..8bfe062 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -356,6 +356,20 @@  int ofnode_read_size(ofnode node, const char *propname);
 phys_addr_t ofnode_get_addr_index(ofnode node, int index);
 
 /**
+ * ofnode_get_addr_size_index() - get an address/size from a node
+ *				  based on index
+ *
+ * This reads the register address from a node
+ *
+ * @node: node to read from
+ * @index: Index of address to read (0 for first)
+ * @size: Pointer to size of the address
+ * @return address, or FDT_ADDR_T_NONE if not present or invalid
+ */
+phys_addr_t ofnode_get_addr_size_index(ofnode node, int index,
+				       fdt_size_t *size);
+
+/**
  * ofnode_get_addr() - get an address from a node
  *
  * This reads the register address from a node