2008-01-17 13:05:05     SPORT w/o DMA and w/o DITFS

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

2008-01-17 13:05:05     SPORT w/o DMA and w/o DITFS

Jim Lee (UNITED STATES)

Message: 49755    Has anyone gotten the SPORT interface to work _without_ DMA and _without_ setting that data independent frame sync (DITFS) bit?

 

I don't need DMA, and I'd like to conserve DMA channels for peripherals that need it.

 

I want to send a single 64 bit (32 bit primary, 32 bit secondary) message.  When DITFS is set, the message comes out, but it also comes out again and again.  The xfer time for the 64 bit message is on the scale of usecs and when DITFS is set, we send the same message over and over for msec.  (See attached jpegs from my logic analyzer.)

 

When DITFS is not set, the message comes out (only once, as I wish), but the code hangs in the driver (../drivers/char/bfin_sport.c) on the line:

 

wait_event_interruptible(dev->waitq, dev->wait_con );

 

I eventually get :

 

..d.tb e fxore TSPEN copy<3>BUG: soft lockup detected on CPU#0!

 

PC: 00594124  Status: 33566757  SysStatus: 0000  RETS: 00021300

A0.x: 00000000  A0.w: 00000000  A1.x: 00000000  A1.w: 00000000

P0: 00164ab8  P1: 01623600  P2: 0009103c  P3: 0162367c

P4: 00000011  P5: 01537ca0

R0: 00000004  R1: 00000004  R2: 00219ac4  R3: 00000011

R4: 00219ac4  R5: 00000011  R6: 00000000  R7: 04000000

 

 

I think this is a race condition; my guess is the xfer has already finished before wait_event_interruptible starts looking.

Is there a safe workaround?

 

Thx.

Jim

 

Just for completeness, when I use DMA and I turn off DITFS, I can get just the data I want out (i.e. one 8 byte message and no "extra" frame sync pulses, no extra words).  But I had to comment out the test for TUVF (underflow) to avoid blocking forever on line :

 

while (!(status & TUVF))

 

Life would be fine but for the fact that I don't need DMA and don't have extra channels to spare.

keepsTalking.jpg

whatIwant.jpg

QuoteReplyEditDelete

 

 

2008-01-18 17:04:55     Re: SPORT w/o DMA and w/o DITFS

Robin Getz (UNITED STATES)

Message: 49817   

Jim:

 

This sounds like a bug in that driver - I don't think it is a quick 10 min fix - someone else will need to have a detailed look.

 

Can you add this to the bug tracker, so it doesn't get lost?

 

Thanks

-Robin

QuoteReplyEditDelete

 

 

2008-01-18 20:04:12     Re: SPORT w/o DMA and w/o DITFS

Jim Lee (UNITED STATES)

Message: 49823    Hi Robin,

 

I will do some more testing to make sure I'm not doing something stupid.

 

If I'm not, I'll post the bug.

 

Jim

QuoteReplyEditDelete

 

 

2008-01-30 16:50:55     Re: SPORT w/o DMA and w/o DITFS

Jim Lee (UNITED STATES)

Message: 50403    It appears the problem was in the function

 

static irqreturn_t sport_tx_handler(int irq, void *dev_id, struct pt_regs *regs)

 

The function never clears the tx enable bit (TSPEN).  Also, it doesn't handle the queue wait condition.

 

Copying these lines from the dma version of the tx function seem to make things happy with DITFS low and DMA off.

 

    dev->regs->tcr1 &= ~TSPEN;

    __builtin_bfin_ssync();

    dev->wait_con = 1;

    wake_up(&dev->waitq);

 

 

Robin:

 

I'll post the bug and this suggested fix to the bug board.

 

Jim

Attachments

    Outcomes