From: Kever Yang <kever.yang@rock-chips.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] regmap: add support for address cell 2
Date: Mon, 06 Mar 2017 17:43:08 +0800 [thread overview]
Message-ID: <58BD2F2C.1000008@rock-chips.com> (raw)
In-Reply-To: <CAPnjgZ3feg-GQ4jfWFngVZ2Crk9JUKOVF_9wuwJvRJ8NVQMcZA@mail.gmail.com>
Hi Simon,
On 02/17/2017 04:43 AM, Simon Glass wrote:
> Hi Kever,
>
> On 13 February 2017 at 01:28, Kever Yang <kever.yang@rock-chips.com> wrote:
>> ARM64 is using 64bit address which address cell is 2 instead of 1,
>> update to support it when of-platdata enabled.
>>
>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>> ---
>>
>> drivers/core/regmap.c | 20 ++++++++++++++++++--
>> 1 file changed, 18 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
>> index c68bcba..a1c0983 100644
>> --- a/drivers/core/regmap.c
>> +++ b/drivers/core/regmap.c
>> @@ -39,6 +39,16 @@ static struct regmap *regmap_alloc_count(int count)
>> }
>>
>> #if CONFIG_IS_ENABLED(OF_PLATDATA)
>> +u64 fdtdec_get_number(const u32 *ptr, unsigned int cells)
> This name is already used and seems misleading. How about of_plat_get_number()?
Yes, of_plat_get_number() is better, thanks.
>
>> +{
>> + u64 number = 0;
>> +
>> + while (cells--)
>> + number = (number << 32) | (*ptr++);
>> +
>> + return number;
>> +}
>> +
>> int regmap_init_mem_platdata(struct udevice *dev, u32 *reg, int count,
>> struct regmap **mapp)
>> {
>> @@ -48,13 +58,19 @@ int regmap_init_mem_platdata(struct udevice *dev, u32 *reg, int count,
>> map = regmap_alloc_count(count);
>> if (!map)
>> return -ENOMEM;
>> -
>> +#ifdef CONFIG_ARM64
> Can you use #ifdef CONFIG_PHYS_64BIT?
OK, will update in next version.
Thanks,
- Kever
>
>> + map->base = fdtdec_get_number(reg, 2);
>> + for (range = map->range; count > 0; reg += 4, range++, count--) {
>> + range->start = fdtdec_get_number(reg, 2);
>> + range->size = fdtdec_get_number(reg + 2, 2);
>> + }
>> +#else
>> map->base = *reg;
>> for (range = map->range; count > 0; reg += 2, range++, count--) {
>> range->start = *reg;
>> range->size = reg[1];
>> }
>> -
>> +#endif
>> *mapp = map;
>>
>> return 0;
>> --
>> 1.9.1
>>
> Regards,
> Simon
>
>
>
prev parent reply other threads:[~2017-03-06 9:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-13 8:28 [U-Boot] [PATCH] regmap: add support for address cell 2 Kever Yang
2017-02-16 20:43 ` Simon Glass
2017-03-06 9:43 ` Kever Yang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=58BD2F2C.1000008@rock-chips.com \
--to=kever.yang@rock-chips.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox