19082eeacSAndy Fleming /* 29082eeacSAndy Fleming * Atheros PHY drivers 39082eeacSAndy Fleming * 49082eeacSAndy Fleming * This program is free software; you can redistribute it and/or 59082eeacSAndy Fleming * modify it under the terms of the GNU General Public License as 69082eeacSAndy Fleming * published by the Free Software Foundation; either version 2 of 79082eeacSAndy Fleming * the License, or (at your option) any later version. 89082eeacSAndy Fleming * 99082eeacSAndy Fleming * This program is distributed in the hope that it will be useful, 109082eeacSAndy Fleming * but WITHOUT ANY WARRANTY; without even the implied warranty of 119082eeacSAndy Fleming * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 129082eeacSAndy Fleming * GNU General Public License for more details. 139082eeacSAndy Fleming * 149082eeacSAndy Fleming * You should have received a copy of the GNU General Public License 159082eeacSAndy Fleming * along with this program; if not, write to the Free Software 169082eeacSAndy Fleming * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 179082eeacSAndy Fleming * MA 02111-1307 USA 189082eeacSAndy Fleming * 196027384aSXie Xiaobo * Copyright 2011, 2013 Freescale Semiconductor, Inc. 209082eeacSAndy Fleming * author Andy Fleming 219082eeacSAndy Fleming * 229082eeacSAndy Fleming */ 239082eeacSAndy Fleming #include <phy.h> 249082eeacSAndy Fleming 259082eeacSAndy Fleming static int ar8021_config(struct phy_device *phydev) 269082eeacSAndy Fleming { 279082eeacSAndy Fleming phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05); 289082eeacSAndy Fleming phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x3D47); 299082eeacSAndy Fleming 309082eeacSAndy Fleming return 0; 319082eeacSAndy Fleming } 329082eeacSAndy Fleming 336027384aSXie Xiaobo static int ar8035_config(struct phy_device *phydev) 346027384aSXie Xiaobo { 356027384aSXie Xiaobo int regval; 366027384aSXie Xiaobo 376027384aSXie Xiaobo phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x0007); 386027384aSXie Xiaobo phy_write(phydev, MDIO_DEVAD_NONE, 0xe, 0x8016); 396027384aSXie Xiaobo phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x4007); 406027384aSXie Xiaobo regval = phy_read(phydev, MDIO_DEVAD_NONE, 0xe); 416027384aSXie Xiaobo phy_write(phydev, MDIO_DEVAD_NONE, 0xe, (regval|0x0018)); 426027384aSXie Xiaobo 436027384aSXie Xiaobo phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05); 446027384aSXie Xiaobo regval = phy_read(phydev, MDIO_DEVAD_NONE, 0x1e); 456027384aSXie Xiaobo phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, (regval|0x0100)); 466027384aSXie Xiaobo 476027384aSXie Xiaobo genphy_config_aneg(phydev); 486027384aSXie Xiaobo 496027384aSXie Xiaobo phy_reset(phydev); 506027384aSXie Xiaobo 516027384aSXie Xiaobo return 0; 526027384aSXie Xiaobo } 536027384aSXie Xiaobo 5406370590SKim Phillips static struct phy_driver AR8021_driver = { 559082eeacSAndy Fleming .name = "AR8021", 569082eeacSAndy Fleming .uid = 0x4dd040, 579082eeacSAndy Fleming .mask = 0xfffff0, 589082eeacSAndy Fleming .features = PHY_GBIT_FEATURES, 599082eeacSAndy Fleming .config = ar8021_config, 609082eeacSAndy Fleming .startup = genphy_startup, 619082eeacSAndy Fleming .shutdown = genphy_shutdown, 629082eeacSAndy Fleming }; 639082eeacSAndy Fleming 64*433a2c53SHeiko Schocher static struct phy_driver AR8031_driver = { 65*433a2c53SHeiko Schocher .name = "AR8031", 66*433a2c53SHeiko Schocher .uid = 0x4dd074, 67*433a2c53SHeiko Schocher .mask = 0xfffff0, 68*433a2c53SHeiko Schocher .features = PHY_GBIT_FEATURES, 69*433a2c53SHeiko Schocher .config = genphy_config, 70*433a2c53SHeiko Schocher .startup = genphy_startup, 71*433a2c53SHeiko Schocher .shutdown = genphy_shutdown, 72*433a2c53SHeiko Schocher }; 73*433a2c53SHeiko Schocher 74*433a2c53SHeiko Schocher static struct phy_driver AR8035_driver = { 756027384aSXie Xiaobo .name = "AR8035", 766027384aSXie Xiaobo .uid = 0x4dd072, 776027384aSXie Xiaobo .mask = 0x4fffff, 786027384aSXie Xiaobo .features = PHY_GBIT_FEATURES, 796027384aSXie Xiaobo .config = ar8035_config, 806027384aSXie Xiaobo .startup = genphy_startup, 816027384aSXie Xiaobo .shutdown = genphy_shutdown, 826027384aSXie Xiaobo }; 836027384aSXie Xiaobo 849082eeacSAndy Fleming int phy_atheros_init(void) 859082eeacSAndy Fleming { 869082eeacSAndy Fleming phy_register(&AR8021_driver); 87*433a2c53SHeiko Schocher phy_register(&AR8031_driver); 886027384aSXie Xiaobo phy_register(&AR8035_driver); 899082eeacSAndy Fleming 909082eeacSAndy Fleming return 0; 919082eeacSAndy Fleming } 92