netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/1] phy/marvell: fix 88e1121 support
       [not found] <20101018214401.053486146@rtp-net.org>
@ 2010-10-18 21:44 ` Arnaud Patard
  2010-10-18 22:02   ` Cyril Chemparathy
  0 siblings, 1 reply; 7+ messages in thread
From: Arnaud Patard @ 2010-10-18 21:44 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Cyril Chemparathy

[-- Attachment #1: phy_marvell_fix_modes.patch --]
[-- Type: text/plain, Size: 1278 bytes --]

Commit c477d0447db08068a497e7beb892b2b2a7bff64b added support for RGMII
rx/tx delays except that it ends up clearing rx/tx delays bit for modes
differents that RGMII*ID. Due to this, ethernet is not working anymore
on my guruplug server +. This patch is fixing that.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Index: linux-2.6/drivers/net/phy/marvell.c
===================================================================
--- linux-2.6.orig/drivers/net/phy/marvell.c	2010-10-18 22:46:09.000000000 +0200
+++ linux-2.6/drivers/net/phy/marvell.c	2010-10-18 23:19:14.000000000 +0200
@@ -199,13 +199,13 @@
 	mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) &
 		MII_88E1121_PHY_MSCR_DELAY_MASK;
 
-	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
-		mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY |
-			 MII_88E1121_PHY_MSCR_TX_DELAY);
-	else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
+	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
 		mscr |= MII_88E1121_PHY_MSCR_RX_DELAY;
 	else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
 		mscr |= MII_88E1121_PHY_MSCR_TX_DELAY;
+	else
+		mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY |
+			 MII_88E1121_PHY_MSCR_TX_DELAY);
 
 	err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr);
 	if (err < 0)



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 1/1] phy/marvell: fix 88e1121 support
  2010-10-18 21:44 ` [patch 1/1] phy/marvell: fix 88e1121 support Arnaud Patard
@ 2010-10-18 22:02   ` Cyril Chemparathy
  2010-10-18 22:29     ` [patch 0/1] " Arnaud Patard
  0 siblings, 1 reply; 7+ messages in thread
From: Cyril Chemparathy @ 2010-10-18 22:02 UTC (permalink / raw)
  To: Arnaud Patard; +Cc: netdev@vger.kernel.org, David S. Miller

Hi,

On 10/18/2010 05:44 PM, Arnaud Patard wrote:
> Commit c477d0447db08068a497e7beb892b2b2a7bff64b added support for RGMII
> rx/tx delays except that it ends up clearing rx/tx delays bit for modes
> differents that RGMII*ID. Due to this, ethernet is not working anymore
> on my guruplug server +. This patch is fixing that.
> 
> Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
> Index: linux-2.6/drivers/net/phy/marvell.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/phy/marvell.c	2010-10-18 22:46:09.000000000 +0200
> +++ linux-2.6/drivers/net/phy/marvell.c	2010-10-18 23:19:14.000000000 +0200
> @@ -199,13 +199,13 @@
>  	mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) &
>  		MII_88E1121_PHY_MSCR_DELAY_MASK;
>  
> -	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
> -		mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY |
> -			 MII_88E1121_PHY_MSCR_TX_DELAY);
> -	else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
> +	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
>  		mscr |= MII_88E1121_PHY_MSCR_RX_DELAY;
>  	else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
>  		mscr |= MII_88E1121_PHY_MSCR_TX_DELAY;
> +	else
> +		mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY |
> +			 MII_88E1121_PHY_MSCR_TX_DELAY);
>  
>  	err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr);
>  	if (err < 0)

This doesn't look right.  This change makes it impossible to configure
the phy without interface delays, i.e., PHY_INTERFACE_MODE_RGMII ends up
behaving the same as PHY_INTERFACE_MODE_RGMII_ID.

I think the correct fix would be to modify guruplug's interface mode to
PHY_INTERFACE_MODE_RGMII_ID if both TX and RX side delays are desired.

Regards
Cyril.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [patch 0/1] Re: [patch 1/1] phy/marvell: fix 88e1121 support
  2010-10-18 22:02   ` Cyril Chemparathy
@ 2010-10-18 22:29     ` Arnaud Patard
  2010-10-18 22:29       ` Arnaud Patard
  0 siblings, 1 reply; 7+ messages in thread
From: Arnaud Patard @ 2010-10-18 22:29 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Cyril Chemparathy

>> @@ -199,13 +199,13 @@
>>  	mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) &
>>  		MII_88E1121_PHY_MSCR_DELAY_MASK;
>>  
>> -	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
>> -		mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY |
>> -			 MII_88E1121_PHY_MSCR_TX_DELAY);
>> -	else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
>> +	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
>>  		mscr |= MII_88E1121_PHY_MSCR_RX_DELAY;
>>  	else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
>>  		mscr |= MII_88E1121_PHY_MSCR_TX_DELAY;
>> +	else
>> +		mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY |
>> +			 MII_88E1121_PHY_MSCR_TX_DELAY);
>>  
>>  	err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr);
>>  	if (err < 0)
>
> This doesn't look right.  This change makes it impossible to configure
> the phy without interface delays, i.e., PHY_INTERFACE_MODE_RGMII ends up
> behaving the same as PHY_INTERFACE_MODE_RGMII_ID.
> 

ok. The other possibility is to modify the MII_88E1121_PHY_MSCR_REG regs
 only in RGMII_* case like for the 88e1111 case imho.
I'm sending a patch doing that right now.

Regards,
Arnaud





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [patch 1/1] phy/marvell: fix 88e1121 support
  2010-10-18 22:29     ` [patch 0/1] " Arnaud Patard
@ 2010-10-18 22:29       ` Arnaud Patard
  2010-10-19 10:52         ` Cyril Chemparathy
  2010-10-21 11:00         ` David Miller
  0 siblings, 2 replies; 7+ messages in thread
From: Arnaud Patard @ 2010-10-18 22:29 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Cyril Chemparathy, Arnaud Patard

[-- Attachment #1: phy_marvell_fix_modes.patch --]
[-- Type: text/plain, Size: 2052 bytes --]

Commit c477d0447db08068a497e7beb892b2b2a7bff64b added support for RGMII
rx/tx delays except that it ends up clearing rx/tx delays bit for modes
differents that RGMII*ID. Due to this, ethernet is not working anymore
on my guruplug server +. This patch is fixing that.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Index: linux-2.6/drivers/net/phy/marvell.c
===================================================================
--- linux-2.6.orig/drivers/net/phy/marvell.c	2010-10-18 22:46:09.000000000 +0200
+++ linux-2.6/drivers/net/phy/marvell.c	2010-10-19 00:20:22.000000000 +0200
@@ -196,20 +196,27 @@
 			MII_88E1121_PHY_MSCR_PAGE);
 	if (err < 0)
 		return err;
-	mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) &
-		MII_88E1121_PHY_MSCR_DELAY_MASK;
 
-	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
-		mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY |
-			 MII_88E1121_PHY_MSCR_TX_DELAY);
-	else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
-		mscr |= MII_88E1121_PHY_MSCR_RX_DELAY;
-	else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
-		mscr |= MII_88E1121_PHY_MSCR_TX_DELAY;
+	if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
+	    (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
+	    (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
+	    (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) {
 
-	err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr);
-	if (err < 0)
-		return err;
+		mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) &
+			MII_88E1121_PHY_MSCR_DELAY_MASK;
+
+		if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
+			mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY |
+				 MII_88E1121_PHY_MSCR_TX_DELAY);
+		else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
+			mscr |= MII_88E1121_PHY_MSCR_RX_DELAY;
+		else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
+			mscr |= MII_88E1121_PHY_MSCR_TX_DELAY;
+
+		err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr);
+		if (err < 0)
+			return err;
+	}
 
 	phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage);
 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 1/1] phy/marvell: fix 88e1121 support
  2010-10-18 22:29       ` Arnaud Patard
@ 2010-10-19 10:52         ` Cyril Chemparathy
  2010-10-19 11:49           ` Arnaud Patard
  2010-10-21 11:00         ` David Miller
  1 sibling, 1 reply; 7+ messages in thread
From: Cyril Chemparathy @ 2010-10-19 10:52 UTC (permalink / raw)
  To: Arnaud Patard; +Cc: netdev@vger.kernel.org, David S. Miller

Hi Arnaud,

On 10/18/2010 06:29 PM, Arnaud Patard wrote:
> Commit c477d0447db08068a497e7beb892b2b2a7bff64b added support for RGMII
> rx/tx delays except that it ends up clearing rx/tx delays bit for modes
> differents that RGMII*ID. Due to this, ethernet is not working anymore
> on my guruplug server +. This patch is fixing that.
> 
> Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
> Index: linux-2.6/drivers/net/phy/marvell.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/phy/marvell.c	2010-10-18 22:46:09.000000000 +0200
> +++ linux-2.6/drivers/net/phy/marvell.c	2010-10-19 00:20:22.000000000 +0200
> @@ -196,20 +196,27 @@
>  			MII_88E1121_PHY_MSCR_PAGE);
>  	if (err < 0)
>  		return err;
> -	mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) &
> -		MII_88E1121_PHY_MSCR_DELAY_MASK;
>  
> -	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
> -		mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY |
> -			 MII_88E1121_PHY_MSCR_TX_DELAY);
> -	else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
> -		mscr |= MII_88E1121_PHY_MSCR_RX_DELAY;
> -	else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
> -		mscr |= MII_88E1121_PHY_MSCR_TX_DELAY;
> +	if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
> +	    (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
> +	    (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
> +	    (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) {
>  
> -	err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr);
> -	if (err < 0)
> -		return err;
> +		mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) &
> +			MII_88E1121_PHY_MSCR_DELAY_MASK;
> +
> +		if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
> +			mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY |
> +				 MII_88E1121_PHY_MSCR_TX_DELAY);
> +		else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
> +			mscr |= MII_88E1121_PHY_MSCR_RX_DELAY;
> +		else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
> +			mscr |= MII_88E1121_PHY_MSCR_TX_DELAY;
> +
> +		err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr);
> +		if (err < 0)
> +			return err;
> +	}
>  
>  	phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage);

That looks more correct.  Just out of curiosity, what is the interface
mode on your platform?

Thanks
Cyril.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 1/1] phy/marvell: fix 88e1121 support
  2010-10-19 10:52         ` Cyril Chemparathy
@ 2010-10-19 11:49           ` Arnaud Patard
  0 siblings, 0 replies; 7+ messages in thread
From: Arnaud Patard @ 2010-10-19 11:49 UTC (permalink / raw)
  To: cyril; +Cc: netdev@vger.kernel.org, David S. Miller

Cyril Chemparathy <cyril@ti.com> writes:

> Hi Arnaud,

Hi,

>
> On 10/18/2010 06:29 PM, Arnaud Patard wrote:
>> Commit c477d0447db08068a497e7beb892b2b2a7bff64b added support for RGMII
>> rx/tx delays except that it ends up clearing rx/tx delays bit for modes
>> differents that RGMII*ID. Due to this, ethernet is not working anymore
>> on my guruplug server +. This patch is fixing that.
>> 
>> Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
>> Index: linux-2.6/drivers/net/phy/marvell.c
>> ===================================================================
>> --- linux-2.6.orig/drivers/net/phy/marvell.c	2010-10-18 22:46:09.000000000 +0200
>> +++ linux-2.6/drivers/net/phy/marvell.c	2010-10-19 00:20:22.000000000 +0200
>> @@ -196,20 +196,27 @@
>>  			MII_88E1121_PHY_MSCR_PAGE);
>>  	if (err < 0)
>>  		return err;
>> -	mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) &
>> -		MII_88E1121_PHY_MSCR_DELAY_MASK;
>>  
>> -	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
>> -		mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY |
>> -			 MII_88E1121_PHY_MSCR_TX_DELAY);
>> -	else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
>> -		mscr |= MII_88E1121_PHY_MSCR_RX_DELAY;
>> -	else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
>> -		mscr |= MII_88E1121_PHY_MSCR_TX_DELAY;
>> +	if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
>> +	    (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
>> +	    (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
>> +	    (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) {
>>  
>> -	err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr);
>> -	if (err < 0)
>> -		return err;
>> +		mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) &
>> +			MII_88E1121_PHY_MSCR_DELAY_MASK;
>> +
>> +		if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
>> +			mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY |
>> +				 MII_88E1121_PHY_MSCR_TX_DELAY);
>> +		else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
>> +			mscr |= MII_88E1121_PHY_MSCR_RX_DELAY;
>> +		else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
>> +			mscr |= MII_88E1121_PHY_MSCR_TX_DELAY;
>> +
>> +		err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr);
>> +		if (err < 0)
>> +			return err;
>> +	}
>>  
>>  	phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage);
>
> That looks more correct.  Just out of curiosity, what is the interface
> mode on your platform?

The interface is in GMII mode iirc. The device is the ethernet embedded
in the Kirkwood SoC with a 88e1121 phy connected. It's handled by the
mv643xx_eth driver and the marvell phy driver.

Arnaud

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 1/1] phy/marvell: fix 88e1121 support
  2010-10-18 22:29       ` Arnaud Patard
  2010-10-19 10:52         ` Cyril Chemparathy
@ 2010-10-21 11:00         ` David Miller
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2010-10-21 11:00 UTC (permalink / raw)
  To: arnaud.patard; +Cc: netdev, cyril

From: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org>
Date: Tue, 19 Oct 2010 00:29:48 +0200

> Commit c477d0447db08068a497e7beb892b2b2a7bff64b added support for RGMII
> rx/tx delays except that it ends up clearing rx/tx delays bit for modes
> differents that RGMII*ID. Due to this, ethernet is not working anymore
> on my guruplug server +. This patch is fixing that.
> 
> Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>

Applied, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-10-21 10:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20101018214401.053486146@rtp-net.org>
2010-10-18 21:44 ` [patch 1/1] phy/marvell: fix 88e1121 support Arnaud Patard
2010-10-18 22:02   ` Cyril Chemparathy
2010-10-18 22:29     ` [patch 0/1] " Arnaud Patard
2010-10-18 22:29       ` Arnaud Patard
2010-10-19 10:52         ` Cyril Chemparathy
2010-10-19 11:49           ` Arnaud Patard
2010-10-21 11:00         ` David Miller

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).