hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* 10G controller driver for Samsung SoCs
23 *
34 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
45 * http://www.samsung.com
56 *
67 * 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.
118 */
129
1310 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -100,7 +97,7 @@
10097
10198 /**
10299 * sxgbe_eee_ctrl_timer
103
- * @arg : data hook
100
+ * @t: timer list containing a data
104101 * Description:
105102 * If there is no data transfer and if we are not in LPI state,
106103 * then MAC Transmitter can be moved to LPI state.
....@@ -258,7 +255,7 @@
258255
259256 /**
260257 * sxgbe_init_phy - PHY initialization
261
- * @dev: net device structure
258
+ * @ndev: net device structure
262259 * Description: it initializes the driver's PHY state, and attaches the PHY
263260 * to the mac driver.
264261 * Return value:
....@@ -298,8 +295,8 @@
298295 /* Stop Advertising 1000BASE Capability if interface is not GMII */
299296 if ((phy_iface == PHY_INTERFACE_MODE_MII) ||
300297 (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
+
303300 if (phydev->phy_id == 0) {
304301 phy_disconnect(phydev);
305302 return -ENODEV;
....@@ -367,8 +364,11 @@
367364 /**
368365 * sxgbe_free_rx_buffers - free what sxgbe_init_rx_buffers() allocated
369366 * @dev: net device structure
367
+ * @p: dec pointer
368
+ * @i: index
369
+ * @dma_buf_sz: size
370370 * @rx_ring: ring to be freed
371
- * @rx_rsize: ring size
371
+ *
372372 * Description: this function initializes the DMA RX descriptor
373373 */
374374 static void sxgbe_free_rx_buffers(struct net_device *dev,
....@@ -386,6 +386,7 @@
386386 /**
387387 * init_tx_ring - init the TX descriptor ring
388388 * @dev: net device structure
389
+ * @queue_no: queue
389390 * @tx_ring: ring to be initialised
390391 * @tx_rsize: ring size
391392 * Description: this function initializes the DMA TX descriptor
....@@ -400,9 +401,9 @@
400401 }
401402
402403 /* 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);
406407 if (!tx_ring->dma_tx)
407408 return -ENOMEM;
408409
....@@ -452,6 +453,7 @@
452453 /**
453454 * init_rx_ring - init the RX descriptor ring
454455 * @dev: net device structure
456
+ * @queue_no: queue
455457 * @rx_ring: ring to be initialised
456458 * @rx_rsize: ring size
457459 * Description: this function initializes the DMA RX descriptor
....@@ -479,9 +481,9 @@
479481 rx_ring->queue_no = queue_no;
480482
481483 /* 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);
485487
486488 if (rx_ring->dma_rx == NULL)
487489 return -ENOMEM;
....@@ -551,7 +553,7 @@
551553
552554 /**
553555 * init_dma_desc_rings - init the RX/TX descriptor rings
554
- * @dev: net device structure
556
+ * @netd: net device structure
555557 * Description: this function initializes the DMA RX/TX descriptors
556558 * and allocates the socket buffers. It suppors the chained and ring
557559 * modes.
....@@ -727,7 +729,7 @@
727729
728730 /**
729731 * sxgbe_tx_queue_clean:
730
- * @priv: driver private structure
732
+ * @tqueue: queue pointer
731733 * Description: it reclaims resources after transmission completes.
732734 */
733735 static void sxgbe_tx_queue_clean(struct sxgbe_tx_queue *tqueue)
....@@ -810,6 +812,7 @@
810812 /**
811813 * sxgbe_restart_tx_queue: irq tx error mng function
812814 * @priv: driver private structure
815
+ * @queue_num: queue number
813816 * Description: it cleans the descriptors and restarts the transmission
814817 * in case of errors.
815818 */
....@@ -1570,12 +1573,13 @@
15701573 /**
15711574 * sxgbe_tx_timeout
15721575 * @dev : Pointer to net device structure
1576
+ * @txqueue: index of the hanging queue
15731577 * Description: this function is called when a packet transmission fails to
15741578 * complete within a reasonable time. The driver will mark the error in the
15751579 * netdev structure and arrange for the device to be reset to a sane state
15761580 * in order to transmit a new packet.
15771581 */
1578
-static void sxgbe_tx_timeout(struct net_device *dev)
1582
+static void sxgbe_tx_timeout(struct net_device *dev, unsigned int txqueue)
15791583 {
15801584 struct sxgbe_priv_data *priv = netdev_priv(dev);
15811585
....@@ -1942,9 +1946,7 @@
19421946 case SIOCGMIIPHY:
19431947 case SIOCGMIIREG:
19441948 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);
19481950 break;
19491951 default:
19501952 break;
....@@ -2280,18 +2282,18 @@
22802282 char *opt;
22812283
22822284 if (!str || !*str)
2283
- return -EINVAL;
2285
+ return 1;
22842286 while ((opt = strsep(&str, ",")) != NULL) {
22852287 if (!strncmp(opt, "eee_timer:", 10)) {
22862288 if (kstrtoint(opt + 10, 0, &eee_timer))
22872289 goto err;
22882290 }
22892291 }
2290
- return 0;
2292
+ return 1;
22912293
22922294 err:
22932295 pr_err("%s: ERROR broken module parameter conversion\n", __func__);
2294
- return -EINVAL;
2296
+ return 1;
22952297 }
22962298
22972299 __setup("sxgbeeth=", sxgbe_cmdline_opt);
....@@ -2299,7 +2301,7 @@
22992301
23002302
23012303
2302
-MODULE_DESCRIPTION("SAMSUNG 10G/2.5G/1G Ethernet PLATFORM driver");
2304
+MODULE_DESCRIPTION("Samsung 10G/2.5G/1G Ethernet PLATFORM driver");
23032305
23042306 MODULE_PARM_DESC(debug, "Message Level (-1: default, 0: no output, 16: all)");
23052307 MODULE_PARM_DESC(eee_timer, "EEE-LPI Default LS timer value");