lkml.org 
[lkml]   [2011]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRE: [PATCH v5 3/4] drivers/i2c/busses/i2c-at91.c: add new driver
    Hi,

    Carsten Behling wrote on 2011-11-22:
    > +static void at91_twi_read_next_byte(struct at91_twi_dev *dev)
    > +{
    > + *dev->buf = at91_twi_read(dev, AT91_TWI_RHR) & 0xff;
    > +
    > + /* send stop if second but last byte has been read */
    > + if (--dev->buf_len == 1)
    > + at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_STOP);
    >
    >
    >
    > If dev->buf_len =1 at the beginning of a read transfer, a stop condition will
    > never be send.

    this case is already catched in at91_do_twi_transfer():

    + if (dev->msg->flags & I2C_M_RD) {
    + unsigned start_flags = AT91_TWI_START;
    +
    + /* if only one byte is to be read, immediately stop transfer */
    + if (dev->buf_len <= 1 && !(dev->msg->flags & I2C_M_RECV_LEN))
    + start_flags |= AT91_TWI_STOP;
    + at91_twi_write(dev, AT91_TWI_CR, start_flags);

    Thanks for reviewing,
    Niko



    \
     
     \ /
      Last update: 2011-11-22 17:29    [W:0.021 / U:1.364 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site