From: Jaehoon Chung <jh80.chung@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fdt: fix address cell count checking in fdt_translate_address()
Date: Thu, 29 Oct 2015 16:28:40 +0900 [thread overview]
Message-ID: <5631CAA8.9000800@samsung.com> (raw)
In-Reply-To: <1446043077-21005-1-git-send-email-p.marczak@samsung.com>
Hi, Przemyslaw.
On 10/28/2015 11:37 PM, Przemyslaw Marczak wrote:
> Commit: dm: core: Enable optional use of fdt_translate_address()
>
> Enables use of this function as default, but after this it's not
> possible to get dev address for the case in which: '#size-cells == 0'
>
> This causes errors when getting address for some GPIOs, for which
> the '#size-cells' is set to 0.
>
> Example error:
> '__of_translate_address: Bad cell count for gpx0'
>
> Allowing for that case by modifying the macro 'OF_CHECK_COUNTS',
> (called from )__of_translate_address(), fixes the issue.
>
> Now, this macro doesn't check, that '#size-cells' is greater than 0.
>
> This is possible from the specification point of view, but I'm not sure
> that it doesn't introduce a regression for other configs.
>
> Please test and share the results.
>
> Tested-on: Odroid U3, Odroid X2, Odroid XU3, Sandbox.
I have also tested with exynos boards.
As you mentioned, it seems that needs to test for other SoC.
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Best Regards,
Jaehoon Chung
>
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Stefan Roese <sr@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Bin Meng <bmeng.cn@gmail.com>
> Cc: Marek Vasut <marex@denx.de>
> ---
> common/fdt_support.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index f86365e..5f808cc 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -946,8 +946,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 ((u64)-1)
> -#define OF_CHECK_COUNTS(na, ns) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \
> - (ns) > 0)
> +#define OF_CHECK_COUNTS(na) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS)
>
> /* Debug utility */
> #ifdef DEBUG
> @@ -1115,7 +1114,7 @@ static u64 __of_translate_address(void *blob, int node_offset, const fdt32_t *in
>
> /* Cound address cells & copy address locally */
> bus->count_cells(blob, parent, &na, &ns);
> - if (!OF_CHECK_COUNTS(na, ns)) {
> + if (!OF_CHECK_COUNTS(na)) {
> printf("%s: Bad cell count for %s\n", __FUNCTION__,
> fdt_get_name(blob, node_offset, NULL));
> goto bail;
> @@ -1142,7 +1141,7 @@ static u64 __of_translate_address(void *blob, int node_offset, const fdt32_t *in
> /* Get new parent bus and counts */
> pbus = &of_busses[0];
> pbus->count_cells(blob, parent, &pna, &pns);
> - if (!OF_CHECK_COUNTS(pna, pns)) {
> + if (!OF_CHECK_COUNTS(pna)) {
> printf("%s: Bad cell count for %s\n", __FUNCTION__,
> fdt_get_name(blob, node_offset, NULL));
> break;
>
next prev parent reply other threads:[~2015-10-29 7:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-28 14:37 [U-Boot] [PATCH] fdt: fix address cell count checking in fdt_translate_address() Przemyslaw Marczak
2015-10-29 7:28 ` Jaehoon Chung [this message]
2015-10-29 17:12 ` Lukasz Majewski
2015-10-29 17:15 ` Simon Glass
2015-11-03 9:57 ` Przemyslaw Marczak
2015-11-06 3:16 ` Simon Glass
2015-11-06 6:47 ` Stefan Roese
2016-01-05 0:59 ` Simon Glass
2016-01-07 19:24 ` Simon Glass
2016-01-08 12:01 ` Przemyslaw Marczak
2016-01-11 16:59 ` Simon Glass
2016-01-12 10:49 ` Przemyslaw Marczak
2016-01-12 13:59 ` Simon Glass
2016-01-12 14:25 ` Przemyslaw Marczak
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=5631CAA8.9000800@samsung.com \
--to=jh80.chung@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox