From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_NEOMUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD077C10F0E for ; Tue, 9 Apr 2019 08:44:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AAAB7206C0 for ; Tue, 9 Apr 2019 08:44:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fuPEBrzA"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="PKJ/YtWL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAAB7206C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7/skQVzQ9uDsSY8XrMSba62hS6sZ3MorjsWhAAFym1c=; b=fuPEBrzAIag/Xlgs4Th3Z8G4C 38+YjZ936oHHm4jR5nSYYMMe/sd/jBhYP4V2W8PjcN/g5dlaFxCvIKF5nf2aDgHx1YDCFy1E6uFIJ FE1Hb4h0eF0/vzhjA7MB4sHc3uX8UX1+1u9NQ87/Gb2u9Jzwn4WrVPBTHYqnLiM5a2aeLJqSs8wf5 ejHN3aH97wLMTMURC4ELCNbqtWj5TL4t/kIPdecu0OyF4hSHBzI+CIknjd4Wq9CgF5Lu3oYUeCwZy 0+H4jdXJGgwJAM5ErURCTkBFNARneKWhRzTMz4cazie2DTyakU1LiKoRLQSJt/ngm8Bt5U+UJDLBp wQShog5+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDmMp-0007ME-SN; Tue, 09 Apr 2019 08:44:31 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDmMo-0007M8-CV for linux-arm-kernel@bombadil.infradead.org; Tue, 09 Apr 2019 08:44:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TDl7fnI+kajlIuSbGjAhEgpn4sUKCwyA82e1OkVLPMI=; b=PKJ/YtWL1UetlpYwrTMs1xPBE v14gtJsa8QC7xGJcUW6LFy+5+GQYuEeKse7JN5zsPcfZZpeva+xvN9xF/JRQymvMDHLtUtp37uJzk t1OhzfQ/2gF4KbXb1G5n23ICnsFHrbSTjFxyIcA3jmiAJr+fVHUxKPXkvsLyJ0l4+EtCAidZmftVp OLuExICS5S2AWXWF8Uofb6ovOb4CfKR2gzuufjtAypFgu47uoNTOLwRFCa/xca0FNEzjwPfT79Yva mQEgngFJvUiLUJbtx2AM7ySF8joxMAKW7ZhPlOmXPZPWHAv3UpNKqDW+8aRnEri+FgRDnS+fhalXR eE3KSb90A==; Received: from relay11.mail.gandi.net ([217.70.178.231]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDmMk-0005qg-EI for linux-arm-kernel@lists.infradead.org; Tue, 09 Apr 2019 08:44:28 +0000 Received: from localhost (aaubervilliers-681-1-89-125.w90-88.abo.wanadoo.fr [90.88.30.125]) (Authenticated sender: maxime.ripard@bootlin.com) by relay11.mail.gandi.net (Postfix) with ESMTPSA id C712D100006; Tue, 9 Apr 2019 08:43:51 +0000 (UTC) Date: Tue, 9 Apr 2019 10:43:51 +0200 From: Maxime Ripard To: megous@megous.com Subject: Re: [PATCH v2 05/13] pinctrl: sunxi: Prepare for alternative bias voltage setting methods Message-ID: <20190409084351.blyvkg47tjbjxwde@flea> References: <20190409002452.14551-1-megous@megous.com> <20190409002452.14551-6-megous@megous.com> MIME-Version: 1.0 In-Reply-To: <20190409002452.14551-6-megous@megous.com> User-Agent: NeoMutt/20180716 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190409_044426_952933_6882E538 X-CRM114-Status: GOOD ( 25.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , David Airlie , Chi-Hsien Lin , dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, linux-stm32@st-md-mailman.stormreply.com, brcm80211-dev-list@cypress.com, Chen-Yu Tsai , Jose Abreu , Naveen Gupta , Linus Walleij , devicetree@vger.kernel.org, Arend van Spriel , Alexandre Torgue , Hante Meuleman , linux-gpio@vger.kernel.org, Rob Herring , Wright Feng , Giuseppe Cavallaro , linux-arm-kernel@lists.infradead.org, Franky Lin , Maxime Coquelin , brcm80211-dev-list.pdl@broadcom.com, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Kalle Valo , Daniel Vetter , "David S. Miller" Content-Type: multipart/mixed; boundary="===============3169411946158569405==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============3169411946158569405== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="56xgcpawz766jjoo" Content-Disposition: inline --56xgcpawz766jjoo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, On Tue, Apr 09, 2019 at 02:24:44AM +0200, megous@megous.com wrote: > From: Ondrej Jirman > > H6 has a different I/O voltage bias setting method than A80. Prepare > existing code for using alternative bias voltage setting methods. > > Signed-off-by: Ondrej Jirman > --- > drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 2 +- > drivers/pinctrl/sunxi/pinctrl-sunxi.c | 41 +++++++++++++---------- > drivers/pinctrl/sunxi/pinctrl-sunxi.h | 5 ++- > 3 files changed, 28 insertions(+), 20 deletions(-) > > diff --git a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c > index da37d594a13d..3aa210079b18 100644 > --- a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c > +++ b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c > @@ -722,7 +722,7 @@ static const struct sunxi_pinctrl_desc sun9i_a80_pinctrl_data = { > .npins = ARRAY_SIZE(sun9i_a80_pins), > .irq_banks = 5, > .disable_strict_mode = true, > - .has_io_bias_cfg = true, > + .io_bias_cfg_variant = IO_BIAS_CFG_V1, > }; > > static int sun9i_a80_pinctrl_probe(struct platform_device *pdev) > diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c > index 8dd25caea2cf..b8dd58ef33b7 100644 > --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c > +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c > @@ -610,7 +610,7 @@ static int sunxi_pinctrl_set_io_bias_cfg(struct sunxi_pinctrl *pctl, > u32 val, reg; > int uV; > > - if (!pctl->desc->has_io_bias_cfg) > + if (!pctl->desc->io_bias_cfg_variant) > return 0; > > uV = regulator_get_voltage(supply); > @@ -621,23 +621,28 @@ static int sunxi_pinctrl_set_io_bias_cfg(struct sunxi_pinctrl *pctl, > if (uV == 0) > return 0; > > - /* Configured value must be equal or greater to actual voltage */ > - if (uV <= 1800000) > - val = 0x0; /* 1.8V */ > - else if (uV <= 2500000) > - val = 0x6; /* 2.5V */ > - else if (uV <= 2800000) > - val = 0x9; /* 2.8V */ > - else if (uV <= 3000000) > - val = 0xA; /* 3.0V */ > - 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)); > + if (pctl->desc->io_bias_cfg_variant == IO_BIAS_CFG_V1) { > + /* > + * Configured value must be equal or greater to actual > + * voltage. > + */ > + if (uV <= 1800000) > + val = 0x0; /* 1.8V */ > + else if (uV <= 2500000) > + val = 0x6; /* 2.5V */ > + else if (uV <= 2800000) > + val = 0x9; /* 2.8V */ > + else if (uV <= 3000000) > + val = 0xA; /* 3.0V */ > + 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)); > + } > > return 0; > } > diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h > index ee15ab067b5f..642f667e99d2 100644 > --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h > +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h > @@ -95,6 +95,9 @@ > #define PINCTRL_SUN7I_A20 BIT(7) > #define PINCTRL_SUN8I_R40 BIT(8) > > +/* Bias voltage configuration done via Pn_GRP_CONFIG registers. */ > +#define IO_BIAS_CFG_V1 1 > + Can we turn this into an enum, and give them proper name? Mentionning an example in the commit would be great too. Something like: enum sunxi_desc_bias_voltage { /* Bias Voltage configuration is done through Pn_GRP_CONFIG registers, as seen on the A83t */ BIAS_VOLTAGE_GRP_CONFIG, }; etc. Thanks! Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --56xgcpawz766jjoo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXKxbRwAKCRDj7w1vZxhR xeaZAQDdcObvBXJGqx+5c2yDDZ/BRZDxHZ7AwgeemSZV8lsHgAD/fDqf3WSJQn7q fsSgPVLlNkihJdSMVpkdwzbozfMMjA8= =L+SO -----END PGP SIGNATURE----- --56xgcpawz766jjoo-- --===============3169411946158569405== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============3169411946158569405==--