1 From 82985725e071f2a5735052f18e109a32aeac3a0b Mon Sep 17 00:00:00 2001
2 From: David Bauer <mail@david-bauer.net>
3 Date: Sun, 26 Jul 2020 02:38:31 +0200
4 Subject: [PATCH] net: usb: r8152: add LED configuration from OF
6 This adds the ability to configure the LED configuration register using
7 OF. This way, the correct value for board specific LED configuration can
10 Signed-off-by: David Bauer <mail@david-bauer.net>
12 drivers/net/usb/r8152.c | 23 +++++++++++++++++++++++
13 1 file changed, 23 insertions(+)
15 --- a/drivers/net/usb/r8152.c
16 +++ b/drivers/net/usb/r8152.c
18 #include <linux/mii.h>
19 #include <linux/ethtool.h>
20 #include <linux/usb.h>
21 +#include <linux/of.h>
22 #include <linux/crc32.h>
23 #include <linux/if_vlan.h>
24 #include <linux/uaccess.h>
25 @@ -6886,6 +6887,22 @@ static void rtl_tally_reset(struct r8152
26 ocp_write_word(tp, MCU_TYPE_PLA, PLA_RSTTALLY, ocp_data);
29 +static int r8152_led_configuration(struct r8152 *tp)
34 + ret = of_property_read_u32(tp->udev->dev.of_node, "realtek,led-data",
40 + ocp_write_word(tp, MCU_TYPE_PLA, PLA_LEDSEL, led_data);
45 static void r8152b_init(struct r8152 *tp)
48 @@ -6927,6 +6944,8 @@ static void r8152b_init(struct r8152 *tp
49 ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL);
50 ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN);
51 ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data);
53 + r8152_led_configuration(tp);
56 static void r8153_init(struct r8152 *tp)
57 @@ -7067,6 +7086,8 @@ static void r8153_init(struct r8152 *tp)
58 tp->coalesce = COALESCE_SLOW;
62 + r8152_led_configuration(tp);
65 static void r8153b_init(struct r8152 *tp)
66 @@ -7149,6 +7170,8 @@ static void r8153b_init(struct r8152 *tp
69 tp->coalesce = 15000; /* 15 us */
71 + r8152_led_configuration(tp);
74 static void r8153c_init(struct r8152 *tp)