Andrew Lunn | a2443fd | 2019-01-21 19:05:50 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 2 | /* |
| 3 | * drivers/net/phy/smsc.c |
| 4 | * |
| 5 | * Driver for SMSC PHYs |
| 6 | * |
| 7 | * Author: Herbert Valerio Riedel |
| 8 | * |
| 9 | * Copyright (c) 2006 Herbert Valerio Riedel <hvr@gnu.org> |
| 10 | * |
Steve Glendinning | 90b24cf | 2012-04-16 12:13:29 +0100 | [diff] [blame] | 11 | * Support added for SMSC LAN8187 and LAN8700 by steve.glendinning@shawell.net |
Steve Glendinning | 4d9b1a0 | 2008-04-28 18:37:29 +0100 | [diff] [blame] | 12 | * |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 13 | */ |
| 14 | |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 15 | #include <linux/kernel.h> |
| 16 | #include <linux/module.h> |
| 17 | #include <linux/mii.h> |
| 18 | #include <linux/ethtool.h> |
Andrew Lunn | c6e970a | 2017-03-28 23:45:06 +0200 | [diff] [blame] | 19 | #include <linux/of.h> |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 20 | #include <linux/phy.h> |
| 21 | #include <linux/netdevice.h> |
Javier Martinez Canillas | 43c6759 | 2012-01-03 20:23:18 -0500 | [diff] [blame] | 22 | #include <linux/smscphy.h> |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 23 | |
Andre Edich | 05b35e7 | 2020-08-26 13:17:17 +0200 | [diff] [blame] | 24 | /* Vendor-specific PHY Definitions */ |
| 25 | /* EDPD NLP / crossover time configuration */ |
| 26 | #define PHY_EDPD_CONFIG 16 |
| 27 | #define PHY_EDPD_CONFIG_EXT_CROSSOVER_ 0x0001 |
| 28 | |
| 29 | /* Control/Status Indication Register */ |
| 30 | #define SPECIAL_CTRL_STS 27 |
| 31 | #define SPECIAL_CTRL_STS_OVRRD_AMDIX_ 0x8000 |
| 32 | #define SPECIAL_CTRL_STS_AMDIX_ENABLE_ 0x4000 |
| 33 | #define SPECIAL_CTRL_STS_AMDIX_STATE_ 0x2000 |
| 34 | |
Andrew Lunn | 030a890 | 2017-06-03 20:00:36 +0200 | [diff] [blame] | 35 | struct smsc_hw_stat { |
| 36 | const char *string; |
| 37 | u8 reg; |
| 38 | u8 bits; |
| 39 | }; |
| 40 | |
| 41 | static struct smsc_hw_stat smsc_hw_stats[] = { |
| 42 | { "phy_symbol_errors", 26, 16}, |
| 43 | }; |
| 44 | |
Teresa Remmet | 0a9c453 | 2016-01-20 13:40:35 +0100 | [diff] [blame] | 45 | struct smsc_phy_priv { |
| 46 | bool energy_enable; |
| 47 | }; |
| 48 | |
Steve Glendinning | 48c41b9 | 2008-04-28 18:36:46 +0100 | [diff] [blame] | 49 | static int smsc_phy_config_intr(struct phy_device *phydev) |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 50 | { |
Marco Felsch | 7365494 | 2020-09-09 15:44:57 +0200 | [diff] [blame] | 51 | struct smsc_phy_priv *priv = phydev->priv; |
| 52 | u16 intmask = 0; |
| 53 | int rc; |
| 54 | |
| 55 | if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { |
| 56 | intmask = MII_LAN83C185_ISF_INT4 | MII_LAN83C185_ISF_INT6; |
| 57 | if (priv->energy_enable) |
| 58 | intmask |= MII_LAN83C185_ISF_INT7; |
| 59 | } |
| 60 | |
| 61 | rc = phy_write(phydev, MII_LAN83C185_IM, intmask); |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 62 | |
| 63 | return rc < 0 ? rc : 0; |
| 64 | } |
| 65 | |
Steve Glendinning | 48c41b9 | 2008-04-28 18:36:46 +0100 | [diff] [blame] | 66 | static int smsc_phy_ack_interrupt(struct phy_device *phydev) |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 67 | { |
| 68 | int rc = phy_read (phydev, MII_LAN83C185_ISF); |
| 69 | |
| 70 | return rc < 0 ? rc : 0; |
| 71 | } |
| 72 | |
Steve Glendinning | 48c41b9 | 2008-04-28 18:36:46 +0100 | [diff] [blame] | 73 | static int smsc_phy_config_init(struct phy_device *phydev) |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 74 | { |
Teresa Remmet | 0a9c453 | 2016-01-20 13:40:35 +0100 | [diff] [blame] | 75 | struct smsc_phy_priv *priv = phydev->priv; |
Marco Felsch | 436e380 | 2020-09-09 15:44:58 +0200 | [diff] [blame^] | 76 | int rc; |
Teresa Remmet | 0a9c453 | 2016-01-20 13:40:35 +0100 | [diff] [blame] | 77 | |
Marco Felsch | 436e380 | 2020-09-09 15:44:58 +0200 | [diff] [blame^] | 78 | if (!priv->energy_enable) |
| 79 | return 0; |
| 80 | |
| 81 | rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); |
Gwenhael Goavec-Merou | 2100968 | 2014-08-15 15:00:38 +0200 | [diff] [blame] | 82 | |
| 83 | if (rc < 0) |
| 84 | return rc; |
| 85 | |
Marco Felsch | 436e380 | 2020-09-09 15:44:58 +0200 | [diff] [blame^] | 86 | /* Enable energy detect mode for this SMSC Transceivers */ |
| 87 | rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, |
| 88 | rc | MII_LAN83C185_EDPWRDOWN); |
| 89 | if (rc < 0) |
| 90 | return rc; |
Gwenhael Goavec-Merou | 2100968 | 2014-08-15 15:00:38 +0200 | [diff] [blame] | 91 | |
| 92 | return smsc_phy_ack_interrupt(phydev); |
| 93 | } |
| 94 | |
| 95 | static int smsc_phy_reset(struct phy_device *phydev) |
| 96 | { |
trem | 6ded7cd | 2012-12-04 08:52:10 +0000 | [diff] [blame] | 97 | int rc = phy_read(phydev, MII_LAN83C185_SPECIAL_MODES); |
| 98 | if (rc < 0) |
| 99 | return rc; |
| 100 | |
| 101 | /* If the SMSC PHY is in power down mode, then set it |
| 102 | * in all capable mode before using it. |
| 103 | */ |
| 104 | if ((rc & MII_LAN83C185_MODE_MASK) == MII_LAN83C185_MODE_POWERDOWN) { |
Manfred Schlaegl | fc0f7e3 | 2016-06-06 10:47:47 +0200 | [diff] [blame] | 105 | /* set "all capable" mode */ |
trem | 6ded7cd | 2012-12-04 08:52:10 +0000 | [diff] [blame] | 106 | rc |= MII_LAN83C185_MODE_ALL; |
| 107 | phy_write(phydev, MII_LAN83C185_SPECIAL_MODES, rc); |
trem | 6ded7cd | 2012-12-04 08:52:10 +0000 | [diff] [blame] | 108 | } |
Manfred Schlaegl | fc0f7e3 | 2016-06-06 10:47:47 +0200 | [diff] [blame] | 109 | |
| 110 | /* reset the phy */ |
| 111 | return genphy_soft_reset(phydev); |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 112 | } |
| 113 | |
Giuseppe Cavallaro | 698244a | 2010-01-06 20:35:14 -0800 | [diff] [blame] | 114 | static int lan911x_config_init(struct phy_device *phydev) |
| 115 | { |
| 116 | return smsc_phy_ack_interrupt(phydev); |
| 117 | } |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 118 | |
Andre Edich | 05b35e7 | 2020-08-26 13:17:17 +0200 | [diff] [blame] | 119 | static int lan87xx_config_aneg(struct phy_device *phydev) |
| 120 | { |
| 121 | int rc; |
| 122 | int val; |
| 123 | |
| 124 | switch (phydev->mdix_ctrl) { |
| 125 | case ETH_TP_MDI: |
| 126 | val = SPECIAL_CTRL_STS_OVRRD_AMDIX_; |
| 127 | break; |
| 128 | case ETH_TP_MDI_X: |
| 129 | val = SPECIAL_CTRL_STS_OVRRD_AMDIX_ | |
| 130 | SPECIAL_CTRL_STS_AMDIX_STATE_; |
| 131 | break; |
| 132 | case ETH_TP_MDI_AUTO: |
| 133 | val = SPECIAL_CTRL_STS_AMDIX_ENABLE_; |
| 134 | break; |
| 135 | default: |
| 136 | return genphy_config_aneg(phydev); |
| 137 | } |
| 138 | |
| 139 | rc = phy_read(phydev, SPECIAL_CTRL_STS); |
| 140 | if (rc < 0) |
| 141 | return rc; |
| 142 | |
| 143 | rc &= ~(SPECIAL_CTRL_STS_OVRRD_AMDIX_ | |
| 144 | SPECIAL_CTRL_STS_AMDIX_ENABLE_ | |
| 145 | SPECIAL_CTRL_STS_AMDIX_STATE_); |
| 146 | rc |= val; |
| 147 | phy_write(phydev, SPECIAL_CTRL_STS, rc); |
| 148 | |
| 149 | phydev->mdix = phydev->mdix_ctrl; |
| 150 | return genphy_config_aneg(phydev); |
| 151 | } |
| 152 | |
| 153 | static int lan87xx_config_aneg_ext(struct phy_device *phydev) |
| 154 | { |
| 155 | int rc; |
| 156 | |
| 157 | /* Extend Manual AutoMDIX timer */ |
| 158 | rc = phy_read(phydev, PHY_EDPD_CONFIG); |
| 159 | if (rc < 0) |
| 160 | return rc; |
| 161 | |
| 162 | rc |= PHY_EDPD_CONFIG_EXT_CROSSOVER_; |
| 163 | phy_write(phydev, PHY_EDPD_CONFIG, rc); |
| 164 | return lan87xx_config_aneg(phydev); |
| 165 | } |
| 166 | |
Patrick Trantham | 4223dbf | 2012-11-15 09:00:57 +0000 | [diff] [blame] | 167 | /* |
Igor Plyatov | 776829d | 2015-08-14 20:11:02 +0300 | [diff] [blame] | 168 | * The LAN87xx suffers from rare absence of the ENERGYON-bit when Ethernet cable |
| 169 | * plugs in while LAN87xx is in Energy Detect Power-Down mode. This leads to |
| 170 | * unstable detection of plugging in Ethernet cable. |
| 171 | * This workaround disables Energy Detect Power-Down mode and waiting for |
| 172 | * response on link pulses to detect presence of plugged Ethernet cable. |
| 173 | * The Energy Detect Power-Down mode is enabled again in the end of procedure to |
| 174 | * save approximately 220 mW of power if cable is unplugged. |
Patrick Trantham | 4223dbf | 2012-11-15 09:00:57 +0000 | [diff] [blame] | 175 | */ |
| 176 | static int lan87xx_read_status(struct phy_device *phydev) |
| 177 | { |
Teresa Remmet | 0a9c453 | 2016-01-20 13:40:35 +0100 | [diff] [blame] | 178 | struct smsc_phy_priv *priv = phydev->priv; |
Patrick Trantham | 4223dbf | 2012-11-15 09:00:57 +0000 | [diff] [blame] | 179 | |
Teresa Remmet | 0a9c453 | 2016-01-20 13:40:35 +0100 | [diff] [blame] | 180 | int err = genphy_read_status(phydev); |
| 181 | |
| 182 | if (!phydev->link && priv->energy_enable) { |
Patrick Trantham | 4223dbf | 2012-11-15 09:00:57 +0000 | [diff] [blame] | 183 | /* Disable EDPD to wake up PHY */ |
| 184 | int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); |
| 185 | if (rc < 0) |
| 186 | return rc; |
| 187 | |
| 188 | rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, |
| 189 | rc & ~MII_LAN83C185_EDPWRDOWN); |
| 190 | if (rc < 0) |
| 191 | return rc; |
| 192 | |
Dejin Zheng | 6d61f48 | 2020-06-20 22:55:34 +0800 | [diff] [blame] | 193 | /* Wait max 640 ms to detect energy and the timeout is not |
| 194 | * an actual error. |
| 195 | */ |
| 196 | read_poll_timeout(phy_read, rc, |
| 197 | rc & MII_LAN83C185_ENERGYON || rc < 0, |
| 198 | 10000, 640000, true, phydev, |
| 199 | MII_LAN83C185_CTRL_STATUS); |
Dejin Zheng | 7ae7ad2 | 2020-03-23 23:05:59 +0800 | [diff] [blame] | 200 | if (rc < 0) |
| 201 | return rc; |
Patrick Trantham | 4223dbf | 2012-11-15 09:00:57 +0000 | [diff] [blame] | 202 | |
| 203 | /* Re-enable EDPD */ |
| 204 | rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); |
| 205 | if (rc < 0) |
| 206 | return rc; |
| 207 | |
| 208 | rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, |
| 209 | rc | MII_LAN83C185_EDPWRDOWN); |
| 210 | if (rc < 0) |
| 211 | return rc; |
| 212 | } |
| 213 | |
| 214 | return err; |
| 215 | } |
| 216 | |
Andrew Lunn | 030a890 | 2017-06-03 20:00:36 +0200 | [diff] [blame] | 217 | static int smsc_get_sset_count(struct phy_device *phydev) |
| 218 | { |
| 219 | return ARRAY_SIZE(smsc_hw_stats); |
| 220 | } |
| 221 | |
| 222 | static void smsc_get_strings(struct phy_device *phydev, u8 *data) |
| 223 | { |
| 224 | int i; |
| 225 | |
| 226 | for (i = 0; i < ARRAY_SIZE(smsc_hw_stats); i++) { |
Arnd Bergmann | 2da5539 | 2017-06-20 22:40:46 +0200 | [diff] [blame] | 227 | strncpy(data + i * ETH_GSTRING_LEN, |
Andrew Lunn | 030a890 | 2017-06-03 20:00:36 +0200 | [diff] [blame] | 228 | smsc_hw_stats[i].string, ETH_GSTRING_LEN); |
| 229 | } |
| 230 | } |
| 231 | |
Andrew Lunn | 030a890 | 2017-06-03 20:00:36 +0200 | [diff] [blame] | 232 | static u64 smsc_get_stat(struct phy_device *phydev, int i) |
| 233 | { |
| 234 | struct smsc_hw_stat stat = smsc_hw_stats[i]; |
| 235 | int val; |
| 236 | u64 ret; |
| 237 | |
| 238 | val = phy_read(phydev, stat.reg); |
| 239 | if (val < 0) |
Jisheng Zhang | 6c3442f | 2018-04-27 16:18:58 +0800 | [diff] [blame] | 240 | ret = U64_MAX; |
Andrew Lunn | 030a890 | 2017-06-03 20:00:36 +0200 | [diff] [blame] | 241 | else |
| 242 | ret = val; |
| 243 | |
| 244 | return ret; |
| 245 | } |
| 246 | |
| 247 | static void smsc_get_stats(struct phy_device *phydev, |
| 248 | struct ethtool_stats *stats, u64 *data) |
| 249 | { |
| 250 | int i; |
| 251 | |
| 252 | for (i = 0; i < ARRAY_SIZE(smsc_hw_stats); i++) |
| 253 | data[i] = smsc_get_stat(phydev, i); |
| 254 | } |
| 255 | |
Teresa Remmet | 0a9c453 | 2016-01-20 13:40:35 +0100 | [diff] [blame] | 256 | static int smsc_phy_probe(struct phy_device *phydev) |
| 257 | { |
| 258 | struct device *dev = &phydev->mdio.dev; |
| 259 | struct device_node *of_node = dev->of_node; |
| 260 | struct smsc_phy_priv *priv; |
| 261 | |
| 262 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); |
| 263 | if (!priv) |
| 264 | return -ENOMEM; |
| 265 | |
| 266 | priv->energy_enable = true; |
| 267 | |
| 268 | if (of_property_read_bool(of_node, "smsc,disable-energy-detect")) |
| 269 | priv->energy_enable = false; |
| 270 | |
| 271 | phydev->priv = priv; |
| 272 | |
| 273 | return 0; |
| 274 | } |
| 275 | |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 276 | static struct phy_driver smsc_phy_driver[] = { |
| 277 | { |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 278 | .phy_id = 0x0007c0a0, /* OUI=0x00800f, Model#=0x0a */ |
| 279 | .phy_id_mask = 0xfffffff0, |
| 280 | .name = "SMSC LAN83C185", |
| 281 | |
Heiner Kallweit | dcdecdc | 2019-04-12 20:47:03 +0200 | [diff] [blame] | 282 | /* PHY_BASIC_FEATURES */ |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 283 | |
Teresa Remmet | 0a9c453 | 2016-01-20 13:40:35 +0100 | [diff] [blame] | 284 | .probe = smsc_phy_probe, |
| 285 | |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 286 | /* basic functions */ |
Steve Glendinning | 48c41b9 | 2008-04-28 18:36:46 +0100 | [diff] [blame] | 287 | .config_init = smsc_phy_config_init, |
Gwenhael Goavec-Merou | 2100968 | 2014-08-15 15:00:38 +0200 | [diff] [blame] | 288 | .soft_reset = smsc_phy_reset, |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 289 | |
| 290 | /* IRQ related */ |
Steve Glendinning | 48c41b9 | 2008-04-28 18:36:46 +0100 | [diff] [blame] | 291 | .ack_interrupt = smsc_phy_ack_interrupt, |
| 292 | .config_intr = smsc_phy_config_intr, |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 293 | |
Steve Glendinning | c64d2a9 | 2009-01-22 14:07:43 -0800 | [diff] [blame] | 294 | .suspend = genphy_suspend, |
| 295 | .resume = genphy_resume, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 296 | }, { |
Steve Glendinning | 4d9b1a0 | 2008-04-28 18:37:29 +0100 | [diff] [blame] | 297 | .phy_id = 0x0007c0b0, /* OUI=0x00800f, Model#=0x0b */ |
| 298 | .phy_id_mask = 0xfffffff0, |
| 299 | .name = "SMSC LAN8187", |
| 300 | |
Heiner Kallweit | dcdecdc | 2019-04-12 20:47:03 +0200 | [diff] [blame] | 301 | /* PHY_BASIC_FEATURES */ |
Steve Glendinning | 4d9b1a0 | 2008-04-28 18:37:29 +0100 | [diff] [blame] | 302 | |
Teresa Remmet | 0a9c453 | 2016-01-20 13:40:35 +0100 | [diff] [blame] | 303 | .probe = smsc_phy_probe, |
| 304 | |
Steve Glendinning | 4d9b1a0 | 2008-04-28 18:37:29 +0100 | [diff] [blame] | 305 | /* basic functions */ |
Steve Glendinning | 4d9b1a0 | 2008-04-28 18:37:29 +0100 | [diff] [blame] | 306 | .config_init = smsc_phy_config_init, |
Gwenhael Goavec-Merou | 2100968 | 2014-08-15 15:00:38 +0200 | [diff] [blame] | 307 | .soft_reset = smsc_phy_reset, |
Steve Glendinning | 4d9b1a0 | 2008-04-28 18:37:29 +0100 | [diff] [blame] | 308 | |
| 309 | /* IRQ related */ |
| 310 | .ack_interrupt = smsc_phy_ack_interrupt, |
| 311 | .config_intr = smsc_phy_config_intr, |
| 312 | |
Andrew Lunn | 030a890 | 2017-06-03 20:00:36 +0200 | [diff] [blame] | 313 | /* Statistics */ |
| 314 | .get_sset_count = smsc_get_sset_count, |
| 315 | .get_strings = smsc_get_strings, |
| 316 | .get_stats = smsc_get_stats, |
| 317 | |
Steve Glendinning | c64d2a9 | 2009-01-22 14:07:43 -0800 | [diff] [blame] | 318 | .suspend = genphy_suspend, |
| 319 | .resume = genphy_resume, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 320 | }, { |
Andre Edich | 05b35e7 | 2020-08-26 13:17:17 +0200 | [diff] [blame] | 321 | /* This covers internal PHY (phy_id: 0x0007C0C3) for |
| 322 | * LAN9500 (PID: 0x9500), LAN9514 (PID: 0xec00), LAN9505 (PID: 0x9505) |
| 323 | */ |
Steve Glendinning | 4d9b1a0 | 2008-04-28 18:37:29 +0100 | [diff] [blame] | 324 | .phy_id = 0x0007c0c0, /* OUI=0x00800f, Model#=0x0c */ |
| 325 | .phy_id_mask = 0xfffffff0, |
| 326 | .name = "SMSC LAN8700", |
| 327 | |
Heiner Kallweit | dcdecdc | 2019-04-12 20:47:03 +0200 | [diff] [blame] | 328 | /* PHY_BASIC_FEATURES */ |
Steve Glendinning | 4d9b1a0 | 2008-04-28 18:37:29 +0100 | [diff] [blame] | 329 | |
Teresa Remmet | 0a9c453 | 2016-01-20 13:40:35 +0100 | [diff] [blame] | 330 | .probe = smsc_phy_probe, |
| 331 | |
Steve Glendinning | 4d9b1a0 | 2008-04-28 18:37:29 +0100 | [diff] [blame] | 332 | /* basic functions */ |
Igor Plyatov | 776829d | 2015-08-14 20:11:02 +0300 | [diff] [blame] | 333 | .read_status = lan87xx_read_status, |
Steve Glendinning | 4d9b1a0 | 2008-04-28 18:37:29 +0100 | [diff] [blame] | 334 | .config_init = smsc_phy_config_init, |
Gwenhael Goavec-Merou | 2100968 | 2014-08-15 15:00:38 +0200 | [diff] [blame] | 335 | .soft_reset = smsc_phy_reset, |
Andre Edich | 05b35e7 | 2020-08-26 13:17:17 +0200 | [diff] [blame] | 336 | .config_aneg = lan87xx_config_aneg, |
Steve Glendinning | 4d9b1a0 | 2008-04-28 18:37:29 +0100 | [diff] [blame] | 337 | |
| 338 | /* IRQ related */ |
| 339 | .ack_interrupt = smsc_phy_ack_interrupt, |
| 340 | .config_intr = smsc_phy_config_intr, |
| 341 | |
Andrew Lunn | 030a890 | 2017-06-03 20:00:36 +0200 | [diff] [blame] | 342 | /* Statistics */ |
| 343 | .get_sset_count = smsc_get_sset_count, |
| 344 | .get_strings = smsc_get_strings, |
| 345 | .get_stats = smsc_get_stats, |
| 346 | |
Steve Glendinning | c64d2a9 | 2009-01-22 14:07:43 -0800 | [diff] [blame] | 347 | .suspend = genphy_suspend, |
| 348 | .resume = genphy_resume, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 349 | }, { |
Steve Glendinning | fd9abb3 | 2008-11-05 00:35:37 +0000 | [diff] [blame] | 350 | .phy_id = 0x0007c0d0, /* OUI=0x00800f, Model#=0x0d */ |
| 351 | .phy_id_mask = 0xfffffff0, |
| 352 | .name = "SMSC LAN911x Internal PHY", |
| 353 | |
Heiner Kallweit | dcdecdc | 2019-04-12 20:47:03 +0200 | [diff] [blame] | 354 | /* PHY_BASIC_FEATURES */ |
Steve Glendinning | fd9abb3 | 2008-11-05 00:35:37 +0000 | [diff] [blame] | 355 | |
Teresa Remmet | 0a9c453 | 2016-01-20 13:40:35 +0100 | [diff] [blame] | 356 | .probe = smsc_phy_probe, |
| 357 | |
Steve Glendinning | fd9abb3 | 2008-11-05 00:35:37 +0000 | [diff] [blame] | 358 | /* basic functions */ |
Giuseppe Cavallaro | 698244a | 2010-01-06 20:35:14 -0800 | [diff] [blame] | 359 | .config_init = lan911x_config_init, |
Steve Glendinning | fd9abb3 | 2008-11-05 00:35:37 +0000 | [diff] [blame] | 360 | |
| 361 | /* IRQ related */ |
| 362 | .ack_interrupt = smsc_phy_ack_interrupt, |
| 363 | .config_intr = smsc_phy_config_intr, |
| 364 | |
Steve Glendinning | c64d2a9 | 2009-01-22 14:07:43 -0800 | [diff] [blame] | 365 | .suspend = genphy_suspend, |
| 366 | .resume = genphy_resume, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 367 | }, { |
Andre Edich | 05b35e7 | 2020-08-26 13:17:17 +0200 | [diff] [blame] | 368 | /* This covers internal PHY (phy_id: 0x0007C0F0) for |
| 369 | * LAN9500A (PID: 0x9E00), LAN9505A (PID: 0x9E01) |
| 370 | */ |
Steve Glendinning | e072b63 | 2009-03-23 15:17:31 -0700 | [diff] [blame] | 371 | .phy_id = 0x0007c0f0, /* OUI=0x00800f, Model#=0x0f */ |
| 372 | .phy_id_mask = 0xfffffff0, |
| 373 | .name = "SMSC LAN8710/LAN8720", |
| 374 | |
Heiner Kallweit | dcdecdc | 2019-04-12 20:47:03 +0200 | [diff] [blame] | 375 | /* PHY_BASIC_FEATURES */ |
Heiner Kallweit | a4307c0 | 2018-11-09 18:17:22 +0100 | [diff] [blame] | 376 | .flags = PHY_RST_AFTER_CLK_EN, |
Steve Glendinning | e072b63 | 2009-03-23 15:17:31 -0700 | [diff] [blame] | 377 | |
Teresa Remmet | 0a9c453 | 2016-01-20 13:40:35 +0100 | [diff] [blame] | 378 | .probe = smsc_phy_probe, |
| 379 | |
Steve Glendinning | e072b63 | 2009-03-23 15:17:31 -0700 | [diff] [blame] | 380 | /* basic functions */ |
Patrick Trantham | 4223dbf | 2012-11-15 09:00:57 +0000 | [diff] [blame] | 381 | .read_status = lan87xx_read_status, |
Patrick Trantham | 4257d58 | 2012-12-06 15:16:02 +0000 | [diff] [blame] | 382 | .config_init = smsc_phy_config_init, |
Gwenhael Goavec-Merou | 2100968 | 2014-08-15 15:00:38 +0200 | [diff] [blame] | 383 | .soft_reset = smsc_phy_reset, |
Andre Edich | 05b35e7 | 2020-08-26 13:17:17 +0200 | [diff] [blame] | 384 | .config_aneg = lan87xx_config_aneg_ext, |
Steve Glendinning | e072b63 | 2009-03-23 15:17:31 -0700 | [diff] [blame] | 385 | |
| 386 | /* IRQ related */ |
| 387 | .ack_interrupt = smsc_phy_ack_interrupt, |
| 388 | .config_intr = smsc_phy_config_intr, |
| 389 | |
Andrew Lunn | 030a890 | 2017-06-03 20:00:36 +0200 | [diff] [blame] | 390 | /* Statistics */ |
| 391 | .get_sset_count = smsc_get_sset_count, |
| 392 | .get_strings = smsc_get_strings, |
| 393 | .get_stats = smsc_get_stats, |
| 394 | |
Steve Glendinning | e072b63 | 2009-03-23 15:17:31 -0700 | [diff] [blame] | 395 | .suspend = genphy_suspend, |
| 396 | .resume = genphy_resume, |
Joshua Henderson | 26706d4 | 2016-01-09 04:54:21 -0700 | [diff] [blame] | 397 | }, { |
| 398 | .phy_id = 0x0007c110, |
| 399 | .phy_id_mask = 0xfffffff0, |
| 400 | .name = "SMSC LAN8740", |
| 401 | |
Heiner Kallweit | dcdecdc | 2019-04-12 20:47:03 +0200 | [diff] [blame] | 402 | /* PHY_BASIC_FEATURES */ |
Martin Fuzzey | 76db2d4 | 2019-10-23 11:44:24 +0200 | [diff] [blame] | 403 | .flags = PHY_RST_AFTER_CLK_EN, |
Joshua Henderson | 26706d4 | 2016-01-09 04:54:21 -0700 | [diff] [blame] | 404 | |
Teresa Remmet | 0a9c453 | 2016-01-20 13:40:35 +0100 | [diff] [blame] | 405 | .probe = smsc_phy_probe, |
| 406 | |
Joshua Henderson | 26706d4 | 2016-01-09 04:54:21 -0700 | [diff] [blame] | 407 | /* basic functions */ |
Joshua Henderson | 26706d4 | 2016-01-09 04:54:21 -0700 | [diff] [blame] | 408 | .read_status = lan87xx_read_status, |
| 409 | .config_init = smsc_phy_config_init, |
| 410 | .soft_reset = smsc_phy_reset, |
| 411 | |
| 412 | /* IRQ related */ |
| 413 | .ack_interrupt = smsc_phy_ack_interrupt, |
| 414 | .config_intr = smsc_phy_config_intr, |
| 415 | |
Andrew Lunn | 030a890 | 2017-06-03 20:00:36 +0200 | [diff] [blame] | 416 | /* Statistics */ |
| 417 | .get_sset_count = smsc_get_sset_count, |
| 418 | .get_strings = smsc_get_strings, |
| 419 | .get_stats = smsc_get_stats, |
| 420 | |
Joshua Henderson | 26706d4 | 2016-01-09 04:54:21 -0700 | [diff] [blame] | 421 | .suspend = genphy_suspend, |
| 422 | .resume = genphy_resume, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 423 | } }; |
Steve Glendinning | e072b63 | 2009-03-23 15:17:31 -0700 | [diff] [blame] | 424 | |
Johan Hovold | 50fd715 | 2014-11-11 19:45:59 +0100 | [diff] [blame] | 425 | module_phy_driver(smsc_phy_driver); |
Herbert Valerio Riedel | c9e055a | 2006-05-07 23:22:53 +0200 | [diff] [blame] | 426 | |
| 427 | MODULE_DESCRIPTION("SMSC PHY driver"); |
| 428 | MODULE_AUTHOR("Herbert Valerio Riedel"); |
| 429 | MODULE_LICENSE("GPL"); |
| 430 | |
Uwe Kleine-König | cf93c94 | 2010-10-03 23:43:32 +0000 | [diff] [blame] | 431 | static struct mdio_device_id __maybe_unused smsc_tbl[] = { |
David Woodhouse | 4e4f10f | 2010-04-02 01:05:56 +0000 | [diff] [blame] | 432 | { 0x0007c0a0, 0xfffffff0 }, |
| 433 | { 0x0007c0b0, 0xfffffff0 }, |
| 434 | { 0x0007c0c0, 0xfffffff0 }, |
| 435 | { 0x0007c0d0, 0xfffffff0 }, |
| 436 | { 0x0007c0f0, 0xfffffff0 }, |
Joshua Henderson | 26706d4 | 2016-01-09 04:54:21 -0700 | [diff] [blame] | 437 | { 0x0007c110, 0xfffffff0 }, |
David Woodhouse | 4e4f10f | 2010-04-02 01:05:56 +0000 | [diff] [blame] | 438 | { } |
| 439 | }; |
| 440 | |
| 441 | MODULE_DEVICE_TABLE(mdio, smsc_tbl); |