| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2012 Daniel Schwierzeck <daniel.schwierzeck@googlemail.com> |
|---|
| 3 | 4 | * 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. |
|---|
| 14 | 5 | */ |
|---|
| 15 | 6 | |
|---|
| 16 | 7 | #include <linux/mdio.h> |
|---|
| .. | .. |
|---|
| 20 | 11 | |
|---|
| 21 | 12 | #define XWAY_MDIO_IMASK 0x19 /* interrupt mask */ |
|---|
| 22 | 13 | #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 */ |
|---|
| 23 | 26 | |
|---|
| 24 | 27 | #define XWAY_MDIO_INIT_WOL BIT(15) /* Wake-On-LAN */ |
|---|
| 25 | 28 | #define XWAY_MDIO_INIT_MSRE BIT(14) |
|---|
| .. | .. |
|---|
| 168 | 171 | /* Clear all pending interrupts */ |
|---|
| 169 | 172 | phy_read(phydev, XWAY_MDIO_ISTAT); |
|---|
| 170 | 173 | |
|---|
| 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 | + |
|---|
| 171 | 183 | phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDCH, |
|---|
| 172 | 184 | XWAY_MMD_LEDCH_NACS_NONE | |
|---|
| 173 | 185 | XWAY_MMD_LEDCH_SBF_F02HZ | |
|---|
| .. | .. |
|---|
| 241 | 253 | .phy_id = PHY_ID_PHY11G_1_3, |
|---|
| 242 | 254 | .phy_id_mask = 0xffffffff, |
|---|
| 243 | 255 | .name = "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.3", |
|---|
| 244 | | - .features = PHY_GBIT_FEATURES, |
|---|
| 245 | | - .flags = PHY_HAS_INTERRUPT, |
|---|
| 256 | + /* PHY_GBIT_FEATURES */ |
|---|
| 246 | 257 | .config_init = xway_gphy_config_init, |
|---|
| 247 | 258 | .config_aneg = xway_gphy14_config_aneg, |
|---|
| 248 | 259 | .ack_interrupt = xway_gphy_ack_interrupt, |
|---|
| .. | .. |
|---|
| 254 | 265 | .phy_id = PHY_ID_PHY22F_1_3, |
|---|
| 255 | 266 | .phy_id_mask = 0xffffffff, |
|---|
| 256 | 267 | .name = "Intel XWAY PHY22F (PEF 7061) v1.3", |
|---|
| 257 | | - .features = PHY_BASIC_FEATURES, |
|---|
| 258 | | - .flags = PHY_HAS_INTERRUPT, |
|---|
| 268 | + /* PHY_BASIC_FEATURES */ |
|---|
| 259 | 269 | .config_init = xway_gphy_config_init, |
|---|
| 260 | 270 | .config_aneg = xway_gphy14_config_aneg, |
|---|
| 261 | 271 | .ack_interrupt = xway_gphy_ack_interrupt, |
|---|
| .. | .. |
|---|
| 267 | 277 | .phy_id = PHY_ID_PHY11G_1_4, |
|---|
| 268 | 278 | .phy_id_mask = 0xffffffff, |
|---|
| 269 | 279 | .name = "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.4", |
|---|
| 270 | | - .features = PHY_GBIT_FEATURES, |
|---|
| 271 | | - .flags = PHY_HAS_INTERRUPT, |
|---|
| 280 | + /* PHY_GBIT_FEATURES */ |
|---|
| 272 | 281 | .config_init = xway_gphy_config_init, |
|---|
| 273 | 282 | .config_aneg = xway_gphy14_config_aneg, |
|---|
| 274 | 283 | .ack_interrupt = xway_gphy_ack_interrupt, |
|---|
| .. | .. |
|---|
| 280 | 289 | .phy_id = PHY_ID_PHY22F_1_4, |
|---|
| 281 | 290 | .phy_id_mask = 0xffffffff, |
|---|
| 282 | 291 | .name = "Intel XWAY PHY22F (PEF 7061) v1.4", |
|---|
| 283 | | - .features = PHY_BASIC_FEATURES, |
|---|
| 284 | | - .flags = PHY_HAS_INTERRUPT, |
|---|
| 292 | + /* PHY_BASIC_FEATURES */ |
|---|
| 285 | 293 | .config_init = xway_gphy_config_init, |
|---|
| 286 | 294 | .config_aneg = xway_gphy14_config_aneg, |
|---|
| 287 | 295 | .ack_interrupt = xway_gphy_ack_interrupt, |
|---|
| .. | .. |
|---|
| 293 | 301 | .phy_id = PHY_ID_PHY11G_1_5, |
|---|
| 294 | 302 | .phy_id_mask = 0xffffffff, |
|---|
| 295 | 303 | .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 */ |
|---|
| 298 | 305 | .config_init = xway_gphy_config_init, |
|---|
| 299 | 306 | .ack_interrupt = xway_gphy_ack_interrupt, |
|---|
| 300 | 307 | .did_interrupt = xway_gphy_did_interrupt, |
|---|
| .. | .. |
|---|
| 305 | 312 | .phy_id = PHY_ID_PHY22F_1_5, |
|---|
| 306 | 313 | .phy_id_mask = 0xffffffff, |
|---|
| 307 | 314 | .name = "Intel XWAY PHY22F (PEF 7061) v1.5 / v1.6", |
|---|
| 308 | | - .features = PHY_BASIC_FEATURES, |
|---|
| 309 | | - .flags = PHY_HAS_INTERRUPT, |
|---|
| 315 | + /* PHY_BASIC_FEATURES */ |
|---|
| 310 | 316 | .config_init = xway_gphy_config_init, |
|---|
| 311 | 317 | .ack_interrupt = xway_gphy_ack_interrupt, |
|---|
| 312 | 318 | .did_interrupt = xway_gphy_did_interrupt, |
|---|
| .. | .. |
|---|
| 317 | 323 | .phy_id = PHY_ID_PHY11G_VR9_1_1, |
|---|
| 318 | 324 | .phy_id_mask = 0xffffffff, |
|---|
| 319 | 325 | .name = "Intel XWAY PHY11G (xRX v1.1 integrated)", |
|---|
| 320 | | - .features = PHY_GBIT_FEATURES, |
|---|
| 321 | | - .flags = PHY_HAS_INTERRUPT, |
|---|
| 326 | + /* PHY_GBIT_FEATURES */ |
|---|
| 322 | 327 | .config_init = xway_gphy_config_init, |
|---|
| 323 | 328 | .ack_interrupt = xway_gphy_ack_interrupt, |
|---|
| 324 | 329 | .did_interrupt = xway_gphy_did_interrupt, |
|---|
| .. | .. |
|---|
| 329 | 334 | .phy_id = PHY_ID_PHY22F_VR9_1_1, |
|---|
| 330 | 335 | .phy_id_mask = 0xffffffff, |
|---|
| 331 | 336 | .name = "Intel XWAY PHY22F (xRX v1.1 integrated)", |
|---|
| 332 | | - .features = PHY_BASIC_FEATURES, |
|---|
| 333 | | - .flags = PHY_HAS_INTERRUPT, |
|---|
| 337 | + /* PHY_BASIC_FEATURES */ |
|---|
| 334 | 338 | .config_init = xway_gphy_config_init, |
|---|
| 335 | 339 | .ack_interrupt = xway_gphy_ack_interrupt, |
|---|
| 336 | 340 | .did_interrupt = xway_gphy_did_interrupt, |
|---|
| .. | .. |
|---|
| 341 | 345 | .phy_id = PHY_ID_PHY11G_VR9_1_2, |
|---|
| 342 | 346 | .phy_id_mask = 0xffffffff, |
|---|
| 343 | 347 | .name = "Intel XWAY PHY11G (xRX v1.2 integrated)", |
|---|
| 344 | | - .features = PHY_GBIT_FEATURES, |
|---|
| 345 | | - .flags = PHY_HAS_INTERRUPT, |
|---|
| 348 | + /* PHY_GBIT_FEATURES */ |
|---|
| 346 | 349 | .config_init = xway_gphy_config_init, |
|---|
| 347 | 350 | .ack_interrupt = xway_gphy_ack_interrupt, |
|---|
| 348 | 351 | .did_interrupt = xway_gphy_did_interrupt, |
|---|
| .. | .. |
|---|
| 353 | 356 | .phy_id = PHY_ID_PHY22F_VR9_1_2, |
|---|
| 354 | 357 | .phy_id_mask = 0xffffffff, |
|---|
| 355 | 358 | .name = "Intel XWAY PHY22F (xRX v1.2 integrated)", |
|---|
| 356 | | - .features = PHY_BASIC_FEATURES, |
|---|
| 357 | | - .flags = PHY_HAS_INTERRUPT, |
|---|
| 359 | + /* PHY_BASIC_FEATURES */ |
|---|
| 358 | 360 | .config_init = xway_gphy_config_init, |
|---|
| 359 | 361 | .ack_interrupt = xway_gphy_ack_interrupt, |
|---|
| 360 | 362 | .did_interrupt = xway_gphy_did_interrupt, |
|---|