Skip to contentSkip to conversation

pinctrl: single: Fix address size reading

PATCH In review Jan Kiszka 1 participant 2 messages May 27, 2021

Subsystems (2)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 pinctrl: single: Fix address size reading

From: Jan Kiszka <[email protected]>

dev_read_addr_size() is inconsistent in too many ways. In particular, it does not retrieve the correct address/size cell number from the DT. dev_read_addr_size_index() does the right thing, so use that for now.

This fixes reading the address size e.g. on boards with the 64-bit AM65x where some pinctrl nodes only use 32-bit addresses and sizes.

---
 drivers/pinctrl/pinctrl-single.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-single.c +1 -1
index ebb7602dde..2769b7a7fd 100644
@@ -509,7 +509,7 @@ static int single_of_to_plat(struct udevice *dev)
 		return -EINVAL;
 	}
 
-	addr = dev_read_addr_size(dev, "reg", &size);
+	addr = dev_read_addr_size_index(dev, 0, &size);
 	if (addr == FDT_ADDR_T_NONE) {
 		dev_err(dev, "failed to get base register size\n");
 		return -EINVAL;
Signature · 1 line
2.26.2
author
#1 lore raw
Quoted 20 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

dev_read_addr_size() is inconsistent in too many ways. In particular, it does not retrieve the correct address/size cell number from the DT. dev_read_addr_size_index() does the right thing, so use that for now.

This fixes reading the address size e.g. on boards with the 64-bit AM65x where some pinctrl nodes only use 32-bit addresses and sizes.

---
 drivers/pinctrl/pinctrl-single.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-single.c +0 -0
index ebb7602dde..2769b7a7fd 100644

drivers/pinctrl/pinctrl-single.c static int single_of_to_plat(struct udevice *dev) · line 515

Quoted 8 lines
drivers/pinctrl/pinctrl-single.c +1 -1
@@ -509,7 +509,7 @@ static int single_of_to_plat(struct udevice *dev)
 		return -EINVAL;
 	}
 
-	addr = dev_read_addr_size(dev, "reg", &size);
+	addr = dev_read_addr_size_index(dev, 0, &size);
 	if (addr == FDT_ADDR_T_NONE) {
 		dev_err(dev, "failed to get base register size\n");
 		return -EINVAL;

Oops, obsolete, 1e7879045f is doing that already.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux