| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /*************************************************************************** |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (C) 2004-2008 SMSC |
|---|
| 4 | 5 | * 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/>. |
|---|
| 18 | 6 | * |
|---|
| 19 | 7 | *************************************************************************** |
|---|
| 20 | 8 | * Rewritten, heavily based on smsc911x simple driver by SMSC. |
|---|
| .. | .. |
|---|
| 26 | 14 | * LAN9210, LAN9211 |
|---|
| 27 | 15 | * LAN9220, LAN9221 |
|---|
| 28 | 16 | * LAN89218,LAN9250 |
|---|
| 29 | | - * |
|---|
| 30 | 17 | */ |
|---|
| 31 | 18 | |
|---|
| 32 | 19 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| .. | .. |
|---|
| 1048 | 1035 | |
|---|
| 1049 | 1036 | phy_attached_info(phydev); |
|---|
| 1050 | 1037 | |
|---|
| 1038 | + phy_set_max_speed(phydev, SPEED_100); |
|---|
| 1039 | + |
|---|
| 1051 | 1040 | /* 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); |
|---|
| 1055 | 1042 | |
|---|
| 1056 | 1043 | pdata->last_duplex = -1; |
|---|
| 1057 | 1044 | pdata->last_carrier = -1; |
|---|
| .. | .. |
|---|
| 1209 | 1196 | SMSC_WARN(pdata, hw, "Timed out waiting for " |
|---|
| 1210 | 1197 | "RX FFWD to finish, RX_DP_CTRL: 0x%08X", val); |
|---|
| 1211 | 1198 | } else { |
|---|
| 1212 | | - unsigned int temp; |
|---|
| 1213 | 1199 | while (pktwords--) |
|---|
| 1214 | | - temp = smsc911x_reg_read(pdata, RX_DATA_FIFO); |
|---|
| 1200 | + smsc911x_reg_read(pdata, RX_DATA_FIFO); |
|---|
| 1215 | 1201 | } |
|---|
| 1216 | 1202 | } |
|---|
| 1217 | 1203 | |
|---|
| .. | .. |
|---|
| 1956 | 1942 | return 0; |
|---|
| 1957 | 1943 | } |
|---|
| 1958 | 1944 | |
|---|
| 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 | | - |
|---|
| 1968 | 1945 | static void smsc911x_ethtool_getdrvinfo(struct net_device *dev, |
|---|
| 1969 | 1946 | struct ethtool_drvinfo *info) |
|---|
| 1970 | 1947 | { |
|---|
| .. | .. |
|---|
| 2077 | 2054 | u8 address, u8 data) |
|---|
| 2078 | 2055 | { |
|---|
| 2079 | 2056 | u32 op = E2P_CMD_EPC_CMD_ERASE_ | address; |
|---|
| 2080 | | - u32 temp; |
|---|
| 2081 | 2057 | int ret; |
|---|
| 2082 | 2058 | |
|---|
| 2083 | 2059 | SMSC_TRACE(pdata, drv, "address 0x%x, data 0x%x", address, data); |
|---|
| .. | .. |
|---|
| 2088 | 2064 | smsc911x_reg_write(pdata, E2P_DATA, (u32)data); |
|---|
| 2089 | 2065 | |
|---|
| 2090 | 2066 | /* Workaround for hardware read-after-write restriction */ |
|---|
| 2091 | | - temp = smsc911x_reg_read(pdata, BYTE_TEST); |
|---|
| 2067 | + smsc911x_reg_read(pdata, BYTE_TEST); |
|---|
| 2092 | 2068 | |
|---|
| 2093 | 2069 | ret = smsc911x_eeprom_send_cmd(pdata, op); |
|---|
| 2094 | 2070 | } |
|---|
| .. | .. |
|---|
| 2164 | 2140 | .ndo_start_xmit = smsc911x_hard_start_xmit, |
|---|
| 2165 | 2141 | .ndo_get_stats = smsc911x_get_stats, |
|---|
| 2166 | 2142 | .ndo_set_rx_mode = smsc911x_set_multicast_list, |
|---|
| 2167 | | - .ndo_do_ioctl = smsc911x_do_ioctl, |
|---|
| 2143 | + .ndo_do_ioctl = phy_do_ioctl_running, |
|---|
| 2168 | 2144 | .ndo_validate_addr = eth_validate_addr, |
|---|
| 2169 | 2145 | .ndo_set_mac_address = smsc911x_set_mac_address, |
|---|
| 2170 | 2146 | #ifdef CONFIG_NET_POLL_CONTROLLER |
|---|
| .. | .. |
|---|
| 2446 | 2422 | if (irq == -EPROBE_DEFER) { |
|---|
| 2447 | 2423 | retval = -EPROBE_DEFER; |
|---|
| 2448 | 2424 | goto out_0; |
|---|
| 2449 | | - } else if (irq <= 0) { |
|---|
| 2425 | + } else if (irq < 0) { |
|---|
| 2450 | 2426 | pr_warn("Could not allocate irq resource\n"); |
|---|
| 2451 | 2427 | retval = -ENODEV; |
|---|
| 2452 | 2428 | goto out_0; |
|---|
| .. | .. |
|---|
| 2467 | 2443 | |
|---|
| 2468 | 2444 | pdata = netdev_priv(dev); |
|---|
| 2469 | 2445 | dev->irq = irq; |
|---|
| 2470 | | - pdata->ioaddr = ioremap_nocache(res->start, res_size); |
|---|
| 2446 | + pdata->ioaddr = ioremap(res->start, res_size); |
|---|
| 2471 | 2447 | if (!pdata->ioaddr) { |
|---|
| 2472 | 2448 | retval = -ENOMEM; |
|---|
| 2473 | 2449 | goto out_ioremap_fail; |
|---|