hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/net/ethernet/lantiq_etop.c
....@@ -1,15 +1,5 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
2
- * This program is free software; you can redistribute it and/or modify it
3
- * under the terms of the GNU General Public License version 2 as published
4
- * by the Free Software Foundation.
5
- *
6
- * This program is distributed in the hope that it will be useful,
7
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
8
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
- * GNU General Public License for more details.
10
- *
11
- * You should have received a copy of the GNU General Public License
12
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
133 *
144 * Copyright (C) 2011 John Crispin <blogic@openwrt.org>
155 */
....@@ -112,10 +102,12 @@
112102 static int
113103 ltq_etop_alloc_skb(struct ltq_etop_chan *ch)
114104 {
105
+ struct ltq_etop_priv *priv = netdev_priv(ch->netdev);
106
+
115107 ch->skb[ch->dma.desc] = netdev_alloc_skb(ch->netdev, MAX_DMA_DATA_LEN);
116108 if (!ch->skb[ch->dma.desc])
117109 return -ENOMEM;
118
- ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(NULL,
110
+ ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(&priv->pdev->dev,
119111 ch->skb[ch->dma.desc]->data, MAX_DMA_DATA_LEN,
120112 DMA_FROM_DEVICE);
121113 ch->dma.desc_base[ch->dma.desc].addr =
....@@ -365,15 +357,8 @@
365357 return PTR_ERR(phydev);
366358 }
367359
368
- phydev->supported &= (SUPPORTED_10baseT_Half
369
- | SUPPORTED_10baseT_Full
370
- | SUPPORTED_100baseT_Half
371
- | SUPPORTED_100baseT_Full
372
- | SUPPORTED_Autoneg
373
- | SUPPORTED_MII
374
- | SUPPORTED_TP);
360
+ phy_set_max_speed(phydev, SPEED_100);
375361
376
- phydev->advertising = phydev->supported;
377362 phy_attached_info(phydev);
378363
379364 return 0;
....@@ -439,6 +424,7 @@
439424 if (!IS_TX(i) && (!IS_RX(i)))
440425 continue;
441426 ltq_dma_open(&ch->dma);
427
+ ltq_dma_enable_irq(&ch->dma);
442428 napi_enable(&ch->napi);
443429 }
444430 phy_start(dev->phydev);
....@@ -480,7 +466,6 @@
480466 len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len;
481467
482468 if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) {
483
- dev_kfree_skb_any(skb);
484469 netdev_err(dev, "tx ring full\n");
485470 netif_tx_stop_queue(txq);
486471 return NETDEV_TX_BUSY;
....@@ -493,7 +478,7 @@
493478 netif_trans_update(dev);
494479
495480 spin_lock_irqsave(&priv->lock, flags);
496
- desc->addr = ((unsigned int) dma_map_single(NULL, skb->data, len,
481
+ desc->addr = ((unsigned int) dma_map_single(&priv->pdev->dev, skb->data, len,
497482 DMA_TO_DEVICE)) - byte_offset;
498483 wmb();
499484 desc->ctl = LTQ_DMA_OWN | LTQ_DMA_SOP | LTQ_DMA_EOP |
....@@ -521,13 +506,6 @@
521506 spin_unlock_irqrestore(&priv->lock, flags);
522507
523508 return 0;
524
-}
525
-
526
-static int
527
-ltq_etop_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
528
-{
529
- /* TODO: mii-toll reports "No MII transceiver present!." ?!*/
530
- return phy_mii_ioctl(dev->phydev, rq, cmd);
531509 }
532510
533511 static int
....@@ -608,7 +586,7 @@
608586 }
609587
610588 static void
611
-ltq_etop_tx_timeout(struct net_device *dev)
589
+ltq_etop_tx_timeout(struct net_device *dev, unsigned int txqueue)
612590 {
613591 int err;
614592
....@@ -630,7 +608,7 @@
630608 .ndo_stop = ltq_etop_stop,
631609 .ndo_start_xmit = ltq_etop_tx,
632610 .ndo_change_mtu = ltq_etop_change_mtu,
633
- .ndo_do_ioctl = ltq_etop_ioctl,
611
+ .ndo_do_ioctl = phy_do_ioctl,
634612 .ndo_set_mac_address = ltq_etop_set_mac_address,
635613 .ndo_validate_addr = eth_validate_addr,
636614 .ndo_set_rx_mode = ltq_etop_set_multicast_list,
....@@ -663,7 +641,7 @@
663641 goto err_out;
664642 }
665643
666
- ltq_etop_membase = devm_ioremap_nocache(&pdev->dev,
644
+ ltq_etop_membase = devm_ioremap(&pdev->dev,
667645 res->start, resource_size(res));
668646 if (!ltq_etop_membase) {
669647 dev_err(&pdev->dev, "failed to remap etop engine %d\n",