summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoratiu Vultur <horatiu.vultur@microchip.com>2023-02-06 21:37:20 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-05 11:24:58 +0200
commite4fbeaa31362fd209719a0b7ee72f3f6e2e9b57c (patch)
tree371c61f106f2017d8bb350f267ade383422667ee
parent76f09582a191dcf11118fd4bdbf50f538c90fa8d (diff)
downloadlinux-e4fbeaa31362fd209719a0b7ee72f3f6e2e9b57c.tar.gz
linux-e4fbeaa31362fd209719a0b7ee72f3f6e2e9b57c.tar.bz2
linux-e4fbeaa31362fd209719a0b7ee72f3f6e2e9b57c.zip
pinctrl: ocelot: Fix alt mode for ocelot
[ Upstream commit 657fd9da2d4b4aa0a384105b236baa22fa0233bf ] In case the driver was trying to set an alternate mode for gpio 0 or 32 then the mode was not set correctly. The reason is that there is computation error inside the function ocelot_pinmux_set_mux because in this case it was trying to shift to left by -1. Fix this by actually shifting the function bits and not the position. Fixes: 4b36082e2e09 ("pinctrl: ocelot: fix pinmuxing for pins after 31") Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> Link: https://lore.kernel.org/r/20230206203720.1177718-1-horatiu.vultur@microchip.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/pinctrl/pinctrl-ocelot.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c
index 0a36ec8775a3..b14f1b7a625e 100644
--- a/drivers/pinctrl/pinctrl-ocelot.c
+++ b/drivers/pinctrl/pinctrl-ocelot.c
@@ -739,7 +739,7 @@ static int ocelot_pinmux_set_mux(struct pinctrl_dev *pctldev,
regmap_update_bits(info->map, REG_ALT(0, info, pin->pin),
BIT(p), f << p);
regmap_update_bits(info->map, REG_ALT(1, info, pin->pin),
- BIT(p), f << (p - 1));
+ BIT(p), (f >> 1) << p);
return 0;
}