diff options
author | Rhyland Klein <rklein@nvidia.com> | 2016-04-07 17:37:08 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-04-14 14:01:25 +0200 |
commit | 26e6aaafc8a1e862437003d6e06ba748e7177ea8 (patch) | |
tree | 04ff0595a8c41c7a2dfa54a5bd59212cc0a9b4e6 /drivers/pinctrl/tegra/pinctrl-tegra.c | |
parent | 6ba20a00a36bb47c64581bfa08f1606d4bf0589f (diff) | |
download | op-kernel-dev-26e6aaafc8a1e862437003d6e06ba748e7177ea8.zip op-kernel-dev-26e6aaafc8a1e862437003d6e06ba748e7177ea8.tar.gz |
pinctrl: tegra: clear park bit for all pins
Parking bits might not be cleared by the bootloader properly (if for
instance it doesn't use the device configured by that pin). Clear
the park bits for all the pins during pinctrl probe.
This is present on T210 platforms but not earlier ones, so for earlier
generations, set parked_reg = -1 to disable.
The park bit is used to prevent glitching when reprogramming pinctrl
registers.
Based on work by:
Shravani Dingari <shravanid@nvidia.com>
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/tegra/pinctrl-tegra.c')
-rw-r--r-- | drivers/pinctrl/tegra/pinctrl-tegra.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c index 3f7fce9..053d620 100644 --- a/drivers/pinctrl/tegra/pinctrl-tegra.c +++ b/drivers/pinctrl/tegra/pinctrl-tegra.c @@ -625,6 +625,22 @@ static struct pinctrl_desc tegra_pinctrl_desc = { .owner = THIS_MODULE, }; +static void tegra_pinctrl_clear_parked_bits(struct tegra_pmx *pmx) +{ + int i = 0; + const struct tegra_pingroup *g; + u32 val; + + for (i = 0; i < pmx->soc->ngroups; ++i) { + if (pmx->soc->groups[i].parked_reg >= 0) { + g = &pmx->soc->groups[i]; + val = pmx_readl(pmx, g->parked_bank, g->parked_reg); + val &= ~(1 << g->parked_bit); + pmx_writel(pmx, val, g->parked_bank, g->parked_reg); + } + } +} + static bool gpio_node_has_range(void) { struct device_node *np; @@ -725,6 +741,8 @@ int tegra_pinctrl_probe(struct platform_device *pdev, return PTR_ERR(pmx->pctl); } + tegra_pinctrl_clear_parked_bits(pmx); + if (!gpio_node_has_range()) pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range); |