kernel: add more dsa b53 pending patches
authorÁlvaro Fernández Rojas <noltari@gmail.com>
Fri, 24 Mar 2023 09:05:23 +0000 (10:05 +0100)
committerÁlvaro Fernández Rojas <noltari@gmail.com>
Fri, 24 Mar 2023 10:23:42 +0000 (11:23 +0100)
These patches have now received a positive review upstream, so let's add them
to pending patches.

776-net-dsa-b53-mmap-add-phy-ops.patch:
  This is mostly bmips/bcm63xx-specific to get external switches working
  without hanging the device when accessing certain registers.

777-net-dsa-b53-mdio-add-support-for-BCM53134:
  This adds support for BCM53134 switch on DSA B53, so any target using DSA B53
  can benefit from it.

Also fix sercomm-h500-s external switch IMP port phy-mode.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi
target/linux/bmips/patches-5.15/510-net-dsa-b53-mmap-disable-phy-read-write-ops.patch [deleted file]
target/linux/bmips/patches-5.15/520-net-dsa-b53-add-bcm53134-support.patch [deleted file]
target/linux/generic/pending-5.15/776-net-dsa-b53-mmap-add-phy-ops.patch [new file with mode: 0644]
target/linux/generic/pending-5.15/777-net-dsa-b53-mdio-add-support-for-BCM53134.patch [new file with mode: 0644]

index c7edad83421372b125b599e730047aea44659c86..7368e9d496e54dcff7814d7c94615ce406d63dd7 100644 (file)
                        port@8 {
                                reg = <8>;
 
-                               phy-mode = "rgmii";
+                               phy-mode = "rgmii-txid";
                                ethernet = <&switch0port4>;
 
                                fixed-link {
diff --git a/target/linux/bmips/patches-5.15/510-net-dsa-b53-mmap-disable-phy-read-write-ops.patch b/target/linux/bmips/patches-5.15/510-net-dsa-b53-mmap-disable-phy-read-write-ops.patch
deleted file mode 100644 (file)
index 3b1ee6c..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-From 03e31e5197a041857299c70bbbc461131156d434 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
-Date: Tue, 21 Mar 2023 19:11:58 +0100
-Subject: [PATCH] net: dsa: b53: mmap: disable phy read/write ops
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-B53 MMAP switches have a MDIO Mux bus controller which should be used instead
-of phy_read() and phy_write() ops.
-
-Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
----
- drivers/net/dsa/b53/b53_mmap.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
---- a/drivers/net/dsa/b53/b53_mmap.c
-+++ b/drivers/net/dsa/b53/b53_mmap.c
-@@ -279,6 +279,7 @@ static int b53_mmap_probe(struct platfor
-       struct b53_platform_data *pdata = pdev->dev.platform_data;
-       struct b53_mmap_priv *priv;
-       struct b53_device *dev;
-+      struct dsa_switch_ops *dso;
-       int ret;
-       if (!pdata && np) {
-@@ -298,10 +299,19 @@ static int b53_mmap_probe(struct platfor
-       priv->regs = pdata->regs;
-+      dso = devm_kzalloc(&pdev->dev, sizeof(*dso), GFP_KERNEL);
-+      if (!dso)
-+              return -ENOMEM;
-+
-       dev = b53_switch_alloc(&pdev->dev, &b53_mmap_ops, priv);
-       if (!dev)
-               return -ENOMEM;
-+      memcpy(dso, dev->ds->ops, sizeof(*dso));
-+      dso->phy_read = NULL;
-+      dso->phy_write = NULL;
-+      dev->ds->ops = dso;
-+
-       dev->pdata = pdata;
-       platform_set_drvdata(pdev, dev);
diff --git a/target/linux/bmips/patches-5.15/520-net-dsa-b53-add-bcm53134-support.patch b/target/linux/bmips/patches-5.15/520-net-dsa-b53-add-bcm53134-support.patch
deleted file mode 100644 (file)
index 3134e29..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-From 8ec46b847fc64a40da5c2c891e1732c863703bb5 Mon Sep 17 00:00:00 2001
-From: Paul Geurts <paul.geurts@prodrive-technologies.com>
-Date: Wed, 22 Mar 2023 20:17:04 +0100
-Subject: [PATCH] net: dsa: b53: mdio: add support for BCM53134
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Add support for the BCM53134 Ethernet switch in the existing b53 dsa driver.
-The BCM53134 is very familiar to the BCM58XX series.
-
-Signed-off-by: Paul Geurts <paul.geurts@prodrive-technologies.com>
-Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
----
- drivers/net/dsa/b53/b53_common.c | 15 +++++++++++++++
- drivers/net/dsa/b53/b53_mdio.c   |  5 ++++-
- drivers/net/dsa/b53/b53_priv.h   |  4 +++-
- 3 files changed, 22 insertions(+), 2 deletions(-)
-
---- a/drivers/net/dsa/b53/b53_common.c
-+++ b/drivers/net/dsa/b53/b53_common.c
-@@ -2609,6 +2609,20 @@ static const struct b53_chip_data b53_sw
-               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
-               .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
-       },
-+      {
-+              .chip_id = BCM53134_DEVICE_ID,
-+              .dev_name = "BCM53134",
-+              .vlans = 4096,
-+              .enabled_ports = 0x12f,
-+              .imp_port = 8,
-+              .cpu_port = B53_CPU_PORT,
-+              .vta_regs = B53_VTA_REGS,
-+              .arl_bins = 4,
-+              .arl_buckets = 1024,
-+              .duplex_reg = B53_DUPLEX_STAT_GE,
-+              .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
-+              .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
-+      },
- };
- static int b53_switch_init(struct b53_device *dev)
-@@ -2785,6 +2799,7 @@ int b53_switch_detect(struct b53_device
-               case BCM53012_DEVICE_ID:
-               case BCM53018_DEVICE_ID:
-               case BCM53019_DEVICE_ID:
-+              case BCM53134_DEVICE_ID:
-                       dev->chip_id = id32;
-                       break;
-               default:
---- a/drivers/net/dsa/b53/b53_mdio.c
-+++ b/drivers/net/dsa/b53/b53_mdio.c
-@@ -286,6 +286,7 @@ static const struct b53_io_ops b53_mdio_
- #define B53_BRCM_OUI_2        0x03625c00
- #define B53_BRCM_OUI_3        0x00406000
- #define B53_BRCM_OUI_4        0x01410c00
-+#define B53_BRCM_OUI_5        0xae025000
- static int b53_mdio_probe(struct mdio_device *mdiodev)
- {
-@@ -313,7 +314,8 @@ static int b53_mdio_probe(struct mdio_de
-       if ((phy_id & 0xfffffc00) != B53_BRCM_OUI_1 &&
-           (phy_id & 0xfffffc00) != B53_BRCM_OUI_2 &&
-           (phy_id & 0xfffffc00) != B53_BRCM_OUI_3 &&
--          (phy_id & 0xfffffc00) != B53_BRCM_OUI_4) {
-+          (phy_id & 0xfffffc00) != B53_BRCM_OUI_4 &&
-+          (phy_id & 0xfffffc00) != B53_BRCM_OUI_5) {
-               dev_err(&mdiodev->dev, "Unsupported device: 0x%08x\n", phy_id);
-               return -ENODEV;
-       }
-@@ -377,6 +379,7 @@ static const struct of_device_id b53_of_
-       { .compatible = "brcm,bcm53115" },
-       { .compatible = "brcm,bcm53125" },
-       { .compatible = "brcm,bcm53128" },
-+      { .compatible = "brcm,bcm53134" },
-       { .compatible = "brcm,bcm5365" },
-       { .compatible = "brcm,bcm5389" },
-       { .compatible = "brcm,bcm5395" },
---- a/drivers/net/dsa/b53/b53_priv.h
-+++ b/drivers/net/dsa/b53/b53_priv.h
-@@ -85,6 +85,7 @@ enum {
-       BCM583XX_DEVICE_ID = 0x58300,
-       BCM7445_DEVICE_ID = 0x7445,
-       BCM7278_DEVICE_ID = 0x7278,
-+      BCM53134_DEVICE_ID = 0x5075,
- };
- #define B53_N_PORTS   9
-@@ -210,7 +211,8 @@ static inline int is58xx(struct b53_devi
-       return dev->chip_id == BCM58XX_DEVICE_ID ||
-               dev->chip_id == BCM583XX_DEVICE_ID ||
-               dev->chip_id == BCM7445_DEVICE_ID ||
--              dev->chip_id == BCM7278_DEVICE_ID;
-+              dev->chip_id == BCM7278_DEVICE_ID ||
-+              dev->chip_id == BCM53134_DEVICE_ID;
- }
- #define B53_63XX_RGMII0       4
diff --git a/target/linux/generic/pending-5.15/776-net-dsa-b53-mmap-add-phy-ops.patch b/target/linux/generic/pending-5.15/776-net-dsa-b53-mmap-add-phy-ops.patch
new file mode 100644 (file)
index 0000000..786e07c
--- /dev/null
@@ -0,0 +1,118 @@
+From patchwork Thu Mar 23 19:48:41 2023
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=
+ <noltari@gmail.com>
+X-Patchwork-Id: 13186039
+X-Patchwork-Delegate: kuba@kernel.org
+Return-Path: <netdev-owner@vger.kernel.org>
+X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
+       aws-us-west-2-korg-lkml-1.web.codeaurora.org
+Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
+       by smtp.lore.kernel.org (Postfix) with ESMTP id 968C3C6FD1C
+       for <netdev@archiver.kernel.org>; Thu, 23 Mar 2023 19:48:57 +0000 (UTC)
+Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
+        id S230463AbjCWTs4 (ORCPT <rfc822;netdev@archiver.kernel.org>);
+        Thu, 23 Mar 2023 15:48:56 -0400
+Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55372 "EHLO
+        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
+        with ESMTP id S231235AbjCWTsv (ORCPT
+        <rfc822;netdev@vger.kernel.org>); Thu, 23 Mar 2023 15:48:51 -0400
+Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com
+ [IPv6:2a00:1450:4864:20::431])
+        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ECB01040F;
+        Thu, 23 Mar 2023 12:48:46 -0700 (PDT)
+Received: by mail-wr1-x431.google.com with SMTP id i9so21784869wrp.3;
+        Thu, 23 Mar 2023 12:48:46 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+        d=gmail.com; s=20210112; t=1679600924;
+        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
+         :to:from:from:to:cc:subject:date:message-id:reply-to;
+        bh=/D6faZLuMe7xaso6CO/2kkyQATErE9ouEiXJJAWuYSw=;
+        b=Sy0AoQ2nURFU7hQ4iDJucgH+I1i7hZxm6erI5lMl/wC/XyNRhAZD+ZJSzlFJBQDtoD
+         hZThEQp9Ad0QKaZFom1OzYTuNqWp1QWKY+AJFN/vyaEKWP/Q1jYAIRkTJK3c+qpZwesc
+         Oha96WNA7SfaVJ/HBCTlaPwV1/N7X5gOWxoqX59Fb4KDRLJ7PBASD6XXxTnaeFudYogB
+         Vg3Mq+rm/TApR/IPWANEO7KqEr6StC0P0EN1tSnfPdAkxSkByuM34l+pr5LXD8w91MGe
+         1BQSl1vHyZQjR/WJmiZl1QAgSaJR0EVn2isPcjOIjQPBg+HQ4AY4MFoaOTm6RanKzloA
+         BtWw==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+        d=1e100.net; s=20210112; t=1679600924;
+        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
+         :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
+         :reply-to;
+        bh=/D6faZLuMe7xaso6CO/2kkyQATErE9ouEiXJJAWuYSw=;
+        b=GoOv7EUR83WD3MWgKMC9ENLuaNcBHHis524Yrd5LxZOocYFmdtARV8Gfgk2WHyQ5lM
+         zoNvI+h6alZwbu2qWJq9KbAUekFUm5/qkjWvPGRMcQVt9aKiCI/nLy6zYG4tJSqT2kyX
+         FHbhy2GbJIriCm8ENoRfzE5RhAjxFuaaD+/apSEA5IK4a7hm+VKDWJDe+VF8C/Vah/Bp
+         tK2LG14OdhhwFmepUsr9lA7jzTqhyCAFklHW+frebH2K/D4ZzvcScvXTx3k+d8+7ZuYr
+         BkPI0fgMryZdYgeGDWnox5s1jIzQQn4laPpNczVMu06i9j8ANfjnZ9uICrpUDAAKgn+x
+         uGBg==
+X-Gm-Message-State: AAQBX9efILx1adxeGqvUsSK8ibPnaoTHCJA78gzwtmsK+HYaaGH/yO4t
+        xPl4Q8TUvNTDcy2J2/mFy80=
+X-Google-Smtp-Source: 
+ AKy350bX5yENhBXAjV5ZhqRDlOsZvqU+xNCSUbf4jNQtqB8hjgDg9RB7fVuazc+3ZdlciEIHI1q/jg==
+X-Received: by 2002:adf:f30c:0:b0:2cf:ed87:37c9 with SMTP id
+ i12-20020adff30c000000b002cfed8737c9mr200232wro.11.1679600924524;
+        Thu, 23 Mar 2023 12:48:44 -0700 (PDT)
+Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net.
+ [79.146.124.255])
+        by smtp.gmail.com with ESMTPSA id
+ p17-20020adfcc91000000b002c71dd1109fsm16952587wrj.47.2023.03.23.12.48.43
+        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
+        Thu, 23 Mar 2023 12:48:44 -0700 (PDT)
+From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=  <noltari@gmail.com>
+To: f.fainelli@gmail.com, jonas.gorski@gmail.com, andrew@lunn.ch,
+        olteanv@gmail.com, davem@davemloft.net, edumazet@google.com,
+        kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk,
+        netdev@vger.kernel.org, linux-kernel@vger.kernel.org
+Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=  <noltari@gmail.com>
+Subject: [PATCH] net: dsa: b53: mmap: add phy ops
+Date: Thu, 23 Mar 2023 20:48:41 +0100
+Message-Id: <20230323194841.1431878-1-noltari@gmail.com>
+X-Mailer: git-send-email 2.30.2
+MIME-Version: 1.0
+Precedence: bulk
+List-ID: <netdev.vger.kernel.org>
+X-Mailing-List: netdev@vger.kernel.org
+X-Patchwork-Delegate: kuba@kernel.org
+
+Implement phy_read16() and phy_write16() ops for B53 MMAP to avoid accessing
+B53_PORT_MII_PAGE registers which hangs the device.
+This access should be done through the MDIO Mux bus controller.
+
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+---
+ drivers/net/dsa/b53/b53_mmap.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/drivers/net/dsa/b53/b53_mmap.c
++++ b/drivers/net/dsa/b53/b53_mmap.c
+@@ -216,6 +216,18 @@ static int b53_mmap_write64(struct b53_d
+       return 0;
+ }
++static int b53_mmap_phy_read16(struct b53_device *dev, int addr, int reg,
++                             u16 *value)
++{
++      return -EIO;
++}
++
++static int b53_mmap_phy_write16(struct b53_device *dev, int addr, int reg,
++                              u16 value)
++{
++      return -EIO;
++}
++
+ static const struct b53_io_ops b53_mmap_ops = {
+       .read8 = b53_mmap_read8,
+       .read16 = b53_mmap_read16,
+@@ -227,6 +239,8 @@ static const struct b53_io_ops b53_mmap_
+       .write32 = b53_mmap_write32,
+       .write48 = b53_mmap_write48,
+       .write64 = b53_mmap_write64,
++      .phy_read16 = b53_mmap_phy_read16,
++      .phy_write16 = b53_mmap_phy_write16,
+ };
+ static int b53_mmap_probe_of(struct platform_device *pdev,
diff --git a/target/linux/generic/pending-5.15/777-net-dsa-b53-mdio-add-support-for-BCM53134.patch b/target/linux/generic/pending-5.15/777-net-dsa-b53-mdio-add-support-for-BCM53134.patch
new file mode 100644 (file)
index 0000000..53494ec
--- /dev/null
@@ -0,0 +1,189 @@
+From patchwork Fri Mar 24 08:41:38 2023
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=
+ <noltari@gmail.com>
+X-Patchwork-Id: 13186549
+X-Patchwork-Delegate: kuba@kernel.org
+Return-Path: <netdev-owner@vger.kernel.org>
+X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
+       aws-us-west-2-korg-lkml-1.web.codeaurora.org
+Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
+       by smtp.lore.kernel.org (Postfix) with ESMTP id EF744C76195
+       for <netdev@archiver.kernel.org>; Fri, 24 Mar 2023 08:42:01 +0000 (UTC)
+Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
+        id S231807AbjCXImA (ORCPT <rfc822;netdev@archiver.kernel.org>);
+        Fri, 24 Mar 2023 04:42:00 -0400
+Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32956 "EHLO
+        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
+        with ESMTP id S231272AbjCXIly (ORCPT
+        <rfc822;netdev@vger.kernel.org>); Fri, 24 Mar 2023 04:41:54 -0400
+Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com
+ [IPv6:2a00:1450:4864:20::535])
+        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 113A517CF3;
+        Fri, 24 Mar 2023 01:41:46 -0700 (PDT)
+Received: by mail-ed1-x535.google.com with SMTP id ek18so4877175edb.6;
+        Fri, 24 Mar 2023 01:41:45 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+        d=gmail.com; s=20210112; t=1679647304;
+        h=content-transfer-encoding:mime-version:references:in-reply-to
+         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
+         :message-id:reply-to;
+        bh=OfUWRaFIQIQw/lRivER+LHryfdLliXzvabGrcmkQVEU=;
+        b=JMrl6Eay1FS0JZqgPHsbcVzuNAbFELc0SLNGyzYtOVQXcI+YwKDM9Ls7I9PsQVEPoZ
+         CthomCTYoz5G9DU7uBuia207rnjOhssZJRu0syrCoU+O/ZiQyGLJDvq61z5oZJxC2S40
+         kzRsUsC6MRjn64DKPWmxhsSTMKLzn2+P233LKNFbHtfi3NWF5Qu/85sUkxMurnfUgja0
+         qQhl25qYY7ZIvmlFHYefaI5UkITQFuiybrqJW9tztCdHf/gS+f33YkkvQ8njmMQa1DW0
+         ppedfOUotX+6kmHZGX1yea2V5ezEGGvRourZtYMoecTiD0E5d1J1bKhktKslVLIDm0ig
+         oc2g==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+        d=1e100.net; s=20210112; t=1679647304;
+        h=content-transfer-encoding:mime-version:references:in-reply-to
+         :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
+         :subject:date:message-id:reply-to;
+        bh=OfUWRaFIQIQw/lRivER+LHryfdLliXzvabGrcmkQVEU=;
+        b=b3Gmga5ZDbnmQfnw1GCz+eU2JwgsVzfciZuSmfYAiVxpW4c6cur3MHbpzDPhi99wzA
+         ZYAM7ryLv88rXl/tQB5g2Nte5rvMfxUeHXsT/JpsRcSSocFRbRrk0QJyiA/Xj86NiD5N
+         C1sKz50Im190FmrvPcBh6OHQbv/3MQyE+1fQx+9q3jW5rQiAWQaYk4Ng8GlWA7gtG3jB
+         fHO6Fuoenn32pgkveJbQLYL/2t2f53wGf3QLQ3IeKW7jdfIHNThwrwqBMxdHoIDaTBT9
+         UWMeJuiYtylIibo/3zbORbWOgIERlWxZRf3BCOFpnzUn4eBzio4LgjtNxZ77ITRxsmbk
+         3+Hg==
+X-Gm-Message-State: AAQBX9dfyBfbR7Sdd5wqxMiAv3Yhk47pK1XzD87MZyAF3AxyoFyKcMaF
+        EbwJLyRvTGQEFdVWCGw1eMU=
+X-Google-Smtp-Source: 
+ AKy350bpDVLq7k1FxG2Mek/VIobZL4KhufiKx8qfmpxpcWmLI3bLg8wfQKEAKJRNJBleo/7CZuCL5g==
+X-Received: by 2002:aa7:c711:0:b0:4a2:588f:b3c5 with SMTP id
+ i17-20020aa7c711000000b004a2588fb3c5mr2261236edq.21.1679647304260;
+        Fri, 24 Mar 2023 01:41:44 -0700 (PDT)
+Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net.
+ [79.146.124.255])
+        by smtp.gmail.com with ESMTPSA id
+ z21-20020a50cd15000000b004acbda55f6bsm10323728edi.27.2023.03.24.01.41.43
+        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
+        Fri, 24 Mar 2023 01:41:43 -0700 (PDT)
+From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=  <noltari@gmail.com>
+To: paul.geurts@prodrive-technologies.com, f.fainelli@gmail.com,
+        jonas.gorski@gmail.com, andrew@lunn.ch, olteanv@gmail.com,
+        davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
+        pabeni@redhat.com, robh+dt@kernel.org,
+        krzysztof.kozlowski+dt@linaro.org, netdev@vger.kernel.org,
+        devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
+Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=  <noltari@gmail.com>
+Subject: [PATCH v2 2/2] net: dsa: b53: mdio: add support for BCM53134
+Date: Fri, 24 Mar 2023 09:41:38 +0100
+Message-Id: <20230324084138.664285-3-noltari@gmail.com>
+X-Mailer: git-send-email 2.30.2
+In-Reply-To: <20230324084138.664285-1-noltari@gmail.com>
+References: <20230323121804.2249605-1-noltari@gmail.com>
+ <20230324084138.664285-1-noltari@gmail.com>
+MIME-Version: 1.0
+Precedence: bulk
+List-ID: <netdev.vger.kernel.org>
+X-Mailing-List: netdev@vger.kernel.org
+X-Patchwork-Delegate: kuba@kernel.org
+
+From: Paul Geurts <paul.geurts@prodrive-technologies.com>
+
+Add support for the BCM53134 Ethernet switch in the existing b53 dsa driver.
+BCM53134 is very similar to the BCM58XX series.
+
+Signed-off-by: Paul Geurts <paul.geurts@prodrive-technologies.com>
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+---
+ v2: add BCM53134 to is531x5() and remove special RGMII config
+
+ drivers/net/dsa/b53/b53_common.c | 15 +++++++++++++++
+ drivers/net/dsa/b53/b53_mdio.c   |  5 ++++-
+ drivers/net/dsa/b53/b53_priv.h   |  7 +++++--
+ 3 files changed, 24 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -2609,6 +2609,20 @@ static const struct b53_chip_data b53_sw
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+               .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
+       },
++      {
++              .chip_id = BCM53134_DEVICE_ID,
++              .dev_name = "BCM53134",
++              .vlans = 4096,
++              .enabled_ports = 0x12f,
++              .imp_port = 8,
++              .cpu_port = B53_CPU_PORT,
++              .vta_regs = B53_VTA_REGS,
++              .arl_bins = 4,
++              .arl_buckets = 1024,
++              .duplex_reg = B53_DUPLEX_STAT_GE,
++              .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
++              .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
++      },
+ };
+ static int b53_switch_init(struct b53_device *dev)
+@@ -2785,6 +2799,7 @@ int b53_switch_detect(struct b53_device
+               case BCM53012_DEVICE_ID:
+               case BCM53018_DEVICE_ID:
+               case BCM53019_DEVICE_ID:
++              case BCM53134_DEVICE_ID:
+                       dev->chip_id = id32;
+                       break;
+               default:
+--- a/drivers/net/dsa/b53/b53_mdio.c
++++ b/drivers/net/dsa/b53/b53_mdio.c
+@@ -286,6 +286,7 @@ static const struct b53_io_ops b53_mdio_
+ #define B53_BRCM_OUI_2        0x03625c00
+ #define B53_BRCM_OUI_3        0x00406000
+ #define B53_BRCM_OUI_4        0x01410c00
++#define B53_BRCM_OUI_5        0xae025000
+ static int b53_mdio_probe(struct mdio_device *mdiodev)
+ {
+@@ -313,7 +314,8 @@ static int b53_mdio_probe(struct mdio_de
+       if ((phy_id & 0xfffffc00) != B53_BRCM_OUI_1 &&
+           (phy_id & 0xfffffc00) != B53_BRCM_OUI_2 &&
+           (phy_id & 0xfffffc00) != B53_BRCM_OUI_3 &&
+-          (phy_id & 0xfffffc00) != B53_BRCM_OUI_4) {
++          (phy_id & 0xfffffc00) != B53_BRCM_OUI_4 &&
++          (phy_id & 0xfffffc00) != B53_BRCM_OUI_5) {
+               dev_err(&mdiodev->dev, "Unsupported device: 0x%08x\n", phy_id);
+               return -ENODEV;
+       }
+@@ -377,6 +379,7 @@ static const struct of_device_id b53_of_
+       { .compatible = "brcm,bcm53115" },
+       { .compatible = "brcm,bcm53125" },
+       { .compatible = "brcm,bcm53128" },
++      { .compatible = "brcm,bcm53134" },
+       { .compatible = "brcm,bcm5365" },
+       { .compatible = "brcm,bcm5389" },
+       { .compatible = "brcm,bcm5395" },
+--- a/drivers/net/dsa/b53/b53_priv.h
++++ b/drivers/net/dsa/b53/b53_priv.h
+@@ -85,6 +85,7 @@ enum {
+       BCM583XX_DEVICE_ID = 0x58300,
+       BCM7445_DEVICE_ID = 0x7445,
+       BCM7278_DEVICE_ID = 0x7278,
++      BCM53134_DEVICE_ID = 0x5075,
+ };
+ #define B53_N_PORTS   9
+@@ -182,7 +183,8 @@ static inline int is531x5(struct b53_dev
+ {
+       return dev->chip_id == BCM53115_DEVICE_ID ||
+               dev->chip_id == BCM53125_DEVICE_ID ||
+-              dev->chip_id == BCM53128_DEVICE_ID;
++              dev->chip_id == BCM53128_DEVICE_ID ||
++              dev->chip_id == BCM53134_DEVICE_ID;
+ }
+ static inline int is63xx(struct b53_device *dev)
+@@ -210,7 +212,8 @@ static inline int is58xx(struct b53_devi
+       return dev->chip_id == BCM58XX_DEVICE_ID ||
+               dev->chip_id == BCM583XX_DEVICE_ID ||
+               dev->chip_id == BCM7445_DEVICE_ID ||
+-              dev->chip_id == BCM7278_DEVICE_ID;
++              dev->chip_id == BCM7278_DEVICE_ID ||
++              dev->chip_id == BCM53134_DEVICE_ID;
+ }
+ #define B53_63XX_RGMII0       4