From: Przemyslaw Marczak <p.marczak@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fdt: Allow fdt_translate_address() to work with buses
Date: Mon, 04 Jan 2016 09:35:47 +0100 [thread overview]
Message-ID: <568A2EE3.4030102@samsung.com> (raw)
In-Reply-To: <1451862280-15245-1-git-send-email-sjg@chromium.org>
Hello Simon,
On 01/04/2016 12:04 AM, Simon Glass wrote:
> It is common for I2C and SPI buses to have a single-cell address and a size
> of 0. These produce a warning at present. For example on snow:
>
> __of_translate_address: Bad cell count for gpc4
> __of_translate_address: Bad cell count for gpx0
> __of_translate_address: Bad cell count for gpv2
> __of_translate_address: Bad cell count for gpv4
>
> One of the nodes in question looks like this in part:
>
> pinctrl_2: pinctrl at 10d10000 {
> #address-cells = <1>;
> #size-cells = <0>;
> gpv2: gpv2 {
> reg = <0x060>;
> };
> gpv4: gpv4 {
> reg = <0xc0>;
> };
> };
>
> This is clearly valid so it looks like the conversion to use
> fdt_translate_address() in dev_get_addr() is not currently a good move.
>
> Przemyslaw Marczak sent three patches to resolve this for exynos boards:
>
> https://patchwork.ozlabs.org/patch/557008/
> https://patchwork.ozlabs.org/patch/557010/
> https://patchwork.ozlabs.org/patch/557009/
>
> But this involves creating a new function, and everyone will need to know
> when to use which one. Also the problem may affect other boards.
>
> Instead we can relax the contraint that there must be at least one size
> cell. This fixes the problem on snow and should not affect anything else,
> since the error check should not fire on normal device trees anyway.
>
> After the release we will have more time to come up with a better solution,
> if one exists.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> common/fdt_support.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index 66464db..43c5fa8 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -952,8 +952,7 @@ void fdt_del_node_and_alias(void *blob, const char *alias)
> /* Max address size we deal with */
> #define OF_MAX_ADDR_CELLS 4
> #define OF_BAD_ADDR FDT_ADDR_T_NONE
> -#define OF_CHECK_COUNTS(na, ns) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \
> - (ns) > 0)
> +#define OF_CHECK_COUNTS(na, ns) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS)
>
> /* Debug utility */
> #ifdef DEBUG
>
The patch with this fix was send by me some time ago:
https://patchwork.ozlabs.org/patch/537372/
It actually do the same, what your patch does.
And my next three patches (adding dev_get_reg()), which you mentioned,
are another way to fix the issue.
So I think, we should choose between those two ways.
However the first one breaks the consistency with the kernel:
drivers/of/address.c: __of_translate_address()
Best regards,
--
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
next prev parent reply other threads:[~2016-01-04 8:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-03 23:04 [U-Boot] [PATCH] fdt: Allow fdt_translate_address() to work with buses Simon Glass
2016-01-04 8:35 ` Przemyslaw Marczak [this message]
2016-01-04 20:15 ` Stephen Warren
2016-01-05 1:00 ` Simon Glass
2016-01-05 15:47 ` Przemyslaw Marczak
2016-01-05 17:26 ` Stephen Warren
2016-01-07 11:43 ` Przemyslaw Marczak
2016-01-07 18:22 ` Stephen Warren
2016-01-05 17:15 ` Stephen Warren
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=568A2EE3.4030102@samsung.com \
--to=p.marczak@samsung.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 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.