[PATCH 05/11] pinctrl: single: check "register-width" DT property

Dario Binacchi dariobin at libero.it
Sat Jan 23 19:27:05 CET 2021


In more recent versions of the Linux kernel the driver's probe function
returns an error if the "pinctrl-single,register-width" DT property is
missing. The lack of this information, in fact, does not allow to know
whether to access the registers of the controller at 8, 16 or 32 bits.

Signed-off-by: Dario Binacchi <dariobin at libero.it>
---

 drivers/pinctrl/pinctrl-single.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index c80a42a193..8fd3bf66de 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -22,7 +22,7 @@ struct single_pdata {
 	fdt_addr_t base;
 	int offset;
 	u32 mask;
-	int width;
+	u32 width;
 	bool bits_per_mux;
 };
 
@@ -184,9 +184,13 @@ static int single_of_to_plat(struct udevice *dev)
 	fdt_addr_t addr;
 	fdt_size_t size;
 	struct single_pdata *pdata = dev_get_plat(dev);
+	int ret;
 
-	pdata->width =
-		dev_read_u32_default(dev, "pinctrl-single,register-width", 0);
+	ret = dev_read_u32(dev, "pinctrl-single,register-width", &pdata->width);
+	if (ret) {
+		dev_err(dev, "missing register width\n");
+		return ret;
+	}
 
 	dev_read_addr_size(dev, "reg", &size);
 	pdata->offset = size - pdata->width / BITS_PER_BYTE;
-- 
2.17.1



More information about the U-Boot mailing list