Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 1 | /* |
Vivien Didelot | 1d90016 | 2017-06-19 10:55:45 -0400 | [diff] [blame] | 2 | * Marvell 88E6xxx Switch Global 2 Registers support |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 3 | * |
| 4 | * Copyright (c) 2008 Marvell Semiconductor |
| 5 | * |
Vivien Didelot | 4333d61 | 2017-03-28 15:10:36 -0400 | [diff] [blame] | 6 | * Copyright (c) 2016-2017 Savoir-faire Linux Inc. |
| 7 | * Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | */ |
| 14 | |
| 15 | #ifndef _MV88E6XXX_GLOBAL2_H |
| 16 | #define _MV88E6XXX_GLOBAL2_H |
| 17 | |
Vivien Didelot | 4d5f2ba7 | 2017-06-02 17:06:15 -0400 | [diff] [blame] | 18 | #include "chip.h" |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 19 | |
Vivien Didelot | 1d90016 | 2017-06-19 10:55:45 -0400 | [diff] [blame] | 20 | #define MV88E6XXX_G2 0x1c |
Vivien Didelot | d23a83f | 2017-06-02 17:06:19 -0400 | [diff] [blame] | 21 | |
Vivien Didelot | 1d90016 | 2017-06-19 10:55:45 -0400 | [diff] [blame] | 22 | /* Offset 0x00: Interrupt Source Register */ |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 23 | #define MV88E6XXX_G2_INT_SRC 0x00 |
| 24 | #define MV88E6XXX_G2_INT_SRC_WDOG 0x8000 |
| 25 | #define MV88E6XXX_G2_INT_SRC_JAM_LIMIT 0x4000 |
| 26 | #define MV88E6XXX_G2_INT_SRC_DUPLEX_MISMATCH 0x2000 |
| 27 | #define MV88E6XXX_G2_INT_SRC_WAKE_EVENT 0x1000 |
| 28 | #define MV88E6352_G2_INT_SRC_SERDES 0x0800 |
| 29 | #define MV88E6352_G2_INT_SRC_PHY 0x001f |
| 30 | #define MV88E6390_G2_INT_SRC_PHY 0x07fe |
| 31 | |
Vivien Didelot | 1d90016 | 2017-06-19 10:55:45 -0400 | [diff] [blame] | 32 | #define MV88E6XXX_G2_INT_SOURCE_WATCHDOG 15 |
| 33 | |
| 34 | /* Offset 0x01: Interrupt Mask Register */ |
Vivien Didelot | d6c5e6a | 2017-07-17 13:03:40 -0400 | [diff] [blame] | 35 | #define MV88E6XXX_G2_INT_MASK 0x01 |
| 36 | #define MV88E6XXX_G2_INT_MASK_WDOG 0x8000 |
| 37 | #define MV88E6XXX_G2_INT_MASK_JAM_LIMIT 0x4000 |
| 38 | #define MV88E6XXX_G2_INT_MASK_DUPLEX_MISMATCH 0x2000 |
| 39 | #define MV88E6XXX_G2_INT_MASK_WAKE_EVENT 0x1000 |
| 40 | #define MV88E6352_G2_INT_MASK_SERDES 0x0800 |
| 41 | #define MV88E6352_G2_INT_MASK_PHY 0x001f |
| 42 | #define MV88E6390_G2_INT_MASK_PHY 0x07fe |
Vivien Didelot | 6bff47b | 2017-06-19 10:55:40 -0400 | [diff] [blame] | 43 | |
| 44 | /* Offset 0x02: MGMT Enable Register 2x */ |
| 45 | #define MV88E6XXX_G2_MGMT_EN_2X 0x02 |
| 46 | |
| 47 | /* Offset 0x03: MGMT Enable Register 0x */ |
| 48 | #define MV88E6XXX_G2_MGMT_EN_0X 0x03 |
| 49 | |
Vivien Didelot | 1d90016 | 2017-06-19 10:55:45 -0400 | [diff] [blame] | 50 | /* Offset 0x04: Flow Control Delay Register */ |
| 51 | #define MV88E6XXX_G2_FLOW_CTL 0x04 |
Vivien Didelot | 6bff47b | 2017-06-19 10:55:40 -0400 | [diff] [blame] | 52 | |
| 53 | /* Offset 0x05: Switch Management Register */ |
| 54 | #define MV88E6XXX_G2_SWITCH_MGMT 0x05 |
| 55 | #define MV88E6XXX_G2_SWITCH_MGMT_USE_DOUBLE_TAG_DATA 0x8000 |
| 56 | #define MV88E6XXX_G2_SWITCH_MGMT_PREVENT_LOOPS 0x4000 |
| 57 | #define MV88E6XXX_G2_SWITCH_MGMT_FLOW_CTL_MSG 0x2000 |
| 58 | #define MV88E6XXX_G2_SWITCH_MGMT_FORCE_FLOW_CTL_PRI 0x0080 |
| 59 | #define MV88E6XXX_G2_SWITCH_MGMT_RSVD2CPU 0x0008 |
Vivien Didelot | 067e474 | 2017-06-19 10:55:39 -0400 | [diff] [blame] | 60 | |
| 61 | /* Offset 0x06: Device Mapping Table Register */ |
| 62 | #define MV88E6XXX_G2_DEVICE_MAPPING 0x06 |
| 63 | #define MV88E6XXX_G2_DEVICE_MAPPING_UPDATE 0x8000 |
| 64 | #define MV88E6XXX_G2_DEVICE_MAPPING_DEV_MASK 0x1f00 |
| 65 | #define MV88E6XXX_G2_DEVICE_MAPPING_PORT_MASK 0x000f |
Vivien Didelot | 56dc734 | 2017-06-19 10:55:38 -0400 | [diff] [blame] | 66 | |
| 67 | /* Offset 0x07: Trunk Mask Table Register */ |
| 68 | #define MV88E6XXX_G2_TRUNK_MASK 0x07 |
| 69 | #define MV88E6XXX_G2_TRUNK_MASK_UPDATE 0x8000 |
| 70 | #define MV88E6XXX_G2_TRUNK_MASK_NUM_MASK 0x7000 |
| 71 | #define MV88E6XXX_G2_TRUNK_MASK_HASH 0x0800 |
| 72 | |
| 73 | /* Offset 0x08: Trunk Mapping Table Register */ |
| 74 | #define MV88E6XXX_G2_TRUNK_MAPPING 0x08 |
| 75 | #define MV88E6XXX_G2_TRUNK_MAPPING_UPDATE 0x8000 |
| 76 | #define MV88E6XXX_G2_TRUNK_MAPPING_ID_MASK 0x7800 |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 77 | |
| 78 | /* Offset 0x09: Ingress Rate Command Register */ |
| 79 | #define MV88E6XXX_G2_IRL_CMD 0x09 |
| 80 | #define MV88E6XXX_G2_IRL_CMD_BUSY 0x8000 |
| 81 | #define MV88E6352_G2_IRL_CMD_OP_MASK 0x7000 |
| 82 | #define MV88E6352_G2_IRL_CMD_OP_NOOP 0x0000 |
| 83 | #define MV88E6352_G2_IRL_CMD_OP_INIT_ALL 0x1000 |
| 84 | #define MV88E6352_G2_IRL_CMD_OP_INIT_RES 0x2000 |
| 85 | #define MV88E6352_G2_IRL_CMD_OP_WRITE_REG 0x3000 |
| 86 | #define MV88E6352_G2_IRL_CMD_OP_READ_REG 0x4000 |
| 87 | #define MV88E6390_G2_IRL_CMD_OP_MASK 0x6000 |
| 88 | #define MV88E6390_G2_IRL_CMD_OP_READ_REG 0x0000 |
| 89 | #define MV88E6390_G2_IRL_CMD_OP_INIT_ALL 0x2000 |
| 90 | #define MV88E6390_G2_IRL_CMD_OP_INIT_RES 0x4000 |
| 91 | #define MV88E6390_G2_IRL_CMD_OP_WRITE_REG 0x6000 |
| 92 | #define MV88E6352_G2_IRL_CMD_PORT_MASK 0x0f00 |
| 93 | #define MV88E6390_G2_IRL_CMD_PORT_MASK 0x1f00 |
| 94 | #define MV88E6XXX_G2_IRL_CMD_RES_MASK 0x00e0 |
| 95 | #define MV88E6XXX_G2_IRL_CMD_REG_MASK 0x000f |
| 96 | |
| 97 | /* Offset 0x0A: Ingress Rate Data Register */ |
| 98 | #define MV88E6XXX_G2_IRL_DATA 0x0a |
| 99 | #define MV88E6XXX_G2_IRL_DATA_MASK 0xffff |
| 100 | |
Vivien Didelot | 67d1ea8 | 2017-06-19 10:55:41 -0400 | [diff] [blame] | 101 | /* Offset 0x0B: Cross-chip Port VLAN Register */ |
| 102 | #define MV88E6XXX_G2_PVT_ADDR 0x0b |
| 103 | #define MV88E6XXX_G2_PVT_ADDR_BUSY 0x8000 |
| 104 | #define MV88E6XXX_G2_PVT_ADDR_OP_MASK 0x7000 |
| 105 | #define MV88E6XXX_G2_PVT_ADDR_OP_INIT_ONES 0x1000 |
| 106 | #define MV88E6XXX_G2_PVT_ADDR_OP_WRITE_PVLAN 0x3000 |
| 107 | #define MV88E6XXX_G2_PVT_ADDR_OP_READ 0x4000 |
| 108 | #define MV88E6XXX_G2_PVT_ADDR_PTR_MASK 0x01ff |
| 109 | |
| 110 | /* Offset 0x0C: Cross-chip Port VLAN Data Register */ |
| 111 | #define MV88E6XXX_G2_PVT_DATA 0x0c |
| 112 | #define MV88E6XXX_G2_PVT_DATA_MASK 0x7f |
| 113 | |
Vivien Didelot | ed44152 | 2017-06-19 10:55:43 -0400 | [diff] [blame] | 114 | /* Offset 0x0D: Switch MAC/WoL/WoF Register */ |
| 115 | #define MV88E6XXX_G2_SWITCH_MAC 0x0d |
| 116 | #define MV88E6XXX_G2_SWITCH_MAC_UPDATE 0x8000 |
| 117 | #define MV88E6XXX_G2_SWITCH_MAC_PTR_MASK 0x1f00 |
| 118 | #define MV88E6XXX_G2_SWITCH_MAC_DATA_MASK 0x00ff |
| 119 | |
Vivien Didelot | 1d90016 | 2017-06-19 10:55:45 -0400 | [diff] [blame] | 120 | /* Offset 0x0E: ATU Stats Register */ |
| 121 | #define MV88E6XXX_G2_ATU_STATS 0x0e |
| 122 | |
| 123 | /* Offset 0x0F: Priority Override Table */ |
| 124 | #define MV88E6XXX_G2_PRIO_OVERRIDE 0x0f |
| 125 | #define MV88E6XXX_G2_PRIO_OVERRIDE_UPDATE 0x8000 |
| 126 | #define MV88E6XXX_G2_PRIO_OVERRIDE_FPRISET 0x1000 |
| 127 | #define MV88E6XXX_G2_PRIO_OVERRIDE_PTR_MASK 0x0f00 |
| 128 | #define MV88E6352_G2_PRIO_OVERRIDE_QPRIAVBEN 0x0080 |
| 129 | #define MV88E6352_G2_PRIO_OVERRIDE_DATAAVB_MASK 0x0030 |
| 130 | #define MV88E6XXX_G2_PRIO_OVERRIDE_QFPRIEN 0x0008 |
| 131 | #define MV88E6XXX_G2_PRIO_OVERRIDE_DATA_MASK 0x0007 |
Vivien Didelot | 7fc8c9d | 2017-06-19 10:55:42 -0400 | [diff] [blame] | 132 | |
| 133 | /* Offset 0x14: EEPROM Command */ |
| 134 | #define MV88E6XXX_G2_EEPROM_CMD 0x14 |
| 135 | #define MV88E6XXX_G2_EEPROM_CMD_BUSY 0x8000 |
| 136 | #define MV88E6XXX_G2_EEPROM_CMD_OP_MASK 0x7000 |
| 137 | #define MV88E6XXX_G2_EEPROM_CMD_OP_WRITE 0x3000 |
| 138 | #define MV88E6XXX_G2_EEPROM_CMD_OP_READ 0x4000 |
| 139 | #define MV88E6XXX_G2_EEPROM_CMD_OP_LOAD 0x6000 |
| 140 | #define MV88E6XXX_G2_EEPROM_CMD_RUNNING 0x0800 |
| 141 | #define MV88E6XXX_G2_EEPROM_CMD_WRITE_EN 0x0400 |
| 142 | #define MV88E6352_G2_EEPROM_CMD_ADDR_MASK 0x00ff |
| 143 | #define MV88E6390_G2_EEPROM_CMD_DATA_MASK 0x00ff |
| 144 | |
| 145 | /* Offset 0x15: EEPROM Data */ |
| 146 | #define MV88E6352_G2_EEPROM_DATA 0x15 |
| 147 | #define MV88E6352_G2_EEPROM_DATA_MASK 0xffff |
| 148 | |
| 149 | /* Offset 0x15: EEPROM Addr */ |
| 150 | #define MV88E6390_G2_EEPROM_ADDR 0x15 |
| 151 | #define MV88E6390_G2_EEPROM_ADDR_MASK 0xffff |
| 152 | |
Vivien Didelot | 1d90016 | 2017-06-19 10:55:45 -0400 | [diff] [blame] | 153 | /* Offset 0x16: AVB Command Register */ |
| 154 | #define MV88E6352_G2_AVB_CMD 0x16 |
| 155 | |
| 156 | /* Offset 0x17: AVB Data Register */ |
| 157 | #define MV88E6352_G2_AVB_DATA 0x17 |
Vivien Didelot | d23a83f | 2017-06-02 17:06:19 -0400 | [diff] [blame] | 158 | |
Vivien Didelot | e289ef0 | 2017-06-19 10:55:37 -0400 | [diff] [blame] | 159 | /* Offset 0x18: SMI PHY Command Register */ |
| 160 | #define MV88E6XXX_G2_SMI_PHY_CMD 0x18 |
| 161 | #define MV88E6XXX_G2_SMI_PHY_CMD_BUSY 0x8000 |
| 162 | #define MV88E6390_G2_SMI_PHY_CMD_FUNC_MASK 0x6000 |
| 163 | #define MV88E6390_G2_SMI_PHY_CMD_FUNC_INTERNAL 0x0000 |
| 164 | #define MV88E6390_G2_SMI_PHY_CMD_FUNC_EXTERNAL 0x2000 |
| 165 | #define MV88E6390_G2_SMI_PHY_CMD_FUNC_SETUP 0x4000 |
| 166 | #define MV88E6XXX_G2_SMI_PHY_CMD_MODE_MASK 0x1000 |
| 167 | #define MV88E6XXX_G2_SMI_PHY_CMD_MODE_45 0x0000 |
| 168 | #define MV88E6XXX_G2_SMI_PHY_CMD_MODE_22 0x1000 |
| 169 | #define MV88E6XXX_G2_SMI_PHY_CMD_OP_MASK 0x0c00 |
| 170 | #define MV88E6XXX_G2_SMI_PHY_CMD_OP_22_WRITE_DATA 0x0400 |
| 171 | #define MV88E6XXX_G2_SMI_PHY_CMD_OP_22_READ_DATA 0x0800 |
| 172 | #define MV88E6XXX_G2_SMI_PHY_CMD_OP_45_WRITE_ADDR 0x0000 |
| 173 | #define MV88E6XXX_G2_SMI_PHY_CMD_OP_45_WRITE_DATA 0x0400 |
| 174 | #define MV88E6XXX_G2_SMI_PHY_CMD_OP_45_READ_DATA_INC 0x0800 |
| 175 | #define MV88E6XXX_G2_SMI_PHY_CMD_OP_45_READ_DATA 0x0c00 |
| 176 | #define MV88E6XXX_G2_SMI_PHY_CMD_DEV_ADDR_MASK 0x03e0 |
| 177 | #define MV88E6XXX_G2_SMI_PHY_CMD_REG_ADDR_MASK 0x001f |
| 178 | #define MV88E6XXX_G2_SMI_PHY_CMD_SETUP_PTR_MASK 0x03ff |
| 179 | |
| 180 | /* Offset 0x19: SMI PHY Data Register */ |
| 181 | #define MV88E6XXX_G2_SMI_PHY_DATA 0x19 |
| 182 | |
Vivien Didelot | 1d90016 | 2017-06-19 10:55:45 -0400 | [diff] [blame] | 183 | /* Offset 0x1A: Scratch and Misc. Register */ |
| 184 | #define MV88E6XXX_G2_SCRATCH_MISC_MISC 0x1a |
| 185 | #define MV88E6XXX_G2_SCRATCH_MISC_UPDATE 0x8000 |
| 186 | #define MV88E6XXX_G2_SCRATCH_MISC_PTR_MASK 0x7f00 |
| 187 | #define MV88E6XXX_G2_SCRATCH_MISC_DATA_MASK 0x00ff |
Vivien Didelot | 3b19df7 | 2017-06-19 10:55:44 -0400 | [diff] [blame] | 188 | |
| 189 | /* Offset 0x1B: Watch Dog Control Register */ |
| 190 | #define MV88E6352_G2_WDOG_CTL 0x1b |
| 191 | #define MV88E6352_G2_WDOG_CTL_EGRESS_EVENT 0x0080 |
| 192 | #define MV88E6352_G2_WDOG_CTL_RMU_TIMEOUT 0x0040 |
| 193 | #define MV88E6352_G2_WDOG_CTL_QC_ENABLE 0x0020 |
| 194 | #define MV88E6352_G2_WDOG_CTL_EGRESS_HISTORY 0x0010 |
| 195 | #define MV88E6352_G2_WDOG_CTL_EGRESS_ENABLE 0x0008 |
| 196 | #define MV88E6352_G2_WDOG_CTL_FORCE_IRQ 0x0004 |
| 197 | #define MV88E6352_G2_WDOG_CTL_HISTORY 0x0002 |
| 198 | #define MV88E6352_G2_WDOG_CTL_SWRESET 0x0001 |
| 199 | |
| 200 | /* Offset 0x1B: Watch Dog Control Register */ |
| 201 | #define MV88E6390_G2_WDOG_CTL 0x1b |
| 202 | #define MV88E6390_G2_WDOG_CTL_UPDATE 0x8000 |
| 203 | #define MV88E6390_G2_WDOG_CTL_PTR_MASK 0x7f00 |
| 204 | #define MV88E6390_G2_WDOG_CTL_PTR_INT_SOURCE 0x0000 |
| 205 | #define MV88E6390_G2_WDOG_CTL_PTR_INT_STS 0x1000 |
| 206 | #define MV88E6390_G2_WDOG_CTL_PTR_INT_ENABLE 0x1100 |
| 207 | #define MV88E6390_G2_WDOG_CTL_PTR_EVENT 0x1200 |
| 208 | #define MV88E6390_G2_WDOG_CTL_PTR_HISTORY 0x1300 |
| 209 | #define MV88E6390_G2_WDOG_CTL_DATA_MASK 0x00ff |
| 210 | #define MV88E6390_G2_WDOG_CTL_CUT_THROUGH 0x0008 |
| 211 | #define MV88E6390_G2_WDOG_CTL_QUEUE_CONTROLLER 0x0004 |
| 212 | #define MV88E6390_G2_WDOG_CTL_EGRESS 0x0002 |
| 213 | #define MV88E6390_G2_WDOG_CTL_FORCE_IRQ 0x0001 |
| 214 | |
Vivien Didelot | 1d90016 | 2017-06-19 10:55:45 -0400 | [diff] [blame] | 215 | /* Offset 0x1C: QoS Weights Register */ |
| 216 | #define MV88E6XXX_G2_QOS_WEIGHTS 0x1c |
| 217 | #define MV88E6XXX_G2_QOS_WEIGHTS_UPDATE 0x8000 |
| 218 | #define MV88E6352_G2_QOS_WEIGHTS_PTR_MASK 0x3f00 |
| 219 | #define MV88E6390_G2_QOS_WEIGHTS_PTR_MASK 0x7f00 |
| 220 | #define MV88E6XXX_G2_QOS_WEIGHTS_DATA_MASK 0x00ff |
| 221 | |
| 222 | /* Offset 0x1D: Misc Register */ |
| 223 | #define MV88E6XXX_G2_MISC 0x1d |
| 224 | #define MV88E6XXX_G2_MISC_5_BIT_PORT 0x4000 |
| 225 | #define MV88E6352_G2_NOEGR_POLICY 0x2000 |
| 226 | #define MV88E6390_G2_LAG_ID_4 0x2000 |
Vivien Didelot | d23a83f | 2017-06-02 17:06:19 -0400 | [diff] [blame] | 227 | |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 228 | #ifdef CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 |
| 229 | |
| 230 | static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip) |
| 231 | { |
| 232 | return 0; |
| 233 | } |
| 234 | |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 235 | int mv88e6352_g2_irl_init_all(struct mv88e6xxx_chip *chip, int port); |
| 236 | int mv88e6390_g2_irl_init_all(struct mv88e6xxx_chip *chip, int port); |
| 237 | |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 238 | int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip, |
| 239 | struct mii_bus *bus, |
| 240 | int addr, int reg, u16 *val); |
| 241 | int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip, |
| 242 | struct mii_bus *bus, |
| 243 | int addr, int reg, u16 val); |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 244 | int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr); |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 245 | |
| 246 | int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip, |
| 247 | struct ethtool_eeprom *eeprom, u8 *data); |
| 248 | int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip, |
| 249 | struct ethtool_eeprom *eeprom, u8 *data); |
| 250 | |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 251 | int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip, |
| 252 | struct ethtool_eeprom *eeprom, u8 *data); |
| 253 | int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip, |
| 254 | struct ethtool_eeprom *eeprom, u8 *data); |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 255 | |
Vivien Didelot | 17a1594 | 2017-03-30 17:37:09 -0400 | [diff] [blame] | 256 | int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip *chip, int src_dev, |
| 257 | int src_port, u16 data); |
Vivien Didelot | 8122899 | 2017-03-30 17:37:08 -0400 | [diff] [blame] | 258 | int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip *chip); |
| 259 | |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 260 | int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 261 | int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip); |
| 262 | void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip); |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 263 | |
| 264 | int mv88e6185_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip); |
| 265 | int mv88e6352_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip); |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 266 | |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame^] | 267 | int mv88e6xxx_g2_pot_clear(struct mv88e6xxx_chip *chip); |
| 268 | |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 269 | extern const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops; |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 270 | extern const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops; |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 271 | |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 272 | #else /* !CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */ |
| 273 | |
| 274 | static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip) |
| 275 | { |
| 276 | if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_GLOBAL2)) { |
| 277 | dev_err(chip->dev, "this chip requires CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 enabled\n"); |
| 278 | return -EOPNOTSUPP; |
| 279 | } |
| 280 | |
| 281 | return 0; |
| 282 | } |
| 283 | |
Vivien Didelot | cd8da8b | 2017-06-19 10:55:36 -0400 | [diff] [blame] | 284 | static inline int mv88e6352_g2_irl_init_all(struct mv88e6xxx_chip *chip, |
| 285 | int port) |
| 286 | { |
| 287 | return -EOPNOTSUPP; |
| 288 | } |
| 289 | |
| 290 | static inline int mv88e6390_g2_irl_init_all(struct mv88e6xxx_chip *chip, |
| 291 | int port) |
| 292 | { |
| 293 | return -EOPNOTSUPP; |
| 294 | } |
| 295 | |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 296 | static inline int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip, |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 297 | struct mii_bus *bus, |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 298 | int addr, int reg, u16 *val) |
| 299 | { |
| 300 | return -EOPNOTSUPP; |
| 301 | } |
| 302 | |
| 303 | static inline int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip, |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 304 | struct mii_bus *bus, |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 305 | int addr, int reg, u16 val) |
| 306 | { |
| 307 | return -EOPNOTSUPP; |
| 308 | } |
| 309 | |
| 310 | static inline int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, |
| 311 | u8 *addr) |
| 312 | { |
| 313 | return -EOPNOTSUPP; |
| 314 | } |
| 315 | |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 316 | static inline int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip, |
| 317 | struct ethtool_eeprom *eeprom, |
| 318 | u8 *data) |
| 319 | { |
| 320 | return -EOPNOTSUPP; |
| 321 | } |
| 322 | |
| 323 | static inline int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip, |
| 324 | struct ethtool_eeprom *eeprom, |
| 325 | u8 *data) |
| 326 | { |
| 327 | return -EOPNOTSUPP; |
| 328 | } |
| 329 | |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 330 | static inline int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip, |
| 331 | struct ethtool_eeprom *eeprom, |
| 332 | u8 *data) |
| 333 | { |
| 334 | return -EOPNOTSUPP; |
| 335 | } |
| 336 | |
| 337 | static inline int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip, |
| 338 | struct ethtool_eeprom *eeprom, |
| 339 | u8 *data) |
| 340 | { |
| 341 | return -EOPNOTSUPP; |
| 342 | } |
| 343 | |
Arnd Bergmann | 59b2c31 | 2017-05-29 14:56:01 +0200 | [diff] [blame] | 344 | static inline int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip *chip, |
| 345 | int src_dev, int src_port, u16 data) |
Vivien Didelot | 17a1594 | 2017-03-30 17:37:09 -0400 | [diff] [blame] | 346 | { |
| 347 | return -EOPNOTSUPP; |
| 348 | } |
| 349 | |
Arnd Bergmann | 59b2c31 | 2017-05-29 14:56:01 +0200 | [diff] [blame] | 350 | static inline int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip *chip) |
Vivien Didelot | 8122899 | 2017-03-30 17:37:08 -0400 | [diff] [blame] | 351 | { |
| 352 | return -EOPNOTSUPP; |
| 353 | } |
| 354 | |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 355 | static inline int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip) |
| 356 | { |
| 357 | return -EOPNOTSUPP; |
| 358 | } |
| 359 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 360 | static inline int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip) |
| 361 | { |
| 362 | return -EOPNOTSUPP; |
| 363 | } |
| 364 | |
| 365 | static inline void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip) |
| 366 | { |
| 367 | } |
| 368 | |
Vivien Didelot | 51c901a | 2017-07-17 13:03:41 -0400 | [diff] [blame] | 369 | static inline int mv88e6185_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip) |
| 370 | { |
| 371 | return -EOPNOTSUPP; |
| 372 | } |
| 373 | |
| 374 | static inline int mv88e6352_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip) |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 375 | { |
| 376 | return -EOPNOTSUPP; |
| 377 | } |
| 378 | |
Vivien Didelot | 9e907d7 | 2017-07-17 13:03:43 -0400 | [diff] [blame^] | 379 | static inline int mv88e6xxx_g2_pot_clear(struct mv88e6xxx_chip *chip) |
| 380 | { |
| 381 | return -EOPNOTSUPP; |
| 382 | } |
| 383 | |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 384 | static const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops = {}; |
Andrew Lunn | 6130373 | 2017-02-09 00:03:43 +0100 | [diff] [blame] | 385 | static const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops = {}; |
Andrew Lunn | fcd2516 | 2017-02-09 00:03:42 +0100 | [diff] [blame] | 386 | |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 387 | #endif /* CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */ |
| 388 | |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 389 | #endif /* _MV88E6XXX_GLOBAL2_H */ |