summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2023-04-03 11:35:30 -0400
committerTom Rini <[email protected]>2023-04-03 11:35:30 -0400
commit9876c8c147144db2c120fcc9ffa6de27f6894441 (patch)
tree6553b7f95619defea532dec9abcaa3c0aa66e5bf /drivers
parenta25dcda452bf6a6de72764a8d990d72e5def643d (diff)
parent00be5197e8423b8b71744ad0e3f2753d4be0132b (diff)
Merge tag 'dm-next-3apr23' of https://source.denx.de/u-boot/custodians/u-boot-dm into next
Enable VPL tests Minor changes with fdt command, vboot test, pinctrl
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pinctrl/pinctrl-uclass.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index 8837726cc16..73dd7b1038b 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -169,34 +169,33 @@ pinctrl_gpio_get_pinctrl_and_offset(struct udevice *dev, unsigned offset,
{
struct ofnode_phandle_args args;
unsigned gpio_offset, pfc_base, pfc_pins;
- int ret;
+ int ret = 0;
+ int i = 0;
- ret = dev_read_phandle_with_args(dev, "gpio-ranges", NULL, 3,
- 0, &args);
- if (ret) {
- dev_dbg(dev, "%s: dev_read_phandle_with_args: err=%d\n",
- __func__, ret);
- return ret;
- }
+ while (ret == 0) {
+ ret = dev_read_phandle_with_args(dev, "gpio-ranges", NULL, 3,
+ i++, &args);
+ if (ret) {
+ dev_dbg(dev, "%s: dev_read_phandle_with_args: err=%d\n",
+ __func__, ret);
+ return ret;
+ }
- ret = uclass_get_device_by_ofnode(UCLASS_PINCTRL,
- args.node, pctldev);
- if (ret) {
- dev_dbg(dev,
- "%s: uclass_get_device_by_of_offset failed: err=%d\n",
- __func__, ret);
- return ret;
- }
+ ret = uclass_get_device_by_ofnode(UCLASS_PINCTRL,
+ args.node, pctldev);
+ if (ret) {
+ dev_dbg(dev,
+ "%s: uclass_get_device_by_of_offset failed: err=%d\n",
+ __func__, ret);
+ return ret;
+ }
- gpio_offset = args.args[0];
- pfc_base = args.args[1];
- pfc_pins = args.args[2];
+ gpio_offset = args.args[0];
+ pfc_base = args.args[1];
+ pfc_pins = args.args[2];
- if (offset < gpio_offset || offset > gpio_offset + pfc_pins) {
- dev_dbg(dev,
- "%s: GPIO can not be mapped to pincontrol pin\n",
- __func__);
- return -EINVAL;
+ if (offset >= gpio_offset && offset <= gpio_offset + pfc_pins)
+ break;
}
offset -= gpio_offset;