Skip to contentSkip to conversation

Revert changes to __of_translate_address()

PATCH New Przemyslaw Marczak 3 participants 8 messages Jan 12, 2016 – Mar 13, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 dts:exynos:update pinctrl size-cells and fix child regs

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

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Stephen Warren <[email protected]>
---
 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(-)
arch/arm/dts/exynos4210-pinctrl-uboot.dtsi +4 -4
index 0ff41d0..b76c77d 100644
@@ -9,21 +9,21 @@
 /{
 	pinctrl_0: pinctrl at 11400000 {
 		#address-cells = <1>;
-		#size-cells = <0>;
+		#size-cells = <1>;
 		compatible = "samsung,exynos4210-pinctrl";
 	};
 
 	pinctrl_1: pinctrl at 11000000 {
 		#address-cells = <1>;
-		#size-cells = <0>;
+		#size-cells = <1>;
 		gpx0: gpx0 {
-			reg = <0xc00>;
+			reg = <0xc00 0x20>;
 		};
 	};
 
 	pinctrl_2: pinctrl at 03860000 {
 		#address-cells = <1>;
-		#size-cells = <0>;
+		#size-cells = <1>;
 	};
 
 };
arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi +9 -9
index 8e5a6c6..33ecc14 100644
@@ -9,37 +9,37 @@
 /{
 	pinctrl_0: pinctrl at 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 at 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 at 03860000 {
 		#address-cells = <1>;
-		#size-cells = <0>;
+		#size-cells = <1>;
 	};
 
 	pinctrl_3: pinctrl at 106E0000 {
 		#address-cells = <1>;
-		#size-cells = <0>;
+		#size-cells = <1>;
 	};
 
 };
arch/arm/dts/exynos5250-pinctrl-uboot.dtsi +8 -8
index 068c5f6..b8c0526 100644
@@ -9,34 +9,34 @@
 /{
 	pinctrl_0: pinctrl at 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 at 13400000 {
 		#address-cells = <1>;
-		#size-cells = <0>;
+		#size-cells = <1>;
 	};
 
 	pinctrl_2: pinctrl at 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 at 03860000 {
 		#address-cells = <1>;
-		#size-cells = <0>;
+		#size-cells = <1>;
 	};
 
 };
arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi +6 -6
index 635a1b0..341194f 100644
@@ -14,29 +14,29 @@
 	 */
 	pinctrl at 14010000 {
 		#address-cells = <1>;
-		#size-cells = <0>;
+		#size-cells = <1>;
 	};
 	pinctrl at 13400000 {
 		#address-cells = <1>;
-		#size-cells = <0>;
+		#size-cells = <1>;
 		gpy7 {
 		};
 
 		gpx0 {
-			reg = <0xc00>;
+			reg = <0xc00 0x0>;
 		};
 	};
 	pinctrl at 13410000 {
 		#address-cells = <1>;
-		#size-cells = <0>;
+		#size-cells = <1>;
 	};
 	pinctrl at 14000000 {
 		#address-cells = <1>;
-		#size-cells = <0>;
+		#size-cells = <1>;
 	};
 	pinctrl at 03860000 {
 		#address-cells = <1>;
-		#size-cells = <0>;
+		#size-cells = <1>;
 	};
 
 };
arch/arm/dts/s5pc110-pinctrl.dtsi +2 -2
index 2e9d552..07e76c0 100644
@@ -9,7 +9,7 @@
 / {
 	pinctrl at 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>;
 		};
Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/2 dts:exynos:update pinctrl size-cells and fix child regs

Quoted 13 lines · Przemyslaw Marczak

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

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Stephen Warren <[email protected]>
Quoted 7 lines
---
 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:

Stephen, I plan to pick this up so please sing out if there is a problem.

#3 lore raw

PATCH 1/2 dts:exynos:update pinctrl size-cells and fix child regs

Quoted 22 lines · Simon Glass
Quoted 13 lines · Przemyslaw Marczak

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

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Stephen Warren <[email protected]>
Quoted 7 lines
---
 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(-)
Quoted 7 lines

Tested on snow:

Stephen, I plan to pick this up so please sing out if there is a problem.

Thanks,
Minkyu Kang.

#4 lore raw

PATCH 1/2 dts:exynos:update pinctrl size-cells and fix child regs

Quoted 27 lines · Minkyu Kang
Quoted 26 lines · Simon Glass
Quoted 13 lines · Przemyslaw Marczak

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

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Stephen Warren <[email protected]>
Quoted 7 lines
---
 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:

Quoted 5 lines
Quoted 3 lines

Stephen, I plan to pick this up so please sing out if there is a problem.

Applied to u-boot-dm/next, thanks!

#5 lore raw

PATCH 2/2 Revert "fdt: fix address cell count checking in fdt_translate_address()"

In reply to Przemyslaw Marczak

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.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Stephen Warren <[email protected]>
---
 common/fdt_support.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
common/fdt_support.c +4 -3
index a539389..66464db 100644
@@ -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;
Signature · 1 line
1.9.1
#6 lore raw

PATCH 2/2 Revert "fdt: fix address cell count checking in fdt_translate_address()"

Quoted 14 lines · Przemyslaw Marczak

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.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Stephen Warren <[email protected]>
Quoted 3 lines
---
 common/fdt_support.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Tested on snow:

#7 lore raw

PATCH 2/2 Revert "fdt: fix address cell count checking in fdt_translate_address()"

Quoted 19 lines · Simon Glass
Quoted 14 lines · Przemyslaw Marczak

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.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Stephen Warren <[email protected]>
Quoted 3 lines
---
 common/fdt_support.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Quoted 3 lines

Tested on snow:

Applied to u-boot-dm/next, thanks!