mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
59 lines
1.5 KiB
Diff
59 lines
1.5 KiB
Diff
From edcc2833819f6750bf003b95a6ac856aced26274 Mon Sep 17 00:00:00 2001
|
|
From: AnYun <amadeus@jmu.edu.cn>
|
|
Date: Sat, 18 Mar 2023 23:05:16 +0800
|
|
Subject: [PATCH] r8169: add LED configuration from OF
|
|
|
|
---
|
|
drivers/net/ethernet/realtek/r8169_main.c | 19 +++++++++++++++++++
|
|
1 file changed, 19 insertions(+)
|
|
|
|
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
|
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
|
@@ -17,6 +17,7 @@
|
|
#include <linux/delay.h>
|
|
#include <linux/ethtool.h>
|
|
#include <linux/phy.h>
|
|
+#include <linux/of.h>
|
|
#include <linux/if_vlan.h>
|
|
#include <linux/in.h>
|
|
#include <linux/io.h>
|
|
@@ -175,6 +176,7 @@ enum rtl_registers {
|
|
MAR0 = 8, /* Multicast filter. */
|
|
CounterAddrLow = 0x10,
|
|
CounterAddrHigh = 0x14,
|
|
+ CustomLED = 0x18,
|
|
TxDescStartAddrLow = 0x20,
|
|
TxDescStartAddrHigh = 0x24,
|
|
TxHDescStartAddrLow = 0x28,
|
|
@@ -5373,6 +5375,22 @@ static bool rtl_aspm_is_safe(struct rtl8
|
|
return false;
|
|
}
|
|
|
|
+static int rtl_led_configuration(struct rtl8169_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 int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
{
|
|
struct rtl8169_private *tp;
|
|
@@ -5541,6 +5559,7 @@ static int rtl_init_one(struct pci_dev *
|
|
if (!tp->counters)
|
|
return -ENOMEM;
|
|
|
|
+ rtl_led_configuration(tp);
|
|
pci_set_drvdata(pdev, tp);
|
|
|
|
rc = r8169_mdio_register(tp);
|