Andy Fleming | 60ca78b | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Atheros PHY drivers |
| 3 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
Andy Fleming | 60ca78b | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 5 | * |
Xie Xiaobo | dcc307e | 2013-04-10 16:23:39 +0800 | [diff] [blame] | 6 | * Copyright 2011, 2013 Freescale Semiconductor, Inc. |
Andy Fleming | 60ca78b | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 7 | * author Andy Fleming |
Andy Fleming | 60ca78b | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 8 | */ |
| 9 | #include <phy.h> |
| 10 | |
| 11 | static 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 Xiaobo | dcc307e | 2013-04-10 16:23:39 +0800 | [diff] [blame] | 19 | static 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 Phillips | 40c2c03 | 2012-10-29 13:34:33 +0000 | [diff] [blame] | 40 | static struct phy_driver AR8021_driver = { |
Andy Fleming | 60ca78b | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 41 | .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 Schocher | 93ac9b8 | 2013-06-04 10:58:00 +0200 | [diff] [blame] | 50 | static struct phy_driver AR8031_driver = { |
Shengzhou Liu | 76f57c3 | 2013-08-08 16:33:35 +0800 | [diff] [blame^] | 51 | .name = "AR8031/AR8033", |
Heiko Schocher | 93ac9b8 | 2013-06-04 10:58:00 +0200 | [diff] [blame] | 52 | .uid = 0x4dd074, |
| 53 | .mask = 0xfffff0, |
| 54 | .features = PHY_GBIT_FEATURES, |
Shengzhou Liu | 76f57c3 | 2013-08-08 16:33:35 +0800 | [diff] [blame^] | 55 | .config = ar8021_config, |
Heiko Schocher | 93ac9b8 | 2013-06-04 10:58:00 +0200 | [diff] [blame] | 56 | .startup = genphy_startup, |
| 57 | .shutdown = genphy_shutdown, |
| 58 | }; |
| 59 | |
| 60 | static struct phy_driver AR8035_driver = { |
Xie Xiaobo | dcc307e | 2013-04-10 16:23:39 +0800 | [diff] [blame] | 61 | .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 Fleming | 60ca78b | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 70 | int phy_atheros_init(void) |
| 71 | { |
| 72 | phy_register(&AR8021_driver); |
Heiko Schocher | 93ac9b8 | 2013-06-04 10:58:00 +0200 | [diff] [blame] | 73 | phy_register(&AR8031_driver); |
Xie Xiaobo | dcc307e | 2013-04-10 16:23:39 +0800 | [diff] [blame] | 74 | phy_register(&AR8035_driver); |
Andy Fleming | 60ca78b | 2011-04-07 21:56:05 -0500 | [diff] [blame] | 75 | |
| 76 | return 0; |
| 77 | } |