From: Lucas Stach <l.stach@pengutronix.de>
To: "Maíra Canal" <maira.canal@usp.br>
Cc: hongxing.zhu@nxp.com, lorenzo.pieralisi@arm.com, robh@kernel.org,
Bjorn Helgaas <bhelgaas@google.com>,
Bjorn Helgaas <helgaas@kernel.org>,
shawnguo@kernel.org, s.hauer@pengutronix.de,
kernel@pengutronix.de, linux-imx@nxp.com,
linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 RESEND] PCI: imx6: Replace legacy gpio interface for gpiod interface
Date: Mon, 01 Nov 2021 15:58:31 +0100 [thread overview]
Message-ID: <557e68ad15634ddb65c98ebf80cd7ef962ac2608.camel@pengutronix.de> (raw)
In-Reply-To: <CAH7FV3nyyLndqTdJYN8HDxU4C7pW0-DLu6ZSOLof2=tEEHbHxQ@mail.gmail.com>
Am Montag, dem 01.11.2021 um 11:44 -0300 schrieb Maíra Canal:
> ?
> > > /* Some boards don't have PCIe reset GPIO. */
> > > - if (gpio_is_valid(imx6_pcie->reset_gpio)) {
> > > - gpio_set_value_cansleep(imx6_pcie->reset_gpio,
> > > + if (imx6_pcie->reset_gpio) {
> > > + gpiod_set_value_cansleep(imx6_pcie->reset_gpio,
> > > imx6_pcie->gpio_active_high);
> > > msleep(100);
> > > - gpio_set_value_cansleep(imx6_pcie->reset_gpio,
> > > + gpiod_set_value_cansleep(imx6_pcie->reset_gpio,
> > > !imx6_pcie->gpio_active_high);
> >
> > I don't think this is correct. gpiod_set_value sets the logical line
> > state, so if the GPIO is specified as active-low in the DT, the real
> > line state will be negated. The only reason why the reset-gpio-active-
> > high property even exists is that old DTs might specify the wrong GPIO
> > polarity in the reset-gpio DT description. I think you need to use to
> > gpiod_set_raw_value API here to get the expected real line state even
> > with a broken DT description.
> >
> > Regards,
> > Lucas
> >
>
> I'm a beginner in kernel development, so I'm sorry for the question.
> If I change gpiod_set_value_cansleep for gpiod_set_raw_value, wouldn't
> I change the behavior of the driver? I replaced
> gpio_set_value_cansleep for gpiod_set_value_cansleep because they have
> the same behavior and I didn't change the logic states. Thank you for
> the feedback!
Yes, you need to use the _cansleep variant of the API to keep the
context information. The point I was trying to make was that you
probably (please double check, that's just an assumption on my side)
need to use the _raw variant of the gpiod API to keep the current
behavior of the driver, as we are setting the physical line state
purely depending on the reset-gpio-active-high property presence, not
the logical line state, which would take into account the polarity
specified in the DT gpio descriptor.
I guess the right API call here would be
gpiod_set_raw_value_cansleep().
Regards,
Lucas
next prev parent reply other threads:[~2021-11-01 14:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-01 14:03 Maíra Canal
2021-11-01 14:21 ` Lucas Stach
2021-11-01 14:44 ` Maíra Canal
2021-11-01 14:58 ` Lucas Stach [this message]
2021-11-02 0:45 ` Maíra Canal
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=557e68ad15634ddb65c98ebf80cd7ef962ac2608.camel@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=bhelgaas@google.com \
--cc=helgaas@kernel.org \
--cc=hongxing.zhu@nxp.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=maira.canal@usp.br \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@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
all inboxes | Powered by JetHome®