summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/pinctrl/pinctrl-tegra.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/pinctrl/pinctrl-tegra.c')
-rw-r--r--kernel/drivers/pinctrl/pinctrl-tegra.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/kernel/drivers/pinctrl/pinctrl-tegra.c b/kernel/drivers/pinctrl/pinctrl-tegra.c
index 4c95c2024..0fd7fd2b0 100644
--- a/kernel/drivers/pinctrl/pinctrl-tegra.c
+++ b/kernel/drivers/pinctrl/pinctrl-tegra.c
@@ -624,6 +624,22 @@ static struct pinctrl_desc tegra_pinctrl_desc = {
.owner = THIS_MODULE,
};
+static bool gpio_node_has_range(void)
+{
+ struct device_node *np;
+ bool has_prop = false;
+
+ np = of_find_compatible_node(NULL, NULL, "nvidia,tegra30-gpio");
+ if (!np)
+ return has_prop;
+
+ has_prop = of_find_property(np, "gpio-ranges", NULL);
+
+ of_node_put(np);
+
+ return has_prop;
+}
+
int tegra_pinctrl_probe(struct platform_device *pdev,
const struct tegra_pinctrl_soc_data *soc_data)
{
@@ -703,12 +719,13 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
}
pmx->pctl = pinctrl_register(&tegra_pinctrl_desc, &pdev->dev, pmx);
- if (!pmx->pctl) {
+ if (IS_ERR(pmx->pctl)) {
dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
- return -ENODEV;
+ return PTR_ERR(pmx->pctl);
}
- pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range);
+ if (!gpio_node_has_range())
+ pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range);
platform_set_drvdata(pdev, pmx);