950-0189-net-bcmgenet-Workaround-2-for-Pi4-Ethernet-fail.patch 1.8 KB

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