drivers/phy/qualcomm/phy-qcom-qmp-usb.c
Source file repositories/reference/linux-study-clean/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/phy/qualcomm/phy-qcom-qmp-usb.c- Extension
.c- Size
- 102068 bytes
- Lines
- 2525
- Domain
- Driver Families
- Bucket
- drivers/phy
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- 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/delay.hlinux/err.hlinux/io.hlinux/iopoll.hlinux/kernel.hlinux/module.hlinux/of.hlinux/of_address.hlinux/phy/phy.hlinux/platform_device.hlinux/regulator/consumer.hlinux/reset.hlinux/slab.hphy-qcom-qmp-common.hphy-qcom-qmp.hphy-qcom-qmp-pcs-misc-v3.hphy-qcom-qmp-pcs-misc-v4.hphy-qcom-qmp-pcs-usb-v4.hphy-qcom-qmp-pcs-usb-v5.hphy-qcom-qmp-pcs-usb-v6.hphy-qcom-qmp-pcs-usb-v7.hphy-qcom-qmp-pcs-usb-v8.h
Detected Declarations
struct qmp_usb_offsetsstruct qmp_phy_cfgstruct qmp_usbenum qphy_reg_layoutfunction qphy_setbitsfunction qphy_clrbitsfunction qmp_usb_serdes_initfunction qmp_usb_initfunction qmp_usb_exitfunction qmp_usb_power_onfunction qmp_usb_power_offfunction qmp_usb_enablefunction qmp_usb_disablefunction qmp_usb_set_modefunction qmp_usb_enable_autonomous_modefunction qmp_usb_disable_autonomous_modefunction qmp_usb_runtime_suspendfunction qmp_usb_runtime_resumefunction qmp_usb_reset_initfunction qmp_usb_clk_initfunction phy_clk_release_providerfunction phy_pipe_clk_registerfunction qmp_usb_parse_dt_legacyfunction qmp_usb_parse_dtfunction qmp_usb_probe
Annotated Snippet
struct qmp_usb_offsets {
u16 serdes;
u16 pcs;
u16 pcs_misc;
u16 pcs_usb;
u16 tx;
u16 rx;
};
/* struct qmp_phy_cfg - per-PHY initialization config */
struct qmp_phy_cfg {
const struct qmp_usb_offsets *offsets;
/* Init sequence for PHY blocks - serdes, tx, rx, pcs */
const struct qmp_phy_init_tbl *serdes_tbl;
int serdes_tbl_num;
const struct qmp_phy_init_tbl *tx_tbl;
int tx_tbl_num;
const struct qmp_phy_init_tbl *rx_tbl;
int rx_tbl_num;
const struct qmp_phy_init_tbl *pcs_tbl;
int pcs_tbl_num;
const struct qmp_phy_init_tbl *pcs_usb_tbl;
int pcs_usb_tbl_num;
/* regulators to be requested */
const struct regulator_bulk_data *vreg_list;
int num_vregs;
/* array of registers with different offsets */
const unsigned int *regs;
/* true, if PHY needs delay after POWER_DOWN */
bool has_pwrdn_delay;
/* Offset from PCS to PCS_USB region */
unsigned int pcs_usb_offset;
};
struct qmp_usb {
struct device *dev;
const struct qmp_phy_cfg *cfg;
void __iomem *serdes;
void __iomem *pcs;
void __iomem *pcs_misc;
void __iomem *pcs_usb;
void __iomem *tx;
void __iomem *rx;
struct clk *pipe_clk;
struct clk_bulk_data *clks;
int num_clks;
int num_resets;
struct reset_control_bulk_data *resets;
struct regulator_bulk_data *vregs;
enum phy_mode mode;
struct phy *phy;
struct clk_fixed_rate pipe_clk_fixed;
};
static inline void qphy_setbits(void __iomem *base, u32 offset, u32 val)
{
u32 reg;
reg = readl(base + offset);
reg |= val;
writel(reg, base + offset);
/* ensure that above write is through */
readl(base + offset);
}
static inline void qphy_clrbits(void __iomem *base, u32 offset, u32 val)
{
u32 reg;
reg = readl(base + offset);
reg &= ~val;
writel(reg, base + offset);
/* ensure that above write is through */
readl(base + offset);
}
/* list of clocks required by phy */
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clk-provider.h`, `linux/delay.h`, `linux/err.h`, `linux/io.h`, `linux/iopoll.h`, `linux/kernel.h`, `linux/module.h`.
- Detected declarations: `struct qmp_usb_offsets`, `struct qmp_phy_cfg`, `struct qmp_usb`, `enum qphy_reg_layout`, `function qphy_setbits`, `function qphy_clrbits`, `function qmp_usb_serdes_init`, `function qmp_usb_init`, `function qmp_usb_exit`, `function qmp_usb_power_on`.
- Atlas domain: Driver Families / drivers/phy.
- Implementation status: source implementation candidate.
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.