Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1753283iog; Sat, 25 Jun 2022 19:14:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s/bGL9DiOGKn8uH0LJSideOFK8d/Akg9uKB463XR0XQsOR9Y0x7m/rCFGbL9xPNp954kMl X-Received: by 2002:a17:907:3d92:b0:726:39f9:4a33 with SMTP id he18-20020a1709073d9200b0072639f94a33mr6172117ejc.766.1656209663295; Sat, 25 Jun 2022 19:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656209663; cv=none; d=google.com; s=arc-20160816; b=r6Onq5Qr6HNrUb+25yGgxETxUfptgg+IsDfxBSQ3l5nQXNapwVCcL1/JumRsGf6lyT 94P69NJCczSNSUobwZcUMS40Td1WPtQJe8NmzyTW4HVuZGsztdYxi1VGb7u22njVBT9Q dxsitG9oCJ4f5QKMwBl66xvJd28wSU0lGsZEmVJwzthbeU0MREwReN/LcVEEDtiV0/iU VDzCJAwi+9LfIWwUfXrfmoFQrrPyI/41Cgd2ihbOgiw0PMLwLvXJ2QfltOJ++mLmsiBP yKCbjbWR8UibcARnZJPgx+RZN2TKL6CSH2gWOJDpPd9SH2+tzVc2OhwskSb9lkypLDgw PIog== 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=VmkPadUXm+jNeGFZShV9Kc9gEUi6keCx3qEtbHtSObY=; b=M3GPTGh31Up8I2/+OrYn1wtOa2HxsAXjgiAALvSHPlqZBTxB0CxNcva2xbznFm+YY+ jbQfAei15wi0PUgd/hdoAQbptpXm3dDPrqzBolnBi8KIzFG7GmE2PtZiHJaxeLVq6Gc0 VD+yZNsXgJbZs8xCJ5WMI1gC0/UWJHEKHT61JPTM4Xjm954X3V8Kf/cmCdmOD0NNXl6W gjb5+lRNqG7Q5q3xgSU0pbNgayf1WvXNQnex99t28Nqao0NoMXYnIm5NLe9xqiECZxhV szkZeknldhTjjDE9X7jbtWdWL57ECi2IjX+w1qGfGOa0aYbygm4h3RwsDm+CyYrodelz scbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=I7x1Vz7E; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=tXTcfpyw; 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 ht15-20020a170907608f00b00716646dc05fsi5911678ejc.860.2022.06.25.19.13.59; Sat, 25 Jun 2022 19:14:23 -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=fm3 header.b=I7x1Vz7E; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=tXTcfpyw; 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 S233598AbiFZCMH (ORCPT + 99 others); Sat, 25 Jun 2022 22:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233838AbiFZCMD (ORCPT ); Sat, 25 Jun 2022 22:12:03 -0400 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EF7214020; Sat, 25 Jun 2022 19:12:02 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id B9C903200907; Sat, 25 Jun 2022 22:12:00 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sat, 25 Jun 2022 22:12:01 -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=fm3; t=1656209520; x=1656295920; bh=Vm kPadUXm+jNeGFZShV9Kc9gEUi6keCx3qEtbHtSObY=; b=I7x1Vz7ELq3OA26XSP N+Fs2X4E39/2bSpj07Zyje7oNUyXphaEQgfbW7ms+cxz64KxEvL/9MD/ZLCB48A7 Y5xa/ohA5+kVrJfccP3jn6ZvD4EYkEBX+Y+XA7U8kBR5Q62HNPvcuD3k4rVsyAC4 Z7R92pa+Z9cQKGsrtUEtf8G3cnx0qpVPiBAOIhNZR3FJzfZ9MdxMe7ozW0m3Epwt ei+5EQ6QwMs+FlxpfPb111DyH4wHC+16hH1LrpTO8XSDx5cislSUjWPbjAYXIdd5 CwtTWgH/uT16mEIqWJmZnS9SMJrOzHWA0e1ICoF1v7GHpIk5wYfifjUZIs4HcT8Y +GiA== 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=fm2; t=1656209520; x=1656295920; bh=VmkPadUXm+jNe GFZShV9Kc9gEUi6keCx3qEtbHtSObY=; b=tXTcfpyw0gAV0GyG0lwuZ5zr0SPHg jkcP+b7cV8T9nNDVuaD4IRnoq138EKEPt+3jdQBhB3DoCVur9JB6xMcQiET63L3c OaGODm9y1hrm4F75i4rltPrQtHW/poGa0qsin5twsE32Z/GobMAhGRYPC2cXGk7d L9P07LRBAJG3fDadRZUcvzE5ginQ6wuVv46XPvHBV8TuC9lT2equ+z0FMs0BYFHv yGqBZD9aE0MoPQj3kHiM65MTps3+G6KFJSFOvvsg9xlRihQvblJNIndaO2UBik+T pEQScuwRQArSOTKtFlzFnRg/QHOkPsvDLwz2cpv+5zcxJeV/rCwAOa2fA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudegvddgheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 25 Jun 2022 22:11:59 -0400 (EDT) From: Samuel Holland To: Chen-Yu Tsai , Jernej Skrabec , Linus Walleij Cc: Samuel Holland , Krzysztof Kozlowski , Maxime Ripard , Ondrej Jirman , 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 Subject: [PATCH 3/6] pinctrl: sunxi: Support the 2.5V I/O bias mode Date: Sat, 25 Jun 2022 21:11:44 -0500 Message-Id: <20220626021148.56740-4-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220626021148.56740-1-samuel@sholland.org> References: <20220626021148.56740-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 H616 and newer SoCs feature a 2.5V I/O bias mode in addition to the 1.8V and 3.3V modes. This mode is entered by selecting the 3.3V level and disabling the "withstand function". H616 supports this capability on its main PIO only. A100 supports this capability on both its PIO and R-PIO. Signed-off-by: Samuel Holland --- drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c | 1 + drivers/pinctrl/sunxi/pinctrl-sun50i-a100.c | 2 +- drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c | 2 +- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 10 ++++++++++ drivers/pinctrl/sunxi/pinctrl-sunxi.h | 7 +++++++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c b/drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c index 21054fcacd34..afc1f5df7545 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c +++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c @@ -82,6 +82,7 @@ static const struct sunxi_pinctrl_desc a100_r_pinctrl_data = { .npins = ARRAY_SIZE(a100_r_pins), .pin_base = PL_BASE, .irq_banks = 1, + .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_CTL, }; static int a100_r_pinctrl_probe(struct platform_device *pdev) diff --git a/drivers/pinctrl/sunxi/pinctrl-sun50i-a100.c b/drivers/pinctrl/sunxi/pinctrl-sun50i-a100.c index e69f6da40dc0..f682e0e4244d 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sun50i-a100.c +++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-a100.c @@ -684,7 +684,7 @@ static const struct sunxi_pinctrl_desc a100_pinctrl_data = { .npins = ARRAY_SIZE(a100_pins), .irq_banks = 7, .irq_bank_map = a100_irq_bank_map, - .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL, + .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_CTL, }; static int a100_pinctrl_probe(struct platform_device *pdev) diff --git a/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c b/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c index 152b71226a80..d6ca720ee8d8 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c +++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c @@ -525,7 +525,7 @@ static const struct sunxi_pinctrl_desc h616_pinctrl_data = { .irq_banks = ARRAY_SIZE(h616_irq_bank_map), .irq_bank_map = h616_irq_bank_map, .irq_read_needs_mux = true, - .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL, + .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_CTL, }; static int h616_pinctrl_probe(struct platform_device *pdev) diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index 3c5e71359ca8..eb3d595f816a 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -662,6 +662,16 @@ static int sunxi_pinctrl_set_io_bias_cfg(struct sunxi_pinctrl *pctl, reg &= ~IO_BIAS_MASK; writel(reg | val, pctl->membase + sunxi_grp_config_reg(pin)); return 0; + case BIAS_VOLTAGE_PIO_POW_MODE_CTL: + val = uV > 1800000 && uV <= 2500000 ? BIT(bank) : 0; + + raw_spin_lock_irqsave(&pctl->lock, flags); + reg = readl(pctl->membase + PIO_POW_MOD_CTL_REG); + reg &= ~BIT(bank); + writel(reg | val, pctl->membase + PIO_POW_MOD_CTL_REG); + raw_spin_unlock_irqrestore(&pctl->lock, flags); + + fallthrough; case BIAS_VOLTAGE_PIO_POW_MODE_SEL: val = uV <= 1800000 ? 1 : 0; diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h index a32bb5bcb754..0f1aab58650c 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h @@ -98,6 +98,7 @@ #define PINCTRL_SUN8I_V3S BIT(10) #define PIO_POW_MOD_SEL_REG 0x340 +#define PIO_POW_MOD_CTL_REG 0x344 enum sunxi_desc_bias_voltage { BIAS_VOLTAGE_NONE, @@ -111,6 +112,12 @@ enum sunxi_desc_bias_voltage { * register, as seen on H6 SoC, for example. */ BIAS_VOLTAGE_PIO_POW_MODE_SEL, + /* + * Bias voltage is set through PIO_POW_MOD_SEL_REG + * and PIO_POW_MOD_CTL_REG register, as seen on + * A100 and D1 SoC, for example. + */ + BIAS_VOLTAGE_PIO_POW_MODE_CTL, }; struct sunxi_desc_function { -- 2.35.1