diff options
author | Kapil Juneja <Kapil.Juneja@freescale.com> | 2007-05-11 19:25:11 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-07-08 22:16:38 -0400 |
commit | d3c12873c36005263286cf5660663c8c10f9d2b5 (patch) | |
tree | 8b51ae1aec834ece23271e6b569d7c4189422ad5 /drivers/net/gianfar.c | |
parent | 0cefeebaf3da39d768bffcf62460fe2088e824ef (diff) |
gianfar: add support for SGMII
Add code for initialising and configuring TBI interface and
programming it for connecting to on-chip SERDES (Lynx PHY)
in case of SGMII mode selected through HRCW at reset.
also add defines for TBI register configuration. TBI
interface is programmed towards the SERDES.
refactored mdio read/write functions to differentiate
programming local interface MII regs (e.g., for TBI) from
always programming the mdio master (TSEC1, for programming
the PHYs).
Signed-off-by: Kapil Juneja <Kapil.Juneja@freescale.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/gianfar.c')
-rw-r--r-- | drivers/net/gianfar.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 1b854bf07b09..d7a1a58de766 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -130,6 +130,9 @@ static int gfar_remove(struct platform_device *pdev); | |||
130 | static void free_skb_resources(struct gfar_private *priv); | 130 | static void free_skb_resources(struct gfar_private *priv); |
131 | static void gfar_set_multi(struct net_device *dev); | 131 | static void gfar_set_multi(struct net_device *dev); |
132 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); | 132 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); |
133 | static void gfar_configure_serdes(struct net_device *dev); | ||
134 | extern int gfar_local_mdio_write(struct gfar_mii *regs, int mii_id, int regnum, u16 value); | ||
135 | extern int gfar_local_mdio_read(struct gfar_mii *regs, int mii_id, int regnum); | ||
133 | #ifdef CONFIG_GFAR_NAPI | 136 | #ifdef CONFIG_GFAR_NAPI |
134 | static int gfar_poll(struct net_device *dev, int *budget); | 137 | static int gfar_poll(struct net_device *dev, int *budget); |
135 | #endif | 138 | #endif |
@@ -451,6 +454,9 @@ static int init_phy(struct net_device *dev) | |||
451 | 454 | ||
452 | phydev = phy_connect(dev, phy_id, &adjust_link, 0, interface); | 455 | phydev = phy_connect(dev, phy_id, &adjust_link, 0, interface); |
453 | 456 | ||
457 | if (interface == PHY_INTERFACE_MODE_SGMII) | ||
458 | gfar_configure_serdes(dev); | ||
459 | |||
454 | if (IS_ERR(phydev)) { | 460 | if (IS_ERR(phydev)) { |
455 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); | 461 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); |
456 | return PTR_ERR(phydev); | 462 | return PTR_ERR(phydev); |
@@ -465,6 +471,27 @@ static int init_phy(struct net_device *dev) | |||
465 | return 0; | 471 | return 0; |
466 | } | 472 | } |
467 | 473 | ||
474 | static void gfar_configure_serdes(struct net_device *dev) | ||
475 | { | ||
476 | struct gfar_private *priv = netdev_priv(dev); | ||
477 | struct gfar_mii __iomem *regs = | ||
478 | (void __iomem *)&priv->regs->gfar_mii_regs; | ||
479 | |||
480 | /* Initialise TBI i/f to communicate with serdes (lynx phy) */ | ||
481 | |||
482 | /* Single clk mode, mii mode off(for aerdes communication) */ | ||
483 | gfar_local_mdio_write(regs, TBIPA_VALUE, MII_TBICON, TBICON_CLK_SELECT); | ||
484 | |||
485 | /* Supported pause and full-duplex, no half-duplex */ | ||
486 | gfar_local_mdio_write(regs, TBIPA_VALUE, MII_ADVERTISE, | ||
487 | ADVERTISE_1000XFULL | ADVERTISE_1000XPAUSE | | ||
488 | ADVERTISE_1000XPSE_ASYM); | ||
489 | |||
490 | /* ANEG enable, restart ANEG, full duplex mode, speed[1] set */ | ||
491 | gfar_local_mdio_write(regs, TBIPA_VALUE, MII_BMCR, BMCR_ANENABLE | | ||
492 | BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000); | ||
493 | } | ||
494 | |||
468 | static void init_registers(struct net_device *dev) | 495 | static void init_registers(struct net_device *dev) |
469 | { | 496 | { |
470 | struct gfar_private *priv = netdev_priv(dev); | 497 | struct gfar_private *priv = netdev_priv(dev); |