From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ECF07C25B10 for ; Mon, 6 May 2024 22:45:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=2M75mebTQ/JxmorUEBHPYKH0dx2sJaLTsLNBZq7V2no=; b=ddhfHG9HHw3uZe U1ayy8cukwTU6KLC6OWTH9x4AFio9WljipgDNz8eFz0GlWEc976Xwu9NfvWDwOdRBUG1KlS0tuIif xa06HhP8J3sEMSmxkKpkbLvwcJh+dCMhWDfoVX2Gynwugbe2mKEeuQ4qlf9GU5UTD73tIw0os0Uex EUtFdgM0xWRG4CiNCU81kDNDG7f9V+mZhMJewuFD49xeDhy2f21Gk0Gl8lR91AFDESnozxvItKTKw 5yYCfD8f2GAkW1zuol6WxB28syoeBDknegZH5TqVRP6fPrzn/pH8J4NBaMg79T/CQGOSFfCtFDfIj Cz1fgpANBaYyscty9JIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s475C-00000008vVJ-1XEu; Mon, 06 May 2024 22:45:18 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4759-00000008vTs-0i7a; Mon, 06 May 2024 22:45:16 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 7032BCE0FF7; Mon, 6 May 2024 22:45:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E8B5C116B1; Mon, 6 May 2024 22:45:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715035510; bh=y5PoXckBqRbG1xrUmNqXmT+xaUFuGSK/aO21osW5ShU=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=nptyv8ad6ktkyiRgxxfI+HmFXxKgpsv44szFxd28jltndbYuVI8CKC9H1isLWrCKx qraawXlVqtSRMCPC9a9JAcQuULACHYrhtEZ4PnZlpgAZtOoqieHtRHkbp8m1Pb1P1y lVSdSgi8tG8OqG9cFGn3UPEh2s9bTw8CSHLk0JGDcEW8JoGRztBM5wS/u7skPkZal0 KzffMbAPLPp/F4UTP2sOrMjEXUqkQNEbsmyVGOxg687CBrxmWiCCHZAMBz/044KaNn n1ujhFrVAWd+k/64I+0GcLnlxd4uK2fmy6NjVlLHJCbDkvUjq0kCIGkEUQk8C41CZQ 9ai6cnVRa0M1g== Date: Mon, 6 May 2024 17:45:08 -0500 From: Bjorn Helgaas To: Jim Quinlan Cc: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Phil Elwell , bcm-kernel-feedback-list@broadcom.com, Florian Fainelli , Jim Quinlan , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , open list Subject: Re: [PATCH v9 2/4] PCI: brcmstb: Set reasonable value for internal bus timeout Message-ID: <20240506224508.GA1713699@bhelgaas> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240403213902.26391-3-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240506_154515_601590_D180A466 X-CRM114-Status: GOOD ( 19.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Apr 03, 2024 at 05:38:59PM -0400, Jim Quinlan wrote: > HW initializes an internal bus timeout register to a small value for > debugging convenience. Set this to something reasonable, i.e. in the > vicinity of 10 msec. > > Signed-off-by: Jim Quinlan > --- > drivers/pci/controller/pcie-brcmstb.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c > index f9dd6622fe10..e3480ca4cd57 100644 > --- a/drivers/pci/controller/pcie-brcmstb.c > +++ b/drivers/pci/controller/pcie-brcmstb.c > @@ -664,6 +664,21 @@ static int brcm_pcie_enable_msi(struct brcm_pcie *pcie) > return 0; > } > > +/* > + * An internal HW bus timer value is set to a small value for debugging > + * convenience. Set this to something reasonable, i.e. somewhere around > + * 10ms. > + */ > +static void brcm_extend_internal_bus_timeout(struct brcm_pcie *pcie, u32 nsec) > +{ > + /* TIMEOUT register is two registers before RGR1_SW_INIT_1 */ > + const unsigned int REG_OFFSET = PCIE_RGR1_SW_INIT_1(pcie) - 8; > + u32 timeout_us = nsec / 1000; > + > + /* Each unit in timeout register is 1/216,000,000 seconds */ > + writel(216 * timeout_us, pcie->base + REG_OFFSET); > +} > + > /* The controller is capable of serving in both RC and EP roles */ > static bool brcm_pcie_rc_mode(struct brcm_pcie *pcie) > { > @@ -1059,6 +1074,9 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie) > return -ENODEV; > } > > + /* Extend internal bus timeout to 8ms or so */ > + brcm_extend_internal_bus_timeout(pcie, SZ_8M); The 216*usec is obviously determined by hardware, but the choice of nsec for the interface, and converting to usec internally seems arbitrary; the caller could just easily supply usec. Or do you envision using this interface for timeouts < 1 usec? "SZ_8M" seems a little unusual as a time measurement and doesn't give a hint about the units. It's pretty common to use "8 * USEC_PER_MSEC" or even "8 * NSEC_PER_MSEC" for things like this. But it's fine with me as-is. > if (pcie->gen) > brcm_pcie_set_gen(pcie, pcie->gen); > > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel