Skip to contentSkip to conversation

sandbox: Correct dtc warning in /chosen node

PATCH New Simon Glass 1 participant 3 messages Feb 3, 2018 – May 16, 2018 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sandbox: Correct dtc warning in /chosen node

At present dtc produces these warnings when compiling sandbox:

arch/sandbox/dts/test.dtb: Warning (reg_format): "reg" property in /chosen/chosen-test has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1) arch/sandbox/dts/test.dtb: Warning (avoid_default_addr_size): Relying on default #address-cells value for /chosen/chosen-test arch/sandbox/dts/test.dtb: Warning (avoid_default_addr_size): Relying on default #size-cells value for /chosen/chosen-test

Add the missing properties to avoid this.

Fixes f200680 (dm: core: parse chosen node)

---

 arch/sandbox/dts/test.dts | 2 ++
 1 file changed, 2 insertions(+)
arch/sandbox/dts/test.dts +2 -0
index 3f9e788e6c3..c38e3691628 100644
@@ -480,6 +480,8 @@
 	};
 
 	chosen {
+		#address-cells = <1>;
+		#size-cells = <1>;
 		chosen-test {
 			compatible = "denx,u-boot-fdt-test";
 			reg = <9 1>;
Signature · 1 line
2.16.0.rc1.238.g530d649a79-goog
#1 lore raw

PATCH 2/2 sandbox: Rename 'num-gpios' property to avoid dtc warning

At present dtc produces these warnings when compiling sandbox:

arch/sandbox/dts/test.dtb: Warning (gpios_property):
Could not get phandle node for /base-gpios:num-gpios(cell 0)
arch/sandbox/dts/test.dtb: Warning (gpios_property):
Missing property '#gpio-cells' in node /reset-ctl or bad phandle (referred from /extra-gpios:num-gpios[0])

Both are due to it assuming that the 'num-gpios' property holds a phandle pointing to a GPIO node.

To avoid these warnings, rename the sandbox property so that it does not include the string 'gpios'.

---

 arch/sandbox/dts/test.dts | 4 ++--
 drivers/gpio/sandbox.c    | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
arch/sandbox/dts/test.dts +2 -2
index c38e3691628..b0f0ca8f19c 100644
@@ -177,7 +177,7 @@
 		gpio-controller;
 		#gpio-cells = <1>;
 		gpio-bank-name = "a";
-		num-gpios = <20>;
+		sandbox,gpio-count = <20>;
 	};
 
 	gpio_b: extra-gpios {
@@ -185,7 +185,7 @@
 		gpio-controller;
 		#gpio-cells = <5>;
 		gpio-bank-name = "b";
-		num-gpios = <10>;
+		sandbox,gpio-count = <10>;
 	};
 
 	i2c at 0 {
drivers/gpio/sandbox.c +2 -1
index 4f7b62eba0d..2a18f328576 100644
@@ -198,7 +198,8 @@ static int sandbox_gpio_ofdata_to_platdata(struct udevice *dev)
 {
 	struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
 
-	uc_priv->gpio_count = dev_read_u32_default(dev, "num-gpios", 0);
+	uc_priv->gpio_count = dev_read_u32_default(dev, "sandbox,gpio-count",
+						   0);
 	uc_priv->bank_name = dev_read_string(dev, "gpio-bank-name");
 
 	return 0;
Signature · 1 line
2.16.0.rc1.238.g530d649a79-goog
#2 lore raw

PATCH 2/2 sandbox: Rename 'num-gpios' property to avoid dtc warning

Quoted 14 lines · Simon Glass

At present dtc produces these warnings when compiling sandbox:

arch/sandbox/dts/test.dtb: Warning (gpios_property):
Could not get phandle node for /base-gpios:num-gpios(cell 0)
arch/sandbox/dts/test.dtb: Warning (gpios_property):
Missing property '#gpio-cells' in node /reset-ctl or bad phandle (referred from /extra-gpios:num-gpios[0])

Both are due to it assuming that the 'num-gpios' property holds a phandle pointing to a GPIO node.

To avoid these warnings, rename the sandbox property so that it does not include the string 'gpios'.

Quoted 7 lines

---

 arch/sandbox/dts/test.dts | 4 ++--
 drivers/gpio/sandbox.c    | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

This was applied to u-boot-dm and is now in mainline.