blob: 8ff12938ab476e295c5e46f020a55ae78580facb [file] [log] [blame]
Matus Ujhelyi0ca71112012-10-14 19:07:16 +00001/*
2 * drivers/net/phy/at803x.c
3 *
4 * Driver for Atheros 803x PHY
5 *
6 * Author: Matus Ujhelyi <ujhelyi.m@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/phy.h>
15#include <linux/module.h>
16#include <linux/string.h>
17#include <linux/netdevice.h>
18#include <linux/etherdevice.h>
Daniel Mack13a56b42014-06-18 11:01:43 +020019#include <linux/of_gpio.h>
20#include <linux/gpio/consumer.h>
Matus Ujhelyi0ca71112012-10-14 19:07:16 +000021
22#define AT803X_INTR_ENABLE 0x12
Martin Blumenstingle6e4a552016-01-15 01:55:24 +010023#define AT803X_INTR_ENABLE_AUTONEG_ERR BIT(15)
24#define AT803X_INTR_ENABLE_SPEED_CHANGED BIT(14)
25#define AT803X_INTR_ENABLE_DUPLEX_CHANGED BIT(13)
26#define AT803X_INTR_ENABLE_PAGE_RECEIVED BIT(12)
27#define AT803X_INTR_ENABLE_LINK_FAIL BIT(11)
28#define AT803X_INTR_ENABLE_LINK_SUCCESS BIT(10)
29#define AT803X_INTR_ENABLE_WIRESPEED_DOWNGRADE BIT(5)
30#define AT803X_INTR_ENABLE_POLARITY_CHANGED BIT(1)
31#define AT803X_INTR_ENABLE_WOL BIT(0)
32
Matus Ujhelyi0ca71112012-10-14 19:07:16 +000033#define AT803X_INTR_STATUS 0x13
Martin Blumenstingla46bd632016-01-15 01:55:23 +010034
Daniel Mack13a56b42014-06-18 11:01:43 +020035#define AT803X_SMART_SPEED 0x14
36#define AT803X_LED_CONTROL 0x18
Martin Blumenstingla46bd632016-01-15 01:55:23 +010037
Matus Ujhelyi0ca71112012-10-14 19:07:16 +000038#define AT803X_DEVICE_ADDR 0x03
39#define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C
40#define AT803X_LOC_MAC_ADDR_16_31_OFFSET 0x804B
41#define AT803X_LOC_MAC_ADDR_32_47_OFFSET 0x804A
42#define AT803X_MMD_ACCESS_CONTROL 0x0D
43#define AT803X_MMD_ACCESS_CONTROL_DATA 0x0E
44#define AT803X_FUNC_DATA 0x4003
Zefir Kurtisif62265b2016-10-24 12:40:54 +020045#define AT803X_REG_CHIP_CONFIG 0x1f
46#define AT803X_BT_BX_REG_SEL 0x8000
Martin Blumenstingla46bd632016-01-15 01:55:23 +010047
Mugunthan V N1ca6d1b2013-06-03 20:10:06 +000048#define AT803X_DEBUG_ADDR 0x1D
49#define AT803X_DEBUG_DATA 0x1E
Martin Blumenstingla46bd632016-01-15 01:55:23 +010050
Zefir Kurtisif62265b2016-10-24 12:40:54 +020051#define AT803X_MODE_CFG_MASK 0x0F
52#define AT803X_MODE_CFG_SGMII 0x01
53
54#define AT803X_PSSR 0x11 /*PHY-Specific Status Register*/
55#define AT803X_PSSR_MR_AN_COMPLETE 0x0200
56
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +010057#define AT803X_DEBUG_REG_0 0x00
58#define AT803X_DEBUG_RX_CLK_DLY_EN BIT(15)
Martin Blumenstingla46bd632016-01-15 01:55:23 +010059
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +010060#define AT803X_DEBUG_REG_5 0x05
61#define AT803X_DEBUG_TX_CLK_DLY_EN BIT(8)
Matus Ujhelyi0ca71112012-10-14 19:07:16 +000062
Daniel Mackbd8ca172014-06-18 11:01:42 +020063#define ATH8030_PHY_ID 0x004dd076
64#define ATH8031_PHY_ID 0x004dd074
65#define ATH8035_PHY_ID 0x004dd072
Fabio Estevam58effd72016-10-26 14:03:54 -020066#define AT803X_PHY_ID_MASK 0xffffffef
Daniel Mackbd8ca172014-06-18 11:01:42 +020067
Matus Ujhelyi0ca71112012-10-14 19:07:16 +000068MODULE_DESCRIPTION("Atheros 803x PHY driver");
69MODULE_AUTHOR("Matus Ujhelyi");
70MODULE_LICENSE("GPL");
71
Daniel Mack13a56b42014-06-18 11:01:43 +020072struct at803x_priv {
73 bool phy_reset:1;
Daniel Mack13a56b42014-06-18 11:01:43 +020074};
75
76struct at803x_context {
77 u16 bmcr;
78 u16 advertise;
79 u16 control1000;
80 u16 int_enable;
81 u16 smart_speed;
82 u16 led_control;
83};
84
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +010085static int at803x_debug_reg_read(struct phy_device *phydev, u16 reg)
86{
87 int ret;
88
89 ret = phy_write(phydev, AT803X_DEBUG_ADDR, reg);
90 if (ret < 0)
91 return ret;
92
93 return phy_read(phydev, AT803X_DEBUG_DATA);
94}
95
96static int at803x_debug_reg_mask(struct phy_device *phydev, u16 reg,
97 u16 clear, u16 set)
98{
99 u16 val;
100 int ret;
101
102 ret = at803x_debug_reg_read(phydev, reg);
103 if (ret < 0)
104 return ret;
105
106 val = ret & 0xffff;
107 val &= ~clear;
108 val |= set;
109
110 return phy_write(phydev, AT803X_DEBUG_DATA, val);
111}
112
Vinod Koulcd28d1d2019-01-21 14:43:17 +0530113static inline int at803x_disable_rx_delay(struct phy_device *phydev)
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +0100114{
Vinod Koulcd28d1d2019-01-21 14:43:17 +0530115 return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
116 AT803X_DEBUG_RX_CLK_DLY_EN, 0);
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +0100117}
118
Vinod Koulcd28d1d2019-01-21 14:43:17 +0530119static inline int at803x_disable_tx_delay(struct phy_device *phydev)
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +0100120{
Vinod Koulcd28d1d2019-01-21 14:43:17 +0530121 return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5,
122 AT803X_DEBUG_TX_CLK_DLY_EN, 0);
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +0100123}
124
Daniel Mack13a56b42014-06-18 11:01:43 +0200125/* save relevant PHY registers to private copy */
126static void at803x_context_save(struct phy_device *phydev,
127 struct at803x_context *context)
128{
129 context->bmcr = phy_read(phydev, MII_BMCR);
130 context->advertise = phy_read(phydev, MII_ADVERTISE);
131 context->control1000 = phy_read(phydev, MII_CTRL1000);
132 context->int_enable = phy_read(phydev, AT803X_INTR_ENABLE);
133 context->smart_speed = phy_read(phydev, AT803X_SMART_SPEED);
134 context->led_control = phy_read(phydev, AT803X_LED_CONTROL);
135}
136
137/* restore relevant PHY registers from private copy */
138static void at803x_context_restore(struct phy_device *phydev,
139 const struct at803x_context *context)
140{
141 phy_write(phydev, MII_BMCR, context->bmcr);
142 phy_write(phydev, MII_ADVERTISE, context->advertise);
143 phy_write(phydev, MII_CTRL1000, context->control1000);
144 phy_write(phydev, AT803X_INTR_ENABLE, context->int_enable);
145 phy_write(phydev, AT803X_SMART_SPEED, context->smart_speed);
146 phy_write(phydev, AT803X_LED_CONTROL, context->led_control);
147}
148
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000149static int at803x_set_wol(struct phy_device *phydev,
150 struct ethtool_wolinfo *wol)
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000151{
152 struct net_device *ndev = phydev->attached_dev;
153 const u8 *mac;
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000154 int ret;
155 u32 value;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000156 unsigned int i, offsets[] = {
157 AT803X_LOC_MAC_ADDR_32_47_OFFSET,
158 AT803X_LOC_MAC_ADDR_16_31_OFFSET,
159 AT803X_LOC_MAC_ADDR_0_15_OFFSET,
160 };
161
162 if (!ndev)
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000163 return -ENODEV;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000164
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000165 if (wol->wolopts & WAKE_MAGIC) {
166 mac = (const u8 *) ndev->dev_addr;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000167
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000168 if (!is_valid_ether_addr(mac))
Dan Murphyfc755682017-10-10 12:42:56 -0500169 return -EINVAL;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000170
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000171 for (i = 0; i < 3; i++) {
172 phy_write(phydev, AT803X_MMD_ACCESS_CONTROL,
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000173 AT803X_DEVICE_ADDR);
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000174 phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA,
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000175 offsets[i]);
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000176 phy_write(phydev, AT803X_MMD_ACCESS_CONTROL,
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000177 AT803X_FUNC_DATA);
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000178 phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA,
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000179 mac[(i * 2) + 1] | (mac[(i * 2)] << 8));
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000180 }
181
182 value = phy_read(phydev, AT803X_INTR_ENABLE);
Martin Blumenstingle6e4a552016-01-15 01:55:24 +0100183 value |= AT803X_INTR_ENABLE_WOL;
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000184 ret = phy_write(phydev, AT803X_INTR_ENABLE, value);
185 if (ret)
186 return ret;
187 value = phy_read(phydev, AT803X_INTR_STATUS);
188 } else {
189 value = phy_read(phydev, AT803X_INTR_ENABLE);
Martin Blumenstingle6e4a552016-01-15 01:55:24 +0100190 value &= (~AT803X_INTR_ENABLE_WOL);
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000191 ret = phy_write(phydev, AT803X_INTR_ENABLE, value);
192 if (ret)
193 return ret;
194 value = phy_read(phydev, AT803X_INTR_STATUS);
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000195 }
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000196
197 return ret;
198}
199
200static void at803x_get_wol(struct phy_device *phydev,
201 struct ethtool_wolinfo *wol)
202{
203 u32 value;
204
205 wol->supported = WAKE_MAGIC;
206 wol->wolopts = 0;
207
208 value = phy_read(phydev, AT803X_INTR_ENABLE);
Martin Blumenstingle6e4a552016-01-15 01:55:24 +0100209 if (value & AT803X_INTR_ENABLE_WOL)
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000210 wol->wolopts |= WAKE_MAGIC;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000211}
212
Daniel Mack6229ed12013-09-21 16:53:02 +0200213static int at803x_suspend(struct phy_device *phydev)
214{
215 int value;
216 int wol_enabled;
217
Daniel Mack6229ed12013-09-21 16:53:02 +0200218 value = phy_read(phydev, AT803X_INTR_ENABLE);
Martin Blumenstingle6e4a552016-01-15 01:55:24 +0100219 wol_enabled = value & AT803X_INTR_ENABLE_WOL;
Daniel Mack6229ed12013-09-21 16:53:02 +0200220
Daniel Mack6229ed12013-09-21 16:53:02 +0200221 if (wol_enabled)
Russell Kingfea23fb2018-01-02 10:58:58 +0000222 value = BMCR_ISOLATE;
Daniel Mack6229ed12013-09-21 16:53:02 +0200223 else
Russell Kingfea23fb2018-01-02 10:58:58 +0000224 value = BMCR_PDOWN;
Daniel Mack6229ed12013-09-21 16:53:02 +0200225
Russell Kingfea23fb2018-01-02 10:58:58 +0000226 phy_modify(phydev, MII_BMCR, 0, value);
Daniel Mack6229ed12013-09-21 16:53:02 +0200227
228 return 0;
229}
230
231static int at803x_resume(struct phy_device *phydev)
232{
Russell Kingf1028522018-01-05 16:07:10 +0000233 return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0);
Daniel Mack6229ed12013-09-21 16:53:02 +0200234}
235
Daniel Mack13a56b42014-06-18 11:01:43 +0200236static int at803x_probe(struct phy_device *phydev)
237{
Andrew Lunne5a03bf2016-01-06 20:11:16 +0100238 struct device *dev = &phydev->mdio.dev;
Daniel Mack13a56b42014-06-18 11:01:43 +0200239 struct at803x_priv *priv;
240
Fengguang Wu8f2877c2014-06-22 12:32:51 +0200241 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
Daniel Mack13a56b42014-06-18 11:01:43 +0200242 if (!priv)
243 return -ENOMEM;
244
Daniel Mack13a56b42014-06-18 11:01:43 +0200245 phydev->priv = priv;
246
247 return 0;
248}
249
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000250static int at803x_config_init(struct phy_device *phydev)
251{
Mugunthan V N1ca6d1b2013-06-03 20:10:06 +0000252 int ret;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000253
Daniel Mack6ff01db2014-04-16 17:19:13 +0200254 ret = genphy_config_init(phydev);
255 if (ret < 0)
256 return ret;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000257
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +0100258 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID ||
Vinod Koulcd28d1d2019-01-21 14:43:17 +0530259 phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
260 phydev->interface == PHY_INTERFACE_MODE_RGMII) {
261 ret = at803x_disable_rx_delay(phydev);
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +0100262 if (ret < 0)
Mugunthan V N1ca6d1b2013-06-03 20:10:06 +0000263 return ret;
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +0100264 }
265
266 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID ||
Vinod Koulcd28d1d2019-01-21 14:43:17 +0530267 phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
268 phydev->interface == PHY_INTERFACE_MODE_RGMII) {
269 ret = at803x_disable_tx_delay(phydev);
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +0100270 if (ret < 0)
Mugunthan V N1ca6d1b2013-06-03 20:10:06 +0000271 return ret;
272 }
273
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000274 return 0;
275}
276
Zhao Qiang77a99392014-03-28 15:39:41 +0800277static int at803x_ack_interrupt(struct phy_device *phydev)
278{
279 int err;
280
Martin Blumenstingla46bd632016-01-15 01:55:23 +0100281 err = phy_read(phydev, AT803X_INTR_STATUS);
Zhao Qiang77a99392014-03-28 15:39:41 +0800282
283 return (err < 0) ? err : 0;
284}
285
286static int at803x_config_intr(struct phy_device *phydev)
287{
288 int err;
289 int value;
290
Martin Blumenstingla46bd632016-01-15 01:55:23 +0100291 value = phy_read(phydev, AT803X_INTR_ENABLE);
Zhao Qiang77a99392014-03-28 15:39:41 +0800292
Martin Blumenstingle6e4a552016-01-15 01:55:24 +0100293 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
294 value |= AT803X_INTR_ENABLE_AUTONEG_ERR;
295 value |= AT803X_INTR_ENABLE_SPEED_CHANGED;
296 value |= AT803X_INTR_ENABLE_DUPLEX_CHANGED;
297 value |= AT803X_INTR_ENABLE_LINK_FAIL;
298 value |= AT803X_INTR_ENABLE_LINK_SUCCESS;
299
300 err = phy_write(phydev, AT803X_INTR_ENABLE, value);
301 }
Zhao Qiang77a99392014-03-28 15:39:41 +0800302 else
Martin Blumenstingla46bd632016-01-15 01:55:23 +0100303 err = phy_write(phydev, AT803X_INTR_ENABLE, 0);
Zhao Qiang77a99392014-03-28 15:39:41 +0800304
305 return err;
306}
307
Daniel Mack13a56b42014-06-18 11:01:43 +0200308static void at803x_link_change_notify(struct phy_device *phydev)
309{
310 struct at803x_priv *priv = phydev->priv;
311
312 /*
313 * Conduct a hardware reset for AT8030 every time a link loss is
314 * signalled. This is necessary to circumvent a hardware bug that
315 * occurs when the cable is unplugged while TX packets are pending
316 * in the FIFO. In such cases, the FIFO enters an error mode it
317 * cannot recover from by software.
318 */
Timur Tabia05d7df2016-04-26 12:44:18 -0500319 if (phydev->state == PHY_NOLINK) {
Sergei Shtylyovbafbdd52017-12-04 13:35:05 +0100320 if (phydev->mdio.reset && !priv->phy_reset) {
Timur Tabia05d7df2016-04-26 12:44:18 -0500321 struct at803x_context context;
Daniel Mack13a56b42014-06-18 11:01:43 +0200322
Timur Tabia05d7df2016-04-26 12:44:18 -0500323 at803x_context_save(phydev, &context);
Daniel Mack13a56b42014-06-18 11:01:43 +0200324
Sergei Shtylyovbafbdd52017-12-04 13:35:05 +0100325 phy_device_reset(phydev, 1);
Timur Tabia05d7df2016-04-26 12:44:18 -0500326 msleep(1);
Sergei Shtylyovbafbdd52017-12-04 13:35:05 +0100327 phy_device_reset(phydev, 0);
Timur Tabia05d7df2016-04-26 12:44:18 -0500328 msleep(1);
Daniel Mack13a56b42014-06-18 11:01:43 +0200329
Timur Tabia05d7df2016-04-26 12:44:18 -0500330 at803x_context_restore(phydev, &context);
Daniel Mack13a56b42014-06-18 11:01:43 +0200331
Timur Tabia05d7df2016-04-26 12:44:18 -0500332 phydev_dbg(phydev, "%s(): phy was reset\n",
333 __func__);
334 priv->phy_reset = true;
Daniel Mack13a56b42014-06-18 11:01:43 +0200335 }
Timur Tabia05d7df2016-04-26 12:44:18 -0500336 } else {
337 priv->phy_reset = false;
Daniel Mack13a56b42014-06-18 11:01:43 +0200338 }
339}
340
Zefir Kurtisif62265b2016-10-24 12:40:54 +0200341static int at803x_aneg_done(struct phy_device *phydev)
342{
343 int ccr;
344
345 int aneg_done = genphy_aneg_done(phydev);
346 if (aneg_done != BMSR_ANEGCOMPLETE)
347 return aneg_done;
348
349 /*
350 * in SGMII mode, if copper side autoneg is successful,
351 * also check SGMII side autoneg result
352 */
353 ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG);
354 if ((ccr & AT803X_MODE_CFG_MASK) != AT803X_MODE_CFG_SGMII)
355 return aneg_done;
356
357 /* switch to SGMII/fiber page */
358 phy_write(phydev, AT803X_REG_CHIP_CONFIG, ccr & ~AT803X_BT_BX_REG_SEL);
359
360 /* check if the SGMII link is OK. */
361 if (!(phy_read(phydev, AT803X_PSSR) & AT803X_PSSR_MR_AN_COMPLETE)) {
Andrew Lunnab2a6052018-09-29 23:04:10 +0200362 phydev_warn(phydev, "803x_aneg_done: SGMII link is not ok\n");
Zefir Kurtisif62265b2016-10-24 12:40:54 +0200363 aneg_done = 0;
364 }
365 /* switch back to copper page */
366 phy_write(phydev, AT803X_REG_CHIP_CONFIG, ccr | AT803X_BT_BX_REG_SEL);
367
368 return aneg_done;
369}
370
Mugunthan V N317420a2013-06-03 20:10:04 +0000371static struct phy_driver at803x_driver[] = {
372{
373 /* ATHEROS 8035 */
Daniel Mack13a56b42014-06-18 11:01:43 +0200374 .phy_id = ATH8035_PHY_ID,
375 .name = "Atheros 8035 ethernet",
Fabio Estevam58effd72016-10-26 14:03:54 -0200376 .phy_id_mask = AT803X_PHY_ID_MASK,
Daniel Mack13a56b42014-06-18 11:01:43 +0200377 .probe = at803x_probe,
378 .config_init = at803x_config_init,
Daniel Mack13a56b42014-06-18 11:01:43 +0200379 .set_wol = at803x_set_wol,
380 .get_wol = at803x_get_wol,
381 .suspend = at803x_suspend,
382 .resume = at803x_resume,
383 .features = PHY_GBIT_FEATURES,
Måns Rullgård0eae5982015-11-12 17:40:20 +0000384 .ack_interrupt = at803x_ack_interrupt,
385 .config_intr = at803x_config_intr,
Mugunthan V N317420a2013-06-03 20:10:04 +0000386}, {
387 /* ATHEROS 8030 */
Daniel Mack13a56b42014-06-18 11:01:43 +0200388 .phy_id = ATH8030_PHY_ID,
389 .name = "Atheros 8030 ethernet",
Fabio Estevam58effd72016-10-26 14:03:54 -0200390 .phy_id_mask = AT803X_PHY_ID_MASK,
Daniel Mack13a56b42014-06-18 11:01:43 +0200391 .probe = at803x_probe,
392 .config_init = at803x_config_init,
393 .link_change_notify = at803x_link_change_notify,
394 .set_wol = at803x_set_wol,
395 .get_wol = at803x_get_wol,
396 .suspend = at803x_suspend,
397 .resume = at803x_resume,
Martin Blumenstingle15bb4c2016-01-15 01:55:21 +0100398 .features = PHY_BASIC_FEATURES,
Måns Rullgård0eae5982015-11-12 17:40:20 +0000399 .ack_interrupt = at803x_ack_interrupt,
400 .config_intr = at803x_config_intr,
Mugunthan V N05d7cce2013-06-03 20:10:07 +0000401}, {
402 /* ATHEROS 8031 */
Daniel Mack13a56b42014-06-18 11:01:43 +0200403 .phy_id = ATH8031_PHY_ID,
404 .name = "Atheros 8031 ethernet",
Fabio Estevam58effd72016-10-26 14:03:54 -0200405 .phy_id_mask = AT803X_PHY_ID_MASK,
Daniel Mack13a56b42014-06-18 11:01:43 +0200406 .probe = at803x_probe,
407 .config_init = at803x_config_init,
Daniel Mack13a56b42014-06-18 11:01:43 +0200408 .set_wol = at803x_set_wol,
409 .get_wol = at803x_get_wol,
410 .suspend = at803x_suspend,
411 .resume = at803x_resume,
412 .features = PHY_GBIT_FEATURES,
Zefir Kurtisif62265b2016-10-24 12:40:54 +0200413 .aneg_done = at803x_aneg_done,
Daniel Mack13a56b42014-06-18 11:01:43 +0200414 .ack_interrupt = &at803x_ack_interrupt,
415 .config_intr = &at803x_config_intr,
Mugunthan V N317420a2013-06-03 20:10:04 +0000416} };
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000417
Johan Hovold50fd7152014-11-11 19:45:59 +0100418module_phy_driver(at803x_driver);
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000419
420static struct mdio_device_id __maybe_unused atheros_tbl[] = {
Fabio Estevam58effd72016-10-26 14:03:54 -0200421 { ATH8030_PHY_ID, AT803X_PHY_ID_MASK },
422 { ATH8031_PHY_ID, AT803X_PHY_ID_MASK },
423 { ATH8035_PHY_ID, AT803X_PHY_ID_MASK },
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000424 { }
425};
426
427MODULE_DEVICE_TABLE(mdio, atheros_tbl);