From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D971612E for ; Mon, 3 Apr 2023 14:22:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23C9CC4339B; Mon, 3 Apr 2023 14:22:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680531722; bh=Wt/kTBu2NIVbnrTBG30OXnfyXtjOjXirjcLHtSwkLeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pahm8Uy09XHP7uiLE5Dk+sotJJ7uk1ZUi6DCVgfWC6O+VhBmRDfQdgmhNtyneJulG eFwClRE2stBBAKpcIqdPrS7NtGf+7mYEedyKzsZoMjknzyX3DJYP1L/M6D/rFkBvpu W5ZQW/Yr2tuyd+rS26gBP9IlsYzWsgZFPy2mS0mo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Horatiu Vultur , Linus Walleij , Sasha Levin Subject: [PATCH 5.4 086/104] pinctrl: ocelot: Fix alt mode for ocelot Date: Mon, 3 Apr 2023 16:09:18 +0200 Message-Id: <20230403140407.515378220@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403140403.549815164@linuxfoundation.org> References: <20230403140403.549815164@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Horatiu Vultur [ 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 Link: https://lore.kernel.org/r/20230206203720.1177718-1-horatiu.vultur@microchip.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/pinctrl-ocelot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index 0a951a75c82b3..cccf1cc8736c6 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -420,7 +420,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; } -- 2.39.2