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>

authored by Jens Osterkamp and committed by Stephen Hemminger 8ec93459 b636d17a

+47 -9
+1 -9
drivers/net/spider_net.c
··· 1794 1794 if (phy->def->ops->setup_forced) 1795 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 */ 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); 1797 + phy->def->ops->enable_fiber(phy); 1806 1798 1807 1799 phy->def->ops->read_link(phy); 1808 1800 pr_info("Found %s with %i Mbps, %s-duplex.\n", phy->def->name,
+45
drivers/net/sungem_phy.c
··· 329 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 356 static int bcm54xx_setup_aneg(struct mii_phy *phy, u32 advertise) 333 357 { 334 358 u16 ctl, adv; ··· 786 762 .setup_forced = bcm54xx_setup_forced, 787 763 .poll_link = genmii_poll_link, 788 764 .read_link = bcm54xx_read_link, 765 + .enable_fiber = bcm5421_enable_fiber, 789 766 }; 790 767 791 768 static struct mii_phy_def bcm5421_phy_def = { ··· 815 790 .features = MII_GBIT_FEATURES, 816 791 .magic_aneg = 1, 817 792 .ops = &bcm5421k2_phy_ops 793 + }; 794 + 795 + static struct mii_phy_ops bcm5461_phy_ops = { 796 + .init = bcm5421_init, 797 + .suspend = generic_suspend, 798 + .setup_aneg = bcm54xx_setup_aneg, 799 + .setup_forced = bcm54xx_setup_forced, 800 + .poll_link = genmii_poll_link, 801 + .read_link = bcm54xx_read_link, 802 + .enable_fiber = bcm5461_enable_fiber, 803 + }; 804 + 805 + static struct mii_phy_def bcm5461_phy_def = { 806 + .phy_id = 0x002060c0, 807 + .phy_id_mask = 0xfffffff0, 808 + .name = "BCM5461", 809 + .features = MII_GBIT_FEATURES, 810 + .magic_aneg = 1, 811 + .ops = &bcm5461_phy_ops 818 812 }; 819 813 820 814 /* Broadcom BCM 5462 built-in Vesta */ ··· 901 857 &bcm5411_phy_def, 902 858 &bcm5421_phy_def, 903 859 &bcm5421k2_phy_def, 860 + &bcm5461_phy_def, 904 861 &bcm5462V_phy_def, 905 862 &marvell_phy_def, 906 863 &genmii_phy_def,
+1
drivers/net/sungem_phy.h
··· 12 12 int (*setup_forced)(struct mii_phy *phy, int speed, int fd); 13 13 int (*poll_link)(struct mii_phy *phy); 14 14 int (*read_link)(struct mii_phy *phy); 15 + int (*enable_fiber)(struct mii_phy *phy); 15 16 }; 16 17 17 18 /* Structure used to statically define an mii/gii based PHY */