diff options
author | Michael Riesch <michael.riesch@wolfvision.net> | 2022-01-14 09:47:56 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-01-14 10:32:45 +0100 |
commit | 0fcc8c97ea073aac4ad1e1d8770f1ea2204e6487 (patch) | |
tree | d088f742f4f9cef2cddb139ed4b5793d4fa759e1 /drivers | |
parent | daafe431e65e65d98f388f77673810bed93b58f8 (diff) | |
download | barebox-0fcc8c97ea073aac4ad1e1d8770f1ea2204e6487.tar.gz |
pinctrl: rockchip: use alias rather than full of name
We've so far relied on GPIO controllers being named "gpioX", while the
binding mandates gpio controllers being just called "gpio". This already
broke rk3288 support and rk3568.dtsi upstream also differs from the
version in barebox' arch/arm/dts in that regard.
Instead, do like Linux does and use the alias to match the controllers to
the GPIO banks with a fallback to probe order.
Fixes: 3f2f5980d517 ("dts: update to v5.16-rc1")
Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
[afa: drop strncmp in favor of id comparison, reword commit message]
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220114084757.311697-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pinctrl/pinctrl-rockchip.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 5cf77c58b2..ea748b6004 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -877,18 +877,24 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( struct rockchip_pin_bank *bank; char *name; int grf_offs, pmu_offs, drv_grf_offs, drv_pmu_offs, i, j; + int gpio = 0; match = of_match_node(rockchip_pinctrl_dt_match, node); ctrl = (struct rockchip_pin_ctrl *)match->data; for_each_child_of_node(node, np) { + int id; + if (!of_find_property(np, "gpio-controller", NULL)) continue; + id = of_alias_get_id(np, "gpio"); + if (id < 0) + id = gpio++; + bank = ctrl->pin_banks; for (i = 0; i < ctrl->nr_banks; ++i, ++bank) { - name = bank->name; - if (!strncmp(name, np->name, strlen(name))) { + if (bank->bank_num == id) { bank->of_node = np; if (!rockchip_get_bank_data(bank, dev)) bank->valid = true; |