diff options
author | Jin Park <jinyoungp@nvidia.com> | 2011-06-17 15:17:19 +0900 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:47:11 -0800 |
commit | 66096378b33d5796746e16d405c0a47c49f61ebf (patch) | |
tree | a3dcd65111f03cf8650100566b16d8bd815a970b /arch | |
parent | 962a04f157cead4c55960f29933393502aeee559 (diff) |
arm: tegra: pinmux: Handling unfitted RSVD pinmux option.
When call tegra_pinmux_set_func with unfitted RSVD pinmux option,
to prevent unexpected potential problem, handle to finding more
preferred value.
Bug 839423
Signed-off-by: Jin Park <jinyoungp@nvidia.com>
Original-Change-Id: Idf8a1ece4317d14e94a69df0d1c8d450d7762c14
Reviewed-on: http://git-master/r/37185
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Rebase-Id: Rfb625aa025048c88c44fd96da1e8b0a3db8d013d
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-tegra/pinmux.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/arch/arm/mach-tegra/pinmux.c b/arch/arm/mach-tegra/pinmux.c index e16797d3b420..71b5af6be4aa 100644 --- a/arch/arm/mach-tegra/pinmux.c +++ b/arch/arm/mach-tegra/pinmux.c @@ -295,6 +295,7 @@ static int tegra_pinmux_set_func(const struct tegra_pingroup_config *config) { int mux = -1; int i; + int find = 0; unsigned long reg; unsigned long flags; enum tegra_pingroup pg = config->pingroup; @@ -320,18 +321,37 @@ static int tegra_pinmux_set_func(const struct tegra_pingroup_config *config) func = pingroups[pg].func_safe; if (func & TEGRA_MUX_RSVD) { - mux = func & 0x3; + for (i = 0; i < 4; i++) { + if (pingroups[pg].funcs[i] & func) + mux = i; + + if (pingroups[pg].funcs[i] == func) { + mux = i; + find = 1; + break; + } + } } else { for (i = 0; i < 4; i++) { if (pingroups[pg].funcs[i] == func) { mux = i; + find = 1; break; } } } - if (mux < 0) + if (mux < 0) { + pr_err("The pingroup %s is not supported option %s\n", + pingroup_name(pg), func_name(func)); + WARN_ON(1); return -EINVAL; + } + + if (!find) + pr_warn("The pingroup %s was configured to %s instead of %s\n", + pingroup_name(pg), func_name(pingroups[pg].funcs[mux]), + func_name(func)); spin_lock_irqsave(&mux_lock, flags); |