drivers/net/phy/aquantia/aquantia.h

Source file repositories/reference/linux-study-clean/drivers/net/phy/aquantia/aquantia.h

File Facts

System
Linux kernel
Corpus path
drivers/net/phy/aquantia/aquantia.h
Extension
.h
Size
10252 bytes
Lines
260
Domain
Driver Families
Bucket
drivers/net
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct aqr107_hw_stat {
	const char *name;
	int reg;
	int size;
};

#define SGMII_STAT(n, r, s) { n, MDIO_C22EXT_STAT_SGMII_ ## r, s }
static const struct aqr107_hw_stat aqr107_hw_stats[] = {
	SGMII_STAT("sgmii_rx_good_frames",	    RX_GOOD_FRAMES,	26),
	SGMII_STAT("sgmii_rx_bad_frames",	    RX_BAD_FRAMES,	26),
	SGMII_STAT("sgmii_rx_false_carrier_events", RX_FALSE_CARRIER,	 8),
	SGMII_STAT("sgmii_tx_good_frames",	    TX_GOOD_FRAMES,	26),
	SGMII_STAT("sgmii_tx_bad_frames",	    TX_BAD_FRAMES,	26),
	SGMII_STAT("sgmii_tx_false_carrier_events", TX_FALSE_CARRIER,	 8),
	SGMII_STAT("sgmii_tx_collisions",	    TX_COLLISIONS,	 8),
	SGMII_STAT("sgmii_tx_line_collisions",	    TX_LINE_COLLISIONS,	 8),
	SGMII_STAT("sgmii_tx_frame_alignment_err",  TX_FRAME_ALIGN_ERR,	16),
	SGMII_STAT("sgmii_tx_runt_frames",	    TX_RUNT_FRAMES,	22),
};

#define AQR107_SGMII_STAT_SZ ARRAY_SIZE(aqr107_hw_stats)

static const struct {
	int speed;
	u16 reg;
} aqr_global_cfg_regs[] = {
	{ SPEED_10,	VEND1_GLOBAL_CFG_10M, },
	{ SPEED_100,	VEND1_GLOBAL_CFG_100M, },
	{ SPEED_1000,	VEND1_GLOBAL_CFG_1G, },
	{ SPEED_2500,	VEND1_GLOBAL_CFG_2_5G, },
	{ SPEED_5000,	VEND1_GLOBAL_CFG_5G, },
	{ SPEED_10000,	VEND1_GLOBAL_CFG_10G, },
};

#define AQR_NUM_GLOBAL_CFG ARRAY_SIZE(aqr_global_cfg_regs)

enum aqr_rate_adaptation {
	AQR_RATE_ADAPT_NONE,
	AQR_RATE_ADAPT_USX,
	AQR_RATE_ADAPT_PAUSE,
};

struct aqr_global_syscfg {
	int speed;
	phy_interface_t interface;
	enum aqr_rate_adaptation rate_adapt;
};

struct aqr107_priv {
	u64 sgmii_stats[AQR107_SGMII_STAT_SZ];
	u64 fingerprint;
	unsigned long leds_active_low;
	unsigned long leds_active_high;
	bool wait_on_global_cfg;
	struct aqr_global_syscfg global_cfg[AQR_NUM_GLOBAL_CFG];
};

#if IS_REACHABLE(CONFIG_HWMON)
int aqr_hwmon_probe(struct phy_device *phydev);
#else
static inline int aqr_hwmon_probe(struct phy_device *phydev) { return 0; }
#endif

int aqr_firmware_load(struct phy_device *phydev);

int aqr_phy_led_blink_set(struct phy_device *phydev, u8 index,
			  unsigned long *delay_on,
			  unsigned long *delay_off);
int aqr_phy_led_brightness_set(struct phy_device *phydev,
			       u8 index, enum led_brightness value);
int aqr_phy_led_hw_is_supported(struct phy_device *phydev, u8 index,
				unsigned long rules);
int aqr_phy_led_hw_control_get(struct phy_device *phydev, u8 index,
			       unsigned long *rules);
int aqr_phy_led_hw_control_set(struct phy_device *phydev, u8 index,
			       unsigned long rules);
int aqr_phy_led_active_low_set(struct phy_device *phydev, int index, bool enable);
int aqr_phy_led_polarity_set(struct phy_device *phydev, int index,
			     unsigned long modes);
int aqr_wait_reset_complete(struct phy_device *phydev);

#endif /* AQUANTIA_H */

Annotation

Implementation Notes