[PATCH v8 1/5] PCI: dwc: Allow adjusting the number of ob/ib windows in glue driver
Randolph Lin
randolph at andestech.com
Tue Oct 14 05:03:45 PDT 2025
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 at andestech.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 c644216995f6..a860890febc3 100644
--- a/drivers/pci/controller/dwc/pcie-designware.c
+++ b/drivers/pci/controller/dwc/pcie-designware.c
@@ -851,8 +851,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
More information about the linux-riscv
mailing list