From patchwork Wed Apr 3 21:38:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13616737 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 64D14CD128A for ; Wed, 3 Apr 2024 21:39:32 +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-Type: MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe :List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tTlrigBtXeT4j9YTQu7ztFGmT/yon5TpWyPnO2QW4Ls=; b=ZmoiNGhW7lqH50uovq5Bvwh5T5 0911jnl0ebvLA1HA9yJHElX2E7tqwfVG2/91sTHr+6mYRY8DIu7AY0X8iLbz4SR99NkyhXlHRsUQY ZtGE049hCZtBYzB7zYBhk22QrQJRwcVgeDnVW1GaA12GuA4aDHul/HIIKGW7ZdLc8xqFNNpSEJG/b pq+M4U1pc0CqGqyrTwfDuV19hUAC58ISEru2g5sPWN+Tab3Bx4tcitPa7FoS6QC9MlAlhYvG8VUvo HW3yQs5Q0GMGmLWpLcomPQRbpbhLmLN5kbfTXM0As7ZmsKc0EFVpa71exK0VAQal225Pl0SIO71U0 nvzlz5xw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs8KH-00000000HRK-2BEu; Wed, 03 Apr 2024 21:39:21 +0000 Received: from mail-qv1-xf33.google.com ([2607:f8b0:4864:20::f33]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs8K7-00000000HL7-3uTM for linux-arm-kernel@lists.infradead.org; Wed, 03 Apr 2024 21:39:14 +0000 Received: by mail-qv1-xf33.google.com with SMTP id 6a1803df08f44-699252365f0so1635776d6.0 for ; Wed, 03 Apr 2024 14:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1712180350; x=1712785150; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=UXdlC3tV3mNfNqeIs50GW8qC/VJRXQOh02qmKbxIRRI=; b=cjvPLtSouTf3VlpLKR51Ye0ZoYAq1KSzq5KypNAdpow2FMJwEL/aXoMJRX2XUceUfM COWMwmJdqjB0hRIMWBrQwmv+C+4UvpTzJvtq5GDjHLl+8NeqWeinEn8JUw3NfnF8t5v3 72q/fg+7d6cvIaZr0Rak2VKAKTNCULN2GFGzw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712180350; x=1712785150; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UXdlC3tV3mNfNqeIs50GW8qC/VJRXQOh02qmKbxIRRI=; b=vEC+UmAozCfPPWftjFm5T/LAdzH+OsLlrrlW6LjwurdA7ByJ6K38ub0Sgg624j8TQb LhH2/ytZaV3PkwExx1hpPeXtu2vCEX2Kkxt9d1D3LSeP/eKc3kUYtA06/rYENqCDcpmP bQ7dFbGb8pjcJP3mGAA+G9U+Z8WfAu+iKpwgJq5cTZAZQWg3Nx7Q841A6tHrZtNcKj0W RyidTmYCaOOBO39Ytrj9AZnsUF9L+F8wLthCu9EcXFVUUWx76SdeoHsEu0xiOCQqW+9Q fTRotaJ0c6H3c6C4Ox0wGa8R3Jkifyf7uSFQahRnBzP79V+yxrS0My7FOyOSjzRIdHa/ Sbug== X-Forwarded-Encrypted: i=1; AJvYcCUxlk7dzDdzr2LS028MINcyzZP66i76HV1KOOoq5BuIRo4vy/94IHzZZWoUb+4XSZaOJyY3eIDrjkP/450pKQRPY5JbCNC7//8HymFv+uT3e60erz0= X-Gm-Message-State: AOJu0YxbtwZA+WXtJ8CGKYUk3ibHOkZSHNBnSCFR7DZQ8OaL27dhfIAj Zw9n8Z7JjQKryKKkPFe4d0ZiwGfy1oQPQtuHTQRpYIfBgesRifeJGp74Iq7WMg== X-Google-Smtp-Source: AGHT+IHEm448Vez1EYSZj6vPmBWem+xpStlyl+rBICguhy1s5dmtGdnrQH6c21gr2zp473n79cj1kA== X-Received: by 2002:a05:6214:4005:b0:699:247e:a69a with SMTP id kd5-20020a056214400500b00699247ea69amr616685qvb.9.1712180350456; Wed, 03 Apr 2024 14:39:10 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id pi10-20020a0562144a8a00b0069903cddc96sm1750739qvb.18.2024.04.03.14.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 14:39:09 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Phil Elwell , bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Jim Quinlan , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v9 2/4] PCI: brcmstb: Set reasonable value for internal bus timeout Date: Wed, 3 Apr 2024 17:38:59 -0400 Message-Id: <20240403213902.26391-3-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240403213902.26391-1-james.quinlan@broadcom.com> References: <20240403213902.26391-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240403_143912_068079_67CE773E X-CRM114-Status: GOOD ( 11.34 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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); + if (pcie->gen) brcm_pcie_set_gen(pcie, pcie->gen);