hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/net/ethernet/smsc/smsc911x.c
....@@ -1,20 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /***************************************************************************
23 *
34 * Copyright (C) 2004-2008 SMSC
45 * Copyright (C) 2005-2008 ARM
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * as published by the Free Software Foundation; either version 2
9
- * of the License, or (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
186 *
197 ***************************************************************************
208 * Rewritten, heavily based on smsc911x simple driver by SMSC.
....@@ -26,7 +14,6 @@
2614 * LAN9210, LAN9211
2715 * LAN9220, LAN9221
2816 * LAN89218,LAN9250
29
- *
3017 */
3118
3219 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -1048,10 +1035,10 @@
10481035
10491036 phy_attached_info(phydev);
10501037
1038
+ phy_set_max_speed(phydev, SPEED_100);
1039
+
10511040 /* mask with MAC supported features */
1052
- phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause |
1053
- SUPPORTED_Asym_Pause);
1054
- phydev->advertising = phydev->supported;
1041
+ phy_support_asym_pause(phydev);
10551042
10561043 pdata->last_duplex = -1;
10571044 pdata->last_carrier = -1;
....@@ -1209,9 +1196,8 @@
12091196 SMSC_WARN(pdata, hw, "Timed out waiting for "
12101197 "RX FFWD to finish, RX_DP_CTRL: 0x%08X", val);
12111198 } else {
1212
- unsigned int temp;
12131199 while (pktwords--)
1214
- temp = smsc911x_reg_read(pdata, RX_DATA_FIFO);
1200
+ smsc911x_reg_read(pdata, RX_DATA_FIFO);
12151201 }
12161202 }
12171203
....@@ -1956,15 +1942,6 @@
19561942 return 0;
19571943 }
19581944
1959
-/* Standard ioctls for mii-tool */
1960
-static int smsc911x_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1961
-{
1962
- if (!netif_running(dev) || !dev->phydev)
1963
- return -EINVAL;
1964
-
1965
- return phy_mii_ioctl(dev->phydev, ifr, cmd);
1966
-}
1967
-
19681945 static void smsc911x_ethtool_getdrvinfo(struct net_device *dev,
19691946 struct ethtool_drvinfo *info)
19701947 {
....@@ -2077,7 +2054,6 @@
20772054 u8 address, u8 data)
20782055 {
20792056 u32 op = E2P_CMD_EPC_CMD_ERASE_ | address;
2080
- u32 temp;
20812057 int ret;
20822058
20832059 SMSC_TRACE(pdata, drv, "address 0x%x, data 0x%x", address, data);
....@@ -2088,7 +2064,7 @@
20882064 smsc911x_reg_write(pdata, E2P_DATA, (u32)data);
20892065
20902066 /* Workaround for hardware read-after-write restriction */
2091
- temp = smsc911x_reg_read(pdata, BYTE_TEST);
2067
+ smsc911x_reg_read(pdata, BYTE_TEST);
20922068
20932069 ret = smsc911x_eeprom_send_cmd(pdata, op);
20942070 }
....@@ -2164,7 +2140,7 @@
21642140 .ndo_start_xmit = smsc911x_hard_start_xmit,
21652141 .ndo_get_stats = smsc911x_get_stats,
21662142 .ndo_set_rx_mode = smsc911x_set_multicast_list,
2167
- .ndo_do_ioctl = smsc911x_do_ioctl,
2143
+ .ndo_do_ioctl = phy_do_ioctl_running,
21682144 .ndo_validate_addr = eth_validate_addr,
21692145 .ndo_set_mac_address = smsc911x_set_mac_address,
21702146 #ifdef CONFIG_NET_POLL_CONTROLLER
....@@ -2446,7 +2422,7 @@
24462422 if (irq == -EPROBE_DEFER) {
24472423 retval = -EPROBE_DEFER;
24482424 goto out_0;
2449
- } else if (irq <= 0) {
2425
+ } else if (irq < 0) {
24502426 pr_warn("Could not allocate irq resource\n");
24512427 retval = -ENODEV;
24522428 goto out_0;
....@@ -2467,7 +2443,7 @@
24672443
24682444 pdata = netdev_priv(dev);
24692445 dev->irq = irq;
2470
- pdata->ioaddr = ioremap_nocache(res->start, res_size);
2446
+ pdata->ioaddr = ioremap(res->start, res_size);
24712447 if (!pdata->ioaddr) {
24722448 retval = -ENOMEM;
24732449 goto out_ioremap_fail;