drivers/phy/rockchip/phy-rockchip-typec.c
Source file repositories/reference/linux-study-clean/drivers/phy/rockchip/phy-rockchip-typec.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/phy/rockchip/phy-rockchip-typec.c- Extension
.c- Size
- 37418 bytes
- Lines
- 1226
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/extcon.hlinux/io.hlinux/iopoll.hlinux/kernel.hlinux/module.hlinux/mutex.hlinux/of.hlinux/of_address.hlinux/of_platform.hlinux/platform_device.hlinux/regmap.hlinux/reset.hlinux/mfd/syscon.hlinux/phy/phy.h
Detected Declarations
struct usb3phy_regstruct rockchip_usb3phy_port_cfgstruct rockchip_typec_phystruct phy_regfunction tcphy_cfg_24mfunction tcphy_cfg_usb3_pllfunction tcphy_cfg_dp_pllfunction tcphy_tx_usb3_cfg_lanefunction tcphy_rx_usb3_cfg_lanefunction tcphy_dp_cfg_lanefunction property_enablefunction tcphy_dp_aux_set_flipfunction tcphy_dp_aux_calibrationfunction tcphy_phy_initfunction tcphy_phy_deinitfunction tcphy_get_modefunction tcphy_cfg_usb3_to_usb2_onlyfunction rockchip_usb3_phy_power_onfunction rockchip_usb3_phy_power_offfunction rockchip_dp_phy_power_onfunction rockchip_dp_phy_power_offfunction tcphy_parse_dtfunction typec_phy_pre_initfunction rockchip_typec_phy_probefunction for_each_available_child_of_nodefunction rockchip_typec_phy_remove
Annotated Snippet
struct usb3phy_reg {
u32 offset;
u32 enable_bit;
u32 write_enable;
};
/**
* struct rockchip_usb3phy_port_cfg - usb3-phy port configuration.
* @reg: the base address for usb3-phy config.
* @typec_conn_dir: the register of type-c connector direction.
* @usb3tousb2_en: the register of type-c force usb2 to usb2 enable.
* @external_psm: the register of type-c phy external psm clock.
* @pipe_status: the register of type-c phy pipe status.
* @usb3_host_disable: the register of type-c usb3 host disable.
* @usb3_host_port: the register of type-c usb3 host port.
* @uphy_dp_sel: the register of type-c phy DP select control.
*/
struct rockchip_usb3phy_port_cfg {
unsigned int reg;
struct usb3phy_reg typec_conn_dir;
struct usb3phy_reg usb3tousb2_en;
struct usb3phy_reg external_psm;
struct usb3phy_reg pipe_status;
struct usb3phy_reg usb3_host_disable;
struct usb3phy_reg usb3_host_port;
struct usb3phy_reg uphy_dp_sel;
};
struct rockchip_typec_phy {
struct device *dev;
void __iomem *base;
struct extcon_dev *extcon;
struct regmap *grf_regs;
struct clk *clk_core;
struct clk *clk_ref;
struct reset_control *uphy_rst;
struct reset_control *pipe_rst;
struct reset_control *tcphy_rst;
const struct rockchip_usb3phy_port_cfg *port_cfgs;
/* mutex to protect access to individual PHYs */
struct mutex lock;
bool flip;
u8 mode;
};
struct phy_reg {
u16 value;
u32 addr;
};
static struct phy_reg usb3_pll_cfg[] = {
{ 0xf0, CMN_PLL0_VCOCAL_INIT },
{ 0x18, CMN_PLL0_VCOCAL_ITER },
{ 0xd0, CMN_PLL0_INTDIV },
{ 0x4a4a, CMN_PLL0_FRACDIV },
{ 0x34, CMN_PLL0_HIGH_THR },
{ 0x1ee, CMN_PLL0_SS_CTRL1 },
{ 0x7f03, CMN_PLL0_SS_CTRL2 },
{ 0x20, CMN_PLL0_DSM_DIAG },
{ 0, CMN_DIAG_PLL0_OVRD },
{ 0, CMN_DIAG_PLL0_FBH_OVRD },
{ 0, CMN_DIAG_PLL0_FBL_OVRD },
{ 0x7, CMN_DIAG_PLL0_V2I_TUNE },
{ 0x45, CMN_DIAG_PLL0_CP_TUNE },
{ 0x8, CMN_DIAG_PLL0_LF_PROG },
};
static struct phy_reg dp_pll_cfg[] = {
{ 0xf0, CMN_PLL1_VCOCAL_INIT },
{ 0x18, CMN_PLL1_VCOCAL_ITER },
{ 0x30b9, CMN_PLL1_VCOCAL_START },
{ 0x21c, CMN_PLL1_INTDIV },
{ 0, CMN_PLL1_FRACDIV },
{ 0x5, CMN_PLL1_HIGH_THR },
{ 0x35, CMN_PLL1_SS_CTRL1 },
{ 0x7f1e, CMN_PLL1_SS_CTRL2 },
{ 0x20, CMN_PLL1_DSM_DIAG },
{ 0, CMN_PLLSM1_USER_DEF_CTRL },
{ 0, CMN_DIAG_PLL1_OVRD },
{ 0, CMN_DIAG_PLL1_FBH_OVRD },
{ 0, CMN_DIAG_PLL1_FBL_OVRD },
{ 0x6, CMN_DIAG_PLL1_V2I_TUNE },
{ 0x45, CMN_DIAG_PLL1_CP_TUNE },
{ 0x8, CMN_DIAG_PLL1_LF_PROG },
{ 0x100, CMN_DIAG_PLL1_PTATIS_TUNE1 },
{ 0x7, CMN_DIAG_PLL1_PTATIS_TUNE2 },
{ 0x4, CMN_DIAG_PLL1_INCLK_CTRL },
};
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clk-provider.h`, `linux/delay.h`, `linux/extcon.h`, `linux/io.h`, `linux/iopoll.h`, `linux/kernel.h`, `linux/module.h`.
- Detected declarations: `struct usb3phy_reg`, `struct rockchip_usb3phy_port_cfg`, `struct rockchip_typec_phy`, `struct phy_reg`, `function tcphy_cfg_24m`, `function tcphy_cfg_usb3_pll`, `function tcphy_cfg_dp_pll`, `function tcphy_tx_usb3_cfg_lane`, `function tcphy_rx_usb3_cfg_lane`, `function tcphy_dp_cfg_lane`.
- Atlas domain: Driver Families / drivers/phy.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.