[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251003023527.3284787-2-randolph@andestech.com>
Date: Fri, 3 Oct 2025 10:35:23 +0800
From: Randolph Lin <randolph@...estech.com>
To: <linux-kernel@...r.kernel.org>
CC: <linux-pci@...r.kernel.org>, <linux-riscv@...ts.infradead.org>,
<devicetree@...r.kernel.org>, <jingoohan1@...il.com>,
<mani@...nel.org>, <lpieralisi@...nel.org>, <kwilczynski@...nel.org>,
<robh@...nel.org>, <bhelgaas@...gle.com>, <krzk+dt@...nel.org>,
<conor+dt@...nel.org>, <alex@...ti.fr>, <aou@...s.berkeley.edu>,
<palmer@...belt.com>, <paul.walmsley@...ive.com>,
<ben717@...estech.com>, <inochiama@...il.com>,
<thippeswamy.havalige@....com>, <namcao@...utronix.de>,
<shradha.t@...sung.com>, <pjw@...nel.org>, <randolph.sklin@...il.com>,
<tim609@...estech.com>, Randolph Lin <randolph@...estech.com>
Subject: [PATCH v6 1/5] PCI: dwc: Allow adjusting the number of ob/ib windows in glue driver
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 <randolph@...estech.com>
---
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..56c1e45adc06 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_ib_windows > ib)
+ 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
Powered by blists - more mailing lists