All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca@lucaceresoli.net>
To: Marc Zyngier <maz@kernel.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org
Cc: "Pali Rohár" <pali@kernel.org>,
	"Alyssa Rosenzweig" <alyssa@rosenzweig.io>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Mark Kettenis" <mark.kettenis@xs4all.nl>,
	kernel-team@android.com
Subject: Re: [PATCH v3 3/3] PCI: apple: Fix #PERST polarity
Date: Tue, 23 Nov 2021 22:36:11 +0100	[thread overview]
Message-ID: <453389da-b041-94b3-009e-6c6323134936@lucaceresoli.net> (raw)
In-Reply-To: <20211123180636.80558-4-maz@kernel.org>

Hi Mark,

On 23/11/21 19:06, Marc Zyngier wrote:
> Now that #PERST is properly defined as active-low in the device tree,
> fix the driver to correctly drive the line indemendently of the
> implied polarity.
> 
> Fixes: 1e33888fbe44 ("PCI: apple: Add initial hardware bring-up")
> Suggested-by: Pali Rohár <pali@kernel.org>
> Signed-off-by: Marc Zyngier <maz@kernel.org>

Thanks for quickly addressing this!

Do we need a transition path for backward compatibility with old DTs
already around? Something like this [0]. You said [1] the DT actually
used is not even the one in the kernel, thus how do we guarantee DT and
driver switch to the new polarity all at once?

[0] https://lkml.org/lkml/2021/6/24/1049
[1] https://lkml.org/lkml/2021/11/23/455

> ---
>  drivers/pci/controller/pcie-apple.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
> index 957960a733c4..03bc56f39be5 100644
> --- a/drivers/pci/controller/pcie-apple.c
> +++ b/drivers/pci/controller/pcie-apple.c
> @@ -540,7 +540,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
>  	rmw_set(PORT_APPCLK_EN, port->base + PORT_APPCLK);
>  
>  	/* Engage #PERST before setting up the clock */
>
> -	gpiod_set_value(reset, 0);
> +	gpiod_set_value(reset, 1);
>  
>  	ret = apple_pcie_setup_refclk(pcie, port);
>  	if (ret < 0)
> @@ -551,7 +551,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
>  
>  	/* Deassert #PERST */
>  	rmw_set(PORT_PERST_OFF, port->base + PORT_PERST);
> -	gpiod_set_value(reset, 1);
> +	gpiod_set_value(reset, 0);

Minor note: if it were me I would coalesce patches 1 and 3 together,
otherwise we are insisting on a wrong implementation (patch 1) to later
fix it all (this patch).

-- 
Luca


WARNING: multiple messages have this Message-ID (diff)
From: Luca Ceresoli <luca@lucaceresoli.net>
To: Marc Zyngier <maz@kernel.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org
Cc: "Pali Rohár" <pali@kernel.org>,
	"Alyssa Rosenzweig" <alyssa@rosenzweig.io>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Mark Kettenis" <mark.kettenis@xs4all.nl>,
	kernel-team@android.com
Subject: Re: [PATCH v3 3/3] PCI: apple: Fix #PERST polarity
Date: Tue, 23 Nov 2021 22:36:11 +0100	[thread overview]
Message-ID: <453389da-b041-94b3-009e-6c6323134936@lucaceresoli.net> (raw)
In-Reply-To: <20211123180636.80558-4-maz@kernel.org>

Hi Mark,

On 23/11/21 19:06, Marc Zyngier wrote:
> Now that #PERST is properly defined as active-low in the device tree,
> fix the driver to correctly drive the line indemendently of the
> implied polarity.
> 
> Fixes: 1e33888fbe44 ("PCI: apple: Add initial hardware bring-up")
> Suggested-by: Pali Rohár <pali@kernel.org>
> Signed-off-by: Marc Zyngier <maz@kernel.org>

Thanks for quickly addressing this!

Do we need a transition path for backward compatibility with old DTs
already around? Something like this [0]. You said [1] the DT actually
used is not even the one in the kernel, thus how do we guarantee DT and
driver switch to the new polarity all at once?

[0] https://lkml.org/lkml/2021/6/24/1049
[1] https://lkml.org/lkml/2021/11/23/455

> ---
>  drivers/pci/controller/pcie-apple.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
> index 957960a733c4..03bc56f39be5 100644
> --- a/drivers/pci/controller/pcie-apple.c
> +++ b/drivers/pci/controller/pcie-apple.c
> @@ -540,7 +540,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
>  	rmw_set(PORT_APPCLK_EN, port->base + PORT_APPCLK);
>  
>  	/* Engage #PERST before setting up the clock */
>
> -	gpiod_set_value(reset, 0);
> +	gpiod_set_value(reset, 1);
>  
>  	ret = apple_pcie_setup_refclk(pcie, port);
>  	if (ret < 0)
> @@ -551,7 +551,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
>  
>  	/* Deassert #PERST */
>  	rmw_set(PORT_PERST_OFF, port->base + PORT_PERST);
> -	gpiod_set_value(reset, 1);
> +	gpiod_set_value(reset, 0);

Minor note: if it were me I would coalesce patches 1 and 3 together,
otherwise we are insisting on a wrong implementation (patch 1) to later
fix it all (this patch).

-- 
Luca


_______________________________________________
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 21:36 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23 18:06 [PATCH v3 0/3] PCI: apple: Assorted #PERST fixes Marc Zyngier
2021-11-23 18:06 ` Marc Zyngier
2021-11-23 18:06 ` [PATCH v3 1/3] PCI: apple: Follow the PCIe specifications when resetting the port Marc Zyngier
2021-11-23 18:06   ` Marc Zyngier
2021-11-24  9:22   ` Luca Ceresoli
2021-11-24  9:22     ` Luca Ceresoli
2021-11-24 12:56   ` Robin Murphy
2021-11-24 12:56     ` Robin Murphy
2021-12-07 16:22   ` Bjorn Helgaas
2021-12-07 16:22     ` Bjorn Helgaas
2021-11-23 18:06 ` [PATCH v3 2/3] arm64: dts: apple: t8103: Fix PCIe #PERST polarity Marc Zyngier
2021-11-23 18:06   ` Marc Zyngier
2021-11-23 18:16   ` Mark Kettenis
2021-11-23 18:16     ` Mark Kettenis
2021-11-24  9:17   ` Luca Ceresoli
2021-11-24  9:17     ` Luca Ceresoli
2021-12-01 14:46     ` Arnd Bergmann
2021-12-01 14:46       ` Arnd Bergmann
2021-11-23 18:06 ` [PATCH v3 3/3] PCI: apple: Fix " Marc Zyngier
2021-11-23 18:06   ` Marc Zyngier
2021-11-23 21:36   ` Luca Ceresoli [this message]
2021-11-23 21:36     ` Luca Ceresoli
2021-11-24  9:02     ` Marc Zyngier
2021-11-24  9:02       ` Marc Zyngier
2021-11-24  9:16       ` Luca Ceresoli
2021-11-24  9:16         ` Luca Ceresoli
2021-11-30 11:56 ` [PATCH v3 0/3] PCI: apple: Assorted #PERST fixes Lorenzo Pieralisi
2021-11-30 11:56   ` Lorenzo Pieralisi
2021-11-30 11:59   ` Marc Zyngier
2021-11-30 11:59     ` Marc Zyngier
2021-11-30 12:12     ` Lorenzo Pieralisi
2021-11-30 12:12       ` Lorenzo Pieralisi
2021-11-30 12:45       ` Marc Zyngier
2021-11-30 12:45         ` Marc Zyngier
2021-12-01 14:48         ` Arnd Bergmann
2021-12-01 14:48           ` Arnd Bergmann
2021-12-07 10:16   ` Lorenzo Pieralisi
2021-12-07 10:16     ` Lorenzo Pieralisi
2021-12-07 20:30     ` Bjorn Helgaas
2021-12-07 20:30       ` Bjorn Helgaas

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=453389da-b041-94b3-009e-6c6323134936@lucaceresoli.net \
    --to=luca@lucaceresoli.net \
    --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=mark.kettenis@xs4all.nl \
    --cc=maz@kernel.org \
    --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.