Hi,

after I solved the startup problem I could now investigate another
thing.

>From time to time, I have problems with some drivers (namely QSPI
in interrupt mode and my self-hacked I2C driver in interrupt mode)
getting stuck when sleeping on a waitqueue. This happens on an
MCF5373L, using the code for MCF532x as they are compatible except
the additional devices on MCF532x.

In my I2C driver, the code is the following:

static
irqreturn_t coldfire_i2c_interrupt(int irq, void *dev_id)
{
        /* check if we are called with the correct IRQ number */
        if(irq != (MCFINT_VECBASE + MCFINT_I2C))
          return IRQ_NONE;

        /* check if I2C int flag is set and send the event to waiting queue */
        if(*MCF_I2C_I2SR & MCF_I2C_I2SR_IIF) {
                *MCF_I2C_I2SR &= ~MCF_I2C_I2SR_IIF;
                atomic_set(&coldfire_i2c_irq_happened, 1);
                wake_up_interruptible(&coldfire_i2c_queue);
        }
        return IRQ_HANDLED;
}

static int coldfire_wait_transfer(void) {

        int timeout;

        /* wait for data transfer to complete */
        timeout = wait_event_interruptible_timeout(coldfire_i2c_queue,
                                                   1 == 
atomic_read(&coldfire_i2c_irq_happened),
                                                   COLDFIRE_I2C_TIMEOUT);

        if ((timeout <= 0 ) || (*MCF_I2C_I2SR & MCF_I2C_I2SR_IAL)) {
                printk("wt: timeout = %d, I2SR = %x\n, ih = %d",timeout, 
*MCF_I2C_I2SR, atomic_read(&coldfire_i2c_irq_happened));
                return -1;
        }
        else {
                atomic_set(&coldfire_i2c_irq_happened, 0);
                return 0;
        }
};

>From time to time, the timeout happens and I get the message:

wt: timeout = 0, I2SR = a0, ih = 1

So obviously the interrupt happens and is correctly handled, but the
waitqueue is not awoken.

Did anybody else experience such a problem, or is it again something
peculiar to my setup?

Thank you and best regards,
Wolfgang

PS: of course I can post the complete I2C driver code, but I think
I messed up support for older processors while integrating the
interrupt stuff...
In case somebody is interested in it, feel free to grab it at
http://leila.dyna.ping.de/wolfgang/i2c-mcf.c
http://leila.dyna.ping.de/wolfgang/i2c-mcf.h

_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to