Re: [PATCH 3/3] PCI: iproc: Display PCIe Link information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
> ---
>  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
> 



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux