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=-7.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 A65D2C433E0 for ; Wed, 5 Aug 2020 08:38:00 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 72AC921744 for ; Wed, 5 Aug 2020 08:38:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ESm3+Q60"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="rw/Yi6bO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72AC921744 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.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=hG8xylEomTHzYHSOnAok50dpbq5zOYjHjJYlatUttB0=; b=ESm3+Q60+ceJmanJNHKgvc6sy FIPJGKL6pOQGYX6tJmPBH7+63iys3vA5yMqYK78CideKrMWlx7gKMUIEzafw+fMIKS2m+1sYpK9AO qeTTQ9BBJy9cBGfXucmYdzTAjD39z7FXjF4eiSegZ931px6jvjm+ZKiZbaq+tvdYB0g4JDiiAnioB U9XhpjmPtcnyAOfbKRzWthGwsk6w08lAeIqeTUqGy79Q+muvfAF56/RtM/V3pAELg0fXl/MgotE8Z zyEXI1VZaakMPvzvpFmCvxn88W25Fo5iGYDY6uVoiqOlZ672wra0Ae9wNGKY+d3el+dWse2GvpqcV 7vcQjQJhA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3Euc-0000eZ-AY; Wed, 05 Aug 2020 08:36:38 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3EuW-0000cd-K1 for linux-arm-kernel@lists.infradead.org; Wed, 05 Aug 2020 08:36:33 +0000 Received: from localhost (router.4pisysteme.de [80.79.225.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3D32D21744; Wed, 5 Aug 2020 08:36:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596616591; bh=rq6tPApAB+dxBpQmJ6x3QrSRVGchYJT6t4pWpmDeeTU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rw/Yi6bOhIoSPQ686F+lhFsQCcCekuYkYcOsFIbJr/rfnWdhWEwslRIDaLFYbHpTj jmjt35cCrqpUJeGaYKFQorepSa3Z5wz8JVArtZGq9aop1VXQY405AFC2HYm/ZbTmN7 cxAaMyYiM2my1dK1ZRAQsecKf9uA6MzYqvvSaUj0= Date: Wed, 5 Aug 2020 10:36:29 +0200 From: To: Codrin Ciubotariu Subject: Re: [PATCH 2/4] i2c: core: add generic I2C GPIO recovery Message-ID: <20200805083629.GB1229@kunai> Mail-Followup-To: , Codrin Ciubotariu , , , , , , , , , , References: <20200804095926.205643-1-codrin.ciubotariu@microchip.com> <20200804095926.205643-3-codrin.ciubotariu@microchip.com> MIME-Version: 1.0 In-Reply-To: <20200804095926.205643-3-codrin.ciubotariu@microchip.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200805_043632_994055_3A2B1853 X-CRM114-Status: GOOD ( 19.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, alexandre.belloni@bootlin.com, kamel.bouhara@bootlin.com, linux-kernel@vger.kernel.org, ludovic.desroches@microchip.com, robh+dt@kernel.org, linux-i2c@vger.kernel.org, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org Content-Type: multipart/mixed; boundary="===============3743255958757572409==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============3743255958757572409== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="b5gNqxB1S1yM7hjW" Content-Disposition: inline --b5gNqxB1S1yM7hjW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 04, 2020 at 12:59:24PM +0300, Codrin Ciubotariu wrote: > Multiple I2C bus drivers use similar bindings to obtain information needed > for I2C recovery. For example, for platforms using device-tree, the > properties look something like this: >=20 > &i2c { > ... > pinctrl-names =3D "default", "gpio"; > pinctrl-0 =3D <&pinctrl_i2c_default>; > pinctrl-1 =3D <&pinctrl_i2c_gpio>; > sda-gpios =3D <&pio 0 GPIO_ACTIVE_HIGH>; > scl-gpios =3D <&pio 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; > ... > } >=20 > For this reason, we can add this common initialization in the core. This > way, other I2C bus drivers will be able to support GPIO recovery just by > providing a pointer to platform's pinctrl and calling i2c_recover_bus() > when SDA is stuck low. >=20 > Signed-off-by: Codrin Ciubotariu > --- Applied to for-next, thanks! Two minor change: > + /* for pinctrl state changes, we need all the information */ > + if (!bri->pins_default || !bri->pins_gpio) { > + bri->pinctrl =3D NULL; > + bri->pins_default =3D NULL; > + bri->pins_gpio =3D NULL; > + } else { > + dev_info(dev, "using pinctrl states for GPIO recovery"); > + } I inverted the logic here: 294 /* for pinctrl state changes, we need all the information */ 295 if (bri->pins_default && bri->pins_gpio) { 296 dev_info(dev, "using pinctrl states for GPIO recovery"= ); 297 } else { 298 bri->pinctrl =3D NULL; 299 bri->pins_default =3D NULL; 300 bri->pins_gpio =3D NULL; 301 } I think it is a bit easier to read if the desired path is not in the else case. > + * @pins_default: default state of SCL/SDA lines, when they are assigned= to the > + * I2C bus. Optional. Populated internally for GPIO recovery, if a = state with > + * the name PINCTRL_STATE_DEFAULT is found and pinctrl is valid. > + * @pins_gpio: recovery state of SCL/SDA lines, when they are used as GP= IOs. > + * Optional. Populated internally for GPIO recovery, if this state = is called > + * "gpio" or "recovery" and pinctrl is valid. Added "pinctrl" to "state of SCL/SDA" to make it clear. --b5gNqxB1S1yM7hjW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAl8qb40ACgkQFA3kzBSg KbYZ8A/+IoGrrXtuuVfRr2wWgX3iz5Zj0mVU0fXGVwN0YoGe3OcHNdo6S7f+Pzy/ I1PZcxBBNjC9ffOXPWBxm8QC/HcT6ZHpY+Bs6CEJMFwXraTBDo8n93iZ3F0tpIbi LpXpYLUSbxG6nw9t9HMyoxwtIx4a0vP0r6RAqzj+DFIXUc4dimmUlTVV4dxpJ5Pm HcPxS7b+X1X3vKFw721eKQAhZfJW3iqo6gqRCGBPByORmxApG/I3M8de+Jb/7aqg n+bne+1ULGILn93WyDVHrQ9b6l5Lj+iD9leRqUaeEfnZAv7zMvEmx4UnwFf3OsSE /HWTxB5YZjjkOOKFGodTtd4iOy0rB2BtRRCnVXR2oF2FdotinYHDhPDF/n0KDpLi obtYBBh1jozlHxE1Mm1ZK5Db5kgYasjqAzZgXC4q2EIB4aY7GoaUIswts0QbxH/T Vep/4DNZQCfIRXbiQWVx0ocaKIBGAC/e6GBjz3378MhQ730O6F/iVNacTXFb/MEy TPRzItlBBRkHQlci0bmymfQPEK6EINwD1IgbaTWYyQy3XXi9RYkiG1Goun6tpolC VcbQTTkhE+3RSaBwTbcr6CBMp2TWRZW0FVhr6oQT6sKQjMmbD7TDY4uQr+2GdCKR KJ3mdnILcKHY7WcZMwCVZu7ZCugLmodXEP1kc2bnXw61ONa8VsE= =WUKN -----END PGP SIGNATURE----- --b5gNqxB1S1yM7hjW-- --===============3743255958757572409== 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 --===============3743255958757572409==--