1 // SPDX-License-Identifier: GPL-2.0+
3 * drivers/net/phy/broadcom.c
5 * Broadcom BCM5411, BCM5421 and BCM5461 Gigabit Ethernet
8 * Copyright (c) 2006 Maciej W. Rozycki
10 * Inspired by code written by Amy Fong.
13 #include "bcm-phy-lib.h"
14 #include <linux/delay.h>
15 #include <linux/module.h>
16 #include <linux/phy.h>
17 #include <linux/brcmphy.h>
20 #define BRCM_PHY_MODEL(phydev) \
21 ((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask)
23 #define BRCM_PHY_REV(phydev) \
24 ((phydev)->drv->phy_id & ~((phydev)->drv->phy_id_mask))
26 MODULE_DESCRIPTION("Broadcom PHY driver");
27 MODULE_AUTHOR("Maciej W. Rozycki");
28 MODULE_LICENSE("GPL");
30 static int bcm54xx_config_clock_delay(struct phy_device *phydev)
34 /* handling PHY's internal RX clock delay */
35 val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
36 val |= MII_BCM54XX_AUXCTL_MISC_WREN;
37 if (phydev->interface == PHY_INTERFACE_MODE_RGMII ||
38 phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) {
39 /* Disable RGMII RXC-RXD skew */
40 val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
42 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
43 phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) {
44 /* Enable RGMII RXC-RXD skew */
45 val |= MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
47 rc = bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
52 /* handling PHY's internal TX clock delay */
53 val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL);
54 if (phydev->interface == PHY_INTERFACE_MODE_RGMII ||
55 phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) {
56 /* Disable internal TX clock delay */
57 val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN;
59 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
60 phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) {
61 /* Enable internal TX clock delay */
62 val |= BCM54810_SHD_CLK_CTL_GTXCLK_EN;
64 rc = bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val);
71 static int bcm54210e_config_init(struct phy_device *phydev)
75 bcm54xx_config_clock_delay(phydev);
77 if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) {
78 val = phy_read(phydev, MII_CTRL1000);
79 val |= CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER;
80 phy_write(phydev, MII_CTRL1000, val);
86 static int bcm54612e_config_init(struct phy_device *phydev)
90 bcm54xx_config_clock_delay(phydev);
92 /* Enable CLK125 MUX on LED4 if ref clock is enabled. */
93 if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) {
96 reg = bcm_phy_read_exp(phydev, BCM54612E_EXP_SPARE0);
97 err = bcm_phy_write_exp(phydev, BCM54612E_EXP_SPARE0,
98 BCM54612E_LED4_CLK125OUT_EN | reg);
107 static int bcm54616s_config_init(struct phy_device *phydev)
111 if (phydev->interface != PHY_INTERFACE_MODE_SGMII &&
112 phydev->interface != PHY_INTERFACE_MODE_1000BASEX)
115 /* Ensure proper interface mode is selected. */
116 /* Disable RGMII mode */
117 val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
120 val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_EN;
121 val |= MII_BCM54XX_AUXCTL_MISC_WREN;
122 rc = bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
127 /* Select 1000BASE-X register set (primary SerDes) */
128 val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_MODE);
131 val |= BCM54XX_SHD_MODE_1000BX;
132 rc = bcm_phy_write_shadow(phydev, BCM54XX_SHD_MODE, val);
136 /* Power down SerDes interface */
137 rc = phy_set_bits(phydev, MII_BMCR, BMCR_PDOWN);
141 /* Select proper interface mode */
142 val &= ~BCM54XX_SHD_INTF_SEL_MASK;
143 val |= phydev->interface == PHY_INTERFACE_MODE_SGMII ?
144 BCM54XX_SHD_INTF_SEL_SGMII :
145 BCM54XX_SHD_INTF_SEL_GBIC;
146 rc = bcm_phy_write_shadow(phydev, BCM54XX_SHD_MODE, val);
150 /* Power up SerDes interface */
151 rc = phy_clear_bits(phydev, MII_BMCR, BMCR_PDOWN);
155 /* Select copper register set */
156 val &= ~BCM54XX_SHD_MODE_1000BX;
157 rc = bcm_phy_write_shadow(phydev, BCM54XX_SHD_MODE, val);
161 /* Power up copper interface */
162 return phy_clear_bits(phydev, MII_BMCR, BMCR_PDOWN);
165 /* Needs SMDSP clock enabled via bcm54xx_phydsp_config() */
166 static int bcm50610_a0_workaround(struct phy_device *phydev)
170 err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_AADJ1CH0,
171 MII_BCM54XX_EXP_AADJ1CH0_SWP_ABCD_OEN |
172 MII_BCM54XX_EXP_AADJ1CH0_SWSEL_THPF);
176 err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_AADJ1CH3,
177 MII_BCM54XX_EXP_AADJ1CH3_ADCCKADJ);
181 err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP75,
182 MII_BCM54XX_EXP_EXP75_VDACCTRL);
186 err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP96,
187 MII_BCM54XX_EXP_EXP96_MYST);
191 err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP97,
192 MII_BCM54XX_EXP_EXP97_MYST);
197 static int bcm54xx_phydsp_config(struct phy_device *phydev)
201 /* Enable the SMDSP clock */
202 err = bcm54xx_auxctl_write(phydev,
203 MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL,
204 MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA |
205 MII_BCM54XX_AUXCTL_ACTL_TX_6DB);
209 if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 ||
210 BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) {
211 /* Clear bit 9 to fix a phy interop issue. */
212 err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP08,
213 MII_BCM54XX_EXP_EXP08_RJCT_2MHZ);
217 if (phydev->drv->phy_id == PHY_ID_BCM50610) {
218 err = bcm50610_a0_workaround(phydev);
224 if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM57780) {
227 val = bcm_phy_read_exp(phydev, MII_BCM54XX_EXP_EXP75);
231 val |= MII_BCM54XX_EXP_EXP75_CM_OSC;
232 err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP75, val);
236 /* Disable the SMDSP clock */
237 err2 = bcm54xx_auxctl_write(phydev,
238 MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL,
239 MII_BCM54XX_AUXCTL_ACTL_TX_6DB);
241 /* Return the first error reported. */
242 return err ? err : err2;
245 static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)
249 bool clk125en = true;
251 /* Abort if we are using an untested phy. */
252 if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 &&
253 BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 &&
254 BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M &&
255 BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54810 &&
256 BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54811)
259 val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR3);
265 if ((BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 ||
266 BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) &&
267 BRCM_PHY_REV(phydev) >= 0x3) {
269 * Here, bit 0 _disables_ CLK125 when set.
270 * This bit is set by default.
274 if (phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED) {
275 if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54811) {
276 /* Here, bit 0 _enables_ CLK125 when set */
277 val &= ~BCM54XX_SHD_SCR3_DEF_CLK125;
283 if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE))
284 val &= ~BCM54XX_SHD_SCR3_DLLAPD_DIS;
286 val |= BCM54XX_SHD_SCR3_DLLAPD_DIS;
288 if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) {
289 if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810 ||
290 BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54811)
291 val |= BCM54810_SHD_SCR3_TRDDAPD;
293 val |= BCM54XX_SHD_SCR3_TRDDAPD;
297 bcm_phy_write_shadow(phydev, BCM54XX_SHD_SCR3, val);
299 val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_APD);
305 if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE))
306 val |= BCM54XX_SHD_APD_EN;
308 val &= ~BCM54XX_SHD_APD_EN;
311 bcm_phy_write_shadow(phydev, BCM54XX_SHD_APD, val);
314 static int bcm54xx_config_init(struct phy_device *phydev)
318 reg = phy_read(phydev, MII_BCM54XX_ECR);
322 /* Mask interrupts globally. */
323 reg |= MII_BCM54XX_ECR_IM;
324 err = phy_write(phydev, MII_BCM54XX_ECR, reg);
328 /* Unmask events we are interested in. */
329 reg = ~(MII_BCM54XX_INT_DUPLEX |
330 MII_BCM54XX_INT_SPEED |
331 MII_BCM54XX_INT_LINK);
332 err = phy_write(phydev, MII_BCM54XX_IMR, reg);
336 if ((BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 ||
337 BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) &&
338 (phydev->dev_flags & PHY_BRCM_CLEAR_RGMII_MODE))
339 bcm_phy_write_shadow(phydev, BCM54XX_SHD_RGMII_MODE, 0);
341 bcm54xx_adjust_rxrefclk(phydev);
343 switch (BRCM_PHY_MODEL(phydev)) {
344 case PHY_ID_BCM50610:
345 case PHY_ID_BCM50610M:
346 err = bcm54xx_config_clock_delay(phydev);
348 case PHY_ID_BCM54210E:
349 err = bcm54210e_config_init(phydev);
351 case PHY_ID_BCM54612E:
352 err = bcm54612e_config_init(phydev);
354 case PHY_ID_BCM54616S:
355 err = bcm54616s_config_init(phydev);
357 case PHY_ID_BCM54810:
358 /* For BCM54810, we need to disable BroadR-Reach function */
359 val = bcm_phy_read_exp(phydev,
360 BCM54810_EXP_BROADREACH_LRE_MISC_CTL);
361 val &= ~BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN;
362 err = bcm_phy_write_exp(phydev,
363 BCM54810_EXP_BROADREACH_LRE_MISC_CTL,
370 bcm54xx_phydsp_config(phydev);
372 /* Encode link speed into LED1 and LED3 pair (green/amber).
373 * Also flash these two LEDs on activity. This means configuring
374 * them for MULTICOLOR and encoding link/activity into them.
376 val = BCM5482_SHD_LEDS1_LED1(BCM_LED_SRC_MULTICOLOR1) |
377 BCM5482_SHD_LEDS1_LED3(BCM_LED_SRC_MULTICOLOR1);
378 bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, val);
380 val = BCM_LED_MULTICOLOR_IN_PHASE |
381 BCM5482_SHD_LEDS1_LED1(BCM_LED_MULTICOLOR_LINK_ACT) |
382 BCM5482_SHD_LEDS1_LED3(BCM_LED_MULTICOLOR_LINK_ACT);
383 bcm_phy_write_exp(phydev, BCM_EXP_MULTICOLOR, val);
388 static int bcm54xx_resume(struct phy_device *phydev)
392 /* Writes to register other than BMCR would be ignored
393 * unless we clear the PDOWN bit first
395 ret = genphy_resume(phydev);
399 /* Upon exiting power down, the PHY remains in an internal reset state
404 return bcm54xx_config_init(phydev);
407 static int bcm54810_read_mmd(struct phy_device *phydev, int devnum, u16 regnum)
412 static int bcm54810_write_mmd(struct phy_device *phydev, int devnum, u16 regnum,
418 static int bcm54811_config_init(struct phy_device *phydev)
422 /* Disable BroadR-Reach function. */
423 reg = bcm_phy_read_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL);
424 reg &= ~BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN;
425 err = bcm_phy_write_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL,
430 err = bcm54xx_config_init(phydev);
432 /* Enable CLK125 MUX on LED4 if ref clock is enabled. */
433 if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) {
434 reg = bcm_phy_read_exp(phydev, BCM54612E_EXP_SPARE0);
435 err = bcm_phy_write_exp(phydev, BCM54612E_EXP_SPARE0,
436 BCM54612E_LED4_CLK125OUT_EN | reg);
444 static int bcm5482_config_init(struct phy_device *phydev)
448 err = bcm54xx_config_init(phydev);
450 if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) {
452 * Enable secondary SerDes and its use as an LED source
454 reg = bcm_phy_read_shadow(phydev, BCM5482_SHD_SSD);
455 bcm_phy_write_shadow(phydev, BCM5482_SHD_SSD,
457 BCM5482_SHD_SSD_LEDM |
461 * Enable SGMII slave mode and auto-detection
463 reg = BCM5482_SSD_SGMII_SLAVE | MII_BCM54XX_EXP_SEL_SSD;
464 err = bcm_phy_read_exp(phydev, reg);
467 err = bcm_phy_write_exp(phydev, reg, err |
468 BCM5482_SSD_SGMII_SLAVE_EN |
469 BCM5482_SSD_SGMII_SLAVE_AD);
474 * Disable secondary SerDes powerdown
476 reg = BCM5482_SSD_1000BX_CTL | MII_BCM54XX_EXP_SEL_SSD;
477 err = bcm_phy_read_exp(phydev, reg);
480 err = bcm_phy_write_exp(phydev, reg,
481 err & ~BCM5482_SSD_1000BX_CTL_PWRDOWN);
486 * Select 1000BASE-X register set (primary SerDes)
488 reg = bcm_phy_read_shadow(phydev, BCM54XX_SHD_MODE);
489 bcm_phy_write_shadow(phydev, BCM54XX_SHD_MODE,
490 reg | BCM54XX_SHD_MODE_1000BX);
493 * LED1=ACTIVITYLED, LED3=LINKSPD[2]
494 * (Use LED1 as secondary SerDes ACTIVITY LED)
496 bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1,
497 BCM5482_SHD_LEDS1_LED1(BCM_LED_SRC_ACTIVITYLED) |
498 BCM5482_SHD_LEDS1_LED3(BCM_LED_SRC_LINKSPD2));
501 * Auto-negotiation doesn't seem to work quite right
502 * in this mode, so we disable it and force it to the
503 * right speed/duplex setting. Only 'link status'
506 phydev->autoneg = AUTONEG_DISABLE;
507 phydev->speed = SPEED_1000;
508 phydev->duplex = DUPLEX_FULL;
514 static int bcm5482_read_status(struct phy_device *phydev)
518 err = genphy_read_status(phydev);
520 if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) {
522 * Only link status matters for 1000Base-X mode, so force
523 * 1000 Mbit/s full-duplex status
526 phydev->speed = SPEED_1000;
527 phydev->duplex = DUPLEX_FULL;
534 static int bcm5481_config_aneg(struct phy_device *phydev)
536 struct device_node *np = phydev->mdio.dev.of_node;
540 ret = genphy_config_aneg(phydev);
542 /* Then we can set up the delay. */
543 bcm54xx_config_clock_delay(phydev);
545 if (of_property_read_bool(np, "enet-phy-lane-swap")) {
546 /* Lane Swap - Undocumented register...magic! */
547 ret = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_SEL_ER + 0x9,
556 static int bcm54616s_probe(struct phy_device *phydev)
560 val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_MODE);
564 /* The PHY is strapped in RGMII-fiber mode when INTERF_SEL[1:0]
565 * is 01b, and the link between PHY and its link partner can be
566 * either 1000Base-X or 100Base-FX.
567 * RGMII-1000Base-X is properly supported, but RGMII-100Base-FX
568 * support is still missing as of now.
570 if ((val & BCM54XX_SHD_INTF_SEL_MASK) == BCM54XX_SHD_INTF_SEL_RGMII) {
571 val = bcm_phy_read_shadow(phydev, BCM54616S_SHD_100FX_CTRL);
575 /* Bit 0 of the SerDes 100-FX Control register, when set
576 * to 1, sets the MII/RGMII -> 100BASE-FX configuration.
577 * When this bit is set to 0, it sets the GMII/RGMII ->
578 * 1000BASE-X configuration.
580 if (!(val & BCM54616S_100FX_MODE))
581 phydev->dev_flags |= PHY_BCM_FLAGS_MODE_1000BX;
583 phydev->port = PORT_FIBRE;
589 static int bcm54616s_config_aneg(struct phy_device *phydev)
594 if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX)
595 ret = genphy_c37_config_aneg(phydev);
597 ret = genphy_config_aneg(phydev);
599 /* Then we can set up the delay. */
600 bcm54xx_config_clock_delay(phydev);
605 static int bcm54616s_read_status(struct phy_device *phydev)
609 if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX)
610 err = genphy_c37_read_status(phydev);
612 err = genphy_read_status(phydev);
617 static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
621 val = phy_read(phydev, reg);
625 return phy_write(phydev, reg, val | set);
628 static int brcm_fet_config_init(struct phy_device *phydev)
630 int reg, err, err2, brcmtest;
632 /* Reset the PHY to bring it to a known state. */
633 err = phy_write(phydev, MII_BMCR, BMCR_RESET);
637 /* The datasheet indicates the PHY needs up to 1us to complete a reset,
638 * build some slack here.
640 usleep_range(1000, 2000);
642 /* The PHY requires 65 MDC clock cycles to complete a write operation
643 * and turnaround the line properly.
645 * We ignore -EIO here as the MDIO controller (e.g.: mdio-bcm-unimac)
646 * may flag the lack of turn-around as a read failure. This is
647 * particularly true with this combination since the MDIO controller
648 * only used 64 MDC cycles. This is not a critical failure in this
649 * specific case and it has no functional impact otherwise, so we let
650 * that one go through. If there is a genuine bus error, the next read
651 * of MII_BRCM_FET_INTREG will error out.
653 err = phy_read(phydev, MII_BMCR);
654 if (err < 0 && err != -EIO)
657 reg = phy_read(phydev, MII_BRCM_FET_INTREG);
661 /* Unmask events we are interested in and mask interrupts globally. */
662 reg = MII_BRCM_FET_IR_DUPLEX_EN |
663 MII_BRCM_FET_IR_SPEED_EN |
664 MII_BRCM_FET_IR_LINK_EN |
665 MII_BRCM_FET_IR_ENABLE |
666 MII_BRCM_FET_IR_MASK;
668 err = phy_write(phydev, MII_BRCM_FET_INTREG, reg);
672 /* Enable shadow register access */
673 brcmtest = phy_read(phydev, MII_BRCM_FET_BRCMTEST);
677 reg = brcmtest | MII_BRCM_FET_BT_SRE;
679 err = phy_write(phydev, MII_BRCM_FET_BRCMTEST, reg);
683 /* Set the LED mode */
684 reg = phy_read(phydev, MII_BRCM_FET_SHDW_AUXMODE4);
690 reg &= ~MII_BRCM_FET_SHDW_AM4_LED_MASK;
691 reg |= MII_BRCM_FET_SHDW_AM4_LED_MODE1;
693 err = phy_write(phydev, MII_BRCM_FET_SHDW_AUXMODE4, reg);
697 /* Enable auto MDIX */
698 err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_MISCCTRL,
699 MII_BRCM_FET_SHDW_MC_FAME);
703 if (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE) {
704 /* Enable auto power down */
705 err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2,
706 MII_BRCM_FET_SHDW_AS2_APDE);
710 /* Disable shadow register access */
711 err2 = phy_write(phydev, MII_BRCM_FET_BRCMTEST, brcmtest);
718 static int brcm_fet_ack_interrupt(struct phy_device *phydev)
722 /* Clear pending interrupts. */
723 reg = phy_read(phydev, MII_BRCM_FET_INTREG);
730 static int brcm_fet_config_intr(struct phy_device *phydev)
734 reg = phy_read(phydev, MII_BRCM_FET_INTREG);
738 if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
739 reg &= ~MII_BRCM_FET_IR_MASK;
741 reg |= MII_BRCM_FET_IR_MASK;
743 err = phy_write(phydev, MII_BRCM_FET_INTREG, reg);
747 struct bcm53xx_phy_priv {
751 static int bcm53xx_phy_probe(struct phy_device *phydev)
753 struct bcm53xx_phy_priv *priv;
755 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL);
761 priv->stats = devm_kcalloc(&phydev->mdio.dev,
762 bcm_phy_get_sset_count(phydev), sizeof(u64),
770 static void bcm53xx_phy_get_stats(struct phy_device *phydev,
771 struct ethtool_stats *stats, u64 *data)
773 struct bcm53xx_phy_priv *priv = phydev->priv;
775 bcm_phy_get_stats(phydev, priv->stats, stats, data);
778 static struct phy_driver broadcom_drivers[] = {
780 .phy_id = PHY_ID_BCM5411,
781 .phy_id_mask = 0xfffffff0,
782 .name = "Broadcom BCM5411",
783 /* PHY_GBIT_FEATURES */
784 .config_init = bcm54xx_config_init,
785 .ack_interrupt = bcm_phy_ack_intr,
786 .config_intr = bcm_phy_config_intr,
788 .phy_id = PHY_ID_BCM5421,
789 .phy_id_mask = 0xfffffff0,
790 .name = "Broadcom BCM5421",
791 /* PHY_GBIT_FEATURES */
792 .config_init = bcm54xx_config_init,
793 .ack_interrupt = bcm_phy_ack_intr,
794 .config_intr = bcm_phy_config_intr,
796 .phy_id = PHY_ID_BCM54210E,
797 .phy_id_mask = 0xfffffff0,
798 .name = "Broadcom BCM54210E",
799 /* PHY_GBIT_FEATURES */
800 .config_init = bcm54xx_config_init,
801 .ack_interrupt = bcm_phy_ack_intr,
802 .config_intr = bcm_phy_config_intr,
804 .phy_id = PHY_ID_BCM5461,
805 .phy_id_mask = 0xfffffff0,
806 .name = "Broadcom BCM5461",
807 /* PHY_GBIT_FEATURES */
808 .config_init = bcm54xx_config_init,
809 .ack_interrupt = bcm_phy_ack_intr,
810 .config_intr = bcm_phy_config_intr,
812 .phy_id = PHY_ID_BCM54612E,
813 .phy_id_mask = 0xfffffff0,
814 .name = "Broadcom BCM54612E",
815 /* PHY_GBIT_FEATURES */
816 .config_init = bcm54xx_config_init,
817 .ack_interrupt = bcm_phy_ack_intr,
818 .config_intr = bcm_phy_config_intr,
820 .phy_id = PHY_ID_BCM54616S,
821 .phy_id_mask = 0xfffffff0,
822 .name = "Broadcom BCM54616S",
823 /* PHY_GBIT_FEATURES */
824 .soft_reset = genphy_soft_reset,
825 .config_init = bcm54xx_config_init,
826 .config_aneg = bcm54616s_config_aneg,
827 .ack_interrupt = bcm_phy_ack_intr,
828 .config_intr = bcm_phy_config_intr,
829 .read_status = bcm54616s_read_status,
830 .probe = bcm54616s_probe,
832 .phy_id = PHY_ID_BCM5464,
833 .phy_id_mask = 0xfffffff0,
834 .name = "Broadcom BCM5464",
835 /* PHY_GBIT_FEATURES */
836 .config_init = bcm54xx_config_init,
837 .ack_interrupt = bcm_phy_ack_intr,
838 .config_intr = bcm_phy_config_intr,
839 .suspend = genphy_suspend,
840 .resume = genphy_resume,
842 .phy_id = PHY_ID_BCM5481,
843 .phy_id_mask = 0xfffffff0,
844 .name = "Broadcom BCM5481",
845 /* PHY_GBIT_FEATURES */
846 .config_init = bcm54xx_config_init,
847 .config_aneg = bcm5481_config_aneg,
848 .ack_interrupt = bcm_phy_ack_intr,
849 .config_intr = bcm_phy_config_intr,
851 .phy_id = PHY_ID_BCM54810,
852 .phy_id_mask = 0xfffffff0,
853 .name = "Broadcom BCM54810",
854 /* PHY_GBIT_FEATURES */
855 .read_mmd = bcm54810_read_mmd,
856 .write_mmd = bcm54810_write_mmd,
857 .config_init = bcm54xx_config_init,
858 .config_aneg = bcm5481_config_aneg,
859 .ack_interrupt = bcm_phy_ack_intr,
860 .config_intr = bcm_phy_config_intr,
861 .suspend = genphy_suspend,
862 .resume = bcm54xx_resume,
864 .phy_id = PHY_ID_BCM54811,
865 .phy_id_mask = 0xfffffff0,
866 .name = "Broadcom BCM54811",
867 /* PHY_GBIT_FEATURES */
868 .config_init = bcm54811_config_init,
869 .config_aneg = bcm5481_config_aneg,
870 .ack_interrupt = bcm_phy_ack_intr,
871 .config_intr = bcm_phy_config_intr,
872 .suspend = genphy_suspend,
873 .resume = bcm54xx_resume,
875 .phy_id = PHY_ID_BCM5482,
876 .phy_id_mask = 0xfffffff0,
877 .name = "Broadcom BCM5482",
878 /* PHY_GBIT_FEATURES */
879 .config_init = bcm5482_config_init,
880 .read_status = bcm5482_read_status,
881 .ack_interrupt = bcm_phy_ack_intr,
882 .config_intr = bcm_phy_config_intr,
884 .phy_id = PHY_ID_BCM50610,
885 .phy_id_mask = 0xfffffff0,
886 .name = "Broadcom BCM50610",
887 /* PHY_GBIT_FEATURES */
888 .config_init = bcm54xx_config_init,
889 .ack_interrupt = bcm_phy_ack_intr,
890 .config_intr = bcm_phy_config_intr,
892 .phy_id = PHY_ID_BCM50610M,
893 .phy_id_mask = 0xfffffff0,
894 .name = "Broadcom BCM50610M",
895 /* PHY_GBIT_FEATURES */
896 .config_init = bcm54xx_config_init,
897 .ack_interrupt = bcm_phy_ack_intr,
898 .config_intr = bcm_phy_config_intr,
900 .phy_id = PHY_ID_BCM57780,
901 .phy_id_mask = 0xfffffff0,
902 .name = "Broadcom BCM57780",
903 /* PHY_GBIT_FEATURES */
904 .config_init = bcm54xx_config_init,
905 .ack_interrupt = bcm_phy_ack_intr,
906 .config_intr = bcm_phy_config_intr,
908 .phy_id = PHY_ID_BCMAC131,
909 .phy_id_mask = 0xfffffff0,
910 .name = "Broadcom BCMAC131",
911 /* PHY_BASIC_FEATURES */
912 .config_init = brcm_fet_config_init,
913 .ack_interrupt = brcm_fet_ack_interrupt,
914 .config_intr = brcm_fet_config_intr,
916 .phy_id = PHY_ID_BCM5241,
917 .phy_id_mask = 0xfffffff0,
918 .name = "Broadcom BCM5241",
919 /* PHY_BASIC_FEATURES */
920 .config_init = brcm_fet_config_init,
921 .ack_interrupt = brcm_fet_ack_interrupt,
922 .config_intr = brcm_fet_config_intr,
924 .phy_id = PHY_ID_BCM5395,
925 .phy_id_mask = 0xfffffff0,
926 .name = "Broadcom BCM5395",
927 .flags = PHY_IS_INTERNAL,
928 /* PHY_GBIT_FEATURES */
929 .get_sset_count = bcm_phy_get_sset_count,
930 .get_strings = bcm_phy_get_strings,
931 .get_stats = bcm53xx_phy_get_stats,
932 .probe = bcm53xx_phy_probe,
934 .phy_id = PHY_ID_BCM53125,
935 .phy_id_mask = 0xfffffff0,
936 .name = "Broadcom BCM53125",
937 .flags = PHY_IS_INTERNAL,
938 /* PHY_GBIT_FEATURES */
939 .get_sset_count = bcm_phy_get_sset_count,
940 .get_strings = bcm_phy_get_strings,
941 .get_stats = bcm53xx_phy_get_stats,
942 .probe = bcm53xx_phy_probe,
943 .config_init = bcm54xx_config_init,
944 .ack_interrupt = bcm_phy_ack_intr,
945 .config_intr = bcm_phy_config_intr,
947 .phy_id = PHY_ID_BCM89610,
948 .phy_id_mask = 0xfffffff0,
949 .name = "Broadcom BCM89610",
950 /* PHY_GBIT_FEATURES */
951 .config_init = bcm54xx_config_init,
952 .ack_interrupt = bcm_phy_ack_intr,
953 .config_intr = bcm_phy_config_intr,
956 module_phy_driver(broadcom_drivers);
958 static struct mdio_device_id __maybe_unused broadcom_tbl[] = {
959 { PHY_ID_BCM5411, 0xfffffff0 },
960 { PHY_ID_BCM5421, 0xfffffff0 },
961 { PHY_ID_BCM54210E, 0xfffffff0 },
962 { PHY_ID_BCM5461, 0xfffffff0 },
963 { PHY_ID_BCM54612E, 0xfffffff0 },
964 { PHY_ID_BCM54616S, 0xfffffff0 },
965 { PHY_ID_BCM5464, 0xfffffff0 },
966 { PHY_ID_BCM5481, 0xfffffff0 },
967 { PHY_ID_BCM54810, 0xfffffff0 },
968 { PHY_ID_BCM54811, 0xfffffff0 },
969 { PHY_ID_BCM5482, 0xfffffff0 },
970 { PHY_ID_BCM50610, 0xfffffff0 },
971 { PHY_ID_BCM50610M, 0xfffffff0 },
972 { PHY_ID_BCM57780, 0xfffffff0 },
973 { PHY_ID_BCMAC131, 0xfffffff0 },
974 { PHY_ID_BCM5241, 0xfffffff0 },
975 { PHY_ID_BCM5395, 0xfffffff0 },
976 { PHY_ID_BCM53125, 0xfffffff0 },
977 { PHY_ID_BCM89610, 0xfffffff0 },
981 MODULE_DEVICE_TABLE(mdio, broadcom_tbl);