drivers/phy/rockchip/phy-rockchip-usb.c
Source file repositories/reference/linux-study-clean/drivers/phy/rockchip/phy-rockchip-usb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/phy/rockchip/phy-rockchip-usb.c- Extension
.c- Size
- 14125 bytes
- Lines
- 564
- 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/hw_bitfield.hlinux/io.hlinux/kernel.hlinux/module.hlinux/mutex.hlinux/of.hlinux/phy/phy.hlinux/platform_device.hlinux/property.hlinux/regulator/consumer.hlinux/reset.hlinux/regmap.hlinux/mfd/syscon.hlinux/delay.h
Detected Declarations
struct rockchip_usb_physstruct rockchip_usb_phy_basestruct rockchip_usb_phy_pdatastruct rockchip_usb_phy_basestruct rockchip_usb_phyfunction rockchip_usb_phy_powerfunction rockchip_usb_phy480m_recalc_ratefunction rockchip_usb_phy480m_disablefunction rockchip_usb_phy480m_enablefunction rockchip_usb_phy480m_is_enabledfunction rockchip_usb_phy_power_offfunction rockchip_usb_phy_power_onfunction rockchip_usb_phy_resetfunction rockchip_usb_phy_actionfunction rockchip_usb_phy_initfunction rockchip_init_usb_uart_commonfunction rk3188_init_usb_uartfunction rk3288_init_usb_uartfunction rockchip_usb_phy_probefunction for_each_available_child_of_node_scopedfunction rockchip_init_usb_uartfunction rockchip_usb_uart
Annotated Snippet
struct rockchip_usb_phys {
int reg;
const char *pll_name;
};
struct rockchip_usb_phy_base;
struct rockchip_usb_phy_pdata {
struct rockchip_usb_phys *phys;
int (*init_usb_uart)(struct regmap *grf,
const struct rockchip_usb_phy_pdata *pdata);
int usb_uart_phy;
};
struct rockchip_usb_phy_base {
struct device *dev;
struct regmap *reg_base;
const struct rockchip_usb_phy_pdata *pdata;
};
struct rockchip_usb_phy {
struct rockchip_usb_phy_base *base;
struct device_node *np;
unsigned int reg_offset;
struct clk *clk;
struct clk *clk480m;
struct clk_hw clk480m_hw;
struct phy *phy;
bool uart_enabled;
struct reset_control *reset;
struct regulator *vbus;
};
static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy,
bool siddq)
{
u32 val = FIELD_PREP_WM16(UOC_CON0_SIDDQ, siddq);
return regmap_write(phy->base->reg_base, phy->reg_offset, val);
}
static unsigned long rockchip_usb_phy480m_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
return 480000000;
}
static void rockchip_usb_phy480m_disable(struct clk_hw *hw)
{
struct rockchip_usb_phy *phy = container_of(hw,
struct rockchip_usb_phy,
clk480m_hw);
if (phy->vbus)
regulator_disable(phy->vbus);
/* Power down usb phy analog blocks by set siddq 1 */
rockchip_usb_phy_power(phy, 1);
}
static int rockchip_usb_phy480m_enable(struct clk_hw *hw)
{
struct rockchip_usb_phy *phy = container_of(hw,
struct rockchip_usb_phy,
clk480m_hw);
/* Power up usb phy analog blocks by set siddq 0 */
return rockchip_usb_phy_power(phy, 0);
}
static int rockchip_usb_phy480m_is_enabled(struct clk_hw *hw)
{
struct rockchip_usb_phy *phy = container_of(hw,
struct rockchip_usb_phy,
clk480m_hw);
int ret;
u32 val;
ret = regmap_read(phy->base->reg_base, phy->reg_offset, &val);
if (ret < 0)
return ret;
return (val & UOC_CON0_SIDDQ) ? 0 : 1;
}
static const struct clk_ops rockchip_usb_phy480m_ops = {
.enable = rockchip_usb_phy480m_enable,
.disable = rockchip_usb_phy480m_disable,
.is_enabled = rockchip_usb_phy480m_is_enabled,
.recalc_rate = rockchip_usb_phy480m_recalc_rate,
};
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clk-provider.h`, `linux/hw_bitfield.h`, `linux/io.h`, `linux/kernel.h`, `linux/module.h`, `linux/mutex.h`, `linux/of.h`.
- Detected declarations: `struct rockchip_usb_phys`, `struct rockchip_usb_phy_base`, `struct rockchip_usb_phy_pdata`, `struct rockchip_usb_phy_base`, `struct rockchip_usb_phy`, `function rockchip_usb_phy_power`, `function rockchip_usb_phy480m_recalc_rate`, `function rockchip_usb_phy480m_disable`, `function rockchip_usb_phy480m_enable`, `function rockchip_usb_phy480m_is_enabled`.
- 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.