2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2011-11-23 21:24:15 +00:00
|
|
|
/*
|
|
|
|
* SMSC PHY drivers
|
|
|
|
*
|
|
|
|
* Base code from drivers/net/phy/davicom.c
|
|
|
|
* Copyright 2010-2011 Freescale Semiconductor, Inc.
|
|
|
|
* author Andy Fleming
|
|
|
|
*
|
2013-09-16 11:15:45 +00:00
|
|
|
* Some code copied from linux kernel
|
2011-11-23 21:24:15 +00:00
|
|
|
* Copyright (c) 2006 Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
*/
|
2018-07-25 17:59:22 +00:00
|
|
|
#include <common.h>
|
2011-11-23 21:24:15 +00:00
|
|
|
#include <miiphy.h>
|
|
|
|
|
2013-11-05 16:23:03 +00:00
|
|
|
/* This code does not check the partner abilities. */
|
2011-11-23 21:24:15 +00:00
|
|
|
static int smsc_parse_status(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int mii_reg;
|
|
|
|
|
|
|
|
mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMSR);
|
|
|
|
|
|
|
|
if (mii_reg & (BMSR_100FULL | BMSR_100HALF))
|
|
|
|
phydev->speed = SPEED_100;
|
|
|
|
else
|
|
|
|
phydev->speed = SPEED_10;
|
|
|
|
|
|
|
|
if (mii_reg & (BMSR_10FULL | BMSR_100FULL))
|
|
|
|
phydev->duplex = DUPLEX_FULL;
|
|
|
|
else
|
|
|
|
phydev->duplex = DUPLEX_HALF;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int smsc_startup(struct phy_device *phydev)
|
|
|
|
{
|
2016-05-18 10:46:12 +00:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = genphy_update_link(phydev);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return smsc_parse_status(phydev);
|
2011-11-23 21:24:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct phy_driver lan8700_driver = {
|
|
|
|
.name = "SMSC LAN8700",
|
|
|
|
.uid = 0x0007c0c0,
|
|
|
|
.mask = 0xffff0,
|
|
|
|
.features = PHY_BASIC_FEATURES,
|
|
|
|
.config = &genphy_config_aneg,
|
|
|
|
.startup = &smsc_startup,
|
|
|
|
.shutdown = &genphy_shutdown,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct phy_driver lan911x_driver = {
|
|
|
|
.name = "SMSC LAN911x Internal PHY",
|
|
|
|
.uid = 0x0007c0d0,
|
|
|
|
.mask = 0xffff0,
|
|
|
|
.features = PHY_BASIC_FEATURES,
|
|
|
|
.config = &genphy_config_aneg,
|
|
|
|
.startup = &smsc_startup,
|
|
|
|
.shutdown = &genphy_shutdown,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct phy_driver lan8710_driver = {
|
|
|
|
.name = "SMSC LAN8710/LAN8720",
|
|
|
|
.uid = 0x0007c0f0,
|
|
|
|
.mask = 0xffff0,
|
2013-06-07 00:04:19 +00:00
|
|
|
.features = PHY_BASIC_FEATURES,
|
2011-11-23 21:24:15 +00:00
|
|
|
.config = &genphy_config_aneg,
|
2013-11-05 16:23:03 +00:00
|
|
|
.startup = &genphy_startup,
|
2011-11-23 21:24:15 +00:00
|
|
|
.shutdown = &genphy_shutdown,
|
|
|
|
};
|
|
|
|
|
2016-01-28 10:00:20 +00:00
|
|
|
static struct phy_driver lan8740_driver = {
|
|
|
|
.name = "SMSC LAN8740",
|
|
|
|
.uid = 0x0007c110,
|
|
|
|
.mask = 0xffff0,
|
|
|
|
.features = PHY_BASIC_FEATURES,
|
|
|
|
.config = &genphy_config_aneg,
|
|
|
|
.startup = &genphy_startup,
|
|
|
|
.shutdown = &genphy_shutdown,
|
|
|
|
};
|
2017-01-22 15:04:28 +00:00
|
|
|
|
2018-01-25 12:08:35 +00:00
|
|
|
static struct phy_driver lan8741_driver = {
|
|
|
|
.name = "SMSC LAN8741",
|
|
|
|
.uid = 0x0007c120,
|
|
|
|
.mask = 0xffff0,
|
|
|
|
.features = PHY_BASIC_FEATURES,
|
|
|
|
.config = &genphy_config_aneg,
|
|
|
|
.startup = &genphy_startup,
|
|
|
|
.shutdown = &genphy_shutdown,
|
|
|
|
};
|
|
|
|
|
2017-01-22 15:04:28 +00:00
|
|
|
static struct phy_driver lan8742_driver = {
|
|
|
|
.name = "SMSC LAN8742",
|
|
|
|
.uid = 0x0007c130,
|
|
|
|
.mask = 0xffff0,
|
|
|
|
.features = PHY_BASIC_FEATURES,
|
|
|
|
.config = &genphy_config_aneg,
|
|
|
|
.startup = &genphy_startup,
|
|
|
|
.shutdown = &genphy_shutdown,
|
|
|
|
};
|
|
|
|
|
2011-11-23 21:24:15 +00:00
|
|
|
int phy_smsc_init(void)
|
|
|
|
{
|
|
|
|
phy_register(&lan8710_driver);
|
|
|
|
phy_register(&lan911x_driver);
|
|
|
|
phy_register(&lan8700_driver);
|
2016-01-28 10:00:20 +00:00
|
|
|
phy_register(&lan8740_driver);
|
2018-01-25 12:08:35 +00:00
|
|
|
phy_register(&lan8741_driver);
|
2017-01-22 15:04:28 +00:00
|
|
|
phy_register(&lan8742_driver);
|
2011-11-23 21:24:15 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|