.. | .. |
---|
172 | 172 | flags = 0; |
---|
173 | 173 | |
---|
174 | 174 | for (i = 0; i < nr_frags; i++) { |
---|
175 | | - struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; |
---|
| 175 | + skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
---|
176 | 176 | int len = skb_frag_size(frag); |
---|
177 | 177 | |
---|
178 | 178 | index = (index + 1) % BGMAC_TX_RING_SLOTS; |
---|
.. | .. |
---|
189 | 189 | } |
---|
190 | 190 | |
---|
191 | 191 | slot->skb = skb; |
---|
192 | | - ring->end += nr_frags + 1; |
---|
193 | 192 | netdev_sent_queue(net_dev, skb->len); |
---|
| 193 | + ring->end += nr_frags + 1; |
---|
194 | 194 | |
---|
195 | 195 | wmb(); |
---|
196 | 196 | |
---|
.. | .. |
---|
616 | 616 | static const u16 ring_base[] = { BGMAC_DMA_BASE0, BGMAC_DMA_BASE1, |
---|
617 | 617 | BGMAC_DMA_BASE2, BGMAC_DMA_BASE3, }; |
---|
618 | 618 | int size; /* ring size: different for Tx and Rx */ |
---|
619 | | - int err; |
---|
620 | 619 | int i; |
---|
621 | 620 | |
---|
622 | 621 | BUILD_BUG_ON(BGMAC_MAX_TX_RINGS > ARRAY_SIZE(ring_base)); |
---|
.. | .. |
---|
635 | 634 | |
---|
636 | 635 | /* Alloc ring of descriptors */ |
---|
637 | 636 | size = BGMAC_TX_RING_SLOTS * sizeof(struct bgmac_dma_desc); |
---|
638 | | - ring->cpu_base = dma_zalloc_coherent(dma_dev, size, |
---|
639 | | - &ring->dma_base, |
---|
640 | | - GFP_KERNEL); |
---|
| 637 | + ring->cpu_base = dma_alloc_coherent(dma_dev, size, |
---|
| 638 | + &ring->dma_base, |
---|
| 639 | + GFP_KERNEL); |
---|
641 | 640 | if (!ring->cpu_base) { |
---|
642 | 641 | dev_err(bgmac->dev, "Allocation of TX ring 0x%X failed\n", |
---|
643 | 642 | ring->mmio_base); |
---|
.. | .. |
---|
660 | 659 | |
---|
661 | 660 | /* Alloc ring of descriptors */ |
---|
662 | 661 | size = BGMAC_RX_RING_SLOTS * sizeof(struct bgmac_dma_desc); |
---|
663 | | - ring->cpu_base = dma_zalloc_coherent(dma_dev, size, |
---|
664 | | - &ring->dma_base, |
---|
665 | | - GFP_KERNEL); |
---|
| 662 | + ring->cpu_base = dma_alloc_coherent(dma_dev, size, |
---|
| 663 | + &ring->dma_base, |
---|
| 664 | + GFP_KERNEL); |
---|
666 | 665 | if (!ring->cpu_base) { |
---|
667 | 666 | dev_err(bgmac->dev, "Allocation of RX ring 0x%X failed\n", |
---|
668 | 667 | ring->mmio_base); |
---|
669 | | - err = -ENOMEM; |
---|
670 | 668 | goto err_dma_free; |
---|
671 | 669 | } |
---|
672 | 670 | |
---|
.. | .. |
---|
892 | 890 | |
---|
893 | 891 | if (iost & BGMAC_BCMA_IOST_ATTACHED) { |
---|
894 | 892 | flags = BGMAC_BCMA_IOCTL_SW_CLKEN; |
---|
895 | | - if (!bgmac->has_robosw) |
---|
| 893 | + if (bgmac->in_init || !bgmac->has_robosw) |
---|
896 | 894 | flags |= BGMAC_BCMA_IOCTL_SW_RESET; |
---|
897 | 895 | } |
---|
898 | 896 | bgmac_clk_enable(bgmac, flags); |
---|
899 | 897 | } |
---|
900 | 898 | |
---|
901 | | - if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw) |
---|
| 899 | + if (iost & BGMAC_BCMA_IOST_ATTACHED && (bgmac->in_init || !bgmac->has_robosw)) |
---|
902 | 900 | bgmac_idm_write(bgmac, BCMA_IOCTL, |
---|
903 | 901 | bgmac_idm_read(bgmac, BCMA_IOCTL) & |
---|
904 | 902 | ~BGMAC_BCMA_IOCTL_SW_RESET); |
---|
.. | .. |
---|
1250 | 1248 | return 0; |
---|
1251 | 1249 | } |
---|
1252 | 1250 | |
---|
1253 | | -static int bgmac_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd) |
---|
| 1251 | +static int bgmac_change_mtu(struct net_device *net_dev, int mtu) |
---|
1254 | 1252 | { |
---|
1255 | | - if (!netif_running(net_dev)) |
---|
1256 | | - return -EINVAL; |
---|
| 1253 | + struct bgmac *bgmac = netdev_priv(net_dev); |
---|
1257 | 1254 | |
---|
1258 | | - return phy_mii_ioctl(net_dev->phydev, ifr, cmd); |
---|
| 1255 | + bgmac_write(bgmac, BGMAC_RXMAX_LENGTH, 32 + mtu); |
---|
| 1256 | + return 0; |
---|
1259 | 1257 | } |
---|
1260 | 1258 | |
---|
1261 | 1259 | static const struct net_device_ops bgmac_netdev_ops = { |
---|
.. | .. |
---|
1265 | 1263 | .ndo_set_rx_mode = bgmac_set_rx_mode, |
---|
1266 | 1264 | .ndo_set_mac_address = bgmac_set_mac_address, |
---|
1267 | 1265 | .ndo_validate_addr = eth_validate_addr, |
---|
1268 | | - .ndo_do_ioctl = bgmac_ioctl, |
---|
| 1266 | + .ndo_do_ioctl = phy_do_ioctl_running, |
---|
| 1267 | + .ndo_change_mtu = bgmac_change_mtu, |
---|
1269 | 1268 | }; |
---|
1270 | 1269 | |
---|
1271 | 1270 | /************************************************** |
---|
.. | .. |
---|
1448 | 1447 | struct phy_device *phy_dev; |
---|
1449 | 1448 | int err; |
---|
1450 | 1449 | |
---|
1451 | | - phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, -1, NULL); |
---|
1452 | | - if (!phy_dev || IS_ERR(phy_dev)) { |
---|
| 1450 | + phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, NULL); |
---|
| 1451 | + if (IS_ERR(phy_dev)) { |
---|
1453 | 1452 | dev_err(bgmac->dev, "Failed to register fixed PHY device\n"); |
---|
1454 | 1453 | return -ENODEV; |
---|
1455 | 1454 | } |
---|
.. | .. |
---|
1491 | 1490 | struct net_device *net_dev = bgmac->net_dev; |
---|
1492 | 1491 | int err; |
---|
1493 | 1492 | |
---|
1494 | | - bgmac_chip_intrs_off(bgmac); |
---|
| 1493 | + bgmac->in_init = true; |
---|
1495 | 1494 | |
---|
1496 | 1495 | net_dev->irq = bgmac->irq; |
---|
1497 | 1496 | SET_NETDEV_DEV(net_dev, bgmac->dev); |
---|
.. | .. |
---|
1509 | 1508 | * Broadcom does it in arch PCI code when enabling fake PCI device. |
---|
1510 | 1509 | */ |
---|
1511 | 1510 | bgmac_clk_enable(bgmac, 0); |
---|
| 1511 | + |
---|
| 1512 | + bgmac_chip_intrs_off(bgmac); |
---|
1512 | 1513 | |
---|
1513 | 1514 | /* This seems to be fixing IRQ by assigning OOB #6 to the core */ |
---|
1514 | 1515 | if (!(bgmac->feature_flags & BGMAC_FEAT_IDM_MASK)) { |
---|
.. | .. |
---|
1540 | 1541 | net_dev->hw_features = net_dev->features; |
---|
1541 | 1542 | net_dev->vlan_features = net_dev->features; |
---|
1542 | 1543 | |
---|
| 1544 | + /* Omit FCS from max MTU size */ |
---|
| 1545 | + net_dev->max_mtu = BGMAC_RX_MAX_FRAME_SIZE - ETH_FCS_LEN; |
---|
| 1546 | + |
---|
| 1547 | + bgmac->in_init = false; |
---|
| 1548 | + |
---|
1543 | 1549 | err = register_netdev(bgmac->net_dev); |
---|
1544 | 1550 | if (err) { |
---|
1545 | 1551 | dev_err(bgmac->dev, "Cannot register net device\n"); |
---|
.. | .. |
---|
1566 | 1572 | phy_disconnect(bgmac->net_dev->phydev); |
---|
1567 | 1573 | netif_napi_del(&bgmac->napi); |
---|
1568 | 1574 | bgmac_dma_free(bgmac); |
---|
1569 | | - free_netdev(bgmac->net_dev); |
---|
1570 | 1575 | } |
---|
1571 | 1576 | EXPORT_SYMBOL_GPL(bgmac_enet_remove); |
---|
1572 | 1577 | |
---|