drivers/pci/controller/cadence/pci-j721e.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/cadence/pci-j721e.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/cadence/pci-j721e.c- Extension
.c- Size
- 19611 bytes
- Lines
- 783
- 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/clk-provider.hlinux/container_of.hlinux/delay.hlinux/gpio/consumer.hlinux/io.hlinux/irqchip/chained_irq.hlinux/irqdomain.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/pci.hlinux/platform_device.hlinux/pm_runtime.hlinux/regmap.h../../pci.hpcie-cadence.h
Detected Declarations
struct j721e_pciestruct j721e_pcie_dataenum link_statusenum j721e_pcie_modefunction j721e_pcie_user_readlfunction j721e_pcie_user_writelfunction j721e_pcie_intd_readlfunction j721e_pcie_intd_writelfunction j721e_pcie_link_irq_handlerfunction j721e_pcie_disable_link_irqfunction j721e_pcie_config_link_irqfunction j721e_pcie_start_linkfunction j721e_pcie_stop_linkfunction j721e_pcie_link_upfunction j721e_pcie_set_modefunction j721e_pcie_set_link_speedfunction j721e_pcie_set_lane_countfunction j721e_enable_acspcie_refclkfunction j721e_pcie_ctrl_initfunction cdns_ti_pcie_config_readfunction cdns_ti_pcie_config_writefunction j721e_pcie_probefunction Specificationfunction j721e_pcie_removefunction j721e_pcie_suspend_noirqfunction j721e_pcie_resume_noirqfunction Specification
Annotated Snippet
struct j721e_pcie {
struct cdns_pcie *cdns_pcie;
struct clk *refclk;
u32 mode;
u32 num_lanes;
u32 max_lanes;
struct gpio_desc *reset_gpio;
void __iomem *user_cfg_base;
void __iomem *intd_cfg_base;
u32 linkdown_irq_regfield;
};
enum j721e_pcie_mode {
PCI_MODE_RC,
PCI_MODE_EP,
};
struct j721e_pcie_data {
enum j721e_pcie_mode mode;
unsigned int quirk_retrain_flag:1;
unsigned int quirk_detect_quiet_flag:1;
unsigned int quirk_disable_flr:1;
u32 linkdown_irq_regfield;
unsigned int byte_access_allowed:1;
unsigned int max_lanes;
};
static inline u32 j721e_pcie_user_readl(struct j721e_pcie *pcie, u32 offset)
{
return readl(pcie->user_cfg_base + offset);
}
static inline void j721e_pcie_user_writel(struct j721e_pcie *pcie, u32 offset,
u32 value)
{
writel(value, pcie->user_cfg_base + offset);
}
static inline u32 j721e_pcie_intd_readl(struct j721e_pcie *pcie, u32 offset)
{
return readl(pcie->intd_cfg_base + offset);
}
static inline void j721e_pcie_intd_writel(struct j721e_pcie *pcie, u32 offset,
u32 value)
{
writel(value, pcie->intd_cfg_base + offset);
}
static irqreturn_t j721e_pcie_link_irq_handler(int irq, void *priv)
{
struct j721e_pcie *pcie = priv;
struct device *dev = pcie->cdns_pcie->dev;
u32 reg;
reg = j721e_pcie_intd_readl(pcie, STATUS_REG_SYS_2);
if (!(reg & pcie->linkdown_irq_regfield))
return IRQ_NONE;
dev_err(dev, "LINK DOWN!\n");
j721e_pcie_intd_writel(pcie, STATUS_CLR_REG_SYS_2, pcie->linkdown_irq_regfield);
return IRQ_HANDLED;
}
static void j721e_pcie_disable_link_irq(struct j721e_pcie *pcie)
{
u32 reg;
reg = j721e_pcie_intd_readl(pcie, ENABLE_CLR_REG_SYS_2);
reg |= pcie->linkdown_irq_regfield;
j721e_pcie_intd_writel(pcie, ENABLE_CLR_REG_SYS_2, reg);
}
static void j721e_pcie_config_link_irq(struct j721e_pcie *pcie)
{
u32 reg;
reg = j721e_pcie_intd_readl(pcie, ENABLE_REG_SYS_2);
reg |= pcie->linkdown_irq_regfield;
j721e_pcie_intd_writel(pcie, ENABLE_REG_SYS_2, reg);
}
static int j721e_pcie_start_link(struct cdns_pcie *cdns_pcie)
{
struct j721e_pcie *pcie = dev_get_drvdata(cdns_pcie->dev);
u32 reg;
reg = j721e_pcie_user_readl(pcie, J721E_PCIE_USER_CMD_STATUS);
reg |= LINK_TRAINING_ENABLE;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clk-provider.h`, `linux/container_of.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/io.h`, `linux/irqchip/chained_irq.h`, `linux/irqdomain.h`.
- Detected declarations: `struct j721e_pcie`, `struct j721e_pcie_data`, `enum link_status`, `enum j721e_pcie_mode`, `function j721e_pcie_user_readl`, `function j721e_pcie_user_writel`, `function j721e_pcie_intd_readl`, `function j721e_pcie_intd_writel`, `function j721e_pcie_link_irq_handler`, `function j721e_pcie_disable_link_irq`.
- 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.