drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c- Extension
.c- Size
- 24795 bytes
- Lines
- 821
- 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/module.hlinux/of.hlinux/of_net.hlinux/platform_device.hlinux/phy.hlinux/phy/phy.hstmmac.hstmmac_platform.h
Detected Declarations
struct ethqos_emac_porstruct ethqos_emac_driver_datastruct qcom_ethqosfunction rgmii_readlfunction rgmii_writelfunction rgmii_updatelfunction rgmii_setmaskfunction rgmii_clrmaskfunction rgmii_dumpfunction ethqos_set_clk_tx_ratefunction qcom_ethqos_set_sgmii_loopbackfunction ethqos_set_func_clk_enfunction ethqos_dll_configurefunction ethqos_rgmii_macro_initfunction ethqos_fix_mac_speed_rgmiifunction ethqos_pcs_set_inbandfunction ethqos_fix_mac_speed_sgmiifunction qcom_ethqos_serdes_powerupfunction qcom_ethqos_serdes_powerdownfunction ethqos_mac_finish_serdesfunction ethqos_clks_configfunction ethqos_clks_disablefunction ethqos_ptp_clk_freq_configfunction qcom_ethqos_probe
Annotated Snippet
struct ethqos_emac_por {
unsigned int offset;
unsigned int value;
};
struct ethqos_emac_driver_data {
const struct ethqos_emac_por *rgmii_por;
unsigned int num_rgmii_por;
bool rgmii_config_loopback_en;
bool has_emac_ge_3;
u8 dma_addr_width;
const char *link_clk_name;
struct dwmac4_addrs dwmac4_addrs;
bool needs_sgmii_loopback;
};
struct qcom_ethqos {
struct platform_device *pdev;
void __iomem *rgmii_base;
struct clk *link_clk;
struct phy *serdes_phy;
phy_interface_t phy_mode;
const struct ethqos_emac_por *rgmii_por;
unsigned int num_rgmii_por;
bool rgmii_config_loopback_en;
bool has_emac_ge_3;
bool needs_sgmii_loopback;
};
static u32 rgmii_readl(struct qcom_ethqos *ethqos, unsigned int offset)
{
return readl(ethqos->rgmii_base + offset);
}
static void rgmii_writel(struct qcom_ethqos *ethqos, u32 value,
unsigned int offset)
{
writel(value, ethqos->rgmii_base + offset);
}
static void rgmii_updatel(struct qcom_ethqos *ethqos, u32 mask, u32 val,
unsigned int offset)
{
u32 temp;
temp = rgmii_readl(ethqos, offset);
temp = (temp & ~(mask)) | val;
rgmii_writel(ethqos, temp, offset);
}
static void rgmii_setmask(struct qcom_ethqos *ethqos, u32 mask,
unsigned int offset)
{
rgmii_updatel(ethqos, mask, mask, offset);
}
static void rgmii_clrmask(struct qcom_ethqos *ethqos, u32 mask,
unsigned int offset)
{
rgmii_updatel(ethqos, mask, 0, offset);
}
static void rgmii_dump(void *priv)
{
struct qcom_ethqos *ethqos = priv;
struct device *dev = ðqos->pdev->dev;
dev_dbg(dev, "Rgmii register dump\n");
dev_dbg(dev, "RGMII_IO_MACRO_CONFIG: %x\n",
rgmii_readl(ethqos, RGMII_IO_MACRO_CONFIG));
dev_dbg(dev, "SDCC_HC_REG_DLL_CONFIG: %x\n",
rgmii_readl(ethqos, SDCC_HC_REG_DLL_CONFIG));
dev_dbg(dev, "SDCC_HC_REG_DDR_CONFIG: %x\n",
rgmii_readl(ethqos, SDCC_HC_REG_DDR_CONFIG));
dev_dbg(dev, "SDCC_HC_REG_DLL_CONFIG2: %x\n",
rgmii_readl(ethqos, SDCC_HC_REG_DLL_CONFIG2));
dev_dbg(dev, "SDC4_STATUS: %x\n",
rgmii_readl(ethqos, SDC4_STATUS));
dev_dbg(dev, "SDCC_USR_CTL: %x\n",
rgmii_readl(ethqos, SDCC_USR_CTL));
dev_dbg(dev, "RGMII_IO_MACRO_CONFIG2: %x\n",
rgmii_readl(ethqos, RGMII_IO_MACRO_CONFIG2));
dev_dbg(dev, "RGMII_IO_MACRO_DEBUG1: %x\n",
rgmii_readl(ethqos, RGMII_IO_MACRO_DEBUG1));
dev_dbg(dev, "EMAC_SYSTEM_LOW_POWER_DEBUG: %x\n",
rgmii_readl(ethqos, EMAC_SYSTEM_LOW_POWER_DEBUG));
}
static int ethqos_set_clk_tx_rate(void *bsp_priv, struct clk *clk_tx_i,
Annotation
- Immediate include surface: `linux/module.h`, `linux/of.h`, `linux/of_net.h`, `linux/platform_device.h`, `linux/phy.h`, `linux/phy/phy.h`, `stmmac.h`, `stmmac_platform.h`.
- Detected declarations: `struct ethqos_emac_por`, `struct ethqos_emac_driver_data`, `struct qcom_ethqos`, `function rgmii_readl`, `function rgmii_writel`, `function rgmii_updatel`, `function rgmii_setmask`, `function rgmii_clrmask`, `function rgmii_dump`, `function ethqos_set_clk_tx_rate`.
- 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.