drivers/pci/controller/dwc/pcie-uniphier.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/dwc/pcie-uniphier.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/dwc/pcie-uniphier.c- Extension
.c- Size
- 10066 bytes
- Lines
- 410
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/bitops.hlinux/bitfield.hlinux/clk.hlinux/delay.hlinux/init.hlinux/interrupt.hlinux/iopoll.hlinux/irqchip/chained_irq.hlinux/irqdomain.hlinux/of_irq.hlinux/pci.hlinux/phy/phy.hlinux/platform_device.hlinux/reset.hpcie-designware.h
Detected Declarations
struct uniphier_pciefunction uniphier_pcie_ltssm_enablefunction uniphier_pcie_init_rcfunction uniphier_pcie_wait_rcfunction uniphier_pcie_link_upfunction uniphier_pcie_start_linkfunction uniphier_pcie_stop_linkfunction uniphier_pcie_irq_enablefunction uniphier_pcie_irq_maskfunction uniphier_pcie_irq_unmaskfunction uniphier_pcie_intx_mapfunction uniphier_pcie_irq_handlerfunction uniphier_pcie_config_intx_irqfunction uniphier_pcie_host_initfunction uniphier_pcie_host_enablefunction uniphier_pcie_probe
Annotated Snippet
struct uniphier_pcie {
struct dw_pcie pci;
void __iomem *base;
struct clk *clk;
struct reset_control *rst;
struct phy *phy;
struct irq_domain *intx_irq_domain;
};
#define to_uniphier_pcie(x) dev_get_drvdata((x)->dev)
static void uniphier_pcie_ltssm_enable(struct uniphier_pcie *pcie,
bool enable)
{
u32 val;
val = readl(pcie->base + PCL_APP_READY_CTRL);
if (enable)
val |= PCL_APP_LTSSM_ENABLE;
else
val &= ~PCL_APP_LTSSM_ENABLE;
writel(val, pcie->base + PCL_APP_READY_CTRL);
}
static void uniphier_pcie_init_rc(struct uniphier_pcie *pcie)
{
u32 val;
/* set RC MODE */
val = readl(pcie->base + PCL_MODE);
val |= PCL_MODE_REGEN;
val &= ~PCL_MODE_REGVAL;
writel(val, pcie->base + PCL_MODE);
/* use auxiliary power detection */
val = readl(pcie->base + PCL_APP_PM0);
val |= PCL_SYS_AUX_PWR_DET;
writel(val, pcie->base + PCL_APP_PM0);
/* assert PERST# */
val = readl(pcie->base + PCL_PINCTRL0);
val &= ~(PCL_PERST_NOE_REGVAL | PCL_PERST_OUT_REGVAL
| PCL_PERST_PLDN_REGVAL);
val |= PCL_PERST_NOE_REGEN | PCL_PERST_OUT_REGEN
| PCL_PERST_PLDN_REGEN;
writel(val, pcie->base + PCL_PINCTRL0);
uniphier_pcie_ltssm_enable(pcie, false);
usleep_range(100000, 200000);
/* deassert PERST# */
val = readl(pcie->base + PCL_PINCTRL0);
val |= PCL_PERST_OUT_REGVAL | PCL_PERST_OUT_REGEN;
writel(val, pcie->base + PCL_PINCTRL0);
}
static int uniphier_pcie_wait_rc(struct uniphier_pcie *pcie)
{
u32 status;
int ret;
/* wait PIPE clock */
ret = readl_poll_timeout(pcie->base + PCL_PIPEMON, status,
status & PCL_PCLK_ALIVE, 100000, 1000000);
if (ret) {
dev_err(pcie->pci.dev,
"Failed to initialize controller in RC mode\n");
return ret;
}
return 0;
}
static bool uniphier_pcie_link_up(struct dw_pcie *pci)
{
struct uniphier_pcie *pcie = to_uniphier_pcie(pci);
u32 val, mask;
val = readl(pcie->base + PCL_STATUS_LINK);
mask = PCL_RDLH_LINK_UP | PCL_XMLH_LINK_UP;
return (val & mask) == mask;
}
static int uniphier_pcie_start_link(struct dw_pcie *pci)
{
struct uniphier_pcie *pcie = to_uniphier_pcie(pci);
uniphier_pcie_ltssm_enable(pcie, true);
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/bitfield.h`, `linux/clk.h`, `linux/delay.h`, `linux/init.h`, `linux/interrupt.h`, `linux/iopoll.h`, `linux/irqchip/chained_irq.h`.
- Detected declarations: `struct uniphier_pcie`, `function uniphier_pcie_ltssm_enable`, `function uniphier_pcie_init_rc`, `function uniphier_pcie_wait_rc`, `function uniphier_pcie_link_up`, `function uniphier_pcie_start_link`, `function uniphier_pcie_stop_link`, `function uniphier_pcie_irq_enable`, `function uniphier_pcie_irq_mask`, `function uniphier_pcie_irq_unmask`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.