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 | |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 17 | #include "bcm-phy-lib.h" |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 18 | #include <linux/module.h> |
| 19 | #include <linux/phy.h> |
Matt Carlson | 8649f13 | 2009-11-02 14:30:00 +0000 | [diff] [blame] | 20 | #include <linux/brcmphy.h> |
Jon Mason | b14995a | 2016-11-04 01:10:58 -0400 | [diff] [blame] | 21 | #include <linux/of.h> |
Matt Carlson | d9221e6 | 2009-08-25 10:11:26 +0000 | [diff] [blame] | 22 | |
| 23 | #define BRCM_PHY_MODEL(phydev) \ |
| 24 | ((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask) |
| 25 | |
Matt Carlson | 32e5a8d | 2009-11-02 14:31:39 +0000 | [diff] [blame] | 26 | #define BRCM_PHY_REV(phydev) \ |
| 27 | ((phydev)->drv->phy_id & ~((phydev)->drv->phy_id_mask)) |
| 28 | |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 29 | MODULE_DESCRIPTION("Broadcom PHY driver"); |
| 30 | MODULE_AUTHOR("Maciej W. Rozycki"); |
| 31 | MODULE_LICENSE("GPL"); |
| 32 | |
Rafał Miłecki | 0fc9ae1 | 2017-01-27 14:07:01 +0100 | [diff] [blame^] | 33 | static int bcm54210e_config_init(struct phy_device *phydev) |
| 34 | { |
| 35 | int val; |
| 36 | |
| 37 | val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC); |
| 38 | val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN; |
| 39 | val |= MII_BCM54XX_AUXCTL_MISC_WREN; |
| 40 | bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, val); |
| 41 | |
| 42 | val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL); |
| 43 | val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN; |
| 44 | bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val); |
| 45 | |
| 46 | return 0; |
| 47 | } |
| 48 | |
Jon Mason | b14995a | 2016-11-04 01:10:58 -0400 | [diff] [blame] | 49 | static int bcm54810_config(struct phy_device *phydev) |
| 50 | { |
| 51 | int rc, val; |
| 52 | |
| 53 | val = bcm_phy_read_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL); |
| 54 | val &= ~BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN; |
| 55 | rc = bcm_phy_write_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL, |
| 56 | val); |
| 57 | if (rc < 0) |
| 58 | return rc; |
| 59 | |
| 60 | val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC); |
| 61 | val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN; |
| 62 | val |= MII_BCM54XX_AUXCTL_MISC_WREN; |
| 63 | rc = bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, |
| 64 | val); |
| 65 | if (rc < 0) |
| 66 | return rc; |
| 67 | |
| 68 | val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL); |
| 69 | val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN; |
| 70 | rc = bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val); |
| 71 | if (rc < 0) |
| 72 | return rc; |
| 73 | |
| 74 | return 0; |
| 75 | } |
| 76 | |
Matt Carlson | 47b1b53 | 2009-11-02 14:28:04 +0000 | [diff] [blame] | 77 | /* Needs SMDSP clock enabled via bcm54xx_phydsp_config() */ |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 78 | static int bcm50610_a0_workaround(struct phy_device *phydev) |
| 79 | { |
| 80 | int err; |
| 81 | |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 82 | err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_AADJ1CH0, |
Matt Carlson | 47b1b53 | 2009-11-02 14:28:04 +0000 | [diff] [blame] | 83 | MII_BCM54XX_EXP_AADJ1CH0_SWP_ABCD_OEN | |
| 84 | MII_BCM54XX_EXP_AADJ1CH0_SWSEL_THPF); |
| 85 | if (err < 0) |
| 86 | return err; |
| 87 | |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 88 | err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_AADJ1CH3, |
| 89 | MII_BCM54XX_EXP_AADJ1CH3_ADCCKADJ); |
Matt Carlson | 47b1b53 | 2009-11-02 14:28:04 +0000 | [diff] [blame] | 90 | if (err < 0) |
| 91 | return err; |
| 92 | |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 93 | err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP75, |
Matt Carlson | 47b1b53 | 2009-11-02 14:28:04 +0000 | [diff] [blame] | 94 | MII_BCM54XX_EXP_EXP75_VDACCTRL); |
| 95 | if (err < 0) |
| 96 | return err; |
| 97 | |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 98 | err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP96, |
Matt Carlson | 47b1b53 | 2009-11-02 14:28:04 +0000 | [diff] [blame] | 99 | MII_BCM54XX_EXP_EXP96_MYST); |
| 100 | if (err < 0) |
| 101 | return err; |
| 102 | |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 103 | err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP97, |
Matt Carlson | 47b1b53 | 2009-11-02 14:28:04 +0000 | [diff] [blame] | 104 | MII_BCM54XX_EXP_EXP97_MYST); |
| 105 | |
| 106 | return err; |
| 107 | } |
| 108 | |
| 109 | static int bcm54xx_phydsp_config(struct phy_device *phydev) |
| 110 | { |
| 111 | int err, err2; |
| 112 | |
| 113 | /* Enable the SMDSP clock */ |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 114 | err = bcm54xx_auxctl_write(phydev, |
| 115 | MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL, |
| 116 | MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA | |
| 117 | MII_BCM54XX_AUXCTL_ACTL_TX_6DB); |
| 118 | if (err < 0) |
| 119 | return err; |
| 120 | |
Matt Carlson | 219c6ef | 2009-11-02 14:28:33 +0000 | [diff] [blame] | 121 | if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 || |
| 122 | BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) { |
| 123 | /* Clear bit 9 to fix a phy interop issue. */ |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 124 | err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP08, |
Matt Carlson | 219c6ef | 2009-11-02 14:28:33 +0000 | [diff] [blame] | 125 | MII_BCM54XX_EXP_EXP08_RJCT_2MHZ); |
| 126 | if (err < 0) |
| 127 | goto error; |
| 128 | |
| 129 | if (phydev->drv->phy_id == PHY_ID_BCM50610) { |
| 130 | err = bcm50610_a0_workaround(phydev); |
| 131 | if (err < 0) |
| 132 | goto error; |
| 133 | } |
| 134 | } |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 135 | |
Matt Carlson | 47b1b53 | 2009-11-02 14:28:04 +0000 | [diff] [blame] | 136 | if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM57780) { |
| 137 | int val; |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 138 | |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 139 | val = bcm_phy_read_exp(phydev, MII_BCM54XX_EXP_EXP75); |
Matt Carlson | 47b1b53 | 2009-11-02 14:28:04 +0000 | [diff] [blame] | 140 | if (val < 0) |
| 141 | goto error; |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 142 | |
Matt Carlson | 47b1b53 | 2009-11-02 14:28:04 +0000 | [diff] [blame] | 143 | val |= MII_BCM54XX_EXP_EXP75_CM_OSC; |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 144 | err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP75, val); |
Matt Carlson | 47b1b53 | 2009-11-02 14:28:04 +0000 | [diff] [blame] | 145 | } |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 146 | |
| 147 | error: |
Matt Carlson | 47b1b53 | 2009-11-02 14:28:04 +0000 | [diff] [blame] | 148 | /* Disable the SMDSP clock */ |
| 149 | err2 = bcm54xx_auxctl_write(phydev, |
| 150 | MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL, |
| 151 | MII_BCM54XX_AUXCTL_ACTL_TX_6DB); |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 152 | |
Matt Carlson | 47b1b53 | 2009-11-02 14:28:04 +0000 | [diff] [blame] | 153 | /* Return the first error reported. */ |
| 154 | return err ? err : err2; |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 155 | } |
| 156 | |
Matt Carlson | 32e5a8d | 2009-11-02 14:31:39 +0000 | [diff] [blame] | 157 | static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev) |
| 158 | { |
Roel Kluin | 5ee6f6a | 2009-12-18 20:16:10 -0800 | [diff] [blame] | 159 | u32 orig; |
| 160 | int val; |
Matt Carlson | c704dc2 | 2009-11-02 14:32:12 +0000 | [diff] [blame] | 161 | bool clk125en = true; |
Matt Carlson | 32e5a8d | 2009-11-02 14:31:39 +0000 | [diff] [blame] | 162 | |
| 163 | /* Abort if we are using an untested phy. */ |
roel kluin | 7ec4e7d | 2009-12-30 06:43:06 +0000 | [diff] [blame] | 164 | if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 && |
| 165 | BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 && |
Matt Carlson | 32e5a8d | 2009-11-02 14:31:39 +0000 | [diff] [blame] | 166 | BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M) |
| 167 | return; |
| 168 | |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 169 | val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR3); |
Matt Carlson | 32e5a8d | 2009-11-02 14:31:39 +0000 | [diff] [blame] | 170 | if (val < 0) |
| 171 | return; |
| 172 | |
| 173 | orig = val; |
| 174 | |
Matt Carlson | c704dc2 | 2009-11-02 14:32:12 +0000 | [diff] [blame] | 175 | if ((BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 || |
| 176 | BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) && |
| 177 | BRCM_PHY_REV(phydev) >= 0x3) { |
| 178 | /* |
| 179 | * Here, bit 0 _disables_ CLK125 when set. |
| 180 | * This bit is set by default. |
| 181 | */ |
| 182 | clk125en = false; |
| 183 | } else { |
| 184 | if (phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED) { |
Matt Carlson | 32e5a8d | 2009-11-02 14:31:39 +0000 | [diff] [blame] | 185 | /* Here, bit 0 _enables_ CLK125 when set */ |
| 186 | val &= ~BCM54XX_SHD_SCR3_DEF_CLK125; |
Matt Carlson | c704dc2 | 2009-11-02 14:32:12 +0000 | [diff] [blame] | 187 | clk125en = false; |
Matt Carlson | 32e5a8d | 2009-11-02 14:31:39 +0000 | [diff] [blame] | 188 | } |
| 189 | } |
| 190 | |
Joe Perches | 23677ce | 2012-02-09 11:17:23 +0000 | [diff] [blame] | 191 | if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) |
Matt Carlson | c704dc2 | 2009-11-02 14:32:12 +0000 | [diff] [blame] | 192 | val &= ~BCM54XX_SHD_SCR3_DLLAPD_DIS; |
| 193 | else |
| 194 | val |= BCM54XX_SHD_SCR3_DLLAPD_DIS; |
| 195 | |
Matt Carlson | 52fae08 | 2009-11-02 14:32:38 +0000 | [diff] [blame] | 196 | if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) |
| 197 | val |= BCM54XX_SHD_SCR3_TRDDAPD; |
| 198 | |
Matt Carlson | 32e5a8d | 2009-11-02 14:31:39 +0000 | [diff] [blame] | 199 | if (orig != val) |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 200 | bcm_phy_write_shadow(phydev, BCM54XX_SHD_SCR3, val); |
Matt Carlson | c704dc2 | 2009-11-02 14:32:12 +0000 | [diff] [blame] | 201 | |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 202 | val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_APD); |
Matt Carlson | c704dc2 | 2009-11-02 14:32:12 +0000 | [diff] [blame] | 203 | if (val < 0) |
| 204 | return; |
| 205 | |
| 206 | orig = val; |
| 207 | |
Joe Perches | 23677ce | 2012-02-09 11:17:23 +0000 | [diff] [blame] | 208 | if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) |
Matt Carlson | c704dc2 | 2009-11-02 14:32:12 +0000 | [diff] [blame] | 209 | val |= BCM54XX_SHD_APD_EN; |
| 210 | else |
| 211 | val &= ~BCM54XX_SHD_APD_EN; |
| 212 | |
| 213 | if (orig != val) |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 214 | bcm_phy_write_shadow(phydev, BCM54XX_SHD_APD, val); |
Matt Carlson | 32e5a8d | 2009-11-02 14:31:39 +0000 | [diff] [blame] | 215 | } |
| 216 | |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 217 | static int bcm54xx_config_init(struct phy_device *phydev) |
| 218 | { |
| 219 | int reg, err; |
| 220 | |
| 221 | reg = phy_read(phydev, MII_BCM54XX_ECR); |
| 222 | if (reg < 0) |
| 223 | return reg; |
| 224 | |
| 225 | /* Mask interrupts globally. */ |
| 226 | reg |= MII_BCM54XX_ECR_IM; |
| 227 | err = phy_write(phydev, MII_BCM54XX_ECR, reg); |
| 228 | if (err < 0) |
| 229 | return err; |
| 230 | |
| 231 | /* Unmask events we are interested in. */ |
| 232 | reg = ~(MII_BCM54XX_INT_DUPLEX | |
| 233 | MII_BCM54XX_INT_SPEED | |
| 234 | MII_BCM54XX_INT_LINK); |
| 235 | err = phy_write(phydev, MII_BCM54XX_IMR, reg); |
| 236 | if (err < 0) |
| 237 | return err; |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 238 | |
Matt Carlson | 63a14ce | 2009-11-02 14:30:40 +0000 | [diff] [blame] | 239 | if ((BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 || |
| 240 | BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) && |
| 241 | (phydev->dev_flags & PHY_BRCM_CLEAR_RGMII_MODE)) |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 242 | bcm_phy_write_shadow(phydev, BCM54XX_SHD_RGMII_MODE, 0); |
Matt Carlson | 63a14ce | 2009-11-02 14:30:40 +0000 | [diff] [blame] | 243 | |
Matt Carlson | c704dc2 | 2009-11-02 14:32:12 +0000 | [diff] [blame] | 244 | if ((phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED) || |
Matt Carlson | 52fae08 | 2009-11-02 14:32:38 +0000 | [diff] [blame] | 245 | (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) || |
Matt Carlson | c704dc2 | 2009-11-02 14:32:12 +0000 | [diff] [blame] | 246 | (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) |
Matt Carlson | 32e5a8d | 2009-11-02 14:31:39 +0000 | [diff] [blame] | 247 | bcm54xx_adjust_rxrefclk(phydev); |
| 248 | |
Rafał Miłecki | 0fc9ae1 | 2017-01-27 14:07:01 +0100 | [diff] [blame^] | 249 | if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E) { |
| 250 | err = bcm54210e_config_init(phydev); |
| 251 | if (err) |
| 252 | return err; |
| 253 | } else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) { |
Jon Mason | b14995a | 2016-11-04 01:10:58 -0400 | [diff] [blame] | 254 | err = bcm54810_config(phydev); |
| 255 | if (err) |
| 256 | return err; |
| 257 | } |
| 258 | |
Matt Carlson | 47b1b53 | 2009-11-02 14:28:04 +0000 | [diff] [blame] | 259 | bcm54xx_phydsp_config(phydev); |
Matt Carlson | d9221e6 | 2009-08-25 10:11:26 +0000 | [diff] [blame] | 260 | |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 261 | return 0; |
| 262 | } |
| 263 | |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 264 | static int bcm5482_config_init(struct phy_device *phydev) |
| 265 | { |
| 266 | int err, reg; |
| 267 | |
| 268 | err = bcm54xx_config_init(phydev); |
| 269 | |
| 270 | if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) { |
| 271 | /* |
| 272 | * Enable secondary SerDes and its use as an LED source |
| 273 | */ |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 274 | reg = bcm_phy_read_shadow(phydev, BCM5482_SHD_SSD); |
| 275 | bcm_phy_write_shadow(phydev, BCM5482_SHD_SSD, |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 276 | reg | |
| 277 | BCM5482_SHD_SSD_LEDM | |
| 278 | BCM5482_SHD_SSD_EN); |
| 279 | |
| 280 | /* |
| 281 | * Enable SGMII slave mode and auto-detection |
| 282 | */ |
Matt Carlson | 042a75b | 2008-11-03 16:56:29 -0800 | [diff] [blame] | 283 | reg = BCM5482_SSD_SGMII_SLAVE | MII_BCM54XX_EXP_SEL_SSD; |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 284 | err = bcm_phy_read_exp(phydev, reg); |
Matt Carlson | 042a75b | 2008-11-03 16:56:29 -0800 | [diff] [blame] | 285 | if (err < 0) |
| 286 | return err; |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 287 | err = bcm_phy_write_exp(phydev, reg, err | |
Matt Carlson | 042a75b | 2008-11-03 16:56:29 -0800 | [diff] [blame] | 288 | BCM5482_SSD_SGMII_SLAVE_EN | |
| 289 | BCM5482_SSD_SGMII_SLAVE_AD); |
| 290 | if (err < 0) |
| 291 | return err; |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 292 | |
| 293 | /* |
| 294 | * Disable secondary SerDes powerdown |
| 295 | */ |
Matt Carlson | 042a75b | 2008-11-03 16:56:29 -0800 | [diff] [blame] | 296 | reg = BCM5482_SSD_1000BX_CTL | MII_BCM54XX_EXP_SEL_SSD; |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 297 | err = bcm_phy_read_exp(phydev, reg); |
Matt Carlson | 042a75b | 2008-11-03 16:56:29 -0800 | [diff] [blame] | 298 | if (err < 0) |
| 299 | return err; |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 300 | err = bcm_phy_write_exp(phydev, reg, |
Matt Carlson | 042a75b | 2008-11-03 16:56:29 -0800 | [diff] [blame] | 301 | err & ~BCM5482_SSD_1000BX_CTL_PWRDOWN); |
| 302 | if (err < 0) |
| 303 | return err; |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 304 | |
| 305 | /* |
| 306 | * Select 1000BASE-X register set (primary SerDes) |
| 307 | */ |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 308 | reg = bcm_phy_read_shadow(phydev, BCM5482_SHD_MODE); |
| 309 | bcm_phy_write_shadow(phydev, BCM5482_SHD_MODE, |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 310 | reg | BCM5482_SHD_MODE_1000BX); |
| 311 | |
| 312 | /* |
| 313 | * LED1=ACTIVITYLED, LED3=LINKSPD[2] |
| 314 | * (Use LED1 as secondary SerDes ACTIVITY LED) |
| 315 | */ |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 316 | bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 317 | BCM5482_SHD_LEDS1_LED1(BCM_LED_SRC_ACTIVITYLED) | |
| 318 | BCM5482_SHD_LEDS1_LED3(BCM_LED_SRC_LINKSPD2)); |
| 319 | |
| 320 | /* |
| 321 | * Auto-negotiation doesn't seem to work quite right |
| 322 | * in this mode, so we disable it and force it to the |
| 323 | * right speed/duplex setting. Only 'link status' |
| 324 | * is important. |
| 325 | */ |
| 326 | phydev->autoneg = AUTONEG_DISABLE; |
| 327 | phydev->speed = SPEED_1000; |
| 328 | phydev->duplex = DUPLEX_FULL; |
| 329 | } |
| 330 | |
| 331 | return err; |
| 332 | } |
| 333 | |
| 334 | static int bcm5482_read_status(struct phy_device *phydev) |
| 335 | { |
| 336 | int err; |
| 337 | |
| 338 | err = genphy_read_status(phydev); |
| 339 | |
| 340 | if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) { |
| 341 | /* |
| 342 | * Only link status matters for 1000Base-X mode, so force |
| 343 | * 1000 Mbit/s full-duplex status |
| 344 | */ |
| 345 | if (phydev->link) { |
| 346 | phydev->speed = SPEED_1000; |
| 347 | phydev->duplex = DUPLEX_FULL; |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | return err; |
| 352 | } |
| 353 | |
Anton Vorontsov | 57bb7e2 | 2008-03-04 19:41:32 +0300 | [diff] [blame] | 354 | static int bcm5481_config_aneg(struct phy_device *phydev) |
| 355 | { |
Jon Mason | b14995a | 2016-11-04 01:10:58 -0400 | [diff] [blame] | 356 | struct device_node *np = phydev->mdio.dev.of_node; |
Anton Vorontsov | 57bb7e2 | 2008-03-04 19:41:32 +0300 | [diff] [blame] | 357 | int ret; |
| 358 | |
| 359 | /* Aneg firsly. */ |
| 360 | ret = genphy_config_aneg(phydev); |
| 361 | |
| 362 | /* Then we can set up the delay. */ |
| 363 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { |
| 364 | u16 reg; |
| 365 | |
| 366 | /* |
| 367 | * There is no BCM5481 specification available, so down |
| 368 | * here is everything we know about "register 0x18". This |
Joe Perches | bfb9035 | 2011-08-17 06:58:04 -0700 | [diff] [blame] | 369 | * at least helps BCM5481 to successfully receive packets |
Anton Vorontsov | 57bb7e2 | 2008-03-04 19:41:32 +0300 | [diff] [blame] | 370 | * on MPC8360E-RDK board. Peter Barada <peterb@logicpd.com> |
| 371 | * says: "This sets delay between the RXD and RXC signals |
| 372 | * instead of using trace lengths to achieve timing". |
| 373 | */ |
| 374 | |
| 375 | /* Set RDX clk delay. */ |
| 376 | reg = 0x7 | (0x7 << 12); |
| 377 | phy_write(phydev, 0x18, reg); |
| 378 | |
| 379 | reg = phy_read(phydev, 0x18); |
| 380 | /* Set RDX-RXC skew. */ |
| 381 | reg |= (1 << 8); |
| 382 | /* Write bits 14:0. */ |
| 383 | reg |= (1 << 15); |
| 384 | phy_write(phydev, 0x18, reg); |
| 385 | } |
| 386 | |
Jon Mason | b14995a | 2016-11-04 01:10:58 -0400 | [diff] [blame] | 387 | if (of_property_read_bool(np, "enet-phy-lane-swap")) { |
| 388 | /* Lane Swap - Undocumented register...magic! */ |
| 389 | ret = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_SEL_ER + 0x9, |
| 390 | 0x11B); |
| 391 | if (ret < 0) |
| 392 | return ret; |
| 393 | } |
| 394 | |
Anton Vorontsov | 57bb7e2 | 2008-03-04 19:41:32 +0300 | [diff] [blame] | 395 | return ret; |
| 396 | } |
| 397 | |
Xo Wang | d92ead1 | 2016-10-21 10:20:13 -0700 | [diff] [blame] | 398 | static int bcm54612e_config_aneg(struct phy_device *phydev) |
| 399 | { |
| 400 | int ret; |
| 401 | |
| 402 | /* First, auto-negotiate. */ |
| 403 | ret = genphy_config_aneg(phydev); |
| 404 | |
| 405 | /* Clear TX internal delay unless requested. */ |
| 406 | if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) && |
| 407 | (phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)) { |
| 408 | /* Disable TXD to GTXCLK clock delay (default set) */ |
| 409 | /* Bit 9 is the only field in shadow register 00011 */ |
| 410 | bcm_phy_write_shadow(phydev, 0x03, 0); |
| 411 | } |
| 412 | |
| 413 | /* Clear RX internal delay unless requested. */ |
| 414 | if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) && |
| 415 | (phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) { |
| 416 | u16 reg; |
| 417 | |
Rafał Miłecki | 85b4685 | 2017-01-25 21:00:25 +0100 | [diff] [blame] | 418 | reg = bcm54xx_auxctl_read(phydev, |
| 419 | MII_BCM54XX_AUXCTL_SHDWSEL_MISC); |
Xo Wang | d92ead1 | 2016-10-21 10:20:13 -0700 | [diff] [blame] | 420 | /* Disable RXD to RXC delay (default set) */ |
Rafał Miłecki | 8293c7bc | 2017-01-25 21:00:26 +0100 | [diff] [blame] | 421 | reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN; |
Xo Wang | d92ead1 | 2016-10-21 10:20:13 -0700 | [diff] [blame] | 422 | /* Clear shadow selector field */ |
| 423 | reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MASK; |
| 424 | bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, |
| 425 | MII_BCM54XX_AUXCTL_MISC_WREN | reg); |
| 426 | } |
| 427 | |
| 428 | return ret; |
| 429 | } |
| 430 | |
Matt Carlson | d7a2ed9 | 2009-08-25 10:10:58 +0000 | [diff] [blame] | 431 | static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set) |
| 432 | { |
| 433 | int val; |
| 434 | |
| 435 | val = phy_read(phydev, reg); |
| 436 | if (val < 0) |
| 437 | return val; |
| 438 | |
| 439 | return phy_write(phydev, reg, val | set); |
| 440 | } |
| 441 | |
| 442 | static int brcm_fet_config_init(struct phy_device *phydev) |
| 443 | { |
| 444 | int reg, err, err2, brcmtest; |
| 445 | |
| 446 | /* Reset the PHY to bring it to a known state. */ |
| 447 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); |
| 448 | if (err < 0) |
| 449 | return err; |
| 450 | |
| 451 | reg = phy_read(phydev, MII_BRCM_FET_INTREG); |
| 452 | if (reg < 0) |
| 453 | return reg; |
| 454 | |
| 455 | /* Unmask events we are interested in and mask interrupts globally. */ |
| 456 | reg = MII_BRCM_FET_IR_DUPLEX_EN | |
| 457 | MII_BRCM_FET_IR_SPEED_EN | |
| 458 | MII_BRCM_FET_IR_LINK_EN | |
| 459 | MII_BRCM_FET_IR_ENABLE | |
| 460 | MII_BRCM_FET_IR_MASK; |
| 461 | |
| 462 | err = phy_write(phydev, MII_BRCM_FET_INTREG, reg); |
| 463 | if (err < 0) |
| 464 | return err; |
| 465 | |
| 466 | /* Enable shadow register access */ |
| 467 | brcmtest = phy_read(phydev, MII_BRCM_FET_BRCMTEST); |
| 468 | if (brcmtest < 0) |
| 469 | return brcmtest; |
| 470 | |
| 471 | reg = brcmtest | MII_BRCM_FET_BT_SRE; |
| 472 | |
| 473 | err = phy_write(phydev, MII_BRCM_FET_BRCMTEST, reg); |
| 474 | if (err < 0) |
| 475 | return err; |
| 476 | |
| 477 | /* Set the LED mode */ |
| 478 | reg = phy_read(phydev, MII_BRCM_FET_SHDW_AUXMODE4); |
| 479 | if (reg < 0) { |
| 480 | err = reg; |
| 481 | goto done; |
| 482 | } |
| 483 | |
| 484 | reg &= ~MII_BRCM_FET_SHDW_AM4_LED_MASK; |
| 485 | reg |= MII_BRCM_FET_SHDW_AM4_LED_MODE1; |
| 486 | |
| 487 | err = phy_write(phydev, MII_BRCM_FET_SHDW_AUXMODE4, reg); |
| 488 | if (err < 0) |
| 489 | goto done; |
| 490 | |
| 491 | /* Enable auto MDIX */ |
| 492 | err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_MISCCTRL, |
| 493 | MII_BRCM_FET_SHDW_MC_FAME); |
| 494 | if (err < 0) |
| 495 | goto done; |
| 496 | |
Matt Carlson | cdd4e09d | 2009-11-02 14:31:11 +0000 | [diff] [blame] | 497 | if (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE) { |
| 498 | /* Enable auto power down */ |
| 499 | err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2, |
| 500 | MII_BRCM_FET_SHDW_AS2_APDE); |
| 501 | } |
Matt Carlson | d7a2ed9 | 2009-08-25 10:10:58 +0000 | [diff] [blame] | 502 | |
| 503 | done: |
| 504 | /* Disable shadow register access */ |
| 505 | err2 = phy_write(phydev, MII_BRCM_FET_BRCMTEST, brcmtest); |
| 506 | if (!err) |
| 507 | err = err2; |
| 508 | |
| 509 | return err; |
| 510 | } |
| 511 | |
| 512 | static int brcm_fet_ack_interrupt(struct phy_device *phydev) |
| 513 | { |
| 514 | int reg; |
| 515 | |
| 516 | /* Clear pending interrupts. */ |
| 517 | reg = phy_read(phydev, MII_BRCM_FET_INTREG); |
| 518 | if (reg < 0) |
| 519 | return reg; |
| 520 | |
| 521 | return 0; |
| 522 | } |
| 523 | |
| 524 | static int brcm_fet_config_intr(struct phy_device *phydev) |
| 525 | { |
| 526 | int reg, err; |
| 527 | |
| 528 | reg = phy_read(phydev, MII_BRCM_FET_INTREG); |
| 529 | if (reg < 0) |
| 530 | return reg; |
| 531 | |
| 532 | if (phydev->interrupts == PHY_INTERRUPT_ENABLED) |
| 533 | reg &= ~MII_BRCM_FET_IR_MASK; |
| 534 | else |
| 535 | reg |= MII_BRCM_FET_IR_MASK; |
| 536 | |
| 537 | err = phy_write(phydev, MII_BRCM_FET_INTREG, reg); |
| 538 | return err; |
| 539 | } |
| 540 | |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 541 | static struct phy_driver broadcom_drivers[] = { |
| 542 | { |
Dmitry Baryshkov | fcb26ec | 2010-06-16 23:02:23 +0000 | [diff] [blame] | 543 | .phy_id = PHY_ID_BCM5411, |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 544 | .phy_id_mask = 0xfffffff0, |
| 545 | .name = "Broadcom BCM5411", |
Timur Tabi | 529ed12 | 2016-12-07 13:20:51 -0600 | [diff] [blame] | 546 | .features = PHY_GBIT_FEATURES, |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 547 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 548 | .config_init = bcm54xx_config_init, |
| 549 | .config_aneg = genphy_config_aneg, |
| 550 | .read_status = genphy_read_status, |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 551 | .ack_interrupt = bcm_phy_ack_intr, |
| 552 | .config_intr = bcm_phy_config_intr, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 553 | }, { |
Dmitry Baryshkov | fcb26ec | 2010-06-16 23:02:23 +0000 | [diff] [blame] | 554 | .phy_id = PHY_ID_BCM5421, |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 555 | .phy_id_mask = 0xfffffff0, |
| 556 | .name = "Broadcom BCM5421", |
Timur Tabi | 529ed12 | 2016-12-07 13:20:51 -0600 | [diff] [blame] | 557 | .features = PHY_GBIT_FEATURES, |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 558 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 559 | .config_init = bcm54xx_config_init, |
| 560 | .config_aneg = genphy_config_aneg, |
| 561 | .read_status = genphy_read_status, |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 562 | .ack_interrupt = bcm_phy_ack_intr, |
| 563 | .config_intr = bcm_phy_config_intr, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 564 | }, { |
Rafał Miłecki | 0fc9ae1 | 2017-01-27 14:07:01 +0100 | [diff] [blame^] | 565 | .phy_id = PHY_ID_BCM54210E, |
| 566 | .phy_id_mask = 0xfffffff0, |
| 567 | .name = "Broadcom BCM54210E", |
| 568 | .features = PHY_GBIT_FEATURES, |
| 569 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 570 | .config_init = bcm54xx_config_init, |
| 571 | .config_aneg = genphy_config_aneg, |
| 572 | .read_status = genphy_read_status, |
| 573 | .ack_interrupt = bcm_phy_ack_intr, |
| 574 | .config_intr = bcm_phy_config_intr, |
| 575 | }, { |
Dmitry Baryshkov | fcb26ec | 2010-06-16 23:02:23 +0000 | [diff] [blame] | 576 | .phy_id = PHY_ID_BCM5461, |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 577 | .phy_id_mask = 0xfffffff0, |
| 578 | .name = "Broadcom BCM5461", |
Timur Tabi | 529ed12 | 2016-12-07 13:20:51 -0600 | [diff] [blame] | 579 | .features = PHY_GBIT_FEATURES, |
Maciej W. Rozycki | c4b41c9 | 2006-10-03 16:18:13 +0100 | [diff] [blame] | 580 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 581 | .config_init = bcm54xx_config_init, |
| 582 | .config_aneg = genphy_config_aneg, |
| 583 | .read_status = genphy_read_status, |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 584 | .ack_interrupt = bcm_phy_ack_intr, |
| 585 | .config_intr = bcm_phy_config_intr, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 586 | }, { |
Xo Wang | d92ead1 | 2016-10-21 10:20:13 -0700 | [diff] [blame] | 587 | .phy_id = PHY_ID_BCM54612E, |
| 588 | .phy_id_mask = 0xfffffff0, |
| 589 | .name = "Broadcom BCM54612E", |
Timur Tabi | 529ed12 | 2016-12-07 13:20:51 -0600 | [diff] [blame] | 590 | .features = PHY_GBIT_FEATURES, |
Xo Wang | d92ead1 | 2016-10-21 10:20:13 -0700 | [diff] [blame] | 591 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 592 | .config_init = bcm54xx_config_init, |
| 593 | .config_aneg = bcm54612e_config_aneg, |
| 594 | .read_status = genphy_read_status, |
| 595 | .ack_interrupt = bcm_phy_ack_intr, |
| 596 | .config_intr = bcm_phy_config_intr, |
| 597 | }, { |
Alessio Igor Bogani | 3bca4cf6 | 2015-04-08 12:15:18 +0200 | [diff] [blame] | 598 | .phy_id = PHY_ID_BCM54616S, |
| 599 | .phy_id_mask = 0xfffffff0, |
| 600 | .name = "Broadcom BCM54616S", |
Timur Tabi | 529ed12 | 2016-12-07 13:20:51 -0600 | [diff] [blame] | 601 | .features = PHY_GBIT_FEATURES, |
Alessio Igor Bogani | 3bca4cf6 | 2015-04-08 12:15:18 +0200 | [diff] [blame] | 602 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 603 | .config_init = bcm54xx_config_init, |
| 604 | .config_aneg = genphy_config_aneg, |
| 605 | .read_status = genphy_read_status, |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 606 | .ack_interrupt = bcm_phy_ack_intr, |
| 607 | .config_intr = bcm_phy_config_intr, |
Alessio Igor Bogani | 3bca4cf6 | 2015-04-08 12:15:18 +0200 | [diff] [blame] | 608 | }, { |
Dmitry Baryshkov | fcb26ec | 2010-06-16 23:02:23 +0000 | [diff] [blame] | 609 | .phy_id = PHY_ID_BCM5464, |
Paul Gortmaker | b1394f9 | 2008-04-14 23:35:41 -0400 | [diff] [blame] | 610 | .phy_id_mask = 0xfffffff0, |
| 611 | .name = "Broadcom BCM5464", |
Timur Tabi | 529ed12 | 2016-12-07 13:20:51 -0600 | [diff] [blame] | 612 | .features = PHY_GBIT_FEATURES, |
Paul Gortmaker | b1394f9 | 2008-04-14 23:35:41 -0400 | [diff] [blame] | 613 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 614 | .config_init = bcm54xx_config_init, |
| 615 | .config_aneg = genphy_config_aneg, |
| 616 | .read_status = genphy_read_status, |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 617 | .ack_interrupt = bcm_phy_ack_intr, |
| 618 | .config_intr = bcm_phy_config_intr, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 619 | }, { |
Dmitry Baryshkov | fcb26ec | 2010-06-16 23:02:23 +0000 | [diff] [blame] | 620 | .phy_id = PHY_ID_BCM5481, |
Anton Vorontsov | 57bb7e2 | 2008-03-04 19:41:32 +0300 | [diff] [blame] | 621 | .phy_id_mask = 0xfffffff0, |
| 622 | .name = "Broadcom BCM5481", |
Timur Tabi | 529ed12 | 2016-12-07 13:20:51 -0600 | [diff] [blame] | 623 | .features = PHY_GBIT_FEATURES, |
Anton Vorontsov | 57bb7e2 | 2008-03-04 19:41:32 +0300 | [diff] [blame] | 624 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 625 | .config_init = bcm54xx_config_init, |
| 626 | .config_aneg = bcm5481_config_aneg, |
| 627 | .read_status = genphy_read_status, |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 628 | .ack_interrupt = bcm_phy_ack_intr, |
| 629 | .config_intr = bcm_phy_config_intr, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 630 | }, { |
Jon Mason | b14995a | 2016-11-04 01:10:58 -0400 | [diff] [blame] | 631 | .phy_id = PHY_ID_BCM54810, |
| 632 | .phy_id_mask = 0xfffffff0, |
| 633 | .name = "Broadcom BCM54810", |
Timur Tabi | 529ed12 | 2016-12-07 13:20:51 -0600 | [diff] [blame] | 634 | .features = PHY_GBIT_FEATURES, |
Jon Mason | b14995a | 2016-11-04 01:10:58 -0400 | [diff] [blame] | 635 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 636 | .config_init = bcm54xx_config_init, |
| 637 | .config_aneg = bcm5481_config_aneg, |
| 638 | .read_status = genphy_read_status, |
| 639 | .ack_interrupt = bcm_phy_ack_intr, |
| 640 | .config_intr = bcm_phy_config_intr, |
| 641 | }, { |
Dmitry Baryshkov | fcb26ec | 2010-06-16 23:02:23 +0000 | [diff] [blame] | 642 | .phy_id = PHY_ID_BCM5482, |
Nate Case | 03157ac | 2008-01-29 10:19:00 -0600 | [diff] [blame] | 643 | .phy_id_mask = 0xfffffff0, |
| 644 | .name = "Broadcom BCM5482", |
Timur Tabi | 529ed12 | 2016-12-07 13:20:51 -0600 | [diff] [blame] | 645 | .features = PHY_GBIT_FEATURES, |
Nate Case | 03157ac | 2008-01-29 10:19:00 -0600 | [diff] [blame] | 646 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 647 | .config_init = bcm5482_config_init, |
Nate Case | 03157ac | 2008-01-29 10:19:00 -0600 | [diff] [blame] | 648 | .config_aneg = genphy_config_aneg, |
Nate Case | cd9af3d | 2008-05-17 06:40:39 +0100 | [diff] [blame] | 649 | .read_status = bcm5482_read_status, |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 650 | .ack_interrupt = bcm_phy_ack_intr, |
| 651 | .config_intr = bcm_phy_config_intr, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 652 | }, { |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 653 | .phy_id = PHY_ID_BCM50610, |
| 654 | .phy_id_mask = 0xfffffff0, |
| 655 | .name = "Broadcom BCM50610", |
Timur Tabi | 529ed12 | 2016-12-07 13:20:51 -0600 | [diff] [blame] | 656 | .features = PHY_GBIT_FEATURES, |
Matt Carlson | 772638b | 2008-11-03 16:56:51 -0800 | [diff] [blame] | 657 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 658 | .config_init = bcm54xx_config_init, |
| 659 | .config_aneg = genphy_config_aneg, |
| 660 | .read_status = genphy_read_status, |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 661 | .ack_interrupt = bcm_phy_ack_intr, |
| 662 | .config_intr = bcm_phy_config_intr, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 663 | }, { |
Matt Carlson | 4f4598f | 2009-08-25 10:10:30 +0000 | [diff] [blame] | 664 | .phy_id = PHY_ID_BCM50610M, |
| 665 | .phy_id_mask = 0xfffffff0, |
| 666 | .name = "Broadcom BCM50610M", |
Timur Tabi | 529ed12 | 2016-12-07 13:20:51 -0600 | [diff] [blame] | 667 | .features = PHY_GBIT_FEATURES, |
Matt Carlson | 4f4598f | 2009-08-25 10:10:30 +0000 | [diff] [blame] | 668 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 669 | .config_init = bcm54xx_config_init, |
| 670 | .config_aneg = genphy_config_aneg, |
| 671 | .read_status = genphy_read_status, |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 672 | .ack_interrupt = bcm_phy_ack_intr, |
| 673 | .config_intr = bcm_phy_config_intr, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 674 | }, { |
Matt Carlson | d9221e6 | 2009-08-25 10:11:26 +0000 | [diff] [blame] | 675 | .phy_id = PHY_ID_BCM57780, |
Matt Carlson | 2fbb69a | 2008-11-21 17:22:53 -0800 | [diff] [blame] | 676 | .phy_id_mask = 0xfffffff0, |
| 677 | .name = "Broadcom BCM57780", |
Timur Tabi | 529ed12 | 2016-12-07 13:20:51 -0600 | [diff] [blame] | 678 | .features = PHY_GBIT_FEATURES, |
Matt Carlson | 2fbb69a | 2008-11-21 17:22:53 -0800 | [diff] [blame] | 679 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 680 | .config_init = bcm54xx_config_init, |
| 681 | .config_aneg = genphy_config_aneg, |
| 682 | .read_status = genphy_read_status, |
Arun Parameswaran | a1cba56 | 2015-10-06 12:25:48 -0700 | [diff] [blame] | 683 | .ack_interrupt = bcm_phy_ack_intr, |
| 684 | .config_intr = bcm_phy_config_intr, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 685 | }, { |
Matt Carlson | 6a443a0 | 2010-02-17 15:17:04 +0000 | [diff] [blame] | 686 | .phy_id = PHY_ID_BCMAC131, |
Matt Carlson | d7a2ed9 | 2009-08-25 10:10:58 +0000 | [diff] [blame] | 687 | .phy_id_mask = 0xfffffff0, |
| 688 | .name = "Broadcom BCMAC131", |
Timur Tabi | 529ed12 | 2016-12-07 13:20:51 -0600 | [diff] [blame] | 689 | .features = PHY_BASIC_FEATURES, |
Matt Carlson | d7a2ed9 | 2009-08-25 10:10:58 +0000 | [diff] [blame] | 690 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 691 | .config_init = brcm_fet_config_init, |
| 692 | .config_aneg = genphy_config_aneg, |
| 693 | .read_status = genphy_read_status, |
| 694 | .ack_interrupt = brcm_fet_ack_interrupt, |
| 695 | .config_intr = brcm_fet_config_intr, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 696 | }, { |
Dmitry Baryshkov | 7a938f8 | 2010-06-16 23:02:24 +0000 | [diff] [blame] | 697 | .phy_id = PHY_ID_BCM5241, |
| 698 | .phy_id_mask = 0xfffffff0, |
| 699 | .name = "Broadcom BCM5241", |
Timur Tabi | 529ed12 | 2016-12-07 13:20:51 -0600 | [diff] [blame] | 700 | .features = PHY_BASIC_FEATURES, |
Dmitry Baryshkov | 7a938f8 | 2010-06-16 23:02:24 +0000 | [diff] [blame] | 701 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 702 | .config_init = brcm_fet_config_init, |
| 703 | .config_aneg = genphy_config_aneg, |
| 704 | .read_status = genphy_read_status, |
| 705 | .ack_interrupt = brcm_fet_ack_interrupt, |
| 706 | .config_intr = brcm_fet_config_intr, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 707 | } }; |
Dmitry Baryshkov | 7a938f8 | 2010-06-16 23:02:24 +0000 | [diff] [blame] | 708 | |
Johan Hovold | 50fd715 | 2014-11-11 19:45:59 +0100 | [diff] [blame] | 709 | module_phy_driver(broadcom_drivers); |
David Woodhouse | 4e4f10f | 2010-04-02 01:05:56 +0000 | [diff] [blame] | 710 | |
Uwe Kleine-König | cf93c94 | 2010-10-03 23:43:32 +0000 | [diff] [blame] | 711 | static struct mdio_device_id __maybe_unused broadcom_tbl[] = { |
Dmitry Baryshkov | fcb26ec | 2010-06-16 23:02:23 +0000 | [diff] [blame] | 712 | { PHY_ID_BCM5411, 0xfffffff0 }, |
| 713 | { PHY_ID_BCM5421, 0xfffffff0 }, |
Rafał Miłecki | 0fc9ae1 | 2017-01-27 14:07:01 +0100 | [diff] [blame^] | 714 | { PHY_ID_BCM54210E, 0xfffffff0 }, |
Dmitry Baryshkov | fcb26ec | 2010-06-16 23:02:23 +0000 | [diff] [blame] | 715 | { PHY_ID_BCM5461, 0xfffffff0 }, |
Xo Wang | d92ead1 | 2016-10-21 10:20:13 -0700 | [diff] [blame] | 716 | { PHY_ID_BCM54612E, 0xfffffff0 }, |
Alessio Igor Bogani | 3bca4cf6 | 2015-04-08 12:15:18 +0200 | [diff] [blame] | 717 | { PHY_ID_BCM54616S, 0xfffffff0 }, |
Dmitry Baryshkov | fcb26ec | 2010-06-16 23:02:23 +0000 | [diff] [blame] | 718 | { PHY_ID_BCM5464, 0xfffffff0 }, |
Aaro Koskinen | 3c25a86 | 2015-11-22 01:08:54 +0200 | [diff] [blame] | 719 | { PHY_ID_BCM5481, 0xfffffff0 }, |
Jon Mason | b14995a | 2016-11-04 01:10:58 -0400 | [diff] [blame] | 720 | { PHY_ID_BCM54810, 0xfffffff0 }, |
Dmitry Baryshkov | fcb26ec | 2010-06-16 23:02:23 +0000 | [diff] [blame] | 721 | { PHY_ID_BCM5482, 0xfffffff0 }, |
David Woodhouse | 4e4f10f | 2010-04-02 01:05:56 +0000 | [diff] [blame] | 722 | { PHY_ID_BCM50610, 0xfffffff0 }, |
| 723 | { PHY_ID_BCM50610M, 0xfffffff0 }, |
| 724 | { PHY_ID_BCM57780, 0xfffffff0 }, |
| 725 | { PHY_ID_BCMAC131, 0xfffffff0 }, |
Dmitry Baryshkov | 7a938f8 | 2010-06-16 23:02:24 +0000 | [diff] [blame] | 726 | { PHY_ID_BCM5241, 0xfffffff0 }, |
David Woodhouse | 4e4f10f | 2010-04-02 01:05:56 +0000 | [diff] [blame] | 727 | { } |
| 728 | }; |
| 729 | |
| 730 | MODULE_DEVICE_TABLE(mdio, broadcom_tbl); |