lkml.org 
[lkml]   [2020]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] PCI: iproc: Display PCIe Link information
On Thu, Mar 26, 2020 at 12:37:27PM +0530, Srinath Mannam wrote:
> Add more comprehensive information to show PCIe link speed and link
> width to the console.
>
> Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
> ---
> drivers/pci/controller/pcie-iproc.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
> index e7f0d58..ed41357 100644
> --- a/drivers/pci/controller/pcie-iproc.c
> +++ b/drivers/pci/controller/pcie-iproc.c
> @@ -823,6 +823,8 @@ static int iproc_pcie_check_link(struct iproc_pcie *pcie)
> #define PCI_TARGET_LINK_SPEED_MASK 0xf
> #define PCI_TARGET_LINK_SPEED_GEN2 0x2
> #define PCI_TARGET_LINK_SPEED_GEN1 0x1
> +#define PCI_TARGET_LINK_WIDTH_MASK 0x3f
> +#define PCI_TARGET_LINK_WIDTH_OFFSET 0x4
> iproc_pci_raw_config_read32(pcie, 0,
> IPROC_PCI_EXP_CAP + PCI_EXP_LNKCTL2,
> 4, &link_ctrl);
> @@ -843,7 +845,14 @@ static int iproc_pcie_check_link(struct iproc_pcie *pcie)
> }
> }
>
> - dev_info(dev, "link: %s\n", link_is_active ? "UP" : "DOWN");
> + if (link_is_active) {
> + dev_info(dev, "link UP @ Speed Gen-%d and width-x%d\n",
> + link_status & PCI_TARGET_LINK_SPEED_MASK,
> + (link_status >> PCI_TARGET_LINK_WIDTH_OFFSET) &
> + PCI_TARGET_LINK_WIDTH_MASK);

Can you use pcie_print_link_status() or some variant here instead of
rolling your own?

> + } else {
> + dev_info(dev, "link DOWN\n");
> + }
>
> return link_is_active ? 0 : -ENODEV;
> }
> --
> 2.7.4
>

\
 
 \ /
  Last update: 2020-03-26 16:12    [W:0.070 / U:1.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site