From 6ee0a41e3283bf67db7cbcf5e0dbaca3fbc38f8a Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Wed, 18 May 2022 12:05:07 +0800 Subject: [PATCH] Revert "r8152: drop led configuration patch" This doesn't make sense at all. For more details see comments in the original commit. This reverts commit 4a22f9ad8ae5b9102cf7af68efeacd5a81848bf3. Signed-off-by: Tianling Shen --- package/kernel/r8152/Makefile | 11 +-- .../100-add-LED-configuration-from-OF.patch | 74 +++++++++++++++++++ 2 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 package/kernel/r8152/patches/100-add-LED-configuration-from-OF.patch diff --git a/package/kernel/r8152/Makefile b/package/kernel/r8152/Makefile index 1ae1852246..8ba85b5044 100644 --- a/package/kernel/r8152/Makefile +++ b/package/kernel/r8152/Makefile @@ -1,7 +1,8 @@ -# -# Download realtek r8152 linux driver from official site: -# [https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-usb-3-0-software] -# +#Download realtek r8152 linux driver from official site [https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-usb-3-0-software] +#Unpack source file +#Replace orginal Makefile with this file +#Put this source to 'package' folder of OpenWRT/LEDE SDK +#Build(make menuconfig, make defconfig, make) include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk @@ -26,7 +27,7 @@ define KernelPackage/usb-net-rtl8152-vendor TITLE:=Kernel module for USB-to-Ethernet Realtek convertors SUBMENU:=USB Support VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) - DEPENDS:=@TARGET_x86 +kmod-usb-net + DEPENDS:=+kmod-usb-net CONFLICTS:=kmod-usb-net-rtl8152 FILES:= $(PKG_BUILD_DIR)/r8152.ko AUTOLOAD:=$(call AutoProbe,r8152) diff --git a/package/kernel/r8152/patches/100-add-LED-configuration-from-OF.patch b/package/kernel/r8152/patches/100-add-LED-configuration-from-OF.patch new file mode 100644 index 0000000000..38d885d72d --- /dev/null +++ b/package/kernel/r8152/patches/100-add-LED-configuration-from-OF.patch @@ -0,0 +1,74 @@ +From 82985725e071f2a5735052f18e109a32aeac3a0b Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Sun, 26 Jul 2020 02:38:31 +0200 +Subject: [PATCH] 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: David Bauer +--- + r8152.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +--- a/r8152.c ++++ b/r8152.c +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -9804,6 +9805,22 @@ static void rtl_tally_reset(struct r8152 + ocp_write_word(tp, MCU_TYPE_PLA, PLA_RSTTALLY, ocp_data); + } + ++static int r8152_led_configuration(struct r8152 *tp) ++{ ++ u32 led_data; ++ int ret; ++ ++ ret = of_property_read_u32(tp->udev->dev.of_node, "realtek,led-data", ++ &led_data); ++ ++ if (ret) ++ return ret; ++ ++ ocp_write_word(tp, MCU_TYPE_PLA, PLA_LEDSEL, led_data); ++ ++ return 0; ++} ++ + static void r8152b_init(struct r8152 *tp) + { + u32 ocp_data; +@@ -9865,6 +9882,8 @@ static void r8152b_init(struct r8152 *tp + ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL); + ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN); + ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data); ++ ++ r8152_led_configuration(tp); + } + + static void r8153_init(struct r8152 *tp) +@@ -10008,6 +10027,8 @@ static void r8153_init(struct r8152 *tp) + tp->coalesce = COALESCE_SLOW; + break; + } ++ ++ r8152_led_configuration(tp); + } + + static void r8153b_init(struct r8152 *tp) +@@ -10098,6 +10119,8 @@ static void r8153b_init(struct r8152 *tp + rtl_tally_reset(tp); + + tp->coalesce = 15000; /* 15 us */ ++ ++ r8152_led_configuration(tp); + } + + static void r8153c_init(struct r8152 *tp)