summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/marvell.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-12 20:35:10 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-12 20:35:10 -0700
commita0e1d1d075cc0efe9a3ac8579bce9393d070e09f (patch)
tree92964216b94d2f9753c2ec043ab5a121f22bbd6d /drivers/net/phy/marvell.c
parentdd14cbc994709a1c5a64ed3621f583c49a27e521 (diff)
parentb232923966f1210e1183353bbd1d52ee53b79fbf (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (89 commits) myri10ge: update driver version myri10ge: report when the link partner is running in Myrinet mode myri10ge: limit the number of recoveries NetXen: Fix link status messages Revert "[netdrvr e100] experiment with doing RX in a similar manner to eepro100" [PATCH] libertas: convert libertas_mpp into anycast_mask [PATCH] libertas: actually send mesh frames to mesh netdev [PATCH] libertas: deauthenticate from AP in channel switch [PATCH] libertas: pull current channel from firmware on mesh autostart [PATCH] libertas: reduce SSID and BSSID mixed-case abuse [PATCH] libertas: remove WPA_SUPPLICANT structure [PATCH] libertas: remove structure WLAN_802_11_SSID and libertas_escape_essid [PATCH] libertas: tweak association debug output [PATCH] libertas: fix big-endian associate command. [PATCH] libertas: don't byte-swap firmware version number. It's a byte array. [PATCH] libertas: more endianness fixes, in tx.c this time [PATCH] libertas: More endianness fixes. [PATCH] libertas: first pass at fixing up endianness issues [PATCH] libertas: sparse fixes [PATCH] libertas: fix character set in README ...
Diffstat (limited to 'drivers/net/phy/marvell.c')
-rw-r--r--drivers/net/phy/marvell.c62
1 files changed, 54 insertions, 8 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 22aec5cce68..b87f8d2a888 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -54,6 +54,12 @@
#define MII_M1111_PHY_LED_CONTROL 0x18
#define MII_M1111_PHY_LED_DIRECT 0x4100
#define MII_M1111_PHY_LED_COMBINE 0x411c
+#define MII_M1111_PHY_EXT_CR 0x14
+#define MII_M1111_RX_DELAY 0x80
+#define MII_M1111_TX_DELAY 0x2
+#define MII_M1111_PHY_EXT_SR 0x1b
+#define MII_M1111_HWCFG_MODE_MASK 0xf
+#define MII_M1111_HWCFG_MODE_RGMII 0xb
MODULE_DESCRIPTION("Marvell PHY driver");
MODULE_AUTHOR("Andy Fleming");
@@ -131,6 +137,45 @@ static int marvell_config_aneg(struct phy_device *phydev)
return err;
}
+static int m88e1111_config_init(struct phy_device *phydev)
+{
+ int err;
+
+ if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
+ (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) {
+ int temp;
+
+ if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
+ temp = phy_read(phydev, MII_M1111_PHY_EXT_CR);
+ if (temp < 0)
+ return temp;
+
+ temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY);
+
+ err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp);
+ if (err < 0)
+ return err;
+ }
+
+ temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
+ if (temp < 0)
+ return temp;
+
+ temp &= ~(MII_M1111_HWCFG_MODE_MASK);
+ temp |= MII_M1111_HWCFG_MODE_RGMII;
+
+ err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp);
+ if (err < 0)
+ return err;
+ }
+
+ err = phy_write(phydev, MII_BMCR, BMCR_RESET);
+ if (err < 0)
+ return err;
+
+ return 0;
+}
+
static int m88e1145_config_init(struct phy_device *phydev)
{
int err;
@@ -152,7 +197,7 @@ static int m88e1145_config_init(struct phy_device *phydev)
if (err < 0)
return err;
- if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
+ if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR);
if (temp < 0)
return temp;
@@ -206,7 +251,7 @@ static struct phy_driver m88e1101_driver = {
.driver = {.owner = THIS_MODULE,},
};
-static struct phy_driver m88e1111s_driver = {
+static struct phy_driver m88e1111_driver = {
.phy_id = 0x01410cc0,
.phy_id_mask = 0xfffffff0,
.name = "Marvell 88E1111",
@@ -216,6 +261,7 @@ static struct phy_driver m88e1111s_driver = {
.read_status = &genphy_read_status,
.ack_interrupt = &marvell_ack_interrupt,
.config_intr = &marvell_config_intr,
+ .config_init = &m88e1111_config_init,
.driver = {.owner = THIS_MODULE,},
};
@@ -241,9 +287,9 @@ static int __init marvell_init(void)
if (ret)
return ret;
- ret = phy_driver_register(&m88e1111s_driver);
+ ret = phy_driver_register(&m88e1111_driver);
if (ret)
- goto err1111s;
+ goto err1111;
ret = phy_driver_register(&m88e1145_driver);
if (ret)
@@ -251,9 +297,9 @@ static int __init marvell_init(void)
return 0;
- err1145:
- phy_driver_unregister(&m88e1111s_driver);
- err1111s:
+err1145:
+ phy_driver_unregister(&m88e1111_driver);
+err1111:
phy_driver_unregister(&m88e1101_driver);
return ret;
}
@@ -261,7 +307,7 @@ static int __init marvell_init(void)
static void __exit marvell_exit(void)
{
phy_driver_unregister(&m88e1101_driver);
- phy_driver_unregister(&m88e1111s_driver);
+ phy_driver_unregister(&m88e1111_driver);
phy_driver_unregister(&m88e1145_driver);
}