drivers/phy/xilinx/phy-zynqmp.c
Source file repositories/reference/linux-study-clean/drivers/phy/xilinx/phy-zynqmp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/phy/xilinx/phy-zynqmp.c- Extension
.c- Size
- 28697 bytes
- Lines
- 1091
- 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/debugfs.hlinux/delay.hlinux/io.hlinux/kernel.hlinux/module.hlinux/of.hlinux/phy/phy.hlinux/platform_device.hlinux/pm_runtime.hlinux/slab.hdt-bindings/phy/phy.h
Detected Declarations
struct xpsgtr_devstruct xpsgtr_sscstruct xpsgtr_phystruct xpsgtr_devfunction xpsgtr_readfunction xpsgtr_writefunction xpsgtr_clr_setfunction xpsgtr_read_phyfunction xpsgtr_write_phyfunction xpsgtr_clr_set_phyfunction xpsgtr_save_lane_regsfunction xpsgtr_restore_lane_regsfunction xpsgtr_wait_pll_lockfunction xpsgtr_configure_pllfunction xpsgtr_lane_set_protocolfunction xpsgtr_bypass_scrambler_8b10bfunction xpsgtr_phy_init_dpfunction xpsgtr_phy_init_satafunction xpsgtr_phy_init_sgmiifunction xpsgtr_phy_configure_dpfunction xpsgtr_phy_init_requiredfunction xpsgtr_phy_tx_term_fixfunction xpsgtr_phy_initfunction xpsgtr_phy_exitfunction xpsgtr_phy_power_onfunction xpsgtr_phy_configurefunction xpsgtr_set_lane_typefunction xpsgtr_status_readfunction xpsgtr_runtime_suspendfunction xpsgtr_runtime_resumefunction xpsgtr_get_ref_clocksfunction xpsgtr_probefunction xpsgtr_remove
Annotated Snippet
struct xpsgtr_ssc {
u32 refclk_rate;
u8 pll_ref_clk;
u32 steps;
u32 step_size;
};
/**
* struct xpsgtr_phy - representation of a lane
* @phy: pointer to the kernel PHY device
* @instance: instance of the protocol type (such as the lane within a
* protocol, or the USB/Ethernet controller)
* @lane: lane number
* @protocol: protocol in which the lane operates
* @skip_phy_init: skip phy_init() if true
* @dev: pointer to the xpsgtr_dev instance
* @refclk: reference clock index
*/
struct xpsgtr_phy {
struct phy *phy;
u8 instance;
u8 lane;
u8 protocol;
bool skip_phy_init;
struct xpsgtr_dev *dev;
unsigned int refclk;
};
/**
* struct xpsgtr_dev - representation of a ZynMP GT device
* @dev: pointer to device
* @serdes: serdes base address
* @siou: siou base address
* @gtr_mutex: mutex for locking
* @phys: PHY lanes
* @clk: reference clocks
* @tx_term_fix: fix for GT issue
* @saved_icm_cfg0: stored value of ICM CFG0 register
* @saved_icm_cfg1: stored value of ICM CFG1 register
* @saved_regs: registers to be saved/restored during suspend/resume
*/
struct xpsgtr_dev {
struct device *dev;
void __iomem *serdes;
void __iomem *siou;
struct mutex gtr_mutex; /* mutex for locking */
struct xpsgtr_phy phys[NUM_LANES];
struct clk *clk[NUM_LANES];
bool tx_term_fix;
unsigned int saved_icm_cfg0;
unsigned int saved_icm_cfg1;
u32 *saved_regs;
};
/*
* Configuration Data
*/
/* lookup table to hold all settings needed for a ref clock frequency */
static const struct xpsgtr_ssc ssc_lookup[] = {
{ 19200000, 0x05, 608, 264020 },
{ 20000000, 0x06, 634, 243454 },
{ 24000000, 0x07, 760, 168973 },
{ 26000000, 0x08, 824, 143860 },
{ 27000000, 0x09, 856, 86551 },
{ 38400000, 0x0a, 1218, 65896 },
{ 40000000, 0x0b, 634, 243454 },
{ 52000000, 0x0c, 824, 143860 },
{ 100000000, 0x0d, 1058, 87533 },
{ 108000000, 0x0e, 856, 86551 },
{ 125000000, 0x0f, 992, 119497 },
{ 135000000, 0x10, 1070, 55393 },
{ 150000000, 0x11, 792, 187091 }
};
/*
* I/O Accessors
*/
static inline u32 xpsgtr_read(struct xpsgtr_dev *gtr_dev, u32 reg)
{
return readl(gtr_dev->serdes + reg);
}
static inline void xpsgtr_write(struct xpsgtr_dev *gtr_dev, u32 reg, u32 value)
{
writel(value, gtr_dev->serdes + reg);
}
static inline void xpsgtr_clr_set(struct xpsgtr_dev *gtr_dev, u32 reg,
Annotation
- Immediate include surface: `linux/clk.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/io.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`, `linux/phy/phy.h`.
- Detected declarations: `struct xpsgtr_dev`, `struct xpsgtr_ssc`, `struct xpsgtr_phy`, `struct xpsgtr_dev`, `function xpsgtr_read`, `function xpsgtr_write`, `function xpsgtr_clr_set`, `function xpsgtr_read_phy`, `function xpsgtr_write_phy`, `function xpsgtr_clr_set_phy`.
- 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.