FAQ:[#6307] Deadlock error in i2c_bfin_twi.c(2010)

Document created by Aaronwu Employee on Sep 11, 2013
Version 1Show Document
  • View in full screen mode

[#6307] Deadlock error in i2c_bfin_twi.c

Submitted By: Morten Kvistgaard

Open Date

2010-10-25 04:24:40     Close Date

2010-10-25 22:05:33

Priority:

Medium     Assignee:

Nobody

Status:

Closed     Fixed In Release:

N/A

Found In Release:

snaps     Release:

Category:

Drivers     Board:

N/A

Processor:

ALL     Silicon Revision:

Is this bug repeatable?:

Yes     Resolution:

Out of Date

Uboot version or rev.:

    Toolchain version or rev.:

Newest release

App binary format:

N/A     

Summary: Deadlock error in i2c_bfin_twi.c

Details:

 

Well, it's not a real deadlock I guess, but here's the thing:

The Blackfin TWI driver starts all actions, with validating the busy state: (This happens for both the smbus and the plain_i2c)

File: uclinux-dist-trunk-svn-9855/linux-2.6.x/drivers/i2c/busses/i2c_bfin_twi.c

Line: 394

----------------------------------------------------------------------------------

     while (read_MASTER_STAT(iface) & BUSBUSY)

        yield();

----------------------------------------------------------------------------------

 

If you got some faulty hw (like we do), this loop will risk never ending. Resulting in a locked system, without possible recovery.

Being a sw person, I don't know much about TWI or I2C. But I suggest inserting the timeout, which already exists in the i2c adapter, in the above loop. Like so:

----------------------------------------------------------------------------------

    start_tick = jiffies;

    while (read_MASTER_STAT(iface) & BUSBUSY)

    {

        if((jiffies-start_tick) > adap->timeout) return -ETIMEDOUT;

        else yield();

    }

----------------------------------------------------------------------------------

 

Follow-ups

 

--- Sonic Zhang                                              2010-10-25 22:05:33

This has ready been fixed in SVN trunk and incoming 2010R1.

 

--- Morten Kvistgaard                                        2010-10-26 04:13:14

Indeed it has. Very nice.

 

 

 

    Files

    Changes

    Commits

    Dependencies

    Duplicates

    Associations

    Tags

 

File Name     File Type     File Size     Posted By

No Files Were Found

Attachments

    Outcomes