From db6b56b7954cc7b1993d2817711bacd1be8928d1 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sun, 5 Mar 2023 12:55:43 +0800 Subject: [PATCH] r8125: read devname configuration from OF Signed-off-by: Tianling Shen --- .../100-add-LED-configuration-from-OF.patch | 4 +-- ...10-add-devname-configuration-from-OF.patch | 34 +++++++++++++++++++ ...r8169-add-LED-configuration-from-OF.patch} | 16 ++++----- ...mm-add-LED-configuration-for-yt8521.patch} | 0 ...69-add-devname-configuration-from-OF.patch | 33 ++++++++++++++++++ 5 files changed, 77 insertions(+), 10 deletions(-) create mode 100644 package/kernel/r8125/patches/110-add-devname-configuration-from-OF.patch rename target/linux/rockchip/patches-5.15/{108-net-ethernet-r8169-add-LED-configuration-from-OF.patch => 600-net-ethernet-r8169-add-LED-configuration-from-OF.patch} (81%) rename target/linux/rockchip/patches-5.15/{109-net-phy-motorcomm-add-LED-configuration-for-yt8521.patch => 601-net-phy-motorcomm-add-LED-configuration-for-yt8521.patch} (100%) create mode 100644 target/linux/rockchip/patches-5.15/602-net-ethernet-r8169-add-devname-configuration-from-OF.patch diff --git a/package/kernel/r8125/patches/100-add-LED-configuration-from-OF.patch b/package/kernel/r8125/patches/100-add-LED-configuration-from-OF.patch index 255cf67fe4..9f252b4458 100644 --- a/package/kernel/r8125/patches/100-add-LED-configuration-from-OF.patch +++ b/package/kernel/r8125/patches/100-add-LED-configuration-from-OF.patch @@ -8,7 +8,7 @@ #include #include #include -@@ -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; diff --git a/package/kernel/r8125/patches/110-add-devname-configuration-from-OF.patch b/package/kernel/r8125/patches/110-add-devname-configuration-from-OF.patch new file mode 100644 index 0000000000..1cf87cb416 --- /dev/null +++ b/package/kernel/r8125/patches/110-add-devname-configuration-from-OF.patch @@ -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); diff --git a/target/linux/rockchip/patches-5.15/108-net-ethernet-r8169-add-LED-configuration-from-OF.patch b/target/linux/rockchip/patches-5.15/600-net-ethernet-r8169-add-LED-configuration-from-OF.patch similarity index 81% rename from target/linux/rockchip/patches-5.15/108-net-ethernet-r8169-add-LED-configuration-from-OF.patch rename to target/linux/rockchip/patches-5.15/600-net-ethernet-r8169-add-LED-configuration-from-OF.patch index 5d0cf57ba1..332e32825b 100644 --- a/target/linux/rockchip/patches-5.15/108-net-ethernet-r8169-add-LED-configuration-from-OF.patch +++ b/target/linux/rockchip/patches-5.15/600-net-ethernet-r8169-add-LED-configuration-from-OF.patch @@ -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) diff --git a/target/linux/rockchip/patches-5.15/109-net-phy-motorcomm-add-LED-configuration-for-yt8521.patch b/target/linux/rockchip/patches-5.15/601-net-phy-motorcomm-add-LED-configuration-for-yt8521.patch similarity index 100% rename from target/linux/rockchip/patches-5.15/109-net-phy-motorcomm-add-LED-configuration-for-yt8521.patch rename to target/linux/rockchip/patches-5.15/601-net-phy-motorcomm-add-LED-configuration-for-yt8521.patch diff --git a/target/linux/rockchip/patches-5.15/602-net-ethernet-r8169-add-devname-configuration-from-OF.patch b/target/linux/rockchip/patches-5.15/602-net-ethernet-r8169-add-devname-configuration-from-OF.patch new file mode 100644 index 0000000000..a85c2fa46c --- /dev/null +++ b/target/linux/rockchip/patches-5.15/602-net-ethernet-r8169-add-devname-configuration-from-OF.patch @@ -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);