linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* FEC_IEVENT_RFIFO_ERROR
@ 2005-03-03 13:14 Babarovic Ivica
  2005-03-03 15:08 ` FEC_IEVENT_RFIFO_ERROR Sylvain Munaut
  2005-03-03 16:59 ` FEC_IEVENT_RFIFO_ERROR Dale Farnsworth
  0 siblings, 2 replies; 8+ messages in thread
From: Babarovic Ivica @ 2005-03-03 13:14 UTC (permalink / raw)
  To: ppcembed; +Cc: tnt

Hi!

I run 2.6.10-rc2 kernel (http://www.246tNt.com/mpc52xx/)
for MPC5200 chip on a custom board that is almost lite5200 compatible.
I noticed a couple of times I have a strange error at bootup.
It was FEC_IEVENT_RFIFO_ERROR. Most of the times this
went trough without problems but since today system just hangs.
Sometimes with several printouts of this error.
---boot sequence ------
FEC_IEVENT_RFIFO_ERROR
FEC_IEVENT_RFIFO_ERROR
FEC_IEVENT_RFIFO_ERROR
....

I traced a problem a bit and found that this happenes at
mpc52xx_fec_probe() function in fec.c at this point:
-----------------------------------------------------------------------------------------
       /* Get the IRQ we need one by one */
                /* Control */
        dev->irq = ocp->def->irq;
-->       if (request_irq(dev->irq, &fec_interrupt, SA_INTERRUPT, 
                        "mpc52xx_fec_ctrl", dev)) {
                printk(KERN_ERR "mpc52xx_fec: ctrl interrupt request 
failed\n");
                ret = -EBUSY;
                dev->irq = -1;  /* Don't try to free it */
                goto probe_error;
        }
------------------------------------------------------------------------------------------

When fec_interrupt() is called also from fec.c.

------------------------------------------------------------------------------------------
static irqreturn_t fec_interrupt(int irq, void *dev_id, struct pt_regs 
*regs)
{
        struct net_device *dev = (struct net_device *)dev_id;
        struct fec_priv *priv = (struct fec_priv *)dev->priv;
        struct mpc52xx_fec *fec = priv->fec;
        int ievent;

        ievent = in_be32(&fec->ievent);
        out_be32(&fec->ievent, ievent);         /* clear pending events */

        if (ievent & (FEC_IEVENT_RFIFO_ERROR | FEC_IEVENT_XFIFO_ERROR)) {
                if (ievent & FEC_IEVENT_RFIFO_ERROR)
-->                        printk(KERN_WARNING "FEC_IEVENT_RFIFO_ERROR\n");
                if (ievent & FEC_IEVENT_XFIFO_ERROR)
                        printk(KERN_WARNING "FEC_IEVENT_XFIFO_ERROR\n");
                fec_reinit(dev);
        }
        else if (ievent & FEC_IEVENT_MII)
                fec_mii(dev);
        return IRQ_HANDLED;
}
-------------------------------------------------------------------------------------------------


This is what I found in MPC5200 Users Manual:
Receive FIFO Error--indicates error occurred within the forest green version
RX FIFO. When RFIFO_ERROR bit is set, ECNTRL.ETHER_EN is cleared,
halting FEC frame processing. When this occurs, software must ensure both
the FIFO Controller and BestComm are soft-reset.

Any ideas on what could be causing this?

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: FEC_IEVENT_RFIFO_ERROR
@ 2005-03-03 20:07 Babarovic Ivica
  0 siblings, 0 replies; 8+ messages in thread
From: Babarovic Ivica @ 2005-03-03 20:07 UTC (permalink / raw)
  To: linuxppc-embedded

Hi Sylvain, Dale and others!

Well, I went for a 5 minute walk to get some fresh air and gather my 
thoughts.
To put it shortly I'm mad as hell. I can't believe what a noob mistake 
I've made.
In one of my drivers I had a for loop that loops trough some IO range  
to discover
if hardware is there and instead  of  this for-expression  (i=0; i<31; 
i+=2), I wrote
this one (i=0; i<31; i=+2) . The difference is in =+ and += . Variable i 
never got
incremented past 2 and of course there was chaos because loop was 
running to infinity. :)
Function I was calling in 'infinite' runaway loop did some input and 
output with a custom
bus and read something from a GPIO register. Here it is:
--------------------------------------------------------------
static inline int ebus_echo(char * io)
{
       struct mpc52xx_gpio *gpio;
       volatile unsigned char dummy;

       gpio = (struct mpc52xx_gpio *)MPC52xx_GPIO;

       out_8(RESET_ECHO, 0);
       dummy=in_8(io);
       if (in_8(&gpio->sint_ival) & 0x02)
               return 1;
       return 0;
}
-----------------------------------------------------------------

This driver was initializing itself just before the NIC. I wonder how 
ethernet init
even started and got to the RFIFO part since there was an infinite loop 
running before it?
What a productive day I just had. A stupid typo cost me 12 hours of work 
and I have
nothing to show for. I apologize and I only hope something good comes 
out of this.

/me ducks

Best regards
I.


Sylvain Munaut wrote:

Hi

>
> I tried the patch you've sent and It's still the same.
> FEC_IEVENT_RFIFO_ERROR is still here.
> Can you/anyone think of something that I could do to make
> analyzing this problem easier?
>
Resetting the FEC early is a good thing so that patch should be there 
anyway, so we don't setup irq handlers for a hardware in unknow state.

However looking at fec code, there is another problem with it : The FEC 
is enabled in probe, once for all but the DMA tasks that should empty
the buffers are only enabled when the interface is up, so during it's 
down time, any received packed ends up in filling the FIFO ...

This problem goes away when the interface is up tough, so you should not 
experience 'crash' ... Do you nfs boot ? Try with a static image, just
to see, maybe having the error at boot screw something. If it doesn't 
boot with a static image then there is still another problem.


   Sylvain

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

end of thread, other threads:[~2005-03-03 20:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-03 13:14 FEC_IEVENT_RFIFO_ERROR Babarovic Ivica
2005-03-03 15:08 ` FEC_IEVENT_RFIFO_ERROR Sylvain Munaut
2005-03-03 15:52   ` FEC_IEVENT_RFIFO_ERROR Babarovic Ivica
2005-03-03 16:13   ` FEC_IEVENT_RFIFO_ERROR Babarovic Ivica
2005-03-03 16:59 ` FEC_IEVENT_RFIFO_ERROR Dale Farnsworth
2005-03-03 18:10   ` FEC_IEVENT_RFIFO_ERROR Babarovic Ivica
2005-03-03 19:11     ` FEC_IEVENT_RFIFO_ERROR Sylvain Munaut
  -- strict thread matches above, loose matches on Subject: below --
2005-03-03 20:07 FEC_IEVENT_RFIFO_ERROR Babarovic Ivica

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