linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Luca Ceresoli <luca@lucaceresoli.net>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	linux-pci <linux-pci@vger.kernel.org>,
	Linux-OMAP <linux-omap@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Rob Herring <robh@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH v2] PCI: dra7xx: Fix reset behaviour
Date: Fri, 25 Jun 2021 01:34:48 +0200	[thread overview]
Message-ID: <20210624233448.ouvczfbogmtnbrye@pali> (raw)
In-Reply-To: <CACRpkdai2cvoNFR8yH2MHP+R27nQm1HZNK4-mJ50mE7DHrBmXw@mail.gmail.com>

On Friday 25 June 2021 01:18:43 Linus Walleij wrote:
> On Wed, Jun 23, 2021 at 12:23 AM Pali Rohár <pali@kernel.org> wrote:
> 
> > Lorenzo asked a good question how GPIO drives PERST#. And maybe it would
> > be a good idea to unify all pci controller drivers to use same GPIO
> > value for asserting PERST# pin. If it is possible. As we can see it is a
> > big mess.
> >
> > Personally I would like to a see two helper functions like
> >
> >   void pcie_assert_perst(struct gpio_desc *gpio);
> >   void pcie_deassert_perst(struct gpio_desc *gpio);
> >
> > which pci controller driver will use and we will not more handle active
> > high / low state or polarity inversion and meditate if gpio set to zero
> > means assert or de-assert.
> 
> GPIO descriptors (as are used in this driver) are supposed to hide
> and encapsulate polarity inversion so:
> 
> gpiod_set_value(gpiod, 1) == assert the line
> gpiod_set_value(gpiod, 0) == de-assert the line

Problem is that some pci controller drivers (e.g. pci-j721e.c or
pcie-rockchip-host.c) expects that gpiod_set_value_cansleep(gpiod, 1)
de-asserts the line and it is already used in this way.

Which is opposite of the behavior which you wrote above.

> Whether the line is asserted by physically driving the line low or
> high should not be a concern, that is handled in the machine
> description, we support OF, ACPI and even board files to
> define this.
> 
> I would use gpiod_set_value() directly as above and maybe
> add some comments explaining what is going on and that
> the resulting polarity inversion is handled inside gpiolib.
> 
> Because of common misunderstandings we have pondered to just
> search/replace the last argument of gpiod_set_value() from
> an (int value) to a (bool asserted) to make things clear.
> I just never get around to do that.

I would suggest to define enum/macro with word ASSERT and DEASSERT in
its name instead of just true/false boolean or 0/1 int.

In case of this PERST# misunderstanding, having assert/deassert in name
should really help.

> 
> Yours,
> Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-06-24 23:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31  9:05 [PATCH v2] PCI: dra7xx: Fix reset behaviour Luca Ceresoli
2021-05-31 13:32 ` Pali Rohár
2021-05-31 13:54   ` Luca Ceresoli
2021-05-31 16:00     ` Kishon Vijay Abraham I
2021-05-31 16:22       ` Pali Rohár
2021-06-22 10:57         ` Luca Ceresoli
2021-06-22 11:06           ` Pali Rohár
2021-06-22 11:56             ` Lorenzo Pieralisi
2021-06-22 12:16               ` Pali Rohár
2021-06-22 13:31                 ` Luca Ceresoli
2021-06-22 13:57                   ` Kishon Vijay Abraham I
2021-06-22 20:52                     ` Pali Rohár
2021-06-22 21:08                       ` Luca Ceresoli
2021-06-22 21:19                         ` Pali Rohár
2021-06-22 21:36                           ` Luca Ceresoli
2021-06-22 22:23                             ` Pali Rohár
2021-06-24 21:31                               ` Luca Ceresoli
2021-06-24 21:42                                 ` Pali Rohár
2021-06-24 23:18                               ` Linus Walleij
2021-06-24 23:34                                 ` Pali Rohár [this message]
2021-06-25  0:09                                   ` Linus Walleij
2021-06-25  8:05                                     ` Luca Ceresoli
2021-06-22 21:04                     ` Luca Ceresoli
2021-06-24 23:11                     ` Linus Walleij
2021-06-25  8:10                       ` Luca Ceresoli
2021-06-22 14:23                 ` Lorenzo Pieralisi
2021-06-22 20:48                   ` Pali Rohár
2021-06-22 20:55                     ` Pali Rohár
2021-06-22 21:13             ` Luca Ceresoli
2021-06-01  9:03       ` Luca Ceresoli

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=20210624233448.ouvczfbogmtnbrye@pali \
    --to=pali@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=kishon@ti.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=luca@lucaceresoli.net \
    --cc=robh@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;
as well as URLs for NNTP newsgroup(s).