4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of
7 * the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19 * Copyright 2010-2011 Freescale Semiconductor, Inc.
25 /* LXT971 Status 2 registers */
26 #define MIIM_LXT971_SR2 0x11 /* Status Register 2 */
27 #define MIIM_LXT971_SR2_SPEED_MASK 0x4200
28 #define MIIM_LXT971_SR2_10HDX 0x0000 /* 10 Mbit half duplex selected */
29 #define MIIM_LXT971_SR2_10FDX 0x0200 /* 10 Mbit full duplex selected */
30 #define MIIM_LXT971_SR2_100HDX 0x4000 /* 100 Mbit half duplex selected */
31 #define MIIM_LXT971_SR2_100FDX 0x4200 /* 100 Mbit full duplex selected */
35 static int lxt971_parse_status(struct phy_device *phydev)
40 mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_LXT971_SR2);
41 speed = mii_reg & MIIM_LXT971_SR2_SPEED_MASK;
44 case MIIM_LXT971_SR2_10HDX:
45 phydev->speed = SPEED_10;
46 phydev->duplex = DUPLEX_HALF;
48 case MIIM_LXT971_SR2_10FDX:
49 phydev->speed = SPEED_10;
50 phydev->duplex = DUPLEX_FULL;
52 case MIIM_LXT971_SR2_100HDX:
53 phydev->speed = SPEED_100;
54 phydev->duplex = DUPLEX_HALF;
57 phydev->speed = SPEED_100;
58 phydev->duplex = DUPLEX_FULL;
64 static int lxt971_startup(struct phy_device *phydev)
66 genphy_update_link(phydev);
67 lxt971_parse_status(phydev);
72 static struct phy_driver LXT971_driver = {
76 .features = PHY_BASIC_FEATURES,
77 .config = &genphy_config_aneg,
78 .startup = &lxt971_startup,
79 .shutdown = &genphy_shutdown,
82 int phy_lxt_init(void)
84 phy_register(&LXT971_driver);