| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* Applied Micro X-Gene SoC Ethernet Driver |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (c) 2014, Applied Micro Circuits Corporation |
|---|
| 4 | 5 | * Authors: Iyappan Subramanian <isubramanian@apm.com> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 7 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 8 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 9 | | - * 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 | #include <linux/ethtool.h> |
|---|
| .. | .. |
|---|
| 115 | 103 | struct platform_device *pdev = pdata->pdev; |
|---|
| 116 | 104 | |
|---|
| 117 | 105 | strcpy(info->driver, "xgene_enet"); |
|---|
| 118 | | - strcpy(info->version, XGENE_DRV_VERSION); |
|---|
| 119 | | - snprintf(info->fw_version, ETHTOOL_FWVERS_LEN, "N/A"); |
|---|
| 120 | 106 | sprintf(info->bus_info, "%s", pdev->name); |
|---|
| 121 | 107 | } |
|---|
| 122 | 108 | |
|---|
| .. | .. |
|---|
| 306 | 292 | { |
|---|
| 307 | 293 | struct xgene_enet_pdata *pdata = netdev_priv(ndev); |
|---|
| 308 | 294 | struct phy_device *phydev = ndev->phydev; |
|---|
| 309 | | - u32 oldadv, newadv; |
|---|
| 310 | 295 | |
|---|
| 311 | 296 | if (phy_interface_mode_is_rgmii(pdata->phy_mode) || |
|---|
| 312 | 297 | pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) { |
|---|
| 313 | 298 | if (!phydev) |
|---|
| 314 | 299 | return -EINVAL; |
|---|
| 315 | 300 | |
|---|
| 316 | | - if (!(phydev->supported & SUPPORTED_Pause) || |
|---|
| 317 | | - (!(phydev->supported & SUPPORTED_Asym_Pause) && |
|---|
| 318 | | - pp->rx_pause != pp->tx_pause)) |
|---|
| 301 | + if (!phy_validate_pause(phydev, pp)) |
|---|
| 319 | 302 | return -EINVAL; |
|---|
| 320 | 303 | |
|---|
| 321 | 304 | pdata->pause_autoneg = pp->autoneg; |
|---|
| 322 | 305 | pdata->tx_pause = pp->tx_pause; |
|---|
| 323 | 306 | pdata->rx_pause = pp->rx_pause; |
|---|
| 324 | 307 | |
|---|
| 325 | | - oldadv = phydev->advertising; |
|---|
| 326 | | - newadv = oldadv & ~(ADVERTISED_Pause | ADVERTISED_Asym_Pause); |
|---|
| 308 | + phy_set_asym_pause(phydev, pp->rx_pause, pp->tx_pause); |
|---|
| 327 | 309 | |
|---|
| 328 | | - if (pp->rx_pause) |
|---|
| 329 | | - newadv |= ADVERTISED_Pause | ADVERTISED_Asym_Pause; |
|---|
| 330 | | - |
|---|
| 331 | | - if (pp->tx_pause) |
|---|
| 332 | | - newadv ^= ADVERTISED_Asym_Pause; |
|---|
| 333 | | - |
|---|
| 334 | | - if (oldadv ^ newadv) { |
|---|
| 335 | | - phydev->advertising = newadv; |
|---|
| 336 | | - |
|---|
| 337 | | - if (phydev->autoneg) |
|---|
| 338 | | - return phy_start_aneg(phydev); |
|---|
| 339 | | - |
|---|
| 340 | | - if (!pp->autoneg) { |
|---|
| 341 | | - pdata->mac_ops->flowctl_tx(pdata, |
|---|
| 342 | | - pdata->tx_pause); |
|---|
| 343 | | - pdata->mac_ops->flowctl_rx(pdata, |
|---|
| 344 | | - pdata->rx_pause); |
|---|
| 345 | | - } |
|---|
| 310 | + if (!pp->autoneg) { |
|---|
| 311 | + pdata->mac_ops->flowctl_tx(pdata, pdata->tx_pause); |
|---|
| 312 | + pdata->mac_ops->flowctl_rx(pdata, pdata->rx_pause); |
|---|
| 346 | 313 | } |
|---|
| 347 | | - |
|---|
| 348 | 314 | } else { |
|---|
| 349 | 315 | if (pp->autoneg) |
|---|
| 350 | 316 | return -EINVAL; |
|---|