mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 01:11:14 +00:00
f5919b65d4
Patch generation process: - rebase rpi/rpi-4.14.y on v4.14.89 from linux-stable - git format-patch v4.14.89 Patches skipped during rebase: - lan78xx: Read MAC address from DT if present - lan78xx: Enable LEDs and auto-negotiation - Revert "softirq: Let ksoftirqd do its job" - sc16is7xx: Fix for multi-channel stall - lan78xx: Ignore DT MAC address if already valid - lan78xx: Simple patch to prevent some crashes - tcp_write_queue_purge clears all the SKBs in the write queue - Revert "lan78xx: Simple patch to prevent some crashes" - lan78xx: Connect phy early - Arm: mm: ftrace: Only set text back to ro after kernel has been marked ro - Revert "Revert "softirq: Let ksoftirqd do its job"" - ASoC: cs4265: SOC_SINGLE register value error fix - Revert "ASoC: cs4265: SOC_SINGLE register value error fix" - Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends" - Revert "Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends"" Patches dropped after rebase: - net: Add non-mainline source for rtl8192cu wlan - net: Fix rtl8192cu build errors on other platforms - brcm: adds support for BCM43341 wifi - brcmfmac: Mute expected startup 'errors' - ARM64: Fix build break for RTL8187/RTL8192CU wifi - ARM64: Enable RTL8187/RTL8192CU wifi in build config - This is the driver for Sony CXD2880 DVB-T2/T tuner + demodulator - brcmfmac: add CLM download support - brcmfmac: request_firmware_direct is quieter - Sets the BCDC priority to constant 0 - brcmfmac: Disable ARP offloading when promiscuous - brcmfmac: Avoid possible out-of-bounds read - brcmfmac: Delete redundant length check - net: rtl8192cu: Normalize indentation - net: rtl8192cu: Fix implicit fallthrough warnings - Revert "Sets the BCDC priority to constant 0" - media: cxd2880: Bump to match 4.18.y version - media: cxd2880-spi: Bump to match 4.18.y version - Revert "mm: alloc_contig: re-allow CMA to compact FS pages" - Revert "Revert "mm: alloc_contig: re-allow CMA to compact FS pages"" - cxd2880: CXD2880_SPI_DRV should select DVB_CXD2880 with MEDIA_SUBDRV_AUTOSELECT - 950-0421-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch - 950-0453-Add-hid-bigbenff-to-list-of-have_special_driver-for-.patch Make I2C built-in instead of modular as in upstream defconfig; also the easiest way to get MFD_ARIZONA enabled, which is required by kmod-sound-soc-rpi-cirrus. Add missing compatible strings from 4.9/960-add-rasbperrypi-compatible.patch, using upstream names for compute modules. Add extra patch to enable the LEDs on lan78xx. Compile-tested: bcm2708, bcm2709, bcm2710 (with CONFIG_ALL_KMODS=y) Runtime-tested: bcm2708, bcm2710 Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
127 lines
3.9 KiB
Diff
127 lines
3.9 KiB
Diff
From 68502f802a66b68a6b5fefb52e709807a702a94b Mon Sep 17 00:00:00 2001
|
|
From: Phil Elwell <phil@raspberrypi.org>
|
|
Date: Mon, 26 Nov 2018 19:46:58 +0000
|
|
Subject: [PATCH 443/454] net: lan78xx: Support auto-downshift to 100Mb/s
|
|
|
|
Ethernet cables with faulty or missing pairs (specifically pairs C and
|
|
D) allow auto-negotiation to 1000Mbs, but do not support the successful
|
|
establishment of a link. Add a DT property, "microchip,downshift-after",
|
|
to configure the number of auto-negotiation failures after which it
|
|
falls back to 100Mbs. Valid values are 2, 3, 4, 5 and 0, where 0 means
|
|
never downshift.
|
|
|
|
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
|
---
|
|
drivers/net/phy/microchip.c | 33 +++++++++++++++++++++++++++++++++
|
|
drivers/net/usb/lan78xx.c | 8 ++++++--
|
|
include/linux/microchipphy.h | 11 +++++++++++
|
|
3 files changed, 50 insertions(+), 2 deletions(-)
|
|
|
|
--- a/drivers/net/phy/microchip.c
|
|
+++ b/drivers/net/phy/microchip.c
|
|
@@ -21,6 +21,7 @@
|
|
#include <linux/phy.h>
|
|
#include <linux/microchipphy.h>
|
|
#include <linux/delay.h>
|
|
+#include <linux/of.h>
|
|
|
|
#define DRIVER_AUTHOR "WOOJUNG HUH <woojung.huh@microchip.com>"
|
|
#define DRIVER_DESC "Microchip LAN88XX PHY driver"
|
|
@@ -225,6 +226,7 @@ static int lan88xx_probe(struct phy_devi
|
|
{
|
|
struct device *dev = &phydev->mdio.dev;
|
|
struct lan88xx_priv *priv;
|
|
+ u32 downshift_after = 0;
|
|
|
|
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
|
if (!priv)
|
|
@@ -232,6 +234,37 @@ static int lan88xx_probe(struct phy_devi
|
|
|
|
priv->wolopts = 0;
|
|
|
|
+ if (!of_property_read_u32(dev->of_node,
|
|
+ "microchip,downshift-after",
|
|
+ &downshift_after)) {
|
|
+ u32 mask = LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_MASK;
|
|
+ u32 val = LAN78XX_PHY_CTRL3_AUTO_DOWNSHIFT;
|
|
+
|
|
+ switch (downshift_after) {
|
|
+ case 2:
|
|
+ val |= LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_2;
|
|
+ break;
|
|
+ case 3:
|
|
+ val |= LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_3;
|
|
+ break;
|
|
+ case 4:
|
|
+ val |= LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_4;
|
|
+ break;
|
|
+ case 5:
|
|
+ val |= LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_5;
|
|
+ break;
|
|
+ case 0:
|
|
+ /* Disable completely */
|
|
+ mask = LAN78XX_PHY_CTRL3_AUTO_DOWNSHIFT;
|
|
+ val = 0;
|
|
+ break;
|
|
+ default:
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ (void)phy_modify_paged(phydev, 1, LAN78XX_PHY_CTRL3,
|
|
+ mask, val);
|
|
+ }
|
|
+
|
|
/* these values can be used to identify internal PHY */
|
|
priv->chip_id = phy_read_mmd(phydev, 3, LAN88XX_MMD3_CHIP_ID);
|
|
priv->chip_rev = phy_read_mmd(phydev, 3, LAN88XX_MMD3_CHIP_REV);
|
|
--- a/drivers/net/usb/lan78xx.c
|
|
+++ b/drivers/net/usb/lan78xx.c
|
|
@@ -36,7 +36,8 @@
|
|
#include <linux/irq.h>
|
|
#include <linux/irqchip/chained_irq.h>
|
|
#include <linux/microchipphy.h>
|
|
-#include <linux/phy.h>
|
|
+#include <linux/phy_fixed.h>
|
|
+#include <linux/of_mdio.h>
|
|
#include <linux/of_net.h>
|
|
#include "lan78xx.h"
|
|
|
|
@@ -1763,6 +1764,7 @@ done:
|
|
|
|
static int lan78xx_mdio_init(struct lan78xx_net *dev)
|
|
{
|
|
+ struct device_node *node;
|
|
int ret;
|
|
|
|
dev->mdiobus = mdiobus_alloc();
|
|
@@ -1791,7 +1793,9 @@ static int lan78xx_mdio_init(struct lan7
|
|
break;
|
|
}
|
|
|
|
- ret = mdiobus_register(dev->mdiobus);
|
|
+ node = of_get_child_by_name(dev->udev->dev.of_node, "mdio");
|
|
+ ret = of_mdiobus_register(dev->mdiobus, node);
|
|
+ of_node_put(node);
|
|
if (ret) {
|
|
netdev_err(dev->net, "can't register MDIO bus\n");
|
|
goto exit1;
|
|
--- a/include/linux/microchipphy.h
|
|
+++ b/include/linux/microchipphy.h
|
|
@@ -70,6 +70,17 @@
|
|
#define LAN88XX_MMD3_CHIP_ID (32877)
|
|
#define LAN88XX_MMD3_CHIP_REV (32878)
|
|
|
|
+/* Registers specific to the LAN7800/LAN7850 embedded phy */
|
|
+#define LAN78XX_PHY_LED_MODE_SELECT (0x1D)
|
|
+
|
|
+#define LAN78XX_PHY_CTRL3 (0x14)
|
|
+#define LAN78XX_PHY_CTRL3_AUTO_DOWNSHIFT (0x0010)
|
|
+#define LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_MASK (0x000c)
|
|
+#define LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_2 (0x0000)
|
|
+#define LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_3 (0x0004)
|
|
+#define LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_4 (0x0008)
|
|
+#define LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_5 (0x000c)
|
|
+
|
|
/* DSP registers */
|
|
#define PHY_ARDENNES_MMD_DEV_3_PHY_CFG (0x806A)
|
|
#define PHY_ARDENNES_MMD_DEV_3_PHY_CFG_ZD_DLY_EN_ (0x2000)
|