.. | .. |
---|
74 | 74 | static irqreturn_t mpc52xx_fec_interrupt(int, void *); |
---|
75 | 75 | static irqreturn_t mpc52xx_fec_rx_interrupt(int, void *); |
---|
76 | 76 | static irqreturn_t mpc52xx_fec_tx_interrupt(int, void *); |
---|
77 | | -static void mpc52xx_fec_stop(struct net_device *dev); |
---|
| 77 | +static void mpc52xx_fec_stop(struct net_device *dev, bool may_sleep); |
---|
78 | 78 | static void mpc52xx_fec_start(struct net_device *dev); |
---|
79 | 79 | static void mpc52xx_fec_reset(struct net_device *dev); |
---|
80 | 80 | |
---|
.. | .. |
---|
84 | 84 | module_param(debug, int, 0); |
---|
85 | 85 | MODULE_PARM_DESC(debug, "debugging messages level"); |
---|
86 | 86 | |
---|
87 | | -static void mpc52xx_fec_tx_timeout(struct net_device *dev) |
---|
| 87 | +static void mpc52xx_fec_tx_timeout(struct net_device *dev, unsigned int txqueue) |
---|
88 | 88 | { |
---|
89 | 89 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); |
---|
90 | 90 | unsigned long flags; |
---|
.. | .. |
---|
283 | 283 | |
---|
284 | 284 | netif_stop_queue(dev); |
---|
285 | 285 | |
---|
286 | | - mpc52xx_fec_stop(dev); |
---|
| 286 | + mpc52xx_fec_stop(dev, true); |
---|
287 | 287 | |
---|
288 | 288 | mpc52xx_fec_free_rx_buffers(dev, priv->rx_dmatsk); |
---|
289 | 289 | |
---|
.. | .. |
---|
369 | 369 | dma_unmap_single(dev->dev.parent, bd->skb_pa, skb->len, |
---|
370 | 370 | DMA_TO_DEVICE); |
---|
371 | 371 | |
---|
372 | | - dev_kfree_skb_irq(skb); |
---|
| 372 | + dev_consume_skb_irq(skb); |
---|
373 | 373 | } |
---|
374 | 374 | spin_unlock(&priv->lock); |
---|
375 | 375 | |
---|
.. | .. |
---|
693 | 693 | * |
---|
694 | 694 | * stop all activity on fec and empty dma buffers |
---|
695 | 695 | */ |
---|
696 | | -static void mpc52xx_fec_stop(struct net_device *dev) |
---|
| 696 | +static void mpc52xx_fec_stop(struct net_device *dev, bool may_sleep) |
---|
697 | 697 | { |
---|
698 | 698 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); |
---|
699 | 699 | struct mpc52xx_fec __iomem *fec = priv->fec; |
---|
.. | .. |
---|
706 | 706 | bcom_disable(priv->rx_dmatsk); |
---|
707 | 707 | |
---|
708 | 708 | /* Wait for tx queue to drain, but only if we're in process context */ |
---|
709 | | - if (!in_interrupt()) { |
---|
| 709 | + if (may_sleep) { |
---|
710 | 710 | timeout = jiffies + msecs_to_jiffies(2000); |
---|
711 | 711 | while (time_before(jiffies, timeout) && |
---|
712 | 712 | !bcom_queue_empty(priv->tx_dmatsk)) |
---|
.. | .. |
---|
738 | 738 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); |
---|
739 | 739 | struct mpc52xx_fec __iomem *fec = priv->fec; |
---|
740 | 740 | |
---|
741 | | - mpc52xx_fec_stop(dev); |
---|
| 741 | + mpc52xx_fec_stop(dev, false); |
---|
742 | 742 | |
---|
743 | 743 | out_be32(&fec->rfifo_status, in_be32(&fec->rfifo_status)); |
---|
744 | 744 | out_be32(&fec->reset_cntrl, FEC_RESET_CNTRL_RESET_FIFO); |
---|
.. | .. |
---|
785 | 785 | }; |
---|
786 | 786 | |
---|
787 | 787 | |
---|
788 | | -static int mpc52xx_fec_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
---|
789 | | -{ |
---|
790 | | - struct phy_device *phydev = dev->phydev; |
---|
791 | | - |
---|
792 | | - if (!phydev) |
---|
793 | | - return -ENOTSUPP; |
---|
794 | | - |
---|
795 | | - return phy_mii_ioctl(phydev, rq, cmd); |
---|
796 | | -} |
---|
797 | | - |
---|
798 | 788 | static const struct net_device_ops mpc52xx_fec_netdev_ops = { |
---|
799 | 789 | .ndo_open = mpc52xx_fec_open, |
---|
800 | 790 | .ndo_stop = mpc52xx_fec_close, |
---|
.. | .. |
---|
802 | 792 | .ndo_set_rx_mode = mpc52xx_fec_set_multicast_list, |
---|
803 | 793 | .ndo_set_mac_address = mpc52xx_fec_set_mac_address, |
---|
804 | 794 | .ndo_validate_addr = eth_validate_addr, |
---|
805 | | - .ndo_do_ioctl = mpc52xx_fec_ioctl, |
---|
| 795 | + .ndo_do_ioctl = phy_do_ioctl, |
---|
806 | 796 | .ndo_tx_timeout = mpc52xx_fec_tx_timeout, |
---|
807 | 797 | .ndo_get_stats = mpc52xx_fec_get_stats, |
---|
808 | 798 | #ifdef CONFIG_NET_POLL_CONTROLLER |
---|
.. | .. |
---|
902 | 892 | * First try to read MAC address from DT |
---|
903 | 893 | */ |
---|
904 | 894 | mac_addr = of_get_mac_address(np); |
---|
905 | | - if (mac_addr) { |
---|
906 | | - memcpy(ndev->dev_addr, mac_addr, ETH_ALEN); |
---|
| 895 | + if (!IS_ERR(mac_addr)) { |
---|
| 896 | + ether_addr_copy(ndev->dev_addr, mac_addr); |
---|
907 | 897 | } else { |
---|
908 | 898 | struct mpc52xx_fec __iomem *fec = priv->fec; |
---|
909 | 899 | |
---|