aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/phy/marvell.c110
1 files changed, 52 insertions, 58 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index fbe1104e9a07..21cb3aa4ae7e 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -254,77 +254,71 @@ static int m88e1145_config_init(struct phy_device *phydev)
254 return 0; 254 return 0;
255} 255}
256 256
257static struct phy_driver m88e1101_driver = { 257static struct phy_driver marvell_drivers[] = {
258 .phy_id = 0x01410c60, 258 {
259 .phy_id_mask = 0xfffffff0, 259 .phy_id = 0x01410c60,
260 .name = "Marvell 88E1101", 260 .phy_id_mask = 0xfffffff0,
261 .features = PHY_GBIT_FEATURES, 261 .name = "Marvell 88E1101",
262 .flags = PHY_HAS_INTERRUPT, 262 .features = PHY_GBIT_FEATURES,
263 .config_aneg = &marvell_config_aneg, 263 .flags = PHY_HAS_INTERRUPT,
264 .read_status = &genphy_read_status, 264 .config_aneg = &marvell_config_aneg,
265 .ack_interrupt = &marvell_ack_interrupt, 265 .read_status = &genphy_read_status,
266 .config_intr = &marvell_config_intr, 266 .ack_interrupt = &marvell_ack_interrupt,
267 .driver = {.owner = THIS_MODULE,}, 267 .config_intr = &marvell_config_intr,
268}; 268 .driver = {.owner = THIS_MODULE,},
269 269 },
270static struct phy_driver m88e1111_driver = { 270 {
271 .phy_id = 0x01410cc0, 271 .phy_id = 0x01410cc0,
272 .phy_id_mask = 0xfffffff0, 272 .phy_id_mask = 0xfffffff0,
273 .name = "Marvell 88E1111", 273 .name = "Marvell 88E1111",
274 .features = PHY_GBIT_FEATURES, 274 .features = PHY_GBIT_FEATURES,
275 .flags = PHY_HAS_INTERRUPT, 275 .flags = PHY_HAS_INTERRUPT,
276 .config_aneg = &marvell_config_aneg, 276 .config_init = &m88e1111_config_init,
277 .read_status = &genphy_read_status, 277 .config_aneg = &marvell_config_aneg,
278 .ack_interrupt = &marvell_ack_interrupt, 278 .read_status = &genphy_read_status,
279 .config_intr = &marvell_config_intr, 279 .ack_interrupt = &marvell_ack_interrupt,
280 .config_init = &m88e1111_config_init, 280 .config_intr = &marvell_config_intr,
281 .driver = {.owner = THIS_MODULE,}, 281 .driver = {.owner = THIS_MODULE,},
282}; 282 },
283 283 {
284static struct phy_driver m88e1145_driver = { 284 .phy_id = 0x01410cd0,
285 .phy_id = 0x01410cd0, 285 .phy_id_mask = 0xfffffff0,
286 .phy_id_mask = 0xfffffff0, 286 .name = "Marvell 88E1145",
287 .name = "Marvell 88E1145", 287 .features = PHY_GBIT_FEATURES,
288 .features = PHY_GBIT_FEATURES, 288 .flags = PHY_HAS_INTERRUPT,
289 .flags = PHY_HAS_INTERRUPT, 289 .config_init = &m88e1145_config_init,
290 .config_init = &m88e1145_config_init, 290 .config_aneg = &marvell_config_aneg,
291 .config_aneg = &marvell_config_aneg, 291 .read_status = &genphy_read_status,
292 .read_status = &genphy_read_status, 292 .ack_interrupt = &marvell_ack_interrupt,
293 .ack_interrupt = &marvell_ack_interrupt, 293 .config_intr = &marvell_config_intr,
294 .config_intr = &marvell_config_intr, 294 .driver = {.owner = THIS_MODULE,},
295 .driver = {.owner = THIS_MODULE,}, 295 }
296}; 296};
297 297
298static int __init marvell_init(void) 298static int __init marvell_init(void)
299{ 299{
300 int ret; 300 int ret;
301 int i;
301 302
302 ret = phy_driver_register(&m88e1101_driver); 303 for (i = 0; i < ARRAY_SIZE(marvell_drivers); i++) {
303 if (ret) 304 ret = phy_driver_register(&marvell_drivers[i]);
304 return ret;
305 305
306 ret = phy_driver_register(&m88e1111_driver); 306 if (ret) {
307 if (ret) 307 while (i-- > 0)
308 goto err1111; 308 phy_driver_unregister(&marvell_drivers[i]);
309 309 return ret;
310 ret = phy_driver_register(&m88e1145_driver); 310 }
311 if (ret) 311 }
312 goto err1145;
313 312
314 return 0; 313 return 0;
315
316err1145:
317 phy_driver_unregister(&m88e1111_driver);
318err1111:
319 phy_driver_unregister(&m88e1101_driver);
320 return ret;
321} 314}
322 315
323static void __exit marvell_exit(void) 316static void __exit marvell_exit(void)
324{ 317{
325 phy_driver_unregister(&m88e1101_driver); 318 int i;
326 phy_driver_unregister(&m88e1111_driver); 319
327 phy_driver_unregister(&m88e1145_driver); 320 for (i = 0; i < ARRAY_SIZE(marvell_drivers); i++)
321 phy_driver_unregister(&marvell_drivers[i]);
328} 322}
329 323
330module_init(marvell_init); 324module_init(marvell_init);