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 34*02aa4c53SXiaobo Xie phydev->supported = phydev->drv->features; 356027384aSXie Xiaobo 366027384aSXie Xiaobo return 0; 376027384aSXie Xiaobo } 386027384aSXie Xiaobo 3906370590SKim Phillips static struct phy_driver AR8021_driver = { 409082eeacSAndy Fleming .name = "AR8021", 419082eeacSAndy Fleming .uid = 0x4dd040, 42dc116bd6SHaijun.Zhang .mask = 0x4ffff0, 439082eeacSAndy Fleming .features = PHY_GBIT_FEATURES, 449082eeacSAndy Fleming .config = ar8021_config, 459082eeacSAndy Fleming .startup = genphy_startup, 469082eeacSAndy Fleming .shutdown = genphy_shutdown, 479082eeacSAndy Fleming }; 489082eeacSAndy Fleming 49433a2c53SHeiko Schocher static struct phy_driver AR8031_driver = { 50626ee1e3SShengzhou Liu .name = "AR8031/AR8033", 51433a2c53SHeiko Schocher .uid = 0x4dd074, 52f66e3dedSFabio Estevam .mask = 0xffffffef, 53433a2c53SHeiko Schocher .features = PHY_GBIT_FEATURES, 5408ad9b06SZhao Qiang .config = ar8021_config, 55433a2c53SHeiko Schocher .startup = genphy_startup, 56433a2c53SHeiko Schocher .shutdown = genphy_shutdown, 57433a2c53SHeiko Schocher }; 58433a2c53SHeiko Schocher 59433a2c53SHeiko Schocher static struct phy_driver AR8035_driver = { 606027384aSXie Xiaobo .name = "AR8035", 616027384aSXie Xiaobo .uid = 0x4dd072, 62f66e3dedSFabio Estevam .mask = 0xffffffef, 636027384aSXie Xiaobo .features = PHY_GBIT_FEATURES, 646027384aSXie Xiaobo .config = ar8035_config, 656027384aSXie Xiaobo .startup = genphy_startup, 666027384aSXie Xiaobo .shutdown = genphy_shutdown, 676027384aSXie Xiaobo }; 686027384aSXie Xiaobo 699082eeacSAndy Fleming int phy_atheros_init(void) 709082eeacSAndy Fleming { 719082eeacSAndy Fleming phy_register(&AR8021_driver); 72433a2c53SHeiko Schocher phy_register(&AR8031_driver); 736027384aSXie Xiaobo phy_register(&AR8035_driver); 749082eeacSAndy Fleming 759082eeacSAndy Fleming return 0; 769082eeacSAndy Fleming } 77