drivers/pci/controller/dwc/pci-dra7xx.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/dwc/pci-dra7xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/dwc/pci-dra7xx.c- Extension
.c- Size
- 22933 bytes
- Lines
- 958
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: implementation source
- Status
- source implementation candidate
Why This File Exists
Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/delay.hlinux/device.hlinux/err.hlinux/interrupt.hlinux/irq.hlinux/irqchip/chained_irq.hlinux/irqdomain.hlinux/kernel.hlinux/module.hlinux/of.hlinux/of_pci.hlinux/pci.hlinux/phy/phy.hlinux/platform_device.hlinux/pm_runtime.hlinux/resource.hlinux/types.hlinux/mfd/syscon.hlinux/regmap.hlinux/gpio/consumer.h../../pci.hpcie-designware.h
Detected Declarations
struct dra7xx_pciestruct dra7xx_pcie_of_datafunction dra7xx_pcie_readlfunction dra7xx_pcie_writelfunction dra7xx_pcie_cpu_addr_fixupfunction dra7xx_pcie_link_upfunction dra7xx_pcie_stop_linkfunction dra7xx_pcie_establish_linkfunction dra7xx_pcie_enable_msi_interruptsfunction dra7xx_pcie_enable_wrapper_interruptsfunction dra7xx_pcie_enable_interruptsfunction dra7xx_pcie_host_initfunction dra7xx_pcie_intx_mapfunction dra7xx_pcie_handle_msifunction dra7xx_pcie_handle_msi_irqfunction dra7xx_pcie_msi_irq_handlerfunction dra7xx_pcie_irq_handlerfunction dra7xx_pcie_init_irq_domainfunction dra7xx_pcie_ep_initfunction dra7xx_pcie_raise_intx_irqfunction dra7xx_pcie_raise_msi_irqfunction dra7xx_pcie_raise_irqfunction dra7xx_pcie_get_featuresfunction dra7xx_add_pcie_epfunction dra7xx_add_pcie_portfunction dra7xx_pcie_disable_phyfunction dra7xx_pcie_enable_phyfunction dra7xx_pcie_unaligned_memaccessfunction dra7xx_pcie_configure_two_lanefunction dra7xx_pcie_probefunction dra7xx_pcie_suspendfunction dra7xx_pcie_resumefunction dra7xx_pcie_suspend_noirqfunction dra7xx_pcie_resume_noirqfunction dra7xx_pcie_shutdown
Annotated Snippet
struct dra7xx_pcie {
struct dw_pcie *pci;
void __iomem *base; /* DT ti_conf */
int phy_count; /* DT phy-names count */
struct phy **phy;
struct irq_domain *irq_domain;
struct clk *clk;
enum dw_pcie_device_mode mode;
};
struct dra7xx_pcie_of_data {
enum dw_pcie_device_mode mode;
u32 b1co_mode_sel_mask;
};
#define to_dra7xx_pcie(x) dev_get_drvdata((x)->dev)
static inline u32 dra7xx_pcie_readl(struct dra7xx_pcie *pcie, u32 offset)
{
return readl(pcie->base + offset);
}
static inline void dra7xx_pcie_writel(struct dra7xx_pcie *pcie, u32 offset,
u32 value)
{
writel(value, pcie->base + offset);
}
static u64 dra7xx_pcie_cpu_addr_fixup(struct dw_pcie *pci, u64 cpu_addr)
{
return cpu_addr & DRA7XX_CPU_TO_BUS_ADDR;
}
static bool dra7xx_pcie_link_up(struct dw_pcie *pci)
{
struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pci);
u32 reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_PHY_CS);
return reg & LINK_UP;
}
static void dra7xx_pcie_stop_link(struct dw_pcie *pci)
{
struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pci);
u32 reg;
reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD);
reg &= ~LTSSM_EN;
dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD, reg);
}
static int dra7xx_pcie_establish_link(struct dw_pcie *pci)
{
struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pci);
struct device *dev = pci->dev;
u32 reg;
if (dw_pcie_link_up(pci)) {
dev_err(dev, "link is already up\n");
return 0;
}
reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD);
reg |= LTSSM_EN;
dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD, reg);
return 0;
}
static void dra7xx_pcie_enable_msi_interrupts(struct dra7xx_pcie *dra7xx)
{
dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI,
LEG_EP_INTERRUPTS | MSI);
dra7xx_pcie_writel(dra7xx,
PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MSI,
MSI | LEG_EP_INTERRUPTS);
}
static void dra7xx_pcie_enable_wrapper_interrupts(struct dra7xx_pcie *dra7xx)
{
dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN,
INTERRUPTS);
dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MAIN,
INTERRUPTS);
}
static void dra7xx_pcie_enable_interrupts(struct dra7xx_pcie *dra7xx)
{
dra7xx_pcie_enable_wrapper_interrupts(dra7xx);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/device.h`, `linux/err.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/irqchip/chained_irq.h`, `linux/irqdomain.h`.
- Detected declarations: `struct dra7xx_pcie`, `struct dra7xx_pcie_of_data`, `function dra7xx_pcie_readl`, `function dra7xx_pcie_writel`, `function dra7xx_pcie_cpu_addr_fixup`, `function dra7xx_pcie_link_up`, `function dra7xx_pcie_stop_link`, `function dra7xx_pcie_establish_link`, `function dra7xx_pcie_enable_msi_interrupts`, `function dra7xx_pcie_enable_wrapper_interrupts`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.