drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
Source file repositories/reference/linux-study-clean/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c- Extension
.c- Size
- 87737 bytes
- Lines
- 2343
- 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.hufs/unipro.hphy-qcom-qmp-common.hphy-qcom-qmp.hphy-qcom-qmp-pcs-ufs-v2.hphy-qcom-qmp-pcs-ufs-v3.hphy-qcom-qmp-pcs-ufs-v4.hphy-qcom-qmp-pcs-ufs-v5.hphy-qcom-qmp-pcs-ufs-v6.hphy-qcom-qmp-qserdes-txrx-ufs-v6.hphy-qcom-qmp-qserdes-txrx-ufs-v7.h
Detected Declarations
struct qmp_ufs_offsetsstruct qmp_phy_cfg_tblsstruct qmp_phy_cfgstruct qmp_ufsenum qphy_reg_layoutfunction qphy_setbitsfunction qphy_clrbitsfunction qmp_ufs_serdes_initfunction qmp_ufs_lanes_initfunction qmp_ufs_pcs_initfunction qmp_ufs_get_gear_overlayfunction qmp_ufs_init_allfunction qmp_ufs_init_registersfunction qmp_ufs_power_onfunction qmp_ufs_phy_calibratefunction qmp_ufs_power_offfunction qmp_ufs_set_modefunction qmp_ufs_phy_initfunction qmp_ufs_clk_initfunction qmp_ufs_clk_release_providerfunction qmp_ufs_register_clocksfunction qmp_ufs_parse_dt_legacyfunction qmp_ufs_parse_dtfunction qmp_ufs_probe
Annotated Snippet
struct qmp_ufs_offsets {
u16 serdes;
u16 pcs;
u16 tx;
u16 rx;
u16 tx2;
u16 rx2;
};
struct qmp_phy_cfg_tbls {
/* Init sequence for PHY blocks - serdes, tx, rx, pcs */
const struct qmp_phy_init_tbl *serdes;
int serdes_num;
const struct qmp_phy_init_tbl *tx;
int tx_num;
const struct qmp_phy_init_tbl *rx;
int rx_num;
const struct qmp_phy_init_tbl *pcs;
int pcs_num;
/* Maximum supported Gear of this tbls */
u32 max_gear;
};
/* struct qmp_phy_cfg - per-PHY initialization config */
struct qmp_phy_cfg {
int lanes;
const struct qmp_ufs_offsets *offsets;
/* Maximum supported Gear of this config */
u32 max_supported_gear;
/* Main init sequence for PHY blocks - serdes, tx, rx, pcs */
const struct qmp_phy_cfg_tbls tbls;
/* Additional sequence for HS Series B */
const struct qmp_phy_cfg_tbls tbls_hs_b;
/* Additional sequence for different HS Gears */
const struct qmp_phy_cfg_tbls tbls_hs_overlay[NUM_OVERLAY];
/* 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 PCS block has no separate SW_RESET register */
bool no_pcs_sw_reset;
};
struct qmp_ufs {
struct device *dev;
const struct qmp_phy_cfg *cfg;
void __iomem *serdes;
void __iomem *pcs;
void __iomem *pcs_misc;
void __iomem *tx;
void __iomem *rx;
void __iomem *tx2;
void __iomem *rx2;
struct clk_bulk_data *clks;
int num_clks;
struct regulator_bulk_data *vregs;
struct reset_control *ufs_reset;
struct phy *phy;
u32 mode;
u32 submode;
};
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;
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_ufs_offsets`, `struct qmp_phy_cfg_tbls`, `struct qmp_phy_cfg`, `struct qmp_ufs`, `enum qphy_reg_layout`, `function qphy_setbits`, `function qphy_clrbits`, `function qmp_ufs_serdes_init`, `function qmp_ufs_lanes_init`, `function qmp_ufs_pcs_init`.
- 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.