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