diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-06-20 23:20:46 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@fluxnic.net> | 2010-07-16 22:01:58 -0400 |
commit | 2f495c398edca50ac251c134f1995a2fb3c06cb7 (patch) | |
tree | 85551c64ef485373807a2733287aafc458881a10 | |
parent | 43b56074b69f3b6d0296e7986e792c7adb1d89c6 (diff) |
net/phy/marvell: Expose IDs and flags in a .h and add dns323 LEDs setup flag
This moves the various known Marvell PHY IDs to include/linux/marvell_phy.h
along with dev_flags definitions for use by the driver.
I then added a flag that changes the PHY init code to setup the LEDs
config to the values needed to operate a dns323 rev C1 NAS.
I moved the existing "resistance" flag to the .h as well, though I've
been unable to find whoever sets this to convert it to use that constant.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
-rw-r--r-- | drivers/net/phy/marvell.c | 38 | ||||
-rw-r--r-- | include/linux/marvell_phy.h | 20 |
2 files changed, 40 insertions, 18 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 78b74e83ce5d..5a1bd5db2a93 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/mii.h> | 29 | #include <linux/mii.h> |
30 | #include <linux/ethtool.h> | 30 | #include <linux/ethtool.h> |
31 | #include <linux/phy.h> | 31 | #include <linux/phy.h> |
32 | #include <linux/marvell_phy.h> | ||
32 | 33 | ||
33 | #include <asm/io.h> | 34 | #include <asm/io.h> |
34 | #include <asm/irq.h> | 35 | #include <asm/irq.h> |
@@ -48,8 +49,6 @@ | |||
48 | #define MII_M1145_RGMII_RX_DELAY 0x0080 | 49 | #define MII_M1145_RGMII_RX_DELAY 0x0080 |
49 | #define MII_M1145_RGMII_TX_DELAY 0x0002 | 50 | #define MII_M1145_RGMII_TX_DELAY 0x0002 |
50 | 51 | ||
51 | #define M1145_DEV_FLAGS_RESISTANCE 0x00000001 | ||
52 | |||
53 | #define MII_M1111_PHY_LED_CONTROL 0x18 | 52 | #define MII_M1111_PHY_LED_CONTROL 0x18 |
54 | #define MII_M1111_PHY_LED_DIRECT 0x4100 | 53 | #define MII_M1111_PHY_LED_DIRECT 0x4100 |
55 | #define MII_M1111_PHY_LED_COMBINE 0x411c | 54 | #define MII_M1111_PHY_LED_COMBINE 0x411c |
@@ -350,7 +349,10 @@ static int m88e1118_config_init(struct phy_device *phydev) | |||
350 | return err; | 349 | return err; |
351 | 350 | ||
352 | /* Adjust LED Control */ | 351 | /* Adjust LED Control */ |
353 | err = phy_write(phydev, 0x10, 0x021e); | 352 | if (phydev->dev_flags & MARVELL_PHY_M1118_DNS323_LEDS) |
353 | err = phy_write(phydev, 0x10, 0x1100); | ||
354 | else | ||
355 | err = phy_write(phydev, 0x10, 0x021e); | ||
354 | if (err < 0) | 356 | if (err < 0) |
355 | return err; | 357 | return err; |
356 | 358 | ||
@@ -398,7 +400,7 @@ static int m88e1145_config_init(struct phy_device *phydev) | |||
398 | if (err < 0) | 400 | if (err < 0) |
399 | return err; | 401 | return err; |
400 | 402 | ||
401 | if (phydev->dev_flags & M1145_DEV_FLAGS_RESISTANCE) { | 403 | if (phydev->dev_flags & MARVELL_PHY_M1145_FLAGS_RESISTANCE) { |
402 | err = phy_write(phydev, 0x1d, 0x0012); | 404 | err = phy_write(phydev, 0x1d, 0x0012); |
403 | if (err < 0) | 405 | if (err < 0) |
404 | return err; | 406 | return err; |
@@ -529,8 +531,8 @@ static int m88e1121_did_interrupt(struct phy_device *phydev) | |||
529 | 531 | ||
530 | static struct phy_driver marvell_drivers[] = { | 532 | static struct phy_driver marvell_drivers[] = { |
531 | { | 533 | { |
532 | .phy_id = 0x01410c60, | 534 | .phy_id = MARVELL_PHY_ID_88E1101, |
533 | .phy_id_mask = 0xfffffff0, | 535 | .phy_id_mask = MARVELL_PHY_ID_MASK, |
534 | .name = "Marvell 88E1101", | 536 | .name = "Marvell 88E1101", |
535 | .features = PHY_GBIT_FEATURES, | 537 | .features = PHY_GBIT_FEATURES, |
536 | .flags = PHY_HAS_INTERRUPT, | 538 | .flags = PHY_HAS_INTERRUPT, |
@@ -541,8 +543,8 @@ static struct phy_driver marvell_drivers[] = { | |||
541 | .driver = { .owner = THIS_MODULE }, | 543 | .driver = { .owner = THIS_MODULE }, |
542 | }, | 544 | }, |
543 | { | 545 | { |
544 | .phy_id = 0x01410c90, | 546 | .phy_id = MARVELL_PHY_ID_88E1112, |
545 | .phy_id_mask = 0xfffffff0, | 547 | .phy_id_mask = MARVELL_PHY_ID_MASK, |
546 | .name = "Marvell 88E1112", | 548 | .name = "Marvell 88E1112", |
547 | .features = PHY_GBIT_FEATURES, | 549 | .features = PHY_GBIT_FEATURES, |
548 | .flags = PHY_HAS_INTERRUPT, | 550 | .flags = PHY_HAS_INTERRUPT, |
@@ -554,8 +556,8 @@ static struct phy_driver marvell_drivers[] = { | |||
554 | .driver = { .owner = THIS_MODULE }, | 556 | .driver = { .owner = THIS_MODULE }, |
555 | }, | 557 | }, |
556 | { | 558 | { |
557 | .phy_id = 0x01410cc0, | 559 | .phy_id = MARVELL_PHY_ID_88E1111, |
558 | .phy_id_mask = 0xfffffff0, | 560 | .phy_id_mask = MARVELL_PHY_ID_MASK, |
559 | .name = "Marvell 88E1111", | 561 | .name = "Marvell 88E1111", |
560 | .features = PHY_GBIT_FEATURES, | 562 | .features = PHY_GBIT_FEATURES, |
561 | .flags = PHY_HAS_INTERRUPT, | 563 | .flags = PHY_HAS_INTERRUPT, |
@@ -567,8 +569,8 @@ static struct phy_driver marvell_drivers[] = { | |||
567 | .driver = { .owner = THIS_MODULE }, | 569 | .driver = { .owner = THIS_MODULE }, |
568 | }, | 570 | }, |
569 | { | 571 | { |
570 | .phy_id = 0x01410e10, | 572 | .phy_id = MARVELL_PHY_ID_88E1118, |
571 | .phy_id_mask = 0xfffffff0, | 573 | .phy_id_mask = MARVELL_PHY_ID_MASK, |
572 | .name = "Marvell 88E1118", | 574 | .name = "Marvell 88E1118", |
573 | .features = PHY_GBIT_FEATURES, | 575 | .features = PHY_GBIT_FEATURES, |
574 | .flags = PHY_HAS_INTERRUPT, | 576 | .flags = PHY_HAS_INTERRUPT, |
@@ -580,8 +582,8 @@ static struct phy_driver marvell_drivers[] = { | |||
580 | .driver = {.owner = THIS_MODULE,}, | 582 | .driver = {.owner = THIS_MODULE,}, |
581 | }, | 583 | }, |
582 | { | 584 | { |
583 | .phy_id = 0x01410cb0, | 585 | .phy_id = MARVELL_PHY_ID_88E1121R, |
584 | .phy_id_mask = 0xfffffff0, | 586 | .phy_id_mask = MARVELL_PHY_ID_MASK, |
585 | .name = "Marvell 88E1121R", | 587 | .name = "Marvell 88E1121R", |
586 | .features = PHY_GBIT_FEATURES, | 588 | .features = PHY_GBIT_FEATURES, |
587 | .flags = PHY_HAS_INTERRUPT, | 589 | .flags = PHY_HAS_INTERRUPT, |
@@ -593,8 +595,8 @@ static struct phy_driver marvell_drivers[] = { | |||
593 | .driver = { .owner = THIS_MODULE }, | 595 | .driver = { .owner = THIS_MODULE }, |
594 | }, | 596 | }, |
595 | { | 597 | { |
596 | .phy_id = 0x01410cd0, | 598 | .phy_id = MARVELL_PHY_ID_88E1145, |
597 | .phy_id_mask = 0xfffffff0, | 599 | .phy_id_mask = MARVELL_PHY_ID_MASK, |
598 | .name = "Marvell 88E1145", | 600 | .name = "Marvell 88E1145", |
599 | .features = PHY_GBIT_FEATURES, | 601 | .features = PHY_GBIT_FEATURES, |
600 | .flags = PHY_HAS_INTERRUPT, | 602 | .flags = PHY_HAS_INTERRUPT, |
@@ -606,8 +608,8 @@ static struct phy_driver marvell_drivers[] = { | |||
606 | .driver = { .owner = THIS_MODULE }, | 608 | .driver = { .owner = THIS_MODULE }, |
607 | }, | 609 | }, |
608 | { | 610 | { |
609 | .phy_id = 0x01410e30, | 611 | .phy_id = MARVELL_PHY_ID_88E1240, |
610 | .phy_id_mask = 0xfffffff0, | 612 | .phy_id_mask = MARVELL_PHY_ID_MASK, |
611 | .name = "Marvell 88E1240", | 613 | .name = "Marvell 88E1240", |
612 | .features = PHY_GBIT_FEATURES, | 614 | .features = PHY_GBIT_FEATURES, |
613 | .flags = PHY_HAS_INTERRUPT, | 615 | .flags = PHY_HAS_INTERRUPT, |
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h new file mode 100644 index 000000000000..2ed4fb8bbd51 --- /dev/null +++ b/include/linux/marvell_phy.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef _MARVELL_PHY_H | ||
2 | #define _MARVELL_PHY_H | ||
3 | |||
4 | /* Mask used for ID comparisons */ | ||
5 | #define MARVELL_PHY_ID_MASK 0xfffffff0 | ||
6 | |||
7 | /* Known PHY IDs */ | ||
8 | #define MARVELL_PHY_ID_88E1101 0x01410c60 | ||
9 | #define MARVELL_PHY_ID_88E1112 0x01410c90 | ||
10 | #define MARVELL_PHY_ID_88E1111 0x01410cc0 | ||
11 | #define MARVELL_PHY_ID_88E1118 0x01410e10 | ||
12 | #define MARVELL_PHY_ID_88E1121R 0x01410cb0 | ||
13 | #define MARVELL_PHY_ID_88E1145 0x01410cd0 | ||
14 | #define MARVELL_PHY_ID_88E1240 0x01410e30 | ||
15 | |||
16 | /* struct phy_device dev_flags definitions */ | ||
17 | #define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001 | ||
18 | #define MARVELL_PHY_M1118_DNS323_LEDS 0x00000002 | ||
19 | |||
20 | #endif /* _MARVELL_PHY_H */ | ||