blob: 0d823f5f2b18556520745bb6d214b277bb39c9d8 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Nobuhiro Iwamatsu61134dc2011-11-23 21:24:15 +00002/*
3 * SMSC PHY drivers
4 *
Nobuhiro Iwamatsu61134dc2011-11-23 21:24:15 +00005 * Base code from drivers/net/phy/davicom.c
6 * Copyright 2010-2011 Freescale Semiconductor, Inc.
7 * author Andy Fleming
8 *
Robert P. J. Day832d36e2013-09-16 07:15:45 -04009 * Some code copied from linux kernel
Nobuhiro Iwamatsu61134dc2011-11-23 21:24:15 +000010 * Copyright (c) 2006 Herbert Valerio Riedel <hvr@gnu.org>
Nobuhiro Iwamatsu61134dc2011-11-23 21:24:15 +000011 */
12#include <miiphy.h>
13
David Dueck6c96ca12013-11-05 17:23:03 +010014/* This code does not check the partner abilities. */
Nobuhiro Iwamatsu61134dc2011-11-23 21:24:15 +000015static int smsc_parse_status(struct phy_device *phydev)
16{
17 int mii_reg;
18
19 mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMSR);
20
21 if (mii_reg & (BMSR_100FULL | BMSR_100HALF))
22 phydev->speed = SPEED_100;
23 else
24 phydev->speed = SPEED_10;
25
26 if (mii_reg & (BMSR_10FULL | BMSR_100FULL))
27 phydev->duplex = DUPLEX_FULL;
28 else
29 phydev->duplex = DUPLEX_HALF;
30
31 return 0;
32}
33
34static int smsc_startup(struct phy_device *phydev)
35{
Michal Simek5ff89662016-05-18 12:46:12 +020036 int ret;
37
38 ret = genphy_update_link(phydev);
39 if (ret)
40 return ret;
41
42 return smsc_parse_status(phydev);
Nobuhiro Iwamatsu61134dc2011-11-23 21:24:15 +000043}
44
Marek Vasut90973682023-03-19 18:03:02 +010045U_BOOT_PHY_DRIVER(lan8700) = {
Nobuhiro Iwamatsu61134dc2011-11-23 21:24:15 +000046 .name = "SMSC LAN8700",
47 .uid = 0x0007c0c0,
48 .mask = 0xffff0,
49 .features = PHY_BASIC_FEATURES,
50 .config = &genphy_config_aneg,
51 .startup = &smsc_startup,
52 .shutdown = &genphy_shutdown,
53};
54
Marek Vasut90973682023-03-19 18:03:02 +010055U_BOOT_PHY_DRIVER(lan911x) = {
Nobuhiro Iwamatsu61134dc2011-11-23 21:24:15 +000056 .name = "SMSC LAN911x Internal PHY",
57 .uid = 0x0007c0d0,
58 .mask = 0xffff0,
59 .features = PHY_BASIC_FEATURES,
60 .config = &genphy_config_aneg,
61 .startup = &smsc_startup,
62 .shutdown = &genphy_shutdown,
63};
64
Marek Vasut90973682023-03-19 18:03:02 +010065U_BOOT_PHY_DRIVER(lan8710) = {
Nobuhiro Iwamatsu61134dc2011-11-23 21:24:15 +000066 .name = "SMSC LAN8710/LAN8720",
67 .uid = 0x0007c0f0,
68 .mask = 0xffff0,
Fabio Estevam55e9a252013-06-06 21:04:19 -030069 .features = PHY_BASIC_FEATURES,
Nobuhiro Iwamatsu61134dc2011-11-23 21:24:15 +000070 .config = &genphy_config_aneg,
David Dueck6c96ca12013-11-05 17:23:03 +010071 .startup = &genphy_startup,
Nobuhiro Iwamatsu61134dc2011-11-23 21:24:15 +000072 .shutdown = &genphy_shutdown,
73};
74
Marek Vasut90973682023-03-19 18:03:02 +010075U_BOOT_PHY_DRIVER(lan8740) = {
Purna Chandra Mandald2499842016-01-28 15:30:20 +053076 .name = "SMSC LAN8740",
77 .uid = 0x0007c110,
78 .mask = 0xffff0,
79 .features = PHY_BASIC_FEATURES,
80 .config = &genphy_config_aneg,
81 .startup = &genphy_startup,
82 .shutdown = &genphy_shutdown,
83};
Michael Kurz30c37f62017-01-22 16:04:28 +010084
Marek Vasut90973682023-03-19 18:03:02 +010085U_BOOT_PHY_DRIVER(lan8741) = {
Arno Steffens003e4372018-01-25 13:08:35 +010086 .name = "SMSC LAN8741",
87 .uid = 0x0007c120,
88 .mask = 0xffff0,
89 .features = PHY_BASIC_FEATURES,
90 .config = &genphy_config_aneg,
91 .startup = &genphy_startup,
92 .shutdown = &genphy_shutdown,
93};
94
Marek Vasut90973682023-03-19 18:03:02 +010095U_BOOT_PHY_DRIVER(lan8742) = {
Michael Kurz30c37f62017-01-22 16:04:28 +010096 .name = "SMSC LAN8742",
97 .uid = 0x0007c130,
98 .mask = 0xffff0,
99 .features = PHY_BASIC_FEATURES,
100 .config = &genphy_config_aneg,
101 .startup = &genphy_startup,
102 .shutdown = &genphy_shutdown,
103};