linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Liu Yu <yu.liu@freescale.com>
To: galak@kernel.crashing.org, davem@davemloft.net
Cc: netdev@vger.kernel.org, Liu Yu <yu.liu@freescale.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 4/4] phy: add RTBI mode for m88e1111
Date: Thu, 14 Jan 2010 16:13:19 +0800	[thread overview]
Message-ID: <1263456799-3306-4-git-send-email-yu.liu@freescale.com> (raw)
In-Reply-To: <1263456799-3306-3-git-send-email-yu.liu@freescale.com>

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
 drivers/net/phy/marvell.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 6f69b9b..65ed385 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -63,6 +63,7 @@
 #define MII_M1111_HWCFG_MODE_COPPER_RGMII	0xb
 #define MII_M1111_HWCFG_MODE_FIBER_RGMII	0x3
 #define MII_M1111_HWCFG_MODE_SGMII_NO_CLK	0x4
+#define MII_M1111_HWCFG_MODE_COPPER_RTBI	0x9
 #define MII_M1111_HWCFG_FIBER_COPPER_AUTO	0x8000
 #define MII_M1111_HWCFG_FIBER_COPPER_RES	0x2000
 
@@ -269,6 +270,43 @@ static int m88e1111_config_init(struct phy_device *phydev)
 			return err;
 	}
 
+	if (phydev->interface == PHY_INTERFACE_MODE_RTBI) {
+		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 | MII_M1111_HWCFG_FIBER_COPPER_RES);
+		temp |= 0x7 | MII_M1111_HWCFG_FIBER_COPPER_AUTO;
+		err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp);
+		if (err < 0)
+			return err;
+
+		/* soft reset */
+		err = phy_write(phydev, MII_BMCR, BMCR_RESET);
+		if (err < 0)
+			return err;
+		do
+			temp = phy_read(phydev, MII_BMCR);
+		while (temp & BMCR_RESET);
+
+		temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
+		if (temp < 0)
+			return temp;
+		temp &= ~(MII_M1111_HWCFG_MODE_MASK | MII_M1111_HWCFG_FIBER_COPPER_RES);
+		temp |= MII_M1111_HWCFG_MODE_COPPER_RTBI | MII_M1111_HWCFG_FIBER_COPPER_AUTO;
+		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;
-- 
1.6.4

  reply	other threads:[~2010-01-14  8:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-14  8:13 [PATCH 1/4] dts/mpc8569mds: Cleanup tbi phy to support rtbi Liu Yu
2010-01-14  8:13 ` [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode Liu Yu
2010-01-14  8:13   ` [PATCH 3/4] ucc_geth: update the tbi-phy setting Liu Yu
2010-01-14  8:13     ` Liu Yu [this message]
2010-01-14 16:20       ` [PATCH 4/4] phy: add RTBI mode for m88e1111 Kumar Gala
2010-01-15  2:49         ` Liu Yu-B13201
2010-01-21  9:18           ` David Miller
2010-02-01 22:00     ` [PATCH 3/4] ucc_geth: update the tbi-phy setting Grant Likely
2010-02-01 21:57   ` [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode Grant Likely
2010-02-02  5:57     ` Liu Yu-B13201
2010-02-01 21:46 ` [PATCH 1/4] dts/mpc8569mds: Cleanup tbi phy to support rtbi Grant Likely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263456799-3306-4-git-send-email-yu.liu@freescale.com \
    --to=yu.liu@freescale.com \
    --cc=davem@davemloft.net \
    --cc=galak@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).