All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Luca Ceresoli <luca@lucaceresoli.net>
Cc: "Pali Rohár" <pali@kernel.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org,
	kernel-team@android.com,
	"Alyssa Rosenzweig" <alyssa@rosenzweig.io>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>
Subject: Re: [PATCH v2] PCI: apple: Follow the PCIe specifications when resetting the port
Date: Tue, 23 Nov 2021 08:48:50 +0000	[thread overview]
Message-ID: <87sfvncl59.wl-maz@kernel.org> (raw)
In-Reply-To: <4fd0438e-b86b-2e1a-ea9a-2297d3580836@lucaceresoli.net>

Luca,

On Mon, 22 Nov 2021 21:32:15 +0000,
Luca Ceresoli <luca@lucaceresoli.net> wrote:
>
> >> Just one comment. PERST# (PCIe Reset) is active-low signal. De-asserting
> >> means to really set value to 1.
> >>
> >> But there was a discussion that de-asserting should be done by call:
> >>   gpiod_set_value(reset, 0);
> >>
> >> https://lore.kernel.org/linux-pci/51be082a-ff10-8a19-5648-f279aabcac51@lucaceresoli.net/
> >>
> >> Could we make this new pcie-apple.c driver to use gpiod_set_value(reset, 0)
> >> for de-asserting, like in other drivers?
> 
> I agree it should be done right from the beginning since this is a new
> driver. Fixing it later is a painful process.

No more painful than anything else. At this stage, using a positive or
negative polarity is immaterial, as there is no core infrastructure
making any use of this behaviour (every single driver must reinvent
its own square wheel). If such an infrastructure existed, that'd
indeed be a requirement. For now, this is merely a convention.

> > I guess it depends whether you care about the assertion or the signal
> > itself. I think we may have a bug in the way the GPIOs are handled at
> > the moment, as it makes no difference whether I register the GPIO are
> > active high or active low...
> >
> > I guess that will be yet another thing to debug, but in the meantime
> > we have a reliable reset.
> 
> Strange, in my case the "active low" pin polarity is correctly picked up
> from device tree by the gpiolib code, thus using gpio_set_value(gpiod,
> 1) asserts the pin as it should, resulting in an electrically low pin.

As I said, this looks like a bug, probably in the M1 DT. I'll try to
look into it when I get the time.

	M.

-- 
Without deviation from the norm, progress is not possible.

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Luca Ceresoli <luca@lucaceresoli.net>
Cc: "Pali Rohár" <pali@kernel.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org,
	kernel-team@android.com,
	"Alyssa Rosenzweig" <alyssa@rosenzweig.io>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>
Subject: Re: [PATCH v2] PCI: apple: Follow the PCIe specifications when resetting the port
Date: Tue, 23 Nov 2021 08:48:50 +0000	[thread overview]
Message-ID: <87sfvncl59.wl-maz@kernel.org> (raw)
In-Reply-To: <4fd0438e-b86b-2e1a-ea9a-2297d3580836@lucaceresoli.net>

Luca,

On Mon, 22 Nov 2021 21:32:15 +0000,
Luca Ceresoli <luca@lucaceresoli.net> wrote:
>
> >> Just one comment. PERST# (PCIe Reset) is active-low signal. De-asserting
> >> means to really set value to 1.
> >>
> >> But there was a discussion that de-asserting should be done by call:
> >>   gpiod_set_value(reset, 0);
> >>
> >> https://lore.kernel.org/linux-pci/51be082a-ff10-8a19-5648-f279aabcac51@lucaceresoli.net/
> >>
> >> Could we make this new pcie-apple.c driver to use gpiod_set_value(reset, 0)
> >> for de-asserting, like in other drivers?
> 
> I agree it should be done right from the beginning since this is a new
> driver. Fixing it later is a painful process.

No more painful than anything else. At this stage, using a positive or
negative polarity is immaterial, as there is no core infrastructure
making any use of this behaviour (every single driver must reinvent
its own square wheel). If such an infrastructure existed, that'd
indeed be a requirement. For now, this is merely a convention.

> > I guess it depends whether you care about the assertion or the signal
> > itself. I think we may have a bug in the way the GPIOs are handled at
> > the moment, as it makes no difference whether I register the GPIO are
> > active high or active low...
> >
> > I guess that will be yet another thing to debug, but in the meantime
> > we have a reliable reset.
> 
> Strange, in my case the "active low" pin polarity is correctly picked up
> from device tree by the gpiolib code, thus using gpio_set_value(gpiod,
> 1) asserts the pin as it should, resulting in an electrically low pin.

As I said, this looks like a bug, probably in the M1 DT. I'll try to
look into it when I get the time.

	M.

-- 
Without deviation from the norm, progress is not possible.

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

  reply	other threads:[~2021-11-23  8:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22 10:41 [PATCH v2] PCI: apple: Follow the PCIe specifications when resetting the port Marc Zyngier
2021-11-22 10:41 ` Marc Zyngier
2021-11-22 12:03 ` Pali Rohár
2021-11-22 12:03   ` Pali Rohár
2021-11-22 14:43   ` Marc Zyngier
2021-11-22 14:43     ` Marc Zyngier
2021-11-22 21:32     ` Luca Ceresoli
2021-11-22 21:32       ` Luca Ceresoli
2021-11-23  8:48       ` Marc Zyngier [this message]
2021-11-23  8:48         ` Marc Zyngier
2021-11-23 12:27         ` Mark Kettenis
2021-11-23 12:27           ` Mark Kettenis
2021-11-22 21:50     ` Mark Kettenis
2021-11-22 21:50       ` Mark Kettenis
2021-11-23 12:24       ` Marc Zyngier
2021-11-23 12:24         ` Marc Zyngier
2021-11-23 12:27         ` Pali Rohár
2021-11-23 12:27           ` Pali Rohár
2021-11-23 13:09           ` Marc Zyngier
2021-11-23 13:09             ` Marc Zyngier
2021-11-23 12:49         ` Mark Kettenis
2021-11-23 12:49           ` Mark Kettenis

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=87sfvncl59.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=alyssa@rosenzweig.io \
    --cc=bhelgaas@google.com \
    --cc=kernel-team@android.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=luca@lucaceresoli.net \
    --cc=pali@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.