blob: 7a1453ff3d1541eaabf07a39a346c3f23bd6b82a [file] [log] [blame]
Andy Fleming60ca78b2011-04-07 21:56:05 -05001/*
2 * Atheros PHY drivers
3 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Andy Fleming60ca78b2011-04-07 21:56:05 -05005 *
Xie Xiaobodcc307e2013-04-10 16:23:39 +08006 * Copyright 2011, 2013 Freescale Semiconductor, Inc.
Andy Fleming60ca78b2011-04-07 21:56:05 -05007 * author Andy Fleming
Andy Fleming60ca78b2011-04-07 21:56:05 -05008 */
9#include <phy.h>
10
11static int ar8021_config(struct phy_device *phydev)
12{
13 phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05);
14 phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x3D47);
15
16 return 0;
17}
18
Xie Xiaobodcc307e2013-04-10 16:23:39 +080019static int ar8035_config(struct phy_device *phydev)
20{
21 int regval;
22
23 phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x0007);
24 phy_write(phydev, MDIO_DEVAD_NONE, 0xe, 0x8016);
25 phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x4007);
26 regval = phy_read(phydev, MDIO_DEVAD_NONE, 0xe);
27 phy_write(phydev, MDIO_DEVAD_NONE, 0xe, (regval|0x0018));
28
29 phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05);
30 regval = phy_read(phydev, MDIO_DEVAD_NONE, 0x1e);
31 phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, (regval|0x0100));
32
33 genphy_config_aneg(phydev);
34
35 phy_reset(phydev);
36
37 return 0;
38}
39
Kim Phillips40c2c032012-10-29 13:34:33 +000040static struct phy_driver AR8021_driver = {
Andy Fleming60ca78b2011-04-07 21:56:05 -050041 .name = "AR8021",
42 .uid = 0x4dd040,
43 .mask = 0xfffff0,
44 .features = PHY_GBIT_FEATURES,
45 .config = ar8021_config,
46 .startup = genphy_startup,
47 .shutdown = genphy_shutdown,
48};
49
Heiko Schocher93ac9b82013-06-04 10:58:00 +020050static struct phy_driver AR8031_driver = {
Shengzhou Liu76f57c32013-08-08 16:33:35 +080051 .name = "AR8031/AR8033",
Heiko Schocher93ac9b82013-06-04 10:58:00 +020052 .uid = 0x4dd074,
53 .mask = 0xfffff0,
54 .features = PHY_GBIT_FEATURES,
Shengzhou Liu76f57c32013-08-08 16:33:35 +080055 .config = ar8021_config,
Heiko Schocher93ac9b82013-06-04 10:58:00 +020056 .startup = genphy_startup,
57 .shutdown = genphy_shutdown,
58};
59
60static struct phy_driver AR8035_driver = {
Xie Xiaobodcc307e2013-04-10 16:23:39 +080061 .name = "AR8035",
62 .uid = 0x4dd072,
63 .mask = 0x4fffff,
64 .features = PHY_GBIT_FEATURES,
65 .config = ar8035_config,
66 .startup = genphy_startup,
67 .shutdown = genphy_shutdown,
68};
69
Andy Fleming60ca78b2011-04-07 21:56:05 -050070int phy_atheros_init(void)
71{
72 phy_register(&AR8021_driver);
Heiko Schocher93ac9b82013-06-04 10:58:00 +020073 phy_register(&AR8031_driver);
Xie Xiaobodcc307e2013-04-10 16:23:39 +080074 phy_register(&AR8035_driver);
Andy Fleming60ca78b2011-04-07 21:56:05 -050075
76 return 0;
77}