From: Stefan Roese <sr@denx.de>
To: "Pali Rohár" <pali@kernel.org>, "Marek Behún" <marek.behun@nic.cz>
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH u-boot-marvell 1/3] arm: a37xx: pci: Do not try to access other buses when link is down
Date: Wed, 16 Feb 2022 09:57:57 +0100 [thread overview]
Message-ID: <ebf9e4a6-ffaa-9429-2ce7-bcc3d5eff65d@denx.de> (raw)
In-Reply-To: <20220215102337.18426-1-pali@kernel.org>
On 2/15/22 11:23, Pali Rohár wrote:
> If a PIO request is executed while link-down, the whole controller gets
> stuck in a non-functional state, and even after link comes up again, PIO
> requests won't work anymore, and a reset of the whole PCIe controller is
> needed. Therefore we need to prevent sending PIO requests while the link
> is down.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Thanks,
Stefan
> ---
> drivers/pci/pci-aardvark.c | 38 +++++++++++++++++++++-----------------
> 1 file changed, 21 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/pci/pci-aardvark.c b/drivers/pci/pci-aardvark.c
> index 1eb257ea8b4a..ccaeecaca8e3 100644
> --- a/drivers/pci/pci-aardvark.c
> +++ b/drivers/pci/pci-aardvark.c
> @@ -177,6 +177,23 @@ static inline uint advk_readl(struct pcie_advk *pcie, uint reg)
> return readl(pcie->base + reg);
> }
>
> +/**
> + * pcie_advk_link_up() - Check if PCIe link is up or not
> + *
> + * @pcie: The PCI device to access
> + *
> + * Return true on link up.
> + * Return false on link down.
> + */
> +static bool pcie_advk_link_up(struct pcie_advk *pcie)
> +{
> + u32 val, ltssm_state;
> +
> + val = advk_readl(pcie, ADVK_LMI_PHY_CFG0);
> + ltssm_state = (val & ADVK_LMI_PHY_CFG0_LTSSM_MASK) >> ADVK_LMI_PHY_CFG0_LTSSM_SHIFT;
> + return ltssm_state >= ADVK_LMI_PHY_CFG0_LTSSM_L0 && ltssm_state < ADVK_LMI_PHY_CFG0_LTSSM_DISABLED;
> +}
> +
> /**
> * pcie_advk_addr_valid() - Check for valid bus address
> *
> @@ -195,6 +212,10 @@ static bool pcie_advk_addr_valid(struct pcie_advk *pcie,
> if (busno == 0 && (dev != 0 || func != 0))
> return false;
>
> + /* Access to other buses is possible when link is up */
> + if (busno != 0 && !pcie_advk_link_up(pcie))
> + return false;
> +
> /*
> * In PCI-E only a single device (0) can exist on the secondary bus.
> * Beyond the secondary bus, there might be a Switch and anything is
> @@ -618,23 +639,6 @@ retry:
> return ret;
> }
>
> -/**
> - * pcie_advk_link_up() - Check if PCIe link is up or not
> - *
> - * @pcie: The PCI device to access
> - *
> - * Return 1 (true) on link up.
> - * Return 0 (false) on link down.
> - */
> -static int pcie_advk_link_up(struct pcie_advk *pcie)
> -{
> - u32 val, ltssm_state;
> -
> - val = advk_readl(pcie, ADVK_LMI_PHY_CFG0);
> - ltssm_state = (val & ADVK_LMI_PHY_CFG0_LTSSM_MASK) >> ADVK_LMI_PHY_CFG0_LTSSM_SHIFT;
> - return ltssm_state >= ADVK_LMI_PHY_CFG0_LTSSM_L0 && ltssm_state < ADVK_LMI_PHY_CFG0_LTSSM_DISABLED;
> -}
> -
> /**
> * pcie_advk_wait_for_link() - Wait for link training to be accomplished
> *
Viele Grüße,
Stefan Roese
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de
prev parent reply other threads:[~2022-02-16 8:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 10:23 [PATCH u-boot-marvell 1/3] arm: a37xx: pci: Do not try to access other buses when link is down Pali Rohár
2022-02-15 10:23 ` [PATCH u-boot-marvell 2/3] arm: a37xx: pci: Register controller also when no PCIe card is connected Pali Rohár
2022-02-16 8:58 ` Stefan Roese
2022-02-15 10:23 ` [PATCH u-boot-marvell 3/3] arm: a37xx: pci: Update comment about Command/Direct mode Pali Rohár
2022-02-16 8:59 ` Stefan Roese
2022-02-16 8:57 ` Stefan Roese [this message]
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=ebf9e4a6-ffaa-9429-2ce7-bcc3d5eff65d@denx.de \
--to=sr@denx.de \
--cc=marek.behun@nic.cz \
--cc=pali@kernel.org \
--cc=u-boot@lists.denx.de \
/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