[U-Boot] [PATCH 0/2] Revert changes to __of_translate_address()

Globally enabled CONFIG_OF_TRANSLATE causes, that function dev_get_addr() returns a different result for a node with: 'size-cells = <0>'.
The above change, breaks the Exynos boards for a long time, because of GPIO driver, which uses the fdt in a non standard way.
After sending few approaches with adding support for that case, the one was appllied for a temporary fix for the release:
"fdt: fix address cell count checking in fdt_translate_address()"
However, after discussion on the list, we found that this way can't be accepted because the function __of_translate_address() as a backend of dev_get_addr(), shouldn't be used for translating a non-MMIO addresses.
Updating some device tree files with '#size-cells = 1' and by extending the 'reg' property by address length - fixes the problem.
This applies on u-boot-dm/master: c5a7533 net: Fix delay in net_retry test
Przemyslaw Marczak (2): dts:exynos:update pinctrl size-cells and fix child regs Revert "fdt: fix address cell count checking in fdt_translate_address()"
arch/arm/dts/exynos4210-pinctrl-uboot.dtsi | 8 ++++---- arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi | 18 +++++++++--------- arch/arm/dts/exynos5250-pinctrl-uboot.dtsi | 16 ++++++++-------- arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi | 12 ++++++------ arch/arm/dts/s5pc110-pinctrl.dtsi | 4 ++-- common/fdt_support.c | 7 ++++--- 6 files changed, 33 insertions(+), 32 deletions(-)

This change is required to avoid warnings about invalid size-cells defined in device-tree pinctrl nodes for Exynos.
Tested on: - Odroid U3 - Odroid XU3
Signed-off-by: Przemyslaw Marczak p.marczak@samsung.com Cc: Stefan Roese sr@denx.de Cc: Tom Rini trini@konsulko.com Cc: Simon Glass sjg@chromium.org Cc: Stephen Warren swarren@nvidia.com Cc: Stephen Warren swarren@wwwdotorg.org --- arch/arm/dts/exynos4210-pinctrl-uboot.dtsi | 8 ++++---- arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi | 18 +++++++++--------- arch/arm/dts/exynos5250-pinctrl-uboot.dtsi | 16 ++++++++-------- arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi | 12 ++++++------ arch/arm/dts/s5pc110-pinctrl.dtsi | 4 ++-- 5 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/arch/arm/dts/exynos4210-pinctrl-uboot.dtsi b/arch/arm/dts/exynos4210-pinctrl-uboot.dtsi index 0ff41d0..b76c77d 100644 --- a/arch/arm/dts/exynos4210-pinctrl-uboot.dtsi +++ b/arch/arm/dts/exynos4210-pinctrl-uboot.dtsi @@ -9,21 +9,21 @@ /{ pinctrl_0: pinctrl@11400000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; compatible = "samsung,exynos4210-pinctrl"; };
pinctrl_1: pinctrl@11000000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; gpx0: gpx0 { - reg = <0xc00>; + reg = <0xc00 0x20>; }; };
pinctrl_2: pinctrl@03860000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; };
}; diff --git a/arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi b/arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi index 8e5a6c6..33ecc14 100644 --- a/arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi +++ b/arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi @@ -9,37 +9,37 @@ /{ pinctrl_0: pinctrl@11400000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; gpf0: gpf0 { - reg = <0x180>; + reg = <0x180 0x20>; }; gpj0: gpj0 { - reg = <0x240>; + reg = <0x240 0x20>; }; };
pinctrl_1: pinctrl@11000000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; gpk0: gpk0 { - reg = <0x40>; + reg = <0x40 0x20>; }; gpm0: gpm0 { - reg = <0x260>; + reg = <0x260 0x20>; }; gpx0: gpx0 { - reg = <0xc00>; + reg = <0xc00 0x20>; }; };
pinctrl_2: pinctrl@03860000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; };
pinctrl_3: pinctrl@106E0000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; };
}; diff --git a/arch/arm/dts/exynos5250-pinctrl-uboot.dtsi b/arch/arm/dts/exynos5250-pinctrl-uboot.dtsi index 068c5f6..b8c0526 100644 --- a/arch/arm/dts/exynos5250-pinctrl-uboot.dtsi +++ b/arch/arm/dts/exynos5250-pinctrl-uboot.dtsi @@ -9,34 +9,34 @@ /{ pinctrl_0: pinctrl@11400000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; gpc4: gpc4 { - reg = <0x2e0>; + reg = <0x2e0 0x20>; }; gpx0: gpx0 { - reg = <0xc00>; + reg = <0xc00 0x20>; }; };
pinctrl_1: pinctrl@13400000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; };
pinctrl_2: pinctrl@10d10000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; gpv2: gpv2 { - reg = <0x060>; + reg = <0x060 0x20>; }; gpv4: gpv4 { - reg = <0xc0>; + reg = <0xc0 0x20>; }; };
pinctrl_3: pinctrl@03860000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; };
}; diff --git a/arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi b/arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi index 635a1b0..341194f 100644 --- a/arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi +++ b/arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi @@ -14,29 +14,29 @@ */ pinctrl@14010000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; }; pinctrl@13400000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; gpy7 { };
gpx0 { - reg = <0xc00>; + reg = <0xc00 0x0>; }; }; pinctrl@13410000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; }; pinctrl@14000000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; }; pinctrl@03860000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; };
}; diff --git a/arch/arm/dts/s5pc110-pinctrl.dtsi b/arch/arm/dts/s5pc110-pinctrl.dtsi index 2e9d552..07e76c0 100644 --- a/arch/arm/dts/s5pc110-pinctrl.dtsi +++ b/arch/arm/dts/s5pc110-pinctrl.dtsi @@ -9,7 +9,7 @@ / { pinctrl@e0200000 { #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; gpa0: gpa0 { gpio-controller; #gpio-cells = <2>; @@ -251,7 +251,7 @@ };
gph0: gph0 { - reg = <0xc00>; + reg = <0xc00 0x20>; gpio-controller; #gpio-cells = <2>; };

On 12 January 2016 at 07:40, Przemyslaw Marczak p.marczak@samsung.com wrote:
This change is required to avoid warnings about invalid size-cells defined in device-tree pinctrl nodes for Exynos.
Tested on:
- Odroid U3
- Odroid XU3
Signed-off-by: Przemyslaw Marczak p.marczak@samsung.com Cc: Stefan Roese sr@denx.de Cc: Tom Rini trini@konsulko.com Cc: Simon Glass sjg@chromium.org Cc: Stephen Warren swarren@nvidia.com Cc: Stephen Warren swarren@wwwdotorg.org
arch/arm/dts/exynos4210-pinctrl-uboot.dtsi | 8 ++++---- arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi | 18 +++++++++--------- arch/arm/dts/exynos5250-pinctrl-uboot.dtsi | 16 ++++++++-------- arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi | 12 ++++++------ arch/arm/dts/s5pc110-pinctrl.dtsi | 4 ++-- 5 files changed, 29 insertions(+), 29 deletions(-)
Tested on snow: Tested-by: Simon Glass sjg@chromium.org Acked-by: Simon Glass sjg@chromium.org
Stephen, I plan to pick this up so please sing out if there is a problem.

On 15/01/16 02:17, Simon Glass wrote:
On 12 January 2016 at 07:40, Przemyslaw Marczak p.marczak@samsung.com wrote:
This change is required to avoid warnings about invalid size-cells defined in device-tree pinctrl nodes for Exynos.
Tested on:
- Odroid U3
- Odroid XU3
Signed-off-by: Przemyslaw Marczak p.marczak@samsung.com Cc: Stefan Roese sr@denx.de Cc: Tom Rini trini@konsulko.com Cc: Simon Glass sjg@chromium.org Cc: Stephen Warren swarren@nvidia.com Cc: Stephen Warren swarren@wwwdotorg.org
arch/arm/dts/exynos4210-pinctrl-uboot.dtsi | 8 ++++---- arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi | 18 +++++++++--------- arch/arm/dts/exynos5250-pinctrl-uboot.dtsi | 16 ++++++++-------- arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi | 12 ++++++------ arch/arm/dts/s5pc110-pinctrl.dtsi | 4 ++-- 5 files changed, 29 insertions(+), 29 deletions(-)
Tested on snow: Tested-by: Simon Glass sjg@chromium.org Acked-by: Simon Glass sjg@chromium.org
Stephen, I plan to pick this up so please sing out if there is a problem.
Acked-by: Minkyu Kang mk7.kang@samsung.com
Thanks, Minkyu Kang.

On 15 January 2016 at 02:31, Minkyu Kang mk7.kang@samsung.com wrote:
On 15/01/16 02:17, Simon Glass wrote:
On 12 January 2016 at 07:40, Przemyslaw Marczak p.marczak@samsung.com wrote:
This change is required to avoid warnings about invalid size-cells defined in device-tree pinctrl nodes for Exynos.
Tested on:
- Odroid U3
- Odroid XU3
Signed-off-by: Przemyslaw Marczak p.marczak@samsung.com Cc: Stefan Roese sr@denx.de Cc: Tom Rini trini@konsulko.com Cc: Simon Glass sjg@chromium.org Cc: Stephen Warren swarren@nvidia.com Cc: Stephen Warren swarren@wwwdotorg.org
arch/arm/dts/exynos4210-pinctrl-uboot.dtsi | 8 ++++---- arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi | 18 +++++++++--------- arch/arm/dts/exynos5250-pinctrl-uboot.dtsi | 16 ++++++++-------- arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi | 12 ++++++------ arch/arm/dts/s5pc110-pinctrl.dtsi | 4 ++-- 5 files changed, 29 insertions(+), 29 deletions(-)
Tested on snow: Tested-by: Simon Glass sjg@chromium.org Acked-by: Simon Glass sjg@chromium.org
Stephen, I plan to pick this up so please sing out if there is a problem.
Acked-by: Minkyu Kang mk7.kang@samsung.com
Applied to u-boot-dm/next, thanks!

This reverts commit 71105f50fedddfa5b0535d102c3d5078671721ad.
The reverted commit was applied for a temporary to unbreak few Exynos boards on the release.
After the discussion about the change, this commit should be avoided. Fixed device-tree for Exynos, allows reverting it without any issues.
Signed-off-by: Przemyslaw Marczak p.marczak@samsung.com Cc: Stefan Roese sr@denx.de Cc: Tom Rini trini@konsulko.com Cc: Simon Glass sjg@chromium.org Cc: Stephen Warren swarren@nvidia.com Cc: Stephen Warren swarren@wwwdotorg.org --- common/fdt_support.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/common/fdt_support.c b/common/fdt_support.c index a539389..66464db 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -952,7 +952,8 @@ 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) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS) +#define OF_CHECK_COUNTS(na, ns) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \ + (ns) > 0)
/* Debug utility */ #ifdef DEBUG @@ -1120,7 +1121,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)) { + if (!OF_CHECK_COUNTS(na, ns)) { printf("%s: Bad cell count for %s\n", __FUNCTION__, fdt_get_name(blob, node_offset, NULL)); goto bail; @@ -1147,7 +1148,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)) { + if (!OF_CHECK_COUNTS(pna, pns)) { printf("%s: Bad cell count for %s\n", __FUNCTION__, fdt_get_name(blob, node_offset, NULL)); break;

On 12 January 2016 at 07:40, Przemyslaw Marczak p.marczak@samsung.com wrote:
This reverts commit 71105f50fedddfa5b0535d102c3d5078671721ad.
The reverted commit was applied for a temporary to unbreak few Exynos boards on the release.
After the discussion about the change, this commit should be avoided. Fixed device-tree for Exynos, allows reverting it without any issues.
Signed-off-by: Przemyslaw Marczak p.marczak@samsung.com Cc: Stefan Roese sr@denx.de Cc: Tom Rini trini@konsulko.com Cc: Simon Glass sjg@chromium.org Cc: Stephen Warren swarren@nvidia.com Cc: Stephen Warren swarren@wwwdotorg.org
common/fdt_support.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Tested on snow: Tested-by: Simon Glass sjg@chromium.org Acked-by: Simon Glass sjg@chromium.org

On 14 January 2016 at 10:17, Simon Glass sjg@chromium.org wrote:
On 12 January 2016 at 07:40, Przemyslaw Marczak p.marczak@samsung.com wrote:
This reverts commit 71105f50fedddfa5b0535d102c3d5078671721ad.
The reverted commit was applied for a temporary to unbreak few Exynos boards on the release.
After the discussion about the change, this commit should be avoided. Fixed device-tree for Exynos, allows reverting it without any issues.
Signed-off-by: Przemyslaw Marczak p.marczak@samsung.com Cc: Stefan Roese sr@denx.de Cc: Tom Rini trini@konsulko.com Cc: Simon Glass sjg@chromium.org Cc: Stephen Warren swarren@nvidia.com Cc: Stephen Warren swarren@wwwdotorg.org
common/fdt_support.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Tested on snow: Tested-by: Simon Glass sjg@chromium.org Acked-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm/next, thanks!
participants (3)
-
Minkyu Kang
-
Przemyslaw Marczak
-
Simon Glass