2
0

774-net-dsa-b53-mmap-allow-passing-a-chip-ID.patch 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. From patchwork Tue Mar 21 17:33:58 2023
  2. Content-Type: text/plain; charset="utf-8"
  3. MIME-Version: 1.0
  4. Content-Transfer-Encoding: 8bit
  5. X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=
  6. <[email protected]>
  7. X-Patchwork-Id: 13183004
  8. X-Patchwork-Delegate: [email protected]
  9. Return-Path: <[email protected]>
  10. X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
  11. aws-us-west-2-korg-lkml-1.web.codeaurora.org
  12. Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
  13. by smtp.lore.kernel.org (Postfix) with ESMTP id B2B12C74A5B
  14. for <[email protected]>; Tue, 21 Mar 2023 17:35:12 +0000 (UTC)
  15. Received: ([email protected]) by vger.kernel.org via listexpand
  16. id S230297AbjCURfK (ORCPT <rfc822;[email protected]>);
  17. Tue, 21 Mar 2023 13:35:10 -0400
  18. Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47438 "EHLO
  19. lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
  20. with ESMTP id S230374AbjCURex (ORCPT
  21. <rfc822;[email protected]>); Tue, 21 Mar 2023 13:34:53 -0400
  22. Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com
  23. [IPv6:2a00:1450:4864:20::432])
  24. by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C906B5550A;
  25. Tue, 21 Mar 2023 10:34:26 -0700 (PDT)
  26. Received: by mail-wr1-x432.google.com with SMTP id y14so14546846wrq.4;
  27. Tue, 21 Mar 2023 10:34:26 -0700 (PDT)
  28. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
  29. d=gmail.com; s=20210112; t=1679420064;
  30. h=content-transfer-encoding:mime-version:references:in-reply-to
  31. :message-id:date:subject:cc:to:from:from:to:cc:subject:date
  32. :message-id:reply-to;
  33. bh=vnvnwWc5Tmg09HBQo/m9RbRM6yM8KLx8r1VA+Abfg3k=;
  34. b=eFv+mwe94Y2YZMiJP5gydXVrGlbIAR5HCrY0rdcoGoMPzQUHLFckZeYCgEKudI55I7
  35. gMLZYCtLwvDXvKeHM2AUigsq2YuJSeF5QwICPrhTnMwUGBg4yyyltrc3+J0lSd6/4kQv
  36. h0yM1Oo4v0d8CuqjBU6bXienIk34AFVJfsPq+vWQTjAbUL7ht4WHZ2Ez2MFoTvZpkIJA
  37. 5iWMyVoMbugZl6eqNRjvDHFmtBtrZIv8AFs10r2Ca6+Yxm+aq0v33DRkbSVVqgFPNEzy
  38. q5QOXOeLBPL6BvyovOpmVSWGoHf1zFV7lrzcqi+uc+FuYxQ9dyN3ND73DrrhWSkLaSg9
  39. r8yA==
  40. X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
  41. d=1e100.net; s=20210112; t=1679420064;
  42. h=content-transfer-encoding:mime-version:references:in-reply-to
  43. :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
  44. :subject:date:message-id:reply-to;
  45. bh=vnvnwWc5Tmg09HBQo/m9RbRM6yM8KLx8r1VA+Abfg3k=;
  46. b=jIRB8pIlrLA/ovhnEoePs/6SX8fn6l7l4fY2CxX2pLrTbP1JI8AAetPavvrNVQTr2M
  47. Vm0iLbKyL/VpTq9+bSN1SMjaoi4lAMj0pgafoHrwABMVZpFauYvtCfSYTstZ2pw4Dr1j
  48. wYQGj3BUSpFIYHtSIDMkb5449WA3T3TONhaQLRFAUCBD6gAFyEky5fY+DIHrGaj352B6
  49. 9ST/tkqHgPpuFlmromr42KQWoTFU+Pj0Uhyp7ru4BsnF7tTshWroZZIHUJmSACudEadr
  50. fBPiuurX9jgp9zNqj8Oy0HjiVUnULFCapj8yICGp5s44uDAK/XFqFXpOuJ8ptS6uPazU
  51. xUwg==
  52. X-Gm-Message-State: AO0yUKX2w6QZfaGDHtlZAlY/U8F8VuJa3HwlgXbxgGChgdgvIoFThawv
  53. oDyFAhWbVfe4DxwXTwxgJ/I=
  54. X-Google-Smtp-Source:
  55. AK7set+sH60XiJYup7bqrZTzFJVNe1YGcX/UTfjWV9xfGwNyodc34cHvKpqNagw5J+vEpv6CKvNHaA==
  56. X-Received: by 2002:adf:f344:0:b0:2cd:de25:1c76 with SMTP id
  57. e4-20020adff344000000b002cdde251c76mr12989754wrp.17.1679420064464;
  58. Tue, 21 Mar 2023 10:34:24 -0700 (PDT)
  59. Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net.
  60. [79.146.124.255])
  61. by smtp.gmail.com with ESMTPSA id
  62. b13-20020a056000054d00b002da1261aa44sm184775wrf.48.2023.03.21.10.34.22
  63. (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
  64. Tue, 21 Mar 2023 10:34:23 -0700 (PDT)
  65. From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <[email protected]>
  66. To: [email protected], [email protected], [email protected],
  67. [email protected], [email protected], [email protected],
  68. [email protected], [email protected], [email protected],
  69. [email protected], [email protected],
  70. [email protected], [email protected]
  71. Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <[email protected]>
  72. Subject: [PATCH v2 3/4] net: dsa: b53: mmap: allow passing a chip ID
  73. Date: Tue, 21 Mar 2023 18:33:58 +0100
  74. Message-Id: <[email protected]>
  75. X-Mailer: git-send-email 2.30.2
  76. In-Reply-To: <[email protected]>
  77. References: <[email protected]>
  78. <[email protected]>
  79. MIME-Version: 1.0
  80. Precedence: bulk
  81. List-ID: <netdev.vger.kernel.org>
  82. X-Mailing-List: [email protected]
  83. X-Patchwork-Delegate: [email protected]
  84. BCM6318 and BCM63268 SoCs require a special handling for their RGMIIs, so we
  85. should be able to identify them as a special BCM63xx switch.
  86. Signed-off-by: Álvaro Fernández Rojas <[email protected]>
  87. ---
  88. v2:
  89. - Add missing chip to b53_switch_chips[].
  90. - Fix device_get_match_data() casting warning.
  91. - Add BCM63268_DEVICE_ID to BCM6318 too.
  92. - Add BCM6318 in commit description.
  93. drivers/net/dsa/b53/b53_common.c | 13 +++++++++++++
  94. drivers/net/dsa/b53/b53_mmap.c | 32 +++++++++++++++++++++++---------
  95. drivers/net/dsa/b53/b53_priv.h | 9 ++++++++-
  96. 3 files changed, 44 insertions(+), 10 deletions(-)
  97. --- a/drivers/net/dsa/b53/b53_common.c
  98. +++ b/drivers/net/dsa/b53/b53_common.c
  99. @@ -2466,6 +2466,19 @@ static const struct b53_chip_data b53_sw
  100. .jumbo_size_reg = B53_JUMBO_MAX_SIZE_63XX,
  101. },
  102. {
  103. + .chip_id = BCM63268_DEVICE_ID,
  104. + .dev_name = "BCM63268",
  105. + .vlans = 4096,
  106. + .enabled_ports = 0, /* pdata must provide them */
  107. + .arl_bins = 4,
  108. + .arl_buckets = 1024,
  109. + .imp_port = 8,
  110. + .vta_regs = B53_VTA_REGS_63XX,
  111. + .duplex_reg = B53_DUPLEX_STAT_63XX,
  112. + .jumbo_pm_reg = B53_JUMBO_PORT_MASK_63XX,
  113. + .jumbo_size_reg = B53_JUMBO_MAX_SIZE_63XX,
  114. + },
  115. + {
  116. .chip_id = BCM53010_DEVICE_ID,
  117. .dev_name = "BCM53010",
  118. .vlans = 4096,
  119. --- a/drivers/net/dsa/b53/b53_mmap.c
  120. +++ b/drivers/net/dsa/b53/b53_mmap.c
  121. @@ -262,7 +262,7 @@ static int b53_mmap_probe_of(struct plat
  122. return -ENOMEM;
  123. pdata->regs = mem;
  124. - pdata->chip_id = BCM63XX_DEVICE_ID;
  125. + pdata->chip_id = (u32)(unsigned long)device_get_match_data(dev);
  126. pdata->big_endian = of_property_read_bool(np, "big-endian");
  127. of_ports = of_get_child_by_name(np, "ports");
  128. @@ -344,14 +344,28 @@ static void b53_mmap_shutdown(struct pla
  129. }
  130. static const struct of_device_id b53_mmap_of_table[] = {
  131. - { .compatible = "brcm,bcm3384-switch" },
  132. - { .compatible = "brcm,bcm6318-switch" },
  133. - { .compatible = "brcm,bcm6328-switch" },
  134. - { .compatible = "brcm,bcm6362-switch" },
  135. - { .compatible = "brcm,bcm6368-switch" },
  136. - { .compatible = "brcm,bcm63268-switch" },
  137. - { .compatible = "brcm,bcm63xx-switch" },
  138. - { /* sentinel */ },
  139. + {
  140. + .compatible = "brcm,bcm3384-switch",
  141. + .data = (void *)BCM63XX_DEVICE_ID,
  142. + }, {
  143. + .compatible = "brcm,bcm6318-switch",
  144. + .data = (void *)BCM63268_DEVICE_ID,
  145. + }, {
  146. + .compatible = "brcm,bcm6328-switch",
  147. + .data = (void *)BCM63XX_DEVICE_ID,
  148. + }, {
  149. + .compatible = "brcm,bcm6362-switch",
  150. + .data = (void *)BCM63XX_DEVICE_ID,
  151. + }, {
  152. + .compatible = "brcm,bcm6368-switch",
  153. + .data = (void *)BCM63XX_DEVICE_ID,
  154. + }, {
  155. + .compatible = "brcm,bcm63268-switch",
  156. + .data = (void *)BCM63268_DEVICE_ID,
  157. + }, {
  158. + .compatible = "brcm,bcm63xx-switch",
  159. + .data = (void *)BCM63XX_DEVICE_ID,
  160. + }, { /* sentinel */ }
  161. };
  162. MODULE_DEVICE_TABLE(of, b53_mmap_of_table);
  163. --- a/drivers/net/dsa/b53/b53_priv.h
  164. +++ b/drivers/net/dsa/b53/b53_priv.h
  165. @@ -70,6 +70,7 @@ enum {
  166. BCM53125_DEVICE_ID = 0x53125,
  167. BCM53128_DEVICE_ID = 0x53128,
  168. BCM63XX_DEVICE_ID = 0x6300,
  169. + BCM63268_DEVICE_ID = 0x63268,
  170. BCM53010_DEVICE_ID = 0x53010,
  171. BCM53011_DEVICE_ID = 0x53011,
  172. BCM53012_DEVICE_ID = 0x53012,
  173. @@ -191,7 +192,13 @@ static inline int is531x5(struct b53_dev
  174. static inline int is63xx(struct b53_device *dev)
  175. {
  176. - return dev->chip_id == BCM63XX_DEVICE_ID;
  177. + return dev->chip_id == BCM63XX_DEVICE_ID ||
  178. + dev->chip_id == BCM63268_DEVICE_ID;
  179. +}
  180. +
  181. +static inline int is63268(struct b53_device *dev)
  182. +{
  183. + return dev->chip_id == BCM63268_DEVICE_ID;
  184. }
  185. static inline int is5301x(struct b53_device *dev)