Message ID | 20231115035753.925534-2-chris.packham@alliedtelesis.co.nz |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:a59:b0:164:83eb:24d7 with SMTP id 25csp2372959rwb; Tue, 14 Nov 2023 19:58:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHade26zx1SKWyBo11cu69ddArpuKwCP1Nri52AJ6FFX/nbOM2gowbwkBYhY/4UfVu4Rhl4 X-Received: by 2002:a05:6870:e2d4:b0:1f0:b31:9b7 with SMTP id w20-20020a056870e2d400b001f00b3109b7mr15342490oad.43.1700020691049; Tue, 14 Nov 2023 19:58:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700020691; cv=none; d=google.com; s=arc-20160816; b=0WCvkHwnZIVFB8fq8ajU+4Id7Fu7DXvl4yP20pEwWVNKwB+ycZnsfzPmB/ASs6PZ7E 2cL8l50E+HCV3dxQjjaK6w099bS7ePtQgSEFi66Vo+QwqqO2425pK6wgum0gyoNanMoJ CVQNAd1Q4p+vOsi6IgdEjzxyyPQssqZ2isVdpLq9rKWsMJEuAjBjRPEmL1WrBLS79hHp 7a8vG6mmEyDL8ow0yf7UqUQf8pGENtUEzgKF0ttNxDQUY3eDgi6e7RWuwqE72za4Clo2 zwKe7Its+UUM4wNSRqIPRGvCrtaQ0FJMmQNREhvaAstHNTF38/EJL9VLyQoVFJzleV/z TlIQ== 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 :dkim-signature; bh=nuXpiTc5KMpjZuPeua6pFPuqtUeESCBp8Bsq5TMv/zA=; fh=8dKo/AYUwqZbM6OvPOtd0I4uFRFV6xZWXb1D4LkmzlI=; b=ucMR/ECZa9fBONUMCRoCz154A8qoxXrRHJKF7p8GFfndgX/K0g4SQQmoS+xUDXd7uq l7p67U/t8ojI93g9U7DI8AYbRRbuPWE7uNhXKD8TDIBTD2gM1Oaibd+tvAb5Q3bibrtI s5jfSH5PnyIRtFr6RiZltbWAnrMystE7haM1IJ77xQGE4r1uXDP48GYgO0wehslbMpDF kJ5Nj29OlWM8LOPqOkRltcljHEMy+evGofboVzuEAEAq7wipndCHLi6ShGtVMxHbE9DU EGMvlasMangCkvEyVtgIs62jlTY9eJZDtwWcj5v6lFNjVPX3xMEbh61XIqrxAs+GYXjA I/JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=HTiTsnjB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=alliedtelesis.co.nz Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id ge18-20020a17090b0e1200b00280468bfb94si13476028pjb.185.2023.11.14.19.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 19:58:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=HTiTsnjB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=alliedtelesis.co.nz Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 42527811F939; Tue, 14 Nov 2023 19:58:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234435AbjKOD6J (ORCPT <rfc822;heyuhang3455@gmail.com> + 28 others); Tue, 14 Nov 2023 22:58:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233763AbjKOD6G (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 14 Nov 2023 22:58:06 -0500 Received: from gate2.alliedtelesis.co.nz (gate2.alliedtelesis.co.nz [202.36.163.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 764D2D9 for <linux-kernel@vger.kernel.org>; Tue, 14 Nov 2023 19:58:02 -0800 (PST) Received: from svr-chch-seg1.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id AE1BA2C04EC; Wed, 15 Nov 2023 16:58:00 +1300 (NZDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1700020680; bh=nuXpiTc5KMpjZuPeua6pFPuqtUeESCBp8Bsq5TMv/zA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HTiTsnjBRTpO1kHK8Er+ewHNb1qLDldNdo1MZw1o2NC2shsZST2/I9A8G4bWxupD6 g6zHS66yUo+NeDI/XK/IAYEdFA289XW5ZIGvy61tiJ8EtINa5s85k9T/26dLNM7SAp gdLs/UWHUEuMO7nxFFPlLh920rHCTb65HK7Qwul969gDuYJremElHOmwm4nM9YDQq1 RH8TfUmsAEGYymH3d5EMjyHp/OEKRK3qsqQvVoVXGj3H2yHwKSYmM4X2cFj3ae0C3z X2nJ/crrzmzZ5U+HIF2bGmXU0zFY8aCEfQsqu7Zhb3VrS6h5DuQbEc/3e07KMLWoyH 7+RntO4QVgKng== Received: from pat.atlnz.lc (Not Verified[10.32.16.33]) by svr-chch-seg1.atlnz.lc with Trustwave SEG (v8,2,6,11305) id <B655441c80007>; Wed, 15 Nov 2023 16:58:00 +1300 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by pat.atlnz.lc (Postfix) with ESMTP id 6267F13EE3F; Wed, 15 Nov 2023 16:58:00 +1300 (NZDT) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 5F8D3280590; Wed, 15 Nov 2023 16:58:00 +1300 (NZDT) From: Chris Packham <chris.packham@alliedtelesis.co.nz> To: wsa@kernel.org, andi.shyti@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, gregory.clement@bootlin.com Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Packham <chris.packham@alliedtelesis.co.nz> Subject: [PATCH v6 1/2] dt-bindings: i2c: add bus-reset-gpios property Date: Wed, 15 Nov 2023 16:57:52 +1300 Message-ID: <20231115035753.925534-2-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231115035753.925534-1-chris.packham@alliedtelesis.co.nz> References: <20231115035753.925534-1-chris.packham@alliedtelesis.co.nz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SEG-SpamProfiler-Analysis: v=2.3 cv=L6ZjvNb8 c=1 sm=1 tr=0 a=KLBiSEs5mFS1a/PbTCJxuA==:117 a=BNY50KLci1gA:10 a=k44-534mOdnrxw8nBDMA:9 X-SEG-SpamProfiler-Score: 0 x-atlnz-ls: pat X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 14 Nov 2023 19:58:10 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782600896331369692 X-GMAIL-MSGID: 1782600896331369692 |
Series |
i2c: bus-reset-gpios
|
|
Commit Message
Chris Packham
Nov. 15, 2023, 3:57 a.m. UTC
Add bus-reset-gpios and bus-reset-duration-us properties to the binding
description for i2c busses. These can be used to describe hardware where
a common reset GPIO is connected to all downstream devices on and I2C
bus. This reset will be asserted then released before the downstream
devices on the bus are probed.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
Notes:
I expect the first reaction to this will be a request to convert the
binding to dtschema. I can attempt such a conversion but given it's one
of the more core bindings I expect others may have strong opinions. I
didn't want to start a conversion without hearing those opinions (or if
I could get away without doing the conversion). It's also likely to spin
off a whole lot of work to bring existing device trees into line.
Changes in v6:
- Retarget changes at the i2c core instead of an individual driver
Changes in v5:
- Rename reset-gpios and reset-duration-us to bus-reset-gpios and
bus-reset-duration-us as requested by Wolfram
Changes in v4:
- Add r-by from Krzysztof
Changes in v3:
- Rename reset-delay-us to reset-duration-us to better reflect its
purpose
- Add default: for reset-duration-us
- Add description: for reset-gpios
Changes in v2:
- Update commit message
- Add reset-delay-us property
Documentation/devicetree/bindings/i2c/i2c.txt | 8 ++++++++
1 file changed, 8 insertions(+)
Comments
On 15/11/2023 04:57, Chris Packham wrote: > Add bus-reset-gpios and bus-reset-duration-us properties to the binding > description for i2c busses. These can be used to describe hardware where > a common reset GPIO is connected to all downstream devices on and I2C > bus. This reset will be asserted then released before the downstream > devices on the bus are probed. > > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> > --- > ... > > Documentation/devicetree/bindings/i2c/i2c.txt | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/Documentation/devicetree/bindings/i2c/i2c.txt b/Documentation/devicetree/bindings/i2c/i2c.txt > index fc3dd7ec0445..3f95d71b9985 100644 > --- a/Documentation/devicetree/bindings/i2c/i2c.txt > +++ b/Documentation/devicetree/bindings/i2c/i2c.txt > @@ -99,6 +99,14 @@ wants to support one of the below features, it should adapt these bindings. > indicates that the system is accessible via this bus as an endpoint for > MCTP over I2C transport. > > +- bus-reset-gpios: > + GPIO pin providing a common reset for all downstream devices. This GPIO > + will be asserted then released before the downstream devices are probed. I initially reviewed it, but did not think enough about it. After more consideration, I believe this is not a property of the I2C bus controller. This is a property of each device, even if the GPIO is the same. Linux kernel already supports shared GPIO, so you only need enable-ref-counting on it. Putting it into the controller bindings looks like solving OS issue with incorrect hardware description. Best regards, Krzysztof
Hi Krystof, On 16/11/23 10:29, Krzysztof Kozlowski wrote: > On 15/11/2023 04:57, Chris Packham wrote: >> Add bus-reset-gpios and bus-reset-duration-us properties to the binding >> description for i2c busses. These can be used to describe hardware where >> a common reset GPIO is connected to all downstream devices on and I2C >> bus. This reset will be asserted then released before the downstream >> devices on the bus are probed. >> >> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> >> --- >> > ... > >> Documentation/devicetree/bindings/i2c/i2c.txt | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/i2c/i2c.txt b/Documentation/devicetree/bindings/i2c/i2c.txt >> index fc3dd7ec0445..3f95d71b9985 100644 >> --- a/Documentation/devicetree/bindings/i2c/i2c.txt >> +++ b/Documentation/devicetree/bindings/i2c/i2c.txt >> @@ -99,6 +99,14 @@ wants to support one of the below features, it should adapt these bindings. >> indicates that the system is accessible via this bus as an endpoint for >> MCTP over I2C transport. >> >> +- bus-reset-gpios: >> + GPIO pin providing a common reset for all downstream devices. This GPIO >> + will be asserted then released before the downstream devices are probed. > I initially reviewed it, but did not think enough about it. After more > consideration, I believe this is not a property of the I2C bus > controller. This is a property of each device, even if the GPIO is the same. > > Linux kernel already supports shared GPIO, so you only need > enable-ref-counting on it. That's the kind of breadcrumb I need. Although I can't see enable-ref-counting as any kind of DT property. Do you mean GPIOD_FLAGS_BIT_NONEXCLUSIVE? > Putting it into the controller bindings looks like solving OS issue with > incorrect hardware description. Yes that's entirely whats happening here. > Best regards, > Krzysztof >
On 15/11/2023 22:53, Chris Packham wrote: > Hi Krystof, > > On 16/11/23 10:29, Krzysztof Kozlowski wrote: >> On 15/11/2023 04:57, Chris Packham wrote: >>> Add bus-reset-gpios and bus-reset-duration-us properties to the binding >>> description for i2c busses. These can be used to describe hardware where >>> a common reset GPIO is connected to all downstream devices on and I2C >>> bus. This reset will be asserted then released before the downstream >>> devices on the bus are probed. >>> >>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> >>> --- >>> >> ... >> >>> Documentation/devicetree/bindings/i2c/i2c.txt | 8 ++++++++ >>> 1 file changed, 8 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/i2c/i2c.txt b/Documentation/devicetree/bindings/i2c/i2c.txt >>> index fc3dd7ec0445..3f95d71b9985 100644 >>> --- a/Documentation/devicetree/bindings/i2c/i2c.txt >>> +++ b/Documentation/devicetree/bindings/i2c/i2c.txt >>> @@ -99,6 +99,14 @@ wants to support one of the below features, it should adapt these bindings. >>> indicates that the system is accessible via this bus as an endpoint for >>> MCTP over I2C transport. >>> >>> +- bus-reset-gpios: >>> + GPIO pin providing a common reset for all downstream devices. This GPIO >>> + will be asserted then released before the downstream devices are probed. >> I initially reviewed it, but did not think enough about it. After more >> consideration, I believe this is not a property of the I2C bus >> controller. This is a property of each device, even if the GPIO is the same. >> >> Linux kernel already supports shared GPIO, so you only need >> enable-ref-counting on it. > > That's the kind of breadcrumb I need. Although I can't see > enable-ref-counting as any kind of DT property. Do you mean > GPIOD_FLAGS_BIT_NONEXCLUSIVE? It's not a feature or property of Devicetree, but missing feature of OS. Best regards, Krzysztof
> > Putting it into the controller bindings looks like solving OS issue with > > incorrect hardware description. > Yes that's entirely whats happening here. So, this series can be dropped?
On 20/12/23 06:02, wsa@kernel.org wrote: >>> Putting it into the controller bindings looks like solving OS issue with >>> incorrect hardware description. >> Yes that's entirely whats happening here. > So, this series can be dropped? > I personally would like to see it accepted but it seems there are objections to this approach. I've yet to come up with anything better to offer as an alternative.
> I personally would like to see it accepted but it seems there are > objections to this approach. I've yet to come up with anything better to > offer as an alternative. I see. Thanks for the heads up!
Hi, > > I personally would like to see it accepted but it seems there are > > objections to this approach. I've yet to come up with anything better to > > offer as an alternative. > > I see. Thanks for the heads up! I'm also inclined to have this merged. A real fix might take time. Myself I have developed a prototype for what has been discussed with Krzysztof, but I don't know how much time it will take to get things done. Andi
On 20/12/2023 00:25, Andi Shyti wrote: > Hi, > >>> I personally would like to see it accepted but it seems there are >>> objections to this approach. I've yet to come up with anything better to >>> offer as an alternative. >> >> I see. Thanks for the heads up! > > I'm also inclined to have this merged. A real fix might take > time. NAK If you intend to merge it, then please carry: Nacked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> The patchset is wrong and made of wrong reasons. It claimed GPIO cannot be shared, which is simply not true. > > Myself I have developed a prototype for what has been discussed > with Krzysztof, but I don't know how much time it will take to > get things done. Best regards, Krzysztof
> >>> I personally would like to see it accepted but it seems there are > >>> objections to this approach. I've yet to come up with anything better to > >>> offer as an alternative. > >> > >> I see. Thanks for the heads up! > > > > I'm also inclined to have this merged. A real fix might take > > time. > > NAK > > If you intend to merge it, then please carry: No worries. If this is "abusing" DT, then it is not going to be merged by me. I am sorry for Chris, but sometimes simple problems create quite some fuzz because Linux hardware abstractions has not foreseen certain use cases. Or the APIs dealing with them didn't forsee that. We have been there a lot of times :/
On 20/12/2023 12:03, wsa@kernel.org wrote: > >>>>> I personally would like to see it accepted but it seems there are >>>>> objections to this approach. I've yet to come up with anything better to >>>>> offer as an alternative. >>>> >>>> I see. Thanks for the heads up! >>> >>> I'm also inclined to have this merged. A real fix might take >>> time. >> >> NAK >> >> If you intend to merge it, then please carry: > > No worries. If this is "abusing" DT, then it is not going to be merged > by me. I am sorry for Chris, but sometimes simple problems create quite > some fuzz because Linux hardware abstractions has not foreseen certain > use cases. Or the APIs dealing with them didn't forsee that. We have > been there a lot of times :/ I need the same solution for WSA884x speaker, for which Mark rejected simple shared GPIO (even though it would work there), so I am trying to solve it. It's basically the same case. Now, I am waiting on answer from Sean Anderson whether he continued his work on reset-gpios controller from two years ago. Rob wanted handling reset-gpios by generic reset framework, which would solve these simple cases, here and mine, nicely. Best regards, Krzysztof
> from two years ago. Rob wanted handling reset-gpios by generic reset > framework, which would solve these simple cases, here and mine, nicely. That sounds good. Good luck with it!
Hi Krzysztof, On Wed, Dec 20, 2023 at 08:22:38AM +0100, Krzysztof Kozlowski wrote: > On 20/12/2023 00:25, Andi Shyti wrote: > > Hi, > > > >>> I personally would like to see it accepted but it seems there are > >>> objections to this approach. I've yet to come up with anything better to > >>> offer as an alternative. > >> > >> I see. Thanks for the heads up! > > > > I'm also inclined to have this merged. A real fix might take > > time. > > NAK > > If you intend to merge it, then please carry: > > Nacked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> ehehe... too much drama here :-) I know you nacked this patch and of course won't be taken anywhere. I was actually referring to Chris previous patch rather than this one. Andi > The patchset is wrong and made of wrong reasons. It claimed GPIO cannot > be shared, which is simply not true. > > > > > Myself I have developed a prototype for what has been discussed > > with Krzysztof, but I don't know how much time it will take to > > get things done. > > > Best regards, > Krzysztof >
diff --git a/Documentation/devicetree/bindings/i2c/i2c.txt b/Documentation/devicetree/bindings/i2c/i2c.txt index fc3dd7ec0445..3f95d71b9985 100644 --- a/Documentation/devicetree/bindings/i2c/i2c.txt +++ b/Documentation/devicetree/bindings/i2c/i2c.txt @@ -99,6 +99,14 @@ wants to support one of the below features, it should adapt these bindings. indicates that the system is accessible via this bus as an endpoint for MCTP over I2C transport. +- bus-reset-gpios: + GPIO pin providing a common reset for all downstream devices. This GPIO + will be asserted then released before the downstream devices are probed. + +- bus-reset-duration-us: + Reset duration in us. + default: 1 + Required properties (per child device) --------------------------------------