All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Bugfix: mpc512x_fec MII accesses fail after ethernet transfers
Date: Tue, 21 Jul 2009 00:48:04 -0700	[thread overview]
Message-ID: <4A6572B4.3080102@gmail.com> (raw)
In-Reply-To: <20090721074457.09CCE832E416@gemini.denx.de>

Wolfgang Denk wrote:
> 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 <Thomas.Doerfler@embedded-brains.de>
>>> --
>>> 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
>
>   
Yikes, sorry again.  I saw the one where you said 'thanks for the
explanation, I can reproduce...'

Better hold off on my pull request :)

On that note, I'm off to bed.  Hopefully the brain is better engaged 
tomorrow.

Ben

      parent reply	other threads:[~2009-07-21  7:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-19 15:35 [U-Boot] [PATCH] Bugfix: mpc512x_fec MII accesses fail after ethernet transfers Thomas Dörfler
2009-07-19 17:22 ` Wolfgang Denk
2009-07-19 17:51   ` Thomas Dörfler
2009-07-19 18:50     ` Wolfgang Denk
2009-07-19 19:26 ` Wolfgang Denk
2009-07-19 19:59   ` Thomas Dörfler
2009-07-23 19:29     ` Wolfgang Denk
2009-07-21  6:53 ` Ben Warren
2009-07-21  7:44   ` Wolfgang Denk
2009-07-21  7:46     ` Ben Warren
2009-07-21  7:48     ` Ben Warren [this message]

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=4A6572B4.3080102@gmail.com \
    --to=biggerbadderben@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.