generic: 5.15: backport support for Marvell 88E6361 switch
authorRobert Marko <robert.marko@sartura.hr>
Thu, 14 Sep 2023 10:44:02 +0000 (12:44 +0200)
committerRobert Marko <robert.marko@sartura.hr>
Tue, 19 Sep 2023 10:12:17 +0000 (12:12 +0200)
New revision of Methode eDPU boards uses Marvell 88E6361 switch, so lets
backport it from kernel 6.5.

Since 5.15 doesnt have phylink_get_caps I had to modify the backport to
use the old mv88e6393x_phylink_validate instead.
I had to fixup one more instance of port_max_speed_mode as well that is not
present in 6.5.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
target/linux/generic/backport-5.15/893-v6.5-01-net-dsa-mv88e6xxx-pass-directly-chip-structure-to-mv.patch [new file with mode: 0644]
target/linux/generic/backport-5.15/893-v6.5-02-net-dsa-mv88e6xxx-use-mv88e6xxx_phy_is_internal-in-m.patch [new file with mode: 0644]
target/linux/generic/backport-5.15/893-v6.5-03-net-dsa-mv88e6xxx-add-field-to-specify-internal-phys.patch [new file with mode: 0644]
target/linux/generic/backport-5.15/893-v6.5-04-net-dsa-mv88e6xxx-fix-88E6393X-family-internal-phys-.patch [new file with mode: 0644]
target/linux/generic/backport-5.15/893-v6.5-05-net-dsa-mv88e6xxx-pass-mv88e6xxx_chip-structure-to-p.patch [new file with mode: 0644]
target/linux/generic/backport-5.15/893-v6.5-06-net-dsa-mv88e6xxx-enable-support-for-88E6361-switch.patch [new file with mode: 0644]
target/linux/generic/hack-5.15/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch
target/linux/generic/pending-5.15/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch

diff --git a/target/linux/generic/backport-5.15/893-v6.5-01-net-dsa-mv88e6xxx-pass-directly-chip-structure-to-mv.patch b/target/linux/generic/backport-5.15/893-v6.5-01-net-dsa-mv88e6xxx-pass-directly-chip-structure-to-mv.patch
new file mode 100644 (file)
index 0000000..177a8ce
--- /dev/null
@@ -0,0 +1,46 @@
+From 19f291d8a65cd19e7595006c7872cd95aa6f9e93 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alexis=20Lothor=C3=A9?= <alexis.lothore@bootlin.com>
+Date: Fri, 4 Aug 2023 19:13:10 +0200
+Subject: [PATCH 893/898] net: dsa: mv88e6xxx: pass directly chip structure to
+ mv88e6xxx_phy_is_internal
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Since this function is a simple helper, we do not need to pass a full
+dsa_switch structure, we can directly pass the mv88e6xxx_chip structure.
+Doing so will allow to share this function with any other function
+not manipulating dsa_switch structure but needing info about number of
+internal phys
+
+Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
+Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/dsa/mv88e6xxx/chip.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/dsa/mv88e6xxx/chip.c
++++ b/drivers/net/dsa/mv88e6xxx/chip.c
+@@ -459,10 +459,8 @@ restore_link:
+       return err;
+ }
+-static int mv88e6xxx_phy_is_internal(struct dsa_switch *ds, int port)
++static int mv88e6xxx_phy_is_internal(struct mv88e6xxx_chip *chip, int port)
+ {
+-      struct mv88e6xxx_chip *chip = ds->priv;
+-
+       return port < chip->info->num_internal_phys;
+ }
+@@ -704,7 +702,7 @@ static void mv88e6xxx_mac_config(struct
+       mv88e6xxx_reg_lock(chip);
+-      if (mode != MLO_AN_PHY || !mv88e6xxx_phy_is_internal(ds, port)) {
++      if (mode != MLO_AN_PHY || !mv88e6xxx_phy_is_internal(chip, port)) {
+               /* In inband mode, the link may come up at any time while the
+                * link is not forced down. Force the link down while we
+                * reconfigure the interface mode.
diff --git a/target/linux/generic/backport-5.15/893-v6.5-02-net-dsa-mv88e6xxx-use-mv88e6xxx_phy_is_internal-in-m.patch b/target/linux/generic/backport-5.15/893-v6.5-02-net-dsa-mv88e6xxx-use-mv88e6xxx_phy_is_internal-in-m.patch
new file mode 100644 (file)
index 0000000..02cafa3
--- /dev/null
@@ -0,0 +1,31 @@
+From 03a50b4f81d9e8bcf86165d6b2ac9376d02e5df9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alexis=20Lothor=C3=A9?= <alexis.lothore@bootlin.com>
+Date: Mon, 29 May 2023 10:02:42 +0200
+Subject: [PATCH 894/898] net: dsa: mv88e6xxx: use mv88e6xxx_phy_is_internal in
+ mv88e6xxx_port_ppu_updates
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Make sure to use existing helper to get internal PHYs count instead of
+redoing it manually
+
+Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
+Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/dsa/mv88e6xxx/chip.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/dsa/mv88e6xxx/chip.c
++++ b/drivers/net/dsa/mv88e6xxx/chip.c
+@@ -473,7 +473,7 @@ static int mv88e6xxx_port_ppu_updates(st
+        * report whether the port is internal.
+        */
+       if (chip->info->family == MV88E6XXX_FAMILY_6250)
+-              return port < chip->info->num_internal_phys;
++              return mv88e6xxx_phy_is_internal(chip, port);
+       err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_STS, &reg);
+       if (err) {
diff --git a/target/linux/generic/backport-5.15/893-v6.5-03-net-dsa-mv88e6xxx-add-field-to-specify-internal-phys.patch b/target/linux/generic/backport-5.15/893-v6.5-03-net-dsa-mv88e6xxx-add-field-to-specify-internal-phys.patch
new file mode 100644 (file)
index 0000000..239620b
--- /dev/null
@@ -0,0 +1,69 @@
+From 07120894b24cc3cf2318925baeaaf0893e3312e4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alexis=20Lothor=C3=A9?= <alexis.lothore@bootlin.com>
+Date: Mon, 29 May 2023 10:02:43 +0200
+Subject: [PATCH 895/898] net: dsa: mv88e6xxx: add field to specify internal
+ phys layout
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+mv88e6xxx currently assumes that switch equipped with internal phys have
+those phys mapped contiguously starting from port 0 (see
+mv88e6xxx_phy_is_internal). However, some switches have internal PHYs but
+NOT starting from port 0. For example 88e6393X, 88E6193X and 88E6191X have
+integrated PHYs available on ports 1 to 8
+To properly support this offset, add a new field to allow specifying an
+internal PHYs layout. If field is not set, default layout is assumed (start
+at port 0)
+
+Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/dsa/mv88e6xxx/chip.c    | 4 +++-
+ drivers/net/dsa/mv88e6xxx/chip.h    | 5 +++++
+ drivers/net/dsa/mv88e6xxx/global2.c | 5 ++++-
+ 3 files changed, 12 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/dsa/mv88e6xxx/chip.c
++++ b/drivers/net/dsa/mv88e6xxx/chip.c
+@@ -461,7 +461,9 @@ restore_link:
+ static int mv88e6xxx_phy_is_internal(struct mv88e6xxx_chip *chip, int port)
+ {
+-      return port < chip->info->num_internal_phys;
++      return port >= chip->info->internal_phys_offset &&
++              port < chip->info->num_internal_phys +
++                      chip->info->internal_phys_offset;
+ }
+ static int mv88e6xxx_port_ppu_updates(struct mv88e6xxx_chip *chip, int port)
+--- a/drivers/net/dsa/mv88e6xxx/chip.h
++++ b/drivers/net/dsa/mv88e6xxx/chip.h
+@@ -165,6 +165,11 @@ struct mv88e6xxx_info {
+       /* Supports PTP */
+       bool ptp_support;
++
++      /* Internal PHY start index. 0 means that internal PHYs range starts at
++       * port 0, 1 means internal PHYs range starts at port 1, etc
++       */
++      unsigned int internal_phys_offset;
+ };
+ struct mv88e6xxx_atu_entry {
+--- a/drivers/net/dsa/mv88e6xxx/global2.c
++++ b/drivers/net/dsa/mv88e6xxx/global2.c
+@@ -1185,8 +1185,11 @@ int mv88e6xxx_g2_irq_mdio_setup(struct m
+                               struct mii_bus *bus)
+ {
+       int phy, irq, err, err_phy;
++      int phy_start = chip->info->internal_phys_offset;
++      int phy_end = chip->info->internal_phys_offset +
++                    chip->info->num_internal_phys;
+-      for (phy = 0; phy < chip->info->num_internal_phys; phy++) {
++      for (phy = phy_start; phy < phy_end; phy++) {
+               irq = irq_find_mapping(chip->g2_irq.domain, phy);
+               if (irq < 0) {
+                       err = irq;
diff --git a/target/linux/generic/backport-5.15/893-v6.5-04-net-dsa-mv88e6xxx-fix-88E6393X-family-internal-phys-.patch b/target/linux/generic/backport-5.15/893-v6.5-04-net-dsa-mv88e6xxx-fix-88E6393X-family-internal-phys-.patch
new file mode 100644 (file)
index 0000000..01bc656
--- /dev/null
@@ -0,0 +1,52 @@
+From 492b06747f544c19b5ffe531a24b67858764c50e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alexis=20Lothor=C3=A9?= <alexis.lothore@bootlin.com>
+Date: Mon, 29 May 2023 10:02:44 +0200
+Subject: [PATCH 896/898] net: dsa: mv88e6xxx: fix 88E6393X family internal
+ phys layout
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+88E6393X/88E6193X/88E6191X switches have in fact 8 internal PHYs, but those
+are not present starting at port 0: supported ports go from 1 to 8
+
+Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/dsa/mv88e6xxx/chip.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/dsa/mv88e6xxx/chip.c
++++ b/drivers/net/dsa/mv88e6xxx/chip.c
+@@ -5370,7 +5370,8 @@ static const struct mv88e6xxx_info mv88e
+               .name = "Marvell 88E6191X",
+               .num_databases = 4096,
+               .num_ports = 11,        /* 10 + Z80 */
+-              .num_internal_phys = 9,
++              .num_internal_phys = 8,
++              .internal_phys_offset = 1,
+               .max_vid = 8191,
+               .port_base_addr = 0x0,
+               .phy_base_addr = 0x0,
+@@ -5392,7 +5393,8 @@ static const struct mv88e6xxx_info mv88e
+               .name = "Marvell 88E6193X",
+               .num_databases = 4096,
+               .num_ports = 11,        /* 10 + Z80 */
+-              .num_internal_phys = 9,
++              .num_internal_phys = 8,
++              .internal_phys_offset = 1,
+               .max_vid = 8191,
+               .port_base_addr = 0x0,
+               .phy_base_addr = 0x0,
+@@ -5702,7 +5704,8 @@ static const struct mv88e6xxx_info mv88e
+               .name = "Marvell 88E6393X",
+               .num_databases = 4096,
+               .num_ports = 11,        /* 10 + Z80 */
+-              .num_internal_phys = 9,
++              .num_internal_phys = 8,
++              .internal_phys_offset = 1,
+               .max_vid = 8191,
+               .port_base_addr = 0x0,
+               .phy_base_addr = 0x0,
diff --git a/target/linux/generic/backport-5.15/893-v6.5-05-net-dsa-mv88e6xxx-pass-mv88e6xxx_chip-structure-to-p.patch b/target/linux/generic/backport-5.15/893-v6.5-05-net-dsa-mv88e6xxx-pass-mv88e6xxx_chip-structure-to-p.patch
new file mode 100644 (file)
index 0000000..f4de58a
--- /dev/null
@@ -0,0 +1,113 @@
+From 68690045f8e220826517c0d6f9388ffc1faa57ea Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alexis=20Lothor=C3=A9?= <alexis.lothore@bootlin.com>
+Date: Mon, 29 May 2023 10:02:45 +0200
+Subject: [PATCH 897/898] net: dsa: mv88e6xxx: pass mv88e6xxx_chip structure to
+ port_max_speed_mode
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Some switches families have minor differences on supported link speed for
+ports. Instead of redefining a new port_max_speed_mode for each different
+configuration, allow to pass mv88e6xxx_chip structure to allow
+differentiating those chips by known chip id
+
+Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Update one more instance of port_max_speed_mode that 5.15 has.
+[Robert Marko]
+Signed-off-by: Robert Marko <robimarko@gmail.com>
+---
+ drivers/net/dsa/mv88e6xxx/chip.c |  2 +-
+ drivers/net/dsa/mv88e6xxx/chip.h |  3 ++-
+ drivers/net/dsa/mv88e6xxx/port.c | 12 ++++++++----
+ drivers/net/dsa/mv88e6xxx/port.h | 12 ++++++++----
+ 4 files changed, 19 insertions(+), 10 deletions(-)
+
+--- a/drivers/net/dsa/mv88e6xxx/chip.c
++++ b/drivers/net/dsa/mv88e6xxx/chip.c
+@@ -443,7 +443,7 @@ static int mv88e6xxx_port_setup_mac(stru
+       }
+       if (speed == SPEED_MAX && chip->info->ops->port_max_speed_mode)
+-              mode = chip->info->ops->port_max_speed_mode(port);
++              mode = chip->info->ops->port_max_speed_mode(chip, port);
+       if (chip->info->ops->port_set_pause) {
+               err = chip->info->ops->port_set_pause(chip, port, pause);
+--- a/drivers/net/dsa/mv88e6xxx/chip.h
++++ b/drivers/net/dsa/mv88e6xxx/chip.h
+@@ -485,7 +485,8 @@ struct mv88e6xxx_ops {
+                                    int speed, int duplex);
+       /* What interface mode should be used for maximum speed? */
+-      phy_interface_t (*port_max_speed_mode)(int port);
++      phy_interface_t (*port_max_speed_mode)(struct mv88e6xxx_chip *chip,
++                                             int port);
+       int (*port_tag_remap)(struct mv88e6xxx_chip *chip, int port);
+--- a/drivers/net/dsa/mv88e6xxx/port.c
++++ b/drivers/net/dsa/mv88e6xxx/port.c
+@@ -357,7 +357,8 @@ int mv88e6341_port_set_speed_duplex(stru
+                                              duplex);
+ }
+-phy_interface_t mv88e6341_port_max_speed_mode(int port)
++phy_interface_t mv88e6341_port_max_speed_mode(struct mv88e6xxx_chip *chip,
++                                            int port)
+ {
+       if (port == 5)
+               return PHY_INTERFACE_MODE_2500BASEX;
+@@ -402,7 +403,8 @@ int mv88e6390_port_set_speed_duplex(stru
+                                              duplex);
+ }
+-phy_interface_t mv88e6390_port_max_speed_mode(int port)
++phy_interface_t mv88e6390_port_max_speed_mode(struct mv88e6xxx_chip *chip,
++                                            int port)
+ {
+       if (port == 9 || port == 10)
+               return PHY_INTERFACE_MODE_2500BASEX;
+@@ -427,7 +429,8 @@ int mv88e6390x_port_set_speed_duplex(str
+                                              duplex);
+ }
+-phy_interface_t mv88e6390x_port_max_speed_mode(int port)
++phy_interface_t mv88e6390x_port_max_speed_mode(struct mv88e6xxx_chip *chip,
++                                             int port)
+ {
+       if (port == 9 || port == 10)
+               return PHY_INTERFACE_MODE_XAUI;
+@@ -527,7 +530,8 @@ int mv88e6393x_port_set_speed_duplex(str
+       return 0;
+ }
+-phy_interface_t mv88e6393x_port_max_speed_mode(int port)
++phy_interface_t mv88e6393x_port_max_speed_mode(struct mv88e6xxx_chip *chip,
++                                             int port)
+ {
+       if (port == 0 || port == 9 || port == 10)
+               return PHY_INTERFACE_MODE_10GBASER;
+--- a/drivers/net/dsa/mv88e6xxx/port.h
++++ b/drivers/net/dsa/mv88e6xxx/port.h
+@@ -350,10 +350,14 @@ int mv88e6390x_port_set_speed_duplex(str
+ int mv88e6393x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port,
+                                    int speed, int duplex);
+-phy_interface_t mv88e6341_port_max_speed_mode(int port);
+-phy_interface_t mv88e6390_port_max_speed_mode(int port);
+-phy_interface_t mv88e6390x_port_max_speed_mode(int port);
+-phy_interface_t mv88e6393x_port_max_speed_mode(int port);
++phy_interface_t mv88e6341_port_max_speed_mode(struct mv88e6xxx_chip *chip,
++                                            int port);
++phy_interface_t mv88e6390_port_max_speed_mode(struct mv88e6xxx_chip *chip,
++                                            int port);
++phy_interface_t mv88e6390x_port_max_speed_mode(struct mv88e6xxx_chip *chip,
++                                             int port);
++phy_interface_t mv88e6393x_port_max_speed_mode(struct mv88e6xxx_chip *chip,
++                                             int port);
+ int mv88e6xxx_port_set_state(struct mv88e6xxx_chip *chip, int port, u8 state);
diff --git a/target/linux/generic/backport-5.15/893-v6.5-06-net-dsa-mv88e6xxx-enable-support-for-88E6361-switch.patch b/target/linux/generic/backport-5.15/893-v6.5-06-net-dsa-mv88e6xxx-enable-support-for-88E6361-switch.patch
new file mode 100644 (file)
index 0000000..c8254e5
--- /dev/null
@@ -0,0 +1,165 @@
+From f318a015330a11befd8c69336efc6284e240f535 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alexis=20Lothor=C3=A9?= <alexis.lothore@bootlin.com>
+Date: Mon, 29 May 2023 10:02:46 +0200
+Subject: [PATCH 898/898] net: dsa: mv88e6xxx: enable support for 88E6361
+ switch
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Marvell 88E6361 is an 8-port switch derived from the
+88E6393X/88E9193X/88E6191X switches family. It can benefit from the
+existing mv88e6xxx driver by simply adding the proper switch description in
+the driver. Main differences with other switches from this
+family are:
+- 8 ports exposed (instead of 11): ports 1, 2 and 8 not available
+- No 5GBase-x nor SFI/USXGMII support
+
+Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Adapt to 5.15 since we dont have phylink_get_caps yet.
+So, update the old mv88e6393x_phylink_validate instead.
+Remove max_sid since 5.15 driver does not support it yet.
+[Robert Marko]
+Signed-off-by: Robert Marko <robimarko@gmail.com>
+---
+ drivers/net/dsa/mv88e6xxx/chip.c | 49 +++++++++++++++++++++++++++++++-
+ drivers/net/dsa/mv88e6xxx/chip.h |  3 +-
+ drivers/net/dsa/mv88e6xxx/port.c | 14 +++++++--
+ drivers/net/dsa/mv88e6xxx/port.h |  1 +
+ 4 files changed, 62 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/dsa/mv88e6xxx/chip.c
++++ b/drivers/net/dsa/mv88e6xxx/chip.c
+@@ -648,6 +648,8 @@ static void mv88e6393x_phylink_validate(
+ {
+       bool is_6191x =
+               chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6191X;
++      bool is_6361 =
++              chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6361;
+       if (((port == 0 || port == 9) && !is_6191x) || port == 10) {
+               phylink_set(mask, 10000baseT_Full);
+@@ -662,8 +664,28 @@ static void mv88e6393x_phylink_validate(
+               phylink_set(mask, 2500baseT_Full);
+       }
++      if (port == 0 || port == 9 || port == 10) {
++              phylink_set(mask, 1000baseX_Full);
++
++              /* 6191X supports >1G modes only on port 10 */
++              if (!is_6191x || port == 10) {
++                      phylink_set(mask, 2500baseX_Full);
++                      phylink_set(mask, 2500baseT_Full);
++
++                      if (!is_6361) {
++                              phylink_set(mask, 10000baseT_Full);
++                              phylink_set(mask, 10000baseKR_Full);
++                              phylink_set(mask, 10000baseCR_Full);
++                              phylink_set(mask, 10000baseSR_Full);
++                              phylink_set(mask, 10000baseLR_Full);
++                              phylink_set(mask, 10000baseLRM_Full);
++                              phylink_set(mask, 10000baseER_Full);
++                              phylink_set(mask, 5000baseT_Full);
++                      }
++              }
++      }
++
+       phylink_set(mask, 1000baseT_Full);
+-      phylink_set(mask, 1000baseX_Full);
+       mv88e6065_phylink_validate(chip, port, mask, state);
+ }
+@@ -5649,6 +5671,31 @@ static const struct mv88e6xxx_info mv88e
+               .ptp_support = true,
+               .ops = &mv88e6352_ops,
+       },
++      [MV88E6361] = {
++              .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6361,
++              .family = MV88E6XXX_FAMILY_6393,
++              .name = "Marvell 88E6361",
++              .num_databases = 4096,
++              .num_macs = 16384,
++              .num_ports = 11,
++              /* Ports 1, 2 and 8 are not routed */
++              .invalid_port_mask = BIT(1) | BIT(2) | BIT(8),
++              .num_internal_phys = 5,
++              .internal_phys_offset = 3,
++              .max_vid = 4095,
++              .port_base_addr = 0x0,
++              .phy_base_addr = 0x0,
++              .global1_addr = 0x1b,
++              .global2_addr = 0x1c,
++              .age_time_coeff = 3750,
++              .g1_irqs = 10,
++              .g2_irqs = 14,
++              .atu_move_port_mask = 0x1f,
++              .pvt = true,
++              .multi_chip = true,
++              .ptp_support = true,
++              .ops = &mv88e6393x_ops,
++      },
+       [MV88E6390] = {
+               .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6390,
+               .family = MV88E6XXX_FAMILY_6390,
+--- a/drivers/net/dsa/mv88e6xxx/chip.h
++++ b/drivers/net/dsa/mv88e6xxx/chip.h
+@@ -81,6 +81,7 @@ enum mv88e6xxx_model {
+       MV88E6350,
+       MV88E6351,
+       MV88E6352,
++      MV88E6361,
+       MV88E6390,
+       MV88E6390X,
+       MV88E6393X,
+@@ -99,7 +100,7 @@ enum mv88e6xxx_family {
+       MV88E6XXX_FAMILY_6351,  /* 6171 6175 6350 6351 */
+       MV88E6XXX_FAMILY_6352,  /* 6172 6176 6240 6352 */
+       MV88E6XXX_FAMILY_6390,  /* 6190 6190X 6191 6290 6390 6390X */
+-      MV88E6XXX_FAMILY_6393,  /* 6191X 6193X 6393X */
++      MV88E6XXX_FAMILY_6393,  /* 6191X 6193X 6361 6393X */
+ };
+ /**
+--- a/drivers/net/dsa/mv88e6xxx/port.c
++++ b/drivers/net/dsa/mv88e6xxx/port.c
+@@ -451,6 +451,10 @@ int mv88e6393x_port_set_speed_duplex(str
+       if (speed == SPEED_MAX)
+               speed = (port > 0 && port < 9) ? 1000 : 10000;
++      if (chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6361 &&
++          speed > 2500)
++              return -EOPNOTSUPP;
++
+       if (speed == 200 && port != 0)
+               return -EOPNOTSUPP;
+@@ -533,10 +537,14 @@ int mv88e6393x_port_set_speed_duplex(str
+ phy_interface_t mv88e6393x_port_max_speed_mode(struct mv88e6xxx_chip *chip,
+                                              int port)
+ {
+-      if (port == 0 || port == 9 || port == 10)
+-              return PHY_INTERFACE_MODE_10GBASER;
+-      return PHY_INTERFACE_MODE_NA;
++      if (port != 0 && port != 9 && port != 10)
++              return PHY_INTERFACE_MODE_NA;
++
++      if (chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6361)
++              return PHY_INTERFACE_MODE_2500BASEX;
++
++      return PHY_INTERFACE_MODE_10GBASER;
+ }
+ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
+--- a/drivers/net/dsa/mv88e6xxx/port.h
++++ b/drivers/net/dsa/mv88e6xxx/port.h
+@@ -128,6 +128,7 @@
+ #define MV88E6XXX_PORT_SWITCH_ID_PROD_6220    0x2200
+ #define MV88E6XXX_PORT_SWITCH_ID_PROD_6240    0x2400
+ #define MV88E6XXX_PORT_SWITCH_ID_PROD_6250    0x2500
++#define MV88E6XXX_PORT_SWITCH_ID_PROD_6361    0x2610
+ #define MV88E6XXX_PORT_SWITCH_ID_PROD_6290    0x2900
+ #define MV88E6XXX_PORT_SWITCH_ID_PROD_6321    0x3100
+ #define MV88E6XXX_PORT_SWITCH_ID_PROD_6141    0x3400
index f6dacb6e50368882467cc5cd13b724406ce09ae7..a63bb25f1a5adf8d4eb6aa0510bbbde0c3874e1e 100644 (file)
@@ -9,7 +9,7 @@ Subject: [PATCH] net/dsa/mv88e6xxx: disable ATU violation
 
 --- a/drivers/net/dsa/mv88e6xxx/chip.c
 +++ b/drivers/net/dsa/mv88e6xxx/chip.c
-@@ -2993,6 +2993,9 @@ static int mv88e6xxx_setup_port(struct m
+@@ -3015,6 +3015,9 @@ static int mv88e6xxx_setup_port(struct m
        else
                reg = 1 << port;
  
index 5aa540acf7772d57485b11026f86409e6533a983..fa9d7ff0b85ba4d56d876571d2af43971192729a 100644 (file)
@@ -17,7 +17,7 @@ Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
 
 --- a/drivers/net/dsa/mv88e6xxx/chip.c
 +++ b/drivers/net/dsa/mv88e6xxx/chip.c
-@@ -6341,6 +6341,7 @@ static int mv88e6xxx_register_switch(str
+@@ -6391,6 +6391,7 @@ static int mv88e6xxx_register_switch(str
        ds->ops = &mv88e6xxx_switch_ops;
        ds->ageing_time_min = chip->info->age_time_coeff;
        ds->ageing_time_max = chip->info->age_time_coeff * U8_MAX;