Commit d02b1cab authored by Dipen Patel's avatar Dipen Patel

hte: handle nvidia,gpio-controller property

The dt binding adds nvidia,gpio-controller property from Tegra234 SoC
onwards to simplify code handling gpio chip search. The gpio chip search
is needed for the AON GPIO GTE instances to map the hardware timestamp
GPIO request (coming from the GPIO framework) to the tegra HTE
providers. The patch also adds new gpio chip match function to match
from the fwnode instead of the gpio controller label. The addition
of the property does not break ABI for the existing Tegra194 code.
Signed-off-by: default avatarDipen Patel <dipenp@nvidia.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 0ebc475f
...@@ -679,6 +679,11 @@ static int tegra_get_gpiochip_from_name(struct gpio_chip *chip, void *data) ...@@ -679,6 +679,11 @@ static int tegra_get_gpiochip_from_name(struct gpio_chip *chip, void *data)
return !strcmp(chip->label, data); return !strcmp(chip->label, data);
} }
static int tegra_gpiochip_match(struct gpio_chip *chip, void *data)
{
return chip->fwnode == of_node_to_fwnode(data);
}
static int tegra_hte_probe(struct platform_device *pdev) static int tegra_hte_probe(struct platform_device *pdev)
{ {
int ret; int ret;
...@@ -687,6 +692,7 @@ static int tegra_hte_probe(struct platform_device *pdev) ...@@ -687,6 +692,7 @@ static int tegra_hte_probe(struct platform_device *pdev)
struct device *dev; struct device *dev;
struct tegra_hte_soc *hte_dev; struct tegra_hte_soc *hte_dev;
struct hte_chip *gc; struct hte_chip *gc;
struct device_node *gpio_ctrl;
dev = &pdev->dev; dev = &pdev->dev;
...@@ -754,15 +760,23 @@ static int tegra_hte_probe(struct platform_device *pdev) ...@@ -754,15 +760,23 @@ static int tegra_hte_probe(struct platform_device *pdev)
gc->match_from_linedata = tegra_hte_match_from_linedata; gc->match_from_linedata = tegra_hte_match_from_linedata;
if (of_device_is_compatible(dev->of_node, if (of_device_is_compatible(dev->of_node,
"nvidia,tegra194-gte-aon")) "nvidia,tegra194-gte-aon")) {
hte_dev->c = gpiochip_find("tegra194-gpio-aon", hte_dev->c = gpiochip_find("tegra194-gpio-aon",
tegra_get_gpiochip_from_name); tegra_get_gpiochip_from_name);
else if (of_device_is_compatible(dev->of_node, } else {
"nvidia,tegra234-gte-aon")) gpio_ctrl = of_parse_phandle(dev->of_node,
hte_dev->c = gpiochip_find("tegra234-gpio-aon", "nvidia,gpio-controller",
tegra_get_gpiochip_from_name); 0);
else if (!gpio_ctrl) {
dev_err(dev,
"gpio controller node not found\n");
return -ENODEV; return -ENODEV;
}
hte_dev->c = gpiochip_find(gpio_ctrl,
tegra_gpiochip_match);
of_node_put(gpio_ctrl);
}
if (!hte_dev->c) if (!hte_dev->c)
return dev_err_probe(dev, -EPROBE_DEFER, return dev_err_probe(dev, -EPROBE_DEFER,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment