]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pinctrl: single: Fix probe failure getting register area size
authorVignesh Raghavendra <vigneshr@ti.com>
Fri, 7 May 2021 09:10:34 +0000 (14:40 +0530)
committerTom Rini <trini@konsulko.com>
Wed, 26 May 2021 21:26:07 +0000 (17:26 -0400)
If reg property of pinctrl-single node requires address translation then
probe fails with following message:

single-pinctrl pinctrl@4301c000: failed to get base register size

This is because driver uses dev_read_addr_size() to get size which also
tries to fetch untranslated addr and fails.
Fix this by using dev_read_addr_size_index() which takes care of address
translation and also makes following dev_read_addr() call redundant.

This fixes Ethernet failures on TI's AM654 based EVMs due to lack of
pinmux configuration.

Fixes: 9fd8a430f3 ("pinctrl: single: get register area size by device API")
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
drivers/pinctrl/pinctrl-single.c

index ebb7602dde80b13300838f7a2c4a33715507a2b9..7af6c5f0b0371cdbd0b580f6ad46a0fe91db19d6 100644 (file)
@@ -509,19 +509,13 @@ 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");
+               dev_err(dev, "failed to get base register address\n");
                return -EINVAL;
        }
 
        pdata->offset = size - pdata->width / BITS_PER_BYTE;
-
-       addr = dev_read_addr(dev);
-       if (addr == FDT_ADDR_T_NONE) {
-               dev_dbg(dev, "no valid base register address\n");
-               return -EINVAL;
-       }
        pdata->base = addr;
 
        ret = dev_read_u32(dev, "pinctrl-single,function-mask", &pdata->mask);