drivers/pci/controller/dwc/pcie-qcom-ep.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/dwc/pcie-qcom-ep.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/dwc/pcie-qcom-ep.c- Extension
.c- Size
- 28526 bytes
- Lines
- 990
- 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/debugfs.hlinux/delay.hlinux/gpio/consumer.hlinux/interconnect.hlinux/mfd/syscon.hlinux/phy/pcie.hlinux/phy/phy.hlinux/platform_device.hlinux/pm_domain.hlinux/regmap.hlinux/reset.hlinux/module.h../../pci.hpcie-designware.hpcie-qcom-common.h
Detected Declarations
struct qcom_pcie_ep_cfgstruct qcom_pcie_epenum qcom_pcie_ep_link_statusfunction qcom_pcie_ep_core_resetfunction qcom_pcie_ep_configure_tcsrfunction qcom_pcie_dw_link_upfunction qcom_pcie_dw_start_linkfunction qcom_pcie_dw_stop_linkfunction qcom_pcie_dw_write_dbi2function qcom_pcie_ep_icc_updatefunction qcom_pcie_enable_resourcesfunction qcom_pcie_disable_resourcesfunction qcom_pcie_perst_deassertfunction qcom_pcie_perst_assertfunction qcom_pcie_ep_get_io_resourcesfunction qcom_pcie_ep_get_resourcesfunction qcom_pcie_ep_global_irq_threadfunction qcom_pcie_ep_perst_irq_threadfunction qcom_pcie_ep_enable_irq_resourcesfunction qcom_pcie_ep_raise_irqfunction qcom_pcie_ep_link_transition_countfunction qcom_pcie_ep_init_debugfsfunction qcom_pcie_epc_get_featuresfunction qcom_pcie_ep_probefunction qcom_pcie_ep_remove
Annotated Snippet
struct qcom_pcie_ep_cfg {
bool hdma_support;
bool override_no_snoop;
bool disable_mhi_ram_parity_check;
bool firmware_managed;
};
/**
* struct qcom_pcie_ep - Qualcomm PCIe Endpoint Controller
* @pci: Designware PCIe controller struct
* @parf: Qualcomm PCIe specific PARF register base
* @mmio: MMIO register base
* @perst_map: PERST regmap
* @mmio_res: MMIO region resource
* @core_reset: PCIe Endpoint core reset
* @reset: PERST# GPIO
* @wake: WAKE# GPIO
* @phy: PHY controller block
* @debugfs: PCIe Endpoint Debugfs directory
* @icc_mem: Handle to an interconnect path between PCIe and MEM
* @clks: PCIe clocks
* @num_clks: PCIe clocks count
* @perst_en: Flag for PERST enable
* @perst_sep_en: Flag for PERST separation enable
* @cfg: PCIe EP config struct
* @link_status: PCIe Link status
* @global_irq: Qualcomm PCIe specific Global IRQ
* @perst_irq: PERST# IRQ
*/
struct qcom_pcie_ep {
struct dw_pcie pci;
void __iomem *parf;
void __iomem *mmio;
struct regmap *perst_map;
struct resource *mmio_res;
struct reset_control *core_reset;
struct gpio_desc *reset;
struct gpio_desc *wake;
struct phy *phy;
struct dentry *debugfs;
struct icc_path *icc_mem;
struct clk_bulk_data *clks;
int num_clks;
u32 perst_en;
u32 perst_sep_en;
const struct qcom_pcie_ep_cfg *cfg;
enum qcom_pcie_ep_link_status link_status;
int global_irq;
int perst_irq;
};
static int qcom_pcie_ep_core_reset(struct qcom_pcie_ep *pcie_ep)
{
struct dw_pcie *pci = &pcie_ep->pci;
struct device *dev = pci->dev;
int ret;
ret = reset_control_assert(pcie_ep->core_reset);
if (ret) {
dev_err(dev, "Cannot assert core reset\n");
return ret;
}
usleep_range(CORE_RESET_TIME_US_MIN, CORE_RESET_TIME_US_MAX);
ret = reset_control_deassert(pcie_ep->core_reset);
if (ret) {
dev_err(dev, "Cannot de-assert core reset\n");
return ret;
}
usleep_range(CORE_RESET_TIME_US_MIN, CORE_RESET_TIME_US_MAX);
return 0;
}
/*
* Delatch PERST_EN and PERST_SEPARATION_ENABLE with TCSR to avoid
* device reset during host reboot and hibernation. The driver is
* expected to handle this situation.
*/
static void qcom_pcie_ep_configure_tcsr(struct qcom_pcie_ep *pcie_ep)
{
if (pcie_ep->perst_map) {
Annotation
- Immediate include surface: `linux/clk.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/interconnect.h`, `linux/mfd/syscon.h`, `linux/phy/pcie.h`, `linux/phy/phy.h`.
- Detected declarations: `struct qcom_pcie_ep_cfg`, `struct qcom_pcie_ep`, `enum qcom_pcie_ep_link_status`, `function qcom_pcie_ep_core_reset`, `function qcom_pcie_ep_configure_tcsr`, `function qcom_pcie_dw_link_up`, `function qcom_pcie_dw_start_link`, `function qcom_pcie_dw_stop_link`, `function qcom_pcie_dw_write_dbi2`, `function qcom_pcie_ep_icc_update`.
- 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.