drivers/pci/controller/dwc/pcie-uniphier-ep.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/dwc/pcie-uniphier-ep.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/dwc/pcie-uniphier-ep.c- Extension
.c- Size
- 11064 bytes
- Lines
- 462
- 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/bitops.hlinux/bitfield.hlinux/clk.hlinux/delay.hlinux/init.hlinux/iopoll.hlinux/of.hlinux/pci.hlinux/phy/phy.hlinux/platform_device.hlinux/reset.hpcie-designware.h
Detected Declarations
struct uniphier_pcie_ep_privstruct uniphier_pcie_ep_soc_datafunction uniphier_pcie_ltssm_enablefunction uniphier_pcie_phy_resetfunction uniphier_pcie_pro5_init_epfunction uniphier_pcie_nx1_init_epfunction uniphier_pcie_nx1_wait_epfunction uniphier_pcie_start_linkfunction uniphier_pcie_stop_linkfunction uniphier_pcie_ep_raise_intx_irqfunction uniphier_pcie_ep_raise_msi_irqfunction uniphier_pcie_ep_raise_irqfunction uniphier_pcie_get_featuresfunction uniphier_pcie_ep_enablefunction uniphier_pcie_ep_probe
Annotated Snippet
struct uniphier_pcie_ep_priv {
void __iomem *base;
struct dw_pcie pci;
struct clk *clk, *clk_gio;
struct reset_control *rst, *rst_gio;
struct phy *phy;
const struct uniphier_pcie_ep_soc_data *data;
};
struct uniphier_pcie_ep_soc_data {
bool has_gio;
void (*init)(struct uniphier_pcie_ep_priv *priv);
int (*wait)(struct uniphier_pcie_ep_priv *priv);
const struct pci_epc_features features;
};
#define to_uniphier_pcie(x) dev_get_drvdata((x)->dev)
static void uniphier_pcie_ltssm_enable(struct uniphier_pcie_ep_priv *priv,
bool enable)
{
u32 val;
val = readl(priv->base + PCL_APP_READY_CTRL);
if (enable)
val |= PCL_APP_LTSSM_ENABLE;
else
val &= ~PCL_APP_LTSSM_ENABLE;
writel(val, priv->base + PCL_APP_READY_CTRL);
}
static void uniphier_pcie_phy_reset(struct uniphier_pcie_ep_priv *priv,
bool assert)
{
u32 val;
val = readl(priv->base + PCL_RSTCTRL2);
if (assert)
val |= PCL_RSTCTRL_PHY_RESET;
else
val &= ~PCL_RSTCTRL_PHY_RESET;
writel(val, priv->base + PCL_RSTCTRL2);
}
static void uniphier_pcie_pro5_init_ep(struct uniphier_pcie_ep_priv *priv)
{
u32 val;
/* set EP mode */
val = readl(priv->base + PCL_MODE);
val |= PCL_MODE_REGEN | PCL_MODE_REGVAL;
writel(val, priv->base + PCL_MODE);
/* clock request */
val = readl(priv->base + PCL_APP_CLK_CTRL);
val &= ~PCL_APP_CLK_REQ;
writel(val, priv->base + PCL_APP_CLK_CTRL);
/* deassert PIPE3 and AXI reset */
val = readl(priv->base + PCL_RSTCTRL0);
val |= PCL_RSTCTRL_AXI_REG | PCL_RSTCTRL_AXI_SLAVE
| PCL_RSTCTRL_AXI_MASTER | PCL_RSTCTRL_PIPE3;
writel(val, priv->base + PCL_RSTCTRL0);
uniphier_pcie_ltssm_enable(priv, false);
msleep(100);
}
static void uniphier_pcie_nx1_init_ep(struct uniphier_pcie_ep_priv *priv)
{
u32 val;
/* set EP mode */
val = readl(priv->base + PCL_MODE);
val |= PCL_MODE_REGEN | PCL_MODE_REGVAL;
writel(val, priv->base + PCL_MODE);
/* use auxiliary power detection */
val = readl(priv->base + PCL_APP_PM0);
val |= PCL_SYS_AUX_PWR_DET;
writel(val, priv->base + PCL_APP_PM0);
/* assert PERST# */
val = readl(priv->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, priv->base + PCL_PINCTRL0);
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/bitfield.h`, `linux/clk.h`, `linux/delay.h`, `linux/init.h`, `linux/iopoll.h`, `linux/of.h`, `linux/pci.h`.
- Detected declarations: `struct uniphier_pcie_ep_priv`, `struct uniphier_pcie_ep_soc_data`, `function uniphier_pcie_ltssm_enable`, `function uniphier_pcie_phy_reset`, `function uniphier_pcie_pro5_init_ep`, `function uniphier_pcie_nx1_init_ep`, `function uniphier_pcie_nx1_wait_ep`, `function uniphier_pcie_start_link`, `function uniphier_pcie_stop_link`, `function uniphier_pcie_ep_raise_intx_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.