From 3efef60d5b8f6acdfdb1cd5712ef4d1f0062aa08 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Sun, 25 Apr 2021 11:20:30 +0800 Subject: [PATCH] r8168: add LED configuration from OF This adds the ability to configure the LED configuration register using OF. This way, the correct value for board specific LED configuration can be determined. Signed-off-by: AmadeusGhost Signed-off-by: Tianling Shen --- ...-r8168-add-LED-configuration-from-OF.patch | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 package/kernel/r8168/patches/001-r8168-add-LED-configuration-from-OF.patch diff --git a/package/kernel/r8168/patches/001-r8168-add-LED-configuration-from-OF.patch b/package/kernel/r8168/patches/001-r8168-add-LED-configuration-from-OF.patch new file mode 100644 index 0000000000..3a7165569b --- /dev/null +++ b/package/kernel/r8168/patches/001-r8168-add-LED-configuration-from-OF.patch @@ -0,0 +1,42 @@ +--- a/src/r8168_n.c ++++ b/src/r8168_n.c +@@ -46,6 +46,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -23978,6 +23979,22 @@ rtl8168_set_bios_setting(struct net_device *dev) + } + } + ++static int rtl8168_led_configuration(struct rtl8168_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 + rtl8168_init_software_variable(struct net_device *dev) + { +@@ -24441,6 +24458,8 @@ rtl8168_init_software_variable(struct net_device *dev) + tp->NotWrMcuPatchCode = TRUE; + } + ++ rtl8168_led_configuration(tp); ++ + tp->NicCustLedValue = RTL_R16(tp, CustomLED); + + rtl8168_get_hw_wol(dev);