--- a/src/r8126_n.c +++ b/src/r8126_n.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -11610,6 +11611,25 @@ rtl8126_setup_mqs_reg(struct rtl8126_pri } } +static int +rtl8126_led_configuration(struct rtl8126_private *tp) +{ + const int led_regs[] = { 0x18, 0x86, 0x84, 0x96 }; /* LEDSEL 0-3 */ + u32 led_data[4]; + int ret, i; + + ret = of_property_read_u32_array(tp->pci_dev->dev.of_node, + "realtek,led-data", led_data, 4); + + if (ret) + return ret; + + for (i = 0; i < 4; i++) + RTL_W16(tp, led_regs[i], led_data[i]); + + return 0; +} + static void rtl8126_init_software_variable(struct net_device *dev) { @@ -11982,6 +12002,8 @@ rtl8126_init_software_variable(struct ne if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) tp->rtl8126_rx_config |= EnableRxDescV3; + rtl8126_led_configuration(tp); + tp->NicCustLedValue = RTL_R16(tp, CustomLED); tp->wol_opts = rtl8126_get_hw_wol(tp);