lede/package/kernel/r8125/patches/300-r8125-add-LED-configuration-from-OF.patch
=?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= b53ecbb75a package: add kmod-r8125 ethernet driver
r8125 is an out of tree driver provided by Realtek for RTL8125 devices.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
[Refresh our patch, disable aspm]
Signed-off-by: AnYun <amadeus@openjmu.xyz>
2024-08-21 20:50:16 +08:00

42 lines
1.2 KiB
Diff

--- a/src/r8125_n.c
+++ b/src/r8125_n.c
@@ -44,6 +44,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>
@@ -13667,6 +13668,22 @@ rtl8125_setup_mqs_reg(struct rtl8125_pri
}
static void
+rtl8125_led_configuration(struct rtl8125_private *tp)
+{
+ u32 led_data[4];
+ int i, ret;
+
+ const int led_regs[] = { 0x18, 0x86, 0x84, 0x96 };
+ ret = of_property_read_u32_array(tp->pci_dev->dev.of_node,
+ "led-data", led_data, 4);
+ if (!ret) {
+ for (i = 0; i < 4; i++) {
+ RTL_W16(tp, led_regs[i], led_data[i]);
+ }
+ }
+}
+
+static void
rtl8125_init_software_variable(struct net_device *dev)
{
struct rtl8125_private *tp = netdev_priv(dev);
@@ -14300,6 +14317,7 @@ rtl8125_init_software_variable(struct ne
else if (tp->InitRxDescType == RX_DESC_RING_TYPE_4)
tp->rtl8125_rx_config &= ~EnableRxDescV4_1;
+ rtl8125_led_configuration(tp);
tp->NicCustLedValue = RTL_R16(tp, CustomLED);
tp->wol_opts = rtl8125_get_hw_wol(tp);