Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1 | /* |
Vivien Didelot | 0d3cd4b | 2016-06-21 12:28:19 -0400 | [diff] [blame] | 2 | * Marvell 88e6xxx Ethernet switch single-chip support |
| 3 | * |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 4 | * Copyright (c) 2008 Marvell Semiconductor |
| 5 | * |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 6 | * Copyright (c) 2016 Andrew Lunn <andrew@lunn.ch> |
| 7 | * |
Vivien Didelot | 4333d61 | 2017-03-28 15:10:36 -0400 | [diff] [blame] | 8 | * Copyright (c) 2016-2017 Savoir-faire Linux Inc. |
| 9 | * Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
| 10 | * |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | */ |
| 16 | |
Barry Grussling | 19b2f97 | 2013-01-08 16:05:54 +0000 | [diff] [blame] | 17 | #include <linux/delay.h> |
Guenter Roeck | defb05b | 2015-03-26 18:36:38 -0700 | [diff] [blame] | 18 | #include <linux/etherdevice.h> |
Andrew Lunn | dea8702 | 2015-08-31 15:56:47 +0200 | [diff] [blame] | 19 | #include <linux/ethtool.h> |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 20 | #include <linux/if_bridge.h> |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 21 | #include <linux/interrupt.h> |
| 22 | #include <linux/irq.h> |
| 23 | #include <linux/irqdomain.h> |
Barry Grussling | 19b2f97 | 2013-01-08 16:05:54 +0000 | [diff] [blame] | 24 | #include <linux/jiffies.h> |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 25 | #include <linux/list.h> |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 26 | #include <linux/mdio.h> |
Paul Gortmaker | 2bbba27 | 2012-01-24 10:41:40 +0000 | [diff] [blame] | 27 | #include <linux/module.h> |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 28 | #include <linux/of_device.h> |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 29 | #include <linux/of_irq.h> |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 30 | #include <linux/of_mdio.h> |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 31 | #include <linux/platform_data/mv88e6xxx.h> |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 32 | #include <linux/netdevice.h> |
Andrew Lunn | c8c1b39a | 2015-11-20 03:56:24 +0100 | [diff] [blame] | 33 | #include <linux/gpio/consumer.h> |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 34 | #include <linux/phy.h> |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 35 | #include <linux/phylink.h> |
Ben Hutchings | c8f0b86 | 2011-11-27 17:06:08 +0000 | [diff] [blame] | 36 | #include <net/dsa.h> |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 37 | |
Vivien Didelot | 4d5f2ba7 | 2017-06-02 17:06:15 -0400 | [diff] [blame] | 38 | #include "chip.h" |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 39 | #include "global1.h" |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 40 | #include "global2.h" |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 41 | #include "hwtstamp.h" |
Andrew Lunn | 10fa5bf | 2017-05-26 01:03:20 +0200 | [diff] [blame] | 42 | #include "phy.h" |
Vivien Didelot | 18abed2 | 2016-11-04 03:23:26 +0100 | [diff] [blame] | 43 | #include "port.h" |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 44 | #include "ptp.h" |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 45 | #include "serdes.h" |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 46 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 47 | static void assert_reg_lock(struct mv88e6xxx_chip *chip) |
Vivien Didelot | 3996a4f | 2015-10-30 18:56:45 -0400 | [diff] [blame] | 48 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 49 | if (unlikely(!mutex_is_locked(&chip->reg_lock))) { |
| 50 | dev_err(chip->dev, "Switch registers lock not held!\n"); |
Vivien Didelot | 3996a4f | 2015-10-30 18:56:45 -0400 | [diff] [blame] | 51 | dump_stack(); |
| 52 | } |
| 53 | } |
| 54 | |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 55 | /* The switch ADDR[4:1] configuration pins define the chip SMI device address |
| 56 | * (ADDR[0] is always zero, thus only even SMI addresses can be strapped). |
| 57 | * |
| 58 | * When ADDR is all zero, the chip uses Single-chip Addressing Mode, assuming it |
| 59 | * is the only device connected to the SMI master. In this mode it responds to |
| 60 | * all 32 possible SMI addresses, and thus maps directly the internal devices. |
| 61 | * |
| 62 | * When ADDR is non-zero, the chip uses Multi-chip Addressing Mode, allowing |
| 63 | * multiple devices to share the SMI interface. In this mode it responds to only |
| 64 | * 2 registers, used to indirectly access the internal SMI devices. |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 65 | */ |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 66 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 67 | static int mv88e6xxx_smi_read(struct mv88e6xxx_chip *chip, |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 68 | int addr, int reg, u16 *val) |
| 69 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 70 | if (!chip->smi_ops) |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 71 | return -EOPNOTSUPP; |
| 72 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 73 | return chip->smi_ops->read(chip, addr, reg, val); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 74 | } |
| 75 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 76 | static int mv88e6xxx_smi_write(struct mv88e6xxx_chip *chip, |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 77 | int addr, int reg, u16 val) |
| 78 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 79 | if (!chip->smi_ops) |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 80 | return -EOPNOTSUPP; |
| 81 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 82 | return chip->smi_ops->write(chip, addr, reg, val); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 83 | } |
| 84 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 85 | static int mv88e6xxx_smi_single_chip_read(struct mv88e6xxx_chip *chip, |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 86 | int addr, int reg, u16 *val) |
| 87 | { |
| 88 | int ret; |
| 89 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 90 | ret = mdiobus_read_nested(chip->bus, addr, reg); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 91 | if (ret < 0) |
| 92 | return ret; |
| 93 | |
| 94 | *val = ret & 0xffff; |
| 95 | |
| 96 | return 0; |
| 97 | } |
| 98 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 99 | static int mv88e6xxx_smi_single_chip_write(struct mv88e6xxx_chip *chip, |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 100 | int addr, int reg, u16 val) |
| 101 | { |
| 102 | int ret; |
| 103 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 104 | ret = mdiobus_write_nested(chip->bus, addr, reg, val); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 105 | if (ret < 0) |
| 106 | return ret; |
| 107 | |
| 108 | return 0; |
| 109 | } |
| 110 | |
Vivien Didelot | c08026a | 2016-09-29 12:21:59 -0400 | [diff] [blame] | 111 | static const struct mv88e6xxx_bus_ops mv88e6xxx_smi_single_chip_ops = { |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 112 | .read = mv88e6xxx_smi_single_chip_read, |
| 113 | .write = mv88e6xxx_smi_single_chip_write, |
| 114 | }; |
| 115 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 116 | static int mv88e6xxx_smi_multi_chip_wait(struct mv88e6xxx_chip *chip) |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 117 | { |
| 118 | int ret; |
| 119 | int i; |
| 120 | |
| 121 | for (i = 0; i < 16; i++) { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 122 | ret = mdiobus_read_nested(chip->bus, chip->sw_addr, SMI_CMD); |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 123 | if (ret < 0) |
| 124 | return ret; |
| 125 | |
Andrew Lunn | cca8b13 | 2015-04-02 04:06:39 +0200 | [diff] [blame] | 126 | if ((ret & SMI_CMD_BUSY) == 0) |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 127 | return 0; |
| 128 | } |
| 129 | |
| 130 | return -ETIMEDOUT; |
| 131 | } |
| 132 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 133 | static int mv88e6xxx_smi_multi_chip_read(struct mv88e6xxx_chip *chip, |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 134 | int addr, int reg, u16 *val) |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 135 | { |
| 136 | int ret; |
| 137 | |
Barry Grussling | 3675c8d | 2013-01-08 16:05:53 +0000 | [diff] [blame] | 138 | /* Wait for the bus to become free. */ |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 139 | ret = mv88e6xxx_smi_multi_chip_wait(chip); |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 140 | if (ret < 0) |
| 141 | return ret; |
| 142 | |
Barry Grussling | 3675c8d | 2013-01-08 16:05:53 +0000 | [diff] [blame] | 143 | /* Transmit the read command. */ |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 144 | ret = mdiobus_write_nested(chip->bus, chip->sw_addr, SMI_CMD, |
Neil Armstrong | 6e899e6 | 2015-10-22 10:37:53 +0200 | [diff] [blame] | 145 | SMI_CMD_OP_22_READ | (addr << 5) | reg); |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 146 | if (ret < 0) |
| 147 | return ret; |
| 148 | |
Barry Grussling | 3675c8d | 2013-01-08 16:05:53 +0000 | [diff] [blame] | 149 | /* Wait for the read command to complete. */ |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 150 | ret = mv88e6xxx_smi_multi_chip_wait(chip); |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 151 | if (ret < 0) |
| 152 | return ret; |
| 153 | |
Barry Grussling | 3675c8d | 2013-01-08 16:05:53 +0000 | [diff] [blame] | 154 | /* Read the data. */ |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 155 | ret = mdiobus_read_nested(chip->bus, chip->sw_addr, SMI_DATA); |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 156 | if (ret < 0) |
| 157 | return ret; |
| 158 | |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 159 | *val = ret & 0xffff; |
| 160 | |
| 161 | return 0; |
| 162 | } |
| 163 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 164 | static int mv88e6xxx_smi_multi_chip_write(struct mv88e6xxx_chip *chip, |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 165 | int addr, int reg, u16 val) |
| 166 | { |
| 167 | int ret; |
| 168 | |
| 169 | /* Wait for the bus to become free. */ |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 170 | ret = mv88e6xxx_smi_multi_chip_wait(chip); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 171 | if (ret < 0) |
| 172 | return ret; |
| 173 | |
| 174 | /* Transmit the data to write. */ |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 175 | ret = mdiobus_write_nested(chip->bus, chip->sw_addr, SMI_DATA, val); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 176 | if (ret < 0) |
| 177 | return ret; |
| 178 | |
| 179 | /* Transmit the write command. */ |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 180 | ret = mdiobus_write_nested(chip->bus, chip->sw_addr, SMI_CMD, |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 181 | SMI_CMD_OP_22_WRITE | (addr << 5) | reg); |
| 182 | if (ret < 0) |
| 183 | return ret; |
| 184 | |
| 185 | /* Wait for the write command to complete. */ |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 186 | ret = mv88e6xxx_smi_multi_chip_wait(chip); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 187 | if (ret < 0) |
| 188 | return ret; |
| 189 | |
| 190 | return 0; |
| 191 | } |
| 192 | |
Vivien Didelot | c08026a | 2016-09-29 12:21:59 -0400 | [diff] [blame] | 193 | static const struct mv88e6xxx_bus_ops mv88e6xxx_smi_multi_chip_ops = { |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 194 | .read = mv88e6xxx_smi_multi_chip_read, |
| 195 | .write = mv88e6xxx_smi_multi_chip_write, |
| 196 | }; |
| 197 | |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 198 | 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] | 199 | { |
| 200 | int err; |
| 201 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 202 | assert_reg_lock(chip); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 203 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 204 | err = mv88e6xxx_smi_read(chip, addr, reg, val); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 205 | if (err) |
| 206 | return err; |
| 207 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 208 | 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] | 209 | addr, reg, *val); |
| 210 | |
| 211 | return 0; |
| 212 | } |
| 213 | |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 214 | 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] | 215 | { |
| 216 | int err; |
| 217 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 218 | assert_reg_lock(chip); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 219 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 220 | err = mv88e6xxx_smi_write(chip, addr, reg, val); |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 221 | if (err) |
| 222 | return err; |
| 223 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 224 | 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] | 225 | addr, reg, val); |
| 226 | |
| 227 | return 0; |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 228 | } |
| 229 | |
Andrew Lunn | 10fa5bf | 2017-05-26 01:03:20 +0200 | [diff] [blame] | 230 | struct mii_bus *mv88e6xxx_default_mdio_bus(struct mv88e6xxx_chip *chip) |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 231 | { |
| 232 | struct mv88e6xxx_mdio_bus *mdio_bus; |
| 233 | |
| 234 | mdio_bus = list_first_entry(&chip->mdios, struct mv88e6xxx_mdio_bus, |
| 235 | list); |
| 236 | if (!mdio_bus) |
| 237 | return NULL; |
| 238 | |
| 239 | return mdio_bus->bus; |
| 240 | } |
| 241 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 242 | static void mv88e6xxx_g1_irq_mask(struct irq_data *d) |
| 243 | { |
| 244 | struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); |
| 245 | unsigned int n = d->hwirq; |
| 246 | |
| 247 | chip->g1_irq.masked |= (1 << n); |
| 248 | } |
| 249 | |
| 250 | static void mv88e6xxx_g1_irq_unmask(struct irq_data *d) |
| 251 | { |
| 252 | struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); |
| 253 | unsigned int n = d->hwirq; |
| 254 | |
| 255 | chip->g1_irq.masked &= ~(1 << n); |
| 256 | } |
| 257 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 258 | static irqreturn_t mv88e6xxx_g1_irq_thread_work(struct mv88e6xxx_chip *chip) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 259 | { |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 260 | unsigned int nhandled = 0; |
| 261 | unsigned int sub_irq; |
| 262 | unsigned int n; |
| 263 | u16 reg; |
| 264 | int err; |
| 265 | |
| 266 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | 8246692 | 2017-06-15 12:13:59 -0400 | [diff] [blame] | 267 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, ®); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 268 | mutex_unlock(&chip->reg_lock); |
| 269 | |
| 270 | if (err) |
| 271 | goto out; |
| 272 | |
| 273 | for (n = 0; n < chip->g1_irq.nirqs; ++n) { |
| 274 | if (reg & (1 << n)) { |
| 275 | sub_irq = irq_find_mapping(chip->g1_irq.domain, n); |
| 276 | handle_nested_irq(sub_irq); |
| 277 | ++nhandled; |
| 278 | } |
| 279 | } |
| 280 | out: |
| 281 | return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE); |
| 282 | } |
| 283 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 284 | static irqreturn_t mv88e6xxx_g1_irq_thread_fn(int irq, void *dev_id) |
| 285 | { |
| 286 | struct mv88e6xxx_chip *chip = dev_id; |
| 287 | |
| 288 | return mv88e6xxx_g1_irq_thread_work(chip); |
| 289 | } |
| 290 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 291 | static void mv88e6xxx_g1_irq_bus_lock(struct irq_data *d) |
| 292 | { |
| 293 | struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); |
| 294 | |
| 295 | mutex_lock(&chip->reg_lock); |
| 296 | } |
| 297 | |
| 298 | static void mv88e6xxx_g1_irq_bus_sync_unlock(struct irq_data *d) |
| 299 | { |
| 300 | struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); |
| 301 | u16 mask = GENMASK(chip->g1_irq.nirqs, 0); |
| 302 | u16 reg; |
| 303 | int err; |
| 304 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 305 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, ®); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 306 | if (err) |
| 307 | goto out; |
| 308 | |
| 309 | reg &= ~mask; |
| 310 | reg |= (~chip->g1_irq.masked & mask); |
| 311 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 312 | err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, reg); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 313 | if (err) |
| 314 | goto out; |
| 315 | |
| 316 | out: |
| 317 | mutex_unlock(&chip->reg_lock); |
| 318 | } |
| 319 | |
Bhumika Goyal | 6eb15e2 | 2017-08-19 16:25:52 +0530 | [diff] [blame] | 320 | static const struct irq_chip mv88e6xxx_g1_irq_chip = { |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 321 | .name = "mv88e6xxx-g1", |
| 322 | .irq_mask = mv88e6xxx_g1_irq_mask, |
| 323 | .irq_unmask = mv88e6xxx_g1_irq_unmask, |
| 324 | .irq_bus_lock = mv88e6xxx_g1_irq_bus_lock, |
| 325 | .irq_bus_sync_unlock = mv88e6xxx_g1_irq_bus_sync_unlock, |
| 326 | }; |
| 327 | |
| 328 | static int mv88e6xxx_g1_irq_domain_map(struct irq_domain *d, |
| 329 | unsigned int irq, |
| 330 | irq_hw_number_t hwirq) |
| 331 | { |
| 332 | struct mv88e6xxx_chip *chip = d->host_data; |
| 333 | |
| 334 | irq_set_chip_data(irq, d->host_data); |
| 335 | irq_set_chip_and_handler(irq, &chip->g1_irq.chip, handle_level_irq); |
| 336 | irq_set_noprobe(irq); |
| 337 | |
| 338 | return 0; |
| 339 | } |
| 340 | |
| 341 | static const struct irq_domain_ops mv88e6xxx_g1_irq_domain_ops = { |
| 342 | .map = mv88e6xxx_g1_irq_domain_map, |
| 343 | .xlate = irq_domain_xlate_twocell, |
| 344 | }; |
| 345 | |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame^] | 346 | /* To be called with reg_lock held */ |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 347 | static void mv88e6xxx_g1_irq_free_common(struct mv88e6xxx_chip *chip) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 348 | { |
| 349 | int irq, virq; |
Andrew Lunn | 3460a57 | 2016-11-20 20:14:16 +0100 | [diff] [blame] | 350 | u16 mask; |
| 351 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 352 | mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &mask); |
Andrew Lunn | 3d5fdba | 2017-12-07 01:05:56 +0100 | [diff] [blame] | 353 | mask &= ~GENMASK(chip->g1_irq.nirqs, 0); |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 354 | mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask); |
Andrew Lunn | 3460a57 | 2016-11-20 20:14:16 +0100 | [diff] [blame] | 355 | |
Andreas Färber | 5edef2f | 2016-11-27 23:26:28 +0100 | [diff] [blame] | 356 | for (irq = 0; irq < chip->g1_irq.nirqs; irq++) { |
Andrew Lunn | a3db3d3 | 2016-11-20 20:14:14 +0100 | [diff] [blame] | 357 | virq = irq_find_mapping(chip->g1_irq.domain, irq); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 358 | irq_dispose_mapping(virq); |
| 359 | } |
| 360 | |
Andrew Lunn | a3db3d3 | 2016-11-20 20:14:14 +0100 | [diff] [blame] | 361 | irq_domain_remove(chip->g1_irq.domain); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 362 | } |
| 363 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 364 | static void mv88e6xxx_g1_irq_free(struct mv88e6xxx_chip *chip) |
| 365 | { |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame^] | 366 | /* |
| 367 | * free_irq must be called without reg_lock taken because the irq |
| 368 | * handler takes this lock, too. |
| 369 | */ |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 370 | free_irq(chip->irq, chip); |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame^] | 371 | |
| 372 | mutex_lock(&chip->reg_lock); |
| 373 | mv88e6xxx_g1_irq_free_common(chip); |
| 374 | mutex_unlock(&chip->reg_lock); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 375 | } |
| 376 | |
| 377 | static int mv88e6xxx_g1_irq_setup_common(struct mv88e6xxx_chip *chip) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 378 | { |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 379 | int err, irq, virq; |
| 380 | u16 reg, mask; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 381 | |
| 382 | chip->g1_irq.nirqs = chip->info->g1_irqs; |
| 383 | chip->g1_irq.domain = irq_domain_add_simple( |
| 384 | NULL, chip->g1_irq.nirqs, 0, |
| 385 | &mv88e6xxx_g1_irq_domain_ops, chip); |
| 386 | if (!chip->g1_irq.domain) |
| 387 | return -ENOMEM; |
| 388 | |
| 389 | for (irq = 0; irq < chip->g1_irq.nirqs; irq++) |
| 390 | irq_create_mapping(chip->g1_irq.domain, irq); |
| 391 | |
| 392 | chip->g1_irq.chip = mv88e6xxx_g1_irq_chip; |
| 393 | chip->g1_irq.masked = ~0; |
| 394 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 395 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &mask); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 396 | if (err) |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 397 | goto out_mapping; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 398 | |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 399 | mask &= ~GENMASK(chip->g1_irq.nirqs, 0); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 400 | |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 401 | err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 402 | if (err) |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 403 | goto out_disable; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 404 | |
| 405 | /* Reading the interrupt status clears (most of) them */ |
Vivien Didelot | 8246692 | 2017-06-15 12:13:59 -0400 | [diff] [blame] | 406 | err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, ®); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 407 | if (err) |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 408 | goto out_disable; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 409 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 410 | return 0; |
| 411 | |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 412 | out_disable: |
Andrew Lunn | 3d5fdba | 2017-12-07 01:05:56 +0100 | [diff] [blame] | 413 | mask &= ~GENMASK(chip->g1_irq.nirqs, 0); |
Vivien Didelot | d77f432 | 2017-06-15 12:14:03 -0400 | [diff] [blame] | 414 | mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask); |
Andrew Lunn | 3dd0ef0 | 2016-11-20 20:14:17 +0100 | [diff] [blame] | 415 | |
| 416 | out_mapping: |
| 417 | for (irq = 0; irq < 16; irq++) { |
| 418 | virq = irq_find_mapping(chip->g1_irq.domain, irq); |
| 419 | irq_dispose_mapping(virq); |
| 420 | } |
| 421 | |
| 422 | irq_domain_remove(chip->g1_irq.domain); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 423 | |
| 424 | return err; |
| 425 | } |
| 426 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 427 | static int mv88e6xxx_g1_irq_setup(struct mv88e6xxx_chip *chip) |
| 428 | { |
| 429 | int err; |
| 430 | |
| 431 | err = mv88e6xxx_g1_irq_setup_common(chip); |
| 432 | if (err) |
| 433 | return err; |
| 434 | |
| 435 | err = request_threaded_irq(chip->irq, NULL, |
| 436 | mv88e6xxx_g1_irq_thread_fn, |
Andrew Lunn | 422a9fd6 | 2018-03-25 23:43:14 +0200 | [diff] [blame] | 437 | IRQF_ONESHOT, |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 438 | dev_name(chip->dev), chip); |
| 439 | if (err) |
| 440 | mv88e6xxx_g1_irq_free_common(chip); |
| 441 | |
| 442 | return err; |
| 443 | } |
| 444 | |
| 445 | static void mv88e6xxx_irq_poll(struct kthread_work *work) |
| 446 | { |
| 447 | struct mv88e6xxx_chip *chip = container_of(work, |
| 448 | struct mv88e6xxx_chip, |
| 449 | irq_poll_work.work); |
| 450 | mv88e6xxx_g1_irq_thread_work(chip); |
| 451 | |
| 452 | kthread_queue_delayed_work(chip->kworker, &chip->irq_poll_work, |
| 453 | msecs_to_jiffies(100)); |
| 454 | } |
| 455 | |
| 456 | static int mv88e6xxx_irq_poll_setup(struct mv88e6xxx_chip *chip) |
| 457 | { |
| 458 | int err; |
| 459 | |
| 460 | err = mv88e6xxx_g1_irq_setup_common(chip); |
| 461 | if (err) |
| 462 | return err; |
| 463 | |
| 464 | kthread_init_delayed_work(&chip->irq_poll_work, |
| 465 | mv88e6xxx_irq_poll); |
| 466 | |
| 467 | chip->kworker = kthread_create_worker(0, dev_name(chip->dev)); |
| 468 | if (IS_ERR(chip->kworker)) |
| 469 | return PTR_ERR(chip->kworker); |
| 470 | |
| 471 | kthread_queue_delayed_work(chip->kworker, &chip->irq_poll_work, |
| 472 | msecs_to_jiffies(100)); |
| 473 | |
| 474 | return 0; |
| 475 | } |
| 476 | |
| 477 | static void mv88e6xxx_irq_poll_free(struct mv88e6xxx_chip *chip) |
| 478 | { |
| 479 | kthread_cancel_delayed_work_sync(&chip->irq_poll_work); |
| 480 | kthread_destroy_worker(chip->kworker); |
Uwe Kleine-König | 3d82475 | 2018-07-20 11:53:15 +0200 | [diff] [blame^] | 481 | |
| 482 | mutex_lock(&chip->reg_lock); |
| 483 | mv88e6xxx_g1_irq_free_common(chip); |
| 484 | mutex_unlock(&chip->reg_lock); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 485 | } |
| 486 | |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 487 | int mv88e6xxx_wait(struct mv88e6xxx_chip *chip, int addr, int reg, u16 mask) |
Vivien Didelot | 2d79af6 | 2016-08-15 17:18:57 -0400 | [diff] [blame] | 488 | { |
Andrew Lunn | 6441e669 | 2016-08-19 00:01:55 +0200 | [diff] [blame] | 489 | int i; |
Vivien Didelot | 2d79af6 | 2016-08-15 17:18:57 -0400 | [diff] [blame] | 490 | |
Andrew Lunn | 6441e669 | 2016-08-19 00:01:55 +0200 | [diff] [blame] | 491 | for (i = 0; i < 16; i++) { |
Vivien Didelot | 2d79af6 | 2016-08-15 17:18:57 -0400 | [diff] [blame] | 492 | u16 val; |
| 493 | int err; |
| 494 | |
| 495 | err = mv88e6xxx_read(chip, addr, reg, &val); |
| 496 | if (err) |
| 497 | return err; |
| 498 | |
| 499 | if (!(val & mask)) |
| 500 | return 0; |
| 501 | |
| 502 | usleep_range(1000, 2000); |
| 503 | } |
| 504 | |
Andrew Lunn | 3085355 | 2016-08-19 00:01:57 +0200 | [diff] [blame] | 505 | dev_err(chip->dev, "Timeout while waiting for switch\n"); |
Vivien Didelot | 2d79af6 | 2016-08-15 17:18:57 -0400 | [diff] [blame] | 506 | return -ETIMEDOUT; |
| 507 | } |
| 508 | |
Vivien Didelot | f22ab64 | 2016-07-18 20:45:31 -0400 | [diff] [blame] | 509 | /* Indirect write to single pointer-data register with an Update bit */ |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 510 | int mv88e6xxx_update(struct mv88e6xxx_chip *chip, int addr, int reg, u16 update) |
Vivien Didelot | f22ab64 | 2016-07-18 20:45:31 -0400 | [diff] [blame] | 511 | { |
| 512 | u16 val; |
Andrew Lunn | 0f02b4f | 2016-08-19 00:01:56 +0200 | [diff] [blame] | 513 | int err; |
Vivien Didelot | f22ab64 | 2016-07-18 20:45:31 -0400 | [diff] [blame] | 514 | |
| 515 | /* Wait until the previous operation is completed */ |
Andrew Lunn | 0f02b4f | 2016-08-19 00:01:56 +0200 | [diff] [blame] | 516 | err = mv88e6xxx_wait(chip, addr, reg, BIT(15)); |
| 517 | if (err) |
| 518 | return err; |
Vivien Didelot | f22ab64 | 2016-07-18 20:45:31 -0400 | [diff] [blame] | 519 | |
| 520 | /* Set the Update bit to trigger a write operation */ |
| 521 | val = BIT(15) | update; |
| 522 | |
| 523 | return mv88e6xxx_write(chip, addr, reg, val); |
| 524 | } |
| 525 | |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 526 | static int mv88e6xxx_port_setup_mac(struct mv88e6xxx_chip *chip, int port, |
| 527 | int link, int speed, int duplex, |
| 528 | phy_interface_t mode) |
| 529 | { |
| 530 | int err; |
| 531 | |
| 532 | if (!chip->info->ops->port_set_link) |
| 533 | return 0; |
| 534 | |
| 535 | /* Port's MAC control must not be changed unless the link is down */ |
| 536 | err = chip->info->ops->port_set_link(chip, port, 0); |
| 537 | if (err) |
| 538 | return err; |
| 539 | |
| 540 | if (chip->info->ops->port_set_speed) { |
| 541 | err = chip->info->ops->port_set_speed(chip, port, speed); |
| 542 | if (err && err != -EOPNOTSUPP) |
| 543 | goto restore_link; |
| 544 | } |
| 545 | |
| 546 | if (chip->info->ops->port_set_duplex) { |
| 547 | err = chip->info->ops->port_set_duplex(chip, port, duplex); |
| 548 | if (err && err != -EOPNOTSUPP) |
| 549 | goto restore_link; |
| 550 | } |
| 551 | |
| 552 | if (chip->info->ops->port_set_rgmii_delay) { |
| 553 | err = chip->info->ops->port_set_rgmii_delay(chip, port, mode); |
| 554 | if (err && err != -EOPNOTSUPP) |
| 555 | goto restore_link; |
| 556 | } |
| 557 | |
Andrew Lunn | f39908d | 2017-02-04 20:02:50 +0100 | [diff] [blame] | 558 | if (chip->info->ops->port_set_cmode) { |
| 559 | err = chip->info->ops->port_set_cmode(chip, port, mode); |
| 560 | if (err && err != -EOPNOTSUPP) |
| 561 | goto restore_link; |
| 562 | } |
| 563 | |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 564 | err = 0; |
| 565 | restore_link: |
| 566 | if (chip->info->ops->port_set_link(chip, port, link)) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 567 | 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] | 568 | |
| 569 | return err; |
| 570 | } |
| 571 | |
Andrew Lunn | dea8702 | 2015-08-31 15:56:47 +0200 | [diff] [blame] | 572 | /* We expect the switch to perform auto negotiation if there is a real |
| 573 | * phy. However, in the case of a fixed link phy, we force the port |
| 574 | * settings from the fixed link settings. |
| 575 | */ |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 576 | static void mv88e6xxx_adjust_link(struct dsa_switch *ds, int port, |
| 577 | struct phy_device *phydev) |
Andrew Lunn | dea8702 | 2015-08-31 15:56:47 +0200 | [diff] [blame] | 578 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 579 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 580 | int err; |
Andrew Lunn | dea8702 | 2015-08-31 15:56:47 +0200 | [diff] [blame] | 581 | |
| 582 | if (!phy_is_pseudo_fixed_link(phydev)) |
| 583 | return; |
| 584 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 585 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 586 | err = mv88e6xxx_port_setup_mac(chip, port, phydev->link, phydev->speed, |
| 587 | phydev->duplex, phydev->interface); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 588 | mutex_unlock(&chip->reg_lock); |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 589 | |
| 590 | if (err && err != -EOPNOTSUPP) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 591 | dev_err(ds->dev, "p%d: failed to configure MAC\n", port); |
Andrew Lunn | dea8702 | 2015-08-31 15:56:47 +0200 | [diff] [blame] | 592 | } |
| 593 | |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 594 | static void mv88e6xxx_validate(struct dsa_switch *ds, int port, |
| 595 | unsigned long *supported, |
| 596 | struct phylink_link_state *state) |
| 597 | { |
| 598 | } |
| 599 | |
| 600 | static int mv88e6xxx_link_state(struct dsa_switch *ds, int port, |
| 601 | struct phylink_link_state *state) |
| 602 | { |
| 603 | struct mv88e6xxx_chip *chip = ds->priv; |
| 604 | int err; |
| 605 | |
| 606 | mutex_lock(&chip->reg_lock); |
| 607 | err = mv88e6xxx_port_link_state(chip, port, state); |
| 608 | mutex_unlock(&chip->reg_lock); |
| 609 | |
| 610 | return err; |
| 611 | } |
| 612 | |
| 613 | static void mv88e6xxx_mac_config(struct dsa_switch *ds, int port, |
| 614 | unsigned int mode, |
| 615 | const struct phylink_link_state *state) |
| 616 | { |
| 617 | struct mv88e6xxx_chip *chip = ds->priv; |
| 618 | int speed, duplex, link, err; |
| 619 | |
| 620 | if (mode == MLO_AN_PHY) |
| 621 | return; |
| 622 | |
| 623 | if (mode == MLO_AN_FIXED) { |
| 624 | link = LINK_FORCED_UP; |
| 625 | speed = state->speed; |
| 626 | duplex = state->duplex; |
| 627 | } else { |
| 628 | speed = SPEED_UNFORCED; |
| 629 | duplex = DUPLEX_UNFORCED; |
| 630 | link = LINK_UNFORCED; |
| 631 | } |
| 632 | |
| 633 | mutex_lock(&chip->reg_lock); |
| 634 | err = mv88e6xxx_port_setup_mac(chip, port, link, speed, duplex, |
| 635 | state->interface); |
| 636 | mutex_unlock(&chip->reg_lock); |
| 637 | |
| 638 | if (err && err != -EOPNOTSUPP) |
| 639 | dev_err(ds->dev, "p%d: failed to configure MAC\n", port); |
| 640 | } |
| 641 | |
| 642 | static void mv88e6xxx_mac_link_force(struct dsa_switch *ds, int port, int link) |
| 643 | { |
| 644 | struct mv88e6xxx_chip *chip = ds->priv; |
| 645 | int err; |
| 646 | |
| 647 | mutex_lock(&chip->reg_lock); |
| 648 | err = chip->info->ops->port_set_link(chip, port, link); |
| 649 | mutex_unlock(&chip->reg_lock); |
| 650 | |
| 651 | if (err) |
| 652 | dev_err(chip->dev, "p%d: failed to force MAC link\n", port); |
| 653 | } |
| 654 | |
| 655 | static void mv88e6xxx_mac_link_down(struct dsa_switch *ds, int port, |
| 656 | unsigned int mode, |
| 657 | phy_interface_t interface) |
| 658 | { |
| 659 | if (mode == MLO_AN_FIXED) |
| 660 | mv88e6xxx_mac_link_force(ds, port, LINK_FORCED_DOWN); |
| 661 | } |
| 662 | |
| 663 | static void mv88e6xxx_mac_link_up(struct dsa_switch *ds, int port, |
| 664 | unsigned int mode, phy_interface_t interface, |
| 665 | struct phy_device *phydev) |
| 666 | { |
| 667 | if (mode == MLO_AN_FIXED) |
| 668 | mv88e6xxx_mac_link_force(ds, port, LINK_FORCED_UP); |
| 669 | } |
| 670 | |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 671 | static int mv88e6xxx_stats_snapshot(struct mv88e6xxx_chip *chip, int port) |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 672 | { |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 673 | if (!chip->info->ops->stats_snapshot) |
| 674 | return -EOPNOTSUPP; |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 675 | |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 676 | return chip->info->ops->stats_snapshot(chip, port); |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 677 | } |
| 678 | |
Andrew Lunn | e413e7e | 2015-04-02 04:06:38 +0200 | [diff] [blame] | 679 | static struct mv88e6xxx_hw_stat mv88e6xxx_hw_stats[] = { |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 680 | { "in_good_octets", 8, 0x00, STATS_TYPE_BANK0, }, |
| 681 | { "in_bad_octets", 4, 0x02, STATS_TYPE_BANK0, }, |
| 682 | { "in_unicast", 4, 0x04, STATS_TYPE_BANK0, }, |
| 683 | { "in_broadcasts", 4, 0x06, STATS_TYPE_BANK0, }, |
| 684 | { "in_multicasts", 4, 0x07, STATS_TYPE_BANK0, }, |
| 685 | { "in_pause", 4, 0x16, STATS_TYPE_BANK0, }, |
| 686 | { "in_undersize", 4, 0x18, STATS_TYPE_BANK0, }, |
| 687 | { "in_fragments", 4, 0x19, STATS_TYPE_BANK0, }, |
| 688 | { "in_oversize", 4, 0x1a, STATS_TYPE_BANK0, }, |
| 689 | { "in_jabber", 4, 0x1b, STATS_TYPE_BANK0, }, |
| 690 | { "in_rx_error", 4, 0x1c, STATS_TYPE_BANK0, }, |
| 691 | { "in_fcs_error", 4, 0x1d, STATS_TYPE_BANK0, }, |
| 692 | { "out_octets", 8, 0x0e, STATS_TYPE_BANK0, }, |
| 693 | { "out_unicast", 4, 0x10, STATS_TYPE_BANK0, }, |
| 694 | { "out_broadcasts", 4, 0x13, STATS_TYPE_BANK0, }, |
| 695 | { "out_multicasts", 4, 0x12, STATS_TYPE_BANK0, }, |
| 696 | { "out_pause", 4, 0x15, STATS_TYPE_BANK0, }, |
| 697 | { "excessive", 4, 0x11, STATS_TYPE_BANK0, }, |
| 698 | { "collisions", 4, 0x1e, STATS_TYPE_BANK0, }, |
| 699 | { "deferred", 4, 0x05, STATS_TYPE_BANK0, }, |
| 700 | { "single", 4, 0x14, STATS_TYPE_BANK0, }, |
| 701 | { "multiple", 4, 0x17, STATS_TYPE_BANK0, }, |
| 702 | { "out_fcs_error", 4, 0x03, STATS_TYPE_BANK0, }, |
| 703 | { "late", 4, 0x1f, STATS_TYPE_BANK0, }, |
| 704 | { "hist_64bytes", 4, 0x08, STATS_TYPE_BANK0, }, |
| 705 | { "hist_65_127bytes", 4, 0x09, STATS_TYPE_BANK0, }, |
| 706 | { "hist_128_255bytes", 4, 0x0a, STATS_TYPE_BANK0, }, |
| 707 | { "hist_256_511bytes", 4, 0x0b, STATS_TYPE_BANK0, }, |
| 708 | { "hist_512_1023bytes", 4, 0x0c, STATS_TYPE_BANK0, }, |
| 709 | { "hist_1024_max_bytes", 4, 0x0d, STATS_TYPE_BANK0, }, |
| 710 | { "sw_in_discards", 4, 0x10, STATS_TYPE_PORT, }, |
| 711 | { "sw_in_filtered", 2, 0x12, STATS_TYPE_PORT, }, |
| 712 | { "sw_out_filtered", 2, 0x13, STATS_TYPE_PORT, }, |
| 713 | { "in_discards", 4, 0x00, STATS_TYPE_BANK1, }, |
| 714 | { "in_filtered", 4, 0x01, STATS_TYPE_BANK1, }, |
| 715 | { "in_accepted", 4, 0x02, STATS_TYPE_BANK1, }, |
| 716 | { "in_bad_accepted", 4, 0x03, STATS_TYPE_BANK1, }, |
| 717 | { "in_good_avb_class_a", 4, 0x04, STATS_TYPE_BANK1, }, |
| 718 | { "in_good_avb_class_b", 4, 0x05, STATS_TYPE_BANK1, }, |
| 719 | { "in_bad_avb_class_a", 4, 0x06, STATS_TYPE_BANK1, }, |
| 720 | { "in_bad_avb_class_b", 4, 0x07, STATS_TYPE_BANK1, }, |
| 721 | { "tcam_counter_0", 4, 0x08, STATS_TYPE_BANK1, }, |
| 722 | { "tcam_counter_1", 4, 0x09, STATS_TYPE_BANK1, }, |
| 723 | { "tcam_counter_2", 4, 0x0a, STATS_TYPE_BANK1, }, |
| 724 | { "tcam_counter_3", 4, 0x0b, STATS_TYPE_BANK1, }, |
| 725 | { "in_da_unknown", 4, 0x0e, STATS_TYPE_BANK1, }, |
| 726 | { "in_management", 4, 0x0f, STATS_TYPE_BANK1, }, |
| 727 | { "out_queue_0", 4, 0x10, STATS_TYPE_BANK1, }, |
| 728 | { "out_queue_1", 4, 0x11, STATS_TYPE_BANK1, }, |
| 729 | { "out_queue_2", 4, 0x12, STATS_TYPE_BANK1, }, |
| 730 | { "out_queue_3", 4, 0x13, STATS_TYPE_BANK1, }, |
| 731 | { "out_queue_4", 4, 0x14, STATS_TYPE_BANK1, }, |
| 732 | { "out_queue_5", 4, 0x15, STATS_TYPE_BANK1, }, |
| 733 | { "out_queue_6", 4, 0x16, STATS_TYPE_BANK1, }, |
| 734 | { "out_queue_7", 4, 0x17, STATS_TYPE_BANK1, }, |
| 735 | { "out_cut_through", 4, 0x18, STATS_TYPE_BANK1, }, |
| 736 | { "out_octets_a", 4, 0x1a, STATS_TYPE_BANK1, }, |
| 737 | { "out_octets_b", 4, 0x1b, STATS_TYPE_BANK1, }, |
| 738 | { "out_management", 4, 0x1f, STATS_TYPE_BANK1, }, |
Andrew Lunn | e413e7e | 2015-04-02 04:06:38 +0200 | [diff] [blame] | 739 | }; |
| 740 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 741 | static uint64_t _mv88e6xxx_get_ethtool_stat(struct mv88e6xxx_chip *chip, |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 742 | struct mv88e6xxx_hw_stat *s, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 743 | int port, u16 bank1_select, |
| 744 | u16 histogram) |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 745 | { |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 746 | u32 low; |
| 747 | u32 high = 0; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 748 | u16 reg = 0; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 749 | int err; |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 750 | u64 value; |
| 751 | |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 752 | switch (s->type) { |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 753 | case STATS_TYPE_PORT: |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 754 | err = mv88e6xxx_port_read(chip, port, s->reg, ®); |
| 755 | if (err) |
Jisheng Zhang | 6c3442f | 2018-04-27 16:18:58 +0800 | [diff] [blame] | 756 | return U64_MAX; |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 757 | |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 758 | low = reg; |
Andrew Lunn | cda9f4a | 2018-03-01 02:02:31 +0100 | [diff] [blame] | 759 | if (s->size == 4) { |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 760 | err = mv88e6xxx_port_read(chip, port, s->reg + 1, ®); |
| 761 | if (err) |
Jisheng Zhang | 6c3442f | 2018-04-27 16:18:58 +0800 | [diff] [blame] | 762 | return U64_MAX; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 763 | high = reg; |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 764 | } |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 765 | break; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 766 | case STATS_TYPE_BANK1: |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 767 | reg = bank1_select; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 768 | /* fall through */ |
| 769 | case STATS_TYPE_BANK0: |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 770 | reg |= s->reg | histogram; |
Andrew Lunn | 7f9ef3a | 2016-11-21 23:27:05 +0100 | [diff] [blame] | 771 | mv88e6xxx_g1_stats_read(chip, reg, &low); |
Andrew Lunn | cda9f4a | 2018-03-01 02:02:31 +0100 | [diff] [blame] | 772 | if (s->size == 8) |
Andrew Lunn | 7f9ef3a | 2016-11-21 23:27:05 +0100 | [diff] [blame] | 773 | mv88e6xxx_g1_stats_read(chip, reg + 1, &high); |
Gustavo A. R. Silva | 9fc3e4d | 2017-05-11 22:11:29 -0500 | [diff] [blame] | 774 | break; |
| 775 | default: |
Jisheng Zhang | 6c3442f | 2018-04-27 16:18:58 +0800 | [diff] [blame] | 776 | return U64_MAX; |
Andrew Lunn | 80c4627 | 2015-06-20 18:42:30 +0200 | [diff] [blame] | 777 | } |
| 778 | value = (((u64)high) << 16) | low; |
| 779 | return value; |
| 780 | } |
| 781 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 782 | static int mv88e6xxx_stats_get_strings(struct mv88e6xxx_chip *chip, |
| 783 | uint8_t *data, int types) |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 784 | { |
| 785 | struct mv88e6xxx_hw_stat *stat; |
| 786 | int i, j; |
| 787 | |
| 788 | for (i = 0, j = 0; i < ARRAY_SIZE(mv88e6xxx_hw_stats); i++) { |
| 789 | stat = &mv88e6xxx_hw_stats[i]; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 790 | if (stat->type & types) { |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 791 | memcpy(data + j * ETH_GSTRING_LEN, stat->string, |
| 792 | ETH_GSTRING_LEN); |
| 793 | j++; |
| 794 | } |
| 795 | } |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 796 | |
| 797 | return j; |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 798 | } |
| 799 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 800 | static int mv88e6095_stats_get_strings(struct mv88e6xxx_chip *chip, |
| 801 | uint8_t *data) |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 802 | { |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 803 | return mv88e6xxx_stats_get_strings(chip, data, |
| 804 | STATS_TYPE_BANK0 | STATS_TYPE_PORT); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 805 | } |
| 806 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 807 | static int mv88e6320_stats_get_strings(struct mv88e6xxx_chip *chip, |
| 808 | uint8_t *data) |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 809 | { |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 810 | return mv88e6xxx_stats_get_strings(chip, data, |
| 811 | STATS_TYPE_BANK0 | STATS_TYPE_BANK1); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 812 | } |
| 813 | |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 814 | static const uint8_t *mv88e6xxx_atu_vtu_stats_strings[] = { |
| 815 | "atu_member_violation", |
| 816 | "atu_miss_violation", |
| 817 | "atu_full_violation", |
| 818 | "vtu_member_violation", |
| 819 | "vtu_miss_violation", |
| 820 | }; |
| 821 | |
| 822 | static void mv88e6xxx_atu_vtu_get_strings(uint8_t *data) |
| 823 | { |
| 824 | unsigned int i; |
| 825 | |
| 826 | for (i = 0; i < ARRAY_SIZE(mv88e6xxx_atu_vtu_stats_strings); i++) |
| 827 | strlcpy(data + i * ETH_GSTRING_LEN, |
| 828 | mv88e6xxx_atu_vtu_stats_strings[i], |
| 829 | ETH_GSTRING_LEN); |
| 830 | } |
| 831 | |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 832 | static void mv88e6xxx_get_strings(struct dsa_switch *ds, int port, |
Florian Fainelli | 89f0904 | 2018-04-25 12:12:50 -0700 | [diff] [blame] | 833 | u32 stringset, uint8_t *data) |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 834 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 835 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 836 | int count = 0; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 837 | |
Florian Fainelli | 89f0904 | 2018-04-25 12:12:50 -0700 | [diff] [blame] | 838 | if (stringset != ETH_SS_STATS) |
| 839 | return; |
| 840 | |
Andrew Lunn | c6c8cd5 | 2018-03-01 02:02:28 +0100 | [diff] [blame] | 841 | mutex_lock(&chip->reg_lock); |
| 842 | |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 843 | if (chip->info->ops->stats_get_strings) |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 844 | count = chip->info->ops->stats_get_strings(chip, data); |
| 845 | |
| 846 | if (chip->info->ops->serdes_get_strings) { |
| 847 | data += count * ETH_GSTRING_LEN; |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 848 | count = chip->info->ops->serdes_get_strings(chip, port, data); |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 849 | } |
Andrew Lunn | c6c8cd5 | 2018-03-01 02:02:28 +0100 | [diff] [blame] | 850 | |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 851 | data += count * ETH_GSTRING_LEN; |
| 852 | mv88e6xxx_atu_vtu_get_strings(data); |
| 853 | |
Andrew Lunn | c6c8cd5 | 2018-03-01 02:02:28 +0100 | [diff] [blame] | 854 | mutex_unlock(&chip->reg_lock); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 855 | } |
| 856 | |
| 857 | static int mv88e6xxx_stats_get_sset_count(struct mv88e6xxx_chip *chip, |
| 858 | int types) |
| 859 | { |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 860 | struct mv88e6xxx_hw_stat *stat; |
| 861 | int i, j; |
| 862 | |
| 863 | for (i = 0, j = 0; i < ARRAY_SIZE(mv88e6xxx_hw_stats); i++) { |
| 864 | stat = &mv88e6xxx_hw_stats[i]; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 865 | if (stat->type & types) |
Andrew Lunn | f5e2ed0 | 2015-12-23 13:23:17 +0100 | [diff] [blame] | 866 | j++; |
| 867 | } |
| 868 | return j; |
| 869 | } |
| 870 | |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 871 | static int mv88e6095_stats_get_sset_count(struct mv88e6xxx_chip *chip) |
| 872 | { |
| 873 | return mv88e6xxx_stats_get_sset_count(chip, STATS_TYPE_BANK0 | |
| 874 | STATS_TYPE_PORT); |
| 875 | } |
| 876 | |
| 877 | static int mv88e6320_stats_get_sset_count(struct mv88e6xxx_chip *chip) |
| 878 | { |
| 879 | return mv88e6xxx_stats_get_sset_count(chip, STATS_TYPE_BANK0 | |
| 880 | STATS_TYPE_BANK1); |
| 881 | } |
| 882 | |
Florian Fainelli | 89f0904 | 2018-04-25 12:12:50 -0700 | [diff] [blame] | 883 | 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] | 884 | { |
| 885 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 886 | int serdes_count = 0; |
| 887 | int count = 0; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 888 | |
Florian Fainelli | 89f0904 | 2018-04-25 12:12:50 -0700 | [diff] [blame] | 889 | if (sset != ETH_SS_STATS) |
| 890 | return 0; |
| 891 | |
Andrew Lunn | c6c8cd5 | 2018-03-01 02:02:28 +0100 | [diff] [blame] | 892 | mutex_lock(&chip->reg_lock); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 893 | if (chip->info->ops->stats_get_sset_count) |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 894 | count = chip->info->ops->stats_get_sset_count(chip); |
| 895 | if (count < 0) |
| 896 | goto out; |
| 897 | |
| 898 | if (chip->info->ops->serdes_get_sset_count) |
| 899 | serdes_count = chip->info->ops->serdes_get_sset_count(chip, |
| 900 | port); |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 901 | if (serdes_count < 0) { |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 902 | count = serdes_count; |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 903 | goto out; |
| 904 | } |
| 905 | count += serdes_count; |
| 906 | count += ARRAY_SIZE(mv88e6xxx_atu_vtu_stats_strings); |
| 907 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 908 | out: |
Andrew Lunn | c6c8cd5 | 2018-03-01 02:02:28 +0100 | [diff] [blame] | 909 | mutex_unlock(&chip->reg_lock); |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 910 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 911 | return count; |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 912 | } |
| 913 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 914 | static int mv88e6xxx_stats_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 915 | uint64_t *data, int types, |
| 916 | u16 bank1_select, u16 histogram) |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 917 | { |
| 918 | struct mv88e6xxx_hw_stat *stat; |
| 919 | int i, j; |
| 920 | |
| 921 | for (i = 0, j = 0; i < ARRAY_SIZE(mv88e6xxx_hw_stats); i++) { |
| 922 | stat = &mv88e6xxx_hw_stats[i]; |
| 923 | if (stat->type & types) { |
Andrew Lunn | 377cda1 | 2018-02-15 14:38:34 +0100 | [diff] [blame] | 924 | mutex_lock(&chip->reg_lock); |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 925 | data[j] = _mv88e6xxx_get_ethtool_stat(chip, stat, port, |
| 926 | bank1_select, |
| 927 | histogram); |
Andrew Lunn | 377cda1 | 2018-02-15 14:38:34 +0100 | [diff] [blame] | 928 | mutex_unlock(&chip->reg_lock); |
| 929 | |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 930 | j++; |
| 931 | } |
| 932 | } |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 933 | return j; |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 934 | } |
| 935 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 936 | static int mv88e6095_stats_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 937 | uint64_t *data) |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 938 | { |
| 939 | return mv88e6xxx_stats_get_stats(chip, port, data, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 940 | STATS_TYPE_BANK0 | STATS_TYPE_PORT, |
Vivien Didelot | 57d1ef3 | 2017-06-15 12:14:05 -0400 | [diff] [blame] | 941 | 0, MV88E6XXX_G1_STATS_OP_HIST_RX_TX); |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 942 | } |
| 943 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 944 | static int mv88e6320_stats_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 945 | uint64_t *data) |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 946 | { |
| 947 | return mv88e6xxx_stats_get_stats(chip, port, data, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 948 | STATS_TYPE_BANK0 | STATS_TYPE_BANK1, |
Vivien Didelot | 57d1ef3 | 2017-06-15 12:14:05 -0400 | [diff] [blame] | 949 | MV88E6XXX_G1_STATS_OP_BANK_1_BIT_9, |
| 950 | MV88E6XXX_G1_STATS_OP_HIST_RX_TX); |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 951 | } |
| 952 | |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 953 | static int mv88e6390_stats_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 954 | uint64_t *data) |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 955 | { |
| 956 | return mv88e6xxx_stats_get_stats(chip, port, data, |
| 957 | STATS_TYPE_BANK0 | STATS_TYPE_BANK1, |
Vivien Didelot | 57d1ef3 | 2017-06-15 12:14:05 -0400 | [diff] [blame] | 958 | MV88E6XXX_G1_STATS_OP_BANK_1_BIT_10, |
| 959 | 0); |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 960 | } |
| 961 | |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 962 | static void mv88e6xxx_atu_vtu_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 963 | uint64_t *data) |
| 964 | { |
| 965 | *data++ = chip->ports[port].atu_member_violation; |
| 966 | *data++ = chip->ports[port].atu_miss_violation; |
| 967 | *data++ = chip->ports[port].atu_full_violation; |
| 968 | *data++ = chip->ports[port].vtu_member_violation; |
| 969 | *data++ = chip->ports[port].vtu_miss_violation; |
| 970 | } |
| 971 | |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 972 | static void mv88e6xxx_get_stats(struct mv88e6xxx_chip *chip, int port, |
| 973 | uint64_t *data) |
| 974 | { |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 975 | int count = 0; |
| 976 | |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 977 | if (chip->info->ops->stats_get_stats) |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 978 | count = chip->info->ops->stats_get_stats(chip, port, data); |
| 979 | |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 980 | mutex_lock(&chip->reg_lock); |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 981 | if (chip->info->ops->serdes_get_stats) { |
| 982 | data += count; |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 983 | count = chip->info->ops->serdes_get_stats(chip, port, data); |
Andrew Lunn | 436fe17 | 2018-03-01 02:02:29 +0100 | [diff] [blame] | 984 | } |
Andrew Lunn | 65f60e4 | 2018-03-28 23:50:28 +0200 | [diff] [blame] | 985 | data += count; |
| 986 | mv88e6xxx_atu_vtu_get_stats(chip, port, data); |
| 987 | mutex_unlock(&chip->reg_lock); |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 988 | } |
| 989 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 990 | static void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port, |
| 991 | uint64_t *data) |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 992 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 993 | struct mv88e6xxx_chip *chip = ds->priv; |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 994 | int ret; |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 995 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 996 | mutex_lock(&chip->reg_lock); |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 997 | |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 998 | ret = mv88e6xxx_stats_snapshot(chip, port); |
Andrew Lunn | 377cda1 | 2018-02-15 14:38:34 +0100 | [diff] [blame] | 999 | mutex_unlock(&chip->reg_lock); |
| 1000 | |
| 1001 | if (ret < 0) |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1002 | return; |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 1003 | |
| 1004 | mv88e6xxx_get_stats(chip, port, data); |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1005 | |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1006 | } |
Ben Hutchings | 98e6730 | 2011-11-25 14:36:19 +0000 | [diff] [blame] | 1007 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1008 | static int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port) |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1009 | { |
| 1010 | return 32 * sizeof(u16); |
| 1011 | } |
| 1012 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1013 | static void mv88e6xxx_get_regs(struct dsa_switch *ds, int port, |
| 1014 | struct ethtool_regs *regs, void *_p) |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1015 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1016 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 1017 | int err; |
| 1018 | u16 reg; |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1019 | u16 *p = _p; |
| 1020 | int i; |
| 1021 | |
| 1022 | regs->version = 0; |
| 1023 | |
| 1024 | memset(p, 0xff, 32 * sizeof(u16)); |
| 1025 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1026 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | 2306251 | 2016-05-09 13:22:45 -0400 | [diff] [blame] | 1027 | |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1028 | for (i = 0; i < 32; i++) { |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1029 | |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 1030 | err = mv88e6xxx_port_read(chip, port, i, ®); |
| 1031 | if (!err) |
| 1032 | p[i] = reg; |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1033 | } |
Vivien Didelot | 2306251 | 2016-05-09 13:22:45 -0400 | [diff] [blame] | 1034 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1035 | mutex_unlock(&chip->reg_lock); |
Guenter Roeck | a1ab91f | 2014-10-29 10:45:05 -0700 | [diff] [blame] | 1036 | } |
| 1037 | |
Vivien Didelot | 08f5006 | 2017-08-01 16:32:41 -0400 | [diff] [blame] | 1038 | static int mv88e6xxx_get_mac_eee(struct dsa_switch *ds, int port, |
| 1039 | struct ethtool_eee *e) |
Guenter Roeck | 11b3b45 | 2015-03-06 22:23:51 -0800 | [diff] [blame] | 1040 | { |
Vivien Didelot | 5480db6 | 2017-08-01 16:32:40 -0400 | [diff] [blame] | 1041 | /* Nothing to do on the port's MAC */ |
| 1042 | return 0; |
Guenter Roeck | 11b3b45 | 2015-03-06 22:23:51 -0800 | [diff] [blame] | 1043 | } |
| 1044 | |
Vivien Didelot | 08f5006 | 2017-08-01 16:32:41 -0400 | [diff] [blame] | 1045 | static int mv88e6xxx_set_mac_eee(struct dsa_switch *ds, int port, |
| 1046 | struct ethtool_eee *e) |
Guenter Roeck | 11b3b45 | 2015-03-06 22:23:51 -0800 | [diff] [blame] | 1047 | { |
Vivien Didelot | 5480db6 | 2017-08-01 16:32:40 -0400 | [diff] [blame] | 1048 | /* Nothing to do on the port's MAC */ |
| 1049 | return 0; |
Guenter Roeck | 11b3b45 | 2015-03-06 22:23:51 -0800 | [diff] [blame] | 1050 | } |
| 1051 | |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1052 | 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] | 1053 | { |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1054 | struct dsa_switch *ds = NULL; |
| 1055 | struct net_device *br; |
| 1056 | u16 pvlan; |
Vivien Didelot | b7666ef | 2016-02-26 13:16:06 -0500 | [diff] [blame] | 1057 | int i; |
| 1058 | |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1059 | if (dev < DSA_MAX_SWITCHES) |
| 1060 | ds = chip->ds->dst->ds[dev]; |
Vivien Didelot | b7666ef | 2016-02-26 13:16:06 -0500 | [diff] [blame] | 1061 | |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1062 | /* Prevent frames from unknown switch or port */ |
| 1063 | if (!ds || port >= ds->num_ports) |
| 1064 | return 0; |
| 1065 | |
| 1066 | /* Frames from DSA links and CPU ports can egress any local port */ |
| 1067 | if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)) |
| 1068 | return mv88e6xxx_port_mask(chip); |
| 1069 | |
| 1070 | br = ds->ports[port].bridge_dev; |
| 1071 | pvlan = 0; |
| 1072 | |
| 1073 | /* Frames from user ports can egress any local DSA links and CPU ports, |
| 1074 | * as well as any local member of their bridge group. |
| 1075 | */ |
| 1076 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) |
| 1077 | if (dsa_is_cpu_port(chip->ds, i) || |
| 1078 | dsa_is_dsa_port(chip->ds, i) || |
Vivien Didelot | c8652c8 | 2017-10-16 11:12:19 -0400 | [diff] [blame] | 1079 | (br && dsa_to_port(chip->ds, i)->bridge_dev == br)) |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1080 | pvlan |= BIT(i); |
| 1081 | |
| 1082 | return pvlan; |
| 1083 | } |
| 1084 | |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1085 | static int mv88e6xxx_port_vlan_map(struct mv88e6xxx_chip *chip, int port) |
Vivien Didelot | e5887a2 | 2017-03-30 17:37:11 -0400 | [diff] [blame] | 1086 | { |
| 1087 | u16 output_ports = mv88e6xxx_port_vlan(chip, chip->ds->index, port); |
Vivien Didelot | b7666ef | 2016-02-26 13:16:06 -0500 | [diff] [blame] | 1088 | |
| 1089 | /* prevent frames from going back out of the port they came in on */ |
| 1090 | output_ports &= ~BIT(port); |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1091 | |
Vivien Didelot | 5a7921f | 2016-11-04 03:23:28 +0100 | [diff] [blame] | 1092 | return mv88e6xxx_port_set_vlan_map(chip, port, output_ports); |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1093 | } |
| 1094 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1095 | static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port, |
| 1096 | u8 state) |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1097 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1098 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 553eb54 | 2016-05-13 20:38:23 -0400 | [diff] [blame] | 1099 | int err; |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1100 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1101 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | f894c29 | 2017-06-08 18:34:10 -0400 | [diff] [blame] | 1102 | err = mv88e6xxx_port_set_state(chip, port, state); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1103 | mutex_unlock(&chip->reg_lock); |
Vivien Didelot | 553eb54 | 2016-05-13 20:38:23 -0400 | [diff] [blame] | 1104 | |
| 1105 | if (err) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 1106 | dev_err(ds->dev, "p%d: failed to update state\n", port); |
Guenter Roeck | facd95b | 2015-03-26 18:36:35 -0700 | [diff] [blame] | 1107 | } |
| 1108 | |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 1109 | static int mv88e6xxx_pri_setup(struct mv88e6xxx_chip *chip) |
| 1110 | { |
| 1111 | int err; |
| 1112 | |
| 1113 | if (chip->info->ops->ieee_pri_map) { |
| 1114 | err = chip->info->ops->ieee_pri_map(chip); |
| 1115 | if (err) |
| 1116 | return err; |
| 1117 | } |
| 1118 | |
| 1119 | if (chip->info->ops->ip_pri_map) { |
| 1120 | err = chip->info->ops->ip_pri_map(chip); |
| 1121 | if (err) |
| 1122 | return err; |
| 1123 | } |
| 1124 | |
| 1125 | return 0; |
| 1126 | } |
| 1127 | |
Vivien Didelot | c7f047b | 2018-04-26 21:56:45 -0400 | [diff] [blame] | 1128 | static int mv88e6xxx_devmap_setup(struct mv88e6xxx_chip *chip) |
| 1129 | { |
| 1130 | int target, port; |
| 1131 | int err; |
| 1132 | |
| 1133 | if (!chip->info->global2_addr) |
| 1134 | return 0; |
| 1135 | |
| 1136 | /* Initialize the routing port to the 32 possible target devices */ |
| 1137 | for (target = 0; target < 32; target++) { |
| 1138 | port = 0x1f; |
| 1139 | if (target < DSA_MAX_SWITCHES) |
| 1140 | if (chip->ds->rtable[target] != DSA_RTABLE_NONE) |
| 1141 | port = chip->ds->rtable[target]; |
| 1142 | |
| 1143 | err = mv88e6xxx_g2_device_mapping_write(chip, target, port); |
| 1144 | if (err) |
| 1145 | return err; |
| 1146 | } |
| 1147 | |
Vivien Didelot | 02317e6 | 2018-05-09 11:38:49 -0400 | [diff] [blame] | 1148 | if (chip->info->ops->set_cascade_port) { |
| 1149 | port = MV88E6XXX_CASCADE_PORT_MULTIPLE; |
| 1150 | err = chip->info->ops->set_cascade_port(chip, port); |
| 1151 | if (err) |
| 1152 | return err; |
| 1153 | } |
| 1154 | |
Vivien Didelot | 23c9891 | 2018-05-09 11:38:50 -0400 | [diff] [blame] | 1155 | err = mv88e6xxx_g1_set_device_number(chip, chip->ds->index); |
| 1156 | if (err) |
| 1157 | return err; |
| 1158 | |
Vivien Didelot | c7f047b | 2018-04-26 21:56:45 -0400 | [diff] [blame] | 1159 | return 0; |
| 1160 | } |
| 1161 | |
Vivien Didelot | b28f872 | 2018-04-26 21:56:44 -0400 | [diff] [blame] | 1162 | static int mv88e6xxx_trunk_setup(struct mv88e6xxx_chip *chip) |
| 1163 | { |
| 1164 | /* Clear all trunk masks and mapping */ |
| 1165 | if (chip->info->global2_addr) |
| 1166 | return mv88e6xxx_g2_trunk_clear(chip); |
| 1167 | |
| 1168 | return 0; |
| 1169 | } |
| 1170 | |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 1171 | static int mv88e6xxx_rmu_setup(struct mv88e6xxx_chip *chip) |
| 1172 | { |
| 1173 | if (chip->info->ops->rmu_disable) |
| 1174 | return chip->info->ops->rmu_disable(chip); |
| 1175 | |
| 1176 | return 0; |
| 1177 | } |
| 1178 | |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 1179 | static int mv88e6xxx_pot_setup(struct mv88e6xxx_chip *chip) |
| 1180 | { |
| 1181 | if (chip->info->ops->pot_clear) |
| 1182 | return chip->info->ops->pot_clear(chip); |
| 1183 | |
| 1184 | return 0; |
| 1185 | } |
| 1186 | |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 1187 | static int mv88e6xxx_rsvd2cpu_setup(struct mv88e6xxx_chip *chip) |
| 1188 | { |
| 1189 | if (chip->info->ops->mgmt_rsvd2cpu) |
| 1190 | return chip->info->ops->mgmt_rsvd2cpu(chip); |
| 1191 | |
| 1192 | return 0; |
| 1193 | } |
| 1194 | |
Vivien Didelot | a2ac29d | 2017-03-11 16:12:49 -0500 | [diff] [blame] | 1195 | static int mv88e6xxx_atu_setup(struct mv88e6xxx_chip *chip) |
| 1196 | { |
Vivien Didelot | c3a7d4a | 2017-03-11 16:12:51 -0500 | [diff] [blame] | 1197 | int err; |
| 1198 | |
Vivien Didelot | daefc94 | 2017-03-11 16:12:54 -0500 | [diff] [blame] | 1199 | err = mv88e6xxx_g1_atu_flush(chip, 0, true); |
| 1200 | if (err) |
| 1201 | return err; |
| 1202 | |
Vivien Didelot | c3a7d4a | 2017-03-11 16:12:51 -0500 | [diff] [blame] | 1203 | err = mv88e6xxx_g1_atu_set_learn2all(chip, true); |
| 1204 | if (err) |
| 1205 | return err; |
| 1206 | |
Vivien Didelot | a2ac29d | 2017-03-11 16:12:49 -0500 | [diff] [blame] | 1207 | return mv88e6xxx_g1_atu_set_age_time(chip, 300000); |
| 1208 | } |
| 1209 | |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 1210 | static int mv88e6xxx_irl_setup(struct mv88e6xxx_chip *chip) |
| 1211 | { |
| 1212 | int port; |
| 1213 | int err; |
| 1214 | |
| 1215 | if (!chip->info->ops->irl_init_all) |
| 1216 | return 0; |
| 1217 | |
| 1218 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
| 1219 | /* Disable ingress rate limiting by resetting all per port |
| 1220 | * ingress rate limit resources to their initial state. |
| 1221 | */ |
| 1222 | err = chip->info->ops->irl_init_all(chip, port); |
| 1223 | if (err) |
| 1224 | return err; |
| 1225 | } |
| 1226 | |
| 1227 | return 0; |
| 1228 | } |
| 1229 | |
Vivien Didelot | 04a69a1 | 2017-10-13 14:18:05 -0400 | [diff] [blame] | 1230 | static int mv88e6xxx_mac_setup(struct mv88e6xxx_chip *chip) |
| 1231 | { |
| 1232 | if (chip->info->ops->set_switch_mac) { |
| 1233 | u8 addr[ETH_ALEN]; |
| 1234 | |
| 1235 | eth_random_addr(addr); |
| 1236 | |
| 1237 | return chip->info->ops->set_switch_mac(chip, addr); |
| 1238 | } |
| 1239 | |
| 1240 | return 0; |
| 1241 | } |
| 1242 | |
Vivien Didelot | 17a1594 | 2017-03-30 17:37:09 -0400 | [diff] [blame] | 1243 | static int mv88e6xxx_pvt_map(struct mv88e6xxx_chip *chip, int dev, int port) |
| 1244 | { |
| 1245 | u16 pvlan = 0; |
| 1246 | |
| 1247 | if (!mv88e6xxx_has_pvt(chip)) |
| 1248 | return -EOPNOTSUPP; |
| 1249 | |
| 1250 | /* Skip the local source device, which uses in-chip port VLAN */ |
| 1251 | if (dev != chip->ds->index) |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 1252 | pvlan = mv88e6xxx_port_vlan(chip, dev, port); |
Vivien Didelot | 17a1594 | 2017-03-30 17:37:09 -0400 | [diff] [blame] | 1253 | |
| 1254 | return mv88e6xxx_g2_pvt_write(chip, dev, port, pvlan); |
| 1255 | } |
| 1256 | |
Vivien Didelot | 8122899 | 2017-03-30 17:37:08 -0400 | [diff] [blame] | 1257 | static int mv88e6xxx_pvt_setup(struct mv88e6xxx_chip *chip) |
| 1258 | { |
Vivien Didelot | 17a1594 | 2017-03-30 17:37:09 -0400 | [diff] [blame] | 1259 | int dev, port; |
| 1260 | int err; |
| 1261 | |
Vivien Didelot | 8122899 | 2017-03-30 17:37:08 -0400 | [diff] [blame] | 1262 | if (!mv88e6xxx_has_pvt(chip)) |
| 1263 | return 0; |
| 1264 | |
| 1265 | /* Clear 5 Bit Port for usage with Marvell Link Street devices: |
| 1266 | * use 4 bits for the Src_Port/Src_Trunk and 5 bits for the Src_Dev. |
| 1267 | */ |
Vivien Didelot | 17a1594 | 2017-03-30 17:37:09 -0400 | [diff] [blame] | 1268 | err = mv88e6xxx_g2_misc_4_bit_port(chip); |
| 1269 | if (err) |
| 1270 | return err; |
| 1271 | |
| 1272 | for (dev = 0; dev < MV88E6XXX_MAX_PVT_SWITCHES; ++dev) { |
| 1273 | for (port = 0; port < MV88E6XXX_MAX_PVT_PORTS; ++port) { |
| 1274 | err = mv88e6xxx_pvt_map(chip, dev, port); |
| 1275 | if (err) |
| 1276 | return err; |
| 1277 | } |
| 1278 | } |
| 1279 | |
| 1280 | return 0; |
Vivien Didelot | 8122899 | 2017-03-30 17:37:08 -0400 | [diff] [blame] | 1281 | } |
| 1282 | |
Vivien Didelot | 749efcb | 2016-09-22 16:49:24 -0400 | [diff] [blame] | 1283 | static void mv88e6xxx_port_fast_age(struct dsa_switch *ds, int port) |
| 1284 | { |
| 1285 | struct mv88e6xxx_chip *chip = ds->priv; |
| 1286 | int err; |
| 1287 | |
| 1288 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 1289 | err = mv88e6xxx_g1_atu_remove(chip, 0, port, false); |
Vivien Didelot | 749efcb | 2016-09-22 16:49:24 -0400 | [diff] [blame] | 1290 | mutex_unlock(&chip->reg_lock); |
| 1291 | |
| 1292 | if (err) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 1293 | dev_err(ds->dev, "p%d: failed to flush ATU\n", port); |
Vivien Didelot | 749efcb | 2016-09-22 16:49:24 -0400 | [diff] [blame] | 1294 | } |
| 1295 | |
Vivien Didelot | b486d7c | 2017-05-01 14:05:13 -0400 | [diff] [blame] | 1296 | static int mv88e6xxx_vtu_setup(struct mv88e6xxx_chip *chip) |
| 1297 | { |
| 1298 | if (!chip->info->max_vid) |
| 1299 | return 0; |
| 1300 | |
| 1301 | return mv88e6xxx_g1_vtu_flush(chip); |
| 1302 | } |
| 1303 | |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 1304 | static int mv88e6xxx_vtu_getnext(struct mv88e6xxx_chip *chip, |
| 1305 | struct mv88e6xxx_vtu_entry *entry) |
| 1306 | { |
| 1307 | if (!chip->info->ops->vtu_getnext) |
| 1308 | return -EOPNOTSUPP; |
| 1309 | |
| 1310 | return chip->info->ops->vtu_getnext(chip, entry); |
| 1311 | } |
| 1312 | |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 1313 | static int mv88e6xxx_vtu_loadpurge(struct mv88e6xxx_chip *chip, |
| 1314 | struct mv88e6xxx_vtu_entry *entry) |
| 1315 | { |
| 1316 | if (!chip->info->ops->vtu_loadpurge) |
| 1317 | return -EOPNOTSUPP; |
| 1318 | |
| 1319 | return chip->info->ops->vtu_loadpurge(chip, entry); |
| 1320 | } |
| 1321 | |
Vivien Didelot | d7f435f | 2017-03-11 16:12:56 -0500 | [diff] [blame] | 1322 | static int mv88e6xxx_atu_new(struct mv88e6xxx_chip *chip, u16 *fid) |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1323 | { |
| 1324 | DECLARE_BITMAP(fid_bitmap, MV88E6XXX_N_FID); |
Vivien Didelot | 3afb4bd | 2017-05-01 14:05:16 -0400 | [diff] [blame] | 1325 | struct mv88e6xxx_vtu_entry vlan = { |
| 1326 | .vid = chip->info->max_vid, |
| 1327 | }; |
Vivien Didelot | 2db9ce1 | 2016-02-26 13:16:04 -0500 | [diff] [blame] | 1328 | int i, err; |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1329 | |
| 1330 | bitmap_zero(fid_bitmap, MV88E6XXX_N_FID); |
| 1331 | |
Vivien Didelot | 2db9ce1 | 2016-02-26 13:16:04 -0500 | [diff] [blame] | 1332 | /* Set every FID bit used by the (un)bridged ports */ |
Vivien Didelot | 370b4ff | 2016-09-29 12:21:57 -0400 | [diff] [blame] | 1333 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) { |
Vivien Didelot | b4e48c5 | 2016-11-04 03:23:29 +0100 | [diff] [blame] | 1334 | err = mv88e6xxx_port_get_fid(chip, i, fid); |
Vivien Didelot | 2db9ce1 | 2016-02-26 13:16:04 -0500 | [diff] [blame] | 1335 | if (err) |
| 1336 | return err; |
| 1337 | |
| 1338 | set_bit(*fid, fid_bitmap); |
| 1339 | } |
| 1340 | |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1341 | /* Set every FID bit used by the VLAN entries */ |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1342 | do { |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 1343 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1344 | if (err) |
| 1345 | return err; |
| 1346 | |
| 1347 | if (!vlan.valid) |
| 1348 | break; |
| 1349 | |
| 1350 | set_bit(vlan.fid, fid_bitmap); |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1351 | } while (vlan.vid < chip->info->max_vid); |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1352 | |
| 1353 | /* The reset value 0x000 is used to indicate that multiple address |
| 1354 | * databases are not needed. Return the next positive available. |
| 1355 | */ |
| 1356 | *fid = find_next_zero_bit(fid_bitmap, MV88E6XXX_N_FID, 1); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1357 | if (unlikely(*fid >= mv88e6xxx_num_databases(chip))) |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1358 | return -ENOSPC; |
| 1359 | |
| 1360 | /* Clear the database */ |
Vivien Didelot | daefc94 | 2017-03-11 16:12:54 -0500 | [diff] [blame] | 1361 | return mv88e6xxx_g1_atu_flush(chip, *fid, true); |
Vivien Didelot | 3285f9e | 2016-02-26 13:16:03 -0500 | [diff] [blame] | 1362 | } |
| 1363 | |
Vivien Didelot | 567aa59 | 2017-05-01 14:05:25 -0400 | [diff] [blame] | 1364 | static int mv88e6xxx_vtu_get(struct mv88e6xxx_chip *chip, u16 vid, |
| 1365 | struct mv88e6xxx_vtu_entry *entry, bool new) |
Vivien Didelot | 2fb5ef0 | 2016-02-26 13:16:01 -0500 | [diff] [blame] | 1366 | { |
| 1367 | int err; |
| 1368 | |
| 1369 | if (!vid) |
| 1370 | return -EINVAL; |
| 1371 | |
Vivien Didelot | 3afb4bd | 2017-05-01 14:05:16 -0400 | [diff] [blame] | 1372 | entry->vid = vid - 1; |
| 1373 | entry->valid = false; |
Vivien Didelot | 2fb5ef0 | 2016-02-26 13:16:01 -0500 | [diff] [blame] | 1374 | |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 1375 | err = mv88e6xxx_vtu_getnext(chip, entry); |
Vivien Didelot | 2fb5ef0 | 2016-02-26 13:16:01 -0500 | [diff] [blame] | 1376 | if (err) |
| 1377 | return err; |
| 1378 | |
Vivien Didelot | 567aa59 | 2017-05-01 14:05:25 -0400 | [diff] [blame] | 1379 | if (entry->vid == vid && entry->valid) |
| 1380 | return 0; |
Vivien Didelot | 2fb5ef0 | 2016-02-26 13:16:01 -0500 | [diff] [blame] | 1381 | |
Vivien Didelot | 567aa59 | 2017-05-01 14:05:25 -0400 | [diff] [blame] | 1382 | if (new) { |
| 1383 | int i; |
| 1384 | |
| 1385 | /* Initialize a fresh VLAN entry */ |
| 1386 | memset(entry, 0, sizeof(*entry)); |
| 1387 | entry->valid = true; |
| 1388 | entry->vid = vid; |
| 1389 | |
Vivien Didelot | 553a768 | 2017-06-07 18:12:16 -0400 | [diff] [blame] | 1390 | /* Exclude all ports */ |
Vivien Didelot | 567aa59 | 2017-05-01 14:05:25 -0400 | [diff] [blame] | 1391 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) |
Vivien Didelot | 553a768 | 2017-06-07 18:12:16 -0400 | [diff] [blame] | 1392 | entry->member[i] = |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1393 | MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER; |
Vivien Didelot | 567aa59 | 2017-05-01 14:05:25 -0400 | [diff] [blame] | 1394 | |
| 1395 | return mv88e6xxx_atu_new(chip, &entry->fid); |
Vivien Didelot | 2fb5ef0 | 2016-02-26 13:16:01 -0500 | [diff] [blame] | 1396 | } |
| 1397 | |
Vivien Didelot | 567aa59 | 2017-05-01 14:05:25 -0400 | [diff] [blame] | 1398 | /* switchdev expects -EOPNOTSUPP to honor software VLANs */ |
| 1399 | return -EOPNOTSUPP; |
Vivien Didelot | 2fb5ef0 | 2016-02-26 13:16:01 -0500 | [diff] [blame] | 1400 | } |
| 1401 | |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1402 | static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port, |
| 1403 | u16 vid_begin, u16 vid_end) |
| 1404 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1405 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 3afb4bd | 2017-05-01 14:05:16 -0400 | [diff] [blame] | 1406 | struct mv88e6xxx_vtu_entry vlan = { |
| 1407 | .vid = vid_begin - 1, |
| 1408 | }; |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1409 | int i, err; |
| 1410 | |
Andrew Lunn | db06ae41 | 2017-09-25 23:32:20 +0200 | [diff] [blame] | 1411 | /* DSA and CPU ports have to be members of multiple vlans */ |
| 1412 | if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port)) |
| 1413 | return 0; |
| 1414 | |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1415 | if (!vid_begin) |
| 1416 | return -EOPNOTSUPP; |
| 1417 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1418 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1419 | |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1420 | do { |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 1421 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1422 | if (err) |
| 1423 | goto unlock; |
| 1424 | |
| 1425 | if (!vlan.valid) |
| 1426 | break; |
| 1427 | |
| 1428 | if (vlan.vid > vid_end) |
| 1429 | break; |
| 1430 | |
Vivien Didelot | 370b4ff | 2016-09-29 12:21:57 -0400 | [diff] [blame] | 1431 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) { |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1432 | if (dsa_is_dsa_port(ds, i) || dsa_is_cpu_port(ds, i)) |
| 1433 | continue; |
| 1434 | |
Andrew Lunn | cd88646 | 2017-11-09 22:29:53 +0100 | [diff] [blame] | 1435 | if (!ds->ports[i].slave) |
Andrew Lunn | 66e2809 | 2016-12-11 21:07:19 +0100 | [diff] [blame] | 1436 | continue; |
| 1437 | |
Vivien Didelot | bd00e05 | 2017-05-01 14:05:11 -0400 | [diff] [blame] | 1438 | if (vlan.member[i] == |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1439 | MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER) |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1440 | continue; |
| 1441 | |
Vivien Didelot | c8652c8 | 2017-10-16 11:12:19 -0400 | [diff] [blame] | 1442 | if (dsa_to_port(ds, i)->bridge_dev == |
Vivien Didelot | fae8a25 | 2017-01-27 15:29:42 -0500 | [diff] [blame] | 1443 | ds->ports[port].bridge_dev) |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1444 | break; /* same bridge, check next VLAN */ |
| 1445 | |
Vivien Didelot | c8652c8 | 2017-10-16 11:12:19 -0400 | [diff] [blame] | 1446 | if (!dsa_to_port(ds, i)->bridge_dev) |
Andrew Lunn | 66e2809 | 2016-12-11 21:07:19 +0100 | [diff] [blame] | 1447 | continue; |
| 1448 | |
Andrew Lunn | 743fcc2 | 2017-11-09 22:29:54 +0100 | [diff] [blame] | 1449 | dev_err(ds->dev, "p%d: hw VLAN %d already used by port %d in %s\n", |
| 1450 | port, vlan.vid, i, |
Vivien Didelot | c8652c8 | 2017-10-16 11:12:19 -0400 | [diff] [blame] | 1451 | netdev_name(dsa_to_port(ds, i)->bridge_dev)); |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1452 | err = -EOPNOTSUPP; |
| 1453 | goto unlock; |
| 1454 | } |
| 1455 | } while (vlan.vid < vid_end); |
| 1456 | |
| 1457 | unlock: |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1458 | mutex_unlock(&chip->reg_lock); |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1459 | |
| 1460 | return err; |
| 1461 | } |
| 1462 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1463 | static int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port, |
| 1464 | bool vlan_filtering) |
Vivien Didelot | 214cdb9 | 2016-02-26 13:16:08 -0500 | [diff] [blame] | 1465 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1466 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 81c6edb | 2017-06-12 12:37:41 -0400 | [diff] [blame] | 1467 | u16 mode = vlan_filtering ? MV88E6XXX_PORT_CTL2_8021Q_MODE_SECURE : |
| 1468 | MV88E6XXX_PORT_CTL2_8021Q_MODE_DISABLED; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 1469 | int err; |
Vivien Didelot | 214cdb9 | 2016-02-26 13:16:08 -0500 | [diff] [blame] | 1470 | |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1471 | if (!chip->info->max_vid) |
Vivien Didelot | 54d77b5 | 2016-05-09 13:22:47 -0400 | [diff] [blame] | 1472 | return -EOPNOTSUPP; |
| 1473 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1474 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | 385a099 | 2016-11-04 03:23:31 +0100 | [diff] [blame] | 1475 | err = mv88e6xxx_port_set_8021q_mode(chip, port, mode); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1476 | mutex_unlock(&chip->reg_lock); |
Vivien Didelot | 214cdb9 | 2016-02-26 13:16:08 -0500 | [diff] [blame] | 1477 | |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 1478 | return err; |
Vivien Didelot | 214cdb9 | 2016-02-26 13:16:08 -0500 | [diff] [blame] | 1479 | } |
| 1480 | |
Vivien Didelot | 57d3231 | 2016-06-20 13:13:58 -0400 | [diff] [blame] | 1481 | static int |
| 1482 | mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port, |
Vivien Didelot | 80e0236 | 2017-11-30 11:23:57 -0500 | [diff] [blame] | 1483 | const struct switchdev_obj_port_vlan *vlan) |
Vivien Didelot | 0d3b33e | 2015-08-13 12:52:22 -0400 | [diff] [blame] | 1484 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1485 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1486 | int err; |
| 1487 | |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1488 | if (!chip->info->max_vid) |
Vivien Didelot | 54d77b5 | 2016-05-09 13:22:47 -0400 | [diff] [blame] | 1489 | return -EOPNOTSUPP; |
| 1490 | |
Vivien Didelot | da9c359 | 2016-02-12 12:09:40 -0500 | [diff] [blame] | 1491 | /* If the requested port doesn't belong to the same bridge as the VLAN |
| 1492 | * members, do not support it (yet) and fallback to software VLAN. |
| 1493 | */ |
| 1494 | err = mv88e6xxx_port_check_hw_vlan(ds, port, vlan->vid_begin, |
| 1495 | vlan->vid_end); |
| 1496 | if (err) |
| 1497 | return err; |
| 1498 | |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1499 | /* We don't need any dynamic resource from the kernel (yet), |
| 1500 | * so skip the prepare phase. |
| 1501 | */ |
| 1502 | return 0; |
| 1503 | } |
| 1504 | |
Andrew Lunn | a4c93ae | 2017-11-09 22:29:55 +0100 | [diff] [blame] | 1505 | static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port, |
| 1506 | const unsigned char *addr, u16 vid, |
| 1507 | u8 state) |
| 1508 | { |
| 1509 | struct mv88e6xxx_vtu_entry vlan; |
| 1510 | struct mv88e6xxx_atu_entry entry; |
| 1511 | int err; |
| 1512 | |
| 1513 | /* Null VLAN ID corresponds to the port private database */ |
| 1514 | if (vid == 0) |
| 1515 | err = mv88e6xxx_port_get_fid(chip, port, &vlan.fid); |
| 1516 | else |
| 1517 | err = mv88e6xxx_vtu_get(chip, vid, &vlan, false); |
| 1518 | if (err) |
| 1519 | return err; |
| 1520 | |
| 1521 | entry.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED; |
| 1522 | ether_addr_copy(entry.mac, addr); |
| 1523 | eth_addr_dec(entry.mac); |
| 1524 | |
| 1525 | err = mv88e6xxx_g1_atu_getnext(chip, vlan.fid, &entry); |
| 1526 | if (err) |
| 1527 | return err; |
| 1528 | |
| 1529 | /* Initialize a fresh ATU entry if it isn't found */ |
| 1530 | if (entry.state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED || |
| 1531 | !ether_addr_equal(entry.mac, addr)) { |
| 1532 | memset(&entry, 0, sizeof(entry)); |
| 1533 | ether_addr_copy(entry.mac, addr); |
| 1534 | } |
| 1535 | |
| 1536 | /* Purge the ATU entry only if no port is using it anymore */ |
| 1537 | if (state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED) { |
| 1538 | entry.portvec &= ~BIT(port); |
| 1539 | if (!entry.portvec) |
| 1540 | entry.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED; |
| 1541 | } else { |
| 1542 | entry.portvec |= BIT(port); |
| 1543 | entry.state = state; |
| 1544 | } |
| 1545 | |
| 1546 | return mv88e6xxx_g1_atu_loadpurge(chip, vlan.fid, &entry); |
| 1547 | } |
| 1548 | |
Andrew Lunn | 87fa886 | 2017-11-09 22:29:56 +0100 | [diff] [blame] | 1549 | static int mv88e6xxx_port_add_broadcast(struct mv88e6xxx_chip *chip, int port, |
| 1550 | u16 vid) |
| 1551 | { |
| 1552 | const char broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 1553 | u8 state = MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC; |
| 1554 | |
| 1555 | return mv88e6xxx_port_db_load_purge(chip, port, broadcast, vid, state); |
| 1556 | } |
| 1557 | |
| 1558 | static int mv88e6xxx_broadcast_setup(struct mv88e6xxx_chip *chip, u16 vid) |
| 1559 | { |
| 1560 | int port; |
| 1561 | int err; |
| 1562 | |
| 1563 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
| 1564 | err = mv88e6xxx_port_add_broadcast(chip, port, vid); |
| 1565 | if (err) |
| 1566 | return err; |
| 1567 | } |
| 1568 | |
| 1569 | return 0; |
| 1570 | } |
| 1571 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1572 | static int _mv88e6xxx_port_vlan_add(struct mv88e6xxx_chip *chip, int port, |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1573 | u16 vid, u8 member) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1574 | { |
Vivien Didelot | b4e47c0 | 2016-09-29 12:21:58 -0400 | [diff] [blame] | 1575 | struct mv88e6xxx_vtu_entry vlan; |
Vivien Didelot | 0d3b33e | 2015-08-13 12:52:22 -0400 | [diff] [blame] | 1576 | int err; |
| 1577 | |
Vivien Didelot | 567aa59 | 2017-05-01 14:05:25 -0400 | [diff] [blame] | 1578 | err = mv88e6xxx_vtu_get(chip, vid, &vlan, true); |
Vivien Didelot | 36d04ba | 2015-10-22 09:34:39 -0400 | [diff] [blame] | 1579 | if (err) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1580 | return err; |
Vivien Didelot | 36d04ba | 2015-10-22 09:34:39 -0400 | [diff] [blame] | 1581 | |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1582 | vlan.member[port] = member; |
Vivien Didelot | 0d3b33e | 2015-08-13 12:52:22 -0400 | [diff] [blame] | 1583 | |
Andrew Lunn | 87fa886 | 2017-11-09 22:29:56 +0100 | [diff] [blame] | 1584 | err = mv88e6xxx_vtu_loadpurge(chip, &vlan); |
| 1585 | if (err) |
| 1586 | return err; |
| 1587 | |
| 1588 | return mv88e6xxx_broadcast_setup(chip, vid); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1589 | } |
| 1590 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1591 | static void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port, |
Vivien Didelot | 80e0236 | 2017-11-30 11:23:57 -0500 | [diff] [blame] | 1592 | const struct switchdev_obj_port_vlan *vlan) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1593 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1594 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1595 | bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; |
| 1596 | bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID; |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1597 | u8 member; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1598 | u16 vid; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1599 | |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1600 | if (!chip->info->max_vid) |
Vivien Didelot | 54d77b5 | 2016-05-09 13:22:47 -0400 | [diff] [blame] | 1601 | return; |
| 1602 | |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1603 | 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] | 1604 | member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_UNMODIFIED; |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1605 | else if (untagged) |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1606 | member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_UNTAGGED; |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1607 | else |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1608 | member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_TAGGED; |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1609 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1610 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1611 | |
Vivien Didelot | 4d5770b | 2016-04-06 11:55:05 -0400 | [diff] [blame] | 1612 | for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) |
Vivien Didelot | c91498e | 2017-06-07 18:12:13 -0400 | [diff] [blame] | 1613 | if (_mv88e6xxx_port_vlan_add(chip, port, vid, member)) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 1614 | dev_err(ds->dev, "p%d: failed to add VLAN %d%c\n", port, |
| 1615 | vid, untagged ? 'u' : 't'); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1616 | |
Vivien Didelot | 77064f3 | 2016-11-04 03:23:30 +0100 | [diff] [blame] | 1617 | if (pvid && mv88e6xxx_port_set_pvid(chip, port, vlan->vid_end)) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 1618 | dev_err(ds->dev, "p%d: failed to set PVID %d\n", port, |
| 1619 | vlan->vid_end); |
Vivien Didelot | 4d5770b | 2016-04-06 11:55:05 -0400 | [diff] [blame] | 1620 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1621 | mutex_unlock(&chip->reg_lock); |
Vivien Didelot | 0d3b33e | 2015-08-13 12:52:22 -0400 | [diff] [blame] | 1622 | } |
| 1623 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1624 | static int _mv88e6xxx_port_vlan_del(struct mv88e6xxx_chip *chip, |
Andrew Lunn | 158bc06 | 2016-04-28 21:24:06 -0400 | [diff] [blame] | 1625 | int port, u16 vid) |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1626 | { |
Vivien Didelot | b4e47c0 | 2016-09-29 12:21:58 -0400 | [diff] [blame] | 1627 | struct mv88e6xxx_vtu_entry vlan; |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1628 | int i, err; |
| 1629 | |
Vivien Didelot | 567aa59 | 2017-05-01 14:05:25 -0400 | [diff] [blame] | 1630 | err = mv88e6xxx_vtu_get(chip, vid, &vlan, false); |
Vivien Didelot | 36d04ba | 2015-10-22 09:34:39 -0400 | [diff] [blame] | 1631 | if (err) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1632 | return err; |
Vivien Didelot | 36d04ba | 2015-10-22 09:34:39 -0400 | [diff] [blame] | 1633 | |
Vivien Didelot | 2fb5ef0 | 2016-02-26 13:16:01 -0500 | [diff] [blame] | 1634 | /* Tell switchdev if this VLAN is handled in software */ |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1635 | if (vlan.member[port] == MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER) |
Vivien Didelot | 3c06f08 | 2016-02-05 14:04:39 -0500 | [diff] [blame] | 1636 | return -EOPNOTSUPP; |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1637 | |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1638 | vlan.member[port] = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER; |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1639 | |
| 1640 | /* keep the VLAN unless all ports are excluded */ |
Vivien Didelot | f02bdff | 2015-10-11 18:08:36 -0400 | [diff] [blame] | 1641 | vlan.valid = false; |
Vivien Didelot | 370b4ff | 2016-09-29 12:21:57 -0400 | [diff] [blame] | 1642 | for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) { |
Vivien Didelot | 7ec60d6e | 2017-06-15 12:14:02 -0400 | [diff] [blame] | 1643 | if (vlan.member[i] != |
| 1644 | MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER) { |
Vivien Didelot | f02bdff | 2015-10-11 18:08:36 -0400 | [diff] [blame] | 1645 | vlan.valid = true; |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1646 | break; |
| 1647 | } |
| 1648 | } |
| 1649 | |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 1650 | err = mv88e6xxx_vtu_loadpurge(chip, &vlan); |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1651 | if (err) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1652 | return err; |
| 1653 | |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 1654 | return mv88e6xxx_g1_atu_remove(chip, vlan.fid, port, false); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1655 | } |
| 1656 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1657 | static int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port, |
| 1658 | const struct switchdev_obj_port_vlan *vlan) |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1659 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1660 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1661 | u16 pvid, vid; |
| 1662 | int err = 0; |
| 1663 | |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1664 | if (!chip->info->max_vid) |
Vivien Didelot | 54d77b5 | 2016-05-09 13:22:47 -0400 | [diff] [blame] | 1665 | return -EOPNOTSUPP; |
| 1666 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1667 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1668 | |
Vivien Didelot | 77064f3 | 2016-11-04 03:23:30 +0100 | [diff] [blame] | 1669 | err = mv88e6xxx_port_get_pvid(chip, port, &pvid); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1670 | if (err) |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1671 | goto unlock; |
| 1672 | |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1673 | for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1674 | err = _mv88e6xxx_port_vlan_del(chip, port, vid); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1675 | if (err) |
| 1676 | goto unlock; |
| 1677 | |
| 1678 | if (vid == pvid) { |
Vivien Didelot | 77064f3 | 2016-11-04 03:23:30 +0100 | [diff] [blame] | 1679 | err = mv88e6xxx_port_set_pvid(chip, port, 0); |
Vivien Didelot | 76e398a | 2015-11-01 12:33:55 -0500 | [diff] [blame] | 1680 | if (err) |
| 1681 | goto unlock; |
| 1682 | } |
| 1683 | } |
| 1684 | |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1685 | unlock: |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1686 | mutex_unlock(&chip->reg_lock); |
Vivien Didelot | 7dad08d | 2015-08-13 12:52:21 -0400 | [diff] [blame] | 1687 | |
| 1688 | return err; |
| 1689 | } |
| 1690 | |
Arkadi Sharshevsky | 1b6dd55 | 2017-08-06 16:15:40 +0300 | [diff] [blame] | 1691 | static int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port, |
| 1692 | const unsigned char *addr, u16 vid) |
Guenter Roeck | defb05b | 2015-03-26 18:36:38 -0700 | [diff] [blame] | 1693 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1694 | struct mv88e6xxx_chip *chip = ds->priv; |
Arkadi Sharshevsky | 1b6dd55 | 2017-08-06 16:15:40 +0300 | [diff] [blame] | 1695 | int err; |
Vivien Didelot | 6630e23 | 2015-08-06 01:44:07 -0400 | [diff] [blame] | 1696 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1697 | mutex_lock(&chip->reg_lock); |
Arkadi Sharshevsky | 1b6dd55 | 2017-08-06 16:15:40 +0300 | [diff] [blame] | 1698 | err = mv88e6xxx_port_db_load_purge(chip, port, addr, vid, |
| 1699 | MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1700 | mutex_unlock(&chip->reg_lock); |
Arkadi Sharshevsky | 1b6dd55 | 2017-08-06 16:15:40 +0300 | [diff] [blame] | 1701 | |
| 1702 | return err; |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1703 | } |
| 1704 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1705 | static int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port, |
Arkadi Sharshevsky | 6c2c1dc | 2017-08-06 16:15:39 +0300 | [diff] [blame] | 1706 | const unsigned char *addr, u16 vid) |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1707 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1708 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1709 | int err; |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1710 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1711 | mutex_lock(&chip->reg_lock); |
Arkadi Sharshevsky | 6c2c1dc | 2017-08-06 16:15:39 +0300 | [diff] [blame] | 1712 | err = mv88e6xxx_port_db_load_purge(chip, port, addr, vid, |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 1713 | MV88E6XXX_G1_ATU_DATA_STATE_UNUSED); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1714 | mutex_unlock(&chip->reg_lock); |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1715 | |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1716 | return err; |
David S. Miller | cdf0969 | 2015-08-11 12:00:37 -0700 | [diff] [blame] | 1717 | } |
| 1718 | |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1719 | static int mv88e6xxx_port_db_dump_fid(struct mv88e6xxx_chip *chip, |
| 1720 | u16 fid, u16 vid, int port, |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1721 | dsa_fdb_dump_cb_t *cb, void *data) |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1722 | { |
Vivien Didelot | dabc1a9 | 2017-03-11 16:12:53 -0500 | [diff] [blame] | 1723 | struct mv88e6xxx_atu_entry addr; |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1724 | bool is_static; |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1725 | int err; |
| 1726 | |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 1727 | addr.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED; |
Vivien Didelot | dabc1a9 | 2017-03-11 16:12:53 -0500 | [diff] [blame] | 1728 | eth_broadcast_addr(addr.mac); |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1729 | |
| 1730 | do { |
Andrew Lunn | a61e540 | 2018-02-15 14:38:35 +0100 | [diff] [blame] | 1731 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | dabc1a9 | 2017-03-11 16:12:53 -0500 | [diff] [blame] | 1732 | err = mv88e6xxx_g1_atu_getnext(chip, fid, &addr); |
Andrew Lunn | a61e540 | 2018-02-15 14:38:35 +0100 | [diff] [blame] | 1733 | mutex_unlock(&chip->reg_lock); |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1734 | if (err) |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1735 | return err; |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1736 | |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 1737 | if (addr.state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED) |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1738 | break; |
| 1739 | |
Vivien Didelot | 01bd96c | 2017-03-11 16:12:57 -0500 | [diff] [blame] | 1740 | if (addr.trunk || (addr.portvec & BIT(port)) == 0) |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1741 | continue; |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1742 | |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1743 | if (!is_unicast_ether_addr(addr.mac)) |
| 1744 | continue; |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1745 | |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1746 | is_static = (addr.state == |
| 1747 | MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC); |
| 1748 | err = cb(addr.mac, vid, is_static, data); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1749 | if (err) |
| 1750 | return err; |
Vivien Didelot | 74b6ba0 | 2016-02-26 13:16:02 -0500 | [diff] [blame] | 1751 | } while (!is_broadcast_ether_addr(addr.mac)); |
| 1752 | |
| 1753 | return err; |
| 1754 | } |
| 1755 | |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1756 | static int mv88e6xxx_port_db_dump(struct mv88e6xxx_chip *chip, int port, |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1757 | dsa_fdb_dump_cb_t *cb, void *data) |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1758 | { |
Vivien Didelot | b4e47c0 | 2016-09-29 12:21:58 -0400 | [diff] [blame] | 1759 | struct mv88e6xxx_vtu_entry vlan = { |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1760 | .vid = chip->info->max_vid, |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1761 | }; |
| 1762 | u16 fid; |
| 1763 | int err; |
| 1764 | |
| 1765 | /* Dump port's default Filtering Information Database (VLAN ID 0) */ |
Andrew Lunn | a61e540 | 2018-02-15 14:38:35 +0100 | [diff] [blame] | 1766 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | b4e48c5 | 2016-11-04 03:23:29 +0100 | [diff] [blame] | 1767 | err = mv88e6xxx_port_get_fid(chip, port, &fid); |
Andrew Lunn | a61e540 | 2018-02-15 14:38:35 +0100 | [diff] [blame] | 1768 | mutex_unlock(&chip->reg_lock); |
| 1769 | |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1770 | if (err) |
| 1771 | return err; |
| 1772 | |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1773 | err = mv88e6xxx_port_db_dump_fid(chip, fid, 0, port, cb, data); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1774 | if (err) |
| 1775 | return err; |
| 1776 | |
| 1777 | /* Dump VLANs' Filtering Information Databases */ |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1778 | do { |
Andrew Lunn | a61e540 | 2018-02-15 14:38:35 +0100 | [diff] [blame] | 1779 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 1780 | err = mv88e6xxx_vtu_getnext(chip, &vlan); |
Andrew Lunn | a61e540 | 2018-02-15 14:38:35 +0100 | [diff] [blame] | 1781 | mutex_unlock(&chip->reg_lock); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1782 | if (err) |
| 1783 | return err; |
| 1784 | |
| 1785 | if (!vlan.valid) |
| 1786 | break; |
| 1787 | |
| 1788 | err = mv88e6xxx_port_db_dump_fid(chip, vlan.fid, vlan.vid, port, |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1789 | cb, data); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1790 | if (err) |
| 1791 | return err; |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 1792 | } while (vlan.vid < chip->info->max_vid); |
Vivien Didelot | 83dabd1 | 2016-08-31 11:50:04 -0400 | [diff] [blame] | 1793 | |
| 1794 | return err; |
| 1795 | } |
| 1796 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1797 | static int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port, |
Arkadi Sharshevsky | 2bedde1 | 2017-08-06 16:15:49 +0300 | [diff] [blame] | 1798 | dsa_fdb_dump_cb_t *cb, void *data) |
Vivien Didelot | f33475b | 2015-10-22 09:34:41 -0400 | [diff] [blame] | 1799 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1800 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | f33475b | 2015-10-22 09:34:41 -0400 | [diff] [blame] | 1801 | |
Andrew Lunn | a61e540 | 2018-02-15 14:38:35 +0100 | [diff] [blame] | 1802 | return mv88e6xxx_port_db_dump(chip, port, cb, data); |
Vivien Didelot | f33475b | 2015-10-22 09:34:41 -0400 | [diff] [blame] | 1803 | } |
| 1804 | |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1805 | static int mv88e6xxx_bridge_map(struct mv88e6xxx_chip *chip, |
| 1806 | struct net_device *br) |
| 1807 | { |
Vivien Didelot | e96a6e0 | 2017-03-30 17:37:13 -0400 | [diff] [blame] | 1808 | struct dsa_switch *ds; |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1809 | int port; |
Vivien Didelot | e96a6e0 | 2017-03-30 17:37:13 -0400 | [diff] [blame] | 1810 | int dev; |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1811 | int err; |
| 1812 | |
| 1813 | /* Remap the Port VLAN of each local bridge group member */ |
| 1814 | for (port = 0; port < mv88e6xxx_num_ports(chip); ++port) { |
| 1815 | if (chip->ds->ports[port].bridge_dev == br) { |
| 1816 | err = mv88e6xxx_port_vlan_map(chip, port); |
| 1817 | if (err) |
| 1818 | return err; |
| 1819 | } |
| 1820 | } |
| 1821 | |
Vivien Didelot | e96a6e0 | 2017-03-30 17:37:13 -0400 | [diff] [blame] | 1822 | if (!mv88e6xxx_has_pvt(chip)) |
| 1823 | return 0; |
| 1824 | |
| 1825 | /* Remap the Port VLAN of each cross-chip bridge group member */ |
| 1826 | for (dev = 0; dev < DSA_MAX_SWITCHES; ++dev) { |
| 1827 | ds = chip->ds->dst->ds[dev]; |
| 1828 | if (!ds) |
| 1829 | break; |
| 1830 | |
| 1831 | for (port = 0; port < ds->num_ports; ++port) { |
| 1832 | if (ds->ports[port].bridge_dev == br) { |
| 1833 | err = mv88e6xxx_pvt_map(chip, dev, port); |
| 1834 | if (err) |
| 1835 | return err; |
| 1836 | } |
| 1837 | } |
| 1838 | } |
| 1839 | |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1840 | return 0; |
| 1841 | } |
| 1842 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 1843 | static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, |
Vivien Didelot | fae8a25 | 2017-01-27 15:29:42 -0500 | [diff] [blame] | 1844 | struct net_device *br) |
Vivien Didelot | e79a8bc | 2015-11-04 17:23:40 -0500 | [diff] [blame] | 1845 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1846 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1847 | int err; |
Vivien Didelot | 466dfa0 | 2016-02-26 13:16:05 -0500 | [diff] [blame] | 1848 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1849 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1850 | err = mv88e6xxx_bridge_map(chip, br); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1851 | mutex_unlock(&chip->reg_lock); |
Vivien Didelot | a669275 | 2016-02-12 12:09:39 -0500 | [diff] [blame] | 1852 | |
Vivien Didelot | 466dfa0 | 2016-02-26 13:16:05 -0500 | [diff] [blame] | 1853 | return err; |
Vivien Didelot | e79a8bc | 2015-11-04 17:23:40 -0500 | [diff] [blame] | 1854 | } |
| 1855 | |
Vivien Didelot | f123f2f | 2017-01-27 15:29:41 -0500 | [diff] [blame] | 1856 | static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port, |
| 1857 | struct net_device *br) |
Vivien Didelot | e79a8bc | 2015-11-04 17:23:40 -0500 | [diff] [blame] | 1858 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 1859 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 466dfa0 | 2016-02-26 13:16:05 -0500 | [diff] [blame] | 1860 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1861 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 1862 | if (mv88e6xxx_bridge_map(chip, br) || |
| 1863 | mv88e6xxx_port_vlan_map(chip, port)) |
| 1864 | dev_err(ds->dev, "failed to remap in-chip Port VLAN\n"); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1865 | mutex_unlock(&chip->reg_lock); |
Vivien Didelot | 66d9cd0 | 2016-02-05 14:07:14 -0500 | [diff] [blame] | 1866 | } |
| 1867 | |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 1868 | static int mv88e6xxx_crosschip_bridge_join(struct dsa_switch *ds, int dev, |
| 1869 | int port, struct net_device *br) |
| 1870 | { |
| 1871 | struct mv88e6xxx_chip *chip = ds->priv; |
| 1872 | int err; |
| 1873 | |
| 1874 | if (!mv88e6xxx_has_pvt(chip)) |
| 1875 | return 0; |
| 1876 | |
| 1877 | mutex_lock(&chip->reg_lock); |
| 1878 | err = mv88e6xxx_pvt_map(chip, dev, port); |
| 1879 | mutex_unlock(&chip->reg_lock); |
| 1880 | |
| 1881 | return err; |
| 1882 | } |
| 1883 | |
| 1884 | static void mv88e6xxx_crosschip_bridge_leave(struct dsa_switch *ds, int dev, |
| 1885 | int port, struct net_device *br) |
| 1886 | { |
| 1887 | struct mv88e6xxx_chip *chip = ds->priv; |
| 1888 | |
| 1889 | if (!mv88e6xxx_has_pvt(chip)) |
| 1890 | return; |
| 1891 | |
| 1892 | mutex_lock(&chip->reg_lock); |
| 1893 | if (mv88e6xxx_pvt_map(chip, dev, port)) |
| 1894 | dev_err(ds->dev, "failed to remap cross-chip Port VLAN\n"); |
| 1895 | mutex_unlock(&chip->reg_lock); |
| 1896 | } |
| 1897 | |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 1898 | static int mv88e6xxx_software_reset(struct mv88e6xxx_chip *chip) |
| 1899 | { |
| 1900 | if (chip->info->ops->reset) |
| 1901 | return chip->info->ops->reset(chip); |
| 1902 | |
| 1903 | return 0; |
| 1904 | } |
| 1905 | |
Vivien Didelot | 309eca6 | 2016-12-05 17:30:26 -0500 | [diff] [blame] | 1906 | static void mv88e6xxx_hardware_reset(struct mv88e6xxx_chip *chip) |
| 1907 | { |
| 1908 | struct gpio_desc *gpiod = chip->reset; |
| 1909 | |
| 1910 | /* If there is a GPIO connected to the reset pin, toggle it */ |
| 1911 | if (gpiod) { |
| 1912 | gpiod_set_value_cansleep(gpiod, 1); |
| 1913 | usleep_range(10000, 20000); |
| 1914 | gpiod_set_value_cansleep(gpiod, 0); |
| 1915 | usleep_range(10000, 20000); |
| 1916 | } |
| 1917 | } |
| 1918 | |
Vivien Didelot | 4ac4b5a | 2016-12-05 17:30:25 -0500 | [diff] [blame] | 1919 | static int mv88e6xxx_disable_ports(struct mv88e6xxx_chip *chip) |
| 1920 | { |
| 1921 | int i, err; |
| 1922 | |
| 1923 | /* Set all ports to the Disabled state */ |
| 1924 | for (i = 0; i < mv88e6xxx_num_ports(chip); i++) { |
Vivien Didelot | f894c29 | 2017-06-08 18:34:10 -0400 | [diff] [blame] | 1925 | err = mv88e6xxx_port_set_state(chip, i, BR_STATE_DISABLED); |
Vivien Didelot | 4ac4b5a | 2016-12-05 17:30:25 -0500 | [diff] [blame] | 1926 | if (err) |
| 1927 | return err; |
| 1928 | } |
| 1929 | |
| 1930 | /* Wait for transmit queues to drain, |
| 1931 | * i.e. 2ms for a maximum frame to be transmitted at 10 Mbps. |
| 1932 | */ |
| 1933 | usleep_range(2000, 4000); |
| 1934 | |
| 1935 | return 0; |
| 1936 | } |
| 1937 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 1938 | static int mv88e6xxx_switch_reset(struct mv88e6xxx_chip *chip) |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 1939 | { |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 1940 | int err; |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 1941 | |
Vivien Didelot | 4ac4b5a | 2016-12-05 17:30:25 -0500 | [diff] [blame] | 1942 | err = mv88e6xxx_disable_ports(chip); |
| 1943 | if (err) |
| 1944 | return err; |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 1945 | |
Vivien Didelot | 309eca6 | 2016-12-05 17:30:26 -0500 | [diff] [blame] | 1946 | mv88e6xxx_hardware_reset(chip); |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 1947 | |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 1948 | return mv88e6xxx_software_reset(chip); |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 1949 | } |
| 1950 | |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 1951 | static int mv88e6xxx_set_port_mode(struct mv88e6xxx_chip *chip, int port, |
Vivien Didelot | 31bef4e | 2017-06-08 18:34:09 -0400 | [diff] [blame] | 1952 | enum mv88e6xxx_frame_mode frame, |
| 1953 | enum mv88e6xxx_egress_mode egress, u16 etype) |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 1954 | { |
| 1955 | int err; |
| 1956 | |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 1957 | if (!chip->info->ops->port_set_frame_mode) |
| 1958 | return -EOPNOTSUPP; |
| 1959 | |
| 1960 | err = mv88e6xxx_port_set_egress_mode(chip, port, egress); |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 1961 | if (err) |
| 1962 | return err; |
| 1963 | |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 1964 | err = chip->info->ops->port_set_frame_mode(chip, port, frame); |
| 1965 | if (err) |
| 1966 | return err; |
| 1967 | |
| 1968 | if (chip->info->ops->port_set_ether_type) |
| 1969 | return chip->info->ops->port_set_ether_type(chip, port, etype); |
| 1970 | |
| 1971 | return 0; |
| 1972 | } |
| 1973 | |
| 1974 | static int mv88e6xxx_set_port_mode_normal(struct mv88e6xxx_chip *chip, int port) |
| 1975 | { |
| 1976 | return mv88e6xxx_set_port_mode(chip, port, MV88E6XXX_FRAME_MODE_NORMAL, |
Vivien Didelot | 31bef4e | 2017-06-08 18:34:09 -0400 | [diff] [blame] | 1977 | MV88E6XXX_EGRESS_MODE_UNMODIFIED, |
Vivien Didelot | b810959 | 2017-06-12 12:37:45 -0400 | [diff] [blame] | 1978 | MV88E6XXX_PORT_ETH_TYPE_DEFAULT); |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 1979 | } |
| 1980 | |
| 1981 | static int mv88e6xxx_set_port_mode_dsa(struct mv88e6xxx_chip *chip, int port) |
| 1982 | { |
| 1983 | return mv88e6xxx_set_port_mode(chip, port, MV88E6XXX_FRAME_MODE_DSA, |
Vivien Didelot | 31bef4e | 2017-06-08 18:34:09 -0400 | [diff] [blame] | 1984 | MV88E6XXX_EGRESS_MODE_UNMODIFIED, |
Vivien Didelot | b810959 | 2017-06-12 12:37:45 -0400 | [diff] [blame] | 1985 | MV88E6XXX_PORT_ETH_TYPE_DEFAULT); |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 1986 | } |
| 1987 | |
| 1988 | static int mv88e6xxx_set_port_mode_edsa(struct mv88e6xxx_chip *chip, int port) |
| 1989 | { |
| 1990 | return mv88e6xxx_set_port_mode(chip, port, |
| 1991 | MV88E6XXX_FRAME_MODE_ETHERTYPE, |
Vivien Didelot | 31bef4e | 2017-06-08 18:34:09 -0400 | [diff] [blame] | 1992 | MV88E6XXX_EGRESS_MODE_ETHERTYPE, |
| 1993 | ETH_P_EDSA); |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 1994 | } |
| 1995 | |
| 1996 | static int mv88e6xxx_setup_port_mode(struct mv88e6xxx_chip *chip, int port) |
| 1997 | { |
| 1998 | if (dsa_is_dsa_port(chip->ds, port)) |
| 1999 | return mv88e6xxx_set_port_mode_dsa(chip, port); |
| 2000 | |
Vivien Didelot | 2b3e989 | 2017-10-26 11:22:54 -0400 | [diff] [blame] | 2001 | if (dsa_is_user_port(chip->ds, port)) |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2002 | return mv88e6xxx_set_port_mode_normal(chip, port); |
| 2003 | |
| 2004 | /* Setup CPU port mode depending on its supported tag format */ |
| 2005 | if (chip->info->tag_protocol == DSA_TAG_PROTO_DSA) |
| 2006 | return mv88e6xxx_set_port_mode_dsa(chip, port); |
| 2007 | |
| 2008 | if (chip->info->tag_protocol == DSA_TAG_PROTO_EDSA) |
| 2009 | return mv88e6xxx_set_port_mode_edsa(chip, port); |
| 2010 | |
| 2011 | return -EINVAL; |
| 2012 | } |
| 2013 | |
Vivien Didelot | ea698f4 | 2017-03-11 16:12:50 -0500 | [diff] [blame] | 2014 | static int mv88e6xxx_setup_message_port(struct mv88e6xxx_chip *chip, int port) |
| 2015 | { |
| 2016 | bool message = dsa_is_dsa_port(chip->ds, port); |
| 2017 | |
| 2018 | return mv88e6xxx_port_set_message_port(chip, port, message); |
| 2019 | } |
| 2020 | |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2021 | static int mv88e6xxx_setup_egress_floods(struct mv88e6xxx_chip *chip, int port) |
| 2022 | { |
Vivien Didelot | 3ee50cb | 2017-12-05 15:34:09 -0500 | [diff] [blame] | 2023 | struct dsa_switch *ds = chip->ds; |
| 2024 | bool flood; |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2025 | |
| 2026 | /* Upstream ports flood frames with unknown unicast or multicast DA */ |
Vivien Didelot | 3ee50cb | 2017-12-05 15:34:09 -0500 | [diff] [blame] | 2027 | flood = dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port); |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2028 | if (chip->info->ops->port_set_egress_floods) |
| 2029 | return chip->info->ops->port_set_egress_floods(chip, port, |
| 2030 | flood, flood); |
| 2031 | |
| 2032 | return 0; |
| 2033 | } |
| 2034 | |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 2035 | static int mv88e6xxx_serdes_power(struct mv88e6xxx_chip *chip, int port, |
| 2036 | bool on) |
| 2037 | { |
Vivien Didelot | 523a890 | 2017-05-26 18:02:42 -0400 | [diff] [blame] | 2038 | if (chip->info->ops->serdes_power) |
| 2039 | return chip->info->ops->serdes_power(chip, port, on); |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 2040 | |
Vivien Didelot | 523a890 | 2017-05-26 18:02:42 -0400 | [diff] [blame] | 2041 | return 0; |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 2042 | } |
| 2043 | |
Vivien Didelot | fa371c8 | 2017-12-05 15:34:10 -0500 | [diff] [blame] | 2044 | static int mv88e6xxx_setup_upstream_port(struct mv88e6xxx_chip *chip, int port) |
| 2045 | { |
| 2046 | struct dsa_switch *ds = chip->ds; |
| 2047 | int upstream_port; |
| 2048 | int err; |
| 2049 | |
Vivien Didelot | 07073c7 | 2017-12-05 15:34:13 -0500 | [diff] [blame] | 2050 | upstream_port = dsa_upstream_port(ds, port); |
Vivien Didelot | fa371c8 | 2017-12-05 15:34:10 -0500 | [diff] [blame] | 2051 | if (chip->info->ops->port_set_upstream_port) { |
| 2052 | err = chip->info->ops->port_set_upstream_port(chip, port, |
| 2053 | upstream_port); |
| 2054 | if (err) |
| 2055 | return err; |
| 2056 | } |
| 2057 | |
Vivien Didelot | 0ea54dd | 2017-12-05 15:34:11 -0500 | [diff] [blame] | 2058 | if (port == upstream_port) { |
| 2059 | if (chip->info->ops->set_cpu_port) { |
| 2060 | err = chip->info->ops->set_cpu_port(chip, |
| 2061 | upstream_port); |
| 2062 | if (err) |
| 2063 | return err; |
| 2064 | } |
| 2065 | |
| 2066 | if (chip->info->ops->set_egress_port) { |
| 2067 | err = chip->info->ops->set_egress_port(chip, |
| 2068 | upstream_port); |
| 2069 | if (err) |
| 2070 | return err; |
| 2071 | } |
| 2072 | } |
| 2073 | |
Vivien Didelot | fa371c8 | 2017-12-05 15:34:10 -0500 | [diff] [blame] | 2074 | return 0; |
| 2075 | } |
| 2076 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2077 | static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2078 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2079 | struct dsa_switch *ds = chip->ds; |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2080 | int err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2081 | u16 reg; |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2082 | |
Vivien Didelot | d78343d | 2016-11-04 03:23:36 +0100 | [diff] [blame] | 2083 | /* MAC Forcing register: don't force link, speed, duplex or flow control |
| 2084 | * state to any particular values on physical ports, but force the CPU |
| 2085 | * port and all DSA ports to their maximum bandwidth and full duplex. |
| 2086 | */ |
| 2087 | if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)) |
| 2088 | err = mv88e6xxx_port_setup_mac(chip, port, LINK_FORCED_UP, |
| 2089 | SPEED_MAX, DUPLEX_FULL, |
| 2090 | PHY_INTERFACE_MODE_NA); |
| 2091 | else |
| 2092 | err = mv88e6xxx_port_setup_mac(chip, port, LINK_UNFORCED, |
| 2093 | SPEED_UNFORCED, DUPLEX_UNFORCED, |
| 2094 | PHY_INTERFACE_MODE_NA); |
| 2095 | if (err) |
| 2096 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2097 | |
| 2098 | /* Port Control: disable Drop-on-Unlock, disable Drop-on-Lock, |
| 2099 | * disable Header mode, enable IGMP/MLD snooping, disable VLAN |
| 2100 | * tunneling, determine priority by looking at 802.1p and IP |
| 2101 | * priority fields (IP prio has precedence), and set STP state |
| 2102 | * to Forwarding. |
| 2103 | * |
| 2104 | * If this is the CPU link, use DSA or EDSA tagging depending |
| 2105 | * on which tagging mode was configured. |
| 2106 | * |
| 2107 | * If this is a link to another switch, use DSA tagging mode. |
| 2108 | * |
| 2109 | * If this is the upstream port for this switch, enable |
| 2110 | * forwarding of unknown unicasts and multicasts. |
| 2111 | */ |
Vivien Didelot | a89b433be | 2017-06-12 12:37:37 -0400 | [diff] [blame] | 2112 | reg = MV88E6XXX_PORT_CTL0_IGMP_MLD_SNOOP | |
| 2113 | MV88E6185_PORT_CTL0_USE_TAG | MV88E6185_PORT_CTL0_USE_IP | |
| 2114 | MV88E6XXX_PORT_CTL0_STATE_FORWARDING; |
| 2115 | err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_CTL0, reg); |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2116 | if (err) |
| 2117 | return err; |
Andrew Lunn | 6083ce7 | 2015-08-17 23:52:52 +0200 | [diff] [blame] | 2118 | |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2119 | err = mv88e6xxx_setup_port_mode(chip, port); |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2120 | if (err) |
| 2121 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2122 | |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2123 | err = mv88e6xxx_setup_egress_floods(chip, port); |
Vivien Didelot | 4314557 | 2017-03-11 16:12:59 -0500 | [diff] [blame] | 2124 | if (err) |
| 2125 | return err; |
| 2126 | |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2127 | /* Enable the SERDES interface for DSA and CPU ports. Normal |
| 2128 | * ports SERDES are enabled when the port is enabled, thus |
| 2129 | * saving a bit of power. |
Patrick Uiterwijk | 13a7ebb | 2016-03-30 01:39:41 +0000 | [diff] [blame] | 2130 | */ |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2131 | if ((dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))) { |
| 2132 | err = mv88e6xxx_serdes_power(chip, port, true); |
| 2133 | if (err) |
| 2134 | return err; |
| 2135 | } |
Patrick Uiterwijk | 13a7ebb | 2016-03-30 01:39:41 +0000 | [diff] [blame] | 2136 | |
Vivien Didelot | 8efdda4 | 2015-08-13 12:52:23 -0400 | [diff] [blame] | 2137 | /* 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] | 2138 | * 10240 bytes, disable 802.1q tags checking, don't discard tagged or |
Vivien Didelot | 8efdda4 | 2015-08-13 12:52:23 -0400 | [diff] [blame] | 2139 | * untagged frames on this port, do a destination address lookup on all |
| 2140 | * received packets as usual, disable ARP mirroring and don't send a |
| 2141 | * copy of all transmitted/received frames on this port to the CPU. |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2142 | */ |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2143 | err = mv88e6xxx_port_set_map_da(chip, port); |
| 2144 | if (err) |
| 2145 | return err; |
| 2146 | |
Vivien Didelot | fa371c8 | 2017-12-05 15:34:10 -0500 | [diff] [blame] | 2147 | err = mv88e6xxx_setup_upstream_port(chip, port); |
| 2148 | if (err) |
| 2149 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2150 | |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2151 | err = mv88e6xxx_port_set_8021q_mode(chip, port, |
Vivien Didelot | 81c6edb | 2017-06-12 12:37:41 -0400 | [diff] [blame] | 2152 | MV88E6XXX_PORT_CTL2_8021Q_MODE_DISABLED); |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2153 | if (err) |
| 2154 | return err; |
| 2155 | |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2156 | if (chip->info->ops->port_set_jumbo_size) { |
| 2157 | err = chip->info->ops->port_set_jumbo_size(chip, port, 10240); |
Andrew Lunn | 5f43666 | 2016-12-03 04:45:17 +0100 | [diff] [blame] | 2158 | if (err) |
| 2159 | return err; |
| 2160 | } |
| 2161 | |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2162 | /* Port Association Vector: when learning source addresses |
| 2163 | * of packets, add the address to the address database using |
| 2164 | * a port bitmap that has only the bit for this port set and |
| 2165 | * the other bits clear. |
| 2166 | */ |
Andrew Lunn | 4c7ea3c | 2015-11-03 10:52:36 -0500 | [diff] [blame] | 2167 | reg = 1 << port; |
Vivien Didelot | 996ecb8 | 2016-04-14 14:42:08 -0400 | [diff] [blame] | 2168 | /* Disable learning for CPU port */ |
| 2169 | if (dsa_is_cpu_port(ds, port)) |
Vivien Didelot | 65fa402 | 2016-04-14 14:42:07 -0400 | [diff] [blame] | 2170 | reg = 0; |
Andrew Lunn | 4c7ea3c | 2015-11-03 10:52:36 -0500 | [diff] [blame] | 2171 | |
Vivien Didelot | 2a4614e | 2017-06-12 12:37:43 -0400 | [diff] [blame] | 2172 | err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_ASSOC_VECTOR, |
| 2173 | reg); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2174 | if (err) |
| 2175 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2176 | |
| 2177 | /* Egress rate control 2: disable egress rate control. */ |
Vivien Didelot | 2cb8cb1 | 2017-06-12 12:37:42 -0400 | [diff] [blame] | 2178 | err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_EGRESS_RATE_CTL2, |
| 2179 | 0x0000); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2180 | if (err) |
| 2181 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2182 | |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2183 | if (chip->info->ops->port_pause_limit) { |
| 2184 | err = chip->info->ops->port_pause_limit(chip, port, 0, 0); |
Andrew Lunn | b35d322a | 2016-12-03 04:45:19 +0100 | [diff] [blame] | 2185 | if (err) |
| 2186 | return err; |
| 2187 | } |
| 2188 | |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2189 | if (chip->info->ops->port_disable_learn_limit) { |
| 2190 | err = chip->info->ops->port_disable_learn_limit(chip, port); |
| 2191 | if (err) |
| 2192 | return err; |
| 2193 | } |
| 2194 | |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2195 | if (chip->info->ops->port_disable_pri_override) { |
| 2196 | err = chip->info->ops->port_disable_pri_override(chip, port); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2197 | if (err) |
| 2198 | return err; |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2199 | } |
Andrew Lunn | 2bbb33b | 2016-08-22 16:01:02 +0200 | [diff] [blame] | 2200 | |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2201 | if (chip->info->ops->port_tag_remap) { |
| 2202 | err = chip->info->ops->port_tag_remap(chip, port); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2203 | if (err) |
| 2204 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2205 | } |
| 2206 | |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2207 | if (chip->info->ops->port_egress_rate_limiting) { |
| 2208 | err = chip->info->ops->port_egress_rate_limiting(chip, port); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2209 | if (err) |
| 2210 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2211 | } |
| 2212 | |
Vivien Didelot | ea698f4 | 2017-03-11 16:12:50 -0500 | [diff] [blame] | 2213 | err = mv88e6xxx_setup_message_port(chip, port); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2214 | if (err) |
| 2215 | return err; |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2216 | |
Vivien Didelot | 207afda | 2016-04-14 14:42:09 -0400 | [diff] [blame] | 2217 | /* Port based VLAN map: give each port the same default address |
Vivien Didelot | b7666ef | 2016-02-26 13:16:06 -0500 | [diff] [blame] | 2218 | * database, and allow bidirectional communication between the |
| 2219 | * CPU and DSA port(s), and the other ports. |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2220 | */ |
Vivien Didelot | b4e48c5 | 2016-11-04 03:23:29 +0100 | [diff] [blame] | 2221 | err = mv88e6xxx_port_set_fid(chip, port, 0); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2222 | if (err) |
| 2223 | return err; |
Vivien Didelot | 2db9ce1 | 2016-02-26 13:16:04 -0500 | [diff] [blame] | 2224 | |
Vivien Didelot | 240ea3e | 2017-03-30 17:37:12 -0400 | [diff] [blame] | 2225 | err = mv88e6xxx_port_vlan_map(chip, port); |
Andrew Lunn | 0e7b992 | 2016-09-21 01:40:31 +0200 | [diff] [blame] | 2226 | if (err) |
| 2227 | return err; |
Guenter Roeck | d827e88 | 2015-03-26 18:36:29 -0700 | [diff] [blame] | 2228 | |
| 2229 | /* Default VLAN ID and priority: don't set a default VLAN |
| 2230 | * ID, and set the default packet priority to zero. |
| 2231 | */ |
Vivien Didelot | b7929fb | 2017-06-12 12:37:40 -0400 | [diff] [blame] | 2232 | return mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_DEFAULT_VLAN, 0); |
Andrew Lunn | dbde9e6 | 2015-05-06 01:09:48 +0200 | [diff] [blame] | 2233 | } |
| 2234 | |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2235 | static int mv88e6xxx_port_enable(struct dsa_switch *ds, int port, |
| 2236 | struct phy_device *phydev) |
| 2237 | { |
| 2238 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 523a890 | 2017-05-26 18:02:42 -0400 | [diff] [blame] | 2239 | int err; |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2240 | |
| 2241 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | 523a890 | 2017-05-26 18:02:42 -0400 | [diff] [blame] | 2242 | err = mv88e6xxx_serdes_power(chip, port, true); |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2243 | mutex_unlock(&chip->reg_lock); |
| 2244 | |
| 2245 | return err; |
| 2246 | } |
| 2247 | |
| 2248 | static void mv88e6xxx_port_disable(struct dsa_switch *ds, int port, |
| 2249 | struct phy_device *phydev) |
| 2250 | { |
| 2251 | struct mv88e6xxx_chip *chip = ds->priv; |
| 2252 | |
| 2253 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | 523a890 | 2017-05-26 18:02:42 -0400 | [diff] [blame] | 2254 | if (mv88e6xxx_serdes_power(chip, port, false)) |
| 2255 | dev_err(chip->dev, "failed to power off SERDES\n"); |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 2256 | mutex_unlock(&chip->reg_lock); |
| 2257 | } |
| 2258 | |
Vivien Didelot | 2cfcd96 | 2016-07-18 20:45:40 -0400 | [diff] [blame] | 2259 | static int mv88e6xxx_set_ageing_time(struct dsa_switch *ds, |
| 2260 | unsigned int ageing_time) |
| 2261 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2262 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 2cfcd96 | 2016-07-18 20:45:40 -0400 | [diff] [blame] | 2263 | int err; |
| 2264 | |
| 2265 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | 720c634 | 2017-03-11 16:12:48 -0500 | [diff] [blame] | 2266 | err = mv88e6xxx_g1_atu_set_age_time(chip, ageing_time); |
Vivien Didelot | 2cfcd96 | 2016-07-18 20:45:40 -0400 | [diff] [blame] | 2267 | mutex_unlock(&chip->reg_lock); |
| 2268 | |
| 2269 | return err; |
| 2270 | } |
| 2271 | |
Vivien Didelot | 447b1bb | 2018-05-11 17:16:36 -0400 | [diff] [blame] | 2272 | static int mv88e6xxx_stats_setup(struct mv88e6xxx_chip *chip) |
Vivien Didelot | 08a0126 | 2016-05-09 13:22:50 -0400 | [diff] [blame] | 2273 | { |
| 2274 | int err; |
Vivien Didelot | 08a0126 | 2016-05-09 13:22:50 -0400 | [diff] [blame] | 2275 | |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 2276 | /* Initialize the statistics unit */ |
Vivien Didelot | 447b1bb | 2018-05-11 17:16:36 -0400 | [diff] [blame] | 2277 | if (chip->info->ops->stats_set_histogram) { |
| 2278 | err = chip->info->ops->stats_set_histogram(chip); |
| 2279 | if (err) |
| 2280 | return err; |
| 2281 | } |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 2282 | |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2283 | return mv88e6xxx_g1_stats_clear(chip); |
Vivien Didelot | 9729934 | 2016-07-18 20:45:30 -0400 | [diff] [blame] | 2284 | } |
| 2285 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 2286 | static int mv88e6xxx_setup(struct dsa_switch *ds) |
Guenter Roeck | acdaffc | 2015-03-26 18:36:28 -0700 | [diff] [blame] | 2287 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2288 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 2289 | int err; |
Vivien Didelot | a1a6a4d | 2016-05-09 13:22:56 -0400 | [diff] [blame] | 2290 | int i; |
| 2291 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2292 | chip->ds = ds; |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2293 | ds->slave_mii_bus = mv88e6xxx_default_mdio_bus(chip); |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 2294 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2295 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | 552238b | 2016-05-09 13:22:49 -0400 | [diff] [blame] | 2296 | |
Vivien Didelot | 9729934 | 2016-07-18 20:45:30 -0400 | [diff] [blame] | 2297 | /* Setup Switch Port Registers */ |
Vivien Didelot | 370b4ff | 2016-09-29 12:21:57 -0400 | [diff] [blame] | 2298 | for (i = 0; i < mv88e6xxx_num_ports(chip); i++) { |
Vivien Didelot | 91dee14 | 2017-10-26 11:22:52 -0400 | [diff] [blame] | 2299 | if (dsa_is_unused_port(ds, i)) |
| 2300 | continue; |
| 2301 | |
Vivien Didelot | 9729934 | 2016-07-18 20:45:30 -0400 | [diff] [blame] | 2302 | err = mv88e6xxx_setup_port(chip, i); |
| 2303 | if (err) |
| 2304 | goto unlock; |
| 2305 | } |
| 2306 | |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2307 | err = mv88e6xxx_irl_setup(chip); |
| 2308 | if (err) |
| 2309 | goto unlock; |
| 2310 | |
Vivien Didelot | 04a69a1 | 2017-10-13 14:18:05 -0400 | [diff] [blame] | 2311 | err = mv88e6xxx_mac_setup(chip); |
| 2312 | if (err) |
| 2313 | goto unlock; |
| 2314 | |
Vivien Didelot | 1b17aed | 2017-05-26 18:03:05 -0400 | [diff] [blame] | 2315 | err = mv88e6xxx_phy_setup(chip); |
| 2316 | if (err) |
| 2317 | goto unlock; |
| 2318 | |
Vivien Didelot | b486d7c | 2017-05-01 14:05:13 -0400 | [diff] [blame] | 2319 | err = mv88e6xxx_vtu_setup(chip); |
| 2320 | if (err) |
| 2321 | goto unlock; |
| 2322 | |
Vivien Didelot | 8122899 | 2017-03-30 17:37:08 -0400 | [diff] [blame] | 2323 | err = mv88e6xxx_pvt_setup(chip); |
| 2324 | if (err) |
| 2325 | goto unlock; |
| 2326 | |
Vivien Didelot | a2ac29d | 2017-03-11 16:12:49 -0500 | [diff] [blame] | 2327 | err = mv88e6xxx_atu_setup(chip); |
| 2328 | if (err) |
| 2329 | goto unlock; |
| 2330 | |
Andrew Lunn | 87fa886 | 2017-11-09 22:29:56 +0100 | [diff] [blame] | 2331 | err = mv88e6xxx_broadcast_setup(chip, 0); |
| 2332 | if (err) |
| 2333 | goto unlock; |
| 2334 | |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2335 | err = mv88e6xxx_pot_setup(chip); |
| 2336 | if (err) |
| 2337 | goto unlock; |
| 2338 | |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 2339 | err = mv88e6xxx_rmu_setup(chip); |
| 2340 | if (err) |
| 2341 | goto unlock; |
| 2342 | |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2343 | err = mv88e6xxx_rsvd2cpu_setup(chip); |
| 2344 | if (err) |
| 2345 | goto unlock; |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 2346 | |
Vivien Didelot | b28f872 | 2018-04-26 21:56:44 -0400 | [diff] [blame] | 2347 | err = mv88e6xxx_trunk_setup(chip); |
| 2348 | if (err) |
| 2349 | goto unlock; |
| 2350 | |
Vivien Didelot | c7f047b | 2018-04-26 21:56:45 -0400 | [diff] [blame] | 2351 | err = mv88e6xxx_devmap_setup(chip); |
| 2352 | if (err) |
| 2353 | goto unlock; |
| 2354 | |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2355 | err = mv88e6xxx_pri_setup(chip); |
| 2356 | if (err) |
| 2357 | goto unlock; |
| 2358 | |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 2359 | /* Setup PTP Hardware Clock and timestamping */ |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 2360 | if (chip->info->ptp_support) { |
| 2361 | err = mv88e6xxx_ptp_setup(chip); |
| 2362 | if (err) |
| 2363 | goto unlock; |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 2364 | |
| 2365 | err = mv88e6xxx_hwtstamp_setup(chip); |
| 2366 | if (err) |
| 2367 | goto unlock; |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 2368 | } |
| 2369 | |
Vivien Didelot | 447b1bb | 2018-05-11 17:16:36 -0400 | [diff] [blame] | 2370 | err = mv88e6xxx_stats_setup(chip); |
| 2371 | if (err) |
| 2372 | goto unlock; |
| 2373 | |
Vivien Didelot | 6b17e86 | 2015-08-13 12:52:18 -0400 | [diff] [blame] | 2374 | unlock: |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2375 | mutex_unlock(&chip->reg_lock); |
Andrew Lunn | db687a5 | 2015-06-20 21:31:29 +0200 | [diff] [blame] | 2376 | |
Andrew Lunn | 48ace4e | 2016-04-14 23:47:12 +0200 | [diff] [blame] | 2377 | return err; |
Andrew Lunn | 54d792f | 2015-05-06 01:09:47 +0200 | [diff] [blame] | 2378 | } |
| 2379 | |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2380 | 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] | 2381 | { |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2382 | struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv; |
| 2383 | struct mv88e6xxx_chip *chip = mdio_bus->chip; |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2384 | u16 val; |
| 2385 | int err; |
Andrew Lunn | fd3a0ee | 2015-04-02 04:06:36 +0200 | [diff] [blame] | 2386 | |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 2387 | if (!chip->info->ops->phy_read) |
| 2388 | return -EOPNOTSUPP; |
| 2389 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2390 | mutex_lock(&chip->reg_lock); |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 2391 | err = chip->info->ops->phy_read(chip, bus, phy, reg, &val); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2392 | mutex_unlock(&chip->reg_lock); |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2393 | |
Andrew Lunn | da9f330 | 2017-02-01 03:40:05 +0100 | [diff] [blame] | 2394 | if (reg == MII_PHYSID2) { |
| 2395 | /* Some internal PHYS don't have a model number. Use |
| 2396 | * the mv88e6390 family model number instead. |
| 2397 | */ |
| 2398 | if (!(val & 0x3f0)) |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 2399 | val |= MV88E6XXX_PORT_SWITCH_ID_PROD_6390 >> 4; |
Andrew Lunn | da9f330 | 2017-02-01 03:40:05 +0100 | [diff] [blame] | 2400 | } |
| 2401 | |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2402 | return err ? err : val; |
Andrew Lunn | fd3a0ee | 2015-04-02 04:06:36 +0200 | [diff] [blame] | 2403 | } |
| 2404 | |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2405 | 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] | 2406 | { |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2407 | struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv; |
| 2408 | struct mv88e6xxx_chip *chip = mdio_bus->chip; |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2409 | int err; |
Andrew Lunn | fd3a0ee | 2015-04-02 04:06:36 +0200 | [diff] [blame] | 2410 | |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 2411 | if (!chip->info->ops->phy_write) |
| 2412 | return -EOPNOTSUPP; |
| 2413 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2414 | mutex_lock(&chip->reg_lock); |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 2415 | err = chip->info->ops->phy_write(chip, bus, phy, reg, val); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2416 | mutex_unlock(&chip->reg_lock); |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 2417 | |
| 2418 | return err; |
Andrew Lunn | fd3a0ee | 2015-04-02 04:06:36 +0200 | [diff] [blame] | 2419 | } |
| 2420 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2421 | static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip, |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2422 | struct device_node *np, |
| 2423 | bool external) |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2424 | { |
| 2425 | static int index; |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2426 | struct mv88e6xxx_mdio_bus *mdio_bus; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2427 | struct mii_bus *bus; |
| 2428 | int err; |
| 2429 | |
Andrew Lunn | 2510bab | 2018-02-22 01:51:49 +0100 | [diff] [blame] | 2430 | if (external) { |
| 2431 | mutex_lock(&chip->reg_lock); |
| 2432 | err = mv88e6xxx_g2_scratch_gpio_set_smi(chip, true); |
| 2433 | mutex_unlock(&chip->reg_lock); |
| 2434 | |
| 2435 | if (err) |
| 2436 | return err; |
| 2437 | } |
| 2438 | |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2439 | bus = devm_mdiobus_alloc_size(chip->dev, sizeof(*mdio_bus)); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2440 | if (!bus) |
| 2441 | return -ENOMEM; |
| 2442 | |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2443 | mdio_bus = bus->priv; |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2444 | mdio_bus->bus = bus; |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2445 | mdio_bus->chip = chip; |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2446 | INIT_LIST_HEAD(&mdio_bus->list); |
| 2447 | mdio_bus->external = external; |
Andrew Lunn | 0dd12d5 | 2017-01-24 14:53:49 +0100 | [diff] [blame] | 2448 | |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2449 | if (np) { |
| 2450 | bus->name = np->full_name; |
Rob Herring | f7ce910 | 2017-07-18 16:43:19 -0500 | [diff] [blame] | 2451 | snprintf(bus->id, MII_BUS_ID_SIZE, "%pOF", np); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2452 | } else { |
| 2453 | bus->name = "mv88e6xxx SMI"; |
| 2454 | snprintf(bus->id, MII_BUS_ID_SIZE, "mv88e6xxx-%d", index++); |
| 2455 | } |
| 2456 | |
| 2457 | bus->read = mv88e6xxx_mdio_read; |
| 2458 | bus->write = mv88e6xxx_mdio_write; |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2459 | bus->parent = chip->dev; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2460 | |
Andrew Lunn | 6f88284 | 2018-03-17 20:32:05 +0100 | [diff] [blame] | 2461 | if (!external) { |
| 2462 | err = mv88e6xxx_g2_irq_mdio_setup(chip, bus); |
| 2463 | if (err) |
| 2464 | return err; |
| 2465 | } |
| 2466 | |
Florian Fainelli | 00e798c | 2018-05-15 16:56:19 -0700 | [diff] [blame] | 2467 | err = of_mdiobus_register(bus, np); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2468 | if (err) { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 2469 | dev_err(chip->dev, "Cannot register MDIO bus (%d)\n", err); |
Andrew Lunn | 6f88284 | 2018-03-17 20:32:05 +0100 | [diff] [blame] | 2470 | mv88e6xxx_g2_irq_mdio_free(chip, bus); |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2471 | return err; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2472 | } |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2473 | |
| 2474 | if (external) |
| 2475 | list_add_tail(&mdio_bus->list, &chip->mdios); |
| 2476 | else |
| 2477 | list_add(&mdio_bus->list, &chip->mdios); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2478 | |
| 2479 | return 0; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 2480 | } |
| 2481 | |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2482 | static const struct of_device_id mv88e6xxx_mdio_external_match[] = { |
| 2483 | { .compatible = "marvell,mv88e6xxx-mdio-external", |
| 2484 | .data = (void *)true }, |
| 2485 | { }, |
| 2486 | }; |
| 2487 | |
Andrew Lunn | 3126aee | 2017-12-07 01:05:57 +0100 | [diff] [blame] | 2488 | static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip) |
| 2489 | |
| 2490 | { |
| 2491 | struct mv88e6xxx_mdio_bus *mdio_bus; |
| 2492 | struct mii_bus *bus; |
| 2493 | |
| 2494 | list_for_each_entry(mdio_bus, &chip->mdios, list) { |
| 2495 | bus = mdio_bus->bus; |
| 2496 | |
Andrew Lunn | 6f88284 | 2018-03-17 20:32:05 +0100 | [diff] [blame] | 2497 | if (!mdio_bus->external) |
| 2498 | mv88e6xxx_g2_irq_mdio_free(chip, bus); |
| 2499 | |
Andrew Lunn | 3126aee | 2017-12-07 01:05:57 +0100 | [diff] [blame] | 2500 | mdiobus_unregister(bus); |
| 2501 | } |
| 2502 | } |
| 2503 | |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2504 | static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip, |
| 2505 | struct device_node *np) |
| 2506 | { |
| 2507 | const struct of_device_id *match; |
| 2508 | struct device_node *child; |
| 2509 | int err; |
| 2510 | |
| 2511 | /* Always register one mdio bus for the internal/default mdio |
| 2512 | * bus. This maybe represented in the device tree, but is |
| 2513 | * optional. |
| 2514 | */ |
| 2515 | child = of_get_child_by_name(np, "mdio"); |
| 2516 | err = mv88e6xxx_mdio_register(chip, child, false); |
| 2517 | if (err) |
| 2518 | return err; |
| 2519 | |
| 2520 | /* Walk the device tree, and see if there are any other nodes |
| 2521 | * which say they are compatible with the external mdio |
| 2522 | * bus. |
| 2523 | */ |
| 2524 | for_each_available_child_of_node(np, child) { |
| 2525 | match = of_match_node(mv88e6xxx_mdio_external_match, child); |
| 2526 | if (match) { |
| 2527 | err = mv88e6xxx_mdio_register(chip, child, true); |
Andrew Lunn | 3126aee | 2017-12-07 01:05:57 +0100 | [diff] [blame] | 2528 | if (err) { |
| 2529 | mv88e6xxx_mdios_unregister(chip); |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2530 | return err; |
Andrew Lunn | 3126aee | 2017-12-07 01:05:57 +0100 | [diff] [blame] | 2531 | } |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 2532 | } |
| 2533 | } |
| 2534 | |
| 2535 | return 0; |
| 2536 | } |
| 2537 | |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2538 | static int mv88e6xxx_get_eeprom_len(struct dsa_switch *ds) |
| 2539 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2540 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2541 | |
| 2542 | return chip->eeprom_len; |
| 2543 | } |
| 2544 | |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2545 | static int mv88e6xxx_get_eeprom(struct dsa_switch *ds, |
| 2546 | struct ethtool_eeprom *eeprom, u8 *data) |
| 2547 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2548 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2549 | int err; |
| 2550 | |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 2551 | if (!chip->info->ops->get_eeprom) |
| 2552 | return -EOPNOTSUPP; |
| 2553 | |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2554 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 2555 | err = chip->info->ops->get_eeprom(chip, eeprom, data); |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2556 | mutex_unlock(&chip->reg_lock); |
| 2557 | |
| 2558 | if (err) |
| 2559 | return err; |
| 2560 | |
| 2561 | eeprom->magic = 0xc3ec4951; |
| 2562 | |
| 2563 | return 0; |
| 2564 | } |
| 2565 | |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2566 | static int mv88e6xxx_set_eeprom(struct dsa_switch *ds, |
| 2567 | struct ethtool_eeprom *eeprom, u8 *data) |
| 2568 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 2569 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2570 | int err; |
| 2571 | |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 2572 | if (!chip->info->ops->set_eeprom) |
| 2573 | return -EOPNOTSUPP; |
| 2574 | |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2575 | if (eeprom->magic != 0xc3ec4951) |
| 2576 | return -EINVAL; |
| 2577 | |
| 2578 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 2579 | err = chip->info->ops->set_eeprom(chip, eeprom, data); |
Vivien Didelot | 855b193 | 2016-07-20 18:18:35 -0400 | [diff] [blame] | 2580 | mutex_unlock(&chip->reg_lock); |
| 2581 | |
| 2582 | return err; |
| 2583 | } |
| 2584 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2585 | static const struct mv88e6xxx_ops mv88e6085_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2586 | /* MV88E6XXX_FAMILY_6097 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2587 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2588 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2589 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2590 | .set_switch_mac = mv88e6xxx_g1_set_switch_mac, |
Vivien Didelot | 7e20cfb | 2017-05-26 18:03:06 -0400 | [diff] [blame] | 2591 | .phy_read = mv88e6185_phy_ppu_read, |
| 2592 | .phy_write = mv88e6185_phy_ppu_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2593 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2594 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2595 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2596 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2597 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2598 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2599 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2600 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2601 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2602 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2603 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 2604 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2605 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2606 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2607 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2608 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2609 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2610 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2611 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2612 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2613 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 2614 | .ppu_enable = mv88e6185_g1_ppu_enable, |
| 2615 | .ppu_disable = mv88e6185_g1_ppu_disable, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2616 | .reset = mv88e6185_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 2617 | .rmu_disable = mv88e6085_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2618 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2619 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Marek Behún | 5bafeb6e | 2018-05-04 19:26:10 +0200 | [diff] [blame] | 2620 | .serdes_power = mv88e6341_serdes_power, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2621 | }; |
| 2622 | |
| 2623 | static const struct mv88e6xxx_ops mv88e6095_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2624 | /* MV88E6XXX_FAMILY_6095 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2625 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2626 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2627 | .set_switch_mac = mv88e6xxx_g1_set_switch_mac, |
Vivien Didelot | 7e20cfb | 2017-05-26 18:03:06 -0400 | [diff] [blame] | 2628 | .phy_read = mv88e6185_phy_ppu_read, |
| 2629 | .phy_write = mv88e6185_phy_ppu_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2630 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2631 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2632 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2633 | .port_set_frame_mode = mv88e6085_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2634 | .port_set_egress_floods = mv88e6185_port_set_egress_floods, |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2635 | .port_set_upstream_port = mv88e6095_port_set_upstream_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 2636 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2637 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2638 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2639 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2640 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2641 | .mgmt_rsvd2cpu = mv88e6185_g2_mgmt_rsvd2cpu, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 2642 | .ppu_enable = mv88e6185_g1_ppu_enable, |
| 2643 | .ppu_disable = mv88e6185_g1_ppu_disable, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2644 | .reset = mv88e6185_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2645 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2646 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2647 | }; |
| 2648 | |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2649 | static const struct mv88e6xxx_ops mv88e6097_ops = { |
Stefan Eichenberger | 15da3cc | 2016-11-25 09:41:30 +0100 | [diff] [blame] | 2650 | /* MV88E6XXX_FAMILY_6097 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2651 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2652 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2653 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2654 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 2655 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 2656 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 2657 | .port_set_link = mv88e6xxx_port_set_link, |
| 2658 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 2659 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2660 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2661 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2662 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2663 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2664 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2665 | .port_egress_rate_limiting = mv88e6095_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2666 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2667 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2668 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2669 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2670 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2671 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2672 | .stats_get_strings = mv88e6095_stats_get_strings, |
| 2673 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2674 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2675 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Volodymyr Bendiuga | 91eaa47 | 2017-02-14 11:29:30 +0100 | [diff] [blame] | 2676 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2677 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2678 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2679 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 2680 | .rmu_disable = mv88e6085_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2681 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2682 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 2683 | }; |
| 2684 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2685 | static const struct mv88e6xxx_ops mv88e6123_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2686 | /* MV88E6XXX_FAMILY_6165 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2687 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2688 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2689 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2690 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Andrew Lunn | ec8378b | 2017-06-02 23:22:45 +0200 | [diff] [blame] | 2691 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 2692 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2693 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2694 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2695 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2696 | .port_set_frame_mode = mv88e6085_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2697 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2698 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2699 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | 0ac64c3 | 2017-06-02 23:22:46 +0200 | [diff] [blame] | 2700 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2701 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2702 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2703 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2704 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2705 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2706 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2707 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2708 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2709 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2710 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2711 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2712 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2713 | }; |
| 2714 | |
| 2715 | static const struct mv88e6xxx_ops mv88e6131_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2716 | /* MV88E6XXX_FAMILY_6185 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2717 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2718 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2719 | .set_switch_mac = mv88e6xxx_g1_set_switch_mac, |
Vivien Didelot | 7e20cfb | 2017-05-26 18:03:06 -0400 | [diff] [blame] | 2720 | .phy_read = mv88e6185_phy_ppu_read, |
| 2721 | .phy_write = mv88e6185_phy_ppu_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2722 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2723 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2724 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2725 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2726 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2727 | .port_set_egress_floods = mv88e6185_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2728 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 2729 | .port_set_upstream_port = mv88e6095_port_set_upstream_port, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2730 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2731 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2732 | .port_pause_limit = mv88e6097_port_pause_limit, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 2733 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2734 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2735 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2736 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2737 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2738 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2739 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2740 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2741 | .mgmt_rsvd2cpu = mv88e6185_g2_mgmt_rsvd2cpu, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 2742 | .ppu_enable = mv88e6185_g1_ppu_enable, |
Vivien Didelot | 02317e6 | 2018-05-09 11:38:49 -0400 | [diff] [blame] | 2743 | .set_cascade_port = mv88e6185_g1_set_cascade_port, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 2744 | .ppu_disable = mv88e6185_g1_ppu_disable, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2745 | .reset = mv88e6185_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2746 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2747 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2748 | }; |
| 2749 | |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2750 | static const struct mv88e6xxx_ops mv88e6141_ops = { |
| 2751 | /* MV88E6XXX_FAMILY_6341 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2752 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2753 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2754 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2755 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 2756 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| 2757 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 2758 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 2759 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 2760 | .port_set_link = mv88e6xxx_port_set_link, |
| 2761 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 2762 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 2763 | .port_set_speed = mv88e6390_port_set_speed, |
| 2764 | .port_tag_remap = mv88e6095_port_tag_remap, |
| 2765 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
| 2766 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
| 2767 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2768 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2769 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2770 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2771 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
| 2772 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
| 2773 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2774 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2775 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 2776 | .stats_get_strings = mv88e6320_stats_get_strings, |
| 2777 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2778 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 2779 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2780 | .watchdog_ops = &mv88e6390_watchdog_ops, |
| 2781 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2782 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2783 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2784 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2785 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 2786 | .gpio_ops = &mv88e6352_gpio_ops, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 2787 | }; |
| 2788 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2789 | static const struct mv88e6xxx_ops mv88e6161_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2790 | /* MV88E6XXX_FAMILY_6165 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2791 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2792 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2793 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2794 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Andrew Lunn | ec8378b | 2017-06-02 23:22:45 +0200 | [diff] [blame] | 2795 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 2796 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2797 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2798 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2799 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2800 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2801 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2802 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2803 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2804 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2805 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2806 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2807 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2808 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | 0ac64c3 | 2017-06-02 23:22:46 +0200 | [diff] [blame] | 2809 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2810 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2811 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2812 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2813 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2814 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2815 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2816 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2817 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2818 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2819 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2820 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2821 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2822 | }; |
| 2823 | |
| 2824 | static const struct mv88e6xxx_ops mv88e6165_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2825 | /* MV88E6XXX_FAMILY_6165 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2826 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2827 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2828 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2829 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Andrew Lunn | efb3e74 | 2017-01-24 14:53:47 +0100 | [diff] [blame] | 2830 | .phy_read = mv88e6165_phy_read, |
| 2831 | .phy_write = mv88e6165_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2832 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2833 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2834 | .port_set_speed = mv88e6185_port_set_speed, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2835 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2836 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 2837 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2838 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2839 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2840 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2841 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2842 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2843 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2844 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2845 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2846 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2847 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2848 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2849 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2850 | }; |
| 2851 | |
| 2852 | static const struct mv88e6xxx_ops mv88e6171_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2853 | /* MV88E6XXX_FAMILY_6351 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2854 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2855 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2856 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2857 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2858 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 2859 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2860 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2861 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Andrew Lunn | 94d66ae | 2016-11-10 15:44:01 +0100 | [diff] [blame] | 2862 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2863 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2864 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2865 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2866 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2867 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2868 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2869 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2870 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2871 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2872 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 2873 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2874 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2875 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2876 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2877 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2878 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2879 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2880 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2881 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2882 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2883 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2884 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2885 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2886 | }; |
| 2887 | |
| 2888 | static const struct mv88e6xxx_ops mv88e6172_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2889 | /* MV88E6XXX_FAMILY_6352 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2890 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2891 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2892 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 2893 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 2894 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2895 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2896 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 2897 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2898 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2899 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | a0a0f62 | 2016-11-04 03:23:34 +0100 | [diff] [blame] | 2900 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2901 | .port_set_speed = mv88e6352_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2902 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2903 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2904 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2905 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2906 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2907 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2908 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2909 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2910 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 2911 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2912 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2913 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2914 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2915 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2916 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2917 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2918 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2919 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2920 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2921 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 2922 | .rmu_disable = mv88e6352_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2923 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2924 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 2925 | .serdes_power = mv88e6352_serdes_power, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 2926 | .gpio_ops = &mv88e6352_gpio_ops, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2927 | }; |
| 2928 | |
| 2929 | static const struct mv88e6xxx_ops mv88e6175_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2930 | /* MV88E6XXX_FAMILY_6351 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2931 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2932 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2933 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2934 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2935 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 2936 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2937 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2938 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Andrew Lunn | 94d66ae | 2016-11-10 15:44:01 +0100 | [diff] [blame] | 2939 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2940 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2941 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2942 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2943 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2944 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2945 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2946 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2947 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2948 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2949 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 2950 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2951 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2952 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2953 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2954 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2955 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2956 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2957 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2958 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2959 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2960 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 2961 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 2962 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Marek Behún | 5bafeb6e | 2018-05-04 19:26:10 +0200 | [diff] [blame] | 2963 | .serdes_power = mv88e6341_serdes_power, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2964 | }; |
| 2965 | |
| 2966 | static const struct mv88e6xxx_ops mv88e6176_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 2967 | /* MV88E6XXX_FAMILY_6352 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 2968 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 2969 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 2970 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 2971 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 2972 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 2973 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 2974 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 2975 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 2976 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 2977 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | a0a0f62 | 2016-11-04 03:23:34 +0100 | [diff] [blame] | 2978 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 2979 | .port_set_speed = mv88e6352_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 2980 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2981 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 2982 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 2983 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 2984 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 2985 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 2986 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 2987 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 2988 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 2989 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 2990 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 2991 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 2992 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 2993 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 2994 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 2995 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 2996 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 2997 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 2998 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 2999 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3000 | .rmu_disable = mv88e6352_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3001 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3002 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 3003 | .serdes_power = mv88e6352_serdes_power, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3004 | .gpio_ops = &mv88e6352_gpio_ops, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3005 | }; |
| 3006 | |
| 3007 | static const struct mv88e6xxx_ops mv88e6185_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3008 | /* MV88E6XXX_FAMILY_6185 */ |
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 | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3011 | .set_switch_mac = mv88e6xxx_g1_set_switch_mac, |
Vivien Didelot | 7e20cfb | 2017-05-26 18:03:06 -0400 | [diff] [blame] | 3012 | .phy_read = mv88e6185_phy_ppu_read, |
| 3013 | .phy_write = mv88e6185_phy_ppu_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3014 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3015 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3016 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3017 | .port_set_frame_mode = mv88e6085_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3018 | .port_set_egress_floods = mv88e6185_port_set_egress_floods, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3019 | .port_egress_rate_limiting = mv88e6095_port_egress_rate_limiting, |
Andrew Lunn | a23b296 | 2017-02-04 20:15:28 +0100 | [diff] [blame] | 3020 | .port_set_upstream_port = mv88e6095_port_set_upstream_port, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3021 | .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3022 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3023 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3024 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3025 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3026 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3027 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3028 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3029 | .mgmt_rsvd2cpu = mv88e6185_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 02317e6 | 2018-05-09 11:38:49 -0400 | [diff] [blame] | 3030 | .set_cascade_port = mv88e6185_g1_set_cascade_port, |
Vivien Didelot | a199d8b | 2016-12-05 17:30:28 -0500 | [diff] [blame] | 3031 | .ppu_enable = mv88e6185_g1_ppu_enable, |
| 3032 | .ppu_disable = mv88e6185_g1_ppu_disable, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3033 | .reset = mv88e6185_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3034 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3035 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3036 | }; |
| 3037 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3038 | static const struct mv88e6xxx_ops mv88e6190_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3039 | /* MV88E6XXX_FAMILY_6390 */ |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3040 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3041 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3042 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3043 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3044 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3045 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3046 | .port_set_link = mv88e6xxx_port_set_link, |
| 3047 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3048 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3049 | .port_set_speed = mv88e6390_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3050 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3051 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3052 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3053 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3054 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3055 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3056 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3057 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3058 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3059 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3060 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3061 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3062 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3063 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3064 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3065 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3066 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3067 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3068 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3069 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3070 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 6335e9f | 2017-05-26 01:03:23 +0200 | [diff] [blame] | 3071 | .serdes_power = mv88e6390_serdes_power, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3072 | .gpio_ops = &mv88e6352_gpio_ops, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3073 | }; |
| 3074 | |
| 3075 | static const struct mv88e6xxx_ops mv88e6190x_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3076 | /* MV88E6XXX_FAMILY_6390 */ |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3077 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3078 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3079 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3080 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3081 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3082 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3083 | .port_set_link = mv88e6xxx_port_set_link, |
| 3084 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3085 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3086 | .port_set_speed = mv88e6390x_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3087 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3088 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3089 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3090 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3091 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3092 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3093 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3094 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3095 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3096 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3097 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3098 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3099 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3100 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3101 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3102 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3103 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3104 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3105 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3106 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3107 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 6335e9f | 2017-05-26 01:03:23 +0200 | [diff] [blame] | 3108 | .serdes_power = mv88e6390_serdes_power, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3109 | .gpio_ops = &mv88e6352_gpio_ops, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3110 | }; |
| 3111 | |
| 3112 | static const struct mv88e6xxx_ops mv88e6191_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3113 | /* MV88E6XXX_FAMILY_6390 */ |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3114 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3115 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3116 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3117 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3118 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3119 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3120 | .port_set_link = mv88e6xxx_port_set_link, |
| 3121 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3122 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3123 | .port_set_speed = mv88e6390_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3124 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3125 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3126 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3127 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3128 | .port_pause_limit = mv88e6390_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3129 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3130 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3131 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3132 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3133 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3134 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3135 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3136 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3137 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3138 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3139 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3140 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3141 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3142 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3143 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3144 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 6335e9f | 2017-05-26 01:03:23 +0200 | [diff] [blame] | 3145 | .serdes_power = mv88e6390_serdes_power, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3146 | }; |
| 3147 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3148 | static const struct mv88e6xxx_ops mv88e6240_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3149 | /* MV88E6XXX_FAMILY_6352 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3150 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3151 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3152 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3153 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3154 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3155 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3156 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3157 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3158 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3159 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | a0a0f62 | 2016-11-04 03:23:34 +0100 | [diff] [blame] | 3160 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3161 | .port_set_speed = mv88e6352_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3162 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3163 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3164 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3165 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3166 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3167 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3168 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3169 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3170 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3171 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3172 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3173 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3174 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3175 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3176 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3177 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3178 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3179 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3180 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3181 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3182 | .rmu_disable = mv88e6352_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3183 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3184 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 3185 | .serdes_power = mv88e6352_serdes_power, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3186 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3187 | .avb_ops = &mv88e6352_avb_ops, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3188 | }; |
| 3189 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3190 | static const struct mv88e6xxx_ops mv88e6290_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3191 | /* MV88E6XXX_FAMILY_6390 */ |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3192 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3193 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3194 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3195 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3196 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3197 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3198 | .port_set_link = mv88e6xxx_port_set_link, |
| 3199 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3200 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3201 | .port_set_speed = mv88e6390_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3202 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3203 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3204 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3205 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3206 | .port_pause_limit = mv88e6390_port_pause_limit, |
Andrew Lunn | f39908d | 2017-02-04 20:02:50 +0100 | [diff] [blame] | 3207 | .port_set_cmode = mv88e6390x_port_set_cmode, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3208 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3209 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3210 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3211 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3212 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3213 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3214 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3215 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3216 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3217 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3218 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3219 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3220 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3221 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3222 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3223 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 6335e9f | 2017-05-26 01:03:23 +0200 | [diff] [blame] | 3224 | .serdes_power = mv88e6390_serdes_power, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3225 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3226 | .avb_ops = &mv88e6390_avb_ops, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3227 | }; |
| 3228 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3229 | static const struct mv88e6xxx_ops mv88e6320_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3230 | /* MV88E6XXX_FAMILY_6320 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3231 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3232 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3233 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3234 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3235 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3236 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3237 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3238 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3239 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3240 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3241 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3242 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3243 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3244 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3245 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3246 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3247 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3248 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3249 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3250 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3251 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3252 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3253 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3254 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3255 | .stats_get_stats = mv88e6320_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3256 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3257 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3258 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3259 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3260 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3261 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3262 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3263 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3264 | .avb_ops = &mv88e6352_avb_ops, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3265 | }; |
| 3266 | |
| 3267 | static const struct mv88e6xxx_ops mv88e6321_ops = { |
Vivien Didelot | bd80720 | 2017-07-17 13:03:37 -0400 | [diff] [blame] | 3268 | /* MV88E6XXX_FAMILY_6320 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3269 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3270 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3271 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3272 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3273 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3274 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3275 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3276 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3277 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3278 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3279 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3280 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3281 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3282 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3283 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3284 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3285 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3286 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3287 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3288 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3289 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3290 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3291 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3292 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3293 | .stats_get_stats = mv88e6320_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3294 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3295 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3296 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3297 | .vtu_getnext = mv88e6185_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3298 | .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3299 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3300 | .avb_ops = &mv88e6352_avb_ops, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3301 | }; |
| 3302 | |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3303 | static const struct mv88e6xxx_ops mv88e6341_ops = { |
| 3304 | /* MV88E6XXX_FAMILY_6341 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3305 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3306 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3307 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3308 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3309 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| 3310 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3311 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3312 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3313 | .port_set_link = mv88e6xxx_port_set_link, |
| 3314 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3315 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3316 | .port_set_speed = mv88e6390_port_set_speed, |
| 3317 | .port_tag_remap = mv88e6095_port_tag_remap, |
| 3318 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
| 3319 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
| 3320 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3321 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3322 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3323 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3324 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
| 3325 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
| 3326 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3327 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3328 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3329 | .stats_get_strings = mv88e6320_stats_get_strings, |
| 3330 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3331 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3332 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3333 | .watchdog_ops = &mv88e6390_watchdog_ops, |
| 3334 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3335 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3336 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3337 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3338 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3339 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3340 | .avb_ops = &mv88e6390_avb_ops, |
Vivien Didelot | 16e329a | 2017-03-28 13:50:33 -0400 | [diff] [blame] | 3341 | }; |
| 3342 | |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3343 | static const struct mv88e6xxx_ops mv88e6350_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3344 | /* MV88E6XXX_FAMILY_6351 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3345 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3346 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3347 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3348 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3349 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3350 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3351 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3352 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Andrew Lunn | 94d66ae | 2016-11-10 15:44:01 +0100 | [diff] [blame] | 3353 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3354 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3355 | .port_tag_remap = mv88e6095_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 | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3359 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3360 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3361 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3362 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3363 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3364 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3365 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3366 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3367 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3368 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3369 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3370 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3371 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3372 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3373 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3374 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3375 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3376 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3377 | }; |
| 3378 | |
| 3379 | static const struct mv88e6xxx_ops mv88e6351_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3380 | /* MV88E6XXX_FAMILY_6351 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3381 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3382 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3383 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3384 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3385 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3386 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3387 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3388 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Andrew Lunn | 94d66ae | 2016-11-10 15:44:01 +0100 | [diff] [blame] | 3389 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3390 | .port_set_speed = mv88e6185_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3391 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3392 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3393 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3394 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3395 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3396 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3397 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3398 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3399 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3400 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3401 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3402 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3403 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3404 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3405 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3406 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3407 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3408 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3409 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3410 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3411 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3412 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3413 | .avb_ops = &mv88e6352_avb_ops, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3414 | }; |
| 3415 | |
| 3416 | static const struct mv88e6xxx_ops mv88e6352_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3417 | /* MV88E6XXX_FAMILY_6352 */ |
Vivien Didelot | 93e18d6 | 2018-05-11 17:16:35 -0400 | [diff] [blame] | 3418 | .ieee_pri_map = mv88e6085_g1_ieee_pri_map, |
| 3419 | .ip_pri_map = mv88e6085_g1_ip_pri_map, |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3420 | .irl_init_all = mv88e6352_g2_irl_init_all, |
Vivien Didelot | ee4dc2e7 | 2016-09-29 12:22:02 -0400 | [diff] [blame] | 3421 | .get_eeprom = mv88e6xxx_g2_get_eeprom16, |
| 3422 | .set_eeprom = mv88e6xxx_g2_set_eeprom16, |
Vivien Didelot | b073d4e | 2016-09-29 12:22:01 -0400 | [diff] [blame] | 3423 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3424 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3425 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
Vivien Didelot | 08ef7f1 | 2016-11-04 03:23:32 +0100 | [diff] [blame] | 3426 | .port_set_link = mv88e6xxx_port_set_link, |
Vivien Didelot | 7f1ae07 | 2016-11-04 03:23:33 +0100 | [diff] [blame] | 3427 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
Vivien Didelot | a0a0f62 | 2016-11-04 03:23:34 +0100 | [diff] [blame] | 3428 | .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, |
Vivien Didelot | 96a2b40 | 2016-11-04 03:23:35 +0100 | [diff] [blame] | 3429 | .port_set_speed = mv88e6352_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3430 | .port_tag_remap = mv88e6095_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3431 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3432 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3433 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3434 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3435 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3436 | .port_pause_limit = mv88e6097_port_pause_limit, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3437 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3438 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | a605a0f | 2016-11-21 23:26:58 +0100 | [diff] [blame] | 3439 | .stats_snapshot = mv88e6320_g1_stats_snapshot, |
Andrew Lunn | 40cff8f | 2017-11-10 00:36:41 +0100 | [diff] [blame] | 3440 | .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3441 | .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
| 3442 | .stats_get_strings = mv88e6095_stats_get_strings, |
Andrew Lunn | 052f947 | 2016-11-21 23:27:03 +0100 | [diff] [blame] | 3443 | .stats_get_stats = mv88e6095_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3444 | .set_cpu_port = mv88e6095_g1_set_cpu_port, |
| 3445 | .set_egress_port = mv88e6095_g1_set_egress_port, |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 3446 | .watchdog_ops = &mv88e6097_watchdog_ops, |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 3447 | .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3448 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3449 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3450 | .rmu_disable = mv88e6352_g1_rmu_disable, |
Vivien Didelot | f1394b78 | 2017-05-01 14:05:22 -0400 | [diff] [blame] | 3451 | .vtu_getnext = mv88e6352_g1_vtu_getnext, |
Vivien Didelot | 0ad5daf | 2017-05-01 14:05:23 -0400 | [diff] [blame] | 3452 | .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, |
Andrew Lunn | 6d91782 | 2017-05-26 01:03:21 +0200 | [diff] [blame] | 3453 | .serdes_power = mv88e6352_serdes_power, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3454 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3455 | .avb_ops = &mv88e6352_avb_ops, |
Andrew Lunn | cda9f4a | 2018-03-01 02:02:31 +0100 | [diff] [blame] | 3456 | .serdes_get_sset_count = mv88e6352_serdes_get_sset_count, |
| 3457 | .serdes_get_strings = mv88e6352_serdes_get_strings, |
| 3458 | .serdes_get_stats = mv88e6352_serdes_get_stats, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3459 | }; |
| 3460 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3461 | static const struct mv88e6xxx_ops mv88e6390_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3462 | /* MV88E6XXX_FAMILY_6390 */ |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3463 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3464 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3465 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3466 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3467 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3468 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3469 | .port_set_link = mv88e6xxx_port_set_link, |
| 3470 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3471 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3472 | .port_set_speed = mv88e6390_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3473 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3474 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3475 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3476 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3477 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3478 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3479 | .port_pause_limit = mv88e6390_port_pause_limit, |
Andrew Lunn | f39908d | 2017-02-04 20:02:50 +0100 | [diff] [blame] | 3480 | .port_set_cmode = mv88e6390x_port_set_cmode, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3481 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3482 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3483 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3484 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3485 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3486 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3487 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3488 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3489 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3490 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3491 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3492 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3493 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3494 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3495 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3496 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 6335e9f | 2017-05-26 01:03:23 +0200 | [diff] [blame] | 3497 | .serdes_power = mv88e6390_serdes_power, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3498 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3499 | .avb_ops = &mv88e6390_avb_ops, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3500 | }; |
| 3501 | |
| 3502 | static const struct mv88e6xxx_ops mv88e6390x_ops = { |
Andrew Lunn | 4b325d8 | 2016-11-21 23:26:59 +0100 | [diff] [blame] | 3503 | /* MV88E6XXX_FAMILY_6390 */ |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 3504 | .irl_init_all = mv88e6390_g2_irl_init_all, |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 3505 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3506 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3507 | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, |
| 3508 | .phy_read = mv88e6xxx_g2_smi_phy_read, |
| 3509 | .phy_write = mv88e6xxx_g2_smi_phy_write, |
| 3510 | .port_set_link = mv88e6xxx_port_set_link, |
| 3511 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
| 3512 | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, |
| 3513 | .port_set_speed = mv88e6390x_port_set_speed, |
Andrew Lunn | ef0a731 | 2016-12-03 04:35:16 +0100 | [diff] [blame] | 3514 | .port_tag_remap = mv88e6390_port_tag_remap, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3515 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
Vivien Didelot | 601aeed | 2017-03-11 16:13:00 -0500 | [diff] [blame] | 3516 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
Andrew Lunn | 56995cb | 2016-12-03 04:35:19 +0100 | [diff] [blame] | 3517 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
Vivien Didelot | cd78265 | 2017-06-08 18:34:13 -0400 | [diff] [blame] | 3518 | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
Andrew Lunn | ef70b11 | 2016-12-03 04:45:18 +0100 | [diff] [blame] | 3519 | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, |
Vivien Didelot | 0898432 | 2017-06-08 18:34:12 -0400 | [diff] [blame] | 3520 | .port_pause_limit = mv88e6390_port_pause_limit, |
Martin Hundebøll | bb0a267 | 2017-07-19 08:17:02 +0200 | [diff] [blame] | 3521 | .port_set_cmode = mv88e6390x_port_set_cmode, |
Vivien Didelot | c8c9489 | 2017-03-11 16:13:01 -0500 | [diff] [blame] | 3522 | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
Vivien Didelot | 9dbfb4e | 2017-03-11 16:13:02 -0500 | [diff] [blame] | 3523 | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
Andrew Lunn | 7952347 | 2016-11-21 23:27:00 +0100 | [diff] [blame] | 3524 | .stats_snapshot = mv88e6390_g1_stats_snapshot, |
Andrew Lunn | de227387 | 2016-11-21 23:27:01 +0100 | [diff] [blame] | 3525 | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
Andrew Lunn | dfafe44 | 2016-11-21 23:27:02 +0100 | [diff] [blame] | 3526 | .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
| 3527 | .stats_get_strings = mv88e6320_stats_get_strings, |
Andrew Lunn | e0d8b61 | 2016-11-21 23:27:04 +0100 | [diff] [blame] | 3528 | .stats_get_stats = mv88e6390_stats_get_stats, |
Vivien Didelot | fa8d117 | 2017-06-08 18:34:11 -0400 | [diff] [blame] | 3529 | .set_cpu_port = mv88e6390_g1_set_cpu_port, |
| 3530 | .set_egress_port = mv88e6390_g1_set_egress_port, |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 3531 | .watchdog_ops = &mv88e6390_watchdog_ops, |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 3532 | .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame] | 3533 | .pot_clear = mv88e6xxx_g2_pot_clear, |
Vivien Didelot | 17e708b | 2016-12-05 17:30:27 -0500 | [diff] [blame] | 3534 | .reset = mv88e6352_g1_reset, |
Vivien Didelot | 9e5baf9 | 2018-05-09 11:38:51 -0400 | [diff] [blame] | 3535 | .rmu_disable = mv88e6390_g1_rmu_disable, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3536 | .vtu_getnext = mv88e6390_g1_vtu_getnext, |
| 3537 | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, |
Andrew Lunn | 6335e9f | 2017-05-26 01:03:23 +0200 | [diff] [blame] | 3538 | .serdes_power = mv88e6390_serdes_power, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3539 | .gpio_ops = &mv88e6352_gpio_ops, |
Brandon Streiff | 0d632c3 | 2018-02-14 01:07:44 +0100 | [diff] [blame] | 3540 | .avb_ops = &mv88e6390_avb_ops, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3541 | }; |
| 3542 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3543 | static const struct mv88e6xxx_info mv88e6xxx_table[] = { |
| 3544 | [MV88E6085] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3545 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6085, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3546 | .family = MV88E6XXX_FAMILY_6097, |
| 3547 | .name = "Marvell 88E6085", |
| 3548 | .num_databases = 4096, |
| 3549 | .num_ports = 10, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3550 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3551 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3552 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3553 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3554 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3555 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3556 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3557 | .g1_irqs = 8, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3558 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3559 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3560 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3561 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3562 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3563 | .ops = &mv88e6085_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3564 | }, |
| 3565 | |
| 3566 | [MV88E6095] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3567 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6095, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3568 | .family = MV88E6XXX_FAMILY_6095, |
| 3569 | .name = "Marvell 88E6095/88E6095F", |
| 3570 | .num_databases = 256, |
| 3571 | .num_ports = 11, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3572 | .num_internal_phys = 0, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3573 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3574 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3575 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3576 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3577 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3578 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3579 | .g1_irqs = 8, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3580 | .atu_move_port_mask = 0xf, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3581 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3582 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3583 | .ops = &mv88e6095_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3584 | }, |
| 3585 | |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 3586 | [MV88E6097] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3587 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6097, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 3588 | .family = MV88E6XXX_FAMILY_6097, |
| 3589 | .name = "Marvell 88E6097/88E6097F", |
| 3590 | .num_databases = 4096, |
| 3591 | .num_ports = 11, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3592 | .num_internal_phys = 8, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3593 | .max_vid = 4095, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 3594 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3595 | .phy_base_addr = 0x0, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 3596 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3597 | .global2_addr = 0x1c, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 3598 | .age_time_coeff = 15000, |
Stefan Eichenberger | c534178 | 2016-11-25 09:41:29 +0100 | [diff] [blame] | 3599 | .g1_irqs = 8, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3600 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3601 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3602 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3603 | .multi_chip = true, |
Stefan Eichenberger | 2bfcfcd | 2016-12-05 14:12:42 +0100 | [diff] [blame] | 3604 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Stefan Eichenberger | 7d381a0 | 2016-11-22 17:47:21 +0100 | [diff] [blame] | 3605 | .ops = &mv88e6097_ops, |
| 3606 | }, |
| 3607 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3608 | [MV88E6123] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3609 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6123, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3610 | .family = MV88E6XXX_FAMILY_6165, |
| 3611 | .name = "Marvell 88E6123", |
| 3612 | .num_databases = 4096, |
| 3613 | .num_ports = 3, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3614 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3615 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3616 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3617 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3618 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3619 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3620 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3621 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3622 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3623 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3624 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3625 | .multi_chip = true, |
Andrew Lunn | 5ebe31d | 2017-06-07 15:06:19 +0200 | [diff] [blame] | 3626 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3627 | .ops = &mv88e6123_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3628 | }, |
| 3629 | |
| 3630 | [MV88E6131] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3631 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6131, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3632 | .family = MV88E6XXX_FAMILY_6185, |
| 3633 | .name = "Marvell 88E6131", |
| 3634 | .num_databases = 256, |
| 3635 | .num_ports = 8, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3636 | .num_internal_phys = 0, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3637 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3638 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3639 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3640 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3641 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3642 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3643 | .g1_irqs = 9, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3644 | .atu_move_port_mask = 0xf, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3645 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3646 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3647 | .ops = &mv88e6131_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3648 | }, |
| 3649 | |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 3650 | [MV88E6141] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3651 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6141, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 3652 | .family = MV88E6XXX_FAMILY_6341, |
Uwe Kleine-König | 79a68b2 | 2018-03-20 10:44:40 +0100 | [diff] [blame] | 3653 | .name = "Marvell 88E6141", |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 3654 | .num_databases = 4096, |
| 3655 | .num_ports = 6, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3656 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3657 | .num_gpio = 11, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3658 | .max_vid = 4095, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 3659 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3660 | .phy_base_addr = 0x10, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 3661 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3662 | .global2_addr = 0x1c, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 3663 | .age_time_coeff = 3750, |
| 3664 | .atu_move_port_mask = 0x1f, |
Andrew Lunn | adfccf1 | 2018-03-17 20:32:03 +0100 | [diff] [blame] | 3665 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3666 | .g2_irqs = 10, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3667 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3668 | .multi_chip = true, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 3669 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | 990e27b | 2017-03-28 13:50:32 -0400 | [diff] [blame] | 3670 | .ops = &mv88e6141_ops, |
| 3671 | }, |
| 3672 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3673 | [MV88E6161] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3674 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6161, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3675 | .family = MV88E6XXX_FAMILY_6165, |
| 3676 | .name = "Marvell 88E6161", |
| 3677 | .num_databases = 4096, |
| 3678 | .num_ports = 6, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3679 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3680 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3681 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3682 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3683 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3684 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3685 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3686 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3687 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3688 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3689 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3690 | .multi_chip = true, |
Andrew Lunn | 5ebe31d | 2017-06-07 15:06:19 +0200 | [diff] [blame] | 3691 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3692 | .ops = &mv88e6161_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3693 | }, |
| 3694 | |
| 3695 | [MV88E6165] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3696 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6165, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3697 | .family = MV88E6XXX_FAMILY_6165, |
| 3698 | .name = "Marvell 88E6165", |
| 3699 | .num_databases = 4096, |
| 3700 | .num_ports = 6, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3701 | .num_internal_phys = 0, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3702 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3703 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3704 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3705 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3706 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3707 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3708 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3709 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3710 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3711 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3712 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3713 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3714 | .ops = &mv88e6165_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3715 | }, |
| 3716 | |
| 3717 | [MV88E6171] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3718 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6171, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3719 | .family = MV88E6XXX_FAMILY_6351, |
| 3720 | .name = "Marvell 88E6171", |
| 3721 | .num_databases = 4096, |
| 3722 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3723 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3724 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3725 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3726 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3727 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3728 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3729 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3730 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3731 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3732 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3733 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3734 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3735 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3736 | .ops = &mv88e6171_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3737 | }, |
| 3738 | |
| 3739 | [MV88E6172] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3740 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6172, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3741 | .family = MV88E6XXX_FAMILY_6352, |
| 3742 | .name = "Marvell 88E6172", |
| 3743 | .num_databases = 4096, |
| 3744 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3745 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3746 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3747 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3748 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3749 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3750 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3751 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3752 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3753 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3754 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3755 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3756 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3757 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3758 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3759 | .ops = &mv88e6172_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3760 | }, |
| 3761 | |
| 3762 | [MV88E6175] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3763 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6175, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3764 | .family = MV88E6XXX_FAMILY_6351, |
| 3765 | .name = "Marvell 88E6175", |
| 3766 | .num_databases = 4096, |
| 3767 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3768 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3769 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3770 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3771 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3772 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3773 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3774 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3775 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3776 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3777 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3778 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3779 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3780 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3781 | .ops = &mv88e6175_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3782 | }, |
| 3783 | |
| 3784 | [MV88E6176] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3785 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6176, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3786 | .family = MV88E6XXX_FAMILY_6352, |
| 3787 | .name = "Marvell 88E6176", |
| 3788 | .num_databases = 4096, |
| 3789 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3790 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3791 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3792 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3793 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3794 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3795 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3796 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3797 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3798 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3799 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3800 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3801 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3802 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3803 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3804 | .ops = &mv88e6176_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3805 | }, |
| 3806 | |
| 3807 | [MV88E6185] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3808 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6185, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3809 | .family = MV88E6XXX_FAMILY_6185, |
| 3810 | .name = "Marvell 88E6185", |
| 3811 | .num_databases = 256, |
| 3812 | .num_ports = 10, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3813 | .num_internal_phys = 0, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3814 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3815 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3816 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3817 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3818 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3819 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3820 | .g1_irqs = 8, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3821 | .atu_move_port_mask = 0xf, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3822 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3823 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3824 | .ops = &mv88e6185_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3825 | }, |
| 3826 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3827 | [MV88E6190] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3828 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6190, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3829 | .family = MV88E6XXX_FAMILY_6390, |
| 3830 | .name = "Marvell 88E6190", |
| 3831 | .num_databases = 4096, |
| 3832 | .num_ports = 11, /* 10 + Z80 */ |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3833 | .num_internal_phys = 11, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3834 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3835 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3836 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3837 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3838 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3839 | .global2_addr = 0x1c, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3840 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 3841 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3842 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3843 | .g2_irqs = 14, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3844 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3845 | .multi_chip = true, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3846 | .atu_move_port_mask = 0x1f, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3847 | .ops = &mv88e6190_ops, |
| 3848 | }, |
| 3849 | |
| 3850 | [MV88E6190X] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3851 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6190X, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3852 | .family = MV88E6XXX_FAMILY_6390, |
| 3853 | .name = "Marvell 88E6190X", |
| 3854 | .num_databases = 4096, |
| 3855 | .num_ports = 11, /* 10 + Z80 */ |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3856 | .num_internal_phys = 11, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3857 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3858 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3859 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3860 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3861 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3862 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 3863 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3864 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3865 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3866 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3867 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3868 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3869 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3870 | .ops = &mv88e6190x_ops, |
| 3871 | }, |
| 3872 | |
| 3873 | [MV88E6191] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3874 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3875 | .family = MV88E6XXX_FAMILY_6390, |
| 3876 | .name = "Marvell 88E6191", |
| 3877 | .num_databases = 4096, |
| 3878 | .num_ports = 11, /* 10 + Z80 */ |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3879 | .num_internal_phys = 11, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3880 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3881 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3882 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3883 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3884 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 3885 | .age_time_coeff = 3750, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3886 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3887 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3888 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3889 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3890 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3891 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 3892 | .ptp_support = true, |
Vivien Didelot | 2cf4cefb | 2017-03-28 13:50:34 -0400 | [diff] [blame] | 3893 | .ops = &mv88e6191_ops, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3894 | }, |
| 3895 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3896 | [MV88E6240] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3897 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6240, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3898 | .family = MV88E6XXX_FAMILY_6352, |
| 3899 | .name = "Marvell 88E6240", |
| 3900 | .num_databases = 4096, |
| 3901 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3902 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3903 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3904 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3905 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3906 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3907 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3908 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3909 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3910 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3911 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3912 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3913 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3914 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3915 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 3916 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3917 | .ops = &mv88e6240_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3918 | }, |
| 3919 | |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3920 | [MV88E6290] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3921 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6290, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3922 | .family = MV88E6XXX_FAMILY_6390, |
| 3923 | .name = "Marvell 88E6290", |
| 3924 | .num_databases = 4096, |
| 3925 | .num_ports = 11, /* 10 + Z80 */ |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3926 | .num_internal_phys = 11, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3927 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 3928 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3929 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3930 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3931 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3932 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 3933 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3934 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 3935 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3936 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3937 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3938 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3939 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 3940 | .ptp_support = true, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 3941 | .ops = &mv88e6290_ops, |
| 3942 | }, |
| 3943 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3944 | [MV88E6320] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3945 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6320, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3946 | .family = MV88E6XXX_FAMILY_6320, |
| 3947 | .name = "Marvell 88E6320", |
| 3948 | .num_databases = 4096, |
| 3949 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3950 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3951 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3952 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3953 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3954 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3955 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3956 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3957 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3958 | .g1_irqs = 8, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3959 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3960 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 3961 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3962 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3963 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 3964 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3965 | .ops = &mv88e6320_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3966 | }, |
| 3967 | |
| 3968 | [MV88E6321] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3969 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6321, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3970 | .family = MV88E6XXX_FAMILY_6320, |
| 3971 | .name = "Marvell 88E6321", |
| 3972 | .num_databases = 4096, |
| 3973 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3974 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3975 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3976 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 3977 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 3978 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 3979 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 3980 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 3981 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 3982 | .g1_irqs = 8, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3983 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 3984 | .atu_move_port_mask = 0xf, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 3985 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 3986 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 3987 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 3988 | .ops = &mv88e6321_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 3989 | }, |
| 3990 | |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 3991 | [MV88E6341] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 3992 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6341, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 3993 | .family = MV88E6XXX_FAMILY_6341, |
| 3994 | .name = "Marvell 88E6341", |
| 3995 | .num_databases = 4096, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 3996 | .num_internal_phys = 5, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 3997 | .num_ports = 6, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 3998 | .num_gpio = 11, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 3999 | .max_vid = 4095, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4000 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4001 | .phy_base_addr = 0x10, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4002 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4003 | .global2_addr = 0x1c, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4004 | .age_time_coeff = 3750, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4005 | .atu_move_port_mask = 0x1f, |
Andrew Lunn | adfccf1 | 2018-03-17 20:32:03 +0100 | [diff] [blame] | 4006 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4007 | .g2_irqs = 10, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4008 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4009 | .multi_chip = true, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4010 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4011 | .ptp_support = true, |
Gregory CLEMENT | a75961d | 2017-01-30 20:29:34 +0100 | [diff] [blame] | 4012 | .ops = &mv88e6341_ops, |
| 4013 | }, |
| 4014 | |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4015 | [MV88E6350] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4016 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6350, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4017 | .family = MV88E6XXX_FAMILY_6351, |
| 4018 | .name = "Marvell 88E6350", |
| 4019 | .num_databases = 4096, |
| 4020 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4021 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4022 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4023 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4024 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4025 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4026 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4027 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4028 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4029 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4030 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4031 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4032 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4033 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4034 | .ops = &mv88e6350_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4035 | }, |
| 4036 | |
| 4037 | [MV88E6351] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4038 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6351, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4039 | .family = MV88E6XXX_FAMILY_6351, |
| 4040 | .name = "Marvell 88E6351", |
| 4041 | .num_databases = 4096, |
| 4042 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4043 | .num_internal_phys = 5, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4044 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4045 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4046 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4047 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4048 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4049 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4050 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4051 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4052 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4053 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4054 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4055 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4056 | .ops = &mv88e6351_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4057 | }, |
| 4058 | |
| 4059 | [MV88E6352] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4060 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6352, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4061 | .family = MV88E6XXX_FAMILY_6352, |
| 4062 | .name = "Marvell 88E6352", |
| 4063 | .num_databases = 4096, |
| 4064 | .num_ports = 7, |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4065 | .num_internal_phys = 5, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4066 | .num_gpio = 15, |
Vivien Didelot | 3cf3c84 | 2017-05-01 14:05:10 -0400 | [diff] [blame] | 4067 | .max_vid = 4095, |
Vivien Didelot | 9dddd47 | 2016-06-20 13:14:10 -0400 | [diff] [blame] | 4068 | .port_base_addr = 0x10, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4069 | .phy_base_addr = 0x0, |
Vivien Didelot | a935c05 | 2016-09-29 12:21:53 -0400 | [diff] [blame] | 4070 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4071 | .global2_addr = 0x1c, |
Vivien Didelot | acddbd2 | 2016-07-18 20:45:39 -0400 | [diff] [blame] | 4072 | .age_time_coeff = 15000, |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4073 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4074 | .g2_irqs = 10, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4075 | .atu_move_port_mask = 0xf, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4076 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4077 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4078 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4079 | .ptp_support = true, |
Vivien Didelot | b3469dd | 2016-09-29 12:22:00 -0400 | [diff] [blame] | 4080 | .ops = &mv88e6352_ops, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4081 | }, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4082 | [MV88E6390] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4083 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6390, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4084 | .family = MV88E6XXX_FAMILY_6390, |
| 4085 | .name = "Marvell 88E6390", |
| 4086 | .num_databases = 4096, |
| 4087 | .num_ports = 11, /* 10 + Z80 */ |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4088 | .num_internal_phys = 11, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4089 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 4090 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4091 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4092 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4093 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4094 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 4095 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4096 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4097 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4098 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4099 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4100 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4101 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4102 | .ptp_support = true, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4103 | .ops = &mv88e6390_ops, |
| 4104 | }, |
| 4105 | [MV88E6390X] = { |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4106 | .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6390X, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4107 | .family = MV88E6XXX_FAMILY_6390, |
| 4108 | .name = "Marvell 88E6390X", |
| 4109 | .num_databases = 4096, |
| 4110 | .num_ports = 11, /* 10 + Z80 */ |
Andrew Lunn | bc39315 | 2018-03-17 20:32:04 +0100 | [diff] [blame] | 4111 | .num_internal_phys = 11, |
Brandon Streiff | a73ccd6 | 2018-02-14 01:07:46 +0100 | [diff] [blame] | 4112 | .num_gpio = 16, |
Vivien Didelot | 931d182 | 2017-05-01 14:05:27 -0400 | [diff] [blame] | 4113 | .max_vid = 8191, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4114 | .port_base_addr = 0x0, |
Andrew Lunn | 9255bac | 2018-05-05 20:58:22 +0200 | [diff] [blame] | 4115 | .phy_base_addr = 0x0, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4116 | .global1_addr = 0x1b, |
Vivien Didelot | 9069c13 | 2017-07-17 13:03:44 -0400 | [diff] [blame] | 4117 | .global2_addr = 0x1c, |
Andrew Lunn | b91e055 | 2017-02-02 00:46:15 +0100 | [diff] [blame] | 4118 | .age_time_coeff = 3750, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4119 | .g1_irqs = 9, |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 4120 | .g2_irqs = 14, |
Vivien Didelot | e606ca3 | 2017-03-11 16:12:55 -0500 | [diff] [blame] | 4121 | .atu_move_port_mask = 0x1f, |
Vivien Didelot | f364565 | 2017-03-30 17:37:07 -0400 | [diff] [blame] | 4122 | .pvt = true, |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4123 | .multi_chip = true, |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4124 | .tag_protocol = DSA_TAG_PROTO_DSA, |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4125 | .ptp_support = true, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4126 | .ops = &mv88e6390x_ops, |
| 4127 | }, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4128 | }; |
| 4129 | |
Vivien Didelot | 5f7c036 | 2016-06-20 13:14:04 -0400 | [diff] [blame] | 4130 | static const struct mv88e6xxx_info *mv88e6xxx_lookup_info(unsigned int prod_num) |
Vivien Didelot | b9b3771 | 2015-10-30 19:39:48 -0400 | [diff] [blame] | 4131 | { |
Vivien Didelot | a439c06 | 2016-04-17 13:23:58 -0400 | [diff] [blame] | 4132 | int i; |
Vivien Didelot | b9b3771 | 2015-10-30 19:39:48 -0400 | [diff] [blame] | 4133 | |
Vivien Didelot | 5f7c036 | 2016-06-20 13:14:04 -0400 | [diff] [blame] | 4134 | for (i = 0; i < ARRAY_SIZE(mv88e6xxx_table); ++i) |
| 4135 | if (mv88e6xxx_table[i].prod_num == prod_num) |
| 4136 | return &mv88e6xxx_table[i]; |
Vivien Didelot | b9b3771 | 2015-10-30 19:39:48 -0400 | [diff] [blame] | 4137 | |
Vivien Didelot | b9b3771 | 2015-10-30 19:39:48 -0400 | [diff] [blame] | 4138 | return NULL; |
| 4139 | } |
| 4140 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4141 | static int mv88e6xxx_detect(struct mv88e6xxx_chip *chip) |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4142 | { |
| 4143 | const struct mv88e6xxx_info *info; |
Vivien Didelot | 8f6345b | 2016-07-20 18:18:36 -0400 | [diff] [blame] | 4144 | unsigned int prod_num, rev; |
| 4145 | u16 id; |
| 4146 | int err; |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4147 | |
Vivien Didelot | 8f6345b | 2016-07-20 18:18:36 -0400 | [diff] [blame] | 4148 | mutex_lock(&chip->reg_lock); |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4149 | err = mv88e6xxx_port_read(chip, 0, MV88E6XXX_PORT_SWITCH_ID, &id); |
Vivien Didelot | 8f6345b | 2016-07-20 18:18:36 -0400 | [diff] [blame] | 4150 | mutex_unlock(&chip->reg_lock); |
| 4151 | if (err) |
| 4152 | return err; |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4153 | |
Vivien Didelot | 107fcc1 | 2017-06-12 12:37:36 -0400 | [diff] [blame] | 4154 | prod_num = id & MV88E6XXX_PORT_SWITCH_ID_PROD_MASK; |
| 4155 | rev = id & MV88E6XXX_PORT_SWITCH_ID_REV_MASK; |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4156 | |
| 4157 | info = mv88e6xxx_lookup_info(prod_num); |
| 4158 | if (!info) |
| 4159 | return -ENODEV; |
| 4160 | |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 4161 | /* Update the compatible info with the probed one */ |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4162 | chip->info = info; |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4163 | |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 4164 | err = mv88e6xxx_g2_require(chip); |
| 4165 | if (err) |
| 4166 | return err; |
| 4167 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4168 | dev_info(chip->dev, "switch 0x%x detected: %s, revision %u\n", |
| 4169 | chip->info->prod_num, chip->info->name, rev); |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4170 | |
| 4171 | return 0; |
| 4172 | } |
| 4173 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4174 | static struct mv88e6xxx_chip *mv88e6xxx_alloc_chip(struct device *dev) |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4175 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4176 | struct mv88e6xxx_chip *chip; |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4177 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4178 | chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); |
| 4179 | if (!chip) |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4180 | return NULL; |
| 4181 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4182 | chip->dev = dev; |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4183 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4184 | mutex_init(&chip->reg_lock); |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 4185 | INIT_LIST_HEAD(&chip->mdios); |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4186 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4187 | return chip; |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4188 | } |
| 4189 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4190 | static int mv88e6xxx_smi_init(struct mv88e6xxx_chip *chip, |
Vivien Didelot | 4a70c4a | 2016-06-20 13:14:07 -0400 | [diff] [blame] | 4191 | struct mii_bus *bus, int sw_addr) |
| 4192 | { |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 4193 | if (sw_addr == 0) |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4194 | chip->smi_ops = &mv88e6xxx_smi_single_chip_ops; |
Vivien Didelot | b3e05aa | 2017-07-17 13:03:46 -0400 | [diff] [blame] | 4195 | else if (chip->info->multi_chip) |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4196 | chip->smi_ops = &mv88e6xxx_smi_multi_chip_ops; |
Vivien Didelot | 914b32f | 2016-06-20 13:14:11 -0400 | [diff] [blame] | 4197 | else |
| 4198 | return -EINVAL; |
| 4199 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4200 | chip->bus = bus; |
| 4201 | chip->sw_addr = sw_addr; |
Vivien Didelot | 4a70c4a | 2016-06-20 13:14:07 -0400 | [diff] [blame] | 4202 | |
| 4203 | return 0; |
| 4204 | } |
| 4205 | |
Florian Fainelli | 5ed4e3e | 2017-11-10 15:22:52 -0800 | [diff] [blame] | 4206 | static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds, |
| 4207 | int port) |
Andrew Lunn | 7b31436 | 2016-08-22 16:01:01 +0200 | [diff] [blame] | 4208 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 4209 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 2bbb33b | 2016-08-22 16:01:02 +0200 | [diff] [blame] | 4210 | |
Andrew Lunn | 443d5a1 | 2016-12-03 04:35:18 +0100 | [diff] [blame] | 4211 | return chip->info->tag_protocol; |
Andrew Lunn | 7b31436 | 2016-08-22 16:01:01 +0200 | [diff] [blame] | 4212 | } |
| 4213 | |
Florian Fainelli | 2a93c1a | 2017-12-06 15:03:33 -0800 | [diff] [blame] | 4214 | #if IS_ENABLED(CONFIG_NET_DSA_LEGACY) |
Andrew Lunn | fcdce7d | 2016-05-10 23:27:20 +0200 | [diff] [blame] | 4215 | static const char *mv88e6xxx_drv_probe(struct device *dsa_dev, |
| 4216 | struct device *host_dev, int sw_addr, |
| 4217 | void **priv) |
Andrew Lunn | a77d43f | 2016-04-13 02:40:42 +0200 | [diff] [blame] | 4218 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4219 | struct mv88e6xxx_chip *chip; |
Vivien Didelot | a439c06 | 2016-04-17 13:23:58 -0400 | [diff] [blame] | 4220 | struct mii_bus *bus; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 4221 | int err; |
Andrew Lunn | a77d43f | 2016-04-13 02:40:42 +0200 | [diff] [blame] | 4222 | |
Vivien Didelot | a439c06 | 2016-04-17 13:23:58 -0400 | [diff] [blame] | 4223 | bus = dsa_host_dev_to_mii_bus(host_dev); |
Andrew Lunn | c156913 | 2016-04-13 02:40:45 +0200 | [diff] [blame] | 4224 | if (!bus) |
| 4225 | return NULL; |
| 4226 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4227 | chip = mv88e6xxx_alloc_chip(dsa_dev); |
| 4228 | if (!chip) |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4229 | return NULL; |
| 4230 | |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 4231 | /* Legacy SMI probing will only support chips similar to 88E6085 */ |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4232 | chip->info = &mv88e6xxx_table[MV88E6085]; |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 4233 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4234 | err = mv88e6xxx_smi_init(chip, bus, sw_addr); |
Vivien Didelot | 4a70c4a | 2016-06-20 13:14:07 -0400 | [diff] [blame] | 4235 | if (err) |
| 4236 | goto free; |
| 4237 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4238 | err = mv88e6xxx_detect(chip); |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4239 | if (err) |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4240 | goto free; |
Vivien Didelot | a439c06 | 2016-04-17 13:23:58 -0400 | [diff] [blame] | 4241 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4242 | mutex_lock(&chip->reg_lock); |
| 4243 | err = mv88e6xxx_switch_reset(chip); |
| 4244 | mutex_unlock(&chip->reg_lock); |
| 4245 | if (err) |
| 4246 | goto free; |
| 4247 | |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 4248 | mv88e6xxx_phy_init(chip); |
| 4249 | |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 4250 | err = mv88e6xxx_mdios_register(chip, NULL); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 4251 | if (err) |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4252 | goto free; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 4253 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4254 | *priv = chip; |
Vivien Didelot | a439c06 | 2016-04-17 13:23:58 -0400 | [diff] [blame] | 4255 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4256 | return chip->info->name; |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4257 | free: |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4258 | devm_kfree(dsa_dev, chip); |
Vivien Didelot | 469d729 | 2016-06-20 13:14:06 -0400 | [diff] [blame] | 4259 | |
| 4260 | return NULL; |
Andrew Lunn | a77d43f | 2016-04-13 02:40:42 +0200 | [diff] [blame] | 4261 | } |
Florian Fainelli | 2a93c1a | 2017-12-06 15:03:33 -0800 | [diff] [blame] | 4262 | #endif |
Andrew Lunn | a77d43f | 2016-04-13 02:40:42 +0200 | [diff] [blame] | 4263 | |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4264 | static int mv88e6xxx_port_mdb_prepare(struct dsa_switch *ds, int port, |
Vivien Didelot | 3709aad | 2017-11-30 11:23:58 -0500 | [diff] [blame] | 4265 | const struct switchdev_obj_port_mdb *mdb) |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4266 | { |
| 4267 | /* We don't need any dynamic resource from the kernel (yet), |
| 4268 | * so skip the prepare phase. |
| 4269 | */ |
| 4270 | |
| 4271 | return 0; |
| 4272 | } |
| 4273 | |
| 4274 | static void mv88e6xxx_port_mdb_add(struct dsa_switch *ds, int port, |
Vivien Didelot | 3709aad | 2017-11-30 11:23:58 -0500 | [diff] [blame] | 4275 | const struct switchdev_obj_port_mdb *mdb) |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4276 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 4277 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4278 | |
| 4279 | mutex_lock(&chip->reg_lock); |
| 4280 | if (mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 4281 | MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC)) |
Vivien Didelot | 774439e5 | 2017-06-08 18:34:08 -0400 | [diff] [blame] | 4282 | dev_err(ds->dev, "p%d: failed to load multicast MAC address\n", |
| 4283 | port); |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4284 | mutex_unlock(&chip->reg_lock); |
| 4285 | } |
| 4286 | |
| 4287 | static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port, |
| 4288 | const struct switchdev_obj_port_mdb *mdb) |
| 4289 | { |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 4290 | struct mv88e6xxx_chip *chip = ds->priv; |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4291 | int err; |
| 4292 | |
| 4293 | mutex_lock(&chip->reg_lock); |
| 4294 | err = mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, |
Vivien Didelot | 27c0e60 | 2017-06-15 12:14:01 -0400 | [diff] [blame] | 4295 | MV88E6XXX_G1_ATU_DATA_STATE_UNUSED); |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4296 | mutex_unlock(&chip->reg_lock); |
| 4297 | |
| 4298 | return err; |
| 4299 | } |
| 4300 | |
Florian Fainelli | a82f67a | 2017-01-08 14:52:08 -0800 | [diff] [blame] | 4301 | static const struct dsa_switch_ops mv88e6xxx_switch_ops = { |
Florian Fainelli | 2a93c1a | 2017-12-06 15:03:33 -0800 | [diff] [blame] | 4302 | #if IS_ENABLED(CONFIG_NET_DSA_LEGACY) |
Andrew Lunn | fcdce7d | 2016-05-10 23:27:20 +0200 | [diff] [blame] | 4303 | .probe = mv88e6xxx_drv_probe, |
Florian Fainelli | 2a93c1a | 2017-12-06 15:03:33 -0800 | [diff] [blame] | 4304 | #endif |
Andrew Lunn | 7b31436 | 2016-08-22 16:01:01 +0200 | [diff] [blame] | 4305 | .get_tag_protocol = mv88e6xxx_get_tag_protocol, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4306 | .setup = mv88e6xxx_setup, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4307 | .adjust_link = mv88e6xxx_adjust_link, |
Russell King | c9a2356 | 2018-05-10 13:17:35 -0700 | [diff] [blame] | 4308 | .phylink_validate = mv88e6xxx_validate, |
| 4309 | .phylink_mac_link_state = mv88e6xxx_link_state, |
| 4310 | .phylink_mac_config = mv88e6xxx_mac_config, |
| 4311 | .phylink_mac_link_down = mv88e6xxx_mac_link_down, |
| 4312 | .phylink_mac_link_up = mv88e6xxx_mac_link_up, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4313 | .get_strings = mv88e6xxx_get_strings, |
| 4314 | .get_ethtool_stats = mv88e6xxx_get_ethtool_stats, |
| 4315 | .get_sset_count = mv88e6xxx_get_sset_count, |
Andrew Lunn | 04aca99 | 2017-05-26 01:03:24 +0200 | [diff] [blame] | 4316 | .port_enable = mv88e6xxx_port_enable, |
| 4317 | .port_disable = mv88e6xxx_port_disable, |
Vivien Didelot | 08f5006 | 2017-08-01 16:32:41 -0400 | [diff] [blame] | 4318 | .get_mac_eee = mv88e6xxx_get_mac_eee, |
| 4319 | .set_mac_eee = mv88e6xxx_set_mac_eee, |
Andrew Lunn | f8cd875 | 2016-05-10 23:27:25 +0200 | [diff] [blame] | 4320 | .get_eeprom_len = mv88e6xxx_get_eeprom_len, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4321 | .get_eeprom = mv88e6xxx_get_eeprom, |
| 4322 | .set_eeprom = mv88e6xxx_set_eeprom, |
| 4323 | .get_regs_len = mv88e6xxx_get_regs_len, |
| 4324 | .get_regs = mv88e6xxx_get_regs, |
Vivien Didelot | 2cfcd96 | 2016-07-18 20:45:40 -0400 | [diff] [blame] | 4325 | .set_ageing_time = mv88e6xxx_set_ageing_time, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4326 | .port_bridge_join = mv88e6xxx_port_bridge_join, |
| 4327 | .port_bridge_leave = mv88e6xxx_port_bridge_leave, |
| 4328 | .port_stp_state_set = mv88e6xxx_port_stp_state_set, |
Vivien Didelot | 749efcb | 2016-09-22 16:49:24 -0400 | [diff] [blame] | 4329 | .port_fast_age = mv88e6xxx_port_fast_age, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4330 | .port_vlan_filtering = mv88e6xxx_port_vlan_filtering, |
| 4331 | .port_vlan_prepare = mv88e6xxx_port_vlan_prepare, |
| 4332 | .port_vlan_add = mv88e6xxx_port_vlan_add, |
| 4333 | .port_vlan_del = mv88e6xxx_port_vlan_del, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4334 | .port_fdb_add = mv88e6xxx_port_fdb_add, |
| 4335 | .port_fdb_del = mv88e6xxx_port_fdb_del, |
| 4336 | .port_fdb_dump = mv88e6xxx_port_fdb_dump, |
Vivien Didelot | 7df8fbd | 2016-08-31 11:50:05 -0400 | [diff] [blame] | 4337 | .port_mdb_prepare = mv88e6xxx_port_mdb_prepare, |
| 4338 | .port_mdb_add = mv88e6xxx_port_mdb_add, |
| 4339 | .port_mdb_del = mv88e6xxx_port_mdb_del, |
Vivien Didelot | aec5ac8 | 2017-03-30 17:37:15 -0400 | [diff] [blame] | 4340 | .crosschip_bridge_join = mv88e6xxx_crosschip_bridge_join, |
| 4341 | .crosschip_bridge_leave = mv88e6xxx_crosschip_bridge_leave, |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 4342 | .port_hwtstamp_set = mv88e6xxx_port_hwtstamp_set, |
| 4343 | .port_hwtstamp_get = mv88e6xxx_port_hwtstamp_get, |
| 4344 | .port_txtstamp = mv88e6xxx_port_txtstamp, |
| 4345 | .port_rxtstamp = mv88e6xxx_port_rxtstamp, |
| 4346 | .get_ts_info = mv88e6xxx_get_ts_info, |
Vivien Didelot | f81ec90 | 2016-05-09 13:22:58 -0400 | [diff] [blame] | 4347 | }; |
| 4348 | |
Florian Fainelli | ab3d408 | 2017-01-08 14:52:07 -0800 | [diff] [blame] | 4349 | static struct dsa_switch_driver mv88e6xxx_switch_drv = { |
| 4350 | .ops = &mv88e6xxx_switch_ops, |
| 4351 | }; |
| 4352 | |
Florian Fainelli | 55ed0ce | 2017-01-26 10:45:51 -0800 | [diff] [blame] | 4353 | static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip) |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4354 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4355 | struct device *dev = chip->dev; |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4356 | struct dsa_switch *ds; |
| 4357 | |
Vivien Didelot | 73b1204 | 2017-03-30 17:37:10 -0400 | [diff] [blame] | 4358 | ds = dsa_switch_alloc(dev, mv88e6xxx_num_ports(chip)); |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4359 | if (!ds) |
| 4360 | return -ENOMEM; |
| 4361 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4362 | ds->priv = chip; |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4363 | ds->dev = dev; |
Vivien Didelot | 9d490b4 | 2016-08-23 12:38:56 -0400 | [diff] [blame] | 4364 | ds->ops = &mv88e6xxx_switch_ops; |
Vivien Didelot | 9ff74f2 | 2017-03-15 15:53:50 -0400 | [diff] [blame] | 4365 | ds->ageing_time_min = chip->info->age_time_coeff; |
| 4366 | ds->ageing_time_max = chip->info->age_time_coeff * U8_MAX; |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4367 | |
| 4368 | dev_set_drvdata(dev, ds); |
| 4369 | |
Vivien Didelot | 23c9ee4 | 2017-05-26 18:12:51 -0400 | [diff] [blame] | 4370 | return dsa_register_switch(ds); |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4371 | } |
| 4372 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4373 | static void mv88e6xxx_unregister_switch(struct mv88e6xxx_chip *chip) |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4374 | { |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4375 | dsa_unregister_switch(chip->ds); |
Vivien Didelot | b7e66a5 | 2016-06-20 13:14:02 -0400 | [diff] [blame] | 4376 | } |
| 4377 | |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4378 | static const void *pdata_device_get_match_data(struct device *dev) |
| 4379 | { |
| 4380 | const struct of_device_id *matches = dev->driver->of_match_table; |
| 4381 | const struct dsa_mv88e6xxx_pdata *pdata = dev->platform_data; |
| 4382 | |
| 4383 | for (; matches->name[0] || matches->type[0] || matches->compatible[0]; |
| 4384 | matches++) { |
| 4385 | if (!strcmp(pdata->compatible, matches->compatible)) |
| 4386 | return matches->data; |
| 4387 | } |
| 4388 | return NULL; |
| 4389 | } |
| 4390 | |
Vivien Didelot | 57d3231 | 2016-06-20 13:13:58 -0400 | [diff] [blame] | 4391 | static int mv88e6xxx_probe(struct mdio_device *mdiodev) |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4392 | { |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4393 | struct dsa_mv88e6xxx_pdata *pdata = mdiodev->dev.platform_data; |
David S. Miller | 7ddae24 | 2018-05-20 19:04:24 -0400 | [diff] [blame] | 4394 | const struct mv88e6xxx_info *compat_info = NULL; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4395 | struct device *dev = &mdiodev->dev; |
Andrew Lunn | f8cd875 | 2016-05-10 23:27:25 +0200 | [diff] [blame] | 4396 | struct device_node *np = dev->of_node; |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4397 | struct mv88e6xxx_chip *chip; |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4398 | int port; |
Andrew Lunn | 52638f7 | 2016-05-10 23:27:22 +0200 | [diff] [blame] | 4399 | int err; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4400 | |
Andrew Lunn | 7bb8c99 | 2018-05-31 00:15:42 +0200 | [diff] [blame] | 4401 | if (!np && !pdata) |
| 4402 | return -EINVAL; |
| 4403 | |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4404 | if (np) |
| 4405 | compat_info = of_device_get_match_data(dev); |
| 4406 | |
| 4407 | if (pdata) { |
| 4408 | compat_info = pdata_device_get_match_data(dev); |
| 4409 | |
| 4410 | if (!pdata->netdev) |
| 4411 | return -EINVAL; |
| 4412 | |
| 4413 | for (port = 0; port < DSA_MAX_PORTS; port++) { |
| 4414 | if (!(pdata->enabled_ports & (1 << port))) |
| 4415 | continue; |
| 4416 | if (strcmp(pdata->cd.port_names[port], "cpu")) |
| 4417 | continue; |
| 4418 | pdata->cd.netdev[port] = &pdata->netdev->dev; |
| 4419 | break; |
| 4420 | } |
| 4421 | } |
| 4422 | |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 4423 | if (!compat_info) |
| 4424 | return -EINVAL; |
| 4425 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4426 | chip = mv88e6xxx_alloc_chip(dev); |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4427 | if (!chip) { |
| 4428 | err = -ENOMEM; |
| 4429 | goto out; |
| 4430 | } |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4431 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4432 | chip->info = compat_info; |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 4433 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4434 | err = mv88e6xxx_smi_init(chip, mdiodev->bus, mdiodev->addr); |
Vivien Didelot | 4a70c4a | 2016-06-20 13:14:07 -0400 | [diff] [blame] | 4435 | if (err) |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4436 | goto out; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4437 | |
Andrew Lunn | b4308f0 | 2016-11-21 23:26:55 +0100 | [diff] [blame] | 4438 | chip->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4439 | if (IS_ERR(chip->reset)) { |
| 4440 | err = PTR_ERR(chip->reset); |
| 4441 | goto out; |
| 4442 | } |
Andrew Lunn | b4308f0 | 2016-11-21 23:26:55 +0100 | [diff] [blame] | 4443 | |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4444 | err = mv88e6xxx_detect(chip); |
Vivien Didelot | bc46a3d | 2016-06-20 13:14:08 -0400 | [diff] [blame] | 4445 | if (err) |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4446 | goto out; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4447 | |
Vivien Didelot | e57e5e7 | 2016-08-15 17:19:00 -0400 | [diff] [blame] | 4448 | mv88e6xxx_phy_init(chip); |
| 4449 | |
Andrew Lunn | 00baabe | 2018-05-19 22:31:35 +0200 | [diff] [blame] | 4450 | if (chip->info->ops->get_eeprom) { |
| 4451 | if (np) |
| 4452 | of_property_read_u32(np, "eeprom-length", |
| 4453 | &chip->eeprom_len); |
| 4454 | else |
| 4455 | chip->eeprom_len = pdata->eeprom_len; |
| 4456 | } |
Andrew Lunn | f8cd875 | 2016-05-10 23:27:25 +0200 | [diff] [blame] | 4457 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4458 | mutex_lock(&chip->reg_lock); |
| 4459 | err = mv88e6xxx_switch_reset(chip); |
| 4460 | mutex_unlock(&chip->reg_lock); |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 4461 | if (err) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4462 | goto out; |
Andrew Lunn | b516d45 | 2016-06-04 21:17:06 +0200 | [diff] [blame] | 4463 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4464 | chip->irq = of_irq_get(np, 0); |
| 4465 | if (chip->irq == -EPROBE_DEFER) { |
| 4466 | err = chip->irq; |
| 4467 | goto out; |
Andrew Lunn | 83c0afa | 2016-06-04 21:17:07 +0200 | [diff] [blame] | 4468 | } |
| 4469 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4470 | /* 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] | 4471 | * the PHYs will link their interrupts to these interrupt |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4472 | * controllers |
| 4473 | */ |
| 4474 | mutex_lock(&chip->reg_lock); |
| 4475 | if (chip->irq > 0) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4476 | err = mv88e6xxx_g1_irq_setup(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4477 | else |
| 4478 | err = mv88e6xxx_irq_poll_setup(chip); |
| 4479 | mutex_unlock(&chip->reg_lock); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4480 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4481 | if (err) |
| 4482 | goto out; |
| 4483 | |
| 4484 | if (chip->info->g2_irqs > 0) { |
| 4485 | err = mv88e6xxx_g2_irq_setup(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4486 | if (err) |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4487 | goto out_g1_irq; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4488 | } |
| 4489 | |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4490 | err = mv88e6xxx_g1_atu_prob_irq_setup(chip); |
| 4491 | if (err) |
| 4492 | goto out_g2_irq; |
| 4493 | |
| 4494 | err = mv88e6xxx_g1_vtu_prob_irq_setup(chip); |
| 4495 | if (err) |
| 4496 | goto out_g1_atu_prob_irq; |
| 4497 | |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 4498 | err = mv88e6xxx_mdios_register(chip, np); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4499 | if (err) |
Andrew Lunn | 62eb116 | 2018-01-14 02:32:45 +0100 | [diff] [blame] | 4500 | goto out_g1_vtu_prob_irq; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4501 | |
Florian Fainelli | 55ed0ce | 2017-01-26 10:45:51 -0800 | [diff] [blame] | 4502 | err = mv88e6xxx_register_switch(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4503 | if (err) |
| 4504 | goto out_mdio; |
| 4505 | |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4506 | return 0; |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4507 | |
| 4508 | out_mdio: |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 4509 | mv88e6xxx_mdios_unregister(chip); |
Andrew Lunn | 62eb116 | 2018-01-14 02:32:45 +0100 | [diff] [blame] | 4510 | out_g1_vtu_prob_irq: |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4511 | mv88e6xxx_g1_vtu_prob_irq_free(chip); |
Andrew Lunn | 0977644 | 2018-01-14 02:32:44 +0100 | [diff] [blame] | 4512 | out_g1_atu_prob_irq: |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4513 | mv88e6xxx_g1_atu_prob_irq_free(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4514 | out_g2_irq: |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4515 | if (chip->info->g2_irqs > 0) |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4516 | mv88e6xxx_g2_irq_free(chip); |
| 4517 | out_g1_irq: |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4518 | if (chip->irq > 0) |
Andrew Lunn | 46712644 | 2016-11-20 20:14:15 +0100 | [diff] [blame] | 4519 | mv88e6xxx_g1_irq_free(chip); |
Andrew Lunn | 294d711 | 2018-02-22 22:58:32 +0100 | [diff] [blame] | 4520 | else |
| 4521 | mv88e6xxx_irq_poll_free(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4522 | out: |
Andrew Lunn | 877b7cb | 2018-05-19 22:31:34 +0200 | [diff] [blame] | 4523 | if (pdata) |
| 4524 | dev_put(pdata->netdev); |
| 4525 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4526 | return err; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4527 | } |
| 4528 | |
| 4529 | static void mv88e6xxx_remove(struct mdio_device *mdiodev) |
| 4530 | { |
| 4531 | struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); |
Vivien Didelot | 04bed14 | 2016-08-31 18:06:13 -0400 | [diff] [blame] | 4532 | struct mv88e6xxx_chip *chip = ds->priv; |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4533 | |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 4534 | if (chip->info->ptp_support) { |
| 4535 | mv88e6xxx_hwtstamp_free(chip); |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4536 | mv88e6xxx_ptp_free(chip); |
Brandon Streiff | c6fe0ad | 2018-02-14 01:07:50 +0100 | [diff] [blame] | 4537 | } |
Brandon Streiff | 2fa8d3a | 2018-02-14 01:07:45 +0100 | [diff] [blame] | 4538 | |
Andrew Lunn | 930188c | 2016-08-22 16:01:03 +0200 | [diff] [blame] | 4539 | mv88e6xxx_phy_destroy(chip); |
Vivien Didelot | fad09c7 | 2016-06-21 12:28:20 -0400 | [diff] [blame] | 4540 | mv88e6xxx_unregister_switch(chip); |
Andrew Lunn | a3c53be5 | 2017-01-24 14:53:50 +0100 | [diff] [blame] | 4541 | mv88e6xxx_mdios_unregister(chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 4542 | |
Andrew Lunn | 76f38f1 | 2018-03-17 20:21:09 +0100 | [diff] [blame] | 4543 | mv88e6xxx_g1_vtu_prob_irq_free(chip); |
| 4544 | mv88e6xxx_g1_atu_prob_irq_free(chip); |
| 4545 | |
| 4546 | if (chip->info->g2_irqs > 0) |
| 4547 | mv88e6xxx_g2_irq_free(chip); |
| 4548 | |
Andrew Lunn | 76f38f1 | 2018-03-17 20:21:09 +0100 | [diff] [blame] | 4549 | if (chip->irq > 0) |
Andrew Lunn | 46712644 | 2016-11-20 20:14:15 +0100 | [diff] [blame] | 4550 | mv88e6xxx_g1_irq_free(chip); |
Andrew Lunn | 76f38f1 | 2018-03-17 20:21:09 +0100 | [diff] [blame] | 4551 | else |
| 4552 | mv88e6xxx_irq_poll_free(chip); |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4553 | } |
| 4554 | |
| 4555 | static const struct of_device_id mv88e6xxx_of_match[] = { |
Vivien Didelot | caac854 | 2016-06-20 13:14:09 -0400 | [diff] [blame] | 4556 | { |
| 4557 | .compatible = "marvell,mv88e6085", |
| 4558 | .data = &mv88e6xxx_table[MV88E6085], |
| 4559 | }, |
Andrew Lunn | 1a3b39e | 2016-11-21 23:26:57 +0100 | [diff] [blame] | 4560 | { |
| 4561 | .compatible = "marvell,mv88e6190", |
| 4562 | .data = &mv88e6xxx_table[MV88E6190], |
| 4563 | }, |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4564 | { /* sentinel */ }, |
| 4565 | }; |
| 4566 | |
| 4567 | MODULE_DEVICE_TABLE(of, mv88e6xxx_of_match); |
| 4568 | |
| 4569 | static struct mdio_driver mv88e6xxx_driver = { |
| 4570 | .probe = mv88e6xxx_probe, |
| 4571 | .remove = mv88e6xxx_remove, |
| 4572 | .mdiodrv.driver = { |
| 4573 | .name = "mv88e6085", |
| 4574 | .of_match_table = mv88e6xxx_of_match, |
| 4575 | }, |
| 4576 | }; |
| 4577 | |
Ben Hutchings | 98e6730 | 2011-11-25 14:36:19 +0000 | [diff] [blame] | 4578 | static int __init mv88e6xxx_init(void) |
| 4579 | { |
Florian Fainelli | ab3d408 | 2017-01-08 14:52:07 -0800 | [diff] [blame] | 4580 | register_switch_driver(&mv88e6xxx_switch_drv); |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4581 | return mdio_driver_register(&mv88e6xxx_driver); |
Ben Hutchings | 98e6730 | 2011-11-25 14:36:19 +0000 | [diff] [blame] | 4582 | } |
| 4583 | module_init(mv88e6xxx_init); |
| 4584 | |
| 4585 | static void __exit mv88e6xxx_cleanup(void) |
| 4586 | { |
Andrew Lunn | 14c7b3c | 2016-05-10 23:27:21 +0200 | [diff] [blame] | 4587 | mdio_driver_unregister(&mv88e6xxx_driver); |
Florian Fainelli | ab3d408 | 2017-01-08 14:52:07 -0800 | [diff] [blame] | 4588 | unregister_switch_driver(&mv88e6xxx_switch_drv); |
Ben Hutchings | 98e6730 | 2011-11-25 14:36:19 +0000 | [diff] [blame] | 4589 | } |
| 4590 | module_exit(mv88e6xxx_cleanup); |
Ben Hutchings | 3d825ed | 2011-11-25 14:37:16 +0000 | [diff] [blame] | 4591 | |
| 4592 | MODULE_AUTHOR("Lennert Buytenhek <buytenh@wantstofly.org>"); |
| 4593 | MODULE_DESCRIPTION("Driver for Marvell 88E6XXX ethernet switch chips"); |
| 4594 | MODULE_LICENSE("GPL"); |