drivers/pci/controller/dwc/pcie-spear13xx.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/dwc/pcie-spear13xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/dwc/pcie-spear13xx.c- Extension
.c- Size
- 6502 bytes
- Lines
- 264
- 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/interrupt.hlinux/kernel.hlinux/init.hlinux/of.hlinux/pci.hlinux/phy/phy.hlinux/platform_device.hlinux/resource.hpcie-designware.h
Detected Declarations
struct spear13xx_pciestruct pcie_app_regfunction spear13xx_pcie_start_linkfunction spear13xx_pcie_irq_handlerfunction spear13xx_pcie_enable_interruptsfunction spear13xx_pcie_link_upfunction spear13xx_pcie_host_initfunction spear13xx_add_pcie_portfunction spear13xx_pcie_probe
Annotated Snippet
struct spear13xx_pcie {
struct dw_pcie *pci;
void __iomem *app_base;
struct phy *phy;
struct clk *clk;
};
struct pcie_app_reg {
u32 app_ctrl_0; /* cr0 */
u32 app_ctrl_1; /* cr1 */
u32 app_status_0; /* cr2 */
u32 app_status_1; /* cr3 */
u32 msg_status; /* cr4 */
u32 msg_payload; /* cr5 */
u32 int_sts; /* cr6 */
u32 int_clr; /* cr7 */
u32 int_mask; /* cr8 */
u32 mst_bmisc; /* cr9 */
u32 phy_ctrl; /* cr10 */
u32 phy_status; /* cr11 */
u32 cxpl_debug_info_0; /* cr12 */
u32 cxpl_debug_info_1; /* cr13 */
u32 ven_msg_ctrl_0; /* cr14 */
u32 ven_msg_ctrl_1; /* cr15 */
u32 ven_msg_data_0; /* cr16 */
u32 ven_msg_data_1; /* cr17 */
u32 ven_msi_0; /* cr18 */
u32 ven_msi_1; /* cr19 */
u32 mst_rmisc; /* cr20 */
};
/* CR0 ID */
#define APP_LTSSM_ENABLE_ID 3
#define DEVICE_TYPE_RC (4 << 25)
#define MISCTRL_EN_ID 30
#define REG_TRANSLATION_ENABLE 31
/* CR3 ID */
#define XMLH_LINK_UP (1 << 6)
/* CR6 */
#define MSI_CTRL_INT (1 << 26)
#define to_spear13xx_pcie(x) dev_get_drvdata((x)->dev)
static int spear13xx_pcie_start_link(struct dw_pcie *pci)
{
struct spear13xx_pcie *spear13xx_pcie = to_spear13xx_pcie(pci);
struct pcie_app_reg __iomem *app_reg = spear13xx_pcie->app_base;
/* enable ltssm */
writel(DEVICE_TYPE_RC | (1 << MISCTRL_EN_ID)
| (1 << APP_LTSSM_ENABLE_ID)
| ((u32)1 << REG_TRANSLATION_ENABLE),
&app_reg->app_ctrl_0);
return 0;
}
static irqreturn_t spear13xx_pcie_irq_handler(int irq, void *arg)
{
struct spear13xx_pcie *spear13xx_pcie = arg;
struct pcie_app_reg __iomem *app_reg = spear13xx_pcie->app_base;
struct dw_pcie *pci = spear13xx_pcie->pci;
struct dw_pcie_rp *pp = &pci->pp;
unsigned int status;
status = readl(&app_reg->int_sts);
if (status & MSI_CTRL_INT) {
BUG_ON(!IS_ENABLED(CONFIG_PCI_MSI));
dw_handle_msi_irq(pp);
}
writel(status, &app_reg->int_clr);
return IRQ_HANDLED;
}
static void spear13xx_pcie_enable_interrupts(struct spear13xx_pcie *spear13xx_pcie)
{
struct pcie_app_reg __iomem *app_reg = spear13xx_pcie->app_base;
/* Enable MSI interrupt */
if (IS_ENABLED(CONFIG_PCI_MSI))
writel(readl(&app_reg->int_mask) |
MSI_CTRL_INT, &app_reg->int_mask);
}
static bool spear13xx_pcie_link_up(struct dw_pcie *pci)
Annotation
- Immediate include surface: `linux/clk.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/init.h`, `linux/of.h`, `linux/pci.h`, `linux/phy/phy.h`, `linux/platform_device.h`.
- Detected declarations: `struct spear13xx_pcie`, `struct pcie_app_reg`, `function spear13xx_pcie_start_link`, `function spear13xx_pcie_irq_handler`, `function spear13xx_pcie_enable_interrupts`, `function spear13xx_pcie_link_up`, `function spear13xx_pcie_host_init`, `function spear13xx_add_pcie_port`, `function spear13xx_pcie_probe`.
- 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.