[PATCH 1/2] eeprom: at24: added quirk for 24c08 devices
Brendan Higgins
brendanhiggins at google.com
Tue Aug 30 09:33:24 AEST 2016
Good call,
I guess this is probably something we do not want to apply to all 24C04
since the real ones probably work properly.
On Mon, Aug 29, 2016 at 4:24 PM Xo Wang <xow at google.com> wrote:
> On Sat, Aug 20, 2016 at 6:34 PM, Brendan Higgins
> <brendanhiggins at google.com> wrote:
> > Some 24c08 devices exhibits a quirk where they will not NACK durring an
>
> BTW, the I2C EEPROM on our AST2500 EVBs are actually generic clones of
> the 24C04, with 4K of storage. This isn't mentioned on the schematic,
> which is why the DTS for dev-4.7 shows a 24C08-compatible device.
>
> > acknowledge poll. Added a STOP after the dummy write to address problem.
> > ---
> > drivers/misc/eeprom/at24.c | 12 +++++++++++-
> > include/linux/platform_data/at24.h | 1 +
> > 2 files changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> > index 9ceb63b..c647efb 100644
> > --- a/drivers/misc/eeprom/at24.c
> > +++ b/drivers/misc/eeprom/at24.c
> > @@ -120,7 +120,11 @@ static const struct i2c_device_id at24_ids[] = {
> > AT24_FLAG_READONLY | AT24_FLAG_IRUGO) },
> > { "24c04", AT24_DEVICE_MAGIC(4096 / 8, 0) },
> > /* 24rf08 quirk is handled at i2c-core */
> > - { "24c08", AT24_DEVICE_MAGIC(8192 / 8, 0) },
> > + /* 24c08 exhibits a quirk where it will not NACK durring an
> > + * acknowledge poll so we have to send a stop after the dummy
> write in
> > + * a read.
> > + */
> > + { "24c08", AT24_DEVICE_MAGIC(8192 / 8, AT24_FLAG_STOPPOLL) },
> > { "24c16", AT24_DEVICE_MAGIC(16384 / 8, 0) },
> > { "24c32", AT24_DEVICE_MAGIC(32768 / 8, AT24_FLAG_ADDR16) },
> > { "24c64", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16) },
> > @@ -212,6 +216,12 @@ static ssize_t at24_eeprom_read(struct at24_data
> *at24, char *buf,
> > msgbuf[i++] = offset;
> >
> > msg[0].addr = client->addr;
> > + /*
> > + * Some EEPROMs do not perform the acknowledge poll
> correctly
> > + * and have to send a STOP after the dummy write.
> > + */
> > + if (at24->chip.flags & AT24_FLAG_STOPPOLL)
> > + msg[0].flags = I2C_M_STOP;
> > msg[0].buf = msgbuf;
> > msg[0].len = i;
> >
> > diff --git a/include/linux/platform_data/at24.h
> b/include/linux/platform_data/at24.h
> > index be830b1..1773822 100644
> > --- a/include/linux/platform_data/at24.h
> > +++ b/include/linux/platform_data/at24.h
> > @@ -47,6 +47,7 @@ struct at24_platform_data {
> > #define AT24_FLAG_READONLY 0x40 /* sysfs-entry will be read-only
> */
> > #define AT24_FLAG_IRUGO 0x20 /* sysfs-entry will be
> world-readable */
> > #define AT24_FLAG_TAKE8ADDR 0x10 /* take always 8 addresses
> (24c00) */
> > +#define AT24_FLAG_STOPPOLL 0x08 /* Send stop before ACK poll */
> >
> > void (*setup)(struct nvmem_device *nvmem, void
> *context);
> > void *context;
> > --
> > 2.8.0.rc3.226.g39d4020
> >
> > _______________________________________________
> > openbmc mailing list
> > openbmc at lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/openbmc
>
> cheers
> xo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20160829/e20b8d7e/attachment.html>
More information about the openbmc
mailing list