forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c
....@@ -1,20 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* Applied Micro X-Gene SoC Ethernet Driver
23 *
34 * Copyright (c) 2014, Applied Micro Circuits Corporation
45 * 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/>.
186 */
197
208 #include <linux/ethtool.h>
....@@ -115,8 +103,6 @@
115103 struct platform_device *pdev = pdata->pdev;
116104
117105 strcpy(info->driver, "xgene_enet");
118
- strcpy(info->version, XGENE_DRV_VERSION);
119
- snprintf(info->fw_version, ETHTOOL_FWVERS_LEN, "N/A");
120106 sprintf(info->bus_info, "%s", pdev->name);
121107 }
122108
....@@ -306,45 +292,25 @@
306292 {
307293 struct xgene_enet_pdata *pdata = netdev_priv(ndev);
308294 struct phy_device *phydev = ndev->phydev;
309
- u32 oldadv, newadv;
310295
311296 if (phy_interface_mode_is_rgmii(pdata->phy_mode) ||
312297 pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) {
313298 if (!phydev)
314299 return -EINVAL;
315300
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))
319302 return -EINVAL;
320303
321304 pdata->pause_autoneg = pp->autoneg;
322305 pdata->tx_pause = pp->tx_pause;
323306 pdata->rx_pause = pp->rx_pause;
324307
325
- oldadv = phydev->advertising;
326
- newadv = oldadv & ~(ADVERTISED_Pause | ADVERTISED_Asym_Pause);
308
+ phy_set_asym_pause(phydev, pp->rx_pause, pp->tx_pause);
327309
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);
346313 }
347
-
348314 } else {
349315 if (pp->autoneg)
350316 return -EINVAL;