408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From d8237d704fc25eb2fc25ef4403608b78c6a6d4be Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <jonas.gorski@gmail.com>
  3. Date: Sun, 15 Jul 2012 20:08:57 +0200
  4. Subject: [PATCH 54/81] bcm63xx_enet: enable rgmii clock on external ports
  5. ---
  6. arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 13 +++++++++++++
  7. drivers/net/ethernet/broadcom/bcm63xx_enet.c | 12 ++++++++++++
  8. 2 files changed, 25 insertions(+), 0 deletions(-)
  9. --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
  10. +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
  11. @@ -967,6 +967,19 @@
  12. #define ENETSW_PORTOV_FDX_MASK (1 << 1)
  13. #define ENETSW_PORTOV_LINKUP_MASK (1 << 0)
  14. +/* Port RGMII control register */
  15. +#define ENETSW_RGMII_CTRL_REG(x) (0x60 + (x))
  16. +#define ENETSW_RGMII_CTRL_GMII_CLK_EN (1 << 7)
  17. +#define ENETSW_RGMII_CTRL_MII_OVERRIDE_EN (1 << 6)
  18. +#define ENETSW_RGMII_CTRL_MII_MODE_MASK (3 << 4)
  19. +#define ENETSW_RGMII_CTRL_RGMII_MODE (0 << 4)
  20. +#define ENETSW_RGMII_CTRL_MII_MODE (1 << 4)
  21. +#define ENETSW_RGMII_CTRL_RVMII_MODE (2 << 4)
  22. +#define ENETSW_RGMII_CTRL_TIMING_SEL_EN (1 << 0)
  23. +
  24. +/* Port RGMII timing register */
  25. +#define ENETSW_RGMII_TIMING_REG(x) (0x68 + (x))
  26. +
  27. /* MDIO control register */
  28. #define ENETSW_MDIOC_REG (0xb0)
  29. #define ENETSW_MDIOC_EXT_MASK (1 << 16)
  30. --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
  31. +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
  32. @@ -2237,6 +2237,18 @@ static int bcm_enetsw_open(struct net_de
  33. priv->sw_port_link[i] = 0;
  34. }
  35. + /* enable external ports */
  36. + for (i = ENETSW_RGMII_PORT0; i < priv->num_ports; i++) {
  37. + u8 rgmii_ctrl;
  38. +
  39. + if (!priv->used_ports[i].used)
  40. + continue;
  41. +
  42. + rgmii_ctrl = enetsw_readb(priv, ENETSW_RGMII_CTRL_REG(i));
  43. + rgmii_ctrl |= ENETSW_RGMII_CTRL_GMII_CLK_EN;
  44. + enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i));
  45. + }
  46. +
  47. /* reset mib */
  48. val = enetsw_readb(priv, ENETSW_GMCR_REG);
  49. val |= ENETSW_GMCR_RST_MIB_MASK;