diff options
Diffstat (limited to 'drivers/pinctrl/pinctrl-rockchip.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-rockchip.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index c84bd0e1ce5a..866969ab30f7 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -24,6 +24,8 @@ #include <linux/of_address.h> #include <linux/of_device.h> #include <linux/of_irq.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> #include <linux/pinctrl/machine.h> #include <linux/pinctrl/pinconf.h> #include <linux/pinctrl/pinctrl.h> @@ -2370,6 +2372,12 @@ static int rockchip_pmx_set(struct pinctrl_dev *pctldev, unsigned selector, dev_dbg(dev, "enable function %s group %s\n", info->functions[selector].name, info->groups[group].name); + if (info->groups[group].io_domain && + !platform_get_drvdata(info->groups[group].io_domain)) { + dev_err(info->dev, "IO domain device is required but not probed yet, deferring..."); + return -EPROBE_DEFER; + } + /* * for each pin in the pin group selected, program the corresponding * pin function number in the config register. @@ -2676,6 +2684,7 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, { struct device *dev = info->dev; struct rockchip_pin_bank *bank; + struct device_node *node; int size; const __be32 *list; int num; @@ -2697,6 +2706,16 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, if (!size || size % 4) return dev_err_probe(dev, -EINVAL, "wrong pins number or pins and configs should be by 4\n"); + node = of_parse_phandle(np, "rockchip,io-domains", 0); + if (node) { + grp->io_domain = of_find_device_by_node(node); + of_node_put(node); + if (!grp->io_domain) { + dev_err(info->dev, "couldn't find IO domain device\n"); + return -ENODEV; + } + } + grp->npins = size / 4; grp->pins = devm_kcalloc(dev, grp->npins, sizeof(*grp->pins), GFP_KERNEL); |