drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c- Extension
.c- Size
- 23742 bytes
- Lines
- 989
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/bits.hlinux/clk.hlinux/debugfs.hlinux/delay.hlinux/fsl/netc_global.hlinux/module.hlinux/of.hlinux/of_device.hlinux/of_net.hlinux/of_platform.hlinux/phy.hlinux/platform_device.hlinux/seq_file.h
Detected Declarations
struct netc_devinfostruct netc_blk_ctrlfunction netc_reg_writefunction netc_reg_readfunction netc_of_pci_get_bus_devfnfunction netc_get_link_mii_protocolfunction imx95_netcmix_initfunction for_each_available_child_of_node_scopedfunction imx94_enetc_get_link_idfunction imx94_link_configfunction imx94_enetc_link_configfunction imx94_switch_link_configfunction imx94_netcmix_initfunction for_each_child_of_node_scopedfunction netc_ierb_is_lockedfunction netc_lock_ierbfunction netc_unlock_ierb_with_warm_resetfunction netc_get_phy_addrfunction netc_parse_emdio_phy_maskfunction for_each_child_of_node_scopedfunction netc_get_emdio_phy_maskfunction imx95_enetc_mdio_phyaddr_configfunction for_each_child_of_node_scopedfunction imx95_ierb_initfunction imx94_get_enetc_idfunction imx94_get_timer_idfunction imx94_enetc_update_tidfunction imx94_enetc_mdio_phyaddr_configfunction imx94_ierb_enetc_initfunction imx94_switch_mdio_phyaddr_configfunction imx94_ierb_switch_initfunction for_each_available_child_of_node_scopedfunction imx94_ierb_initfunction for_each_child_of_node_scopedfunction netc_ierb_initfunction netc_prb_showfunction netc_blk_ctrl_create_debugfsfunction netc_blk_ctrl_remove_debugfsfunction netc_blk_ctrl_create_debugfsfunction netc_blk_ctrl_probefunction netc_blk_ctrl_remove
Annotated Snippet
struct netc_devinfo {
u32 flags;
int (*netcmix_init)(struct platform_device *pdev);
int (*ierb_init)(struct platform_device *pdev);
};
struct netc_blk_ctrl {
void __iomem *prb;
void __iomem *ierb;
void __iomem *netcmix;
const struct netc_devinfo *devinfo;
struct platform_device *pdev;
struct dentry *debugfs_root;
};
static void netc_reg_write(void __iomem *base, u32 offset, u32 val)
{
netc_write(base + offset, val);
}
static u32 netc_reg_read(void __iomem *base, u32 offset)
{
return netc_read(base + offset);
}
static int netc_of_pci_get_bus_devfn(struct device_node *np)
{
u32 reg[5];
int error;
error = of_property_read_u32_array(np, "reg", reg, ARRAY_SIZE(reg));
if (error)
return error;
return (reg[0] >> 8) & 0xffff;
}
static int netc_get_link_mii_protocol(phy_interface_t interface)
{
switch (interface) {
case PHY_INTERFACE_MODE_MII:
return MII_PROT_MII;
case PHY_INTERFACE_MODE_RMII:
return MII_PROT_RMII;
case PHY_INTERFACE_MODE_RGMII:
case PHY_INTERFACE_MODE_RGMII_ID:
case PHY_INTERFACE_MODE_RGMII_RXID:
case PHY_INTERFACE_MODE_RGMII_TXID:
return MII_PROT_RGMII;
case PHY_INTERFACE_MODE_SGMII:
case PHY_INTERFACE_MODE_2500BASEX:
case PHY_INTERFACE_MODE_10GBASER:
case PHY_INTERFACE_MODE_XGMII:
case PHY_INTERFACE_MODE_USXGMII:
return MII_PROT_SERIAL;
default:
return -EINVAL;
}
}
static int imx95_netcmix_init(struct platform_device *pdev)
{
struct netc_blk_ctrl *priv = platform_get_drvdata(pdev);
struct device_node *np = pdev->dev.of_node;
phy_interface_t interface;
int bus_devfn, mii_proto;
u32 val;
int err;
/* Default setting of MII protocol */
val = MII_PROT(0, MII_PROT_RGMII) | MII_PROT(1, MII_PROT_RGMII) |
MII_PROT(2, MII_PROT_SERIAL);
/* Update the link MII protocol through parsing phy-mode */
for_each_available_child_of_node_scoped(np, child) {
for_each_available_child_of_node_scoped(child, gchild) {
if (!of_device_is_compatible(gchild, "pci1131,e101"))
continue;
bus_devfn = netc_of_pci_get_bus_devfn(gchild);
if (bus_devfn < 0)
return -EINVAL;
if (bus_devfn == IMX95_ENETC2_BUS_DEVFN)
continue;
err = of_get_phy_mode(gchild, &interface);
if (err)
continue;
Annotation
- Immediate include surface: `linux/bits.h`, `linux/clk.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/fsl/netc_global.h`, `linux/module.h`, `linux/of.h`, `linux/of_device.h`.
- Detected declarations: `struct netc_devinfo`, `struct netc_blk_ctrl`, `function netc_reg_write`, `function netc_reg_read`, `function netc_of_pci_get_bus_devfn`, `function netc_get_link_mii_protocol`, `function imx95_netcmix_init`, `function for_each_available_child_of_node_scoped`, `function imx94_enetc_get_link_id`, `function imx94_link_config`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.