84 lines
1.8 KiB
Diff
84 lines
1.8 KiB
Diff
From 82985725e071f2a5735052f18e109a32aeac3a0b Mon Sep 17 00:00:00 2001
|
|
From: David Bauer <mail@david-bauer.net>
|
|
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 <mail@david-bauer.net>
|
|
---
|
|
r8152.c | 23 +++++++++++++++++++++++
|
|
1 file changed, 23 insertions(+)
|
|
|
|
--- a/r8152.c
|
|
+++ b/r8152.c
|
|
@@ -18,6 +18,7 @@
|
|
#include <linux/mii.h>
|
|
#include <linux/ethtool.h>
|
|
#include <linux/usb.h>
|
|
+#include <linux/of.h>
|
|
#include <linux/crc32.h>
|
|
#include <linux/if_vlan.h>
|
|
#include <linux/uaccess.h>
|
|
@@ -12596,6 +12597,22 @@ out:
|
|
return ret;
|
|
}
|
|
|
|
+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 int r8152b_init(struct r8152 *tp)
|
|
{
|
|
int ret;
|
|
@@ -12695,6 +12712,8 @@ static int r8152b_init(struct r8152 *tp)
|
|
ret = ocp_word_clr_bits(tp, MCU_TYPE_USB, USB_USB_CTRL,
|
|
RX_AGG_DISABLE | RX_ZERO_EN);
|
|
|
|
+ r8152_led_configuration(tp);
|
|
+
|
|
out:
|
|
return (ret < 0) ? ret : 0;
|
|
}
|
|
@@ -12883,6 +12902,8 @@ static int r8153_init(struct r8152 *tp)
|
|
break;
|
|
}
|
|
|
|
+ r8152_led_configuration(tp);
|
|
+
|
|
out:
|
|
return (ret < 0) ? ret : 0;
|
|
}
|
|
@@ -13013,6 +13034,8 @@ static int r8153b_init(struct r8152 *tp)
|
|
|
|
tp->coalesce = 15000; /* 15 us */
|
|
|
|
+ r8152_led_configuration(tp);
|
|
+
|
|
out:
|
|
return (ret < 0) ? ret : 0;
|
|
}
|
|
@@ -13124,6 +13147,8 @@ static int r8153c_init(struct r8152 *tp)
|
|
|
|
tp->coalesce = 15000; /* 15 us */
|
|
|
|
+ r8152_led_configuration(tp);
|
|
+
|
|
out:
|
|
return (ret < 0) ? ret : 0;
|
|
}
|