drivers/usb/phy/phy-mxs-usb.c
Source file repositories/reference/linux-study-clean/drivers/usb/phy/phy-mxs-usb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/phy/phy-mxs-usb.c- Extension
.c- Size
- 27333 bytes
- Lines
- 978
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/module.hlinux/kernel.hlinux/platform_device.hlinux/clk.hlinux/usb/otg.hlinux/stmp_device.hlinux/delay.hlinux/err.hlinux/io.hlinux/of.hlinux/regmap.hlinux/mfd/syscon.hlinux/iopoll.hlinux/regulator/consumer.h
Detected Declarations
struct mxs_phy_datastruct mxs_phyfunction is_imx6q_phyfunction is_imx6sl_phyfunction is_imx7ulp_phyfunction is_imx6ul_phyfunction busfunction mxs_phy_tx_initfunction mxs_phy_pll_enablefunction mxs_phy_hw_initfunction mxs_phy_get_vbus_statusfunction __mxs_phy_disconnect_linefunction mxs_phy_is_otg_hostfunction mxs_phy_disconnect_linefunction mxs_phy_initfunction mxs_phy_shutdownfunction mxs_phy_is_low_speed_connectionfunction mxs_phy_suspendfunction mxs_phy_set_wakeupfunction mxs_phy_on_connectfunction mxs_phy_on_disconnectfunction mxs_charger_data_contact_detectfunction mxs_charger_primary_detectionfunction mxs_charger_secondary_detectionfunction mxs_phy_charger_detectfunction mxs_phy_probefunction mxs_phy_removefunction mxs_phy_wakeup_enablefunction mxs_phy_enable_ldo_in_suspendfunction mxs_phy_system_suspendfunction mxs_phy_system_resumefunction mxs_phy_module_initfunction mxs_phy_module_exit
Annotated Snippet
struct mxs_phy_data {
unsigned int flags;
};
static const struct mxs_phy_data imx23_phy_data = {
.flags = MXS_PHY_ABNORMAL_IN_SUSPEND | MXS_PHY_SENDING_SOF_TOO_FAST,
};
static const struct mxs_phy_data imx6q_phy_data = {
.flags = MXS_PHY_SENDING_SOF_TOO_FAST |
MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS |
MXS_PHY_NEED_IP_FIX |
MXS_PHY_HARDWARE_CONTROL_PHY2_CLK,
};
static const struct mxs_phy_data imx6sl_phy_data = {
.flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS |
MXS_PHY_NEED_IP_FIX |
MXS_PHY_HARDWARE_CONTROL_PHY2_CLK,
};
static const struct mxs_phy_data vf610_phy_data = {
.flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS |
MXS_PHY_NEED_IP_FIX,
};
static const struct mxs_phy_data imx6sx_phy_data = {
.flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS |
MXS_PHY_HARDWARE_CONTROL_PHY2_CLK,
};
static const struct mxs_phy_data imx6ul_phy_data = {
.flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS |
MXS_PHY_HARDWARE_CONTROL_PHY2_CLK,
};
static const struct mxs_phy_data imx7ulp_phy_data = {
};
static const struct of_device_id mxs_phy_dt_ids[] = {
{ .compatible = "fsl,imx6sx-usbphy", .data = &imx6sx_phy_data, },
{ .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, },
{ .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, },
{ .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, },
{ .compatible = "fsl,vf610-usbphy", .data = &vf610_phy_data, },
{ .compatible = "fsl,imx6ul-usbphy", .data = &imx6ul_phy_data, },
{ .compatible = "fsl,imx7ulp-usbphy", .data = &imx7ulp_phy_data, },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids);
struct mxs_phy {
struct usb_phy phy;
struct clk *clk;
const struct mxs_phy_data *data;
struct regmap *regmap_anatop;
struct regmap *regmap_sim;
int port_id;
u32 tx_reg_set;
u32 tx_reg_mask;
struct regulator *phy_3p0;
};
static inline bool is_imx6q_phy(struct mxs_phy *mxs_phy)
{
return mxs_phy->data == &imx6q_phy_data;
}
static inline bool is_imx6sl_phy(struct mxs_phy *mxs_phy)
{
return mxs_phy->data == &imx6sl_phy_data;
}
static inline bool is_imx7ulp_phy(struct mxs_phy *mxs_phy)
{
return mxs_phy->data == &imx7ulp_phy_data;
}
static inline bool is_imx6ul_phy(struct mxs_phy *mxs_phy)
{
return mxs_phy->data == &imx6ul_phy_data;
}
/*
* PHY needs some 32K cycles to switch from 32K clock to
* bus (such as AHB/AXI, etc) clock.
*/
static void mxs_phy_clock_switch_delay(void)
{
usleep_range(300, 400);
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/platform_device.h`, `linux/clk.h`, `linux/usb/otg.h`, `linux/stmp_device.h`, `linux/delay.h`, `linux/err.h`.
- Detected declarations: `struct mxs_phy_data`, `struct mxs_phy`, `function is_imx6q_phy`, `function is_imx6sl_phy`, `function is_imx7ulp_phy`, `function is_imx6ul_phy`, `function bus`, `function mxs_phy_tx_init`, `function mxs_phy_pll_enable`, `function mxs_phy_hw_init`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: integration 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.