Skip to contentSkip to conversation

at24: support eeproms that do not roll over page reads.

PATCH In review Sven Van Asbroeck 2 participants 3 messages Nov 1, 2017 – Nov 6, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover at24: support eeproms that do not roll over page reads.

v2:
kbuild test robot feedback: correct
"warning: comparison of distinct pointer types lacks a cast"
build warning on some compilers / architectures.

v1:
original patch

Sven Van Asbroeck (1):
at24: support eeproms that do not roll over page reads.

 .../devicetree/bindings/eeprom/eeprom.txt          |  5 +++
 drivers/misc/eeprom/at24.c                         | 47 +++++++++++-----------
 include/linux/platform_data/at24.h                 |  1 +
 3 files changed, 29 insertions(+), 24 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 at24: support eeproms that do not roll over page reads.

Some eeproms in the at24 family do not roll over page reads, e.g. the Microchip 24AA16/24LC16B. On those eeproms, reads that straddle block boundaries will not work correctly.

Solution:
Implement read rollover in the driver. To enable it, add the AT24_FLAG_NO_RDROL flag to the eeprom entry in the device_id table, or add 'no-read-rollover' to the eeprom devicetree entry.

---
 .../devicetree/bindings/eeprom/eeprom.txt          |  5 +++
 drivers/misc/eeprom/at24.c                         | 47 +++++++++++-----------
 include/linux/platform_data/at24.h                 |  1 +
 3 files changed, 29 insertions(+), 24 deletions(-)
Documentation/devicetree/bindings/eeprom/eeprom.txt +5 -0
index afc0458..301bc7e 100644
@@ -36,6 +36,11 @@ Optional properties:
 
   - read-only: this parameterless property disables writes to the eeprom
 
+  - no-read-rollover: supported on the at24 eeprom family only.
+			This parameterless property indicates that the
+			eeprom does not support auto read rollover. Please consult
+			the manual of your device.
+
 Example:
 
 eeprom@52 {
drivers/misc/eeprom/at24.c +23 -24

104 lines not on this page · raw message

include/linux/platform_data/at24.h +1 -0
index 271a4e2..a5804f1 100644
@@ -50,6 +50,7 @@ struct at24_platform_data {
 #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 */
+#define AT24_FLAG_NO_RDROL	BIT(1)	/* chip does not rollover page reads */
 
 	void		(*setup)(struct nvmem_device *nvmem, void *context);
 	void		*context;
Signature · 1 line
1.9.1
maintainer Acked-by on v2 1/1
#2 lore raw
Quoted 10 lines · Sven Van Asbroeck

Some eeproms in the at24 family do not roll over page reads, e.g. the Microchip 24AA16/24LC16B. On those eeproms, reads that straddle block boundaries will not work correctly.

Solution:
Implement read rollover in the driver. To enable it, add the AT24_FLAG_NO_RDROL flag to the eeprom entry in the device_id table, or add 'no-read-rollover' to the eeprom devicetree entry.

Quoted 3 lines
---
 .../devicetree/bindings/eeprom/eeprom.txt          |  5 +++
Quoted 3 lines
 drivers/misc/eeprom/at24.c                         | 47 +++++++++++-----------
 include/linux/platform_data/at24.h                 |  1 +
 3 files changed, 29 insertions(+), 24 deletions(-)