Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 2 | /* |
| 3 | * RealTek PHY drivers |
| 4 | * |
Codrin Ciubotariu | 3cee138 | 2015-02-13 14:47:58 +0200 | [diff] [blame] | 5 | * Copyright 2010-2011, 2015 Freescale Semiconductor, Inc. |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 6 | * author Andy Fleming |
Karsten Merker | 563d8d9 | 2016-03-21 20:29:07 +0100 | [diff] [blame] | 7 | * Copyright 2016 Karsten Merker <merker@debian.org> |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 8 | */ |
| 9 | #include <config.h> |
| 10 | #include <common.h> |
oliver@schinagl.nl | 020f676 | 2016-11-08 17:38:57 +0100 | [diff] [blame] | 11 | #include <linux/bitops.h> |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 12 | #include <phy.h> |
| 13 | |
oliver@schinagl.nl | cebf3f5 | 2016-11-08 17:38:59 +0100 | [diff] [blame] | 14 | #define PHY_RTL8211x_FORCE_MASTER BIT(1) |
kevans@FreeBSD.org | 66526e7 | 2018-02-14 17:02:15 -0600 | [diff] [blame] | 15 | #define PHY_RTL8211E_PINE64_GIGABIT_FIX BIT(2) |
oliver@schinagl.nl | cebf3f5 | 2016-11-08 17:38:59 +0100 | [diff] [blame] | 16 | |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 17 | #define PHY_AUTONEGOTIATE_TIMEOUT 5000 |
| 18 | |
Michael Haas | 525d187 | 2016-03-25 18:22:50 +0100 | [diff] [blame] | 19 | /* RTL8211x 1000BASE-T Control Register */ |
oliver@schinagl.nl | 020f676 | 2016-11-08 17:38:57 +0100 | [diff] [blame] | 20 | #define MIIM_RTL8211x_CTRL1000T_MSCE BIT(12); |
oliver@schinagl.nl | cbe40e1 | 2016-11-08 17:38:58 +0100 | [diff] [blame] | 21 | #define MIIM_RTL8211x_CTRL1000T_MASTER BIT(11); |
Michael Haas | 525d187 | 2016-03-25 18:22:50 +0100 | [diff] [blame] | 22 | |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 23 | /* RTL8211x PHY Status Register */ |
| 24 | #define MIIM_RTL8211x_PHY_STATUS 0x11 |
| 25 | #define MIIM_RTL8211x_PHYSTAT_SPEED 0xc000 |
| 26 | #define MIIM_RTL8211x_PHYSTAT_GBIT 0x8000 |
| 27 | #define MIIM_RTL8211x_PHYSTAT_100 0x4000 |
| 28 | #define MIIM_RTL8211x_PHYSTAT_DUPLEX 0x2000 |
| 29 | #define MIIM_RTL8211x_PHYSTAT_SPDDONE 0x0800 |
| 30 | #define MIIM_RTL8211x_PHYSTAT_LINK 0x0400 |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 31 | |
Codrin Ciubotariu | 3cee138 | 2015-02-13 14:47:58 +0200 | [diff] [blame] | 32 | /* RTL8211x PHY Interrupt Enable Register */ |
| 33 | #define MIIM_RTL8211x_PHY_INER 0x12 |
| 34 | #define MIIM_RTL8211x_PHY_INTR_ENA 0x9f01 |
| 35 | #define MIIM_RTL8211x_PHY_INTR_DIS 0x0000 |
| 36 | |
| 37 | /* RTL8211x PHY Interrupt Status Register */ |
| 38 | #define MIIM_RTL8211x_PHY_INSR 0x13 |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 39 | |
Shengzhou Liu | 3d6af74 | 2015-03-12 18:54:59 +0800 | [diff] [blame] | 40 | /* RTL8211F PHY Status Register */ |
| 41 | #define MIIM_RTL8211F_PHY_STATUS 0x1a |
| 42 | #define MIIM_RTL8211F_AUTONEG_ENABLE 0x1000 |
| 43 | #define MIIM_RTL8211F_PHYSTAT_SPEED 0x0030 |
| 44 | #define MIIM_RTL8211F_PHYSTAT_GBIT 0x0020 |
| 45 | #define MIIM_RTL8211F_PHYSTAT_100 0x0010 |
| 46 | #define MIIM_RTL8211F_PHYSTAT_DUPLEX 0x0008 |
| 47 | #define MIIM_RTL8211F_PHYSTAT_SPDDONE 0x0800 |
| 48 | #define MIIM_RTL8211F_PHYSTAT_LINK 0x0004 |
| 49 | |
kevans@FreeBSD.org | 66526e7 | 2018-02-14 17:02:15 -0600 | [diff] [blame] | 50 | #define MIIM_RTL8211E_CONFREG 0x1c |
| 51 | #define MIIM_RTL8211E_CONFREG_TXD 0x0002 |
| 52 | #define MIIM_RTL8211E_CONFREG_RXD 0x0004 |
| 53 | #define MIIM_RTL8211E_CONFREG_MAGIC 0xb400 /* Undocumented */ |
| 54 | |
| 55 | #define MIIM_RTL8211E_EXT_PAGE_SELECT 0x1e |
| 56 | |
Shengzhou Liu | 3d6af74 | 2015-03-12 18:54:59 +0800 | [diff] [blame] | 57 | #define MIIM_RTL8211F_PAGE_SELECT 0x1f |
Shengzhou Liu | 793ea94 | 2015-04-24 16:57:17 +0800 | [diff] [blame] | 58 | #define MIIM_RTL8211F_TX_DELAY 0x100 |
Shengzhou Liu | 9071274 | 2015-05-21 18:07:35 +0800 | [diff] [blame] | 59 | #define MIIM_RTL8211F_LCR 0x10 |
Shengzhou Liu | 3d6af74 | 2015-03-12 18:54:59 +0800 | [diff] [blame] | 60 | |
oliver@schinagl.nl | cebf3f5 | 2016-11-08 17:38:59 +0100 | [diff] [blame] | 61 | static int rtl8211b_probe(struct phy_device *phydev) |
| 62 | { |
| 63 | #ifdef CONFIG_RTL8211X_PHY_FORCE_MASTER |
| 64 | phydev->flags |= PHY_RTL8211x_FORCE_MASTER; |
| 65 | #endif |
| 66 | |
| 67 | return 0; |
| 68 | } |
| 69 | |
kevans@FreeBSD.org | 66526e7 | 2018-02-14 17:02:15 -0600 | [diff] [blame] | 70 | static int rtl8211e_probe(struct phy_device *phydev) |
| 71 | { |
| 72 | #ifdef CONFIG_RTL8211E_PINE64_GIGABIT_FIX |
| 73 | phydev->flags |= PHY_RTL8211E_PINE64_GIGABIT_FIX; |
| 74 | #endif |
| 75 | |
| 76 | return 0; |
| 77 | } |
| 78 | |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 79 | /* RealTek RTL8211x */ |
| 80 | static int rtl8211x_config(struct phy_device *phydev) |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 81 | { |
| 82 | phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET); |
| 83 | |
Codrin Ciubotariu | 3cee138 | 2015-02-13 14:47:58 +0200 | [diff] [blame] | 84 | /* mask interrupt at init; if the interrupt is |
| 85 | * needed indeed, it should be explicitly enabled |
| 86 | */ |
| 87 | phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211x_PHY_INER, |
| 88 | MIIM_RTL8211x_PHY_INTR_DIS); |
oliver@schinagl.nl | cebf3f5 | 2016-11-08 17:38:59 +0100 | [diff] [blame] | 89 | |
| 90 | if (phydev->flags & PHY_RTL8211x_FORCE_MASTER) { |
| 91 | unsigned int reg; |
| 92 | |
| 93 | reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_CTRL1000); |
| 94 | /* force manual master/slave configuration */ |
| 95 | reg |= MIIM_RTL8211x_CTRL1000T_MSCE; |
| 96 | /* force master mode */ |
| 97 | reg |= MIIM_RTL8211x_CTRL1000T_MASTER; |
| 98 | phy_write(phydev, MDIO_DEVAD_NONE, MII_CTRL1000, reg); |
| 99 | } |
kevans@FreeBSD.org | 66526e7 | 2018-02-14 17:02:15 -0600 | [diff] [blame] | 100 | if (phydev->flags & PHY_RTL8211E_PINE64_GIGABIT_FIX) { |
| 101 | unsigned int reg; |
| 102 | |
| 103 | phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, |
| 104 | 7); |
| 105 | phy_write(phydev, MDIO_DEVAD_NONE, |
| 106 | MIIM_RTL8211E_EXT_PAGE_SELECT, 0xa4); |
| 107 | reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211E_CONFREG); |
| 108 | /* Ensure both internal delays are turned off */ |
| 109 | reg &= ~(MIIM_RTL8211E_CONFREG_TXD | MIIM_RTL8211E_CONFREG_RXD); |
| 110 | /* Flip the magic undocumented bits */ |
| 111 | reg |= MIIM_RTL8211E_CONFREG_MAGIC; |
| 112 | phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211E_CONFREG, reg); |
| 113 | phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, |
| 114 | 0); |
| 115 | } |
Codrin Ciubotariu | 3cee138 | 2015-02-13 14:47:58 +0200 | [diff] [blame] | 116 | /* read interrupt status just to clear it */ |
| 117 | phy_read(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211x_PHY_INER); |
| 118 | |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 119 | genphy_config_aneg(phydev); |
| 120 | |
| 121 | return 0; |
| 122 | } |
| 123 | |
Shengzhou Liu | 793ea94 | 2015-04-24 16:57:17 +0800 | [diff] [blame] | 124 | static int rtl8211f_config(struct phy_device *phydev) |
| 125 | { |
| 126 | u16 reg; |
| 127 | |
| 128 | phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET); |
| 129 | |
Madalin Bucur | 05b29aa | 2017-08-18 11:35:24 +0300 | [diff] [blame] | 130 | phy_write(phydev, MDIO_DEVAD_NONE, |
| 131 | MIIM_RTL8211F_PAGE_SELECT, 0xd08); |
| 132 | reg = phy_read(phydev, MDIO_DEVAD_NONE, 0x11); |
| 133 | |
| 134 | /* enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it */ |
| 135 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || |
| 136 | phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) |
Shengzhou Liu | 793ea94 | 2015-04-24 16:57:17 +0800 | [diff] [blame] | 137 | reg |= MIIM_RTL8211F_TX_DELAY; |
Madalin Bucur | 05b29aa | 2017-08-18 11:35:24 +0300 | [diff] [blame] | 138 | else |
| 139 | reg &= ~MIIM_RTL8211F_TX_DELAY; |
| 140 | |
| 141 | phy_write(phydev, MDIO_DEVAD_NONE, 0x11, reg); |
| 142 | /* restore to default page 0 */ |
| 143 | phy_write(phydev, MDIO_DEVAD_NONE, |
| 144 | MIIM_RTL8211F_PAGE_SELECT, 0x0); |
Shengzhou Liu | 793ea94 | 2015-04-24 16:57:17 +0800 | [diff] [blame] | 145 | |
Shengzhou Liu | 9071274 | 2015-05-21 18:07:35 +0800 | [diff] [blame] | 146 | /* Set green LED for Link, yellow LED for Active */ |
| 147 | phy_write(phydev, MDIO_DEVAD_NONE, |
| 148 | MIIM_RTL8211F_PAGE_SELECT, 0xd04); |
| 149 | phy_write(phydev, MDIO_DEVAD_NONE, 0x10, 0x617f); |
| 150 | phy_write(phydev, MDIO_DEVAD_NONE, |
| 151 | MIIM_RTL8211F_PAGE_SELECT, 0x0); |
| 152 | |
Shengzhou Liu | 793ea94 | 2015-04-24 16:57:17 +0800 | [diff] [blame] | 153 | genphy_config_aneg(phydev); |
| 154 | |
| 155 | return 0; |
| 156 | } |
| 157 | |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 158 | static int rtl8211x_parse_status(struct phy_device *phydev) |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 159 | { |
| 160 | unsigned int speed; |
| 161 | unsigned int mii_reg; |
| 162 | |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 163 | mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211x_PHY_STATUS); |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 164 | |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 165 | if (!(mii_reg & MIIM_RTL8211x_PHYSTAT_SPDDONE)) { |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 166 | int i = 0; |
| 167 | |
| 168 | /* in case of timeout ->link is cleared */ |
| 169 | phydev->link = 1; |
| 170 | puts("Waiting for PHY realtime link"); |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 171 | while (!(mii_reg & MIIM_RTL8211x_PHYSTAT_SPDDONE)) { |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 172 | /* Timeout reached ? */ |
| 173 | if (i > PHY_AUTONEGOTIATE_TIMEOUT) { |
| 174 | puts(" TIMEOUT !\n"); |
| 175 | phydev->link = 0; |
| 176 | break; |
| 177 | } |
| 178 | |
| 179 | if ((i++ % 1000) == 0) |
| 180 | putc('.'); |
| 181 | udelay(1000); /* 1 ms */ |
| 182 | mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 183 | MIIM_RTL8211x_PHY_STATUS); |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 184 | } |
| 185 | puts(" done\n"); |
| 186 | udelay(500000); /* another 500 ms (results in faster booting) */ |
| 187 | } else { |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 188 | if (mii_reg & MIIM_RTL8211x_PHYSTAT_LINK) |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 189 | phydev->link = 1; |
| 190 | else |
| 191 | phydev->link = 0; |
| 192 | } |
| 193 | |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 194 | if (mii_reg & MIIM_RTL8211x_PHYSTAT_DUPLEX) |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 195 | phydev->duplex = DUPLEX_FULL; |
| 196 | else |
| 197 | phydev->duplex = DUPLEX_HALF; |
| 198 | |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 199 | speed = (mii_reg & MIIM_RTL8211x_PHYSTAT_SPEED); |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 200 | |
| 201 | switch (speed) { |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 202 | case MIIM_RTL8211x_PHYSTAT_GBIT: |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 203 | phydev->speed = SPEED_1000; |
| 204 | break; |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 205 | case MIIM_RTL8211x_PHYSTAT_100: |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 206 | phydev->speed = SPEED_100; |
| 207 | break; |
| 208 | default: |
| 209 | phydev->speed = SPEED_10; |
| 210 | } |
| 211 | |
| 212 | return 0; |
| 213 | } |
| 214 | |
Shengzhou Liu | 3d6af74 | 2015-03-12 18:54:59 +0800 | [diff] [blame] | 215 | static int rtl8211f_parse_status(struct phy_device *phydev) |
| 216 | { |
| 217 | unsigned int speed; |
| 218 | unsigned int mii_reg; |
| 219 | int i = 0; |
| 220 | |
| 221 | phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, 0xa43); |
| 222 | mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PHY_STATUS); |
| 223 | |
| 224 | phydev->link = 1; |
| 225 | while (!(mii_reg & MIIM_RTL8211F_PHYSTAT_LINK)) { |
| 226 | if (i > PHY_AUTONEGOTIATE_TIMEOUT) { |
| 227 | puts(" TIMEOUT !\n"); |
| 228 | phydev->link = 0; |
| 229 | break; |
| 230 | } |
| 231 | |
| 232 | if ((i++ % 1000) == 0) |
| 233 | putc('.'); |
| 234 | udelay(1000); |
| 235 | mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, |
| 236 | MIIM_RTL8211F_PHY_STATUS); |
| 237 | } |
| 238 | |
| 239 | if (mii_reg & MIIM_RTL8211F_PHYSTAT_DUPLEX) |
| 240 | phydev->duplex = DUPLEX_FULL; |
| 241 | else |
| 242 | phydev->duplex = DUPLEX_HALF; |
| 243 | |
| 244 | speed = (mii_reg & MIIM_RTL8211F_PHYSTAT_SPEED); |
| 245 | |
| 246 | switch (speed) { |
| 247 | case MIIM_RTL8211F_PHYSTAT_GBIT: |
| 248 | phydev->speed = SPEED_1000; |
| 249 | break; |
| 250 | case MIIM_RTL8211F_PHYSTAT_100: |
| 251 | phydev->speed = SPEED_100; |
| 252 | break; |
| 253 | default: |
| 254 | phydev->speed = SPEED_10; |
| 255 | } |
| 256 | |
Shengzhou Liu | 3d6af74 | 2015-03-12 18:54:59 +0800 | [diff] [blame] | 257 | return 0; |
| 258 | } |
| 259 | |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 260 | static int rtl8211x_startup(struct phy_device *phydev) |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 261 | { |
Michal Simek | b733c27 | 2016-05-18 12:46:12 +0200 | [diff] [blame] | 262 | int ret; |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 263 | |
Michal Simek | b733c27 | 2016-05-18 12:46:12 +0200 | [diff] [blame] | 264 | /* Read the Status (2x to make sure link is right) */ |
| 265 | ret = genphy_update_link(phydev); |
| 266 | if (ret) |
| 267 | return ret; |
| 268 | |
| 269 | return rtl8211x_parse_status(phydev); |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 270 | } |
| 271 | |
Michal Simek | 6a10bc5 | 2016-02-13 10:31:32 +0100 | [diff] [blame] | 272 | static int rtl8211e_startup(struct phy_device *phydev) |
| 273 | { |
Michal Simek | b733c27 | 2016-05-18 12:46:12 +0200 | [diff] [blame] | 274 | int ret; |
Michal Simek | 6a10bc5 | 2016-02-13 10:31:32 +0100 | [diff] [blame] | 275 | |
Michal Simek | b733c27 | 2016-05-18 12:46:12 +0200 | [diff] [blame] | 276 | ret = genphy_update_link(phydev); |
| 277 | if (ret) |
| 278 | return ret; |
| 279 | |
| 280 | return genphy_parse_link(phydev); |
Michal Simek | 6a10bc5 | 2016-02-13 10:31:32 +0100 | [diff] [blame] | 281 | } |
| 282 | |
Shengzhou Liu | 3d6af74 | 2015-03-12 18:54:59 +0800 | [diff] [blame] | 283 | static int rtl8211f_startup(struct phy_device *phydev) |
| 284 | { |
Michal Simek | b733c27 | 2016-05-18 12:46:12 +0200 | [diff] [blame] | 285 | int ret; |
Shengzhou Liu | 3d6af74 | 2015-03-12 18:54:59 +0800 | [diff] [blame] | 286 | |
Michal Simek | b733c27 | 2016-05-18 12:46:12 +0200 | [diff] [blame] | 287 | /* Read the Status (2x to make sure link is right) */ |
| 288 | ret = genphy_update_link(phydev); |
| 289 | if (ret) |
| 290 | return ret; |
| 291 | /* Read the Status (2x to make sure link is right) */ |
| 292 | |
| 293 | return rtl8211f_parse_status(phydev); |
Shengzhou Liu | 3d6af74 | 2015-03-12 18:54:59 +0800 | [diff] [blame] | 294 | } |
| 295 | |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 296 | /* Support for RTL8211B PHY */ |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 297 | static struct phy_driver RTL8211B_driver = { |
| 298 | .name = "RealTek RTL8211B", |
Karsten Merker | 563d8d9 | 2016-03-21 20:29:07 +0100 | [diff] [blame] | 299 | .uid = 0x1cc912, |
Bhupesh Sharma | 4220504 | 2013-09-01 04:40:52 +0530 | [diff] [blame] | 300 | .mask = 0xffffff, |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 301 | .features = PHY_GBIT_FEATURES, |
oliver@schinagl.nl | cebf3f5 | 2016-11-08 17:38:59 +0100 | [diff] [blame] | 302 | .probe = &rtl8211b_probe, |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 303 | .config = &rtl8211x_config, |
| 304 | .startup = &rtl8211x_startup, |
| 305 | .shutdown = &genphy_shutdown, |
| 306 | }; |
| 307 | |
| 308 | /* Support for RTL8211E-VB-CG, RTL8211E-VL-CG and RTL8211EG-VB-CG PHYs */ |
| 309 | static struct phy_driver RTL8211E_driver = { |
| 310 | .name = "RealTek RTL8211E", |
| 311 | .uid = 0x1cc915, |
Bhupesh Sharma | 4220504 | 2013-09-01 04:40:52 +0530 | [diff] [blame] | 312 | .mask = 0xffffff, |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 313 | .features = PHY_GBIT_FEATURES, |
kevans@FreeBSD.org | 66526e7 | 2018-02-14 17:02:15 -0600 | [diff] [blame] | 314 | .probe = &rtl8211e_probe, |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 315 | .config = &rtl8211x_config, |
Michal Simek | 6a10bc5 | 2016-02-13 10:31:32 +0100 | [diff] [blame] | 316 | .startup = &rtl8211e_startup, |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 317 | .shutdown = &genphy_shutdown, |
| 318 | }; |
| 319 | |
| 320 | /* Support for RTL8211DN PHY */ |
| 321 | static struct phy_driver RTL8211DN_driver = { |
| 322 | .name = "RealTek RTL8211DN", |
| 323 | .uid = 0x1cc914, |
Bhupesh Sharma | 4220504 | 2013-09-01 04:40:52 +0530 | [diff] [blame] | 324 | .mask = 0xffffff, |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 325 | .features = PHY_GBIT_FEATURES, |
| 326 | .config = &rtl8211x_config, |
| 327 | .startup = &rtl8211x_startup, |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 328 | .shutdown = &genphy_shutdown, |
| 329 | }; |
| 330 | |
Shengzhou Liu | 3d6af74 | 2015-03-12 18:54:59 +0800 | [diff] [blame] | 331 | /* Support for RTL8211F PHY */ |
| 332 | static struct phy_driver RTL8211F_driver = { |
| 333 | .name = "RealTek RTL8211F", |
| 334 | .uid = 0x1cc916, |
| 335 | .mask = 0xffffff, |
| 336 | .features = PHY_GBIT_FEATURES, |
Shengzhou Liu | 793ea94 | 2015-04-24 16:57:17 +0800 | [diff] [blame] | 337 | .config = &rtl8211f_config, |
Shengzhou Liu | 3d6af74 | 2015-03-12 18:54:59 +0800 | [diff] [blame] | 338 | .startup = &rtl8211f_startup, |
| 339 | .shutdown = &genphy_shutdown, |
| 340 | }; |
| 341 | |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 342 | int phy_realtek_init(void) |
| 343 | { |
| 344 | phy_register(&RTL8211B_driver); |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 345 | phy_register(&RTL8211E_driver); |
Shengzhou Liu | 3d6af74 | 2015-03-12 18:54:59 +0800 | [diff] [blame] | 346 | phy_register(&RTL8211F_driver); |
Bhupesh Sharma | c624d16 | 2013-07-18 13:58:20 +0530 | [diff] [blame] | 347 | phy_register(&RTL8211DN_driver); |
Andy Fleming | 9082eea | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 348 | |
| 349 | return 0; |
| 350 | } |