diff mbox series

eeprom: at24: add ST M24256E Additional Write lockable page support

Message ID 20241108185302.139487-1-marex@denx.de
State Accepted
Delegated to: Tom Rini
Headers show
Series eeprom: at24: add ST M24256E Additional Write lockable page support | expand

Commit Message

Marek Vasut Nov. 8, 2024, 6:52 p.m. UTC
The ST M24256E behaves as a regular M24C256, except for the E variant
which uses up another I2C address for Additional Write lockable page.
This page is 64 Bytes long and can contain additional data. Add entry
for it, so users can describe that page in DT. Note that users still
have to describe the main M24C256 area separately as that is on separate
I2C address from this page.

Unlike M24C32-D and M24C64-D, this part is specifically ST and does not
have any comparable M24* counterparts from other vendors, hence the st,
vendor prefix. Furthermore, the part name is M24256E without C between
the 24 and 256, this is not a typo. Finally, there is M24C256-D part,
which does contain 32 Bytes long Additional Write lockable page, which
is a different part and not supported by this patch.

Datasheet: https://www.st.com/resource/en/datasheet/m24256e-f.pdf

From Linux kernel commit:
339cb28b9ee6 ("eeprom: at24: add ST M24256E Additional Write lockable page support")

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@dh-electronics.com
Cc: u-boot@lists.denx.de
---
 drivers/misc/i2c_eeprom.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Tom Rini Dec. 6, 2024, 6:58 p.m. UTC | #1
On Fri, 08 Nov 2024 19:52:26 +0100, Marek Vasut wrote:

> The ST M24256E behaves as a regular M24C256, except for the E variant
> which uses up another I2C address for Additional Write lockable page.
> This page is 64 Bytes long and can contain additional data. Add entry
> for it, so users can describe that page in DT. Note that users still
> have to describe the main M24C256 area separately as that is on separate
> I2C address from this page.
> 
> [...]

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/drivers/misc/i2c_eeprom.c b/drivers/misc/i2c_eeprom.c
index 10f0173d805..3cb38aa28ad 100644
--- a/drivers/misc/i2c_eeprom.c
+++ b/drivers/misc/i2c_eeprom.c
@@ -264,6 +264,13 @@  static const struct i2c_eeprom_drv_data atmel24c256_data = {
 	.offset_len = 2,
 };
 
+static const struct i2c_eeprom_drv_data st24256e_wlp_data = {
+	.size = 64,
+	.pagesize = 64,
+	.addr_offset_mask = 0,
+	.offset_len = 2,
+};
+
 static const struct i2c_eeprom_drv_data atmel24c512_data = {
 	.size = 65536,
 	.pagesize = 64,
@@ -287,6 +294,7 @@  static const struct udevice_id i2c_eeprom_std_ids[] = {
 	{ .compatible = "atmel,24c128", (ulong)&atmel24c128_data },
 	{ .compatible = "atmel,24c256", (ulong)&atmel24c256_data },
 	{ .compatible = "atmel,24c512", (ulong)&atmel24c512_data },
+	{ .compatible = "st,24256e-wl", (ulong)&st24256e_wlp_data },
 	{ }
 };