| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 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/>. |
|---|
| 13 | 3 | * |
|---|
| 14 | 4 | * Copyright (C) 2011 John Crispin <blogic@openwrt.org> |
|---|
| 15 | 5 | */ |
|---|
| .. | .. |
|---|
| 112 | 102 | static int |
|---|
| 113 | 103 | ltq_etop_alloc_skb(struct ltq_etop_chan *ch) |
|---|
| 114 | 104 | { |
|---|
| 105 | + struct ltq_etop_priv *priv = netdev_priv(ch->netdev); |
|---|
| 106 | + |
|---|
| 115 | 107 | ch->skb[ch->dma.desc] = netdev_alloc_skb(ch->netdev, MAX_DMA_DATA_LEN); |
|---|
| 116 | 108 | if (!ch->skb[ch->dma.desc]) |
|---|
| 117 | 109 | 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, |
|---|
| 119 | 111 | ch->skb[ch->dma.desc]->data, MAX_DMA_DATA_LEN, |
|---|
| 120 | 112 | DMA_FROM_DEVICE); |
|---|
| 121 | 113 | ch->dma.desc_base[ch->dma.desc].addr = |
|---|
| .. | .. |
|---|
| 365 | 357 | return PTR_ERR(phydev); |
|---|
| 366 | 358 | } |
|---|
| 367 | 359 | |
|---|
| 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); |
|---|
| 375 | 361 | |
|---|
| 376 | | - phydev->advertising = phydev->supported; |
|---|
| 377 | 362 | phy_attached_info(phydev); |
|---|
| 378 | 363 | |
|---|
| 379 | 364 | return 0; |
|---|
| .. | .. |
|---|
| 439 | 424 | if (!IS_TX(i) && (!IS_RX(i))) |
|---|
| 440 | 425 | continue; |
|---|
| 441 | 426 | ltq_dma_open(&ch->dma); |
|---|
| 427 | + ltq_dma_enable_irq(&ch->dma); |
|---|
| 442 | 428 | napi_enable(&ch->napi); |
|---|
| 443 | 429 | } |
|---|
| 444 | 430 | phy_start(dev->phydev); |
|---|
| .. | .. |
|---|
| 480 | 466 | len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len; |
|---|
| 481 | 467 | |
|---|
| 482 | 468 | if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) { |
|---|
| 483 | | - dev_kfree_skb_any(skb); |
|---|
| 484 | 469 | netdev_err(dev, "tx ring full\n"); |
|---|
| 485 | 470 | netif_tx_stop_queue(txq); |
|---|
| 486 | 471 | return NETDEV_TX_BUSY; |
|---|
| .. | .. |
|---|
| 493 | 478 | netif_trans_update(dev); |
|---|
| 494 | 479 | |
|---|
| 495 | 480 | 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, |
|---|
| 497 | 482 | DMA_TO_DEVICE)) - byte_offset; |
|---|
| 498 | 483 | wmb(); |
|---|
| 499 | 484 | desc->ctl = LTQ_DMA_OWN | LTQ_DMA_SOP | LTQ_DMA_EOP | |
|---|
| .. | .. |
|---|
| 521 | 506 | spin_unlock_irqrestore(&priv->lock, flags); |
|---|
| 522 | 507 | |
|---|
| 523 | 508 | 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); |
|---|
| 531 | 509 | } |
|---|
| 532 | 510 | |
|---|
| 533 | 511 | static int |
|---|
| .. | .. |
|---|
| 608 | 586 | } |
|---|
| 609 | 587 | |
|---|
| 610 | 588 | static void |
|---|
| 611 | | -ltq_etop_tx_timeout(struct net_device *dev) |
|---|
| 589 | +ltq_etop_tx_timeout(struct net_device *dev, unsigned int txqueue) |
|---|
| 612 | 590 | { |
|---|
| 613 | 591 | int err; |
|---|
| 614 | 592 | |
|---|
| .. | .. |
|---|
| 630 | 608 | .ndo_stop = ltq_etop_stop, |
|---|
| 631 | 609 | .ndo_start_xmit = ltq_etop_tx, |
|---|
| 632 | 610 | .ndo_change_mtu = ltq_etop_change_mtu, |
|---|
| 633 | | - .ndo_do_ioctl = ltq_etop_ioctl, |
|---|
| 611 | + .ndo_do_ioctl = phy_do_ioctl, |
|---|
| 634 | 612 | .ndo_set_mac_address = ltq_etop_set_mac_address, |
|---|
| 635 | 613 | .ndo_validate_addr = eth_validate_addr, |
|---|
| 636 | 614 | .ndo_set_rx_mode = ltq_etop_set_multicast_list, |
|---|
| .. | .. |
|---|
| 663 | 641 | goto err_out; |
|---|
| 664 | 642 | } |
|---|
| 665 | 643 | |
|---|
| 666 | | - ltq_etop_membase = devm_ioremap_nocache(&pdev->dev, |
|---|
| 644 | + ltq_etop_membase = devm_ioremap(&pdev->dev, |
|---|
| 667 | 645 | res->start, resource_size(res)); |
|---|
| 668 | 646 | if (!ltq_etop_membase) { |
|---|
| 669 | 647 | dev_err(&pdev->dev, "failed to remap etop engine %d\n", |
|---|