armbian_build/patch/kernel/archive/sunxi-6.10/patches.armbian/net-usb-r8152-add-LED-configuration-from-OF.patch
The-going 5838fac412 sunxi-6.10: Delete unused patches and add newly extracted patches.
The patches in the series were applied to the Linux
kernel git repository as the "git am" command.
And then re-extracted to the target patches.armbian
folder using the tools/mk_format_patch script.
In this case, the series.armbian file is created anew
and all patches in the series strictly correspond
to this list.

I.e. unused ones will be deleted. The name of the patch
file will match the string "Subject:".

Signed-off-by: The-going <48602507+The-going@users.noreply.github.com>
2024-09-10 21:59:57 +02:00

80 lines
2.0 KiB
Diff

From e12418d82f0fe2ca5c0fa65273cddcf8469870ce Mon Sep 17 00:00:00 2001
From: David Bauer <mail@david-bauer.net>
Date: Sun, 26 Jul 2020 02:38:31 +0200
Subject: net: usb: r8152: 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 <mail@david-bauer.net>
---
drivers/net/usb/r8152.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 19df1cd9f072..cc249ee55a6f 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -12,6 +12,7 @@
#include <linux/ethtool.h>
#include <linux/phy.h>
#include <linux/usb.h>
+#include <linux/of.h>
#include <linux/crc32.h>
#include <linux/if_vlan.h>
#include <linux/uaccess.h>
@@ -7036,6 +7037,22 @@ static void rtl_tally_reset(struct r8152 *tp)
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;
@@ -7077,6 +7094,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)
@@ -7217,6 +7236,8 @@ static void r8153_init(struct r8152 *tp)
tp->coalesce = COALESCE_SLOW;
break;
}
+
+ r8152_led_configuration(tp);
}
static void r8153b_init(struct r8152 *tp)
@@ -7299,6 +7320,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)
--
2.35.3