This is the Microchip version of the Atmel 24c1024, which is already supported. The key difference between them is that the I2C address bit used to select between the two banks is bit 2 for the 1025 and not bit 0 as in the 1024. Add a flag to describe this difference. Signed-off-by: Trent Piepho <tpiepho@xxxxxxxxxxxxxx> --- drivers/eeprom/at24.c | 8 ++++++-- include/i2c/at24.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/eeprom/at24.c b/drivers/eeprom/at24.c index bb2dd53..9c322a9 100644 --- a/drivers/eeprom/at24.c +++ b/drivers/eeprom/at24.c @@ -80,7 +80,9 @@ static unsigned io_limit = 128; */ static unsigned write_timeout = 25; +/* number of bits in driver_data reserved for eeprom byte length */ #define AT24_SIZE_BYTELEN 5 +/* number of bits in driver_data reserved for flags */ #define AT24_SIZE_FLAGS 8 #define AT24_BITMASK(x) (BIT(x) - 1) @@ -109,6 +111,7 @@ static struct platform_device_id at24_ids[] = { { "24c256", AT24_DEVICE_MAGIC(262144 / 8, AT24_FLAG_ADDR16) }, { "24c512", AT24_DEVICE_MAGIC(524288 / 8, AT24_FLAG_ADDR16) }, { "24c1024", AT24_DEVICE_MAGIC(1048576 / 8, AT24_FLAG_ADDR16) }, + { "24c1025", AT24_DEVICE_MAGIC(1048576 / 8, AT24_FLAG_ADDR16 | AT24_FLAG_BANK_BIT_2) }, { "at24", 0 }, { /* END OF LIST */ } }; @@ -423,11 +426,12 @@ static int at24_probe(struct device_d *dev) /* use dummy devices for multiple-address chips */ for (i = 1; i < num_addresses; i++) { + const int shift = (chip.flags & AT24_FLAG_BANK_BIT_2) ? 2 : 0; at24->client[i] = i2c_new_dummy(client->adapter, - client->addr + i); + client->addr + (i << shift)); if (!at24->client[i]) { dev_err(&client->dev, "address 0x%02x unavailable\n", - client->addr + i); + client->addr + (i << shift)); err = -EADDRINUSE; goto err_clients; } diff --git a/include/i2c/at24.h b/include/i2c/at24.h index 1013308..44a64a0 100644 --- a/include/i2c/at24.h +++ b/include/i2c/at24.h @@ -30,6 +30,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_BANK_BIT_2 0x08 /* blank select at bit 2 (vs lsb) */ }; #endif /* _LINUX_AT24_H */ -- 1.8.3.1 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox