diff mbox

[U-Boot,v2,2/4] regmap: use fdt address translation

Message ID 1486999070-21155-3-git-send-email-jjhiblot@ti.com
State Accepted
Commit 5c8ef359804536e57eb2fff7fd5035ea74a4c40e
Delegated to: Simon Glass
Headers show

Commit Message

Jean-Jacques Hiblot Feb. 13, 2017, 3:17 p.m. UTC
In the DTS, the addresses are defined relative to the parent bus. We need
to translate them to get the address as seen by the CPU core.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
---

to: sjg@chromium.org

 drivers/core/regmap.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Simon Glass Feb. 14, 2017, 5:23 a.m. UTC | #1
Hi,

On 13 February 2017 at 08:17, Jean-Jacques Hiblot <jjhiblot@ti.com> wrote:
> In the DTS, the addresses are defined relative to the parent bus. We need
> to translate them to get the address as seen by the CPU core.
>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> ---
>
> to: sjg@chromium.org
>
>  drivers/core/regmap.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)

This says v2 but I don't see a change log. Can you please resend this?

Regards,
Simon
Jean-Jacques Hiblot Feb. 14, 2017, 10:20 a.m. UTC | #2
On 14/02/2017 06:23, Simon Glass wrote:
> Hi,
>
> On 13 February 2017 at 08:17, Jean-Jacques Hiblot <jjhiblot@ti.com> wrote:
>> In the DTS, the addresses are defined relative to the parent bus. We need
>> to translate them to get the address as seen by the CPU core.
>>
>> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
>> ---
>>
>> to: sjg@chromium.org
>>
>>   drivers/core/regmap.c | 14 ++++++++------
>>   1 file changed, 8 insertions(+), 6 deletions(-)
> This says v2 but I don't see a change log. Can you please resend this?
Hi Simon,

Sorry, I didn't think about sending the whole series to you. The series 
is marked v2 but this particular patch that you and stephen warren have 
already reviewed hasn't changed a bit.

Jean-Jacques
>
> Regards,
> Simon
>
Simon Glass Feb. 16, 2017, 8:43 p.m. UTC | #3
On 14 February 2017 at 03:20, Jean-Jacques Hiblot <jjhiblot@ti.com> wrote:
>
>
> On 14/02/2017 06:23, Simon Glass wrote:
>>
>> Hi,
>>
>> On 13 February 2017 at 08:17, Jean-Jacques Hiblot <jjhiblot@ti.com> wrote:
>>>
>>> In the DTS, the addresses are defined relative to the parent bus. We need
>>> to translate them to get the address as seen by the CPU core.
>>>
>>> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
>>> ---
>>>
>>> to: sjg@chromium.org
>>>
>>>   drivers/core/regmap.c | 14 ++++++++------
>>>   1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> This says v2 but I don't see a change log. Can you please resend this?
>
> Hi Simon,
>
> Sorry, I didn't think about sending the whole series to you. The series is
> marked v2 but this particular patch that you and stephen warren have already
> reviewed hasn't changed a bit.
>
> Jean-Jacques

OK thanks. It's good to have 'v2: no changes' in the patch for this
sort of situation. E.g. patman will do this for you.

Regards,
Simon
Simon Glass March 17, 2017, 4:20 p.m. UTC | #4
On 16 February 2017 at 13:43, Simon Glass <sjg@chromium.org> wrote:
> On 14 February 2017 at 03:20, Jean-Jacques Hiblot <jjhiblot@ti.com> wrote:
>>
>>
>> On 14/02/2017 06:23, Simon Glass wrote:
>>>
>>> Hi,
>>>
>>> On 13 February 2017 at 08:17, Jean-Jacques Hiblot <jjhiblot@ti.com> wrote:
>>>>
>>>> In the DTS, the addresses are defined relative to the parent bus. We need
>>>> to translate them to get the address as seen by the CPU core.
>>>>
>>>> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
>>>> ---
>>>>
>>>> to: sjg@chromium.org
>>>>
>>>>   drivers/core/regmap.c | 14 ++++++++------
>>>>   1 file changed, 8 insertions(+), 6 deletions(-)
>>>
>>> This says v2 but I don't see a change log. Can you please resend this?
>>
>> Hi Simon,
>>
>> Sorry, I didn't think about sending the whole series to you. The series is
>> marked v2 but this particular patch that you and stephen warren have already
>> reviewed hasn't changed a bit.
>>
>> Jean-Jacques
>
> OK thanks. It's good to have 'v2: no changes' in the patch for this
> sort of situation. E.g. patman will do this for you.
>
> Regards,
> Simon

Applied to u-boot-dm, thanks!

You mention above some review tags but I don't see them in this patch.
I think you may have forgotten to add then to you v2, along with the
change log?

- Simon
Jean-Jacques Hiblot March 20, 2017, 10:08 a.m. UTC | #5
On 17/03/2017 17:20, Simon Glass wrote:
> On 16 February 2017 at 13:43, Simon Glass <sjg@chromium.org> wrote:
>> On 14 February 2017 at 03:20, Jean-Jacques Hiblot <jjhiblot@ti.com> wrote:
>>>
>>> On 14/02/2017 06:23, Simon Glass wrote:
>>>> Hi,
>>>>
>>>> On 13 February 2017 at 08:17, Jean-Jacques Hiblot <jjhiblot@ti.com> wrote:
>>>>> In the DTS, the addresses are defined relative to the parent bus. We need
>>>>> to translate them to get the address as seen by the CPU core.
>>>>>
>>>>> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
>>>>> ---
>>>>>
>>>>> to: sjg@chromium.org
>>>>>
>>>>>    drivers/core/regmap.c | 14 ++++++++------
>>>>>    1 file changed, 8 insertions(+), 6 deletions(-)
>>>> This says v2 but I don't see a change log. Can you please resend this?
>>> Hi Simon,
>>>
>>> Sorry, I didn't think about sending the whole series to you. The series is
>>> marked v2 but this particular patch that you and stephen warren have already
>>> reviewed hasn't changed a bit.
>>>
>>> Jean-Jacques
>> OK thanks. It's good to have 'v2: no changes' in the patch for this
>> sort of situation. E.g. patman will do this for you.
>>
>> Regards,
>> Simon
> Applied to u-boot-dm, thanks!
>
> You mention above some review tags but I don't see them in this patch.
> I think you may have forgotten to add then to you v2, along with the
> change log?
Yes I forgot to add the reviewed-by tags.
Thanks for pulling it in
> - Simon
>
diff mbox

Patch

diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index 833cd78..3bec3df 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -70,6 +70,7 @@  int regmap_init_mem(struct udevice *dev, struct regmap **mapp)
 	int addr_len, size_len, both_len;
 	int parent;
 	int len;
+	int index;
 
 	parent = dev_of_offset(dev->parent);
 	addr_len = fdt_address_cells(blob, parent);
@@ -86,13 +87,14 @@  int regmap_init_mem(struct udevice *dev, struct regmap **mapp)
 	if (!map)
 		return -ENOMEM;
 
-	map->base = fdtdec_get_number(cell, addr_len);
-
-	for (range = map->range; count > 0;
-	     count--, cell += both_len, range++) {
-		range->start = fdtdec_get_number(cell, addr_len);
-		range->size = fdtdec_get_number(cell + addr_len, size_len);
+	for (range = map->range, index = 0; count > 0;
+	     count--, cell += both_len, range++, index++) {
+		fdt_size_t sz;
+		range->start = fdtdec_get_addr_size_fixed(blob, dev->of_offset,
+				"reg", index, addr_len, size_len, &sz, true);
+		range->size = sz;
 	}
+	map->base = map->range[0].start;
 
 	*mapp = map;