drivers/phy/marvell/phy-mvebu-a3700-comphy.c
Source file repositories/reference/linux-study-clean/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/phy/marvell/phy-mvebu-a3700-comphy.c- Extension
.c- Size
- 43324 bytes
- Lines
- 1378
- 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/bitfield.hlinux/clk.hlinux/io.hlinux/iopoll.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/phy.hlinux/phy/phy.hlinux/platform_device.hlinux/spinlock.h
Detected Declarations
struct mvebu_a3700_comphy_confstruct mvebu_a3700_comphy_privstruct mvebu_a3700_comphy_lanestruct gbe_phy_init_data_fixfunction comphy_reg_setfunction comphy_reg_set16function comphy_set_indirectfunction comphy_lane_reg_setfunction comphy_lane_reg_pollfunction comphy_periph_reg_setfunction comphy_periph_reg_pollfunction mvebu_a3700_comphy_set_phy_selectorfunction mvebu_a3700_comphy_sata_power_onfunction comphy_gbe_phy_initfunction mvebu_a3700_comphy_ethernet_power_onfunction mvebu_a3700_comphy_usb3_power_onfunction mvebu_a3700_comphy_pcie_power_onfunction mvebu_a3700_comphy_sata_power_offfunction mvebu_a3700_comphy_ethernet_power_offfunction mvebu_a3700_comphy_pcie_power_offfunction mvebu_a3700_comphy_usb3_power_offfunction mvebu_a3700_comphy_set_modefunction mvebu_a3700_comphy_power_onfunction mvebu_a3700_comphy_power_offfunction mvebu_a3700_comphy_probefunction for_each_available_child_of_node
Annotated Snippet
struct mvebu_a3700_comphy_conf {
unsigned int lane;
enum phy_mode mode;
int submode;
};
#define MVEBU_A3700_COMPHY_CONF(_lane, _mode, _smode) \
{ \
.lane = _lane, \
.mode = _mode, \
.submode = _smode, \
}
#define MVEBU_A3700_COMPHY_CONF_GEN(_lane, _mode) \
MVEBU_A3700_COMPHY_CONF(_lane, _mode, PHY_INTERFACE_MODE_NA)
#define MVEBU_A3700_COMPHY_CONF_ETH(_lane, _smode) \
MVEBU_A3700_COMPHY_CONF(_lane, PHY_MODE_ETHERNET, _smode)
static const struct mvebu_a3700_comphy_conf mvebu_a3700_comphy_modes[] = {
/* lane 0 */
MVEBU_A3700_COMPHY_CONF_GEN(0, PHY_MODE_USB_HOST_SS),
MVEBU_A3700_COMPHY_CONF_ETH(0, PHY_INTERFACE_MODE_SGMII),
MVEBU_A3700_COMPHY_CONF_ETH(0, PHY_INTERFACE_MODE_1000BASEX),
MVEBU_A3700_COMPHY_CONF_ETH(0, PHY_INTERFACE_MODE_2500BASEX),
/* lane 1 */
MVEBU_A3700_COMPHY_CONF_GEN(1, PHY_MODE_PCIE),
MVEBU_A3700_COMPHY_CONF_ETH(1, PHY_INTERFACE_MODE_SGMII),
MVEBU_A3700_COMPHY_CONF_ETH(1, PHY_INTERFACE_MODE_1000BASEX),
MVEBU_A3700_COMPHY_CONF_ETH(1, PHY_INTERFACE_MODE_2500BASEX),
/* lane 2 */
MVEBU_A3700_COMPHY_CONF_GEN(2, PHY_MODE_SATA),
MVEBU_A3700_COMPHY_CONF_GEN(2, PHY_MODE_USB_HOST_SS),
};
struct mvebu_a3700_comphy_priv {
void __iomem *comphy_regs;
void __iomem *lane0_phy_regs; /* USB3 and GbE1 */
void __iomem *lane1_phy_regs; /* PCIe and GbE0 */
void __iomem *lane2_phy_indirect; /* SATA and USB3 */
spinlock_t lock; /* for PHY selector access */
bool xtal_is_40m;
};
struct mvebu_a3700_comphy_lane {
struct mvebu_a3700_comphy_priv *priv;
struct device *dev;
unsigned int id;
enum phy_mode mode;
int submode;
bool invert_tx;
bool invert_rx;
};
struct gbe_phy_init_data_fix {
u16 addr;
u16 value;
};
/* Changes to 40M1G25 mode data required for running 40M3G125 init mode */
static struct gbe_phy_init_data_fix gbe_phy_init_fix[] = {
{ 0x005, 0x07CC }, { 0x015, 0x0000 }, { 0x01B, 0x0000 },
{ 0x01D, 0x0000 }, { 0x01E, 0x0000 }, { 0x01F, 0x0000 },
{ 0x020, 0x0000 }, { 0x021, 0x0030 }, { 0x026, 0x0888 },
{ 0x04D, 0x0152 }, { 0x04F, 0xA020 }, { 0x050, 0x07CC },
{ 0x053, 0xE9CA }, { 0x055, 0xBD97 }, { 0x071, 0x3015 },
{ 0x076, 0x03AA }, { 0x07C, 0x0FDF }, { 0x0C2, 0x3030 },
{ 0x0C3, 0x8000 }, { 0x0E2, 0x5550 }, { 0x0E3, 0x12A4 },
{ 0x0E4, 0x7D00 }, { 0x0E6, 0x0C83 }, { 0x101, 0xFCC0 },
{ 0x104, 0x0C10 }
};
/* 40M1G25 mode init data */
static u16 gbe_phy_init[512] = {
/* 0 1 2 3 4 5 6 7 */
/*-----------------------------------------------------------*/
/* 8 9 A B C D E F */
0x3110, 0xFD83, 0x6430, 0x412F, 0x82C0, 0x06FA, 0x4500, 0x6D26, /* 00 */
0xAFC0, 0x8000, 0xC000, 0x0000, 0x2000, 0x49CC, 0x0BC9, 0x2A52, /* 08 */
0x0BD2, 0x0CDE, 0x13D2, 0x0CE8, 0x1149, 0x10E0, 0x0000, 0x0000, /* 10 */
0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x4134, 0x0D2D, 0xFFFF, /* 18 */
0xFFE0, 0x4030, 0x1016, 0x0030, 0x0000, 0x0800, 0x0866, 0x0000, /* 20 */
0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, /* 28 */
0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 30 */
0x0000, 0x0000, 0x000F, 0x6A62, 0x1988, 0x3100, 0x3100, 0x3100, /* 38 */
0x3100, 0xA708, 0x2430, 0x0830, 0x1030, 0x4610, 0xFF00, 0xFF00, /* 40 */
0x0060, 0x1000, 0x0400, 0x0040, 0x00F0, 0x0155, 0x1100, 0xA02A, /* 48 */
0x06FA, 0x0080, 0xB008, 0xE3ED, 0x5002, 0xB592, 0x7A80, 0x0001, /* 50 */
0x020A, 0x8820, 0x6014, 0x8054, 0xACAA, 0xFC88, 0x2A02, 0x45CF, /* 58 */
0x000F, 0x1817, 0x2860, 0x064F, 0x0000, 0x0204, 0x1800, 0x6000, /* 60 */
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/io.h`, `linux/iopoll.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of.h`, `linux/phy.h`.
- Detected declarations: `struct mvebu_a3700_comphy_conf`, `struct mvebu_a3700_comphy_priv`, `struct mvebu_a3700_comphy_lane`, `struct gbe_phy_init_data_fix`, `function comphy_reg_set`, `function comphy_reg_set16`, `function comphy_set_indirect`, `function comphy_lane_reg_set`, `function comphy_lane_reg_poll`, `function comphy_periph_reg_set`.
- 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.