bcm27xx: 6.1: add kernel patches
[openwrt/staging/jow.git] / target / linux / bcm27xx / patches-6.1 / 950-0513-net-bcmgenet-Add-eee-module-parameter.patch
1 From d69cdb1cc4e3f717f63910cb2c40ca26f912ea34 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Wed, 14 Dec 2022 15:00:51 +0000
4 Subject: [PATCH] net: bcmgenet: Add 'eee' module parameter
5
6 On some switches, having EEE enabled causes the link to become
7 unstable. With this patch, adding 'genet.eee=N' to the kernel command
8 line will cause EEE to be disabled on the link.
9
10 See: https://github.com/raspberrypi/linux/issues/4289
11
12 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
13 ---
14 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 14 ++++++++++++++
15 1 file changed, 14 insertions(+)
16
17 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
18 +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
19 @@ -70,6 +70,9 @@ static void bcmgenet_set_rx_mode(struct
20 static bool skip_umac_reset = false;
21 module_param(skip_umac_reset, bool, 0444);
22 MODULE_PARM_DESC(skip_umac_reset, "Skip UMAC reset step");
23 +static bool eee = true;
24 +module_param(eee, bool, 0444);
25 +MODULE_PARM_DESC(eee, "Enable EEE (default Y)");
26
27 static inline void bcmgenet_writel(u32 value, void __iomem *offset)
28 {
29 @@ -3441,6 +3444,17 @@ static int bcmgenet_open(struct net_devi
30
31 bcmgenet_phy_pause_set(dev, priv->rx_pause, priv->tx_pause);
32
33 + if (!eee) {
34 + struct ethtool_eee eee_data;
35 +
36 + ret = bcmgenet_get_eee(dev, &eee_data);
37 + if (ret == 0) {
38 + eee_data.eee_enabled = 0;
39 + bcmgenet_set_eee(dev, &eee_data);
40 + netdev_warn(dev, "EEE disabled\n");
41 + }
42 + }
43 +
44 bcmgenet_netif_start(dev);
45
46 netif_tx_start_all_queues(dev);