drivers/pci/controller/dwc/pcie-artpec6.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/dwc/pcie-artpec6.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/dwc/pcie-artpec6.c- Extension
.c- Size
- 13123 bytes
- Lines
- 522
- 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/delay.hlinux/kernel.hlinux/init.hlinux/of.hlinux/pci.hlinux/platform_device.hlinux/resource.hlinux/signal.hlinux/types.hlinux/interrupt.hlinux/mfd/syscon.hlinux/regmap.hpcie-designware.h
Detected Declarations
struct artpec6_pciestruct artpec_pcie_of_dataenum artpec_pcie_variantsfunction artpec6_pcie_readlfunction artpec6_pcie_writelfunction artpec6_pcie_cpu_addr_fixupfunction artpec6_pcie_establish_linkfunction artpec6_pcie_stop_linkfunction artpec6_pcie_wait_for_phy_a6function artpec6_pcie_wait_for_phy_a7function artpec6_pcie_wait_for_phyfunction artpec6_pcie_init_phy_a6function artpec6_pcie_init_phy_a7function artpec6_pcie_init_phyfunction artpec6_pcie_assert_core_resetfunction artpec6_pcie_deassert_core_resetfunction artpec6_pcie_host_initfunction artpec6_pcie_ep_initfunction artpec6_pcie_raise_irqfunction artpec6_pcie_get_featuresfunction artpec6_pcie_probe
Annotated Snippet
struct artpec6_pcie {
struct dw_pcie *pci;
struct regmap *regmap; /* DT axis,syscon-pcie */
void __iomem *phy_base; /* DT phy */
enum artpec_pcie_variants variant;
enum dw_pcie_device_mode mode;
};
struct artpec_pcie_of_data {
enum artpec_pcie_variants variant;
enum dw_pcie_device_mode mode;
};
static const struct of_device_id artpec6_pcie_of_match[];
/* ARTPEC-6 specific registers */
#define PCIECFG 0x18
#define PCIECFG_DBG_OEN BIT(24)
#define PCIECFG_CORE_RESET_REQ BIT(21)
#define PCIECFG_LTSSM_ENABLE BIT(20)
#define PCIECFG_DEVICE_TYPE_MASK GENMASK(19, 16)
#define PCIECFG_CLKREQ_B BIT(11)
#define PCIECFG_REFCLK_ENABLE BIT(10)
#define PCIECFG_PLL_ENABLE BIT(9)
#define PCIECFG_PCLK_ENABLE BIT(8)
#define PCIECFG_RISRCREN BIT(4)
#define PCIECFG_MODE_TX_DRV_EN BIT(3)
#define PCIECFG_CISRREN BIT(2)
#define PCIECFG_MACRO_ENABLE BIT(0)
/* ARTPEC-7 specific fields */
#define PCIECFG_REFCLKSEL BIT(23)
#define PCIECFG_NOC_RESET BIT(3)
#define PCIESTAT 0x1c
/* ARTPEC-7 specific fields */
#define PCIESTAT_EXTREFCLK BIT(3)
#define NOCCFG 0x40
#define NOCCFG_ENABLE_CLK_PCIE BIT(4)
#define NOCCFG_POWER_PCIE_IDLEACK BIT(3)
#define NOCCFG_POWER_PCIE_IDLE BIT(2)
#define NOCCFG_POWER_PCIE_IDLEREQ BIT(1)
#define PHY_STATUS 0x118
#define PHY_COSPLLLOCK BIT(0)
#define PHY_TX_ASIC_OUT 0x4040
#define PHY_TX_ASIC_OUT_TX_ACK BIT(0)
#define PHY_RX_ASIC_OUT 0x405c
#define PHY_RX_ASIC_OUT_ACK BIT(0)
static u32 artpec6_pcie_readl(struct artpec6_pcie *artpec6_pcie, u32 offset)
{
u32 val;
regmap_read(artpec6_pcie->regmap, offset, &val);
return val;
}
static void artpec6_pcie_writel(struct artpec6_pcie *artpec6_pcie, u32 offset, u32 val)
{
regmap_write(artpec6_pcie->regmap, offset, val);
}
static u64 artpec6_pcie_cpu_addr_fixup(struct dw_pcie *pci, u64 cpu_addr)
{
struct artpec6_pcie *artpec6_pcie = to_artpec6_pcie(pci);
struct dw_pcie_rp *pp = &pci->pp;
struct dw_pcie_ep *ep = &pci->ep;
switch (artpec6_pcie->mode) {
case DW_PCIE_RC_TYPE:
return cpu_addr - pp->cfg0_base;
case DW_PCIE_EP_TYPE:
return cpu_addr - ep->phys_base;
default:
dev_err(pci->dev, "UNKNOWN device type\n");
}
return cpu_addr;
}
static int artpec6_pcie_establish_link(struct dw_pcie *pci)
{
struct artpec6_pcie *artpec6_pcie = to_artpec6_pcie(pci);
u32 val;
val = artpec6_pcie_readl(artpec6_pcie, PCIECFG);
val |= PCIECFG_LTSSM_ENABLE;
artpec6_pcie_writel(artpec6_pcie, PCIECFG, val);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/kernel.h`, `linux/init.h`, `linux/of.h`, `linux/pci.h`, `linux/platform_device.h`, `linux/resource.h`, `linux/signal.h`.
- Detected declarations: `struct artpec6_pcie`, `struct artpec_pcie_of_data`, `enum artpec_pcie_variants`, `function artpec6_pcie_readl`, `function artpec6_pcie_writel`, `function artpec6_pcie_cpu_addr_fixup`, `function artpec6_pcie_establish_link`, `function artpec6_pcie_stop_link`, `function artpec6_pcie_wait_for_phy_a6`, `function artpec6_pcie_wait_for_phy_a7`.
- 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.