drivers/net/dsa/microchip/ksz_common.h
Source file repositories/reference/linux-study-clean/drivers/net/dsa/microchip/ksz_common.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/dsa/microchip/ksz_common.h- Extension
.h- Size
- 25329 bytes
- Lines
- 981
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/etherdevice.hlinux/kernel.hlinux/mutex.hlinux/pcs/pcs-xpcs.hlinux/phy.hlinux/regmap.hnet/dsa.hlinux/irq.hlinux/platform_data/microchip-ksz.hksz_ptp.h
Detected Declarations
struct ksz_devicestruct ksz_portstruct phylink_mac_opsstruct vlan_tablestruct ksz_port_mibstruct ksz_mib_namesstruct ksz_chip_datastruct ksz_irqstruct ksz_ptp_irqstruct ksz_switch_macaddrstruct ksz_portstruct ksz_devicestruct alu_structstruct ksz_dev_opsenum ksz_regmap_widthenum ksz_modelenum ksz_regsenum ksz_masksenum ksz_shiftsenum ksz_xmii_ctrl0enum ksz_xmii_ctrl1function ksz_is_ksz8463function ksz_read8function ksz_read16function ksz_read32function ksz_read64function ksz_write8function ksz_write16function ksz_write32function ksz_rmw16function ksz_rmw32function ksz_write64function ksz_rmw8function ksz_pread8function ksz_pread16function ksz_pread32function ksz_pwrite8function ksz_pwrite16function ksz_pwrite32function ksz_prmw8function ksz_prmw32function ksz_regmap_lockfunction ksz_regmap_unlockfunction ksz_is_ksz87xxfunction ksz_is_ksz88x3function ksz_is_8895_familyfunction is_ksz8function is_ksz88xx
Annotated Snippet
struct vlan_table {
u32 table[3];
};
struct ksz_port_mib {
struct mutex cnt_mutex; /* structure access */
u8 cnt_ptr;
u64 *counters;
struct rtnl_link_stats64 stats64;
struct ethtool_pause_stats pause_stats;
struct spinlock stats64_lock;
};
struct ksz_mib_names {
int index;
char string[ETH_GSTRING_LEN];
};
struct ksz_chip_data {
u32 chip_id;
const char *dev_name;
int num_vlans;
int num_alus;
int num_statics;
int cpu_ports;
int port_cnt;
u8 port_nirqs;
u8 num_tx_queues;
u8 num_ipms; /* number of Internal Priority Maps */
bool tc_cbs_supported;
/**
* @phy_side_mdio_supported: Indicates if the chip supports an additional
* side MDIO channel for accessing integrated PHYs.
*/
bool phy_side_mdio_supported;
const struct ksz_dev_ops *ops;
const struct dsa_switch_ops *switch_ops;
const struct phylink_mac_ops *phylink_mac_ops;
bool phy_errata_9477;
bool ksz87xx_eee_link_erratum;
const struct ksz_mib_names *mib_names;
int mib_cnt;
u8 reg_mib_cnt;
const u16 *regs;
const u32 *masks;
const u8 *shifts;
const u8 *xmii_ctrl0;
const u8 *xmii_ctrl1;
int stp_ctrl_reg;
int broadcast_ctrl_reg;
int multicast_ctrl_reg;
int start_ctrl_reg;
bool supports_mii[KSZ_MAX_NUM_PORTS];
bool supports_rmii[KSZ_MAX_NUM_PORTS];
bool supports_rgmii[KSZ_MAX_NUM_PORTS];
bool internal_phy[KSZ_MAX_NUM_PORTS];
bool gbit_capable[KSZ_MAX_NUM_PORTS];
bool ptp_capable;
u8 sgmii_port;
const struct regmap_access_table *wr_table;
const struct regmap_access_table *rd_table;
};
struct ksz_irq {
u16 masked;
u16 reg_mask;
u16 reg_status;
struct irq_domain *domain;
int nirqs;
int irq_num;
char name[16];
struct ksz_device *dev;
u16 irq0_offset;
};
struct ksz_ptp_irq {
struct ksz_port *port;
u16 ts_reg;
bool ts_en;
char name[16];
int num;
};
struct ksz_switch_macaddr {
unsigned char addr[ETH_ALEN];
refcount_t refcount;
};
struct ksz_port {
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/kernel.h`, `linux/mutex.h`, `linux/pcs/pcs-xpcs.h`, `linux/phy.h`, `linux/regmap.h`, `net/dsa.h`, `linux/irq.h`.
- Detected declarations: `struct ksz_device`, `struct ksz_port`, `struct phylink_mac_ops`, `struct vlan_table`, `struct ksz_port_mib`, `struct ksz_mib_names`, `struct ksz_chip_data`, `struct ksz_irq`, `struct ksz_ptp_irq`, `struct ksz_switch_macaddr`.
- Atlas domain: Driver Families / drivers/net.
- 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.