aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/marvell.c
diff options
context:
space:
mode:
authorViet Nga Dao <vndao@altera.com>2014-10-23 22:41:53 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-28 14:49:32 -0400
commitb02241755d0edc67204d475e746750bc754ead4f (patch)
tree3210c8224ebcb733a2a5bba9770e4b0a13d44787 /drivers/net/phy/marvell.c
parent62b9c8d0372d11a5e048c6b56997374901e0445b (diff)
net: phy: Adding SGMII support for Marvell 88ee1145 driver
Additional code to m88e1145_config_init function to allow the driver to support SGMII mode. Signed-off-by: Viet Nga Dao <vndao@altera.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/marvell.c')
-rw-r--r--drivers/net/phy/marvell.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index d2b2f2f795d5..3e3d7cadeb27 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -50,9 +50,13 @@
50#define MII_M1011_PHY_SCR 0x10 50#define MII_M1011_PHY_SCR 0x10
51#define MII_M1011_PHY_SCR_AUTO_CROSS 0x0060 51#define MII_M1011_PHY_SCR_AUTO_CROSS 0x0060
52 52
53#define MII_M1145_PHY_EXT_SR 0x1b
53#define MII_M1145_PHY_EXT_CR 0x14 54#define MII_M1145_PHY_EXT_CR 0x14
54#define MII_M1145_RGMII_RX_DELAY 0x0080 55#define MII_M1145_RGMII_RX_DELAY 0x0080
55#define MII_M1145_RGMII_TX_DELAY 0x0002 56#define MII_M1145_RGMII_TX_DELAY 0x0002
57#define MII_M1145_HWCFG_MODE_SGMII_NO_CLK 0x4
58#define MII_M1145_HWCFG_MODE_MASK 0xf
59#define MII_M1145_HWCFG_FIBER_COPPER_AUTO 0x8000
56 60
57#define MII_M1111_PHY_LED_CONTROL 0x18 61#define MII_M1111_PHY_LED_CONTROL 0x18
58#define MII_M1111_PHY_LED_DIRECT 0x4100 62#define MII_M1111_PHY_LED_DIRECT 0x4100
@@ -642,6 +646,7 @@ static int m88e1149_config_init(struct phy_device *phydev)
642static int m88e1145_config_init(struct phy_device *phydev) 646static int m88e1145_config_init(struct phy_device *phydev)
643{ 647{
644 int err; 648 int err;
649 int temp;
645 650
646 /* Take care of errata E0 & E1 */ 651 /* Take care of errata E0 & E1 */
647 err = phy_write(phydev, 0x1d, 0x001b); 652 err = phy_write(phydev, 0x1d, 0x001b);
@@ -698,6 +703,20 @@ static int m88e1145_config_init(struct phy_device *phydev)
698 } 703 }
699 } 704 }
700 705
706 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
707 temp = phy_read(phydev, MII_M1145_PHY_EXT_SR);
708 if (temp < 0)
709 return temp;
710
711 temp &= ~(MII_M1145_HWCFG_MODE_MASK);
712 temp |= MII_M1145_HWCFG_MODE_SGMII_NO_CLK;
713 temp |= MII_M1145_HWCFG_FIBER_COPPER_AUTO;
714
715 err = phy_write(phydev, MII_M1145_PHY_EXT_SR, temp);
716 if (err < 0)
717 return err;
718 }
719
701 err = marvell_of_reg_init(phydev); 720 err = marvell_of_reg_init(phydev);
702 if (err < 0) 721 if (err < 0)
703 return err; 722 return err;