blob: a8a1dc9f6725d1c0e08c2549ed2f55cca1089101 [file] [log] [blame]
Alexey Brodkine4f23792013-06-24 09:54:27 +04001/*
2 * Copyright (C) 2004-2013 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Driver for the ARC EMAC 10100 (hardware revision 5)
9 *
10 * Contributors:
11 * Amit Bhor
12 * Sameer Dhavale
13 * Vineet Gupta
14 */
15
Beniamino Galvani775dd682014-05-11 18:11:47 +020016#include <linux/crc32.h>
Alexey Brodkine4f23792013-06-24 09:54:27 +040017#include <linux/etherdevice.h>
18#include <linux/interrupt.h>
19#include <linux/io.h>
20#include <linux/module.h>
21#include <linux/of_address.h>
22#include <linux/of_irq.h>
23#include <linux/of_mdio.h>
24#include <linux/of_net.h>
25#include <linux/of_platform.h>
26
27#include "emac.h"
28
Alexey Brodkine4f23792013-06-24 09:54:27 +040029/**
Beniamino Galvani74dd40b2014-09-10 22:50:03 +020030 * arc_emac_tx_avail - Return the number of available slots in the tx ring.
31 * @priv: Pointer to ARC EMAC private data structure.
32 *
33 * returns: the number of slots available for transmission in tx the ring.
34 */
35static inline int arc_emac_tx_avail(struct arc_emac_priv *priv)
36{
37 return (priv->txbd_dirty + TX_BD_NUM - priv->txbd_curr - 1) % TX_BD_NUM;
38}
39
40/**
Alexey Brodkine4f23792013-06-24 09:54:27 +040041 * arc_emac_adjust_link - Adjust the PHY link duplex.
42 * @ndev: Pointer to the net_device structure.
43 *
44 * This function is called to change the duplex setting after auto negotiation
45 * is done by the PHY.
46 */
47static void arc_emac_adjust_link(struct net_device *ndev)
48{
49 struct arc_emac_priv *priv = netdev_priv(ndev);
Philippe Reynes01dea532016-07-02 20:06:51 +020050 struct phy_device *phy_dev = ndev->phydev;
Alexey Brodkine4f23792013-06-24 09:54:27 +040051 unsigned int reg, state_changed = 0;
52
53 if (priv->link != phy_dev->link) {
54 priv->link = phy_dev->link;
55 state_changed = 1;
56 }
57
58 if (priv->speed != phy_dev->speed) {
59 priv->speed = phy_dev->speed;
60 state_changed = 1;
Romain Perier6eacf312014-09-08 17:14:47 +000061 if (priv->set_mac_speed)
62 priv->set_mac_speed(priv, priv->speed);
Alexey Brodkine4f23792013-06-24 09:54:27 +040063 }
64
65 if (priv->duplex != phy_dev->duplex) {
66 reg = arc_reg_get(priv, R_CTRL);
67
Caesar Wang663713e2016-03-14 16:01:55 +080068 if (phy_dev->duplex == DUPLEX_FULL)
Alexey Brodkine4f23792013-06-24 09:54:27 +040069 reg |= ENFL_MASK;
70 else
71 reg &= ~ENFL_MASK;
72
73 arc_reg_set(priv, R_CTRL, reg);
74 priv->duplex = phy_dev->duplex;
75 state_changed = 1;
76 }
77
78 if (state_changed)
79 phy_print_status(phy_dev);
80}
81
82/**
83 * arc_emac_get_settings - Get PHY settings.
84 * @ndev: Pointer to net_device structure.
85 * @cmd: Pointer to ethtool_cmd structure.
86 *
87 * This implements ethtool command for getting PHY settings. If PHY could
88 * not be found, the function returns -ENODEV. This function calls the
89 * relevant PHY ethtool API to get the PHY settings.
90 * Issue "ethtool ethX" under linux prompt to execute this function.
91 */
92static int arc_emac_get_settings(struct net_device *ndev,
93 struct ethtool_cmd *cmd)
94{
Philippe Reynes01dea532016-07-02 20:06:51 +020095 return phy_ethtool_gset(ndev->phydev, cmd);
Alexey Brodkine4f23792013-06-24 09:54:27 +040096}
97
98/**
99 * arc_emac_set_settings - Set PHY settings as passed in the argument.
100 * @ndev: Pointer to net_device structure.
101 * @cmd: Pointer to ethtool_cmd structure.
102 *
103 * This implements ethtool command for setting various PHY settings. If PHY
104 * could not be found, the function returns -ENODEV. This function calls the
105 * relevant PHY ethtool API to set the PHY.
106 * Issue e.g. "ethtool -s ethX speed 1000" under linux prompt to execute this
107 * function.
108 */
109static int arc_emac_set_settings(struct net_device *ndev,
110 struct ethtool_cmd *cmd)
111{
Alexey Brodkine4f23792013-06-24 09:54:27 +0400112 if (!capable(CAP_NET_ADMIN))
113 return -EPERM;
114
Philippe Reynes01dea532016-07-02 20:06:51 +0200115 return phy_ethtool_sset(ndev->phydev, cmd);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400116}
117
118/**
119 * arc_emac_get_drvinfo - Get EMAC driver information.
120 * @ndev: Pointer to net_device structure.
121 * @info: Pointer to ethtool_drvinfo structure.
122 *
123 * This implements ethtool command for getting the driver information.
124 * Issue "ethtool -i ethX" under linux prompt to execute this function.
125 */
126static void arc_emac_get_drvinfo(struct net_device *ndev,
127 struct ethtool_drvinfo *info)
128{
Romain Perier23d2d9a2014-08-26 13:14:51 +0000129 struct arc_emac_priv *priv = netdev_priv(ndev);
130
131 strlcpy(info->driver, priv->drv_name, sizeof(info->driver));
132 strlcpy(info->version, priv->drv_version, sizeof(info->version));
Alexey Brodkine4f23792013-06-24 09:54:27 +0400133}
134
135static const struct ethtool_ops arc_emac_ethtool_ops = {
136 .get_settings = arc_emac_get_settings,
137 .set_settings = arc_emac_set_settings,
138 .get_drvinfo = arc_emac_get_drvinfo,
139 .get_link = ethtool_op_get_link,
140};
141
142#define FIRST_OR_LAST_MASK (FIRST_MASK | LAST_MASK)
143
144/**
145 * arc_emac_tx_clean - clears processed by EMAC Tx BDs.
146 * @ndev: Pointer to the network device.
147 */
148static void arc_emac_tx_clean(struct net_device *ndev)
149{
150 struct arc_emac_priv *priv = netdev_priv(ndev);
Tobias Klauserff458f62014-07-09 11:07:37 +0200151 struct net_device_stats *stats = &ndev->stats;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400152 unsigned int i;
153
154 for (i = 0; i < TX_BD_NUM; i++) {
155 unsigned int *txbd_dirty = &priv->txbd_dirty;
156 struct arc_emac_bd *txbd = &priv->txbd[*txbd_dirty];
157 struct buffer_state *tx_buff = &priv->tx_buff[*txbd_dirty];
158 struct sk_buff *skb = tx_buff->skb;
159 unsigned int info = le32_to_cpu(txbd->info);
160
Alexander Kochetkovc278c252016-02-09 18:20:38 +0300161 if ((info & FOR_EMAC) || !txbd->data || !skb)
Alexey Brodkine4f23792013-06-24 09:54:27 +0400162 break;
163
164 if (unlikely(info & (DROP | DEFR | LTCL | UFLO))) {
165 stats->tx_errors++;
166 stats->tx_dropped++;
167
168 if (info & DEFR)
169 stats->tx_carrier_errors++;
170
171 if (info & LTCL)
172 stats->collisions++;
173
174 if (info & UFLO)
175 stats->tx_fifo_errors++;
176 } else if (likely(info & FIRST_OR_LAST_MASK)) {
177 stats->tx_packets++;
178 stats->tx_bytes += skb->len;
179 }
180
Alexey Brodkina4a11392013-06-26 11:49:26 +0400181 dma_unmap_single(&ndev->dev, dma_unmap_addr(tx_buff, addr),
182 dma_unmap_len(tx_buff, len), DMA_TO_DEVICE);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400183
184 /* return the sk_buff to system */
185 dev_kfree_skb_irq(skb);
186
187 txbd->data = 0;
188 txbd->info = 0;
Alexander Kochetkovc278c252016-02-09 18:20:38 +0300189 tx_buff->skb = NULL;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400190
Vineet Gupta27082ee2013-09-04 17:17:15 +0530191 *txbd_dirty = (*txbd_dirty + 1) % TX_BD_NUM;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400192 }
Beniamino Galvani74dd40b2014-09-10 22:50:03 +0200193
194 /* Ensure that txbd_dirty is visible to tx() before checking
195 * for queue stopped.
196 */
197 smp_mb();
198
199 if (netif_queue_stopped(ndev) && arc_emac_tx_avail(priv))
200 netif_wake_queue(ndev);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400201}
202
203/**
204 * arc_emac_rx - processing of Rx packets.
205 * @ndev: Pointer to the network device.
206 * @budget: How many BDs to process on 1 call.
207 *
208 * returns: Number of processed BDs
209 *
210 * Iterate through Rx BDs and deliver received packages to upper layer.
211 */
212static int arc_emac_rx(struct net_device *ndev, int budget)
213{
214 struct arc_emac_priv *priv = netdev_priv(ndev);
215 unsigned int work_done;
216
Alexey Brodkin9cff8662013-08-13 17:04:36 +0400217 for (work_done = 0; work_done < budget; work_done++) {
Alexey Brodkine4f23792013-06-24 09:54:27 +0400218 unsigned int *last_rx_bd = &priv->last_rx_bd;
Tobias Klauserff458f62014-07-09 11:07:37 +0200219 struct net_device_stats *stats = &ndev->stats;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400220 struct buffer_state *rx_buff = &priv->rx_buff[*last_rx_bd];
221 struct arc_emac_bd *rxbd = &priv->rxbd[*last_rx_bd];
Alexey Brodkine4f23792013-06-24 09:54:27 +0400222 unsigned int pktlen, info = le32_to_cpu(rxbd->info);
223 struct sk_buff *skb;
224 dma_addr_t addr;
225
226 if (unlikely((info & OWN_MASK) == FOR_EMAC))
227 break;
228
229 /* Make a note that we saw a packet at this BD.
230 * So next time, driver starts from this + 1
231 */
232 *last_rx_bd = (*last_rx_bd + 1) % RX_BD_NUM;
233
234 if (unlikely((info & FIRST_OR_LAST_MASK) !=
235 FIRST_OR_LAST_MASK)) {
236 /* We pre-allocate buffers of MTU size so incoming
237 * packets won't be split/chained.
238 */
239 if (net_ratelimit())
240 netdev_err(ndev, "incomplete packet received\n");
241
242 /* Return ownership to EMAC */
Alexey Brodkina4a11392013-06-26 11:49:26 +0400243 rxbd->info = cpu_to_le32(FOR_EMAC | EMAC_BUFFER_SIZE);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400244 stats->rx_errors++;
245 stats->rx_length_errors++;
246 continue;
247 }
248
249 pktlen = info & LEN_MASK;
250 stats->rx_packets++;
251 stats->rx_bytes += pktlen;
252 skb = rx_buff->skb;
253 skb_put(skb, pktlen);
254 skb->dev = ndev;
255 skb->protocol = eth_type_trans(skb, ndev);
256
Alexey Brodkina4a11392013-06-26 11:49:26 +0400257 dma_unmap_single(&ndev->dev, dma_unmap_addr(rx_buff, addr),
258 dma_unmap_len(rx_buff, len), DMA_FROM_DEVICE);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400259
260 /* Prepare the BD for next cycle */
Alexey Brodkina4a11392013-06-26 11:49:26 +0400261 rx_buff->skb = netdev_alloc_skb_ip_align(ndev,
262 EMAC_BUFFER_SIZE);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400263 if (unlikely(!rx_buff->skb)) {
264 stats->rx_errors++;
265 /* Because receive_skb is below, increment rx_dropped */
266 stats->rx_dropped++;
267 continue;
268 }
269
270 /* receive_skb only if new skb was allocated to avoid holes */
271 netif_receive_skb(skb);
272
273 addr = dma_map_single(&ndev->dev, (void *)rx_buff->skb->data,
Alexey Brodkina4a11392013-06-26 11:49:26 +0400274 EMAC_BUFFER_SIZE, DMA_FROM_DEVICE);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400275 if (dma_mapping_error(&ndev->dev, addr)) {
276 if (net_ratelimit())
277 netdev_err(ndev, "cannot dma map\n");
278 dev_kfree_skb(rx_buff->skb);
279 stats->rx_errors++;
280 continue;
281 }
Alexey Brodkina4a11392013-06-26 11:49:26 +0400282 dma_unmap_addr_set(rx_buff, addr, addr);
283 dma_unmap_len_set(rx_buff, len, EMAC_BUFFER_SIZE);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400284
Alexey Brodkina4a11392013-06-26 11:49:26 +0400285 rxbd->data = cpu_to_le32(addr);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400286
287 /* Make sure pointer to data buffer is set */
288 wmb();
289
290 /* Return ownership to EMAC */
Alexey Brodkina4a11392013-06-26 11:49:26 +0400291 rxbd->info = cpu_to_le32(FOR_EMAC | EMAC_BUFFER_SIZE);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400292 }
293
294 return work_done;
295}
296
297/**
298 * arc_emac_poll - NAPI poll handler.
299 * @napi: Pointer to napi_struct structure.
300 * @budget: How many BDs to process on 1 call.
301 *
302 * returns: Number of processed BDs
303 */
304static int arc_emac_poll(struct napi_struct *napi, int budget)
305{
306 struct net_device *ndev = napi->dev;
307 struct arc_emac_priv *priv = netdev_priv(ndev);
308 unsigned int work_done;
309
310 arc_emac_tx_clean(ndev);
311
312 work_done = arc_emac_rx(ndev, budget);
313 if (work_done < budget) {
314 napi_complete(napi);
Beniamino Galvani7ce76792014-09-10 22:50:02 +0200315 arc_reg_or(priv, R_ENABLE, RXINT_MASK | TXINT_MASK);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400316 }
317
318 return work_done;
319}
320
321/**
322 * arc_emac_intr - Global interrupt handler for EMAC.
323 * @irq: irq number.
324 * @dev_instance: device instance.
325 *
326 * returns: IRQ_HANDLED for all cases.
327 *
328 * ARC EMAC has only 1 interrupt line, and depending on bits raised in
329 * STATUS register we may tell what is a reason for interrupt to fire.
330 */
331static irqreturn_t arc_emac_intr(int irq, void *dev_instance)
332{
333 struct net_device *ndev = dev_instance;
334 struct arc_emac_priv *priv = netdev_priv(ndev);
Tobias Klauserff458f62014-07-09 11:07:37 +0200335 struct net_device_stats *stats = &ndev->stats;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400336 unsigned int status;
337
338 status = arc_reg_get(priv, R_STATUS);
339 status &= ~MDIO_MASK;
340
341 /* Reset all flags except "MDIO complete" */
342 arc_reg_set(priv, R_STATUS, status);
343
Beniamino Galvani7ce76792014-09-10 22:50:02 +0200344 if (status & (RXINT_MASK | TXINT_MASK)) {
Alexey Brodkine4f23792013-06-24 09:54:27 +0400345 if (likely(napi_schedule_prep(&priv->napi))) {
Beniamino Galvani7ce76792014-09-10 22:50:02 +0200346 arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400347 __napi_schedule(&priv->napi);
348 }
349 }
350
351 if (status & ERR_MASK) {
352 /* MSER/RXCR/RXFR/RXFL interrupt fires on corresponding
353 * 8-bit error counter overrun.
354 */
355
356 if (status & MSER_MASK) {
357 stats->rx_missed_errors += 0x100;
358 stats->rx_errors += 0x100;
359 }
360
361 if (status & RXCR_MASK) {
362 stats->rx_crc_errors += 0x100;
363 stats->rx_errors += 0x100;
364 }
365
366 if (status & RXFR_MASK) {
367 stats->rx_frame_errors += 0x100;
368 stats->rx_errors += 0x100;
369 }
370
371 if (status & RXFL_MASK) {
372 stats->rx_over_errors += 0x100;
373 stats->rx_errors += 0x100;
374 }
375 }
376
377 return IRQ_HANDLED;
378}
379
Beniamino Galvani5a45e572014-05-11 18:11:48 +0200380#ifdef CONFIG_NET_POLL_CONTROLLER
381static void arc_emac_poll_controller(struct net_device *dev)
382{
383 disable_irq(dev->irq);
384 arc_emac_intr(dev->irq, dev);
385 enable_irq(dev->irq);
386}
387#endif
388
Alexey Brodkine4f23792013-06-24 09:54:27 +0400389/**
390 * arc_emac_open - Open the network device.
391 * @ndev: Pointer to the network device.
392 *
393 * returns: 0, on success or non-zero error value on failure.
394 *
395 * This function sets the MAC address, requests and enables an IRQ
396 * for the EMAC device and starts the Tx queue.
397 * It also connects to the phy device.
398 */
399static int arc_emac_open(struct net_device *ndev)
400{
401 struct arc_emac_priv *priv = netdev_priv(ndev);
Philippe Reynes01dea532016-07-02 20:06:51 +0200402 struct phy_device *phy_dev = ndev->phydev;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400403 int i;
404
405 phy_dev->autoneg = AUTONEG_ENABLE;
406 phy_dev->speed = 0;
407 phy_dev->duplex = 0;
Florian Fainellib0ac9562013-12-05 14:52:15 -0800408 phy_dev->advertising &= phy_dev->supported;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400409
Alexey Brodkina4a11392013-06-26 11:49:26 +0400410 priv->last_rx_bd = 0;
411
Alexey Brodkine4f23792013-06-24 09:54:27 +0400412 /* Allocate and set buffers for Rx BD's */
Alexey Brodkine4f23792013-06-24 09:54:27 +0400413 for (i = 0; i < RX_BD_NUM; i++) {
Alexey Brodkina4a11392013-06-26 11:49:26 +0400414 dma_addr_t addr;
415 unsigned int *last_rx_bd = &priv->last_rx_bd;
416 struct arc_emac_bd *rxbd = &priv->rxbd[*last_rx_bd];
417 struct buffer_state *rx_buff = &priv->rx_buff[*last_rx_bd];
418
419 rx_buff->skb = netdev_alloc_skb_ip_align(ndev,
420 EMAC_BUFFER_SIZE);
421 if (unlikely(!rx_buff->skb))
Alexey Brodkine4f23792013-06-24 09:54:27 +0400422 return -ENOMEM;
423
Alexey Brodkina4a11392013-06-26 11:49:26 +0400424 addr = dma_map_single(&ndev->dev, (void *)rx_buff->skb->data,
425 EMAC_BUFFER_SIZE, DMA_FROM_DEVICE);
426 if (dma_mapping_error(&ndev->dev, addr)) {
427 netdev_err(ndev, "cannot dma map\n");
428 dev_kfree_skb(rx_buff->skb);
429 return -ENOMEM;
430 }
431 dma_unmap_addr_set(rx_buff, addr, addr);
432 dma_unmap_len_set(rx_buff, len, EMAC_BUFFER_SIZE);
433
434 rxbd->data = cpu_to_le32(addr);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400435
436 /* Make sure pointer to data buffer is set */
437 wmb();
438
Alexey Brodkina4a11392013-06-26 11:49:26 +0400439 /* Return ownership to EMAC */
440 rxbd->info = cpu_to_le32(FOR_EMAC | EMAC_BUFFER_SIZE);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400441
Alexey Brodkina4a11392013-06-26 11:49:26 +0400442 *last_rx_bd = (*last_rx_bd + 1) % RX_BD_NUM;
443 }
Alexey Brodkine4f23792013-06-24 09:54:27 +0400444
Alexander Kochetkov99f93a152016-02-09 18:20:39 +0300445 priv->txbd_curr = 0;
446 priv->txbd_dirty = 0;
447
Alexey Brodkine4f23792013-06-24 09:54:27 +0400448 /* Clean Tx BD's */
449 memset(priv->txbd, 0, TX_RING_SZ);
450
451 /* Initialize logical address filter */
452 arc_reg_set(priv, R_LAFL, 0);
453 arc_reg_set(priv, R_LAFH, 0);
454
455 /* Set BD ring pointers for device side */
456 arc_reg_set(priv, R_RX_RING, (unsigned int)priv->rxbd_dma);
457 arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma);
458
459 /* Enable interrupts */
Beniamino Galvani7ce76792014-09-10 22:50:02 +0200460 arc_reg_set(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400461
462 /* Set CONTROL */
463 arc_reg_set(priv, R_CTRL,
Caesar Wang663713e2016-03-14 16:01:55 +0800464 (RX_BD_NUM << 24) | /* RX BD table length */
465 (TX_BD_NUM << 16) | /* TX BD table length */
466 TXRN_MASK | RXRN_MASK);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400467
468 napi_enable(&priv->napi);
469
470 /* Enable EMAC */
471 arc_reg_or(priv, R_CTRL, EN_MASK);
472
Philippe Reynes01dea532016-07-02 20:06:51 +0200473 phy_start_aneg(ndev->phydev);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400474
475 netif_start_queue(ndev);
476
477 return 0;
478}
479
480/**
Beniamino Galvani775dd682014-05-11 18:11:47 +0200481 * arc_emac_set_rx_mode - Change the receive filtering mode.
482 * @ndev: Pointer to the network device.
483 *
484 * This function enables/disables promiscuous or all-multicast mode
485 * and updates the multicast filtering list of the network device.
486 */
487static void arc_emac_set_rx_mode(struct net_device *ndev)
488{
489 struct arc_emac_priv *priv = netdev_priv(ndev);
490
491 if (ndev->flags & IFF_PROMISC) {
492 arc_reg_or(priv, R_CTRL, PROM_MASK);
493 } else {
494 arc_reg_clr(priv, R_CTRL, PROM_MASK);
495
496 if (ndev->flags & IFF_ALLMULTI) {
497 arc_reg_set(priv, R_LAFL, ~0);
498 arc_reg_set(priv, R_LAFH, ~0);
499 } else {
500 struct netdev_hw_addr *ha;
501 unsigned int filter[2] = { 0, 0 };
502 int bit;
503
504 netdev_for_each_mc_addr(ha, ndev) {
505 bit = ether_crc_le(ETH_ALEN, ha->addr) >> 26;
506 filter[bit >> 5] |= 1 << (bit & 31);
507 }
508
509 arc_reg_set(priv, R_LAFL, filter[0]);
510 arc_reg_set(priv, R_LAFH, filter[1]);
511 }
512 }
513}
514
515/**
Alexander Kochetkovb530b162016-02-09 18:20:40 +0300516 * arc_free_tx_queue - free skb from tx queue
517 * @ndev: Pointer to the network device.
518 *
519 * This function must be called while EMAC disable
520 */
521static void arc_free_tx_queue(struct net_device *ndev)
522{
523 struct arc_emac_priv *priv = netdev_priv(ndev);
524 unsigned int i;
525
526 for (i = 0; i < TX_BD_NUM; i++) {
527 struct arc_emac_bd *txbd = &priv->txbd[i];
528 struct buffer_state *tx_buff = &priv->tx_buff[i];
529
530 if (tx_buff->skb) {
Caesar Wang663713e2016-03-14 16:01:55 +0800531 dma_unmap_single(&ndev->dev,
532 dma_unmap_addr(tx_buff, addr),
533 dma_unmap_len(tx_buff, len),
534 DMA_TO_DEVICE);
Alexander Kochetkovb530b162016-02-09 18:20:40 +0300535
536 /* return the sk_buff to system */
537 dev_kfree_skb_irq(tx_buff->skb);
538 }
539
540 txbd->info = 0;
541 txbd->data = 0;
542 tx_buff->skb = NULL;
543 }
544}
545
546/**
547 * arc_free_rx_queue - free skb from rx queue
548 * @ndev: Pointer to the network device.
549 *
550 * This function must be called while EMAC disable
551 */
552static void arc_free_rx_queue(struct net_device *ndev)
553{
554 struct arc_emac_priv *priv = netdev_priv(ndev);
555 unsigned int i;
556
557 for (i = 0; i < RX_BD_NUM; i++) {
558 struct arc_emac_bd *rxbd = &priv->rxbd[i];
559 struct buffer_state *rx_buff = &priv->rx_buff[i];
560
561 if (rx_buff->skb) {
Caesar Wang663713e2016-03-14 16:01:55 +0800562 dma_unmap_single(&ndev->dev,
563 dma_unmap_addr(rx_buff, addr),
564 dma_unmap_len(rx_buff, len),
565 DMA_FROM_DEVICE);
Alexander Kochetkovb530b162016-02-09 18:20:40 +0300566
567 /* return the sk_buff to system */
568 dev_kfree_skb_irq(rx_buff->skb);
569 }
570
571 rxbd->info = 0;
572 rxbd->data = 0;
573 rx_buff->skb = NULL;
574 }
575}
576
577/**
Alexey Brodkine4f23792013-06-24 09:54:27 +0400578 * arc_emac_stop - Close the network device.
579 * @ndev: Pointer to the network device.
580 *
581 * This function stops the Tx queue, disables interrupts and frees the IRQ for
582 * the EMAC device.
583 * It also disconnects the PHY device associated with the EMAC device.
584 */
585static int arc_emac_stop(struct net_device *ndev)
586{
587 struct arc_emac_priv *priv = netdev_priv(ndev);
588
589 napi_disable(&priv->napi);
590 netif_stop_queue(ndev);
591
592 /* Disable interrupts */
Beniamino Galvani7ce76792014-09-10 22:50:02 +0200593 arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400594
595 /* Disable EMAC */
596 arc_reg_clr(priv, R_CTRL, EN_MASK);
597
Alexander Kochetkovb530b162016-02-09 18:20:40 +0300598 /* Return the sk_buff to system */
599 arc_free_tx_queue(ndev);
600 arc_free_rx_queue(ndev);
601
Alexey Brodkine4f23792013-06-24 09:54:27 +0400602 return 0;
603}
604
605/**
606 * arc_emac_stats - Get system network statistics.
607 * @ndev: Pointer to net_device structure.
608 *
609 * Returns the address of the device statistics structure.
610 * Statistics are updated in interrupt handler.
611 */
612static struct net_device_stats *arc_emac_stats(struct net_device *ndev)
613{
614 struct arc_emac_priv *priv = netdev_priv(ndev);
Tobias Klauserff458f62014-07-09 11:07:37 +0200615 struct net_device_stats *stats = &ndev->stats;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400616 unsigned long miss, rxerr;
617 u8 rxcrc, rxfram, rxoflow;
618
619 rxerr = arc_reg_get(priv, R_RXERR);
620 miss = arc_reg_get(priv, R_MISS);
621
622 rxcrc = rxerr;
623 rxfram = rxerr >> 8;
624 rxoflow = rxerr >> 16;
625
626 stats->rx_errors += miss;
627 stats->rx_errors += rxcrc + rxfram + rxoflow;
628
629 stats->rx_over_errors += rxoflow;
630 stats->rx_frame_errors += rxfram;
631 stats->rx_crc_errors += rxcrc;
632 stats->rx_missed_errors += miss;
633
634 return stats;
635}
636
637/**
638 * arc_emac_tx - Starts the data transmission.
639 * @skb: sk_buff pointer that contains data to be Transmitted.
640 * @ndev: Pointer to net_device structure.
641 *
642 * returns: NETDEV_TX_OK, on success
643 * NETDEV_TX_BUSY, if any of the descriptors are not free.
644 *
645 * This function is invoked from upper layers to initiate transmission.
646 */
647static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)
648{
649 struct arc_emac_priv *priv = netdev_priv(ndev);
650 unsigned int len, *txbd_curr = &priv->txbd_curr;
Tobias Klauserff458f62014-07-09 11:07:37 +0200651 struct net_device_stats *stats = &ndev->stats;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400652 __le32 *info = &priv->txbd[*txbd_curr].info;
653 dma_addr_t addr;
654
655 if (skb_padto(skb, ETH_ZLEN))
656 return NETDEV_TX_OK;
657
658 len = max_t(unsigned int, ETH_ZLEN, skb->len);
659
Beniamino Galvani74dd40b2014-09-10 22:50:03 +0200660 if (unlikely(!arc_emac_tx_avail(priv))) {
Alexey Brodkine4f23792013-06-24 09:54:27 +0400661 netif_stop_queue(ndev);
Beniamino Galvani74dd40b2014-09-10 22:50:03 +0200662 netdev_err(ndev, "BUG! Tx Ring full when queue awake!\n");
Alexey Brodkine4f23792013-06-24 09:54:27 +0400663 return NETDEV_TX_BUSY;
664 }
665
666 addr = dma_map_single(&ndev->dev, (void *)skb->data, len,
667 DMA_TO_DEVICE);
668
669 if (unlikely(dma_mapping_error(&ndev->dev, addr))) {
670 stats->tx_dropped++;
671 stats->tx_errors++;
672 dev_kfree_skb(skb);
673 return NETDEV_TX_OK;
674 }
Alexey Brodkina4a11392013-06-26 11:49:26 +0400675 dma_unmap_addr_set(&priv->tx_buff[*txbd_curr], addr, addr);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400676 dma_unmap_len_set(&priv->tx_buff[*txbd_curr], len, len);
677
Alexey Brodkina4a11392013-06-26 11:49:26 +0400678 priv->txbd[*txbd_curr].data = cpu_to_le32(addr);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400679
680 /* Make sure pointer to data buffer is set */
681 wmb();
682
Eric Dumazet37ec2742013-12-19 18:10:40 -0800683 skb_tx_timestamp(skb);
684
Alexey Brodkine4f23792013-06-24 09:54:27 +0400685 *info = cpu_to_le32(FOR_EMAC | FIRST_OR_LAST_MASK | len);
686
Alexander Kochetkovc278c252016-02-09 18:20:38 +0300687 /* Make sure info word is set */
688 wmb();
689
690 priv->tx_buff[*txbd_curr].skb = skb;
691
Alexey Brodkine4f23792013-06-24 09:54:27 +0400692 /* Increment index to point to the next BD */
693 *txbd_curr = (*txbd_curr + 1) % TX_BD_NUM;
694
Beniamino Galvani74dd40b2014-09-10 22:50:03 +0200695 /* Ensure that tx_clean() sees the new txbd_curr before
696 * checking the queue status. This prevents an unneeded wake
697 * of the queue in tx_clean().
698 */
699 smp_mb();
Alexey Brodkine4f23792013-06-24 09:54:27 +0400700
Beniamino Galvani74dd40b2014-09-10 22:50:03 +0200701 if (!arc_emac_tx_avail(priv)) {
Alexey Brodkine4f23792013-06-24 09:54:27 +0400702 netif_stop_queue(ndev);
Beniamino Galvani74dd40b2014-09-10 22:50:03 +0200703 /* Refresh tx_dirty */
704 smp_mb();
705 if (arc_emac_tx_avail(priv))
706 netif_start_queue(ndev);
707 }
Alexey Brodkine4f23792013-06-24 09:54:27 +0400708
709 arc_reg_set(priv, R_STATUS, TXPL_MASK);
710
Alexey Brodkine4f23792013-06-24 09:54:27 +0400711 return NETDEV_TX_OK;
712}
713
Max Schwarz235a2512014-04-18 02:17:32 +0200714static void arc_emac_set_address_internal(struct net_device *ndev)
715{
716 struct arc_emac_priv *priv = netdev_priv(ndev);
717 unsigned int addr_low, addr_hi;
718
Caesar Wang663713e2016-03-14 16:01:55 +0800719 addr_low = le32_to_cpu(*(__le32 *)&ndev->dev_addr[0]);
720 addr_hi = le16_to_cpu(*(__le16 *)&ndev->dev_addr[4]);
Max Schwarz235a2512014-04-18 02:17:32 +0200721
722 arc_reg_set(priv, R_ADDRL, addr_low);
723 arc_reg_set(priv, R_ADDRH, addr_hi);
724}
725
Alexey Brodkine4f23792013-06-24 09:54:27 +0400726/**
727 * arc_emac_set_address - Set the MAC address for this device.
728 * @ndev: Pointer to net_device structure.
729 * @p: 6 byte Address to be written as MAC address.
730 *
731 * This function copies the HW address from the sockaddr structure to the
732 * net_device structure and updates the address in HW.
733 *
734 * returns: -EBUSY if the net device is busy or 0 if the address is set
735 * successfully.
736 */
737static int arc_emac_set_address(struct net_device *ndev, void *p)
738{
Alexey Brodkine4f23792013-06-24 09:54:27 +0400739 struct sockaddr *addr = p;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400740
741 if (netif_running(ndev))
742 return -EBUSY;
743
744 if (!is_valid_ether_addr(addr->sa_data))
745 return -EADDRNOTAVAIL;
746
747 memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
748
Max Schwarz235a2512014-04-18 02:17:32 +0200749 arc_emac_set_address_internal(ndev);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400750
751 return 0;
752}
753
754static const struct net_device_ops arc_emac_netdev_ops = {
755 .ndo_open = arc_emac_open,
756 .ndo_stop = arc_emac_stop,
757 .ndo_start_xmit = arc_emac_tx,
758 .ndo_set_mac_address = arc_emac_set_address,
759 .ndo_get_stats = arc_emac_stats,
Beniamino Galvani775dd682014-05-11 18:11:47 +0200760 .ndo_set_rx_mode = arc_emac_set_rx_mode,
Beniamino Galvani5a45e572014-05-11 18:11:48 +0200761#ifdef CONFIG_NET_POLL_CONTROLLER
762 .ndo_poll_controller = arc_emac_poll_controller,
763#endif
Alexey Brodkine4f23792013-06-24 09:54:27 +0400764};
765
Romain Perier23d2d9a2014-08-26 13:14:51 +0000766int arc_emac_probe(struct net_device *ndev, int interface)
Alexey Brodkine4f23792013-06-24 09:54:27 +0400767{
Romain Perier23d2d9a2014-08-26 13:14:51 +0000768 struct device *dev = ndev->dev.parent;
Thierry Redingf7578492013-09-18 15:24:44 +0200769 struct resource res_regs;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400770 struct device_node *phy_node;
Philippe Reynes01dea532016-07-02 20:06:51 +0200771 struct phy_device *phydev = NULL;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400772 struct arc_emac_priv *priv;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400773 const char *mac_addr;
Thierry Redingf7578492013-09-18 15:24:44 +0200774 unsigned int id, clock_frequency, irq;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400775 int err;
776
Alexey Brodkine4f23792013-06-24 09:54:27 +0400777 /* Get PHY from device tree */
Romain Perierf15f44e2014-08-26 13:14:49 +0000778 phy_node = of_parse_phandle(dev->of_node, "phy", 0);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400779 if (!phy_node) {
Romain Perierf15f44e2014-08-26 13:14:49 +0000780 dev_err(dev, "failed to retrieve phy description from device tree\n");
Alexey Brodkine4f23792013-06-24 09:54:27 +0400781 return -ENODEV;
782 }
783
784 /* Get EMAC registers base address from device tree */
Romain Perierf15f44e2014-08-26 13:14:49 +0000785 err = of_address_to_resource(dev->of_node, 0, &res_regs);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400786 if (err) {
Romain Perierf15f44e2014-08-26 13:14:49 +0000787 dev_err(dev, "failed to retrieve registers base from device tree\n");
Alexey Brodkine4f23792013-06-24 09:54:27 +0400788 return -ENODEV;
789 }
790
Alexey Brodkine4f23792013-06-24 09:54:27 +0400791 /* Get IRQ from device tree */
Romain Perierf15f44e2014-08-26 13:14:49 +0000792 irq = irq_of_parse_and_map(dev->of_node, 0);
Thierry Redingf7578492013-09-18 15:24:44 +0200793 if (!irq) {
Romain Perierf15f44e2014-08-26 13:14:49 +0000794 dev_err(dev, "failed to retrieve <irq> value from device tree\n");
Alexey Brodkine4f23792013-06-24 09:54:27 +0400795 return -ENODEV;
796 }
797
Alexey Brodkine4f23792013-06-24 09:54:27 +0400798 ndev->netdev_ops = &arc_emac_netdev_ops;
799 ndev->ethtool_ops = &arc_emac_ethtool_ops;
800 ndev->watchdog_timeo = TX_TIMEOUT;
801 /* FIXME :: no multicast support yet */
802 ndev->flags &= ~IFF_MULTICAST;
803
804 priv = netdev_priv(ndev);
Romain Perierf15f44e2014-08-26 13:14:49 +0000805 priv->dev = dev;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400806
Romain Perierf15f44e2014-08-26 13:14:49 +0000807 priv->regs = devm_ioremap_resource(dev, &res_regs);
Caesar Wang663713e2016-03-14 16:01:55 +0800808 if (IS_ERR(priv->regs))
Romain Perier23d2d9a2014-08-26 13:14:51 +0000809 return PTR_ERR(priv->regs);
Caesar Wang663713e2016-03-14 16:01:55 +0800810
Romain Perierf15f44e2014-08-26 13:14:49 +0000811 dev_dbg(dev, "Registers base address is 0x%p\n", priv->regs);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400812
Romain Perier23d2d9a2014-08-26 13:14:51 +0000813 if (priv->clk) {
Heiko Stübner88154c92014-04-25 10:06:13 +0200814 err = clk_prepare_enable(priv->clk);
815 if (err) {
Romain Perierf15f44e2014-08-26 13:14:49 +0000816 dev_err(dev, "failed to enable clock\n");
Romain Perier23d2d9a2014-08-26 13:14:51 +0000817 return err;
Heiko Stübner88154c92014-04-25 10:06:13 +0200818 }
819
820 clock_frequency = clk_get_rate(priv->clk);
Romain Perier23d2d9a2014-08-26 13:14:51 +0000821 } else {
822 /* Get CPU clock frequency from device tree */
823 if (of_property_read_u32(dev->of_node, "clock-frequency",
824 &clock_frequency)) {
825 dev_err(dev, "failed to retrieve <clock-frequency> from device tree\n");
826 return -EINVAL;
827 }
Heiko Stübner88154c92014-04-25 10:06:13 +0200828 }
829
Alexey Brodkine4f23792013-06-24 09:54:27 +0400830 id = arc_reg_get(priv, R_ID);
831
832 /* Check for EMAC revision 5 or 7, magic number */
833 if (!(id == 0x0005fd02 || id == 0x0007fd02)) {
Romain Perierf15f44e2014-08-26 13:14:49 +0000834 dev_err(dev, "ARC EMAC not detected, id=0x%x\n", id);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400835 err = -ENODEV;
Heiko Stübner88154c92014-04-25 10:06:13 +0200836 goto out_clken;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400837 }
Romain Perierf15f44e2014-08-26 13:14:49 +0000838 dev_info(dev, "ARC EMAC detected with id: 0x%x\n", id);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400839
840 /* Set poll rate so that it polls every 1 ms */
841 arc_reg_set(priv, R_POLLRATE, clock_frequency / 1000000);
842
Thierry Redingf7578492013-09-18 15:24:44 +0200843 ndev->irq = irq;
Romain Perierf15f44e2014-08-26 13:14:49 +0000844 dev_info(dev, "IRQ is %d\n", ndev->irq);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400845
846 /* Register interrupt handler for device */
Romain Perierf15f44e2014-08-26 13:14:49 +0000847 err = devm_request_irq(dev, ndev->irq, arc_emac_intr, 0,
Alexey Brodkine4f23792013-06-24 09:54:27 +0400848 ndev->name, ndev);
849 if (err) {
Romain Perierf15f44e2014-08-26 13:14:49 +0000850 dev_err(dev, "could not allocate IRQ\n");
Heiko Stübner88154c92014-04-25 10:06:13 +0200851 goto out_clken;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400852 }
853
854 /* Get MAC address from device tree */
Romain Perierf15f44e2014-08-26 13:14:49 +0000855 mac_addr = of_get_mac_address(dev->of_node);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400856
Luka Perkov99470812013-10-30 00:11:00 +0100857 if (mac_addr)
Alexey Brodkine4f23792013-06-24 09:54:27 +0400858 memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
Luka Perkov99470812013-10-30 00:11:00 +0100859 else
860 eth_hw_addr_random(ndev);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400861
Max Schwarz235a2512014-04-18 02:17:32 +0200862 arc_emac_set_address_internal(ndev);
Romain Perierf15f44e2014-08-26 13:14:49 +0000863 dev_info(dev, "MAC address is now %pM\n", ndev->dev_addr);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400864
865 /* Do 1 allocation instead of 2 separate ones for Rx and Tx BD rings */
Romain Perierf15f44e2014-08-26 13:14:49 +0000866 priv->rxbd = dmam_alloc_coherent(dev, RX_RING_SZ + TX_RING_SZ,
Alexey Brodkine4f23792013-06-24 09:54:27 +0400867 &priv->rxbd_dma, GFP_KERNEL);
868
869 if (!priv->rxbd) {
Romain Perierf15f44e2014-08-26 13:14:49 +0000870 dev_err(dev, "failed to allocate data buffers\n");
Alexey Brodkine4f23792013-06-24 09:54:27 +0400871 err = -ENOMEM;
Heiko Stübner88154c92014-04-25 10:06:13 +0200872 goto out_clken;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400873 }
874
875 priv->txbd = priv->rxbd + RX_BD_NUM;
876
877 priv->txbd_dma = priv->rxbd_dma + RX_RING_SZ;
Romain Perierf15f44e2014-08-26 13:14:49 +0000878 dev_dbg(dev, "EMAC Device addr: Rx Ring [0x%x], Tx Ring[%x]\n",
Alexey Brodkine4f23792013-06-24 09:54:27 +0400879 (unsigned int)priv->rxbd_dma, (unsigned int)priv->txbd_dma);
880
Romain Perier93e91b32014-08-26 13:14:50 +0000881 err = arc_mdio_probe(priv);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400882 if (err) {
Romain Perierf15f44e2014-08-26 13:14:49 +0000883 dev_err(dev, "failed to probe MII bus\n");
Heiko Stübner88154c92014-04-25 10:06:13 +0200884 goto out_clken;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400885 }
886
Philippe Reynes01dea532016-07-02 20:06:51 +0200887 phydev = of_phy_connect(ndev, phy_node, arc_emac_adjust_link, 0,
888 interface);
889 if (!phydev) {
Romain Perierf15f44e2014-08-26 13:14:49 +0000890 dev_err(dev, "of_phy_connect() failed\n");
Alexey Brodkine4f23792013-06-24 09:54:27 +0400891 err = -ENODEV;
Heiko Stübner796bec12014-04-25 10:03:29 +0200892 goto out_mdio;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400893 }
894
Romain Perierf15f44e2014-08-26 13:14:49 +0000895 dev_info(dev, "connected to %s phy with id 0x%x\n",
Philippe Reynes01dea532016-07-02 20:06:51 +0200896 phydev->drv->name, phydev->phy_id);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400897
898 netif_napi_add(ndev, &priv->napi, arc_emac_poll, ARC_EMAC_NAPI_WEIGHT);
899
900 err = register_netdev(ndev);
901 if (err) {
Romain Perierf15f44e2014-08-26 13:14:49 +0000902 dev_err(dev, "failed to register network device\n");
Heiko Stübner796bec12014-04-25 10:03:29 +0200903 goto out_netif_api;
Alexey Brodkine4f23792013-06-24 09:54:27 +0400904 }
905
906 return 0;
907
Heiko Stübner796bec12014-04-25 10:03:29 +0200908out_netif_api:
909 netif_napi_del(&priv->napi);
Philippe Reynes01dea532016-07-02 20:06:51 +0200910 phy_disconnect(phydev);
Heiko Stübner796bec12014-04-25 10:03:29 +0200911out_mdio:
912 arc_mdio_remove(priv);
Heiko Stübner88154c92014-04-25 10:06:13 +0200913out_clken:
Romain Perier23d2d9a2014-08-26 13:14:51 +0000914 if (priv->clk)
Heiko Stübner88154c92014-04-25 10:06:13 +0200915 clk_disable_unprepare(priv->clk);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400916 return err;
917}
Romain Perier23d2d9a2014-08-26 13:14:51 +0000918EXPORT_SYMBOL_GPL(arc_emac_probe);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400919
Romain Perier23d2d9a2014-08-26 13:14:51 +0000920int arc_emac_remove(struct net_device *ndev)
Alexey Brodkine4f23792013-06-24 09:54:27 +0400921{
Alexey Brodkine4f23792013-06-24 09:54:27 +0400922 struct arc_emac_priv *priv = netdev_priv(ndev);
923
Philippe Reynes01dea532016-07-02 20:06:51 +0200924 phy_disconnect(ndev->phydev);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400925 arc_mdio_remove(priv);
926 unregister_netdev(ndev);
927 netif_napi_del(&priv->napi);
Heiko Stübner88154c92014-04-25 10:06:13 +0200928
Caesar Wang663713e2016-03-14 16:01:55 +0800929 if (!IS_ERR(priv->clk))
Heiko Stübner88154c92014-04-25 10:06:13 +0200930 clk_disable_unprepare(priv->clk);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400931
932 return 0;
933}
Romain Perier23d2d9a2014-08-26 13:14:51 +0000934EXPORT_SYMBOL_GPL(arc_emac_remove);
Alexey Brodkine4f23792013-06-24 09:54:27 +0400935
936MODULE_AUTHOR("Alexey Brodkin <abrodkin@synopsys.com>");
937MODULE_DESCRIPTION("ARC EMAC driver");
938MODULE_LICENSE("GPL");