forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/net/ethernet/apm/xgene-v2/mdio.c
....@@ -1,22 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Applied Micro X-Gene SoC Ethernet v2 Driver
34 *
45 * Copyright (c) 2017, Applied Micro Circuits Corporation
56 * Author(s): Iyappan Subramanian <isubramanian@apm.com>
67 * Keyur Chudgar <kchudgar@apm.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify it
9
- * under the terms of the GNU General Public License as published by the
10
- * Free Software Foundation; either version 2 of the License, or (at your
11
- * option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
208 */
219
2210 #include "main.h"
....@@ -109,6 +97,7 @@
10997
11098 int xge_mdio_config(struct net_device *ndev)
11199 {
100
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
112101 struct xge_pdata *pdata = netdev_priv(ndev);
113102 struct device *dev = &pdata->pdev->dev;
114103 struct mii_bus *mdio_bus;
....@@ -148,16 +137,17 @@
148137 goto err;
149138 }
150139
151
- phydev->supported &= ~(SUPPORTED_10baseT_Half |
152
- SUPPORTED_10baseT_Full |
153
- SUPPORTED_100baseT_Half |
154
- SUPPORTED_100baseT_Full |
155
- SUPPORTED_1000baseT_Half |
156
- SUPPORTED_AUI |
157
- SUPPORTED_MII |
158
- SUPPORTED_FIBRE |
159
- SUPPORTED_BNC);
160
- phydev->advertising = phydev->supported;
140
+ linkmode_set_bit_array(phy_10_100_features_array,
141
+ ARRAY_SIZE(phy_10_100_features_array),
142
+ mask);
143
+ linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, mask);
144
+ linkmode_set_bit(ETHTOOL_LINK_MODE_AUI_BIT, mask);
145
+ linkmode_set_bit(ETHTOOL_LINK_MODE_MII_BIT, mask);
146
+ linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, mask);
147
+ linkmode_set_bit(ETHTOOL_LINK_MODE_BNC_BIT, mask);
148
+
149
+ linkmode_andnot(phydev->supported, phydev->supported, mask);
150
+ linkmode_copy(phydev->advertising, phydev->supported);
161151 pdata->phy_speed = SPEED_UNKNOWN;
162152
163153 return 0;