Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 2 | /* |
Vivien Didelot | 0d3cd4b | 2016-06-21 12:28:19 -0400 | [diff] [blame] | 3 | * Marvell 88e6xxx Ethernet switch single-chip support |
| 4 | * |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 5 | * Copyright (c) 2008 Marvell Semiconductor |
| 6 | * |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 7 | * Copyright (c) 2016 Andrew Lunn <andrew@lunn.ch> |
| 8 | * |
Vivien Didelot | 4333d61 | 2017-03-28 15:10:36 -0400 | [diff] [blame] | 9 | * Copyright (c) 2016-2017 Savoir-faire Linux Inc. |
| 10 | * Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 11 | */ |
| 12 | |
Barry Grussling | 19b2f97 | 2013-01-08 16:05:54 +0000 | [diff] [blame] | 13 | #include <linux/delay.h> |
Guenter Roeck | defb05b | 2015-03-26 18:36:38 -0700 | [diff] [blame] | 14 | #include <linux/etherdevice.h> |
Andrew Lunn | dea8702 | 2015-08-31 15:56:47 +0200 | [diff] [blame] | 15 | #include <linux/ethtool.h> |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 16 | #include <linux/if_bridge.h> |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 17 | #include <linux/interrupt.h> |
| 18 | #include <linux/irq.h> |
| 19 | #include <linux/irqdomain.h> |
Barry Grussling | 19b2f97 | 2013-01-08 16:05:54 +0000 | [diff] [blame] | 20 | #include <linux/jiffies.h> |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 21 | #include <linux/list.h> |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 22 | #include <linux/mdio.h> |
Paul Gortmaker | 2bbba27 | 2012-01-24 10:41:40 +0000 | [diff] [blame] | 23 | #include <linux/module.h> |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 24 | #include <linux/of_device.h> |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 25 | #include <linux/of_irq.h> |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 26 | #include <linux/of_mdio.h> |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 27 | #include <linux/platform_data/mv88e6xxx.h> |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 28 | #include <linux/netdevice.h> |
Andrew Lunn | c8c1b39a | 2015-11-20 03:56:24 +0100 | [diff] [blame] | 29 | #include <linux/gpio/consumer.h> |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 30 | #include <linux/phy.h> |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 31 | #include <linux/phylink.h> |
Ben Hutchings | c8f0b86 | 2011-11-27 17:06:08 +0000 | [diff] [blame] | 32 | #include <net/dsa.h> |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 33 | |
Vivien Didelot | 4d5f2ba7 | 2017-06-02 17:06:15 -0400 | [diff] [blame] | 34 | #include "chip.h" |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 35 | #include "global1.h" |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 36 | #include "global2.h" |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 37 | #include "hwtstamp.h" |
Andrew Lunn | 10fa5bf | 2017-05-26 01:03:20 +0200 | [diff] [blame] | 38 | #include "phy.h" |
Vivien Didelot | 18abed2 | 2016-11-04 03:23:26 +0100 | [diff] [blame] | 39 | #include "port.h" |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 40 | #include "ptp.h" |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 41 | #include "serdes.h" |
Vivien Didelot | e7ba0fa | 2019-05-03 19:28:22 -0400 | [diff] [blame] | 42 | #include "smi.h" |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 43 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 44 | static void assert_reg_lock(struct mv88e6xxx_chip *chip) |
Vivien Didelot | 3996a4f | 2015-10-30 18:56:45 -0400 | [diff] [blame] | 45 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 46 | if (unlikely(!mutex_is_locked(&chip->reg_lock))) { |
| 47 | dev_err(chip->dev, "Switch registers lock not held!\n"); |
Vivien Didelot | 3996a4f | 2015-10-30 18:56:45 -0400 | [diff] [blame] | 48 | dump_stack(); |
| 49 | } |
| 50 | } |
| 51 | |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 52 | int mv88e6xxx_read(struct mv88e6xxx_chip *chip, int addr, int reg, u16 *val) |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 53 | { |
| 54 | int err; |
| 55 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 56 | assert_reg_lock(chip); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 57 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 58 | err = mv88e6xxx_smi_read(chip, addr, reg, val); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 59 | if (err) |
| 60 | return err; |
| 61 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 62 | dev_dbg(chip->dev, "<- addr: 0x%.2x reg: 0x%.2x val: 0x%.4x\n", |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 63 | addr, reg, *val); |
| 64 | |
| 65 | return 0; |
| 66 | } |
| 67 | |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 68 | int mv88e6xxx_write(struct mv88e6xxx_chip *chip, int addr, int reg, u16 val) |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 69 | { |
| 70 | int err; |
| 71 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 72 | assert_reg_lock(chip); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 73 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 74 | err = mv88e6xxx_smi_write(chip, addr, reg, val); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 75 | if (err) |
| 76 | return err; |
| 77 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 78 | dev_dbg(chip->dev, "-> addr: 0x%.2x reg: 0x%.2x val: 0x%.4x\n", |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 79 | addr, reg, val); |
| 80 | |
| 81 | return 0; |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 82 | } |
| 83 | |
Andrew Lunn | 10fa5bf | 2017-05-26 01:03:20 +0200 | [diff] [blame] | 84 | struct mii_bus *mv88e6xxx_default_mdio_bus(struct mv88e6xxx_chip *chip) |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 85 | { |
| 86 | struct mv88e6xxx_mdio_bus *mdio_bus; |
| 87 | |
| 88 | mdio_bus = list_first_entry(&chip->mdios, struct mv88e6xxx_mdio_bus, |
| 89 | list); |
| 90 | if (!mdio_bus) |
| 91 | return NULL; |
| 92 | |
| 93 | return mdio_bus->bus; |
| 94 | } |
| 95 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 96 | static void mv88e6xxx_g1_irq_mask(struct irq_data *d) |
| 97 | { |
| 98 | struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); |
| 99 | unsigned int n = d->hwirq; |
| 100 | |
| 101 | chip->g1_irq.masked |= (1 << n); |
| 102 | } |
| 103 | |
| 104 | static void mv88e6xxx_g1_irq_unmask(struct irq_data *d) |
| 105 | { |
| 106 | struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); |
| 107 | unsigned int n = d->hwirq; |
| 108 | |
| 109 | chip->g1_irq.masked &= ~(1 << n); |
| 110 | } |
| 111 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 112 | static irqreturn_t mv88e6xxx_g1_irq_thread_work(struct mv88e6xxx_chip *chip) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 113 | { |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 114 | unsigned int nhandled = 0; |
| 115 | unsigned int sub_irq; |
| 116 | unsigned int n; |
| 117 | u16 reg; |
John David Anglin | 7c0db24 | 2019-02-11 13:40:21 -0500 | [diff] [blame] | 118 | u16 ctl1; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 119 | int err; |
| 120 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 121 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 8246692 | 2017-06-15 12:13:59 -0400 | [diff] [blame] | 122 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, ®); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 123 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 124 | |
| 125 | if (err) |
| 126 | goto out; |
| 127 | |
John David Anglin | 7c0db24 | 2019-02-11 13:40:21 -0500 | [diff] [blame] | 128 | do { |
| 129 | for (n = 0; n < chip->g1_irq.nirqs; ++n) { |
| 130 | if (reg & (1 << n)) { |
| 131 | sub_irq = irq_find_mapping(chip->g1_irq.domain, |
| 132 | n); |
| 133 | handle_nested_irq(sub_irq); |
| 134 | ++nhandled; |
| 135 | } |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 136 | } |
John David Anglin | 7c0db24 | 2019-02-11 13:40:21 -0500 | [diff] [blame] | 137 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 138 | mv88e6xxx_reg_lock(chip); |
John David Anglin | 7c0db24 | 2019-02-11 13:40:21 -0500 | [diff] [blame] | 139 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &ctl1); |
| 140 | if (err) |
| 141 | goto unlock; |
| 142 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, ®); |
| 143 | unlock: |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 144 | mv88e6xxx_reg_unlock(chip); |
John David Anglin | 7c0db24 | 2019-02-11 13:40:21 -0500 | [diff] [blame] | 145 | if (err) |
| 146 | goto out; |
| 147 | ctl1 &= GENMASK(chip->g1_irq.nirqs, 0); |
| 148 | } while (reg & ctl1); |
| 149 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 150 | out: |
| 151 | return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE); |
| 152 | } |
| 153 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 154 | static irqreturn_t mv88e6xxx_g1_irq_thread_fn(int irq, void *dev_id) |
| 155 | { |
| 156 | struct mv88e6xxx_chip *chip = dev_id; |
| 157 | |
| 158 | return mv88e6xxx_g1_irq_thread_work(chip); |
| 159 | } |
| 160 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 161 | static void mv88e6xxx_g1_irq_bus_lock(struct irq_data *d) |
| 162 | { |
| 163 | struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); |
| 164 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 165 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | static void mv88e6xxx_g1_irq_bus_sync_unlock(struct irq_data *d) |
| 169 | { |
| 170 | struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); |
| 171 | u16 mask = GENMASK(chip->g1_irq.nirqs, 0); |
| 172 | u16 reg; |
| 173 | int err; |
| 174 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 175 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, ®); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 176 | if (err) |
| 177 | goto out; |
| 178 | |
| 179 | reg &= ~mask; |
| 180 | reg |= (~chip->g1_irq.masked & mask); |
| 181 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 182 | err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, reg); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 183 | if (err) |
| 184 | goto out; |
| 185 | |
| 186 | out: |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 187 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 188 | } |
| 189 | |
Bhumika Goyal | 6eb15e2 | 2017-08-19 16:25:52 +0530 | [diff] [blame] | 190 | static const struct irq_chip mv88e6xxx_g1_irq_chip = { |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 191 | .name = "mv88e6xxx-g1", |
| 192 | .irq_mask = mv88e6xxx_g1_irq_mask, |
| 193 | .irq_unmask = mv88e6xxx_g1_irq_unmask, |
| 194 | .irq_bus_lock = mv88e6xxx_g1_irq_bus_lock, |
| 195 | .irq_bus_sync_unlock = mv88e6xxx_g1_irq_bus_sync_unlock, |
| 196 | }; |
| 197 | |
| 198 | static int mv88e6xxx_g1_irq_domain_map(struct irq_domain *d, |
| 199 | unsigned int irq, |
| 200 | irq_hw_number_t hwirq) |
| 201 | { |
| 202 | struct mv88e6xxx_chip *chip = d->host_data; |
| 203 | |
| 204 | irq_set_chip_data(irq, d->host_data); |
| 205 | irq_set_chip_and_handler(irq, &chip->g1_irq.chip, handle_level_irq); |
| 206 | irq_set_noprobe(irq); |
| 207 | |
| 208 | return 0; |
| 209 | } |
| 210 | |
| 211 | static const struct irq_domain_ops mv88e6xxx_g1_irq_domain_ops = { |
| 212 | .map = mv88e6xxx_g1_irq_domain_map, |
| 213 | .xlate = irq_domain_xlate_twocell, |
| 214 | }; |
| 215 | |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame] | 216 | /* To be called with reg_lock held */ |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 217 | static void mv88e6xxx_g1_irq_free_common(struct mv88e6xxx_chip *chip) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 218 | { |
| 219 | int irq, virq; |
Andrew Lunn | 3460a57 | 2016-11-20 20:14:16 +0100 | [diff] [blame] | 220 | u16 mask; |
| 221 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 222 | mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &mask); |
Andrew Lunn | 3d5fdba | 2017-12-07 01:05:56 +0100 | [diff] [blame] | 223 | mask &= ~GENMASK(chip->g1_irq.nirqs, 0); |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 224 | mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask); |
Andrew Lunn | 3460a57 | 2016-11-20 20:14:16 +0100 | [diff] [blame] | 225 | |
Andreas Färber | 5edef2f | 2016-11-27 23:26:28 +0100 | [diff] [blame] | 226 | for (irq = 0; irq < chip->g1_irq.nirqs; irq++) { |
Andrew Lunn | a3db3d3 | 2016-11-20 20:14:14 +0100 | [diff] [blame] | 227 | virq = irq_find_mapping(chip->g1_irq.domain, irq); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 228 | irq_dispose_mapping(virq); |
| 229 | } |
| 230 | |
Andrew Lunn | a3db3d3 | 2016-11-20 20:14:14 +0100 | [diff] [blame] | 231 | irq_domain_remove(chip->g1_irq.domain); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 232 | } |
| 233 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 234 | static void mv88e6xxx_g1_irq_free(struct mv88e6xxx_chip *chip) |
| 235 | { |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame] | 236 | /* |
| 237 | * free_irq must be called without reg_lock taken because the irq |
| 238 | * handler takes this lock, too. |
| 239 | */ |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 240 | free_irq(chip->irq, chip); |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame] | 241 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 242 | mv88e6xxx_reg_lock(chip); |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame] | 243 | mv88e6xxx_g1_irq_free_common(chip); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 244 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | static int mv88e6xxx_g1_irq_setup_common(struct mv88e6xxx_chip *chip) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 248 | { |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 249 | int err, irq, virq; |
| 250 | u16 reg, mask; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 251 | |
| 252 | chip->g1_irq.nirqs = chip->info->g1_irqs; |
| 253 | chip->g1_irq.domain = irq_domain_add_simple( |
| 254 | NULL, chip->g1_irq.nirqs, 0, |
| 255 | &mv88e6xxx_g1_irq_domain_ops, chip); |
| 256 | if (!chip->g1_irq.domain) |
| 257 | return -ENOMEM; |
| 258 | |
| 259 | for (irq = 0; irq < chip->g1_irq.nirqs; irq++) |
| 260 | irq_create_mapping(chip->g1_irq.domain, irq); |
| 261 | |
| 262 | chip->g1_irq.chip = mv88e6xxx_g1_irq_chip; |
| 263 | chip->g1_irq.masked = ~0; |
| 264 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 265 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &mask); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 266 | if (err) |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 267 | goto out_mapping; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 268 | |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 269 | mask &= ~GENMASK(chip->g1_irq.nirqs, 0); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 270 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 271 | err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 272 | if (err) |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 273 | goto out_disable; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 274 | |
| 275 | /* Reading the interrupt status clears (most of) them */ |
Vivien Didelot | 8246692 | 2017-06-15 12:13:59 -0400 | [diff] [blame] | 276 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, ®); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 277 | if (err) |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 278 | goto out_disable; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 279 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 280 | return 0; |
| 281 | |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 282 | out_disable: |
Andrew Lunn | 3d5fdba | 2017-12-07 01:05:56 +0100 | [diff] [blame] | 283 | mask &= ~GENMASK(chip->g1_irq.nirqs, 0); |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 284 | mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask); |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 285 | |
| 286 | out_mapping: |
| 287 | for (irq = 0; irq < 16; irq++) { |
| 288 | virq = irq_find_mapping(chip->g1_irq.domain, irq); |
| 289 | irq_dispose_mapping(virq); |
| 290 | } |
| 291 | |
| 292 | irq_domain_remove(chip->g1_irq.domain); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 293 | |
| 294 | return err; |
| 295 | } |
| 296 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 297 | static int mv88e6xxx_g1_irq_setup(struct mv88e6xxx_chip *chip) |
| 298 | { |
Andrew Lunn | f6d9758 | 2019-02-23 17:43:56 +0100 | [diff] [blame] | 299 | static struct lock_class_key lock_key; |
| 300 | static struct lock_class_key request_key; |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 301 | int err; |
| 302 | |
| 303 | err = mv88e6xxx_g1_irq_setup_common(chip); |
| 304 | if (err) |
| 305 | return err; |
| 306 | |
Andrew Lunn | f6d9758 | 2019-02-23 17:43:56 +0100 | [diff] [blame] | 307 | /* These lock classes tells lockdep that global 1 irqs are in |
| 308 | * a different category than their parent GPIO, so it won't |
| 309 | * report false recursion. |
| 310 | */ |
| 311 | irq_set_lockdep_class(chip->irq, &lock_key, &request_key); |
| 312 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 313 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 314 | err = request_threaded_irq(chip->irq, NULL, |
| 315 | mv88e6xxx_g1_irq_thread_fn, |
Marek Behún | 0340376 | 2018-08-30 02:13:50 +0200 | [diff] [blame] | 316 | IRQF_ONESHOT | IRQF_SHARED, |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 317 | dev_name(chip->dev), chip); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 318 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 319 | if (err) |
| 320 | mv88e6xxx_g1_irq_free_common(chip); |
| 321 | |
| 322 | return err; |
| 323 | } |
| 324 | |
| 325 | static void mv88e6xxx_irq_poll(struct kthread_work *work) |
| 326 | { |
| 327 | struct mv88e6xxx_chip *chip = container_of(work, |
| 328 | struct mv88e6xxx_chip, |
| 329 | irq_poll_work.work); |
| 330 | mv88e6xxx_g1_irq_thread_work(chip); |
| 331 | |
| 332 | kthread_queue_delayed_work(chip->kworker, &chip->irq_poll_work, |
| 333 | msecs_to_jiffies(100)); |
| 334 | } |
| 335 | |
| 336 | static int mv88e6xxx_irq_poll_setup(struct mv88e6xxx_chip *chip) |
| 337 | { |
| 338 | int err; |
| 339 | |
| 340 | err = mv88e6xxx_g1_irq_setup_common(chip); |
| 341 | if (err) |
| 342 | return err; |
| 343 | |
| 344 | kthread_init_delayed_work(&chip->irq_poll_work, |
| 345 | mv88e6xxx_irq_poll); |
| 346 | |
Florian Fainelli | 3f8b869 | 2019-02-21 20:09:27 -0800 | [diff] [blame] | 347 | chip->kworker = kthread_create_worker(0, "%s", dev_name(chip->dev)); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 348 | if (IS_ERR(chip->kworker)) |
| 349 | return PTR_ERR(chip->kworker); |
| 350 | |
| 351 | kthread_queue_delayed_work(chip->kworker, &chip->irq_poll_work, |
| 352 | msecs_to_jiffies(100)); |
| 353 | |
| 354 | return 0; |
| 355 | } |
| 356 | |
| 357 | static void mv88e6xxx_irq_poll_free(struct mv88e6xxx_chip *chip) |
| 358 | { |
| 359 | kthread_cancel_delayed_work_sync(&chip->irq_poll_work); |
| 360 | kthread_destroy_worker(chip->kworker); |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame] | 361 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 362 | mv88e6xxx_reg_lock(chip); |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame] | 363 | mv88e6xxx_g1_irq_free_common(chip); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 364 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 365 | } |
| 366 | |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 367 | int mv88e6xxx_wait(struct mv88e6xxx_chip *chip, int addr, int reg, u16 mask) |
Vivien Didelot | 2d79af6 | 2016-08-15 17:18:57 -0400 | [diff] [blame] | 368 | { |
Andrew Lunn | 6441e669 | 2016-08-19 00:01:55 +0200 | [diff] [blame] | 369 | int i; |
Vivien Didelot | 2d79af6 | 2016-08-15 17:18:57 -0400 | [diff] [blame] | 370 | |
Andrew Lunn | 6441e669 | 2016-08-19 00:01:55 +0200 | [diff] [blame] | 371 | for (i = 0; i < 16; i++) { |
Vivien Didelot | 2d79af6 | 2016-08-15 17:18:57 -0400 | [diff] [blame] | 372 | u16 val; |
| 373 | int err; |
| 374 | |
| 375 | err = mv88e6xxx_read(chip, addr, reg, &val); |
| 376 | if (err) |
| 377 | return err; |
| 378 | |
| 379 | if (!(val & mask)) |
| 380 | return 0; |
| 381 | |
| 382 | usleep_range(1000, 2000); |
| 383 | } |
| 384 | |
Andrew Lunn | 3085355 | 2016-08-19 00:01:57 +0200 | [diff] [blame] | 385 | dev_err(chip->dev, "Timeout while waiting for switch\n"); |
Vivien Didelot | 2d79af6 | 2016-08-15 17:18:57 -0400 | [diff] [blame] | 386 | return -ETIMEDOUT; |
| 387 | } |
| 388 | |
Vivien Didelot | f22ab64 | 2016-07-18 20:45:31 -0400 | [diff] [blame] | 389 | /* Indirect write to single pointer-data register with an Update bit */ |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 390 | int mv88e6xxx_update(struct mv88e6xxx_chip *chip, int addr, int reg, u16 update) |
Vivien Didelot | f22ab64 | 2016-07-18 20:45:31 -0400 | [diff] [blame] | 391 | { |
| 392 | u16 val; |
Andrew Lunn | 0f02b4f | 2016-08-19 00:01:56 +0200 | [diff] [blame] | 393 | int err; |
Vivien Didelot | f22ab64 | 2016-07-18 20:45:31 -0400 | [diff] [blame] | 394 | |
| 395 | /* Wait until the previous operation is completed */ |
Andrew Lunn | 0f02b4f | 2016-08-19 00:01:56 +0200 | [diff] [blame] | 396 | err = mv88e6xxx_wait(chip, addr, reg, BIT(15)); |
| 397 | if (err) |
| 398 | return err; |
Vivien Didelot | f22ab64 | 2016-07-18 20:45:31 -0400 | [diff] [blame] | 399 | |
| 400 | /* Set the Update bit to trigger a write operation */ |
| 401 | val = BIT(15) | update; |
| 402 | |
| 403 | return mv88e6xxx_write(chip, addr, reg, val); |
| 404 | } |
| 405 | |
Heiner Kallweit | 72d8b4f | 2019-03-01 20:41:00 +0100 | [diff] [blame] | 406 | int mv88e6xxx_port_setup_mac(struct mv88e6xxx_chip *chip, int port, int link, |
| 407 | int speed, int duplex, int pause, |
| 408 | phy_interface_t mode) |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 409 | { |
Andrew Lunn | a26deec | 2019-04-18 03:11:39 +0200 | [diff] [blame] | 410 | struct phylink_link_state state; |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 411 | int err; |
| 412 | |
| 413 | if (!chip->info->ops->port_set_link) |
| 414 | return 0; |
| 415 | |
Andrew Lunn | a26deec | 2019-04-18 03:11:39 +0200 | [diff] [blame] | 416 | if (!chip->info->ops->port_link_state) |
| 417 | return 0; |
| 418 | |
| 419 | err = chip->info->ops->port_link_state(chip, port, &state); |
| 420 | if (err) |
| 421 | return err; |
| 422 | |
| 423 | /* Has anything actually changed? We don't expect the |
| 424 | * interface mode to change without one of the other |
| 425 | * parameters also changing |
| 426 | */ |
| 427 | if (state.link == link && |
| 428 | state.speed == speed && |
| 429 | state.duplex == duplex) |
| 430 | return 0; |
| 431 | |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 432 | /* Port's MAC control must not be changed unless the link is down */ |
| 433 | err = chip->info->ops->port_set_link(chip, port, 0); |
| 434 | if (err) |
| 435 | return err; |
| 436 | |
| 437 | if (chip->info->ops->port_set_speed) { |
| 438 | err = chip->info->ops->port_set_speed(chip, port, speed); |
| 439 | if (err && err != -EOPNOTSUPP) |
| 440 | goto restore_link; |
| 441 | } |
| 442 | |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 443 | if (speed == SPEED_MAX && chip->info->ops->port_max_speed_mode) |
| 444 | mode = chip->info->ops->port_max_speed_mode(port); |
| 445 | |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 446 | if (chip->info->ops->port_set_pause) { |
| 447 | err = chip->info->ops->port_set_pause(chip, port, pause); |
| 448 | if (err) |
| 449 | goto restore_link; |
| 450 | } |
| 451 | |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 452 | if (chip->info->ops->port_set_duplex) { |
| 453 | err = chip->info->ops->port_set_duplex(chip, port, duplex); |
| 454 | if (err && err != -EOPNOTSUPP) |
| 455 | goto restore_link; |
| 456 | } |
| 457 | |
| 458 | if (chip->info->ops->port_set_rgmii_delay) { |
| 459 | err = chip->info->ops->port_set_rgmii_delay(chip, port, mode); |
| 460 | if (err && err != -EOPNOTSUPP) |
| 461 | goto restore_link; |
| 462 | } |
| 463 | |
Andrew Lunn | f39908d | 2017-02-04 20:02:50 +0100 | [diff] [blame] | 464 | if (chip->info->ops->port_set_cmode) { |
| 465 | err = chip->info->ops->port_set_cmode(chip, port, mode); |
| 466 | if (err && err != -EOPNOTSUPP) |
| 467 | goto restore_link; |
| 468 | } |
| 469 | |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 470 | err = 0; |
| 471 | restore_link: |
| 472 | if (chip->info->ops->port_set_link(chip, port, link)) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 473 | dev_err(chip->dev, "p%d: failed to restore MAC's link\n", port); |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 474 | |
| 475 | return err; |
| 476 | } |
| 477 | |
Marek Vasut | d700ec4 | 2018-09-12 00:15:24 +0200 | [diff] [blame] | 478 | static int mv88e6xxx_phy_is_internal(struct dsa_switch *ds, int port) |
| 479 | { |
| 480 | struct mv88e6xxx_chip *chip = ds->priv; |
| 481 | |
| 482 | return port < chip->info->num_internal_phys; |
| 483 | } |
| 484 | |
Andrew Lunn | dea8702 | 2015-08-31 15:56:47 +0200 | [diff] [blame] | 485 | /* We expect the switch to perform auto negotiation if there is a real |
| 486 | * phy. However, in the case of a fixed link phy, we force the port |
| 487 | * settings from the fixed link settings. |
| 488 | */ |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 489 | static void mv88e6xxx_adjust_link(struct dsa_switch *ds, int port, |
| 490 | struct phy_device *phydev) |
Andrew Lunn | dea8702 | 2015-08-31 15:56:47 +0200 | [diff] [blame] | 491 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 492 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 493 | int err; |
Andrew Lunn | dea8702 | 2015-08-31 15:56:47 +0200 | [diff] [blame] | 494 | |
Marek Vasut | d700ec4 | 2018-09-12 00:15:24 +0200 | [diff] [blame] | 495 | if (!phy_is_pseudo_fixed_link(phydev) && |
| 496 | mv88e6xxx_phy_is_internal(ds, port)) |
Andrew Lunn | dea8702 | 2015-08-31 15:56:47 +0200 | [diff] [blame] | 497 | return; |
| 498 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 499 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 500 | err = mv88e6xxx_port_setup_mac(chip, port, phydev->link, phydev->speed, |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 501 | phydev->duplex, phydev->pause, |
| 502 | phydev->interface); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 503 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 504 | |
| 505 | if (err && err != -EOPNOTSUPP) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 506 | dev_err(ds->dev, "p%d: failed to configure MAC\n", port); |
Andrew Lunn | dea8702 | 2015-08-31 15:56:47 +0200 | [diff] [blame] | 507 | } |
| 508 | |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 509 | static void mv88e6065_phylink_validate(struct mv88e6xxx_chip *chip, int port, |
| 510 | unsigned long *mask, |
| 511 | struct phylink_link_state *state) |
| 512 | { |
| 513 | if (!phy_interface_mode_is_8023z(state->interface)) { |
| 514 | /* 10M and 100M are only supported in non-802.3z mode */ |
| 515 | phylink_set(mask, 10baseT_Half); |
| 516 | phylink_set(mask, 10baseT_Full); |
| 517 | phylink_set(mask, 100baseT_Half); |
| 518 | phylink_set(mask, 100baseT_Full); |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | static void mv88e6185_phylink_validate(struct mv88e6xxx_chip *chip, int port, |
| 523 | unsigned long *mask, |
| 524 | struct phylink_link_state *state) |
| 525 | { |
| 526 | /* FIXME: if the port is in 1000Base-X mode, then it only supports |
| 527 | * 1000M FD speeds. In this case, CMODE will indicate 5. |
| 528 | */ |
| 529 | phylink_set(mask, 1000baseT_Full); |
| 530 | phylink_set(mask, 1000baseX_Full); |
| 531 | |
| 532 | mv88e6065_phylink_validate(chip, port, mask, state); |
| 533 | } |
| 534 | |
Marek Behún | e3af71a | 2019-02-25 12:39:55 +0100 | [diff] [blame] | 535 | static void mv88e6341_phylink_validate(struct mv88e6xxx_chip *chip, int port, |
| 536 | unsigned long *mask, |
| 537 | struct phylink_link_state *state) |
| 538 | { |
| 539 | if (port >= 5) |
| 540 | phylink_set(mask, 2500baseX_Full); |
| 541 | |
| 542 | /* No ethtool bits for 200Mbps */ |
| 543 | phylink_set(mask, 1000baseT_Full); |
| 544 | phylink_set(mask, 1000baseX_Full); |
| 545 | |
| 546 | mv88e6065_phylink_validate(chip, port, mask, state); |
| 547 | } |
| 548 | |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 549 | static void mv88e6352_phylink_validate(struct mv88e6xxx_chip *chip, int port, |
| 550 | unsigned long *mask, |
| 551 | struct phylink_link_state *state) |
| 552 | { |
| 553 | /* No ethtool bits for 200Mbps */ |
| 554 | phylink_set(mask, 1000baseT_Full); |
| 555 | phylink_set(mask, 1000baseX_Full); |
| 556 | |
| 557 | mv88e6065_phylink_validate(chip, port, mask, state); |
| 558 | } |
| 559 | |
| 560 | static void mv88e6390_phylink_validate(struct mv88e6xxx_chip *chip, int port, |
| 561 | unsigned long *mask, |
| 562 | struct phylink_link_state *state) |
| 563 | { |
Andrew Lunn | ec26016 | 2019-02-08 22:25:44 +0100 | [diff] [blame] | 564 | if (port >= 9) { |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 565 | phylink_set(mask, 2500baseX_Full); |
Andrew Lunn | ec26016 | 2019-02-08 22:25:44 +0100 | [diff] [blame] | 566 | phylink_set(mask, 2500baseT_Full); |
| 567 | } |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 568 | |
| 569 | /* No ethtool bits for 200Mbps */ |
| 570 | phylink_set(mask, 1000baseT_Full); |
| 571 | phylink_set(mask, 1000baseX_Full); |
| 572 | |
| 573 | mv88e6065_phylink_validate(chip, port, mask, state); |
| 574 | } |
| 575 | |
| 576 | static void mv88e6390x_phylink_validate(struct mv88e6xxx_chip *chip, int port, |
| 577 | unsigned long *mask, |
| 578 | struct phylink_link_state *state) |
| 579 | { |
| 580 | if (port >= 9) { |
| 581 | phylink_set(mask, 10000baseT_Full); |
| 582 | phylink_set(mask, 10000baseKR_Full); |
| 583 | } |
| 584 | |
| 585 | mv88e6390_phylink_validate(chip, port, mask, state); |
| 586 | } |
| 587 | |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 588 | static void mv88e6xxx_validate(struct dsa_switch *ds, int port, |
| 589 | unsigned long *supported, |
| 590 | struct phylink_link_state *state) |
| 591 | { |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 592 | __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; |
| 593 | struct mv88e6xxx_chip *chip = ds->priv; |
| 594 | |
| 595 | /* Allow all the expected bits */ |
| 596 | phylink_set(mask, Autoneg); |
| 597 | phylink_set(mask, Pause); |
| 598 | phylink_set_port_modes(mask); |
| 599 | |
| 600 | if (chip->info->ops->phylink_validate) |
| 601 | chip->info->ops->phylink_validate(chip, port, mask, state); |
| 602 | |
| 603 | bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS); |
| 604 | bitmap_and(state->advertising, state->advertising, mask, |
| 605 | __ETHTOOL_LINK_MODE_MASK_NBITS); |
| 606 | |
| 607 | /* We can only operate at 2500BaseX or 1000BaseX. If requested |
| 608 | * to advertise both, only report advertising at 2500BaseX. |
| 609 | */ |
| 610 | phylink_helper_basex_speed(state); |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 611 | } |
| 612 | |
| 613 | static int mv88e6xxx_link_state(struct dsa_switch *ds, int port, |
| 614 | struct phylink_link_state *state) |
| 615 | { |
| 616 | struct mv88e6xxx_chip *chip = ds->priv; |
| 617 | int err; |
| 618 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 619 | mv88e6xxx_reg_lock(chip); |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 620 | if (chip->info->ops->port_link_state) |
| 621 | err = chip->info->ops->port_link_state(chip, port, state); |
| 622 | else |
| 623 | err = -EOPNOTSUPP; |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 624 | mv88e6xxx_reg_unlock(chip); |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 625 | |
| 626 | return err; |
| 627 | } |
| 628 | |
| 629 | static void mv88e6xxx_mac_config(struct dsa_switch *ds, int port, |
| 630 | unsigned int mode, |
| 631 | const struct phylink_link_state *state) |
| 632 | { |
| 633 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 634 | int speed, duplex, link, pause, err; |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 635 | |
Marek Vasut | d700ec4 | 2018-09-12 00:15:24 +0200 | [diff] [blame] | 636 | if ((mode == MLO_AN_PHY) && mv88e6xxx_phy_is_internal(ds, port)) |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 637 | return; |
| 638 | |
| 639 | if (mode == MLO_AN_FIXED) { |
| 640 | link = LINK_FORCED_UP; |
| 641 | speed = state->speed; |
| 642 | duplex = state->duplex; |
Marek Vasut | d700ec4 | 2018-09-12 00:15:24 +0200 | [diff] [blame] | 643 | } else if (!mv88e6xxx_phy_is_internal(ds, port)) { |
| 644 | link = state->link; |
| 645 | speed = state->speed; |
| 646 | duplex = state->duplex; |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 647 | } else { |
| 648 | speed = SPEED_UNFORCED; |
| 649 | duplex = DUPLEX_UNFORCED; |
| 650 | link = LINK_UNFORCED; |
| 651 | } |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 652 | pause = !!phylink_test(state->advertising, Pause); |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 653 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 654 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 655 | err = mv88e6xxx_port_setup_mac(chip, port, link, speed, duplex, pause, |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 656 | state->interface); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 657 | mv88e6xxx_reg_unlock(chip); |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 658 | |
| 659 | if (err && err != -EOPNOTSUPP) |
| 660 | dev_err(ds->dev, "p%d: failed to configure MAC\n", port); |
| 661 | } |
| 662 | |
| 663 | static void mv88e6xxx_mac_link_force(struct dsa_switch *ds, int port, int link) |
| 664 | { |
| 665 | struct mv88e6xxx_chip *chip = ds->priv; |
| 666 | int err; |
| 667 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 668 | mv88e6xxx_reg_lock(chip); |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 669 | err = chip->info->ops->port_set_link(chip, port, link); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 670 | mv88e6xxx_reg_unlock(chip); |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 671 | |
| 672 | if (err) |
| 673 | dev_err(chip->dev, "p%d: failed to force MAC link\n", port); |
| 674 | } |
| 675 | |
| 676 | static void mv88e6xxx_mac_link_down(struct dsa_switch *ds, int port, |
| 677 | unsigned int mode, |
| 678 | phy_interface_t interface) |
| 679 | { |
| 680 | if (mode == MLO_AN_FIXED) |
| 681 | mv88e6xxx_mac_link_force(ds, port, LINK_FORCED_DOWN); |
| 682 | } |
| 683 | |
| 684 | static void mv88e6xxx_mac_link_up(struct dsa_switch *ds, int port, |
| 685 | unsigned int mode, phy_interface_t interface, |
| 686 | struct phy_device *phydev) |
| 687 | { |
| 688 | if (mode == MLO_AN_FIXED) |
| 689 | mv88e6xxx_mac_link_force(ds, port, LINK_FORCED_UP); |
| 690 | } |
| 691 | |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 692 | static int mv88e6xxx_stats_snapshot(struct mv88e6xxx_chip *chip, int port) |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 693 | { |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 694 | if (!chip->info->ops->stats_snapshot) |
| 695 | return -EOPNOTSUPP; |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 696 | |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 697 | return chip->info->ops->stats_snapshot(chip, port); |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 698 | } |
| 699 | |
Andrew Lunn | e413e7e | 2015-04-02 04:06:38 +0200 | [diff] [blame] | 700 | static struct mv88e6xxx_hw_stat mv88e6xxx_hw_stats[] = { |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 701 | { "in_good_octets", 8, 0x00, STATS_TYPE_BANK0, }, |
| 702 | { "in_bad_octets", 4, 0x02, STATS_TYPE_BANK0, }, |
| 703 | { "in_unicast", 4, 0x04, STATS_TYPE_BANK0, }, |
| 704 | { "in_broadcasts", 4, 0x06, STATS_TYPE_BANK0, }, |
| 705 | { "in_multicasts", 4, 0x07, STATS_TYPE_BANK0, }, |
| 706 | { "in_pause", 4, 0x16, STATS_TYPE_BANK0, }, |
| 707 | { "in_undersize", 4, 0x18, STATS_TYPE_BANK0, }, |
| 708 | { "in_fragments", 4, 0x19, STATS_TYPE_BANK0, }, |
| 709 | { "in_oversize", 4, 0x1a, STATS_TYPE_BANK0, }, |
| 710 | { "in_jabber", 4, 0x1b, STATS_TYPE_BANK0, }, |
| 711 | { "in_rx_error", 4, 0x1c, STATS_TYPE_BANK0, }, |
| 712 | { "in_fcs_error", 4, 0x1d, STATS_TYPE_BANK0, }, |
| 713 | { "out_octets", 8, 0x0e, STATS_TYPE_BANK0, }, |
| 714 | { "out_unicast", 4, 0x10, STATS_TYPE_BANK0, }, |
| 715 | { "out_broadcasts", 4, 0x13, STATS_TYPE_BANK0, }, |
| 716 | { "out_multicasts", 4, 0x12, STATS_TYPE_BANK0, }, |
| 717 | { "out_pause", 4, 0x15, STATS_TYPE_BANK0, }, |
| 718 | { "excessive", 4, 0x11, STATS_TYPE_BANK0, }, |
| 719 | { "collisions", 4, 0x1e, STATS_TYPE_BANK0, }, |
| 720 | { "deferred", 4, 0x05, STATS_TYPE_BANK0, }, |
| 721 | { "single", 4, 0x14, STATS_TYPE_BANK0, }, |
| 722 | { "multiple", 4, 0x17, STATS_TYPE_BANK0, }, |
| 723 | { "out_fcs_error", 4, 0x03, STATS_TYPE_BANK0, }, |
| 724 | { "late", 4, 0x1f, STATS_TYPE_BANK0, }, |
| 725 | { "hist_64bytes", 4, 0x08, STATS_TYPE_BANK0, }, |
| 726 | { "hist_65_127bytes", 4, 0x09, STATS_TYPE_BANK0, }, |
| 727 | { "hist_128_255bytes", 4, 0x0a, STATS_TYPE_BANK0, }, |
| 728 | { "hist_256_511bytes", 4, 0x0b, STATS_TYPE_BANK0, }, |
| 729 | { "hist_512_1023bytes", 4, 0x0c, STATS_TYPE_BANK0, }, |
| 730 | { "hist_1024_max_bytes", 4, 0x0d, STATS_TYPE_BANK0, }, |
| 731 | { "sw_in_discards", 4, 0x10, STATS_TYPE_PORT, }, |
| 732 | { "sw_in_filtered", 2, 0x12, STATS_TYPE_PORT, }, |
| 733 | { "sw_out_filtered", 2, 0x13, STATS_TYPE_PORT, }, |
| 734 | { "in_discards", 4, 0x00, STATS_TYPE_BANK1, }, |
| 735 | { "in_filtered", 4, 0x01, STATS_TYPE_BANK1, }, |
| 736 | { "in_accepted", 4, 0x02, STATS_TYPE_BANK1, }, |
| 737 | { "in_bad_accepted", 4, 0x03, STATS_TYPE_BANK1, }, |
| 738 | { "in_good_avb_class_a", 4, 0x04, STATS_TYPE_BANK1, }, |
| 739 | { "in_good_avb_class_b", 4, 0x05, STATS_TYPE_BANK1, }, |
| 740 | { "in_bad_avb_class_a", 4, 0x06, STATS_TYPE_BANK1, }, |
| 741 | { "in_bad_avb_class_b", 4, 0x07, STATS_TYPE_BANK1, }, |
| 742 | { "tcam_counter_0", 4, 0x08, STATS_TYPE_BANK1, }, |
| 743 | { "tcam_counter_1", 4, 0x09, STATS_TYPE_BANK1, }, |
| 744 | { "tcam_counter_2", 4, 0x0a, STATS_TYPE_BANK1, }, |
| 745 | { "tcam_counter_3", 4, 0x0b, STATS_TYPE_BANK1, }, |
| 746 | { "in_da_unknown", 4, 0x0e, STATS_TYPE_BANK1, }, |
| 747 | { "in_management", 4, 0x0f, STATS_TYPE_BANK1, }, |
| 748 | { "out_queue_0", 4, 0x10, STATS_TYPE_BANK1, }, |
| 749 | { "out_queue_1", 4, 0x11, STATS_TYPE_BANK1, }, |
| 750 | { "out_queue_2", 4, 0x12, STATS_TYPE_BANK1, }, |
| 751 | { "out_queue_3", 4, 0x13, STATS_TYPE_BANK1, }, |
| 752 | { "out_queue_4", 4, 0x14, STATS_TYPE_BANK1, }, |
| 753 | { "out_queue_5", 4, 0x15, STATS_TYPE_BANK1, }, |
| 754 | { "out_queue_6", 4, 0x16, STATS_TYPE_BANK1, }, |
| 755 | { "out_queue_7", 4, 0x17, STATS_TYPE_BANK1, }, |
| 756 | { "out_cut_through", 4, 0x18, STATS_TYPE_BANK1, }, |
| 757 | { "out_octets_a", 4, 0x1a, STATS_TYPE_BANK1, }, |
| 758 | { "out_octets_b", 4, 0x1b, STATS_TYPE_BANK1, }, |
| 759 | { "out_management", 4, 0x1f, STATS_TYPE_BANK1, }, |
Andrew Lunn | e413e7e | 2015-04-02 04:06:38 +0200 | [diff] [blame] | 760 | }; |
| 761 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 762 | static uint64_t _mv88e6xxx_get_ethtool_stat(struct mv88e6xxx_chip *chip, |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 763 | struct mv88e6xxx_hw_stat *s, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 764 | int port, u16 bank1_select, |
| 765 | u16 histogram) |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 766 | { |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 767 | u32 low; |
| 768 | u32 high = 0; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 769 | u16 reg = 0; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 770 | int err; |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 771 | u64 value; |
| 772 | |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 773 | switch (s->type) { |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 774 | case STATS_TYPE_PORT: |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 775 | err = mv88e6xxx_port_read(chip, port, s->reg, ®); |
| 776 | if (err) |
Jisheng Zhang | 6c3442f | 2018-04-27 16:18:58 +0800 | [diff] [blame] | 777 | return U64_MAX; |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 778 | |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 779 | low = reg; |
Andrew Lunn | cda9f4a | 2018-03-01 02:02:31 +0100 | [diff] [blame] | 780 | if (s->size == 4) { |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 781 | err = mv88e6xxx_port_read(chip, port, s->reg + 1, ®); |
| 782 | if (err) |
Jisheng Zhang | 6c3442f | 2018-04-27 16:18:58 +0800 | [diff] [blame] | 783 | return U64_MAX; |
Rasmus Villemoes | 84b3fd1 | 2019-05-29 07:02:11 +0000 | [diff] [blame] | 784 | low |= ((u32)reg) << 16; |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 785 | } |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 786 | break; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 787 | case STATS_TYPE_BANK1: |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 788 | reg = bank1_select; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 789 | /* fall through */ |
| 790 | case STATS_TYPE_BANK0: |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 791 | reg |= s->reg | histogram; |
Andrew Lunn | 7f9ef3a | 2016-11-21 23:27:05 +0100 | [diff] [blame] | 792 | mv88e6xxx_g1_stats_read(chip, reg, &low); |
Andrew Lunn | cda9f4a | 2018-03-01 02:02:31 +0100 | [diff] [blame] | 793 | if (s->size == 8) |
Andrew Lunn | 7f9ef3a | 2016-11-21 23:27:05 +0100 | [diff] [blame] | 794 | mv88e6xxx_g1_stats_read(chip, reg + 1, &high); |
Gustavo A. R. Silva | 9fc3e4d | 2017-05-11 22:11:29 -0500 | [diff] [blame] | 795 | break; |
| 796 | default: |
Jisheng Zhang | 6c3442f | 2018-04-27 16:18:58 +0800 | [diff] [blame] | 797 | return U64_MAX; |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 798 | } |
Andrew Lunn | 6e46e2d | 2019-02-28 18:14:03 +0100 | [diff] [blame] | 799 | value = (((u64)high) << 32) | low; |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 800 | return value; |
| 801 | } |
| 802 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 803 | static int mv88e6xxx_stats_get_strings(struct mv88e6xxx_chip *chip, |
| 804 | uint8_t *data, int types) |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 805 | { |
| 806 | struct mv88e6xxx_hw_stat *stat; |
| 807 | int i, j; |
| 808 | |
| 809 | for (i = 0, j = 0; i < ARRAY_SIZE(mv88e6xxx_hw_stats); i++) { |
| 810 | stat = &mv88e6xxx_hw_stats[i]; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 811 | if (stat->type & types) { |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 812 | memcpy(data + j * ETH_GSTRING_LEN, stat->string, |
| 813 | ETH_GSTRING_LEN); |
| 814 | j++; |
| 815 | } |
| 816 | } |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 817 | |
| 818 | return j; |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 819 | } |
| 820 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 821 | static int mv88e6095_stats_get_strings(struct mv88e6xxx_chip *chip, |
| 822 | uint8_t *data) |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 823 | { |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 824 | return mv88e6xxx_stats_get_strings(chip, data, |
| 825 | STATS_TYPE_BANK0 | STATS_TYPE_PORT); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 826 | } |
| 827 | |
Rasmus Villemoes | 1f71836 | 2019-06-04 07:34:32 +0000 | [diff] [blame] | 828 | static int mv88e6250_stats_get_strings(struct mv88e6xxx_chip *chip, |
| 829 | uint8_t *data) |
| 830 | { |
| 831 | return mv88e6xxx_stats_get_strings(chip, data, STATS_TYPE_BANK0); |
| 832 | } |
| 833 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 834 | static int mv88e6320_stats_get_strings(struct mv88e6xxx_chip *chip, |
| 835 | uint8_t *data) |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 836 | { |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 837 | return mv88e6xxx_stats_get_strings(chip, data, |
| 838 | STATS_TYPE_BANK0 | STATS_TYPE_BANK1); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 839 | } |
| 840 | |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 841 | static const uint8_t *mv88e6xxx_atu_vtu_stats_strings[] = { |
| 842 | "atu_member_violation", |
| 843 | "atu_miss_violation", |
| 844 | "atu_full_violation", |
| 845 | "vtu_member_violation", |
| 846 | "vtu_miss_violation", |
| 847 | }; |
| 848 | |
| 849 | static void mv88e6xxx_atu_vtu_get_strings(uint8_t *data) |
| 850 | { |
| 851 | unsigned int i; |
| 852 | |
| 853 | for (i = 0; i < ARRAY_SIZE(mv88e6xxx_atu_vtu_stats_strings); i++) |
| 854 | strlcpy(data + i * ETH_GSTRING_LEN, |
| 855 | mv88e6xxx_atu_vtu_stats_strings[i], |
| 856 | ETH_GSTRING_LEN); |
| 857 | } |
| 858 | |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 859 | static void mv88e6xxx_get_strings(struct dsa_switch *ds, int port, |
Florian Fainelli | 89f0904 | 2018-04-25 12:12:50 -0700 | [diff] [blame] | 860 | u32 stringset, uint8_t *data) |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 861 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 862 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 863 | int count = 0; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 864 | |
Florian Fainelli | 89f0904 | 2018-04-25 12:12:50 -0700 | [diff] [blame] | 865 | if (stringset != ETH_SS_STATS) |
| 866 | return; |
| 867 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 868 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | c6c8cd5 | 2018-03-01 02:02:28 +0100 | [diff] [blame] | 869 | |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 870 | if (chip->info->ops->stats_get_strings) |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 871 | count = chip->info->ops->stats_get_strings(chip, data); |
| 872 | |
| 873 | if (chip->info->ops->serdes_get_strings) { |
| 874 | data += count * ETH_GSTRING_LEN; |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 875 | count = chip->info->ops->serdes_get_strings(chip, port, data); |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 876 | } |
Andrew Lunn | c6c8cd5 | 2018-03-01 02:02:28 +0100 | [diff] [blame] | 877 | |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 878 | data += count * ETH_GSTRING_LEN; |
| 879 | mv88e6xxx_atu_vtu_get_strings(data); |
| 880 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 881 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 882 | } |
| 883 | |
| 884 | static int mv88e6xxx_stats_get_sset_count(struct mv88e6xxx_chip *chip, |
| 885 | int types) |
| 886 | { |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 887 | struct mv88e6xxx_hw_stat *stat; |
| 888 | int i, j; |
| 889 | |
| 890 | for (i = 0, j = 0; i < ARRAY_SIZE(mv88e6xxx_hw_stats); i++) { |
| 891 | stat = &mv88e6xxx_hw_stats[i]; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 892 | if (stat->type & types) |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 893 | j++; |
| 894 | } |
| 895 | return j; |
| 896 | } |
| 897 | |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 898 | static int mv88e6095_stats_get_sset_count(struct mv88e6xxx_chip *chip) |
| 899 | { |
| 900 | return mv88e6xxx_stats_get_sset_count(chip, STATS_TYPE_BANK0 | |
| 901 | STATS_TYPE_PORT); |
| 902 | } |
| 903 | |
Rasmus Villemoes | 1f71836 | 2019-06-04 07:34:32 +0000 | [diff] [blame] | 904 | static int mv88e6250_stats_get_sset_count(struct mv88e6xxx_chip *chip) |
| 905 | { |
| 906 | return mv88e6xxx_stats_get_sset_count(chip, STATS_TYPE_BANK0); |
| 907 | } |
| 908 | |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 909 | static int mv88e6320_stats_get_sset_count(struct mv88e6xxx_chip *chip) |
| 910 | { |
| 911 | return mv88e6xxx_stats_get_sset_count(chip, STATS_TYPE_BANK0 | |
| 912 | STATS_TYPE_BANK1); |
| 913 | } |
| 914 | |
Florian Fainelli | 89f0904 | 2018-04-25 12:12:50 -0700 | [diff] [blame] | 915 | static int mv88e6xxx_get_sset_count(struct dsa_switch *ds, int port, int sset) |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 916 | { |
| 917 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 918 | int serdes_count = 0; |
| 919 | int count = 0; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 920 | |
Florian Fainelli | 89f0904 | 2018-04-25 12:12:50 -0700 | [diff] [blame] | 921 | if (sset != ETH_SS_STATS) |
| 922 | return 0; |
| 923 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 924 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 925 | if (chip->info->ops->stats_get_sset_count) |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 926 | count = chip->info->ops->stats_get_sset_count(chip); |
| 927 | if (count < 0) |
| 928 | goto out; |
| 929 | |
| 930 | if (chip->info->ops->serdes_get_sset_count) |
| 931 | serdes_count = chip->info->ops->serdes_get_sset_count(chip, |
| 932 | port); |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 933 | if (serdes_count < 0) { |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 934 | count = serdes_count; |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 935 | goto out; |
| 936 | } |
| 937 | count += serdes_count; |
| 938 | count += ARRAY_SIZE(mv88e6xxx_atu_vtu_stats_strings); |
| 939 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 940 | out: |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 941 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 942 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 943 | return count; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 944 | } |
| 945 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 946 | static int mv88e6xxx_stats_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 947 | uint64_t *data, int types, |
| 948 | u16 bank1_select, u16 histogram) |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 949 | { |
| 950 | struct mv88e6xxx_hw_stat *stat; |
| 951 | int i, j; |
| 952 | |
| 953 | for (i = 0, j = 0; i < ARRAY_SIZE(mv88e6xxx_hw_stats); i++) { |
| 954 | stat = &mv88e6xxx_hw_stats[i]; |
| 955 | if (stat->type & types) { |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 956 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 957 | data[j] = _mv88e6xxx_get_ethtool_stat(chip, stat, port, |
| 958 | bank1_select, |
| 959 | histogram); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 960 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 377cda1 | 2018-02-15 14:38:34 +0100 | [diff] [blame] | 961 | |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 962 | j++; |
| 963 | } |
| 964 | } |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 965 | return j; |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 966 | } |
| 967 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 968 | static int mv88e6095_stats_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 969 | uint64_t *data) |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 970 | { |
| 971 | return mv88e6xxx_stats_get_stats(chip, port, data, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 972 | STATS_TYPE_BANK0 | STATS_TYPE_PORT, |
Vivien Didelot | 57d1ef3 | 2017-06-15 12:14:05 -0400 | [diff] [blame] | 973 | 0, MV88E6XXX_G1_STATS_OP_HIST_RX_TX); |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 974 | } |
| 975 | |
Rasmus Villemoes | 1f71836 | 2019-06-04 07:34:32 +0000 | [diff] [blame] | 976 | static int mv88e6250_stats_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 977 | uint64_t *data) |
| 978 | { |
| 979 | return mv88e6xxx_stats_get_stats(chip, port, data, STATS_TYPE_BANK0, |
| 980 | 0, MV88E6XXX_G1_STATS_OP_HIST_RX_TX); |
| 981 | } |
| 982 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 983 | static int mv88e6320_stats_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 984 | uint64_t *data) |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 985 | { |
| 986 | return mv88e6xxx_stats_get_stats(chip, port, data, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 987 | STATS_TYPE_BANK0 | STATS_TYPE_BANK1, |
Vivien Didelot | 57d1ef3 | 2017-06-15 12:14:05 -0400 | [diff] [blame] | 988 | MV88E6XXX_G1_STATS_OP_BANK_1_BIT_9, |
| 989 | MV88E6XXX_G1_STATS_OP_HIST_RX_TX); |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 990 | } |
| 991 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 992 | static int mv88e6390_stats_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 993 | uint64_t *data) |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 994 | { |
| 995 | return mv88e6xxx_stats_get_stats(chip, port, data, |
| 996 | STATS_TYPE_BANK0 | STATS_TYPE_BANK1, |
Vivien Didelot | 57d1ef3 | 2017-06-15 12:14:05 -0400 | [diff] [blame] | 997 | MV88E6XXX_G1_STATS_OP_BANK_1_BIT_10, |
| 998 | 0); |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 999 | } |
| 1000 | |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 1001 | static void mv88e6xxx_atu_vtu_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 1002 | uint64_t *data) |
| 1003 | { |
| 1004 | *data++ = chip->ports[port].atu_member_violation; |
| 1005 | *data++ = chip->ports[port].atu_miss_violation; |
| 1006 | *data++ = chip->ports[port].atu_full_violation; |
| 1007 | *data++ = chip->ports[port].vtu_member_violation; |
| 1008 | *data++ = chip->ports[port].vtu_miss_violation; |
| 1009 | } |
| 1010 | |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 1011 | static void mv88e6xxx_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 1012 | uint64_t *data) |
| 1013 | { |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 1014 | int count = 0; |
| 1015 | |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 1016 | if (chip->info->ops->stats_get_stats) |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 1017 | count = chip->info->ops->stats_get_stats(chip, port, data); |
| 1018 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1019 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 1020 | if (chip->info->ops->serdes_get_stats) { |
| 1021 | data += count; |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 1022 | count = chip->info->ops->serdes_get_stats(chip, port, data); |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 1023 | } |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 1024 | data += count; |
| 1025 | mv88e6xxx_atu_vtu_get_stats(chip, port, data); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1026 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 1027 | } |
| 1028 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1029 | static void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port, |
| 1030 | uint64_t *data) |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1031 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1032 | struct mv88e6xxx_chip *chip = ds->priv; |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1033 | int ret; |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1034 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1035 | mv88e6xxx_reg_lock(chip); |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1036 | |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 1037 | ret = mv88e6xxx_stats_snapshot(chip, port); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1038 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 377cda1 | 2018-02-15 14:38:34 +0100 | [diff] [blame] | 1039 | |
| 1040 | if (ret < 0) |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1041 | return; |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 1042 | |
| 1043 | mv88e6xxx_get_stats(chip, port, data); |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1044 | |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1045 | } |
Ben Hutchings | 98e6730 | 2011-11-25 14:36:19 +0000 | [diff] [blame] | 1046 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1047 | static int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port) |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1048 | { |
| 1049 | return 32 * sizeof(u16); |
| 1050 | } |
| 1051 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1052 | static void mv88e6xxx_get_regs(struct dsa_switch *ds, int port, |
| 1053 | struct ethtool_regs *regs, void *_p) |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1054 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1055 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 1056 | int err; |
| 1057 | u16 reg; |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1058 | u16 *p = _p; |
| 1059 | int i; |
| 1060 | |
Vivien Didelot | a5f3932 | 2018-12-17 16:05:21 -0500 | [diff] [blame] | 1061 | regs->version = chip->info->prod_num; |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1062 | |
| 1063 | memset(p, 0xff, 32 * sizeof(u16)); |
| 1064 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1065 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 2306251 | 2016-05-09 13:22:45 -0400 | [diff] [blame] | 1066 | |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1067 | for (i = 0; i < 32; i++) { |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1068 | |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 1069 | err = mv88e6xxx_port_read(chip, port, i, ®); |
| 1070 | if (!err) |
| 1071 | p[i] = reg; |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1072 | } |
Vivien Didelot | 2306251 | 2016-05-09 13:22:45 -0400 | [diff] [blame] | 1073 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1074 | mv88e6xxx_reg_unlock(chip); |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1075 | } |
| 1076 | |
Vivien Didelot | 08f5006 | 2017-08-01 16:32:41 -0400 | [diff] [blame] | 1077 | static int mv88e6xxx_get_mac_eee(struct dsa_switch *ds, int port, |
| 1078 | struct ethtool_eee *e) |
Guenter Roeck | 11b3b45 | 2015-03-06 22:23:51 -0800 | [diff] [blame] | 1079 | { |
Vivien Didelot | 5480db6 | 2017-08-01 16:32:40 -0400 | [diff] [blame] | 1080 | /* Nothing to do on the port's MAC */ |
| 1081 | return 0; |
Guenter Roeck | 11b3b45 | 2015-03-06 22:23:51 -0800 | [diff] [blame] | 1082 | } |
| 1083 | |
Vivien Didelot | 08f5006 | 2017-08-01 16:32:41 -0400 | [diff] [blame] | 1084 | static int mv88e6xxx_set_mac_eee(struct dsa_switch *ds, int port, |
| 1085 | struct ethtool_eee *e) |
Guenter Roeck | 11b3b45 | 2015-03-06 22:23:51 -0800 | [diff] [blame] | 1086 | { |
Vivien Didelot | 5480db6 | 2017-08-01 16:32:40 -0400 | [diff] [blame] | 1087 | /* Nothing to do on the port's MAC */ |
| 1088 | return 0; |
Guenter Roeck | 11b3b45 | 2015-03-06 22:23:51 -0800 | [diff] [blame] | 1089 | } |
| 1090 | |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1091 | static u16 mv88e6xxx_port_vlan(struct mv88e6xxx_chip *chip, int dev, int port) |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1092 | { |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1093 | struct dsa_switch *ds = NULL; |
| 1094 | struct net_device *br; |
| 1095 | u16 pvlan; |
Vivien Didelot | b7666ef | 2016-02-26 13:16:06 -0500 | [diff] [blame] | 1096 | int i; |
| 1097 | |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1098 | if (dev < DSA_MAX_SWITCHES) |
| 1099 | ds = chip->ds->dst->ds[dev]; |
Vivien Didelot | b7666ef | 2016-02-26 13:16:06 -0500 | [diff] [blame] | 1100 | |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1101 | /* Prevent frames from unknown switch or port */ |
| 1102 | if (!ds || port >= ds->num_ports) |
| 1103 | return 0; |
| 1104 | |
| 1105 | /* Frames from DSA links and CPU ports can egress any local port */ |
| 1106 | if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)) |
| 1107 | return mv88e6xxx_port_mask(chip); |
| 1108 | |
| 1109 | br = ds->ports[port].bridge_dev; |
| 1110 | pvlan = 0; |
| 1111 | |
| 1112 | /* Frames from user ports can egress any local DSA links and CPU ports, |
| 1113 | * as well as any local member of their bridge group. |
| 1114 | */ |
| 1115 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) |
| 1116 | if (dsa_is_cpu_port(chip->ds, i) || |
| 1117 | dsa_is_dsa_port(chip->ds, i) || |
Vivien Didelot | c8652c8 | 2017-10-16 11:12:19 -0400 | [diff] [blame] | 1118 | (br && dsa_to_port(chip->ds, i)->bridge_dev == br)) |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1119 | pvlan |= BIT(i); |
| 1120 | |
| 1121 | return pvlan; |
| 1122 | } |
| 1123 | |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1124 | static int mv88e6xxx_port_vlan_map(struct mv88e6xxx_chip *chip, int port) |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1125 | { |
| 1126 | u16 output_ports = mv88e6xxx_port_vlan(chip, chip->ds->index, port); |
Vivien Didelot | b7666ef | 2016-02-26 13:16:06 -0500 | [diff] [blame] | 1127 | |
| 1128 | /* prevent frames from going back out of the port they came in on */ |
| 1129 | output_ports &= ~BIT(port); |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1130 | |
Vivien Didelot | 5a7921f | 2016-11-04 03:23:28 +0100 | [diff] [blame] | 1131 | return mv88e6xxx_port_set_vlan_map(chip, port, output_ports); |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1132 | } |
| 1133 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1134 | static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port, |
| 1135 | u8 state) |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1136 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1137 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 553eb54 | 2016-05-13 20:38:23 -0400 | [diff] [blame] | 1138 | int err; |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1139 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1140 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | f894c29 | 2017-06-08 18:34:10 -0400 | [diff] [blame] | 1141 | err = mv88e6xxx_port_set_state(chip, port, state); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1142 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 553eb54 | 2016-05-13 20:38:23 -0400 | [diff] [blame] | 1143 | |
| 1144 | if (err) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 1145 | dev_err(ds->dev, "p%d: failed to update state\n", port); |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1146 | } |
| 1147 | |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 1148 | static int mv88e6xxx_pri_setup(struct mv88e6xxx_chip *chip) |
| 1149 | { |
| 1150 | int err; |
| 1151 | |
| 1152 | if (chip->info->ops->ieee_pri_map) { |
| 1153 | err = chip->info->ops->ieee_pri_map(chip); |
| 1154 | if (err) |
| 1155 | return err; |
| 1156 | } |
| 1157 | |
| 1158 | if (chip->info->ops->ip_pri_map) { |
| 1159 | err = chip->info->ops->ip_pri_map(chip); |
| 1160 | if (err) |
| 1161 | return err; |
| 1162 | } |
| 1163 | |
| 1164 | return 0; |
| 1165 | } |
| 1166 | |
Vivien Didelot | c7f047b | 2018-04-26 21:56:45 -0400 | [diff] [blame] | 1167 | static int mv88e6xxx_devmap_setup(struct mv88e6xxx_chip *chip) |
| 1168 | { |
| 1169 | int target, port; |
| 1170 | int err; |
| 1171 | |
| 1172 | if (!chip->info->global2_addr) |
| 1173 | return 0; |
| 1174 | |
| 1175 | /* Initialize the routing port to the 32 possible target devices */ |
| 1176 | for (target = 0; target < 32; target++) { |
| 1177 | port = 0x1f; |
| 1178 | if (target < DSA_MAX_SWITCHES) |
| 1179 | if (chip->ds->rtable[target] != DSA_RTABLE_NONE) |
| 1180 | port = chip->ds->rtable[target]; |
| 1181 | |
| 1182 | err = mv88e6xxx_g2_device_mapping_write(chip, target, port); |
| 1183 | if (err) |
| 1184 | return err; |
| 1185 | } |
| 1186 | |
Vivien Didelot | 02317e6 | 2018-05-09 11:38:49 -0400 | [diff] [blame] | 1187 | if (chip->info->ops->set_cascade_port) { |
| 1188 | port = MV88E6XXX_CASCADE_PORT_MULTIPLE; |
| 1189 | err = chip->info->ops->set_cascade_port(chip, port); |
| 1190 | if (err) |
| 1191 | return err; |
| 1192 | } |
| 1193 | |
Vivien Didelot | 23c9891 | 2018-05-09 11:38:50 -0400 | [diff] [blame] | 1194 | err = mv88e6xxx_g1_set_device_number(chip, chip->ds->index); |
| 1195 | if (err) |
| 1196 | return err; |
| 1197 | |
Vivien Didelot | c7f047b | 2018-04-26 21:56:45 -0400 | [diff] [blame] | 1198 | return 0; |
| 1199 | } |
| 1200 | |
Vivien Didelot | b28f872 | 2018-04-26 21:56:44 -0400 | [diff] [blame] | 1201 | static int mv88e6xxx_trunk_setup(struct mv88e6xxx_chip *chip) |
| 1202 | { |
| 1203 | /* Clear all trunk masks and mapping */ |
| 1204 | if (chip->info->global2_addr) |
| 1205 | return mv88e6xxx_g2_trunk_clear(chip); |
| 1206 | |
| 1207 | return 0; |
| 1208 | } |
| 1209 | |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 1210 | static int mv88e6xxx_rmu_setup(struct mv88e6xxx_chip *chip) |
| 1211 | { |
| 1212 | if (chip->info->ops->rmu_disable) |
| 1213 | return chip->info->ops->rmu_disable(chip); |
| 1214 | |
| 1215 | return 0; |
| 1216 | } |
| 1217 | |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 1218 | static int mv88e6xxx_pot_setup(struct mv88e6xxx_chip *chip) |
| 1219 | { |
| 1220 | if (chip->info->ops->pot_clear) |
| 1221 | return chip->info->ops->pot_clear(chip); |
| 1222 | |
| 1223 | return 0; |
| 1224 | } |
| 1225 | |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 1226 | static int mv88e6xxx_rsvd2cpu_setup(struct mv88e6xxx_chip *chip) |
| 1227 | { |
| 1228 | if (chip->info->ops->mgmt_rsvd2cpu) |
| 1229 | return chip->info->ops->mgmt_rsvd2cpu(chip); |
| 1230 | |
| 1231 | return 0; |
| 1232 | } |
| 1233 | |
Vivien Didelot | a2ac29d | 2017-03-11 16:12:49 -0500 | [diff] [blame] | 1234 | static int mv88e6xxx_atu_setup(struct mv88e6xxx_chip *chip) |
| 1235 | { |
Vivien Didelot | c3a7d4a | 2017-03-11 16:12:51 -0500 | [diff] [blame] | 1236 | int err; |
| 1237 | |
Vivien Didelot | daefc94 | 2017-03-11 16:12:54 -0500 | [diff] [blame] | 1238 | err = mv88e6xxx_g1_atu_flush(chip, 0, true); |
| 1239 | if (err) |
| 1240 | return err; |
| 1241 | |
Vivien Didelot | c3a7d4a | 2017-03-11 16:12:51 -0500 | [diff] [blame] | 1242 | err = mv88e6xxx_g1_atu_set_learn2all(chip, true); |
| 1243 | if (err) |
| 1244 | return err; |
| 1245 | |
Vivien Didelot | a2ac29d | 2017-03-11 16:12:49 -0500 | [diff] [blame] | 1246 | return mv88e6xxx_g1_atu_set_age_time(chip, 300000); |
| 1247 | } |
| 1248 | |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 1249 | static int mv88e6xxx_irl_setup(struct mv88e6xxx_chip *chip) |
| 1250 | { |
| 1251 | int port; |
| 1252 | int err; |
| 1253 | |
| 1254 | if (!chip->info->ops->irl_init_all) |
| 1255 | return 0; |
| 1256 | |
| 1257 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
| 1258 | /* Disable ingress rate limiting by resetting all per port |
| 1259 | * ingress rate limit resources to their initial state. |
| 1260 | */ |
| 1261 | err = chip->info->ops->irl_init_all(chip, port); |
| 1262 | if (err) |
| 1263 | return err; |
| 1264 | } |
| 1265 | |
| 1266 | return 0; |
| 1267 | } |
| 1268 | |
Vivien Didelot | 04a69a1 | 2017-10-13 14:18:05 -0400 | [diff] [blame] | 1269 | static int mv88e6xxx_mac_setup(struct mv88e6xxx_chip *chip) |
| 1270 | { |
| 1271 | if (chip->info->ops->set_switch_mac) { |
| 1272 | u8 addr[ETH_ALEN]; |
| 1273 | |
| 1274 | eth_random_addr(addr); |
| 1275 | |
| 1276 | return chip->info->ops->set_switch_mac(chip, addr); |
| 1277 | } |
| 1278 | |
| 1279 | return 0; |
| 1280 | } |
| 1281 | |
Vivien Didelot | 17a1594 | 2017-03-30 17:37:09 -0400 | [diff] [blame] | 1282 | static int mv88e6xxx_pvt_map(struct mv88e6xxx_chip *chip, int dev, int port) |
| 1283 | { |
| 1284 | u16 pvlan = 0; |
| 1285 | |
| 1286 | if (!mv88e6xxx_has_pvt(chip)) |
| 1287 | return -EOPNOTSUPP; |
| 1288 | |
| 1289 | /* Skip the local source device, which uses in-chip port VLAN */ |
| 1290 | if (dev != chip->ds->index) |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 1291 | pvlan = mv88e6xxx_port_vlan(chip, dev, port); |
Vivien Didelot | 17a1594 | 2017-03-30 17:37:09 -0400 | [diff] [blame] | 1292 | |
| 1293 | return mv88e6xxx_g2_pvt_write(chip, dev, port, pvlan); |
| 1294 | } |
| 1295 | |
Vivien Didelot | 8122899 | 2017-03-30 17:37:08 -0400 | [diff] [blame] | 1296 | static int mv88e6xxx_pvt_setup(struct mv88e6xxx_chip *chip) |
| 1297 | { |
Vivien Didelot | 17a1594 | 2017-03-30 17:37:09 -0400 | [diff] [blame] | 1298 | int dev, port; |
| 1299 | int err; |
| 1300 | |
Vivien Didelot | 8122899 | 2017-03-30 17:37:08 -0400 | [diff] [blame] | 1301 | if (!mv88e6xxx_has_pvt(chip)) |
| 1302 | return 0; |
| 1303 | |
| 1304 | /* Clear 5 Bit Port for usage with Marvell Link Street devices: |
| 1305 | * use 4 bits for the Src_Port/Src_Trunk and 5 bits for the Src_Dev. |
| 1306 | */ |
Vivien Didelot | 17a1594 | 2017-03-30 17:37:09 -0400 | [diff] [blame] | 1307 | err = mv88e6xxx_g2_misc_4_bit_port(chip); |
| 1308 | if (err) |
| 1309 | return err; |
| 1310 | |
| 1311 | for (dev = 0; dev < MV88E6XXX_MAX_PVT_SWITCHES; ++dev) { |
| 1312 | for (port = 0; port < MV88E6XXX_MAX_PVT_PORTS; ++port) { |
| 1313 | err = mv88e6xxx_pvt_map(chip, dev, port); |
| 1314 | if (err) |
| 1315 | return err; |
| 1316 | } |
| 1317 | } |
| 1318 | |
| 1319 | return 0; |
Vivien Didelot | 8122899 | 2017-03-30 17:37:08 -0400 | [diff] [blame] | 1320 | } |
| 1321 | |
Vivien Didelot | 749efcb | 2016-09-22 16:49:24 -0400 | [diff] [blame] | 1322 | static void mv88e6xxx_port_fast_age(struct dsa_switch *ds, int port) |
| 1323 | { |
| 1324 | struct mv88e6xxx_chip *chip = ds->priv; |
| 1325 | int err; |
| 1326 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1327 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 1328 | err = mv88e6xxx_g1_atu_remove(chip, 0, port, false); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1329 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 749efcb | 2016-09-22 16:49:24 -0400 | [diff] [blame] | 1330 | |
| 1331 | if (err) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 1332 | dev_err(ds->dev, "p%d: failed to flush ATU\n", port); |
Vivien Didelot | 749efcb | 2016-09-22 16:49:24 -0400 | [diff] [blame] | 1333 | } |
| 1334 | |
Vivien Didelot | b486d7c | 2017-05-01 14:05:13 -0400 | [diff] [blame] | 1335 | static int mv88e6xxx_vtu_setup(struct mv88e6xxx_chip *chip) |
| 1336 | { |
| 1337 | if (!chip->info->max_vid) |
| 1338 | return 0; |
| 1339 | |
| 1340 | return mv88e6xxx_g1_vtu_flush(chip); |
| 1341 | } |
| 1342 | |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 1343 | static int mv88e6xxx_vtu_getnext(struct mv88e6xxx_chip *chip, |
| 1344 | struct mv88e6xxx_vtu_entry *entry) |
| 1345 | { |
| 1346 | if (!chip->info->ops->vtu_getnext) |
| 1347 | return -EOPNOTSUPP; |
| 1348 | |
| 1349 | return chip->info->ops->vtu_getnext(chip, entry); |
| 1350 | } |
| 1351 | |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 1352 | static int mv88e6xxx_vtu_loadpurge(struct mv88e6xxx_chip *chip, |
| 1353 | struct mv88e6xxx_vtu_entry *entry) |
| 1354 | { |
| 1355 | if (!chip->info->ops->vtu_loadpurge) |
| 1356 | return -EOPNOTSUPP; |
| 1357 | |
| 1358 | return chip->info->ops->vtu_loadpurge(chip, entry); |
| 1359 | } |
| 1360 | |
Vivien Didelot | d7f435f | 2017-03-11 16:12:56 -0500 | [diff] [blame] | 1361 | static int mv88e6xxx_atu_new(struct mv88e6xxx_chip *chip, u16 *fid) |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1362 | { |
| 1363 | DECLARE_BITMAP(fid_bitmap, MV88E6XXX_N_FID); |
Vivien Didelot | 425d2d3 | 2019-08-01 14:36:34 -0400 | [diff] [blame] | 1364 | struct mv88e6xxx_vtu_entry vlan; |
Vivien Didelot | 2db9ce1 | 2016-02-26 13:16:04 -0500 | [diff] [blame] | 1365 | int i, err; |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1366 | |
| 1367 | bitmap_zero(fid_bitmap, MV88E6XXX_N_FID); |
| 1368 | |
Vivien Didelot | 2db9ce1 | 2016-02-26 13:16:04 -0500 | [diff] [blame] | 1369 | /* Set every FID bit used by the (un)bridged ports */ |
Vivien Didelot | 370b4ff | 2016-09-29 12:21:57 -0400 | [diff] [blame] | 1370 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) { |
Vivien Didelot | b4e48c5 | 2016-11-04 03:23:29 +0100 | [diff] [blame] | 1371 | err = mv88e6xxx_port_get_fid(chip, i, fid); |
Vivien Didelot | 2db9ce1 | 2016-02-26 13:16:04 -0500 | [diff] [blame] | 1372 | if (err) |
| 1373 | return err; |
| 1374 | |
| 1375 | set_bit(*fid, fid_bitmap); |
| 1376 | } |
| 1377 | |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1378 | /* Set every FID bit used by the VLAN entries */ |
Vivien Didelot | 425d2d3 | 2019-08-01 14:36:34 -0400 | [diff] [blame] | 1379 | vlan.vid = chip->info->max_vid; |
| 1380 | vlan.valid = false; |
| 1381 | |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1382 | do { |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 1383 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1384 | if (err) |
| 1385 | return err; |
| 1386 | |
| 1387 | if (!vlan.valid) |
| 1388 | break; |
| 1389 | |
| 1390 | set_bit(vlan.fid, fid_bitmap); |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1391 | } while (vlan.vid < chip->info->max_vid); |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1392 | |
| 1393 | /* The reset value 0x000 is used to indicate that multiple address |
| 1394 | * databases are not needed. Return the next positive available. |
| 1395 | */ |
| 1396 | *fid = find_next_zero_bit(fid_bitmap, MV88E6XXX_N_FID, 1); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1397 | if (unlikely(*fid >= mv88e6xxx_num_databases(chip))) |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1398 | return -ENOSPC; |
| 1399 | |
| 1400 | /* Clear the database */ |
Vivien Didelot | daefc94 | 2017-03-11 16:12:54 -0500 | [diff] [blame] | 1401 | return mv88e6xxx_g1_atu_flush(chip, *fid, true); |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1402 | } |
| 1403 | |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1404 | static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port, |
| 1405 | u16 vid_begin, u16 vid_end) |
| 1406 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1407 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 425d2d3 | 2019-08-01 14:36:34 -0400 | [diff] [blame] | 1408 | struct mv88e6xxx_vtu_entry vlan; |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1409 | int i, err; |
| 1410 | |
Andrew Lunn | db06ae41 | 2017-09-25 23:32:20 +0200 | [diff] [blame] | 1411 | /* DSA and CPU ports have to be members of multiple vlans */ |
| 1412 | if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port)) |
| 1413 | return 0; |
| 1414 | |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1415 | if (!vid_begin) |
| 1416 | return -EOPNOTSUPP; |
| 1417 | |
Vivien Didelot | 425d2d3 | 2019-08-01 14:36:34 -0400 | [diff] [blame] | 1418 | vlan.vid = vid_begin - 1; |
| 1419 | vlan.valid = false; |
| 1420 | |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1421 | do { |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 1422 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1423 | if (err) |
Vivien Didelot | 7095a4c | 2019-08-01 14:36:33 -0400 | [diff] [blame] | 1424 | return err; |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1425 | |
| 1426 | if (!vlan.valid) |
| 1427 | break; |
| 1428 | |
| 1429 | if (vlan.vid > vid_end) |
| 1430 | break; |
| 1431 | |
Vivien Didelot | 370b4ff | 2016-09-29 12:21:57 -0400 | [diff] [blame] | 1432 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) { |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1433 | if (dsa_is_dsa_port(ds, i) || dsa_is_cpu_port(ds, i)) |
| 1434 | continue; |
| 1435 | |
Andrew Lunn | cd88646 | 2017-11-09 22:29:53 +0100 | [diff] [blame] | 1436 | if (!ds->ports[i].slave) |
Andrew Lunn | 66e2809 | 2016-12-11 21:07:19 +0100 | [diff] [blame] | 1437 | continue; |
| 1438 | |
Vivien Didelot | bd00e05 | 2017-05-01 14:05:11 -0400 | [diff] [blame] | 1439 | if (vlan.member[i] == |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1440 | MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER) |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1441 | continue; |
| 1442 | |
Vivien Didelot | c8652c8 | 2017-10-16 11:12:19 -0400 | [diff] [blame] | 1443 | if (dsa_to_port(ds, i)->bridge_dev == |
Vivien Didelot | fae8a25 | 2017-01-27 15:29:42 -0500 | [diff] [blame] | 1444 | ds->ports[port].bridge_dev) |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1445 | break; /* same bridge, check next VLAN */ |
| 1446 | |
Vivien Didelot | c8652c8 | 2017-10-16 11:12:19 -0400 | [diff] [blame] | 1447 | if (!dsa_to_port(ds, i)->bridge_dev) |
Andrew Lunn | 66e2809 | 2016-12-11 21:07:19 +0100 | [diff] [blame] | 1448 | continue; |
| 1449 | |
Andrew Lunn | 743fcc2 | 2017-11-09 22:29:54 +0100 | [diff] [blame] | 1450 | dev_err(ds->dev, "p%d: hw VLAN %d already used by port %d in %s\n", |
| 1451 | port, vlan.vid, i, |
Vivien Didelot | c8652c8 | 2017-10-16 11:12:19 -0400 | [diff] [blame] | 1452 | netdev_name(dsa_to_port(ds, i)->bridge_dev)); |
Vivien Didelot | 7095a4c | 2019-08-01 14:36:33 -0400 | [diff] [blame] | 1453 | return -EOPNOTSUPP; |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1454 | } |
| 1455 | } while (vlan.vid < vid_end); |
| 1456 | |
Vivien Didelot | 7095a4c | 2019-08-01 14:36:33 -0400 | [diff] [blame] | 1457 | return 0; |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1458 | } |
| 1459 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1460 | static int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port, |
| 1461 | bool vlan_filtering) |
Vivien Didelot | 214cdb9 | 2016-02-26 13:16:08 -0500 | [diff] [blame] | 1462 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1463 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 81c6edb | 2017-06-12 12:37:41 -0400 | [diff] [blame] | 1464 | u16 mode = vlan_filtering ? MV88E6XXX_PORT_CTL2_8021Q_MODE_SECURE : |
| 1465 | MV88E6XXX_PORT_CTL2_8021Q_MODE_DISABLED; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 1466 | int err; |
Vivien Didelot | 214cdb9 | 2016-02-26 13:16:08 -0500 | [diff] [blame] | 1467 | |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1468 | if (!chip->info->max_vid) |
Vivien Didelot | 54d77b5 | 2016-05-09 13:22:47 -0400 | [diff] [blame] | 1469 | return -EOPNOTSUPP; |
| 1470 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1471 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 385a099 | 2016-11-04 03:23:31 +0100 | [diff] [blame] | 1472 | err = mv88e6xxx_port_set_8021q_mode(chip, port, mode); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1473 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 214cdb9 | 2016-02-26 13:16:08 -0500 | [diff] [blame] | 1474 | |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 1475 | return err; |
Vivien Didelot | 214cdb9 | 2016-02-26 13:16:08 -0500 | [diff] [blame] | 1476 | } |
| 1477 | |
Vivien Didelot | 57d3231 | 2016-06-20 13:13:58 -0400 | [diff] [blame] | 1478 | static int |
| 1479 | mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port, |
Vivien Didelot | 80e0236 | 2017-11-30 11:23:57 -0500 | [diff] [blame] | 1480 | const struct switchdev_obj_port_vlan *vlan) |
Vivien Didelot | 0d3b33e | 2015-08-13 12:52:22 -0400 | [diff] [blame] | 1481 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1482 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1483 | int err; |
| 1484 | |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1485 | if (!chip->info->max_vid) |
Vivien Didelot | 54d77b5 | 2016-05-09 13:22:47 -0400 | [diff] [blame] | 1486 | return -EOPNOTSUPP; |
| 1487 | |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1488 | /* If the requested port doesn't belong to the same bridge as the VLAN |
| 1489 | * members, do not support it (yet) and fallback to software VLAN. |
| 1490 | */ |
Vivien Didelot | 7095a4c | 2019-08-01 14:36:33 -0400 | [diff] [blame] | 1491 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1492 | err = mv88e6xxx_port_check_hw_vlan(ds, port, vlan->vid_begin, |
| 1493 | vlan->vid_end); |
Vivien Didelot | 7095a4c | 2019-08-01 14:36:33 -0400 | [diff] [blame] | 1494 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1495 | |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1496 | /* We don't need any dynamic resource from the kernel (yet), |
| 1497 | * so skip the prepare phase. |
| 1498 | */ |
Vivien Didelot | 7095a4c | 2019-08-01 14:36:33 -0400 | [diff] [blame] | 1499 | return err; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1500 | } |
| 1501 | |
Andrew Lunn | a4c93ae | 2017-11-09 22:29:55 +0100 | [diff] [blame] | 1502 | static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port, |
| 1503 | const unsigned char *addr, u16 vid, |
| 1504 | u8 state) |
| 1505 | { |
Andrew Lunn | a4c93ae | 2017-11-09 22:29:55 +0100 | [diff] [blame] | 1506 | struct mv88e6xxx_atu_entry entry; |
Vivien Didelot | 5ef8d24 | 2019-08-01 14:36:35 -0400 | [diff] [blame] | 1507 | struct mv88e6xxx_vtu_entry vlan; |
| 1508 | u16 fid; |
Andrew Lunn | a4c93ae | 2017-11-09 22:29:55 +0100 | [diff] [blame] | 1509 | int err; |
| 1510 | |
| 1511 | /* Null VLAN ID corresponds to the port private database */ |
Vivien Didelot | 5ef8d24 | 2019-08-01 14:36:35 -0400 | [diff] [blame] | 1512 | if (vid == 0) { |
| 1513 | err = mv88e6xxx_port_get_fid(chip, port, &fid); |
| 1514 | if (err) |
| 1515 | return err; |
| 1516 | } else { |
| 1517 | vlan.vid = vid - 1; |
| 1518 | vlan.valid = false; |
| 1519 | |
| 1520 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
| 1521 | if (err) |
| 1522 | return err; |
| 1523 | |
| 1524 | /* switchdev expects -EOPNOTSUPP to honor software VLANs */ |
| 1525 | if (vlan.vid != vid || !vlan.valid) |
| 1526 | return -EOPNOTSUPP; |
| 1527 | |
| 1528 | fid = vlan.fid; |
| 1529 | } |
Andrew Lunn | a4c93ae | 2017-11-09 22:29:55 +0100 | [diff] [blame] | 1530 | |
| 1531 | entry.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED; |
| 1532 | ether_addr_copy(entry.mac, addr); |
| 1533 | eth_addr_dec(entry.mac); |
| 1534 | |
Vivien Didelot | 5ef8d24 | 2019-08-01 14:36:35 -0400 | [diff] [blame] | 1535 | err = mv88e6xxx_g1_atu_getnext(chip, fid, &entry); |
Andrew Lunn | a4c93ae | 2017-11-09 22:29:55 +0100 | [diff] [blame] | 1536 | if (err) |
| 1537 | return err; |
| 1538 | |
| 1539 | /* Initialize a fresh ATU entry if it isn't found */ |
| 1540 | if (entry.state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED || |
| 1541 | !ether_addr_equal(entry.mac, addr)) { |
| 1542 | memset(&entry, 0, sizeof(entry)); |
| 1543 | ether_addr_copy(entry.mac, addr); |
| 1544 | } |
| 1545 | |
| 1546 | /* Purge the ATU entry only if no port is using it anymore */ |
| 1547 | if (state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED) { |
| 1548 | entry.portvec &= ~BIT(port); |
| 1549 | if (!entry.portvec) |
| 1550 | entry.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED; |
| 1551 | } else { |
| 1552 | entry.portvec |= BIT(port); |
| 1553 | entry.state = state; |
| 1554 | } |
| 1555 | |
Vivien Didelot | 5ef8d24 | 2019-08-01 14:36:35 -0400 | [diff] [blame] | 1556 | return mv88e6xxx_g1_atu_loadpurge(chip, fid, &entry); |
Andrew Lunn | a4c93ae | 2017-11-09 22:29:55 +0100 | [diff] [blame] | 1557 | } |
| 1558 | |
Andrew Lunn | 87fa886 | 2017-11-09 22:29:56 +0100 | [diff] [blame] | 1559 | static int mv88e6xxx_port_add_broadcast(struct mv88e6xxx_chip *chip, int port, |
| 1560 | u16 vid) |
| 1561 | { |
| 1562 | const char broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 1563 | u8 state = MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC; |
| 1564 | |
| 1565 | return mv88e6xxx_port_db_load_purge(chip, port, broadcast, vid, state); |
| 1566 | } |
| 1567 | |
| 1568 | static int mv88e6xxx_broadcast_setup(struct mv88e6xxx_chip *chip, u16 vid) |
| 1569 | { |
| 1570 | int port; |
| 1571 | int err; |
| 1572 | |
| 1573 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
| 1574 | err = mv88e6xxx_port_add_broadcast(chip, port, vid); |
| 1575 | if (err) |
| 1576 | return err; |
| 1577 | } |
| 1578 | |
| 1579 | return 0; |
| 1580 | } |
| 1581 | |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1582 | static int mv88e6xxx_port_vlan_join(struct mv88e6xxx_chip *chip, int port, |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1583 | u16 vid, u8 member) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1584 | { |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1585 | const u8 non_member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER; |
Vivien Didelot | b4e47c0 | 2016-09-29 12:21:58 -0400 | [diff] [blame] | 1586 | struct mv88e6xxx_vtu_entry vlan; |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1587 | int i, err; |
Vivien Didelot | 0d3b33e | 2015-08-13 12:52:22 -0400 | [diff] [blame] | 1588 | |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1589 | if (!vid) |
| 1590 | return -EOPNOTSUPP; |
| 1591 | |
| 1592 | vlan.vid = vid - 1; |
| 1593 | vlan.valid = false; |
| 1594 | |
| 1595 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
Vivien Didelot | 36d04ba | 2015-10-22 09:34:39 -0400 | [diff] [blame] | 1596 | if (err) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1597 | return err; |
Vivien Didelot | 36d04ba | 2015-10-22 09:34:39 -0400 | [diff] [blame] | 1598 | |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1599 | if (vlan.vid != vid || !vlan.valid) { |
| 1600 | memset(&vlan, 0, sizeof(vlan)); |
Vivien Didelot | 0d3b33e | 2015-08-13 12:52:22 -0400 | [diff] [blame] | 1601 | |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1602 | err = mv88e6xxx_atu_new(chip, &vlan.fid); |
| 1603 | if (err) |
| 1604 | return err; |
Andrew Lunn | 87fa886 | 2017-11-09 22:29:56 +0100 | [diff] [blame] | 1605 | |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1606 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) |
| 1607 | if (i == port) |
| 1608 | vlan.member[i] = member; |
| 1609 | else |
| 1610 | vlan.member[i] = non_member; |
| 1611 | |
| 1612 | vlan.vid = vid; |
| 1613 | vlan.valid = true; |
| 1614 | |
| 1615 | err = mv88e6xxx_vtu_loadpurge(chip, &vlan); |
| 1616 | if (err) |
| 1617 | return err; |
| 1618 | |
| 1619 | err = mv88e6xxx_broadcast_setup(chip, vlan.vid); |
| 1620 | if (err) |
| 1621 | return err; |
| 1622 | } else if (vlan.member[port] != member) { |
| 1623 | vlan.member[port] = member; |
| 1624 | |
| 1625 | err = mv88e6xxx_vtu_loadpurge(chip, &vlan); |
| 1626 | if (err) |
| 1627 | return err; |
| 1628 | } else { |
| 1629 | dev_info(chip->dev, "p%d: already a member of VLAN %d\n", |
| 1630 | port, vid); |
| 1631 | } |
| 1632 | |
| 1633 | return 0; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1634 | } |
| 1635 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1636 | static void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port, |
Vivien Didelot | 80e0236 | 2017-11-30 11:23:57 -0500 | [diff] [blame] | 1637 | const struct switchdev_obj_port_vlan *vlan) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1638 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1639 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1640 | bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; |
| 1641 | bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID; |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1642 | u8 member; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1643 | u16 vid; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1644 | |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1645 | if (!chip->info->max_vid) |
Vivien Didelot | 54d77b5 | 2016-05-09 13:22:47 -0400 | [diff] [blame] | 1646 | return; |
| 1647 | |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1648 | if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port)) |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1649 | member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_UNMODIFIED; |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1650 | else if (untagged) |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1651 | member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_UNTAGGED; |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1652 | else |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1653 | member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_TAGGED; |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1654 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1655 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1656 | |
Vivien Didelot | 4d5770b | 2016-04-06 11:55:05 -0400 | [diff] [blame] | 1657 | for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1658 | if (mv88e6xxx_port_vlan_join(chip, port, vid, member)) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 1659 | dev_err(ds->dev, "p%d: failed to add VLAN %d%c\n", port, |
| 1660 | vid, untagged ? 'u' : 't'); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1661 | |
Vivien Didelot | 77064f3 | 2016-11-04 03:23:30 +0100 | [diff] [blame] | 1662 | if (pvid && mv88e6xxx_port_set_pvid(chip, port, vlan->vid_end)) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 1663 | dev_err(ds->dev, "p%d: failed to set PVID %d\n", port, |
| 1664 | vlan->vid_end); |
Vivien Didelot | 4d5770b | 2016-04-06 11:55:05 -0400 | [diff] [blame] | 1665 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1666 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 0d3b33e | 2015-08-13 12:52:22 -0400 | [diff] [blame] | 1667 | } |
| 1668 | |
Vivien Didelot | 52109892 | 2019-08-01 14:36:36 -0400 | [diff] [blame] | 1669 | static int mv88e6xxx_port_vlan_leave(struct mv88e6xxx_chip *chip, |
| 1670 | int port, u16 vid) |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1671 | { |
Vivien Didelot | b4e47c0 | 2016-09-29 12:21:58 -0400 | [diff] [blame] | 1672 | struct mv88e6xxx_vtu_entry vlan; |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1673 | int i, err; |
| 1674 | |
Vivien Didelot | 52109892 | 2019-08-01 14:36:36 -0400 | [diff] [blame] | 1675 | if (!vid) |
| 1676 | return -EOPNOTSUPP; |
| 1677 | |
| 1678 | vlan.vid = vid - 1; |
| 1679 | vlan.valid = false; |
| 1680 | |
| 1681 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
Vivien Didelot | 36d04ba | 2015-10-22 09:34:39 -0400 | [diff] [blame] | 1682 | if (err) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1683 | return err; |
Vivien Didelot | 36d04ba | 2015-10-22 09:34:39 -0400 | [diff] [blame] | 1684 | |
Vivien Didelot | 52109892 | 2019-08-01 14:36:36 -0400 | [diff] [blame] | 1685 | /* If the VLAN doesn't exist in hardware or the port isn't a member, |
| 1686 | * tell switchdev that this VLAN is likely handled in software. |
| 1687 | */ |
| 1688 | if (vlan.vid != vid || !vlan.valid || |
| 1689 | vlan.member[port] == MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER) |
Vivien Didelot | 3c06f08 | 2016-02-05 14:04:39 -0500 | [diff] [blame] | 1690 | return -EOPNOTSUPP; |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1691 | |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1692 | vlan.member[port] = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER; |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1693 | |
| 1694 | /* keep the VLAN unless all ports are excluded */ |
Vivien Didelot | f02bdff | 2015-10-11 18:08:36 -0400 | [diff] [blame] | 1695 | vlan.valid = false; |
Vivien Didelot | 370b4ff | 2016-09-29 12:21:57 -0400 | [diff] [blame] | 1696 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) { |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1697 | if (vlan.member[i] != |
| 1698 | MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER) { |
Vivien Didelot | f02bdff | 2015-10-11 18:08:36 -0400 | [diff] [blame] | 1699 | vlan.valid = true; |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1700 | break; |
| 1701 | } |
| 1702 | } |
| 1703 | |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 1704 | err = mv88e6xxx_vtu_loadpurge(chip, &vlan); |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1705 | if (err) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1706 | return err; |
| 1707 | |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 1708 | return mv88e6xxx_g1_atu_remove(chip, vlan.fid, port, false); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1709 | } |
| 1710 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1711 | static int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port, |
| 1712 | const struct switchdev_obj_port_vlan *vlan) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1713 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1714 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1715 | u16 pvid, vid; |
| 1716 | int err = 0; |
| 1717 | |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1718 | if (!chip->info->max_vid) |
Vivien Didelot | 54d77b5 | 2016-05-09 13:22:47 -0400 | [diff] [blame] | 1719 | return -EOPNOTSUPP; |
| 1720 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1721 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1722 | |
Vivien Didelot | 77064f3 | 2016-11-04 03:23:30 +0100 | [diff] [blame] | 1723 | err = mv88e6xxx_port_get_pvid(chip, port, &pvid); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1724 | if (err) |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1725 | goto unlock; |
| 1726 | |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1727 | for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) { |
Vivien Didelot | 52109892 | 2019-08-01 14:36:36 -0400 | [diff] [blame] | 1728 | err = mv88e6xxx_port_vlan_leave(chip, port, vid); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1729 | if (err) |
| 1730 | goto unlock; |
| 1731 | |
| 1732 | if (vid == pvid) { |
Vivien Didelot | 77064f3 | 2016-11-04 03:23:30 +0100 | [diff] [blame] | 1733 | err = mv88e6xxx_port_set_pvid(chip, port, 0); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1734 | if (err) |
| 1735 | goto unlock; |
| 1736 | } |
| 1737 | } |
| 1738 | |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1739 | unlock: |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1740 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1741 | |
| 1742 | return err; |
| 1743 | } |
| 1744 | |
Arkadi Sharshevsky | 1b6dd55 | 2017-08-06 16:15:40 +0300 | [diff] [blame] | 1745 | static int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port, |
| 1746 | const unsigned char *addr, u16 vid) |
Guenter Roeck | defb05b | 2015-03-26 18:36:38 -0700 | [diff] [blame] | 1747 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1748 | struct mv88e6xxx_chip *chip = ds->priv; |
Arkadi Sharshevsky | 1b6dd55 | 2017-08-06 16:15:40 +0300 | [diff] [blame] | 1749 | int err; |
Vivien Didelot | 6630e23 | 2015-08-06 01:44:07 -0400 | [diff] [blame] | 1750 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1751 | mv88e6xxx_reg_lock(chip); |
Arkadi Sharshevsky | 1b6dd55 | 2017-08-06 16:15:40 +0300 | [diff] [blame] | 1752 | err = mv88e6xxx_port_db_load_purge(chip, port, addr, vid, |
| 1753 | MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1754 | mv88e6xxx_reg_unlock(chip); |
Arkadi Sharshevsky | 1b6dd55 | 2017-08-06 16:15:40 +0300 | [diff] [blame] | 1755 | |
| 1756 | return err; |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1757 | } |
| 1758 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1759 | static int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port, |
Arkadi Sharshevsky | 6c2c1dc | 2017-08-06 16:15:39 +0300 | [diff] [blame] | 1760 | const unsigned char *addr, u16 vid) |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1761 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1762 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1763 | int err; |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1764 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1765 | mv88e6xxx_reg_lock(chip); |
Arkadi Sharshevsky | 6c2c1dc | 2017-08-06 16:15:39 +0300 | [diff] [blame] | 1766 | err = mv88e6xxx_port_db_load_purge(chip, port, addr, vid, |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 1767 | MV88E6XXX_G1_ATU_DATA_STATE_UNUSED); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1768 | mv88e6xxx_reg_unlock(chip); |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1769 | |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1770 | return err; |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1771 | } |
| 1772 | |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1773 | static int mv88e6xxx_port_db_dump_fid(struct mv88e6xxx_chip *chip, |
| 1774 | u16 fid, u16 vid, int port, |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1775 | dsa_fdb_dump_cb_t *cb, void *data) |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1776 | { |
Vivien Didelot | dabc1a9 | 2017-03-11 16:12:53 -0500 | [diff] [blame] | 1777 | struct mv88e6xxx_atu_entry addr; |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1778 | bool is_static; |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1779 | int err; |
| 1780 | |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 1781 | addr.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED; |
Vivien Didelot | dabc1a9 | 2017-03-11 16:12:53 -0500 | [diff] [blame] | 1782 | eth_broadcast_addr(addr.mac); |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1783 | |
| 1784 | do { |
Vivien Didelot | dabc1a9 | 2017-03-11 16:12:53 -0500 | [diff] [blame] | 1785 | err = mv88e6xxx_g1_atu_getnext(chip, fid, &addr); |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1786 | if (err) |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1787 | return err; |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1788 | |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 1789 | if (addr.state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED) |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1790 | break; |
| 1791 | |
Vivien Didelot | 01bd96c | 2017-03-11 16:12:57 -0500 | [diff] [blame] | 1792 | if (addr.trunk || (addr.portvec & BIT(port)) == 0) |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1793 | continue; |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1794 | |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1795 | if (!is_unicast_ether_addr(addr.mac)) |
| 1796 | continue; |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1797 | |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1798 | is_static = (addr.state == |
| 1799 | MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC); |
| 1800 | err = cb(addr.mac, vid, is_static, data); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1801 | if (err) |
| 1802 | return err; |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1803 | } while (!is_broadcast_ether_addr(addr.mac)); |
| 1804 | |
| 1805 | return err; |
| 1806 | } |
| 1807 | |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1808 | static int mv88e6xxx_port_db_dump(struct mv88e6xxx_chip *chip, int port, |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1809 | dsa_fdb_dump_cb_t *cb, void *data) |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1810 | { |
Vivien Didelot | 425d2d3 | 2019-08-01 14:36:34 -0400 | [diff] [blame] | 1811 | struct mv88e6xxx_vtu_entry vlan; |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1812 | u16 fid; |
| 1813 | int err; |
| 1814 | |
| 1815 | /* Dump port's default Filtering Information Database (VLAN ID 0) */ |
Vivien Didelot | b4e48c5 | 2016-11-04 03:23:29 +0100 | [diff] [blame] | 1816 | err = mv88e6xxx_port_get_fid(chip, port, &fid); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1817 | if (err) |
| 1818 | return err; |
| 1819 | |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1820 | err = mv88e6xxx_port_db_dump_fid(chip, fid, 0, port, cb, data); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1821 | if (err) |
| 1822 | return err; |
| 1823 | |
| 1824 | /* Dump VLANs' Filtering Information Databases */ |
Vivien Didelot | 425d2d3 | 2019-08-01 14:36:34 -0400 | [diff] [blame] | 1825 | vlan.vid = chip->info->max_vid; |
| 1826 | vlan.valid = false; |
| 1827 | |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1828 | do { |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 1829 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1830 | if (err) |
| 1831 | return err; |
| 1832 | |
| 1833 | if (!vlan.valid) |
| 1834 | break; |
| 1835 | |
| 1836 | err = mv88e6xxx_port_db_dump_fid(chip, vlan.fid, vlan.vid, port, |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1837 | cb, data); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1838 | if (err) |
| 1839 | return err; |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1840 | } while (vlan.vid < chip->info->max_vid); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1841 | |
| 1842 | return err; |
| 1843 | } |
| 1844 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1845 | static int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port, |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1846 | dsa_fdb_dump_cb_t *cb, void *data) |
Vivien Didelot | f33475b | 2015-10-22 09:34:41 -0400 | [diff] [blame] | 1847 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1848 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | fcf1536 | 2019-06-12 12:42:47 -0400 | [diff] [blame] | 1849 | int err; |
Vivien Didelot | f33475b | 2015-10-22 09:34:41 -0400 | [diff] [blame] | 1850 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1851 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | fcf1536 | 2019-06-12 12:42:47 -0400 | [diff] [blame] | 1852 | err = mv88e6xxx_port_db_dump(chip, port, cb, data); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1853 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | fcf1536 | 2019-06-12 12:42:47 -0400 | [diff] [blame] | 1854 | |
| 1855 | return err; |
Vivien Didelot | f33475b | 2015-10-22 09:34:41 -0400 | [diff] [blame] | 1856 | } |
| 1857 | |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1858 | static int mv88e6xxx_bridge_map(struct mv88e6xxx_chip *chip, |
| 1859 | struct net_device *br) |
| 1860 | { |
Vivien Didelot | e96a6e0 | 2017-03-30 17:37:13 -0400 | [diff] [blame] | 1861 | struct dsa_switch *ds; |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1862 | int port; |
Vivien Didelot | e96a6e0 | 2017-03-30 17:37:13 -0400 | [diff] [blame] | 1863 | int dev; |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1864 | int err; |
| 1865 | |
| 1866 | /* Remap the Port VLAN of each local bridge group member */ |
| 1867 | for (port = 0; port < mv88e6xxx_num_ports(chip); ++port) { |
| 1868 | if (chip->ds->ports[port].bridge_dev == br) { |
| 1869 | err = mv88e6xxx_port_vlan_map(chip, port); |
| 1870 | if (err) |
| 1871 | return err; |
| 1872 | } |
| 1873 | } |
| 1874 | |
Vivien Didelot | e96a6e0 | 2017-03-30 17:37:13 -0400 | [diff] [blame] | 1875 | if (!mv88e6xxx_has_pvt(chip)) |
| 1876 | return 0; |
| 1877 | |
| 1878 | /* Remap the Port VLAN of each cross-chip bridge group member */ |
| 1879 | for (dev = 0; dev < DSA_MAX_SWITCHES; ++dev) { |
| 1880 | ds = chip->ds->dst->ds[dev]; |
| 1881 | if (!ds) |
| 1882 | break; |
| 1883 | |
| 1884 | for (port = 0; port < ds->num_ports; ++port) { |
| 1885 | if (ds->ports[port].bridge_dev == br) { |
| 1886 | err = mv88e6xxx_pvt_map(chip, dev, port); |
| 1887 | if (err) |
| 1888 | return err; |
| 1889 | } |
| 1890 | } |
| 1891 | } |
| 1892 | |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1893 | return 0; |
| 1894 | } |
| 1895 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1896 | static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, |
Vivien Didelot | fae8a25 | 2017-01-27 15:29:42 -0500 | [diff] [blame] | 1897 | struct net_device *br) |
Vivien Didelot | e79a8bc | 2015-11-04 17:23:40 -0500 | [diff] [blame] | 1898 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1899 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1900 | int err; |
Vivien Didelot | 466dfa0 | 2016-02-26 13:16:05 -0500 | [diff] [blame] | 1901 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1902 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1903 | err = mv88e6xxx_bridge_map(chip, br); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1904 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | a669275 | 2016-02-12 12:09:39 -0500 | [diff] [blame] | 1905 | |
Vivien Didelot | 466dfa0 | 2016-02-26 13:16:05 -0500 | [diff] [blame] | 1906 | return err; |
Vivien Didelot | e79a8bc | 2015-11-04 17:23:40 -0500 | [diff] [blame] | 1907 | } |
| 1908 | |
Vivien Didelot | f123f2f | 2017-01-27 15:29:41 -0500 | [diff] [blame] | 1909 | static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port, |
| 1910 | struct net_device *br) |
Vivien Didelot | e79a8bc | 2015-11-04 17:23:40 -0500 | [diff] [blame] | 1911 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1912 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 466dfa0 | 2016-02-26 13:16:05 -0500 | [diff] [blame] | 1913 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1914 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1915 | if (mv88e6xxx_bridge_map(chip, br) || |
| 1916 | mv88e6xxx_port_vlan_map(chip, port)) |
| 1917 | dev_err(ds->dev, "failed to remap in-chip Port VLAN\n"); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1918 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 66d9cd0 | 2016-02-05 14:07:14 -0500 | [diff] [blame] | 1919 | } |
| 1920 | |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 1921 | static int mv88e6xxx_crosschip_bridge_join(struct dsa_switch *ds, int dev, |
| 1922 | int port, struct net_device *br) |
| 1923 | { |
| 1924 | struct mv88e6xxx_chip *chip = ds->priv; |
| 1925 | int err; |
| 1926 | |
| 1927 | if (!mv88e6xxx_has_pvt(chip)) |
| 1928 | return 0; |
| 1929 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1930 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 1931 | err = mv88e6xxx_pvt_map(chip, dev, port); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1932 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 1933 | |
| 1934 | return err; |
| 1935 | } |
| 1936 | |
| 1937 | static void mv88e6xxx_crosschip_bridge_leave(struct dsa_switch *ds, int dev, |
| 1938 | int port, struct net_device *br) |
| 1939 | { |
| 1940 | struct mv88e6xxx_chip *chip = ds->priv; |
| 1941 | |
| 1942 | if (!mv88e6xxx_has_pvt(chip)) |
| 1943 | return; |
| 1944 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1945 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 1946 | if (mv88e6xxx_pvt_map(chip, dev, port)) |
| 1947 | dev_err(ds->dev, "failed to remap cross-chip Port VLAN\n"); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1948 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 1949 | } |
| 1950 | |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 1951 | static int mv88e6xxx_software_reset(struct mv88e6xxx_chip *chip) |
| 1952 | { |
| 1953 | if (chip->info->ops->reset) |
| 1954 | return chip->info->ops->reset(chip); |
| 1955 | |
| 1956 | return 0; |
| 1957 | } |
| 1958 | |
Vivien Didelot | 309eca6 | 2016-12-05 17:30:26 -0500 | [diff] [blame] | 1959 | static void mv88e6xxx_hardware_reset(struct mv88e6xxx_chip *chip) |
| 1960 | { |
| 1961 | struct gpio_desc *gpiod = chip->reset; |
| 1962 | |
| 1963 | /* If there is a GPIO connected to the reset pin, toggle it */ |
| 1964 | if (gpiod) { |
| 1965 | gpiod_set_value_cansleep(gpiod, 1); |
| 1966 | usleep_range(10000, 20000); |
| 1967 | gpiod_set_value_cansleep(gpiod, 0); |
| 1968 | usleep_range(10000, 20000); |
| 1969 | } |
| 1970 | } |
| 1971 | |
Vivien Didelot | 4ac4b5a | 2016-12-05 17:30:25 -0500 | [diff] [blame] | 1972 | static int mv88e6xxx_disable_ports(struct mv88e6xxx_chip *chip) |
| 1973 | { |
| 1974 | int i, err; |
| 1975 | |
| 1976 | /* Set all ports to the Disabled state */ |
| 1977 | for (i = 0; i < mv88e6xxx_num_ports(chip); i++) { |
Vivien Didelot | f894c29 | 2017-06-08 18:34:10 -0400 | [diff] [blame] | 1978 | err = mv88e6xxx_port_set_state(chip, i, BR_STATE_DISABLED); |
Vivien Didelot | 4ac4b5a | 2016-12-05 17:30:25 -0500 | [diff] [blame] | 1979 | if (err) |
| 1980 | return err; |
| 1981 | } |
| 1982 | |
| 1983 | /* Wait for transmit queues to drain, |
| 1984 | * i.e. 2ms for a maximum frame to be transmitted at 10 Mbps. |
| 1985 | */ |
| 1986 | usleep_range(2000, 4000); |
| 1987 | |
| 1988 | return 0; |
| 1989 | } |
| 1990 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1991 | static int mv88e6xxx_switch_reset(struct mv88e6xxx_chip *chip) |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 1992 | { |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 1993 | int err; |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 1994 | |
Vivien Didelot | 4ac4b5a | 2016-12-05 17:30:25 -0500 | [diff] [blame] | 1995 | err = mv88e6xxx_disable_ports(chip); |
| 1996 | if (err) |
| 1997 | return err; |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 1998 | |
Vivien Didelot | 309eca6 | 2016-12-05 17:30:26 -0500 | [diff] [blame] | 1999 | mv88e6xxx_hardware_reset(chip); |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 2000 | |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2001 | return mv88e6xxx_software_reset(chip); |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 2002 | } |
| 2003 | |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2004 | static int mv88e6xxx_set_port_mode(struct mv88e6xxx_chip *chip, int port, |
Vivien Didelot | 31bef4e | 2017-06-08 18:34:09 -0400 | [diff] [blame] | 2005 | enum mv88e6xxx_frame_mode frame, |
| 2006 | enum mv88e6xxx_egress_mode egress, u16 etype) |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2007 | { |
| 2008 | int err; |
| 2009 | |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2010 | if (!chip->info->ops->port_set_frame_mode) |
| 2011 | return -EOPNOTSUPP; |
| 2012 | |
| 2013 | err = mv88e6xxx_port_set_egress_mode(chip, port, egress); |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2014 | if (err) |
| 2015 | return err; |
| 2016 | |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2017 | err = chip->info->ops->port_set_frame_mode(chip, port, frame); |
| 2018 | if (err) |
| 2019 | return err; |
| 2020 | |
| 2021 | if (chip->info->ops->port_set_ether_type) |
| 2022 | return chip->info->ops->port_set_ether_type(chip, port, etype); |
| 2023 | |
| 2024 | return 0; |
| 2025 | } |
| 2026 | |
| 2027 | static int mv88e6xxx_set_port_mode_normal(struct mv88e6xxx_chip *chip, int port) |
| 2028 | { |
| 2029 | return mv88e6xxx_set_port_mode(chip, port, MV88E6XXX_FRAME_MODE_NORMAL, |
Vivien Didelot | 31bef4e | 2017-06-08 18:34:09 -0400 | [diff] [blame] | 2030 | MV88E6XXX_EGRESS_MODE_UNMODIFIED, |
Vivien Didelot | b810959 | 2017-06-12 12:37:45 -0400 | [diff] [blame] | 2031 | MV88E6XXX_PORT_ETH_TYPE_DEFAULT); |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2032 | } |
| 2033 | |
| 2034 | static int mv88e6xxx_set_port_mode_dsa(struct mv88e6xxx_chip *chip, int port) |
| 2035 | { |
| 2036 | return mv88e6xxx_set_port_mode(chip, port, MV88E6XXX_FRAME_MODE_DSA, |
Vivien Didelot | 31bef4e | 2017-06-08 18:34:09 -0400 | [diff] [blame] | 2037 | MV88E6XXX_EGRESS_MODE_UNMODIFIED, |
Vivien Didelot | b810959 | 2017-06-12 12:37:45 -0400 | [diff] [blame] | 2038 | MV88E6XXX_PORT_ETH_TYPE_DEFAULT); |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2039 | } |
| 2040 | |
| 2041 | static int mv88e6xxx_set_port_mode_edsa(struct mv88e6xxx_chip *chip, int port) |
| 2042 | { |
| 2043 | return mv88e6xxx_set_port_mode(chip, port, |
| 2044 | MV88E6XXX_FRAME_MODE_ETHERTYPE, |
Vivien Didelot | 31bef4e | 2017-06-08 18:34:09 -0400 | [diff] [blame] | 2045 | MV88E6XXX_EGRESS_MODE_ETHERTYPE, |
| 2046 | ETH_P_EDSA); |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2047 | } |
| 2048 | |
| 2049 | static int mv88e6xxx_setup_port_mode(struct mv88e6xxx_chip *chip, int port) |
| 2050 | { |
| 2051 | if (dsa_is_dsa_port(chip->ds, port)) |
| 2052 | return mv88e6xxx_set_port_mode_dsa(chip, port); |
| 2053 | |
Vivien Didelot | 2b3e989 | 2017-10-26 11:22:54 -0400 | [diff] [blame] | 2054 | if (dsa_is_user_port(chip->ds, port)) |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2055 | return mv88e6xxx_set_port_mode_normal(chip, port); |
| 2056 | |
| 2057 | /* Setup CPU port mode depending on its supported tag format */ |
| 2058 | if (chip->info->tag_protocol == DSA_TAG_PROTO_DSA) |
| 2059 | return mv88e6xxx_set_port_mode_dsa(chip, port); |
| 2060 | |
| 2061 | if (chip->info->tag_protocol == DSA_TAG_PROTO_EDSA) |
| 2062 | return mv88e6xxx_set_port_mode_edsa(chip, port); |
| 2063 | |
| 2064 | return -EINVAL; |
| 2065 | } |
| 2066 | |
Vivien Didelot | ea698f4 | 2017-03-11 16:12:50 -0500 | [diff] [blame] | 2067 | static int mv88e6xxx_setup_message_port(struct mv88e6xxx_chip *chip, int port) |
| 2068 | { |
| 2069 | bool message = dsa_is_dsa_port(chip->ds, port); |
| 2070 | |
| 2071 | return mv88e6xxx_port_set_message_port(chip, port, message); |
| 2072 | } |
| 2073 | |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2074 | static int mv88e6xxx_setup_egress_floods(struct mv88e6xxx_chip *chip, int port) |
| 2075 | { |
Vivien Didelot | 3ee50cb | 2017-12-05 15:34:09 -0500 | [diff] [blame] | 2076 | struct dsa_switch *ds = chip->ds; |
David S. Miller | 407308f | 2019-06-15 13:35:29 -0700 | [diff] [blame] | 2077 | bool flood; |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2078 | |
David S. Miller | 407308f | 2019-06-15 13:35:29 -0700 | [diff] [blame] | 2079 | /* Upstream ports flood frames with unknown unicast or multicast DA */ |
| 2080 | flood = dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port); |
| 2081 | if (chip->info->ops->port_set_egress_floods) |
| 2082 | return chip->info->ops->port_set_egress_floods(chip, port, |
| 2083 | flood, flood); |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2084 | |
David S. Miller | 407308f | 2019-06-15 13:35:29 -0700 | [diff] [blame] | 2085 | return 0; |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2086 | } |
| 2087 | |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 2088 | static int mv88e6xxx_serdes_power(struct mv88e6xxx_chip *chip, int port, |
| 2089 | bool on) |
| 2090 | { |
Vivien Didelot | 523a890 | 2017-05-26 18:02:42 -0400 | [diff] [blame] | 2091 | if (chip->info->ops->serdes_power) |
| 2092 | return chip->info->ops->serdes_power(chip, port, on); |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 2093 | |
Vivien Didelot | 523a890 | 2017-05-26 18:02:42 -0400 | [diff] [blame] | 2094 | return 0; |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 2095 | } |
| 2096 | |
Vivien Didelot | fa371c8 | 2017-12-05 15:34:10 -0500 | [diff] [blame] | 2097 | static int mv88e6xxx_setup_upstream_port(struct mv88e6xxx_chip *chip, int port) |
| 2098 | { |
| 2099 | struct dsa_switch *ds = chip->ds; |
| 2100 | int upstream_port; |
| 2101 | int err; |
| 2102 | |
Vivien Didelot | 07073c7 | 2017-12-05 15:34:13 -0500 | [diff] [blame] | 2103 | upstream_port = dsa_upstream_port(ds, port); |
Vivien Didelot | fa371c8 | 2017-12-05 15:34:10 -0500 | [diff] [blame] | 2104 | if (chip->info->ops->port_set_upstream_port) { |
| 2105 | err = chip->info->ops->port_set_upstream_port(chip, port, |
| 2106 | upstream_port); |
| 2107 | if (err) |
| 2108 | return err; |
| 2109 | } |
| 2110 | |
Vivien Didelot | 0ea54dd | 2017-12-05 15:34:11 -0500 | [diff] [blame] | 2111 | if (port == upstream_port) { |
| 2112 | if (chip->info->ops->set_cpu_port) { |
| 2113 | err = chip->info->ops->set_cpu_port(chip, |
| 2114 | upstream_port); |
| 2115 | if (err) |
| 2116 | return err; |
| 2117 | } |
| 2118 | |
| 2119 | if (chip->info->ops->set_egress_port) { |
| 2120 | err = chip->info->ops->set_egress_port(chip, |
| 2121 | upstream_port); |
| 2122 | if (err) |
| 2123 | return err; |
| 2124 | } |
| 2125 | } |
| 2126 | |
Vivien Didelot | fa371c8 | 2017-12-05 15:34:10 -0500 | [diff] [blame] | 2127 | return 0; |
| 2128 | } |
| 2129 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2130 | static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2131 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2132 | struct dsa_switch *ds = chip->ds; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2133 | int err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2134 | u16 reg; |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2135 | |
Andrew Lunn | 7b89846 | 2018-08-09 15:38:47 +0200 | [diff] [blame] | 2136 | chip->ports[port].chip = chip; |
| 2137 | chip->ports[port].port = port; |
| 2138 | |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 2139 | /* MAC Forcing register: don't force link, speed, duplex or flow control |
| 2140 | * state to any particular values on physical ports, but force the CPU |
| 2141 | * port and all DSA ports to their maximum bandwidth and full duplex. |
| 2142 | */ |
| 2143 | if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)) |
| 2144 | err = mv88e6xxx_port_setup_mac(chip, port, LINK_FORCED_UP, |
| 2145 | SPEED_MAX, DUPLEX_FULL, |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 2146 | PAUSE_OFF, |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 2147 | PHY_INTERFACE_MODE_NA); |
| 2148 | else |
| 2149 | err = mv88e6xxx_port_setup_mac(chip, port, LINK_UNFORCED, |
| 2150 | SPEED_UNFORCED, DUPLEX_UNFORCED, |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 2151 | PAUSE_ON, |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 2152 | PHY_INTERFACE_MODE_NA); |
| 2153 | if (err) |
| 2154 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2155 | |
| 2156 | /* Port Control: disable Drop-on-Unlock, disable Drop-on-Lock, |
| 2157 | * disable Header mode, enable IGMP/MLD snooping, disable VLAN |
| 2158 | * tunneling, determine priority by looking at 802.1p and IP |
| 2159 | * priority fields (IP prio has precedence), and set STP state |
| 2160 | * to Forwarding. |
| 2161 | * |
| 2162 | * If this is the CPU link, use DSA or EDSA tagging depending |
| 2163 | * on which tagging mode was configured. |
| 2164 | * |
| 2165 | * If this is a link to another switch, use DSA tagging mode. |
| 2166 | * |
| 2167 | * If this is the upstream port for this switch, enable |
| 2168 | * forwarding of unknown unicasts and multicasts. |
| 2169 | */ |
Vivien Didelot | a89b433be | 2017-06-12 12:37:37 -0400 | [diff] [blame] | 2170 | reg = MV88E6XXX_PORT_CTL0_IGMP_MLD_SNOOP | |
| 2171 | MV88E6185_PORT_CTL0_USE_TAG | MV88E6185_PORT_CTL0_USE_IP | |
| 2172 | MV88E6XXX_PORT_CTL0_STATE_FORWARDING; |
| 2173 | err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_CTL0, reg); |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2174 | if (err) |
| 2175 | return err; |
Andrew Lunn | 6083ce7 | 2015-08-17 23:52:52 +0200 | [diff] [blame] | 2176 | |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2177 | err = mv88e6xxx_setup_port_mode(chip, port); |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2178 | if (err) |
| 2179 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2180 | |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2181 | err = mv88e6xxx_setup_egress_floods(chip, port); |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2182 | if (err) |
| 2183 | return err; |
| 2184 | |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2185 | /* Enable the SERDES interface for DSA and CPU ports. Normal |
| 2186 | * ports SERDES are enabled when the port is enabled, thus |
| 2187 | * saving a bit of power. |
Patrick Uiterwijk | 13a7ebb | 2016-03-30 01:39:41 +0000 | [diff] [blame] | 2188 | */ |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2189 | if ((dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))) { |
| 2190 | err = mv88e6xxx_serdes_power(chip, port, true); |
| 2191 | if (err) |
| 2192 | return err; |
| 2193 | } |
Patrick Uiterwijk | 13a7ebb | 2016-03-30 01:39:41 +0000 | [diff] [blame] | 2194 | |
Vivien Didelot | 8efdda4 | 2015-08-13 12:52:23 -0400 | [diff] [blame] | 2195 | /* Port Control 2: don't force a good FCS, set the maximum frame size to |
Vivien Didelot | 46fbe5e | 2016-02-26 13:16:07 -0500 | [diff] [blame] | 2196 | * 10240 bytes, disable 802.1q tags checking, don't discard tagged or |
Vivien Didelot | 8efdda4 | 2015-08-13 12:52:23 -0400 | [diff] [blame] | 2197 | * untagged frames on this port, do a destination address lookup on all |
| 2198 | * received packets as usual, disable ARP mirroring and don't send a |
| 2199 | * copy of all transmitted/received frames on this port to the CPU. |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2200 | */ |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2201 | err = mv88e6xxx_port_set_map_da(chip, port); |
| 2202 | if (err) |
| 2203 | return err; |
| 2204 | |
Vivien Didelot | fa371c8 | 2017-12-05 15:34:10 -0500 | [diff] [blame] | 2205 | err = mv88e6xxx_setup_upstream_port(chip, port); |
| 2206 | if (err) |
| 2207 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2208 | |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2209 | err = mv88e6xxx_port_set_8021q_mode(chip, port, |
Vivien Didelot | 81c6edb | 2017-06-12 12:37:41 -0400 | [diff] [blame] | 2210 | MV88E6XXX_PORT_CTL2_8021Q_MODE_DISABLED); |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2211 | if (err) |
| 2212 | return err; |
| 2213 | |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2214 | if (chip->info->ops->port_set_jumbo_size) { |
| 2215 | err = chip->info->ops->port_set_jumbo_size(chip, port, 10240); |
Andrew Lunn | 5f43666 | 2016-12-03 04:45:17 +0100 | [diff] [blame] | 2216 | if (err) |
| 2217 | return err; |
| 2218 | } |
| 2219 | |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2220 | /* Port Association Vector: when learning source addresses |
| 2221 | * of packets, add the address to the address database using |
| 2222 | * a port bitmap that has only the bit for this port set and |
| 2223 | * the other bits clear. |
| 2224 | */ |
Andrew Lunn | 4c7ea3c | 2015-11-03 10:52:36 -0500 | [diff] [blame] | 2225 | reg = 1 << port; |
Vivien Didelot | 996ecb8 | 2016-04-14 14:42:08 -0400 | [diff] [blame] | 2226 | /* Disable learning for CPU port */ |
| 2227 | if (dsa_is_cpu_port(ds, port)) |
Vivien Didelot | 65fa402 | 2016-04-14 14:42:07 -0400 | [diff] [blame] | 2228 | reg = 0; |
Andrew Lunn | 4c7ea3c | 2015-11-03 10:52:36 -0500 | [diff] [blame] | 2229 | |
Vivien Didelot | 2a4614e | 2017-06-12 12:37:43 -0400 | [diff] [blame] | 2230 | err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_ASSOC_VECTOR, |
| 2231 | reg); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2232 | if (err) |
| 2233 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2234 | |
| 2235 | /* Egress rate control 2: disable egress rate control. */ |
Vivien Didelot | 2cb8cb1 | 2017-06-12 12:37:42 -0400 | [diff] [blame] | 2236 | err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_EGRESS_RATE_CTL2, |
| 2237 | 0x0000); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2238 | if (err) |
| 2239 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2240 | |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2241 | if (chip->info->ops->port_pause_limit) { |
| 2242 | err = chip->info->ops->port_pause_limit(chip, port, 0, 0); |
Andrew Lunn | b35d322a | 2016-12-03 04:45:19 +0100 | [diff] [blame] | 2243 | if (err) |
| 2244 | return err; |
| 2245 | } |
| 2246 | |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2247 | if (chip->info->ops->port_disable_learn_limit) { |
| 2248 | err = chip->info->ops->port_disable_learn_limit(chip, port); |
| 2249 | if (err) |
| 2250 | return err; |
| 2251 | } |
| 2252 | |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2253 | if (chip->info->ops->port_disable_pri_override) { |
| 2254 | err = chip->info->ops->port_disable_pri_override(chip, port); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2255 | if (err) |
| 2256 | return err; |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2257 | } |
Andrew Lunn | 2bbb33b | 2016-08-22 16:01:02 +0200 | [diff] [blame] | 2258 | |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2259 | if (chip->info->ops->port_tag_remap) { |
| 2260 | err = chip->info->ops->port_tag_remap(chip, port); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2261 | if (err) |
| 2262 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2263 | } |
| 2264 | |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2265 | if (chip->info->ops->port_egress_rate_limiting) { |
| 2266 | err = chip->info->ops->port_egress_rate_limiting(chip, port); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2267 | if (err) |
| 2268 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2269 | } |
| 2270 | |
Vivien Didelot | ea698f4 | 2017-03-11 16:12:50 -0500 | [diff] [blame] | 2271 | err = mv88e6xxx_setup_message_port(chip, port); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2272 | if (err) |
| 2273 | return err; |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2274 | |
Vivien Didelot | 207afda | 2016-04-14 14:42:09 -0400 | [diff] [blame] | 2275 | /* Port based VLAN map: give each port the same default address |
Vivien Didelot | b7666ef | 2016-02-26 13:16:06 -0500 | [diff] [blame] | 2276 | * database, and allow bidirectional communication between the |
| 2277 | * CPU and DSA port(s), and the other ports. |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2278 | */ |
Vivien Didelot | b4e48c5 | 2016-11-04 03:23:29 +0100 | [diff] [blame] | 2279 | err = mv88e6xxx_port_set_fid(chip, port, 0); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2280 | if (err) |
| 2281 | return err; |
Vivien Didelot | 2db9ce1 | 2016-02-26 13:16:04 -0500 | [diff] [blame] | 2282 | |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 2283 | err = mv88e6xxx_port_vlan_map(chip, port); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2284 | if (err) |
| 2285 | return err; |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2286 | |
| 2287 | /* Default VLAN ID and priority: don't set a default VLAN |
| 2288 | * ID, and set the default packet priority to zero. |
| 2289 | */ |
Vivien Didelot | b7929fb | 2017-06-12 12:37:40 -0400 | [diff] [blame] | 2290 | return mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_DEFAULT_VLAN, 0); |
Andrew Lunn | dbde9e6 | 2015-05-06 01:09:48 +0200 | [diff] [blame] | 2291 | } |
| 2292 | |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2293 | static int mv88e6xxx_port_enable(struct dsa_switch *ds, int port, |
| 2294 | struct phy_device *phydev) |
| 2295 | { |
| 2296 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 523a890 | 2017-05-26 18:02:42 -0400 | [diff] [blame] | 2297 | int err; |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2298 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2299 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | efd1ba6 | 2018-08-09 15:38:48 +0200 | [diff] [blame] | 2300 | |
Vivien Didelot | 523a890 | 2017-05-26 18:02:42 -0400 | [diff] [blame] | 2301 | err = mv88e6xxx_serdes_power(chip, port, true); |
Andrew Lunn | efd1ba6 | 2018-08-09 15:38:48 +0200 | [diff] [blame] | 2302 | |
| 2303 | if (!err && chip->info->ops->serdes_irq_setup) |
| 2304 | err = chip->info->ops->serdes_irq_setup(chip, port); |
| 2305 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2306 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2307 | |
| 2308 | return err; |
| 2309 | } |
| 2310 | |
Andrew Lunn | 75104db | 2019-02-24 20:44:43 +0100 | [diff] [blame] | 2311 | static void mv88e6xxx_port_disable(struct dsa_switch *ds, int port) |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2312 | { |
| 2313 | struct mv88e6xxx_chip *chip = ds->priv; |
| 2314 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2315 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | efd1ba6 | 2018-08-09 15:38:48 +0200 | [diff] [blame] | 2316 | |
Andrew Lunn | 4a0eb73 | 2019-05-01 00:08:30 +0200 | [diff] [blame] | 2317 | if (mv88e6xxx_port_set_state(chip, port, BR_STATE_DISABLED)) |
| 2318 | dev_err(chip->dev, "failed to disable port\n"); |
| 2319 | |
Andrew Lunn | efd1ba6 | 2018-08-09 15:38:48 +0200 | [diff] [blame] | 2320 | if (chip->info->ops->serdes_irq_free) |
| 2321 | chip->info->ops->serdes_irq_free(chip, port); |
| 2322 | |
Vivien Didelot | 523a890 | 2017-05-26 18:02:42 -0400 | [diff] [blame] | 2323 | if (mv88e6xxx_serdes_power(chip, port, false)) |
| 2324 | dev_err(chip->dev, "failed to power off SERDES\n"); |
Andrew Lunn | efd1ba6 | 2018-08-09 15:38:48 +0200 | [diff] [blame] | 2325 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2326 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2327 | } |
| 2328 | |
Vivien Didelot | 2cfcd96 | 2016-07-18 20:45:40 -0400 | [diff] [blame] | 2329 | static int mv88e6xxx_set_ageing_time(struct dsa_switch *ds, |
| 2330 | unsigned int ageing_time) |
| 2331 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2332 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 2cfcd96 | 2016-07-18 20:45:40 -0400 | [diff] [blame] | 2333 | int err; |
| 2334 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2335 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 720c634 | 2017-03-11 16:12:48 -0500 | [diff] [blame] | 2336 | err = mv88e6xxx_g1_atu_set_age_time(chip, ageing_time); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2337 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 2cfcd96 | 2016-07-18 20:45:40 -0400 | [diff] [blame] | 2338 | |
| 2339 | return err; |
| 2340 | } |
| 2341 | |
Vivien Didelot | 447b1bb | 2018-05-11 17:16:36 -0400 | [diff] [blame] | 2342 | static int mv88e6xxx_stats_setup(struct mv88e6xxx_chip *chip) |
Vivien Didelot | 08a0126 | 2016-05-09 13:22:50 -0400 | [diff] [blame] | 2343 | { |
| 2344 | int err; |
Vivien Didelot | 08a0126 | 2016-05-09 13:22:50 -0400 | [diff] [blame] | 2345 | |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 2346 | /* Initialize the statistics unit */ |
Vivien Didelot | 447b1bb | 2018-05-11 17:16:36 -0400 | [diff] [blame] | 2347 | if (chip->info->ops->stats_set_histogram) { |
| 2348 | err = chip->info->ops->stats_set_histogram(chip); |
| 2349 | if (err) |
| 2350 | return err; |
| 2351 | } |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 2352 | |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2353 | return mv88e6xxx_g1_stats_clear(chip); |
Vivien Didelot | 9729934 | 2016-07-18 20:45:30 -0400 | [diff] [blame] | 2354 | } |
| 2355 | |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 2356 | /* The mv88e6390 has some hidden registers used for debug and |
| 2357 | * development. The errata also makes use of them. |
| 2358 | */ |
| 2359 | static int mv88e6390_hidden_write(struct mv88e6xxx_chip *chip, int port, |
| 2360 | int reg, u16 val) |
| 2361 | { |
| 2362 | u16 ctrl; |
| 2363 | int err; |
| 2364 | |
| 2365 | err = mv88e6xxx_port_write(chip, PORT_RESERVED_1A_DATA_PORT, |
| 2366 | PORT_RESERVED_1A, val); |
| 2367 | if (err) |
| 2368 | return err; |
| 2369 | |
| 2370 | ctrl = PORT_RESERVED_1A_BUSY | PORT_RESERVED_1A_WRITE | |
| 2371 | PORT_RESERVED_1A_BLOCK | port << PORT_RESERVED_1A_PORT_SHIFT | |
| 2372 | reg; |
| 2373 | |
| 2374 | return mv88e6xxx_port_write(chip, PORT_RESERVED_1A_CTRL_PORT, |
| 2375 | PORT_RESERVED_1A, ctrl); |
| 2376 | } |
| 2377 | |
| 2378 | static int mv88e6390_hidden_wait(struct mv88e6xxx_chip *chip) |
| 2379 | { |
| 2380 | return mv88e6xxx_wait(chip, PORT_RESERVED_1A_CTRL_PORT, |
| 2381 | PORT_RESERVED_1A, PORT_RESERVED_1A_BUSY); |
| 2382 | } |
| 2383 | |
| 2384 | |
| 2385 | static int mv88e6390_hidden_read(struct mv88e6xxx_chip *chip, int port, |
| 2386 | int reg, u16 *val) |
| 2387 | { |
| 2388 | u16 ctrl; |
| 2389 | int err; |
| 2390 | |
| 2391 | ctrl = PORT_RESERVED_1A_BUSY | PORT_RESERVED_1A_READ | |
| 2392 | PORT_RESERVED_1A_BLOCK | port << PORT_RESERVED_1A_PORT_SHIFT | |
| 2393 | reg; |
| 2394 | |
| 2395 | err = mv88e6xxx_port_write(chip, PORT_RESERVED_1A_CTRL_PORT, |
| 2396 | PORT_RESERVED_1A, ctrl); |
| 2397 | if (err) |
| 2398 | return err; |
| 2399 | |
| 2400 | err = mv88e6390_hidden_wait(chip); |
| 2401 | if (err) |
| 2402 | return err; |
| 2403 | |
| 2404 | return mv88e6xxx_port_read(chip, PORT_RESERVED_1A_DATA_PORT, |
| 2405 | PORT_RESERVED_1A, val); |
| 2406 | } |
| 2407 | |
| 2408 | /* Check if the errata has already been applied. */ |
| 2409 | static bool mv88e6390_setup_errata_applied(struct mv88e6xxx_chip *chip) |
| 2410 | { |
| 2411 | int port; |
| 2412 | int err; |
| 2413 | u16 val; |
| 2414 | |
| 2415 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
| 2416 | err = mv88e6390_hidden_read(chip, port, 0, &val); |
| 2417 | if (err) { |
| 2418 | dev_err(chip->dev, |
| 2419 | "Error reading hidden register: %d\n", err); |
| 2420 | return false; |
| 2421 | } |
| 2422 | if (val != 0x01c0) |
| 2423 | return false; |
| 2424 | } |
| 2425 | |
| 2426 | return true; |
| 2427 | } |
| 2428 | |
| 2429 | /* The 6390 copper ports have an errata which require poking magic |
| 2430 | * values into undocumented hidden registers and then performing a |
| 2431 | * software reset. |
| 2432 | */ |
| 2433 | static int mv88e6390_setup_errata(struct mv88e6xxx_chip *chip) |
| 2434 | { |
| 2435 | int port; |
| 2436 | int err; |
| 2437 | |
| 2438 | if (mv88e6390_setup_errata_applied(chip)) |
| 2439 | return 0; |
| 2440 | |
| 2441 | /* Set the ports into blocking mode */ |
| 2442 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
| 2443 | err = mv88e6xxx_port_set_state(chip, port, BR_STATE_DISABLED); |
| 2444 | if (err) |
| 2445 | return err; |
| 2446 | } |
| 2447 | |
| 2448 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
| 2449 | err = mv88e6390_hidden_write(chip, port, 0, 0x01c0); |
| 2450 | if (err) |
| 2451 | return err; |
| 2452 | } |
| 2453 | |
| 2454 | return mv88e6xxx_software_reset(chip); |
| 2455 | } |
| 2456 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 2457 | static int mv88e6xxx_setup(struct dsa_switch *ds) |
Guenter Roeck | acdaffc | 2015-03-26 18:36:28 -0700 | [diff] [blame] | 2458 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2459 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2460 | u8 cmode; |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 2461 | int err; |
Vivien Didelot | a1a6a4d | 2016-05-09 13:22:56 -0400 | [diff] [blame] | 2462 | int i; |
| 2463 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2464 | chip->ds = ds; |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2465 | ds->slave_mii_bus = mv88e6xxx_default_mdio_bus(chip); |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 2466 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2467 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 2468 | |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 2469 | if (chip->info->ops->setup_errata) { |
| 2470 | err = chip->info->ops->setup_errata(chip); |
| 2471 | if (err) |
| 2472 | goto unlock; |
| 2473 | } |
| 2474 | |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2475 | /* Cache the cmode of each port. */ |
| 2476 | for (i = 0; i < mv88e6xxx_num_ports(chip); i++) { |
| 2477 | if (chip->info->ops->port_get_cmode) { |
| 2478 | err = chip->info->ops->port_get_cmode(chip, i, &cmode); |
| 2479 | if (err) |
Dan Carpenter | e29129f | 2018-08-14 12:09:05 +0300 | [diff] [blame] | 2480 | goto unlock; |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2481 | |
| 2482 | chip->ports[i].cmode = cmode; |
| 2483 | } |
| 2484 | } |
| 2485 | |
Vivien Didelot | 9729934 | 2016-07-18 20:45:30 -0400 | [diff] [blame] | 2486 | /* Setup Switch Port Registers */ |
Vivien Didelot | 370b4ff | 2016-09-29 12:21:57 -0400 | [diff] [blame] | 2487 | for (i = 0; i < mv88e6xxx_num_ports(chip); i++) { |
Andrew Lunn | 100a9b9 | 2019-05-01 00:08:31 +0200 | [diff] [blame] | 2488 | if (dsa_is_unused_port(ds, i)) { |
| 2489 | err = mv88e6xxx_port_set_state(chip, i, |
| 2490 | BR_STATE_DISABLED); |
| 2491 | if (err) |
| 2492 | goto unlock; |
| 2493 | |
| 2494 | err = mv88e6xxx_serdes_power(chip, i, false); |
| 2495 | if (err) |
| 2496 | goto unlock; |
| 2497 | |
Vivien Didelot | 91dee14 | 2017-10-26 11:22:52 -0400 | [diff] [blame] | 2498 | continue; |
Andrew Lunn | 100a9b9 | 2019-05-01 00:08:31 +0200 | [diff] [blame] | 2499 | } |
Vivien Didelot | 91dee14 | 2017-10-26 11:22:52 -0400 | [diff] [blame] | 2500 | |
Vivien Didelot | 9729934 | 2016-07-18 20:45:30 -0400 | [diff] [blame] | 2501 | err = mv88e6xxx_setup_port(chip, i); |
| 2502 | if (err) |
| 2503 | goto unlock; |
| 2504 | } |
| 2505 | |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2506 | err = mv88e6xxx_irl_setup(chip); |
| 2507 | if (err) |
| 2508 | goto unlock; |
| 2509 | |
Vivien Didelot | 04a69a1 | 2017-10-13 14:18:05 -0400 | [diff] [blame] | 2510 | err = mv88e6xxx_mac_setup(chip); |
| 2511 | if (err) |
| 2512 | goto unlock; |
| 2513 | |
Vivien Didelot | 1b17aed | 2017-05-26 18:03:05 -0400 | [diff] [blame] | 2514 | err = mv88e6xxx_phy_setup(chip); |
| 2515 | if (err) |
| 2516 | goto unlock; |
| 2517 | |
Vivien Didelot | b486d7c | 2017-05-01 14:05:13 -0400 | [diff] [blame] | 2518 | err = mv88e6xxx_vtu_setup(chip); |
| 2519 | if (err) |
| 2520 | goto unlock; |
| 2521 | |
Vivien Didelot | 8122899 | 2017-03-30 17:37:08 -0400 | [diff] [blame] | 2522 | err = mv88e6xxx_pvt_setup(chip); |
| 2523 | if (err) |
| 2524 | goto unlock; |
| 2525 | |
Vivien Didelot | a2ac29d | 2017-03-11 16:12:49 -0500 | [diff] [blame] | 2526 | err = mv88e6xxx_atu_setup(chip); |
| 2527 | if (err) |
| 2528 | goto unlock; |
| 2529 | |
Andrew Lunn | 87fa886 | 2017-11-09 22:29:56 +0100 | [diff] [blame] | 2530 | err = mv88e6xxx_broadcast_setup(chip, 0); |
| 2531 | if (err) |
| 2532 | goto unlock; |
| 2533 | |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2534 | err = mv88e6xxx_pot_setup(chip); |
| 2535 | if (err) |
| 2536 | goto unlock; |
| 2537 | |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 2538 | err = mv88e6xxx_rmu_setup(chip); |
| 2539 | if (err) |
| 2540 | goto unlock; |
| 2541 | |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2542 | err = mv88e6xxx_rsvd2cpu_setup(chip); |
| 2543 | if (err) |
| 2544 | goto unlock; |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 2545 | |
Vivien Didelot | b28f872 | 2018-04-26 21:56:44 -0400 | [diff] [blame] | 2546 | err = mv88e6xxx_trunk_setup(chip); |
| 2547 | if (err) |
| 2548 | goto unlock; |
| 2549 | |
Vivien Didelot | c7f047b | 2018-04-26 21:56:45 -0400 | [diff] [blame] | 2550 | err = mv88e6xxx_devmap_setup(chip); |
| 2551 | if (err) |
| 2552 | goto unlock; |
| 2553 | |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2554 | err = mv88e6xxx_pri_setup(chip); |
| 2555 | if (err) |
| 2556 | goto unlock; |
| 2557 | |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 2558 | /* Setup PTP Hardware Clock and timestamping */ |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 2559 | if (chip->info->ptp_support) { |
| 2560 | err = mv88e6xxx_ptp_setup(chip); |
| 2561 | if (err) |
| 2562 | goto unlock; |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 2563 | |
| 2564 | err = mv88e6xxx_hwtstamp_setup(chip); |
| 2565 | if (err) |
| 2566 | goto unlock; |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 2567 | } |
| 2568 | |
Vivien Didelot | 447b1bb | 2018-05-11 17:16:36 -0400 | [diff] [blame] | 2569 | err = mv88e6xxx_stats_setup(chip); |
| 2570 | if (err) |
| 2571 | goto unlock; |
| 2572 | |
Vivien Didelot | 6b17e86 | 2015-08-13 12:52:18 -0400 | [diff] [blame] | 2573 | unlock: |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2574 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | db687a5 | 2015-06-20 21:31:29 +0200 | [diff] [blame] | 2575 | |
Andrew Lunn | 48ace4e | 2016-04-14 23:47:12 +0200 | [diff] [blame] | 2576 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2577 | } |
| 2578 | |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2579 | static int mv88e6xxx_mdio_read(struct mii_bus *bus, int phy, int reg) |
Andrew Lunn | fd3a0ee | 2015-04-02 04:06:36 +0200 | [diff] [blame] | 2580 | { |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2581 | struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv; |
| 2582 | struct mv88e6xxx_chip *chip = mdio_bus->chip; |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2583 | u16 val; |
| 2584 | int err; |
Andrew Lunn | fd3a0ee | 2015-04-02 04:06:36 +0200 | [diff] [blame] | 2585 | |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 2586 | if (!chip->info->ops->phy_read) |
| 2587 | return -EOPNOTSUPP; |
| 2588 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2589 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 2590 | err = chip->info->ops->phy_read(chip, bus, phy, reg, &val); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2591 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2592 | |
Andrew Lunn | da9f330 | 2017-02-01 03:40:05 +0100 | [diff] [blame] | 2593 | if (reg == MII_PHYSID2) { |
Andrew Lunn | ddc49ac | 2018-11-12 18:51:01 +0100 | [diff] [blame] | 2594 | /* Some internal PHYs don't have a model number. */ |
| 2595 | if (chip->info->family != MV88E6XXX_FAMILY_6165) |
| 2596 | /* Then there is the 6165 family. It gets is |
| 2597 | * PHYs correct. But it can also have two |
| 2598 | * SERDES interfaces in the PHY address |
| 2599 | * space. And these don't have a model |
| 2600 | * number. But they are not PHYs, so we don't |
| 2601 | * want to give them something a PHY driver |
| 2602 | * will recognise. |
| 2603 | * |
| 2604 | * Use the mv88e6390 family model number |
| 2605 | * instead, for anything which really could be |
| 2606 | * a PHY, |
| 2607 | */ |
| 2608 | if (!(val & 0x3f0)) |
| 2609 | val |= MV88E6XXX_PORT_SWITCH_ID_PROD_6390 >> 4; |
Andrew Lunn | da9f330 | 2017-02-01 03:40:05 +0100 | [diff] [blame] | 2610 | } |
| 2611 | |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2612 | return err ? err : val; |
Andrew Lunn | fd3a0ee | 2015-04-02 04:06:36 +0200 | [diff] [blame] | 2613 | } |
| 2614 | |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2615 | static int mv88e6xxx_mdio_write(struct mii_bus *bus, int phy, int reg, u16 val) |
Andrew Lunn | fd3a0ee | 2015-04-02 04:06:36 +0200 | [diff] [blame] | 2616 | { |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2617 | struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv; |
| 2618 | struct mv88e6xxx_chip *chip = mdio_bus->chip; |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2619 | int err; |
Andrew Lunn | fd3a0ee | 2015-04-02 04:06:36 +0200 | [diff] [blame] | 2620 | |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 2621 | if (!chip->info->ops->phy_write) |
| 2622 | return -EOPNOTSUPP; |
| 2623 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2624 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 2625 | err = chip->info->ops->phy_write(chip, bus, phy, reg, val); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2626 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2627 | |
| 2628 | return err; |
Andrew Lunn | fd3a0ee | 2015-04-02 04:06:36 +0200 | [diff] [blame] | 2629 | } |
| 2630 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2631 | static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip, |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2632 | struct device_node *np, |
| 2633 | bool external) |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2634 | { |
| 2635 | static int index; |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2636 | struct mv88e6xxx_mdio_bus *mdio_bus; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2637 | struct mii_bus *bus; |
| 2638 | int err; |
| 2639 | |
Andrew Lunn | 2510bab | 2018-02-22 01:51:49 +0100 | [diff] [blame] | 2640 | if (external) { |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2641 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | 2510bab | 2018-02-22 01:51:49 +0100 | [diff] [blame] | 2642 | err = mv88e6xxx_g2_scratch_gpio_set_smi(chip, true); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2643 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 2510bab | 2018-02-22 01:51:49 +0100 | [diff] [blame] | 2644 | |
| 2645 | if (err) |
| 2646 | return err; |
| 2647 | } |
| 2648 | |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2649 | bus = devm_mdiobus_alloc_size(chip->dev, sizeof(*mdio_bus)); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2650 | if (!bus) |
| 2651 | return -ENOMEM; |
| 2652 | |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2653 | mdio_bus = bus->priv; |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2654 | mdio_bus->bus = bus; |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2655 | mdio_bus->chip = chip; |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2656 | INIT_LIST_HEAD(&mdio_bus->list); |
| 2657 | mdio_bus->external = external; |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2658 | |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2659 | if (np) { |
| 2660 | bus->name = np->full_name; |
Rob Herring | f7ce910 | 2017-07-18 16:43:19 -0500 | [diff] [blame] | 2661 | snprintf(bus->id, MII_BUS_ID_SIZE, "%pOF", np); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2662 | } else { |
| 2663 | bus->name = "mv88e6xxx SMI"; |
| 2664 | snprintf(bus->id, MII_BUS_ID_SIZE, "mv88e6xxx-%d", index++); |
| 2665 | } |
| 2666 | |
| 2667 | bus->read = mv88e6xxx_mdio_read; |
| 2668 | bus->write = mv88e6xxx_mdio_write; |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2669 | bus->parent = chip->dev; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2670 | |
Andrew Lunn | 6f88284 | 2018-03-17 20:32:05 +0100 | [diff] [blame] | 2671 | if (!external) { |
| 2672 | err = mv88e6xxx_g2_irq_mdio_setup(chip, bus); |
| 2673 | if (err) |
| 2674 | return err; |
| 2675 | } |
| 2676 | |
Florian Fainelli | 00e798c | 2018-05-15 16:56:19 -0700 | [diff] [blame] | 2677 | err = of_mdiobus_register(bus, np); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2678 | if (err) { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2679 | dev_err(chip->dev, "Cannot register MDIO bus (%d)\n", err); |
Andrew Lunn | 6f88284 | 2018-03-17 20:32:05 +0100 | [diff] [blame] | 2680 | mv88e6xxx_g2_irq_mdio_free(chip, bus); |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2681 | return err; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2682 | } |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2683 | |
| 2684 | if (external) |
| 2685 | list_add_tail(&mdio_bus->list, &chip->mdios); |
| 2686 | else |
| 2687 | list_add(&mdio_bus->list, &chip->mdios); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2688 | |
| 2689 | return 0; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2690 | } |
| 2691 | |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2692 | static const struct of_device_id mv88e6xxx_mdio_external_match[] = { |
| 2693 | { .compatible = "marvell,mv88e6xxx-mdio-external", |
| 2694 | .data = (void *)true }, |
| 2695 | { }, |
| 2696 | }; |
| 2697 | |
Andrew Lunn | 3126aee | 2017-12-07 01:05:57 +0100 | [diff] [blame] | 2698 | static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip) |
| 2699 | |
| 2700 | { |
| 2701 | struct mv88e6xxx_mdio_bus *mdio_bus; |
| 2702 | struct mii_bus *bus; |
| 2703 | |
| 2704 | list_for_each_entry(mdio_bus, &chip->mdios, list) { |
| 2705 | bus = mdio_bus->bus; |
| 2706 | |
Andrew Lunn | 6f88284 | 2018-03-17 20:32:05 +0100 | [diff] [blame] | 2707 | if (!mdio_bus->external) |
| 2708 | mv88e6xxx_g2_irq_mdio_free(chip, bus); |
| 2709 | |
Andrew Lunn | 3126aee | 2017-12-07 01:05:57 +0100 | [diff] [blame] | 2710 | mdiobus_unregister(bus); |
| 2711 | } |
| 2712 | } |
| 2713 | |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2714 | static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip, |
| 2715 | struct device_node *np) |
| 2716 | { |
| 2717 | const struct of_device_id *match; |
| 2718 | struct device_node *child; |
| 2719 | int err; |
| 2720 | |
| 2721 | /* Always register one mdio bus for the internal/default mdio |
| 2722 | * bus. This maybe represented in the device tree, but is |
| 2723 | * optional. |
| 2724 | */ |
| 2725 | child = of_get_child_by_name(np, "mdio"); |
| 2726 | err = mv88e6xxx_mdio_register(chip, child, false); |
| 2727 | if (err) |
| 2728 | return err; |
| 2729 | |
| 2730 | /* Walk the device tree, and see if there are any other nodes |
| 2731 | * which say they are compatible with the external mdio |
| 2732 | * bus. |
| 2733 | */ |
| 2734 | for_each_available_child_of_node(np, child) { |
| 2735 | match = of_match_node(mv88e6xxx_mdio_external_match, child); |
| 2736 | if (match) { |
| 2737 | err = mv88e6xxx_mdio_register(chip, child, true); |
Andrew Lunn | 3126aee | 2017-12-07 01:05:57 +0100 | [diff] [blame] | 2738 | if (err) { |
| 2739 | mv88e6xxx_mdios_unregister(chip); |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2740 | return err; |
Andrew Lunn | 3126aee | 2017-12-07 01:05:57 +0100 | [diff] [blame] | 2741 | } |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2742 | } |
| 2743 | } |
| 2744 | |
| 2745 | return 0; |
| 2746 | } |
| 2747 | |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2748 | static int mv88e6xxx_get_eeprom_len(struct dsa_switch *ds) |
| 2749 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2750 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2751 | |
| 2752 | return chip->eeprom_len; |
| 2753 | } |
| 2754 | |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2755 | static int mv88e6xxx_get_eeprom(struct dsa_switch *ds, |
| 2756 | struct ethtool_eeprom *eeprom, u8 *data) |
| 2757 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2758 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2759 | int err; |
| 2760 | |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 2761 | if (!chip->info->ops->get_eeprom) |
| 2762 | return -EOPNOTSUPP; |
| 2763 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2764 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 2765 | err = chip->info->ops->get_eeprom(chip, eeprom, data); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2766 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2767 | |
| 2768 | if (err) |
| 2769 | return err; |
| 2770 | |
| 2771 | eeprom->magic = 0xc3ec4951; |
| 2772 | |
| 2773 | return 0; |
| 2774 | } |
| 2775 | |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2776 | static int mv88e6xxx_set_eeprom(struct dsa_switch *ds, |
| 2777 | struct ethtool_eeprom *eeprom, u8 *data) |
| 2778 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2779 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2780 | int err; |
| 2781 | |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 2782 | if (!chip->info->ops->set_eeprom) |
| 2783 | return -EOPNOTSUPP; |
| 2784 | |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2785 | if (eeprom->magic != 0xc3ec4951) |
| 2786 | return -EINVAL; |
| 2787 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2788 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 2789 | err = chip->info->ops->set_eeprom(chip, eeprom, data); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2790 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2791 | |
| 2792 | return err; |
| 2793 | } |
| 2794 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2795 | static const struct mv88e6xxx_ops mv88e6085_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2796 | /* MV88E6XXX_FAMILY_6097 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2797 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2798 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2799 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2800 | .set_switch_mac = mv88e6xxx_g1_set_switch_mac, |
Vivien Didelot | 7e20cfb | 2017-05-26 18:03:06 -0400 | [diff] [blame] | 2801 | .phy_read = mv88e6185_phy_ppu_read, |
| 2802 | .phy_write = mv88e6185_phy_ppu_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2803 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2804 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2805 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2806 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2807 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2808 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2809 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2810 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2811 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2812 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2813 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2814 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2815 | .port_get_cmode = mv88e6185_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 2816 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2817 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2818 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2819 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2820 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2821 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2822 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2823 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2824 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2825 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 2826 | .ppu_enable = mv88e6185_g1_ppu_enable, |
| 2827 | .ppu_disable = mv88e6185_g1_ppu_disable, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2828 | .reset = mv88e6185_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 2829 | .rmu_disable = mv88e6085_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2830 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2831 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2832 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2833 | }; |
| 2834 | |
| 2835 | static const struct mv88e6xxx_ops mv88e6095_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2836 | /* MV88E6XXX_FAMILY_6095 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2837 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2838 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2839 | .set_switch_mac = mv88e6xxx_g1_set_switch_mac, |
Vivien Didelot | 7e20cfb | 2017-05-26 18:03:06 -0400 | [diff] [blame] | 2840 | .phy_read = mv88e6185_phy_ppu_read, |
| 2841 | .phy_write = mv88e6185_phy_ppu_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2842 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2843 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2844 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2845 | .port_set_frame_mode = mv88e6085_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2846 | .port_set_egress_floods = mv88e6185_port_set_egress_floods, |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2847 | .port_set_upstream_port = mv88e6095_port_set_upstream_port, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2848 | .port_link_state = mv88e6185_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2849 | .port_get_cmode = mv88e6185_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 2850 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2851 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2852 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2853 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2854 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2855 | .mgmt_rsvd2cpu = mv88e6185_g2_mgmt_rsvd2cpu, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 2856 | .ppu_enable = mv88e6185_g1_ppu_enable, |
| 2857 | .ppu_disable = mv88e6185_g1_ppu_disable, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2858 | .reset = mv88e6185_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2859 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2860 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2861 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2862 | }; |
| 2863 | |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2864 | static const struct mv88e6xxx_ops mv88e6097_ops = { |
Stefan Eichenberger | 15da3cc | 2016-11-25 09:41:30 +0100 | [diff] [blame] | 2865 | /* MV88E6XXX_FAMILY_6097 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2866 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2867 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2868 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2869 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 2870 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 2871 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 2872 | .port_set_link = mv88e6xxx_port_set_link, |
| 2873 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 2874 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2875 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2876 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2877 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2878 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2879 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2880 | .port_egress_rate_limiting = mv88e6095_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2881 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2882 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2883 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2884 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2885 | .port_get_cmode = mv88e6185_port_get_cmode, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2886 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2887 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2888 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2889 | .stats_get_strings = mv88e6095_stats_get_strings, |
| 2890 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2891 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2892 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Volodymyr Bendiuga | 91eaa47 | 2017-02-14 11:29:30 +0100 | [diff] [blame] | 2893 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2894 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2895 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2896 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 2897 | .rmu_disable = mv88e6085_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2898 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2899 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2900 | .phylink_validate = mv88e6185_phylink_validate, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2901 | }; |
| 2902 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2903 | static const struct mv88e6xxx_ops mv88e6123_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2904 | /* MV88E6XXX_FAMILY_6165 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2905 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2906 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2907 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2908 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Andrew Lunn | ec8378b | 2017-06-02 23:22:45 +0200 | [diff] [blame] | 2909 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 2910 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2911 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2912 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2913 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2914 | .port_set_frame_mode = mv88e6085_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2915 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2916 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2917 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2918 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2919 | .port_get_cmode = mv88e6185_port_get_cmode, |
Andrew Lunn | 0ac64c3 | 2017-06-02 23:22:46 +0200 | [diff] [blame] | 2920 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2921 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2922 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2923 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2924 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2925 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2926 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2927 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2928 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2929 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2930 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2931 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2932 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2933 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2934 | }; |
| 2935 | |
| 2936 | static const struct mv88e6xxx_ops mv88e6131_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2937 | /* MV88E6XXX_FAMILY_6185 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2938 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2939 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2940 | .set_switch_mac = mv88e6xxx_g1_set_switch_mac, |
Vivien Didelot | 7e20cfb | 2017-05-26 18:03:06 -0400 | [diff] [blame] | 2941 | .phy_read = mv88e6185_phy_ppu_read, |
| 2942 | .phy_write = mv88e6185_phy_ppu_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2943 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2944 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2945 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2946 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2947 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2948 | .port_set_egress_floods = mv88e6185_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2949 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2950 | .port_set_upstream_port = mv88e6095_port_set_upstream_port, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2951 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2952 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2953 | .port_pause_limit = mv88e6097_port_pause_limit, |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 2954 | .port_set_pause = mv88e6185_port_set_pause, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2955 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2956 | .port_get_cmode = mv88e6185_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 2957 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2958 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2959 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2960 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2961 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2962 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2963 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2964 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2965 | .mgmt_rsvd2cpu = mv88e6185_g2_mgmt_rsvd2cpu, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 2966 | .ppu_enable = mv88e6185_g1_ppu_enable, |
Vivien Didelot | 02317e6 | 2018-05-09 11:38:49 -0400 | [diff] [blame] | 2967 | .set_cascade_port = mv88e6185_g1_set_cascade_port, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 2968 | .ppu_disable = mv88e6185_g1_ppu_disable, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2969 | .reset = mv88e6185_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2970 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2971 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2972 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2973 | }; |
| 2974 | |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2975 | static const struct mv88e6xxx_ops mv88e6141_ops = { |
| 2976 | /* MV88E6XXX_FAMILY_6341 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2977 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2978 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2979 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2980 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 2981 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| 2982 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 2983 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 2984 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 2985 | .port_set_link = mv88e6xxx_port_set_link, |
| 2986 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 2987 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
Marek Behún | 2642234 | 2018-10-13 14:40:31 +0200 | [diff] [blame] | 2988 | .port_set_speed = mv88e6341_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 2989 | .port_max_speed_mode = mv88e6341_port_max_speed_mode, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2990 | .port_tag_remap = mv88e6095_port_tag_remap, |
| 2991 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
| 2992 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
| 2993 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2994 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2995 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2996 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2997 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
| 2998 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2999 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3000 | .port_get_cmode = mv88e6352_port_get_cmode, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 3001 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3002 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 3003 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3004 | .stats_get_strings = mv88e6320_stats_get_strings, |
| 3005 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3006 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3007 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 3008 | .watchdog_ops = &mv88e6390_watchdog_ops, |
| 3009 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3010 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 3011 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3012 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3013 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Andrew Lunn | 6751e7c | 2018-07-31 19:19:50 +0200 | [diff] [blame] | 3014 | .serdes_power = mv88e6341_serdes_power, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3015 | .gpio_ops = &mv88e6352_gpio_ops, |
Marek Behún | e3af71a | 2019-02-25 12:39:55 +0100 | [diff] [blame] | 3016 | .phylink_validate = mv88e6341_phylink_validate, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 3017 | }; |
| 3018 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3019 | static const struct mv88e6xxx_ops mv88e6161_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3020 | /* MV88E6XXX_FAMILY_6165 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3021 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3022 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3023 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3024 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Andrew Lunn | ec8378b | 2017-06-02 23:22:45 +0200 | [diff] [blame] | 3025 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3026 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3027 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3028 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3029 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3030 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3031 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3032 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3033 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3034 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3035 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3036 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3037 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3038 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3039 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3040 | .port_get_cmode = mv88e6185_port_get_cmode, |
Andrew Lunn | a6da21b | 2019-03-01 23:43:39 +0100 | [diff] [blame] | 3041 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3042 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3043 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3044 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3045 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3046 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3047 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3048 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3049 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3050 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3051 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3052 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3053 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Andrew Lunn | a469a61 | 2018-07-18 22:38:21 +0200 | [diff] [blame] | 3054 | .avb_ops = &mv88e6165_avb_ops, |
Andrew Lunn | dfa5434 | 2018-07-18 22:38:22 +0200 | [diff] [blame] | 3055 | .ptp_ops = &mv88e6165_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3056 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3057 | }; |
| 3058 | |
| 3059 | static const struct mv88e6xxx_ops mv88e6165_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3060 | /* MV88E6XXX_FAMILY_6165 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3061 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3062 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3063 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3064 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Andrew Lunn | efb3e74 | 2017-01-24 14:53:47 +0100 | [diff] [blame] | 3065 | .phy_read = mv88e6165_phy_read, |
| 3066 | .phy_write = mv88e6165_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3067 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3068 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3069 | .port_set_speed = mv88e6185_port_set_speed, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3070 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3071 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3072 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3073 | .port_get_cmode = mv88e6185_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3074 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3075 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3076 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3077 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3078 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3079 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3080 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3081 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3082 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3083 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3084 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3085 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3086 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Andrew Lunn | a469a61 | 2018-07-18 22:38:21 +0200 | [diff] [blame] | 3087 | .avb_ops = &mv88e6165_avb_ops, |
Andrew Lunn | dfa5434 | 2018-07-18 22:38:22 +0200 | [diff] [blame] | 3088 | .ptp_ops = &mv88e6165_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3089 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3090 | }; |
| 3091 | |
| 3092 | static const struct mv88e6xxx_ops mv88e6171_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3093 | /* MV88E6XXX_FAMILY_6351 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3094 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3095 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3096 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3097 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3098 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3099 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3100 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3101 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Andrew Lunn | 94d66ae | 2016-11-10 15:44:01 +0100 | [diff] [blame] | 3102 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3103 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3104 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3105 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3106 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3107 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3108 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3109 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3110 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3111 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3112 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3113 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3114 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3115 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3116 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3117 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3118 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3119 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3120 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3121 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3122 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3123 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3124 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3125 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3126 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3127 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3128 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3129 | }; |
| 3130 | |
| 3131 | static const struct mv88e6xxx_ops mv88e6172_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3132 | /* MV88E6XXX_FAMILY_6352 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3133 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3134 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3135 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3136 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3137 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3138 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3139 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3140 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3141 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3142 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | a0a0f62 | 2016-11-04 03:23:34 +0100 | [diff] [blame] | 3143 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3144 | .port_set_speed = mv88e6352_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3145 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3146 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3147 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3148 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3149 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3150 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3151 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3152 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3153 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3154 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3155 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3156 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3157 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3158 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3159 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3160 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3161 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3162 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3163 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3164 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3165 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3166 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3167 | .rmu_disable = mv88e6352_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3168 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3169 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 3170 | .serdes_power = mv88e6352_serdes_power, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3171 | .gpio_ops = &mv88e6352_gpio_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3172 | .phylink_validate = mv88e6352_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3173 | }; |
| 3174 | |
| 3175 | static const struct mv88e6xxx_ops mv88e6175_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3176 | /* MV88E6XXX_FAMILY_6351 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3177 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3178 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3179 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3180 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3181 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3182 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3183 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3184 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Andrew Lunn | 94d66ae | 2016-11-10 15:44:01 +0100 | [diff] [blame] | 3185 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3186 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3187 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3188 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3189 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3190 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3191 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3192 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3193 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3194 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3195 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3196 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3197 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3198 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3199 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3200 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3201 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3202 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3203 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3204 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3205 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3206 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3207 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3208 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3209 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3210 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3211 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3212 | }; |
| 3213 | |
| 3214 | static const struct mv88e6xxx_ops mv88e6176_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3215 | /* MV88E6XXX_FAMILY_6352 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3216 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3217 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3218 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3219 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3220 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3221 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3222 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3223 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3224 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3225 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | a0a0f62 | 2016-11-04 03:23:34 +0100 | [diff] [blame] | 3226 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3227 | .port_set_speed = mv88e6352_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3228 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3229 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3230 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3231 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3232 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3233 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3234 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3235 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3236 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3237 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3238 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3239 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3240 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3241 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3242 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3243 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3244 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3245 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3246 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3247 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3248 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3249 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3250 | .rmu_disable = mv88e6352_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3251 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3252 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 3253 | .serdes_power = mv88e6352_serdes_power, |
Andrew Lunn | 4382172 | 2018-09-02 18:13:15 +0200 | [diff] [blame] | 3254 | .serdes_irq_setup = mv88e6352_serdes_irq_setup, |
| 3255 | .serdes_irq_free = mv88e6352_serdes_irq_free, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3256 | .gpio_ops = &mv88e6352_gpio_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3257 | .phylink_validate = mv88e6352_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3258 | }; |
| 3259 | |
| 3260 | static const struct mv88e6xxx_ops mv88e6185_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3261 | /* MV88E6XXX_FAMILY_6185 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3262 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3263 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3264 | .set_switch_mac = mv88e6xxx_g1_set_switch_mac, |
Vivien Didelot | 7e20cfb | 2017-05-26 18:03:06 -0400 | [diff] [blame] | 3265 | .phy_read = mv88e6185_phy_ppu_read, |
| 3266 | .phy_write = mv88e6185_phy_ppu_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3267 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3268 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3269 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3270 | .port_set_frame_mode = mv88e6085_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3271 | .port_set_egress_floods = mv88e6185_port_set_egress_floods, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3272 | .port_egress_rate_limiting = mv88e6095_port_egress_rate_limiting, |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 3273 | .port_set_upstream_port = mv88e6095_port_set_upstream_port, |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 3274 | .port_set_pause = mv88e6185_port_set_pause, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3275 | .port_link_state = mv88e6185_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3276 | .port_get_cmode = mv88e6185_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3277 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3278 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3279 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3280 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3281 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3282 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3283 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3284 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3285 | .mgmt_rsvd2cpu = mv88e6185_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 02317e6 | 2018-05-09 11:38:49 -0400 | [diff] [blame] | 3286 | .set_cascade_port = mv88e6185_g1_set_cascade_port, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 3287 | .ppu_enable = mv88e6185_g1_ppu_enable, |
| 3288 | .ppu_disable = mv88e6185_g1_ppu_disable, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3289 | .reset = mv88e6185_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3290 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3291 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3292 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3293 | }; |
| 3294 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3295 | static const struct mv88e6xxx_ops mv88e6190_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3296 | /* MV88E6XXX_FAMILY_6390 */ |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 3297 | .setup_errata = mv88e6390_setup_errata, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3298 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3299 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3300 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3301 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3302 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3303 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3304 | .port_set_link = mv88e6xxx_port_set_link, |
| 3305 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3306 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3307 | .port_set_speed = mv88e6390_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 3308 | .port_max_speed_mode = mv88e6390_port_max_speed_mode, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3309 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3310 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3311 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3312 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3313 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3314 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3315 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3316 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3317 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | fdc71ee | 2018-11-11 00:32:15 +0100 | [diff] [blame] | 3318 | .port_set_cmode = mv88e6390_port_set_cmode, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3319 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3320 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3321 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3322 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3323 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3324 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3325 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3326 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3327 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3328 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3329 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3330 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3331 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3332 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 6335e9f | 2017-05-26 01:03:23 +0200 | [diff] [blame] | 3333 | .serdes_power = mv88e6390_serdes_power, |
Andrew Lunn | efd1ba6 | 2018-08-09 15:38:48 +0200 | [diff] [blame] | 3334 | .serdes_irq_setup = mv88e6390_serdes_irq_setup, |
| 3335 | .serdes_irq_free = mv88e6390_serdes_irq_free, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3336 | .gpio_ops = &mv88e6352_gpio_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3337 | .phylink_validate = mv88e6390_phylink_validate, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3338 | }; |
| 3339 | |
| 3340 | static const struct mv88e6xxx_ops mv88e6190x_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3341 | /* MV88E6XXX_FAMILY_6390 */ |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 3342 | .setup_errata = mv88e6390_setup_errata, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3343 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3344 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3345 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3346 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3347 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3348 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3349 | .port_set_link = mv88e6xxx_port_set_link, |
| 3350 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3351 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3352 | .port_set_speed = mv88e6390x_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 3353 | .port_max_speed_mode = mv88e6390x_port_max_speed_mode, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3354 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3355 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3356 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3357 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3358 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3359 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3360 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3361 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3362 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | fdc71ee | 2018-11-11 00:32:15 +0100 | [diff] [blame] | 3363 | .port_set_cmode = mv88e6390x_port_set_cmode, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3364 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3365 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3366 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3367 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3368 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3369 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3370 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3371 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3372 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3373 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3374 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3375 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3376 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3377 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 07ffbd7 | 2018-08-09 15:38:41 +0200 | [diff] [blame] | 3378 | .serdes_power = mv88e6390x_serdes_power, |
Andrew Lunn | 2defda1 | 2018-11-11 00:32:17 +0100 | [diff] [blame] | 3379 | .serdes_irq_setup = mv88e6390x_serdes_irq_setup, |
| 3380 | .serdes_irq_free = mv88e6390x_serdes_irq_free, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3381 | .gpio_ops = &mv88e6352_gpio_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3382 | .phylink_validate = mv88e6390x_phylink_validate, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3383 | }; |
| 3384 | |
| 3385 | static const struct mv88e6xxx_ops mv88e6191_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3386 | /* MV88E6XXX_FAMILY_6390 */ |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 3387 | .setup_errata = mv88e6390_setup_errata, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3388 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3389 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3390 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3391 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3392 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3393 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3394 | .port_set_link = mv88e6xxx_port_set_link, |
| 3395 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3396 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3397 | .port_set_speed = mv88e6390_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 3398 | .port_max_speed_mode = mv88e6390_port_max_speed_mode, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3399 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3400 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3401 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3402 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3403 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3404 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3405 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3406 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3407 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | fdc71ee | 2018-11-11 00:32:15 +0100 | [diff] [blame] | 3408 | .port_set_cmode = mv88e6390_port_set_cmode, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3409 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3410 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3411 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3412 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3413 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3414 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3415 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3416 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3417 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3418 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3419 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3420 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3421 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3422 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 6335e9f | 2017-05-26 01:03:23 +0200 | [diff] [blame] | 3423 | .serdes_power = mv88e6390_serdes_power, |
Andrew Lunn | efd1ba6 | 2018-08-09 15:38:48 +0200 | [diff] [blame] | 3424 | .serdes_irq_setup = mv88e6390_serdes_irq_setup, |
| 3425 | .serdes_irq_free = mv88e6390_serdes_irq_free, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3426 | .avb_ops = &mv88e6390_avb_ops, |
| 3427 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3428 | .phylink_validate = mv88e6390_phylink_validate, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3429 | }; |
| 3430 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3431 | static const struct mv88e6xxx_ops mv88e6240_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3432 | /* MV88E6XXX_FAMILY_6352 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3433 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3434 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3435 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3436 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3437 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3438 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3439 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3440 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3441 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3442 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | a0a0f62 | 2016-11-04 03:23:34 +0100 | [diff] [blame] | 3443 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3444 | .port_set_speed = mv88e6352_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3445 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3446 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3447 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3448 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3449 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3450 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3451 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3452 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3453 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3454 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3455 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3456 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3457 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3458 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3459 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3460 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3461 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3462 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3463 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3464 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3465 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3466 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3467 | .rmu_disable = mv88e6352_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3468 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3469 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 3470 | .serdes_power = mv88e6352_serdes_power, |
Andrew Lunn | 4382172 | 2018-09-02 18:13:15 +0200 | [diff] [blame] | 3471 | .serdes_irq_setup = mv88e6352_serdes_irq_setup, |
| 3472 | .serdes_irq_free = mv88e6352_serdes_irq_free, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3473 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3474 | .avb_ops = &mv88e6352_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3475 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3476 | .phylink_validate = mv88e6352_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3477 | }; |
| 3478 | |
Rasmus Villemoes | 1f71836 | 2019-06-04 07:34:32 +0000 | [diff] [blame] | 3479 | static const struct mv88e6xxx_ops mv88e6250_ops = { |
| 3480 | /* MV88E6XXX_FAMILY_6250 */ |
| 3481 | .ieee_pri_map = mv88e6250_g1_ieee_pri_map, |
| 3482 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
| 3483 | .irl_init_all = mv88e6352_g2_irl_init_all, |
| 3484 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3485 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
| 3486 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3487 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3488 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3489 | .port_set_link = mv88e6xxx_port_set_link, |
| 3490 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3491 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
| 3492 | .port_set_speed = mv88e6250_port_set_speed, |
| 3493 | .port_tag_remap = mv88e6095_port_tag_remap, |
| 3494 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
| 3495 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
| 3496 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
| 3497 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
| 3498 | .port_pause_limit = mv88e6097_port_pause_limit, |
| 3499 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
| 3500 | .port_link_state = mv88e6250_port_link_state, |
| 3501 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
| 3502 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
| 3503 | .stats_get_sset_count = mv88e6250_stats_get_sset_count, |
| 3504 | .stats_get_strings = mv88e6250_stats_get_strings, |
| 3505 | .stats_get_stats = mv88e6250_stats_get_stats, |
| 3506 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3507 | .set_egress_port = mv88e6095_g1_set_egress_port, |
| 3508 | .watchdog_ops = &mv88e6250_watchdog_ops, |
| 3509 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
| 3510 | .pot_clear = mv88e6xxx_g2_pot_clear, |
| 3511 | .reset = mv88e6250_g1_reset, |
| 3512 | .vtu_getnext = mv88e6250_g1_vtu_getnext, |
| 3513 | .vtu_loadpurge = mv88e6250_g1_vtu_loadpurge, |
| 3514 | .phylink_validate = mv88e6065_phylink_validate, |
| 3515 | }; |
| 3516 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3517 | static const struct mv88e6xxx_ops mv88e6290_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3518 | /* MV88E6XXX_FAMILY_6390 */ |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 3519 | .setup_errata = mv88e6390_setup_errata, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3520 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3521 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3522 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3523 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3524 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3525 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3526 | .port_set_link = mv88e6xxx_port_set_link, |
| 3527 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3528 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3529 | .port_set_speed = mv88e6390_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 3530 | .port_max_speed_mode = mv88e6390_port_max_speed_mode, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3531 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3532 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3533 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3534 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3535 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3536 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3537 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3538 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3539 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | fdc71ee | 2018-11-11 00:32:15 +0100 | [diff] [blame] | 3540 | .port_set_cmode = mv88e6390_port_set_cmode, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3541 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3542 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3543 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3544 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3545 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3546 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3547 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3548 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3549 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3550 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3551 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3552 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3553 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3554 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 6335e9f | 2017-05-26 01:03:23 +0200 | [diff] [blame] | 3555 | .serdes_power = mv88e6390_serdes_power, |
Andrew Lunn | efd1ba6 | 2018-08-09 15:38:48 +0200 | [diff] [blame] | 3556 | .serdes_irq_setup = mv88e6390_serdes_irq_setup, |
| 3557 | .serdes_irq_free = mv88e6390_serdes_irq_free, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3558 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3559 | .avb_ops = &mv88e6390_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3560 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3561 | .phylink_validate = mv88e6390_phylink_validate, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3562 | }; |
| 3563 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3564 | static const struct mv88e6xxx_ops mv88e6320_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3565 | /* MV88E6XXX_FAMILY_6320 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3566 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3567 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3568 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3569 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3570 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3571 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3572 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3573 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3574 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3575 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3576 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3577 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3578 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3579 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3580 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3581 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3582 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3583 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3584 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3585 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3586 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3587 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3588 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3589 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3590 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3591 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3592 | .stats_get_stats = mv88e6320_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3593 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3594 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | 9c7f37e | 2018-12-19 18:28:54 +0100 | [diff] [blame] | 3595 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3596 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3597 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3598 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3599 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3600 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3601 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3602 | .avb_ops = &mv88e6352_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3603 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3604 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3605 | }; |
| 3606 | |
| 3607 | static const struct mv88e6xxx_ops mv88e6321_ops = { |
Vivien Didelot | bd80720 | 2017-07-17 13:03:37 -0400 | [diff] [blame] | 3608 | /* MV88E6XXX_FAMILY_6320 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3609 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3610 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3611 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3612 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3613 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3614 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3615 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3616 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3617 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3618 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3619 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3620 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3621 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3622 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3623 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3624 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3625 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3626 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3627 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3628 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3629 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3630 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3631 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3632 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3633 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3634 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3635 | .stats_get_stats = mv88e6320_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3636 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3637 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | 9c7f37e | 2018-12-19 18:28:54 +0100 | [diff] [blame] | 3638 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3639 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3640 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3641 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3642 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3643 | .avb_ops = &mv88e6352_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3644 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3645 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3646 | }; |
| 3647 | |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3648 | static const struct mv88e6xxx_ops mv88e6341_ops = { |
| 3649 | /* MV88E6XXX_FAMILY_6341 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3650 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3651 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3652 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3653 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3654 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| 3655 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3656 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3657 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3658 | .port_set_link = mv88e6xxx_port_set_link, |
| 3659 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3660 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
Marek Behún | 2642234 | 2018-10-13 14:40:31 +0200 | [diff] [blame] | 3661 | .port_set_speed = mv88e6341_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 3662 | .port_max_speed_mode = mv88e6341_port_max_speed_mode, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3663 | .port_tag_remap = mv88e6095_port_tag_remap, |
| 3664 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
| 3665 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
| 3666 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3667 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3668 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3669 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3670 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
| 3671 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3672 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3673 | .port_get_cmode = mv88e6352_port_get_cmode, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3674 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3675 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3676 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3677 | .stats_get_strings = mv88e6320_stats_get_strings, |
| 3678 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3679 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3680 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3681 | .watchdog_ops = &mv88e6390_watchdog_ops, |
| 3682 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3683 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3684 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3685 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3686 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Andrew Lunn | 6751e7c | 2018-07-31 19:19:50 +0200 | [diff] [blame] | 3687 | .serdes_power = mv88e6341_serdes_power, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3688 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3689 | .avb_ops = &mv88e6390_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3690 | .ptp_ops = &mv88e6352_ptp_ops, |
Marek Behún | e3af71a | 2019-02-25 12:39:55 +0100 | [diff] [blame] | 3691 | .phylink_validate = mv88e6341_phylink_validate, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3692 | }; |
| 3693 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3694 | static const struct mv88e6xxx_ops mv88e6350_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3695 | /* MV88E6XXX_FAMILY_6351 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3696 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3697 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3698 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3699 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3700 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3701 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3702 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3703 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Andrew Lunn | 94d66ae | 2016-11-10 15:44:01 +0100 | [diff] [blame] | 3704 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3705 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3706 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3707 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3708 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3709 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3710 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3711 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3712 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3713 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3714 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3715 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3716 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3717 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3718 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3719 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3720 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3721 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3722 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3723 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3724 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3725 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3726 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3727 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3728 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3729 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3730 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3731 | }; |
| 3732 | |
| 3733 | static const struct mv88e6xxx_ops mv88e6351_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3734 | /* MV88E6XXX_FAMILY_6351 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3735 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3736 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3737 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3738 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3739 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3740 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3741 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3742 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Andrew Lunn | 94d66ae | 2016-11-10 15:44:01 +0100 | [diff] [blame] | 3743 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3744 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3745 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3746 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3747 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3748 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3749 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3750 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3751 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3752 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3753 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3754 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3755 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3756 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3757 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3758 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3759 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3760 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3761 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3762 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3763 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3764 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3765 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3766 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3767 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3768 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3769 | .avb_ops = &mv88e6352_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3770 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3771 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3772 | }; |
| 3773 | |
| 3774 | static const struct mv88e6xxx_ops mv88e6352_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3775 | /* MV88E6XXX_FAMILY_6352 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3776 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3777 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3778 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3779 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3780 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3781 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3782 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3783 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3784 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3785 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | a0a0f62 | 2016-11-04 03:23:34 +0100 | [diff] [blame] | 3786 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3787 | .port_set_speed = mv88e6352_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3788 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3789 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3790 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3791 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3792 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3793 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3794 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3795 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3796 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3797 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3798 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3799 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3800 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3801 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3802 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3803 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3804 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3805 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3806 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3807 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3808 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3809 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3810 | .rmu_disable = mv88e6352_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3811 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3812 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 3813 | .serdes_power = mv88e6352_serdes_power, |
Andrew Lunn | 4382172 | 2018-09-02 18:13:15 +0200 | [diff] [blame] | 3814 | .serdes_irq_setup = mv88e6352_serdes_irq_setup, |
| 3815 | .serdes_irq_free = mv88e6352_serdes_irq_free, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3816 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3817 | .avb_ops = &mv88e6352_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3818 | .ptp_ops = &mv88e6352_ptp_ops, |
Andrew Lunn | cda9f4a | 2018-03-01 02:02:31 +0100 | [diff] [blame] | 3819 | .serdes_get_sset_count = mv88e6352_serdes_get_sset_count, |
| 3820 | .serdes_get_strings = mv88e6352_serdes_get_strings, |
| 3821 | .serdes_get_stats = mv88e6352_serdes_get_stats, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3822 | .phylink_validate = mv88e6352_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3823 | }; |
| 3824 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3825 | static const struct mv88e6xxx_ops mv88e6390_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3826 | /* MV88E6XXX_FAMILY_6390 */ |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 3827 | .setup_errata = mv88e6390_setup_errata, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3828 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3829 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3830 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3831 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3832 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3833 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3834 | .port_set_link = mv88e6xxx_port_set_link, |
| 3835 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3836 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3837 | .port_set_speed = mv88e6390_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 3838 | .port_max_speed_mode = mv88e6390_port_max_speed_mode, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3839 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3840 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3841 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3842 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3843 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3844 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3845 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3846 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3847 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3848 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3849 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | fdc71ee | 2018-11-11 00:32:15 +0100 | [diff] [blame] | 3850 | .port_set_cmode = mv88e6390_port_set_cmode, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3851 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3852 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3853 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3854 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3855 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3856 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3857 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3858 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3859 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3860 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3861 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3862 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3863 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3864 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 6335e9f | 2017-05-26 01:03:23 +0200 | [diff] [blame] | 3865 | .serdes_power = mv88e6390_serdes_power, |
Andrew Lunn | efd1ba6 | 2018-08-09 15:38:48 +0200 | [diff] [blame] | 3866 | .serdes_irq_setup = mv88e6390_serdes_irq_setup, |
| 3867 | .serdes_irq_free = mv88e6390_serdes_irq_free, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3868 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3869 | .avb_ops = &mv88e6390_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3870 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3871 | .phylink_validate = mv88e6390_phylink_validate, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3872 | }; |
| 3873 | |
| 3874 | static const struct mv88e6xxx_ops mv88e6390x_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3875 | /* MV88E6XXX_FAMILY_6390 */ |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 3876 | .setup_errata = mv88e6390_setup_errata, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3877 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3878 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3879 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3880 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3881 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3882 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3883 | .port_set_link = mv88e6xxx_port_set_link, |
| 3884 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3885 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3886 | .port_set_speed = mv88e6390x_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 3887 | .port_max_speed_mode = mv88e6390x_port_max_speed_mode, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3888 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3889 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3890 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3891 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3892 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3893 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3894 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3895 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3896 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3897 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3898 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | b3dce4d | 2018-11-11 00:32:14 +0100 | [diff] [blame] | 3899 | .port_set_cmode = mv88e6390x_port_set_cmode, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3900 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3901 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3902 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3903 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3904 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3905 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3906 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3907 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3908 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3909 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3910 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3911 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3912 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3913 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 07ffbd7 | 2018-08-09 15:38:41 +0200 | [diff] [blame] | 3914 | .serdes_power = mv88e6390x_serdes_power, |
Andrew Lunn | 2defda1 | 2018-11-11 00:32:17 +0100 | [diff] [blame] | 3915 | .serdes_irq_setup = mv88e6390x_serdes_irq_setup, |
| 3916 | .serdes_irq_free = mv88e6390x_serdes_irq_free, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3917 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3918 | .avb_ops = &mv88e6390_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3919 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3920 | .phylink_validate = mv88e6390x_phylink_validate, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3921 | }; |
| 3922 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3923 | static const struct mv88e6xxx_info mv88e6xxx_table[] = { |
| 3924 | [MV88E6085] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3925 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6085, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3926 | .family = MV88E6XXX_FAMILY_6097, |
| 3927 | .name = "Marvell 88E6085", |
| 3928 | .num_databases = 4096, |
| 3929 | .num_ports = 10, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3930 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3931 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3932 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3933 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3934 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3935 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3936 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3937 | .g1_irqs = 8, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3938 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3939 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3940 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3941 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3942 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3943 | .ops = &mv88e6085_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3944 | }, |
| 3945 | |
| 3946 | [MV88E6095] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3947 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6095, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3948 | .family = MV88E6XXX_FAMILY_6095, |
| 3949 | .name = "Marvell 88E6095/88E6095F", |
| 3950 | .num_databases = 256, |
| 3951 | .num_ports = 11, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3952 | .num_internal_phys = 0, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3953 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3954 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3955 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3956 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3957 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3958 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3959 | .g1_irqs = 8, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3960 | .atu_move_port_mask = 0xf, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3961 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3962 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3963 | .ops = &mv88e6095_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3964 | }, |
| 3965 | |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 3966 | [MV88E6097] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3967 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6097, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 3968 | .family = MV88E6XXX_FAMILY_6097, |
| 3969 | .name = "Marvell 88E6097/88E6097F", |
| 3970 | .num_databases = 4096, |
| 3971 | .num_ports = 11, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3972 | .num_internal_phys = 8, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3973 | .max_vid = 4095, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 3974 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3975 | .phy_base_addr = 0x0, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 3976 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3977 | .global2_addr = 0x1c, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 3978 | .age_time_coeff = 15000, |
Stefan Eichenberger | c534178 | 2016-11-25 09:41:29 +0100 | [diff] [blame] | 3979 | .g1_irqs = 8, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3980 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3981 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3982 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3983 | .multi_chip = true, |
Stefan Eichenberger | 2bfcfcd | 2016-12-05 14:12:42 +0100 | [diff] [blame] | 3984 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 3985 | .ops = &mv88e6097_ops, |
| 3986 | }, |
| 3987 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3988 | [MV88E6123] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3989 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6123, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3990 | .family = MV88E6XXX_FAMILY_6165, |
| 3991 | .name = "Marvell 88E6123", |
| 3992 | .num_databases = 4096, |
| 3993 | .num_ports = 3, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3994 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3995 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3996 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3997 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3998 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3999 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4000 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4001 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4002 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4003 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4004 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4005 | .multi_chip = true, |
Andrew Lunn | 5ebe31d | 2017-06-07 15:06:19 +0200 | [diff] [blame] | 4006 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4007 | .ops = &mv88e6123_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4008 | }, |
| 4009 | |
| 4010 | [MV88E6131] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4011 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6131, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4012 | .family = MV88E6XXX_FAMILY_6185, |
| 4013 | .name = "Marvell 88E6131", |
| 4014 | .num_databases = 256, |
| 4015 | .num_ports = 8, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4016 | .num_internal_phys = 0, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4017 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4018 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4019 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4020 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4021 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4022 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4023 | .g1_irqs = 9, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4024 | .atu_move_port_mask = 0xf, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4025 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4026 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4027 | .ops = &mv88e6131_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4028 | }, |
| 4029 | |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4030 | [MV88E6141] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4031 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6141, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4032 | .family = MV88E6XXX_FAMILY_6341, |
Uwe Kleine-König | 79a68b2 | 2018-03-20 10:44:40 +0100 | [diff] [blame] | 4033 | .name = "Marvell 88E6141", |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4034 | .num_databases = 4096, |
| 4035 | .num_ports = 6, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4036 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4037 | .num_gpio = 11, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4038 | .max_vid = 4095, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4039 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4040 | .phy_base_addr = 0x10, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4041 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4042 | .global2_addr = 0x1c, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4043 | .age_time_coeff = 3750, |
| 4044 | .atu_move_port_mask = 0x1f, |
Andrew Lunn | adfccf1 | 2018-03-17 20:32:03 +0100 | [diff] [blame] | 4045 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4046 | .g2_irqs = 10, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4047 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4048 | .multi_chip = true, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4049 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4050 | .ops = &mv88e6141_ops, |
| 4051 | }, |
| 4052 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4053 | [MV88E6161] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4054 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6161, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4055 | .family = MV88E6XXX_FAMILY_6165, |
| 4056 | .name = "Marvell 88E6161", |
| 4057 | .num_databases = 4096, |
| 4058 | .num_ports = 6, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4059 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4060 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4061 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4062 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4063 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4064 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4065 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4066 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4067 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4068 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4069 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4070 | .multi_chip = true, |
Andrew Lunn | 5ebe31d | 2017-06-07 15:06:19 +0200 | [diff] [blame] | 4071 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Andrew Lunn | dfa5434 | 2018-07-18 22:38:22 +0200 | [diff] [blame] | 4072 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4073 | .ops = &mv88e6161_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4074 | }, |
| 4075 | |
| 4076 | [MV88E6165] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4077 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6165, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4078 | .family = MV88E6XXX_FAMILY_6165, |
| 4079 | .name = "Marvell 88E6165", |
| 4080 | .num_databases = 4096, |
| 4081 | .num_ports = 6, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4082 | .num_internal_phys = 0, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4083 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4084 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4085 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4086 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4087 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4088 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4089 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4090 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4091 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4092 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4093 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4094 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Andrew Lunn | dfa5434 | 2018-07-18 22:38:22 +0200 | [diff] [blame] | 4095 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4096 | .ops = &mv88e6165_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4097 | }, |
| 4098 | |
| 4099 | [MV88E6171] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4100 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6171, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4101 | .family = MV88E6XXX_FAMILY_6351, |
| 4102 | .name = "Marvell 88E6171", |
| 4103 | .num_databases = 4096, |
| 4104 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4105 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4106 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4107 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4108 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4109 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4110 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4111 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4112 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4113 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4114 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4115 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4116 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4117 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4118 | .ops = &mv88e6171_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4119 | }, |
| 4120 | |
| 4121 | [MV88E6172] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4122 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6172, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4123 | .family = MV88E6XXX_FAMILY_6352, |
| 4124 | .name = "Marvell 88E6172", |
| 4125 | .num_databases = 4096, |
| 4126 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4127 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4128 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4129 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4130 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4131 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4132 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4133 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4134 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4135 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4136 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4137 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4138 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4139 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4140 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4141 | .ops = &mv88e6172_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4142 | }, |
| 4143 | |
| 4144 | [MV88E6175] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4145 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6175, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4146 | .family = MV88E6XXX_FAMILY_6351, |
| 4147 | .name = "Marvell 88E6175", |
| 4148 | .num_databases = 4096, |
| 4149 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4150 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4151 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4152 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4153 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4154 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4155 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4156 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4157 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4158 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4159 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4160 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4161 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4162 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4163 | .ops = &mv88e6175_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4164 | }, |
| 4165 | |
| 4166 | [MV88E6176] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4167 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6176, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4168 | .family = MV88E6XXX_FAMILY_6352, |
| 4169 | .name = "Marvell 88E6176", |
| 4170 | .num_databases = 4096, |
| 4171 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4172 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4173 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4174 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4175 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4176 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4177 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4178 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4179 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4180 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4181 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4182 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4183 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4184 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4185 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4186 | .ops = &mv88e6176_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4187 | }, |
| 4188 | |
| 4189 | [MV88E6185] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4190 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6185, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4191 | .family = MV88E6XXX_FAMILY_6185, |
| 4192 | .name = "Marvell 88E6185", |
| 4193 | .num_databases = 256, |
| 4194 | .num_ports = 10, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4195 | .num_internal_phys = 0, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4196 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4197 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4198 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4199 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4200 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4201 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4202 | .g1_irqs = 8, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4203 | .atu_move_port_mask = 0xf, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4204 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4205 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4206 | .ops = &mv88e6185_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4207 | }, |
| 4208 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4209 | [MV88E6190] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4210 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6190, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4211 | .family = MV88E6XXX_FAMILY_6390, |
| 4212 | .name = "Marvell 88E6190", |
| 4213 | .num_databases = 4096, |
| 4214 | .num_ports = 11, /* 10 + Z80 */ |
Heiner Kallweit | 95150f2 | 2019-03-02 10:06:05 +0100 | [diff] [blame] | 4215 | .num_internal_phys = 9, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4216 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 4217 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4218 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4219 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4220 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4221 | .global2_addr = 0x1c, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4222 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 4223 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4224 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4225 | .g2_irqs = 14, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4226 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4227 | .multi_chip = true, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4228 | .atu_move_port_mask = 0x1f, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4229 | .ops = &mv88e6190_ops, |
| 4230 | }, |
| 4231 | |
| 4232 | [MV88E6190X] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4233 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6190X, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4234 | .family = MV88E6XXX_FAMILY_6390, |
| 4235 | .name = "Marvell 88E6190X", |
| 4236 | .num_databases = 4096, |
| 4237 | .num_ports = 11, /* 10 + Z80 */ |
Heiner Kallweit | 95150f2 | 2019-03-02 10:06:05 +0100 | [diff] [blame] | 4238 | .num_internal_phys = 9, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4239 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 4240 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4241 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4242 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4243 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4244 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 4245 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4246 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4247 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4248 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4249 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4250 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4251 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4252 | .ops = &mv88e6190x_ops, |
| 4253 | }, |
| 4254 | |
| 4255 | [MV88E6191] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4256 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4257 | .family = MV88E6XXX_FAMILY_6390, |
| 4258 | .name = "Marvell 88E6191", |
| 4259 | .num_databases = 4096, |
| 4260 | .num_ports = 11, /* 10 + Z80 */ |
Heiner Kallweit | 95150f2 | 2019-03-02 10:06:05 +0100 | [diff] [blame] | 4261 | .num_internal_phys = 9, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 4262 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4263 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4264 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4265 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4266 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 4267 | .age_time_coeff = 3750, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4268 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4269 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4270 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4271 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4272 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4273 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4274 | .ptp_support = true, |
Vivien Didelot | 2cf4cefb | 2017-03-28 13:50:34 -0400 | [diff] [blame] | 4275 | .ops = &mv88e6191_ops, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4276 | }, |
| 4277 | |
Hubert Feurstein | 4902264 | 2019-07-31 10:23:46 +0200 | [diff] [blame^] | 4278 | [MV88E6220] = { |
| 4279 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6220, |
| 4280 | .family = MV88E6XXX_FAMILY_6250, |
| 4281 | .name = "Marvell 88E6220", |
| 4282 | .num_databases = 64, |
| 4283 | |
| 4284 | /* Ports 2-4 are not routed to pins |
| 4285 | * => usable ports 0, 1, 5, 6 |
| 4286 | */ |
| 4287 | .num_ports = 7, |
| 4288 | .num_internal_phys = 2, |
| 4289 | .max_vid = 4095, |
| 4290 | .port_base_addr = 0x08, |
| 4291 | .phy_base_addr = 0x00, |
| 4292 | .global1_addr = 0x0f, |
| 4293 | .global2_addr = 0x07, |
| 4294 | .age_time_coeff = 15000, |
| 4295 | .g1_irqs = 9, |
| 4296 | .g2_irqs = 10, |
| 4297 | .atu_move_port_mask = 0xf, |
| 4298 | .dual_chip = true, |
| 4299 | .tag_protocol = DSA_TAG_PROTO_DSA, |
| 4300 | .ops = &mv88e6250_ops, |
| 4301 | }, |
| 4302 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4303 | [MV88E6240] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4304 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6240, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4305 | .family = MV88E6XXX_FAMILY_6352, |
| 4306 | .name = "Marvell 88E6240", |
| 4307 | .num_databases = 4096, |
| 4308 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4309 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4310 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4311 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4312 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4313 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4314 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4315 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4316 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4317 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4318 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4319 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4320 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4321 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4322 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4323 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4324 | .ops = &mv88e6240_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4325 | }, |
| 4326 | |
Rasmus Villemoes | 1f71836 | 2019-06-04 07:34:32 +0000 | [diff] [blame] | 4327 | [MV88E6250] = { |
| 4328 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6250, |
| 4329 | .family = MV88E6XXX_FAMILY_6250, |
| 4330 | .name = "Marvell 88E6250", |
| 4331 | .num_databases = 64, |
| 4332 | .num_ports = 7, |
| 4333 | .num_internal_phys = 5, |
| 4334 | .max_vid = 4095, |
| 4335 | .port_base_addr = 0x08, |
| 4336 | .phy_base_addr = 0x00, |
| 4337 | .global1_addr = 0x0f, |
| 4338 | .global2_addr = 0x07, |
| 4339 | .age_time_coeff = 15000, |
| 4340 | .g1_irqs = 9, |
| 4341 | .g2_irqs = 10, |
| 4342 | .atu_move_port_mask = 0xf, |
| 4343 | .dual_chip = true, |
| 4344 | .tag_protocol = DSA_TAG_PROTO_DSA, |
| 4345 | .ops = &mv88e6250_ops, |
| 4346 | }, |
| 4347 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4348 | [MV88E6290] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4349 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6290, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4350 | .family = MV88E6XXX_FAMILY_6390, |
| 4351 | .name = "Marvell 88E6290", |
| 4352 | .num_databases = 4096, |
| 4353 | .num_ports = 11, /* 10 + Z80 */ |
Heiner Kallweit | 95150f2 | 2019-03-02 10:06:05 +0100 | [diff] [blame] | 4354 | .num_internal_phys = 9, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4355 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 4356 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4357 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4358 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4359 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4360 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 4361 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4362 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4363 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4364 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4365 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4366 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4367 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4368 | .ptp_support = true, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4369 | .ops = &mv88e6290_ops, |
| 4370 | }, |
| 4371 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4372 | [MV88E6320] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4373 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6320, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4374 | .family = MV88E6XXX_FAMILY_6320, |
| 4375 | .name = "Marvell 88E6320", |
| 4376 | .num_databases = 4096, |
| 4377 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4378 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4379 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4380 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4381 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4382 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4383 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4384 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4385 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4386 | .g1_irqs = 8, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4387 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4388 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4389 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4390 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4391 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4392 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4393 | .ops = &mv88e6320_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4394 | }, |
| 4395 | |
| 4396 | [MV88E6321] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4397 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6321, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4398 | .family = MV88E6XXX_FAMILY_6320, |
| 4399 | .name = "Marvell 88E6321", |
| 4400 | .num_databases = 4096, |
| 4401 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4402 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4403 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4404 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4405 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4406 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4407 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4408 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4409 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4410 | .g1_irqs = 8, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4411 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4412 | .atu_move_port_mask = 0xf, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4413 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4414 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4415 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4416 | .ops = &mv88e6321_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4417 | }, |
| 4418 | |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4419 | [MV88E6341] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4420 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6341, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4421 | .family = MV88E6XXX_FAMILY_6341, |
| 4422 | .name = "Marvell 88E6341", |
| 4423 | .num_databases = 4096, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4424 | .num_internal_phys = 5, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4425 | .num_ports = 6, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4426 | .num_gpio = 11, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4427 | .max_vid = 4095, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4428 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4429 | .phy_base_addr = 0x10, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4430 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4431 | .global2_addr = 0x1c, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4432 | .age_time_coeff = 3750, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4433 | .atu_move_port_mask = 0x1f, |
Andrew Lunn | adfccf1 | 2018-03-17 20:32:03 +0100 | [diff] [blame] | 4434 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4435 | .g2_irqs = 10, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4436 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4437 | .multi_chip = true, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4438 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4439 | .ptp_support = true, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4440 | .ops = &mv88e6341_ops, |
| 4441 | }, |
| 4442 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4443 | [MV88E6350] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4444 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6350, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4445 | .family = MV88E6XXX_FAMILY_6351, |
| 4446 | .name = "Marvell 88E6350", |
| 4447 | .num_databases = 4096, |
| 4448 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4449 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4450 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4451 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4452 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4453 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4454 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4455 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4456 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4457 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4458 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4459 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4460 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4461 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4462 | .ops = &mv88e6350_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4463 | }, |
| 4464 | |
| 4465 | [MV88E6351] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4466 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6351, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4467 | .family = MV88E6XXX_FAMILY_6351, |
| 4468 | .name = "Marvell 88E6351", |
| 4469 | .num_databases = 4096, |
| 4470 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4471 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4472 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4473 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4474 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4475 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4476 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4477 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4478 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4479 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4480 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4481 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4482 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4483 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4484 | .ops = &mv88e6351_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4485 | }, |
| 4486 | |
| 4487 | [MV88E6352] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4488 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6352, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4489 | .family = MV88E6XXX_FAMILY_6352, |
| 4490 | .name = "Marvell 88E6352", |
| 4491 | .num_databases = 4096, |
| 4492 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4493 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4494 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4495 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4496 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4497 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4498 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4499 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4500 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4501 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4502 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4503 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4504 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4505 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4506 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4507 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4508 | .ops = &mv88e6352_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4509 | }, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4510 | [MV88E6390] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4511 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6390, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4512 | .family = MV88E6XXX_FAMILY_6390, |
| 4513 | .name = "Marvell 88E6390", |
| 4514 | .num_databases = 4096, |
| 4515 | .num_ports = 11, /* 10 + Z80 */ |
Heiner Kallweit | 95150f2 | 2019-03-02 10:06:05 +0100 | [diff] [blame] | 4516 | .num_internal_phys = 9, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4517 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 4518 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4519 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4520 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4521 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4522 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 4523 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4524 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4525 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4526 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4527 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4528 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4529 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4530 | .ptp_support = true, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4531 | .ops = &mv88e6390_ops, |
| 4532 | }, |
| 4533 | [MV88E6390X] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4534 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6390X, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4535 | .family = MV88E6XXX_FAMILY_6390, |
| 4536 | .name = "Marvell 88E6390X", |
| 4537 | .num_databases = 4096, |
| 4538 | .num_ports = 11, /* 10 + Z80 */ |
Heiner Kallweit | 95150f2 | 2019-03-02 10:06:05 +0100 | [diff] [blame] | 4539 | .num_internal_phys = 9, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4540 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 4541 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4542 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4543 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4544 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4545 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 4546 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4547 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4548 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4549 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4550 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4551 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4552 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4553 | .ptp_support = true, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4554 | .ops = &mv88e6390x_ops, |
| 4555 | }, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4556 | }; |
| 4557 | |
Vivien Didelot | 5f7c036 | 2016-06-20 13:14:04 -0400 | [diff] [blame] | 4558 | static const struct mv88e6xxx_info *mv88e6xxx_lookup_info(unsigned int prod_num) |
Vivien Didelot | b9b3771 | 2015-10-30 19:39:48 -0400 | [diff] [blame] | 4559 | { |
Vivien Didelot | a439c06 | 2016-04-17 13:23:58 -0400 | [diff] [blame] | 4560 | int i; |
Vivien Didelot | b9b3771 | 2015-10-30 19:39:48 -0400 | [diff] [blame] | 4561 | |
Vivien Didelot | 5f7c036 | 2016-06-20 13:14:04 -0400 | [diff] [blame] | 4562 | for (i = 0; i < ARRAY_SIZE(mv88e6xxx_table); ++i) |
| 4563 | if (mv88e6xxx_table[i].prod_num == prod_num) |
| 4564 | return &mv88e6xxx_table[i]; |
Vivien Didelot | b9b3771 | 2015-10-30 19:39:48 -0400 | [diff] [blame] | 4565 | |
Vivien Didelot | b9b3771 | 2015-10-30 19:39:48 -0400 | [diff] [blame] | 4566 | return NULL; |
| 4567 | } |
| 4568 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4569 | static int mv88e6xxx_detect(struct mv88e6xxx_chip *chip) |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4570 | { |
| 4571 | const struct mv88e6xxx_info *info; |
Vivien Didelot | 8f6345b | 2016-07-20 18:18:36 -0400 | [diff] [blame] | 4572 | unsigned int prod_num, rev; |
| 4573 | u16 id; |
| 4574 | int err; |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4575 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4576 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4577 | err = mv88e6xxx_port_read(chip, 0, MV88E6XXX_PORT_SWITCH_ID, &id); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4578 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 8f6345b | 2016-07-20 18:18:36 -0400 | [diff] [blame] | 4579 | if (err) |
| 4580 | return err; |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4581 | |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4582 | prod_num = id & MV88E6XXX_PORT_SWITCH_ID_PROD_MASK; |
| 4583 | rev = id & MV88E6XXX_PORT_SWITCH_ID_REV_MASK; |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4584 | |
| 4585 | info = mv88e6xxx_lookup_info(prod_num); |
| 4586 | if (!info) |
| 4587 | return -ENODEV; |
| 4588 | |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 4589 | /* Update the compatible info with the probed one */ |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4590 | chip->info = info; |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4591 | |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 4592 | err = mv88e6xxx_g2_require(chip); |
| 4593 | if (err) |
| 4594 | return err; |
| 4595 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4596 | dev_info(chip->dev, "switch 0x%x detected: %s, revision %u\n", |
| 4597 | chip->info->prod_num, chip->info->name, rev); |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4598 | |
| 4599 | return 0; |
| 4600 | } |
| 4601 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4602 | static struct mv88e6xxx_chip *mv88e6xxx_alloc_chip(struct device *dev) |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4603 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4604 | struct mv88e6xxx_chip *chip; |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4605 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4606 | chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); |
| 4607 | if (!chip) |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4608 | return NULL; |
| 4609 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4610 | chip->dev = dev; |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4611 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4612 | mutex_init(&chip->reg_lock); |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 4613 | INIT_LIST_HEAD(&chip->mdios); |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4614 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4615 | return chip; |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4616 | } |
| 4617 | |
Florian Fainelli | 5ed4e3e | 2017-11-10 15:22:52 -0800 | [diff] [blame] | 4618 | static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds, |
| 4619 | int port) |
Andrew Lunn | 7b31436 | 2016-08-22 16:01:01 +0200 | [diff] [blame] | 4620 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 4621 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 2bbb33b | 2016-08-22 16:01:02 +0200 | [diff] [blame] | 4622 | |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4623 | return chip->info->tag_protocol; |
Andrew Lunn | 7b31436 | 2016-08-22 16:01:01 +0200 | [diff] [blame] | 4624 | } |
| 4625 | |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4626 | static int mv88e6xxx_port_mdb_prepare(struct dsa_switch *ds, int port, |
Vivien Didelot | 3709aad | 2017-11-30 11:23:58 -0500 | [diff] [blame] | 4627 | const struct switchdev_obj_port_mdb *mdb) |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4628 | { |
| 4629 | /* We don't need any dynamic resource from the kernel (yet), |
| 4630 | * so skip the prepare phase. |
| 4631 | */ |
| 4632 | |
| 4633 | return 0; |
| 4634 | } |
| 4635 | |
| 4636 | static void mv88e6xxx_port_mdb_add(struct dsa_switch *ds, int port, |
Vivien Didelot | 3709aad | 2017-11-30 11:23:58 -0500 | [diff] [blame] | 4637 | const struct switchdev_obj_port_mdb *mdb) |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4638 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 4639 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4640 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4641 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4642 | if (mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 4643 | MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC)) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 4644 | dev_err(ds->dev, "p%d: failed to load multicast MAC address\n", |
| 4645 | port); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4646 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4647 | } |
| 4648 | |
| 4649 | static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port, |
| 4650 | const struct switchdev_obj_port_mdb *mdb) |
| 4651 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 4652 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4653 | int err; |
| 4654 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4655 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4656 | err = mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 4657 | MV88E6XXX_G1_ATU_DATA_STATE_UNUSED); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4658 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4659 | |
| 4660 | return err; |
| 4661 | } |
| 4662 | |
Russell King | 4f85901 | 2019-02-20 15:35:05 -0800 | [diff] [blame] | 4663 | static int mv88e6xxx_port_egress_floods(struct dsa_switch *ds, int port, |
| 4664 | bool unicast, bool multicast) |
| 4665 | { |
| 4666 | struct mv88e6xxx_chip *chip = ds->priv; |
| 4667 | int err = -EOPNOTSUPP; |
| 4668 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4669 | mv88e6xxx_reg_lock(chip); |
Russell King | 4f85901 | 2019-02-20 15:35:05 -0800 | [diff] [blame] | 4670 | if (chip->info->ops->port_set_egress_floods) |
| 4671 | err = chip->info->ops->port_set_egress_floods(chip, port, |
| 4672 | unicast, |
| 4673 | multicast); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4674 | mv88e6xxx_reg_unlock(chip); |
Russell King | 4f85901 | 2019-02-20 15:35:05 -0800 | [diff] [blame] | 4675 | |
| 4676 | return err; |
| 4677 | } |
| 4678 | |
Florian Fainelli | a82f67a | 2017-01-08 14:52:08 -0800 | [diff] [blame] | 4679 | static const struct dsa_switch_ops mv88e6xxx_switch_ops = { |
Andrew Lunn | 7b31436 | 2016-08-22 16:01:01 +0200 | [diff] [blame] | 4680 | .get_tag_protocol = mv88e6xxx_get_tag_protocol, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4681 | .setup = mv88e6xxx_setup, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4682 | .adjust_link = mv88e6xxx_adjust_link, |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 4683 | .phylink_validate = mv88e6xxx_validate, |
| 4684 | .phylink_mac_link_state = mv88e6xxx_link_state, |
| 4685 | .phylink_mac_config = mv88e6xxx_mac_config, |
| 4686 | .phylink_mac_link_down = mv88e6xxx_mac_link_down, |
| 4687 | .phylink_mac_link_up = mv88e6xxx_mac_link_up, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4688 | .get_strings = mv88e6xxx_get_strings, |
| 4689 | .get_ethtool_stats = mv88e6xxx_get_ethtool_stats, |
| 4690 | .get_sset_count = mv88e6xxx_get_sset_count, |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 4691 | .port_enable = mv88e6xxx_port_enable, |
| 4692 | .port_disable = mv88e6xxx_port_disable, |
Vivien Didelot | 08f5006 | 2017-08-01 16:32:41 -0400 | [diff] [blame] | 4693 | .get_mac_eee = mv88e6xxx_get_mac_eee, |
| 4694 | .set_mac_eee = mv88e6xxx_set_mac_eee, |
Andrew Lunn | f8cd875 | 2016-05-10 23:27:25 +0200 | [diff] [blame] | 4695 | .get_eeprom_len = mv88e6xxx_get_eeprom_len, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4696 | .get_eeprom = mv88e6xxx_get_eeprom, |
| 4697 | .set_eeprom = mv88e6xxx_set_eeprom, |
| 4698 | .get_regs_len = mv88e6xxx_get_regs_len, |
| 4699 | .get_regs = mv88e6xxx_get_regs, |
Vivien Didelot | 2cfcd96 | 2016-07-18 20:45:40 -0400 | [diff] [blame] | 4700 | .set_ageing_time = mv88e6xxx_set_ageing_time, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4701 | .port_bridge_join = mv88e6xxx_port_bridge_join, |
| 4702 | .port_bridge_leave = mv88e6xxx_port_bridge_leave, |
Russell King | 4f85901 | 2019-02-20 15:35:05 -0800 | [diff] [blame] | 4703 | .port_egress_floods = mv88e6xxx_port_egress_floods, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4704 | .port_stp_state_set = mv88e6xxx_port_stp_state_set, |
Vivien Didelot | 749efcb | 2016-09-22 16:49:24 -0400 | [diff] [blame] | 4705 | .port_fast_age = mv88e6xxx_port_fast_age, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4706 | .port_vlan_filtering = mv88e6xxx_port_vlan_filtering, |
| 4707 | .port_vlan_prepare = mv88e6xxx_port_vlan_prepare, |
| 4708 | .port_vlan_add = mv88e6xxx_port_vlan_add, |
| 4709 | .port_vlan_del = mv88e6xxx_port_vlan_del, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4710 | .port_fdb_add = mv88e6xxx_port_fdb_add, |
| 4711 | .port_fdb_del = mv88e6xxx_port_fdb_del, |
| 4712 | .port_fdb_dump = mv88e6xxx_port_fdb_dump, |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4713 | .port_mdb_prepare = mv88e6xxx_port_mdb_prepare, |
| 4714 | .port_mdb_add = mv88e6xxx_port_mdb_add, |
| 4715 | .port_mdb_del = mv88e6xxx_port_mdb_del, |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 4716 | .crosschip_bridge_join = mv88e6xxx_crosschip_bridge_join, |
| 4717 | .crosschip_bridge_leave = mv88e6xxx_crosschip_bridge_leave, |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 4718 | .port_hwtstamp_set = mv88e6xxx_port_hwtstamp_set, |
| 4719 | .port_hwtstamp_get = mv88e6xxx_port_hwtstamp_get, |
| 4720 | .port_txtstamp = mv88e6xxx_port_txtstamp, |
| 4721 | .port_rxtstamp = mv88e6xxx_port_rxtstamp, |
| 4722 | .get_ts_info = mv88e6xxx_get_ts_info, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4723 | }; |
| 4724 | |
Florian Fainelli | 55ed0ce | 2017-01-26 10:45:51 -0800 | [diff] [blame] | 4725 | static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip) |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4726 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4727 | struct device *dev = chip->dev; |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4728 | struct dsa_switch *ds; |
| 4729 | |
Vivien Didelot | 73b1204 | 2017-03-30 17:37:10 -0400 | [diff] [blame] | 4730 | ds = dsa_switch_alloc(dev, mv88e6xxx_num_ports(chip)); |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4731 | if (!ds) |
| 4732 | return -ENOMEM; |
| 4733 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4734 | ds->priv = chip; |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4735 | ds->dev = dev; |
Vivien Didelot | 9d490b4 | 2016-08-23 12:38:56 -0400 | [diff] [blame] | 4736 | ds->ops = &mv88e6xxx_switch_ops; |
Vivien Didelot | 9ff74f2 | 2017-03-15 15:53:50 -0400 | [diff] [blame] | 4737 | ds->ageing_time_min = chip->info->age_time_coeff; |
| 4738 | ds->ageing_time_max = chip->info->age_time_coeff * U8_MAX; |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4739 | |
| 4740 | dev_set_drvdata(dev, ds); |
| 4741 | |
Vivien Didelot | 23c9ee4 | 2017-05-26 18:12:51 -0400 | [diff] [blame] | 4742 | return dsa_register_switch(ds); |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4743 | } |
| 4744 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4745 | static void mv88e6xxx_unregister_switch(struct mv88e6xxx_chip *chip) |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4746 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4747 | dsa_unregister_switch(chip->ds); |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4748 | } |
| 4749 | |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4750 | static const void *pdata_device_get_match_data(struct device *dev) |
| 4751 | { |
| 4752 | const struct of_device_id *matches = dev->driver->of_match_table; |
| 4753 | const struct dsa_mv88e6xxx_pdata *pdata = dev->platform_data; |
| 4754 | |
| 4755 | for (; matches->name[0] || matches->type[0] || matches->compatible[0]; |
| 4756 | matches++) { |
| 4757 | if (!strcmp(pdata->compatible, matches->compatible)) |
| 4758 | return matches->data; |
| 4759 | } |
| 4760 | return NULL; |
| 4761 | } |
| 4762 | |
Miquel Raynal | bcd3d9d | 2019-02-05 12:07:28 +0100 | [diff] [blame] | 4763 | /* There is no suspend to RAM support at DSA level yet, the switch configuration |
| 4764 | * would be lost after a power cycle so prevent it to be suspended. |
| 4765 | */ |
| 4766 | static int __maybe_unused mv88e6xxx_suspend(struct device *dev) |
| 4767 | { |
| 4768 | return -EOPNOTSUPP; |
| 4769 | } |
| 4770 | |
| 4771 | static int __maybe_unused mv88e6xxx_resume(struct device *dev) |
| 4772 | { |
| 4773 | return 0; |
| 4774 | } |
| 4775 | |
| 4776 | static SIMPLE_DEV_PM_OPS(mv88e6xxx_pm_ops, mv88e6xxx_suspend, mv88e6xxx_resume); |
| 4777 | |
Vivien Didelot | 57d3231 | 2016-06-20 13:13:58 -0400 | [diff] [blame] | 4778 | static int mv88e6xxx_probe(struct mdio_device *mdiodev) |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4779 | { |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4780 | struct dsa_mv88e6xxx_pdata *pdata = mdiodev->dev.platform_data; |
David S. Miller | 7ddae24 | 2018-05-20 19:04:24 -0400 | [diff] [blame] | 4781 | const struct mv88e6xxx_info *compat_info = NULL; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4782 | struct device *dev = &mdiodev->dev; |
Andrew Lunn | f8cd875 | 2016-05-10 23:27:25 +0200 | [diff] [blame] | 4783 | struct device_node *np = dev->of_node; |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4784 | struct mv88e6xxx_chip *chip; |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4785 | int port; |
Andrew Lunn | 52638f7 | 2016-05-10 23:27:22 +0200 | [diff] [blame] | 4786 | int err; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4787 | |
Andrew Lunn | 7bb8c99 | 2018-05-31 00:15:42 +0200 | [diff] [blame] | 4788 | if (!np && !pdata) |
| 4789 | return -EINVAL; |
| 4790 | |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4791 | if (np) |
| 4792 | compat_info = of_device_get_match_data(dev); |
| 4793 | |
| 4794 | if (pdata) { |
| 4795 | compat_info = pdata_device_get_match_data(dev); |
| 4796 | |
| 4797 | if (!pdata->netdev) |
| 4798 | return -EINVAL; |
| 4799 | |
| 4800 | for (port = 0; port < DSA_MAX_PORTS; port++) { |
| 4801 | if (!(pdata->enabled_ports & (1 << port))) |
| 4802 | continue; |
| 4803 | if (strcmp(pdata->cd.port_names[port], "cpu")) |
| 4804 | continue; |
| 4805 | pdata->cd.netdev[port] = &pdata->netdev->dev; |
| 4806 | break; |
| 4807 | } |
| 4808 | } |
| 4809 | |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 4810 | if (!compat_info) |
| 4811 | return -EINVAL; |
| 4812 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4813 | chip = mv88e6xxx_alloc_chip(dev); |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4814 | if (!chip) { |
| 4815 | err = -ENOMEM; |
| 4816 | goto out; |
| 4817 | } |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4818 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4819 | chip->info = compat_info; |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 4820 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4821 | err = mv88e6xxx_smi_init(chip, mdiodev->bus, mdiodev->addr); |
Vivien Didelot | 4a70c4a | 2016-06-20 13:14:07 -0400 | [diff] [blame] | 4822 | if (err) |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4823 | goto out; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4824 | |
Andrew Lunn | b4308f0 | 2016-11-21 23:26:55 +0100 | [diff] [blame] | 4825 | chip->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4826 | if (IS_ERR(chip->reset)) { |
| 4827 | err = PTR_ERR(chip->reset); |
| 4828 | goto out; |
| 4829 | } |
Baruch Siach | 7b75e49 | 2019-06-27 21:17:39 +0300 | [diff] [blame] | 4830 | if (chip->reset) |
| 4831 | usleep_range(1000, 2000); |
Andrew Lunn | b4308f0 | 2016-11-21 23:26:55 +0100 | [diff] [blame] | 4832 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4833 | err = mv88e6xxx_detect(chip); |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4834 | if (err) |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4835 | goto out; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4836 | |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 4837 | mv88e6xxx_phy_init(chip); |
| 4838 | |
Andrew Lunn | 00baabe | 2018-05-19 22:31:35 +0200 | [diff] [blame] | 4839 | if (chip->info->ops->get_eeprom) { |
| 4840 | if (np) |
| 4841 | of_property_read_u32(np, "eeprom-length", |
| 4842 | &chip->eeprom_len); |
| 4843 | else |
| 4844 | chip->eeprom_len = pdata->eeprom_len; |
| 4845 | } |
Andrew Lunn | f8cd875 | 2016-05-10 23:27:25 +0200 | [diff] [blame] | 4846 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4847 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4848 | err = mv88e6xxx_switch_reset(chip); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4849 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 4850 | if (err) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4851 | goto out; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 4852 | |
Andrew Lunn | a27415d | 2019-05-01 00:10:50 +0200 | [diff] [blame] | 4853 | if (np) { |
| 4854 | chip->irq = of_irq_get(np, 0); |
| 4855 | if (chip->irq == -EPROBE_DEFER) { |
| 4856 | err = chip->irq; |
| 4857 | goto out; |
| 4858 | } |
Andrew Lunn | 83c0afa | 2016-06-04 21:17:07 +0200 | [diff] [blame] | 4859 | } |
| 4860 | |
Andrew Lunn | a27415d | 2019-05-01 00:10:50 +0200 | [diff] [blame] | 4861 | if (pdata) |
| 4862 | chip->irq = pdata->irq; |
| 4863 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4864 | /* Has to be performed before the MDIO bus is created, because |
Uwe Kleine-König | a708767 | 2018-03-20 10:44:41 +0100 | [diff] [blame] | 4865 | * the PHYs will link their interrupts to these interrupt |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4866 | * controllers |
| 4867 | */ |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4868 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4869 | if (chip->irq > 0) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4870 | err = mv88e6xxx_g1_irq_setup(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4871 | else |
| 4872 | err = mv88e6xxx_irq_poll_setup(chip); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4873 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4874 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4875 | if (err) |
| 4876 | goto out; |
| 4877 | |
| 4878 | if (chip->info->g2_irqs > 0) { |
| 4879 | err = mv88e6xxx_g2_irq_setup(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4880 | if (err) |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4881 | goto out_g1_irq; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4882 | } |
| 4883 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4884 | err = mv88e6xxx_g1_atu_prob_irq_setup(chip); |
| 4885 | if (err) |
| 4886 | goto out_g2_irq; |
| 4887 | |
| 4888 | err = mv88e6xxx_g1_vtu_prob_irq_setup(chip); |
| 4889 | if (err) |
| 4890 | goto out_g1_atu_prob_irq; |
| 4891 | |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 4892 | err = mv88e6xxx_mdios_register(chip, np); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4893 | if (err) |
Andrew Lunn | 62eb116 | 2018-01-14 02:32:45 +0100 | [diff] [blame] | 4894 | goto out_g1_vtu_prob_irq; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4895 | |
Florian Fainelli | 55ed0ce | 2017-01-26 10:45:51 -0800 | [diff] [blame] | 4896 | err = mv88e6xxx_register_switch(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4897 | if (err) |
| 4898 | goto out_mdio; |
| 4899 | |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4900 | return 0; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4901 | |
| 4902 | out_mdio: |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 4903 | mv88e6xxx_mdios_unregister(chip); |
Andrew Lunn | 62eb116 | 2018-01-14 02:32:45 +0100 | [diff] [blame] | 4904 | out_g1_vtu_prob_irq: |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4905 | mv88e6xxx_g1_vtu_prob_irq_free(chip); |
Andrew Lunn | 0977644 | 2018-01-14 02:32:44 +0100 | [diff] [blame] | 4906 | out_g1_atu_prob_irq: |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4907 | mv88e6xxx_g1_atu_prob_irq_free(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4908 | out_g2_irq: |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4909 | if (chip->info->g2_irqs > 0) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4910 | mv88e6xxx_g2_irq_free(chip); |
| 4911 | out_g1_irq: |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4912 | if (chip->irq > 0) |
Andrew Lunn | 46712644 | 2016-11-20 20:14:15 +0100 | [diff] [blame] | 4913 | mv88e6xxx_g1_irq_free(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4914 | else |
| 4915 | mv88e6xxx_irq_poll_free(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4916 | out: |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4917 | if (pdata) |
| 4918 | dev_put(pdata->netdev); |
| 4919 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4920 | return err; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4921 | } |
| 4922 | |
| 4923 | static void mv88e6xxx_remove(struct mdio_device *mdiodev) |
| 4924 | { |
| 4925 | struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 4926 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4927 | |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 4928 | if (chip->info->ptp_support) { |
| 4929 | mv88e6xxx_hwtstamp_free(chip); |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4930 | mv88e6xxx_ptp_free(chip); |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 4931 | } |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4932 | |
Andrew Lunn | 930188c | 2016-08-22 16:01:03 +0200 | [diff] [blame] | 4933 | mv88e6xxx_phy_destroy(chip); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4934 | mv88e6xxx_unregister_switch(chip); |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 4935 | mv88e6xxx_mdios_unregister(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4936 | |
Andrew Lunn | 76f38f1 | 2018-03-17 20:21:09 +0100 | [diff] [blame] | 4937 | mv88e6xxx_g1_vtu_prob_irq_free(chip); |
| 4938 | mv88e6xxx_g1_atu_prob_irq_free(chip); |
| 4939 | |
| 4940 | if (chip->info->g2_irqs > 0) |
| 4941 | mv88e6xxx_g2_irq_free(chip); |
| 4942 | |
Andrew Lunn | 76f38f1 | 2018-03-17 20:21:09 +0100 | [diff] [blame] | 4943 | if (chip->irq > 0) |
Andrew Lunn | 46712644 | 2016-11-20 20:14:15 +0100 | [diff] [blame] | 4944 | mv88e6xxx_g1_irq_free(chip); |
Andrew Lunn | 76f38f1 | 2018-03-17 20:21:09 +0100 | [diff] [blame] | 4945 | else |
| 4946 | mv88e6xxx_irq_poll_free(chip); |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4947 | } |
| 4948 | |
| 4949 | static const struct of_device_id mv88e6xxx_of_match[] = { |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 4950 | { |
| 4951 | .compatible = "marvell,mv88e6085", |
| 4952 | .data = &mv88e6xxx_table[MV88E6085], |
| 4953 | }, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4954 | { |
| 4955 | .compatible = "marvell,mv88e6190", |
| 4956 | .data = &mv88e6xxx_table[MV88E6190], |
| 4957 | }, |
Rasmus Villemoes | 1f71836 | 2019-06-04 07:34:32 +0000 | [diff] [blame] | 4958 | { |
| 4959 | .compatible = "marvell,mv88e6250", |
| 4960 | .data = &mv88e6xxx_table[MV88E6250], |
| 4961 | }, |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4962 | { /* sentinel */ }, |
| 4963 | }; |
| 4964 | |
| 4965 | MODULE_DEVICE_TABLE(of, mv88e6xxx_of_match); |
| 4966 | |
| 4967 | static struct mdio_driver mv88e6xxx_driver = { |
| 4968 | .probe = mv88e6xxx_probe, |
| 4969 | .remove = mv88e6xxx_remove, |
| 4970 | .mdiodrv.driver = { |
| 4971 | .name = "mv88e6085", |
| 4972 | .of_match_table = mv88e6xxx_of_match, |
Miquel Raynal | bcd3d9d | 2019-02-05 12:07:28 +0100 | [diff] [blame] | 4973 | .pm = &mv88e6xxx_pm_ops, |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4974 | }, |
| 4975 | }; |
| 4976 | |
Andrew Lunn | 7324d50 | 2019-04-27 19:19:10 +0200 | [diff] [blame] | 4977 | mdio_module_driver(mv88e6xxx_driver); |
Ben Hutchings | 3d825ed | 2011-11-25 14:37:16 +0000 | [diff] [blame] | 4978 | |
| 4979 | MODULE_AUTHOR("Lennert Buytenhek <buytenh@wantstofly.org>"); |
| 4980 | MODULE_DESCRIPTION("Driver for Marvell 88E6XXX ethernet switch chips"); |
| 4981 | MODULE_LICENSE("GPL"); |