Skip to content

Commit

Permalink
net-usb-r8152-add-LED-configuration-from-OF(:1)
Browse files Browse the repository at this point in the history
Original-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>
X-Armbian: Patch-File: net-usb-r8152-add-LED-configuration-from-OF
X-Armbian: Patch-File-Counter: 1
X-Armbian: Patch-Rel-Directory: patch/kernel/archive/rockchip64-6.3
X-Armbian: Patch-Type: kernel
X-Armbian: Patch-Root-Type: core
X-Armbian: Patch-Sub-Type: common
X-Armbian: Original-Subject: net: usb: r8152: add LED configuration from OF
  • Loading branch information
blocktrron authored and Armbian AutoPatcher committed Jul 26, 2020
1 parent 748672c commit acfca1a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions drivers/net/usb/r8152.c
Expand Up @@ -11,6 +11,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>
Expand Down Expand Up @@ -6871,6 +6872,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;
Expand Down Expand Up @@ -6912,6 +6929,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)
Expand Down Expand Up @@ -7052,6 +7071,8 @@ static void r8153_init(struct r8152 *tp)
tp->coalesce = COALESCE_SLOW;
break;
}

r8152_led_configuration(tp);
}

static void r8153b_init(struct r8152 *tp)
Expand Down Expand Up @@ -7134,6 +7155,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)
Expand Down

0 comments on commit acfca1a

Please sign in to comment.