drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c- Extension
.c- Size
- 44972 bytes
- Lines
- 1650
- 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.
- 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/stmmac.hlinux/hw_bitfield.hlinux/bitops.hlinux/clk.hlinux/phy.hlinux/of_net.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regulator/consumer.hlinux/delay.hlinux/mfd/syscon.hlinux/regmap.hlinux/pm_runtime.hstmmac_platform.h
Detected Declarations
struct rk_priv_datastruct rk_clock_fieldsstruct rk_gmac_opsstruct rk_priv_dataenum rk_clocks_indexfunction rk_gmac_rgmii_clk_divfunction rk_get_phy_intf_selfunction rk_encode_wm16function rk_write_gmac_grf_regfunction rk_write_clock_grf_regfunction rk_set_rmii_gate_enfunction rk_ungate_rmii_clockfunction rk_gate_rmii_clockfunction rk_configure_io_clkselfunction rk_set_clk_mac_speedfunction rk_gmac_integrated_ephy_powerupfunction rk_gmac_integrated_ephy_powerdownfunction rk_gmac_integrated_fephy_powerupfunction rk_gmac_integrated_fephy_powerdownfunction rk3128_set_to_rgmiifunction rk3228_set_to_rgmiifunction rk3228_set_to_rmiifunction rk3228_integrated_phy_powerupfunction rk3288_set_to_rgmiifunction rk3328_initfunction rk3328_set_to_rgmiifunction rk3328_integrated_phy_powerupfunction rk3366_set_to_rgmiifunction rk3368_set_to_rgmiifunction rk3399_set_to_rgmiifunction rk3506_initfunction rk3528_initfunction rk3528_set_to_rgmiifunction rk3528_integrated_phy_powerupfunction rk3528_integrated_phy_powerdownfunction rk3568_initfunction rk3568_set_to_rgmiifunction rk3576_initfunction rk3576_set_to_rgmiifunction rk3588_initfunction rk3588_set_to_rgmiifunction rv1126_set_to_rgmiifunction rk_gmac_clk_initfunction gmac_clk_enablefunction rk_phy_powerupfunction rk_phy_powerdownfunction rk_gmac_check_opsfunction rk_gmac_powerup
Annotated Snippet
struct rk_clock_fields {
/* io_clksel_cru_mask - io_clksel bit in clock GRF register which,
* when set, selects the tx clock from CRU.
*/
u16 io_clksel_cru_mask;
/* io_clksel_io_mask - io_clksel bit in clock GRF register which,
* when set, selects the tx clock from IO.
*/
u16 io_clksel_io_mask;
u16 gmii_clk_sel_mask;
u16 rmii_clk_sel_mask;
u16 rmii_gate_en_mask;
u16 rmii_mode_mask;
u16 mac_speed_mask;
};
struct rk_gmac_ops {
int (*init)(struct rk_priv_data *bsp_priv);
void (*set_to_rgmii)(struct rk_priv_data *bsp_priv,
int tx_delay, int rx_delay);
void (*set_to_rmii)(struct rk_priv_data *bsp_priv);
int (*set_speed)(struct rk_priv_data *bsp_priv,
phy_interface_t interface, int speed);
void (*integrated_phy_powerup)(struct rk_priv_data *bsp_priv);
void (*integrated_phy_powerdown)(struct rk_priv_data *bsp_priv);
u16 gmac_grf_reg;
u16 gmac_phy_intf_sel_mask;
u16 gmac_rmii_mode_mask;
u16 clock_grf_reg;
struct rk_clock_fields clock;
bool gmac_grf_reg_in_php;
bool clock_grf_reg_in_php;
bool supports_rgmii;
bool supports_rmii;
bool php_grf_required;
bool regs_valid;
u32 regs[];
};
static const char * const rk_clocks[] = {
"aclk_mac", "pclk_mac", "mac_clk_tx", "clk_mac_speed",
};
static const char * const rk_rmii_clocks[] = {
"mac_clk_rx", "clk_mac_ref", "clk_mac_refout",
};
enum rk_clocks_index {
RK_ACLK_MAC = 0,
RK_PCLK_MAC,
RK_MAC_CLK_TX,
RK_CLK_MAC_SPEED,
RK_MAC_CLK_RX,
RK_CLK_MAC_REF,
RK_CLK_MAC_REFOUT,
};
struct rk_priv_data {
struct device *dev;
phy_interface_t phy_iface;
int id;
struct regulator *regulator;
const struct rk_gmac_ops *ops;
bool clk_enabled;
bool clock_input;
bool integrated_phy;
bool supports_rgmii;
bool supports_rmii;
struct clk_bulk_data *clks;
int num_clks;
struct clk *clk_phy;
struct reset_control *phy_reset;
int tx_delay;
int rx_delay;
struct regmap *grf;
struct regmap *php_grf;
u16 gmac_grf_reg;
u16 gmac_phy_intf_sel_mask;
u16 gmac_rmii_mode_mask;
u16 clock_grf_reg;
Annotation
- Immediate include surface: `linux/stmmac.h`, `linux/hw_bitfield.h`, `linux/bitops.h`, `linux/clk.h`, `linux/phy.h`, `linux/of_net.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `struct rk_priv_data`, `struct rk_clock_fields`, `struct rk_gmac_ops`, `struct rk_priv_data`, `enum rk_clocks_index`, `function rk_gmac_rgmii_clk_div`, `function rk_get_phy_intf_sel`, `function rk_encode_wm16`, `function rk_write_gmac_grf_reg`, `function rk_write_clock_grf_reg`.
- Atlas domain: Driver Families / drivers/net.
- 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.