drivers/phy/ti/phy-da8xx-usb.c
Source file repositories/reference/linux-study-clean/drivers/phy/ti/phy-da8xx-usb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/phy/ti/phy-da8xx-usb.c- Extension
.c- Size
- 7440 bytes
- Lines
- 295
- 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/io.hlinux/of.hlinux/mfd/da8xx-cfgchip.hlinux/mfd/syscon.hlinux/module.hlinux/phy/phy.hlinux/platform_data/phy-da8xx-usb.hlinux/platform_device.hlinux/pm_runtime.hlinux/regmap.h
Detected Declarations
struct da8xx_usb_phyfunction da8xx_usb11_phy_power_onfunction da8xx_usb11_phy_power_offfunction da8xx_usb20_phy_power_onfunction da8xx_usb20_phy_power_offfunction da8xx_usb20_phy_set_modefunction da8xx_runtime_suspendfunction da8xx_runtime_resumefunction da8xx_usb_phy_probefunction da8xx_usb_phy_remove
Annotated Snippet
struct da8xx_usb_phy {
struct device *dev;
struct phy_provider *phy_provider;
struct phy *usb11_phy;
struct phy *usb20_phy;
struct clk *usb11_clk;
struct clk *usb20_clk;
struct regmap *regmap;
};
static int da8xx_usb11_phy_power_on(struct phy *phy)
{
struct da8xx_usb_phy *d_phy = phy_get_drvdata(phy);
int ret;
ret = clk_prepare_enable(d_phy->usb11_clk);
if (ret)
return ret;
regmap_write_bits(d_phy->regmap, CFGCHIP(2), CFGCHIP2_USB1SUSPENDM,
CFGCHIP2_USB1SUSPENDM);
/*
* USB1.1 can used USB2.0 output clock as reference clock so this is here to prevent USB2.0
* from shutting PHY's power when USB1.1 might use it
*/
pm_runtime_get_sync(d_phy->dev);
return 0;
}
static int da8xx_usb11_phy_power_off(struct phy *phy)
{
struct da8xx_usb_phy *d_phy = phy_get_drvdata(phy);
regmap_write_bits(d_phy->regmap, CFGCHIP(2), CFGCHIP2_USB1SUSPENDM, 0);
clk_disable_unprepare(d_phy->usb11_clk);
pm_runtime_put_sync(d_phy->dev);
return 0;
}
static const struct phy_ops da8xx_usb11_phy_ops = {
.power_on = da8xx_usb11_phy_power_on,
.power_off = da8xx_usb11_phy_power_off,
.owner = THIS_MODULE,
};
static int da8xx_usb20_phy_power_on(struct phy *phy)
{
struct da8xx_usb_phy *d_phy = phy_get_drvdata(phy);
int ret;
ret = clk_prepare_enable(d_phy->usb20_clk);
if (ret)
return ret;
regmap_write_bits(d_phy->regmap, CFGCHIP(2), CFGCHIP2_OTGPWRDN, 0);
return 0;
}
static int da8xx_usb20_phy_power_off(struct phy *phy)
{
struct da8xx_usb_phy *d_phy = phy_get_drvdata(phy);
regmap_write_bits(d_phy->regmap, CFGCHIP(2), CFGCHIP2_OTGPWRDN,
CFGCHIP2_OTGPWRDN);
clk_disable_unprepare(d_phy->usb20_clk);
return 0;
}
static int da8xx_usb20_phy_set_mode(struct phy *phy,
enum phy_mode mode, int submode)
{
struct da8xx_usb_phy *d_phy = phy_get_drvdata(phy);
u32 val;
switch (mode) {
case PHY_MODE_USB_HOST: /* Force VBUS valid, ID = 0 */
val = CFGCHIP2_OTGMODE_FORCE_HOST;
break;
case PHY_MODE_USB_DEVICE: /* Force VBUS valid, ID = 1 */
val = CFGCHIP2_OTGMODE_FORCE_DEVICE;
break;
case PHY_MODE_USB_OTG: /* Don't override the VBUS/ID comparators */
val = CFGCHIP2_OTGMODE_NO_OVERRIDE;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/io.h`, `linux/of.h`, `linux/mfd/da8xx-cfgchip.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/phy/phy.h`, `linux/platform_data/phy-da8xx-usb.h`.
- Detected declarations: `struct da8xx_usb_phy`, `function da8xx_usb11_phy_power_on`, `function da8xx_usb11_phy_power_off`, `function da8xx_usb20_phy_power_on`, `function da8xx_usb20_phy_power_off`, `function da8xx_usb20_phy_set_mode`, `function da8xx_runtime_suspend`, `function da8xx_runtime_resume`, `function da8xx_usb_phy_probe`, `function da8xx_usb_phy_remove`.
- 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.