kernel: bump 5.4 to 5.4.48
[oweals/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0295-net-bcmgenet-Workaround-2-for-Pi4-Ethernet-fail.patch
1 From 128e363e406841fbbd9800199cb093b4737d7cba Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Fri, 9 Aug 2019 08:51:43 +0100
4 Subject: [PATCH] net: bcmgenet: Workaround #2 for Pi4 Ethernet fail
5
6 Some combinations of Pi 4Bs and Ethernet switches don't reliably get a
7 DCHP-assigned IP address, leaving the unit with a self=assigned 169.254
8 address. In the failure case, the Pi is left able to receive packets
9 but not send them, suggesting that the MAC<->PHY link is getting into
10 a bad state.
11
12 It has been found empirically that skipping a reset step by the genet
13 driver prevents the failures. No downsides have been discovered yet,
14 and unlike the forced renegotiation it doesn't increase the time to
15 get an IP address, so the workaround is enabled by default; add
16
17   genet.skip_umac_reset=n
18
19 to the command line to disable it.
20
21 See: https://github.com/raspberrypi/linux/issues/3108
22
23 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
24 ---
25  drivers/net/ethernet/broadcom/genet/bcmgenet.c | 9 +++++++++
26  1 file changed, 9 insertions(+)
27
28 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
29 +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
30 @@ -72,6 +72,10 @@
31  /* Forward declarations */
32  static void bcmgenet_set_rx_mode(struct net_device *dev);
33  
34 +static bool skip_umac_reset = true;
35 +module_param(skip_umac_reset, bool, 0444);
36 +MODULE_PARM_DESC(skip_umac_reset, "Skip UMAC reset step");
37 +
38  static inline void bcmgenet_writel(u32 value, void __iomem *offset)
39  {
40         /* MIPS chips strapped for BE will automagically configure the
41 @@ -1997,6 +2001,11 @@ static void reset_umac(struct bcmgenet_p
42         bcmgenet_rbuf_ctrl_set(priv, 0);
43         udelay(10);
44  
45 +       if (skip_umac_reset) {
46 +               pr_warn("Skipping UMAC reset\n");
47 +               return;
48 +       }
49 +
50         /* disable MAC while updating its registers */
51         bcmgenet_umac_writel(priv, 0, UMAC_CMD);
52