From: Heiko Stuebner <heiko@sntech.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3] regmap: add support for address cell 2
Date: Fri, 05 May 2017 15:10:07 +0200 [thread overview]
Message-ID: <1899317.D03Pv7KL9M@phil> (raw)
In-Reply-To: <1493952008-9762-1-git-send-email-kever.yang@rock-chips.com>
Hi Kever,
Am Freitag, 5. Mai 2017, 10:39:35 CEST schrieb Kever Yang:
> 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>
This helps make OF_PLATDATA work on my firefly-rk3399 so yay :-),
but I don't think it's that easy to solve, see below:
> ---
>
> Changes in v3:
> - move of_plat_get_number() into lib/of_plat.c
>
> Changes in v2:
> - rename the fdtdec_get_number() to of_plat_get_number()
>
> drivers/core/regmap.c | 9 +++++++++
> include/of_plat.h | 22 ++++++++++++++++++++++
> lib/Makefile | 3 +++
> lib/of_plat.c | 17 +++++++++++++++++
> 4 files changed, 51 insertions(+)
> create mode 100644 include/of_plat.h
> create mode 100644 lib/of_plat.c
>
> diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
> index 3bec3df..c03279e 100644
> --- a/drivers/core/regmap.c
> +++ b/drivers/core/regmap.c
> @@ -12,6 +12,7 @@
> #include <malloc.h>
> #include <mapmem.h>
> #include <regmap.h>
> +#include <of_plat.h>
>
> #include <asm/io.h>
>
> @@ -49,11 +50,19 @@ int regmap_init_mem_platdata(struct udevice *dev, u32 *reg, int count,
> if (!map)
> return -ENOMEM;
>
> +#ifdef CONFIG_PHYS_64BIT
> + map->base = of_plat_get_number(reg, 2);
> + for (range = map->range; count > 0; reg += 4, range++, count--) {
> + range->start = of_plat_get_number(reg, 2);
> + range->size = of_plat_get_number(reg + 2, 2);
> + }
I may just be missing something, but how can you be sure that the cell-size
is always 2?
For example, there were discussions about 64bit platforms not really
needing to add all the 0x0 elements, when the whole io-registers are well
below the 4GB mark and for example at least one sunxi also uses this, see
for example:
allwinner/sun50i-a64.dtsi, altera/socfpga_stratix10.dtsi,
broadcom/bcm283x.dtsi and problably more using #address-cells = <1>,
#size-cells = <1> for their memory mapped io.
And from what I've seen dtoc simply converts the reg property and just
ignores #address-cells and #size-cells (or I'm overlooking something).
Possible solutions that come to mind would be make dtoc also convert
#address-cells and #size-cells, making regmap and everybody check it
or alternatively make dtoc convert regs to cell-size 2 in all cases when
CONFIG_PHYS_64BIT is set.
Heiko
next prev parent reply other threads:[~2017-05-05 13:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-05 2:39 [U-Boot] [PATCH v3] regmap: add support for address cell 2 Kever Yang
2017-05-05 13:10 ` Heiko Stuebner [this message]
2017-05-08 1:45 ` Kever Yang
2017-06-19 4:11 ` Simon Glass
2017-06-20 18:26 ` Simon Glass
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=1899317.D03Pv7KL9M@phil \
--to=heiko@sntech.de \
--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