Skip to contentSkip to conversation

MPC5200 FEC MII speed register

PATCH New Jon 3 participants 5 messages Mar 11, 2009 – Mar 13, 2009 Network drivers

lore
Share & tools
lore

Jon

author
#0 lore raw

PATCH 1/1 MPC5200 FEC MII speed register

From: Jon Smirl <[email protected]>

Set a non-zero speed in the MII register so that MII commands will work.

---
 drivers/net/mpc5xxx_fec.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
drivers/net/mpc5xxx_fec.c +16 -7
index 89e91c3..1876b76 100644
@@ -285,13 +285,6 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
 	}
 
 	fec->eth->x_cntrl = 0x00000000;	/* half-duplex, heartbeat disabled */
-	if (fec->xcv_type != SEVENWIRE) {
-		/*
-		 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
-		 * and do not drop the Preamble.
-		 */
-		fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
-	}
 
 	/*
 	 * Set Opcode/Pause Duration Register
@@ -649,6 +642,15 @@ static void mpc5xxx_fec_halt(struct eth_device *dev)
 	 */
 	udelay(10);
 
+	/* don't leave the MII speed set to zero */
+	if (fec->xcv_type != SEVENWIRE) {
+		/*
+		 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
+		 * and do not drop the Preamble.
+		 */
+		fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
+	}
+
 #if (DEBUG & 0x3)
 	printf("Ethernet task stopped\n");
 #endif
@@ -906,6 +908,13 @@ int mpc5xxx_fec_initialize(bd_t * bis)
 #else
 #error fec->xcv_type not initialized.
 #endif
+	if (fec->xcv_type != SEVENWIRE) {
+		/*
+		 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
+		 * and do not drop the Preamble.
+		 */
+		fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
+	}
 
 	dev->priv = (void *)fec;
 	dev->iobase = MPC5XXX_FEC;
author
#1 lore raw

PATCH 1/1 MPC5200 FEC MII speed register

Quoted 1 line · Jon

From: Jon Smirl <[email protected]>

Who's the maintainer for the mpc5200 core code? It isn't clear from the MAINTAINERS file.

Quoted 57 lines

Set a non-zero speed in the MII register so that MII commands will work.

---
?drivers/net/mpc5xxx_fec.c | ? 23 ++++++++++++++++------- ?1 files changed, 16 insertions(+), 7 deletions(-)

drivers/net/mpc5xxx_fec.c +0 -0
index 89e91c3..1876b76 100644
@@ -285,13 +285,6 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
 ? ? ? ?}
 

? ? ? ?fec->eth->x_cntrl = 0x00000000; /* half-duplex, heartbeat disabled */
- ? ? ? if (fec->xcv_type != SEVENWIRE) {
- ? ? ? ? ? ? ? /*
- ? ? ? ? ? ? ? ?* Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
- ? ? ? ? ? ? ? ?* and do not drop the Preamble.
- ? ? ? ? ? ? ? ?*/
- ? ? ? ? ? ? ? fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
- ? ? ? }

? ? ? ?/*
? ? ? ? * Set Opcode/Pause Duration Register

drivers/net/mpc5xxx_fec.c +0 -0
@@ -649,6 +642,15 @@ static void mpc5xxx_fec_halt(struct eth_device *dev)

? ? ? ? */
? ? ? ?udelay(10);

+ ? ? ? /* don't leave the MII speed set to zero */
+ ? ? ? if (fec->xcv_type != SEVENWIRE) {
+ ? ? ? ? ? ? ? /*
+ ? ? ? ? ? ? ? ?* Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
+ ? ? ? ? ? ? ? ?* and do not drop the Preamble.
+ ? ? ? ? ? ? ? ?*/
+ ? ? ? ? ? ? ? fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
+ ? ? ? }
+
?#if (DEBUG & 0x3)
? ? ? ?printf("Ethernet task stopped\n");
?#endif

drivers/net/mpc5xxx_fec.c +0 -0
@@ -906,6 +908,13 @@ int mpc5xxx_fec_initialize(bd_t * bis)

?#else
?#error fec->xcv_type not initialized.
?#endif
+ ? ? ? if (fec->xcv_type != SEVENWIRE) {
+ ? ? ? ? ? ? ? /*
+ ? ? ? ? ? ? ? ?* Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
+ ? ? ? ? ? ? ? ?* and do not drop the Preamble.
+ ? ? ? ? ? ? ? ?*/
+ ? ? ? ? ? ? ? fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
+ ? ? ? }

? ? ? ?dev->priv = (void *)fec;
? ? ? ?dev->iobase = MPC5XXX_FEC;

Signature · 2 lines
Jon Smirl
jonsmirl at gmail.com
#2 lore raw

PATCH 1/1 MPC5200 FEC MII speed register

Dear Jon Smirl,

Quoted 5 lines · In message <[email protected]> you…
Quoted 1 line · Jon

From: Jon Smirl <[email protected]>

Who's the maintainer for the mpc5200 core code? It isn't clear from the MAINTAINERS file.

If in doubt, contact the respective custodian.

See http://www.denx.de/wiki/U-Boot/Custodians

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"It's when they say 2 + 2 = 5 that I begin to argue."    - Eric Pepke
author
#3 lore raw

PATCH 1/1 MPC5200 FEC MII speed register

In reply to Jon

John, could you please apply this.

Without this the MII commands don't work on any of the mpc5200 platforms. mpc5xxx_fec_halt() sets the mii speed register to zero it needs to left at a non-zero speed for the commands to function.

---------- Forwarded message ----------
From: Jon <[email protected]>
Date: Wed, Mar 11, 2009 at 3:08 PM
Subject: [PATCH] MPC5200 FEC MII speed register
To: u-boot at lists.denx.de

From: Jon Smirl <[email protected]>

Set a non-zero speed in the MII register so that MII commands will work.

---
?drivers/net/mpc5xxx_fec.c | ? 23 ++++++++++++++++------- ?1 files changed, 16 insertions(+), 7 deletions(-)

drivers/net/mpc5xxx_fec.c +0 -0
index 89e91c3..1876b76 100644
@@ -285,13 +285,6 @@ static int mpc5xxx_fec_init(struct eth_device

*dev, bd_t * bis)
? ? ? ?}

? ? ? ?fec->eth->x_cntrl = 0x00000000; /* half-duplex, heartbeat disabled */
- ? ? ? if (fec->xcv_type != SEVENWIRE) {
- ? ? ? ? ? ? ? /*
- ? ? ? ? ? ? ? ?* Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
- ? ? ? ? ? ? ? ?* and do not drop the Preamble.
- ? ? ? ? ? ? ? ?*/
- ? ? ? ? ? ? ? fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
- ? ? ? }

? ? ? ?/*
? ? ? ? * Set Opcode/Pause Duration Register
@@ -649,6 +642,15 @@ static void mpc5xxx_fec_halt(struct eth_device *dev) ? ? ? ? */
? ? ? ?udelay(10);

+ ? ? ? /* don't leave the MII speed set to zero */
+ ? ? ? if (fec->xcv_type != SEVENWIRE) {
+ ? ? ? ? ? ? ? /*
+ ? ? ? ? ? ? ? ?* Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
+ ? ? ? ? ? ? ? ?* and do not drop the Preamble.
+ ? ? ? ? ? ? ? ?*/
+ ? ? ? ? ? ? ? fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
+ ? ? ? }
+
?#if (DEBUG & 0x3)
? ? ? ?printf("Ethernet task stopped\n");
?#endif
@@ -906,6 +908,13 @@ int mpc5xxx_fec_initialize(bd_t * bis) ?#else
?#error fec->xcv_type not initialized.
?#endif
+ ? ? ? if (fec->xcv_type != SEVENWIRE) {
+ ? ? ? ? ? ? ? /*
+ ? ? ? ? ? ? ? ?* Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
+ ? ? ? ? ? ? ? ?* and do not drop the Preamble.
+ ? ? ? ? ? ? ? ?*/
+ ? ? ? ? ? ? ? fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
+ ? ? ? }

? ? ? ?dev->priv = (void *)fec;
? ? ? ?dev->iobase = MPC5XXX_FEC;

Signature · 2 lines
Jon Smirl
jonsmirl at gmail.com
#4 lore raw

PATCH 1/1 MPC5200 FEC MII speed register

Quoted 72 lines · Jon Smirl

John, could you please apply this.

Without this the MII commands don't work on any of the mpc5200 platforms. mpc5xxx_fec_halt() sets the mii speed register to zero it needs to left at a non-zero speed for the commands to function.

---------- Forwarded message ----------
From: Jon <[email protected]>
Date: Wed, Mar 11, 2009 at 3:08 PM
Subject: [PATCH] MPC5200 FEC MII speed register
To: u-boot at lists.denx.de

From: Jon Smirl <[email protected]>

Set a non-zero speed in the MII register so that MII commands will work.

---
 drivers/net/mpc5xxx_fec.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
drivers/net/mpc5xxx_fec.c +0 -6
index 89e91c3..1876b76 100644
@@ -285,13 +285,6 @@ static int mpc5xxx_fec_init(struct eth_device
 *dev, bd_t * bis)
       }
 
       fec->eth->x_cntrl = 0x00000000; /* half-duplex, heartbeat disabled */
-       if (fec->xcv_type != SEVENWIRE) {
-               /*
-                * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
-                * and do not drop the Preamble.
-                */
-               fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) <<

1); /* No MII for 7-wire mode */

drivers/net/mpc5xxx_fec.c +7 -1
-       }
 
       /*
        * Set Opcode/Pause Duration Register
@@ -649,6 +642,15 @@ static void mpc5xxx_fec_halt(struct eth_device *dev)
        */
       udelay(10);
 
+       /* don't leave the MII speed set to zero */
+       if (fec->xcv_type != SEVENWIRE) {
+               /*
+                * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
+                * and do not drop the Preamble.
+                */
+               fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) <<

1); /* No MII for 7-wire mode */

drivers/net/mpc5xxx_fec.c +8 -0
+       }
+
 #if (DEBUG & 0x3)
       printf("Ethernet task stopped\n");
 #endif
@@ -906,6 +908,13 @@ int mpc5xxx_fec_initialize(bd_t * bis)
 #else
 #error fec->xcv_type not initialized.
 #endif
+       if (fec->xcv_type != SEVENWIRE) {
+               /*
+                * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
+                * and do not drop the Preamble.
+                */
+               fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) <<

1); /* No MII for 7-wire mode */
+ }

Quoted 7 lines
       dev->priv = (void *)fec;
       dev->iobase = MPC5XXX_FEC;

done