Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1837067ybb; Thu, 26 Mar 2020 08:12:57 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvEEEO00X1Wk5jsOXQ22UxVzUS6UWZ1zTE/obEnrvkRHmBGvitRsJAhkloXryMTrR8Jppcb X-Received: by 2002:aca:a882:: with SMTP id r124mr359470oie.53.1585235577159; Thu, 26 Mar 2020 08:12:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585235577; cv=none; d=google.com; s=arc-20160816; b=uRkhEqnE66bgtoRxls6PoWcT164dyY5vNoG+nv66DfkiFpJy+IuSWt2YH8gl4i0blF VAqF+HQvEewAM37G5kAhEqHSRNkn0oNCXuv2YIaKLT3OLzlQmp7Y4wN7xurifNeItCYi WASK40z56Dl5n3mxgSqoESodUp3QaL2EABYrVxqml+bd7PKbPl792+0yAHrHumdkVGVj BdAyj8005+kMSk+HaFCfKKmxlD9IosJ76VThGF3Gs/f+1ow4n+tazE4bDtJnfS5BZclN LYDd2x0d/vCHPWQdAapkKXsscACd0z2FPUj7uGzwb2CkAAYSaNvWgPJt430NlKxP0UYv NT7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=+voao1v0tEnV9OYkT+1WygwLJmDAkgWAUt1CTRPptkw=; b=hUwDXL1OygK6EbipTmtbQYt2Asb9gfqi+7Vwe/8wXN8fZ5NPNHTPzawMYbEbCbLY+x eCtjjJA3ThqX2Yj1Vzr3cTX3lt5oQubXxm3gwxQLpvaeBJXzSdlDDFXirO38/jVT0kYd onG7IDA+DPCTk0QuVyFmLkvsDcYXcqKPHd7Envnwj19wZeQawE/aGzCjs1Ty47hc4zXl uTNqT05iExAZdj12LsG3OcT4jngO/Nf8uBJzURsdQxK+VSnBJVKKzwnozb5Hzp1YuX7a iGhaTgaGIJ6zTllg1s1/6ZZh4M+t2Bnck7OHwZYewANmr2mVP++AaXVmCidAMzbqvjrj R6XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HswQ9GU3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o20si1189938ota.17.2020.03.26.08.12.36; Thu, 26 Mar 2020 08:12:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HswQ9GU3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727699AbgCZPMJ (ORCPT + 99 others); Thu, 26 Mar 2020 11:12:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:37542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726496AbgCZPMI (ORCPT ); Thu, 26 Mar 2020 11:12:08 -0400 Received: from localhost (mobile-166-175-186-165.mycingular.net [166.175.186.165]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9991E206F8; Thu, 26 Mar 2020 15:12:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585235528; bh=gNmb1UwpI1bot54AGT9LmV+Ay1kJtk9PvnEvdt7OJfc=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=HswQ9GU3pelOso6U3R+842+f+BEsJtKi+asi1ius/Kpn2ivVMGAkMxQdfx4AdmRWL OXIpK3kwBDOOPY60j6YQgGoDi/R1l/B3W2qIVR2ZIZhJqacpgQuvx/Hur4AJIK+DoY froEyzgClLoLaQL8Y/qmAtHqp2GIHJ1KQZMKnUFw= Date: Thu, 26 Mar 2020 10:12:05 -0500 From: Bjorn Helgaas To: Srinath Mannam Cc: Lorenzo Pieralisi , Florian Fainelli , Ray Jui , Andrew Murray , bcm-kernel-feedback-list@broadcom.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] PCI: iproc: Display PCIe Link information Message-ID: <20200326151205.GA6837@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1585206447-1363-4-git-send-email-srinath.mannam@broadcom.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 >