r8125: add led configuration from OF support

This commit is contained in:
lean 2022-08-19 19:39:37 +08:00
parent a4b74ce3fe
commit af98ec260b

View File

@ -0,0 +1,43 @@
--- a/src/r8125_n.c
+++ b/src/r8125_n.c
@@ -43,6 +43,7 @@
#include <linux/etherdevice.h>
#include <linux/delay.h>
#include <linux/mii.h>
+#include <linux/of.h>
#include <linux/if_vlan.h>
#include <linux/crc32.h>
#include <linux/interrupt.h>
@@ -10407,6 +10408,23 @@ rtl8125_setup_mqs_reg(struct rtl8125_private *tp)
}
}
+static int
+rtl8125_led_configuration(struct rtl8125_private *tp)
+{
+ u32 led_data;
+ int ret;
+
+ ret = of_property_read_u32(tp->pci_dev->dev.of_node,
+ "realtek,led-data", &led_data);
+
+ if (ret)
+ return ret;
+
+ RTL_W16(tp, CustomLED, led_data);
+
+ return 0;
+}
+
static void
rtl8125_init_software_variable(struct net_device *dev)
{
@@ -10838,6 +10856,8 @@ rtl8125_init_software_variable(struct net_device *dev)
if (tp->InitRxDescType == RX_DESC_RING_TYPE_3)
tp->rtl8125_rx_config |= EnableRxDescV3;
+ rtl8125_led_configuration(tp);
+
tp->NicCustLedValue = RTL_R16(tp, CustomLED);
tp->wol_opts = rtl8125_get_hw_wol(tp);