aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/vitesse.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/vitesse.c')
-rw-r--r--drivers/net/phy/vitesse.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
index f39ab76e6f67..6a5385647911 100644
--- a/drivers/net/phy/vitesse.c
+++ b/drivers/net/phy/vitesse.c
@@ -21,6 +21,10 @@
21/* Vitesse Extended Control Register 1 */ 21/* Vitesse Extended Control Register 1 */
22#define MII_VSC8244_EXT_CON1 0x17 22#define MII_VSC8244_EXT_CON1 0x17
23#define MII_VSC8244_EXTCON1_INIT 0x0000 23#define MII_VSC8244_EXTCON1_INIT 0x0000
24#define MII_VSC8244_EXTCON1_TX_SKEW_MASK 0x0c00
25#define MII_VSC8244_EXTCON1_RX_SKEW_MASK 0x0300
26#define MII_VSC8244_EXTCON1_TX_SKEW 0x0800
27#define MII_VSC8244_EXTCON1_RX_SKEW 0x0200
24 28
25/* Vitesse Interrupt Mask Register */ 29/* Vitesse Interrupt Mask Register */
26#define MII_VSC8244_IMASK 0x19 30#define MII_VSC8244_IMASK 0x19
@@ -39,7 +43,7 @@
39 43
40/* Vitesse Auxiliary Control/Status Register */ 44/* Vitesse Auxiliary Control/Status Register */
41#define MII_VSC8244_AUX_CONSTAT 0x1c 45#define MII_VSC8244_AUX_CONSTAT 0x1c
42#define MII_VSC8244_AUXCONSTAT_INIT 0x0004 46#define MII_VSC8244_AUXCONSTAT_INIT 0x0000
43#define MII_VSC8244_AUXCONSTAT_DUPLEX 0x0020 47#define MII_VSC8244_AUXCONSTAT_DUPLEX 0x0020
44#define MII_VSC8244_AUXCONSTAT_SPEED 0x0018 48#define MII_VSC8244_AUXCONSTAT_SPEED 0x0018
45#define MII_VSC8244_AUXCONSTAT_GBIT 0x0010 49#define MII_VSC8244_AUXCONSTAT_GBIT 0x0010
@@ -51,6 +55,7 @@ MODULE_LICENSE("GPL");
51 55
52static int vsc824x_config_init(struct phy_device *phydev) 56static int vsc824x_config_init(struct phy_device *phydev)
53{ 57{
58 int extcon;
54 int err; 59 int err;
55 60
56 err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT, 61 err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT,
@@ -58,8 +63,20 @@ static int vsc824x_config_init(struct phy_device *phydev)
58 if (err < 0) 63 if (err < 0)
59 return err; 64 return err;
60 65
61 err = phy_write(phydev, MII_VSC8244_EXT_CON1, 66 extcon = phy_read(phydev, MII_VSC8244_EXT_CON1);
62 MII_VSC8244_EXTCON1_INIT); 67
68 if (extcon < 0)
69 return err;
70
71 extcon &= ~(MII_VSC8244_EXTCON1_TX_SKEW_MASK |
72 MII_VSC8244_EXTCON1_RX_SKEW_MASK);
73
74 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
75 extcon |= (MII_VSC8244_EXTCON1_TX_SKEW |
76 MII_VSC8244_EXTCON1_RX_SKEW);
77
78 err = phy_write(phydev, MII_VSC8244_EXT_CON1, extcon);
79
63 return err; 80 return err;
64} 81}
65 82