19082eeacSAndy Fleming /* 29082eeacSAndy Fleming * Atheros PHY drivers 39082eeacSAndy Fleming * 41a459660SWolfgang Denk * SPDX-License-Identifier: GPL-2.0+ 59082eeacSAndy Fleming * 66027384aSXie Xiaobo * Copyright 2011, 2013 Freescale Semiconductor, Inc. 79082eeacSAndy Fleming * author Andy Fleming 89082eeacSAndy Fleming */ 99082eeacSAndy Fleming #include <phy.h> 109082eeacSAndy Fleming 119082eeacSAndy Fleming static int ar8021_config(struct phy_device *phydev) 129082eeacSAndy Fleming { 139082eeacSAndy Fleming phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05); 149082eeacSAndy Fleming phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x3D47); 159082eeacSAndy Fleming 16e0d80964SZhao Qiang phydev->supported = phydev->drv->features; 179082eeacSAndy Fleming return 0; 189082eeacSAndy Fleming } 199082eeacSAndy Fleming 206027384aSXie Xiaobo static int ar8035_config(struct phy_device *phydev) 216027384aSXie Xiaobo { 226027384aSXie Xiaobo int regval; 236027384aSXie Xiaobo 246027384aSXie Xiaobo phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x0007); 256027384aSXie Xiaobo phy_write(phydev, MDIO_DEVAD_NONE, 0xe, 0x8016); 266027384aSXie Xiaobo phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x4007); 276027384aSXie Xiaobo regval = phy_read(phydev, MDIO_DEVAD_NONE, 0xe); 286027384aSXie Xiaobo phy_write(phydev, MDIO_DEVAD_NONE, 0xe, (regval|0x0018)); 296027384aSXie Xiaobo 306027384aSXie Xiaobo phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05); 316027384aSXie Xiaobo regval = phy_read(phydev, MDIO_DEVAD_NONE, 0x1e); 326027384aSXie Xiaobo phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, (regval|0x0100)); 336027384aSXie Xiaobo 346027384aSXie Xiaobo genphy_config_aneg(phydev); 356027384aSXie Xiaobo 366027384aSXie Xiaobo phy_reset(phydev); 376027384aSXie Xiaobo 386027384aSXie Xiaobo return 0; 396027384aSXie Xiaobo } 406027384aSXie Xiaobo 4106370590SKim Phillips static struct phy_driver AR8021_driver = { 429082eeacSAndy Fleming .name = "AR8021", 439082eeacSAndy Fleming .uid = 0x4dd040, 44*dc116bd6SHaijun.Zhang .mask = 0x4ffff0, 459082eeacSAndy Fleming .features = PHY_GBIT_FEATURES, 469082eeacSAndy Fleming .config = ar8021_config, 479082eeacSAndy Fleming .startup = genphy_startup, 489082eeacSAndy Fleming .shutdown = genphy_shutdown, 499082eeacSAndy Fleming }; 509082eeacSAndy Fleming 51433a2c53SHeiko Schocher static struct phy_driver AR8031_driver = { 52626ee1e3SShengzhou Liu .name = "AR8031/AR8033", 53433a2c53SHeiko Schocher .uid = 0x4dd074, 54f66e3dedSFabio Estevam .mask = 0xffffffef, 55433a2c53SHeiko Schocher .features = PHY_GBIT_FEATURES, 569137d19bSHeiko Schocher .config = genphy_config, 57433a2c53SHeiko Schocher .startup = genphy_startup, 58433a2c53SHeiko Schocher .shutdown = genphy_shutdown, 59433a2c53SHeiko Schocher }; 60433a2c53SHeiko Schocher 61433a2c53SHeiko Schocher static struct phy_driver AR8035_driver = { 626027384aSXie Xiaobo .name = "AR8035", 636027384aSXie Xiaobo .uid = 0x4dd072, 64f66e3dedSFabio Estevam .mask = 0xffffffef, 656027384aSXie Xiaobo .features = PHY_GBIT_FEATURES, 666027384aSXie Xiaobo .config = ar8035_config, 676027384aSXie Xiaobo .startup = genphy_startup, 686027384aSXie Xiaobo .shutdown = genphy_shutdown, 696027384aSXie Xiaobo }; 706027384aSXie Xiaobo 719082eeacSAndy Fleming int phy_atheros_init(void) 729082eeacSAndy Fleming { 739082eeacSAndy Fleming phy_register(&AR8021_driver); 74433a2c53SHeiko Schocher phy_register(&AR8031_driver); 756027384aSXie Xiaobo phy_register(&AR8035_driver); 769082eeacSAndy Fleming 779082eeacSAndy Fleming return 0; 789082eeacSAndy Fleming } 79