| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* 10G controller driver for Samsung SoCs |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (C) 2013 Samsung Electronics Co., Ltd. |
|---|
| 4 | 5 | * http://www.samsung.com |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Siva Reddy Kallam <siva.kallam@samsung.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 10 | | - * published by the Free Software Foundation. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| .. | .. |
|---|
| 100 | 97 | |
|---|
| 101 | 98 | /** |
|---|
| 102 | 99 | * sxgbe_eee_ctrl_timer |
|---|
| 103 | | - * @arg : data hook |
|---|
| 100 | + * @t: timer list containing a data |
|---|
| 104 | 101 | * Description: |
|---|
| 105 | 102 | * If there is no data transfer and if we are not in LPI state, |
|---|
| 106 | 103 | * then MAC Transmitter can be moved to LPI state. |
|---|
| .. | .. |
|---|
| 258 | 255 | |
|---|
| 259 | 256 | /** |
|---|
| 260 | 257 | * sxgbe_init_phy - PHY initialization |
|---|
| 261 | | - * @dev: net device structure |
|---|
| 258 | + * @ndev: net device structure |
|---|
| 262 | 259 | * Description: it initializes the driver's PHY state, and attaches the PHY |
|---|
| 263 | 260 | * to the mac driver. |
|---|
| 264 | 261 | * Return value: |
|---|
| .. | .. |
|---|
| 298 | 295 | /* Stop Advertising 1000BASE Capability if interface is not GMII */ |
|---|
| 299 | 296 | if ((phy_iface == PHY_INTERFACE_MODE_MII) || |
|---|
| 300 | 297 | (phy_iface == PHY_INTERFACE_MODE_RMII)) |
|---|
| 301 | | - phydev->advertising &= ~(SUPPORTED_1000baseT_Half | |
|---|
| 302 | | - SUPPORTED_1000baseT_Full); |
|---|
| 298 | + phy_set_max_speed(phydev, SPEED_1000); |
|---|
| 299 | + |
|---|
| 303 | 300 | if (phydev->phy_id == 0) { |
|---|
| 304 | 301 | phy_disconnect(phydev); |
|---|
| 305 | 302 | return -ENODEV; |
|---|
| .. | .. |
|---|
| 367 | 364 | /** |
|---|
| 368 | 365 | * sxgbe_free_rx_buffers - free what sxgbe_init_rx_buffers() allocated |
|---|
| 369 | 366 | * @dev: net device structure |
|---|
| 367 | + * @p: dec pointer |
|---|
| 368 | + * @i: index |
|---|
| 369 | + * @dma_buf_sz: size |
|---|
| 370 | 370 | * @rx_ring: ring to be freed |
|---|
| 371 | | - * @rx_rsize: ring size |
|---|
| 371 | + * |
|---|
| 372 | 372 | * Description: this function initializes the DMA RX descriptor |
|---|
| 373 | 373 | */ |
|---|
| 374 | 374 | static void sxgbe_free_rx_buffers(struct net_device *dev, |
|---|
| .. | .. |
|---|
| 386 | 386 | /** |
|---|
| 387 | 387 | * init_tx_ring - init the TX descriptor ring |
|---|
| 388 | 388 | * @dev: net device structure |
|---|
| 389 | + * @queue_no: queue |
|---|
| 389 | 390 | * @tx_ring: ring to be initialised |
|---|
| 390 | 391 | * @tx_rsize: ring size |
|---|
| 391 | 392 | * Description: this function initializes the DMA TX descriptor |
|---|
| .. | .. |
|---|
| 400 | 401 | } |
|---|
| 401 | 402 | |
|---|
| 402 | 403 | /* allocate memory for TX descriptors */ |
|---|
| 403 | | - tx_ring->dma_tx = dma_zalloc_coherent(dev, |
|---|
| 404 | | - tx_rsize * sizeof(struct sxgbe_tx_norm_desc), |
|---|
| 405 | | - &tx_ring->dma_tx_phy, GFP_KERNEL); |
|---|
| 404 | + tx_ring->dma_tx = dma_alloc_coherent(dev, |
|---|
| 405 | + tx_rsize * sizeof(struct sxgbe_tx_norm_desc), |
|---|
| 406 | + &tx_ring->dma_tx_phy, GFP_KERNEL); |
|---|
| 406 | 407 | if (!tx_ring->dma_tx) |
|---|
| 407 | 408 | return -ENOMEM; |
|---|
| 408 | 409 | |
|---|
| .. | .. |
|---|
| 452 | 453 | /** |
|---|
| 453 | 454 | * init_rx_ring - init the RX descriptor ring |
|---|
| 454 | 455 | * @dev: net device structure |
|---|
| 456 | + * @queue_no: queue |
|---|
| 455 | 457 | * @rx_ring: ring to be initialised |
|---|
| 456 | 458 | * @rx_rsize: ring size |
|---|
| 457 | 459 | * Description: this function initializes the DMA RX descriptor |
|---|
| .. | .. |
|---|
| 479 | 481 | rx_ring->queue_no = queue_no; |
|---|
| 480 | 482 | |
|---|
| 481 | 483 | /* allocate memory for RX descriptors */ |
|---|
| 482 | | - rx_ring->dma_rx = dma_zalloc_coherent(priv->device, |
|---|
| 483 | | - rx_rsize * sizeof(struct sxgbe_rx_norm_desc), |
|---|
| 484 | | - &rx_ring->dma_rx_phy, GFP_KERNEL); |
|---|
| 484 | + rx_ring->dma_rx = dma_alloc_coherent(priv->device, |
|---|
| 485 | + rx_rsize * sizeof(struct sxgbe_rx_norm_desc), |
|---|
| 486 | + &rx_ring->dma_rx_phy, GFP_KERNEL); |
|---|
| 485 | 487 | |
|---|
| 486 | 488 | if (rx_ring->dma_rx == NULL) |
|---|
| 487 | 489 | return -ENOMEM; |
|---|
| .. | .. |
|---|
| 551 | 553 | |
|---|
| 552 | 554 | /** |
|---|
| 553 | 555 | * init_dma_desc_rings - init the RX/TX descriptor rings |
|---|
| 554 | | - * @dev: net device structure |
|---|
| 556 | + * @netd: net device structure |
|---|
| 555 | 557 | * Description: this function initializes the DMA RX/TX descriptors |
|---|
| 556 | 558 | * and allocates the socket buffers. It suppors the chained and ring |
|---|
| 557 | 559 | * modes. |
|---|
| .. | .. |
|---|
| 727 | 729 | |
|---|
| 728 | 730 | /** |
|---|
| 729 | 731 | * sxgbe_tx_queue_clean: |
|---|
| 730 | | - * @priv: driver private structure |
|---|
| 732 | + * @tqueue: queue pointer |
|---|
| 731 | 733 | * Description: it reclaims resources after transmission completes. |
|---|
| 732 | 734 | */ |
|---|
| 733 | 735 | static void sxgbe_tx_queue_clean(struct sxgbe_tx_queue *tqueue) |
|---|
| .. | .. |
|---|
| 810 | 812 | /** |
|---|
| 811 | 813 | * sxgbe_restart_tx_queue: irq tx error mng function |
|---|
| 812 | 814 | * @priv: driver private structure |
|---|
| 815 | + * @queue_num: queue number |
|---|
| 813 | 816 | * Description: it cleans the descriptors and restarts the transmission |
|---|
| 814 | 817 | * in case of errors. |
|---|
| 815 | 818 | */ |
|---|
| .. | .. |
|---|
| 1570 | 1573 | /** |
|---|
| 1571 | 1574 | * sxgbe_tx_timeout |
|---|
| 1572 | 1575 | * @dev : Pointer to net device structure |
|---|
| 1576 | + * @txqueue: index of the hanging queue |
|---|
| 1573 | 1577 | * Description: this function is called when a packet transmission fails to |
|---|
| 1574 | 1578 | * complete within a reasonable time. The driver will mark the error in the |
|---|
| 1575 | 1579 | * netdev structure and arrange for the device to be reset to a sane state |
|---|
| 1576 | 1580 | * in order to transmit a new packet. |
|---|
| 1577 | 1581 | */ |
|---|
| 1578 | | -static void sxgbe_tx_timeout(struct net_device *dev) |
|---|
| 1582 | +static void sxgbe_tx_timeout(struct net_device *dev, unsigned int txqueue) |
|---|
| 1579 | 1583 | { |
|---|
| 1580 | 1584 | struct sxgbe_priv_data *priv = netdev_priv(dev); |
|---|
| 1581 | 1585 | |
|---|
| .. | .. |
|---|
| 1942 | 1946 | case SIOCGMIIPHY: |
|---|
| 1943 | 1947 | case SIOCGMIIREG: |
|---|
| 1944 | 1948 | case SIOCSMIIREG: |
|---|
| 1945 | | - if (!dev->phydev) |
|---|
| 1946 | | - return -EINVAL; |
|---|
| 1947 | | - ret = phy_mii_ioctl(dev->phydev, rq, cmd); |
|---|
| 1949 | + ret = phy_do_ioctl(dev, rq, cmd); |
|---|
| 1948 | 1950 | break; |
|---|
| 1949 | 1951 | default: |
|---|
| 1950 | 1952 | break; |
|---|
| .. | .. |
|---|
| 2280 | 2282 | char *opt; |
|---|
| 2281 | 2283 | |
|---|
| 2282 | 2284 | if (!str || !*str) |
|---|
| 2283 | | - return -EINVAL; |
|---|
| 2285 | + return 1; |
|---|
| 2284 | 2286 | while ((opt = strsep(&str, ",")) != NULL) { |
|---|
| 2285 | 2287 | if (!strncmp(opt, "eee_timer:", 10)) { |
|---|
| 2286 | 2288 | if (kstrtoint(opt + 10, 0, &eee_timer)) |
|---|
| 2287 | 2289 | goto err; |
|---|
| 2288 | 2290 | } |
|---|
| 2289 | 2291 | } |
|---|
| 2290 | | - return 0; |
|---|
| 2292 | + return 1; |
|---|
| 2291 | 2293 | |
|---|
| 2292 | 2294 | err: |
|---|
| 2293 | 2295 | pr_err("%s: ERROR broken module parameter conversion\n", __func__); |
|---|
| 2294 | | - return -EINVAL; |
|---|
| 2296 | + return 1; |
|---|
| 2295 | 2297 | } |
|---|
| 2296 | 2298 | |
|---|
| 2297 | 2299 | __setup("sxgbeeth=", sxgbe_cmdline_opt); |
|---|
| .. | .. |
|---|
| 2299 | 2301 | |
|---|
| 2300 | 2302 | |
|---|
| 2301 | 2303 | |
|---|
| 2302 | | -MODULE_DESCRIPTION("SAMSUNG 10G/2.5G/1G Ethernet PLATFORM driver"); |
|---|
| 2304 | +MODULE_DESCRIPTION("Samsung 10G/2.5G/1G Ethernet PLATFORM driver"); |
|---|
| 2303 | 2305 | |
|---|
| 2304 | 2306 | MODULE_PARM_DESC(debug, "Message Level (-1: default, 0: no output, 16: all)"); |
|---|
| 2305 | 2307 | MODULE_PARM_DESC(eee_timer, "EEE-LPI Default LS timer value"); |
|---|