4 * SPDX-License-Identifier: GPL-2.0+
6 * Copyright 2010-2011 Freescale Semiconductor, Inc.
11 /* LXT971 Status 2 registers */
12 #define MIIM_LXT971_SR2 0x11 /* Status Register 2 */
13 #define MIIM_LXT971_SR2_SPEED_MASK 0x4200
14 #define MIIM_LXT971_SR2_10HDX 0x0000 /* 10 Mbit half duplex selected */
15 #define MIIM_LXT971_SR2_10FDX 0x0200 /* 10 Mbit full duplex selected */
16 #define MIIM_LXT971_SR2_100HDX 0x4000 /* 100 Mbit half duplex selected */
17 #define MIIM_LXT971_SR2_100FDX 0x4200 /* 100 Mbit full duplex selected */
21 static int lxt971_parse_status(struct phy_device *phydev)
26 mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_LXT971_SR2);
27 speed = mii_reg & MIIM_LXT971_SR2_SPEED_MASK;
30 case MIIM_LXT971_SR2_10HDX:
31 phydev->speed = SPEED_10;
32 phydev->duplex = DUPLEX_HALF;
34 case MIIM_LXT971_SR2_10FDX:
35 phydev->speed = SPEED_10;
36 phydev->duplex = DUPLEX_FULL;
38 case MIIM_LXT971_SR2_100HDX:
39 phydev->speed = SPEED_100;
40 phydev->duplex = DUPLEX_HALF;
43 phydev->speed = SPEED_100;
44 phydev->duplex = DUPLEX_FULL;
50 static int lxt971_startup(struct phy_device *phydev)
52 genphy_update_link(phydev);
53 lxt971_parse_status(phydev);
58 static struct phy_driver LXT971_driver = {
62 .features = PHY_BASIC_FEATURES,
63 .config = &genphy_config_aneg,
64 .startup = &lxt971_startup,
65 .shutdown = &genphy_shutdown,
68 int phy_lxt_init(void)
70 phy_register(&LXT971_driver);