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 | |
Vivien Didelot | 19fb7f6 | 2019-08-09 18:47:55 -0400 | [diff] [blame] | 13 | #include <linux/bitfield.h> |
Barry Grussling | 19b2f97 | 2013-01-08 16:05:54 +0000 | [diff] [blame] | 14 | #include <linux/delay.h> |
Guenter Roeck | defb05b | 2015-03-26 18:36:38 -0700 | [diff] [blame] | 15 | #include <linux/etherdevice.h> |
Andrew Lunn | dea8702 | 2015-08-31 15:56:47 +0200 | [diff] [blame] | 16 | #include <linux/ethtool.h> |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 17 | #include <linux/if_bridge.h> |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 18 | #include <linux/interrupt.h> |
| 19 | #include <linux/irq.h> |
| 20 | #include <linux/irqdomain.h> |
Barry Grussling | 19b2f97 | 2013-01-08 16:05:54 +0000 | [diff] [blame] | 21 | #include <linux/jiffies.h> |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 22 | #include <linux/list.h> |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 23 | #include <linux/mdio.h> |
Paul Gortmaker | 2bbba27 | 2012-01-24 10:41:40 +0000 | [diff] [blame] | 24 | #include <linux/module.h> |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 25 | #include <linux/of_device.h> |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 26 | #include <linux/of_irq.h> |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 27 | #include <linux/of_mdio.h> |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 28 | #include <linux/platform_data/mv88e6xxx.h> |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 29 | #include <linux/netdevice.h> |
Andrew Lunn | c8c1b39a | 2015-11-20 03:56:24 +0100 | [diff] [blame] | 30 | #include <linux/gpio/consumer.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 | |
Vivien Didelot | 683f224 | 2019-08-09 18:47:54 -0400 | [diff] [blame] | 84 | int mv88e6xxx_wait_mask(struct mv88e6xxx_chip *chip, int addr, int reg, |
| 85 | u16 mask, u16 val) |
| 86 | { |
| 87 | u16 data; |
| 88 | int err; |
| 89 | int i; |
| 90 | |
| 91 | /* There's no bus specific operation to wait for a mask */ |
| 92 | for (i = 0; i < 16; i++) { |
| 93 | err = mv88e6xxx_read(chip, addr, reg, &data); |
| 94 | if (err) |
| 95 | return err; |
| 96 | |
| 97 | if ((data & mask) == val) |
| 98 | return 0; |
| 99 | |
| 100 | usleep_range(1000, 2000); |
| 101 | } |
| 102 | |
| 103 | dev_err(chip->dev, "Timeout while waiting for switch\n"); |
| 104 | return -ETIMEDOUT; |
| 105 | } |
| 106 | |
Vivien Didelot | 19fb7f6 | 2019-08-09 18:47:55 -0400 | [diff] [blame] | 107 | int mv88e6xxx_wait_bit(struct mv88e6xxx_chip *chip, int addr, int reg, |
| 108 | int bit, int val) |
| 109 | { |
| 110 | return mv88e6xxx_wait_mask(chip, addr, reg, BIT(bit), |
| 111 | val ? BIT(bit) : 0x0000); |
| 112 | } |
| 113 | |
Andrew Lunn | 10fa5bf | 2017-05-26 01:03:20 +0200 | [diff] [blame] | 114 | struct mii_bus *mv88e6xxx_default_mdio_bus(struct mv88e6xxx_chip *chip) |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 115 | { |
| 116 | struct mv88e6xxx_mdio_bus *mdio_bus; |
| 117 | |
| 118 | mdio_bus = list_first_entry(&chip->mdios, struct mv88e6xxx_mdio_bus, |
| 119 | list); |
| 120 | if (!mdio_bus) |
| 121 | return NULL; |
| 122 | |
| 123 | return mdio_bus->bus; |
| 124 | } |
| 125 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 126 | static void mv88e6xxx_g1_irq_mask(struct irq_data *d) |
| 127 | { |
| 128 | struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); |
| 129 | unsigned int n = d->hwirq; |
| 130 | |
| 131 | chip->g1_irq.masked |= (1 << n); |
| 132 | } |
| 133 | |
| 134 | static void mv88e6xxx_g1_irq_unmask(struct irq_data *d) |
| 135 | { |
| 136 | struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); |
| 137 | unsigned int n = d->hwirq; |
| 138 | |
| 139 | chip->g1_irq.masked &= ~(1 << n); |
| 140 | } |
| 141 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 142 | static irqreturn_t mv88e6xxx_g1_irq_thread_work(struct mv88e6xxx_chip *chip) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 143 | { |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 144 | unsigned int nhandled = 0; |
| 145 | unsigned int sub_irq; |
| 146 | unsigned int n; |
| 147 | u16 reg; |
John David Anglin | 7c0db24 | 2019-02-11 13:40:21 -0500 | [diff] [blame] | 148 | u16 ctl1; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 149 | int err; |
| 150 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 151 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 8246692 | 2017-06-15 12:13:59 -0400 | [diff] [blame] | 152 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, ®); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 153 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 154 | |
| 155 | if (err) |
| 156 | goto out; |
| 157 | |
John David Anglin | 7c0db24 | 2019-02-11 13:40:21 -0500 | [diff] [blame] | 158 | do { |
| 159 | for (n = 0; n < chip->g1_irq.nirqs; ++n) { |
| 160 | if (reg & (1 << n)) { |
| 161 | sub_irq = irq_find_mapping(chip->g1_irq.domain, |
| 162 | n); |
| 163 | handle_nested_irq(sub_irq); |
| 164 | ++nhandled; |
| 165 | } |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 166 | } |
John David Anglin | 7c0db24 | 2019-02-11 13:40:21 -0500 | [diff] [blame] | 167 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 168 | mv88e6xxx_reg_lock(chip); |
John David Anglin | 7c0db24 | 2019-02-11 13:40:21 -0500 | [diff] [blame] | 169 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &ctl1); |
| 170 | if (err) |
| 171 | goto unlock; |
| 172 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, ®); |
| 173 | unlock: |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 174 | mv88e6xxx_reg_unlock(chip); |
John David Anglin | 7c0db24 | 2019-02-11 13:40:21 -0500 | [diff] [blame] | 175 | if (err) |
| 176 | goto out; |
| 177 | ctl1 &= GENMASK(chip->g1_irq.nirqs, 0); |
| 178 | } while (reg & ctl1); |
| 179 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 180 | out: |
| 181 | return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE); |
| 182 | } |
| 183 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 184 | static irqreturn_t mv88e6xxx_g1_irq_thread_fn(int irq, void *dev_id) |
| 185 | { |
| 186 | struct mv88e6xxx_chip *chip = dev_id; |
| 187 | |
| 188 | return mv88e6xxx_g1_irq_thread_work(chip); |
| 189 | } |
| 190 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 191 | static void mv88e6xxx_g1_irq_bus_lock(struct irq_data *d) |
| 192 | { |
| 193 | struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); |
| 194 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 195 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | static void mv88e6xxx_g1_irq_bus_sync_unlock(struct irq_data *d) |
| 199 | { |
| 200 | struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); |
| 201 | u16 mask = GENMASK(chip->g1_irq.nirqs, 0); |
| 202 | u16 reg; |
| 203 | int err; |
| 204 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 205 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, ®); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 206 | if (err) |
| 207 | goto out; |
| 208 | |
| 209 | reg &= ~mask; |
| 210 | reg |= (~chip->g1_irq.masked & mask); |
| 211 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 212 | err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, reg); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 213 | if (err) |
| 214 | goto out; |
| 215 | |
| 216 | out: |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 217 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 218 | } |
| 219 | |
Bhumika Goyal | 6eb15e2 | 2017-08-19 16:25:52 +0530 | [diff] [blame] | 220 | static const struct irq_chip mv88e6xxx_g1_irq_chip = { |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 221 | .name = "mv88e6xxx-g1", |
| 222 | .irq_mask = mv88e6xxx_g1_irq_mask, |
| 223 | .irq_unmask = mv88e6xxx_g1_irq_unmask, |
| 224 | .irq_bus_lock = mv88e6xxx_g1_irq_bus_lock, |
| 225 | .irq_bus_sync_unlock = mv88e6xxx_g1_irq_bus_sync_unlock, |
| 226 | }; |
| 227 | |
| 228 | static int mv88e6xxx_g1_irq_domain_map(struct irq_domain *d, |
| 229 | unsigned int irq, |
| 230 | irq_hw_number_t hwirq) |
| 231 | { |
| 232 | struct mv88e6xxx_chip *chip = d->host_data; |
| 233 | |
| 234 | irq_set_chip_data(irq, d->host_data); |
| 235 | irq_set_chip_and_handler(irq, &chip->g1_irq.chip, handle_level_irq); |
| 236 | irq_set_noprobe(irq); |
| 237 | |
| 238 | return 0; |
| 239 | } |
| 240 | |
| 241 | static const struct irq_domain_ops mv88e6xxx_g1_irq_domain_ops = { |
| 242 | .map = mv88e6xxx_g1_irq_domain_map, |
| 243 | .xlate = irq_domain_xlate_twocell, |
| 244 | }; |
| 245 | |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame] | 246 | /* To be called with reg_lock held */ |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 247 | static void mv88e6xxx_g1_irq_free_common(struct mv88e6xxx_chip *chip) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 248 | { |
| 249 | int irq, virq; |
Andrew Lunn | 3460a57 | 2016-11-20 20:14:16 +0100 | [diff] [blame] | 250 | u16 mask; |
| 251 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 252 | mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &mask); |
Andrew Lunn | 3d5fdba | 2017-12-07 01:05:56 +0100 | [diff] [blame] | 253 | mask &= ~GENMASK(chip->g1_irq.nirqs, 0); |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 254 | mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask); |
Andrew Lunn | 3460a57 | 2016-11-20 20:14:16 +0100 | [diff] [blame] | 255 | |
Andreas Färber | 5edef2f | 2016-11-27 23:26:28 +0100 | [diff] [blame] | 256 | for (irq = 0; irq < chip->g1_irq.nirqs; irq++) { |
Andrew Lunn | a3db3d3 | 2016-11-20 20:14:14 +0100 | [diff] [blame] | 257 | virq = irq_find_mapping(chip->g1_irq.domain, irq); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 258 | irq_dispose_mapping(virq); |
| 259 | } |
| 260 | |
Andrew Lunn | a3db3d3 | 2016-11-20 20:14:14 +0100 | [diff] [blame] | 261 | irq_domain_remove(chip->g1_irq.domain); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 262 | } |
| 263 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 264 | static void mv88e6xxx_g1_irq_free(struct mv88e6xxx_chip *chip) |
| 265 | { |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame] | 266 | /* |
| 267 | * free_irq must be called without reg_lock taken because the irq |
| 268 | * handler takes this lock, too. |
| 269 | */ |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 270 | free_irq(chip->irq, chip); |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame] | 271 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 272 | mv88e6xxx_reg_lock(chip); |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame] | 273 | mv88e6xxx_g1_irq_free_common(chip); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 274 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | static int mv88e6xxx_g1_irq_setup_common(struct mv88e6xxx_chip *chip) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 278 | { |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 279 | int err, irq, virq; |
| 280 | u16 reg, mask; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 281 | |
| 282 | chip->g1_irq.nirqs = chip->info->g1_irqs; |
| 283 | chip->g1_irq.domain = irq_domain_add_simple( |
| 284 | NULL, chip->g1_irq.nirqs, 0, |
| 285 | &mv88e6xxx_g1_irq_domain_ops, chip); |
| 286 | if (!chip->g1_irq.domain) |
| 287 | return -ENOMEM; |
| 288 | |
| 289 | for (irq = 0; irq < chip->g1_irq.nirqs; irq++) |
| 290 | irq_create_mapping(chip->g1_irq.domain, irq); |
| 291 | |
| 292 | chip->g1_irq.chip = mv88e6xxx_g1_irq_chip; |
| 293 | chip->g1_irq.masked = ~0; |
| 294 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 295 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &mask); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 296 | if (err) |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 297 | goto out_mapping; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 298 | |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 299 | mask &= ~GENMASK(chip->g1_irq.nirqs, 0); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 300 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 301 | err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 302 | if (err) |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 303 | goto out_disable; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 304 | |
| 305 | /* Reading the interrupt status clears (most of) them */ |
Vivien Didelot | 8246692 | 2017-06-15 12:13:59 -0400 | [diff] [blame] | 306 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, ®); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 307 | if (err) |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 308 | goto out_disable; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 309 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 310 | return 0; |
| 311 | |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 312 | out_disable: |
Andrew Lunn | 3d5fdba | 2017-12-07 01:05:56 +0100 | [diff] [blame] | 313 | mask &= ~GENMASK(chip->g1_irq.nirqs, 0); |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 314 | mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask); |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 315 | |
| 316 | out_mapping: |
| 317 | for (irq = 0; irq < 16; irq++) { |
| 318 | virq = irq_find_mapping(chip->g1_irq.domain, irq); |
| 319 | irq_dispose_mapping(virq); |
| 320 | } |
| 321 | |
| 322 | irq_domain_remove(chip->g1_irq.domain); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 323 | |
| 324 | return err; |
| 325 | } |
| 326 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 327 | static int mv88e6xxx_g1_irq_setup(struct mv88e6xxx_chip *chip) |
| 328 | { |
Andrew Lunn | f6d9758 | 2019-02-23 17:43:56 +0100 | [diff] [blame] | 329 | static struct lock_class_key lock_key; |
| 330 | static struct lock_class_key request_key; |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 331 | int err; |
| 332 | |
| 333 | err = mv88e6xxx_g1_irq_setup_common(chip); |
| 334 | if (err) |
| 335 | return err; |
| 336 | |
Andrew Lunn | f6d9758 | 2019-02-23 17:43:56 +0100 | [diff] [blame] | 337 | /* These lock classes tells lockdep that global 1 irqs are in |
| 338 | * a different category than their parent GPIO, so it won't |
| 339 | * report false recursion. |
| 340 | */ |
| 341 | irq_set_lockdep_class(chip->irq, &lock_key, &request_key); |
| 342 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 343 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 344 | err = request_threaded_irq(chip->irq, NULL, |
| 345 | mv88e6xxx_g1_irq_thread_fn, |
Marek Behún | 0340376 | 2018-08-30 02:13:50 +0200 | [diff] [blame] | 346 | IRQF_ONESHOT | IRQF_SHARED, |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 347 | dev_name(chip->dev), chip); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 348 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 349 | if (err) |
| 350 | mv88e6xxx_g1_irq_free_common(chip); |
| 351 | |
| 352 | return err; |
| 353 | } |
| 354 | |
| 355 | static void mv88e6xxx_irq_poll(struct kthread_work *work) |
| 356 | { |
| 357 | struct mv88e6xxx_chip *chip = container_of(work, |
| 358 | struct mv88e6xxx_chip, |
| 359 | irq_poll_work.work); |
| 360 | mv88e6xxx_g1_irq_thread_work(chip); |
| 361 | |
| 362 | kthread_queue_delayed_work(chip->kworker, &chip->irq_poll_work, |
| 363 | msecs_to_jiffies(100)); |
| 364 | } |
| 365 | |
| 366 | static int mv88e6xxx_irq_poll_setup(struct mv88e6xxx_chip *chip) |
| 367 | { |
| 368 | int err; |
| 369 | |
| 370 | err = mv88e6xxx_g1_irq_setup_common(chip); |
| 371 | if (err) |
| 372 | return err; |
| 373 | |
| 374 | kthread_init_delayed_work(&chip->irq_poll_work, |
| 375 | mv88e6xxx_irq_poll); |
| 376 | |
Florian Fainelli | 3f8b869 | 2019-02-21 20:09:27 -0800 | [diff] [blame] | 377 | chip->kworker = kthread_create_worker(0, "%s", dev_name(chip->dev)); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 378 | if (IS_ERR(chip->kworker)) |
| 379 | return PTR_ERR(chip->kworker); |
| 380 | |
| 381 | kthread_queue_delayed_work(chip->kworker, &chip->irq_poll_work, |
| 382 | msecs_to_jiffies(100)); |
| 383 | |
| 384 | return 0; |
| 385 | } |
| 386 | |
| 387 | static void mv88e6xxx_irq_poll_free(struct mv88e6xxx_chip *chip) |
| 388 | { |
| 389 | kthread_cancel_delayed_work_sync(&chip->irq_poll_work); |
| 390 | kthread_destroy_worker(chip->kworker); |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame] | 391 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 392 | mv88e6xxx_reg_lock(chip); |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame] | 393 | mv88e6xxx_g1_irq_free_common(chip); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 394 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 395 | } |
| 396 | |
Heiner Kallweit | 72d8b4f | 2019-03-01 20:41:00 +0100 | [diff] [blame] | 397 | int mv88e6xxx_port_setup_mac(struct mv88e6xxx_chip *chip, int port, int link, |
| 398 | int speed, int duplex, int pause, |
| 399 | phy_interface_t mode) |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 400 | { |
Andrew Lunn | a26deec | 2019-04-18 03:11:39 +0200 | [diff] [blame] | 401 | struct phylink_link_state state; |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 402 | int err; |
| 403 | |
| 404 | if (!chip->info->ops->port_set_link) |
| 405 | return 0; |
| 406 | |
Andrew Lunn | a26deec | 2019-04-18 03:11:39 +0200 | [diff] [blame] | 407 | if (!chip->info->ops->port_link_state) |
| 408 | return 0; |
| 409 | |
| 410 | err = chip->info->ops->port_link_state(chip, port, &state); |
| 411 | if (err) |
| 412 | return err; |
| 413 | |
| 414 | /* Has anything actually changed? We don't expect the |
| 415 | * interface mode to change without one of the other |
| 416 | * parameters also changing |
| 417 | */ |
| 418 | if (state.link == link && |
| 419 | state.speed == speed && |
Marek Behún | 927441a | 2019-08-14 16:40:24 +0200 | [diff] [blame] | 420 | state.duplex == duplex && |
| 421 | (state.interface == mode || |
| 422 | state.interface == PHY_INTERFACE_MODE_NA)) |
Andrew Lunn | a26deec | 2019-04-18 03:11:39 +0200 | [diff] [blame] | 423 | return 0; |
| 424 | |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 425 | /* Port's MAC control must not be changed unless the link is down */ |
Hubert Feurstein | 43c8e0a | 2019-07-30 12:11:42 +0200 | [diff] [blame] | 426 | err = chip->info->ops->port_set_link(chip, port, LINK_FORCED_DOWN); |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 427 | if (err) |
| 428 | return err; |
| 429 | |
| 430 | if (chip->info->ops->port_set_speed) { |
| 431 | err = chip->info->ops->port_set_speed(chip, port, speed); |
| 432 | if (err && err != -EOPNOTSUPP) |
| 433 | goto restore_link; |
| 434 | } |
| 435 | |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 436 | if (speed == SPEED_MAX && chip->info->ops->port_max_speed_mode) |
| 437 | mode = chip->info->ops->port_max_speed_mode(port); |
| 438 | |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 439 | if (chip->info->ops->port_set_pause) { |
| 440 | err = chip->info->ops->port_set_pause(chip, port, pause); |
| 441 | if (err) |
| 442 | goto restore_link; |
| 443 | } |
| 444 | |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 445 | if (chip->info->ops->port_set_duplex) { |
| 446 | err = chip->info->ops->port_set_duplex(chip, port, duplex); |
| 447 | if (err && err != -EOPNOTSUPP) |
| 448 | goto restore_link; |
| 449 | } |
| 450 | |
| 451 | if (chip->info->ops->port_set_rgmii_delay) { |
| 452 | err = chip->info->ops->port_set_rgmii_delay(chip, port, mode); |
| 453 | if (err && err != -EOPNOTSUPP) |
| 454 | goto restore_link; |
| 455 | } |
| 456 | |
Andrew Lunn | f39908d | 2017-02-04 20:02:50 +0100 | [diff] [blame] | 457 | if (chip->info->ops->port_set_cmode) { |
| 458 | err = chip->info->ops->port_set_cmode(chip, port, mode); |
| 459 | if (err && err != -EOPNOTSUPP) |
| 460 | goto restore_link; |
| 461 | } |
| 462 | |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 463 | err = 0; |
| 464 | restore_link: |
| 465 | if (chip->info->ops->port_set_link(chip, port, link)) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 466 | 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] | 467 | |
| 468 | return err; |
| 469 | } |
| 470 | |
Marek Vasut | d700ec4 | 2018-09-12 00:15:24 +0200 | [diff] [blame] | 471 | static int mv88e6xxx_phy_is_internal(struct dsa_switch *ds, int port) |
| 472 | { |
| 473 | struct mv88e6xxx_chip *chip = ds->priv; |
| 474 | |
| 475 | return port < chip->info->num_internal_phys; |
| 476 | } |
| 477 | |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 478 | static void mv88e6065_phylink_validate(struct mv88e6xxx_chip *chip, int port, |
| 479 | unsigned long *mask, |
| 480 | struct phylink_link_state *state) |
| 481 | { |
| 482 | if (!phy_interface_mode_is_8023z(state->interface)) { |
| 483 | /* 10M and 100M are only supported in non-802.3z mode */ |
| 484 | phylink_set(mask, 10baseT_Half); |
| 485 | phylink_set(mask, 10baseT_Full); |
| 486 | phylink_set(mask, 100baseT_Half); |
| 487 | phylink_set(mask, 100baseT_Full); |
| 488 | } |
| 489 | } |
| 490 | |
| 491 | static void mv88e6185_phylink_validate(struct mv88e6xxx_chip *chip, int port, |
| 492 | unsigned long *mask, |
| 493 | struct phylink_link_state *state) |
| 494 | { |
| 495 | /* FIXME: if the port is in 1000Base-X mode, then it only supports |
| 496 | * 1000M FD speeds. In this case, CMODE will indicate 5. |
| 497 | */ |
| 498 | phylink_set(mask, 1000baseT_Full); |
| 499 | phylink_set(mask, 1000baseX_Full); |
| 500 | |
| 501 | mv88e6065_phylink_validate(chip, port, mask, state); |
| 502 | } |
| 503 | |
Marek Behún | e3af71a | 2019-02-25 12:39:55 +0100 | [diff] [blame] | 504 | static void mv88e6341_phylink_validate(struct mv88e6xxx_chip *chip, int port, |
| 505 | unsigned long *mask, |
| 506 | struct phylink_link_state *state) |
| 507 | { |
| 508 | if (port >= 5) |
| 509 | phylink_set(mask, 2500baseX_Full); |
| 510 | |
| 511 | /* No ethtool bits for 200Mbps */ |
| 512 | phylink_set(mask, 1000baseT_Full); |
| 513 | phylink_set(mask, 1000baseX_Full); |
| 514 | |
| 515 | mv88e6065_phylink_validate(chip, port, mask, state); |
| 516 | } |
| 517 | |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 518 | static void mv88e6352_phylink_validate(struct mv88e6xxx_chip *chip, int port, |
| 519 | unsigned long *mask, |
| 520 | struct phylink_link_state *state) |
| 521 | { |
| 522 | /* No ethtool bits for 200Mbps */ |
| 523 | phylink_set(mask, 1000baseT_Full); |
| 524 | phylink_set(mask, 1000baseX_Full); |
| 525 | |
| 526 | mv88e6065_phylink_validate(chip, port, mask, state); |
| 527 | } |
| 528 | |
| 529 | static void mv88e6390_phylink_validate(struct mv88e6xxx_chip *chip, int port, |
| 530 | unsigned long *mask, |
| 531 | struct phylink_link_state *state) |
| 532 | { |
Andrew Lunn | ec26016 | 2019-02-08 22:25:44 +0100 | [diff] [blame] | 533 | if (port >= 9) { |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 534 | phylink_set(mask, 2500baseX_Full); |
Andrew Lunn | ec26016 | 2019-02-08 22:25:44 +0100 | [diff] [blame] | 535 | phylink_set(mask, 2500baseT_Full); |
| 536 | } |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 537 | |
| 538 | /* No ethtool bits for 200Mbps */ |
| 539 | phylink_set(mask, 1000baseT_Full); |
| 540 | phylink_set(mask, 1000baseX_Full); |
| 541 | |
| 542 | mv88e6065_phylink_validate(chip, port, mask, state); |
| 543 | } |
| 544 | |
| 545 | static void mv88e6390x_phylink_validate(struct mv88e6xxx_chip *chip, int port, |
| 546 | unsigned long *mask, |
| 547 | struct phylink_link_state *state) |
| 548 | { |
| 549 | if (port >= 9) { |
| 550 | phylink_set(mask, 10000baseT_Full); |
| 551 | phylink_set(mask, 10000baseKR_Full); |
| 552 | } |
| 553 | |
| 554 | mv88e6390_phylink_validate(chip, port, mask, state); |
| 555 | } |
| 556 | |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 557 | static void mv88e6xxx_validate(struct dsa_switch *ds, int port, |
| 558 | unsigned long *supported, |
| 559 | struct phylink_link_state *state) |
| 560 | { |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 561 | __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; |
| 562 | struct mv88e6xxx_chip *chip = ds->priv; |
| 563 | |
| 564 | /* Allow all the expected bits */ |
| 565 | phylink_set(mask, Autoneg); |
| 566 | phylink_set(mask, Pause); |
| 567 | phylink_set_port_modes(mask); |
| 568 | |
| 569 | if (chip->info->ops->phylink_validate) |
| 570 | chip->info->ops->phylink_validate(chip, port, mask, state); |
| 571 | |
| 572 | bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS); |
| 573 | bitmap_and(state->advertising, state->advertising, mask, |
| 574 | __ETHTOOL_LINK_MODE_MASK_NBITS); |
| 575 | |
| 576 | /* We can only operate at 2500BaseX or 1000BaseX. If requested |
| 577 | * to advertise both, only report advertising at 2500BaseX. |
| 578 | */ |
| 579 | phylink_helper_basex_speed(state); |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 580 | } |
| 581 | |
| 582 | static int mv88e6xxx_link_state(struct dsa_switch *ds, int port, |
| 583 | struct phylink_link_state *state) |
| 584 | { |
| 585 | struct mv88e6xxx_chip *chip = ds->priv; |
| 586 | int err; |
| 587 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 588 | mv88e6xxx_reg_lock(chip); |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 589 | if (chip->info->ops->port_link_state) |
| 590 | err = chip->info->ops->port_link_state(chip, port, state); |
| 591 | else |
| 592 | err = -EOPNOTSUPP; |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 593 | mv88e6xxx_reg_unlock(chip); |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 594 | |
| 595 | return err; |
| 596 | } |
| 597 | |
| 598 | static void mv88e6xxx_mac_config(struct dsa_switch *ds, int port, |
| 599 | unsigned int mode, |
| 600 | const struct phylink_link_state *state) |
| 601 | { |
| 602 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 603 | int speed, duplex, link, pause, err; |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 604 | |
Marek Vasut | d700ec4 | 2018-09-12 00:15:24 +0200 | [diff] [blame] | 605 | if ((mode == MLO_AN_PHY) && mv88e6xxx_phy_is_internal(ds, port)) |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 606 | return; |
| 607 | |
| 608 | if (mode == MLO_AN_FIXED) { |
| 609 | link = LINK_FORCED_UP; |
| 610 | speed = state->speed; |
| 611 | duplex = state->duplex; |
Marek Vasut | d700ec4 | 2018-09-12 00:15:24 +0200 | [diff] [blame] | 612 | } else if (!mv88e6xxx_phy_is_internal(ds, port)) { |
| 613 | link = state->link; |
| 614 | speed = state->speed; |
| 615 | duplex = state->duplex; |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 616 | } else { |
| 617 | speed = SPEED_UNFORCED; |
| 618 | duplex = DUPLEX_UNFORCED; |
| 619 | link = LINK_UNFORCED; |
| 620 | } |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 621 | pause = !!phylink_test(state->advertising, Pause); |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 622 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 623 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 624 | err = mv88e6xxx_port_setup_mac(chip, port, link, speed, duplex, pause, |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 625 | state->interface); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 626 | mv88e6xxx_reg_unlock(chip); |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 627 | |
| 628 | if (err && err != -EOPNOTSUPP) |
| 629 | dev_err(ds->dev, "p%d: failed to configure MAC\n", port); |
| 630 | } |
| 631 | |
| 632 | static void mv88e6xxx_mac_link_force(struct dsa_switch *ds, int port, int link) |
| 633 | { |
| 634 | struct mv88e6xxx_chip *chip = ds->priv; |
| 635 | int err; |
| 636 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 637 | mv88e6xxx_reg_lock(chip); |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 638 | err = chip->info->ops->port_set_link(chip, port, link); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 639 | mv88e6xxx_reg_unlock(chip); |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 640 | |
| 641 | if (err) |
| 642 | dev_err(chip->dev, "p%d: failed to force MAC link\n", port); |
| 643 | } |
| 644 | |
| 645 | static void mv88e6xxx_mac_link_down(struct dsa_switch *ds, int port, |
| 646 | unsigned int mode, |
| 647 | phy_interface_t interface) |
| 648 | { |
| 649 | if (mode == MLO_AN_FIXED) |
| 650 | mv88e6xxx_mac_link_force(ds, port, LINK_FORCED_DOWN); |
| 651 | } |
| 652 | |
| 653 | static void mv88e6xxx_mac_link_up(struct dsa_switch *ds, int port, |
| 654 | unsigned int mode, phy_interface_t interface, |
| 655 | struct phy_device *phydev) |
| 656 | { |
| 657 | if (mode == MLO_AN_FIXED) |
| 658 | mv88e6xxx_mac_link_force(ds, port, LINK_FORCED_UP); |
| 659 | } |
| 660 | |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 661 | static int mv88e6xxx_stats_snapshot(struct mv88e6xxx_chip *chip, int port) |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 662 | { |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 663 | if (!chip->info->ops->stats_snapshot) |
| 664 | return -EOPNOTSUPP; |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 665 | |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 666 | return chip->info->ops->stats_snapshot(chip, port); |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 667 | } |
| 668 | |
Andrew Lunn | e413e7e | 2015-04-02 04:06:38 +0200 | [diff] [blame] | 669 | static struct mv88e6xxx_hw_stat mv88e6xxx_hw_stats[] = { |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 670 | { "in_good_octets", 8, 0x00, STATS_TYPE_BANK0, }, |
| 671 | { "in_bad_octets", 4, 0x02, STATS_TYPE_BANK0, }, |
| 672 | { "in_unicast", 4, 0x04, STATS_TYPE_BANK0, }, |
| 673 | { "in_broadcasts", 4, 0x06, STATS_TYPE_BANK0, }, |
| 674 | { "in_multicasts", 4, 0x07, STATS_TYPE_BANK0, }, |
| 675 | { "in_pause", 4, 0x16, STATS_TYPE_BANK0, }, |
| 676 | { "in_undersize", 4, 0x18, STATS_TYPE_BANK0, }, |
| 677 | { "in_fragments", 4, 0x19, STATS_TYPE_BANK0, }, |
| 678 | { "in_oversize", 4, 0x1a, STATS_TYPE_BANK0, }, |
| 679 | { "in_jabber", 4, 0x1b, STATS_TYPE_BANK0, }, |
| 680 | { "in_rx_error", 4, 0x1c, STATS_TYPE_BANK0, }, |
| 681 | { "in_fcs_error", 4, 0x1d, STATS_TYPE_BANK0, }, |
| 682 | { "out_octets", 8, 0x0e, STATS_TYPE_BANK0, }, |
| 683 | { "out_unicast", 4, 0x10, STATS_TYPE_BANK0, }, |
| 684 | { "out_broadcasts", 4, 0x13, STATS_TYPE_BANK0, }, |
| 685 | { "out_multicasts", 4, 0x12, STATS_TYPE_BANK0, }, |
| 686 | { "out_pause", 4, 0x15, STATS_TYPE_BANK0, }, |
| 687 | { "excessive", 4, 0x11, STATS_TYPE_BANK0, }, |
| 688 | { "collisions", 4, 0x1e, STATS_TYPE_BANK0, }, |
| 689 | { "deferred", 4, 0x05, STATS_TYPE_BANK0, }, |
| 690 | { "single", 4, 0x14, STATS_TYPE_BANK0, }, |
| 691 | { "multiple", 4, 0x17, STATS_TYPE_BANK0, }, |
| 692 | { "out_fcs_error", 4, 0x03, STATS_TYPE_BANK0, }, |
| 693 | { "late", 4, 0x1f, STATS_TYPE_BANK0, }, |
| 694 | { "hist_64bytes", 4, 0x08, STATS_TYPE_BANK0, }, |
| 695 | { "hist_65_127bytes", 4, 0x09, STATS_TYPE_BANK0, }, |
| 696 | { "hist_128_255bytes", 4, 0x0a, STATS_TYPE_BANK0, }, |
| 697 | { "hist_256_511bytes", 4, 0x0b, STATS_TYPE_BANK0, }, |
| 698 | { "hist_512_1023bytes", 4, 0x0c, STATS_TYPE_BANK0, }, |
| 699 | { "hist_1024_max_bytes", 4, 0x0d, STATS_TYPE_BANK0, }, |
| 700 | { "sw_in_discards", 4, 0x10, STATS_TYPE_PORT, }, |
| 701 | { "sw_in_filtered", 2, 0x12, STATS_TYPE_PORT, }, |
| 702 | { "sw_out_filtered", 2, 0x13, STATS_TYPE_PORT, }, |
| 703 | { "in_discards", 4, 0x00, STATS_TYPE_BANK1, }, |
| 704 | { "in_filtered", 4, 0x01, STATS_TYPE_BANK1, }, |
| 705 | { "in_accepted", 4, 0x02, STATS_TYPE_BANK1, }, |
| 706 | { "in_bad_accepted", 4, 0x03, STATS_TYPE_BANK1, }, |
| 707 | { "in_good_avb_class_a", 4, 0x04, STATS_TYPE_BANK1, }, |
| 708 | { "in_good_avb_class_b", 4, 0x05, STATS_TYPE_BANK1, }, |
| 709 | { "in_bad_avb_class_a", 4, 0x06, STATS_TYPE_BANK1, }, |
| 710 | { "in_bad_avb_class_b", 4, 0x07, STATS_TYPE_BANK1, }, |
| 711 | { "tcam_counter_0", 4, 0x08, STATS_TYPE_BANK1, }, |
| 712 | { "tcam_counter_1", 4, 0x09, STATS_TYPE_BANK1, }, |
| 713 | { "tcam_counter_2", 4, 0x0a, STATS_TYPE_BANK1, }, |
| 714 | { "tcam_counter_3", 4, 0x0b, STATS_TYPE_BANK1, }, |
| 715 | { "in_da_unknown", 4, 0x0e, STATS_TYPE_BANK1, }, |
| 716 | { "in_management", 4, 0x0f, STATS_TYPE_BANK1, }, |
| 717 | { "out_queue_0", 4, 0x10, STATS_TYPE_BANK1, }, |
| 718 | { "out_queue_1", 4, 0x11, STATS_TYPE_BANK1, }, |
| 719 | { "out_queue_2", 4, 0x12, STATS_TYPE_BANK1, }, |
| 720 | { "out_queue_3", 4, 0x13, STATS_TYPE_BANK1, }, |
| 721 | { "out_queue_4", 4, 0x14, STATS_TYPE_BANK1, }, |
| 722 | { "out_queue_5", 4, 0x15, STATS_TYPE_BANK1, }, |
| 723 | { "out_queue_6", 4, 0x16, STATS_TYPE_BANK1, }, |
| 724 | { "out_queue_7", 4, 0x17, STATS_TYPE_BANK1, }, |
| 725 | { "out_cut_through", 4, 0x18, STATS_TYPE_BANK1, }, |
| 726 | { "out_octets_a", 4, 0x1a, STATS_TYPE_BANK1, }, |
| 727 | { "out_octets_b", 4, 0x1b, STATS_TYPE_BANK1, }, |
| 728 | { "out_management", 4, 0x1f, STATS_TYPE_BANK1, }, |
Andrew Lunn | e413e7e | 2015-04-02 04:06:38 +0200 | [diff] [blame] | 729 | }; |
| 730 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 731 | static uint64_t _mv88e6xxx_get_ethtool_stat(struct mv88e6xxx_chip *chip, |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 732 | struct mv88e6xxx_hw_stat *s, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 733 | int port, u16 bank1_select, |
| 734 | u16 histogram) |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 735 | { |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 736 | u32 low; |
| 737 | u32 high = 0; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 738 | u16 reg = 0; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 739 | int err; |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 740 | u64 value; |
| 741 | |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 742 | switch (s->type) { |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 743 | case STATS_TYPE_PORT: |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 744 | err = mv88e6xxx_port_read(chip, port, s->reg, ®); |
| 745 | if (err) |
Jisheng Zhang | 6c3442f | 2018-04-27 16:18:58 +0800 | [diff] [blame] | 746 | return U64_MAX; |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 747 | |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 748 | low = reg; |
Andrew Lunn | cda9f4a | 2018-03-01 02:02:31 +0100 | [diff] [blame] | 749 | if (s->size == 4) { |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 750 | err = mv88e6xxx_port_read(chip, port, s->reg + 1, ®); |
| 751 | if (err) |
Jisheng Zhang | 6c3442f | 2018-04-27 16:18:58 +0800 | [diff] [blame] | 752 | return U64_MAX; |
Rasmus Villemoes | 84b3fd1 | 2019-05-29 07:02:11 +0000 | [diff] [blame] | 753 | low |= ((u32)reg) << 16; |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 754 | } |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 755 | break; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 756 | case STATS_TYPE_BANK1: |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 757 | reg = bank1_select; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 758 | /* fall through */ |
| 759 | case STATS_TYPE_BANK0: |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 760 | reg |= s->reg | histogram; |
Andrew Lunn | 7f9ef3a | 2016-11-21 23:27:05 +0100 | [diff] [blame] | 761 | mv88e6xxx_g1_stats_read(chip, reg, &low); |
Andrew Lunn | cda9f4a | 2018-03-01 02:02:31 +0100 | [diff] [blame] | 762 | if (s->size == 8) |
Andrew Lunn | 7f9ef3a | 2016-11-21 23:27:05 +0100 | [diff] [blame] | 763 | mv88e6xxx_g1_stats_read(chip, reg + 1, &high); |
Gustavo A. R. Silva | 9fc3e4d | 2017-05-11 22:11:29 -0500 | [diff] [blame] | 764 | break; |
| 765 | default: |
Jisheng Zhang | 6c3442f | 2018-04-27 16:18:58 +0800 | [diff] [blame] | 766 | return U64_MAX; |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 767 | } |
Andrew Lunn | 6e46e2d | 2019-02-28 18:14:03 +0100 | [diff] [blame] | 768 | value = (((u64)high) << 32) | low; |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 769 | return value; |
| 770 | } |
| 771 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 772 | static int mv88e6xxx_stats_get_strings(struct mv88e6xxx_chip *chip, |
| 773 | uint8_t *data, int types) |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 774 | { |
| 775 | struct mv88e6xxx_hw_stat *stat; |
| 776 | int i, j; |
| 777 | |
| 778 | for (i = 0, j = 0; i < ARRAY_SIZE(mv88e6xxx_hw_stats); i++) { |
| 779 | stat = &mv88e6xxx_hw_stats[i]; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 780 | if (stat->type & types) { |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 781 | memcpy(data + j * ETH_GSTRING_LEN, stat->string, |
| 782 | ETH_GSTRING_LEN); |
| 783 | j++; |
| 784 | } |
| 785 | } |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 786 | |
| 787 | return j; |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 788 | } |
| 789 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 790 | static int mv88e6095_stats_get_strings(struct mv88e6xxx_chip *chip, |
| 791 | uint8_t *data) |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 792 | { |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 793 | return mv88e6xxx_stats_get_strings(chip, data, |
| 794 | STATS_TYPE_BANK0 | STATS_TYPE_PORT); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 795 | } |
| 796 | |
Rasmus Villemoes | 1f71836 | 2019-06-04 07:34:32 +0000 | [diff] [blame] | 797 | static int mv88e6250_stats_get_strings(struct mv88e6xxx_chip *chip, |
| 798 | uint8_t *data) |
| 799 | { |
| 800 | return mv88e6xxx_stats_get_strings(chip, data, STATS_TYPE_BANK0); |
| 801 | } |
| 802 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 803 | static int mv88e6320_stats_get_strings(struct mv88e6xxx_chip *chip, |
| 804 | uint8_t *data) |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 805 | { |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 806 | return mv88e6xxx_stats_get_strings(chip, data, |
| 807 | STATS_TYPE_BANK0 | STATS_TYPE_BANK1); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 808 | } |
| 809 | |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 810 | static const uint8_t *mv88e6xxx_atu_vtu_stats_strings[] = { |
| 811 | "atu_member_violation", |
| 812 | "atu_miss_violation", |
| 813 | "atu_full_violation", |
| 814 | "vtu_member_violation", |
| 815 | "vtu_miss_violation", |
| 816 | }; |
| 817 | |
| 818 | static void mv88e6xxx_atu_vtu_get_strings(uint8_t *data) |
| 819 | { |
| 820 | unsigned int i; |
| 821 | |
| 822 | for (i = 0; i < ARRAY_SIZE(mv88e6xxx_atu_vtu_stats_strings); i++) |
| 823 | strlcpy(data + i * ETH_GSTRING_LEN, |
| 824 | mv88e6xxx_atu_vtu_stats_strings[i], |
| 825 | ETH_GSTRING_LEN); |
| 826 | } |
| 827 | |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 828 | static void mv88e6xxx_get_strings(struct dsa_switch *ds, int port, |
Florian Fainelli | 89f0904 | 2018-04-25 12:12:50 -0700 | [diff] [blame] | 829 | u32 stringset, uint8_t *data) |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 830 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 831 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 832 | int count = 0; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 833 | |
Florian Fainelli | 89f0904 | 2018-04-25 12:12:50 -0700 | [diff] [blame] | 834 | if (stringset != ETH_SS_STATS) |
| 835 | return; |
| 836 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 837 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | c6c8cd5 | 2018-03-01 02:02:28 +0100 | [diff] [blame] | 838 | |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 839 | if (chip->info->ops->stats_get_strings) |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 840 | count = chip->info->ops->stats_get_strings(chip, data); |
| 841 | |
| 842 | if (chip->info->ops->serdes_get_strings) { |
| 843 | data += count * ETH_GSTRING_LEN; |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 844 | count = chip->info->ops->serdes_get_strings(chip, port, data); |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 845 | } |
Andrew Lunn | c6c8cd5 | 2018-03-01 02:02:28 +0100 | [diff] [blame] | 846 | |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 847 | data += count * ETH_GSTRING_LEN; |
| 848 | mv88e6xxx_atu_vtu_get_strings(data); |
| 849 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 850 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 851 | } |
| 852 | |
| 853 | static int mv88e6xxx_stats_get_sset_count(struct mv88e6xxx_chip *chip, |
| 854 | int types) |
| 855 | { |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 856 | struct mv88e6xxx_hw_stat *stat; |
| 857 | int i, j; |
| 858 | |
| 859 | for (i = 0, j = 0; i < ARRAY_SIZE(mv88e6xxx_hw_stats); i++) { |
| 860 | stat = &mv88e6xxx_hw_stats[i]; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 861 | if (stat->type & types) |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 862 | j++; |
| 863 | } |
| 864 | return j; |
| 865 | } |
| 866 | |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 867 | static int mv88e6095_stats_get_sset_count(struct mv88e6xxx_chip *chip) |
| 868 | { |
| 869 | return mv88e6xxx_stats_get_sset_count(chip, STATS_TYPE_BANK0 | |
| 870 | STATS_TYPE_PORT); |
| 871 | } |
| 872 | |
Rasmus Villemoes | 1f71836 | 2019-06-04 07:34:32 +0000 | [diff] [blame] | 873 | static int mv88e6250_stats_get_sset_count(struct mv88e6xxx_chip *chip) |
| 874 | { |
| 875 | return mv88e6xxx_stats_get_sset_count(chip, STATS_TYPE_BANK0); |
| 876 | } |
| 877 | |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 878 | static int mv88e6320_stats_get_sset_count(struct mv88e6xxx_chip *chip) |
| 879 | { |
| 880 | return mv88e6xxx_stats_get_sset_count(chip, STATS_TYPE_BANK0 | |
| 881 | STATS_TYPE_BANK1); |
| 882 | } |
| 883 | |
Florian Fainelli | 89f0904 | 2018-04-25 12:12:50 -0700 | [diff] [blame] | 884 | 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] | 885 | { |
| 886 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 887 | int serdes_count = 0; |
| 888 | int count = 0; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 889 | |
Florian Fainelli | 89f0904 | 2018-04-25 12:12:50 -0700 | [diff] [blame] | 890 | if (sset != ETH_SS_STATS) |
| 891 | return 0; |
| 892 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 893 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 894 | if (chip->info->ops->stats_get_sset_count) |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 895 | count = chip->info->ops->stats_get_sset_count(chip); |
| 896 | if (count < 0) |
| 897 | goto out; |
| 898 | |
| 899 | if (chip->info->ops->serdes_get_sset_count) |
| 900 | serdes_count = chip->info->ops->serdes_get_sset_count(chip, |
| 901 | port); |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 902 | if (serdes_count < 0) { |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 903 | count = serdes_count; |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 904 | goto out; |
| 905 | } |
| 906 | count += serdes_count; |
| 907 | count += ARRAY_SIZE(mv88e6xxx_atu_vtu_stats_strings); |
| 908 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 909 | out: |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 910 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 911 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 912 | return count; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 913 | } |
| 914 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 915 | static int mv88e6xxx_stats_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 916 | uint64_t *data, int types, |
| 917 | u16 bank1_select, u16 histogram) |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 918 | { |
| 919 | struct mv88e6xxx_hw_stat *stat; |
| 920 | int i, j; |
| 921 | |
| 922 | for (i = 0, j = 0; i < ARRAY_SIZE(mv88e6xxx_hw_stats); i++) { |
| 923 | stat = &mv88e6xxx_hw_stats[i]; |
| 924 | if (stat->type & types) { |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 925 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 926 | data[j] = _mv88e6xxx_get_ethtool_stat(chip, stat, port, |
| 927 | bank1_select, |
| 928 | histogram); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 929 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 377cda1 | 2018-02-15 14:38:34 +0100 | [diff] [blame] | 930 | |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 931 | j++; |
| 932 | } |
| 933 | } |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 934 | return j; |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 935 | } |
| 936 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 937 | static int mv88e6095_stats_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 938 | uint64_t *data) |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 939 | { |
| 940 | return mv88e6xxx_stats_get_stats(chip, port, data, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 941 | STATS_TYPE_BANK0 | STATS_TYPE_PORT, |
Vivien Didelot | 57d1ef3 | 2017-06-15 12:14:05 -0400 | [diff] [blame] | 942 | 0, MV88E6XXX_G1_STATS_OP_HIST_RX_TX); |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 943 | } |
| 944 | |
Rasmus Villemoes | 1f71836 | 2019-06-04 07:34:32 +0000 | [diff] [blame] | 945 | static int mv88e6250_stats_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 946 | uint64_t *data) |
| 947 | { |
| 948 | return mv88e6xxx_stats_get_stats(chip, port, data, STATS_TYPE_BANK0, |
| 949 | 0, MV88E6XXX_G1_STATS_OP_HIST_RX_TX); |
| 950 | } |
| 951 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 952 | static int mv88e6320_stats_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 953 | uint64_t *data) |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 954 | { |
| 955 | return mv88e6xxx_stats_get_stats(chip, port, data, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 956 | STATS_TYPE_BANK0 | STATS_TYPE_BANK1, |
Vivien Didelot | 57d1ef3 | 2017-06-15 12:14:05 -0400 | [diff] [blame] | 957 | MV88E6XXX_G1_STATS_OP_BANK_1_BIT_9, |
| 958 | MV88E6XXX_G1_STATS_OP_HIST_RX_TX); |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 959 | } |
| 960 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 961 | static int mv88e6390_stats_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 962 | uint64_t *data) |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 963 | { |
| 964 | return mv88e6xxx_stats_get_stats(chip, port, data, |
| 965 | STATS_TYPE_BANK0 | STATS_TYPE_BANK1, |
Vivien Didelot | 57d1ef3 | 2017-06-15 12:14:05 -0400 | [diff] [blame] | 966 | MV88E6XXX_G1_STATS_OP_BANK_1_BIT_10, |
| 967 | 0); |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 968 | } |
| 969 | |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 970 | static void mv88e6xxx_atu_vtu_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 971 | uint64_t *data) |
| 972 | { |
| 973 | *data++ = chip->ports[port].atu_member_violation; |
| 974 | *data++ = chip->ports[port].atu_miss_violation; |
| 975 | *data++ = chip->ports[port].atu_full_violation; |
| 976 | *data++ = chip->ports[port].vtu_member_violation; |
| 977 | *data++ = chip->ports[port].vtu_miss_violation; |
| 978 | } |
| 979 | |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 980 | static void mv88e6xxx_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 981 | uint64_t *data) |
| 982 | { |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 983 | int count = 0; |
| 984 | |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 985 | if (chip->info->ops->stats_get_stats) |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 986 | count = chip->info->ops->stats_get_stats(chip, port, data); |
| 987 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 988 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 989 | if (chip->info->ops->serdes_get_stats) { |
| 990 | data += count; |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 991 | count = chip->info->ops->serdes_get_stats(chip, port, data); |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 992 | } |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 993 | data += count; |
| 994 | mv88e6xxx_atu_vtu_get_stats(chip, port, data); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 995 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 996 | } |
| 997 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 998 | static void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port, |
| 999 | uint64_t *data) |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1000 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1001 | struct mv88e6xxx_chip *chip = ds->priv; |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1002 | int ret; |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1003 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1004 | mv88e6xxx_reg_lock(chip); |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1005 | |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 1006 | ret = mv88e6xxx_stats_snapshot(chip, port); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1007 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 377cda1 | 2018-02-15 14:38:34 +0100 | [diff] [blame] | 1008 | |
| 1009 | if (ret < 0) |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1010 | return; |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 1011 | |
| 1012 | mv88e6xxx_get_stats(chip, port, data); |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1013 | |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1014 | } |
Ben Hutchings | 98e6730 | 2011-11-25 14:36:19 +0000 | [diff] [blame] | 1015 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1016 | static int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port) |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1017 | { |
| 1018 | return 32 * sizeof(u16); |
| 1019 | } |
| 1020 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1021 | static void mv88e6xxx_get_regs(struct dsa_switch *ds, int port, |
| 1022 | struct ethtool_regs *regs, void *_p) |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1023 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1024 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 1025 | int err; |
| 1026 | u16 reg; |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1027 | u16 *p = _p; |
| 1028 | int i; |
| 1029 | |
Vivien Didelot | a5f3932 | 2018-12-17 16:05:21 -0500 | [diff] [blame] | 1030 | regs->version = chip->info->prod_num; |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1031 | |
| 1032 | memset(p, 0xff, 32 * sizeof(u16)); |
| 1033 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1034 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 2306251 | 2016-05-09 13:22:45 -0400 | [diff] [blame] | 1035 | |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1036 | for (i = 0; i < 32; i++) { |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1037 | |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 1038 | err = mv88e6xxx_port_read(chip, port, i, ®); |
| 1039 | if (!err) |
| 1040 | p[i] = reg; |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1041 | } |
Vivien Didelot | 2306251 | 2016-05-09 13:22:45 -0400 | [diff] [blame] | 1042 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1043 | mv88e6xxx_reg_unlock(chip); |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1044 | } |
| 1045 | |
Vivien Didelot | 08f5006 | 2017-08-01 16:32:41 -0400 | [diff] [blame] | 1046 | static int mv88e6xxx_get_mac_eee(struct dsa_switch *ds, int port, |
| 1047 | struct ethtool_eee *e) |
Guenter Roeck | 11b3b45 | 2015-03-06 22:23:51 -0800 | [diff] [blame] | 1048 | { |
Vivien Didelot | 5480db6 | 2017-08-01 16:32:40 -0400 | [diff] [blame] | 1049 | /* Nothing to do on the port's MAC */ |
| 1050 | return 0; |
Guenter Roeck | 11b3b45 | 2015-03-06 22:23:51 -0800 | [diff] [blame] | 1051 | } |
| 1052 | |
Vivien Didelot | 08f5006 | 2017-08-01 16:32:41 -0400 | [diff] [blame] | 1053 | static int mv88e6xxx_set_mac_eee(struct dsa_switch *ds, int port, |
| 1054 | struct ethtool_eee *e) |
Guenter Roeck | 11b3b45 | 2015-03-06 22:23:51 -0800 | [diff] [blame] | 1055 | { |
Vivien Didelot | 5480db6 | 2017-08-01 16:32:40 -0400 | [diff] [blame] | 1056 | /* Nothing to do on the port's MAC */ |
| 1057 | return 0; |
Guenter Roeck | 11b3b45 | 2015-03-06 22:23:51 -0800 | [diff] [blame] | 1058 | } |
| 1059 | |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1060 | 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] | 1061 | { |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1062 | struct dsa_switch *ds = NULL; |
| 1063 | struct net_device *br; |
| 1064 | u16 pvlan; |
Vivien Didelot | b7666ef | 2016-02-26 13:16:06 -0500 | [diff] [blame] | 1065 | int i; |
| 1066 | |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1067 | if (dev < DSA_MAX_SWITCHES) |
| 1068 | ds = chip->ds->dst->ds[dev]; |
Vivien Didelot | b7666ef | 2016-02-26 13:16:06 -0500 | [diff] [blame] | 1069 | |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1070 | /* Prevent frames from unknown switch or port */ |
| 1071 | if (!ds || port >= ds->num_ports) |
| 1072 | return 0; |
| 1073 | |
| 1074 | /* Frames from DSA links and CPU ports can egress any local port */ |
| 1075 | if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)) |
| 1076 | return mv88e6xxx_port_mask(chip); |
| 1077 | |
| 1078 | br = ds->ports[port].bridge_dev; |
| 1079 | pvlan = 0; |
| 1080 | |
| 1081 | /* Frames from user ports can egress any local DSA links and CPU ports, |
| 1082 | * as well as any local member of their bridge group. |
| 1083 | */ |
| 1084 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) |
| 1085 | if (dsa_is_cpu_port(chip->ds, i) || |
| 1086 | dsa_is_dsa_port(chip->ds, i) || |
Vivien Didelot | c8652c8 | 2017-10-16 11:12:19 -0400 | [diff] [blame] | 1087 | (br && dsa_to_port(chip->ds, i)->bridge_dev == br)) |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1088 | pvlan |= BIT(i); |
| 1089 | |
| 1090 | return pvlan; |
| 1091 | } |
| 1092 | |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1093 | static int mv88e6xxx_port_vlan_map(struct mv88e6xxx_chip *chip, int port) |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1094 | { |
| 1095 | u16 output_ports = mv88e6xxx_port_vlan(chip, chip->ds->index, port); |
Vivien Didelot | b7666ef | 2016-02-26 13:16:06 -0500 | [diff] [blame] | 1096 | |
| 1097 | /* prevent frames from going back out of the port they came in on */ |
| 1098 | output_ports &= ~BIT(port); |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1099 | |
Vivien Didelot | 5a7921f | 2016-11-04 03:23:28 +0100 | [diff] [blame] | 1100 | return mv88e6xxx_port_set_vlan_map(chip, port, output_ports); |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1101 | } |
| 1102 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1103 | static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port, |
| 1104 | u8 state) |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1105 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1106 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 553eb54 | 2016-05-13 20:38:23 -0400 | [diff] [blame] | 1107 | int err; |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1108 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1109 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | f894c29 | 2017-06-08 18:34:10 -0400 | [diff] [blame] | 1110 | err = mv88e6xxx_port_set_state(chip, port, state); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1111 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 553eb54 | 2016-05-13 20:38:23 -0400 | [diff] [blame] | 1112 | |
| 1113 | if (err) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 1114 | dev_err(ds->dev, "p%d: failed to update state\n", port); |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1115 | } |
| 1116 | |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 1117 | static int mv88e6xxx_pri_setup(struct mv88e6xxx_chip *chip) |
| 1118 | { |
| 1119 | int err; |
| 1120 | |
| 1121 | if (chip->info->ops->ieee_pri_map) { |
| 1122 | err = chip->info->ops->ieee_pri_map(chip); |
| 1123 | if (err) |
| 1124 | return err; |
| 1125 | } |
| 1126 | |
| 1127 | if (chip->info->ops->ip_pri_map) { |
| 1128 | err = chip->info->ops->ip_pri_map(chip); |
| 1129 | if (err) |
| 1130 | return err; |
| 1131 | } |
| 1132 | |
| 1133 | return 0; |
| 1134 | } |
| 1135 | |
Vivien Didelot | c7f047b | 2018-04-26 21:56:45 -0400 | [diff] [blame] | 1136 | static int mv88e6xxx_devmap_setup(struct mv88e6xxx_chip *chip) |
| 1137 | { |
| 1138 | int target, port; |
| 1139 | int err; |
| 1140 | |
| 1141 | if (!chip->info->global2_addr) |
| 1142 | return 0; |
| 1143 | |
| 1144 | /* Initialize the routing port to the 32 possible target devices */ |
| 1145 | for (target = 0; target < 32; target++) { |
| 1146 | port = 0x1f; |
| 1147 | if (target < DSA_MAX_SWITCHES) |
| 1148 | if (chip->ds->rtable[target] != DSA_RTABLE_NONE) |
| 1149 | port = chip->ds->rtable[target]; |
| 1150 | |
| 1151 | err = mv88e6xxx_g2_device_mapping_write(chip, target, port); |
| 1152 | if (err) |
| 1153 | return err; |
| 1154 | } |
| 1155 | |
Vivien Didelot | 02317e6 | 2018-05-09 11:38:49 -0400 | [diff] [blame] | 1156 | if (chip->info->ops->set_cascade_port) { |
| 1157 | port = MV88E6XXX_CASCADE_PORT_MULTIPLE; |
| 1158 | err = chip->info->ops->set_cascade_port(chip, port); |
| 1159 | if (err) |
| 1160 | return err; |
| 1161 | } |
| 1162 | |
Vivien Didelot | 23c9891 | 2018-05-09 11:38:50 -0400 | [diff] [blame] | 1163 | err = mv88e6xxx_g1_set_device_number(chip, chip->ds->index); |
| 1164 | if (err) |
| 1165 | return err; |
| 1166 | |
Vivien Didelot | c7f047b | 2018-04-26 21:56:45 -0400 | [diff] [blame] | 1167 | return 0; |
| 1168 | } |
| 1169 | |
Vivien Didelot | b28f872 | 2018-04-26 21:56:44 -0400 | [diff] [blame] | 1170 | static int mv88e6xxx_trunk_setup(struct mv88e6xxx_chip *chip) |
| 1171 | { |
| 1172 | /* Clear all trunk masks and mapping */ |
| 1173 | if (chip->info->global2_addr) |
| 1174 | return mv88e6xxx_g2_trunk_clear(chip); |
| 1175 | |
| 1176 | return 0; |
| 1177 | } |
| 1178 | |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 1179 | static int mv88e6xxx_rmu_setup(struct mv88e6xxx_chip *chip) |
| 1180 | { |
| 1181 | if (chip->info->ops->rmu_disable) |
| 1182 | return chip->info->ops->rmu_disable(chip); |
| 1183 | |
| 1184 | return 0; |
| 1185 | } |
| 1186 | |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 1187 | static int mv88e6xxx_pot_setup(struct mv88e6xxx_chip *chip) |
| 1188 | { |
| 1189 | if (chip->info->ops->pot_clear) |
| 1190 | return chip->info->ops->pot_clear(chip); |
| 1191 | |
| 1192 | return 0; |
| 1193 | } |
| 1194 | |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 1195 | static int mv88e6xxx_rsvd2cpu_setup(struct mv88e6xxx_chip *chip) |
| 1196 | { |
| 1197 | if (chip->info->ops->mgmt_rsvd2cpu) |
| 1198 | return chip->info->ops->mgmt_rsvd2cpu(chip); |
| 1199 | |
| 1200 | return 0; |
| 1201 | } |
| 1202 | |
Vivien Didelot | a2ac29d | 2017-03-11 16:12:49 -0500 | [diff] [blame] | 1203 | static int mv88e6xxx_atu_setup(struct mv88e6xxx_chip *chip) |
| 1204 | { |
Vivien Didelot | c3a7d4a | 2017-03-11 16:12:51 -0500 | [diff] [blame] | 1205 | int err; |
| 1206 | |
Vivien Didelot | daefc94 | 2017-03-11 16:12:54 -0500 | [diff] [blame] | 1207 | err = mv88e6xxx_g1_atu_flush(chip, 0, true); |
| 1208 | if (err) |
| 1209 | return err; |
| 1210 | |
Vivien Didelot | c3a7d4a | 2017-03-11 16:12:51 -0500 | [diff] [blame] | 1211 | err = mv88e6xxx_g1_atu_set_learn2all(chip, true); |
| 1212 | if (err) |
| 1213 | return err; |
| 1214 | |
Vivien Didelot | a2ac29d | 2017-03-11 16:12:49 -0500 | [diff] [blame] | 1215 | return mv88e6xxx_g1_atu_set_age_time(chip, 300000); |
| 1216 | } |
| 1217 | |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 1218 | static int mv88e6xxx_irl_setup(struct mv88e6xxx_chip *chip) |
| 1219 | { |
| 1220 | int port; |
| 1221 | int err; |
| 1222 | |
| 1223 | if (!chip->info->ops->irl_init_all) |
| 1224 | return 0; |
| 1225 | |
| 1226 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
| 1227 | /* Disable ingress rate limiting by resetting all per port |
| 1228 | * ingress rate limit resources to their initial state. |
| 1229 | */ |
| 1230 | err = chip->info->ops->irl_init_all(chip, port); |
| 1231 | if (err) |
| 1232 | return err; |
| 1233 | } |
| 1234 | |
| 1235 | return 0; |
| 1236 | } |
| 1237 | |
Vivien Didelot | 04a69a1 | 2017-10-13 14:18:05 -0400 | [diff] [blame] | 1238 | static int mv88e6xxx_mac_setup(struct mv88e6xxx_chip *chip) |
| 1239 | { |
| 1240 | if (chip->info->ops->set_switch_mac) { |
| 1241 | u8 addr[ETH_ALEN]; |
| 1242 | |
| 1243 | eth_random_addr(addr); |
| 1244 | |
| 1245 | return chip->info->ops->set_switch_mac(chip, addr); |
| 1246 | } |
| 1247 | |
| 1248 | return 0; |
| 1249 | } |
| 1250 | |
Vivien Didelot | 17a1594 | 2017-03-30 17:37:09 -0400 | [diff] [blame] | 1251 | static int mv88e6xxx_pvt_map(struct mv88e6xxx_chip *chip, int dev, int port) |
| 1252 | { |
| 1253 | u16 pvlan = 0; |
| 1254 | |
| 1255 | if (!mv88e6xxx_has_pvt(chip)) |
| 1256 | return -EOPNOTSUPP; |
| 1257 | |
| 1258 | /* Skip the local source device, which uses in-chip port VLAN */ |
| 1259 | if (dev != chip->ds->index) |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 1260 | pvlan = mv88e6xxx_port_vlan(chip, dev, port); |
Vivien Didelot | 17a1594 | 2017-03-30 17:37:09 -0400 | [diff] [blame] | 1261 | |
| 1262 | return mv88e6xxx_g2_pvt_write(chip, dev, port, pvlan); |
| 1263 | } |
| 1264 | |
Vivien Didelot | 8122899 | 2017-03-30 17:37:08 -0400 | [diff] [blame] | 1265 | static int mv88e6xxx_pvt_setup(struct mv88e6xxx_chip *chip) |
| 1266 | { |
Vivien Didelot | 17a1594 | 2017-03-30 17:37:09 -0400 | [diff] [blame] | 1267 | int dev, port; |
| 1268 | int err; |
| 1269 | |
Vivien Didelot | 8122899 | 2017-03-30 17:37:08 -0400 | [diff] [blame] | 1270 | if (!mv88e6xxx_has_pvt(chip)) |
| 1271 | return 0; |
| 1272 | |
| 1273 | /* Clear 5 Bit Port for usage with Marvell Link Street devices: |
| 1274 | * use 4 bits for the Src_Port/Src_Trunk and 5 bits for the Src_Dev. |
| 1275 | */ |
Vivien Didelot | 17a1594 | 2017-03-30 17:37:09 -0400 | [diff] [blame] | 1276 | err = mv88e6xxx_g2_misc_4_bit_port(chip); |
| 1277 | if (err) |
| 1278 | return err; |
| 1279 | |
| 1280 | for (dev = 0; dev < MV88E6XXX_MAX_PVT_SWITCHES; ++dev) { |
| 1281 | for (port = 0; port < MV88E6XXX_MAX_PVT_PORTS; ++port) { |
| 1282 | err = mv88e6xxx_pvt_map(chip, dev, port); |
| 1283 | if (err) |
| 1284 | return err; |
| 1285 | } |
| 1286 | } |
| 1287 | |
| 1288 | return 0; |
Vivien Didelot | 8122899 | 2017-03-30 17:37:08 -0400 | [diff] [blame] | 1289 | } |
| 1290 | |
Vivien Didelot | 749efcb | 2016-09-22 16:49:24 -0400 | [diff] [blame] | 1291 | static void mv88e6xxx_port_fast_age(struct dsa_switch *ds, int port) |
| 1292 | { |
| 1293 | struct mv88e6xxx_chip *chip = ds->priv; |
| 1294 | int err; |
| 1295 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1296 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 1297 | err = mv88e6xxx_g1_atu_remove(chip, 0, port, false); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1298 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 749efcb | 2016-09-22 16:49:24 -0400 | [diff] [blame] | 1299 | |
| 1300 | if (err) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 1301 | dev_err(ds->dev, "p%d: failed to flush ATU\n", port); |
Vivien Didelot | 749efcb | 2016-09-22 16:49:24 -0400 | [diff] [blame] | 1302 | } |
| 1303 | |
Vivien Didelot | b486d7c | 2017-05-01 14:05:13 -0400 | [diff] [blame] | 1304 | static int mv88e6xxx_vtu_setup(struct mv88e6xxx_chip *chip) |
| 1305 | { |
| 1306 | if (!chip->info->max_vid) |
| 1307 | return 0; |
| 1308 | |
| 1309 | return mv88e6xxx_g1_vtu_flush(chip); |
| 1310 | } |
| 1311 | |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 1312 | static int mv88e6xxx_vtu_getnext(struct mv88e6xxx_chip *chip, |
| 1313 | struct mv88e6xxx_vtu_entry *entry) |
| 1314 | { |
| 1315 | if (!chip->info->ops->vtu_getnext) |
| 1316 | return -EOPNOTSUPP; |
| 1317 | |
| 1318 | return chip->info->ops->vtu_getnext(chip, entry); |
| 1319 | } |
| 1320 | |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 1321 | static int mv88e6xxx_vtu_loadpurge(struct mv88e6xxx_chip *chip, |
| 1322 | struct mv88e6xxx_vtu_entry *entry) |
| 1323 | { |
| 1324 | if (!chip->info->ops->vtu_loadpurge) |
| 1325 | return -EOPNOTSUPP; |
| 1326 | |
| 1327 | return chip->info->ops->vtu_loadpurge(chip, entry); |
| 1328 | } |
| 1329 | |
Vivien Didelot | d7f435f | 2017-03-11 16:12:56 -0500 | [diff] [blame] | 1330 | static int mv88e6xxx_atu_new(struct mv88e6xxx_chip *chip, u16 *fid) |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1331 | { |
| 1332 | DECLARE_BITMAP(fid_bitmap, MV88E6XXX_N_FID); |
Vivien Didelot | 425d2d3 | 2019-08-01 14:36:34 -0400 | [diff] [blame] | 1333 | struct mv88e6xxx_vtu_entry vlan; |
Vivien Didelot | 2db9ce1 | 2016-02-26 13:16:04 -0500 | [diff] [blame] | 1334 | int i, err; |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1335 | |
| 1336 | bitmap_zero(fid_bitmap, MV88E6XXX_N_FID); |
| 1337 | |
Vivien Didelot | 2db9ce1 | 2016-02-26 13:16:04 -0500 | [diff] [blame] | 1338 | /* Set every FID bit used by the (un)bridged ports */ |
Vivien Didelot | 370b4ff | 2016-09-29 12:21:57 -0400 | [diff] [blame] | 1339 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) { |
Vivien Didelot | b4e48c5 | 2016-11-04 03:23:29 +0100 | [diff] [blame] | 1340 | err = mv88e6xxx_port_get_fid(chip, i, fid); |
Vivien Didelot | 2db9ce1 | 2016-02-26 13:16:04 -0500 | [diff] [blame] | 1341 | if (err) |
| 1342 | return err; |
| 1343 | |
| 1344 | set_bit(*fid, fid_bitmap); |
| 1345 | } |
| 1346 | |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1347 | /* Set every FID bit used by the VLAN entries */ |
Vivien Didelot | 425d2d3 | 2019-08-01 14:36:34 -0400 | [diff] [blame] | 1348 | vlan.vid = chip->info->max_vid; |
| 1349 | vlan.valid = false; |
| 1350 | |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1351 | do { |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 1352 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1353 | if (err) |
| 1354 | return err; |
| 1355 | |
| 1356 | if (!vlan.valid) |
| 1357 | break; |
| 1358 | |
| 1359 | set_bit(vlan.fid, fid_bitmap); |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1360 | } while (vlan.vid < chip->info->max_vid); |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1361 | |
| 1362 | /* The reset value 0x000 is used to indicate that multiple address |
| 1363 | * databases are not needed. Return the next positive available. |
| 1364 | */ |
| 1365 | *fid = find_next_zero_bit(fid_bitmap, MV88E6XXX_N_FID, 1); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1366 | if (unlikely(*fid >= mv88e6xxx_num_databases(chip))) |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1367 | return -ENOSPC; |
| 1368 | |
| 1369 | /* Clear the database */ |
Vivien Didelot | daefc94 | 2017-03-11 16:12:54 -0500 | [diff] [blame] | 1370 | return mv88e6xxx_g1_atu_flush(chip, *fid, true); |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1371 | } |
| 1372 | |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1373 | static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port, |
| 1374 | u16 vid_begin, u16 vid_end) |
| 1375 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1376 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 425d2d3 | 2019-08-01 14:36:34 -0400 | [diff] [blame] | 1377 | struct mv88e6xxx_vtu_entry vlan; |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1378 | int i, err; |
| 1379 | |
Andrew Lunn | db06ae41 | 2017-09-25 23:32:20 +0200 | [diff] [blame] | 1380 | /* DSA and CPU ports have to be members of multiple vlans */ |
| 1381 | if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port)) |
| 1382 | return 0; |
| 1383 | |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1384 | if (!vid_begin) |
| 1385 | return -EOPNOTSUPP; |
| 1386 | |
Vivien Didelot | 425d2d3 | 2019-08-01 14:36:34 -0400 | [diff] [blame] | 1387 | vlan.vid = vid_begin - 1; |
| 1388 | vlan.valid = false; |
| 1389 | |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1390 | do { |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 1391 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1392 | if (err) |
Vivien Didelot | 7095a4c | 2019-08-01 14:36:33 -0400 | [diff] [blame] | 1393 | return err; |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1394 | |
| 1395 | if (!vlan.valid) |
| 1396 | break; |
| 1397 | |
| 1398 | if (vlan.vid > vid_end) |
| 1399 | break; |
| 1400 | |
Vivien Didelot | 370b4ff | 2016-09-29 12:21:57 -0400 | [diff] [blame] | 1401 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) { |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1402 | if (dsa_is_dsa_port(ds, i) || dsa_is_cpu_port(ds, i)) |
| 1403 | continue; |
| 1404 | |
Andrew Lunn | cd88646 | 2017-11-09 22:29:53 +0100 | [diff] [blame] | 1405 | if (!ds->ports[i].slave) |
Andrew Lunn | 66e2809 | 2016-12-11 21:07:19 +0100 | [diff] [blame] | 1406 | continue; |
| 1407 | |
Vivien Didelot | bd00e05 | 2017-05-01 14:05:11 -0400 | [diff] [blame] | 1408 | if (vlan.member[i] == |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1409 | MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER) |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1410 | continue; |
| 1411 | |
Vivien Didelot | c8652c8 | 2017-10-16 11:12:19 -0400 | [diff] [blame] | 1412 | if (dsa_to_port(ds, i)->bridge_dev == |
Vivien Didelot | fae8a25 | 2017-01-27 15:29:42 -0500 | [diff] [blame] | 1413 | ds->ports[port].bridge_dev) |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1414 | break; /* same bridge, check next VLAN */ |
| 1415 | |
Vivien Didelot | c8652c8 | 2017-10-16 11:12:19 -0400 | [diff] [blame] | 1416 | if (!dsa_to_port(ds, i)->bridge_dev) |
Andrew Lunn | 66e2809 | 2016-12-11 21:07:19 +0100 | [diff] [blame] | 1417 | continue; |
| 1418 | |
Andrew Lunn | 743fcc2 | 2017-11-09 22:29:54 +0100 | [diff] [blame] | 1419 | dev_err(ds->dev, "p%d: hw VLAN %d already used by port %d in %s\n", |
| 1420 | port, vlan.vid, i, |
Vivien Didelot | c8652c8 | 2017-10-16 11:12:19 -0400 | [diff] [blame] | 1421 | netdev_name(dsa_to_port(ds, i)->bridge_dev)); |
Vivien Didelot | 7095a4c | 2019-08-01 14:36:33 -0400 | [diff] [blame] | 1422 | return -EOPNOTSUPP; |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1423 | } |
| 1424 | } while (vlan.vid < vid_end); |
| 1425 | |
Vivien Didelot | 7095a4c | 2019-08-01 14:36:33 -0400 | [diff] [blame] | 1426 | return 0; |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1427 | } |
| 1428 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1429 | static int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port, |
| 1430 | bool vlan_filtering) |
Vivien Didelot | 214cdb9 | 2016-02-26 13:16:08 -0500 | [diff] [blame] | 1431 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1432 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 81c6edb | 2017-06-12 12:37:41 -0400 | [diff] [blame] | 1433 | u16 mode = vlan_filtering ? MV88E6XXX_PORT_CTL2_8021Q_MODE_SECURE : |
| 1434 | MV88E6XXX_PORT_CTL2_8021Q_MODE_DISABLED; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 1435 | int err; |
Vivien Didelot | 214cdb9 | 2016-02-26 13:16:08 -0500 | [diff] [blame] | 1436 | |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1437 | if (!chip->info->max_vid) |
Vivien Didelot | 54d77b5 | 2016-05-09 13:22:47 -0400 | [diff] [blame] | 1438 | return -EOPNOTSUPP; |
| 1439 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1440 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 385a099 | 2016-11-04 03:23:31 +0100 | [diff] [blame] | 1441 | err = mv88e6xxx_port_set_8021q_mode(chip, port, mode); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1442 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 214cdb9 | 2016-02-26 13:16:08 -0500 | [diff] [blame] | 1443 | |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 1444 | return err; |
Vivien Didelot | 214cdb9 | 2016-02-26 13:16:08 -0500 | [diff] [blame] | 1445 | } |
| 1446 | |
Vivien Didelot | 57d3231 | 2016-06-20 13:13:58 -0400 | [diff] [blame] | 1447 | static int |
| 1448 | mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port, |
Vivien Didelot | 80e0236 | 2017-11-30 11:23:57 -0500 | [diff] [blame] | 1449 | const struct switchdev_obj_port_vlan *vlan) |
Vivien Didelot | 0d3b33e | 2015-08-13 12:52:22 -0400 | [diff] [blame] | 1450 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1451 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1452 | int err; |
| 1453 | |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1454 | if (!chip->info->max_vid) |
Vivien Didelot | 54d77b5 | 2016-05-09 13:22:47 -0400 | [diff] [blame] | 1455 | return -EOPNOTSUPP; |
| 1456 | |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1457 | /* If the requested port doesn't belong to the same bridge as the VLAN |
| 1458 | * members, do not support it (yet) and fallback to software VLAN. |
| 1459 | */ |
Vivien Didelot | 7095a4c | 2019-08-01 14:36:33 -0400 | [diff] [blame] | 1460 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1461 | err = mv88e6xxx_port_check_hw_vlan(ds, port, vlan->vid_begin, |
| 1462 | vlan->vid_end); |
Vivien Didelot | 7095a4c | 2019-08-01 14:36:33 -0400 | [diff] [blame] | 1463 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1464 | |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1465 | /* We don't need any dynamic resource from the kernel (yet), |
| 1466 | * so skip the prepare phase. |
| 1467 | */ |
Vivien Didelot | 7095a4c | 2019-08-01 14:36:33 -0400 | [diff] [blame] | 1468 | return err; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1469 | } |
| 1470 | |
Andrew Lunn | a4c93ae | 2017-11-09 22:29:55 +0100 | [diff] [blame] | 1471 | static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port, |
| 1472 | const unsigned char *addr, u16 vid, |
| 1473 | u8 state) |
| 1474 | { |
Andrew Lunn | a4c93ae | 2017-11-09 22:29:55 +0100 | [diff] [blame] | 1475 | struct mv88e6xxx_atu_entry entry; |
Vivien Didelot | 5ef8d24 | 2019-08-01 14:36:35 -0400 | [diff] [blame] | 1476 | struct mv88e6xxx_vtu_entry vlan; |
| 1477 | u16 fid; |
Andrew Lunn | a4c93ae | 2017-11-09 22:29:55 +0100 | [diff] [blame] | 1478 | int err; |
| 1479 | |
| 1480 | /* Null VLAN ID corresponds to the port private database */ |
Vivien Didelot | 5ef8d24 | 2019-08-01 14:36:35 -0400 | [diff] [blame] | 1481 | if (vid == 0) { |
| 1482 | err = mv88e6xxx_port_get_fid(chip, port, &fid); |
| 1483 | if (err) |
| 1484 | return err; |
| 1485 | } else { |
| 1486 | vlan.vid = vid - 1; |
| 1487 | vlan.valid = false; |
| 1488 | |
| 1489 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
| 1490 | if (err) |
| 1491 | return err; |
| 1492 | |
| 1493 | /* switchdev expects -EOPNOTSUPP to honor software VLANs */ |
| 1494 | if (vlan.vid != vid || !vlan.valid) |
| 1495 | return -EOPNOTSUPP; |
| 1496 | |
| 1497 | fid = vlan.fid; |
| 1498 | } |
Andrew Lunn | a4c93ae | 2017-11-09 22:29:55 +0100 | [diff] [blame] | 1499 | |
| 1500 | entry.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED; |
| 1501 | ether_addr_copy(entry.mac, addr); |
| 1502 | eth_addr_dec(entry.mac); |
| 1503 | |
Vivien Didelot | 5ef8d24 | 2019-08-01 14:36:35 -0400 | [diff] [blame] | 1504 | err = mv88e6xxx_g1_atu_getnext(chip, fid, &entry); |
Andrew Lunn | a4c93ae | 2017-11-09 22:29:55 +0100 | [diff] [blame] | 1505 | if (err) |
| 1506 | return err; |
| 1507 | |
| 1508 | /* Initialize a fresh ATU entry if it isn't found */ |
| 1509 | if (entry.state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED || |
| 1510 | !ether_addr_equal(entry.mac, addr)) { |
| 1511 | memset(&entry, 0, sizeof(entry)); |
| 1512 | ether_addr_copy(entry.mac, addr); |
| 1513 | } |
| 1514 | |
| 1515 | /* Purge the ATU entry only if no port is using it anymore */ |
| 1516 | if (state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED) { |
| 1517 | entry.portvec &= ~BIT(port); |
| 1518 | if (!entry.portvec) |
| 1519 | entry.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED; |
| 1520 | } else { |
| 1521 | entry.portvec |= BIT(port); |
| 1522 | entry.state = state; |
| 1523 | } |
| 1524 | |
Vivien Didelot | 5ef8d24 | 2019-08-01 14:36:35 -0400 | [diff] [blame] | 1525 | return mv88e6xxx_g1_atu_loadpurge(chip, fid, &entry); |
Andrew Lunn | a4c93ae | 2017-11-09 22:29:55 +0100 | [diff] [blame] | 1526 | } |
| 1527 | |
Andrew Lunn | 87fa886 | 2017-11-09 22:29:56 +0100 | [diff] [blame] | 1528 | static int mv88e6xxx_port_add_broadcast(struct mv88e6xxx_chip *chip, int port, |
| 1529 | u16 vid) |
| 1530 | { |
| 1531 | const char broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 1532 | u8 state = MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC; |
| 1533 | |
| 1534 | return mv88e6xxx_port_db_load_purge(chip, port, broadcast, vid, state); |
| 1535 | } |
| 1536 | |
| 1537 | static int mv88e6xxx_broadcast_setup(struct mv88e6xxx_chip *chip, u16 vid) |
| 1538 | { |
| 1539 | int port; |
| 1540 | int err; |
| 1541 | |
| 1542 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
| 1543 | err = mv88e6xxx_port_add_broadcast(chip, port, vid); |
| 1544 | if (err) |
| 1545 | return err; |
| 1546 | } |
| 1547 | |
| 1548 | return 0; |
| 1549 | } |
| 1550 | |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1551 | static int mv88e6xxx_port_vlan_join(struct mv88e6xxx_chip *chip, int port, |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1552 | u16 vid, u8 member) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1553 | { |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1554 | const u8 non_member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER; |
Vivien Didelot | b4e47c0 | 2016-09-29 12:21:58 -0400 | [diff] [blame] | 1555 | struct mv88e6xxx_vtu_entry vlan; |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1556 | int i, err; |
Vivien Didelot | 0d3b33e | 2015-08-13 12:52:22 -0400 | [diff] [blame] | 1557 | |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1558 | if (!vid) |
| 1559 | return -EOPNOTSUPP; |
| 1560 | |
| 1561 | vlan.vid = vid - 1; |
| 1562 | vlan.valid = false; |
| 1563 | |
| 1564 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
Vivien Didelot | 36d04ba | 2015-10-22 09:34:39 -0400 | [diff] [blame] | 1565 | if (err) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1566 | return err; |
Vivien Didelot | 36d04ba | 2015-10-22 09:34:39 -0400 | [diff] [blame] | 1567 | |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1568 | if (vlan.vid != vid || !vlan.valid) { |
| 1569 | memset(&vlan, 0, sizeof(vlan)); |
Vivien Didelot | 0d3b33e | 2015-08-13 12:52:22 -0400 | [diff] [blame] | 1570 | |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1571 | err = mv88e6xxx_atu_new(chip, &vlan.fid); |
| 1572 | if (err) |
| 1573 | return err; |
Andrew Lunn | 87fa886 | 2017-11-09 22:29:56 +0100 | [diff] [blame] | 1574 | |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1575 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) |
| 1576 | if (i == port) |
| 1577 | vlan.member[i] = member; |
| 1578 | else |
| 1579 | vlan.member[i] = non_member; |
| 1580 | |
| 1581 | vlan.vid = vid; |
| 1582 | vlan.valid = true; |
| 1583 | |
| 1584 | err = mv88e6xxx_vtu_loadpurge(chip, &vlan); |
| 1585 | if (err) |
| 1586 | return err; |
| 1587 | |
| 1588 | err = mv88e6xxx_broadcast_setup(chip, vlan.vid); |
| 1589 | if (err) |
| 1590 | return err; |
| 1591 | } else if (vlan.member[port] != member) { |
| 1592 | vlan.member[port] = member; |
| 1593 | |
| 1594 | err = mv88e6xxx_vtu_loadpurge(chip, &vlan); |
| 1595 | if (err) |
| 1596 | return err; |
| 1597 | } else { |
| 1598 | dev_info(chip->dev, "p%d: already a member of VLAN %d\n", |
| 1599 | port, vid); |
| 1600 | } |
| 1601 | |
| 1602 | return 0; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1603 | } |
| 1604 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1605 | static void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port, |
Vivien Didelot | 80e0236 | 2017-11-30 11:23:57 -0500 | [diff] [blame] | 1606 | const struct switchdev_obj_port_vlan *vlan) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1607 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1608 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1609 | bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; |
| 1610 | bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID; |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1611 | u8 member; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1612 | u16 vid; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1613 | |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1614 | if (!chip->info->max_vid) |
Vivien Didelot | 54d77b5 | 2016-05-09 13:22:47 -0400 | [diff] [blame] | 1615 | return; |
| 1616 | |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1617 | 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] | 1618 | member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_UNMODIFIED; |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1619 | else if (untagged) |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1620 | member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_UNTAGGED; |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1621 | else |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1622 | member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_TAGGED; |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1623 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1624 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1625 | |
Vivien Didelot | 4d5770b | 2016-04-06 11:55:05 -0400 | [diff] [blame] | 1626 | for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) |
Vivien Didelot | b1ac6fb | 2019-08-01 14:36:37 -0400 | [diff] [blame] | 1627 | if (mv88e6xxx_port_vlan_join(chip, port, vid, member)) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 1628 | dev_err(ds->dev, "p%d: failed to add VLAN %d%c\n", port, |
| 1629 | vid, untagged ? 'u' : 't'); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1630 | |
Vivien Didelot | 77064f3 | 2016-11-04 03:23:30 +0100 | [diff] [blame] | 1631 | if (pvid && mv88e6xxx_port_set_pvid(chip, port, vlan->vid_end)) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 1632 | dev_err(ds->dev, "p%d: failed to set PVID %d\n", port, |
| 1633 | vlan->vid_end); |
Vivien Didelot | 4d5770b | 2016-04-06 11:55:05 -0400 | [diff] [blame] | 1634 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1635 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 0d3b33e | 2015-08-13 12:52:22 -0400 | [diff] [blame] | 1636 | } |
| 1637 | |
Vivien Didelot | 52109892 | 2019-08-01 14:36:36 -0400 | [diff] [blame] | 1638 | static int mv88e6xxx_port_vlan_leave(struct mv88e6xxx_chip *chip, |
| 1639 | int port, u16 vid) |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1640 | { |
Vivien Didelot | b4e47c0 | 2016-09-29 12:21:58 -0400 | [diff] [blame] | 1641 | struct mv88e6xxx_vtu_entry vlan; |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1642 | int i, err; |
| 1643 | |
Vivien Didelot | 52109892 | 2019-08-01 14:36:36 -0400 | [diff] [blame] | 1644 | if (!vid) |
| 1645 | return -EOPNOTSUPP; |
| 1646 | |
| 1647 | vlan.vid = vid - 1; |
| 1648 | vlan.valid = false; |
| 1649 | |
| 1650 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
Vivien Didelot | 36d04ba | 2015-10-22 09:34:39 -0400 | [diff] [blame] | 1651 | if (err) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1652 | return err; |
Vivien Didelot | 36d04ba | 2015-10-22 09:34:39 -0400 | [diff] [blame] | 1653 | |
Vivien Didelot | 52109892 | 2019-08-01 14:36:36 -0400 | [diff] [blame] | 1654 | /* If the VLAN doesn't exist in hardware or the port isn't a member, |
| 1655 | * tell switchdev that this VLAN is likely handled in software. |
| 1656 | */ |
| 1657 | if (vlan.vid != vid || !vlan.valid || |
| 1658 | vlan.member[port] == MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER) |
Vivien Didelot | 3c06f08 | 2016-02-05 14:04:39 -0500 | [diff] [blame] | 1659 | return -EOPNOTSUPP; |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1660 | |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1661 | vlan.member[port] = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER; |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1662 | |
| 1663 | /* keep the VLAN unless all ports are excluded */ |
Vivien Didelot | f02bdff | 2015-10-11 18:08:36 -0400 | [diff] [blame] | 1664 | vlan.valid = false; |
Vivien Didelot | 370b4ff | 2016-09-29 12:21:57 -0400 | [diff] [blame] | 1665 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) { |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1666 | if (vlan.member[i] != |
| 1667 | MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER) { |
Vivien Didelot | f02bdff | 2015-10-11 18:08:36 -0400 | [diff] [blame] | 1668 | vlan.valid = true; |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1669 | break; |
| 1670 | } |
| 1671 | } |
| 1672 | |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 1673 | err = mv88e6xxx_vtu_loadpurge(chip, &vlan); |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1674 | if (err) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1675 | return err; |
| 1676 | |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 1677 | return mv88e6xxx_g1_atu_remove(chip, vlan.fid, port, false); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1678 | } |
| 1679 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1680 | static int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port, |
| 1681 | const struct switchdev_obj_port_vlan *vlan) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1682 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1683 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1684 | u16 pvid, vid; |
| 1685 | int err = 0; |
| 1686 | |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1687 | if (!chip->info->max_vid) |
Vivien Didelot | 54d77b5 | 2016-05-09 13:22:47 -0400 | [diff] [blame] | 1688 | return -EOPNOTSUPP; |
| 1689 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1690 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1691 | |
Vivien Didelot | 77064f3 | 2016-11-04 03:23:30 +0100 | [diff] [blame] | 1692 | err = mv88e6xxx_port_get_pvid(chip, port, &pvid); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1693 | if (err) |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1694 | goto unlock; |
| 1695 | |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1696 | for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) { |
Vivien Didelot | 52109892 | 2019-08-01 14:36:36 -0400 | [diff] [blame] | 1697 | err = mv88e6xxx_port_vlan_leave(chip, port, vid); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1698 | if (err) |
| 1699 | goto unlock; |
| 1700 | |
| 1701 | if (vid == pvid) { |
Vivien Didelot | 77064f3 | 2016-11-04 03:23:30 +0100 | [diff] [blame] | 1702 | err = mv88e6xxx_port_set_pvid(chip, port, 0); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1703 | if (err) |
| 1704 | goto unlock; |
| 1705 | } |
| 1706 | } |
| 1707 | |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1708 | unlock: |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1709 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1710 | |
| 1711 | return err; |
| 1712 | } |
| 1713 | |
Arkadi Sharshevsky | 1b6dd55 | 2017-08-06 16:15:40 +0300 | [diff] [blame] | 1714 | static int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port, |
| 1715 | const unsigned char *addr, u16 vid) |
Guenter Roeck | defb05b | 2015-03-26 18:36:38 -0700 | [diff] [blame] | 1716 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1717 | struct mv88e6xxx_chip *chip = ds->priv; |
Arkadi Sharshevsky | 1b6dd55 | 2017-08-06 16:15:40 +0300 | [diff] [blame] | 1718 | int err; |
Vivien Didelot | 6630e23 | 2015-08-06 01:44:07 -0400 | [diff] [blame] | 1719 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1720 | mv88e6xxx_reg_lock(chip); |
Arkadi Sharshevsky | 1b6dd55 | 2017-08-06 16:15:40 +0300 | [diff] [blame] | 1721 | err = mv88e6xxx_port_db_load_purge(chip, port, addr, vid, |
| 1722 | MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1723 | mv88e6xxx_reg_unlock(chip); |
Arkadi Sharshevsky | 1b6dd55 | 2017-08-06 16:15:40 +0300 | [diff] [blame] | 1724 | |
| 1725 | return err; |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1726 | } |
| 1727 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1728 | static int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port, |
Arkadi Sharshevsky | 6c2c1dc | 2017-08-06 16:15:39 +0300 | [diff] [blame] | 1729 | const unsigned char *addr, u16 vid) |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1730 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1731 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1732 | int err; |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1733 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1734 | mv88e6xxx_reg_lock(chip); |
Arkadi Sharshevsky | 6c2c1dc | 2017-08-06 16:15:39 +0300 | [diff] [blame] | 1735 | err = mv88e6xxx_port_db_load_purge(chip, port, addr, vid, |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 1736 | MV88E6XXX_G1_ATU_DATA_STATE_UNUSED); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1737 | mv88e6xxx_reg_unlock(chip); |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1738 | |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1739 | return err; |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1740 | } |
| 1741 | |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1742 | static int mv88e6xxx_port_db_dump_fid(struct mv88e6xxx_chip *chip, |
| 1743 | u16 fid, u16 vid, int port, |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1744 | dsa_fdb_dump_cb_t *cb, void *data) |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1745 | { |
Vivien Didelot | dabc1a9 | 2017-03-11 16:12:53 -0500 | [diff] [blame] | 1746 | struct mv88e6xxx_atu_entry addr; |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1747 | bool is_static; |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1748 | int err; |
| 1749 | |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 1750 | addr.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED; |
Vivien Didelot | dabc1a9 | 2017-03-11 16:12:53 -0500 | [diff] [blame] | 1751 | eth_broadcast_addr(addr.mac); |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1752 | |
| 1753 | do { |
Vivien Didelot | dabc1a9 | 2017-03-11 16:12:53 -0500 | [diff] [blame] | 1754 | err = mv88e6xxx_g1_atu_getnext(chip, fid, &addr); |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1755 | if (err) |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1756 | return err; |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1757 | |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 1758 | if (addr.state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED) |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1759 | break; |
| 1760 | |
Vivien Didelot | 01bd96c | 2017-03-11 16:12:57 -0500 | [diff] [blame] | 1761 | if (addr.trunk || (addr.portvec & BIT(port)) == 0) |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1762 | continue; |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1763 | |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1764 | if (!is_unicast_ether_addr(addr.mac)) |
| 1765 | continue; |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1766 | |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1767 | is_static = (addr.state == |
| 1768 | MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC); |
| 1769 | err = cb(addr.mac, vid, is_static, data); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1770 | if (err) |
| 1771 | return err; |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1772 | } while (!is_broadcast_ether_addr(addr.mac)); |
| 1773 | |
| 1774 | return err; |
| 1775 | } |
| 1776 | |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1777 | static int mv88e6xxx_port_db_dump(struct mv88e6xxx_chip *chip, int port, |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1778 | dsa_fdb_dump_cb_t *cb, void *data) |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1779 | { |
Vivien Didelot | 425d2d3 | 2019-08-01 14:36:34 -0400 | [diff] [blame] | 1780 | struct mv88e6xxx_vtu_entry vlan; |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1781 | u16 fid; |
| 1782 | int err; |
| 1783 | |
| 1784 | /* Dump port's default Filtering Information Database (VLAN ID 0) */ |
Vivien Didelot | b4e48c5 | 2016-11-04 03:23:29 +0100 | [diff] [blame] | 1785 | err = mv88e6xxx_port_get_fid(chip, port, &fid); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1786 | if (err) |
| 1787 | return err; |
| 1788 | |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1789 | err = mv88e6xxx_port_db_dump_fid(chip, fid, 0, port, cb, data); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1790 | if (err) |
| 1791 | return err; |
| 1792 | |
| 1793 | /* Dump VLANs' Filtering Information Databases */ |
Vivien Didelot | 425d2d3 | 2019-08-01 14:36:34 -0400 | [diff] [blame] | 1794 | vlan.vid = chip->info->max_vid; |
| 1795 | vlan.valid = false; |
| 1796 | |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1797 | do { |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 1798 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1799 | if (err) |
| 1800 | return err; |
| 1801 | |
| 1802 | if (!vlan.valid) |
| 1803 | break; |
| 1804 | |
| 1805 | err = mv88e6xxx_port_db_dump_fid(chip, vlan.fid, vlan.vid, port, |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1806 | cb, data); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1807 | if (err) |
| 1808 | return err; |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1809 | } while (vlan.vid < chip->info->max_vid); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1810 | |
| 1811 | return err; |
| 1812 | } |
| 1813 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1814 | static int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port, |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1815 | dsa_fdb_dump_cb_t *cb, void *data) |
Vivien Didelot | f33475b | 2015-10-22 09:34:41 -0400 | [diff] [blame] | 1816 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1817 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | fcf1536 | 2019-06-12 12:42:47 -0400 | [diff] [blame] | 1818 | int err; |
Vivien Didelot | f33475b | 2015-10-22 09:34:41 -0400 | [diff] [blame] | 1819 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1820 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | fcf1536 | 2019-06-12 12:42:47 -0400 | [diff] [blame] | 1821 | err = mv88e6xxx_port_db_dump(chip, port, cb, data); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1822 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | fcf1536 | 2019-06-12 12:42:47 -0400 | [diff] [blame] | 1823 | |
| 1824 | return err; |
Vivien Didelot | f33475b | 2015-10-22 09:34:41 -0400 | [diff] [blame] | 1825 | } |
| 1826 | |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1827 | static int mv88e6xxx_bridge_map(struct mv88e6xxx_chip *chip, |
| 1828 | struct net_device *br) |
| 1829 | { |
Vivien Didelot | e96a6e0 | 2017-03-30 17:37:13 -0400 | [diff] [blame] | 1830 | struct dsa_switch *ds; |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1831 | int port; |
Vivien Didelot | e96a6e0 | 2017-03-30 17:37:13 -0400 | [diff] [blame] | 1832 | int dev; |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1833 | int err; |
| 1834 | |
| 1835 | /* Remap the Port VLAN of each local bridge group member */ |
| 1836 | for (port = 0; port < mv88e6xxx_num_ports(chip); ++port) { |
| 1837 | if (chip->ds->ports[port].bridge_dev == br) { |
| 1838 | err = mv88e6xxx_port_vlan_map(chip, port); |
| 1839 | if (err) |
| 1840 | return err; |
| 1841 | } |
| 1842 | } |
| 1843 | |
Vivien Didelot | e96a6e0 | 2017-03-30 17:37:13 -0400 | [diff] [blame] | 1844 | if (!mv88e6xxx_has_pvt(chip)) |
| 1845 | return 0; |
| 1846 | |
| 1847 | /* Remap the Port VLAN of each cross-chip bridge group member */ |
| 1848 | for (dev = 0; dev < DSA_MAX_SWITCHES; ++dev) { |
| 1849 | ds = chip->ds->dst->ds[dev]; |
| 1850 | if (!ds) |
| 1851 | break; |
| 1852 | |
| 1853 | for (port = 0; port < ds->num_ports; ++port) { |
| 1854 | if (ds->ports[port].bridge_dev == br) { |
| 1855 | err = mv88e6xxx_pvt_map(chip, dev, port); |
| 1856 | if (err) |
| 1857 | return err; |
| 1858 | } |
| 1859 | } |
| 1860 | } |
| 1861 | |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1862 | return 0; |
| 1863 | } |
| 1864 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1865 | static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, |
Vivien Didelot | fae8a25 | 2017-01-27 15:29:42 -0500 | [diff] [blame] | 1866 | struct net_device *br) |
Vivien Didelot | e79a8bc | 2015-11-04 17:23:40 -0500 | [diff] [blame] | 1867 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1868 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1869 | int err; |
Vivien Didelot | 466dfa0 | 2016-02-26 13:16:05 -0500 | [diff] [blame] | 1870 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1871 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1872 | err = mv88e6xxx_bridge_map(chip, br); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1873 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | a669275 | 2016-02-12 12:09:39 -0500 | [diff] [blame] | 1874 | |
Vivien Didelot | 466dfa0 | 2016-02-26 13:16:05 -0500 | [diff] [blame] | 1875 | return err; |
Vivien Didelot | e79a8bc | 2015-11-04 17:23:40 -0500 | [diff] [blame] | 1876 | } |
| 1877 | |
Vivien Didelot | f123f2f | 2017-01-27 15:29:41 -0500 | [diff] [blame] | 1878 | static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port, |
| 1879 | struct net_device *br) |
Vivien Didelot | e79a8bc | 2015-11-04 17:23:40 -0500 | [diff] [blame] | 1880 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1881 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 466dfa0 | 2016-02-26 13:16:05 -0500 | [diff] [blame] | 1882 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1883 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1884 | if (mv88e6xxx_bridge_map(chip, br) || |
| 1885 | mv88e6xxx_port_vlan_map(chip, port)) |
| 1886 | dev_err(ds->dev, "failed to remap in-chip Port VLAN\n"); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1887 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 66d9cd0 | 2016-02-05 14:07:14 -0500 | [diff] [blame] | 1888 | } |
| 1889 | |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 1890 | static int mv88e6xxx_crosschip_bridge_join(struct dsa_switch *ds, int dev, |
| 1891 | int port, struct net_device *br) |
| 1892 | { |
| 1893 | struct mv88e6xxx_chip *chip = ds->priv; |
| 1894 | int err; |
| 1895 | |
| 1896 | if (!mv88e6xxx_has_pvt(chip)) |
| 1897 | return 0; |
| 1898 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1899 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 1900 | err = mv88e6xxx_pvt_map(chip, dev, port); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1901 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 1902 | |
| 1903 | return err; |
| 1904 | } |
| 1905 | |
| 1906 | static void mv88e6xxx_crosschip_bridge_leave(struct dsa_switch *ds, int dev, |
| 1907 | int port, struct net_device *br) |
| 1908 | { |
| 1909 | struct mv88e6xxx_chip *chip = ds->priv; |
| 1910 | |
| 1911 | if (!mv88e6xxx_has_pvt(chip)) |
| 1912 | return; |
| 1913 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1914 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 1915 | if (mv88e6xxx_pvt_map(chip, dev, port)) |
| 1916 | dev_err(ds->dev, "failed to remap cross-chip Port VLAN\n"); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 1917 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 1918 | } |
| 1919 | |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 1920 | static int mv88e6xxx_software_reset(struct mv88e6xxx_chip *chip) |
| 1921 | { |
| 1922 | if (chip->info->ops->reset) |
| 1923 | return chip->info->ops->reset(chip); |
| 1924 | |
| 1925 | return 0; |
| 1926 | } |
| 1927 | |
Vivien Didelot | 309eca6 | 2016-12-05 17:30:26 -0500 | [diff] [blame] | 1928 | static void mv88e6xxx_hardware_reset(struct mv88e6xxx_chip *chip) |
| 1929 | { |
| 1930 | struct gpio_desc *gpiod = chip->reset; |
| 1931 | |
| 1932 | /* If there is a GPIO connected to the reset pin, toggle it */ |
| 1933 | if (gpiod) { |
| 1934 | gpiod_set_value_cansleep(gpiod, 1); |
| 1935 | usleep_range(10000, 20000); |
| 1936 | gpiod_set_value_cansleep(gpiod, 0); |
| 1937 | usleep_range(10000, 20000); |
| 1938 | } |
| 1939 | } |
| 1940 | |
Vivien Didelot | 4ac4b5a | 2016-12-05 17:30:25 -0500 | [diff] [blame] | 1941 | static int mv88e6xxx_disable_ports(struct mv88e6xxx_chip *chip) |
| 1942 | { |
| 1943 | int i, err; |
| 1944 | |
| 1945 | /* Set all ports to the Disabled state */ |
| 1946 | for (i = 0; i < mv88e6xxx_num_ports(chip); i++) { |
Vivien Didelot | f894c29 | 2017-06-08 18:34:10 -0400 | [diff] [blame] | 1947 | err = mv88e6xxx_port_set_state(chip, i, BR_STATE_DISABLED); |
Vivien Didelot | 4ac4b5a | 2016-12-05 17:30:25 -0500 | [diff] [blame] | 1948 | if (err) |
| 1949 | return err; |
| 1950 | } |
| 1951 | |
| 1952 | /* Wait for transmit queues to drain, |
| 1953 | * i.e. 2ms for a maximum frame to be transmitted at 10 Mbps. |
| 1954 | */ |
| 1955 | usleep_range(2000, 4000); |
| 1956 | |
| 1957 | return 0; |
| 1958 | } |
| 1959 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1960 | static int mv88e6xxx_switch_reset(struct mv88e6xxx_chip *chip) |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 1961 | { |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 1962 | int err; |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 1963 | |
Vivien Didelot | 4ac4b5a | 2016-12-05 17:30:25 -0500 | [diff] [blame] | 1964 | err = mv88e6xxx_disable_ports(chip); |
| 1965 | if (err) |
| 1966 | return err; |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 1967 | |
Vivien Didelot | 309eca6 | 2016-12-05 17:30:26 -0500 | [diff] [blame] | 1968 | mv88e6xxx_hardware_reset(chip); |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 1969 | |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 1970 | return mv88e6xxx_software_reset(chip); |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 1971 | } |
| 1972 | |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 1973 | static int mv88e6xxx_set_port_mode(struct mv88e6xxx_chip *chip, int port, |
Vivien Didelot | 31bef4e | 2017-06-08 18:34:09 -0400 | [diff] [blame] | 1974 | enum mv88e6xxx_frame_mode frame, |
| 1975 | enum mv88e6xxx_egress_mode egress, u16 etype) |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 1976 | { |
| 1977 | int err; |
| 1978 | |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 1979 | if (!chip->info->ops->port_set_frame_mode) |
| 1980 | return -EOPNOTSUPP; |
| 1981 | |
| 1982 | err = mv88e6xxx_port_set_egress_mode(chip, port, egress); |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 1983 | if (err) |
| 1984 | return err; |
| 1985 | |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 1986 | err = chip->info->ops->port_set_frame_mode(chip, port, frame); |
| 1987 | if (err) |
| 1988 | return err; |
| 1989 | |
| 1990 | if (chip->info->ops->port_set_ether_type) |
| 1991 | return chip->info->ops->port_set_ether_type(chip, port, etype); |
| 1992 | |
| 1993 | return 0; |
| 1994 | } |
| 1995 | |
| 1996 | static int mv88e6xxx_set_port_mode_normal(struct mv88e6xxx_chip *chip, int port) |
| 1997 | { |
| 1998 | return mv88e6xxx_set_port_mode(chip, port, MV88E6XXX_FRAME_MODE_NORMAL, |
Vivien Didelot | 31bef4e | 2017-06-08 18:34:09 -0400 | [diff] [blame] | 1999 | MV88E6XXX_EGRESS_MODE_UNMODIFIED, |
Vivien Didelot | b810959 | 2017-06-12 12:37:45 -0400 | [diff] [blame] | 2000 | MV88E6XXX_PORT_ETH_TYPE_DEFAULT); |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2001 | } |
| 2002 | |
| 2003 | static int mv88e6xxx_set_port_mode_dsa(struct mv88e6xxx_chip *chip, int port) |
| 2004 | { |
| 2005 | return mv88e6xxx_set_port_mode(chip, port, MV88E6XXX_FRAME_MODE_DSA, |
Vivien Didelot | 31bef4e | 2017-06-08 18:34:09 -0400 | [diff] [blame] | 2006 | MV88E6XXX_EGRESS_MODE_UNMODIFIED, |
Vivien Didelot | b810959 | 2017-06-12 12:37:45 -0400 | [diff] [blame] | 2007 | MV88E6XXX_PORT_ETH_TYPE_DEFAULT); |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2008 | } |
| 2009 | |
| 2010 | static int mv88e6xxx_set_port_mode_edsa(struct mv88e6xxx_chip *chip, int port) |
| 2011 | { |
| 2012 | return mv88e6xxx_set_port_mode(chip, port, |
| 2013 | MV88E6XXX_FRAME_MODE_ETHERTYPE, |
Vivien Didelot | 31bef4e | 2017-06-08 18:34:09 -0400 | [diff] [blame] | 2014 | MV88E6XXX_EGRESS_MODE_ETHERTYPE, |
| 2015 | ETH_P_EDSA); |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2016 | } |
| 2017 | |
| 2018 | static int mv88e6xxx_setup_port_mode(struct mv88e6xxx_chip *chip, int port) |
| 2019 | { |
| 2020 | if (dsa_is_dsa_port(chip->ds, port)) |
| 2021 | return mv88e6xxx_set_port_mode_dsa(chip, port); |
| 2022 | |
Vivien Didelot | 2b3e989 | 2017-10-26 11:22:54 -0400 | [diff] [blame] | 2023 | if (dsa_is_user_port(chip->ds, port)) |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2024 | return mv88e6xxx_set_port_mode_normal(chip, port); |
| 2025 | |
| 2026 | /* Setup CPU port mode depending on its supported tag format */ |
| 2027 | if (chip->info->tag_protocol == DSA_TAG_PROTO_DSA) |
| 2028 | return mv88e6xxx_set_port_mode_dsa(chip, port); |
| 2029 | |
| 2030 | if (chip->info->tag_protocol == DSA_TAG_PROTO_EDSA) |
| 2031 | return mv88e6xxx_set_port_mode_edsa(chip, port); |
| 2032 | |
| 2033 | return -EINVAL; |
| 2034 | } |
| 2035 | |
Vivien Didelot | ea698f4 | 2017-03-11 16:12:50 -0500 | [diff] [blame] | 2036 | static int mv88e6xxx_setup_message_port(struct mv88e6xxx_chip *chip, int port) |
| 2037 | { |
| 2038 | bool message = dsa_is_dsa_port(chip->ds, port); |
| 2039 | |
| 2040 | return mv88e6xxx_port_set_message_port(chip, port, message); |
| 2041 | } |
| 2042 | |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2043 | static int mv88e6xxx_setup_egress_floods(struct mv88e6xxx_chip *chip, int port) |
| 2044 | { |
Vivien Didelot | 3ee50cb | 2017-12-05 15:34:09 -0500 | [diff] [blame] | 2045 | struct dsa_switch *ds = chip->ds; |
David S. Miller | 407308f | 2019-06-15 13:35:29 -0700 | [diff] [blame] | 2046 | bool flood; |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2047 | |
David S. Miller | 407308f | 2019-06-15 13:35:29 -0700 | [diff] [blame] | 2048 | /* Upstream ports flood frames with unknown unicast or multicast DA */ |
| 2049 | flood = dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port); |
| 2050 | if (chip->info->ops->port_set_egress_floods) |
| 2051 | return chip->info->ops->port_set_egress_floods(chip, port, |
| 2052 | flood, flood); |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2053 | |
David S. Miller | 407308f | 2019-06-15 13:35:29 -0700 | [diff] [blame] | 2054 | return 0; |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2055 | } |
| 2056 | |
Vivien Didelot | 45de77f | 2019-08-31 16:18:36 -0400 | [diff] [blame] | 2057 | static irqreturn_t mv88e6xxx_serdes_irq_thread_fn(int irq, void *dev_id) |
| 2058 | { |
| 2059 | struct mv88e6xxx_port *mvp = dev_id; |
| 2060 | struct mv88e6xxx_chip *chip = mvp->chip; |
| 2061 | irqreturn_t ret = IRQ_NONE; |
| 2062 | int port = mvp->port; |
| 2063 | u8 lane; |
| 2064 | |
| 2065 | mv88e6xxx_reg_lock(chip); |
| 2066 | lane = mv88e6xxx_serdes_get_lane(chip, port); |
| 2067 | if (lane) |
| 2068 | ret = mv88e6xxx_serdes_irq_status(chip, port, lane); |
| 2069 | mv88e6xxx_reg_unlock(chip); |
| 2070 | |
| 2071 | return ret; |
| 2072 | } |
| 2073 | |
| 2074 | static int mv88e6xxx_serdes_irq_request(struct mv88e6xxx_chip *chip, int port, |
| 2075 | u8 lane) |
| 2076 | { |
| 2077 | struct mv88e6xxx_port *dev_id = &chip->ports[port]; |
| 2078 | unsigned int irq; |
| 2079 | int err; |
| 2080 | |
| 2081 | /* Nothing to request if this SERDES port has no IRQ */ |
| 2082 | irq = mv88e6xxx_serdes_irq_mapping(chip, port); |
| 2083 | if (!irq) |
| 2084 | return 0; |
| 2085 | |
| 2086 | /* Requesting the IRQ will trigger IRQ callbacks, so release the lock */ |
| 2087 | mv88e6xxx_reg_unlock(chip); |
| 2088 | err = request_threaded_irq(irq, NULL, mv88e6xxx_serdes_irq_thread_fn, |
| 2089 | IRQF_ONESHOT, "mv88e6xxx-serdes", dev_id); |
| 2090 | mv88e6xxx_reg_lock(chip); |
| 2091 | if (err) |
| 2092 | return err; |
| 2093 | |
| 2094 | dev_id->serdes_irq = irq; |
| 2095 | |
| 2096 | return mv88e6xxx_serdes_irq_enable(chip, port, lane); |
| 2097 | } |
| 2098 | |
| 2099 | static int mv88e6xxx_serdes_irq_free(struct mv88e6xxx_chip *chip, int port, |
| 2100 | u8 lane) |
| 2101 | { |
| 2102 | struct mv88e6xxx_port *dev_id = &chip->ports[port]; |
| 2103 | unsigned int irq = dev_id->serdes_irq; |
| 2104 | int err; |
| 2105 | |
| 2106 | /* Nothing to free if no IRQ has been requested */ |
| 2107 | if (!irq) |
| 2108 | return 0; |
| 2109 | |
| 2110 | err = mv88e6xxx_serdes_irq_disable(chip, port, lane); |
| 2111 | |
| 2112 | /* Freeing the IRQ will trigger IRQ callbacks, so release the lock */ |
| 2113 | mv88e6xxx_reg_unlock(chip); |
| 2114 | free_irq(irq, dev_id); |
| 2115 | mv88e6xxx_reg_lock(chip); |
| 2116 | |
| 2117 | dev_id->serdes_irq = 0; |
| 2118 | |
| 2119 | return err; |
| 2120 | } |
| 2121 | |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 2122 | static int mv88e6xxx_serdes_power(struct mv88e6xxx_chip *chip, int port, |
| 2123 | bool on) |
| 2124 | { |
Vivien Didelot | dc272f6 | 2019-08-31 16:18:33 -0400 | [diff] [blame] | 2125 | u8 lane; |
Vivien Didelot | fc0bc01 | 2019-08-19 16:00:53 -0400 | [diff] [blame] | 2126 | int err; |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 2127 | |
Vivien Didelot | dc272f6 | 2019-08-31 16:18:33 -0400 | [diff] [blame] | 2128 | lane = mv88e6xxx_serdes_get_lane(chip, port); |
| 2129 | if (!lane) |
Vivien Didelot | fc0bc01 | 2019-08-19 16:00:53 -0400 | [diff] [blame] | 2130 | return 0; |
| 2131 | |
| 2132 | if (on) { |
Vivien Didelot | dc272f6 | 2019-08-31 16:18:33 -0400 | [diff] [blame] | 2133 | err = mv88e6xxx_serdes_power_up(chip, port, lane); |
Vivien Didelot | fc0bc01 | 2019-08-19 16:00:53 -0400 | [diff] [blame] | 2134 | if (err) |
| 2135 | return err; |
| 2136 | |
Vivien Didelot | 45de77f | 2019-08-31 16:18:36 -0400 | [diff] [blame] | 2137 | err = mv88e6xxx_serdes_irq_request(chip, port, lane); |
Vivien Didelot | fc0bc01 | 2019-08-19 16:00:53 -0400 | [diff] [blame] | 2138 | } else { |
Vivien Didelot | 45de77f | 2019-08-31 16:18:36 -0400 | [diff] [blame] | 2139 | err = mv88e6xxx_serdes_irq_free(chip, port, lane); |
| 2140 | if (err) |
| 2141 | return err; |
Vivien Didelot | fc0bc01 | 2019-08-19 16:00:53 -0400 | [diff] [blame] | 2142 | |
Vivien Didelot | dc272f6 | 2019-08-31 16:18:33 -0400 | [diff] [blame] | 2143 | err = mv88e6xxx_serdes_power_down(chip, port, lane); |
Vivien Didelot | fc0bc01 | 2019-08-19 16:00:53 -0400 | [diff] [blame] | 2144 | } |
| 2145 | |
| 2146 | return err; |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 2147 | } |
| 2148 | |
Vivien Didelot | fa371c8 | 2017-12-05 15:34:10 -0500 | [diff] [blame] | 2149 | static int mv88e6xxx_setup_upstream_port(struct mv88e6xxx_chip *chip, int port) |
| 2150 | { |
| 2151 | struct dsa_switch *ds = chip->ds; |
| 2152 | int upstream_port; |
| 2153 | int err; |
| 2154 | |
Vivien Didelot | 07073c7 | 2017-12-05 15:34:13 -0500 | [diff] [blame] | 2155 | upstream_port = dsa_upstream_port(ds, port); |
Vivien Didelot | fa371c8 | 2017-12-05 15:34:10 -0500 | [diff] [blame] | 2156 | if (chip->info->ops->port_set_upstream_port) { |
| 2157 | err = chip->info->ops->port_set_upstream_port(chip, port, |
| 2158 | upstream_port); |
| 2159 | if (err) |
| 2160 | return err; |
| 2161 | } |
| 2162 | |
Vivien Didelot | 0ea54dd | 2017-12-05 15:34:11 -0500 | [diff] [blame] | 2163 | if (port == upstream_port) { |
| 2164 | if (chip->info->ops->set_cpu_port) { |
| 2165 | err = chip->info->ops->set_cpu_port(chip, |
| 2166 | upstream_port); |
| 2167 | if (err) |
| 2168 | return err; |
| 2169 | } |
| 2170 | |
| 2171 | if (chip->info->ops->set_egress_port) { |
| 2172 | err = chip->info->ops->set_egress_port(chip, |
| 2173 | upstream_port); |
| 2174 | if (err) |
| 2175 | return err; |
| 2176 | } |
| 2177 | } |
| 2178 | |
Vivien Didelot | fa371c8 | 2017-12-05 15:34:10 -0500 | [diff] [blame] | 2179 | return 0; |
| 2180 | } |
| 2181 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2182 | static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2183 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2184 | struct dsa_switch *ds = chip->ds; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2185 | int err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2186 | u16 reg; |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2187 | |
Andrew Lunn | 7b89846 | 2018-08-09 15:38:47 +0200 | [diff] [blame] | 2188 | chip->ports[port].chip = chip; |
| 2189 | chip->ports[port].port = port; |
| 2190 | |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 2191 | /* MAC Forcing register: don't force link, speed, duplex or flow control |
| 2192 | * state to any particular values on physical ports, but force the CPU |
| 2193 | * port and all DSA ports to their maximum bandwidth and full duplex. |
| 2194 | */ |
| 2195 | if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)) |
| 2196 | err = mv88e6xxx_port_setup_mac(chip, port, LINK_FORCED_UP, |
| 2197 | SPEED_MAX, DUPLEX_FULL, |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 2198 | PAUSE_OFF, |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 2199 | PHY_INTERFACE_MODE_NA); |
| 2200 | else |
| 2201 | err = mv88e6xxx_port_setup_mac(chip, port, LINK_UNFORCED, |
| 2202 | SPEED_UNFORCED, DUPLEX_UNFORCED, |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 2203 | PAUSE_ON, |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 2204 | PHY_INTERFACE_MODE_NA); |
| 2205 | if (err) |
| 2206 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2207 | |
| 2208 | /* Port Control: disable Drop-on-Unlock, disable Drop-on-Lock, |
| 2209 | * disable Header mode, enable IGMP/MLD snooping, disable VLAN |
| 2210 | * tunneling, determine priority by looking at 802.1p and IP |
| 2211 | * priority fields (IP prio has precedence), and set STP state |
| 2212 | * to Forwarding. |
| 2213 | * |
| 2214 | * If this is the CPU link, use DSA or EDSA tagging depending |
| 2215 | * on which tagging mode was configured. |
| 2216 | * |
| 2217 | * If this is a link to another switch, use DSA tagging mode. |
| 2218 | * |
| 2219 | * If this is the upstream port for this switch, enable |
| 2220 | * forwarding of unknown unicasts and multicasts. |
| 2221 | */ |
Vivien Didelot | a89b433be | 2017-06-12 12:37:37 -0400 | [diff] [blame] | 2222 | reg = MV88E6XXX_PORT_CTL0_IGMP_MLD_SNOOP | |
| 2223 | MV88E6185_PORT_CTL0_USE_TAG | MV88E6185_PORT_CTL0_USE_IP | |
| 2224 | MV88E6XXX_PORT_CTL0_STATE_FORWARDING; |
| 2225 | err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_CTL0, reg); |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2226 | if (err) |
| 2227 | return err; |
Andrew Lunn | 6083ce7 | 2015-08-17 23:52:52 +0200 | [diff] [blame] | 2228 | |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2229 | err = mv88e6xxx_setup_port_mode(chip, port); |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2230 | if (err) |
| 2231 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2232 | |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2233 | err = mv88e6xxx_setup_egress_floods(chip, port); |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2234 | if (err) |
| 2235 | return err; |
| 2236 | |
Vivien Didelot | 8efdda4 | 2015-08-13 12:52:23 -0400 | [diff] [blame] | 2237 | /* 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] | 2238 | * 10240 bytes, disable 802.1q tags checking, don't discard tagged or |
Vivien Didelot | 8efdda4 | 2015-08-13 12:52:23 -0400 | [diff] [blame] | 2239 | * untagged frames on this port, do a destination address lookup on all |
| 2240 | * received packets as usual, disable ARP mirroring and don't send a |
| 2241 | * copy of all transmitted/received frames on this port to the CPU. |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2242 | */ |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2243 | err = mv88e6xxx_port_set_map_da(chip, port); |
| 2244 | if (err) |
| 2245 | return err; |
| 2246 | |
Vivien Didelot | fa371c8 | 2017-12-05 15:34:10 -0500 | [diff] [blame] | 2247 | err = mv88e6xxx_setup_upstream_port(chip, port); |
| 2248 | if (err) |
| 2249 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2250 | |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2251 | err = mv88e6xxx_port_set_8021q_mode(chip, port, |
Vivien Didelot | 81c6edb | 2017-06-12 12:37:41 -0400 | [diff] [blame] | 2252 | MV88E6XXX_PORT_CTL2_8021Q_MODE_DISABLED); |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2253 | if (err) |
| 2254 | return err; |
| 2255 | |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2256 | if (chip->info->ops->port_set_jumbo_size) { |
| 2257 | err = chip->info->ops->port_set_jumbo_size(chip, port, 10240); |
Andrew Lunn | 5f43666 | 2016-12-03 04:45:17 +0100 | [diff] [blame] | 2258 | if (err) |
| 2259 | return err; |
| 2260 | } |
| 2261 | |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2262 | /* Port Association Vector: when learning source addresses |
| 2263 | * of packets, add the address to the address database using |
| 2264 | * a port bitmap that has only the bit for this port set and |
| 2265 | * the other bits clear. |
| 2266 | */ |
Andrew Lunn | 4c7ea3c | 2015-11-03 10:52:36 -0500 | [diff] [blame] | 2267 | reg = 1 << port; |
Vivien Didelot | 996ecb8 | 2016-04-14 14:42:08 -0400 | [diff] [blame] | 2268 | /* Disable learning for CPU port */ |
| 2269 | if (dsa_is_cpu_port(ds, port)) |
Vivien Didelot | 65fa402 | 2016-04-14 14:42:07 -0400 | [diff] [blame] | 2270 | reg = 0; |
Andrew Lunn | 4c7ea3c | 2015-11-03 10:52:36 -0500 | [diff] [blame] | 2271 | |
Vivien Didelot | 2a4614e | 2017-06-12 12:37:43 -0400 | [diff] [blame] | 2272 | err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_ASSOC_VECTOR, |
| 2273 | reg); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2274 | if (err) |
| 2275 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2276 | |
| 2277 | /* Egress rate control 2: disable egress rate control. */ |
Vivien Didelot | 2cb8cb1 | 2017-06-12 12:37:42 -0400 | [diff] [blame] | 2278 | err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_EGRESS_RATE_CTL2, |
| 2279 | 0x0000); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2280 | if (err) |
| 2281 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2282 | |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2283 | if (chip->info->ops->port_pause_limit) { |
| 2284 | err = chip->info->ops->port_pause_limit(chip, port, 0, 0); |
Andrew Lunn | b35d322a | 2016-12-03 04:45:19 +0100 | [diff] [blame] | 2285 | if (err) |
| 2286 | return err; |
| 2287 | } |
| 2288 | |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2289 | if (chip->info->ops->port_disable_learn_limit) { |
| 2290 | err = chip->info->ops->port_disable_learn_limit(chip, port); |
| 2291 | if (err) |
| 2292 | return err; |
| 2293 | } |
| 2294 | |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2295 | if (chip->info->ops->port_disable_pri_override) { |
| 2296 | err = chip->info->ops->port_disable_pri_override(chip, port); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2297 | if (err) |
| 2298 | return err; |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2299 | } |
Andrew Lunn | 2bbb33b | 2016-08-22 16:01:02 +0200 | [diff] [blame] | 2300 | |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2301 | if (chip->info->ops->port_tag_remap) { |
| 2302 | err = chip->info->ops->port_tag_remap(chip, port); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2303 | if (err) |
| 2304 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2305 | } |
| 2306 | |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2307 | if (chip->info->ops->port_egress_rate_limiting) { |
| 2308 | err = chip->info->ops->port_egress_rate_limiting(chip, port); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2309 | if (err) |
| 2310 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2311 | } |
| 2312 | |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 2313 | if (chip->info->ops->port_setup_message_port) { |
| 2314 | err = chip->info->ops->port_setup_message_port(chip, port); |
| 2315 | if (err) |
| 2316 | return err; |
| 2317 | } |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2318 | |
Vivien Didelot | 207afda | 2016-04-14 14:42:09 -0400 | [diff] [blame] | 2319 | /* Port based VLAN map: give each port the same default address |
Vivien Didelot | b7666ef | 2016-02-26 13:16:06 -0500 | [diff] [blame] | 2320 | * database, and allow bidirectional communication between the |
| 2321 | * CPU and DSA port(s), and the other ports. |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2322 | */ |
Vivien Didelot | b4e48c5 | 2016-11-04 03:23:29 +0100 | [diff] [blame] | 2323 | err = mv88e6xxx_port_set_fid(chip, port, 0); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2324 | if (err) |
| 2325 | return err; |
Vivien Didelot | 2db9ce1 | 2016-02-26 13:16:04 -0500 | [diff] [blame] | 2326 | |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 2327 | err = mv88e6xxx_port_vlan_map(chip, port); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2328 | if (err) |
| 2329 | return err; |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2330 | |
| 2331 | /* Default VLAN ID and priority: don't set a default VLAN |
| 2332 | * ID, and set the default packet priority to zero. |
| 2333 | */ |
Vivien Didelot | b7929fb | 2017-06-12 12:37:40 -0400 | [diff] [blame] | 2334 | return mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_DEFAULT_VLAN, 0); |
Andrew Lunn | dbde9e6 | 2015-05-06 01:09:48 +0200 | [diff] [blame] | 2335 | } |
| 2336 | |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2337 | static int mv88e6xxx_port_enable(struct dsa_switch *ds, int port, |
| 2338 | struct phy_device *phydev) |
| 2339 | { |
| 2340 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 523a890 | 2017-05-26 18:02:42 -0400 | [diff] [blame] | 2341 | int err; |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2342 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2343 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 523a890 | 2017-05-26 18:02:42 -0400 | [diff] [blame] | 2344 | err = mv88e6xxx_serdes_power(chip, port, true); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2345 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2346 | |
| 2347 | return err; |
| 2348 | } |
| 2349 | |
Andrew Lunn | 75104db | 2019-02-24 20:44:43 +0100 | [diff] [blame] | 2350 | static void mv88e6xxx_port_disable(struct dsa_switch *ds, int port) |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2351 | { |
| 2352 | struct mv88e6xxx_chip *chip = ds->priv; |
| 2353 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2354 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 523a890 | 2017-05-26 18:02:42 -0400 | [diff] [blame] | 2355 | if (mv88e6xxx_serdes_power(chip, port, false)) |
| 2356 | dev_err(chip->dev, "failed to power off SERDES\n"); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2357 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2358 | } |
| 2359 | |
Vivien Didelot | 2cfcd96 | 2016-07-18 20:45:40 -0400 | [diff] [blame] | 2360 | static int mv88e6xxx_set_ageing_time(struct dsa_switch *ds, |
| 2361 | unsigned int ageing_time) |
| 2362 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2363 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 2cfcd96 | 2016-07-18 20:45:40 -0400 | [diff] [blame] | 2364 | int err; |
| 2365 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2366 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 720c634 | 2017-03-11 16:12:48 -0500 | [diff] [blame] | 2367 | err = mv88e6xxx_g1_atu_set_age_time(chip, ageing_time); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2368 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 2cfcd96 | 2016-07-18 20:45:40 -0400 | [diff] [blame] | 2369 | |
| 2370 | return err; |
| 2371 | } |
| 2372 | |
Vivien Didelot | 447b1bb | 2018-05-11 17:16:36 -0400 | [diff] [blame] | 2373 | static int mv88e6xxx_stats_setup(struct mv88e6xxx_chip *chip) |
Vivien Didelot | 08a0126 | 2016-05-09 13:22:50 -0400 | [diff] [blame] | 2374 | { |
| 2375 | int err; |
Vivien Didelot | 08a0126 | 2016-05-09 13:22:50 -0400 | [diff] [blame] | 2376 | |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 2377 | /* Initialize the statistics unit */ |
Vivien Didelot | 447b1bb | 2018-05-11 17:16:36 -0400 | [diff] [blame] | 2378 | if (chip->info->ops->stats_set_histogram) { |
| 2379 | err = chip->info->ops->stats_set_histogram(chip); |
| 2380 | if (err) |
| 2381 | return err; |
| 2382 | } |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 2383 | |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2384 | return mv88e6xxx_g1_stats_clear(chip); |
Vivien Didelot | 9729934 | 2016-07-18 20:45:30 -0400 | [diff] [blame] | 2385 | } |
| 2386 | |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 2387 | /* Check if the errata has already been applied. */ |
| 2388 | static bool mv88e6390_setup_errata_applied(struct mv88e6xxx_chip *chip) |
| 2389 | { |
| 2390 | int port; |
| 2391 | int err; |
| 2392 | u16 val; |
| 2393 | |
| 2394 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
Marek Behún | 6090701 | 2019-08-26 23:31:51 +0200 | [diff] [blame] | 2395 | err = mv88e6xxx_port_hidden_read(chip, 0xf, port, 0, &val); |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 2396 | if (err) { |
| 2397 | dev_err(chip->dev, |
| 2398 | "Error reading hidden register: %d\n", err); |
| 2399 | return false; |
| 2400 | } |
| 2401 | if (val != 0x01c0) |
| 2402 | return false; |
| 2403 | } |
| 2404 | |
| 2405 | return true; |
| 2406 | } |
| 2407 | |
| 2408 | /* The 6390 copper ports have an errata which require poking magic |
| 2409 | * values into undocumented hidden registers and then performing a |
| 2410 | * software reset. |
| 2411 | */ |
| 2412 | static int mv88e6390_setup_errata(struct mv88e6xxx_chip *chip) |
| 2413 | { |
| 2414 | int port; |
| 2415 | int err; |
| 2416 | |
| 2417 | if (mv88e6390_setup_errata_applied(chip)) |
| 2418 | return 0; |
| 2419 | |
| 2420 | /* Set the ports into blocking mode */ |
| 2421 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
| 2422 | err = mv88e6xxx_port_set_state(chip, port, BR_STATE_DISABLED); |
| 2423 | if (err) |
| 2424 | return err; |
| 2425 | } |
| 2426 | |
| 2427 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
Marek Behún | 6090701 | 2019-08-26 23:31:51 +0200 | [diff] [blame] | 2428 | err = mv88e6xxx_port_hidden_write(chip, 0xf, port, 0, 0x01c0); |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 2429 | if (err) |
| 2430 | return err; |
| 2431 | } |
| 2432 | |
| 2433 | return mv88e6xxx_software_reset(chip); |
| 2434 | } |
| 2435 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 2436 | static int mv88e6xxx_setup(struct dsa_switch *ds) |
Guenter Roeck | acdaffc | 2015-03-26 18:36:28 -0700 | [diff] [blame] | 2437 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2438 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2439 | u8 cmode; |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 2440 | int err; |
Vivien Didelot | a1a6a4d | 2016-05-09 13:22:56 -0400 | [diff] [blame] | 2441 | int i; |
| 2442 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2443 | chip->ds = ds; |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2444 | ds->slave_mii_bus = mv88e6xxx_default_mdio_bus(chip); |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 2445 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2446 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 2447 | |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 2448 | if (chip->info->ops->setup_errata) { |
| 2449 | err = chip->info->ops->setup_errata(chip); |
| 2450 | if (err) |
| 2451 | goto unlock; |
| 2452 | } |
| 2453 | |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2454 | /* Cache the cmode of each port. */ |
| 2455 | for (i = 0; i < mv88e6xxx_num_ports(chip); i++) { |
| 2456 | if (chip->info->ops->port_get_cmode) { |
| 2457 | err = chip->info->ops->port_get_cmode(chip, i, &cmode); |
| 2458 | if (err) |
Dan Carpenter | e29129f | 2018-08-14 12:09:05 +0300 | [diff] [blame] | 2459 | goto unlock; |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2460 | |
| 2461 | chip->ports[i].cmode = cmode; |
| 2462 | } |
| 2463 | } |
| 2464 | |
Vivien Didelot | 9729934 | 2016-07-18 20:45:30 -0400 | [diff] [blame] | 2465 | /* Setup Switch Port Registers */ |
Vivien Didelot | 370b4ff | 2016-09-29 12:21:57 -0400 | [diff] [blame] | 2466 | for (i = 0; i < mv88e6xxx_num_ports(chip); i++) { |
Vivien Didelot | b759f52 | 2019-08-19 16:00:52 -0400 | [diff] [blame] | 2467 | if (dsa_is_unused_port(ds, i)) |
| 2468 | continue; |
| 2469 | |
Hubert Feurstein | c857486 | 2019-07-31 10:23:48 +0200 | [diff] [blame] | 2470 | /* Prevent the use of an invalid port. */ |
Vivien Didelot | b759f52 | 2019-08-19 16:00:52 -0400 | [diff] [blame] | 2471 | if (mv88e6xxx_is_invalid_port(chip, i)) { |
Hubert Feurstein | c857486 | 2019-07-31 10:23:48 +0200 | [diff] [blame] | 2472 | dev_err(chip->dev, "port %d is invalid\n", i); |
| 2473 | err = -EINVAL; |
| 2474 | goto unlock; |
| 2475 | } |
| 2476 | |
Vivien Didelot | 9729934 | 2016-07-18 20:45:30 -0400 | [diff] [blame] | 2477 | err = mv88e6xxx_setup_port(chip, i); |
| 2478 | if (err) |
| 2479 | goto unlock; |
| 2480 | } |
| 2481 | |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2482 | err = mv88e6xxx_irl_setup(chip); |
| 2483 | if (err) |
| 2484 | goto unlock; |
| 2485 | |
Vivien Didelot | 04a69a1 | 2017-10-13 14:18:05 -0400 | [diff] [blame] | 2486 | err = mv88e6xxx_mac_setup(chip); |
| 2487 | if (err) |
| 2488 | goto unlock; |
| 2489 | |
Vivien Didelot | 1b17aed | 2017-05-26 18:03:05 -0400 | [diff] [blame] | 2490 | err = mv88e6xxx_phy_setup(chip); |
| 2491 | if (err) |
| 2492 | goto unlock; |
| 2493 | |
Vivien Didelot | b486d7c | 2017-05-01 14:05:13 -0400 | [diff] [blame] | 2494 | err = mv88e6xxx_vtu_setup(chip); |
| 2495 | if (err) |
| 2496 | goto unlock; |
| 2497 | |
Vivien Didelot | 8122899 | 2017-03-30 17:37:08 -0400 | [diff] [blame] | 2498 | err = mv88e6xxx_pvt_setup(chip); |
| 2499 | if (err) |
| 2500 | goto unlock; |
| 2501 | |
Vivien Didelot | a2ac29d | 2017-03-11 16:12:49 -0500 | [diff] [blame] | 2502 | err = mv88e6xxx_atu_setup(chip); |
| 2503 | if (err) |
| 2504 | goto unlock; |
| 2505 | |
Andrew Lunn | 87fa886 | 2017-11-09 22:29:56 +0100 | [diff] [blame] | 2506 | err = mv88e6xxx_broadcast_setup(chip, 0); |
| 2507 | if (err) |
| 2508 | goto unlock; |
| 2509 | |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2510 | err = mv88e6xxx_pot_setup(chip); |
| 2511 | if (err) |
| 2512 | goto unlock; |
| 2513 | |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 2514 | err = mv88e6xxx_rmu_setup(chip); |
| 2515 | if (err) |
| 2516 | goto unlock; |
| 2517 | |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2518 | err = mv88e6xxx_rsvd2cpu_setup(chip); |
| 2519 | if (err) |
| 2520 | goto unlock; |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 2521 | |
Vivien Didelot | b28f872 | 2018-04-26 21:56:44 -0400 | [diff] [blame] | 2522 | err = mv88e6xxx_trunk_setup(chip); |
| 2523 | if (err) |
| 2524 | goto unlock; |
| 2525 | |
Vivien Didelot | c7f047b | 2018-04-26 21:56:45 -0400 | [diff] [blame] | 2526 | err = mv88e6xxx_devmap_setup(chip); |
| 2527 | if (err) |
| 2528 | goto unlock; |
| 2529 | |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2530 | err = mv88e6xxx_pri_setup(chip); |
| 2531 | if (err) |
| 2532 | goto unlock; |
| 2533 | |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 2534 | /* Setup PTP Hardware Clock and timestamping */ |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 2535 | if (chip->info->ptp_support) { |
| 2536 | err = mv88e6xxx_ptp_setup(chip); |
| 2537 | if (err) |
| 2538 | goto unlock; |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 2539 | |
| 2540 | err = mv88e6xxx_hwtstamp_setup(chip); |
| 2541 | if (err) |
| 2542 | goto unlock; |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 2543 | } |
| 2544 | |
Vivien Didelot | 447b1bb | 2018-05-11 17:16:36 -0400 | [diff] [blame] | 2545 | err = mv88e6xxx_stats_setup(chip); |
| 2546 | if (err) |
| 2547 | goto unlock; |
| 2548 | |
Vivien Didelot | 6b17e86 | 2015-08-13 12:52:18 -0400 | [diff] [blame] | 2549 | unlock: |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2550 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | db687a5 | 2015-06-20 21:31:29 +0200 | [diff] [blame] | 2551 | |
Andrew Lunn | 48ace4e | 2016-04-14 23:47:12 +0200 | [diff] [blame] | 2552 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2553 | } |
| 2554 | |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2555 | 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] | 2556 | { |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2557 | struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv; |
| 2558 | struct mv88e6xxx_chip *chip = mdio_bus->chip; |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2559 | u16 val; |
| 2560 | int err; |
Andrew Lunn | fd3a0ee | 2015-04-02 04:06:36 +0200 | [diff] [blame] | 2561 | |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 2562 | if (!chip->info->ops->phy_read) |
| 2563 | return -EOPNOTSUPP; |
| 2564 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2565 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 2566 | err = chip->info->ops->phy_read(chip, bus, phy, reg, &val); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2567 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2568 | |
Andrew Lunn | da9f330 | 2017-02-01 03:40:05 +0100 | [diff] [blame] | 2569 | if (reg == MII_PHYSID2) { |
Andrew Lunn | ddc49ac | 2018-11-12 18:51:01 +0100 | [diff] [blame] | 2570 | /* Some internal PHYs don't have a model number. */ |
| 2571 | if (chip->info->family != MV88E6XXX_FAMILY_6165) |
| 2572 | /* Then there is the 6165 family. It gets is |
| 2573 | * PHYs correct. But it can also have two |
| 2574 | * SERDES interfaces in the PHY address |
| 2575 | * space. And these don't have a model |
| 2576 | * number. But they are not PHYs, so we don't |
| 2577 | * want to give them something a PHY driver |
| 2578 | * will recognise. |
| 2579 | * |
| 2580 | * Use the mv88e6390 family model number |
| 2581 | * instead, for anything which really could be |
| 2582 | * a PHY, |
| 2583 | */ |
| 2584 | if (!(val & 0x3f0)) |
| 2585 | val |= MV88E6XXX_PORT_SWITCH_ID_PROD_6390 >> 4; |
Andrew Lunn | da9f330 | 2017-02-01 03:40:05 +0100 | [diff] [blame] | 2586 | } |
| 2587 | |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2588 | return err ? err : val; |
Andrew Lunn | fd3a0ee | 2015-04-02 04:06:36 +0200 | [diff] [blame] | 2589 | } |
| 2590 | |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2591 | 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] | 2592 | { |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2593 | struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv; |
| 2594 | struct mv88e6xxx_chip *chip = mdio_bus->chip; |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2595 | int err; |
Andrew Lunn | fd3a0ee | 2015-04-02 04:06:36 +0200 | [diff] [blame] | 2596 | |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 2597 | if (!chip->info->ops->phy_write) |
| 2598 | return -EOPNOTSUPP; |
| 2599 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2600 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 2601 | err = chip->info->ops->phy_write(chip, bus, phy, reg, val); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2602 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2603 | |
| 2604 | return err; |
Andrew Lunn | fd3a0ee | 2015-04-02 04:06:36 +0200 | [diff] [blame] | 2605 | } |
| 2606 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2607 | static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip, |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2608 | struct device_node *np, |
| 2609 | bool external) |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2610 | { |
| 2611 | static int index; |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2612 | struct mv88e6xxx_mdio_bus *mdio_bus; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2613 | struct mii_bus *bus; |
| 2614 | int err; |
| 2615 | |
Andrew Lunn | 2510bab | 2018-02-22 01:51:49 +0100 | [diff] [blame] | 2616 | if (external) { |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2617 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | 2510bab | 2018-02-22 01:51:49 +0100 | [diff] [blame] | 2618 | err = mv88e6xxx_g2_scratch_gpio_set_smi(chip, true); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2619 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | 2510bab | 2018-02-22 01:51:49 +0100 | [diff] [blame] | 2620 | |
| 2621 | if (err) |
| 2622 | return err; |
| 2623 | } |
| 2624 | |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2625 | bus = devm_mdiobus_alloc_size(chip->dev, sizeof(*mdio_bus)); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2626 | if (!bus) |
| 2627 | return -ENOMEM; |
| 2628 | |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2629 | mdio_bus = bus->priv; |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2630 | mdio_bus->bus = bus; |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2631 | mdio_bus->chip = chip; |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2632 | INIT_LIST_HEAD(&mdio_bus->list); |
| 2633 | mdio_bus->external = external; |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2634 | |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2635 | if (np) { |
| 2636 | bus->name = np->full_name; |
Rob Herring | f7ce910 | 2017-07-18 16:43:19 -0500 | [diff] [blame] | 2637 | snprintf(bus->id, MII_BUS_ID_SIZE, "%pOF", np); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2638 | } else { |
| 2639 | bus->name = "mv88e6xxx SMI"; |
| 2640 | snprintf(bus->id, MII_BUS_ID_SIZE, "mv88e6xxx-%d", index++); |
| 2641 | } |
| 2642 | |
| 2643 | bus->read = mv88e6xxx_mdio_read; |
| 2644 | bus->write = mv88e6xxx_mdio_write; |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2645 | bus->parent = chip->dev; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2646 | |
Andrew Lunn | 6f88284 | 2018-03-17 20:32:05 +0100 | [diff] [blame] | 2647 | if (!external) { |
| 2648 | err = mv88e6xxx_g2_irq_mdio_setup(chip, bus); |
| 2649 | if (err) |
| 2650 | return err; |
| 2651 | } |
| 2652 | |
Florian Fainelli | 00e798c | 2018-05-15 16:56:19 -0700 | [diff] [blame] | 2653 | err = of_mdiobus_register(bus, np); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2654 | if (err) { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2655 | dev_err(chip->dev, "Cannot register MDIO bus (%d)\n", err); |
Andrew Lunn | 6f88284 | 2018-03-17 20:32:05 +0100 | [diff] [blame] | 2656 | mv88e6xxx_g2_irq_mdio_free(chip, bus); |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2657 | return err; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2658 | } |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2659 | |
| 2660 | if (external) |
| 2661 | list_add_tail(&mdio_bus->list, &chip->mdios); |
| 2662 | else |
| 2663 | list_add(&mdio_bus->list, &chip->mdios); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2664 | |
| 2665 | return 0; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2666 | } |
| 2667 | |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2668 | static const struct of_device_id mv88e6xxx_mdio_external_match[] = { |
| 2669 | { .compatible = "marvell,mv88e6xxx-mdio-external", |
| 2670 | .data = (void *)true }, |
| 2671 | { }, |
| 2672 | }; |
| 2673 | |
Andrew Lunn | 3126aee | 2017-12-07 01:05:57 +0100 | [diff] [blame] | 2674 | static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip) |
| 2675 | |
| 2676 | { |
| 2677 | struct mv88e6xxx_mdio_bus *mdio_bus; |
| 2678 | struct mii_bus *bus; |
| 2679 | |
| 2680 | list_for_each_entry(mdio_bus, &chip->mdios, list) { |
| 2681 | bus = mdio_bus->bus; |
| 2682 | |
Andrew Lunn | 6f88284 | 2018-03-17 20:32:05 +0100 | [diff] [blame] | 2683 | if (!mdio_bus->external) |
| 2684 | mv88e6xxx_g2_irq_mdio_free(chip, bus); |
| 2685 | |
Andrew Lunn | 3126aee | 2017-12-07 01:05:57 +0100 | [diff] [blame] | 2686 | mdiobus_unregister(bus); |
| 2687 | } |
| 2688 | } |
| 2689 | |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2690 | static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip, |
| 2691 | struct device_node *np) |
| 2692 | { |
| 2693 | const struct of_device_id *match; |
| 2694 | struct device_node *child; |
| 2695 | int err; |
| 2696 | |
| 2697 | /* Always register one mdio bus for the internal/default mdio |
| 2698 | * bus. This maybe represented in the device tree, but is |
| 2699 | * optional. |
| 2700 | */ |
| 2701 | child = of_get_child_by_name(np, "mdio"); |
| 2702 | err = mv88e6xxx_mdio_register(chip, child, false); |
| 2703 | if (err) |
| 2704 | return err; |
| 2705 | |
| 2706 | /* Walk the device tree, and see if there are any other nodes |
| 2707 | * which say they are compatible with the external mdio |
| 2708 | * bus. |
| 2709 | */ |
| 2710 | for_each_available_child_of_node(np, child) { |
| 2711 | match = of_match_node(mv88e6xxx_mdio_external_match, child); |
| 2712 | if (match) { |
| 2713 | err = mv88e6xxx_mdio_register(chip, child, true); |
Andrew Lunn | 3126aee | 2017-12-07 01:05:57 +0100 | [diff] [blame] | 2714 | if (err) { |
| 2715 | mv88e6xxx_mdios_unregister(chip); |
Nishka Dasgupta | 78e4204 | 2019-07-23 16:13:07 +0530 | [diff] [blame] | 2716 | of_node_put(child); |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2717 | return err; |
Andrew Lunn | 3126aee | 2017-12-07 01:05:57 +0100 | [diff] [blame] | 2718 | } |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2719 | } |
| 2720 | } |
| 2721 | |
| 2722 | return 0; |
| 2723 | } |
| 2724 | |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2725 | static int mv88e6xxx_get_eeprom_len(struct dsa_switch *ds) |
| 2726 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2727 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2728 | |
| 2729 | return chip->eeprom_len; |
| 2730 | } |
| 2731 | |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2732 | static int mv88e6xxx_get_eeprom(struct dsa_switch *ds, |
| 2733 | struct ethtool_eeprom *eeprom, u8 *data) |
| 2734 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2735 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2736 | int err; |
| 2737 | |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 2738 | if (!chip->info->ops->get_eeprom) |
| 2739 | return -EOPNOTSUPP; |
| 2740 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2741 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 2742 | err = chip->info->ops->get_eeprom(chip, eeprom, data); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2743 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2744 | |
| 2745 | if (err) |
| 2746 | return err; |
| 2747 | |
| 2748 | eeprom->magic = 0xc3ec4951; |
| 2749 | |
| 2750 | return 0; |
| 2751 | } |
| 2752 | |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2753 | static int mv88e6xxx_set_eeprom(struct dsa_switch *ds, |
| 2754 | struct ethtool_eeprom *eeprom, u8 *data) |
| 2755 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2756 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2757 | int err; |
| 2758 | |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 2759 | if (!chip->info->ops->set_eeprom) |
| 2760 | return -EOPNOTSUPP; |
| 2761 | |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2762 | if (eeprom->magic != 0xc3ec4951) |
| 2763 | return -EINVAL; |
| 2764 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2765 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 2766 | err = chip->info->ops->set_eeprom(chip, eeprom, data); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 2767 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2768 | |
| 2769 | return err; |
| 2770 | } |
| 2771 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2772 | static const struct mv88e6xxx_ops mv88e6085_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2773 | /* MV88E6XXX_FAMILY_6097 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2774 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2775 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2776 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2777 | .set_switch_mac = mv88e6xxx_g1_set_switch_mac, |
Vivien Didelot | 7e20cfb | 2017-05-26 18:03:06 -0400 | [diff] [blame] | 2778 | .phy_read = mv88e6185_phy_ppu_read, |
| 2779 | .phy_write = mv88e6185_phy_ppu_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2780 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2781 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2782 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2783 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2784 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2785 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2786 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2787 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2788 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2789 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2790 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2791 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2792 | .port_get_cmode = mv88e6185_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 2793 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 2794 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2795 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2796 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2797 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2798 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2799 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2800 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2801 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2802 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2803 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 2804 | .ppu_enable = mv88e6185_g1_ppu_enable, |
| 2805 | .ppu_disable = mv88e6185_g1_ppu_disable, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2806 | .reset = mv88e6185_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 2807 | .rmu_disable = mv88e6085_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2808 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2809 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2810 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2811 | }; |
| 2812 | |
| 2813 | static const struct mv88e6xxx_ops mv88e6095_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2814 | /* MV88E6XXX_FAMILY_6095 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2815 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2816 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2817 | .set_switch_mac = mv88e6xxx_g1_set_switch_mac, |
Vivien Didelot | 7e20cfb | 2017-05-26 18:03:06 -0400 | [diff] [blame] | 2818 | .phy_read = mv88e6185_phy_ppu_read, |
| 2819 | .phy_write = mv88e6185_phy_ppu_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2820 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2821 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2822 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2823 | .port_set_frame_mode = mv88e6085_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2824 | .port_set_egress_floods = mv88e6185_port_set_egress_floods, |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2825 | .port_set_upstream_port = mv88e6095_port_set_upstream_port, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2826 | .port_link_state = mv88e6185_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2827 | .port_get_cmode = mv88e6185_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 2828 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 2829 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2830 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2831 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2832 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2833 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2834 | .mgmt_rsvd2cpu = mv88e6185_g2_mgmt_rsvd2cpu, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 2835 | .ppu_enable = mv88e6185_g1_ppu_enable, |
| 2836 | .ppu_disable = mv88e6185_g1_ppu_disable, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2837 | .reset = mv88e6185_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2838 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2839 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2840 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2841 | }; |
| 2842 | |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2843 | static const struct mv88e6xxx_ops mv88e6097_ops = { |
Stefan Eichenberger | 15da3cc | 2016-11-25 09:41:30 +0100 | [diff] [blame] | 2844 | /* MV88E6XXX_FAMILY_6097 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2845 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2846 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2847 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2848 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 2849 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 2850 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 2851 | .port_set_link = mv88e6xxx_port_set_link, |
| 2852 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 2853 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2854 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2855 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2856 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2857 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2858 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2859 | .port_egress_rate_limiting = mv88e6095_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2860 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2861 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2862 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2863 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2864 | .port_get_cmode = mv88e6185_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 2865 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2866 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2867 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2868 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2869 | .stats_get_strings = mv88e6095_stats_get_strings, |
| 2870 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2871 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2872 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Volodymyr Bendiuga | 91eaa47 | 2017-02-14 11:29:30 +0100 | [diff] [blame] | 2873 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2874 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2875 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2876 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 2877 | .rmu_disable = mv88e6085_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2878 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2879 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2880 | .phylink_validate = mv88e6185_phylink_validate, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2881 | }; |
| 2882 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2883 | static const struct mv88e6xxx_ops mv88e6123_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2884 | /* MV88E6XXX_FAMILY_6165 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2885 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2886 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2887 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2888 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Andrew Lunn | ec8378b | 2017-06-02 23:22:45 +0200 | [diff] [blame] | 2889 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 2890 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2891 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2892 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2893 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2894 | .port_set_frame_mode = mv88e6085_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2895 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2896 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2897 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2898 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2899 | .port_get_cmode = mv88e6185_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 2900 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | 0ac64c3 | 2017-06-02 23:22:46 +0200 | [diff] [blame] | 2901 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2902 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2903 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2904 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2905 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2906 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2907 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2908 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2909 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2910 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2911 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2912 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2913 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2914 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2915 | }; |
| 2916 | |
| 2917 | static const struct mv88e6xxx_ops mv88e6131_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2918 | /* MV88E6XXX_FAMILY_6185 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2919 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2920 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2921 | .set_switch_mac = mv88e6xxx_g1_set_switch_mac, |
Vivien Didelot | 7e20cfb | 2017-05-26 18:03:06 -0400 | [diff] [blame] | 2922 | .phy_read = mv88e6185_phy_ppu_read, |
| 2923 | .phy_write = mv88e6185_phy_ppu_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2924 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2925 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2926 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2927 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2928 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2929 | .port_set_egress_floods = mv88e6185_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2930 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2931 | .port_set_upstream_port = mv88e6095_port_set_upstream_port, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2932 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2933 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2934 | .port_pause_limit = mv88e6097_port_pause_limit, |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 2935 | .port_set_pause = mv88e6185_port_set_pause, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2936 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2937 | .port_get_cmode = mv88e6185_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 2938 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 2939 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2940 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2941 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2942 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2943 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2944 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2945 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2946 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2947 | .mgmt_rsvd2cpu = mv88e6185_g2_mgmt_rsvd2cpu, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 2948 | .ppu_enable = mv88e6185_g1_ppu_enable, |
Vivien Didelot | 02317e6 | 2018-05-09 11:38:49 -0400 | [diff] [blame] | 2949 | .set_cascade_port = mv88e6185_g1_set_cascade_port, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 2950 | .ppu_disable = mv88e6185_g1_ppu_disable, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2951 | .reset = mv88e6185_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2952 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2953 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2954 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2955 | }; |
| 2956 | |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2957 | static const struct mv88e6xxx_ops mv88e6141_ops = { |
| 2958 | /* MV88E6XXX_FAMILY_6341 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2959 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2960 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2961 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2962 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 2963 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| 2964 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 2965 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 2966 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 2967 | .port_set_link = mv88e6xxx_port_set_link, |
| 2968 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 2969 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
Marek Behún | 2642234 | 2018-10-13 14:40:31 +0200 | [diff] [blame] | 2970 | .port_set_speed = mv88e6341_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 2971 | .port_max_speed_mode = mv88e6341_port_max_speed_mode, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2972 | .port_tag_remap = mv88e6095_port_tag_remap, |
| 2973 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
| 2974 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
| 2975 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2976 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2977 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2978 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2979 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
| 2980 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 2981 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 2982 | .port_get_cmode = mv88e6352_port_get_cmode, |
Marek Behún | 7a3007d | 2019-08-26 23:31:55 +0200 | [diff] [blame] | 2983 | .port_set_cmode = mv88e6341_port_set_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 2984 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2985 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2986 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2987 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 2988 | .stats_get_strings = mv88e6320_stats_get_strings, |
| 2989 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2990 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 2991 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2992 | .watchdog_ops = &mv88e6390_watchdog_ops, |
| 2993 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2994 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2995 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2996 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2997 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Marek Behún | d3cf7d8 | 2019-08-26 23:31:53 +0200 | [diff] [blame] | 2998 | .serdes_power = mv88e6390_serdes_power, |
| 2999 | .serdes_get_lane = mv88e6341_serdes_get_lane, |
Vivien Didelot | 4241ef5 | 2019-08-31 16:18:29 -0400 | [diff] [blame] | 3000 | .serdes_irq_mapping = mv88e6390_serdes_irq_mapping, |
Vivien Didelot | 61a46b4 | 2019-08-31 16:18:34 -0400 | [diff] [blame] | 3001 | .serdes_irq_enable = mv88e6390_serdes_irq_enable, |
Vivien Didelot | 907b9b9 | 2019-08-31 16:18:35 -0400 | [diff] [blame] | 3002 | .serdes_irq_status = mv88e6390_serdes_irq_status, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3003 | .gpio_ops = &mv88e6352_gpio_ops, |
Marek Behún | e3af71a | 2019-02-25 12:39:55 +0100 | [diff] [blame] | 3004 | .phylink_validate = mv88e6341_phylink_validate, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 3005 | }; |
| 3006 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3007 | static const struct mv88e6xxx_ops mv88e6161_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3008 | /* MV88E6XXX_FAMILY_6165 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3009 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3010 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3011 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3012 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Andrew Lunn | ec8378b | 2017-06-02 23:22:45 +0200 | [diff] [blame] | 3013 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3014 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3015 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3016 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3017 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3018 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3019 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3020 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3021 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3022 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3023 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3024 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3025 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3026 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3027 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3028 | .port_get_cmode = mv88e6185_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3029 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a6da21b | 2019-03-01 23:43:39 +0100 | [diff] [blame] | 3030 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3031 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3032 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3033 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3034 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3035 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3036 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3037 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3038 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3039 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3040 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3041 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3042 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Andrew Lunn | a469a61 | 2018-07-18 22:38:21 +0200 | [diff] [blame] | 3043 | .avb_ops = &mv88e6165_avb_ops, |
Andrew Lunn | dfa5434 | 2018-07-18 22:38:22 +0200 | [diff] [blame] | 3044 | .ptp_ops = &mv88e6165_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3045 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3046 | }; |
| 3047 | |
| 3048 | static const struct mv88e6xxx_ops mv88e6165_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3049 | /* MV88E6XXX_FAMILY_6165 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3050 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3051 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3052 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3053 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Andrew Lunn | efb3e74 | 2017-01-24 14:53:47 +0100 | [diff] [blame] | 3054 | .phy_read = mv88e6165_phy_read, |
| 3055 | .phy_write = mv88e6165_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3056 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3057 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3058 | .port_set_speed = mv88e6185_port_set_speed, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3059 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3060 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3061 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3062 | .port_get_cmode = mv88e6185_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3063 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3064 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3065 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3066 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3067 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3068 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3069 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3070 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3071 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3072 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3073 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3074 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3075 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3076 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Andrew Lunn | a469a61 | 2018-07-18 22:38:21 +0200 | [diff] [blame] | 3077 | .avb_ops = &mv88e6165_avb_ops, |
Andrew Lunn | dfa5434 | 2018-07-18 22:38:22 +0200 | [diff] [blame] | 3078 | .ptp_ops = &mv88e6165_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3079 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3080 | }; |
| 3081 | |
| 3082 | static const struct mv88e6xxx_ops mv88e6171_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3083 | /* MV88E6XXX_FAMILY_6351 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3084 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3085 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3086 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3087 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3088 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3089 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3090 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3091 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Andrew Lunn | 94d66ae | 2016-11-10 15:44:01 +0100 | [diff] [blame] | 3092 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3093 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3094 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3095 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3096 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3097 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3098 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3099 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3100 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3101 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3102 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3103 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3104 | .port_get_cmode = mv88e6352_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3105 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3106 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3107 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3108 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3109 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3110 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3111 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3112 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3113 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3114 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3115 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3116 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3117 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3118 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3119 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3120 | }; |
| 3121 | |
| 3122 | static const struct mv88e6xxx_ops mv88e6172_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3123 | /* MV88E6XXX_FAMILY_6352 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3124 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3125 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3126 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3127 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3128 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3129 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3130 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3131 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3132 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3133 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | a0a0f62 | 2016-11-04 03:23:34 +0100 | [diff] [blame] | 3134 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3135 | .port_set_speed = mv88e6352_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3136 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3137 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3138 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3139 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3140 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3141 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3142 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3143 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3144 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3145 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3146 | .port_get_cmode = mv88e6352_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3147 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3148 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3149 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3150 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3151 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3152 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3153 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3154 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3155 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3156 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3157 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3158 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3159 | .rmu_disable = mv88e6352_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3160 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3161 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Vivien Didelot | 9db4a72 | 2019-08-31 16:18:31 -0400 | [diff] [blame] | 3162 | .serdes_get_lane = mv88e6352_serdes_get_lane, |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 3163 | .serdes_power = mv88e6352_serdes_power, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3164 | .gpio_ops = &mv88e6352_gpio_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3165 | .phylink_validate = mv88e6352_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3166 | }; |
| 3167 | |
| 3168 | static const struct mv88e6xxx_ops mv88e6175_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3169 | /* MV88E6XXX_FAMILY_6351 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3170 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3171 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3172 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3173 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3174 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3175 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3176 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3177 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Andrew Lunn | 94d66ae | 2016-11-10 15:44:01 +0100 | [diff] [blame] | 3178 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3179 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3180 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3181 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3182 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3183 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3184 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3185 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3186 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3187 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3188 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3189 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3190 | .port_get_cmode = mv88e6352_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3191 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3192 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3193 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3194 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3195 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3196 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3197 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3198 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3199 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3200 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3201 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3202 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3203 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3204 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3205 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3206 | }; |
| 3207 | |
| 3208 | static const struct mv88e6xxx_ops mv88e6176_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3209 | /* MV88E6XXX_FAMILY_6352 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3210 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3211 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3212 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3213 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3214 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3215 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3216 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3217 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3218 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3219 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | a0a0f62 | 2016-11-04 03:23:34 +0100 | [diff] [blame] | 3220 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3221 | .port_set_speed = mv88e6352_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3222 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3223 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3224 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3225 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3226 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3227 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3228 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3229 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3230 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3231 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3232 | .port_get_cmode = mv88e6352_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3233 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3234 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3235 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3236 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3237 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3238 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3239 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3240 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3241 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3242 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3243 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3244 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3245 | .rmu_disable = mv88e6352_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3246 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3247 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Vivien Didelot | 9db4a72 | 2019-08-31 16:18:31 -0400 | [diff] [blame] | 3248 | .serdes_get_lane = mv88e6352_serdes_get_lane, |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 3249 | .serdes_power = mv88e6352_serdes_power, |
Vivien Didelot | 4241ef5 | 2019-08-31 16:18:29 -0400 | [diff] [blame] | 3250 | .serdes_irq_mapping = mv88e6352_serdes_irq_mapping, |
Vivien Didelot | 61a46b4 | 2019-08-31 16:18:34 -0400 | [diff] [blame] | 3251 | .serdes_irq_enable = mv88e6352_serdes_irq_enable, |
Vivien Didelot | 907b9b9 | 2019-08-31 16:18:35 -0400 | [diff] [blame] | 3252 | .serdes_irq_status = mv88e6352_serdes_irq_status, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3253 | .gpio_ops = &mv88e6352_gpio_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3254 | .phylink_validate = mv88e6352_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3255 | }; |
| 3256 | |
| 3257 | static const struct mv88e6xxx_ops mv88e6185_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3258 | /* MV88E6XXX_FAMILY_6185 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3259 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3260 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3261 | .set_switch_mac = mv88e6xxx_g1_set_switch_mac, |
Vivien Didelot | 7e20cfb | 2017-05-26 18:03:06 -0400 | [diff] [blame] | 3262 | .phy_read = mv88e6185_phy_ppu_read, |
| 3263 | .phy_write = mv88e6185_phy_ppu_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3264 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3265 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3266 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3267 | .port_set_frame_mode = mv88e6085_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3268 | .port_set_egress_floods = mv88e6185_port_set_egress_floods, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3269 | .port_egress_rate_limiting = mv88e6095_port_egress_rate_limiting, |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 3270 | .port_set_upstream_port = mv88e6095_port_set_upstream_port, |
Andrew Lunn | 54186b9 | 2018-08-09 15:38:37 +0200 | [diff] [blame] | 3271 | .port_set_pause = mv88e6185_port_set_pause, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3272 | .port_link_state = mv88e6185_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3273 | .port_get_cmode = mv88e6185_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3274 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3275 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3276 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3277 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3278 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3279 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3280 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3281 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3282 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3283 | .mgmt_rsvd2cpu = mv88e6185_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 02317e6 | 2018-05-09 11:38:49 -0400 | [diff] [blame] | 3284 | .set_cascade_port = mv88e6185_g1_set_cascade_port, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 3285 | .ppu_enable = mv88e6185_g1_ppu_enable, |
| 3286 | .ppu_disable = mv88e6185_g1_ppu_disable, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3287 | .reset = mv88e6185_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3288 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3289 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3290 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3291 | }; |
| 3292 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3293 | static const struct mv88e6xxx_ops mv88e6190_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3294 | /* MV88E6XXX_FAMILY_6390 */ |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 3295 | .setup_errata = mv88e6390_setup_errata, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3296 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3297 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3298 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3299 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3300 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3301 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3302 | .port_set_link = mv88e6xxx_port_set_link, |
| 3303 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3304 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3305 | .port_set_speed = mv88e6390_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 3306 | .port_max_speed_mode = mv88e6390_port_max_speed_mode, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3307 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3308 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3309 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3310 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3311 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3312 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3313 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3314 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3315 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | fdc71ee | 2018-11-11 00:32:15 +0100 | [diff] [blame] | 3316 | .port_set_cmode = mv88e6390_port_set_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3317 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3318 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3319 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3320 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3321 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3322 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3323 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3324 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3325 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3326 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3327 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3328 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3329 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3330 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3331 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 6335e9f | 2017-05-26 01:03:23 +0200 | [diff] [blame] | 3332 | .serdes_power = mv88e6390_serdes_power, |
Marek Behún | 17deaf5 | 2019-08-26 23:31:52 +0200 | [diff] [blame] | 3333 | .serdes_get_lane = mv88e6390_serdes_get_lane, |
Vivien Didelot | 4241ef5 | 2019-08-31 16:18:29 -0400 | [diff] [blame] | 3334 | .serdes_irq_mapping = mv88e6390_serdes_irq_mapping, |
Vivien Didelot | 61a46b4 | 2019-08-31 16:18:34 -0400 | [diff] [blame] | 3335 | .serdes_irq_enable = mv88e6390_serdes_irq_enable, |
Vivien Didelot | 907b9b9 | 2019-08-31 16:18:35 -0400 | [diff] [blame] | 3336 | .serdes_irq_status = mv88e6390_serdes_irq_status, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3337 | .gpio_ops = &mv88e6352_gpio_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3338 | .phylink_validate = mv88e6390_phylink_validate, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3339 | }; |
| 3340 | |
| 3341 | static const struct mv88e6xxx_ops mv88e6190x_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3342 | /* MV88E6XXX_FAMILY_6390 */ |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 3343 | .setup_errata = mv88e6390_setup_errata, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3344 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3345 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3346 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3347 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3348 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3349 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3350 | .port_set_link = mv88e6xxx_port_set_link, |
| 3351 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3352 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3353 | .port_set_speed = mv88e6390x_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 3354 | .port_max_speed_mode = mv88e6390x_port_max_speed_mode, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3355 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3356 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3357 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3358 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3359 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3360 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3361 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3362 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3363 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | fdc71ee | 2018-11-11 00:32:15 +0100 | [diff] [blame] | 3364 | .port_set_cmode = mv88e6390x_port_set_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3365 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3366 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3367 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3368 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3369 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3370 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3371 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3372 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3373 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3374 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3375 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3376 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3377 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3378 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3379 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Marek Behún | d3cf7d8 | 2019-08-26 23:31:53 +0200 | [diff] [blame] | 3380 | .serdes_power = mv88e6390_serdes_power, |
Marek Behún | 17deaf5 | 2019-08-26 23:31:52 +0200 | [diff] [blame] | 3381 | .serdes_get_lane = mv88e6390x_serdes_get_lane, |
Vivien Didelot | 4241ef5 | 2019-08-31 16:18:29 -0400 | [diff] [blame] | 3382 | .serdes_irq_mapping = mv88e6390_serdes_irq_mapping, |
Vivien Didelot | 61a46b4 | 2019-08-31 16:18:34 -0400 | [diff] [blame] | 3383 | .serdes_irq_enable = mv88e6390_serdes_irq_enable, |
Vivien Didelot | 907b9b9 | 2019-08-31 16:18:35 -0400 | [diff] [blame] | 3384 | .serdes_irq_status = mv88e6390_serdes_irq_status, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3385 | .gpio_ops = &mv88e6352_gpio_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3386 | .phylink_validate = mv88e6390x_phylink_validate, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3387 | }; |
| 3388 | |
| 3389 | static const struct mv88e6xxx_ops mv88e6191_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3390 | /* MV88E6XXX_FAMILY_6390 */ |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 3391 | .setup_errata = mv88e6390_setup_errata, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3392 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3393 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3394 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3395 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3396 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3397 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3398 | .port_set_link = mv88e6xxx_port_set_link, |
| 3399 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3400 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3401 | .port_set_speed = mv88e6390_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 3402 | .port_max_speed_mode = mv88e6390_port_max_speed_mode, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3403 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3404 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3405 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3406 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3407 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3408 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3409 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3410 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3411 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | fdc71ee | 2018-11-11 00:32:15 +0100 | [diff] [blame] | 3412 | .port_set_cmode = mv88e6390_port_set_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3413 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3414 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3415 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3416 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3417 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3418 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3419 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3420 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3421 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3422 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3423 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3424 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3425 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3426 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3427 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 6335e9f | 2017-05-26 01:03:23 +0200 | [diff] [blame] | 3428 | .serdes_power = mv88e6390_serdes_power, |
Marek Behún | 17deaf5 | 2019-08-26 23:31:52 +0200 | [diff] [blame] | 3429 | .serdes_get_lane = mv88e6390_serdes_get_lane, |
Vivien Didelot | 4241ef5 | 2019-08-31 16:18:29 -0400 | [diff] [blame] | 3430 | .serdes_irq_mapping = mv88e6390_serdes_irq_mapping, |
Vivien Didelot | 61a46b4 | 2019-08-31 16:18:34 -0400 | [diff] [blame] | 3431 | .serdes_irq_enable = mv88e6390_serdes_irq_enable, |
Vivien Didelot | 907b9b9 | 2019-08-31 16:18:35 -0400 | [diff] [blame] | 3432 | .serdes_irq_status = mv88e6390_serdes_irq_status, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3433 | .avb_ops = &mv88e6390_avb_ops, |
| 3434 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3435 | .phylink_validate = mv88e6390_phylink_validate, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3436 | }; |
| 3437 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3438 | static const struct mv88e6xxx_ops mv88e6240_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3439 | /* MV88E6XXX_FAMILY_6352 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3440 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3441 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3442 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3443 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3444 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3445 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3446 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3447 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3448 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3449 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | a0a0f62 | 2016-11-04 03:23:34 +0100 | [diff] [blame] | 3450 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3451 | .port_set_speed = mv88e6352_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3452 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3453 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3454 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3455 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3456 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3457 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3458 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3459 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3460 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3461 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3462 | .port_get_cmode = mv88e6352_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3463 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3464 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3465 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3466 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3467 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3468 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3469 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3470 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3471 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3472 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3473 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3474 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3475 | .rmu_disable = mv88e6352_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3476 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3477 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Vivien Didelot | 9db4a72 | 2019-08-31 16:18:31 -0400 | [diff] [blame] | 3478 | .serdes_get_lane = mv88e6352_serdes_get_lane, |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 3479 | .serdes_power = mv88e6352_serdes_power, |
Vivien Didelot | 4241ef5 | 2019-08-31 16:18:29 -0400 | [diff] [blame] | 3480 | .serdes_irq_mapping = mv88e6352_serdes_irq_mapping, |
Vivien Didelot | 61a46b4 | 2019-08-31 16:18:34 -0400 | [diff] [blame] | 3481 | .serdes_irq_enable = mv88e6352_serdes_irq_enable, |
Vivien Didelot | 907b9b9 | 2019-08-31 16:18:35 -0400 | [diff] [blame] | 3482 | .serdes_irq_status = mv88e6352_serdes_irq_status, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3483 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3484 | .avb_ops = &mv88e6352_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3485 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3486 | .phylink_validate = mv88e6352_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3487 | }; |
| 3488 | |
Rasmus Villemoes | 1f71836 | 2019-06-04 07:34:32 +0000 | [diff] [blame] | 3489 | static const struct mv88e6xxx_ops mv88e6250_ops = { |
| 3490 | /* MV88E6XXX_FAMILY_6250 */ |
| 3491 | .ieee_pri_map = mv88e6250_g1_ieee_pri_map, |
| 3492 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
| 3493 | .irl_init_all = mv88e6352_g2_irl_init_all, |
| 3494 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3495 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
| 3496 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3497 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3498 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3499 | .port_set_link = mv88e6xxx_port_set_link, |
| 3500 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3501 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
| 3502 | .port_set_speed = mv88e6250_port_set_speed, |
| 3503 | .port_tag_remap = mv88e6095_port_tag_remap, |
| 3504 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
| 3505 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
| 3506 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
| 3507 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
| 3508 | .port_pause_limit = mv88e6097_port_pause_limit, |
| 3509 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
| 3510 | .port_link_state = mv88e6250_port_link_state, |
| 3511 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
| 3512 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
| 3513 | .stats_get_sset_count = mv88e6250_stats_get_sset_count, |
| 3514 | .stats_get_strings = mv88e6250_stats_get_strings, |
| 3515 | .stats_get_stats = mv88e6250_stats_get_stats, |
| 3516 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3517 | .set_egress_port = mv88e6095_g1_set_egress_port, |
| 3518 | .watchdog_ops = &mv88e6250_watchdog_ops, |
| 3519 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
| 3520 | .pot_clear = mv88e6xxx_g2_pot_clear, |
| 3521 | .reset = mv88e6250_g1_reset, |
| 3522 | .vtu_getnext = mv88e6250_g1_vtu_getnext, |
| 3523 | .vtu_loadpurge = mv88e6250_g1_vtu_loadpurge, |
Hubert Feurstein | 7150961 | 2019-07-31 10:23:51 +0200 | [diff] [blame] | 3524 | .avb_ops = &mv88e6352_avb_ops, |
| 3525 | .ptp_ops = &mv88e6250_ptp_ops, |
Rasmus Villemoes | 1f71836 | 2019-06-04 07:34:32 +0000 | [diff] [blame] | 3526 | .phylink_validate = mv88e6065_phylink_validate, |
| 3527 | }; |
| 3528 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3529 | static const struct mv88e6xxx_ops mv88e6290_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3530 | /* MV88E6XXX_FAMILY_6390 */ |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 3531 | .setup_errata = mv88e6390_setup_errata, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3532 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3533 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3534 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3535 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3536 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3537 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3538 | .port_set_link = mv88e6xxx_port_set_link, |
| 3539 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3540 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3541 | .port_set_speed = mv88e6390_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 3542 | .port_max_speed_mode = mv88e6390_port_max_speed_mode, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3543 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3544 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3545 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3546 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3547 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3548 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3549 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3550 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3551 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | fdc71ee | 2018-11-11 00:32:15 +0100 | [diff] [blame] | 3552 | .port_set_cmode = mv88e6390_port_set_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3553 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3554 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3555 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3556 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3557 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3558 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3559 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3560 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3561 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3562 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3563 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3564 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3565 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3566 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3567 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 6335e9f | 2017-05-26 01:03:23 +0200 | [diff] [blame] | 3568 | .serdes_power = mv88e6390_serdes_power, |
Marek Behún | 17deaf5 | 2019-08-26 23:31:52 +0200 | [diff] [blame] | 3569 | .serdes_get_lane = mv88e6390_serdes_get_lane, |
Vivien Didelot | 4241ef5 | 2019-08-31 16:18:29 -0400 | [diff] [blame] | 3570 | .serdes_irq_mapping = mv88e6390_serdes_irq_mapping, |
Vivien Didelot | 61a46b4 | 2019-08-31 16:18:34 -0400 | [diff] [blame] | 3571 | .serdes_irq_enable = mv88e6390_serdes_irq_enable, |
Vivien Didelot | 907b9b9 | 2019-08-31 16:18:35 -0400 | [diff] [blame] | 3572 | .serdes_irq_status = mv88e6390_serdes_irq_status, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3573 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3574 | .avb_ops = &mv88e6390_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3575 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3576 | .phylink_validate = mv88e6390_phylink_validate, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3577 | }; |
| 3578 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3579 | static const struct mv88e6xxx_ops mv88e6320_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3580 | /* MV88E6XXX_FAMILY_6320 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3581 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3582 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3583 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3584 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3585 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3586 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3587 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3588 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3589 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3590 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3591 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3592 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3593 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3594 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3595 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3596 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3597 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3598 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3599 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3600 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3601 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3602 | .port_get_cmode = mv88e6352_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3603 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3604 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3605 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3606 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3607 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3608 | .stats_get_stats = mv88e6320_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3609 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3610 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | 9c7f37e | 2018-12-19 18:28:54 +0100 | [diff] [blame] | 3611 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3612 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3613 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3614 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3615 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3616 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3617 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3618 | .avb_ops = &mv88e6352_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3619 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3620 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3621 | }; |
| 3622 | |
| 3623 | static const struct mv88e6xxx_ops mv88e6321_ops = { |
Vivien Didelot | bd80720 | 2017-07-17 13:03:37 -0400 | [diff] [blame] | 3624 | /* MV88E6XXX_FAMILY_6320 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3625 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3626 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3627 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3628 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3629 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3630 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3631 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3632 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3633 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3634 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3635 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3636 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3637 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3638 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3639 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3640 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3641 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3642 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3643 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3644 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3645 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3646 | .port_get_cmode = mv88e6352_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3647 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3648 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3649 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3650 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3651 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3652 | .stats_get_stats = mv88e6320_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3653 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3654 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | 9c7f37e | 2018-12-19 18:28:54 +0100 | [diff] [blame] | 3655 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3656 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3657 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3658 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3659 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3660 | .avb_ops = &mv88e6352_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3661 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3662 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3663 | }; |
| 3664 | |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3665 | static const struct mv88e6xxx_ops mv88e6341_ops = { |
| 3666 | /* MV88E6XXX_FAMILY_6341 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3667 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3668 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3669 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3670 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3671 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| 3672 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3673 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3674 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3675 | .port_set_link = mv88e6xxx_port_set_link, |
| 3676 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3677 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
Marek Behún | 2642234 | 2018-10-13 14:40:31 +0200 | [diff] [blame] | 3678 | .port_set_speed = mv88e6341_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 3679 | .port_max_speed_mode = mv88e6341_port_max_speed_mode, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3680 | .port_tag_remap = mv88e6095_port_tag_remap, |
| 3681 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
| 3682 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
| 3683 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3684 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3685 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3686 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3687 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
| 3688 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3689 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3690 | .port_get_cmode = mv88e6352_port_get_cmode, |
Marek Behún | 7a3007d | 2019-08-26 23:31:55 +0200 | [diff] [blame] | 3691 | .port_set_cmode = mv88e6341_port_set_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3692 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3693 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3694 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3695 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3696 | .stats_get_strings = mv88e6320_stats_get_strings, |
| 3697 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3698 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3699 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3700 | .watchdog_ops = &mv88e6390_watchdog_ops, |
| 3701 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3702 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3703 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3704 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3705 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Marek Behún | d3cf7d8 | 2019-08-26 23:31:53 +0200 | [diff] [blame] | 3706 | .serdes_power = mv88e6390_serdes_power, |
| 3707 | .serdes_get_lane = mv88e6341_serdes_get_lane, |
Vivien Didelot | 4241ef5 | 2019-08-31 16:18:29 -0400 | [diff] [blame] | 3708 | .serdes_irq_mapping = mv88e6390_serdes_irq_mapping, |
Vivien Didelot | 61a46b4 | 2019-08-31 16:18:34 -0400 | [diff] [blame] | 3709 | .serdes_irq_enable = mv88e6390_serdes_irq_enable, |
Vivien Didelot | 907b9b9 | 2019-08-31 16:18:35 -0400 | [diff] [blame] | 3710 | .serdes_irq_status = mv88e6390_serdes_irq_status, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3711 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3712 | .avb_ops = &mv88e6390_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3713 | .ptp_ops = &mv88e6352_ptp_ops, |
Marek Behún | e3af71a | 2019-02-25 12:39:55 +0100 | [diff] [blame] | 3714 | .phylink_validate = mv88e6341_phylink_validate, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3715 | }; |
| 3716 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3717 | static const struct mv88e6xxx_ops mv88e6350_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3718 | /* MV88E6XXX_FAMILY_6351 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3719 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3720 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3721 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3722 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3723 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3724 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3725 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3726 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Andrew Lunn | 94d66ae | 2016-11-10 15:44:01 +0100 | [diff] [blame] | 3727 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3728 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3729 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3730 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3731 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3732 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3733 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3734 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3735 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3736 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3737 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3738 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3739 | .port_get_cmode = mv88e6352_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3740 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3741 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3742 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3743 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3744 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3745 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3746 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3747 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3748 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3749 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3750 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3751 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3752 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3753 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3754 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3755 | }; |
| 3756 | |
| 3757 | static const struct mv88e6xxx_ops mv88e6351_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3758 | /* MV88E6XXX_FAMILY_6351 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3759 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3760 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3761 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3762 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3763 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3764 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3765 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3766 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Andrew Lunn | 94d66ae | 2016-11-10 15:44:01 +0100 | [diff] [blame] | 3767 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3768 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3769 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3770 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3771 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3772 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3773 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3774 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3775 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3776 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3777 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3778 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3779 | .port_get_cmode = mv88e6352_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3780 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3781 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3782 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3783 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3784 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3785 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3786 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3787 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3788 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3789 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3790 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3791 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3792 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3793 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3794 | .avb_ops = &mv88e6352_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3795 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3796 | .phylink_validate = mv88e6185_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3797 | }; |
| 3798 | |
| 3799 | static const struct mv88e6xxx_ops mv88e6352_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3800 | /* MV88E6XXX_FAMILY_6352 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3801 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3802 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3803 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3804 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3805 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3806 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3807 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3808 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3809 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3810 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | a0a0f62 | 2016-11-04 03:23:34 +0100 | [diff] [blame] | 3811 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3812 | .port_set_speed = mv88e6352_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3813 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3814 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3815 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3816 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3817 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3818 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3819 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3820 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3821 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3822 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3823 | .port_get_cmode = mv88e6352_port_get_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3824 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3825 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3826 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3827 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3828 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3829 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3830 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3831 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3832 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3833 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3834 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3835 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3836 | .rmu_disable = mv88e6352_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3837 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3838 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Vivien Didelot | 9db4a72 | 2019-08-31 16:18:31 -0400 | [diff] [blame] | 3839 | .serdes_get_lane = mv88e6352_serdes_get_lane, |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 3840 | .serdes_power = mv88e6352_serdes_power, |
Vivien Didelot | 4241ef5 | 2019-08-31 16:18:29 -0400 | [diff] [blame] | 3841 | .serdes_irq_mapping = mv88e6352_serdes_irq_mapping, |
Vivien Didelot | 61a46b4 | 2019-08-31 16:18:34 -0400 | [diff] [blame] | 3842 | .serdes_irq_enable = mv88e6352_serdes_irq_enable, |
Vivien Didelot | 907b9b9 | 2019-08-31 16:18:35 -0400 | [diff] [blame] | 3843 | .serdes_irq_status = mv88e6352_serdes_irq_status, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3844 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3845 | .avb_ops = &mv88e6352_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3846 | .ptp_ops = &mv88e6352_ptp_ops, |
Andrew Lunn | cda9f4a | 2018-03-01 02:02:31 +0100 | [diff] [blame] | 3847 | .serdes_get_sset_count = mv88e6352_serdes_get_sset_count, |
| 3848 | .serdes_get_strings = mv88e6352_serdes_get_strings, |
| 3849 | .serdes_get_stats = mv88e6352_serdes_get_stats, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3850 | .phylink_validate = mv88e6352_phylink_validate, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3851 | }; |
| 3852 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3853 | static const struct mv88e6xxx_ops mv88e6390_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3854 | /* MV88E6XXX_FAMILY_6390 */ |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 3855 | .setup_errata = mv88e6390_setup_errata, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3856 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3857 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3858 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3859 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3860 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3861 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3862 | .port_set_link = mv88e6xxx_port_set_link, |
| 3863 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3864 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3865 | .port_set_speed = mv88e6390_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 3866 | .port_max_speed_mode = mv88e6390_port_max_speed_mode, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3867 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3868 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3869 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3870 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3871 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3872 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3873 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3874 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3875 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3876 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3877 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | fdc71ee | 2018-11-11 00:32:15 +0100 | [diff] [blame] | 3878 | .port_set_cmode = mv88e6390_port_set_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3879 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3880 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3881 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3882 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3883 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3884 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3885 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3886 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3887 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3888 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3889 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3890 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3891 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3892 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3893 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 6335e9f | 2017-05-26 01:03:23 +0200 | [diff] [blame] | 3894 | .serdes_power = mv88e6390_serdes_power, |
Marek Behún | 17deaf5 | 2019-08-26 23:31:52 +0200 | [diff] [blame] | 3895 | .serdes_get_lane = mv88e6390_serdes_get_lane, |
Vivien Didelot | 4241ef5 | 2019-08-31 16:18:29 -0400 | [diff] [blame] | 3896 | .serdes_irq_mapping = mv88e6390_serdes_irq_mapping, |
Vivien Didelot | 61a46b4 | 2019-08-31 16:18:34 -0400 | [diff] [blame] | 3897 | .serdes_irq_enable = mv88e6390_serdes_irq_enable, |
Vivien Didelot | 907b9b9 | 2019-08-31 16:18:35 -0400 | [diff] [blame] | 3898 | .serdes_irq_status = mv88e6390_serdes_irq_status, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3899 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3900 | .avb_ops = &mv88e6390_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3901 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3902 | .phylink_validate = mv88e6390_phylink_validate, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3903 | }; |
| 3904 | |
| 3905 | static const struct mv88e6xxx_ops mv88e6390x_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3906 | /* MV88E6XXX_FAMILY_6390 */ |
Andrew Lunn | ea89098 | 2019-01-09 00:24:03 +0100 | [diff] [blame] | 3907 | .setup_errata = mv88e6390_setup_errata, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3908 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3909 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3910 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3911 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3912 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3913 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3914 | .port_set_link = mv88e6xxx_port_set_link, |
| 3915 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3916 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3917 | .port_set_speed = mv88e6390x_port_set_speed, |
Andrew Lunn | 7cbbee0 | 2019-03-08 01:21:27 +0100 | [diff] [blame] | 3918 | .port_max_speed_mode = mv88e6390x_port_max_speed_mode, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3919 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3920 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3921 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3922 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3923 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3924 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3925 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3926 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3927 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3928 | .port_link_state = mv88e6352_port_link_state, |
Andrew Lunn | 2d2e1dd | 2018-08-09 15:38:45 +0200 | [diff] [blame] | 3929 | .port_get_cmode = mv88e6352_port_get_cmode, |
Andrew Lunn | b3dce4d | 2018-11-11 00:32:14 +0100 | [diff] [blame] | 3930 | .port_set_cmode = mv88e6390x_port_set_cmode, |
Hubert Feurstein | 121b8fe | 2019-07-31 10:23:49 +0200 | [diff] [blame] | 3931 | .port_setup_message_port = mv88e6xxx_setup_message_port, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3932 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3933 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3934 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3935 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3936 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3937 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3938 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3939 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3940 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3941 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3942 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3943 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3944 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3945 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Marek Behún | d3cf7d8 | 2019-08-26 23:31:53 +0200 | [diff] [blame] | 3946 | .serdes_power = mv88e6390_serdes_power, |
Marek Behún | 17deaf5 | 2019-08-26 23:31:52 +0200 | [diff] [blame] | 3947 | .serdes_get_lane = mv88e6390x_serdes_get_lane, |
Vivien Didelot | 4241ef5 | 2019-08-31 16:18:29 -0400 | [diff] [blame] | 3948 | .serdes_irq_mapping = mv88e6390_serdes_irq_mapping, |
Vivien Didelot | 61a46b4 | 2019-08-31 16:18:34 -0400 | [diff] [blame] | 3949 | .serdes_irq_enable = mv88e6390_serdes_irq_enable, |
Vivien Didelot | 907b9b9 | 2019-08-31 16:18:35 -0400 | [diff] [blame] | 3950 | .serdes_irq_status = mv88e6390_serdes_irq_status, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3951 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3952 | .avb_ops = &mv88e6390_avb_ops, |
Andrew Lunn | 6d2ac8e | 2018-07-18 22:38:20 +0200 | [diff] [blame] | 3953 | .ptp_ops = &mv88e6352_ptp_ops, |
Russell King | 6c422e3 | 2018-08-09 15:38:39 +0200 | [diff] [blame] | 3954 | .phylink_validate = mv88e6390x_phylink_validate, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3955 | }; |
| 3956 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3957 | static const struct mv88e6xxx_info mv88e6xxx_table[] = { |
| 3958 | [MV88E6085] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3959 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6085, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3960 | .family = MV88E6XXX_FAMILY_6097, |
| 3961 | .name = "Marvell 88E6085", |
| 3962 | .num_databases = 4096, |
| 3963 | .num_ports = 10, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3964 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3965 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3966 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3967 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3968 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3969 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3970 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3971 | .g1_irqs = 8, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3972 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3973 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3974 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3975 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3976 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3977 | .ops = &mv88e6085_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3978 | }, |
| 3979 | |
| 3980 | [MV88E6095] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3981 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6095, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3982 | .family = MV88E6XXX_FAMILY_6095, |
| 3983 | .name = "Marvell 88E6095/88E6095F", |
| 3984 | .num_databases = 256, |
| 3985 | .num_ports = 11, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3986 | .num_internal_phys = 0, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3987 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3988 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3989 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3990 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3991 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3992 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3993 | .g1_irqs = 8, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3994 | .atu_move_port_mask = 0xf, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3995 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3996 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3997 | .ops = &mv88e6095_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3998 | }, |
| 3999 | |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 4000 | [MV88E6097] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4001 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6097, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 4002 | .family = MV88E6XXX_FAMILY_6097, |
| 4003 | .name = "Marvell 88E6097/88E6097F", |
| 4004 | .num_databases = 4096, |
| 4005 | .num_ports = 11, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4006 | .num_internal_phys = 8, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4007 | .max_vid = 4095, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 4008 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4009 | .phy_base_addr = 0x0, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 4010 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4011 | .global2_addr = 0x1c, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 4012 | .age_time_coeff = 15000, |
Stefan Eichenberger | c534178 | 2016-11-25 09:41:29 +0100 | [diff] [blame] | 4013 | .g1_irqs = 8, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4014 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4015 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4016 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4017 | .multi_chip = true, |
Stefan Eichenberger | 2bfcfcd | 2016-12-05 14:12:42 +0100 | [diff] [blame] | 4018 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 4019 | .ops = &mv88e6097_ops, |
| 4020 | }, |
| 4021 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4022 | [MV88E6123] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4023 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6123, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4024 | .family = MV88E6XXX_FAMILY_6165, |
| 4025 | .name = "Marvell 88E6123", |
| 4026 | .num_databases = 4096, |
| 4027 | .num_ports = 3, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4028 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4029 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4030 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4031 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4032 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4033 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4034 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4035 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4036 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4037 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4038 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4039 | .multi_chip = true, |
Andrew Lunn | 5ebe31d | 2017-06-07 15:06:19 +0200 | [diff] [blame] | 4040 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4041 | .ops = &mv88e6123_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4042 | }, |
| 4043 | |
| 4044 | [MV88E6131] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4045 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6131, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4046 | .family = MV88E6XXX_FAMILY_6185, |
| 4047 | .name = "Marvell 88E6131", |
| 4048 | .num_databases = 256, |
| 4049 | .num_ports = 8, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4050 | .num_internal_phys = 0, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4051 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4052 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4053 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4054 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4055 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4056 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4057 | .g1_irqs = 9, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4058 | .atu_move_port_mask = 0xf, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4059 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4060 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4061 | .ops = &mv88e6131_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4062 | }, |
| 4063 | |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4064 | [MV88E6141] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4065 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6141, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4066 | .family = MV88E6XXX_FAMILY_6341, |
Uwe Kleine-König | 79a68b2 | 2018-03-20 10:44:40 +0100 | [diff] [blame] | 4067 | .name = "Marvell 88E6141", |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4068 | .num_databases = 4096, |
| 4069 | .num_ports = 6, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4070 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4071 | .num_gpio = 11, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4072 | .max_vid = 4095, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4073 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4074 | .phy_base_addr = 0x10, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4075 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4076 | .global2_addr = 0x1c, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4077 | .age_time_coeff = 3750, |
| 4078 | .atu_move_port_mask = 0x1f, |
Andrew Lunn | adfccf1 | 2018-03-17 20:32:03 +0100 | [diff] [blame] | 4079 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4080 | .g2_irqs = 10, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4081 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4082 | .multi_chip = true, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4083 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 4084 | .ops = &mv88e6141_ops, |
| 4085 | }, |
| 4086 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4087 | [MV88E6161] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4088 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6161, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4089 | .family = MV88E6XXX_FAMILY_6165, |
| 4090 | .name = "Marvell 88E6161", |
| 4091 | .num_databases = 4096, |
| 4092 | .num_ports = 6, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4093 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4094 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4095 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4096 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4097 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4098 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4099 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4100 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4101 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4102 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4103 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4104 | .multi_chip = true, |
Andrew Lunn | 5ebe31d | 2017-06-07 15:06:19 +0200 | [diff] [blame] | 4105 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Andrew Lunn | dfa5434 | 2018-07-18 22:38:22 +0200 | [diff] [blame] | 4106 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4107 | .ops = &mv88e6161_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4108 | }, |
| 4109 | |
| 4110 | [MV88E6165] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4111 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6165, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4112 | .family = MV88E6XXX_FAMILY_6165, |
| 4113 | .name = "Marvell 88E6165", |
| 4114 | .num_databases = 4096, |
| 4115 | .num_ports = 6, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4116 | .num_internal_phys = 0, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4117 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4118 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4119 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4120 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4121 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4122 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4123 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4124 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4125 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4126 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4127 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4128 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Andrew Lunn | dfa5434 | 2018-07-18 22:38:22 +0200 | [diff] [blame] | 4129 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4130 | .ops = &mv88e6165_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4131 | }, |
| 4132 | |
| 4133 | [MV88E6171] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4134 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6171, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4135 | .family = MV88E6XXX_FAMILY_6351, |
| 4136 | .name = "Marvell 88E6171", |
| 4137 | .num_databases = 4096, |
| 4138 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4139 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4140 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4141 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4142 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4143 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4144 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4145 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4146 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4147 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4148 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4149 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4150 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4151 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4152 | .ops = &mv88e6171_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4153 | }, |
| 4154 | |
| 4155 | [MV88E6172] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4156 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6172, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4157 | .family = MV88E6XXX_FAMILY_6352, |
| 4158 | .name = "Marvell 88E6172", |
| 4159 | .num_databases = 4096, |
| 4160 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4161 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4162 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4163 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4164 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4165 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4166 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4167 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4168 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4169 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4170 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4171 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4172 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4173 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4174 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4175 | .ops = &mv88e6172_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4176 | }, |
| 4177 | |
| 4178 | [MV88E6175] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4179 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6175, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4180 | .family = MV88E6XXX_FAMILY_6351, |
| 4181 | .name = "Marvell 88E6175", |
| 4182 | .num_databases = 4096, |
| 4183 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4184 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4185 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4186 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4187 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4188 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4189 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4190 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4191 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4192 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4193 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4194 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4195 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4196 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4197 | .ops = &mv88e6175_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4198 | }, |
| 4199 | |
| 4200 | [MV88E6176] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4201 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6176, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4202 | .family = MV88E6XXX_FAMILY_6352, |
| 4203 | .name = "Marvell 88E6176", |
| 4204 | .num_databases = 4096, |
| 4205 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4206 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4207 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4208 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4209 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4210 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4211 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4212 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4213 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4214 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4215 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4216 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4217 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4218 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4219 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4220 | .ops = &mv88e6176_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4221 | }, |
| 4222 | |
| 4223 | [MV88E6185] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4224 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6185, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4225 | .family = MV88E6XXX_FAMILY_6185, |
| 4226 | .name = "Marvell 88E6185", |
| 4227 | .num_databases = 256, |
| 4228 | .num_ports = 10, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4229 | .num_internal_phys = 0, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4230 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4231 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4232 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4233 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4234 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4235 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4236 | .g1_irqs = 8, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4237 | .atu_move_port_mask = 0xf, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4238 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4239 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4240 | .ops = &mv88e6185_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4241 | }, |
| 4242 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4243 | [MV88E6190] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4244 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6190, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4245 | .family = MV88E6XXX_FAMILY_6390, |
| 4246 | .name = "Marvell 88E6190", |
| 4247 | .num_databases = 4096, |
| 4248 | .num_ports = 11, /* 10 + Z80 */ |
Heiner Kallweit | 95150f2 | 2019-03-02 10:06:05 +0100 | [diff] [blame] | 4249 | .num_internal_phys = 9, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4250 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 4251 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4252 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4253 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4254 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4255 | .global2_addr = 0x1c, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4256 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 4257 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4258 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4259 | .g2_irqs = 14, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4260 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4261 | .multi_chip = true, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4262 | .atu_move_port_mask = 0x1f, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4263 | .ops = &mv88e6190_ops, |
| 4264 | }, |
| 4265 | |
| 4266 | [MV88E6190X] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4267 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6190X, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4268 | .family = MV88E6XXX_FAMILY_6390, |
| 4269 | .name = "Marvell 88E6190X", |
| 4270 | .num_databases = 4096, |
| 4271 | .num_ports = 11, /* 10 + Z80 */ |
Heiner Kallweit | 95150f2 | 2019-03-02 10:06:05 +0100 | [diff] [blame] | 4272 | .num_internal_phys = 9, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4273 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 4274 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4275 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4276 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4277 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4278 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 4279 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4280 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4281 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4282 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4283 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4284 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4285 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4286 | .ops = &mv88e6190x_ops, |
| 4287 | }, |
| 4288 | |
| 4289 | [MV88E6191] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4290 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4291 | .family = MV88E6XXX_FAMILY_6390, |
| 4292 | .name = "Marvell 88E6191", |
| 4293 | .num_databases = 4096, |
| 4294 | .num_ports = 11, /* 10 + Z80 */ |
Heiner Kallweit | 95150f2 | 2019-03-02 10:06:05 +0100 | [diff] [blame] | 4295 | .num_internal_phys = 9, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 4296 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4297 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4298 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4299 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4300 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 4301 | .age_time_coeff = 3750, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4302 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4303 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4304 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4305 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4306 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4307 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4308 | .ptp_support = true, |
Vivien Didelot | 2cf4cefb | 2017-03-28 13:50:34 -0400 | [diff] [blame] | 4309 | .ops = &mv88e6191_ops, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4310 | }, |
| 4311 | |
Hubert Feurstein | 4902264 | 2019-07-31 10:23:46 +0200 | [diff] [blame] | 4312 | [MV88E6220] = { |
| 4313 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6220, |
| 4314 | .family = MV88E6XXX_FAMILY_6250, |
| 4315 | .name = "Marvell 88E6220", |
| 4316 | .num_databases = 64, |
| 4317 | |
| 4318 | /* Ports 2-4 are not routed to pins |
| 4319 | * => usable ports 0, 1, 5, 6 |
| 4320 | */ |
| 4321 | .num_ports = 7, |
| 4322 | .num_internal_phys = 2, |
Hubert Feurstein | c857486 | 2019-07-31 10:23:48 +0200 | [diff] [blame] | 4323 | .invalid_port_mask = BIT(2) | BIT(3) | BIT(4), |
Hubert Feurstein | 4902264 | 2019-07-31 10:23:46 +0200 | [diff] [blame] | 4324 | .max_vid = 4095, |
| 4325 | .port_base_addr = 0x08, |
| 4326 | .phy_base_addr = 0x00, |
| 4327 | .global1_addr = 0x0f, |
| 4328 | .global2_addr = 0x07, |
| 4329 | .age_time_coeff = 15000, |
| 4330 | .g1_irqs = 9, |
| 4331 | .g2_irqs = 10, |
| 4332 | .atu_move_port_mask = 0xf, |
| 4333 | .dual_chip = true, |
| 4334 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Hubert Feurstein | 7150961 | 2019-07-31 10:23:51 +0200 | [diff] [blame] | 4335 | .ptp_support = true, |
Hubert Feurstein | 4902264 | 2019-07-31 10:23:46 +0200 | [diff] [blame] | 4336 | .ops = &mv88e6250_ops, |
| 4337 | }, |
| 4338 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4339 | [MV88E6240] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4340 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6240, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4341 | .family = MV88E6XXX_FAMILY_6352, |
| 4342 | .name = "Marvell 88E6240", |
| 4343 | .num_databases = 4096, |
| 4344 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4345 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4346 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4347 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4348 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4349 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4350 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4351 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4352 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4353 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4354 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4355 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4356 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4357 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4358 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4359 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4360 | .ops = &mv88e6240_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4361 | }, |
| 4362 | |
Rasmus Villemoes | 1f71836 | 2019-06-04 07:34:32 +0000 | [diff] [blame] | 4363 | [MV88E6250] = { |
| 4364 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6250, |
| 4365 | .family = MV88E6XXX_FAMILY_6250, |
| 4366 | .name = "Marvell 88E6250", |
| 4367 | .num_databases = 64, |
| 4368 | .num_ports = 7, |
| 4369 | .num_internal_phys = 5, |
| 4370 | .max_vid = 4095, |
| 4371 | .port_base_addr = 0x08, |
| 4372 | .phy_base_addr = 0x00, |
| 4373 | .global1_addr = 0x0f, |
| 4374 | .global2_addr = 0x07, |
| 4375 | .age_time_coeff = 15000, |
| 4376 | .g1_irqs = 9, |
| 4377 | .g2_irqs = 10, |
| 4378 | .atu_move_port_mask = 0xf, |
| 4379 | .dual_chip = true, |
| 4380 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Hubert Feurstein | 7150961 | 2019-07-31 10:23:51 +0200 | [diff] [blame] | 4381 | .ptp_support = true, |
Rasmus Villemoes | 1f71836 | 2019-06-04 07:34:32 +0000 | [diff] [blame] | 4382 | .ops = &mv88e6250_ops, |
| 4383 | }, |
| 4384 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4385 | [MV88E6290] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4386 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6290, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4387 | .family = MV88E6XXX_FAMILY_6390, |
| 4388 | .name = "Marvell 88E6290", |
| 4389 | .num_databases = 4096, |
| 4390 | .num_ports = 11, /* 10 + Z80 */ |
Heiner Kallweit | 95150f2 | 2019-03-02 10:06:05 +0100 | [diff] [blame] | 4391 | .num_internal_phys = 9, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4392 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 4393 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4394 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4395 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4396 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4397 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 4398 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4399 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4400 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4401 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4402 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4403 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4404 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4405 | .ptp_support = true, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4406 | .ops = &mv88e6290_ops, |
| 4407 | }, |
| 4408 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4409 | [MV88E6320] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4410 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6320, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4411 | .family = MV88E6XXX_FAMILY_6320, |
| 4412 | .name = "Marvell 88E6320", |
| 4413 | .num_databases = 4096, |
| 4414 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4415 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4416 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4417 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4418 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4419 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4420 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4421 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4422 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4423 | .g1_irqs = 8, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4424 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4425 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4426 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4427 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4428 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4429 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4430 | .ops = &mv88e6320_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4431 | }, |
| 4432 | |
| 4433 | [MV88E6321] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4434 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6321, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4435 | .family = MV88E6XXX_FAMILY_6320, |
| 4436 | .name = "Marvell 88E6321", |
| 4437 | .num_databases = 4096, |
| 4438 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4439 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4440 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4441 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4442 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4443 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4444 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4445 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4446 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4447 | .g1_irqs = 8, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4448 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4449 | .atu_move_port_mask = 0xf, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4450 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4451 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4452 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4453 | .ops = &mv88e6321_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4454 | }, |
| 4455 | |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4456 | [MV88E6341] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4457 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6341, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4458 | .family = MV88E6XXX_FAMILY_6341, |
| 4459 | .name = "Marvell 88E6341", |
| 4460 | .num_databases = 4096, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4461 | .num_internal_phys = 5, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4462 | .num_ports = 6, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4463 | .num_gpio = 11, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4464 | .max_vid = 4095, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4465 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4466 | .phy_base_addr = 0x10, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4467 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4468 | .global2_addr = 0x1c, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4469 | .age_time_coeff = 3750, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4470 | .atu_move_port_mask = 0x1f, |
Andrew Lunn | adfccf1 | 2018-03-17 20:32:03 +0100 | [diff] [blame] | 4471 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4472 | .g2_irqs = 10, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4473 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4474 | .multi_chip = true, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4475 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4476 | .ptp_support = true, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4477 | .ops = &mv88e6341_ops, |
| 4478 | }, |
| 4479 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4480 | [MV88E6350] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4481 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6350, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4482 | .family = MV88E6XXX_FAMILY_6351, |
| 4483 | .name = "Marvell 88E6350", |
| 4484 | .num_databases = 4096, |
| 4485 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4486 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4487 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4488 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4489 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4490 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4491 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4492 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4493 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4494 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4495 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4496 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4497 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4498 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4499 | .ops = &mv88e6350_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4500 | }, |
| 4501 | |
| 4502 | [MV88E6351] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4503 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6351, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4504 | .family = MV88E6XXX_FAMILY_6351, |
| 4505 | .name = "Marvell 88E6351", |
| 4506 | .num_databases = 4096, |
| 4507 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4508 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4509 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4510 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4511 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4512 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4513 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4514 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4515 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4516 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4517 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4518 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4519 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4520 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4521 | .ops = &mv88e6351_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4522 | }, |
| 4523 | |
| 4524 | [MV88E6352] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4525 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6352, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4526 | .family = MV88E6XXX_FAMILY_6352, |
| 4527 | .name = "Marvell 88E6352", |
| 4528 | .num_databases = 4096, |
| 4529 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4530 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4531 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4532 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4533 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4534 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4535 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4536 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4537 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4538 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4539 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4540 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4541 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4542 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4543 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4544 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4545 | .ops = &mv88e6352_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4546 | }, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4547 | [MV88E6390] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4548 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6390, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4549 | .family = MV88E6XXX_FAMILY_6390, |
| 4550 | .name = "Marvell 88E6390", |
| 4551 | .num_databases = 4096, |
| 4552 | .num_ports = 11, /* 10 + Z80 */ |
Heiner Kallweit | 95150f2 | 2019-03-02 10:06:05 +0100 | [diff] [blame] | 4553 | .num_internal_phys = 9, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4554 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 4555 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4556 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4557 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4558 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4559 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 4560 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4561 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4562 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4563 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4564 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4565 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4566 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4567 | .ptp_support = true, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4568 | .ops = &mv88e6390_ops, |
| 4569 | }, |
| 4570 | [MV88E6390X] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4571 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6390X, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4572 | .family = MV88E6XXX_FAMILY_6390, |
| 4573 | .name = "Marvell 88E6390X", |
| 4574 | .num_databases = 4096, |
| 4575 | .num_ports = 11, /* 10 + Z80 */ |
Heiner Kallweit | 95150f2 | 2019-03-02 10:06:05 +0100 | [diff] [blame] | 4576 | .num_internal_phys = 9, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4577 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 4578 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4579 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4580 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4581 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4582 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 4583 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4584 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4585 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4586 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4587 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4588 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4589 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4590 | .ptp_support = true, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4591 | .ops = &mv88e6390x_ops, |
| 4592 | }, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4593 | }; |
| 4594 | |
Vivien Didelot | 5f7c036 | 2016-06-20 13:14:04 -0400 | [diff] [blame] | 4595 | static const struct mv88e6xxx_info *mv88e6xxx_lookup_info(unsigned int prod_num) |
Vivien Didelot | b9b3771 | 2015-10-30 19:39:48 -0400 | [diff] [blame] | 4596 | { |
Vivien Didelot | a439c06 | 2016-04-17 13:23:58 -0400 | [diff] [blame] | 4597 | int i; |
Vivien Didelot | b9b3771 | 2015-10-30 19:39:48 -0400 | [diff] [blame] | 4598 | |
Vivien Didelot | 5f7c036 | 2016-06-20 13:14:04 -0400 | [diff] [blame] | 4599 | for (i = 0; i < ARRAY_SIZE(mv88e6xxx_table); ++i) |
| 4600 | if (mv88e6xxx_table[i].prod_num == prod_num) |
| 4601 | return &mv88e6xxx_table[i]; |
Vivien Didelot | b9b3771 | 2015-10-30 19:39:48 -0400 | [diff] [blame] | 4602 | |
Vivien Didelot | b9b3771 | 2015-10-30 19:39:48 -0400 | [diff] [blame] | 4603 | return NULL; |
| 4604 | } |
| 4605 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4606 | static int mv88e6xxx_detect(struct mv88e6xxx_chip *chip) |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4607 | { |
| 4608 | const struct mv88e6xxx_info *info; |
Vivien Didelot | 8f6345b | 2016-07-20 18:18:36 -0400 | [diff] [blame] | 4609 | unsigned int prod_num, rev; |
| 4610 | u16 id; |
| 4611 | int err; |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4612 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4613 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4614 | err = mv88e6xxx_port_read(chip, 0, MV88E6XXX_PORT_SWITCH_ID, &id); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4615 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 8f6345b | 2016-07-20 18:18:36 -0400 | [diff] [blame] | 4616 | if (err) |
| 4617 | return err; |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4618 | |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4619 | prod_num = id & MV88E6XXX_PORT_SWITCH_ID_PROD_MASK; |
| 4620 | rev = id & MV88E6XXX_PORT_SWITCH_ID_REV_MASK; |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4621 | |
| 4622 | info = mv88e6xxx_lookup_info(prod_num); |
| 4623 | if (!info) |
| 4624 | return -ENODEV; |
| 4625 | |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 4626 | /* Update the compatible info with the probed one */ |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4627 | chip->info = info; |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4628 | |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 4629 | err = mv88e6xxx_g2_require(chip); |
| 4630 | if (err) |
| 4631 | return err; |
| 4632 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4633 | dev_info(chip->dev, "switch 0x%x detected: %s, revision %u\n", |
| 4634 | chip->info->prod_num, chip->info->name, rev); |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4635 | |
| 4636 | return 0; |
| 4637 | } |
| 4638 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4639 | static struct mv88e6xxx_chip *mv88e6xxx_alloc_chip(struct device *dev) |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4640 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4641 | struct mv88e6xxx_chip *chip; |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4642 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4643 | chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); |
| 4644 | if (!chip) |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4645 | return NULL; |
| 4646 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4647 | chip->dev = dev; |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4648 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4649 | mutex_init(&chip->reg_lock); |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 4650 | INIT_LIST_HEAD(&chip->mdios); |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4651 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4652 | return chip; |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4653 | } |
| 4654 | |
Florian Fainelli | 5ed4e3e | 2017-11-10 15:22:52 -0800 | [diff] [blame] | 4655 | static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds, |
| 4656 | int port) |
Andrew Lunn | 7b31436 | 2016-08-22 16:01:01 +0200 | [diff] [blame] | 4657 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 4658 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 2bbb33b | 2016-08-22 16:01:02 +0200 | [diff] [blame] | 4659 | |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4660 | return chip->info->tag_protocol; |
Andrew Lunn | 7b31436 | 2016-08-22 16:01:01 +0200 | [diff] [blame] | 4661 | } |
| 4662 | |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4663 | static int mv88e6xxx_port_mdb_prepare(struct dsa_switch *ds, int port, |
Vivien Didelot | 3709aad | 2017-11-30 11:23:58 -0500 | [diff] [blame] | 4664 | const struct switchdev_obj_port_mdb *mdb) |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4665 | { |
| 4666 | /* We don't need any dynamic resource from the kernel (yet), |
| 4667 | * so skip the prepare phase. |
| 4668 | */ |
| 4669 | |
| 4670 | return 0; |
| 4671 | } |
| 4672 | |
| 4673 | static void mv88e6xxx_port_mdb_add(struct dsa_switch *ds, int port, |
Vivien Didelot | 3709aad | 2017-11-30 11:23:58 -0500 | [diff] [blame] | 4674 | const struct switchdev_obj_port_mdb *mdb) |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4675 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 4676 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4677 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4678 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4679 | if (mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 4680 | MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC)) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 4681 | dev_err(ds->dev, "p%d: failed to load multicast MAC address\n", |
| 4682 | port); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4683 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4684 | } |
| 4685 | |
| 4686 | static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port, |
| 4687 | const struct switchdev_obj_port_mdb *mdb) |
| 4688 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 4689 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4690 | int err; |
| 4691 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4692 | mv88e6xxx_reg_lock(chip); |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4693 | err = mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 4694 | MV88E6XXX_G1_ATU_DATA_STATE_UNUSED); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4695 | mv88e6xxx_reg_unlock(chip); |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4696 | |
| 4697 | return err; |
| 4698 | } |
| 4699 | |
Russell King | 4f85901 | 2019-02-20 15:35:05 -0800 | [diff] [blame] | 4700 | static int mv88e6xxx_port_egress_floods(struct dsa_switch *ds, int port, |
| 4701 | bool unicast, bool multicast) |
| 4702 | { |
| 4703 | struct mv88e6xxx_chip *chip = ds->priv; |
| 4704 | int err = -EOPNOTSUPP; |
| 4705 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4706 | mv88e6xxx_reg_lock(chip); |
Russell King | 4f85901 | 2019-02-20 15:35:05 -0800 | [diff] [blame] | 4707 | if (chip->info->ops->port_set_egress_floods) |
| 4708 | err = chip->info->ops->port_set_egress_floods(chip, port, |
| 4709 | unicast, |
| 4710 | multicast); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4711 | mv88e6xxx_reg_unlock(chip); |
Russell King | 4f85901 | 2019-02-20 15:35:05 -0800 | [diff] [blame] | 4712 | |
| 4713 | return err; |
| 4714 | } |
| 4715 | |
Florian Fainelli | a82f67a | 2017-01-08 14:52:08 -0800 | [diff] [blame] | 4716 | static const struct dsa_switch_ops mv88e6xxx_switch_ops = { |
Andrew Lunn | 7b31436 | 2016-08-22 16:01:01 +0200 | [diff] [blame] | 4717 | .get_tag_protocol = mv88e6xxx_get_tag_protocol, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4718 | .setup = mv88e6xxx_setup, |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 4719 | .phylink_validate = mv88e6xxx_validate, |
| 4720 | .phylink_mac_link_state = mv88e6xxx_link_state, |
| 4721 | .phylink_mac_config = mv88e6xxx_mac_config, |
| 4722 | .phylink_mac_link_down = mv88e6xxx_mac_link_down, |
| 4723 | .phylink_mac_link_up = mv88e6xxx_mac_link_up, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4724 | .get_strings = mv88e6xxx_get_strings, |
| 4725 | .get_ethtool_stats = mv88e6xxx_get_ethtool_stats, |
| 4726 | .get_sset_count = mv88e6xxx_get_sset_count, |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 4727 | .port_enable = mv88e6xxx_port_enable, |
| 4728 | .port_disable = mv88e6xxx_port_disable, |
Vivien Didelot | 08f5006 | 2017-08-01 16:32:41 -0400 | [diff] [blame] | 4729 | .get_mac_eee = mv88e6xxx_get_mac_eee, |
| 4730 | .set_mac_eee = mv88e6xxx_set_mac_eee, |
Andrew Lunn | f8cd875 | 2016-05-10 23:27:25 +0200 | [diff] [blame] | 4731 | .get_eeprom_len = mv88e6xxx_get_eeprom_len, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4732 | .get_eeprom = mv88e6xxx_get_eeprom, |
| 4733 | .set_eeprom = mv88e6xxx_set_eeprom, |
| 4734 | .get_regs_len = mv88e6xxx_get_regs_len, |
| 4735 | .get_regs = mv88e6xxx_get_regs, |
Vivien Didelot | 2cfcd96 | 2016-07-18 20:45:40 -0400 | [diff] [blame] | 4736 | .set_ageing_time = mv88e6xxx_set_ageing_time, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4737 | .port_bridge_join = mv88e6xxx_port_bridge_join, |
| 4738 | .port_bridge_leave = mv88e6xxx_port_bridge_leave, |
Russell King | 4f85901 | 2019-02-20 15:35:05 -0800 | [diff] [blame] | 4739 | .port_egress_floods = mv88e6xxx_port_egress_floods, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4740 | .port_stp_state_set = mv88e6xxx_port_stp_state_set, |
Vivien Didelot | 749efcb | 2016-09-22 16:49:24 -0400 | [diff] [blame] | 4741 | .port_fast_age = mv88e6xxx_port_fast_age, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4742 | .port_vlan_filtering = mv88e6xxx_port_vlan_filtering, |
| 4743 | .port_vlan_prepare = mv88e6xxx_port_vlan_prepare, |
| 4744 | .port_vlan_add = mv88e6xxx_port_vlan_add, |
| 4745 | .port_vlan_del = mv88e6xxx_port_vlan_del, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4746 | .port_fdb_add = mv88e6xxx_port_fdb_add, |
| 4747 | .port_fdb_del = mv88e6xxx_port_fdb_del, |
| 4748 | .port_fdb_dump = mv88e6xxx_port_fdb_dump, |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4749 | .port_mdb_prepare = mv88e6xxx_port_mdb_prepare, |
| 4750 | .port_mdb_add = mv88e6xxx_port_mdb_add, |
| 4751 | .port_mdb_del = mv88e6xxx_port_mdb_del, |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 4752 | .crosschip_bridge_join = mv88e6xxx_crosschip_bridge_join, |
| 4753 | .crosschip_bridge_leave = mv88e6xxx_crosschip_bridge_leave, |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 4754 | .port_hwtstamp_set = mv88e6xxx_port_hwtstamp_set, |
| 4755 | .port_hwtstamp_get = mv88e6xxx_port_hwtstamp_get, |
| 4756 | .port_txtstamp = mv88e6xxx_port_txtstamp, |
| 4757 | .port_rxtstamp = mv88e6xxx_port_rxtstamp, |
| 4758 | .get_ts_info = mv88e6xxx_get_ts_info, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4759 | }; |
| 4760 | |
Florian Fainelli | 55ed0ce | 2017-01-26 10:45:51 -0800 | [diff] [blame] | 4761 | static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip) |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4762 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4763 | struct device *dev = chip->dev; |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4764 | struct dsa_switch *ds; |
| 4765 | |
Vivien Didelot | 73b1204 | 2017-03-30 17:37:10 -0400 | [diff] [blame] | 4766 | ds = dsa_switch_alloc(dev, mv88e6xxx_num_ports(chip)); |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4767 | if (!ds) |
| 4768 | return -ENOMEM; |
| 4769 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4770 | ds->priv = chip; |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4771 | ds->dev = dev; |
Vivien Didelot | 9d490b4 | 2016-08-23 12:38:56 -0400 | [diff] [blame] | 4772 | ds->ops = &mv88e6xxx_switch_ops; |
Vivien Didelot | 9ff74f2 | 2017-03-15 15:53:50 -0400 | [diff] [blame] | 4773 | ds->ageing_time_min = chip->info->age_time_coeff; |
| 4774 | ds->ageing_time_max = chip->info->age_time_coeff * U8_MAX; |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4775 | |
| 4776 | dev_set_drvdata(dev, ds); |
| 4777 | |
Vivien Didelot | 23c9ee4 | 2017-05-26 18:12:51 -0400 | [diff] [blame] | 4778 | return dsa_register_switch(ds); |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4779 | } |
| 4780 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4781 | static void mv88e6xxx_unregister_switch(struct mv88e6xxx_chip *chip) |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4782 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4783 | dsa_unregister_switch(chip->ds); |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4784 | } |
| 4785 | |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4786 | static const void *pdata_device_get_match_data(struct device *dev) |
| 4787 | { |
| 4788 | const struct of_device_id *matches = dev->driver->of_match_table; |
| 4789 | const struct dsa_mv88e6xxx_pdata *pdata = dev->platform_data; |
| 4790 | |
| 4791 | for (; matches->name[0] || matches->type[0] || matches->compatible[0]; |
| 4792 | matches++) { |
| 4793 | if (!strcmp(pdata->compatible, matches->compatible)) |
| 4794 | return matches->data; |
| 4795 | } |
| 4796 | return NULL; |
| 4797 | } |
| 4798 | |
Miquel Raynal | bcd3d9d | 2019-02-05 12:07:28 +0100 | [diff] [blame] | 4799 | /* There is no suspend to RAM support at DSA level yet, the switch configuration |
| 4800 | * would be lost after a power cycle so prevent it to be suspended. |
| 4801 | */ |
| 4802 | static int __maybe_unused mv88e6xxx_suspend(struct device *dev) |
| 4803 | { |
| 4804 | return -EOPNOTSUPP; |
| 4805 | } |
| 4806 | |
| 4807 | static int __maybe_unused mv88e6xxx_resume(struct device *dev) |
| 4808 | { |
| 4809 | return 0; |
| 4810 | } |
| 4811 | |
| 4812 | static SIMPLE_DEV_PM_OPS(mv88e6xxx_pm_ops, mv88e6xxx_suspend, mv88e6xxx_resume); |
| 4813 | |
Vivien Didelot | 57d3231 | 2016-06-20 13:13:58 -0400 | [diff] [blame] | 4814 | static int mv88e6xxx_probe(struct mdio_device *mdiodev) |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4815 | { |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4816 | struct dsa_mv88e6xxx_pdata *pdata = mdiodev->dev.platform_data; |
David S. Miller | 7ddae24 | 2018-05-20 19:04:24 -0400 | [diff] [blame] | 4817 | const struct mv88e6xxx_info *compat_info = NULL; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4818 | struct device *dev = &mdiodev->dev; |
Andrew Lunn | f8cd875 | 2016-05-10 23:27:25 +0200 | [diff] [blame] | 4819 | struct device_node *np = dev->of_node; |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4820 | struct mv88e6xxx_chip *chip; |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4821 | int port; |
Andrew Lunn | 52638f7 | 2016-05-10 23:27:22 +0200 | [diff] [blame] | 4822 | int err; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4823 | |
Andrew Lunn | 7bb8c99 | 2018-05-31 00:15:42 +0200 | [diff] [blame] | 4824 | if (!np && !pdata) |
| 4825 | return -EINVAL; |
| 4826 | |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4827 | if (np) |
| 4828 | compat_info = of_device_get_match_data(dev); |
| 4829 | |
| 4830 | if (pdata) { |
| 4831 | compat_info = pdata_device_get_match_data(dev); |
| 4832 | |
| 4833 | if (!pdata->netdev) |
| 4834 | return -EINVAL; |
| 4835 | |
| 4836 | for (port = 0; port < DSA_MAX_PORTS; port++) { |
| 4837 | if (!(pdata->enabled_ports & (1 << port))) |
| 4838 | continue; |
| 4839 | if (strcmp(pdata->cd.port_names[port], "cpu")) |
| 4840 | continue; |
| 4841 | pdata->cd.netdev[port] = &pdata->netdev->dev; |
| 4842 | break; |
| 4843 | } |
| 4844 | } |
| 4845 | |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 4846 | if (!compat_info) |
| 4847 | return -EINVAL; |
| 4848 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4849 | chip = mv88e6xxx_alloc_chip(dev); |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4850 | if (!chip) { |
| 4851 | err = -ENOMEM; |
| 4852 | goto out; |
| 4853 | } |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4854 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4855 | chip->info = compat_info; |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 4856 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4857 | err = mv88e6xxx_smi_init(chip, mdiodev->bus, mdiodev->addr); |
Vivien Didelot | 4a70c4a | 2016-06-20 13:14:07 -0400 | [diff] [blame] | 4858 | if (err) |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4859 | goto out; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4860 | |
Andrew Lunn | b4308f0 | 2016-11-21 23:26:55 +0100 | [diff] [blame] | 4861 | chip->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4862 | if (IS_ERR(chip->reset)) { |
| 4863 | err = PTR_ERR(chip->reset); |
| 4864 | goto out; |
| 4865 | } |
Baruch Siach | 7b75e49 | 2019-06-27 21:17:39 +0300 | [diff] [blame] | 4866 | if (chip->reset) |
| 4867 | usleep_range(1000, 2000); |
Andrew Lunn | b4308f0 | 2016-11-21 23:26:55 +0100 | [diff] [blame] | 4868 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4869 | err = mv88e6xxx_detect(chip); |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4870 | if (err) |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4871 | goto out; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4872 | |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 4873 | mv88e6xxx_phy_init(chip); |
| 4874 | |
Andrew Lunn | 00baabe | 2018-05-19 22:31:35 +0200 | [diff] [blame] | 4875 | if (chip->info->ops->get_eeprom) { |
| 4876 | if (np) |
| 4877 | of_property_read_u32(np, "eeprom-length", |
| 4878 | &chip->eeprom_len); |
| 4879 | else |
| 4880 | chip->eeprom_len = pdata->eeprom_len; |
| 4881 | } |
Andrew Lunn | f8cd875 | 2016-05-10 23:27:25 +0200 | [diff] [blame] | 4882 | |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4883 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4884 | err = mv88e6xxx_switch_reset(chip); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4885 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 4886 | if (err) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4887 | goto out; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 4888 | |
Andrew Lunn | a27415d | 2019-05-01 00:10:50 +0200 | [diff] [blame] | 4889 | if (np) { |
| 4890 | chip->irq = of_irq_get(np, 0); |
| 4891 | if (chip->irq == -EPROBE_DEFER) { |
| 4892 | err = chip->irq; |
| 4893 | goto out; |
| 4894 | } |
Andrew Lunn | 83c0afa | 2016-06-04 21:17:07 +0200 | [diff] [blame] | 4895 | } |
| 4896 | |
Andrew Lunn | a27415d | 2019-05-01 00:10:50 +0200 | [diff] [blame] | 4897 | if (pdata) |
| 4898 | chip->irq = pdata->irq; |
| 4899 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4900 | /* 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] | 4901 | * the PHYs will link their interrupts to these interrupt |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4902 | * controllers |
| 4903 | */ |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4904 | mv88e6xxx_reg_lock(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4905 | if (chip->irq > 0) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4906 | err = mv88e6xxx_g1_irq_setup(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4907 | else |
| 4908 | err = mv88e6xxx_irq_poll_setup(chip); |
Rasmus Villemoes | c9acece | 2019-06-20 13:50:42 +0000 | [diff] [blame] | 4909 | mv88e6xxx_reg_unlock(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4910 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4911 | if (err) |
| 4912 | goto out; |
| 4913 | |
| 4914 | if (chip->info->g2_irqs > 0) { |
| 4915 | err = mv88e6xxx_g2_irq_setup(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4916 | if (err) |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4917 | goto out_g1_irq; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4918 | } |
| 4919 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4920 | err = mv88e6xxx_g1_atu_prob_irq_setup(chip); |
| 4921 | if (err) |
| 4922 | goto out_g2_irq; |
| 4923 | |
| 4924 | err = mv88e6xxx_g1_vtu_prob_irq_setup(chip); |
| 4925 | if (err) |
| 4926 | goto out_g1_atu_prob_irq; |
| 4927 | |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 4928 | err = mv88e6xxx_mdios_register(chip, np); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4929 | if (err) |
Andrew Lunn | 62eb116 | 2018-01-14 02:32:45 +0100 | [diff] [blame] | 4930 | goto out_g1_vtu_prob_irq; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4931 | |
Florian Fainelli | 55ed0ce | 2017-01-26 10:45:51 -0800 | [diff] [blame] | 4932 | err = mv88e6xxx_register_switch(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4933 | if (err) |
| 4934 | goto out_mdio; |
| 4935 | |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4936 | return 0; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4937 | |
| 4938 | out_mdio: |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 4939 | mv88e6xxx_mdios_unregister(chip); |
Andrew Lunn | 62eb116 | 2018-01-14 02:32:45 +0100 | [diff] [blame] | 4940 | out_g1_vtu_prob_irq: |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4941 | mv88e6xxx_g1_vtu_prob_irq_free(chip); |
Andrew Lunn | 0977644 | 2018-01-14 02:32:44 +0100 | [diff] [blame] | 4942 | out_g1_atu_prob_irq: |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4943 | mv88e6xxx_g1_atu_prob_irq_free(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4944 | out_g2_irq: |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4945 | if (chip->info->g2_irqs > 0) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4946 | mv88e6xxx_g2_irq_free(chip); |
| 4947 | out_g1_irq: |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4948 | if (chip->irq > 0) |
Andrew Lunn | 46712644 | 2016-11-20 20:14:15 +0100 | [diff] [blame] | 4949 | mv88e6xxx_g1_irq_free(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4950 | else |
| 4951 | mv88e6xxx_irq_poll_free(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4952 | out: |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4953 | if (pdata) |
| 4954 | dev_put(pdata->netdev); |
| 4955 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4956 | return err; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4957 | } |
| 4958 | |
| 4959 | static void mv88e6xxx_remove(struct mdio_device *mdiodev) |
| 4960 | { |
| 4961 | struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 4962 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4963 | |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 4964 | if (chip->info->ptp_support) { |
| 4965 | mv88e6xxx_hwtstamp_free(chip); |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4966 | mv88e6xxx_ptp_free(chip); |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 4967 | } |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4968 | |
Andrew Lunn | 930188c | 2016-08-22 16:01:03 +0200 | [diff] [blame] | 4969 | mv88e6xxx_phy_destroy(chip); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4970 | mv88e6xxx_unregister_switch(chip); |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 4971 | mv88e6xxx_mdios_unregister(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4972 | |
Andrew Lunn | 76f38f1 | 2018-03-17 20:21:09 +0100 | [diff] [blame] | 4973 | mv88e6xxx_g1_vtu_prob_irq_free(chip); |
| 4974 | mv88e6xxx_g1_atu_prob_irq_free(chip); |
| 4975 | |
| 4976 | if (chip->info->g2_irqs > 0) |
| 4977 | mv88e6xxx_g2_irq_free(chip); |
| 4978 | |
Andrew Lunn | 76f38f1 | 2018-03-17 20:21:09 +0100 | [diff] [blame] | 4979 | if (chip->irq > 0) |
Andrew Lunn | 46712644 | 2016-11-20 20:14:15 +0100 | [diff] [blame] | 4980 | mv88e6xxx_g1_irq_free(chip); |
Andrew Lunn | 76f38f1 | 2018-03-17 20:21:09 +0100 | [diff] [blame] | 4981 | else |
| 4982 | mv88e6xxx_irq_poll_free(chip); |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4983 | } |
| 4984 | |
| 4985 | static const struct of_device_id mv88e6xxx_of_match[] = { |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 4986 | { |
| 4987 | .compatible = "marvell,mv88e6085", |
| 4988 | .data = &mv88e6xxx_table[MV88E6085], |
| 4989 | }, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4990 | { |
| 4991 | .compatible = "marvell,mv88e6190", |
| 4992 | .data = &mv88e6xxx_table[MV88E6190], |
| 4993 | }, |
Rasmus Villemoes | 1f71836 | 2019-06-04 07:34:32 +0000 | [diff] [blame] | 4994 | { |
| 4995 | .compatible = "marvell,mv88e6250", |
| 4996 | .data = &mv88e6xxx_table[MV88E6250], |
| 4997 | }, |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4998 | { /* sentinel */ }, |
| 4999 | }; |
| 5000 | |
| 5001 | MODULE_DEVICE_TABLE(of, mv88e6xxx_of_match); |
| 5002 | |
| 5003 | static struct mdio_driver mv88e6xxx_driver = { |
| 5004 | .probe = mv88e6xxx_probe, |
| 5005 | .remove = mv88e6xxx_remove, |
| 5006 | .mdiodrv.driver = { |
| 5007 | .name = "mv88e6085", |
| 5008 | .of_match_table = mv88e6xxx_of_match, |
Miquel Raynal | bcd3d9d | 2019-02-05 12:07:28 +0100 | [diff] [blame] | 5009 | .pm = &mv88e6xxx_pm_ops, |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 5010 | }, |
| 5011 | }; |
| 5012 | |
Andrew Lunn | 7324d50 | 2019-04-27 19:19:10 +0200 | [diff] [blame] | 5013 | mdio_module_driver(mv88e6xxx_driver); |
Ben Hutchings | 3d825ed | 2011-11-25 14:37:16 +0000 | [diff] [blame] | 5014 | |
| 5015 | MODULE_AUTHOR("Lennert Buytenhek <buytenh@wantstofly.org>"); |
| 5016 | MODULE_DESCRIPTION("Driver for Marvell 88E6XXX ethernet switch chips"); |
| 5017 | MODULE_LICENSE("GPL"); |