hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/drivers/net/phy/intel-xway.c
....@@ -1,16 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0+
12 /*
23 * Copyright (C) 2012 Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
34 * Copyright (C) 2016 Hauke Mehrtens <hauke@hauke-m.de>
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
145 */
156
167 #include <linux/mdio.h>
....@@ -20,6 +11,18 @@
2011
2112 #define XWAY_MDIO_IMASK 0x19 /* interrupt mask */
2213 #define XWAY_MDIO_ISTAT 0x1A /* interrupt status */
14
+#define XWAY_MDIO_LED 0x1B /* led control */
15
+
16
+/* bit 15:12 are reserved */
17
+#define XWAY_MDIO_LED_LED3_EN BIT(11) /* Enable the integrated function of LED3 */
18
+#define XWAY_MDIO_LED_LED2_EN BIT(10) /* Enable the integrated function of LED2 */
19
+#define XWAY_MDIO_LED_LED1_EN BIT(9) /* Enable the integrated function of LED1 */
20
+#define XWAY_MDIO_LED_LED0_EN BIT(8) /* Enable the integrated function of LED0 */
21
+/* bit 7:4 are reserved */
22
+#define XWAY_MDIO_LED_LED3_DA BIT(3) /* Direct Access to LED3 */
23
+#define XWAY_MDIO_LED_LED2_DA BIT(2) /* Direct Access to LED2 */
24
+#define XWAY_MDIO_LED_LED1_DA BIT(1) /* Direct Access to LED1 */
25
+#define XWAY_MDIO_LED_LED0_DA BIT(0) /* Direct Access to LED0 */
2326
2427 #define XWAY_MDIO_INIT_WOL BIT(15) /* Wake-On-LAN */
2528 #define XWAY_MDIO_INIT_MSRE BIT(14)
....@@ -168,6 +171,15 @@
168171 /* Clear all pending interrupts */
169172 phy_read(phydev, XWAY_MDIO_ISTAT);
170173
174
+ /* Ensure that integrated led function is enabled for all leds */
175
+ err = phy_write(phydev, XWAY_MDIO_LED,
176
+ XWAY_MDIO_LED_LED0_EN |
177
+ XWAY_MDIO_LED_LED1_EN |
178
+ XWAY_MDIO_LED_LED2_EN |
179
+ XWAY_MDIO_LED_LED3_EN);
180
+ if (err)
181
+ return err;
182
+
171183 phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDCH,
172184 XWAY_MMD_LEDCH_NACS_NONE |
173185 XWAY_MMD_LEDCH_SBF_F02HZ |
....@@ -241,8 +253,7 @@
241253 .phy_id = PHY_ID_PHY11G_1_3,
242254 .phy_id_mask = 0xffffffff,
243255 .name = "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.3",
244
- .features = PHY_GBIT_FEATURES,
245
- .flags = PHY_HAS_INTERRUPT,
256
+ /* PHY_GBIT_FEATURES */
246257 .config_init = xway_gphy_config_init,
247258 .config_aneg = xway_gphy14_config_aneg,
248259 .ack_interrupt = xway_gphy_ack_interrupt,
....@@ -254,8 +265,7 @@
254265 .phy_id = PHY_ID_PHY22F_1_3,
255266 .phy_id_mask = 0xffffffff,
256267 .name = "Intel XWAY PHY22F (PEF 7061) v1.3",
257
- .features = PHY_BASIC_FEATURES,
258
- .flags = PHY_HAS_INTERRUPT,
268
+ /* PHY_BASIC_FEATURES */
259269 .config_init = xway_gphy_config_init,
260270 .config_aneg = xway_gphy14_config_aneg,
261271 .ack_interrupt = xway_gphy_ack_interrupt,
....@@ -267,8 +277,7 @@
267277 .phy_id = PHY_ID_PHY11G_1_4,
268278 .phy_id_mask = 0xffffffff,
269279 .name = "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.4",
270
- .features = PHY_GBIT_FEATURES,
271
- .flags = PHY_HAS_INTERRUPT,
280
+ /* PHY_GBIT_FEATURES */
272281 .config_init = xway_gphy_config_init,
273282 .config_aneg = xway_gphy14_config_aneg,
274283 .ack_interrupt = xway_gphy_ack_interrupt,
....@@ -280,8 +289,7 @@
280289 .phy_id = PHY_ID_PHY22F_1_4,
281290 .phy_id_mask = 0xffffffff,
282291 .name = "Intel XWAY PHY22F (PEF 7061) v1.4",
283
- .features = PHY_BASIC_FEATURES,
284
- .flags = PHY_HAS_INTERRUPT,
292
+ /* PHY_BASIC_FEATURES */
285293 .config_init = xway_gphy_config_init,
286294 .config_aneg = xway_gphy14_config_aneg,
287295 .ack_interrupt = xway_gphy_ack_interrupt,
....@@ -293,8 +301,7 @@
293301 .phy_id = PHY_ID_PHY11G_1_5,
294302 .phy_id_mask = 0xffffffff,
295303 .name = "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.5 / v1.6",
296
- .features = PHY_GBIT_FEATURES,
297
- .flags = PHY_HAS_INTERRUPT,
304
+ /* PHY_GBIT_FEATURES */
298305 .config_init = xway_gphy_config_init,
299306 .ack_interrupt = xway_gphy_ack_interrupt,
300307 .did_interrupt = xway_gphy_did_interrupt,
....@@ -305,8 +312,7 @@
305312 .phy_id = PHY_ID_PHY22F_1_5,
306313 .phy_id_mask = 0xffffffff,
307314 .name = "Intel XWAY PHY22F (PEF 7061) v1.5 / v1.6",
308
- .features = PHY_BASIC_FEATURES,
309
- .flags = PHY_HAS_INTERRUPT,
315
+ /* PHY_BASIC_FEATURES */
310316 .config_init = xway_gphy_config_init,
311317 .ack_interrupt = xway_gphy_ack_interrupt,
312318 .did_interrupt = xway_gphy_did_interrupt,
....@@ -317,8 +323,7 @@
317323 .phy_id = PHY_ID_PHY11G_VR9_1_1,
318324 .phy_id_mask = 0xffffffff,
319325 .name = "Intel XWAY PHY11G (xRX v1.1 integrated)",
320
- .features = PHY_GBIT_FEATURES,
321
- .flags = PHY_HAS_INTERRUPT,
326
+ /* PHY_GBIT_FEATURES */
322327 .config_init = xway_gphy_config_init,
323328 .ack_interrupt = xway_gphy_ack_interrupt,
324329 .did_interrupt = xway_gphy_did_interrupt,
....@@ -329,8 +334,7 @@
329334 .phy_id = PHY_ID_PHY22F_VR9_1_1,
330335 .phy_id_mask = 0xffffffff,
331336 .name = "Intel XWAY PHY22F (xRX v1.1 integrated)",
332
- .features = PHY_BASIC_FEATURES,
333
- .flags = PHY_HAS_INTERRUPT,
337
+ /* PHY_BASIC_FEATURES */
334338 .config_init = xway_gphy_config_init,
335339 .ack_interrupt = xway_gphy_ack_interrupt,
336340 .did_interrupt = xway_gphy_did_interrupt,
....@@ -341,8 +345,7 @@
341345 .phy_id = PHY_ID_PHY11G_VR9_1_2,
342346 .phy_id_mask = 0xffffffff,
343347 .name = "Intel XWAY PHY11G (xRX v1.2 integrated)",
344
- .features = PHY_GBIT_FEATURES,
345
- .flags = PHY_HAS_INTERRUPT,
348
+ /* PHY_GBIT_FEATURES */
346349 .config_init = xway_gphy_config_init,
347350 .ack_interrupt = xway_gphy_ack_interrupt,
348351 .did_interrupt = xway_gphy_did_interrupt,
....@@ -353,8 +356,7 @@
353356 .phy_id = PHY_ID_PHY22F_VR9_1_2,
354357 .phy_id_mask = 0xffffffff,
355358 .name = "Intel XWAY PHY22F (xRX v1.2 integrated)",
356
- .features = PHY_BASIC_FEATURES,
357
- .flags = PHY_HAS_INTERRUPT,
359
+ /* PHY_BASIC_FEATURES */
358360 .config_init = xway_gphy_config_init,
359361 .ack_interrupt = xway_gphy_ack_interrupt,
360362 .did_interrupt = xway_gphy_did_interrupt,