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