![]() |
RT-Thread RTOS
An open source embedded real-time operating system
|
SoC root complex drivers: map config space, parse DT **ranges**, call **rt_pci_host_bridge_probe**. Distinct from the PCI bridge function driver (PCI bridge function driver).
| API | Role |
|---|---|
**pci_ecam_create(host_bridge, ops)** | Attach **pci_generic_ecam_ops** (or variant) to host |
**pci_ecam_map(bus, devfn, where)** | Config MMIO address |
**pci_generic_ecam_ops** | Standard **bus_shift** ECAM |
**struct pci_ecam_config_window**: **win** base, **bus_range[2]**, **bus_shift**, **ops**.
**pci_dw_ecam_bus_ops**: on root bus, **devfn slot > 0** returns **NULL** from **map** (only device 0 on bus 0) — used by **snps,dw-pcie-ecam**, Marvell, Socionext compatibles.
**RT_PLATFORM_DRIVER_EXPORT(gen_pci_driver)**
compatible | ECAM ops |
|---|---|
**pci-host-ecam-generic** | **pci_generic_ecam_ops** |
**pci-host-cam-generic** | CAM layout, **bus_shift = 16** |
**snps,dw-pcie-ecam**, **marvell,armada8k-pcie-ecam**, … | **pci_dw_ecam_bus_ops** |
**pci_host_common_probe** (host/pci-host-common.c):
rt_pci_host_bridge_alloc**rt_dm_dev_iomap(dev, 0)** — ECAM **reg**rt_pci_host_bridge_init** — OFW rangespci_ecam_create**, **conf_win->win = base**rt_pci_host_bridge_probe**| File | Role |
|---|---|
**pcie-dw_host.c** | RC mode: DBI, link, **rt_pci_host_bridge_probe** |
**pcie-dw_ep.c** | EP mode — PCI endpoint (EP) mode |
**pcie-dw_platfrom.c** | Platform glue |
Enable via **pci/host/dw/Kconfig**. DT binding typically **snps,dw-pcie** plus ECAM child node.
**struct rt_pci_host_bridge** optional:
| Field | Role |
|---|---|
**irq_slot(pdev, &pin)** | ACPI/legacy slot for INTx |
**irq_map(pdev, slot, pin)** | Return Linux IRQ number |
If NULL, OFW path or no INTx (PCI INTx interrupts, PCI and device tree).
| Issue | Mitigation |
|---|---|
ECAM **reg not iomapped** | **pci_host_common_probe** fails with **-RT_EIO** |
Empty **ranges** | **rt_pci_ofw_parse_ranges** fails — no MEM/IO for BARs |
Wrong **compatible** | Pick ops matching hardware CAM vs ECAM |
Confusing with **host-bridge.c** | That file is PCI function driver for bridge devices |