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 7314ECCA471 for ; Thu, 2 Oct 2025 11:05:26 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D6BWug6xGmwtibsOfk+4gL3VFkeVCve483AwLWAVBCw=; b=1BUoUtbRAdGAvI +YWcVIUiPDLLLn3jQWjDdKnQs6nO3AS760tRSXHkGNVLhQnIMz88PfsbRe6IjzFKHPfWTwlmM0IXF ZoilH/ff+QWFFXNqJULXC/gspn2JwPdl41xeTgEM2IXMOtt5Qpjt6namETTn/gMOIn+9AEmBPqaJ+ Yn6QRRtWy0lTdKL7E3yiB9p9oLefsLYbkrWsP/NvZnDg4OO/HOUID2/xbcG33u7WsIxgqlVF+zLCG FziZ1YlTSZfoZnwbnTb6aWWfJ+npxWGwL/PFtPBO2eL0FVoDOdDpioPYl0Iuuhbc7+filgF2e+4aj fMBUbR/eLqprBuEOymtw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v4H7g-0000000AKg8-0lnZ; Thu, 02 Oct 2025 11:05:20 +0000 Received: from 60-248-80-70.hinet-ip.hinet.net ([60.248.80.70] helo=Atcsqr.andestech.com) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v4H7d-0000000AKf9-41Vk for linux-riscv@lists.infradead.org; Thu, 02 Oct 2025 11:05:19 +0000 Received: from Atcsqr.andestech.com (localhost [127.0.0.2] (may be forged)) by Atcsqr.andestech.com with ESMTP id 592Ao2mP070574 for ; Thu, 2 Oct 2025 18:50:02 +0800 (+08) (envelope-from randolph@andestech.com) Received: from mail.andestech.com (ATCPCS31.andestech.com [10.0.1.89]) by Atcsqr.andestech.com with ESMTPS id 592AkCsm068599 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 2 Oct 2025 18:46:12 +0800 (+08) (envelope-from randolph@andestech.com) Received: from atctrx.andestech.com (10.0.15.173) by ATCPCS31.andestech.com (10.0.1.89) with Microsoft SMTP Server id 14.3.498.0; Thu, 2 Oct 2025 18:46:12 +0800 From: Randolph Lin To: CC: , , , , , , , , , , , , , , , , , , , , , , , Randolph Lin Subject: [PATCH v5 1/5] PCI: dwc: Allow adjusting the number of ob/ib windows in glue driver Date: Thu, 2 Oct 2025 18:45:54 +0800 Message-ID: <20251002104558.4068668-2-randolph@andestech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251002104558.4068668-1-randolph@andestech.com> References: <20251002104558.4068668-1-randolph@andestech.com> MIME-Version: 1.0 X-Originating-IP: [10.0.15.173] X-DKIM-Results: atcpcs31.andestech.com; dkim=none; X-DNSRBL: X-MAIL: Atcsqr.andestech.com 592Ao2mP070574 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251002_040518_311937_3552A3CE X-CRM114-Status: GOOD ( 10.94 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The number of ob/ib windows is determined through write-read loops on registers in the core driver. Some glue drivers need to adjust the number of ob/ib windows to meet specific requirements,such as hardware limitations. This change allows the glue driver to adjust the number of ob/ib windows to satisfy platform-specific constraints. The glue driver may adjust the number of ob/ib windows, but the values must stay within hardware limits. Signed-off-by: Randolph Lin --- drivers/pci/controller/dwc/pcie-designware.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 89aad5a08928..8ca7777a73e0 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -907,8 +907,16 @@ void dw_pcie_iatu_detect(struct dw_pcie *pci) max = 0; } - pci->num_ob_windows = ob; - pci->num_ib_windows = ib; + if (!pci->num_ob_windows) + pci->num_ob_windows = ob; + else if (pci->num_ob_windows > ob) + dev_err(pci->dev, "Adjusted ob windows exceed the limit\n"); + + if (!pci->num_ib_windows) + pci->num_ib_windows = ib; + else if (pci->num_ob_windows > ob) + dev_err(pci->dev, "Adjusted ib windows exceed the limit\n"); + pci->region_align = 1 << fls(min); pci->region_limit = (max << 32) | (SZ_4G - 1); -- 2.34.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv