Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1364234 > unrolled thread

[PATCH 00/13] eeprom: support for at24cs and at24mac

Started byBartosz Golaszewski <bgolaszewski@baylibre.com>
First post2016-03-24 15:50 +0100
Last post2016-03-24 16:00 +0100
Articles 11 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/13] eeprom: support for at24cs and at24mac Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-03-24 15:50 +0100
    [PATCH 08/13] eeprom: at24: call read and write routines via function pointers Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-03-24 16:00 +0100
      Re: [PATCH 08/13] eeprom: at24: call read and write routines via  function pointers kbuild test robot <lkp@intel.com> - 2016-03-24 16:20 +0100
    [PATCH 13/13] eeprom: at24: add at24mac chips to the list of supported devices Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-03-24 16:00 +0100
    [PATCH 07/13] eeprom: at24: support reading of the serial number Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-03-24 16:00 +0100
    [PATCH 01/13] eeprom: at24: remove a reduntant if Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-03-24 16:00 +0100
    [PATCH 05/13] eeprom: at24: replace msleep() with usleep_range() Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-03-24 16:00 +0100
    [PATCH 12/13] eeprom: at24: add support for at24mac series Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-03-24 16:00 +0100
    [PATCH 09/13] eeprom: at24: use at24cs_serial_read() Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-03-24 16:00 +0100
    [PATCH 10/13] eeprom: at24: add the at24cs series to the list of supported devices Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-03-24 16:00 +0100
    [PATCH 11/13] eeprom: at24: add at24mac series flag Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-03-24 16:00 +0100

#1364234 — [PATCH 00/13] eeprom: support for at24cs and at24mac

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-03-24 15:50 +0100
Subject[PATCH 00/13] eeprom: support for at24cs and at24mac
Message-ID<rgeKe-3Y1-3@gated-at.bofh.it>
Chips from the at24cs EEPROM series have an additional read-only
memory area containing a factory pre-programmed serial number. In
order to access it, a dummy write must be executed before reading
the serial number bytes.

Chips from the at24mac familiy, apart from the serial number, have
a second special memory area containing a factory programmed
EUI-48/EUI64 mac address.

The read-only serial/mac memory area is accessible on a different i2c
slave address (addr + 0x08). This patchset makes it possible to
instantiate a separate at24 device on this second address and access
the read-only area through the regular eeprom sysfs attribute or the
new nvmem subsystem.

This series also contains several patches intoducing some minor tweaks
and refactoring.

Tested with at24cs32 and at24cs02 chips (for both 16 and 8 bit address
pointers). I have no means of testing the support for at24mac chips, I
relied solely on the datasheet.

Bartosz Golaszewski (13):
  eeprom: at24: remove a reduntant if
  eeprom: at24: improve the device_id table readability
  eeprom: at24: platform_data: use BIT() macro
  eeprom: at24: make locking more fine-grained
  eeprom: at24: replace msleep() with usleep_range()
  eeprom: at24: add serial number flag
  eeprom: at24: support reading of the serial number
  eeprom: at24: call read and write routines via function pointers
  eeprom: at24: use at24cs_serial_read()
  eeprom: at24: add the at24cs series to the list of supported devices
  eeprom: at24: add at24mac series flag
  eeprom: at24: add support for at24mac series
  eeprom: at24: add at24mac chips to the list of supported devices

 drivers/misc/eeprom/at24.c         | 200 ++++++++++++++++++++++++++++---------
 include/linux/platform_data/at24.h |  10 +-
 2 files changed, 161 insertions(+), 49 deletions(-)

-- 
2.7.4

[toc] | [next] | [standalone]


#1364236 — [PATCH 08/13] eeprom: at24: call read and write routines via function pointers

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-03-24 16:00 +0100
Subject[PATCH 08/13] eeprom: at24: call read and write routines via function pointers
Message-ID<rgeTT-42l-1@gated-at.bofh.it>
In reply to#1364234
In order to support non-standard read/write functions (as part of the
at24cs series support) introduce two function pointers in struct
at24_data to which different implementations can be assigned.

For now we continue to use the regular read/write routines by default.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/misc/eeprom/at24.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index a7d6c15..5b484bc 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -59,6 +59,9 @@ struct at24_data {
 	int use_smbus;
 	int use_smbus_write;
 
+	int (*read_func)(struct at24_data *, char *, loff_t, size_t);
+	int (*write_func)(struct at24_data *, const char *, loff_t, size_t);
+
 	u8 *writebuf;
 	struct mutex wrbuf_lock;
 	unsigned write_max;
@@ -458,7 +461,7 @@ static int at24_regmap_read(void *context, const void *reg, size_t reg_size,
 	off_t offset = *(u32 *)reg;
 	int err;
 
-	err = at24_read(at24, val, offset, val_size);
+	err = at24->read_func(at24, val, offset, val_size);
 	if (err)
 		return err;
 	return 0;
@@ -476,7 +479,7 @@ static int at24_regmap_write(void *context, const void *data, size_t count)
 	buf = (const char *)data + sizeof(offset);
 	len = count - sizeof(offset);
 
-	err = at24_write(at24, buf, offset, len);
+	err = at24->write_func(at24, buf, offset, len);
 	if (err)
 		return err;
 	return 0;
@@ -611,6 +614,9 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	at24->chip = chip;
 	at24->num_addresses = num_addresses;
 
+	at24->read_func = at24_read;
+	at24->write_func = at24_write;
+
 	writable = !(chip.flags & AT24_FLAG_READONLY);
 	if (writable) {
 		if (!use_smbus || use_smbus_write) {
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1364263 — Re: [PATCH 08/13] eeprom: at24: call read and write routines via function pointers

Fromkbuild test robot <lkp@intel.com>
Date2016-03-24 16:20 +0100
SubjectRe: [PATCH 08/13] eeprom: at24: call read and write routines via function pointers
Message-ID<rgfdg-4ss-9@gated-at.bofh.it>
In reply to#1364236

[Multipart message — attachments visible in raw view] — view raw

Hi Bartosz,

[auto build test ERROR on next-20160324]
[cannot apply to v4.5-rc7 v4.5-rc6 v4.5-rc5 v4.5]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Bartosz-Golaszewski/eeprom-support-for-at24cs-and-at24mac/20160324-230008
config: x86_64-randconfig-x012-201612 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/misc/eeprom/at24.c: In function 'at24_probe':
>> drivers/misc/eeprom/at24.c:617:18: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
     at24->read_func = at24_read;
                     ^
   drivers/misc/eeprom/at24.c:618:19: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
     at24->write_func = at24_write;
                      ^
   cc1: some warnings being treated as errors

vim +617 drivers/misc/eeprom/at24.c

   611		mutex_init(&at24->wrbuf_lock);
   612		at24->use_smbus = use_smbus;
   613		at24->use_smbus_write = use_smbus_write;
   614		at24->chip = chip;
   615		at24->num_addresses = num_addresses;
   616	
 > 617		at24->read_func = at24_read;
   618		at24->write_func = at24_write;
   619	
   620		writable = !(chip.flags & AT24_FLAG_READONLY);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1364238 — [PATCH 13/13] eeprom: at24: add at24mac chips to the list of supported devices

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-03-24 16:00 +0100
Subject[PATCH 13/13] eeprom: at24: add at24mac chips to the list of supported devices
Message-ID<rgeTT-42l-7@gated-at.bofh.it>
In reply to#1364234
Now with the infrastructue for reading the factory-programmed mac
address in place, add the two available chips from the at24mac
family: at24mac402 and at24mac602 to the device ID list.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/misc/eeprom/at24.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 26c28c2..f620d33 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -119,6 +119,10 @@ static const struct i2c_device_id at24_ids[] = {
 	{ "24c02",	AT24_DEVICE_MAGIC(2048 / 8,	0) },
 	{ "24cs02",	AT24_DEVICE_MAGIC(128 / 8,
 				AT24_FLAG_SERIAL | AT24_FLAG_READONLY) },
+	{ "24mac402",	AT24_DEVICE_MAGIC(48 / 8,
+				AT24_FLAG_MAC | AT24_FLAG_READONLY) },
+	{ "24mac602",	AT24_DEVICE_MAGIC(64 / 8,
+				AT24_FLAG_MAC | AT24_FLAG_READONLY) },
 	/* spd is a 24c02 in memory DIMMs */
 	{ "spd",	AT24_DEVICE_MAGIC(2048 / 8,
 				AT24_FLAG_READONLY | AT24_FLAG_IRUGO) },
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1364239 — [PATCH 07/13] eeprom: at24: support reading of the serial number

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-03-24 16:00 +0100
Subject[PATCH 07/13] eeprom: at24: support reading of the serial number
Message-ID<rgeTT-42l-9@gated-at.bofh.it>
In reply to#1364234
The at24cs series EEPROM chips have an additional read-only memory area
containing a factory pre-programmed serial number. In order to access
it, one has to perform a dummy write before reading the serial number
bytes.

Add a function that allows to access the serial number.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/misc/eeprom/at24.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index bc5be1e..a7d6c15 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -159,6 +159,65 @@ static struct i2c_client *at24_translate_offset(struct at24_data *at24,
 	return at24->client[i];
 }
 
+static int __attribute__((unused))
+at24cs_serial_read(struct at24_data *at24,
+		   char *buf, loff_t off, size_t count)
+{
+	unsigned long timeout, read_time;
+	struct i2c_client *client;
+	unsigned int offset = off;
+	struct i2c_msg msg[2];
+	u8 addrbuf[2];
+	int status;
+
+	client = at24_translate_offset(at24, &offset);
+
+	memset(msg, 0, sizeof(msg));
+	msg[0].addr = client->addr;
+	msg[0].buf = addrbuf;
+
+	/*
+	 * The address pointer of the device is shared between the regular
+	 * EEPROM array and the serial number block. The dummy write (part of
+	 * the sequential read protocol) ensures the address pointer is reset
+	 * to the desired position.
+	 */
+	if (at24->chip.flags & AT24_FLAG_ADDR16) {
+		/*
+		 * For 16 bit address pointers, the word address must contain
+		 * a '10' sequence in bits 11 and 10 regardless of the
+		 * intended position of the address pointer.
+		 */
+		addrbuf[0] = 0x08;
+		addrbuf[1] = offset;
+		msg[0].len = 2;
+	} else {
+		/*
+		 * Otherwise the word address must begin with a '10' sequence,
+		 * regardless of the intended address.
+		 */
+		addrbuf[0] = 0x80 + offset;
+		msg[0].len = 1;
+	}
+
+	msg[1].addr = client->addr;
+	msg[1].flags = I2C_M_RD;
+	msg[1].buf = buf;
+	msg[1].len = count;
+
+	timeout = jiffies + msecs_to_jiffies(write_timeout);
+	do {
+		read_time = jiffies;
+		status = i2c_transfer(client->adapter, msg, 2);
+		if (status == 2)
+			return count;
+
+		usleep_range(1000, 1500);
+	} while (time_before(read_time, timeout));
+
+	return -ETIMEDOUT;
+}
+
 static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf,
 		unsigned offset, size_t count)
 {
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1364240 — [PATCH 01/13] eeprom: at24: remove a reduntant if

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-03-24 16:00 +0100
Subject[PATCH 01/13] eeprom: at24: remove a reduntant if
Message-ID<rgeTT-42l-13@gated-at.bofh.it>
In reply to#1364234
It seems as if the second check for I2C_FUNC_I2C functionality had
been introduced accidentally during a merge. Tt's reduntant, so
remove it.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/misc/eeprom/at24.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 089d694..001a9af 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -544,10 +544,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		} else {
 			return -EPFNOSUPPORT;
 		}
-	}
 
-	/* Use I2C operations unless we're stuck with SMBus extensions. */
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
 		if (i2c_check_functionality(client->adapter,
 				I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) {
 			use_smbus_write = I2C_SMBUS_I2C_BLOCK_DATA;
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1364244 — [PATCH 05/13] eeprom: at24: replace msleep() with usleep_range()

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-03-24 16:00 +0100
Subject[PATCH 05/13] eeprom: at24: replace msleep() with usleep_range()
Message-ID<rgeTU-42l-25@gated-at.bofh.it>
In reply to#1364234
We cannot expect msleep(1) to actually sleep for a period shorter than
20 ms. Replace all calls to msleep() with usleep_range().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/misc/eeprom/at24.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 9e01428..bc5be1e 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -240,8 +240,7 @@ static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf,
 		if (status == count)
 			return count;
 
-		/* REVISIT: at HZ=100, this is sloooow */
-		msleep(1);
+		usleep_range(1000, 1500);
 	} while (time_before(read_time, timeout));
 
 	return -ETIMEDOUT;
@@ -355,8 +354,7 @@ static ssize_t at24_eeprom_write(struct at24_data *at24, const char *buf,
 		if (status == count)
 			return count;
 
-		/* REVISIT: at HZ=100, this is sloooow */
-		msleep(1);
+		usleep_range(1000, 1500);
 	} while (time_before(write_time, timeout));
 
 	return -ETIMEDOUT;
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1364245 — [PATCH 12/13] eeprom: at24: add support for at24mac series

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-03-24 16:00 +0100
Subject[PATCH 12/13] eeprom: at24: add support for at24mac series
Message-ID<rgeTU-42l-27@gated-at.bofh.it>
In reply to#1364234
Add a new read function to the at24 driver allowing to retrieve the
factory-programmed mac address embedded in chips from the at24mac
family.

These chips can be instantiated similarily to the at24cs family,
except that there's no way of having access to both the serial number
and the mac address at the same time - the user must instantiate
either an at24cs or at24mac device as both special memory areas are
accessible on the same slave address.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/misc/eeprom/at24.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index a95a301..26c28c2 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -238,6 +238,41 @@ static int at24cs_serial_read(struct at24_data *at24,
 	return -ETIMEDOUT;
 }
 
+static int at24mac_mac_read(struct at24_data *at24,
+			   char *buf, loff_t off, size_t count)
+{
+	unsigned long timeout, read_time;
+	struct i2c_client *client;
+	unsigned int offset = off;
+	struct i2c_msg msg[2];
+	u8 addrbuf[2];
+	int status;
+
+	client = at24_translate_offset(at24, &offset);
+
+	memset(msg, 0, sizeof(msg));
+	msg[0].addr = client->addr;
+	msg[0].buf = addrbuf;
+	addrbuf[0] = 0x90 + offset;
+	msg[0].len = 1;
+	msg[1].addr = client->addr;
+	msg[1].flags = I2C_M_RD;
+	msg[1].buf = buf;
+	msg[1].len = count;
+
+	timeout = jiffies + msecs_to_jiffies(write_timeout);
+	do {
+		read_time = jiffies;
+		status = i2c_transfer(client->adapter, msg, 2);
+		if (status == 2)
+			return count;
+
+		usleep_range(1000, 1500);
+	} while (time_before(read_time, timeout));
+
+	return -ETIMEDOUT;
+}
+
 static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf,
 		unsigned offset, size_t count)
 {
@@ -631,8 +666,16 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	at24->chip = chip;
 	at24->num_addresses = num_addresses;
 
+	if ((chip.flags & AT24_FLAG_SERIAL) && (chip.flags & AT24_FLAG_MAC)) {
+		dev_err(&client->dev,
+			"invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC.");
+		return -EINVAL;
+	}
+
 	if (chip.flags & AT24_FLAG_SERIAL) {
 		at24->read_func = at24cs_serial_read;
+	} else if (chip.flags & AT24_FLAG_MAC) {
+		at24->read_func = at24mac_mac_read;
 	} else {
 		at24->read_func = at24_read;
 		at24->write_func = at24_write;
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1364246 — [PATCH 09/13] eeprom: at24: use at24cs_serial_read()

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-03-24 16:00 +0100
Subject[PATCH 09/13] eeprom: at24: use at24cs_serial_read()
Message-ID<rgeTU-42l-31@gated-at.bofh.it>
In reply to#1364234
Assign at24cs_serial_read() to at24->read_func if the chip allows serial
number read operation.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/misc/eeprom/at24.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 5b484bc..9515001 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -162,9 +162,8 @@ static struct i2c_client *at24_translate_offset(struct at24_data *at24,
 	return at24->client[i];
 }
 
-static int __attribute__((unused))
-at24cs_serial_read(struct at24_data *at24,
-		   char *buf, loff_t off, size_t count)
+static int at24cs_serial_read(struct at24_data *at24,
+			      char *buf, loff_t off, size_t count)
 {
 	unsigned long timeout, read_time;
 	struct i2c_client *client;
@@ -614,8 +613,12 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	at24->chip = chip;
 	at24->num_addresses = num_addresses;
 
-	at24->read_func = at24_read;
-	at24->write_func = at24_write;
+	if (chip.flags & AT24_FLAG_SERIAL) {
+		at24->read_func = at24cs_serial_read;
+	} else {
+		at24->read_func = at24_read;
+		at24->write_func = at24_write;
+	}
 
 	writable = !(chip.flags & AT24_FLAG_READONLY);
 	if (writable) {
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1364253 — [PATCH 10/13] eeprom: at24: add the at24cs series to the list of supported devices

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-03-24 16:00 +0100
Subject[PATCH 10/13] eeprom: at24: add the at24cs series to the list of supported devices
Message-ID<rgeTV-42l-41@gated-at.bofh.it>
In reply to#1364234
The infrastructure for reading of the factory-programmed serial number
for at24cs EEPROM series is now in place. Add the chips that are actually
equipped with the serial number memory area to the list of supported
devices.

The chips from the at24cs family have two memory areas - a regular
read-write block and a read-only area containing the serial number.

The latter is visible on a different slave address (the address of the
wr memory block + 0x08). In order to access both blocks the user needs
to instantiate a regular at24c device for the wr block address and a
corresponding at24cs device on the serial number block address.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/misc/eeprom/at24.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 9515001..a95a301 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -114,16 +114,34 @@ static const struct i2c_device_id at24_ids[] = {
 	{ "24c00",	AT24_DEVICE_MAGIC(128 / 8,	AT24_FLAG_TAKE8ADDR) },
 	/* old variants can't be handled with this generic entry! */
 	{ "24c01",	AT24_DEVICE_MAGIC(1024 / 8,	0) },
+	{ "24cs01",	AT24_DEVICE_MAGIC(128 / 8,
+				AT24_FLAG_SERIAL | AT24_FLAG_READONLY) },
 	{ "24c02",	AT24_DEVICE_MAGIC(2048 / 8,	0) },
+	{ "24cs02",	AT24_DEVICE_MAGIC(128 / 8,
+				AT24_FLAG_SERIAL | AT24_FLAG_READONLY) },
 	/* spd is a 24c02 in memory DIMMs */
 	{ "spd",	AT24_DEVICE_MAGIC(2048 / 8,
 				AT24_FLAG_READONLY | AT24_FLAG_IRUGO) },
 	{ "24c04",	AT24_DEVICE_MAGIC(4096 / 8,	0) },
+	{ "24cs04",	AT24_DEVICE_MAGIC(128 / 8,
+				AT24_FLAG_SERIAL | AT24_FLAG_READONLY) },
 	/* 24rf08 quirk is handled at i2c-core */
 	{ "24c08",	AT24_DEVICE_MAGIC(8192 / 8,	0) },
+	{ "24cs08",	AT24_DEVICE_MAGIC(128 / 8,
+				AT24_FLAG_SERIAL | AT24_FLAG_READONLY) },
 	{ "24c16",	AT24_DEVICE_MAGIC(16384 / 8,	0) },
+	{ "24cs16",	AT24_DEVICE_MAGIC(128 / 8,
+				AT24_FLAG_SERIAL | AT24_FLAG_READONLY) },
 	{ "24c32",	AT24_DEVICE_MAGIC(32768 / 8,	AT24_FLAG_ADDR16) },
+	{ "24cs32",	AT24_DEVICE_MAGIC(128 / 8,
+				AT24_FLAG_ADDR16 |
+				AT24_FLAG_SERIAL |
+				AT24_FLAG_READONLY) },
 	{ "24c64",	AT24_DEVICE_MAGIC(65536 / 8,	AT24_FLAG_ADDR16) },
+	{ "24cs64",	AT24_DEVICE_MAGIC(128 / 8,
+				AT24_FLAG_ADDR16 |
+				AT24_FLAG_SERIAL |
+				AT24_FLAG_READONLY) },
 	{ "24c128",	AT24_DEVICE_MAGIC(131072 / 8,	AT24_FLAG_ADDR16) },
 	{ "24c256",	AT24_DEVICE_MAGIC(262144 / 8,	AT24_FLAG_ADDR16) },
 	{ "24c512",	AT24_DEVICE_MAGIC(524288 / 8,	AT24_FLAG_ADDR16) },
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1364254 — [PATCH 11/13] eeprom: at24: add at24mac series flag

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-03-24 16:00 +0100
Subject[PATCH 11/13] eeprom: at24: add at24mac series flag
Message-ID<rgeTV-42l-43@gated-at.bofh.it>
In reply to#1364234
As part of supporting the at24mac series add a new flag to the at24
platform data. When set, it indicates that this chip exposes the
factory-programmed EUI-48 or EUI-64 address.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 include/linux/platform_data/at24.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/platform_data/at24.h b/include/linux/platform_data/at24.h
index 5bc02fe..fa89605 100644
--- a/include/linux/platform_data/at24.h
+++ b/include/linux/platform_data/at24.h
@@ -48,6 +48,7 @@ struct at24_platform_data {
 #define AT24_FLAG_IRUGO		BIT(5)	/* sysfs-entry will be world-readable */
 #define AT24_FLAG_TAKE8ADDR	BIT(4)	/* take always 8 addresses (24c00) */
 #define AT24_FLAG_SERIAL	BIT(3)	/* factory-programmed serial number */
+#define AT24_FLAG_MAC		BIT(2)	/* factory-programmed mac address */
 
 	void		(*setup)(struct nvmem_device *nvmem, void *context);
 	void		*context;
-- 
2.7.4

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web