[PATCH v2 06/12] pinctrl: single: check "register-width" DT property

Dario Binacchi dariobin at libero.it
Thu Jan 28 23:24:55 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, ... bits.

Signed-off-by: Dario Binacchi <dariobin at libero.it>
Reviewed-by: Simon Glass <sjg at chromium.org>

---

Changes in v2:
- Updated commit message.
- Added Simon Glass review tag.

 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 d5656de8e8..5ade108875 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;
+	}
 
 	addr = dev_read_addr_size(dev, "reg", &size);
 	if (addr == FDT_ADDR_T_NONE) {
-- 
2.17.1



More information about the U-Boot mailing list