.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. |
---|
2 | | - * |
---|
3 | | - * This program is free software; you can redistribute it and/or modify |
---|
4 | | - * it under the terms of the GNU General Public License version 2 and |
---|
5 | | - * only version 2 as published by the Free Software Foundation. |
---|
6 | | - * |
---|
7 | | - * This program is distributed in the hope that it will be useful, |
---|
8 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
9 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
10 | | - * GNU General Public License for more details. |
---|
11 | 3 | */ |
---|
12 | 4 | |
---|
13 | 5 | /* Qualcomm Technologies, Inc. EMAC Gigabit Ethernet Driver */ |
---|
.. | .. |
---|
123 | 115 | } |
---|
124 | 116 | |
---|
125 | 117 | /* Transmit the packet */ |
---|
126 | | -static int emac_start_xmit(struct sk_buff *skb, struct net_device *netdev) |
---|
| 118 | +static netdev_tx_t emac_start_xmit(struct sk_buff *skb, |
---|
| 119 | + struct net_device *netdev) |
---|
127 | 120 | { |
---|
128 | 121 | struct emac_adapter *adpt = netdev_priv(netdev); |
---|
129 | 122 | |
---|
.. | .. |
---|
221 | 214 | { |
---|
222 | 215 | struct emac_adapter *adpt = netdev_priv(netdev); |
---|
223 | 216 | |
---|
224 | | - netif_info(adpt, hw, adpt->netdev, |
---|
225 | | - "changing MTU from %d to %d\n", netdev->mtu, |
---|
226 | | - new_mtu); |
---|
| 217 | + netif_dbg(adpt, hw, adpt->netdev, |
---|
| 218 | + "changing MTU from %d to %d\n", netdev->mtu, |
---|
| 219 | + new_mtu); |
---|
227 | 220 | netdev->mtu = new_mtu; |
---|
228 | 221 | |
---|
229 | 222 | if (netif_running(netdev)) |
---|
.. | .. |
---|
290 | 283 | } |
---|
291 | 284 | |
---|
292 | 285 | /* Respond to a TX hang */ |
---|
293 | | -static void emac_tx_timeout(struct net_device *netdev) |
---|
| 286 | +static void emac_tx_timeout(struct net_device *netdev, unsigned int txqueue) |
---|
294 | 287 | { |
---|
295 | 288 | struct emac_adapter *adpt = netdev_priv(netdev); |
---|
296 | 289 | |
---|
297 | 290 | schedule_work(&adpt->work_thread); |
---|
298 | 291 | } |
---|
299 | 292 | |
---|
300 | | -/* IOCTL support for the interface */ |
---|
301 | | -static int emac_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) |
---|
302 | | -{ |
---|
303 | | - if (!netif_running(netdev)) |
---|
304 | | - return -EINVAL; |
---|
305 | | - |
---|
306 | | - if (!netdev->phydev) |
---|
307 | | - return -ENODEV; |
---|
308 | | - |
---|
309 | | - return phy_mii_ioctl(netdev->phydev, ifr, cmd); |
---|
310 | | -} |
---|
311 | | - |
---|
312 | 293 | /** |
---|
313 | 294 | * emac_update_hw_stats - read the EMAC stat registers |
---|
| 295 | + * @adpt: pointer to adapter struct |
---|
314 | 296 | * |
---|
315 | 297 | * Reads the stats registers and write the values to adpt->stats. |
---|
316 | 298 | * |
---|
.. | .. |
---|
395 | 377 | .ndo_start_xmit = emac_start_xmit, |
---|
396 | 378 | .ndo_set_mac_address = eth_mac_addr, |
---|
397 | 379 | .ndo_change_mtu = emac_change_mtu, |
---|
398 | | - .ndo_do_ioctl = emac_ioctl, |
---|
| 380 | + .ndo_do_ioctl = phy_do_ioctl_running, |
---|
399 | 381 | .ndo_tx_timeout = emac_tx_timeout, |
---|
400 | 382 | .ndo_get_stats64 = emac_get_stats64, |
---|
401 | 383 | .ndo_set_features = emac_set_features, |
---|
.. | .. |
---|
563 | 545 | struct emac_adapter *adpt) |
---|
564 | 546 | { |
---|
565 | 547 | struct net_device *netdev = adpt->netdev; |
---|
566 | | - struct resource *res; |
---|
567 | 548 | char maddr[ETH_ALEN]; |
---|
568 | 549 | int ret = 0; |
---|
569 | 550 | |
---|
.. | .. |
---|
575 | 556 | |
---|
576 | 557 | /* Core 0 interrupt */ |
---|
577 | 558 | ret = platform_get_irq(pdev, 0); |
---|
578 | | - if (ret < 0) { |
---|
579 | | - dev_err(&pdev->dev, |
---|
580 | | - "error: missing core0 irq resource (error=%i)\n", ret); |
---|
| 559 | + if (ret < 0) |
---|
581 | 560 | return ret; |
---|
582 | | - } |
---|
583 | 561 | adpt->irq.irq = ret; |
---|
584 | 562 | |
---|
585 | 563 | /* base register address */ |
---|
586 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
587 | | - adpt->base = devm_ioremap_resource(&pdev->dev, res); |
---|
| 564 | + adpt->base = devm_platform_ioremap_resource(pdev, 0); |
---|
588 | 565 | if (IS_ERR(adpt->base)) |
---|
589 | 566 | return PTR_ERR(adpt->base); |
---|
590 | 567 | |
---|
591 | 568 | /* CSR register address */ |
---|
592 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
---|
593 | | - adpt->csr = devm_ioremap_resource(&pdev->dev, res); |
---|
| 569 | + adpt->csr = devm_platform_ioremap_resource(pdev, 1); |
---|
594 | 570 | if (IS_ERR(adpt->csr)) |
---|
595 | 571 | return PTR_ERR(adpt->csr); |
---|
596 | 572 | |
---|
.. | .. |
---|
752 | 728 | struct net_device *netdev = dev_get_drvdata(&pdev->dev); |
---|
753 | 729 | struct emac_adapter *adpt = netdev_priv(netdev); |
---|
754 | 730 | |
---|
| 731 | + netif_carrier_off(netdev); |
---|
| 732 | + netif_tx_disable(netdev); |
---|
| 733 | + |
---|
755 | 734 | unregister_netdev(netdev); |
---|
756 | 735 | netif_napi_del(&adpt->rx_q.napi); |
---|
757 | 736 | |
---|
| 737 | + free_irq(adpt->irq.irq, &adpt->irq); |
---|
| 738 | + cancel_work_sync(&adpt->work_thread); |
---|
| 739 | + |
---|
758 | 740 | emac_clks_teardown(adpt); |
---|
759 | 741 | |
---|
760 | 742 | put_device(&adpt->phydev->mdio.dev); |
---|