[PATCH] pinctrl: fix pinctrl_gpio_get_pinctrl_and_offset for gpio-ranges array

Simon Glass sjg at chromium.org
Sun Apr 2 23:33:21 CEST 2023


From: Quanyang Wang <quanyang.wang at windriver.com>

Sometimes a multi-element array is used for "gpio-ranges" property in
dts file:

    qe_pio_e: gpio-controller at 1460 {
        ......
        gpio-ranges = <&pinctrl1 0 20 10>, <&pinctrl2 10 50 20>;
        ......
    };

But the function pinctrl_gpio_get_pinctrl_and_offset can't handle this
case because the "index" argument passed to dev_read_phandle_with_args
is fixed to be "0". Use a loop to traverse the array to fix it.

Signed-off-by: Quanyang Wang <quanyang.wang at windriver.com>
---
 drivers/pinctrl/pinctrl-uclass.c | 47 ++++++++++++++++----------------
 1 file changed, 23 insertions(+), 24 deletions(-)

Applied to u-boot-dm/next, thanks!


More information about the U-Boot mailing list