From: Wolfgang Denk Date: Tue, 21 Jul 2009 09:44:57 +0200 Subject: [U-Boot] [PATCH] Bugfix: mpc512x_fec MII accesses fail after ethernet transfers In-Reply-To: <4A6565D4.7050400@gmail.com> References: <4A633D5A.3060803@embedded-brains.de> <4A6565D4.7050400@gmail.com> Message-ID: <20090721074457.09CCE832E416@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Ben Warren, In message <4A6565D4.7050400@gmail.com> you wrote: > > Thomas D?rfler wrote: > > The mpc512x FEC network driver resets the FEC before transferring > > packets. With this reset, the FEC clears the previous setting of MII > > transfer speed. This patch ensures, that it is set again to a reasonable > > value after a FEC reset. > > > > Signed-off-by: Thomas Doerfler > > -- > > diff --git a/drivers/net/mpc512x_fec.c b/drivers/net/mpc512x_fec.c > > index fb2c19a..f3d76ba 100644 > > --- a/drivers/net/mpc512x_fec.c > > +++ b/drivers/net/mpc512x_fec.c > > @@ -446,6 +446,19 @@ static void mpc512x_fec_halt (struct eth_device *dev) > > * wait at least 16 clock cycles > > */ > > udelay (10); > > + /* > > + * NOTE: reset will also clear the MII speed register > > + * we should reinitialize it ASAP > > + */ > > + 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->ips_clk / 1000000) / 5) > > + + 1) > > + << 1); > > + } > > #if (DEBUG & 0x3) > > printf ("Ethernet task stopped\n"); > > #endif > > > Applied to net repo (after some tweaking) Sorry Ben, but I am not convinced that this is a good way to address the problem. Please see the previous discussion of this patch. I think it is perfectly reasonable that mpc512x_fec_halt() also disables the MII clock. After all, when the network intrface is stopped, there is no need that the clocks keep running and drawing current on battery powered devices. I'd rather see that the MII clock gets only started when needed, i. e. before running any MII commands. Best regards, Wolfgang Denk -- 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 I've already got a female to worry about. Her name is the Enterprise. -- Kirk, "The Corbomite Maneuver", stardate 1514.0