Skip to content

Commit

Permalink
pinctrl: tegra: define GPIO compatible node per SoC
Browse files Browse the repository at this point in the history
Tegra 2 uses a different GPIO controller which uses "tegra20-gpio" as
compatible string.

Make the compatible string the GPIO node is using a SoC specific
property. This prevents the kernel from registering the GPIO range
twice in case the GPIO range is specified in the device tree.

Fixes: 9462510 ("pinctrl: tegra: Only set the gpio range if needed")
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Stefan Agner authored and Linus Walleij committed Jul 29, 2018
1 parent 55aedef commit 3c94d2d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/pinctrl/tegra/pinctrl-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,12 +629,12 @@ static void tegra_pinctrl_clear_parked_bits(struct tegra_pmx *pmx)
}
}

static bool gpio_node_has_range(void)
static bool gpio_node_has_range(const char *compatible)
{
struct device_node *np;
bool has_prop = false;

np = of_find_compatible_node(NULL, NULL, "nvidia,tegra30-gpio");
np = of_find_compatible_node(NULL, NULL, compatible);
if (!np)
return has_prop;

Expand Down Expand Up @@ -728,7 +728,7 @@ int tegra_pinctrl_probe(struct platform_device *pdev,

tegra_pinctrl_clear_parked_bits(pmx);

if (!gpio_node_has_range())
if (!gpio_node_has_range(pmx->soc->gpio_compatible))
pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range);

platform_set_drvdata(pdev, pmx);
Expand Down
1 change: 1 addition & 0 deletions drivers/pinctrl/tegra/pinctrl-tegra.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ struct tegra_pingroup {
*/
struct tegra_pinctrl_soc_data {
unsigned ngpios;
const char *gpio_compatible;
const struct pinctrl_pin_desc *pins;
unsigned npins;
struct tegra_function *functions;
Expand Down
1 change: 1 addition & 0 deletions drivers/pinctrl/tegra/pinctrl-tegra114.c
Original file line number Diff line number Diff line change
Expand Up @@ -1839,6 +1839,7 @@ static const struct tegra_pingroup tegra114_groups[] = {

static const struct tegra_pinctrl_soc_data tegra114_pinctrl = {
.ngpios = NUM_GPIOS,
.gpio_compatible = "nvidia,tegra30-gpio",
.pins = tegra114_pins,
.npins = ARRAY_SIZE(tegra114_pins),
.functions = tegra114_functions,
Expand Down
1 change: 1 addition & 0 deletions drivers/pinctrl/tegra/pinctrl-tegra124.c
Original file line number Diff line number Diff line change
Expand Up @@ -2051,6 +2051,7 @@ static const struct tegra_pingroup tegra124_groups[] = {

static const struct tegra_pinctrl_soc_data tegra124_pinctrl = {
.ngpios = NUM_GPIOS,
.gpio_compatible = "nvidia,tegra30-gpio",
.pins = tegra124_pins,
.npins = ARRAY_SIZE(tegra124_pins),
.functions = tegra124_functions,
Expand Down
1 change: 1 addition & 0 deletions drivers/pinctrl/tegra/pinctrl-tegra20.c
Original file line number Diff line number Diff line change
Expand Up @@ -2221,6 +2221,7 @@ static const struct tegra_pingroup tegra20_groups[] = {

static const struct tegra_pinctrl_soc_data tegra20_pinctrl = {
.ngpios = NUM_GPIOS,
.gpio_compatible = "nvidia,tegra20-gpio",
.pins = tegra20_pins,
.npins = ARRAY_SIZE(tegra20_pins),
.functions = tegra20_functions,
Expand Down
1 change: 1 addition & 0 deletions drivers/pinctrl/tegra/pinctrl-tegra210.c
Original file line number Diff line number Diff line change
Expand Up @@ -1553,6 +1553,7 @@ static const struct tegra_pingroup tegra210_groups[] = {

static const struct tegra_pinctrl_soc_data tegra210_pinctrl = {
.ngpios = NUM_GPIOS,
.gpio_compatible = "nvidia,tegra30-gpio",
.pins = tegra210_pins,
.npins = ARRAY_SIZE(tegra210_pins),
.functions = tegra210_functions,
Expand Down
1 change: 1 addition & 0 deletions drivers/pinctrl/tegra/pinctrl-tegra30.c
Original file line number Diff line number Diff line change
Expand Up @@ -2474,6 +2474,7 @@ static const struct tegra_pingroup tegra30_groups[] = {

static const struct tegra_pinctrl_soc_data tegra30_pinctrl = {
.ngpios = NUM_GPIOS,
.gpio_compatible = "nvidia,tegra30-gpio",
.pins = tegra30_pins,
.npins = ARRAY_SIZE(tegra30_pins),
.functions = tegra30_functions,
Expand Down

0 comments on commit 3c94d2d

Please sign in to comment.