summaryrefslogtreecommitdiffstats
path: root/drivers/eeprom
diff options
context:
space:
mode:
authorTrent Piepho <tpiepho@kymetacorp.com>2015-11-23 23:40:53 +0000
committerSascha Hauer <s.hauer@pengutronix.de>2015-11-26 09:05:59 +0100
commitf9c9550b8dd397363af8ed5a41f65eb89bf4ca8e (patch)
tree43b2817648eb5ec74abc9e1e5334c470edfb9899 /drivers/eeprom
parentb097f7b9100a812d61c904d1211686e08fb00bd2 (diff)
downloadbarebox-f9c9550b8dd397363af8ed5a41f65eb89bf4ca8e.tar.gz
barebox-f9c9550b8dd397363af8ed5a41f65eb89bf4ca8e.tar.xz
eeprom: Add support for 24c1025 EEPROM
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@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/eeprom')
-rw-r--r--drivers/eeprom/at24.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/eeprom/at24.c b/drivers/eeprom/at24.c
index 76f30e7e22..06e94ad8fc 100644
--- a/drivers/eeprom/at24.c
+++ b/drivers/eeprom/at24.c
@@ -84,7 +84,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)
@@ -113,6 +115,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 */ }
};
@@ -460,11 +463,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;
}