| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Aeroflex Gaisler GRETH 10/100/1G Ethernet MAC. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 7 | 8 | * available in the GRLIB VHDL IP core library. |
|---|
| 8 | 9 | * |
|---|
| 9 | 10 | * Full documentation of both cores can be found here: |
|---|
| 10 | | - * http://www.gaisler.com/products/grlib/grip.pdf |
|---|
| 11 | + * https://www.gaisler.com/products/grlib/grip.pdf |
|---|
| 11 | 12 | * |
|---|
| 12 | 13 | * The Gigabit version supports scatter/gather DMA, any alignment of |
|---|
| 13 | 14 | * buffers and checksum offloading. |
|---|
| 14 | | - * |
|---|
| 15 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 16 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 17 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 18 | | - * option) any later version. |
|---|
| 19 | 15 | * |
|---|
| 20 | 16 | * Contributors: Kristoffer Glembo |
|---|
| 21 | 17 | * Daniel Hellstrom |
|---|
| .. | .. |
|---|
| 114 | 110 | |
|---|
| 115 | 111 | print_hex_dump(KERN_DEBUG, "TX: ", DUMP_PREFIX_OFFSET, 16, 1, |
|---|
| 116 | 112 | skb_frag_address(&skb_shinfo(skb)->frags[i]), |
|---|
| 117 | | - skb_shinfo(skb)->frags[i].size, true); |
|---|
| 113 | + skb_frag_size(&skb_shinfo(skb)->frags[i]), true); |
|---|
| 118 | 114 | } |
|---|
| 119 | 115 | } |
|---|
| 120 | 116 | |
|---|
| .. | .. |
|---|
| 262 | 258 | if (dma_mapping_error(greth->dev, dma_addr)) { |
|---|
| 263 | 259 | if (netif_msg_ifup(greth)) |
|---|
| 264 | 260 | dev_err(greth->dev, "Could not create initial DMA mapping\n"); |
|---|
| 261 | + dev_kfree_skb(skb); |
|---|
| 265 | 262 | goto cleanup; |
|---|
| 266 | 263 | } |
|---|
| 267 | 264 | greth->rx_skbuff[i] = skb; |
|---|
| .. | .. |
|---|
| 613 | 610 | napi_schedule(&greth->napi); |
|---|
| 614 | 611 | } |
|---|
| 615 | 612 | |
|---|
| 616 | | - mmiowb(); |
|---|
| 617 | 613 | spin_unlock(&greth->devlock); |
|---|
| 618 | 614 | |
|---|
| 619 | 615 | return retval; |
|---|
| .. | .. |
|---|
| 1119 | 1115 | |
|---|
| 1120 | 1116 | strlcpy(info->driver, dev_driver_string(greth->dev), |
|---|
| 1121 | 1117 | sizeof(info->driver)); |
|---|
| 1122 | | - strlcpy(info->version, "revision: 1.0", sizeof(info->version)); |
|---|
| 1123 | 1118 | strlcpy(info->bus_info, greth->dev->bus->name, sizeof(info->bus_info)); |
|---|
| 1124 | | - strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); |
|---|
| 1125 | 1119 | } |
|---|
| 1126 | 1120 | |
|---|
| 1127 | 1121 | static void greth_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) |
|---|
| .. | .. |
|---|
| 1279 | 1273 | } |
|---|
| 1280 | 1274 | |
|---|
| 1281 | 1275 | if (greth->gbit_mac) |
|---|
| 1282 | | - phy->supported &= PHY_GBIT_FEATURES; |
|---|
| 1276 | + phy_set_max_speed(phy, SPEED_1000); |
|---|
| 1283 | 1277 | else |
|---|
| 1284 | | - phy->supported &= PHY_BASIC_FEATURES; |
|---|
| 1278 | + phy_set_max_speed(phy, SPEED_100); |
|---|
| 1285 | 1279 | |
|---|
| 1286 | | - phy->advertising = phy->supported; |
|---|
| 1280 | + linkmode_copy(phy->advertising, phy->supported); |
|---|
| 1287 | 1281 | |
|---|
| 1288 | 1282 | greth->link = 0; |
|---|
| 1289 | 1283 | greth->speed = 0; |
|---|
| .. | .. |
|---|
| 1433 | 1427 | } |
|---|
| 1434 | 1428 | |
|---|
| 1435 | 1429 | /* Allocate TX descriptor ring in coherent memory */ |
|---|
| 1436 | | - greth->tx_bd_base = dma_zalloc_coherent(greth->dev, 1024, |
|---|
| 1437 | | - &greth->tx_bd_base_phys, |
|---|
| 1438 | | - GFP_KERNEL); |
|---|
| 1430 | + greth->tx_bd_base = dma_alloc_coherent(greth->dev, 1024, |
|---|
| 1431 | + &greth->tx_bd_base_phys, |
|---|
| 1432 | + GFP_KERNEL); |
|---|
| 1439 | 1433 | if (!greth->tx_bd_base) { |
|---|
| 1440 | 1434 | err = -ENOMEM; |
|---|
| 1441 | 1435 | goto error3; |
|---|
| 1442 | 1436 | } |
|---|
| 1443 | 1437 | |
|---|
| 1444 | 1438 | /* Allocate RX descriptor ring in coherent memory */ |
|---|
| 1445 | | - greth->rx_bd_base = dma_zalloc_coherent(greth->dev, 1024, |
|---|
| 1446 | | - &greth->rx_bd_base_phys, |
|---|
| 1447 | | - GFP_KERNEL); |
|---|
| 1439 | + greth->rx_bd_base = dma_alloc_coherent(greth->dev, 1024, |
|---|
| 1440 | + &greth->rx_bd_base_phys, |
|---|
| 1441 | + GFP_KERNEL); |
|---|
| 1448 | 1442 | if (!greth->rx_bd_base) { |
|---|
| 1449 | 1443 | err = -ENOMEM; |
|---|
| 1450 | 1444 | goto error4; |
|---|
| .. | .. |
|---|
| 1459 | 1453 | const u8 *addr; |
|---|
| 1460 | 1454 | |
|---|
| 1461 | 1455 | addr = of_get_mac_address(ofdev->dev.of_node); |
|---|
| 1462 | | - if (addr) { |
|---|
| 1456 | + if (!IS_ERR(addr)) { |
|---|
| 1463 | 1457 | for (i = 0; i < 6; i++) |
|---|
| 1464 | 1458 | macaddr[i] = (unsigned int) addr[i]; |
|---|
| 1465 | 1459 | } else { |
|---|