Upcomming pca953x gpio driver (tca6416 is compatible with it)
is using for example this DT description (ZynqMP zcu102):
i2c0: i2c@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@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@20 **
__of_translate_address: Bad cell count for gpio@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.si...@xilinx.com>
---

 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

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to