public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Peng Fan <van.freenix@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fdt: Do not report bad cell count when #size-cells = <0>
Date: Thu, 14 Apr 2016 15:54:51 +0800	[thread overview]
Message-ID: <20160414075449.GA21342@linux-7smt.suse> (raw)
In-Reply-To: <dbb9c24189974a6fc157bf1a38cdc82d48be77a5.1460614826.git.michal.simek@xilinx.com>

Hi Michal,

On Thu, Apr 14, 2016 at 08:20:28AM +0200, Michal Simek wrote:
>Upcomming pca953x gpio driver (tca6416 is compatible with it)
>is using for example this DT description (ZynqMP zcu102):
>i2c0: i2c at ff020000 {
>	compatible = "cdns,i2c-r1p10";
>	interrupt-parent = <&gic>;
>	interrupts = <0 17 4>;
>	reg = <0x0 0xff020000 0x1000>;
>	#address-cells = <1>;
>	#size-cells = <0>;
>
>	tca6416_u61: gpio at 21 {
>		compatible = "ti,tca6416";
>		reg = <0x21>;
>		gpio-controller;
>		#gpio-cells = <2>;
>	};
>};
>
>I2C bus is using #size-cells = <0> which current code detects as
>"Bad cell count":
>OF: reached root node
>OF: ** translation for device gpio at 20 **
>__of_translate_address: Bad cell count for gpio at 20
>Command 'gpio' failed: Error -19
>
>This patch fixes OF_CHECK_COUNTS macro not to report problem when
>size-cells is 0 which is also valid bus configuration.
>
>Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Reviewed-by: Peng Fan <van.freenix@gmail.com>

Regards,
Peng.

>---
>
> common/fdt_support.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/common/fdt_support.c b/common/fdt_support.c
>index ced119e70d9f..5f5b49c6210b 100644
>--- a/common/fdt_support.c
>+++ b/common/fdt_support.c
>@@ -941,7 +941,7 @@ void fdt_del_node_and_alias(void *blob, const char *alias)
> #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)
>+			(ns) >= 0)
> 
> /* Debug utility */
> #ifdef DEBUG
>-- 
>1.9.1
>

  reply	other threads:[~2016-04-14  7:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-14  6:20 [U-Boot] [PATCH] fdt: Do not report bad cell count when #size-cells = <0> Michal Simek
2016-04-14  7:54 ` Peng Fan [this message]
2016-04-14  9:45 ` Przemyslaw Marczak
2016-04-14 12:49   ` Michal Simek

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=20160414075449.GA21342@linux-7smt.suse \
    --to=van.freenix@gmail.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