Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 1 | /* |
| 2 | * drivers/net/phy/broadcom.c |
| 3 | * |
| 4 | * Broadcom BCM5411, BCM5421 and BCM5461 Gigabit Ethernet |
| 5 | * transceivers. |
| 6 | * |
| 7 | * Copyright (c) 2006 Maciej W. Rozycki |
| 8 | * |
| 9 | * Inspired by code written by Amy Fong. |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU General Public License |
| 13 | * as published by the Free Software Foundation; either version |
| 14 | * 2 of the License, or (at your option) any later version. |
| 15 | */ |
| 16 | |
| 17 | #include <linux/module.h> |
| 18 | #include <linux/phy.h> |
| 19 | |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 20 | #define PHY_ID_BCM50610 0x0143bd60 |
Matt Carlson | 4f4598f | 2009-08-25 10:10:30 +0000 | [diff] [blame] | 21 | #define PHY_ID_BCM50610M 0x0143bd70 |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 22 | |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 23 | #define MII_BCM54XX_ECR 0x10 /* BCM54xx extended control register */ |
| 24 | #define MII_BCM54XX_ECR_IM 0x1000 /* Interrupt mask */ |
| 25 | #define MII_BCM54XX_ECR_IF 0x0800 /* Interrupt force */ |
| 26 | |
| 27 | #define MII_BCM54XX_ESR 0x11 /* BCM54xx extended status register */ |
| 28 | #define MII_BCM54XX_ESR_IS 0x1000 /* Interrupt status */ |
| 29 | |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 30 | #define MII_BCM54XX_EXP_DATA 0x15 /* Expansion register data */ |
| 31 | #define MII_BCM54XX_EXP_SEL 0x17 /* Expansion register select */ |
| 32 | #define MII_BCM54XX_EXP_SEL_SSD 0x0e00 /* Secondary SerDes select */ |
| 33 | #define MII_BCM54XX_EXP_SEL_ER 0x0f00 /* Expansion register select */ |
| 34 | |
| 35 | #define MII_BCM54XX_AUX_CTL 0x18 /* Auxiliary control register */ |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 36 | #define MII_BCM54XX_ISR 0x1a /* BCM54xx interrupt status register */ |
| 37 | #define MII_BCM54XX_IMR 0x1b /* BCM54xx interrupt mask register */ |
| 38 | #define MII_BCM54XX_INT_CRCERR 0x0001 /* CRC error */ |
| 39 | #define MII_BCM54XX_INT_LINK 0x0002 /* Link status changed */ |
| 40 | #define MII_BCM54XX_INT_SPEED 0x0004 /* Link speed change */ |
| 41 | #define MII_BCM54XX_INT_DUPLEX 0x0008 /* Duplex mode changed */ |
| 42 | #define MII_BCM54XX_INT_LRS 0x0010 /* Local receiver status changed */ |
| 43 | #define MII_BCM54XX_INT_RRS 0x0020 /* Remote receiver status changed */ |
| 44 | #define MII_BCM54XX_INT_SSERR 0x0040 /* Scrambler synchronization error */ |
| 45 | #define MII_BCM54XX_INT_UHCD 0x0080 /* Unsupported HCD negotiated */ |
| 46 | #define MII_BCM54XX_INT_NHCD 0x0100 /* No HCD */ |
| 47 | #define MII_BCM54XX_INT_NHCDL 0x0200 /* No HCD link */ |
| 48 | #define MII_BCM54XX_INT_ANPR 0x0400 /* Auto-negotiation page received */ |
| 49 | #define MII_BCM54XX_INT_LC 0x0800 /* All counters below 128 */ |
| 50 | #define MII_BCM54XX_INT_HC 0x1000 /* Counter above 32768 */ |
| 51 | #define MII_BCM54XX_INT_MDIX 0x2000 /* MDIX status change */ |
| 52 | #define MII_BCM54XX_INT_PSERR 0x4000 /* Pair swap error */ |
| 53 | |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 54 | #define MII_BCM54XX_SHD 0x1c /* 0x1c shadow registers */ |
| 55 | #define MII_BCM54XX_SHD_WRITE 0x8000 |
| 56 | #define MII_BCM54XX_SHD_VAL(x) ((x & 0x1f) << 10) |
| 57 | #define MII_BCM54XX_SHD_DATA(x) ((x & 0x3ff) << 0) |
| 58 | |
| 59 | /* |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 60 | * AUXILIARY CONTROL SHADOW ACCESS REGISTERS. (PHY REG 0x18) |
| 61 | */ |
| 62 | #define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000 |
| 63 | #define MII_BCM54XX_AUXCTL_ACTL_TX_6DB 0x0400 |
| 64 | #define MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA 0x0800 |
| 65 | |
| 66 | #define MII_BCM54XX_AUXCTL_MISC_WREN 0x8000 |
| 67 | #define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200 |
| 68 | #define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC 0x7000 |
| 69 | #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x0007 |
| 70 | |
| 71 | #define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000 |
| 72 | |
| 73 | |
| 74 | /* |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 75 | * Broadcom LED source encodings. These are used in BCM5461, BCM5481, |
| 76 | * BCM5482, and possibly some others. |
| 77 | */ |
| 78 | #define BCM_LED_SRC_LINKSPD1 0x0 |
| 79 | #define BCM_LED_SRC_LINKSPD2 0x1 |
| 80 | #define BCM_LED_SRC_XMITLED 0x2 |
| 81 | #define BCM_LED_SRC_ACTIVITYLED 0x3 |
| 82 | #define BCM_LED_SRC_FDXLED 0x4 |
| 83 | #define BCM_LED_SRC_SLAVE 0x5 |
| 84 | #define BCM_LED_SRC_INTR 0x6 |
| 85 | #define BCM_LED_SRC_QUALITY 0x7 |
| 86 | #define BCM_LED_SRC_RCVLED 0x8 |
| 87 | #define BCM_LED_SRC_MULTICOLOR1 0xa |
| 88 | #define BCM_LED_SRC_OPENSHORT 0xb |
| 89 | #define BCM_LED_SRC_OFF 0xe /* Tied high */ |
| 90 | #define BCM_LED_SRC_ON 0xf /* Tied low */ |
| 91 | |
| 92 | /* |
| 93 | * BCM5482: Shadow registers |
| 94 | * Shadow values go into bits [14:10] of register 0x1c to select a shadow |
| 95 | * register to access. |
| 96 | */ |
| 97 | #define BCM5482_SHD_LEDS1 0x0d /* 01101: LED Selector 1 */ |
| 98 | /* LED3 / ~LINKSPD[2] selector */ |
| 99 | #define BCM5482_SHD_LEDS1_LED3(src) ((src & 0xf) << 4) |
| 100 | /* LED1 / ~LINKSPD[1] selector */ |
| 101 | #define BCM5482_SHD_LEDS1_LED1(src) ((src & 0xf) << 0) |
| 102 | #define BCM5482_SHD_SSD 0x14 /* 10100: Secondary SerDes control */ |
| 103 | #define BCM5482_SHD_SSD_LEDM 0x0008 /* SSD LED Mode enable */ |
| 104 | #define BCM5482_SHD_SSD_EN 0x0001 /* SSD enable */ |
| 105 | #define BCM5482_SHD_MODE 0x1f /* 11111: Mode Control Register */ |
| 106 | #define BCM5482_SHD_MODE_1000BX 0x0001 /* Enable 1000BASE-X registers */ |
| 107 | |
| 108 | /* |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 109 | * EXPANSION SHADOW ACCESS REGISTERS. (PHY REG 0x15, 0x16, and 0x17) |
| 110 | */ |
| 111 | #define MII_BCM54XX_EXP_AADJ1CH0 0x001f |
| 112 | #define MII_BCM54XX_EXP_AADJ1CH0_SWP_ABCD_OEN 0x0200 |
| 113 | #define MII_BCM54XX_EXP_AADJ1CH0_SWSEL_THPF 0x0100 |
| 114 | #define MII_BCM54XX_EXP_AADJ1CH3 0x601f |
| 115 | #define MII_BCM54XX_EXP_AADJ1CH3_ADCCKADJ 0x0002 |
| 116 | #define MII_BCM54XX_EXP_EXP08 0x0F08 |
| 117 | #define MII_BCM54XX_EXP_EXP08_RJCT_2MHZ 0x0001 |
| 118 | #define MII_BCM54XX_EXP_EXP08_EARLY_DAC_WAKE 0x0200 |
| 119 | #define MII_BCM54XX_EXP_EXP75 0x0f75 |
| 120 | #define MII_BCM54XX_EXP_EXP75_VDACCTRL 0x003c |
| 121 | #define MII_BCM54XX_EXP_EXP96 0x0f96 |
| 122 | #define MII_BCM54XX_EXP_EXP96_MYST 0x0010 |
| 123 | #define MII_BCM54XX_EXP_EXP97 0x0f97 |
| 124 | #define MII_BCM54XX_EXP_EXP97_MYST 0x0c0c |
| 125 | |
| 126 | /* |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 127 | * BCM5482: Secondary SerDes registers |
| 128 | */ |
| 129 | #define BCM5482_SSD_1000BX_CTL 0x00 /* 1000BASE-X Control */ |
| 130 | #define BCM5482_SSD_1000BX_CTL_PWRDOWN 0x0800 /* Power-down SSD */ |
| 131 | #define BCM5482_SSD_SGMII_SLAVE 0x15 /* SGMII Slave Register */ |
| 132 | #define BCM5482_SSD_SGMII_SLAVE_EN 0x0002 /* Slave mode enable */ |
| 133 | #define BCM5482_SSD_SGMII_SLAVE_AD 0x0001 /* Slave auto-detection */ |
| 134 | |
| 135 | /* |
| 136 | * Device flags for PHYs that can be configured for different operating |
| 137 | * modes. |
| 138 | */ |
| 139 | #define PHY_BCM_FLAGS_VALID 0x80000000 |
| 140 | #define PHY_BCM_FLAGS_INTF_XAUI 0x00000020 |
| 141 | #define PHY_BCM_FLAGS_INTF_SGMII 0x00000010 |
| 142 | #define PHY_BCM_FLAGS_MODE_1000BX 0x00000002 |
| 143 | #define PHY_BCM_FLAGS_MODE_COPPER 0x00000001 |
| 144 | |
Matt Carlson | d7a2ed9 | 2009-08-25 10:10:58 +0000 | [diff] [blame^] | 145 | |
| 146 | /*****************************************************************************/ |
| 147 | /* Fast Ethernet Transceiver definitions. */ |
| 148 | /*****************************************************************************/ |
| 149 | |
| 150 | #define MII_BRCM_FET_INTREG 0x1a /* Interrupt register */ |
| 151 | #define MII_BRCM_FET_IR_MASK 0x0100 /* Mask all interrupts */ |
| 152 | #define MII_BRCM_FET_IR_LINK_EN 0x0200 /* Link status change enable */ |
| 153 | #define MII_BRCM_FET_IR_SPEED_EN 0x0400 /* Link speed change enable */ |
| 154 | #define MII_BRCM_FET_IR_DUPLEX_EN 0x0800 /* Duplex mode change enable */ |
| 155 | #define MII_BRCM_FET_IR_ENABLE 0x4000 /* Interrupt enable */ |
| 156 | |
| 157 | #define MII_BRCM_FET_BRCMTEST 0x1f /* Brcm test register */ |
| 158 | #define MII_BRCM_FET_BT_SRE 0x0080 /* Shadow register enable */ |
| 159 | |
| 160 | |
| 161 | /*** Shadow register definitions ***/ |
| 162 | |
| 163 | #define MII_BRCM_FET_SHDW_MISCCTRL 0x10 /* Shadow misc ctrl */ |
| 164 | #define MII_BRCM_FET_SHDW_MC_FAME 0x4000 /* Force Auto MDIX enable */ |
| 165 | |
| 166 | #define MII_BRCM_FET_SHDW_AUXMODE4 0x1a /* Auxiliary mode 4 */ |
| 167 | #define MII_BRCM_FET_SHDW_AM4_LED_MASK 0x0003 |
| 168 | #define MII_BRCM_FET_SHDW_AM4_LED_MODE1 0x0001 |
| 169 | |
| 170 | #define MII_BRCM_FET_SHDW_AUXSTAT2 0x1b /* Auxiliary status 2 */ |
| 171 | #define MII_BRCM_FET_SHDW_AS2_APDE 0x0020 /* Auto power down enable */ |
| 172 | |
| 173 | |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 174 | MODULE_DESCRIPTION("Broadcom PHY driver"); |
| 175 | MODULE_AUTHOR("Maciej W. Rozycki"); |
| 176 | MODULE_LICENSE("GPL"); |
| 177 | |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 178 | /* |
| 179 | * Indirect register access functions for the 1000BASE-T/100BASE-TX/10BASE-T |
| 180 | * 0x1c shadow registers. |
| 181 | */ |
| 182 | static int bcm54xx_shadow_read(struct phy_device *phydev, u16 shadow) |
| 183 | { |
| 184 | phy_write(phydev, MII_BCM54XX_SHD, MII_BCM54XX_SHD_VAL(shadow)); |
| 185 | return MII_BCM54XX_SHD_DATA(phy_read(phydev, MII_BCM54XX_SHD)); |
| 186 | } |
| 187 | |
| 188 | static int bcm54xx_shadow_write(struct phy_device *phydev, u16 shadow, u16 val) |
| 189 | { |
| 190 | return phy_write(phydev, MII_BCM54XX_SHD, |
| 191 | MII_BCM54XX_SHD_WRITE | |
| 192 | MII_BCM54XX_SHD_VAL(shadow) | |
| 193 | MII_BCM54XX_SHD_DATA(val)); |
| 194 | } |
| 195 | |
Matt Carlson | 042a75b | 2008-11-03 16:56:29 -0800 | [diff] [blame] | 196 | /* Indirect register access functions for the Expansion Registers */ |
| 197 | static int bcm54xx_exp_read(struct phy_device *phydev, u8 regnum) |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 198 | { |
| 199 | int val; |
| 200 | |
Matt Carlson | 042a75b | 2008-11-03 16:56:29 -0800 | [diff] [blame] | 201 | val = phy_write(phydev, MII_BCM54XX_EXP_SEL, regnum); |
| 202 | if (val < 0) |
| 203 | return val; |
| 204 | |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 205 | val = phy_read(phydev, MII_BCM54XX_EXP_DATA); |
Matt Carlson | 042a75b | 2008-11-03 16:56:29 -0800 | [diff] [blame] | 206 | |
| 207 | /* Restore default value. It's O.K. if this write fails. */ |
| 208 | phy_write(phydev, MII_BCM54XX_EXP_SEL, 0); |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 209 | |
| 210 | return val; |
| 211 | } |
| 212 | |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 213 | static int bcm54xx_exp_write(struct phy_device *phydev, u16 regnum, u16 val) |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 214 | { |
| 215 | int ret; |
| 216 | |
Matt Carlson | 042a75b | 2008-11-03 16:56:29 -0800 | [diff] [blame] | 217 | ret = phy_write(phydev, MII_BCM54XX_EXP_SEL, regnum); |
| 218 | if (ret < 0) |
| 219 | return ret; |
| 220 | |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 221 | ret = phy_write(phydev, MII_BCM54XX_EXP_DATA, val); |
Matt Carlson | 042a75b | 2008-11-03 16:56:29 -0800 | [diff] [blame] | 222 | |
| 223 | /* Restore default value. It's O.K. if this write fails. */ |
| 224 | phy_write(phydev, MII_BCM54XX_EXP_SEL, 0); |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 225 | |
| 226 | return ret; |
| 227 | } |
| 228 | |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 229 | static int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val) |
| 230 | { |
| 231 | return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val); |
| 232 | } |
| 233 | |
| 234 | static int bcm50610_a0_workaround(struct phy_device *phydev) |
| 235 | { |
| 236 | int err; |
| 237 | |
| 238 | err = bcm54xx_auxctl_write(phydev, |
| 239 | MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL, |
| 240 | MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA | |
| 241 | MII_BCM54XX_AUXCTL_ACTL_TX_6DB); |
| 242 | if (err < 0) |
| 243 | return err; |
| 244 | |
| 245 | err = bcm54xx_exp_write(phydev, MII_BCM54XX_EXP_EXP08, |
| 246 | MII_BCM54XX_EXP_EXP08_RJCT_2MHZ | |
| 247 | MII_BCM54XX_EXP_EXP08_EARLY_DAC_WAKE); |
| 248 | if (err < 0) |
| 249 | goto error; |
| 250 | |
| 251 | err = bcm54xx_exp_write(phydev, MII_BCM54XX_EXP_AADJ1CH0, |
| 252 | MII_BCM54XX_EXP_AADJ1CH0_SWP_ABCD_OEN | |
| 253 | MII_BCM54XX_EXP_AADJ1CH0_SWSEL_THPF); |
| 254 | if (err < 0) |
| 255 | goto error; |
| 256 | |
| 257 | err = bcm54xx_exp_write(phydev, MII_BCM54XX_EXP_AADJ1CH3, |
| 258 | MII_BCM54XX_EXP_AADJ1CH3_ADCCKADJ); |
| 259 | if (err < 0) |
| 260 | goto error; |
| 261 | |
| 262 | err = bcm54xx_exp_write(phydev, MII_BCM54XX_EXP_EXP75, |
| 263 | MII_BCM54XX_EXP_EXP75_VDACCTRL); |
| 264 | if (err < 0) |
| 265 | goto error; |
| 266 | |
| 267 | err = bcm54xx_exp_write(phydev, MII_BCM54XX_EXP_EXP96, |
| 268 | MII_BCM54XX_EXP_EXP96_MYST); |
| 269 | if (err < 0) |
| 270 | goto error; |
| 271 | |
| 272 | err = bcm54xx_exp_write(phydev, MII_BCM54XX_EXP_EXP97, |
| 273 | MII_BCM54XX_EXP_EXP97_MYST); |
| 274 | |
| 275 | error: |
| 276 | bcm54xx_auxctl_write(phydev, |
| 277 | MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL, |
| 278 | MII_BCM54XX_AUXCTL_ACTL_TX_6DB); |
| 279 | |
| 280 | return err; |
| 281 | } |
| 282 | |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 283 | static int bcm54xx_config_init(struct phy_device *phydev) |
| 284 | { |
| 285 | int reg, err; |
| 286 | |
| 287 | reg = phy_read(phydev, MII_BCM54XX_ECR); |
| 288 | if (reg < 0) |
| 289 | return reg; |
| 290 | |
| 291 | /* Mask interrupts globally. */ |
| 292 | reg |= MII_BCM54XX_ECR_IM; |
| 293 | err = phy_write(phydev, MII_BCM54XX_ECR, reg); |
| 294 | if (err < 0) |
| 295 | return err; |
| 296 | |
| 297 | /* Unmask events we are interested in. */ |
| 298 | reg = ~(MII_BCM54XX_INT_DUPLEX | |
| 299 | MII_BCM54XX_INT_SPEED | |
| 300 | MII_BCM54XX_INT_LINK); |
| 301 | err = phy_write(phydev, MII_BCM54XX_IMR, reg); |
| 302 | if (err < 0) |
| 303 | return err; |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 304 | |
| 305 | if (phydev->drv->phy_id == PHY_ID_BCM50610) { |
| 306 | err = bcm50610_a0_workaround(phydev); |
| 307 | if (err < 0) |
| 308 | return err; |
| 309 | } |
| 310 | |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 311 | return 0; |
| 312 | } |
| 313 | |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 314 | static int bcm5482_config_init(struct phy_device *phydev) |
| 315 | { |
| 316 | int err, reg; |
| 317 | |
| 318 | err = bcm54xx_config_init(phydev); |
| 319 | |
| 320 | if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) { |
| 321 | /* |
| 322 | * Enable secondary SerDes and its use as an LED source |
| 323 | */ |
| 324 | reg = bcm54xx_shadow_read(phydev, BCM5482_SHD_SSD); |
| 325 | bcm54xx_shadow_write(phydev, BCM5482_SHD_SSD, |
| 326 | reg | |
| 327 | BCM5482_SHD_SSD_LEDM | |
| 328 | BCM5482_SHD_SSD_EN); |
| 329 | |
| 330 | /* |
| 331 | * Enable SGMII slave mode and auto-detection |
| 332 | */ |
Matt Carlson | 042a75b | 2008-11-03 16:56:29 -0800 | [diff] [blame] | 333 | reg = BCM5482_SSD_SGMII_SLAVE | MII_BCM54XX_EXP_SEL_SSD; |
| 334 | err = bcm54xx_exp_read(phydev, reg); |
| 335 | if (err < 0) |
| 336 | return err; |
| 337 | err = bcm54xx_exp_write(phydev, reg, err | |
| 338 | BCM5482_SSD_SGMII_SLAVE_EN | |
| 339 | BCM5482_SSD_SGMII_SLAVE_AD); |
| 340 | if (err < 0) |
| 341 | return err; |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 342 | |
| 343 | /* |
| 344 | * Disable secondary SerDes powerdown |
| 345 | */ |
Matt Carlson | 042a75b | 2008-11-03 16:56:29 -0800 | [diff] [blame] | 346 | reg = BCM5482_SSD_1000BX_CTL | MII_BCM54XX_EXP_SEL_SSD; |
| 347 | err = bcm54xx_exp_read(phydev, reg); |
| 348 | if (err < 0) |
| 349 | return err; |
| 350 | err = bcm54xx_exp_write(phydev, reg, |
| 351 | err & ~BCM5482_SSD_1000BX_CTL_PWRDOWN); |
| 352 | if (err < 0) |
| 353 | return err; |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 354 | |
| 355 | /* |
| 356 | * Select 1000BASE-X register set (primary SerDes) |
| 357 | */ |
| 358 | reg = bcm54xx_shadow_read(phydev, BCM5482_SHD_MODE); |
| 359 | bcm54xx_shadow_write(phydev, BCM5482_SHD_MODE, |
| 360 | reg | BCM5482_SHD_MODE_1000BX); |
| 361 | |
| 362 | /* |
| 363 | * LED1=ACTIVITYLED, LED3=LINKSPD[2] |
| 364 | * (Use LED1 as secondary SerDes ACTIVITY LED) |
| 365 | */ |
| 366 | bcm54xx_shadow_write(phydev, BCM5482_SHD_LEDS1, |
| 367 | BCM5482_SHD_LEDS1_LED1(BCM_LED_SRC_ACTIVITYLED) | |
| 368 | BCM5482_SHD_LEDS1_LED3(BCM_LED_SRC_LINKSPD2)); |
| 369 | |
| 370 | /* |
| 371 | * Auto-negotiation doesn't seem to work quite right |
| 372 | * in this mode, so we disable it and force it to the |
| 373 | * right speed/duplex setting. Only 'link status' |
| 374 | * is important. |
| 375 | */ |
| 376 | phydev->autoneg = AUTONEG_DISABLE; |
| 377 | phydev->speed = SPEED_1000; |
| 378 | phydev->duplex = DUPLEX_FULL; |
| 379 | } |
| 380 | |
| 381 | return err; |
| 382 | } |
| 383 | |
| 384 | static int bcm5482_read_status(struct phy_device *phydev) |
| 385 | { |
| 386 | int err; |
| 387 | |
| 388 | err = genphy_read_status(phydev); |
| 389 | |
| 390 | if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) { |
| 391 | /* |
| 392 | * Only link status matters for 1000Base-X mode, so force |
| 393 | * 1000 Mbit/s full-duplex status |
| 394 | */ |
| 395 | if (phydev->link) { |
| 396 | phydev->speed = SPEED_1000; |
| 397 | phydev->duplex = DUPLEX_FULL; |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | return err; |
| 402 | } |
| 403 | |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 404 | static int bcm54xx_ack_interrupt(struct phy_device *phydev) |
| 405 | { |
| 406 | int reg; |
| 407 | |
| 408 | /* Clear pending interrupts. */ |
| 409 | reg = phy_read(phydev, MII_BCM54XX_ISR); |
| 410 | if (reg < 0) |
| 411 | return reg; |
| 412 | |
| 413 | return 0; |
| 414 | } |
| 415 | |
| 416 | static int bcm54xx_config_intr(struct phy_device *phydev) |
| 417 | { |
| 418 | int reg, err; |
| 419 | |
| 420 | reg = phy_read(phydev, MII_BCM54XX_ECR); |
| 421 | if (reg < 0) |
| 422 | return reg; |
| 423 | |
| 424 | if (phydev->interrupts == PHY_INTERRUPT_ENABLED) |
| 425 | reg &= ~MII_BCM54XX_ECR_IM; |
| 426 | else |
| 427 | reg |= MII_BCM54XX_ECR_IM; |
| 428 | |
| 429 | err = phy_write(phydev, MII_BCM54XX_ECR, reg); |
| 430 | return err; |
| 431 | } |
| 432 | |
Anton Vorontsov | 57bb7e2 | 2008-03-04 19:41:32 +0300 | [diff] [blame] | 433 | static int bcm5481_config_aneg(struct phy_device *phydev) |
| 434 | { |
| 435 | int ret; |
| 436 | |
| 437 | /* Aneg firsly. */ |
| 438 | ret = genphy_config_aneg(phydev); |
| 439 | |
| 440 | /* Then we can set up the delay. */ |
| 441 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { |
| 442 | u16 reg; |
| 443 | |
| 444 | /* |
| 445 | * There is no BCM5481 specification available, so down |
| 446 | * here is everything we know about "register 0x18". This |
| 447 | * at least helps BCM5481 to successfuly receive packets |
| 448 | * on MPC8360E-RDK board. Peter Barada <peterb@logicpd.com> |
| 449 | * says: "This sets delay between the RXD and RXC signals |
| 450 | * instead of using trace lengths to achieve timing". |
| 451 | */ |
| 452 | |
| 453 | /* Set RDX clk delay. */ |
| 454 | reg = 0x7 | (0x7 << 12); |
| 455 | phy_write(phydev, 0x18, reg); |
| 456 | |
| 457 | reg = phy_read(phydev, 0x18); |
| 458 | /* Set RDX-RXC skew. */ |
| 459 | reg |= (1 << 8); |
| 460 | /* Write bits 14:0. */ |
| 461 | reg |= (1 << 15); |
| 462 | phy_write(phydev, 0x18, reg); |
| 463 | } |
| 464 | |
| 465 | return ret; |
| 466 | } |
| 467 | |
Matt Carlson | d7a2ed9 | 2009-08-25 10:10:58 +0000 | [diff] [blame^] | 468 | static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set) |
| 469 | { |
| 470 | int val; |
| 471 | |
| 472 | val = phy_read(phydev, reg); |
| 473 | if (val < 0) |
| 474 | return val; |
| 475 | |
| 476 | return phy_write(phydev, reg, val | set); |
| 477 | } |
| 478 | |
| 479 | static int brcm_fet_config_init(struct phy_device *phydev) |
| 480 | { |
| 481 | int reg, err, err2, brcmtest; |
| 482 | |
| 483 | /* Reset the PHY to bring it to a known state. */ |
| 484 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); |
| 485 | if (err < 0) |
| 486 | return err; |
| 487 | |
| 488 | reg = phy_read(phydev, MII_BRCM_FET_INTREG); |
| 489 | if (reg < 0) |
| 490 | return reg; |
| 491 | |
| 492 | /* Unmask events we are interested in and mask interrupts globally. */ |
| 493 | reg = MII_BRCM_FET_IR_DUPLEX_EN | |
| 494 | MII_BRCM_FET_IR_SPEED_EN | |
| 495 | MII_BRCM_FET_IR_LINK_EN | |
| 496 | MII_BRCM_FET_IR_ENABLE | |
| 497 | MII_BRCM_FET_IR_MASK; |
| 498 | |
| 499 | err = phy_write(phydev, MII_BRCM_FET_INTREG, reg); |
| 500 | if (err < 0) |
| 501 | return err; |
| 502 | |
| 503 | /* Enable shadow register access */ |
| 504 | brcmtest = phy_read(phydev, MII_BRCM_FET_BRCMTEST); |
| 505 | if (brcmtest < 0) |
| 506 | return brcmtest; |
| 507 | |
| 508 | reg = brcmtest | MII_BRCM_FET_BT_SRE; |
| 509 | |
| 510 | err = phy_write(phydev, MII_BRCM_FET_BRCMTEST, reg); |
| 511 | if (err < 0) |
| 512 | return err; |
| 513 | |
| 514 | /* Set the LED mode */ |
| 515 | reg = phy_read(phydev, MII_BRCM_FET_SHDW_AUXMODE4); |
| 516 | if (reg < 0) { |
| 517 | err = reg; |
| 518 | goto done; |
| 519 | } |
| 520 | |
| 521 | reg &= ~MII_BRCM_FET_SHDW_AM4_LED_MASK; |
| 522 | reg |= MII_BRCM_FET_SHDW_AM4_LED_MODE1; |
| 523 | |
| 524 | err = phy_write(phydev, MII_BRCM_FET_SHDW_AUXMODE4, reg); |
| 525 | if (err < 0) |
| 526 | goto done; |
| 527 | |
| 528 | /* Enable auto MDIX */ |
| 529 | err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_MISCCTRL, |
| 530 | MII_BRCM_FET_SHDW_MC_FAME); |
| 531 | if (err < 0) |
| 532 | goto done; |
| 533 | |
| 534 | /* Enable auto power down */ |
| 535 | err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2, |
| 536 | MII_BRCM_FET_SHDW_AS2_APDE); |
| 537 | |
| 538 | done: |
| 539 | /* Disable shadow register access */ |
| 540 | err2 = phy_write(phydev, MII_BRCM_FET_BRCMTEST, brcmtest); |
| 541 | if (!err) |
| 542 | err = err2; |
| 543 | |
| 544 | return err; |
| 545 | } |
| 546 | |
| 547 | static int brcm_fet_ack_interrupt(struct phy_device *phydev) |
| 548 | { |
| 549 | int reg; |
| 550 | |
| 551 | /* Clear pending interrupts. */ |
| 552 | reg = phy_read(phydev, MII_BRCM_FET_INTREG); |
| 553 | if (reg < 0) |
| 554 | return reg; |
| 555 | |
| 556 | return 0; |
| 557 | } |
| 558 | |
| 559 | static int brcm_fet_config_intr(struct phy_device *phydev) |
| 560 | { |
| 561 | int reg, err; |
| 562 | |
| 563 | reg = phy_read(phydev, MII_BRCM_FET_INTREG); |
| 564 | if (reg < 0) |
| 565 | return reg; |
| 566 | |
| 567 | if (phydev->interrupts == PHY_INTERRUPT_ENABLED) |
| 568 | reg &= ~MII_BRCM_FET_IR_MASK; |
| 569 | else |
| 570 | reg |= MII_BRCM_FET_IR_MASK; |
| 571 | |
| 572 | err = phy_write(phydev, MII_BRCM_FET_INTREG, reg); |
| 573 | return err; |
| 574 | } |
| 575 | |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 576 | static struct phy_driver bcm5411_driver = { |
| 577 | .phy_id = 0x00206070, |
| 578 | .phy_id_mask = 0xfffffff0, |
| 579 | .name = "Broadcom BCM5411", |
Matt Carlson | 5e0c676 | 2008-11-03 16:56:07 -0800 | [diff] [blame] | 580 | .features = PHY_GBIT_FEATURES | |
| 581 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 582 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 583 | .config_init = bcm54xx_config_init, |
| 584 | .config_aneg = genphy_config_aneg, |
| 585 | .read_status = genphy_read_status, |
| 586 | .ack_interrupt = bcm54xx_ack_interrupt, |
| 587 | .config_intr = bcm54xx_config_intr, |
Matt Carlson | 4f4598f | 2009-08-25 10:10:30 +0000 | [diff] [blame] | 588 | .driver = { .owner = THIS_MODULE }, |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 589 | }; |
| 590 | |
| 591 | static struct phy_driver bcm5421_driver = { |
| 592 | .phy_id = 0x002060e0, |
| 593 | .phy_id_mask = 0xfffffff0, |
| 594 | .name = "Broadcom BCM5421", |
Matt Carlson | 5e0c676 | 2008-11-03 16:56:07 -0800 | [diff] [blame] | 595 | .features = PHY_GBIT_FEATURES | |
| 596 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 597 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 598 | .config_init = bcm54xx_config_init, |
| 599 | .config_aneg = genphy_config_aneg, |
| 600 | .read_status = genphy_read_status, |
| 601 | .ack_interrupt = bcm54xx_ack_interrupt, |
| 602 | .config_intr = bcm54xx_config_intr, |
Matt Carlson | 4f4598f | 2009-08-25 10:10:30 +0000 | [diff] [blame] | 603 | .driver = { .owner = THIS_MODULE }, |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 604 | }; |
| 605 | |
| 606 | static struct phy_driver bcm5461_driver = { |
| 607 | .phy_id = 0x002060c0, |
| 608 | .phy_id_mask = 0xfffffff0, |
| 609 | .name = "Broadcom BCM5461", |
Matt Carlson | 5e0c676 | 2008-11-03 16:56:07 -0800 | [diff] [blame] | 610 | .features = PHY_GBIT_FEATURES | |
| 611 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 612 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 613 | .config_init = bcm54xx_config_init, |
| 614 | .config_aneg = genphy_config_aneg, |
| 615 | .read_status = genphy_read_status, |
| 616 | .ack_interrupt = bcm54xx_ack_interrupt, |
| 617 | .config_intr = bcm54xx_config_intr, |
Matt Carlson | 4f4598f | 2009-08-25 10:10:30 +0000 | [diff] [blame] | 618 | .driver = { .owner = THIS_MODULE }, |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 619 | }; |
| 620 | |
Paul Gortmaker | b1394f9 | 2008-04-14 23:35:41 -0400 | [diff] [blame] | 621 | static struct phy_driver bcm5464_driver = { |
| 622 | .phy_id = 0x002060b0, |
| 623 | .phy_id_mask = 0xfffffff0, |
| 624 | .name = "Broadcom BCM5464", |
Matt Carlson | 5e0c676 | 2008-11-03 16:56:07 -0800 | [diff] [blame] | 625 | .features = PHY_GBIT_FEATURES | |
| 626 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, |
Paul Gortmaker | b1394f9 | 2008-04-14 23:35:41 -0400 | [diff] [blame] | 627 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 628 | .config_init = bcm54xx_config_init, |
| 629 | .config_aneg = genphy_config_aneg, |
| 630 | .read_status = genphy_read_status, |
| 631 | .ack_interrupt = bcm54xx_ack_interrupt, |
| 632 | .config_intr = bcm54xx_config_intr, |
Matt Carlson | 4f4598f | 2009-08-25 10:10:30 +0000 | [diff] [blame] | 633 | .driver = { .owner = THIS_MODULE }, |
Paul Gortmaker | b1394f9 | 2008-04-14 23:35:41 -0400 | [diff] [blame] | 634 | }; |
| 635 | |
Anton Vorontsov | 57bb7e2 | 2008-03-04 19:41:32 +0300 | [diff] [blame] | 636 | static struct phy_driver bcm5481_driver = { |
| 637 | .phy_id = 0x0143bca0, |
| 638 | .phy_id_mask = 0xfffffff0, |
| 639 | .name = "Broadcom BCM5481", |
Matt Carlson | 5e0c676 | 2008-11-03 16:56:07 -0800 | [diff] [blame] | 640 | .features = PHY_GBIT_FEATURES | |
| 641 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, |
Anton Vorontsov | 57bb7e2 | 2008-03-04 19:41:32 +0300 | [diff] [blame] | 642 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 643 | .config_init = bcm54xx_config_init, |
| 644 | .config_aneg = bcm5481_config_aneg, |
| 645 | .read_status = genphy_read_status, |
| 646 | .ack_interrupt = bcm54xx_ack_interrupt, |
| 647 | .config_intr = bcm54xx_config_intr, |
Matt Carlson | 4f4598f | 2009-08-25 10:10:30 +0000 | [diff] [blame] | 648 | .driver = { .owner = THIS_MODULE }, |
Anton Vorontsov | 57bb7e2 | 2008-03-04 19:41:32 +0300 | [diff] [blame] | 649 | }; |
| 650 | |
Nate Case | 03157ac | 2008-01-29 10:19:00 -0600 | [diff] [blame] | 651 | static struct phy_driver bcm5482_driver = { |
Anton Vorontsov | 57bb7e2 | 2008-03-04 19:41:32 +0300 | [diff] [blame] | 652 | .phy_id = 0x0143bcb0, |
Nate Case | 03157ac | 2008-01-29 10:19:00 -0600 | [diff] [blame] | 653 | .phy_id_mask = 0xfffffff0, |
| 654 | .name = "Broadcom BCM5482", |
Matt Carlson | 5e0c676 | 2008-11-03 16:56:07 -0800 | [diff] [blame] | 655 | .features = PHY_GBIT_FEATURES | |
| 656 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, |
Nate Case | 03157ac | 2008-01-29 10:19:00 -0600 | [diff] [blame] | 657 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 658 | .config_init = bcm5482_config_init, |
Nate Case | 03157ac | 2008-01-29 10:19:00 -0600 | [diff] [blame] | 659 | .config_aneg = genphy_config_aneg, |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 660 | .read_status = bcm5482_read_status, |
Nate Case | 03157ac | 2008-01-29 10:19:00 -0600 | [diff] [blame] | 661 | .ack_interrupt = bcm54xx_ack_interrupt, |
| 662 | .config_intr = bcm54xx_config_intr, |
Matt Carlson | 4f4598f | 2009-08-25 10:10:30 +0000 | [diff] [blame] | 663 | .driver = { .owner = THIS_MODULE }, |
Nate Case | 03157ac | 2008-01-29 10:19:00 -0600 | [diff] [blame] | 664 | }; |
| 665 | |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 666 | static struct phy_driver bcm50610_driver = { |
| 667 | .phy_id = PHY_ID_BCM50610, |
| 668 | .phy_id_mask = 0xfffffff0, |
| 669 | .name = "Broadcom BCM50610", |
| 670 | .features = PHY_GBIT_FEATURES | |
| 671 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, |
| 672 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 673 | .config_init = bcm54xx_config_init, |
| 674 | .config_aneg = genphy_config_aneg, |
| 675 | .read_status = genphy_read_status, |
| 676 | .ack_interrupt = bcm54xx_ack_interrupt, |
| 677 | .config_intr = bcm54xx_config_intr, |
Matt Carlson | 4f4598f | 2009-08-25 10:10:30 +0000 | [diff] [blame] | 678 | .driver = { .owner = THIS_MODULE }, |
| 679 | }; |
| 680 | |
| 681 | static struct phy_driver bcm50610m_driver = { |
| 682 | .phy_id = PHY_ID_BCM50610M, |
| 683 | .phy_id_mask = 0xfffffff0, |
| 684 | .name = "Broadcom BCM50610M", |
| 685 | .features = PHY_GBIT_FEATURES | |
| 686 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, |
| 687 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 688 | .config_init = bcm54xx_config_init, |
| 689 | .config_aneg = genphy_config_aneg, |
| 690 | .read_status = genphy_read_status, |
| 691 | .ack_interrupt = bcm54xx_ack_interrupt, |
| 692 | .config_intr = bcm54xx_config_intr, |
| 693 | .driver = { .owner = THIS_MODULE }, |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 694 | }; |
| 695 | |
Matt Carlson | 2fbb69a | 2008-11-21 17:22:53 -0800 | [diff] [blame] | 696 | static struct phy_driver bcm57780_driver = { |
| 697 | .phy_id = 0x03625d90, |
| 698 | .phy_id_mask = 0xfffffff0, |
| 699 | .name = "Broadcom BCM57780", |
| 700 | .features = PHY_GBIT_FEATURES | |
| 701 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, |
| 702 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 703 | .config_init = bcm54xx_config_init, |
| 704 | .config_aneg = genphy_config_aneg, |
| 705 | .read_status = genphy_read_status, |
| 706 | .ack_interrupt = bcm54xx_ack_interrupt, |
| 707 | .config_intr = bcm54xx_config_intr, |
Matt Carlson | 4f4598f | 2009-08-25 10:10:30 +0000 | [diff] [blame] | 708 | .driver = { .owner = THIS_MODULE }, |
Matt Carlson | 2fbb69a | 2008-11-21 17:22:53 -0800 | [diff] [blame] | 709 | }; |
| 710 | |
Matt Carlson | d7a2ed9 | 2009-08-25 10:10:58 +0000 | [diff] [blame^] | 711 | static struct phy_driver bcmac131_driver = { |
| 712 | .phy_id = 0x0143bc70, |
| 713 | .phy_id_mask = 0xfffffff0, |
| 714 | .name = "Broadcom BCMAC131", |
| 715 | .features = PHY_BASIC_FEATURES | |
| 716 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, |
| 717 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 718 | .config_init = brcm_fet_config_init, |
| 719 | .config_aneg = genphy_config_aneg, |
| 720 | .read_status = genphy_read_status, |
| 721 | .ack_interrupt = brcm_fet_ack_interrupt, |
| 722 | .config_intr = brcm_fet_config_intr, |
| 723 | .driver = { .owner = THIS_MODULE }, |
| 724 | }; |
| 725 | |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 726 | static int __init broadcom_init(void) |
| 727 | { |
| 728 | int ret; |
| 729 | |
| 730 | ret = phy_driver_register(&bcm5411_driver); |
| 731 | if (ret) |
| 732 | goto out_5411; |
| 733 | ret = phy_driver_register(&bcm5421_driver); |
| 734 | if (ret) |
| 735 | goto out_5421; |
| 736 | ret = phy_driver_register(&bcm5461_driver); |
| 737 | if (ret) |
| 738 | goto out_5461; |
Paul Gortmaker | b1394f9 | 2008-04-14 23:35:41 -0400 | [diff] [blame] | 739 | ret = phy_driver_register(&bcm5464_driver); |
| 740 | if (ret) |
| 741 | goto out_5464; |
Anton Vorontsov | 57bb7e2 | 2008-03-04 19:41:32 +0300 | [diff] [blame] | 742 | ret = phy_driver_register(&bcm5481_driver); |
| 743 | if (ret) |
| 744 | goto out_5481; |
Nate Case | 03157ac | 2008-01-29 10:19:00 -0600 | [diff] [blame] | 745 | ret = phy_driver_register(&bcm5482_driver); |
| 746 | if (ret) |
| 747 | goto out_5482; |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 748 | ret = phy_driver_register(&bcm50610_driver); |
| 749 | if (ret) |
| 750 | goto out_50610; |
Matt Carlson | 4f4598f | 2009-08-25 10:10:30 +0000 | [diff] [blame] | 751 | ret = phy_driver_register(&bcm50610m_driver); |
| 752 | if (ret) |
| 753 | goto out_50610m; |
Matt Carlson | 2fbb69a | 2008-11-21 17:22:53 -0800 | [diff] [blame] | 754 | ret = phy_driver_register(&bcm57780_driver); |
| 755 | if (ret) |
| 756 | goto out_57780; |
Matt Carlson | d7a2ed9 | 2009-08-25 10:10:58 +0000 | [diff] [blame^] | 757 | ret = phy_driver_register(&bcmac131_driver); |
| 758 | if (ret) |
| 759 | goto out_ac131; |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 760 | return ret; |
| 761 | |
Matt Carlson | d7a2ed9 | 2009-08-25 10:10:58 +0000 | [diff] [blame^] | 762 | out_ac131: |
| 763 | phy_driver_unregister(&bcm57780_driver); |
Matt Carlson | 2fbb69a | 2008-11-21 17:22:53 -0800 | [diff] [blame] | 764 | out_57780: |
Matt Carlson | 4f4598f | 2009-08-25 10:10:30 +0000 | [diff] [blame] | 765 | phy_driver_unregister(&bcm50610m_driver); |
| 766 | out_50610m: |
Matt Carlson | 2fbb69a | 2008-11-21 17:22:53 -0800 | [diff] [blame] | 767 | phy_driver_unregister(&bcm50610_driver); |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 768 | out_50610: |
| 769 | phy_driver_unregister(&bcm5482_driver); |
Nate Case | 03157ac | 2008-01-29 10:19:00 -0600 | [diff] [blame] | 770 | out_5482: |
Anton Vorontsov | 57bb7e2 | 2008-03-04 19:41:32 +0300 | [diff] [blame] | 771 | phy_driver_unregister(&bcm5481_driver); |
| 772 | out_5481: |
Paul Gortmaker | b1394f9 | 2008-04-14 23:35:41 -0400 | [diff] [blame] | 773 | phy_driver_unregister(&bcm5464_driver); |
| 774 | out_5464: |
Nate Case | 03157ac | 2008-01-29 10:19:00 -0600 | [diff] [blame] | 775 | phy_driver_unregister(&bcm5461_driver); |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 776 | out_5461: |
| 777 | phy_driver_unregister(&bcm5421_driver); |
| 778 | out_5421: |
| 779 | phy_driver_unregister(&bcm5411_driver); |
| 780 | out_5411: |
| 781 | return ret; |
| 782 | } |
| 783 | |
| 784 | static void __exit broadcom_exit(void) |
| 785 | { |
Matt Carlson | d7a2ed9 | 2009-08-25 10:10:58 +0000 | [diff] [blame^] | 786 | phy_driver_unregister(&bcmac131_driver); |
Matt Carlson | 2fbb69a | 2008-11-21 17:22:53 -0800 | [diff] [blame] | 787 | phy_driver_unregister(&bcm57780_driver); |
Matt Carlson | 4f4598f | 2009-08-25 10:10:30 +0000 | [diff] [blame] | 788 | phy_driver_unregister(&bcm50610m_driver); |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 789 | phy_driver_unregister(&bcm50610_driver); |
Nate Case | 03157ac | 2008-01-29 10:19:00 -0600 | [diff] [blame] | 790 | phy_driver_unregister(&bcm5482_driver); |
Anton Vorontsov | 57bb7e2 | 2008-03-04 19:41:32 +0300 | [diff] [blame] | 791 | phy_driver_unregister(&bcm5481_driver); |
Paul Gortmaker | b1394f9 | 2008-04-14 23:35:41 -0400 | [diff] [blame] | 792 | phy_driver_unregister(&bcm5464_driver); |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 793 | phy_driver_unregister(&bcm5461_driver); |
| 794 | phy_driver_unregister(&bcm5421_driver); |
| 795 | phy_driver_unregister(&bcm5411_driver); |
| 796 | } |
| 797 | |
| 798 | module_init(broadcom_init); |
| 799 | module_exit(broadcom_exit); |