blob: 32c2ab9944e1dfd15cf2153a55c9035d7444589c [file] [log] [blame]
Andy Fleming9082eea2011-04-07 21:56:05 -05001/*
2 * Atheros PHY drivers
3 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Andy Fleming9082eea2011-04-07 21:56:05 -05005 *
Xie Xiaobo60273842013-04-10 16:23:39 +08006 * Copyright 2011, 2013 Freescale Semiconductor, Inc.
Andy Fleming9082eea2011-04-07 21:56:05 -05007 * author Andy Fleming
Andy Fleming9082eea2011-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 Xiaobo60273842013-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 Phillips06370592012-10-29 13:34:33 +000040static struct phy_driver AR8021_driver = {
Andy Fleming9082eea2011-04-07 21:56:05 -050041 .name = "AR8021",
42 .uid = 0x4dd040,
Fabio Estevame003ba52013-11-02 16:40:42 -020043 .mask = 0x4fffff,
Andy Fleming9082eea2011-04-07 21:56:05 -050044 .features = PHY_GBIT_FEATURES,
45 .config = ar8021_config,
46 .startup = genphy_startup,
47 .shutdown = genphy_shutdown,
48};
49
Heiko Schocher433a2c52013-06-04 10:58:00 +020050static struct phy_driver AR8031_driver = {
Shengzhou Liu626ee1e2013-08-08 16:33:35 +080051 .name = "AR8031/AR8033",
Heiko Schocher433a2c52013-06-04 10:58:00 +020052 .uid = 0x4dd074,
Fabio Estevamf66e3de2014-01-03 15:55:59 -020053 .mask = 0xffffffef,
Heiko Schocher433a2c52013-06-04 10:58:00 +020054 .features = PHY_GBIT_FEATURES,
Shengzhou Liu626ee1e2013-08-08 16:33:35 +080055 .config = ar8021_config,
Heiko Schocher433a2c52013-06-04 10:58:00 +020056 .startup = genphy_startup,
57 .shutdown = genphy_shutdown,
58};
59
60static struct phy_driver AR8035_driver = {
Xie Xiaobo60273842013-04-10 16:23:39 +080061 .name = "AR8035",
62 .uid = 0x4dd072,
Fabio Estevamf66e3de2014-01-03 15:55:59 -020063 .mask = 0xffffffef,
Xie Xiaobo60273842013-04-10 16:23:39 +080064 .features = PHY_GBIT_FEATURES,
65 .config = ar8035_config,
66 .startup = genphy_startup,
67 .shutdown = genphy_shutdown,
68};
69
Andy Fleming9082eea2011-04-07 21:56:05 -050070int phy_atheros_init(void)
71{
72 phy_register(&AR8021_driver);
Heiko Schocher433a2c52013-06-04 10:58:00 +020073 phy_register(&AR8031_driver);
Xie Xiaobo60273842013-04-10 16:23:39 +080074 phy_register(&AR8035_driver);
Andy Fleming9082eea2011-04-07 21:56:05 -050075
76 return 0;
77}