From: "Álvaro Fernández 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, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, netdev@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Álvaro Fernández Rojas" <noltari@gmail.com>
Subject: [PATCH v2 3/4] net: dsa: b53: mmap: allow passing a chip ID
Date: Tue, 21 Mar 2023 18:33:58 +0100 [thread overview]
Message-ID: <20230321173359.251778-4-noltari@gmail.com> (raw)
In-Reply-To: <20230321173359.251778-1-noltari@gmail.com>
BCM6318 and BCM63268 SoCs require a special handling for their RGMIIs, so we
should be able to identify them as a special BCM63xx switch.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
v2:
- Add missing chip to b53_switch_chips[].
- Fix device_get_match_data() casting warning.
- Add BCM63268_DEVICE_ID to BCM6318 too.
- Add BCM6318 in commit description.
drivers/net/dsa/b53/b53_common.c | 13 +++++++++++++
drivers/net/dsa/b53/b53_mmap.c | 32 +++++++++++++++++++++++---------
drivers/net/dsa/b53/b53_priv.h | 9 ++++++++-
3 files changed, 44 insertions(+), 10 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 6e212f6f1cb9..97327d7a6760 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -2465,6 +2465,19 @@ static const struct b53_chip_data b53_switch_chips[] = {
.jumbo_pm_reg = B53_JUMBO_PORT_MASK_63XX,
.jumbo_size_reg = B53_JUMBO_MAX_SIZE_63XX,
},
+ {
+ .chip_id = BCM63268_DEVICE_ID,
+ .dev_name = "BCM63268",
+ .vlans = 4096,
+ .enabled_ports = 0, /* pdata must provide them */
+ .arl_bins = 4,
+ .arl_buckets = 1024,
+ .imp_port = 8,
+ .vta_regs = B53_VTA_REGS_63XX,
+ .duplex_reg = B53_DUPLEX_STAT_63XX,
+ .jumbo_pm_reg = B53_JUMBO_PORT_MASK_63XX,
+ .jumbo_size_reg = B53_JUMBO_MAX_SIZE_63XX,
+ },
{
.chip_id = BCM53010_DEVICE_ID,
.dev_name = "BCM53010",
diff --git a/drivers/net/dsa/b53/b53_mmap.c b/drivers/net/dsa/b53/b53_mmap.c
index f63aebd445e8..a83a0c9d6939 100644
--- a/drivers/net/dsa/b53/b53_mmap.c
+++ b/drivers/net/dsa/b53/b53_mmap.c
@@ -248,7 +248,7 @@ static int b53_mmap_probe_of(struct platform_device *pdev,
return -ENOMEM;
pdata->regs = mem;
- pdata->chip_id = BCM63XX_DEVICE_ID;
+ pdata->chip_id = (u32)(unsigned long)device_get_match_data(dev);
pdata->big_endian = of_property_read_bool(np, "big-endian");
of_ports = of_get_child_by_name(np, "ports");
@@ -330,14 +330,28 @@ static void b53_mmap_shutdown(struct platform_device *pdev)
}
static const struct of_device_id b53_mmap_of_table[] = {
- { .compatible = "brcm,bcm3384-switch" },
- { .compatible = "brcm,bcm6318-switch" },
- { .compatible = "brcm,bcm6328-switch" },
- { .compatible = "brcm,bcm6362-switch" },
- { .compatible = "brcm,bcm6368-switch" },
- { .compatible = "brcm,bcm63268-switch" },
- { .compatible = "brcm,bcm63xx-switch" },
- { /* sentinel */ },
+ {
+ .compatible = "brcm,bcm3384-switch",
+ .data = (void *)BCM63XX_DEVICE_ID,
+ }, {
+ .compatible = "brcm,bcm6318-switch",
+ .data = (void *)BCM63268_DEVICE_ID,
+ }, {
+ .compatible = "brcm,bcm6328-switch",
+ .data = (void *)BCM63XX_DEVICE_ID,
+ }, {
+ .compatible = "brcm,bcm6362-switch",
+ .data = (void *)BCM63XX_DEVICE_ID,
+ }, {
+ .compatible = "brcm,bcm6368-switch",
+ .data = (void *)BCM63XX_DEVICE_ID,
+ }, {
+ .compatible = "brcm,bcm63268-switch",
+ .data = (void *)BCM63268_DEVICE_ID,
+ }, {
+ .compatible = "brcm,bcm63xx-switch",
+ .data = (void *)BCM63XX_DEVICE_ID,
+ }, { /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, b53_mmap_of_table);
diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h
index 4cf9f540696e..a689a6950189 100644
--- a/drivers/net/dsa/b53/b53_priv.h
+++ b/drivers/net/dsa/b53/b53_priv.h
@@ -70,6 +70,7 @@ enum {
BCM53125_DEVICE_ID = 0x53125,
BCM53128_DEVICE_ID = 0x53128,
BCM63XX_DEVICE_ID = 0x6300,
+ BCM63268_DEVICE_ID = 0x63268,
BCM53010_DEVICE_ID = 0x53010,
BCM53011_DEVICE_ID = 0x53011,
BCM53012_DEVICE_ID = 0x53012,
@@ -191,7 +192,13 @@ static inline int is531x5(struct b53_device *dev)
static inline int is63xx(struct b53_device *dev)
{
- return dev->chip_id == BCM63XX_DEVICE_ID;
+ return dev->chip_id == BCM63XX_DEVICE_ID ||
+ dev->chip_id == BCM63268_DEVICE_ID;
+}
+
+static inline int is63268(struct b53_device *dev)
+{
+ return dev->chip_id == BCM63268_DEVICE_ID;
}
static inline int is5301x(struct b53_device *dev)
--
2.30.2
next prev parent reply other threads:[~2023-03-21 17:35 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 15:50 [PATCH 0/4] net: dsa: b53: configure BCM63268 RGMII ports Álvaro Fernández Rojas
2023-03-20 15:50 ` [PATCH 1/4] dt-bindings: net: dsa: b53: add more 63xx SoCs Álvaro Fernández Rojas
2023-03-20 19:49 ` Simon Horman
2023-03-20 19:51 ` Florian Fainelli
2023-03-21 7:14 ` Krzysztof Kozlowski
2023-03-20 15:50 ` [PATCH 2/4] net: dsa: b53: mmap: add more BCM63xx SoCs Álvaro Fernández Rojas
2023-03-20 19:52 ` Florian Fainelli
2023-03-20 19:54 ` Simon Horman
2023-03-20 19:56 ` Álvaro Fernández Rojas
2023-03-20 20:11 ` Simon Horman
2023-03-20 15:50 ` [PATCH 3/4] net: dsa: b53: mmap: allow passing a chip ID Álvaro Fernández Rojas
2023-03-20 19:57 ` Florian Fainelli
2023-03-20 20:01 ` Simon Horman
2023-03-20 15:50 ` [PATCH 4/4] net: dsa: b53: add BCM63268 RGMII configuration Álvaro Fernández Rojas
2023-03-20 20:00 ` Florian Fainelli
2023-03-21 9:10 ` Álvaro Fernández Rojas
2023-03-20 20:07 ` Simon Horman
2023-03-21 17:33 ` [PATCH v2 0/4] net: dsa: b53: configure 6318 and 63268 RGMII ports Álvaro Fernández Rojas
2023-03-21 17:33 ` [PATCH v2 1/4] dt-bindings: net: dsa: b53: add more 63xx SoCs Álvaro Fernández Rojas
2023-03-21 17:33 ` [PATCH v2 2/4] net: dsa: b53: mmap: " Álvaro Fernández Rojas
2023-03-22 11:11 ` Simon Horman
2023-03-21 17:33 ` Álvaro Fernández Rojas [this message]
2023-03-21 18:19 ` [PATCH v2 3/4] net: dsa: b53: mmap: allow passing a chip ID Florian Fainelli
2023-03-22 11:12 ` Simon Horman
2023-03-21 17:33 ` [PATCH v2 4/4] net: dsa: b53: add BCM63268 RGMII configuration Álvaro Fernández Rojas
2023-03-23 4:50 ` [PATCH v2 0/4] net: dsa: b53: configure 6318 and 63268 RGMII ports patchwork-bot+netdevbpf
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=20230321173359.251778-4-noltari@gmail.com \
--to=noltari@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=jonas.gorski@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).