From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: "Leonard, Niall" <Niall.Leonard@ncr.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] gpio: mmio: Use new flag BGPIOF_NO_INPUT.
Date: Mon, 13 Mar 2023 16:11:40 +0200 [thread overview]
Message-ID: <ZA8vHLozhRrYRrER@smile.fi.intel.com> (raw)
In-Reply-To: <ace51cc4-aa77-7ac0-b83f-12057a9bbae6@ncr.com>
On Mon, Mar 13, 2023 at 01:56:24PM +0000, Leonard, Niall wrote:
> On 12/02/2023 12:38, Andy Shevchenko wrote:
> > On Tue, Jan 31, 2023 at 01:49:38PM +0000, Niall Leonard wrote:
> >> Add new flag BGPIOF_NO_INPUT to header file.
> >> Use the existing shadow data register 'bgpio_data' to allow
> >> the last written value to be returned by the read operation
> >> when BGPIOF_NO_INPUT flag is set.
> >> Ensure this change only applies to the specific binding "wd,mbl-gpio".
> >
> > I'm wondering why do we need that.
> >
> > I mean the reading back the (possible cached) output value is the right thing
> > to do by default for GPIO (in output mode) or GPO. So, instead you can simply
> > check the current direction of the pin and return (cached) value.
> >
> > Or did I miss something?
> >
> My thinking here was that I don't want to break any existing code which
> relies on the read always reading the physical port.
> I'm going to rethink my approach here as I'm starting to think the
> better approach would be to modify the gpio-74xx-mmio.c driver to cater
> for this hardware.
That's why we need a greatest denominator here, right?
Currently we have a full inconsistency on how drivers are implementing
all this. What I'm suggesting is to always have the following:
1) if pin is input or OS/OD/OE/OC -- read input buffer;
2) if pin is output, always read (cached) value.
Yes, there is an opinion to find a short circuit by reading input in
the output mode, but I consider that impractical complication.
Note, that above will also satisfy all (common) hardware limitations.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2023-03-13 14:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-31 13:49 [PATCH v2 0/2] Introduce new optional property to mark port as write only Niall Leonard via B4 Submission Endpoint
2023-01-31 13:49 ` [PATCH v2 1/2] dt-bindings: improve wb,mbl-gpio binding documentation Niall Leonard via B4 Submission Endpoint
2023-02-01 8:27 ` Krzysztof Kozlowski
2023-02-07 9:49 ` Leonard, Niall
2023-02-07 10:48 ` Krzysztof Kozlowski
2023-01-31 13:49 ` [PATCH v2 2/2] gpio: mmio: Use new flag BGPIOF_NO_INPUT Niall Leonard via B4 Submission Endpoint
2023-02-12 12:38 ` Andy Shevchenko
2023-03-13 13:56 ` Leonard, Niall
2023-03-13 14:11 ` Andy Shevchenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZA8vHLozhRrYRrER@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=Niall.Leonard@ncr.com \
--cc=brgl@bgdev.pl \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox