From: Paul Geurts <paul.geurts@prodrive-technologies.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/4] net: dsa: b53: Add support for Broadcom BCM53134 managed Ethernet switch
Date: Mon, 27 Feb 2023 19:44:06 +0000 [thread overview]
Message-ID: <AM0PR02MB5524C3FE38B82C480E2EC968BDAF9@AM0PR02MB5524.eurprd02.prod.outlook.com> (raw)
In-Reply-To: <20221212135640.3590545-2-paul.geurts@prodrive-technologies.com>
Add support for the BCM53134 Ethernet switch in the existing b53 dsa driver. This Ethernet switch supports MDIO and SPI interfacing.
This implementation only implements the MDIO interface of this device.
The device also features an SPI interface, which is not implemente in this patch.
The BCM53134 is very familiar to the BCM58XX series. Therefore is85xx() is also applicable to this device.
Signed-off-by: Paul Geurts <paul.geurts@prodrive-technologies.com>
---
drivers/net/dsa/b53/b53_common.c | 19 ++++++++++++++++++-
drivers/net/dsa/b53/b53_mdio.c | 5 ++++-
drivers/net/dsa/b53/b53_priv.h | 12 ++++++++++--
3 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 59cdfc51ce06..6aa76cb4f992 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1266,7 +1266,9 @@ static void b53_adjust_link(struct dsa_switch *ds, int port,
rgmii_ctrl |= RGMII_CTRL_DLL_TXC;
if (phydev->interface == PHY_INTERFACE_MODE_RGMII)
rgmii_ctrl |= RGMII_CTRL_DLL_TXC | RGMII_CTRL_DLL_RXC;
- rgmii_ctrl |= RGMII_CTRL_TIMING_SEL;
+ /* BCM53134 does not support this bit */
+ if (!is53134(dev))
+ rgmii_ctrl |= RGMII_CTRL_TIMING_SEL;
b53_write8(dev, B53_CTRL_PAGE, off, rgmii_ctrl);
dev_info(ds->dev, "Configured port %d for %s\n", port, @@ -2550,6 +2552,20 @@ static const struct b53_chip_data b53_switch_chips[] = {
.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) @@ -2727,6 +2743,7 @@ int b53_switch_detect(struct b53_device *dev)
case BCM53012_DEVICE_ID:
case BCM53018_DEVICE_ID:
case BCM53019_DEVICE_ID:
+ case BCM53134_DEVICE_ID:
dev->chip_id = id32;
break;
default:
diff --git a/drivers/net/dsa/b53/b53_mdio.c b/drivers/net/dsa/b53/b53_mdio.c index 6ddc03b58b28..8b422b298cd5 100644
--- 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_ops = {
#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_device *mdiodev)
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;
}
@@ -375,6 +377,7 @@ static const struct of_device_id b53_of_match[] = {
{ .compatible = "brcm,bcm53115" },
{ .compatible = "brcm,bcm53125" },
{ .compatible = "brcm,bcm53128" },
+ { .compatible = "brcm,bcm53134" },
{ .compatible = "brcm,bcm5365" },
{ .compatible = "brcm,bcm5389" },
{ .compatible = "brcm,bcm5395" },
diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h index 795cbffd5c2b..0388193709a5 100644
--- a/drivers/net/dsa/b53/b53_priv.h
+++ b/drivers/net/dsa/b53/b53_priv.h
@@ -79,6 +79,7 @@ enum {
BCM583XX_DEVICE_ID = 0x58300,
BCM7445_DEVICE_ID = 0x7445,
BCM7278_DEVICE_ID = 0x7278,
+ BCM53134_DEVICE_ID = 0x5075,
};
struct b53_pcs {
@@ -186,7 +187,13 @@ static inline int is531x5(struct b53_device *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 is53134(struct b53_device *dev) {
+ return dev->chip_id == BCM53134_DEVICE_ID;
}
static inline int is63xx(struct b53_device *dev) @@ -208,7 +215,8 @@ static inline int is58xx(struct b53_device *dev)
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_CPU_PORT_25 5
--
2.30.2
next prev parent reply other threads:[~2023-02-27 19:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221212135640.3590545-1-paul.geurts@prodrive-technologies.com>
2023-02-27 19:44 ` [PATCH 0/4] b53: Add BCM53134 support Paul Geurts
[not found] ` <20221212135640.3590545-2-paul.geurts@prodrive-technologies.com>
2023-02-27 19:44 ` Paul Geurts [this message]
2023-02-28 11:35 ` [PATCH 1/4] net: dsa: b53: Add support for Broadcom BCM53134 managed Ethernet switch Krzysztof Kozlowski
[not found] ` <20221212135640.3590545-3-paul.geurts@prodrive-technologies.com>
2023-02-27 19:44 ` [PATCH 2/4] dt-bindings: net/dsa/: add brcm,bcm53134 as compatible flag Paul Geurts
2023-02-28 11:33 ` Krzysztof Kozlowski
[not found] ` <20230301085531.3713797-1-paul.geurts@prodrive-technologies.com>
2023-03-01 8:58 ` Paul Geurts
[not found] ` <20221212135640.3590545-4-paul.geurts@prodrive-technologies.com>
2023-02-27 19:44 ` [PATCH 3/4] net: dsa: b53: fail switch initialization for unsupported switch types Paul Geurts
[not found] ` <20221212135640.3590545-5-paul.geurts@prodrive-technologies.com>
2023-02-27 19:44 ` [PATCH 4/4] net: dsa: b53: mdio: Add optional reset gpio Paul Geurts
2023-02-28 11:34 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AM0PR02MB5524C3FE38B82C480E2EC968BDAF9@AM0PR02MB5524.eurprd02.prod.outlook.com \
--to=paul.geurts@prodrive-technologies.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®