aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy
diff options
context:
space:
mode:
authorKim Phillips <kim.phillips@freescale.com>2007-06-05 06:46:47 -0400
committerJeff Garzik <jeff@garzik.org>2007-06-09 18:25:35 -0400
commit895ee682db14ed71860e22495280bdee4dae4738 (patch)
treef7ce2684c600c8f4367b2a32ad23ee063e7f507c /drivers/net/phy
parentdec590c1bb05c1553b68cab7aa3ea36d77e7f9a3 (diff)
phylib: add RGMII-ID mode to the Marvell m88e1111 PHY to fix broken ucc_geth
Support for configuring RGMII-ID (RGMII with internal delay) mode on the 88e1111 and 88e1145. Ucc_geth on MPC8360EMDS(the main user of ucc_geth) is broken after changed to use phylib. It is fixed by adding this internal delay. Also renamed 88e1111s -> 88e1111 (no references to an 88e1111s part were found), and fixed some whitespace. Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Li Yang <leoli@freescale.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/marvell.c62
1 files changed, 54 insertions, 8 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 22aec5cce683..b87f8d2a888b 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -54,6 +54,12 @@
54#define MII_M1111_PHY_LED_CONTROL 0x18 54#define MII_M1111_PHY_LED_CONTROL 0x18
55#define MII_M1111_PHY_LED_DIRECT 0x4100 55#define MII_M1111_PHY_LED_DIRECT 0x4100
56#define MII_M1111_PHY_LED_COMBINE 0x411c 56#define MII_M1111_PHY_LED_COMBINE 0x411c
57#define MII_M1111_PHY_EXT_CR 0x14
58#define MII_M1111_RX_DELAY 0x80
59#define MII_M1111_TX_DELAY 0x2
60#define MII_M1111_PHY_EXT_SR 0x1b
61#define MII_M1111_HWCFG_MODE_MASK 0xf
62#define MII_M1111_HWCFG_MODE_RGMII 0xb
57 63
58MODULE_DESCRIPTION("Marvell PHY driver"); 64MODULE_DESCRIPTION("Marvell PHY driver");
59MODULE_AUTHOR("Andy Fleming"); 65MODULE_AUTHOR("Andy Fleming");
@@ -131,6 +137,45 @@ static int marvell_config_aneg(struct phy_device *phydev)
131 return err; 137 return err;
132} 138}
133 139
140static int m88e1111_config_init(struct phy_device *phydev)
141{
142 int err;
143
144 if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
145 (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) {
146 int temp;
147
148 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
149 temp = phy_read(phydev, MII_M1111_PHY_EXT_CR);
150 if (temp < 0)
151 return temp;
152
153 temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY);
154
155 err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp);
156 if (err < 0)
157 return err;
158 }
159
160 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
161 if (temp < 0)
162 return temp;
163
164 temp &= ~(MII_M1111_HWCFG_MODE_MASK);
165 temp |= MII_M1111_HWCFG_MODE_RGMII;
166
167 err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp);
168 if (err < 0)
169 return err;
170 }
171
172 err = phy_write(phydev, MII_BMCR, BMCR_RESET);
173 if (err < 0)
174 return err;
175
176 return 0;
177}
178
134static int m88e1145_config_init(struct phy_device *phydev) 179static int m88e1145_config_init(struct phy_device *phydev)
135{ 180{
136 int err; 181 int err;
@@ -152,7 +197,7 @@ static int m88e1145_config_init(struct phy_device *phydev)
152 if (err < 0) 197 if (err < 0)
153 return err; 198 return err;
154 199
155 if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { 200 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
156 int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR); 201 int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR);
157 if (temp < 0) 202 if (temp < 0)
158 return temp; 203 return temp;
@@ -206,7 +251,7 @@ static struct phy_driver m88e1101_driver = {
206 .driver = {.owner = THIS_MODULE,}, 251 .driver = {.owner = THIS_MODULE,},
207}; 252};
208 253
209static struct phy_driver m88e1111s_driver = { 254static struct phy_driver m88e1111_driver = {
210 .phy_id = 0x01410cc0, 255 .phy_id = 0x01410cc0,
211 .phy_id_mask = 0xfffffff0, 256 .phy_id_mask = 0xfffffff0,
212 .name = "Marvell 88E1111", 257 .name = "Marvell 88E1111",
@@ -216,6 +261,7 @@ static struct phy_driver m88e1111s_driver = {
216 .read_status = &genphy_read_status, 261 .read_status = &genphy_read_status,
217 .ack_interrupt = &marvell_ack_interrupt, 262 .ack_interrupt = &marvell_ack_interrupt,
218 .config_intr = &marvell_config_intr, 263 .config_intr = &marvell_config_intr,
264 .config_init = &m88e1111_config_init,
219 .driver = {.owner = THIS_MODULE,}, 265 .driver = {.owner = THIS_MODULE,},
220}; 266};
221 267
@@ -241,9 +287,9 @@ static int __init marvell_init(void)
241 if (ret) 287 if (ret)
242 return ret; 288 return ret;
243 289
244 ret = phy_driver_register(&m88e1111s_driver); 290 ret = phy_driver_register(&m88e1111_driver);
245 if (ret) 291 if (ret)
246 goto err1111s; 292 goto err1111;
247 293
248 ret = phy_driver_register(&m88e1145_driver); 294 ret = phy_driver_register(&m88e1145_driver);
249 if (ret) 295 if (ret)
@@ -251,9 +297,9 @@ static int __init marvell_init(void)
251 297
252 return 0; 298 return 0;
253 299
254 err1145: 300err1145:
255 phy_driver_unregister(&m88e1111s_driver); 301 phy_driver_unregister(&m88e1111_driver);
256 err1111s: 302err1111:
257 phy_driver_unregister(&m88e1101_driver); 303 phy_driver_unregister(&m88e1101_driver);
258 return ret; 304 return ret;
259} 305}
@@ -261,7 +307,7 @@ static int __init marvell_init(void)
261static void __exit marvell_exit(void) 307static void __exit marvell_exit(void)
262{ 308{
263 phy_driver_unregister(&m88e1101_driver); 309 phy_driver_unregister(&m88e1101_driver);
264 phy_driver_unregister(&m88e1111s_driver); 310 phy_driver_unregister(&m88e1111_driver);
265 phy_driver_unregister(&m88e1145_driver); 311 phy_driver_unregister(&m88e1145_driver);
266} 312}
267 313