[PATCH v3 07/12] pinctrl: single: change function mask default value
Dario Binacchi
dariobin at libero.it
Sun Feb 28 15:12:36 CET 2021
The patch is inspired by more recent versions of the Linux driver.
Replacing the default value 0xffffffff of the function mask with 0 is
certainly more conservative in case the "pinctrl-single,function-mask"
DT property is missing.
Signed-off-by: Dario Binacchi <dariobin at libero.it>
Reviewed-by: Simon Glass <sjg at chromium.org>
---
Changes in v3:
- Added Simon Glass review tag.
drivers/pinctrl/pinctrl-single.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 5ade108875..630a6c08b8 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -79,6 +79,10 @@ static int single_configure_pins(struct udevice *dev,
phys_addr_t reg;
u32 offset, val;
+ /* If function mask is null, needn't enable it. */
+ if (!pdata->mask)
+ return 0;
+
for (n = 0; n < count; n++, pins++) {
offset = fdt32_to_cpu(pins->reg);
if (offset < 0 || offset > pdata->offset) {
@@ -207,8 +211,12 @@ static int single_of_to_plat(struct udevice *dev)
}
pdata->base = addr;
- pdata->mask = dev_read_u32_default(dev, "pinctrl-single,function-mask",
- 0xffffffff);
+ ret = dev_read_u32(dev, "pinctrl-single,function-mask", &pdata->mask);
+ if (ret) {
+ pdata->mask = 0;
+ dev_warn(dev, "missing function register mask\n");
+ }
+
pdata->bits_per_mux = dev_read_bool(dev, "pinctrl-single,bit-per-mux");
return 0;
--
2.17.1
More information about the U-Boot
mailing list