drivers/phy/qualcomm/phy-qcom-usb-hs-28nm.c
Source file repositories/reference/linux-study-clean/drivers/phy/qualcomm/phy-qcom-usb-hs-28nm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/phy/qualcomm/phy-qcom-usb-hs-28nm.c- Extension
.c- Size
- 9482 bytes
- Lines
- 426
- 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/delay.hlinux/io.hlinux/kernel.hlinux/module.hlinux/of.hlinux/of_graph.hlinux/phy/phy.hlinux/platform_device.hlinux/regulator/consumer.hlinux/reset.hlinux/slab.h
Detected Declarations
struct hsphy_init_seqstruct hsphy_datastruct hsphy_privenum hsphy_voltageenum hsphy_vregfunction qcom_snps_hsphy_set_modefunction qcom_snps_hsphy_enable_hv_interruptsfunction qcom_snps_hsphy_disable_hv_interruptsfunction qcom_snps_hsphy_enter_retentionfunction qcom_snps_hsphy_exit_retentionfunction qcom_snps_hsphy_power_onfunction qcom_snps_hsphy_power_offfunction qcom_snps_hsphy_resetfunction qcom_snps_hsphy_init_sequencefunction qcom_snps_hsphy_por_resetfunction qcom_snps_hsphy_initfunction qcom_snps_hsphy_exitfunction qcom_snps_hsphy_probe
Annotated Snippet
struct hsphy_init_seq {
int offset;
int val;
int delay;
};
struct hsphy_data {
const struct hsphy_init_seq *init_seq;
unsigned int init_seq_num;
};
struct hsphy_priv {
void __iomem *base;
struct clk_bulk_data *clks;
int num_clks;
struct reset_control *phy_reset;
struct reset_control *por_reset;
struct regulator_bulk_data vregs[VREG_NUM];
const struct hsphy_data *data;
enum phy_mode mode;
};
static int qcom_snps_hsphy_set_mode(struct phy *phy, enum phy_mode mode,
int submode)
{
struct hsphy_priv *priv = phy_get_drvdata(phy);
priv->mode = PHY_MODE_INVALID;
if (mode > 0)
priv->mode = mode;
return 0;
}
static void qcom_snps_hsphy_enable_hv_interrupts(struct hsphy_priv *priv)
{
u32 val;
/* Clear any existing interrupts before enabling the interrupts */
val = readb(priv->base + PHY_INTR_CLEAR0);
val |= DPDM_MASK;
writeb(val, priv->base + PHY_INTR_CLEAR0);
writeb(0x0, priv->base + PHY_IRQ_CMD);
usleep_range(200, 220);
writeb(0x1, priv->base + PHY_IRQ_CMD);
/* Make sure the interrupts are cleared */
usleep_range(200, 220);
val = readb(priv->base + PHY_INTR_MASK0);
switch (priv->mode) {
case PHY_MODE_USB_HOST_HS:
case PHY_MODE_USB_HOST_FS:
case PHY_MODE_USB_DEVICE_HS:
case PHY_MODE_USB_DEVICE_FS:
val |= DP_1_0 | DM_0_1;
break;
case PHY_MODE_USB_HOST_LS:
case PHY_MODE_USB_DEVICE_LS:
val |= DP_0_1 | DM_1_0;
break;
default:
/* No device connected */
val |= DP_0_1 | DM_0_1;
break;
}
writeb(val, priv->base + PHY_INTR_MASK0);
}
static void qcom_snps_hsphy_disable_hv_interrupts(struct hsphy_priv *priv)
{
u32 val;
val = readb(priv->base + PHY_INTR_MASK0);
val &= ~DPDM_MASK;
writeb(val, priv->base + PHY_INTR_MASK0);
/* Clear any pending interrupts */
val = readb(priv->base + PHY_INTR_CLEAR0);
val |= DPDM_MASK;
writeb(val, priv->base + PHY_INTR_CLEAR0);
writeb(0x0, priv->base + PHY_IRQ_CMD);
usleep_range(200, 220);
writeb(0x1, priv->base + PHY_IRQ_CMD);
usleep_range(200, 220);
}
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/io.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`, `linux/of_graph.h`, `linux/phy/phy.h`.
- Detected declarations: `struct hsphy_init_seq`, `struct hsphy_data`, `struct hsphy_priv`, `enum hsphy_voltage`, `enum hsphy_vreg`, `function qcom_snps_hsphy_set_mode`, `function qcom_snps_hsphy_enable_hv_interrupts`, `function qcom_snps_hsphy_disable_hv_interrupts`, `function qcom_snps_hsphy_enter_retention`, `function qcom_snps_hsphy_exit_retention`.
- 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.