drivers/phy/socionext/phy-uniphier-usb3hs.c
Source file repositories/reference/linux-study-clean/drivers/phy/socionext/phy-uniphier-usb3hs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/phy/socionext/phy-uniphier-usb3hs.c- Extension
.c- Size
- 11639 bytes
- Lines
- 471
- 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/bitfield.hlinux/bitops.hlinux/clk.hlinux/io.hlinux/module.hlinux/nvmem-consumer.hlinux/of.hlinux/of_platform.hlinux/phy/phy.hlinux/platform_device.hlinux/regulator/consumer.hlinux/reset.hlinux/slab.h
Detected Declarations
struct uniphier_u3hsphy_paramstruct uniphier_u3hsphy_trim_paramstruct uniphier_u3hsphy_privstruct uniphier_u3hsphy_soc_datafunction uniphier_u3hsphy_trim_ld20function uniphier_u3hsphy_get_nvparamfunction uniphier_u3hsphy_get_nvparamsfunction uniphier_u3hsphy_update_configfunction uniphier_u3hsphy_set_paramfunction uniphier_u3hsphy_power_onfunction uniphier_u3hsphy_power_offfunction uniphier_u3hsphy_initfunction uniphier_u3hsphy_exitfunction uniphier_u3hsphy_probe
Annotated Snippet
struct uniphier_u3hsphy_param {
struct {
int reg_no;
int msb;
int lsb;
} field;
u8 value;
};
struct uniphier_u3hsphy_trim_param {
unsigned int rterm;
unsigned int sel_t;
unsigned int hs_i;
};
#define trim_param_is_valid(p) ((p)->rterm || (p)->sel_t || (p)->hs_i)
struct uniphier_u3hsphy_priv {
struct device *dev;
void __iomem *base;
struct clk *clk, *clk_parent, *clk_ext, *clk_parent_gio;
struct reset_control *rst, *rst_parent, *rst_parent_gio;
struct regulator *vbus;
const struct uniphier_u3hsphy_soc_data *data;
};
struct uniphier_u3hsphy_soc_data {
bool is_legacy;
int nparams;
const struct uniphier_u3hsphy_param param[MAX_PHY_PARAMS];
u32 config0;
u32 config1;
void (*trim_func)(struct uniphier_u3hsphy_priv *priv, u32 *pconfig,
struct uniphier_u3hsphy_trim_param *pt);
};
static void uniphier_u3hsphy_trim_ld20(struct uniphier_u3hsphy_priv *priv,
u32 *pconfig,
struct uniphier_u3hsphy_trim_param *pt)
{
*pconfig &= ~HSPHY_CFG0_RTERM_MASK;
*pconfig |= FIELD_PREP(HSPHY_CFG0_RTERM_MASK, pt->rterm);
*pconfig &= ~HSPHY_CFG0_SEL_T_MASK;
*pconfig |= FIELD_PREP(HSPHY_CFG0_SEL_T_MASK, pt->sel_t);
*pconfig &= ~HSPHY_CFG0_HS_I_MASK;
*pconfig |= FIELD_PREP(HSPHY_CFG0_HS_I_MASK, pt->hs_i);
}
static int uniphier_u3hsphy_get_nvparam(struct uniphier_u3hsphy_priv *priv,
const char *name, unsigned int *val)
{
struct nvmem_cell *cell;
u8 *buf;
cell = devm_nvmem_cell_get(priv->dev, name);
if (IS_ERR(cell))
return PTR_ERR(cell);
buf = nvmem_cell_read(cell, NULL);
if (IS_ERR(buf))
return PTR_ERR(buf);
*val = *buf;
kfree(buf);
return 0;
}
static int uniphier_u3hsphy_get_nvparams(struct uniphier_u3hsphy_priv *priv,
struct uniphier_u3hsphy_trim_param *pt)
{
int ret;
ret = uniphier_u3hsphy_get_nvparam(priv, "rterm", &pt->rterm);
if (ret)
return ret;
ret = uniphier_u3hsphy_get_nvparam(priv, "sel_t", &pt->sel_t);
if (ret)
return ret;
ret = uniphier_u3hsphy_get_nvparam(priv, "hs_i", &pt->hs_i);
if (ret)
return ret;
return 0;
}
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitops.h`, `linux/clk.h`, `linux/io.h`, `linux/module.h`, `linux/nvmem-consumer.h`, `linux/of.h`, `linux/of_platform.h`.
- Detected declarations: `struct uniphier_u3hsphy_param`, `struct uniphier_u3hsphy_trim_param`, `struct uniphier_u3hsphy_priv`, `struct uniphier_u3hsphy_soc_data`, `function uniphier_u3hsphy_trim_ld20`, `function uniphier_u3hsphy_get_nvparam`, `function uniphier_u3hsphy_get_nvparams`, `function uniphier_u3hsphy_update_config`, `function uniphier_u3hsphy_set_param`, `function uniphier_u3hsphy_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.