generic: 6.1: backport support for Marvell 88E6361 switch
authorRobert Marko <robert.marko@sartura.hr>
Fri, 4 Aug 2023 12:39:18 +0000 (14:39 +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.

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

diff --git a/target/linux/generic/backport-6.1/807-v6.5-01-net-dsa-mv88e6xxx-pass-directly-chip-structure-to-mv.patch b/target/linux/generic/backport-6.1/807-v6.5-01-net-dsa-mv88e6xxx-pass-directly-chip-structure-to-mv.patch
new file mode 100644 (file)
index 0000000..58777cd
--- /dev/null
@@ -0,0 +1,64 @@
+From 4f86eb098e18fd0f032877dfa1a7e8c1503ca409 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:41 +0200
+Subject: [PATCH 1/6] 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 | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/dsa/mv88e6xxx/chip.c
++++ b/drivers/net/dsa/mv88e6xxx/chip.c
+@@ -470,10 +470,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;
+ }
+@@ -591,7 +589,7 @@ static void mv88e6095_phylink_get_caps(s
+       config->mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100;
+-      if (mv88e6xxx_phy_is_internal(chip->ds, port)) {
++      if (mv88e6xxx_phy_is_internal(chip, port)) {
+               __set_bit(PHY_INTERFACE_MODE_MII, config->supported_interfaces);
+       } else {
+               if (cmode < ARRAY_SIZE(mv88e6185_phy_interface_modes) &&
+@@ -839,7 +837,7 @@ static void mv88e6xxx_get_caps(struct ds
+       chip->info->ops->phylink_get_caps(chip, port, config);
+       mv88e6xxx_reg_unlock(chip);
+-      if (mv88e6xxx_phy_is_internal(ds, port)) {
++      if (mv88e6xxx_phy_is_internal(chip, port)) {
+               __set_bit(PHY_INTERFACE_MODE_INTERNAL,
+                         config->supported_interfaces);
+               /* Internal ports with no phy-mode need GMII for PHYLIB */
+@@ -860,7 +858,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-6.1/807-v6.5-02-net-dsa-mv88e6xxx-use-mv88e6xxx_phy_is_internal-in-m.patch b/target/linux/generic/backport-6.1/807-v6.5-02-net-dsa-mv88e6xxx-use-mv88e6xxx_phy_is_internal-in-m.patch
new file mode 100644 (file)
index 0000000..75a21a9
--- /dev/null
@@ -0,0 +1,31 @@
+From 73cbfad9296eed004992806e056db5b48583ca41 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 2/6] 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
+@@ -484,7 +484,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-6.1/807-v6.5-03-net-dsa-mv88e6xxx-add-field-to-specify-internal-phys.patch b/target/linux/generic/backport-6.1/807-v6.5-03-net-dsa-mv88e6xxx-add-field-to-specify-internal-phys.patch
new file mode 100644 (file)
index 0000000..e24dca8
--- /dev/null
@@ -0,0 +1,69 @@
+From 1414d30660d201f515a9d877571ceea9ca190b6a 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 3/6] 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
+@@ -472,7 +472,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
+@@ -167,6 +167,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-6.1/807-v6.5-04-net-dsa-mv88e6xxx-fix-88E6393X-family-internal-phys-.patch b/target/linux/generic/backport-6.1/807-v6.5-04-net-dsa-mv88e6xxx-fix-88E6393X-family-internal-phys-.patch
new file mode 100644 (file)
index 0000000..b7db7fb
--- /dev/null
@@ -0,0 +1,52 @@
+From eb8c75f82a6711387f3b9e03e28923f3e75a761b 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 4/6] 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
+@@ -5942,7 +5942,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,
+               .max_sid = 63,
+               .port_base_addr = 0x0,
+@@ -5965,7 +5966,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,
+               .max_sid = 63,
+               .port_base_addr = 0x0,
+@@ -6284,7 +6286,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,
+               .max_sid = 63,
+               .port_base_addr = 0x0,
diff --git a/target/linux/generic/backport-6.1/807-v6.5-05-net-dsa-mv88e6xxx-pass-mv88e6xxx_chip-structure-to-p.patch b/target/linux/generic/backport-6.1/807-v6.5-05-net-dsa-mv88e6xxx-pass-mv88e6xxx_chip-structure-to-p.patch
new file mode 100644 (file)
index 0000000..92ce97b
--- /dev/null
@@ -0,0 +1,110 @@
+From cef945452c8468efce75ba0dc8420510a5b84af9 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 5/6] 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>
+---
+ 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
+@@ -3326,7 +3326,7 @@ static int mv88e6xxx_setup_port(struct m
+               caps = pl_config.mac_capabilities;
+               if (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);
+               else
+                       mode = PHY_INTERFACE_MODE_NA;
+--- a/drivers/net/dsa/mv88e6xxx/chip.h
++++ b/drivers/net/dsa/mv88e6xxx/chip.h
+@@ -508,7 +508,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
+@@ -342,7 +342,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;
+@@ -381,7 +382,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;
+@@ -403,7 +405,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;
+@@ -500,7 +503,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
+@@ -359,10 +359,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-6.1/807-v6.5-06-net-dsa-mv88e6xxx-enable-support-for-88E6361-switch.patch b/target/linux/generic/backport-6.1/807-v6.5-06-net-dsa-mv88e6xxx-enable-support-for-88E6361-switch.patch
new file mode 100644 (file)
index 0000000..e5e815d
--- /dev/null
@@ -0,0 +1,153 @@
+From 23680321789863bab2d60af507858ce50ff9f56a 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 6/6] 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>
+---
+ drivers/net/dsa/mv88e6xxx/chip.c | 42 ++++++++++++++++++++++++++++----
+ drivers/net/dsa/mv88e6xxx/chip.h |  3 ++-
+ drivers/net/dsa/mv88e6xxx/port.c | 14 ++++++++---
+ drivers/net/dsa/mv88e6xxx/port.h |  1 +
+ 4 files changed, 51 insertions(+), 9 deletions(-)
+
+--- a/drivers/net/dsa/mv88e6xxx/chip.c
++++ b/drivers/net/dsa/mv88e6xxx/chip.c
+@@ -797,6 +797,8 @@ static void mv88e6393x_phylink_get_caps(
+       unsigned long *supported = config->supported_interfaces;
+       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;
+       mv88e6xxx_translate_cmode(chip->ports[port].cmode, supported);
+@@ -811,13 +813,17 @@ static void mv88e6393x_phylink_get_caps(
+               /* 6191X supports >1G modes only on port 10 */
+               if (!is_6191x || port == 10) {
+                       __set_bit(PHY_INTERFACE_MODE_2500BASEX, supported);
+-                      __set_bit(PHY_INTERFACE_MODE_5GBASER, supported);
+-                      __set_bit(PHY_INTERFACE_MODE_10GBASER, supported);
++                      config->mac_capabilities |= MAC_2500FD;
++
++                      /* 6361 only supports up to 2500BaseX */
++                      if (!is_6361) {
++                              __set_bit(PHY_INTERFACE_MODE_5GBASER, supported);
++                              __set_bit(PHY_INTERFACE_MODE_10GBASER, supported);
++                              config->mac_capabilities |= MAC_5000FD |
++                                      MAC_10000FD;
++                      }
+                       /* FIXME: USXGMII is not supported yet */
+                       /* __set_bit(PHY_INTERFACE_MODE_USXGMII, supported); */
+-
+-                      config->mac_capabilities |= MAC_2500FD | MAC_5000FD |
+-                              MAC_10000FD;
+               }
+       }
+@@ -6229,6 +6235,32 @@ 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,
++              .max_sid = 63,
++              .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
+@@ -82,6 +82,7 @@ enum mv88e6xxx_model {
+       MV88E6350,
+       MV88E6351,
+       MV88E6352,
++      MV88E6361,
+       MV88E6390,
+       MV88E6390X,
+       MV88E6393X,
+@@ -100,7 +101,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
+@@ -424,6 +424,10 @@ int mv88e6393x_port_set_speed_duplex(str
+       u16 reg, ctrl;
+       int err;
++      if (chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6361 &&
++          speed > 2500)
++              return -EOPNOTSUPP;
++
+       if (speed == 200 && port != 0)
+               return -EOPNOTSUPP;
+@@ -506,10 +510,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
+@@ -133,6 +133,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 9c45115ebb09dcef2bb7a41bc2515bad020235aa..5a8f253c34831a5bcaae100909245386cadb1d3a 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
-@@ -3480,6 +3480,9 @@ static int mv88e6xxx_setup_port(struct m
+@@ -3486,6 +3486,9 @@ static int mv88e6xxx_setup_port(struct m
        else
                reg = 1 << port;
  
index ac59b4b5ea61629f66e94dc1faee9970b819bac4..a32c7d3603ffe6d9bb611dfcf5583da5a28c8cb6 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
-@@ -6988,6 +6988,7 @@ static int mv88e6xxx_register_switch(str
+@@ -7023,6 +7023,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;