drivers/pci/controller/dwc/pcie-stm32-ep.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/dwc/pcie-stm32-ep.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/dwc/pcie-stm32-ep.c- Extension
.c- Size
- 8182 bytes
- Lines
- 335
- 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/gpio/consumer.hlinux/mfd/syscon.hlinux/of_platform.hlinux/phy/phy.hlinux/platform_device.hlinux/pm_runtime.hlinux/regmap.hlinux/reset.hpcie-designware.hpcie-stm32.h
Detected Declarations
struct stm32_pciefunction stm32_pcie_start_linkfunction stm32_pcie_stop_linkfunction stm32_pcie_raise_irqfunction stm32_pcie_get_featuresfunction stm32_pcie_enable_resourcesfunction stm32_pcie_disable_resourcesfunction stm32_pcie_perst_assertfunction stm32_pcie_perst_deassertfunction stm32_pcie_ep_perst_irq_threadfunction stm32_add_pcie_epfunction stm32_pcie_probefunction stm32_pcie_remove
Annotated Snippet
struct stm32_pcie {
struct dw_pcie pci;
struct regmap *regmap;
struct reset_control *rst;
struct phy *phy;
struct clk *clk;
struct gpio_desc *perst_gpio;
unsigned int perst_irq;
};
static int stm32_pcie_start_link(struct dw_pcie *pci)
{
struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
enable_irq(stm32_pcie->perst_irq);
return 0;
}
static void stm32_pcie_stop_link(struct dw_pcie *pci)
{
struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
disable_irq(stm32_pcie->perst_irq);
}
static int stm32_pcie_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
unsigned int type, u16 interrupt_num)
{
struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
switch (type) {
case PCI_IRQ_INTX:
return dw_pcie_ep_raise_intx_irq(ep, func_no);
case PCI_IRQ_MSI:
return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num);
default:
dev_err(pci->dev, "UNKNOWN IRQ type\n");
return -EINVAL;
}
}
static const struct pci_epc_features stm32_pcie_epc_features = {
DWC_EPC_COMMON_FEATURES,
.msi_capable = true,
.align = SZ_64K,
};
static const struct pci_epc_features*
stm32_pcie_get_features(struct dw_pcie_ep *ep)
{
return &stm32_pcie_epc_features;
}
static const struct dw_pcie_ep_ops stm32_pcie_ep_ops = {
.raise_irq = stm32_pcie_raise_irq,
.get_features = stm32_pcie_get_features,
};
static const struct dw_pcie_ops dw_pcie_ops = {
.start_link = stm32_pcie_start_link,
.stop_link = stm32_pcie_stop_link,
};
static int stm32_pcie_enable_resources(struct stm32_pcie *stm32_pcie)
{
int ret;
ret = phy_init(stm32_pcie->phy);
if (ret)
return ret;
ret = clk_prepare_enable(stm32_pcie->clk);
if (ret)
phy_exit(stm32_pcie->phy);
return ret;
}
static void stm32_pcie_disable_resources(struct stm32_pcie *stm32_pcie)
{
clk_disable_unprepare(stm32_pcie->clk);
phy_exit(stm32_pcie->phy);
}
static void stm32_pcie_perst_assert(struct dw_pcie *pci)
{
struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
struct dw_pcie_ep *ep = &stm32_pcie->pci.ep;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/gpio/consumer.h`, `linux/mfd/syscon.h`, `linux/of_platform.h`, `linux/phy/phy.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `linux/regmap.h`.
- Detected declarations: `struct stm32_pcie`, `function stm32_pcie_start_link`, `function stm32_pcie_stop_link`, `function stm32_pcie_raise_irq`, `function stm32_pcie_get_features`, `function stm32_pcie_enable_resources`, `function stm32_pcie_disable_resources`, `function stm32_pcie_perst_assert`, `function stm32_pcie_perst_deassert`, `function stm32_pcie_ep_perst_irq_thread`.
- 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.