linux/RPi: update lan78xx patch

This commit is contained in:
MilhouseVH 2018-03-24 21:21:12 +00:00
parent c1bcdb5728
commit e0dc115e44
2 changed files with 24 additions and 100 deletions

View File

@ -0,0 +1,24 @@
From abfbd6e4fc3cd4ff256207312605c69ad23ed215 Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Sun, 29 Oct 2017 15:31:10 +0000
Subject: [PATCH] lan78xx: Disable WOL
---
drivers/net/usb/lan78xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index f33460c..ff4ad6c 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -1618,7 +1618,7 @@ static const struct ethtool_ops lan78xx_ethtool_ops = {
.get_sset_count = lan78xx_get_sset_count,
.get_strings = lan78xx_get_strings,
.get_wol = lan78xx_get_wol,
- .set_wol = lan78xx_set_wol,
+// .set_wol = lan78xx_set_wol,
.get_eee = lan78xx_get_eee,
.set_eee = lan78xx_set_eee,
.get_pauseparam = lan78xx_get_pause,
--
2.7.4

View File

@ -1,100 +0,0 @@
From abfbd6e4fc3cd4ff256207312605c69ad23ed215 Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Sun, 29 Oct 2017 15:31:10 +0000
Subject: [PATCH 1/3] lan78xx: Disable WOL
---
drivers/net/usb/lan78xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index f33460c..ff4ad6c 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -1618,7 +1618,7 @@ static const struct ethtool_ops lan78xx_ethtool_ops = {
.get_sset_count = lan78xx_get_sset_count,
.get_strings = lan78xx_get_strings,
.get_wol = lan78xx_get_wol,
- .set_wol = lan78xx_set_wol,
+// .set_wol = lan78xx_set_wol,
.get_eee = lan78xx_get_eee,
.set_eee = lan78xx_set_eee,
.get_pauseparam = lan78xx_get_pause,
--
2.7.4
From 31a1f69f2fe9f158a27bdf7d6a516a84c6a054a9 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Tue, 17 Oct 2017 15:04:29 +0100
Subject: [PATCH 2/3] lan78xx: Enable LED0 and LED1
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/net/usb/lan78xx.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index ff4ad6c..65c86c2 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2204,6 +2204,7 @@ static int lan78xx_reset(struct lan78xx_net *dev)
ret = lan78xx_read_reg(dev, HW_CFG, &buf);
buf |= HW_CFG_MEF_;
+ buf |= HW_CFG_LED0_EN_ | HW_CFG_LED1_EN_;
ret = lan78xx_write_reg(dev, HW_CFG, buf);
ret = lan78xx_read_reg(dev, USB_CFG0, &buf);
--
2.7.4
From 2c5e254d9cff51d8e01cb3fe4cf35d87823e1f0d Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Fri, 21 Jul 2017 11:30:18 +0100
Subject: [PATCH 3/3] lan78xx: Read MAC address from DT if present
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/net/usb/lan78xx.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 65c86c2..0113ac4 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -31,6 +31,7 @@
#include <linux/mdio.h>
#include <net/ip6_checksum.h>
#include <linux/microchipphy.h>
+#include <linux/of_net.h>
#include "lan78xx.h"
#define DRIVER_AUTHOR "WOOJUNG HUH <woojung.huh@microchip.com>"
@@ -1638,6 +1639,14 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev)
u32 addr_lo, addr_hi;
int ret;
u8 addr[6];
+ const u8 *mac_addr;
+
+ /* maybe the boot loader passed the MAC address in devicetree */
+ mac_addr = of_get_mac_address(dev->udev->dev.of_node);
+ if (mac_addr) {
+ ether_addr_copy(addr, mac_addr);
+ goto set_mac_addr;
+ }
ret = lan78xx_read_reg(dev, RX_ADDRL, &addr_lo);
ret = lan78xx_read_reg(dev, RX_ADDRH, &addr_hi);
@@ -1666,6 +1675,7 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev)
"MAC address set to random addr");
}
+set_mac_addr:
addr_lo = addr[0] | (addr[1] << 8) |
(addr[2] << 16) | (addr[3] << 24);
addr_hi = addr[4] | (addr[5] << 8);
--
2.7.4