Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp276321imw; Tue, 12 Jul 2022 19:54:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t39AD3SMfDpLaD82HtAzjhixv6MW/9IIMZx9xUTmqSsGnakbbWiwS6oJ04JzUzKUQvbBaI X-Received: by 2002:a05:6a00:1386:b0:52a:d5f9:2837 with SMTP id t6-20020a056a00138600b0052ad5f92837mr1232892pfg.5.1657680867625; Tue, 12 Jul 2022 19:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657680867; cv=none; d=google.com; s=arc-20160816; b=vtVt61sxSrJzqAkb1P4vfrc3Bz5NUs1p95Wxe6vz2Me4ZgI8OuVjfnnki36+Z0tu4c pkYd7hDSelnSkdTmA1sfq/4JW4+4J7t1Qmm/pxpUDfdIek0A7KZ3OCq3u6tv3isayFQx f3S/KopPXkk9zVZoqbhyalT4xvTHLp/+Zzyn6LIsaitsxH3QRCyvWgtSVzpeNWn0158P rHE0jS8/WUdRnuF5/7GQB/rLeBoOIVqhnY6ONVgwtnCuHVumxmt+o28cYwDunMt/YkKT gRRhCX5maP0iytdGVLcxlB9D9pxZEjycFjpUePV6foMTw43x1sdSHfQ2zncpTtHMlyeW 7e+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=THeS8xy4Zm5mdWzYbARJ4M+iZXKF70sJR2l6+NqN65g=; b=QM0guMDPPwiSnWFXMxzcpcBZLAJRV0I1ivylfx+qbGBOMqyIW3mfNUIkHvEQts/d4A eE3CLuAAUJtWowL4LNvlKWD/X5uAdDZTNGWszI/9QfbvuS0nbJ2I+YTDeQTUe3Tbldm1 vbIBHWTImfwAXu9NC95KcVEBJTRdCcEn9Xd8PP7fRENZIxQ3aQnUvlJs/lS8K2lwXnr9 bVZrI6c+ysJtijJwp+8pO7U+hWbkV0kWAmOkF1Op4HJKzM07okEreVBFBi2ko6wDNUEC MeXbEigf42nReWCc9mJdndzioUYUqOs5IYQcCY2hGzRpKi0gfSviTGaUsyjcJt65tQH4 815w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm1 header.b=ioldxu42; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=LA9TK9aW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a056a0008c300b0052542cfb5c4si16503495pfu.235.2022.07.12.19.54.14; Tue, 12 Jul 2022 19:54:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm1 header.b=ioldxu42; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=LA9TK9aW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229993AbiGMCwz (ORCPT + 99 others); Tue, 12 Jul 2022 22:52:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232160AbiGMCwu (ORCPT ); Tue, 12 Jul 2022 22:52:50 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E608AD4BE6; Tue, 12 Jul 2022 19:52:39 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 2345E5C0167; Tue, 12 Jul 2022 22:52:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 12 Jul 2022 22:52:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1657680759; x=1657767159; bh=TH eS8xy4Zm5mdWzYbARJ4M+iZXKF70sJR2l6+NqN65g=; b=ioldxu42vU48K401aB B9epgJXtYbyEcPUMHhMS6S/fX2xo/PX5NVuie8OC4SSzeSaZxytQfZvlN1uqOXZ6 SlXPUkosNfcmlsqwb8FW8EJZ+yguO9MYJ00prZFFu8g9vOcGbNzZ4nrQwdWv0pCw jka30OTLl3rW1nNaTR8G42t79Cxg8GkG6efCvv4rxBhUuOAk9NEwgxd117ScpEtq WVg1m8Ad5Dk0skxISWD2A16eJFwD7crwuDZD7lOirOJXMbbvnIP0Quk5Lyp7M6JC mdhNOxqDU9Z6PbfSsgWbcmz354rrqMIE3V3PBr7cLdhwi60GA+clPa7O5/CxYb4N 8EVA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1657680759; x=1657767159; bh=THeS8xy4Zm5md WzYbARJ4M+iZXKF70sJR2l6+NqN65g=; b=LA9TK9aW5CrKSvbrXeJaUKmXDuxdg 9s+3rEBM92WXzdl+mNgGtBTLtabVopfY0Ny1rWVtboV15RRHvaTjcqsr/CuApQ4O LikRZUsOJ38T3uRJY62NIx3WJD6Ipk4mpFJGdfrTKzDPMiVrNYbsvBjdTww6DfzO TeAfO/v4FuUkw7zvbyUEG0aw1EiLJeBSzlgybi+aj0LX5xol0B9vPqCwHM+5dpAt PiC/gVv/+HqSsGBSnWpmcqLKM8bDkyluy19iK5P7l0S9D1LQeYHPzM/LLJLbZdoj 8mWPct5UXlT/nwC59yg2AdYsy8JXLv/CaLYtQWJiwk3KUDW2AVHvpNKpQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudejiedgieeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 12 Jul 2022 22:52:38 -0400 (EDT) From: Samuel Holland To: Chen-Yu Tsai , Jernej Skrabec , Linus Walleij , Andre Przywara Cc: Samuel Holland , Krzysztof Kozlowski , Maxime Ripard , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev, Heiko Stuebner Subject: [PATCH v2 2/6] pinctrl: sunxi: Add I/O bias setting for H6 R-PIO Date: Tue, 12 Jul 2022 21:52:29 -0500 Message-Id: <20220713025233.27248-3-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220713025233.27248-1-samuel@sholland.org> References: <20220713025233.27248-1-samuel@sholland.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org H6 requires I/O bias configuration on both of its PIO devices. Previously it was only done for the main PIO. The setting for Port L is at bit 0, so the bank calculation needs to account for the pin base. Otherwise the wrong bit is used. Fixes: cc62383fcebe ("pinctrl: sunxi: Support I/O bias voltage setting on H6") Reviewed-by: Jernej Skrabec Tested-by: Heiko Stuebner Signed-off-by: Samuel Holland --- (no changes since v1) drivers/pinctrl/sunxi/pinctrl-sun50i-h6-r.c | 1 + drivers/pinctrl/sunxi/pinctrl-sunxi.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/sunxi/pinctrl-sun50i-h6-r.c b/drivers/pinctrl/sunxi/pinctrl-sun50i-h6-r.c index 487a76c45f7e..3aba0aec3d78 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sun50i-h6-r.c +++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-h6-r.c @@ -106,6 +106,7 @@ static const struct sunxi_pinctrl_desc sun50i_h6_r_pinctrl_data = { .npins = ARRAY_SIZE(sun50i_h6_r_pins), .pin_base = PL_BASE, .irq_banks = 2, + .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL, }; static int sun50i_h6_r_pinctrl_probe(struct platform_device *pdev) diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index d9327d7d56ee..3c5e71359ca8 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -622,7 +622,7 @@ static int sunxi_pinctrl_set_io_bias_cfg(struct sunxi_pinctrl *pctl, unsigned pin, struct regulator *supply) { - unsigned short bank = pin / PINS_PER_BANK; + unsigned short bank; unsigned long flags; u32 val, reg; int uV; @@ -638,6 +638,9 @@ static int sunxi_pinctrl_set_io_bias_cfg(struct sunxi_pinctrl *pctl, if (uV == 0) return 0; + pin -= pctl->desc->pin_base; + bank = pin / PINS_PER_BANK; + switch (pctl->desc->io_bias_cfg_variant) { case BIAS_VOLTAGE_GRP_CONFIG: /* @@ -655,8 +658,6 @@ static int sunxi_pinctrl_set_io_bias_cfg(struct sunxi_pinctrl *pctl, else val = 0xD; /* 3.3V */ - pin -= pctl->desc->pin_base; - reg = readl(pctl->membase + sunxi_grp_config_reg(pin)); reg &= ~IO_BIAS_MASK; writel(reg | val, pctl->membase + sunxi_grp_config_reg(pin)); -- 2.35.1