firewall4: update to the latest version
[openwrt/staging/dedeckeh.git] / target / linux / bmips / patches-5.15 / 520-net-dsa-b53-add-bcm53134-support.patch
1 From 8ec46b847fc64a40da5c2c891e1732c863703bb5 Mon Sep 17 00:00:00 2001
2 From: Paul Geurts <paul.geurts@prodrive-technologies.com>
3 Date: Wed, 22 Mar 2023 20:17:04 +0100
4 Subject: [PATCH] net: dsa: b53: mdio: add support for BCM53134
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Add support for the BCM53134 Ethernet switch in the existing b53 dsa driver.
10 The BCM53134 is very familiar to the BCM58XX series.
11
12 Signed-off-by: Paul Geurts <paul.geurts@prodrive-technologies.com>
13 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
14 ---
15 drivers/net/dsa/b53/b53_common.c | 15 +++++++++++++++
16 drivers/net/dsa/b53/b53_mdio.c | 5 ++++-
17 drivers/net/dsa/b53/b53_priv.h | 4 +++-
18 3 files changed, 22 insertions(+), 2 deletions(-)
19
20 --- a/drivers/net/dsa/b53/b53_common.c
21 +++ b/drivers/net/dsa/b53/b53_common.c
22 @@ -2609,6 +2609,20 @@ static const struct b53_chip_data b53_sw
23 .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
24 .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
25 },
26 + {
27 + .chip_id = BCM53134_DEVICE_ID,
28 + .dev_name = "BCM53134",
29 + .vlans = 4096,
30 + .enabled_ports = 0x12f,
31 + .imp_port = 8,
32 + .cpu_port = B53_CPU_PORT,
33 + .vta_regs = B53_VTA_REGS,
34 + .arl_bins = 4,
35 + .arl_buckets = 1024,
36 + .duplex_reg = B53_DUPLEX_STAT_GE,
37 + .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
38 + .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
39 + },
40 };
41
42 static int b53_switch_init(struct b53_device *dev)
43 @@ -2785,6 +2799,7 @@ int b53_switch_detect(struct b53_device
44 case BCM53012_DEVICE_ID:
45 case BCM53018_DEVICE_ID:
46 case BCM53019_DEVICE_ID:
47 + case BCM53134_DEVICE_ID:
48 dev->chip_id = id32;
49 break;
50 default:
51 --- a/drivers/net/dsa/b53/b53_mdio.c
52 +++ b/drivers/net/dsa/b53/b53_mdio.c
53 @@ -286,6 +286,7 @@ static const struct b53_io_ops b53_mdio_
54 #define B53_BRCM_OUI_2 0x03625c00
55 #define B53_BRCM_OUI_3 0x00406000
56 #define B53_BRCM_OUI_4 0x01410c00
57 +#define B53_BRCM_OUI_5 0xae025000
58
59 static int b53_mdio_probe(struct mdio_device *mdiodev)
60 {
61 @@ -313,7 +314,8 @@ static int b53_mdio_probe(struct mdio_de
62 if ((phy_id & 0xfffffc00) != B53_BRCM_OUI_1 &&
63 (phy_id & 0xfffffc00) != B53_BRCM_OUI_2 &&
64 (phy_id & 0xfffffc00) != B53_BRCM_OUI_3 &&
65 - (phy_id & 0xfffffc00) != B53_BRCM_OUI_4) {
66 + (phy_id & 0xfffffc00) != B53_BRCM_OUI_4 &&
67 + (phy_id & 0xfffffc00) != B53_BRCM_OUI_5) {
68 dev_err(&mdiodev->dev, "Unsupported device: 0x%08x\n", phy_id);
69 return -ENODEV;
70 }
71 @@ -377,6 +379,7 @@ static const struct of_device_id b53_of_
72 { .compatible = "brcm,bcm53115" },
73 { .compatible = "brcm,bcm53125" },
74 { .compatible = "brcm,bcm53128" },
75 + { .compatible = "brcm,bcm53134" },
76 { .compatible = "brcm,bcm5365" },
77 { .compatible = "brcm,bcm5389" },
78 { .compatible = "brcm,bcm5395" },
79 --- a/drivers/net/dsa/b53/b53_priv.h
80 +++ b/drivers/net/dsa/b53/b53_priv.h
81 @@ -85,6 +85,7 @@ enum {
82 BCM583XX_DEVICE_ID = 0x58300,
83 BCM7445_DEVICE_ID = 0x7445,
84 BCM7278_DEVICE_ID = 0x7278,
85 + BCM53134_DEVICE_ID = 0x5075,
86 };
87
88 #define B53_N_PORTS 9
89 @@ -210,7 +211,8 @@ static inline int is58xx(struct b53_devi
90 return dev->chip_id == BCM58XX_DEVICE_ID ||
91 dev->chip_id == BCM583XX_DEVICE_ID ||
92 dev->chip_id == BCM7445_DEVICE_ID ||
93 - dev->chip_id == BCM7278_DEVICE_ID;
94 + dev->chip_id == BCM7278_DEVICE_ID ||
95 + dev->chip_id == BCM53134_DEVICE_ID;
96 }
97
98 #define B53_63XX_RGMII0 4