mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [I2C] question on adapter design
@ 2006-05-19  8:42 moreau francis
  2006-05-19 10:23 ` Matti Aarnio
  0 siblings, 1 reply; 3+ messages in thread
From: moreau francis @ 2006-05-19  8:42 UTC (permalink / raw)
  To: linux-kernel

I'm about writing a I2C bus adapter driver and wondering if it worth
to use interrupt for transfering data on the bus or just polling is
good enough ?

My hardware has a 8 bytes fifo for both Tx/Rx. It can generates
an interrupt when Tx fifo is empty and Rx fifo is not empty, 
actually like any UARTs. My CPU speed is 96 Mhz.

Thanks for your advices

Francis



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

* Re: [I2C] question on adapter design
  2006-05-19  8:42 [I2C] question on adapter design moreau francis
@ 2006-05-19 10:23 ` Matti Aarnio
  2006-05-20 11:07   ` Re : " moreau francis
  0 siblings, 1 reply; 3+ messages in thread
From: Matti Aarnio @ 2006-05-19 10:23 UTC (permalink / raw)
  To: moreau francis; +Cc: linux-kernel

On Fri, May 19, 2006 at 08:42:45AM +0000, moreau francis wrote:
> I'm about writing a I2C bus adapter driver and wondering if it worth
> to use interrupt for transfering data on the bus or just polling is
> good enough ?
> 
> My hardware has a 8 bytes fifo for both Tx/Rx. It can generates
> an interrupt when Tx fifo is empty and Rx fifo is not empty, 
> actually like any UARTs. My CPU speed is 96 Mhz.

The I²C (TM Philips) -bus runs at 100 kHz or (high-speed one) at 400 kHz.
An eight bit byte goes thru it in 80 or 20 microseconds depending on used
speed.  If your interrupt processing considers it as medium level
priority and fills the Tx fifo with as much as is available (most I²C TX
sequences do fit inside the 8 byte fifo) and collects as much data as is
available in the Rx fifo, you should be well set.

Most notable detail there is, that you do have those (for I²C) huge FIFOs.
Another thing is (I haven't verified this) that I²C master controls the
bus clock, and can stop it temporarily, when Tx FIFO is empty, or Rx FIFO
is full.

> Thanks for your advices
> Francis

/Matti Aarnio

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

* Re : [I2C] question on adapter design
  2006-05-19 10:23 ` Matti Aarnio
@ 2006-05-20 11:07   ` moreau francis
  0 siblings, 0 replies; 3+ messages in thread
From: moreau francis @ 2006-05-20 11:07 UTC (permalink / raw)
  To: Matti Aarnio; +Cc: linux-kernel



>The I²C (TM Philips) -bus runs at 100 kHz or (high-speed one) at 400 kHz.
>An eight bit byte goes thru it in 80 or 20 microseconds depending on used
>speed.  If your interrupt processing considers it as medium level
>priority and fills the Tx fifo with as much as is available (most I²C TX
>sequences do fit inside the 8 byte fifo) and collects as much data as is
>available in the Rx fifo, you should be well set.

ok so most of I2C commands shouldn't last more than 160 us when bus 
runs at 400 khz, right ? If so, I'm not sure it worth to use interrupts because
an active polling would avoid context switch that is not negligible in that case.
Interrupts can be usefull if I2C transfers would be longer than 8 bytes...

>
>Most notable detail there is, that you do have those (for I²C) huge FIFOs.
>Another thing is (I haven't verified this) that I²C master controls the
>bus clock, and can stop it temporarily, when Tx FIFO is empty, or Rx FIFO
>is full.
>

Indeed, my controller can automatically stop the bus clock when Tx fifo is
empty or Rx fifo is full.


Francis



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

end of thread, other threads:[~2006-05-20 11:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-19  8:42 [I2C] question on adapter design moreau francis
2006-05-19 10:23 ` Matti Aarnio
2006-05-20 11:07   ` Re : " moreau francis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®