diff options
author | Andy Fleming <afleming@freescale.com> | 2011-10-13 00:33:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-19 15:59:45 -0400 |
commit | fddf86fc4699a5fbabe6b8bda67613dbd57cbe47 (patch) | |
tree | 69022388e856ab212bd26c4cff8cd5df740f4d92 /drivers/net | |
parent | 3d153a7c8b23031df35e61377c0600a6c96a8b0b (diff) |
phylib: Modify Vitesse RGMII skew settings
The Vitesse driver was using the RGMII_ID interface type to determine if
skew was necessary. However, we want to move away from using that
interface type, as it's really a property of the board's PHY connection.
However, some boards depend on it, so we want to support it, while
allowing new boards to use the more flexible "fixups" approach. To do
this, we extract the code which adds skew into its own function, and
call that function when RGMII_ID has been selected.
Another side-effect of this change is that if your PHY has skew set
already, it doesn't clear it. This way, the fixup code can modify the
register without config_init then clearing it.
Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/phy/vitesse.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index 5d8f6e17bd55..0ec8e09cc2ac 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Author: Kriston Carson | 4 | * Author: Kriston Carson |
5 | * | 5 | * |
6 | * Copyright (c) 2005 Freescale Semiconductor, Inc. | 6 | * Copyright (c) 2005, 2009 Freescale Semiconductor, Inc. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public License as published by the | 9 | * under the terms of the GNU General Public License as published by the |
@@ -61,32 +61,42 @@ MODULE_DESCRIPTION("Vitesse PHY driver"); | |||
61 | MODULE_AUTHOR("Kriston Carson"); | 61 | MODULE_AUTHOR("Kriston Carson"); |
62 | MODULE_LICENSE("GPL"); | 62 | MODULE_LICENSE("GPL"); |
63 | 63 | ||
64 | static int vsc824x_config_init(struct phy_device *phydev) | 64 | int vsc824x_add_skew(struct phy_device *phydev) |
65 | { | 65 | { |
66 | int extcon; | ||
67 | int err; | 66 | int err; |
68 | 67 | int extcon; | |
69 | err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT, | ||
70 | MII_VSC8244_AUXCONSTAT_INIT); | ||
71 | if (err < 0) | ||
72 | return err; | ||
73 | 68 | ||
74 | extcon = phy_read(phydev, MII_VSC8244_EXT_CON1); | 69 | extcon = phy_read(phydev, MII_VSC8244_EXT_CON1); |
75 | 70 | ||
76 | if (extcon < 0) | 71 | if (extcon < 0) |
77 | return err; | 72 | return extcon; |
78 | 73 | ||
79 | extcon &= ~(MII_VSC8244_EXTCON1_TX_SKEW_MASK | | 74 | extcon &= ~(MII_VSC8244_EXTCON1_TX_SKEW_MASK | |
80 | MII_VSC8244_EXTCON1_RX_SKEW_MASK); | 75 | MII_VSC8244_EXTCON1_RX_SKEW_MASK); |
81 | 76 | ||
82 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) | 77 | extcon |= (MII_VSC8244_EXTCON1_TX_SKEW | |
83 | extcon |= (MII_VSC8244_EXTCON1_TX_SKEW | | 78 | MII_VSC8244_EXTCON1_RX_SKEW); |
84 | MII_VSC8244_EXTCON1_RX_SKEW); | ||
85 | 79 | ||
86 | err = phy_write(phydev, MII_VSC8244_EXT_CON1, extcon); | 80 | err = phy_write(phydev, MII_VSC8244_EXT_CON1, extcon); |
87 | 81 | ||
88 | return err; | 82 | return err; |
89 | } | 83 | } |
84 | EXPORT_SYMBOL(vsc824x_add_skew); | ||
85 | |||
86 | static int vsc824x_config_init(struct phy_device *phydev) | ||
87 | { | ||
88 | int err; | ||
89 | |||
90 | err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT, | ||
91 | MII_VSC8244_AUXCONSTAT_INIT); | ||
92 | if (err < 0) | ||
93 | return err; | ||
94 | |||
95 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) | ||
96 | err = vsc824x_add_skew(phydev); | ||
97 | |||
98 | return err; | ||
99 | } | ||
90 | 100 | ||
91 | static int vsc824x_ack_interrupt(struct phy_device *phydev) | 101 | static int vsc824x_ack_interrupt(struct phy_device *phydev) |
92 | { | 102 | { |