All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function
@ 2018-11-05  5:47 Keerthy
  2018-11-05  5:47 ` [U-Boot] [PATCH 2/2] core: ofnode: Add ofnode_get_addr_size_index Keerthy
  2018-11-13 19:53 ` [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function Simon Glass
  0 siblings, 2 replies; 9+ messages in thread
From: Keerthy @ 2018-11-05  5:47 UTC (permalink / raw)
  To: u-boot

Currently the else part of ofnode_get_addr_size_index function
does not fetch addresses based on the index but rather just
returns the base address. Fix that.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 drivers/core/ofnode.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index b7b7ad3..c80e1cb 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -253,12 +253,12 @@ int ofnode_read_size(ofnode node, const char *propname)
 
 fdt_addr_t ofnode_get_addr_index(ofnode node, int index)
 {
+	int na, ns;
+	u64 size;
+
 	if (ofnode_is_np(node)) {
 		const __be32 *prop_val;
 		uint flags;
-		u64 size;
-		int na;
-		int ns;
 
 		prop_val = of_get_address(ofnode_to_np(node), index, &size,
 					  &flags);
@@ -274,8 +274,11 @@ fdt_addr_t ofnode_get_addr_index(ofnode node, int index)
 			return of_read_number(prop_val, na);
 		}
 	} else {
-		return fdt_get_base_address(gd->fdt_blob,
-					    ofnode_to_offset(node));
+		na = ofnode_read_simple_addr_cells(ofnode_get_parent(node));
+		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);
 	}
 
 	return FDT_ADDR_T_NONE;
-- 
1.9.1

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

* [U-Boot] [PATCH 2/2] core: ofnode: Add ofnode_get_addr_size_index
  2018-11-05  5:47 [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function Keerthy
@ 2018-11-05  5:47 ` Keerthy
  2018-11-05  5:53   ` Keerthy
  2018-11-13 19:53 ` [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function Simon Glass
  1 sibling, 1 reply; 9+ messages in thread
From: Keerthy @ 2018-11-05  5:47 UTC (permalink / raw)
  To: u-boot

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 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index c80e1cb..b98b0b9 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -251,16 +251,15 @@ 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, u64 *size)
 {
 	int na, ns;
-	u64 size;
 
 	if (ofnode_is_np(node)) {
 		const __be32 *prop_val;
 		uint flags;
 
-		prop_val = of_get_address(ofnode_to_np(node), index, &size,
+		prop_val = of_get_address(ofnode_to_np(node), index, 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)
+{
+	u64 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);
-- 
1.9.1

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

* [U-Boot] [PATCH 2/2] core: ofnode: Add ofnode_get_addr_size_index
  2018-11-05  5:47 ` [U-Boot] [PATCH 2/2] core: ofnode: Add ofnode_get_addr_size_index Keerthy
@ 2018-11-05  5:53   ` Keerthy
  0 siblings, 0 replies; 9+ messages in thread
From: Keerthy @ 2018-11-05  5:53 UTC (permalink / raw)
  To: u-boot



On Monday 05 November 2018 11:17 AM, Keerthy wrote:
> Add ofnode_get_addr_size_index function to fetch the address
> and size of the reg space based on index.

I missed the header file hunk. I will send v2 in a bit.

> 
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> ---
>  drivers/core/ofnode.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> index c80e1cb..b98b0b9 100644
> --- a/drivers/core/ofnode.c
> +++ b/drivers/core/ofnode.c
> @@ -251,16 +251,15 @@ 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, u64 *size)
>  {
>  	int na, ns;
> -	u64 size;
>  
>  	if (ofnode_is_np(node)) {
>  		const __be32 *prop_val;
>  		uint flags;
>  
> -		prop_val = of_get_address(ofnode_to_np(node), index, &size,
> +		prop_val = of_get_address(ofnode_to_np(node), index, 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)
> +{
> +	u64 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);
> 

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

* [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function
  2018-11-05  5:47 [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function Keerthy
  2018-11-05  5:47 ` [U-Boot] [PATCH 2/2] core: ofnode: Add ofnode_get_addr_size_index Keerthy
@ 2018-11-13 19:53 ` Simon Glass
  2018-11-17  0:09   ` Simon Glass
  1 sibling, 1 reply; 9+ messages in thread
From: Simon Glass @ 2018-11-13 19:53 UTC (permalink / raw)
  To: u-boot

On 4 November 2018 at 22:47, Keerthy <j-keerthy@ti.com> wrote:
> Currently the else part of ofnode_get_addr_size_index function
> does not fetch addresses based on the index but rather just
> returns the base address. Fix that.
>
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> ---
>  drivers/core/ofnode.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

This should really have a sandbox test, e.g. see
dm_test_fdt_remap_addr_flat,() for a test that relies on flagtree.

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

* [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function
  2018-11-13 19:53 ` [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function Simon Glass
@ 2018-11-17  0:09   ` Simon Glass
  2018-11-18 21:29     ` Simon Glass
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Glass @ 2018-11-17  0:09 UTC (permalink / raw)
  To: u-boot

On Tue, 13 Nov 2018 at 12:53, Simon Glass <sjg@chromium.org> wrote:
>
> On 4 November 2018 at 22:47, Keerthy <j-keerthy@ti.com> wrote:
> > Currently the else part of ofnode_get_addr_size_index function
> > does not fetch addresses based on the index but rather just
> > returns the base address. Fix that.
> >
> > Signed-off-by: Keerthy <j-keerthy@ti.com>
> > ---
> >  drivers/core/ofnode.c | 13 ++++++++-----
> >  1 file changed, 8 insertions(+), 5 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> This should really have a sandbox test, e.g. see
> dm_test_fdt_remap_addr_flat,() for a test that relies on flagtree.

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function
  2018-11-17  0:09   ` Simon Glass
@ 2018-11-18 21:29     ` Simon Glass
  2018-11-19  5:17       ` J, KEERTHY
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Glass @ 2018-11-18 21:29 UTC (permalink / raw)
  To: u-boot

Hi Keerthy,

On Fri, 16 Nov 2018 at 17:09, Simon Glass <sjg@chromium.org> wrote:
>
> On Tue, 13 Nov 2018 at 12:53, Simon Glass <sjg@chromium.org> wrote:
> >
> > On 4 November 2018 at 22:47, Keerthy <j-keerthy@ti.com> wrote:
> > > Currently the else part of ofnode_get_addr_size_index function
> > > does not fetch addresses based on the index but rather just
> > > returns the base address. Fix that.
> > >
> > > Signed-off-by: Keerthy <j-keerthy@ti.com>
> > > ---
> > >  drivers/core/ofnode.c | 13 ++++++++-----
> > >  1 file changed, 8 insertions(+), 5 deletions(-)
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> > This should really have a sandbox test, e.g. see
> > dm_test_fdt_remap_addr_flat,() for a test that relies on flagtree.
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Unfortunately this patch causes build errors with sandbox. Can you
please take a look? I skip the second patch in this series too, since
it depends on this one.

Regards,
Simon

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

* [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function
  2018-11-18 21:29     ` Simon Glass
@ 2018-11-19  5:17       ` J, KEERTHY
  2018-11-19  6:18         ` J, KEERTHY
  0 siblings, 1 reply; 9+ messages in thread
From: J, KEERTHY @ 2018-11-19  5:17 UTC (permalink / raw)
  To: u-boot



On 11/19/2018 2:59 AM, Simon Glass wrote:
> Hi Keerthy,
> 
> On Fri, 16 Nov 2018 at 17:09, Simon Glass <sjg@chromium.org> wrote:
>>
>> On Tue, 13 Nov 2018 at 12:53, Simon Glass <sjg@chromium.org> wrote:
>>>
>>> On 4 November 2018 at 22:47, Keerthy <j-keerthy@ti.com> wrote:
>>>> Currently the else part of ofnode_get_addr_size_index function
>>>> does not fetch addresses based on the index but rather just
>>>> returns the base address. Fix that.
>>>>
>>>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>>>> ---
>>>>   drivers/core/ofnode.c | 13 ++++++++-----
>>>>   1 file changed, 8 insertions(+), 5 deletions(-)
>>>
>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>
>>> This should really have a sandbox test, e.g. see
>>> dm_test_fdt_remap_addr_flat,() for a test that relies on flagtree.
>>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> Unfortunately this patch causes build errors with sandbox. Can you
> please take a look? I skip the second patch in this series too, since
> it depends on this one.

Sure. Thanks for catching it.

> 
> Regards,
> Simon
> 

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

* [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function
  2018-11-19  5:17       ` J, KEERTHY
@ 2018-11-19  6:18         ` J, KEERTHY
  0 siblings, 0 replies; 9+ messages in thread
From: J, KEERTHY @ 2018-11-19  6:18 UTC (permalink / raw)
  To: u-boot



On 11/19/2018 10:47 AM, J, KEERTHY wrote:
> 
> 
> On 11/19/2018 2:59 AM, Simon Glass wrote:
>> Hi Keerthy,
>>
>> On Fri, 16 Nov 2018 at 17:09, Simon Glass <sjg@chromium.org> wrote:
>>>
>>> On Tue, 13 Nov 2018 at 12:53, Simon Glass <sjg@chromium.org> wrote:
>>>>
>>>> On 4 November 2018 at 22:47, Keerthy <j-keerthy@ti.com> wrote:
>>>>> Currently the else part of ofnode_get_addr_size_index function
>>>>> does not fetch addresses based on the index but rather just
>>>>> returns the base address. Fix that.
>>>>>
>>>>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>>>>> ---
>>>>>   drivers/core/ofnode.c | 13 ++++++++-----
>>>>>   1 file changed, 8 insertions(+), 5 deletions(-)
>>>>
>>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>>
>>>> This should really have a sandbox test, e.g. see
>>>> dm_test_fdt_remap_addr_flat,() for a test that relies on flagtree.
>>>
>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>
>> Unfortunately this patch causes build errors with sandbox. Can you
>> please take a look? I skip the second patch in this series too, since
>> it depends on this one.
> 
> Sure. Thanks for catching it.

Simon,

Sent a v3 with sandbox_defconfig warnings fixed. Please let me know if 
they are fine.

Thanks,
Keerthy
> 
>>
>> Regards,
>> Simon
>>

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

* [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function
@ 2018-11-05  5:54 Keerthy
  0 siblings, 0 replies; 9+ messages in thread
From: Keerthy @ 2018-11-05  5:54 UTC (permalink / raw)
  To: u-boot

Currently the else part of ofnode_get_addr_size_index function
does not fetch addresses based on the index but rather just
returns the base address. Fix that.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 drivers/core/ofnode.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index b7b7ad3..c80e1cb 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -253,12 +253,12 @@ int ofnode_read_size(ofnode node, const char *propname)
 
 fdt_addr_t ofnode_get_addr_index(ofnode node, int index)
 {
+	int na, ns;
+	u64 size;
+
 	if (ofnode_is_np(node)) {
 		const __be32 *prop_val;
 		uint flags;
-		u64 size;
-		int na;
-		int ns;
 
 		prop_val = of_get_address(ofnode_to_np(node), index, &size,
 					  &flags);
@@ -274,8 +274,11 @@ fdt_addr_t ofnode_get_addr_index(ofnode node, int index)
 			return of_read_number(prop_val, na);
 		}
 	} else {
-		return fdt_get_base_address(gd->fdt_blob,
-					    ofnode_to_offset(node));
+		na = ofnode_read_simple_addr_cells(ofnode_get_parent(node));
+		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);
 	}
 
 	return FDT_ADDR_T_NONE;
-- 
1.9.1

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

end of thread, other threads:[~2018-11-19  6:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-05  5:47 [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function Keerthy
2018-11-05  5:47 ` [U-Boot] [PATCH 2/2] core: ofnode: Add ofnode_get_addr_size_index Keerthy
2018-11-05  5:53   ` Keerthy
2018-11-13 19:53 ` [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function Simon Glass
2018-11-17  0:09   ` Simon Glass
2018-11-18 21:29     ` Simon Glass
2018-11-19  5:17       ` J, KEERTHY
2018-11-19  6:18         ` J, KEERTHY
2018-11-05  5:54 Keerthy

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.