1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-03-09 15:40:20 +00:00

Update RPI3 patches

This commit is contained in:
Ycarus 2018-04-09 10:50:54 +02:00
parent 1f0c0498d7
commit d89c425df7
18 changed files with 3050 additions and 5 deletions

View file

@ -1,6 +1,7 @@
#
# Copyright (C) 2012-2016 OpenWrt.org
# Copyright (C) 2017 LEDE project
# Copyright (C) 2018 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -9,8 +10,8 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=brcm2708-gpu-fw
PKG_VERSION:=2018-03-26
PKG_RELEASE:=75de5d7a5ccaeb2dc499c38bcd95593ca76a6269
PKG_VERSION:=2018-04-06
PKG_RELEASE:=3aa806091dc57b757790b026c01754883cee2abc
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)/rpi-firmware-$(PKG_RELEASE)
@ -49,7 +50,7 @@ define Download/fixup_cd_dat
FILE:=$(RPI_FIRMWARE_FILE)-fixup_cd.dat
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=fixup_cd.dat
HASH:=ea8d0e1cc55755652c63ccf41e3f1987b73de7fb0d74baee5aa8f2147391ce48
HASH:=83109aff303b871ae68e8a5e214639d4795bdaebfaa7de58cd680065b7822c5f
endef
$(eval $(call Download,fixup_cd_dat))
@ -57,7 +58,7 @@ define Download/start_elf
FILE:=$(RPI_FIRMWARE_FILE)-start.elf
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=start.elf
HASH:=44922983955dedb52057265ef0e1130da682ee92819283c0fc819c7e6c512d24
HASH:=83109aff303b871ae68e8a5e214639d4795bdaebfaa7de58cd680065b7822c5f
endef
$(eval $(call Download,start_elf))
@ -65,7 +66,7 @@ define Download/start_cd_elf
FILE:=$(RPI_FIRMWARE_FILE)-start_cd.elf
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=start_cd.elf
HASH:=dccf2e4cd106b9568b7759fcc6de3e3bbbdab4c5262310f89f3b76d7e46f668e
HASH:=e283f91a728a4046ff7143de87326187c4cdbc29d335812537ae3872251323c5
endef
$(eval $(call Download,start_cd_elf))

View file

@ -0,0 +1,32 @@
From bc80536c9c9a429db34f96d98549b98ee026df63 Mon Sep 17 00:00:00 2001
From: hexameron <hexameron>
Date: Tue, 20 Mar 2018 12:48:10 +0000
Subject: [PATCH 278/297] overlays: use all seven dwc2 gadget fifos.
Linux 4.9 needed fifos to be set to their default values,
leaving the last one (silently) set to zero size.
From 4.12 Linux allows fifos to be set to any size EXCEPT zero.
Resolves https://github.com/raspberrypi/linux/issues/2390
Signed-off-by: John Greb <h3x4m3r0n@gmail.com>
---
arch/arm/boot/dts/overlays/dwc2-overlay.dts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/overlays/dwc2-overlay.dts b/arch/arm/boot/dts/overlays/dwc2-overlay.dts
index 265a16bab008..d6c223bc559a 100644
--- a/arch/arm/boot/dts/overlays/dwc2-overlay.dts
+++ b/arch/arm/boot/dts/overlays/dwc2-overlay.dts
@@ -15,7 +15,7 @@
dr_mode = "otg";
g-np-tx-fifo-size = <32>;
g-rx-fifo-size = <256>;
- g-tx-fifo-size = <512 512 512 512 512 768>;
+ g-tx-fifo-size = <512 512 512 512 512 256 256>;
status = "okay";
};
};
--
2.16.1

View file

@ -0,0 +1,26 @@
From 69c1d8b43a86a07dec8dabf5503296da509c6d1c Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Wed, 21 Mar 2018 13:53:39 +0000
Subject: [PATCH 279/297] overlays: Update 'upstream' overlay with new dwc2
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
arch/arm/boot/dts/overlays/upstream-overlay.dts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/overlays/upstream-overlay.dts b/arch/arm/boot/dts/overlays/upstream-overlay.dts
index 3890d900486f..ff37a5013de4 100644
--- a/arch/arm/boot/dts/overlays/upstream-overlay.dts
+++ b/arch/arm/boot/dts/overlays/upstream-overlay.dts
@@ -126,7 +126,7 @@
dr_mode = "otg";
g-np-tx-fifo-size = <32>;
g-rx-fifo-size = <256>;
- g-tx-fifo-size = <512 512 512 512 512 768>;
+ g-tx-fifo-size = <512 512 512 512 512 256 256>;
status = "okay";
};
};
--
2.16.1

View file

@ -0,0 +1,72 @@
From a32256581a6be7e3315af44802ae217f1816af8c Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Wed, 21 Mar 2018 15:59:26 +0000
Subject: [PATCH 280/297] lan78xx: Read LED states from Device Tree
Add support for DT property "microchip,led-modes", a vector of two
cells (u32s) in the range 0-15, each of which sets the mode for one
of the two LEDs. The possible values are:
0=link/activity 1=link1000/activity
2=link100/activity 3=link10/activity
4=link100/1000/activity 5=link10/1000/activity
6=link10/100/activity 14=off 15=on
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/net/usb/lan78xx.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 53c6dbaf8425..52593368a48d 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2017,7 +2017,9 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
{
int ret;
u32 mii_adv;
- u32 led_modes;
+ u32 led_modes[2];
+ u32 led_modes_reg;
+ int i;
struct phy_device *phydev = dev->net->phydev;
phydev = phy_find_first(dev->mdiobus);
@@ -2090,18 +2092,27 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
mii_adv = (u32)mii_advertise_flowctrl(dev->fc_request_control);
phydev->advertising |= mii_adv_to_ethtool_adv_t(mii_adv);
- /* Change LED defaults:
- * orange = link1000/activity
- * green = link10/link100/activity
+ /* Set LED modes:
* led: 0=link/activity 1=link1000/activity
* 2=link100/activity 3=link10/activity
* 4=link100/1000/activity 5=link10/1000/activity
* 6=link10/100/activity 14=off 15=on
*/
- led_modes = phy_read(phydev, 0x1d);
- led_modes &= ~0xff;
- led_modes |= (1 << 0) | (6 << 4);
- (void)phy_write(phydev, 0x1d, led_modes);
+
+ memset(led_modes, ~0, sizeof(led_modes));
+
+ of_property_read_u32_array(dev->udev->dev.of_node,
+ "microchip,led-modes",
+ led_modes, ARRAY_SIZE(led_modes));
+
+ led_modes_reg = phy_read(phydev, 0x1d);
+ for (i = 0; i < ARRAY_SIZE(led_modes); i++) {
+ if (led_modes[i] != ~0) {
+ led_modes_reg &= ~(0xf << (i * 4));
+ led_modes_reg |= (led_modes[i] & 0xf) << (i * 4);
+ }
+ }
+ (void)phy_write(phydev, 0x1d, led_modes_reg);
genphy_config_aneg(phydev);
--
2.16.1

View file

@ -0,0 +1,67 @@
From 06e903ade73529bd4e36d68e52da48a397033ef5 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Wed, 21 Mar 2018 16:04:18 +0000
Subject: [PATCH 281/297] BCM27XX_DT: Set LED modes from Device Tree
The new default values for LAN7515 (LAN7800) are:
LED0 = 1 (link1000/activity)
LED1 = 6 (link10/link100/activity)
Also add two dtparams - eth_led0 and eth_led1 - to provide user control
over the LEDs.
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi | 7 +++++++
arch/arm/boot/dts/overlays/README | 10 ++++++++++
2 files changed, 17 insertions(+)
diff --git a/arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi b/arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi
index 1b1075d4aa5c..154d48b7c45d 100644
--- a/arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi
+++ b/arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi
@@ -22,6 +22,11 @@
reg = <1>;
microchip,eee-enabled;
microchip,tx-lpi-timer = <600>; /* non-aggressive*/
+ /*
+ * led0 = 1:link1000/activity
+ * led1 = 6:link10/100/activity
+ */
+ microchip,led-modes = <1 6>;
};
};
};
@@ -32,5 +37,7 @@
__overrides__ {
eee = <&ethernet>,"microchip,eee-enabled?";
tx_lpi_timer = <&ethernet>,"microchip,tx-lpi-timer:0";
+ eth_led0 = <&ethernet>,"microchip,led-modes:0";
+ eth_led1 = <&ethernet>,"microchip,led-modes:4";
};
};
diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
index 3e260a9325fb..9652c741377b 100644
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -93,6 +93,16 @@ Params:
compatible devices (default "on"). See also
"tx_lpi_timer".
+ eth_led0 Set mode of LED0 (usually orange) (default
+ "1"). The legal values are:
+ 0=link/activity 1=link1000/activity
+ 2=link100/activity 3=link10/activity
+ 4=link100/1000/activity 5=link10/1000/activity
+ 6=link10/100/activity 14=off 15=on
+
+ eth_led1 Set mode of LED1 (usually green) (default
+ "6"). See eth_led0 for legal values.
+
i2c_arm Set to "on" to enable the ARM's i2c interface
(default "off")
--
2.16.1

View file

@ -0,0 +1,59 @@
From 74b4a1d8a7906120d69ef2312e503bc628590a8b Mon Sep 17 00:00:00 2001
From: derpeter <derpeter@users.noreply.github.com>
Date: Sun, 25 Mar 2018 23:27:30 +0200
Subject: [PATCH 282/297] This commit adds support for RP3-B-Plus in in arch
arm64 (#2464)
---
arch/arm64/boot/dts/broadcom/Makefile | 1 +
arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dts | 3 +++
arch/arm64/boot/dts/broadcom/bcm283x-rpi-lan7515.dtsi | 1 +
arch/arm64/configs/bcmrpi3_defconfig | 1 +
4 files changed, 6 insertions(+)
create mode 100644 arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dts
create mode 120000 arch/arm64/boot/dts/broadcom/bcm283x-rpi-lan7515.dtsi
diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile
index 3adfeab86f3f..f056f542dac4 100644
--- a/arch/arm64/boot/dts/broadcom/Makefile
+++ b/arch/arm64/boot/dts/broadcom/Makefile
@@ -8,6 +8,7 @@ endif
dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb
dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb
dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b.dtb
+dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b-plus.dtb
dts-dirs += ../overlays
diff --git a/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dts b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dts
new file mode 100644
index 000000000000..d9242ff77079
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dts
@@ -0,0 +1,3 @@
+#define RPI364
+
+#include "../../../../arm/boot/dts/bcm2710-rpi-3-b-plus.dts"
diff --git a/arch/arm64/boot/dts/broadcom/bcm283x-rpi-lan7515.dtsi b/arch/arm64/boot/dts/broadcom/bcm283x-rpi-lan7515.dtsi
new file mode 120000
index 000000000000..fc4c05bbe7fd
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/bcm283x-rpi-lan7515.dtsi
@@ -0,0 +1 @@
+../../../../arm/boot/dts/bcm283x-rpi-lan7515.dtsi
\ No newline at end of file
diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig
index 43052ca2aa35..50acf25b1f28 100644
--- a/arch/arm64/configs/bcmrpi3_defconfig
+++ b/arch/arm64/configs/bcmrpi3_defconfig
@@ -479,6 +479,7 @@ CONFIG_USB_NET_SR9700=m
CONFIG_USB_NET_SR9800=m
CONFIG_USB_NET_SMSC75XX=m
CONFIG_USB_NET_SMSC95XX=y
+CONFIG_USB_LAN78XX=y
CONFIG_USB_NET_GL620A=m
CONFIG_USB_NET_NET1080=m
CONFIG_USB_NET_PLUSB=m
--
2.16.1

View file

@ -0,0 +1,59 @@
From 9696aab22bb8163fb3a2a262dd6c67f6d05b70a1 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Wed, 28 Mar 2018 12:18:13 +0100
Subject: [PATCH 284/297] lan78xx: Ignore DT MAC address if already valid
The patch to set the lan78xx MAC address from DT does so regardless of
whether or not the interface already has a valid address. As the
initialisation function is called from the reset handler when the
interface is brought up, it is impossible to change the MAC address
in a way that persists across the interface being brought up.
Fix the problem by moving the DT reading code after the check for a
valid address.
See: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=209309
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/net/usb/lan78xx.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 52593368a48d..981cc5bf2df4 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -1641,14 +1641,6 @@ 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);
@@ -1661,6 +1653,15 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev)
addr[5] = (addr_hi >> 8) & 0xFF;
if (!is_valid_ether_addr(addr)) {
+ 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;
+ }
+
/* reading mac address from EEPROM or OTP */
if ((lan78xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
addr) == 0) ||
--
2.16.1

View file

@ -0,0 +1,70 @@
From 661230038a8736ba9023978c53cd21cd65739406 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Wed, 28 Mar 2018 17:32:20 +0100
Subject: [PATCH 285/297] lan78xx: Simple patch to prevent some crashes
Alexander Graf submitted a patch to solve a problem when connecting to
the device before the interface is brought up, but with that patch
applied the interface fails to work (for me and others). This simpler
patch should be considered a stepping stone that may prevent some of the
crashes seen when the interface is reset but without solving the early
access problem.
See: https://github.com/raspberrypi/linux/issues/2449
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/net/usb/lan78xx.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 981cc5bf2df4..e7bdbd1accad 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2023,6 +2023,9 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
int i;
struct phy_device *phydev = dev->net->phydev;
+ /* Return early if already initialised */
+ if (phydev)
+ return 0;
phydev = phy_find_first(dev->mdiobus);
if (!phydev) {
netdev_err(dev->net, "no PHY found\n");
@@ -2639,13 +2642,8 @@ static int lan78xx_stop(struct net_device *net)
if (timer_pending(&dev->stat_monitor))
del_timer_sync(&dev->stat_monitor);
- phy_unregister_fixup_for_uid(PHY_KSZ9031RNX, 0xfffffff0);
- phy_unregister_fixup_for_uid(PHY_LAN8835, 0xfffffff0);
-
- phy_stop(net->phydev);
- phy_disconnect(net->phydev);
-
- net->phydev = NULL;
+ if (net->phydev)
+ phy_stop(net->phydev);
clear_bit(EVENT_DEV_OPEN, &dev->flags);
netif_stop_queue(net);
@@ -3543,10 +3541,16 @@ static void lan78xx_disconnect(struct usb_interface *intf)
udev = interface_to_usbdev(intf);
net = dev->net;
- unregister_netdev(net);
cancel_delayed_work_sync(&dev->wq);
+ phy_unregister_fixup_for_uid(PHY_KSZ9031RNX, 0xfffffff0);
+ phy_unregister_fixup_for_uid(PHY_LAN8835, 0xfffffff0);
+
+ phy_disconnect(net->phydev);
+ net->phydev = NULL;
+ unregister_netdev(net);
+
usb_scuttle_anchored_urbs(&dev->deferred);
lan78xx_unbind(dev, intf);
--
2.16.1

View file

@ -0,0 +1,62 @@
From 8960ba68b681a62a523cc593773d5d03a413a075 Mon Sep 17 00:00:00 2001
From: Paul Zimmerman <Paul.Zimmerman@synopsys.com>
Date: Tue, 4 Feb 2014 11:21:24 -0800
Subject: [PATCH 287/297] usb: dwc_otg: fix memory corruption in dwc_otg driver
[Upstream commit 51b1b6491752ac066ee8d32cc66042fcc955fef6]
The move from the staging tree to the main tree exposed a
longstanding memory corruption bug in the dwc2 driver. The
reordering of the driver initialization caused the dwc2 driver
to corrupt the initialization data of the sdhci driver on the
Raspberry Pi platform, which made the bug show up.
The error is in calling to_usb_device(hsotg->dev), since ->dev
is not a member of struct usb_device. The easiest fix is to
just remove the offending code, since it is not really needed.
Thanks to Stephen Warren for tracking down the cause of this.
Reported-by: Andre Heider <a.heider@gmail.com>
Tested-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[lukas: port from upstream dwc2 to out-of-tree dwc_otg driver]
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
index 2ccd2a80dbef..ed9694058ed0 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
@@ -1012,25 +1012,11 @@ static void endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *ep)
static void endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep)
{
dwc_irqflags_t flags;
- struct usb_device *udev = NULL;
- int epnum = usb_endpoint_num(&ep->desc);
- int is_out = usb_endpoint_dir_out(&ep->desc);
- int is_control = usb_endpoint_xfer_control(&ep->desc);
dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd);
- struct device *dev = DWC_OTG_OS_GETDEV(dwc_otg_hcd->otg_dev->os_dep);
-
- if (dev)
- udev = to_usb_device(dev);
- else
- return;
DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD EP RESET: Endpoint Num=0x%02d\n", epnum);
DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags);
- usb_settoggle(udev, epnum, is_out, 0);
- if (is_control)
- usb_settoggle(udev, epnum, !is_out, 0);
-
if (ep->hcpriv) {
dwc_otg_hcd_endpoint_reset(dwc_otg_hcd, ep->hcpriv);
}
--
2.16.1

View file

@ -0,0 +1,362 @@
From 4332ceb0c6de3c82a25137ac354f36a8e71382f7 Mon Sep 17 00:00:00 2001
From: wavelet2 <a3d35232@btinternet.com>
Date: Mon, 26 Mar 2018 21:05:10 +0100
Subject: [PATCH 290/297] Add overlay for JEDEC SPI NOR flash
---
arch/arm/boot/dts/overlays/Makefile | 1 +
arch/arm/boot/dts/overlays/README | 9 +
.../boot/dts/overlays/jedec-spi-nor-overlay.dts | 309 +++++++++++++++++++++
3 files changed, 319 insertions(+)
create mode 100644 arch/arm/boot/dts/overlays/jedec-spi-nor-overlay.dts
diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile
index dcc64b5a3237..5439afd9b28c 100644
--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -55,6 +55,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
iqaudio-dac.dtbo \
iqaudio-dacplus.dtbo \
iqaudio-digi-wm8804-audio.dtbo \
+ jedec-spi-nor.dtbo \
justboom-dac.dtbo \
justboom-digi.dtbo \
lirc-rpi.dtbo \
diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
index dd2575cf7def..7ec84713cd06 100644
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -939,6 +939,15 @@ Params: card_name Override the default, "IQAudIODigi", card name.
dai stream name.
+Name: jedec-spi-nor
+Info: Adds support for JEDEC-compliant SPI NOR flash devices. (Note: The
+ "jedec,spi-nor" kernel driver was formerly known as "m25p80".)
+Load: dtoverlay=jedec-spi-nor,<param>=<val>
+Params: flash-spi<n>-<m> Enables flash device on SPI<n>, CS#<m>.
+ flash-fastr-spi<n>-<m> Enables flash device with fast read capability
+ on SPI<n>, CS#<m>.
+
+
Name: justboom-dac
Info: Configures the JustBoom DAC HAT, Amp HAT, DAC Zero and Amp Zero audio
cards
diff --git a/arch/arm/boot/dts/overlays/jedec-spi-nor-overlay.dts b/arch/arm/boot/dts/overlays/jedec-spi-nor-overlay.dts
new file mode 100644
index 000000000000..279e22efc013
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/jedec-spi-nor-overlay.dts
@@ -0,0 +1,309 @@
+// Overlay for JEDEC SPI-NOR Flash Devices (aka m25p80)
+
+// dtparams:
+// flash-spi<n>-<m> - Enables flash device on SPI<n>, CS#<m>.
+// flash-fastr-spi<n>-<m> - Enables flash device with fast read capability on SPI<n>, CS#<m>.
+//
+// If devices are present on SPI1 or SPI2, those interfaces must be enabled with one of the spi1-1/2/3cs and/or spi2-1/2/3cs overlays.
+//
+// Example: A single flash device with fast read capability on SPI0, CS#0:
+// dtoverlay=jedec-spi-nor:flash-fastr-spi0-0
+
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
+
+ // disable spi-dev on spi0.0
+ fragment@0 {
+ target = <&spidev0>;
+ __dormant__ {
+ status = "disabled";
+ };
+ };
+
+ // disable spi-dev on spi0.1
+ fragment@1 {
+ target = <&spidev1>;
+ __dormant__ {
+ status = "disabled";
+ };
+ };
+
+ // disable spi-dev on spi1.0
+ fragment@2 {
+ target-path = "spi1/spidev@0";
+ __dormant__ {
+ status = "disabled";
+ };
+ };
+
+ // disable spi-dev on spi1.1
+ fragment@3 {
+ target-path = "spi1/spidev@1";
+ __dormant__ {
+ status = "disabled";
+ };
+ };
+
+ // disable spi-dev on spi1.2
+ fragment@4 {
+ target-path = "spi1/spidev@2";
+ __dormant__ {
+ status = "disabled";
+ };
+ };
+
+ // disable spi-dev on spi2.0
+ fragment@5 {
+ target-path = "spi2/spidev@0";
+ __dormant__ {
+ status = "disabled";
+ };
+ };
+
+ // disable spi-dev on spi2.1
+ fragment@6 {
+ target-path = "spi2/spidev@1";
+ __dormant__ {
+ status = "disabled";
+ };
+ };
+
+ // disable spi-dev on spi2.2
+ fragment@7 {
+ target-path = "spi2/spidev@2";
+ __dormant__ {
+ status = "disabled";
+ };
+ };
+
+ // enable flash on spi0.0
+ fragment@8 {
+ target = <&spi0>;
+ __dormant__ {
+ status = "okay";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spi_nor_00: spi_nor@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <500000>;
+ };
+ };
+ };
+
+ // enable flash on spi0.1
+ fragment@9 {
+ target = <&spi0>;
+ __dormant__ {
+ status = "okay";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spi_nor_01: spi_nor@1 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "jedec,spi-nor";
+ reg = <1>;
+ spi-max-frequency = <500000>;
+ };
+ };
+ };
+
+ // enable flash on spi1.0
+ fragment@10 {
+ target = <&spi1>;
+ __dormant__ {
+ status = "okay";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spi_nor_10: spi_nor@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <500000>;
+ };
+ };
+ };
+
+ // enable flash on spi1.1
+ fragment@11 {
+ target = <&spi1>;
+ __dormant__ {
+ status = "okay";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spi_nor_11: spi_nor@1 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "jedec,spi-nor";
+ reg = <1>;
+ spi-max-frequency = <500000>;
+ };
+ };
+ };
+
+ // enable flash on spi1.2
+ fragment@12 {
+ target = <&spi1>;
+ __dormant__ {
+ status = "okay";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spi_nor_12: spi_nor@2 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "jedec,spi-nor";
+ reg = <2>;
+ spi-max-frequency = <500000>;
+ };
+ };
+ };
+
+ // enable flash on spi2.0
+ fragment@13 {
+ target = <&spi2>;
+ __dormant__ {
+ status = "okay";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spi_nor_20: spi_nor@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <500000>;
+ };
+ };
+ };
+
+ // enable flash on spi2.1
+ fragment@14 {
+ target = <&spi2>;
+ __dormant__ {
+ status = "okay";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spi_nor_21: spi_nor@1 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "jedec,spi-nor";
+ reg = <1>;
+ spi-max-frequency = <500000>;
+ };
+ };
+ };
+
+ // enable flash on spi2.2
+ fragment@15 {
+ target = <&spi2>;
+ __dormant__ {
+ status = "okay";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spi_nor_22: spi_nor@2 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "jedec,spi-nor";
+ reg = <2>;
+ spi-max-frequency = <500000>;
+ };
+ };
+ };
+
+ // Enable fast read for device on spi0.0.
+ // Use default active low interrupt signalling.
+ fragment@16 {
+ target = <&spi_nor_00>;
+ __dormant__ {
+ m25p,fast-read;
+ };
+ };
+
+ // Enable fast read for device on spi0.1.
+ // Use default active low interrupt signalling.
+ fragment@17 {
+ target = <&spi_nor_01>;
+ __dormant__ {
+ m25p,fast-read;
+ };
+ };
+
+ // Enable fast read for device on spi1.0.
+ // Use default active low interrupt signalling.
+ fragment@18 {
+ target = <&spi_nor_10>;
+ __dormant__ {
+ m25p,fast-read;
+ };
+ };
+
+ // Enable fast read for device on spi1.1.
+ // Use default active low interrupt signalling.
+ fragment@19 {
+ target = <&spi_nor_11>;
+ __dormant__ {
+ m25p,fast-read;
+ };
+ };
+
+ // Enable fast read for device on spi1.2.
+ // Use default active low interrupt signalling.
+ fragment@20 {
+ target = <&spi_nor_12>;
+ __dormant__ {
+ m25p,fast-read;
+ };
+ };
+
+ // Enable fast read for device on spi2.0.
+ // Use default active low interrupt signalling.
+ fragment@21 {
+ target = <&spi_nor_20>;
+ __dormant__ {
+ m25p,fast-read;
+ };
+ };
+
+ // Enable fast read for device on spi2.1.
+ // Use default active low interrupt signalling.
+ fragment@22 {
+ target = <&spi_nor_21>;
+ __dormant__ {
+ m25p,fast-read;
+ };
+ };
+
+ // Enable fast read for device on spi2.2.
+ // Use default active low interrupt signalling.
+ fragment@23 {
+ target = <&spi_nor_22>;
+ __dormant__ {
+ m25p,fast-read;
+ };
+ };
+
+ __overrides__ {
+ flash-spi0-0 = <0>,"+0+8";
+ flash-spi0-1 = <0>,"+1+9";
+ flash-spi1-0 = <0>,"+2+10";
+ flash-spi1-1 = <0>,"+3+11";
+ flash-spi1-2 = <0>,"+4+12";
+ flash-spi2-0 = <0>,"+5+13";
+ flash-spi2-1 = <0>,"+6+14";
+ flash-spi2-2 = <0>,"+7+15";
+ flash-fastr-spi0-0 = <0>,"+0+8+16";
+ flash-fastr-spi0-1 = <0>,"+1+9+17";
+ flash-fastr-spi1-0 = <0>,"+2+10+18";
+ flash-fastr-spi1-1 = <0>,"+3+11+19";
+ flash-fastr-spi1-2 = <0>,"+4+12+20";
+ flash-fastr-spi2-0 = <0>,"+5+13+21";
+ flash-fastr-spi2-1 = <0>,"+6+14+22";
+ flash-fastr-spi2-2 = <0>,"+7+15+23";
+ };
+};
+
--
2.16.1

View file

@ -0,0 +1,43 @@
From 55140f53d406070183b156ea56c6f6f76f7012d1 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date: Wed, 4 Apr 2018 16:34:24 +0100
Subject: [PATCH 291/297] net: lan78xx: Allow for VLAN headers in timeout.
The frame abort timeout being set by lan78xx_set_rx_max_frame_length
didn't account for any VLAN headers, resulting in very low
throughput if used with tagged VLANs.
Use VLAN_ETH_HLEN instead of ETH_HLEN to correct for this.
See https://github.com/raspberrypi/linux/issues/2458
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
drivers/net/usb/lan78xx.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index e7bdbd1accad..099c7a06e365 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2221,7 +2221,7 @@ static int lan78xx_change_mtu(struct net_device *netdev, int new_mtu)
if ((ll_mtu % dev->maxpacket) == 0)
return -EDOM;
- ret = lan78xx_set_rx_max_frame_length(dev, new_mtu + ETH_HLEN);
+ ret = lan78xx_set_rx_max_frame_length(dev, new_mtu + VLAN_ETH_HLEN);
netdev->mtu = new_mtu;
@@ -2511,7 +2511,8 @@ static int lan78xx_reset(struct lan78xx_net *dev)
buf |= FCT_TX_CTL_EN_;
ret = lan78xx_write_reg(dev, FCT_TX_CTL, buf);
- ret = lan78xx_set_rx_max_frame_length(dev, dev->net->mtu + ETH_HLEN);
+ ret = lan78xx_set_rx_max_frame_length(dev,
+ dev->net->mtu + VLAN_ETH_HLEN);
ret = lan78xx_read_reg(dev, MAC_RX, &buf);
buf |= MAC_RX_RXEN_;
--
2.16.1

View file

@ -0,0 +1,62 @@
From 8d51cdad7dfe77c6b5dfeb95e675d7c4036c9f0f Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Wed, 4 Apr 2018 16:56:49 +0100
Subject: [PATCH 292/297] Revert "lan78xx: Simple patch to prevent some
crashes"
This reverts commit 661230038a8736ba9023978c53cd21cd65739406.
---
drivers/net/usb/lan78xx.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 099c7a06e365..70490995022b 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2023,9 +2023,6 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
int i;
struct phy_device *phydev = dev->net->phydev;
- /* Return early if already initialised */
- if (phydev)
- return 0;
phydev = phy_find_first(dev->mdiobus);
if (!phydev) {
netdev_err(dev->net, "no PHY found\n");
@@ -2643,8 +2640,13 @@ static int lan78xx_stop(struct net_device *net)
if (timer_pending(&dev->stat_monitor))
del_timer_sync(&dev->stat_monitor);
- if (net->phydev)
- phy_stop(net->phydev);
+ phy_unregister_fixup_for_uid(PHY_KSZ9031RNX, 0xfffffff0);
+ phy_unregister_fixup_for_uid(PHY_LAN8835, 0xfffffff0);
+
+ phy_stop(net->phydev);
+ phy_disconnect(net->phydev);
+
+ net->phydev = NULL;
clear_bit(EVENT_DEV_OPEN, &dev->flags);
netif_stop_queue(net);
@@ -3542,16 +3544,10 @@ static void lan78xx_disconnect(struct usb_interface *intf)
udev = interface_to_usbdev(intf);
net = dev->net;
+ unregister_netdev(net);
cancel_delayed_work_sync(&dev->wq);
- phy_unregister_fixup_for_uid(PHY_KSZ9031RNX, 0xfffffff0);
- phy_unregister_fixup_for_uid(PHY_LAN8835, 0xfffffff0);
-
- phy_disconnect(net->phydev);
- net->phydev = NULL;
- unregister_netdev(net);
-
usb_scuttle_anchored_urbs(&dev->deferred);
lan78xx_unbind(dev, intf);
--
2.16.1

View file

@ -0,0 +1,172 @@
From c11ae4fec531878e4d416004912b3bd6dda7b432 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 4 Apr 2018 00:19:35 +0200
Subject: [PATCH 293/297] lan78xx: Connect phy early
When using wicked with a lan78xx device attached to the system, we
end up with ethtool commands issued on the device before an ifup
got issued. That lead to the following crash:
Unable to handle kernel NULL pointer dereference at virtual address 0000039c
pgd = ffff800035b30000
[0000039c] *pgd=0000000000000000
Internal error: Oops: 96000004 [#1] SMP
Modules linked in: [...]
Supported: Yes
CPU: 3 PID: 638 Comm: wickedd Tainted: G E 4.12.14-0-default #1
Hardware name: raspberrypi rpi/rpi, BIOS 2018.03-rc2 02/21/2018
task: ffff800035e74180 task.stack: ffff800036718000
PC is at phy_ethtool_ksettings_get+0x20/0x98
LR is at lan78xx_get_link_ksettings+0x44/0x60 [lan78xx]
pc : [<ffff0000086f7f30>] lr : [<ffff000000dcca84>] pstate: 20000005
sp : ffff80003671bb20
x29: ffff80003671bb20 x28: ffff800035e74180
x27: ffff000008912000 x26: 000000000000001d
x25: 0000000000000124 x24: ffff000008f74d00
x23: 0000004000114809 x22: 0000000000000000
x21: ffff80003671bbd0 x20: 0000000000000000
x19: ffff80003671bbd0 x18: 000000000000040d
x17: 0000000000000001 x16: 0000000000000000
x15: 0000000000000000 x14: ffffffffffffffff
x13: 0000000000000000 x12: 0000000000000020
x11: 0101010101010101 x10: fefefefefefefeff
x9 : 7f7f7f7f7f7f7f7f x8 : fefefeff31677364
x7 : 0000000080808080 x6 : ffff80003671bc9c
x5 : ffff80003671b9f8 x4 : ffff80002c296190
x3 : 0000000000000000 x2 : 0000000000000000
x1 : ffff80003671bbd0 x0 : ffff80003671bc00
Process wickedd (pid: 638, stack limit = 0xffff800036718000)
Call trace:
Exception stack(0xffff80003671b9e0 to 0xffff80003671bb20)
b9e0: ffff80003671bc00 ffff80003671bbd0 0000000000000000 0000000000000000
ba00: ffff80002c296190 ffff80003671b9f8 ffff80003671bc9c 0000000080808080
ba20: fefefeff31677364 7f7f7f7f7f7f7f7f fefefefefefefeff 0101010101010101
ba40: 0000000000000020 0000000000000000 ffffffffffffffff 0000000000000000
ba60: 0000000000000000 0000000000000001 000000000000040d ffff80003671bbd0
ba80: 0000000000000000 ffff80003671bbd0 0000000000000000 0000004000114809
baa0: ffff000008f74d00 0000000000000124 000000000000001d ffff000008912000
bac0: ffff800035e74180 ffff80003671bb20 ffff000000dcca84 ffff80003671bb20
bae0: ffff0000086f7f30 0000000020000005 ffff80002c296000 ffff800035223900
bb00: 0000ffffffffffff 0000000000000000 ffff80003671bb20 ffff0000086f7f30
[<ffff0000086f7f30>] phy_ethtool_ksettings_get+0x20/0x98
[<ffff000000dcca84>] lan78xx_get_link_ksettings+0x44/0x60 [lan78xx]
[<ffff0000087cbc40>] ethtool_get_settings+0x68/0x210
[<ffff0000087cc0d4>] dev_ethtool+0x214/0x2180
[<ffff0000087e5008>] dev_ioctl+0x400/0x630
[<ffff00000879dd00>] sock_do_ioctl+0x70/0x88
[<ffff00000879f5f8>] sock_ioctl+0x208/0x368
[<ffff0000082cde10>] do_vfs_ioctl+0xb0/0x848
[<ffff0000082ce634>] SyS_ioctl+0x8c/0xa8
Exception stack(0xffff80003671bec0 to 0xffff80003671c000)
bec0: 0000000000000009 0000000000008946 0000fffff4e841d0 0000aa0032687465
bee0: 0000aaaafa2319d4 0000fffff4e841d4 0000000032687465 0000000032687465
bf00: 000000000000001d 7f7fff7f7f7f7f7f 72606b622e71ff4c 7f7f7f7f7f7f7f7f
bf20: 0101010101010101 0000000000000020 ffffffffffffffff 0000ffff7f510c68
bf40: 0000ffff7f6a9d18 0000ffff7f44ce30 000000000000040d 0000ffff7f6f98f0
bf60: 0000fffff4e842c0 0000000000000001 0000aaaafa2c2e00 0000ffff7f6ab000
bf80: 0000fffff4e842c0 0000ffff7f62a000 0000aaaafa2b9f20 0000aaaafa2c2e00
bfa0: 0000fffff4e84818 0000fffff4e841a0 0000ffff7f5ad0cc 0000fffff4e841a0
bfc0: 0000ffff7f44ce3c 0000000080000000 0000000000000009 000000000000001d
bfe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
The culprit is quite simple: The driver tries to access the phy left and right,
but only actually has a working reference to it when the device is up.
The fix thus is quite simple too: Get a reference to the phy on probe already
and keep it even when the device is going down.
With this patch applied, I can successfully run wicked on my system and bring
the interface up and down as many times as I want, without getting NULL pointer
dereferences in between.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
drivers/net/usb/lan78xx.c | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 70490995022b..5c6972871b7b 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2119,10 +2119,6 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
dev->fc_autoneg = phydev->autoneg;
- phy_start(phydev);
-
- netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
-
return 0;
error:
@@ -2561,9 +2557,9 @@ static int lan78xx_open(struct net_device *net)
if (ret < 0)
goto done;
- ret = lan78xx_phy_init(dev);
- if (ret < 0)
- goto done;
+ phy_start(net->phydev);
+
+ netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
if (of_property_read_bool(dev->udev->dev.of_node,
"microchip,eee-enabled")) {
@@ -2640,13 +2636,8 @@ static int lan78xx_stop(struct net_device *net)
if (timer_pending(&dev->stat_monitor))
del_timer_sync(&dev->stat_monitor);
- phy_unregister_fixup_for_uid(PHY_KSZ9031RNX, 0xfffffff0);
- phy_unregister_fixup_for_uid(PHY_LAN8835, 0xfffffff0);
-
- phy_stop(net->phydev);
- phy_disconnect(net->phydev);
-
- net->phydev = NULL;
+ if (net->phydev)
+ phy_stop(net->phydev);
clear_bit(EVENT_DEV_OPEN, &dev->flags);
netif_stop_queue(net);
@@ -3542,8 +3533,13 @@ static void lan78xx_disconnect(struct usb_interface *intf)
return;
udev = interface_to_usbdev(intf);
-
net = dev->net;
+
+ phy_unregister_fixup_for_uid(PHY_KSZ9031RNX, 0xfffffff0);
+ phy_unregister_fixup_for_uid(PHY_LAN8835, 0xfffffff0);
+
+ phy_disconnect(net->phydev);
+
unregister_netdev(net);
cancel_delayed_work_sync(&dev->wq);
@@ -3703,8 +3699,14 @@ static int lan78xx_probe(struct usb_interface *intf,
pm_runtime_set_autosuspend_delay(&udev->dev,
DEFAULT_AUTOSUSPEND_DELAY);
+ ret = lan78xx_phy_init(dev);
+ if (ret < 0)
+ goto out4;
+
return 0;
+out4:
+ unregister_netdev(netdev);
out3:
lan78xx_unbind(dev, intf);
out2:
@@ -4052,7 +4054,7 @@ static int lan78xx_reset_resume(struct usb_interface *intf)
lan78xx_reset(dev);
- lan78xx_phy_init(dev);
+ phy_start(dev->net->phydev);
return lan78xx_resume(intf);
}
--
2.16.1

View file

@ -0,0 +1,36 @@
From b5b6bb9bdb5e62bc7dfc64b40bd833bffd971693 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Wed, 4 Apr 2018 16:39:44 +0100
Subject: [PATCH 294/297] lan78xx: Don't reset the interface on open
With Alexander Graf's patch ("lan78xx: Connect phy early") applied,
the call to lan78xx_reset within lan78xx_open prevents the phy
interrupt from being generated (even though the link is up).
Avoid this issue by removing the lan78xx_reset call.
See: https://github.com/raspberrypi/linux/issues/2437
https://github.com/raspberrypi/linux/issues/2442
https://github.com/raspberrypi/linux/issues/2457
---
drivers/net/usb/lan78xx.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 5c6972871b7b..b57e86f45434 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2553,10 +2553,6 @@ static int lan78xx_open(struct net_device *net)
if (ret < 0)
goto out;
- ret = lan78xx_reset(dev);
- if (ret < 0)
- goto done;
-
phy_start(net->phydev);
netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
--
2.16.1

View file

@ -0,0 +1,56 @@
From 924deccc8667392fa4daf305e56c68daa1369b5f Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Thu, 5 Apr 2018 12:49:00 +0100
Subject: [PATCH 295/297] config: Add BT_HCIUART_BCM=y and SERIAL_DEV_BUS=m
See: https://github.com/raspberrypi/linux/issues/2479
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
arch/arm/configs/bcm2709_defconfig | 2 ++
arch/arm/configs/bcmrpi_defconfig | 2 ++
2 files changed, 4 insertions(+)
diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
index ae321226db5f..cb348578d44f 100644
--- a/arch/arm/configs/bcm2709_defconfig
+++ b/arch/arm/configs/bcm2709_defconfig
@@ -374,6 +374,7 @@ CONFIG_BT_6LOWPAN=m
CONFIG_BT_HCIBTUSB=m
CONFIG_BT_HCIUART=m
CONFIG_BT_HCIUART_3WIRE=y
+CONFIG_BT_HCIUART_BCM=y
CONFIG_BT_HCIBCM203X=m
CONFIG_BT_HCIBPA10X=m
CONFIG_BT_HCIBFUSB=m
@@ -597,6 +598,7 @@ CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_SERIAL_SC16IS7XX=m
CONFIG_SERIAL_SC16IS7XX_SPI=y
+CONFIG_SERIAL_DEV_BUS=m
CONFIG_TTY_PRINTK=y
CONFIG_HW_RANDOM=y
CONFIG_RAW_DRIVER=y
diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
index 21f9acf849f6..12f20a105638 100644
--- a/arch/arm/configs/bcmrpi_defconfig
+++ b/arch/arm/configs/bcmrpi_defconfig
@@ -369,6 +369,7 @@ CONFIG_BT_6LOWPAN=m
CONFIG_BT_HCIBTUSB=m
CONFIG_BT_HCIUART=m
CONFIG_BT_HCIUART_3WIRE=y
+CONFIG_BT_HCIUART_BCM=y
CONFIG_BT_HCIBCM203X=m
CONFIG_BT_HCIBPA10X=m
CONFIG_BT_HCIBFUSB=m
@@ -592,6 +593,7 @@ CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_SERIAL_SC16IS7XX=m
CONFIG_SERIAL_SC16IS7XX_SPI=y
+CONFIG_SERIAL_DEV_BUS=m
CONFIG_TTY_PRINTK=y
CONFIG_HW_RANDOM=y
CONFIG_RAW_DRIVER=y
--
2.16.1

View file

@ -0,0 +1,28 @@
From 274cd7bcba6874bfb3d891d957845b3da7206be3 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Thu, 5 Apr 2018 13:29:02 +0100
Subject: [PATCH 296/297] arm64: Add CONFIG_SERIAL_DEV_BUS=m to
bcmrpi3_defconfig
See: https://github.com/raspberrypi/linux/issues/2479
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
arch/arm64/configs/bcmrpi3_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig
index 50acf25b1f28..69aea2f6da4a 100644
--- a/arch/arm64/configs/bcmrpi3_defconfig
+++ b/arch/arm64/configs/bcmrpi3_defconfig
@@ -595,6 +595,7 @@ CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_SERIAL_SC16IS7XX=m
CONFIG_SERIAL_SC16IS7XX_SPI=y
+CONFIG_SERIAL_DEV_BUS=m
CONFIG_TTY_PRINTK=y
CONFIG_HW_RANDOM=y
CONFIG_RAW_DRIVER=y
--
2.16.1

View file

@ -0,0 +1,69 @@
From c2eb30683b43b13b931bd9cfef6a2a09ac7b7c1e Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Thu, 5 Apr 2018 14:46:11 +0100
Subject: [PATCH 297/297] lan78xx: Move enabling of EEE into PHY init code
Enable EEE mode as soon as possible after connecting to the PHY, and
before phy_start. This avoids a second link negotiation, which speeds
up booting and stops the interface failing to become ready.
See: https://github.com/raspberrypi/linux/issues/2437
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/net/usb/lan78xx.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index b57e86f45434..3bc5ce4b73f9 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2093,6 +2093,22 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
mii_adv = (u32)mii_advertise_flowctrl(dev->fc_request_control);
phydev->advertising |= mii_adv_to_ethtool_adv_t(mii_adv);
+ if (of_property_read_bool(dev->udev->dev.of_node,
+ "microchip,eee-enabled")) {
+ struct ethtool_eee edata;
+ memset(&edata, 0, sizeof(edata));
+ edata.cmd = ETHTOOL_SEEE;
+ edata.advertised = ADVERTISED_1000baseT_Full |
+ ADVERTISED_100baseT_Full;
+ edata.eee_enabled = true;
+ edata.tx_lpi_enabled = true;
+ if (of_property_read_u32(dev->udev->dev.of_node,
+ "microchip,tx-lpi-timer",
+ &edata.tx_lpi_timer))
+ edata.tx_lpi_timer = 600; /* non-aggressive */
+ (void)lan78xx_set_eee(dev->net, &edata);
+ }
+
/* Set LED modes:
* led: 0=link/activity 1=link1000/activity
* 2=link100/activity 3=link10/activity
@@ -2557,22 +2573,6 @@ static int lan78xx_open(struct net_device *net)
netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
- if (of_property_read_bool(dev->udev->dev.of_node,
- "microchip,eee-enabled")) {
- struct ethtool_eee edata;
- memset(&edata, 0, sizeof(edata));
- edata.cmd = ETHTOOL_SEEE;
- edata.advertised = ADVERTISED_1000baseT_Full |
- ADVERTISED_100baseT_Full;
- edata.eee_enabled = true;
- edata.tx_lpi_enabled = true;
- if (of_property_read_u32(dev->udev->dev.of_node,
- "microchip,tx-lpi-timer",
- &edata.tx_lpi_timer))
- edata.tx_lpi_timer = 600; /* non-aggressive */
- (void)lan78xx_set_eee(net, &edata);
- }
-
/* for Link Check */
if (dev->urb_intr) {
ret = usb_submit_urb(dev->urb_intr, GFP_KERNEL);
--
2.16.1