r8125: read devname configuration from OF

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2023-03-05 12:55:43 +08:00
parent f1605333e6
commit db6b56b795
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
5 changed files with 77 additions and 10 deletions

View File

@ -8,7 +8,7 @@
#include <linux/if_vlan.h>
#include <linux/crc32.h>
#include <linux/interrupt.h>
@@ -10416,6 +10417,23 @@ rtl8125_setup_mqs_reg(struct rtl8125_pri
@@ -11479,6 +11480,23 @@ rtl8125_setup_mqs_reg(struct rtl8125_pri
}
}
@ -32,7 +32,7 @@
static void
rtl8125_init_software_variable(struct net_device *dev)
{
@@ -10847,6 +10865,8 @@ rtl8125_init_software_variable(struct ne
@@ -11957,6 +11975,8 @@ rtl8125_init_software_variable(struct ne
if (tp->InitRxDescType == RX_DESC_RING_TYPE_3)
tp->rtl8125_rx_config |= EnableRxDescV3;

View File

@ -0,0 +1,34 @@
--- a/src/r8125_n.c
+++ b/src/r8125_n.c
@@ -11481,6 +11481,23 @@ rtl8125_setup_mqs_reg(struct rtl8125_pri
}
static int
+rtl8125_devname_configuration(struct rtl8125_private *tp)
+{
+ const char *devname;
+ int ret;
+
+ ret = of_property_read_string(tp->pci_dev->dev.of_node,
+ "label", &devname);
+
+ if (ret)
+ return ret;
+
+ strlcpy(tp->dev->name, devname, IFNAMSIZ);
+
+ return 0;
+}
+
+static int
rtl8125_led_configuration(struct rtl8125_private *tp)
{
u32 led_data;
@@ -11975,6 +11992,7 @@ rtl8125_init_software_variable(struct ne
if (tp->InitRxDescType == RX_DESC_RING_TYPE_3)
tp->rtl8125_rx_config |= EnableRxDescV3;
+ rtl8125_devname_configuration(tp);
rtl8125_led_configuration(tp);
tp->NicCustLedValue = RTL_R16(tp, CustomLED);

View File

@ -22,18 +22,18 @@
+static int rtl8169_led_configuration(struct rtl8169_private *tp)
+{
+ u32 led_data;
+ int ret;
+ u32 led_data;
+ int ret;
+
+ ret = of_property_read_u32(tp->pci_dev->dev.of_node,
+ "realtek,led-data", &led_data);
+ ret = of_property_read_u32(tp->pci_dev->dev.of_node,
+ "realtek,led-data", &led_data);
+
+ if (ret)
+ return ret;
+ if (ret)
+ return ret;
+
+ RTL_W16(tp, CustomLED, led_data);
+ RTL_W16(tp, CustomLED, led_data);
+
+ return 0;
+ return 0;
+}
+
static void rtl8168_config_eee_mac(struct rtl8169_private *tp)

View File

@ -0,0 +1,33 @@
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -2142,6 +2142,22 @@ void r8169_apply_firmware(struct rtl8169
}
}
+static int rtl8169_devname_configuration(struct rtl8169_private *tp)
+{
+ const char *devname;
+ int ret;
+
+ ret = of_property_read_string(tp->pci_dev->dev.of_node,
+ "label", &devname);
+
+ if (ret)
+ return ret;
+
+ strlcpy(tp->dev->name, devname, IFNAMSIZ);
+
+ return 0;
+}
+
static int rtl8169_led_configuration(struct rtl8169_private *tp)
{
u32 led_data;
@@ -3715,6 +3731,7 @@ static void rtl_hw_start_8125b(struct rt
rtl_ephy_init(tp, e_info_8125b);
rtl_hw_start_8125_common(tp);
+ rtl8169_devname_configuration(tp);
rtl8169_led_configuration(tp);
rtl_hw_aspm_clkreq_enable(tp, true);