#RK3576Linux RTL8211F网口灯控制

发布时间:2026/8/2 5:20:06
#RK3576Linux RTL8211F网口灯控制
需求目前RTL8211的网口灯led2默认是接上网线进行闪烁需要添加led1绿灯常亮功能通过ADB命令控制RTL8211F LED# 切换到扩展页0xd04 /sys/bus/mdio_bus/devices/stmmac-1:01# echo 0x1f 0xd04 phy_registers # 写入LED控制寄存器值例如0x2d60 /sys/bus/mdio_bus/devices/stmmac-1:01# echo 0x10 0x2d60 phy_registersdiff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index a6310d96b0d4..3f5e5665b696 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -146,6 146,25 static void stmmac_exit_fs(struct net_device *dev); #define STMMAC_COAL_TIMER(x) (ns_to_ktime((x) * NSEC_PER_USEC)) #define RTL_8211F_PHY_ID 0x001cc916 #define RTL_8211F_PHY_ID_MASK 0x001fffff #define RTL_8211F_PAGE_SELECT 0x1f #define RTL_8211F_LCR_ADDR 0x10 int phy_rtl8211f_led_fixup(struct phy_device *phydev) { /* 切换到扩展页0xd04 */ phy_write(phydev, RTL_8211F_PAGE_SELECT, 0xd04); /* 设置LCR寄存器值为0x6171 */ phy_write(phydev, RTL_8211F_LCR_ADDR, 0x6d00); /* 切换回默认页 */ phy_write(phydev, RTL_8211F_PAGE_SELECT, 0xa42); return 0; } int stmmac_bus_clks_config(struct stmmac_priv *priv, bool enabled) { int ret 0; -7369,6 7388,12 int stmmac_dvr_probe(struct device *device, #ifdef CONFIG_DEBUG_FS stmmac_init_fs(ndev); #endif //add bubble ret phy_register_fixup_for_uid(RTL_8211F_PHY_ID, RTL_8211F_PHY_ID_MASK, phy_rtl8211f_led_fixup); if (ret) { dev_warn(priv-device, Cannot register PHY board fixup, error:%d\n, ret); } //end if (priv-plat-dump_debug_regs) priv-plat-dump_debug_regs(priv-plat-bsp_priv);