Alex Marginean | 4ea74fd | 2021-01-25 14:23:55 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause |
| 2 | /* |
| 3 | * Felix (VSC9959) Ethernet switch driver |
Vladimir Oltean | 5041e42 | 2021-09-17 14:27:13 +0300 | [diff] [blame] | 4 | * Copyright 2018-2021 NXP |
Alex Marginean | 4ea74fd | 2021-01-25 14:23:55 +0200 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | /* |
| 8 | * This driver is used for the Ethernet switch integrated into NXP LS1028A. |
| 9 | * Felix switch is derived from Microsemi Ocelot but there are several NXP |
| 10 | * adaptations that makes the two U-Boot drivers largely incompatible. |
| 11 | * |
| 12 | * Felix on LS1028A has 4 front panel ports and two internal ports, connected |
| 13 | * to ENETC interfaces. We're using one of the ENETC interfaces to push traffic |
| 14 | * into the switch. Injection/extraction headers are used to identify |
| 15 | * egress/ingress ports in the switch for Tx/Rx. |
| 16 | */ |
| 17 | |
| 18 | #include <dm/device_compat.h> |
| 19 | #include <linux/delay.h> |
| 20 | #include <net/dsa.h> |
| 21 | #include <asm/io.h> |
| 22 | #include <miiphy.h> |
| 23 | #include <pci.h> |
| 24 | |
| 25 | /* defines especially around PCS are reused from enetc */ |
| 26 | #include "../fsl_enetc.h" |
| 27 | |
| 28 | #define PCI_DEVICE_ID_FELIX_ETHSW 0xEEF0 |
| 29 | |
| 30 | /* Felix has in fact 6 ports, but we don't use the last internal one */ |
| 31 | #define FELIX_PORT_COUNT 5 |
| 32 | /* Front panel port mask */ |
| 33 | #define FELIX_FP_PORT_MASK 0xf |
| 34 | |
| 35 | /* Register map for BAR4 */ |
| 36 | #define FELIX_SYS 0x010000 |
| 37 | #define FELIX_ES0 0x040000 |
| 38 | #define FELIX_IS1 0x050000 |
| 39 | #define FELIX_IS2 0x060000 |
| 40 | #define FELIX_GMII(port) (0x100000 + (port) * 0x10000) |
| 41 | #define FELIX_QSYS 0x200000 |
| 42 | |
| 43 | #define FELIX_SYS_SYSTEM (FELIX_SYS + 0x00000E00) |
| 44 | #define FELIX_SYS_SYSTEM_EN BIT(0) |
| 45 | #define FELIX_SYS_RAM_CTRL (FELIX_SYS + 0x00000F24) |
| 46 | #define FELIX_SYS_RAM_CTRL_INIT BIT(1) |
| 47 | #define FELIX_SYS_SYSTEM_PORT_MODE(a) (FELIX_SYS_SYSTEM + 0xC + (a) * 4) |
| 48 | #define FELIX_SYS_SYSTEM_PORT_MODE_CPU 0x0000001e |
| 49 | |
| 50 | #define FELIX_ES0_TCAM_CTRL (FELIX_ES0 + 0x000003C0) |
| 51 | #define FELIX_ES0_TCAM_CTRL_EN BIT(0) |
| 52 | #define FELIX_IS1_TCAM_CTRL (FELIX_IS1 + 0x000003C0) |
| 53 | #define FELIX_IS1_TCAM_CTRL_EN BIT(0) |
| 54 | #define FELIX_IS2_TCAM_CTRL (FELIX_IS2 + 0x000003C0) |
| 55 | #define FELIX_IS2_TCAM_CTRL_EN BIT(0) |
| 56 | |
| 57 | #define FELIX_GMII_CLOCK_CFG(port) (FELIX_GMII(port) + 0x00000000) |
| 58 | #define FELIX_GMII_CLOCK_CFG_LINK_1G 1 |
| 59 | #define FELIX_GMII_CLOCK_CFG_LINK_100M 2 |
| 60 | #define FELIX_GMII_CLOCK_CFG_LINK_10M 3 |
| 61 | #define FELIX_GMII_MAC_ENA_CFG(port) (FELIX_GMII(port) + 0x0000001C) |
| 62 | #define FELIX_GMII_MAX_ENA_CFG_TX BIT(0) |
| 63 | #define FELIX_GMII_MAX_ENA_CFG_RX BIT(4) |
| 64 | #define FELIX_GMII_MAC_IFG_CFG(port) (FELIX_GMII(port) + 0x0000001C + 0x14) |
| 65 | #define FELIX_GMII_MAC_IFG_CFG_DEF 0x515 |
| 66 | |
| 67 | #define FELIX_QSYS_SYSTEM (FELIX_QSYS + 0x0000F460) |
| 68 | #define FELIX_QSYS_SYSTEM_SW_PORT_MODE(a) \ |
| 69 | (FELIX_QSYS_SYSTEM + 0x20 + (a) * 4) |
| 70 | #define FELIX_QSYS_SYSTEM_SW_PORT_ENA BIT(14) |
| 71 | #define FELIX_QSYS_SYSTEM_SW_PORT_LOSSY BIT(9) |
| 72 | #define FELIX_QSYS_SYSTEM_SW_PORT_SCH(a) (((a) & 0x3800) << 11) |
| 73 | #define FELIX_QSYS_SYSTEM_EXT_CPU_CFG (FELIX_QSYS_SYSTEM + 0x80) |
| 74 | #define FELIX_QSYS_SYSTEM_EXT_CPU_PORT(a) (((a) & 0xf) << 8 | 0xff) |
| 75 | |
| 76 | /* internal MDIO in BAR0 */ |
| 77 | #define FELIX_PM_IMDIO_BASE 0x8030 |
| 78 | |
| 79 | /* Serdes block on LS1028A */ |
| 80 | #define FELIX_SERDES_BASE 0x1ea0000L |
| 81 | #define FELIX_SERDES_LNATECR0(lane) (FELIX_SERDES_BASE + 0x818 + \ |
| 82 | (lane) * 0x40) |
| 83 | #define FELIX_SERDES_LNATECR0_ADPT_EQ 0x00003000 |
| 84 | #define FELIX_SERDES_SGMIICR1(lane) (FELIX_SERDES_BASE + 0x1804 + \ |
| 85 | (lane) * 0x10) |
| 86 | #define FELIX_SERDES_SGMIICR1_SGPCS BIT(11) |
| 87 | #define FELIX_SERDES_SGMIICR1_MDEV(a) (((a) & 0x1f) << 27) |
| 88 | |
| 89 | #define FELIX_PCS_CTRL 0 |
| 90 | #define FELIX_PCS_CTRL_RST BIT(15) |
| 91 | |
| 92 | /* |
| 93 | * The long prefix format used here contains two dummy MAC addresses, a magic |
| 94 | * value in place of a VLAN tag followed by the extraction/injection header and |
| 95 | * the original L2 frame. Out of all this we only use the port ID. |
| 96 | */ |
| 97 | #define FELIX_DSA_TAG_LEN sizeof(struct felix_dsa_tag) |
| 98 | #define FELIX_DSA_TAG_MAGIC 0x0a008088 |
| 99 | #define FELIX_DSA_TAG_INJ_PORT 7 |
| 100 | #define FELIX_DSA_TAG_INJ_PORT_SET(a) (0x1 << ((a) & FELIX_FP_PORT_MASK)) |
| 101 | #define FELIX_DSA_TAG_EXT_PORT 10 |
| 102 | #define FELIX_DSA_TAG_EXT_PORT_GET(a) ((a) >> 3) |
| 103 | |
| 104 | struct felix_dsa_tag { |
| 105 | uchar d_mac[6]; |
| 106 | uchar s_mac[6]; |
| 107 | u32 magic; |
| 108 | uchar meta[16]; |
| 109 | }; |
| 110 | |
| 111 | struct felix_priv { |
| 112 | void *regs_base; |
| 113 | void *imdio_base; |
| 114 | struct mii_dev imdio; |
| 115 | }; |
| 116 | |
| 117 | /* MDIO wrappers, we're using these to drive internal MDIO to get to serdes */ |
| 118 | static int felix_mdio_read(struct mii_dev *bus, int addr, int devad, int reg) |
| 119 | { |
| 120 | struct enetc_mdio_priv priv; |
| 121 | |
| 122 | priv.regs_base = bus->priv; |
| 123 | return enetc_mdio_read_priv(&priv, addr, devad, reg); |
| 124 | } |
| 125 | |
| 126 | static int felix_mdio_write(struct mii_dev *bus, int addr, int devad, int reg, |
| 127 | u16 val) |
| 128 | { |
| 129 | struct enetc_mdio_priv priv; |
| 130 | |
| 131 | priv.regs_base = bus->priv; |
| 132 | return enetc_mdio_write_priv(&priv, addr, devad, reg, val); |
| 133 | } |
| 134 | |
| 135 | /* set up serdes for SGMII */ |
| 136 | static void felix_init_sgmii(struct mii_dev *imdio, int pidx, bool an) |
| 137 | { |
| 138 | u16 reg; |
| 139 | |
| 140 | /* set up PCS lane address */ |
| 141 | out_le32(FELIX_SERDES_SGMIICR1(pidx), FELIX_SERDES_SGMIICR1_SGPCS | |
| 142 | FELIX_SERDES_SGMIICR1_MDEV(pidx)); |
| 143 | |
| 144 | /* |
| 145 | * Set to SGMII mode, for 1Gbps enable AN, for 2.5Gbps set fixed speed. |
| 146 | * Although fixed speed is 1Gbps, we could be running at 2.5Gbps based |
| 147 | * on PLL configuration. Setting 1G for 2.5G here is counter intuitive |
| 148 | * but intentional. |
| 149 | */ |
| 150 | reg = ENETC_PCS_IF_MODE_SGMII; |
| 151 | reg |= an ? ENETC_PCS_IF_MODE_SGMII_AN : ENETC_PCS_IF_MODE_SPEED_1G; |
| 152 | felix_mdio_write(imdio, pidx, MDIO_DEVAD_NONE, |
| 153 | ENETC_PCS_IF_MODE, reg); |
| 154 | |
| 155 | /* Dev ability - SGMII */ |
| 156 | felix_mdio_write(imdio, pidx, MDIO_DEVAD_NONE, |
| 157 | ENETC_PCS_DEV_ABILITY, ENETC_PCS_DEV_ABILITY_SGMII); |
| 158 | |
| 159 | /* Adjust link timer for SGMII */ |
| 160 | felix_mdio_write(imdio, pidx, MDIO_DEVAD_NONE, |
| 161 | ENETC_PCS_LINK_TIMER1, ENETC_PCS_LINK_TIMER1_VAL); |
| 162 | felix_mdio_write(imdio, pidx, MDIO_DEVAD_NONE, |
| 163 | ENETC_PCS_LINK_TIMER2, ENETC_PCS_LINK_TIMER2_VAL); |
| 164 | |
| 165 | reg = ENETC_PCS_CR_DEF_VAL; |
| 166 | reg |= an ? ENETC_PCS_CR_RESET_AN : ENETC_PCS_CR_RST; |
| 167 | /* restart PCS AN */ |
| 168 | felix_mdio_write(imdio, pidx, MDIO_DEVAD_NONE, |
| 169 | ENETC_PCS_CR, reg); |
| 170 | } |
| 171 | |
| 172 | /* set up MAC and serdes for (Q)SXGMII */ |
| 173 | static int felix_init_sxgmii(struct mii_dev *imdio, int pidx) |
| 174 | { |
| 175 | int timeout = 1000; |
| 176 | |
| 177 | /* set up transit equalization control on serdes lane */ |
| 178 | out_le32(FELIX_SERDES_LNATECR0(1), FELIX_SERDES_LNATECR0_ADPT_EQ); |
| 179 | |
| 180 | /*reset lane */ |
| 181 | felix_mdio_write(imdio, pidx, MDIO_MMD_PCS, FELIX_PCS_CTRL, |
| 182 | FELIX_PCS_CTRL_RST); |
| 183 | while (felix_mdio_read(imdio, pidx, MDIO_MMD_PCS, |
| 184 | FELIX_PCS_CTRL) & FELIX_PCS_CTRL_RST && |
| 185 | --timeout) { |
| 186 | mdelay(10); |
| 187 | } |
| 188 | if (felix_mdio_read(imdio, pidx, MDIO_MMD_PCS, |
| 189 | FELIX_PCS_CTRL) & FELIX_PCS_CTRL_RST) |
| 190 | return -ETIME; |
| 191 | |
| 192 | /* Dev ability - SXGMII */ |
| 193 | felix_mdio_write(imdio, pidx, ENETC_PCS_DEVAD_REPL, |
| 194 | ENETC_PCS_DEV_ABILITY, ENETC_PCS_DEV_ABILITY_SXGMII); |
| 195 | |
| 196 | /* Restart PCS AN */ |
| 197 | felix_mdio_write(imdio, pidx, ENETC_PCS_DEVAD_REPL, ENETC_PCS_CR, |
| 198 | ENETC_PCS_CR_RST | ENETC_PCS_CR_RESET_AN); |
| 199 | felix_mdio_write(imdio, pidx, ENETC_PCS_DEVAD_REPL, |
| 200 | ENETC_PCS_REPL_LINK_TIMER_1, |
| 201 | ENETC_PCS_REPL_LINK_TIMER_1_DEF); |
| 202 | felix_mdio_write(imdio, pidx, ENETC_PCS_DEVAD_REPL, |
| 203 | ENETC_PCS_REPL_LINK_TIMER_2, |
| 204 | ENETC_PCS_REPL_LINK_TIMER_2_DEF); |
| 205 | |
| 206 | return 0; |
| 207 | } |
| 208 | |
| 209 | /* Apply protocol specific configuration to MAC, serdes as needed */ |
| 210 | static void felix_start_pcs(struct udevice *dev, int port, |
| 211 | struct phy_device *phy, struct mii_dev *imdio) |
| 212 | { |
| 213 | bool autoneg = true; |
| 214 | |
| 215 | if (phy->phy_id == PHY_FIXED_ID || |
Vladimir Oltean | 6caef97 | 2021-09-18 15:32:35 +0300 | [diff] [blame] | 216 | phy->interface == PHY_INTERFACE_MODE_2500BASEX) |
Alex Marginean | 4ea74fd | 2021-01-25 14:23:55 +0200 | [diff] [blame] | 217 | autoneg = false; |
| 218 | |
| 219 | switch (phy->interface) { |
| 220 | case PHY_INTERFACE_MODE_SGMII: |
Vladimir Oltean | 6caef97 | 2021-09-18 15:32:35 +0300 | [diff] [blame] | 221 | case PHY_INTERFACE_MODE_2500BASEX: |
Alex Marginean | 4ea74fd | 2021-01-25 14:23:55 +0200 | [diff] [blame] | 222 | case PHY_INTERFACE_MODE_QSGMII: |
| 223 | felix_init_sgmii(imdio, port, autoneg); |
| 224 | break; |
Vladimir Oltean | 6a6e402 | 2021-09-18 15:32:34 +0300 | [diff] [blame] | 225 | case PHY_INTERFACE_MODE_10GBASER: |
Alex Marginean | 4ea74fd | 2021-01-25 14:23:55 +0200 | [diff] [blame] | 226 | case PHY_INTERFACE_MODE_USXGMII: |
| 227 | if (felix_init_sxgmii(imdio, port)) |
| 228 | dev_err(dev, "PCS reset timeout on port %d\n", port); |
| 229 | break; |
| 230 | default: |
| 231 | break; |
| 232 | } |
| 233 | } |
| 234 | |
Vladimir Oltean | 132a8c2 | 2021-08-24 15:00:38 +0300 | [diff] [blame] | 235 | static void felix_init(struct udevice *dev) |
Alex Marginean | 4ea74fd | 2021-01-25 14:23:55 +0200 | [diff] [blame] | 236 | { |
| 237 | struct dsa_pdata *pdata = dev_get_uclass_plat(dev); |
| 238 | struct felix_priv *priv = dev_get_priv(dev); |
| 239 | void *base = priv->regs_base; |
| 240 | int timeout = 100; |
| 241 | |
| 242 | /* Init core memories */ |
| 243 | out_le32(base + FELIX_SYS_RAM_CTRL, FELIX_SYS_RAM_CTRL_INIT); |
| 244 | while (in_le32(base + FELIX_SYS_RAM_CTRL) & FELIX_SYS_RAM_CTRL_INIT && |
| 245 | --timeout) |
| 246 | udelay(10); |
| 247 | if (in_le32(base + FELIX_SYS_RAM_CTRL) & FELIX_SYS_RAM_CTRL_INIT) |
| 248 | dev_err(dev, "Timeout waiting for switch memories\n"); |
| 249 | |
| 250 | /* Start switch core, set up ES0, IS1, IS2 */ |
| 251 | out_le32(base + FELIX_SYS_SYSTEM, FELIX_SYS_SYSTEM_EN); |
| 252 | out_le32(base + FELIX_ES0_TCAM_CTRL, FELIX_ES0_TCAM_CTRL_EN); |
| 253 | out_le32(base + FELIX_IS1_TCAM_CTRL, FELIX_IS1_TCAM_CTRL_EN); |
| 254 | out_le32(base + FELIX_IS2_TCAM_CTRL, FELIX_IS2_TCAM_CTRL_EN); |
| 255 | udelay(20); |
| 256 | |
| 257 | priv->imdio.read = felix_mdio_read; |
| 258 | priv->imdio.write = felix_mdio_write; |
| 259 | priv->imdio.priv = priv->imdio_base + FELIX_PM_IMDIO_BASE; |
| 260 | strncpy(priv->imdio.name, dev->name, MDIO_NAME_LEN); |
| 261 | |
| 262 | /* set up CPU port */ |
| 263 | out_le32(base + FELIX_QSYS_SYSTEM_EXT_CPU_CFG, |
| 264 | FELIX_QSYS_SYSTEM_EXT_CPU_PORT(pdata->cpu_port)); |
| 265 | out_le32(base + FELIX_SYS_SYSTEM_PORT_MODE(pdata->cpu_port), |
| 266 | FELIX_SYS_SYSTEM_PORT_MODE_CPU); |
| 267 | } |
| 268 | |
| 269 | /* |
| 270 | * Probe Felix: |
| 271 | * - enable the PCI function |
| 272 | * - map BAR 4 |
| 273 | * - init switch core and port registers |
| 274 | */ |
| 275 | static int felix_probe(struct udevice *dev) |
| 276 | { |
| 277 | struct felix_priv *priv = dev_get_priv(dev); |
| 278 | |
| 279 | if (ofnode_valid(dev_ofnode(dev)) && |
| 280 | !ofnode_is_available(dev_ofnode(dev))) { |
| 281 | dev_dbg(dev, "switch disabled\n"); |
| 282 | return -ENODEV; |
| 283 | } |
| 284 | |
| 285 | priv->imdio_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0); |
| 286 | if (!priv->imdio_base) { |
| 287 | dev_err(dev, "failed to map BAR0\n"); |
| 288 | return -EINVAL; |
| 289 | } |
| 290 | |
| 291 | priv->regs_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_4, 0); |
| 292 | if (!priv->regs_base) { |
| 293 | dev_err(dev, "failed to map BAR4\n"); |
| 294 | return -EINVAL; |
| 295 | } |
| 296 | |
| 297 | /* register internal MDIO for debug */ |
| 298 | if (!miiphy_get_dev_by_name(dev->name)) { |
| 299 | struct mii_dev *mii_bus; |
| 300 | |
| 301 | mii_bus = mdio_alloc(); |
| 302 | mii_bus->read = felix_mdio_read; |
| 303 | mii_bus->write = felix_mdio_write; |
| 304 | mii_bus->priv = priv->imdio_base + FELIX_PM_IMDIO_BASE; |
| 305 | strncpy(mii_bus->name, dev->name, MDIO_NAME_LEN); |
| 306 | mdio_register(mii_bus); |
| 307 | } |
| 308 | |
| 309 | dm_pci_clrset_config16(dev, PCI_COMMAND, 0, PCI_COMMAND_MEMORY); |
| 310 | |
| 311 | dsa_set_tagging(dev, FELIX_DSA_TAG_LEN, 0); |
| 312 | |
| 313 | /* set up registers */ |
| 314 | felix_init(dev); |
| 315 | |
| 316 | return 0; |
| 317 | } |
| 318 | |
Vladimir Oltean | 81cec03 | 2021-08-24 15:00:42 +0300 | [diff] [blame] | 319 | static int felix_port_probe(struct udevice *dev, int port, |
| 320 | struct phy_device *phy) |
| 321 | { |
| 322 | int supported = PHY_GBIT_FEATURES | SUPPORTED_2500baseX_Full; |
| 323 | struct felix_priv *priv = dev_get_priv(dev); |
| 324 | |
| 325 | phy->supported &= supported; |
| 326 | phy->advertising &= supported; |
| 327 | |
| 328 | felix_start_pcs(dev, port, phy, &priv->imdio); |
| 329 | |
| 330 | return phy_config(phy); |
| 331 | } |
| 332 | |
Alex Marginean | 4ea74fd | 2021-01-25 14:23:55 +0200 | [diff] [blame] | 333 | static int felix_port_enable(struct udevice *dev, int port, |
| 334 | struct phy_device *phy) |
| 335 | { |
Alex Marginean | 4ea74fd | 2021-01-25 14:23:55 +0200 | [diff] [blame] | 336 | struct felix_priv *priv = dev_get_priv(dev); |
| 337 | void *base = priv->regs_base; |
| 338 | |
| 339 | /* Set up MAC registers */ |
| 340 | out_le32(base + FELIX_GMII_CLOCK_CFG(port), |
| 341 | FELIX_GMII_CLOCK_CFG_LINK_1G); |
| 342 | |
| 343 | out_le32(base + FELIX_GMII_MAC_IFG_CFG(port), |
| 344 | FELIX_GMII_MAC_IFG_CFG_DEF); |
| 345 | |
| 346 | out_le32(base + FELIX_GMII_MAC_ENA_CFG(port), |
| 347 | FELIX_GMII_MAX_ENA_CFG_TX | FELIX_GMII_MAX_ENA_CFG_RX); |
| 348 | |
| 349 | out_le32(base + FELIX_QSYS_SYSTEM_SW_PORT_MODE(port), |
| 350 | FELIX_QSYS_SYSTEM_SW_PORT_ENA | |
| 351 | FELIX_QSYS_SYSTEM_SW_PORT_LOSSY | |
| 352 | FELIX_QSYS_SYSTEM_SW_PORT_SCH(1)); |
| 353 | |
Vladimir Oltean | e26bcf6 | 2021-08-24 15:00:43 +0300 | [diff] [blame] | 354 | return phy_startup(phy); |
Alex Marginean | 4ea74fd | 2021-01-25 14:23:55 +0200 | [diff] [blame] | 355 | } |
| 356 | |
| 357 | static void felix_port_disable(struct udevice *dev, int pidx, |
| 358 | struct phy_device *phy) |
| 359 | { |
| 360 | struct felix_priv *priv = dev_get_priv(dev); |
| 361 | void *base = priv->regs_base; |
| 362 | |
| 363 | out_le32(base + FELIX_GMII_MAC_ENA_CFG(pidx), 0); |
| 364 | |
| 365 | out_le32(base + FELIX_QSYS_SYSTEM_SW_PORT_MODE(pidx), |
| 366 | FELIX_QSYS_SYSTEM_SW_PORT_LOSSY | |
| 367 | FELIX_QSYS_SYSTEM_SW_PORT_SCH(1)); |
| 368 | |
| 369 | /* |
| 370 | * we don't call phy_shutdown here to avoid waiting next time we use |
| 371 | * the port, but the downside is that remote side will think we're |
| 372 | * actively processing traffic although we are not. |
| 373 | */ |
| 374 | } |
| 375 | |
| 376 | static int felix_xmit(struct udevice *dev, int pidx, void *packet, int length) |
| 377 | { |
| 378 | struct felix_dsa_tag *tag = packet; |
| 379 | |
| 380 | tag->magic = FELIX_DSA_TAG_MAGIC; |
| 381 | tag->meta[FELIX_DSA_TAG_INJ_PORT] = FELIX_DSA_TAG_INJ_PORT_SET(pidx); |
| 382 | |
| 383 | return 0; |
| 384 | } |
| 385 | |
| 386 | static int felix_rcv(struct udevice *dev, int *pidx, void *packet, int length) |
| 387 | { |
| 388 | struct felix_dsa_tag *tag = packet; |
| 389 | |
| 390 | if (tag->magic != FELIX_DSA_TAG_MAGIC) |
| 391 | return -EINVAL; |
| 392 | |
| 393 | *pidx = FELIX_DSA_TAG_EXT_PORT_GET(tag->meta[FELIX_DSA_TAG_EXT_PORT]); |
| 394 | |
| 395 | return 0; |
| 396 | } |
| 397 | |
| 398 | static const struct dsa_ops felix_dsa_ops = { |
Vladimir Oltean | 81cec03 | 2021-08-24 15:00:42 +0300 | [diff] [blame] | 399 | .port_probe = felix_port_probe, |
Alex Marginean | 4ea74fd | 2021-01-25 14:23:55 +0200 | [diff] [blame] | 400 | .port_enable = felix_port_enable, |
| 401 | .port_disable = felix_port_disable, |
| 402 | .xmit = felix_xmit, |
| 403 | .rcv = felix_rcv, |
| 404 | }; |
| 405 | |
| 406 | U_BOOT_DRIVER(felix_ethsw) = { |
| 407 | .name = "felix-switch", |
| 408 | .id = UCLASS_DSA, |
| 409 | .probe = felix_probe, |
| 410 | .ops = &felix_dsa_ops, |
| 411 | .priv_auto = sizeof(struct felix_priv), |
| 412 | }; |
| 413 | |
| 414 | static struct pci_device_id felix_ethsw_ids[] = { |
| 415 | { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, PCI_DEVICE_ID_FELIX_ETHSW) }, |
| 416 | {} |
| 417 | }; |
| 418 | |
| 419 | U_BOOT_PCI_DEVICE(felix_ethsw, felix_ethsw_ids); |