807-v6.5-06-net-dsa-mv88e6xxx-enable-support-for-88E6361-switch.patch 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. From 23680321789863bab2d60af507858ce50ff9f56a Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Alexis=20Lothor=C3=A9?= <[email protected]>
  3. Date: Mon, 29 May 2023 10:02:46 +0200
  4. Subject: [PATCH 6/6] net: dsa: mv88e6xxx: enable support for 88E6361 switch
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Marvell 88E6361 is an 8-port switch derived from the
  9. 88E6393X/88E9193X/88E6191X switches family. It can benefit from the
  10. existing mv88e6xxx driver by simply adding the proper switch description in
  11. the driver. Main differences with other switches from this
  12. family are:
  13. - 8 ports exposed (instead of 11): ports 1, 2 and 8 not available
  14. - No 5GBase-x nor SFI/USXGMII support
  15. Signed-off-by: Alexis Lothoré <[email protected]>
  16. Reviewed-by: Andrew Lunn <[email protected]>
  17. Signed-off-by: Jakub Kicinski <[email protected]>
  18. ---
  19. drivers/net/dsa/mv88e6xxx/chip.c | 42 ++++++++++++++++++++++++++++----
  20. drivers/net/dsa/mv88e6xxx/chip.h | 3 ++-
  21. drivers/net/dsa/mv88e6xxx/port.c | 14 ++++++++---
  22. drivers/net/dsa/mv88e6xxx/port.h | 1 +
  23. 4 files changed, 51 insertions(+), 9 deletions(-)
  24. --- a/drivers/net/dsa/mv88e6xxx/chip.c
  25. +++ b/drivers/net/dsa/mv88e6xxx/chip.c
  26. @@ -797,6 +797,8 @@ static void mv88e6393x_phylink_get_caps(
  27. unsigned long *supported = config->supported_interfaces;
  28. bool is_6191x =
  29. chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6191X;
  30. + bool is_6361 =
  31. + chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6361;
  32. mv88e6xxx_translate_cmode(chip->ports[port].cmode, supported);
  33. @@ -811,13 +813,17 @@ static void mv88e6393x_phylink_get_caps(
  34. /* 6191X supports >1G modes only on port 10 */
  35. if (!is_6191x || port == 10) {
  36. __set_bit(PHY_INTERFACE_MODE_2500BASEX, supported);
  37. - __set_bit(PHY_INTERFACE_MODE_5GBASER, supported);
  38. - __set_bit(PHY_INTERFACE_MODE_10GBASER, supported);
  39. + config->mac_capabilities |= MAC_2500FD;
  40. +
  41. + /* 6361 only supports up to 2500BaseX */
  42. + if (!is_6361) {
  43. + __set_bit(PHY_INTERFACE_MODE_5GBASER, supported);
  44. + __set_bit(PHY_INTERFACE_MODE_10GBASER, supported);
  45. + config->mac_capabilities |= MAC_5000FD |
  46. + MAC_10000FD;
  47. + }
  48. /* FIXME: USXGMII is not supported yet */
  49. /* __set_bit(PHY_INTERFACE_MODE_USXGMII, supported); */
  50. -
  51. - config->mac_capabilities |= MAC_2500FD | MAC_5000FD |
  52. - MAC_10000FD;
  53. }
  54. }
  55. @@ -6231,6 +6237,32 @@ static const struct mv88e6xxx_info mv88e
  56. .ptp_support = true,
  57. .ops = &mv88e6352_ops,
  58. },
  59. + [MV88E6361] = {
  60. + .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6361,
  61. + .family = MV88E6XXX_FAMILY_6393,
  62. + .name = "Marvell 88E6361",
  63. + .num_databases = 4096,
  64. + .num_macs = 16384,
  65. + .num_ports = 11,
  66. + /* Ports 1, 2 and 8 are not routed */
  67. + .invalid_port_mask = BIT(1) | BIT(2) | BIT(8),
  68. + .num_internal_phys = 5,
  69. + .internal_phys_offset = 3,
  70. + .max_vid = 4095,
  71. + .max_sid = 63,
  72. + .port_base_addr = 0x0,
  73. + .phy_base_addr = 0x0,
  74. + .global1_addr = 0x1b,
  75. + .global2_addr = 0x1c,
  76. + .age_time_coeff = 3750,
  77. + .g1_irqs = 10,
  78. + .g2_irqs = 14,
  79. + .atu_move_port_mask = 0x1f,
  80. + .pvt = true,
  81. + .multi_chip = true,
  82. + .ptp_support = true,
  83. + .ops = &mv88e6393x_ops,
  84. + },
  85. [MV88E6390] = {
  86. .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6390,
  87. .family = MV88E6XXX_FAMILY_6390,
  88. --- a/drivers/net/dsa/mv88e6xxx/chip.h
  89. +++ b/drivers/net/dsa/mv88e6xxx/chip.h
  90. @@ -82,6 +82,7 @@ enum mv88e6xxx_model {
  91. MV88E6350,
  92. MV88E6351,
  93. MV88E6352,
  94. + MV88E6361,
  95. MV88E6390,
  96. MV88E6390X,
  97. MV88E6393X,
  98. @@ -100,7 +101,7 @@ enum mv88e6xxx_family {
  99. MV88E6XXX_FAMILY_6351, /* 6171 6175 6350 6351 */
  100. MV88E6XXX_FAMILY_6352, /* 6172 6176 6240 6352 */
  101. MV88E6XXX_FAMILY_6390, /* 6190 6190X 6191 6290 6390 6390X */
  102. - MV88E6XXX_FAMILY_6393, /* 6191X 6193X 6393X */
  103. + MV88E6XXX_FAMILY_6393, /* 6191X 6193X 6361 6393X */
  104. };
  105. /**
  106. --- a/drivers/net/dsa/mv88e6xxx/port.c
  107. +++ b/drivers/net/dsa/mv88e6xxx/port.c
  108. @@ -424,6 +424,10 @@ int mv88e6393x_port_set_speed_duplex(str
  109. u16 reg, ctrl;
  110. int err;
  111. + if (chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6361 &&
  112. + speed > 2500)
  113. + return -EOPNOTSUPP;
  114. +
  115. if (speed == 200 && port != 0)
  116. return -EOPNOTSUPP;
  117. @@ -506,10 +510,14 @@ int mv88e6393x_port_set_speed_duplex(str
  118. phy_interface_t mv88e6393x_port_max_speed_mode(struct mv88e6xxx_chip *chip,
  119. int port)
  120. {
  121. - if (port == 0 || port == 9 || port == 10)
  122. - return PHY_INTERFACE_MODE_10GBASER;
  123. - return PHY_INTERFACE_MODE_NA;
  124. + if (port != 0 && port != 9 && port != 10)
  125. + return PHY_INTERFACE_MODE_NA;
  126. +
  127. + if (chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6361)
  128. + return PHY_INTERFACE_MODE_2500BASEX;
  129. +
  130. + return PHY_INTERFACE_MODE_10GBASER;
  131. }
  132. static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
  133. --- a/drivers/net/dsa/mv88e6xxx/port.h
  134. +++ b/drivers/net/dsa/mv88e6xxx/port.h
  135. @@ -133,6 +133,7 @@
  136. #define MV88E6XXX_PORT_SWITCH_ID_PROD_6220 0x2200
  137. #define MV88E6XXX_PORT_SWITCH_ID_PROD_6240 0x2400
  138. #define MV88E6XXX_PORT_SWITCH_ID_PROD_6250 0x2500
  139. +#define MV88E6XXX_PORT_SWITCH_ID_PROD_6361 0x2610
  140. #define MV88E6XXX_PORT_SWITCH_ID_PROD_6290 0x2900
  141. #define MV88E6XXX_PORT_SWITCH_ID_PROD_6321 0x3100
  142. #define MV88E6XXX_PORT_SWITCH_ID_PROD_6141 0x3400