All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: "Jason Cooper" <jason@lakedaemon.net>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Gregory Clement" <gregory.clement@bootlin.com>,
	"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Andrew Murray" <amurray@thegoodpenguin.co.uk>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Remi Pommarel" <repk@triplefau.lt>,
	"Marek Behún" <marek.behun@nic.cz>,
	"Tomasz Maciej Nowak" <tmn505@gmail.com>,
	Xogium <contact@xogium.me>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH v4 05/12] PCI: aardvark: Issue PERST via GPIO
Date: Thu, 30 Apr 2020 10:22:45 +0200	[thread overview]
Message-ID: <20200430082245.xblvb7xeamm4e336@pali> (raw)
In-Reply-To: <20200430080625.26070-6-pali@kernel.org>

On Thursday 30 April 2020 10:06:18 Pali Rohár wrote:
> +static void advk_pcie_issue_perst(struct advk_pcie *pcie)
> +{
> +	u32 reg;
> +
> +	if (!pcie->reset_gpio)
> +		return;
> +
> +	/* PERST does not work for some cards when link training is enabled */
> +	reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG);
> +	reg &= ~LINK_TRAINING_EN;
> +	advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG);
> +
> +	/* 10ms delay is needed for some cards */
> +	dev_info(&pcie->pdev->dev, "issuing PERST via reset GPIO for 10ms\n");
> +	gpiod_set_value_cansleep(pcie->reset_gpio, 1);
> +	usleep_range(10000, 11000);
> +	gpiod_set_value_cansleep(pcie->reset_gpio, 0);
> +}

Just note about delay between changing GPIO reset:

In V2 there as only 1ms, but be figured out that it is not enough for
WLE900VX cards when they were already initialized in u-boot.

I tried to find in PCI specs if there is a defined timeout for this
operation. I found following 3 delay definitions which could be related:

TPVPERL - PERST# must remain active at least this long after power becomes valid
TPERST - When asserted, PERST# must remain asserted at least this long
TPERSTCLK - PERST# must remain active at least this long after any supplied reference clock is stable

In another spec they have defined also minimal values:

TPVPERL - Power stable to PERST# inactive - Min 100 ms
TPERST - PERST# active time - Min 100 us
TPERSTCLK - REFCLK stable before PERST# inactive - Min 100 us

After experimenting with those Compex WLE900VX cards, I know that 100us
delay is not enough. And I'm not sure if TPVPERL is really relevant for
this case. I understood that TPVPERL is needed when initializing power
again. And because delaying boot by another 100ms is does not have to be
acceptable if there is not strict reason for it, I rather decided to
stay with just 10ms delay.

If you know what is the correct timeout between changing GPIO reset,
please let me know and in future I can fix/reimplement it.

  reply	other threads:[~2020-04-30  8:22 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30  8:06 [PATCH v4 00/12] PCI: aardvark: Fix support for Turris MOX and Compex wifi cards Pali Rohár
2020-04-30  8:06 ` [PATCH v4 01/12] PCI: aardvark: Train link immediately after enabling training Pali Rohár
2020-05-04 15:50   ` Bjorn Helgaas
2020-05-07 21:05   ` Rob Herring
2020-04-30  8:06 ` [PATCH v4 02/12] PCI: aardvark: Don't blindly enable ASPM L0s and don't write to read-only register Pali Rohár
2020-05-07 21:07   ` Rob Herring
2020-04-30  8:06 ` [PATCH v4 03/12] PCI: of: Zero max-link-speed value is invalid Pali Rohár
2020-05-07 21:07   ` Rob Herring
2020-04-30  8:06 ` [PATCH v4 04/12] PCI: aardvark: Improve link training Pali Rohár
2020-05-07 21:10   ` Rob Herring
2020-04-30  8:06 ` [PATCH v4 05/12] PCI: aardvark: Issue PERST via GPIO Pali Rohár
2020-04-30  8:22   ` Pali Rohár [this message]
2020-05-07 21:20     ` Rob Herring
2020-04-30  8:06 ` [PATCH v4 06/12] PCI: aardvark: Add FIXME comment for PCIE_CORE_CMD_STATUS_REG access Pali Rohár
2020-05-07 21:20   ` Rob Herring
2020-04-30  8:06 ` [PATCH v4 07/12] PCI: aardvark: Add PHY support Pali Rohár
2020-05-07 21:23   ` Rob Herring
2020-04-30  8:06 ` [PATCH v4 08/12] PCI: aardvark: Replace custom macros by standard linux/pci_regs.h macros Pali Rohár
2020-05-04 15:52   ` Bjorn Helgaas
2020-05-07 21:24   ` Rob Herring
2020-04-30  8:06 ` [PATCH v4 09/12] dt-bindings: PCI: aardvark: Describe new properties Pali Rohár
2020-05-07 21:25   ` Rob Herring
2020-04-30  8:06 ` [PATCH v4 10/12] arm64: dts: marvell: armada-37xx: Set pcie_reset_pin to gpio function Pali Rohár
2020-04-30  8:06 ` [PATCH v4 11/12] arm64: dts: marvell: armada-37xx: Move PCIe comphy handle property Pali Rohár
2020-04-30  8:06 ` [PATCH v4 12/12] arm64: dts: marvell: armada-37xx: Move PCIe max-link-speed property Pali Rohár
2020-05-04 15:50   ` Bjorn Helgaas
2020-05-08 13:11 ` [PATCH v4 00/12] PCI: aardvark: Fix support for Turris MOX and Compex wifi cards Tomasz Maciej Nowak
2020-05-13 11:16 ` Pali Rohár
2020-05-13 11:33   ` Lorenzo Pieralisi
2020-05-13 11:59     ` Pali Rohár
2020-05-13 11:56 ` Thomas Petazzoni
2020-05-17 15:57   ` Gregory CLEMENT
2020-05-18 10:30     ` Pali Rohár
2020-05-18 13:46       ` Lorenzo Pieralisi
2020-05-18 13:50         ` Marek Behun

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=20200430082245.xblvb7xeamm4e336@pali \
    --to=pali@kernel.org \
    --cc=amurray@thegoodpenguin.co.uk \
    --cc=andrew@lunn.ch \
    --cc=bhelgaas@google.com \
    --cc=contact@xogium.me \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=marek.behun@nic.cz \
    --cc=repk@triplefau.lt \
    --cc=robh+dt@kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tmn505@gmail.com \
    /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.