hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/net/ethernet/freescale/ucc_geth.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) 2006-2009 Freescale Semicondutor, Inc. All rights reserved.
34 *
....@@ -6,11 +7,6 @@
67 *
78 * Description:
89 * QE UCC Gigabit Ethernet Driver
9
- *
10
- * This program is free software; you can redistribute it and/or modify it
11
- * under the terms of the GNU General Public License as published by the
12
- * Free Software Foundation; either version 2 of the License, or (at your
13
- * option) any later version.
1410 */
1511
1612 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -30,6 +26,7 @@
3026 #include <linux/dma-mapping.h>
3127 #include <linux/mii.h>
3228 #include <linux/phy.h>
29
+#include <linux/phy_fixed.h>
3330 #include <linux/workqueue.h>
3431 #include <linux/of_address.h>
3532 #include <linux/of_irq.h>
....@@ -45,7 +42,6 @@
4542 #include <soc/fsl/qe/ucc.h>
4643 #include <soc/fsl/qe/ucc_fast.h>
4744 #include <asm/machdep.h>
48
-#include <net/sch_generic.h>
4945
5046 #include "ucc_geth.h"
5147
....@@ -1352,7 +1348,7 @@
13521348 switch (ugeth->max_speed) {
13531349 case SPEED_10:
13541350 upsmr |= UCC_GETH_UPSMR_R10M;
1355
- /* FALLTHROUGH */
1351
+ fallthrough;
13561352 case SPEED_100:
13571353 if (ugeth->phy_interface != PHY_INTERFACE_MODE_RTBI)
13581354 upsmr |= UCC_GETH_UPSMR_RMM;
....@@ -1362,7 +1358,7 @@
13621358 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
13631359 upsmr |= UCC_GETH_UPSMR_TBIM;
13641360 }
1365
- if ((ugeth->phy_interface == PHY_INTERFACE_MODE_SGMII))
1361
+ if (ugeth->phy_interface == PHY_INTERFACE_MODE_SGMII)
13661362 upsmr |= UCC_GETH_UPSMR_SGMM;
13671363
13681364 out_be32(&uf_regs->upsmr, upsmr);
....@@ -1743,17 +1739,7 @@
17431739 if (priv->phy_interface == PHY_INTERFACE_MODE_SGMII)
17441740 uec_configure_serdes(dev);
17451741
1746
- phydev->supported &= (SUPPORTED_MII |
1747
- SUPPORTED_Autoneg |
1748
- ADVERTISED_10baseT_Half |
1749
- ADVERTISED_10baseT_Full |
1750
- ADVERTISED_100baseT_Half |
1751
- ADVERTISED_100baseT_Full);
1752
-
1753
- if (priv->max_speed == SPEED_1000)
1754
- phydev->supported |= ADVERTISED_1000baseT_Full;
1755
-
1756
- phydev->advertising = phydev->supported;
1742
+ phy_set_max_speed(phydev, priv->max_speed);
17571743
17581744 priv->phydev = phydev;
17591745
....@@ -3559,7 +3545,7 @@
35593545 * ucc_geth_timeout gets called when a packet has not been
35603546 * transmitted after a set amount of time.
35613547 */
3562
-static void ucc_geth_timeout(struct net_device *dev)
3548
+static void ucc_geth_timeout(struct net_device *dev, unsigned int txqueue)
35633549 {
35643550 struct ucc_geth_private *ugeth = netdev_priv(dev);
35653551
....@@ -3689,6 +3675,7 @@
36893675 .ndo_stop = ucc_geth_close,
36903676 .ndo_start_xmit = ucc_geth_start_xmit,
36913677 .ndo_validate_addr = eth_validate_addr,
3678
+ .ndo_change_carrier = fixed_phy_change_carrier,
36923679 .ndo_set_mac_address = ucc_geth_set_mac_addr,
36933680 .ndo_set_rx_mode = ucc_geth_set_multi,
36943681 .ndo_tx_timeout = ucc_geth_timeout,
....@@ -3920,8 +3907,8 @@
39203907 }
39213908
39223909 mac_addr = of_get_mac_address(np);
3923
- if (mac_addr)
3924
- memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
3910
+ if (!IS_ERR(mac_addr))
3911
+ ether_addr_copy(dev->dev_addr, mac_addr);
39253912
39263913 ugeth->ug_info = ug_info;
39273914 ugeth->dev = device;
....@@ -4004,5 +3991,4 @@
40043991
40053992 MODULE_AUTHOR("Freescale Semiconductor, Inc");
40063993 MODULE_DESCRIPTION(DRV_DESC);
4007
-MODULE_VERSION(DRV_VERSION);
40083994 MODULE_LICENSE("GPL");