Re: [PATCH] i2c: omap: ensure writes to dev->buf_len are ordered

2012-10-27 Thread Santosh Shilimkar
On Saturday 27 October 2012 09:29 PM, Paul Walmsley wrote: On Sat, 27 Oct 2012, Santosh Shilimkar wrote: Another alternative, which I will recommend to just make use of the read*/wrire* instead __raw versions. The barriers are taken care already and driver point of view, it is transparent. Th

Re: [PATCH 7/8] i2c: add 'transferred' field to struct i2c_msg

2012-10-27 Thread Jean Delvare
Hi Al, On Sat, 27 Oct 2012 18:10:36 +0100, Al Viro wrote: > On Sat, Oct 27, 2012 at 06:02:35PM +0100, Al Viro wrote: > > On Sat, Oct 27, 2012 at 05:40:13PM +0100, Al Viro wrote: > > > > > You are wrong. Assumption that pointers are aligned to 32bit boundary > > > is simply not true. In particula

Re: [PATCH v2 7/7] i2c: omap: implement handling for 'transferred' bytes

2012-10-27 Thread Paul Walmsley
Hi On Thu, 25 Oct 2012, Felipe Balbi wrote: > this is important in cases where client driver > wants to know how many bytes were actually > transferred. > > There is one trick here: if transfer is completed, > meaning I2C_CNT reaches zero, then ARDY will be > asserted to let SW know that it can

Re: [PATCH 7/8] i2c: add 'transferred' field to struct i2c_msg

2012-10-27 Thread Russell King - ARM Linux
On Sat, Oct 27, 2012 at 04:32:24PM +0200, Jean Delvare wrote: > On Thu, 25 Oct 2012 15:18:00 +0100, Russell King - ARM Linux wrote: > > On Thu, Oct 25, 2012 at 03:56:33PM +0200, Jean Delvare wrote: > > > The original idea of using the hole in the i2c_msg structure is from > > > David Brownell, who

Re: [PATCH 7/8] i2c: add 'transferred' field to struct i2c_msg

2012-10-27 Thread Al Viro
On Sat, Oct 27, 2012 at 06:02:35PM +0100, Al Viro wrote: > On Sat, Oct 27, 2012 at 05:40:13PM +0100, Al Viro wrote: > > > You are wrong. Assumption that pointers are aligned to 32bit boundary > > is simply not true. In particular, on m68k alignment is 16bit, i.e. there > > struct foo { > > ch

Re: [PATCH 7/8] i2c: add 'transferred' field to struct i2c_msg

2012-10-27 Thread Al Viro
On Sat, Oct 27, 2012 at 05:40:13PM +0100, Al Viro wrote: > You are wrong. Assumption that pointers are aligned to 32bit boundary > is simply not true. In particular, on m68k alignment is 16bit, i.e. there > struct foo { > char x; > void *p; > }; will have 1 byte occupied by x, follow

Re: Q: i2c block write emulation / handling of i2c message size constraints of a bus ?

2012-10-27 Thread Frank Schäfer
Hi, Am 27.10.2012 18:50, schrieb Jean Delvare: > Hi Frank, > > On Sat, 27 Oct 2012 17:17:34 +0300, Frank Schäfer wrote: >> the i2c interface of my device is capable of writing 2 bytes (reg + >> data) and reading a single data byte only. > Are you talking about an I2C master (controller) here, or a

Re: [PATCH 7/8] i2c: add 'transferred' field to struct i2c_msg

2012-10-27 Thread Al Viro
On Sat, Oct 27, 2012 at 04:32:24PM +0200, Jean Delvare wrote: > On Thu, 25 Oct 2012 15:18:00 +0100, Russell King - ARM Linux wrote: > > On Thu, Oct 25, 2012 at 03:56:33PM +0200, Jean Delvare wrote: > > > The original idea of using the hole in the i2c_msg structure is from > > > David Brownell, who

Re: [PATCH] i2c: omap: ensure writes to dev->buf_len are ordered

2012-10-27 Thread Paul Walmsley
On Sat, 27 Oct 2012, Santosh Shilimkar wrote: > Another alternative, which I will recommend to just make use of the > read*/wrire* instead __raw versions. The barriers are taken care > already and driver point of view, it is transparent. Those barriers will disappear if CONFIG_ARM_DMA_MEM_BUFFERA

Re: Q: i2c block write emulation / handling of i2c message size constraints of a bus ?

2012-10-27 Thread Jean Delvare
Hi Frank, On Sat, 27 Oct 2012 17:17:34 +0300, Frank Schäfer wrote: > the i2c interface of my device is capable of writing 2 bytes (reg + > data) and reading a single data byte only. Are you talking about an I2C master (controller) here, or a slave device? > A block read/write emulation function

Q: i2c block write emulation / handling of i2c message size constraints of a bus ?

2012-10-27 Thread Frank Schäfer
Hi, the i2c interface of my device is capable of writing 2 bytes (reg + data) and reading a single data byte only. A block read/write emulation function would have to do an i2c write (to increase the register) followed by either an i2c read or write for each data byte. The question is now: does it

Re: [PATCH 7/8] i2c: add 'transferred' field to struct i2c_msg

2012-10-27 Thread Jean Delvare
On Thu, 25 Oct 2012 15:18:00 +0100, Russell King - ARM Linux wrote: > On Thu, Oct 25, 2012 at 03:56:33PM +0200, Jean Delvare wrote: > > The original idea of using the hole in the i2c_msg structure is from > > David Brownell, who was apparently familiar with such practice, so I > > assumed it was OK

Re: [PATCH] i2c: omap: ensure writes to dev->buf_len are ordered

2012-10-27 Thread Santosh Shilimkar
On Saturday 27 October 2012 04:31 AM, Paul Walmsley wrote: Hi Felipe just two quick comments On Thu, 25 Oct 2012, Felipe Balbi wrote: if we allow compiler reorder our writes, we could fall into a situation where dev->buf_len is reset for no apparent reason. This bug was found with a simple s