Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver

2014-11-26 Thread Wolfram Sang
On Wed, Nov 26, 2014 at 03:25:29PM +0300, Alexander Kochetkov wrote: > > 22 нояб. 2014 г., в 21:12, Wolfram Sang написал(а): > > > IMO a repeated start is to ensure that two messages arrive at the slave > > without interruption from another master. I can't think why a slave > > should know which

Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver

2014-11-26 Thread Alexander Kochetkov
22 нояб. 2014 г., в 21:12, Wolfram Sang написал(а): > IMO a repeated start is to ensure that two messages arrive at the slave > without interruption from another master. I can't think why a slave > should know which type of start that was. In fact, if it does that would > raise an eyebrow for me

Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver

2014-11-26 Thread Wolfram Sang
> My bad, will minimize the overhead in the future. Thanks! > I think usable semantics could be that a slave driver can indicate at any > point during an I2C read transaction that the next X bytes should be > returned from a buffer and for a write transaction, that the next X bytes > should be b

Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver

2014-11-25 Thread Stijn Devriendt
On Sat, Nov 22, 2014 at 7:12 PM, Wolfram Sang wrote: > Hi, > > Please quote only relevant parts of the message (like I did). This > improves readability a lot. > My bad, will minimize the overhead in the future. >> >> Would it make sense to have: >> WRITE_START >> WRITE_NEXT >> WRITE_STOP >> WRI

Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver

2014-11-24 Thread Wolfram Sang
> > > When the eeprom driver is probed and the adapter driver notices a read > > > request for the respective i2c address, this callback is called with > > > event=I2C_SLAVE_REQ_READ_START. Returning 0 here and provide the first > > > byte to send make the adapter ack the read request and send the

Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver

2014-11-23 Thread Uwe Kleine-König
Hello Wolfram, On Sat, Nov 22, 2014 at 07:26:30PM +0100, Wolfram Sang wrote: > > > this mail is thematically more a reply to patch 1 and maybe just serves > > my understanding of the slave support. > > Sure. This shows how badly needed the documentation is :) > > ... > > > + break; > >

Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver

2014-11-23 Thread Uwe Kleine-König
Hallo Wolfram, On Sat, Nov 22, 2014 at 07:14:06PM +0100, Wolfram Sang wrote: > > > > + case I2C_SLAVE_REQ_READ_END: > > > > + eeprom->buffer_idx++; > > > You don't check here for buffer_idx >= ARRAY_SIZE(buffer)? > > > Ditto in the I2C_SLAVE_REQ_WRITE_END case. > > I just notic

Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver

2014-11-22 Thread Wolfram Sang
> this mail is thematically more a reply to patch 1 and maybe just serves > my understanding of the slave support. Sure. This shows how badly needed the documentation is :) ... > > + break; > > + > > + case I2C_SLAVE_STOP: > > + eeprom->first_write = true; > > + b

Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver

2014-11-22 Thread Wolfram Sang
Hi Uwe, please don't quote so much :) > > > + case I2C_SLAVE_REQ_READ_END: > > > + eeprom->buffer_idx++; > > You don't check here for buffer_idx >= ARRAY_SIZE(buffer)? > > Ditto in the I2C_SLAVE_REQ_WRITE_END case. > I just noticed that buffer_idx is an u8, so it overflows at 255+1. So >

Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver

2014-11-22 Thread Wolfram Sang
Hi, Please quote only relevant parts of the message (like I did). This improves readability a lot. > > +static int i2c_slave_eeprom_slave_cb(struct i2c_client *client, > > +enum i2c_slave_event event, u8 *val) > > +{ > > + struct eeprom_data *eeprom = i2c

Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver

2014-11-21 Thread Uwe Kleine-König
On Fri, Nov 21, 2014 at 08:19:41AM +0100, Uwe Kleine-König wrote: > Hello Wolfram, > > this mail is thematically more a reply to patch 1 and maybe just serves > my understanding of the slave support. > > On Tue, Nov 18, 2014 at 05:04:54PM +0100, Wolfram Sang wrote: > > From: Wolfram Sang > > >

Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver

2014-11-20 Thread Uwe Kleine-König
Hello Wolfram, this mail is thematically more a reply to patch 1 and maybe just serves my understanding of the slave support. On Tue, Nov 18, 2014 at 05:04:54PM +0100, Wolfram Sang wrote: > From: Wolfram Sang > > The first user of the i2c-slave interface is an eeprom simulator. It is > a shared

Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver

2014-11-20 Thread Stijn Devriendt
On Tue, Nov 18, 2014 at 5:04 PM, Wolfram Sang wrote: > From: Wolfram Sang > > The first user of the i2c-slave interface is an eeprom simulator. It is > a shared memory which can be accessed by the remote master via I2C and > locally via sysfs. > > Signed-off-by: Wolfram Sang > --- > > Changes si

[PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver

2014-11-18 Thread Wolfram Sang
From: Wolfram Sang The first user of the i2c-slave interface is an eeprom simulator. It is a shared memory which can be accessed by the remote master via I2C and locally via sysfs. Signed-off-by: Wolfram Sang --- Changes since RFC: * fix build error for modules * don't hardcode size * add boun