blob: f3e96191eb6f3533ab8b9fcdb1affe6d1a96e5ed [file] [log] [blame]
Andrew Lunna2443fd2019-01-21 19:05:50 +01001// SPDX-License-Identifier: GPL-2.0+
Matus Ujhelyi0ca71112012-10-14 19:07:16 +00002/*
3 * drivers/net/phy/at803x.c
4 *
5 * Driver for Atheros 803x PHY
6 *
7 * Author: Matus Ujhelyi <ujhelyi.m@gmail.com>
Matus Ujhelyi0ca71112012-10-14 19:07:16 +00008 */
9
10#include <linux/phy.h>
11#include <linux/module.h>
12#include <linux/string.h>
13#include <linux/netdevice.h>
14#include <linux/etherdevice.h>
Daniel Mack13a56b42014-06-18 11:01:43 +020015#include <linux/of_gpio.h>
16#include <linux/gpio/consumer.h>
Matus Ujhelyi0ca71112012-10-14 19:07:16 +000017
18#define AT803X_INTR_ENABLE 0x12
Martin Blumenstingle6e4a552016-01-15 01:55:24 +010019#define AT803X_INTR_ENABLE_AUTONEG_ERR BIT(15)
20#define AT803X_INTR_ENABLE_SPEED_CHANGED BIT(14)
21#define AT803X_INTR_ENABLE_DUPLEX_CHANGED BIT(13)
22#define AT803X_INTR_ENABLE_PAGE_RECEIVED BIT(12)
23#define AT803X_INTR_ENABLE_LINK_FAIL BIT(11)
24#define AT803X_INTR_ENABLE_LINK_SUCCESS BIT(10)
25#define AT803X_INTR_ENABLE_WIRESPEED_DOWNGRADE BIT(5)
26#define AT803X_INTR_ENABLE_POLARITY_CHANGED BIT(1)
27#define AT803X_INTR_ENABLE_WOL BIT(0)
28
Matus Ujhelyi0ca71112012-10-14 19:07:16 +000029#define AT803X_INTR_STATUS 0x13
Martin Blumenstingla46bd632016-01-15 01:55:23 +010030
Daniel Mack13a56b42014-06-18 11:01:43 +020031#define AT803X_SMART_SPEED 0x14
32#define AT803X_LED_CONTROL 0x18
Martin Blumenstingla46bd632016-01-15 01:55:23 +010033
Matus Ujhelyi0ca71112012-10-14 19:07:16 +000034#define AT803X_DEVICE_ADDR 0x03
35#define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C
36#define AT803X_LOC_MAC_ADDR_16_31_OFFSET 0x804B
37#define AT803X_LOC_MAC_ADDR_32_47_OFFSET 0x804A
Zefir Kurtisif62265b2016-10-24 12:40:54 +020038#define AT803X_REG_CHIP_CONFIG 0x1f
39#define AT803X_BT_BX_REG_SEL 0x8000
Martin Blumenstingla46bd632016-01-15 01:55:23 +010040
Mugunthan V N1ca6d1b2013-06-03 20:10:06 +000041#define AT803X_DEBUG_ADDR 0x1D
42#define AT803X_DEBUG_DATA 0x1E
Martin Blumenstingla46bd632016-01-15 01:55:23 +010043
Zefir Kurtisif62265b2016-10-24 12:40:54 +020044#define AT803X_MODE_CFG_MASK 0x0F
45#define AT803X_MODE_CFG_SGMII 0x01
46
47#define AT803X_PSSR 0x11 /*PHY-Specific Status Register*/
48#define AT803X_PSSR_MR_AN_COMPLETE 0x0200
49
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +010050#define AT803X_DEBUG_REG_0 0x00
51#define AT803X_DEBUG_RX_CLK_DLY_EN BIT(15)
Martin Blumenstingla46bd632016-01-15 01:55:23 +010052
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +010053#define AT803X_DEBUG_REG_5 0x05
54#define AT803X_DEBUG_TX_CLK_DLY_EN BIT(8)
Matus Ujhelyi0ca71112012-10-14 19:07:16 +000055
Daniel Mackbd8ca172014-06-18 11:01:42 +020056#define ATH8030_PHY_ID 0x004dd076
57#define ATH8031_PHY_ID 0x004dd074
58#define ATH8035_PHY_ID 0x004dd072
Fabio Estevam58effd72016-10-26 14:03:54 -020059#define AT803X_PHY_ID_MASK 0xffffffef
Daniel Mackbd8ca172014-06-18 11:01:42 +020060
Matus Ujhelyi0ca71112012-10-14 19:07:16 +000061MODULE_DESCRIPTION("Atheros 803x PHY driver");
62MODULE_AUTHOR("Matus Ujhelyi");
63MODULE_LICENSE("GPL");
64
Daniel Mack13a56b42014-06-18 11:01:43 +020065struct at803x_priv {
66 bool phy_reset:1;
Daniel Mack13a56b42014-06-18 11:01:43 +020067};
68
69struct at803x_context {
70 u16 bmcr;
71 u16 advertise;
72 u16 control1000;
73 u16 int_enable;
74 u16 smart_speed;
75 u16 led_control;
76};
77
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +010078static int at803x_debug_reg_read(struct phy_device *phydev, u16 reg)
79{
80 int ret;
81
82 ret = phy_write(phydev, AT803X_DEBUG_ADDR, reg);
83 if (ret < 0)
84 return ret;
85
86 return phy_read(phydev, AT803X_DEBUG_DATA);
87}
88
89static int at803x_debug_reg_mask(struct phy_device *phydev, u16 reg,
90 u16 clear, u16 set)
91{
92 u16 val;
93 int ret;
94
95 ret = at803x_debug_reg_read(phydev, reg);
96 if (ret < 0)
97 return ret;
98
99 val = ret & 0xffff;
100 val &= ~clear;
101 val |= set;
102
103 return phy_write(phydev, AT803X_DEBUG_DATA, val);
104}
105
Vinod Koul6d4cd042019-02-21 15:53:15 +0530106static int at803x_enable_rx_delay(struct phy_device *phydev)
107{
108 return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, 0,
109 AT803X_DEBUG_RX_CLK_DLY_EN);
110}
111
112static int at803x_enable_tx_delay(struct phy_device *phydev)
113{
114 return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, 0,
115 AT803X_DEBUG_TX_CLK_DLY_EN);
116}
117
Vinod Koul43f2ebd2019-02-21 15:53:14 +0530118static int at803x_disable_rx_delay(struct phy_device *phydev)
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +0100119{
Vinod Koulcd28d1d2019-01-21 14:43:17 +0530120 return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
121 AT803X_DEBUG_RX_CLK_DLY_EN, 0);
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +0100122}
123
Vinod Koul43f2ebd2019-02-21 15:53:14 +0530124static int at803x_disable_tx_delay(struct phy_device *phydev)
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +0100125{
Vinod Koulcd28d1d2019-01-21 14:43:17 +0530126 return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5,
127 AT803X_DEBUG_TX_CLK_DLY_EN, 0);
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +0100128}
129
Daniel Mack13a56b42014-06-18 11:01:43 +0200130/* save relevant PHY registers to private copy */
131static void at803x_context_save(struct phy_device *phydev,
132 struct at803x_context *context)
133{
134 context->bmcr = phy_read(phydev, MII_BMCR);
135 context->advertise = phy_read(phydev, MII_ADVERTISE);
136 context->control1000 = phy_read(phydev, MII_CTRL1000);
137 context->int_enable = phy_read(phydev, AT803X_INTR_ENABLE);
138 context->smart_speed = phy_read(phydev, AT803X_SMART_SPEED);
139 context->led_control = phy_read(phydev, AT803X_LED_CONTROL);
140}
141
142/* restore relevant PHY registers from private copy */
143static void at803x_context_restore(struct phy_device *phydev,
144 const struct at803x_context *context)
145{
146 phy_write(phydev, MII_BMCR, context->bmcr);
147 phy_write(phydev, MII_ADVERTISE, context->advertise);
148 phy_write(phydev, MII_CTRL1000, context->control1000);
149 phy_write(phydev, AT803X_INTR_ENABLE, context->int_enable);
150 phy_write(phydev, AT803X_SMART_SPEED, context->smart_speed);
151 phy_write(phydev, AT803X_LED_CONTROL, context->led_control);
152}
153
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000154static int at803x_set_wol(struct phy_device *phydev,
155 struct ethtool_wolinfo *wol)
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000156{
157 struct net_device *ndev = phydev->attached_dev;
158 const u8 *mac;
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000159 int ret;
160 u32 value;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000161 unsigned int i, offsets[] = {
162 AT803X_LOC_MAC_ADDR_32_47_OFFSET,
163 AT803X_LOC_MAC_ADDR_16_31_OFFSET,
164 AT803X_LOC_MAC_ADDR_0_15_OFFSET,
165 };
166
167 if (!ndev)
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000168 return -ENODEV;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000169
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000170 if (wol->wolopts & WAKE_MAGIC) {
171 mac = (const u8 *) ndev->dev_addr;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000172
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000173 if (!is_valid_ether_addr(mac))
Dan Murphyfc755682017-10-10 12:42:56 -0500174 return -EINVAL;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000175
Carlo Caione0e021392019-01-25 12:35:10 +0000176 for (i = 0; i < 3; i++)
177 phy_write_mmd(phydev, AT803X_DEVICE_ADDR, offsets[i],
178 mac[(i * 2) + 1] | (mac[(i * 2)] << 8));
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000179
180 value = phy_read(phydev, AT803X_INTR_ENABLE);
Martin Blumenstingle6e4a552016-01-15 01:55:24 +0100181 value |= AT803X_INTR_ENABLE_WOL;
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000182 ret = phy_write(phydev, AT803X_INTR_ENABLE, value);
183 if (ret)
184 return ret;
185 value = phy_read(phydev, AT803X_INTR_STATUS);
186 } else {
187 value = phy_read(phydev, AT803X_INTR_ENABLE);
Martin Blumenstingle6e4a552016-01-15 01:55:24 +0100188 value &= (~AT803X_INTR_ENABLE_WOL);
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000189 ret = phy_write(phydev, AT803X_INTR_ENABLE, value);
190 if (ret)
191 return ret;
192 value = phy_read(phydev, AT803X_INTR_STATUS);
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000193 }
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000194
195 return ret;
196}
197
198static void at803x_get_wol(struct phy_device *phydev,
199 struct ethtool_wolinfo *wol)
200{
201 u32 value;
202
203 wol->supported = WAKE_MAGIC;
204 wol->wolopts = 0;
205
206 value = phy_read(phydev, AT803X_INTR_ENABLE);
Martin Blumenstingle6e4a552016-01-15 01:55:24 +0100207 if (value & AT803X_INTR_ENABLE_WOL)
Mugunthan V Nea13c9e2013-06-03 20:10:05 +0000208 wol->wolopts |= WAKE_MAGIC;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000209}
210
Daniel Mack6229ed12013-09-21 16:53:02 +0200211static int at803x_suspend(struct phy_device *phydev)
212{
213 int value;
214 int wol_enabled;
215
Daniel Mack6229ed12013-09-21 16:53:02 +0200216 value = phy_read(phydev, AT803X_INTR_ENABLE);
Martin Blumenstingle6e4a552016-01-15 01:55:24 +0100217 wol_enabled = value & AT803X_INTR_ENABLE_WOL;
Daniel Mack6229ed12013-09-21 16:53:02 +0200218
Daniel Mack6229ed12013-09-21 16:53:02 +0200219 if (wol_enabled)
Russell Kingfea23fb2018-01-02 10:58:58 +0000220 value = BMCR_ISOLATE;
Daniel Mack6229ed12013-09-21 16:53:02 +0200221 else
Russell Kingfea23fb2018-01-02 10:58:58 +0000222 value = BMCR_PDOWN;
Daniel Mack6229ed12013-09-21 16:53:02 +0200223
Russell Kingfea23fb2018-01-02 10:58:58 +0000224 phy_modify(phydev, MII_BMCR, 0, value);
Daniel Mack6229ed12013-09-21 16:53:02 +0200225
226 return 0;
227}
228
229static int at803x_resume(struct phy_device *phydev)
230{
Russell Kingf1028522018-01-05 16:07:10 +0000231 return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0);
Daniel Mack6229ed12013-09-21 16:53:02 +0200232}
233
Daniel Mack13a56b42014-06-18 11:01:43 +0200234static int at803x_probe(struct phy_device *phydev)
235{
Andrew Lunne5a03bf2016-01-06 20:11:16 +0100236 struct device *dev = &phydev->mdio.dev;
Daniel Mack13a56b42014-06-18 11:01:43 +0200237 struct at803x_priv *priv;
238
Fengguang Wu8f2877c2014-06-22 12:32:51 +0200239 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
Daniel Mack13a56b42014-06-18 11:01:43 +0200240 if (!priv)
241 return -ENOMEM;
242
Daniel Mack13a56b42014-06-18 11:01:43 +0200243 phydev->priv = priv;
244
245 return 0;
246}
247
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000248static int at803x_config_init(struct phy_device *phydev)
249{
Mugunthan V N1ca6d1b2013-06-03 20:10:06 +0000250 int ret;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000251
Daniel Mack6ff01db2014-04-16 17:19:13 +0200252 ret = genphy_config_init(phydev);
253 if (ret < 0)
254 return ret;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000255
Vinod Koul6d4cd042019-02-21 15:53:15 +0530256 /* The RX and TX delay default is:
257 * after HW reset: RX delay enabled and TX delay disabled
258 * after SW reset: RX delay enabled, while TX delay retains the
259 * value before reset.
260 *
261 * So let's first disable the RX and TX delays in PHY and enable
262 * them based on the mode selected (this also takes care of RGMII
263 * mode where we expect delays to be disabled)
264 */
265
266 ret = at803x_disable_rx_delay(phydev);
267 if (ret < 0)
268 return ret;
269 ret = at803x_disable_tx_delay(phydev);
270 if (ret < 0)
271 return ret;
272
273 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
274 phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) {
275 /* If RGMII_ID or RGMII_RXID are specified enable RX delay,
276 * otherwise keep it disabled
277 */
278 ret = at803x_enable_rx_delay(phydev);
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +0100279 if (ret < 0)
Mugunthan V N1ca6d1b2013-06-03 20:10:06 +0000280 return ret;
Martin Blumenstingl2e5f9f22016-01-15 01:55:22 +0100281 }
282
Vinod Koul6d4cd042019-02-21 15:53:15 +0530283 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
284 phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) {
285 /* If RGMII_ID or RGMII_TXID are specified enable TX delay,
286 * otherwise keep it disabled
287 */
288 ret = at803x_enable_tx_delay(phydev);
Mugunthan V N1ca6d1b2013-06-03 20:10:06 +0000289 }
290
Vinod Koul6d4cd042019-02-21 15:53:15 +0530291 return ret;
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000292}
293
Zhao Qiang77a99392014-03-28 15:39:41 +0800294static int at803x_ack_interrupt(struct phy_device *phydev)
295{
296 int err;
297
Martin Blumenstingla46bd632016-01-15 01:55:23 +0100298 err = phy_read(phydev, AT803X_INTR_STATUS);
Zhao Qiang77a99392014-03-28 15:39:41 +0800299
300 return (err < 0) ? err : 0;
301}
302
303static int at803x_config_intr(struct phy_device *phydev)
304{
305 int err;
306 int value;
307
Martin Blumenstingla46bd632016-01-15 01:55:23 +0100308 value = phy_read(phydev, AT803X_INTR_ENABLE);
Zhao Qiang77a99392014-03-28 15:39:41 +0800309
Martin Blumenstingle6e4a552016-01-15 01:55:24 +0100310 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
311 value |= AT803X_INTR_ENABLE_AUTONEG_ERR;
312 value |= AT803X_INTR_ENABLE_SPEED_CHANGED;
313 value |= AT803X_INTR_ENABLE_DUPLEX_CHANGED;
314 value |= AT803X_INTR_ENABLE_LINK_FAIL;
315 value |= AT803X_INTR_ENABLE_LINK_SUCCESS;
316
317 err = phy_write(phydev, AT803X_INTR_ENABLE, value);
318 }
Zhao Qiang77a99392014-03-28 15:39:41 +0800319 else
Martin Blumenstingla46bd632016-01-15 01:55:23 +0100320 err = phy_write(phydev, AT803X_INTR_ENABLE, 0);
Zhao Qiang77a99392014-03-28 15:39:41 +0800321
322 return err;
323}
324
Daniel Mack13a56b42014-06-18 11:01:43 +0200325static void at803x_link_change_notify(struct phy_device *phydev)
326{
327 struct at803x_priv *priv = phydev->priv;
328
329 /*
330 * Conduct a hardware reset for AT8030 every time a link loss is
331 * signalled. This is necessary to circumvent a hardware bug that
332 * occurs when the cable is unplugged while TX packets are pending
333 * in the FIFO. In such cases, the FIFO enters an error mode it
334 * cannot recover from by software.
335 */
Timur Tabia05d7df2016-04-26 12:44:18 -0500336 if (phydev->state == PHY_NOLINK) {
Sergei Shtylyovbafbdd52017-12-04 13:35:05 +0100337 if (phydev->mdio.reset && !priv->phy_reset) {
Timur Tabia05d7df2016-04-26 12:44:18 -0500338 struct at803x_context context;
Daniel Mack13a56b42014-06-18 11:01:43 +0200339
Timur Tabia05d7df2016-04-26 12:44:18 -0500340 at803x_context_save(phydev, &context);
Daniel Mack13a56b42014-06-18 11:01:43 +0200341
Sergei Shtylyovbafbdd52017-12-04 13:35:05 +0100342 phy_device_reset(phydev, 1);
Timur Tabia05d7df2016-04-26 12:44:18 -0500343 msleep(1);
Sergei Shtylyovbafbdd52017-12-04 13:35:05 +0100344 phy_device_reset(phydev, 0);
Timur Tabia05d7df2016-04-26 12:44:18 -0500345 msleep(1);
Daniel Mack13a56b42014-06-18 11:01:43 +0200346
Timur Tabia05d7df2016-04-26 12:44:18 -0500347 at803x_context_restore(phydev, &context);
Daniel Mack13a56b42014-06-18 11:01:43 +0200348
Timur Tabia05d7df2016-04-26 12:44:18 -0500349 phydev_dbg(phydev, "%s(): phy was reset\n",
350 __func__);
351 priv->phy_reset = true;
Daniel Mack13a56b42014-06-18 11:01:43 +0200352 }
Timur Tabia05d7df2016-04-26 12:44:18 -0500353 } else {
354 priv->phy_reset = false;
Daniel Mack13a56b42014-06-18 11:01:43 +0200355 }
356}
357
Zefir Kurtisif62265b2016-10-24 12:40:54 +0200358static int at803x_aneg_done(struct phy_device *phydev)
359{
360 int ccr;
361
362 int aneg_done = genphy_aneg_done(phydev);
363 if (aneg_done != BMSR_ANEGCOMPLETE)
364 return aneg_done;
365
366 /*
367 * in SGMII mode, if copper side autoneg is successful,
368 * also check SGMII side autoneg result
369 */
370 ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG);
371 if ((ccr & AT803X_MODE_CFG_MASK) != AT803X_MODE_CFG_SGMII)
372 return aneg_done;
373
374 /* switch to SGMII/fiber page */
375 phy_write(phydev, AT803X_REG_CHIP_CONFIG, ccr & ~AT803X_BT_BX_REG_SEL);
376
377 /* check if the SGMII link is OK. */
378 if (!(phy_read(phydev, AT803X_PSSR) & AT803X_PSSR_MR_AN_COMPLETE)) {
Andrew Lunnab2a6052018-09-29 23:04:10 +0200379 phydev_warn(phydev, "803x_aneg_done: SGMII link is not ok\n");
Zefir Kurtisif62265b2016-10-24 12:40:54 +0200380 aneg_done = 0;
381 }
382 /* switch back to copper page */
383 phy_write(phydev, AT803X_REG_CHIP_CONFIG, ccr | AT803X_BT_BX_REG_SEL);
384
385 return aneg_done;
386}
387
Mugunthan V N317420a2013-06-03 20:10:04 +0000388static struct phy_driver at803x_driver[] = {
389{
390 /* ATHEROS 8035 */
Daniel Mack13a56b42014-06-18 11:01:43 +0200391 .phy_id = ATH8035_PHY_ID,
392 .name = "Atheros 8035 ethernet",
Fabio Estevam58effd72016-10-26 14:03:54 -0200393 .phy_id_mask = AT803X_PHY_ID_MASK,
Daniel Mack13a56b42014-06-18 11:01:43 +0200394 .probe = at803x_probe,
395 .config_init = at803x_config_init,
Daniel Mack13a56b42014-06-18 11:01:43 +0200396 .set_wol = at803x_set_wol,
397 .get_wol = at803x_get_wol,
398 .suspend = at803x_suspend,
399 .resume = at803x_resume,
400 .features = PHY_GBIT_FEATURES,
Måns Rullgård0eae5982015-11-12 17:40:20 +0000401 .ack_interrupt = at803x_ack_interrupt,
402 .config_intr = at803x_config_intr,
Mugunthan V N317420a2013-06-03 20:10:04 +0000403}, {
404 /* ATHEROS 8030 */
Daniel Mack13a56b42014-06-18 11:01:43 +0200405 .phy_id = ATH8030_PHY_ID,
406 .name = "Atheros 8030 ethernet",
Fabio Estevam58effd72016-10-26 14:03:54 -0200407 .phy_id_mask = AT803X_PHY_ID_MASK,
Daniel Mack13a56b42014-06-18 11:01:43 +0200408 .probe = at803x_probe,
409 .config_init = at803x_config_init,
410 .link_change_notify = at803x_link_change_notify,
411 .set_wol = at803x_set_wol,
412 .get_wol = at803x_get_wol,
413 .suspend = at803x_suspend,
414 .resume = at803x_resume,
Martin Blumenstingle15bb4c2016-01-15 01:55:21 +0100415 .features = PHY_BASIC_FEATURES,
Måns Rullgård0eae5982015-11-12 17:40:20 +0000416 .ack_interrupt = at803x_ack_interrupt,
417 .config_intr = at803x_config_intr,
Mugunthan V N05d7cce2013-06-03 20:10:07 +0000418}, {
419 /* ATHEROS 8031 */
Daniel Mack13a56b42014-06-18 11:01:43 +0200420 .phy_id = ATH8031_PHY_ID,
421 .name = "Atheros 8031 ethernet",
Fabio Estevam58effd72016-10-26 14:03:54 -0200422 .phy_id_mask = AT803X_PHY_ID_MASK,
Daniel Mack13a56b42014-06-18 11:01:43 +0200423 .probe = at803x_probe,
424 .config_init = at803x_config_init,
Daniel Mack13a56b42014-06-18 11:01:43 +0200425 .set_wol = at803x_set_wol,
426 .get_wol = at803x_get_wol,
427 .suspend = at803x_suspend,
428 .resume = at803x_resume,
429 .features = PHY_GBIT_FEATURES,
Zefir Kurtisif62265b2016-10-24 12:40:54 +0200430 .aneg_done = at803x_aneg_done,
Daniel Mack13a56b42014-06-18 11:01:43 +0200431 .ack_interrupt = &at803x_ack_interrupt,
432 .config_intr = &at803x_config_intr,
Mugunthan V N317420a2013-06-03 20:10:04 +0000433} };
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000434
Johan Hovold50fd7152014-11-11 19:45:59 +0100435module_phy_driver(at803x_driver);
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000436
437static struct mdio_device_id __maybe_unused atheros_tbl[] = {
Fabio Estevam58effd72016-10-26 14:03:54 -0200438 { ATH8030_PHY_ID, AT803X_PHY_ID_MASK },
439 { ATH8031_PHY_ID, AT803X_PHY_ID_MASK },
440 { ATH8035_PHY_ID, AT803X_PHY_ID_MASK },
Matus Ujhelyi0ca71112012-10-14 19:07:16 +0000441 { }
442};
443
444MODULE_DEVICE_TABLE(mdio, atheros_tbl);