diff options
author | Jens Osterkamp <Jens.Osterkamp@de.ibm.com> | 2006-05-04 05:59:41 -0400 |
---|---|---|
committer | Stephen Hemminger <shemminger@osdl.org> | 2006-05-08 19:01:12 -0400 |
commit | 8ec93459655a3618dedec6360bb28d63f0010ef6 (patch) | |
tree | 48a3599fd2701a507bdc9e3308c970b28cb99086 /drivers | |
parent | b636d17a3bee8ba988e78e4bc8262f0dc3fad8ab (diff) |
spidernet: enable support for bcm5461 ethernet phy
A newer board revision changed the type of ethernet phy.
Moreover, this generalizes the way that a phy gets switched
into fiber mode when autodetection is not available.
Signed-off-by: Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/spider_net.c | 10 | ||||
-rw-r--r-- | drivers/net/sungem_phy.c | 45 | ||||
-rw-r--r-- | drivers/net/sungem_phy.h | 1 |
3 files changed, 47 insertions, 9 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index b36838bfb8dc..394339d5e87c 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c | |||
@@ -1794,15 +1794,7 @@ spider_net_setup_phy(struct spider_net_card *card) | |||
1794 | if (phy->def->ops->setup_forced) | 1794 | if (phy->def->ops->setup_forced) |
1795 | phy->def->ops->setup_forced(phy, SPEED_1000, DUPLEX_FULL); | 1795 | phy->def->ops->setup_forced(phy, SPEED_1000, DUPLEX_FULL); |
1796 | 1796 | ||
1797 | /* the following two writes could be moved to sungem_phy.c */ | 1797 | phy->def->ops->enable_fiber(phy); |
1798 | /* enable fiber mode */ | ||
1799 | spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0x9020); | ||
1800 | /* LEDs active in both modes, autosense prio = fiber */ | ||
1801 | spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0x945f); | ||
1802 | |||
1803 | /* switch off fibre autoneg */ | ||
1804 | spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0xfc01); | ||
1805 | spider_net_write_phy(card->netdev, 1, 0x0b, 0x0004); | ||
1806 | 1798 | ||
1807 | phy->def->ops->read_link(phy); | 1799 | phy->def->ops->read_link(phy); |
1808 | pr_info("Found %s with %i Mbps, %s-duplex.\n", phy->def->name, | 1800 | pr_info("Found %s with %i Mbps, %s-duplex.\n", phy->def->name, |
diff --git a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c index 046371ee5bbe..b2ddd5e79303 100644 --- a/drivers/net/sungem_phy.c +++ b/drivers/net/sungem_phy.c | |||
@@ -329,6 +329,30 @@ static int bcm5421_init(struct mii_phy* phy) | |||
329 | return 0; | 329 | return 0; |
330 | } | 330 | } |
331 | 331 | ||
332 | static int bcm5421_enable_fiber(struct mii_phy* phy) | ||
333 | { | ||
334 | /* enable fiber mode */ | ||
335 | phy_write(phy, MII_NCONFIG, 0x9020); | ||
336 | /* LEDs active in both modes, autosense prio = fiber */ | ||
337 | phy_write(phy, MII_NCONFIG, 0x945f); | ||
338 | |||
339 | /* switch off fibre autoneg */ | ||
340 | phy_write(phy, MII_NCONFIG, 0xfc01); | ||
341 | phy_write(phy, 0x0b, 0x0004); | ||
342 | |||
343 | return 0; | ||
344 | } | ||
345 | |||
346 | static int bcm5461_enable_fiber(struct mii_phy* phy) | ||
347 | { | ||
348 | phy_write(phy, MII_NCONFIG, 0xfc0c); | ||
349 | phy_write(phy, MII_BMCR, 0x4140); | ||
350 | phy_write(phy, MII_NCONFIG, 0xfc0b); | ||
351 | phy_write(phy, MII_BMCR, 0x0140); | ||
352 | |||
353 | return 0; | ||
354 | } | ||
355 | |||
332 | static int bcm54xx_setup_aneg(struct mii_phy *phy, u32 advertise) | 356 | static int bcm54xx_setup_aneg(struct mii_phy *phy, u32 advertise) |
333 | { | 357 | { |
334 | u16 ctl, adv; | 358 | u16 ctl, adv; |
@@ -762,6 +786,7 @@ static struct mii_phy_ops bcm5421_phy_ops = { | |||
762 | .setup_forced = bcm54xx_setup_forced, | 786 | .setup_forced = bcm54xx_setup_forced, |
763 | .poll_link = genmii_poll_link, | 787 | .poll_link = genmii_poll_link, |
764 | .read_link = bcm54xx_read_link, | 788 | .read_link = bcm54xx_read_link, |
789 | .enable_fiber = bcm5421_enable_fiber, | ||
765 | }; | 790 | }; |
766 | 791 | ||
767 | static struct mii_phy_def bcm5421_phy_def = { | 792 | static struct mii_phy_def bcm5421_phy_def = { |
@@ -792,6 +817,25 @@ static struct mii_phy_def bcm5421k2_phy_def = { | |||
792 | .ops = &bcm5421k2_phy_ops | 817 | .ops = &bcm5421k2_phy_ops |
793 | }; | 818 | }; |
794 | 819 | ||
820 | static struct mii_phy_ops bcm5461_phy_ops = { | ||
821 | .init = bcm5421_init, | ||
822 | .suspend = generic_suspend, | ||
823 | .setup_aneg = bcm54xx_setup_aneg, | ||
824 | .setup_forced = bcm54xx_setup_forced, | ||
825 | .poll_link = genmii_poll_link, | ||
826 | .read_link = bcm54xx_read_link, | ||
827 | .enable_fiber = bcm5461_enable_fiber, | ||
828 | }; | ||
829 | |||
830 | static struct mii_phy_def bcm5461_phy_def = { | ||
831 | .phy_id = 0x002060c0, | ||
832 | .phy_id_mask = 0xfffffff0, | ||
833 | .name = "BCM5461", | ||
834 | .features = MII_GBIT_FEATURES, | ||
835 | .magic_aneg = 1, | ||
836 | .ops = &bcm5461_phy_ops | ||
837 | }; | ||
838 | |||
795 | /* Broadcom BCM 5462 built-in Vesta */ | 839 | /* Broadcom BCM 5462 built-in Vesta */ |
796 | static struct mii_phy_ops bcm5462V_phy_ops = { | 840 | static struct mii_phy_ops bcm5462V_phy_ops = { |
797 | .init = bcm5421_init, | 841 | .init = bcm5421_init, |
@@ -857,6 +901,7 @@ static struct mii_phy_def* mii_phy_table[] = { | |||
857 | &bcm5411_phy_def, | 901 | &bcm5411_phy_def, |
858 | &bcm5421_phy_def, | 902 | &bcm5421_phy_def, |
859 | &bcm5421k2_phy_def, | 903 | &bcm5421k2_phy_def, |
904 | &bcm5461_phy_def, | ||
860 | &bcm5462V_phy_def, | 905 | &bcm5462V_phy_def, |
861 | &marvell_phy_def, | 906 | &marvell_phy_def, |
862 | &genmii_phy_def, | 907 | &genmii_phy_def, |
diff --git a/drivers/net/sungem_phy.h b/drivers/net/sungem_phy.h index 430544496c52..69e125197fcf 100644 --- a/drivers/net/sungem_phy.h +++ b/drivers/net/sungem_phy.h | |||
@@ -12,6 +12,7 @@ struct mii_phy_ops | |||
12 | int (*setup_forced)(struct mii_phy *phy, int speed, int fd); | 12 | int (*setup_forced)(struct mii_phy *phy, int speed, int fd); |
13 | int (*poll_link)(struct mii_phy *phy); | 13 | int (*poll_link)(struct mii_phy *phy); |
14 | int (*read_link)(struct mii_phy *phy); | 14 | int (*read_link)(struct mii_phy *phy); |
15 | int (*enable_fiber)(struct mii_phy *phy); | ||
15 | }; | 16 | }; |
16 | 17 | ||
17 | /* Structure used to statically define an mii/gii based PHY */ | 18 | /* Structure used to statically define an mii/gii based PHY */ |