pinctrl: single: change function mask default value

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@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Dario Binacchi 2021-04-11 09:39:45 +02:00 committed by Lokesh Vutla
parent 971c64a452
commit d85b93e80b

View File

@ -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;