blob: 7b1f81477fd83cd733e3d6d61bcedf95e9fe5189 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
wdenk38635852002-08-27 05:55:31 +00002/*
3 * (C) Copyright 2000, 2001
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
wdenk38635852002-08-27 05:55:31 +00005 */
6
d4f5c722005-08-12 21:16:13 +02007/*
8 * Support for read and write access to EEPROM like memory devices. This
9 * includes regular EEPROM as well as FRAM (ferroelectic nonvolaile RAM).
10 * FRAM devices read and write data at bus speed. In particular, there is no
Peter Meerwalde506a002012-02-08 05:31:53 +000011 * write delay. Also, there is no limit imposed on the number of bytes that can
d4f5c722005-08-12 21:16:13 +020012 * be transferred with a single read or write.
Wolfgang Denk6617aae2005-08-19 00:46:54 +020013 *
d4f5c722005-08-12 21:16:13 +020014 * Use the following configuration options to ensure no unneeded performance
15 * degradation (typical for EEPROM) is incured for FRAM memory:
Wolfgang Denk6617aae2005-08-19 00:46:54 +020016 *
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020017 * #define CONFIG_SYS_I2C_FRAM
18 * #undef CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
d4f5c722005-08-12 21:16:13 +020019 *
20 */
21
wdenk38635852002-08-27 05:55:31 +000022#include <common.h>
23#include <config.h>
24#include <command.h>
25#include <i2c.h>
Nikita Kiryanove7c27292016-04-16 17:55:12 +030026#include <eeprom_layout.h>
wdenk38635852002-08-27 05:55:31 +000027
Marek Vasut4f296d02015-11-10 20:53:18 +010028#ifndef CONFIG_SYS_I2C_SPEED
29#define CONFIG_SYS_I2C_SPEED 50000
Stefan Roese98f4a3d2005-09-22 09:04:17 +020030#endif
wdenk38635852002-08-27 05:55:31 +000031
Marek Vasutd7387462015-11-10 20:53:26 +010032#ifndef CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
33#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 0
34#endif
35
Marek Vasut6717e3c2015-11-10 20:53:28 +010036#ifndef CONFIG_SYS_EEPROM_PAGE_WRITE_BITS
37#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 8
38#endif
39
Mario Sixa6e7b772016-04-20 10:44:52 +020040#ifndef I2C_RXTX_LEN
41#define I2C_RXTX_LEN 128
42#endif
43
Marek Vasut6717e3c2015-11-10 20:53:28 +010044#define EEPROM_PAGE_SIZE (1 << CONFIG_SYS_EEPROM_PAGE_WRITE_BITS)
45#define EEPROM_PAGE_OFFSET(x) ((x) & (EEPROM_PAGE_SIZE - 1))
46
Marek Vasut4f296d02015-11-10 20:53:18 +010047/*
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020048 * for CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 2 (16-bit EEPROM address) offset is
wdenk38635852002-08-27 05:55:31 +000049 * 0x000nxxxx for EEPROM address selectors at n, offset xxxx in EEPROM.
50 *
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020051 * for CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 1 (8-bit EEPROM page address) offset is
wdenk38635852002-08-27 05:55:31 +000052 * 0x00000nxx for EEPROM address selectors and page number at n.
53 */
Heiko Schocher548738b2010-01-07 08:55:40 +010054#if !defined(CONFIG_SPI) || defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
Marek Vasut4f296d02015-11-10 20:53:18 +010055#if !defined(CONFIG_SYS_I2C_EEPROM_ADDR_LEN) || \
Marek Vasutd4e69e62015-11-10 20:53:33 +010056 (CONFIG_SYS_I2C_EEPROM_ADDR_LEN < 1) || \
57 (CONFIG_SYS_I2C_EEPROM_ADDR_LEN > 2)
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020058#error CONFIG_SYS_I2C_EEPROM_ADDR_LEN must be 1 or 2
wdenk38635852002-08-27 05:55:31 +000059#endif
60#endif
61
Simon Goldschmidt4f256172019-03-26 13:38:52 +010062#if defined(CONFIG_DM_I2C)
63int eeprom_i2c_bus;
64#endif
65
Marek Vasut52cd47c2015-11-10 20:53:25 +010066__weak int eeprom_write_enable(unsigned dev_addr, int state)
67{
68 return 0;
69}
Marek Vasut4f296d02015-11-10 20:53:18 +010070
Marek Vasut354e3ed2015-11-10 20:53:31 +010071void eeprom_init(int bus)
Marek Vasut4f296d02015-11-10 20:53:18 +010072{
Marek Vasut4f296d02015-11-10 20:53:18 +010073 /* I2C EEPROM */
Simon Goldschmidt4f256172019-03-26 13:38:52 +010074#if defined(CONFIG_DM_I2C)
75 eeprom_i2c_bus = bus;
76#elif defined(CONFIG_SYS_I2C)
Marek Vasut354e3ed2015-11-10 20:53:31 +010077 if (bus >= 0)
78 i2c_set_bus_num(bus);
Marek Vasut4f296d02015-11-10 20:53:18 +010079 i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
80#endif
81}
82
Marek Vasut02c321c2015-11-10 20:53:24 +010083static int eeprom_addr(unsigned dev_addr, unsigned offset, uchar *addr)
84{
85 unsigned blk_off;
86 int alen;
87
88 blk_off = offset & 0xff; /* block offset */
89#if CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 1
90 addr[0] = offset >> 8; /* block number */
91 addr[1] = blk_off; /* block offset */
92 alen = 2;
93#else
94 addr[0] = offset >> 16; /* block number */
95 addr[1] = offset >> 8; /* upper address octet */
96 addr[2] = blk_off; /* lower address octet */
97 alen = 3;
98#endif /* CONFIG_SYS_I2C_EEPROM_ADDR_LEN */
99
100 addr[0] |= dev_addr; /* insert device address */
101
102 return alen;
103}
104
Marek Vasut39b6f982015-11-10 20:53:29 +0100105static int eeprom_len(unsigned offset, unsigned end)
106{
107 unsigned len = end - offset;
108
109 /*
110 * For a FRAM device there is no limit on the number of the
111 * bytes that can be ccessed with the single read or write
112 * operation.
113 */
114#if !defined(CONFIG_SYS_I2C_FRAM)
115 unsigned blk_off = offset & 0xff;
116 unsigned maxlen = EEPROM_PAGE_SIZE - EEPROM_PAGE_OFFSET(blk_off);
117
118 if (maxlen > I2C_RXTX_LEN)
119 maxlen = I2C_RXTX_LEN;
120
121 if (len > maxlen)
122 len = maxlen;
123#endif
124
125 return len;
126}
127
Marek Vasut91320882015-11-10 20:53:23 +0100128static int eeprom_rw_block(unsigned offset, uchar *addr, unsigned alen,
129 uchar *buffer, unsigned len, bool read)
130{
131 int ret = 0;
132
Simon Goldschmidt4f256172019-03-26 13:38:52 +0100133#if defined(CONFIG_DM_I2C)
Lukasz Majewski0c07a9b2018-11-21 23:40:43 +0100134 struct udevice *dev;
135
Simon Goldschmidt4f256172019-03-26 13:38:52 +0100136 ret = i2c_get_chip_for_busnum(eeprom_i2c_bus, addr[0],
Lukasz Majewski0c07a9b2018-11-21 23:40:43 +0100137 alen - 1, &dev);
138 if (ret) {
139 printf("%s: Cannot find udev for a bus %d\n", __func__,
Simon Goldschmidt4f256172019-03-26 13:38:52 +0100140 eeprom_i2c_bus);
Lukasz Majewski0c07a9b2018-11-21 23:40:43 +0100141 return CMD_RET_FAILURE;
142 }
143
144 if (read)
145 ret = dm_i2c_read(dev, offset, buffer, len);
146 else
147 ret = dm_i2c_write(dev, offset, buffer, len);
148
149#else /* Non DM I2C support - will be removed */
Marek Vasut91320882015-11-10 20:53:23 +0100150
151 if (read)
152 ret = i2c_read(addr[0], offset, alen - 1, buffer, len);
153 else
154 ret = i2c_write(addr[0], offset, alen - 1, buffer, len);
Simon Goldschmidt4f256172019-03-26 13:38:52 +0100155#endif /* CONFIG_DM_I2C */
Lukasz Majewski0c07a9b2018-11-21 23:40:43 +0100156 if (ret)
157 ret = CMD_RET_FAILURE;
158
Marek Vasut91320882015-11-10 20:53:23 +0100159 return ret;
160}
161
Marek Vasut1a378892015-11-10 20:53:30 +0100162static int eeprom_rw(unsigned dev_addr, unsigned offset, uchar *buffer,
163 unsigned cnt, bool read)
wdenk38635852002-08-27 05:55:31 +0000164{
165 unsigned end = offset + cnt;
Marek Vasut1a378892015-11-10 20:53:30 +0100166 unsigned alen, len;
wdenk38635852002-08-27 05:55:31 +0000167 int rcode = 0;
Marek Vasut02c321c2015-11-10 20:53:24 +0100168 uchar addr[3];
wdenk38635852002-08-27 05:55:31 +0000169
Simon Goldschmidt4f256172019-03-26 13:38:52 +0100170#if defined(CONFIG_SYS_I2C_EEPROM_BUS)
171 eeprom_init(CONFIG_SYS_I2C_EEPROM_BUS);
172#endif
173
wdenk38635852002-08-27 05:55:31 +0000174 while (offset < end) {
Marek Vasut02c321c2015-11-10 20:53:24 +0100175 alen = eeprom_addr(dev_addr, offset, addr);
wdenk38635852002-08-27 05:55:31 +0000176
Marek Vasut39b6f982015-11-10 20:53:29 +0100177 len = eeprom_len(offset, end);
d4f5c722005-08-12 21:16:13 +0200178
Marek Vasut1a378892015-11-10 20:53:30 +0100179 rcode = eeprom_rw_block(offset, addr, alen, buffer, len, read);
Marek Vasut91320882015-11-10 20:53:23 +0100180
wdenk38635852002-08-27 05:55:31 +0000181 buffer += len;
182 offset += len;
Marek Vasut1a378892015-11-10 20:53:30 +0100183
184 if (!read)
185 udelay(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
wdenk38635852002-08-27 05:55:31 +0000186 }
d4f5c722005-08-12 21:16:13 +0200187
wdenk38635852002-08-27 05:55:31 +0000188 return rcode;
189}
190
Marek Vasut1a378892015-11-10 20:53:30 +0100191int eeprom_read(unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt)
wdenk38635852002-08-27 05:55:31 +0000192{
Marek Vasut1a378892015-11-10 20:53:30 +0100193 /*
194 * Read data until done or would cross a page boundary.
195 * We must write the address again when changing pages
196 * because the next page may be in a different device.
197 */
198 return eeprom_rw(dev_addr, offset, buffer, cnt, 1);
199}
200
Marek Vasutd4e69e62015-11-10 20:53:33 +0100201int eeprom_write(unsigned dev_addr, unsigned offset,
202 uchar *buffer, unsigned cnt)
Marek Vasut1a378892015-11-10 20:53:30 +0100203{
204 int ret;
wdenk38635852002-08-27 05:55:31 +0000205
Marek Vasut52cd47c2015-11-10 20:53:25 +0100206 eeprom_write_enable(dev_addr, 1);
207
Marek Vasut4f296d02015-11-10 20:53:18 +0100208 /*
209 * Write data until done or would cross a write page boundary.
wdenk38635852002-08-27 05:55:31 +0000210 * We must write the address again when changing pages
211 * because the address counter only increments within a page.
212 */
Alexey Brodkin52bc7c72015-12-14 18:45:34 +0300213 ret = eeprom_rw(dev_addr, offset, buffer, cnt, 0);
Marek Vasut52cd47c2015-11-10 20:53:25 +0100214
215 eeprom_write_enable(dev_addr, 0);
Marek Vasut1a378892015-11-10 20:53:30 +0100216 return ret;
wdenk38635852002-08-27 05:55:31 +0000217}
218
Nikita Kiryanovc40f0372016-04-16 17:55:11 +0300219static int parse_numeric_param(char *str)
220{
221 char *endptr;
222 int value = simple_strtol(str, &endptr, 16);
223
224 return (*endptr != '\0') ? -1 : value;
225}
226
227/**
228 * parse_i2c_bus_addr - parse the i2c bus and i2c devaddr parameters
229 *
230 * @i2c_bus: address to store the i2c bus
231 * @i2c_addr: address to store the device i2c address
232 * @argc: count of command line arguments left to parse
233 * @argv: command line arguments left to parse
234 * @argc_no_bus_addr: argc value we expect to see when bus & addr aren't given
235 *
236 * @returns: number of arguments parsed or CMD_RET_USAGE if error
237 */
238static int parse_i2c_bus_addr(int *i2c_bus, ulong *i2c_addr, int argc,
239 char * const argv[], int argc_no_bus_addr)
240{
241 int argc_no_bus = argc_no_bus_addr + 1;
242 int argc_bus_addr = argc_no_bus_addr + 2;
243
244#ifdef CONFIG_SYS_DEF_EEPROM_ADDR
245 if (argc == argc_no_bus_addr) {
246 *i2c_bus = -1;
247 *i2c_addr = CONFIG_SYS_DEF_EEPROM_ADDR;
248
249 return 0;
250 }
251#endif
252 if (argc == argc_no_bus) {
253 *i2c_bus = -1;
254 *i2c_addr = parse_numeric_param(argv[0]);
255
256 return 1;
257 }
258
259 if (argc == argc_bus_addr) {
260 *i2c_bus = parse_numeric_param(argv[0]);
261 *i2c_addr = parse_numeric_param(argv[1]);
262
263 return 2;
264 }
265
266 return CMD_RET_USAGE;
267}
268
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300269#ifdef CONFIG_CMD_EEPROM_LAYOUT
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300270
271__weak int eeprom_parse_layout_version(char *str)
272{
273 return LAYOUT_VERSION_UNRECOGNIZED;
274}
275
276static unsigned char eeprom_buf[CONFIG_SYS_EEPROM_SIZE];
277
Nikita Kiryanove7c27292016-04-16 17:55:12 +0300278#endif
279
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300280enum eeprom_action {
Nikita Kiryanove7c27292016-04-16 17:55:12 +0300281 EEPROM_READ,
282 EEPROM_WRITE,
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300283 EEPROM_PRINT,
284 EEPROM_UPDATE,
285 EEPROM_ACTION_INVALID,
286};
287
288static enum eeprom_action parse_action(char *cmd)
289{
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300290 if (!strncmp(cmd, "read", 4))
291 return EEPROM_READ;
292 if (!strncmp(cmd, "write", 5))
293 return EEPROM_WRITE;
294#ifdef CONFIG_CMD_EEPROM_LAYOUT
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300295 if (!strncmp(cmd, "print", 5))
296 return EEPROM_PRINT;
297 if (!strncmp(cmd, "update", 6))
298 return EEPROM_UPDATE;
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300299#endif
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300300
301 return EEPROM_ACTION_INVALID;
302}
303
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300304static int eeprom_execute_command(enum eeprom_action action, int i2c_bus,
Nikita Kiryanove7c27292016-04-16 17:55:12 +0300305 ulong i2c_addr, int layout_ver, char *key,
306 char *value, ulong addr, ulong off, ulong cnt)
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300307{
Nikita Kiryanove7c27292016-04-16 17:55:12 +0300308 int rcode = 0;
309 const char *const fmt =
310 "\nEEPROM @0x%lX %s: addr %08lx off %04lx count %ld ... ";
311#ifdef CONFIG_CMD_EEPROM_LAYOUT
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300312 struct eeprom_layout layout;
Nikita Kiryanove7c27292016-04-16 17:55:12 +0300313#endif
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300314
315 if (action == EEPROM_ACTION_INVALID)
316 return CMD_RET_USAGE;
317
318 eeprom_init(i2c_bus);
Nikita Kiryanove7c27292016-04-16 17:55:12 +0300319 if (action == EEPROM_READ) {
320 printf(fmt, i2c_addr, "read", addr, off, cnt);
321
322 rcode = eeprom_read(i2c_addr, off, (uchar *)addr, cnt);
323
324 puts("done\n");
325 return rcode;
326 } else if (action == EEPROM_WRITE) {
327 printf(fmt, i2c_addr, "write", addr, off, cnt);
328
329 rcode = eeprom_write(i2c_addr, off, (uchar *)addr, cnt);
330
331 puts("done\n");
332 return rcode;
333 }
334
335#ifdef CONFIG_CMD_EEPROM_LAYOUT
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300336 rcode = eeprom_read(i2c_addr, 0, eeprom_buf, CONFIG_SYS_EEPROM_SIZE);
337 if (rcode < 0)
338 return rcode;
339
340 eeprom_layout_setup(&layout, eeprom_buf, CONFIG_SYS_EEPROM_SIZE,
341 layout_ver);
342
343 if (action == EEPROM_PRINT) {
344 layout.print(&layout);
345 return 0;
346 }
347
348 layout.update(&layout, key, value);
349
350 rcode = eeprom_write(i2c_addr, 0, layout.data, CONFIG_SYS_EEPROM_SIZE);
Nikita Kiryanove7c27292016-04-16 17:55:12 +0300351#endif
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300352
353 return rcode;
354}
355
356#define NEXT_PARAM(argc, index) { (argc)--; (index)++; }
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300357int do_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300358{
359 int layout_ver = LAYOUT_VERSION_AUTODETECT;
360 enum eeprom_action action = EEPROM_ACTION_INVALID;
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300361 int i2c_bus = -1, index = 0;
362 ulong i2c_addr = -1, addr = 0, cnt = 0, off = 0;
363 int ret;
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300364 char *field_name = "";
365 char *field_value = "";
366
367 if (argc <= 1)
368 return CMD_RET_USAGE;
369
370 NEXT_PARAM(argc, index); /* Skip program name */
371
372 action = parse_action(argv[index]);
373 NEXT_PARAM(argc, index);
374
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300375 if (action == EEPROM_ACTION_INVALID)
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300376 return CMD_RET_USAGE;
377
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300378#ifdef CONFIG_CMD_EEPROM_LAYOUT
379 if (action == EEPROM_PRINT || action == EEPROM_UPDATE) {
380 if (!strcmp(argv[index], "-l")) {
381 NEXT_PARAM(argc, index);
382 layout_ver = eeprom_parse_layout_version(argv[index]);
383 NEXT_PARAM(argc, index);
384 }
385 }
386#endif
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300387
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300388 switch (action) {
389 case EEPROM_READ:
390 case EEPROM_WRITE:
391 ret = parse_i2c_bus_addr(&i2c_bus, &i2c_addr, argc,
392 argv + index, 3);
393 break;
394 case EEPROM_PRINT:
395 ret = parse_i2c_bus_addr(&i2c_bus, &i2c_addr, argc,
396 argv + index, 0);
397 break;
398 case EEPROM_UPDATE:
399 ret = parse_i2c_bus_addr(&i2c_bus, &i2c_addr, argc,
400 argv + index, 2);
401 break;
402 default:
403 /* Get compiler to stop whining */
404 return CMD_RET_USAGE;
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300405 }
406
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300407 if (ret == CMD_RET_USAGE)
408 return ret;
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300409
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300410 while (ret--)
411 NEXT_PARAM(argc, index);
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300412
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300413 if (action == EEPROM_READ || action == EEPROM_WRITE) {
414 addr = parse_numeric_param(argv[index]);
415 NEXT_PARAM(argc, index);
416 off = parse_numeric_param(argv[index]);
417 NEXT_PARAM(argc, index);
418 cnt = parse_numeric_param(argv[index]);
419 }
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300420
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300421#ifdef CONFIG_CMD_EEPROM_LAYOUT
422 if (action == EEPROM_UPDATE) {
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300423 field_name = argv[index];
424 NEXT_PARAM(argc, index);
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300425 field_value = argv[index];
426 NEXT_PARAM(argc, index);
427 }
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300428#endif
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300429
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300430 return eeprom_execute_command(action, i2c_bus, i2c_addr, layout_ver,
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300431 field_name, field_value, addr, off, cnt);
wdenk38635852002-08-27 05:55:31 +0000432}
Heiko Schocher548738b2010-01-07 08:55:40 +0100433
wdenk0d498392003-07-01 21:06:45 +0000434U_BOOT_CMD(
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300435 eeprom, 8, 1, do_eeprom,
Peter Tyser2fb26042009-01-27 18:03:12 -0600436 "EEPROM sub-system",
Marek Vasutd4fec4e2015-11-10 20:53:32 +0100437 "read <bus> <devaddr> addr off cnt\n"
438 "eeprom write <bus> <devaddr> addr off cnt\n"
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200439 " - read/write `cnt' bytes from `devaddr` EEPROM at offset `off'"
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300440#ifdef CONFIG_CMD_EEPROM_LAYOUT
441 "\n"
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300442 "eeprom print [-l <layout_version>] <bus> <devaddr>\n"
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300443 " - Print layout fields and their data in human readable format\n"
Nikita Kiryanov3dc9be82016-04-16 17:55:13 +0300444 "eeprom update [-l <layout_version>] <bus> <devaddr> field_name field_value\n"
Nikita Kiryanovaa9e6042016-04-16 17:55:03 +0300445 " - Update a specific eeprom field with new data.\n"
446 " The new data must be written in the same human readable format as shown by the print command.\n"
447 "\n"
448 "LAYOUT VERSIONS\n"
449 "The -l option can be used to force the command to interpret the EEPROM data using the chosen layout.\n"
450 "If the -l option is omitted, the command will auto detect the layout based on the data in the EEPROM.\n"
451 "The values which can be provided with the -l option are:\n"
452 CONFIG_EEPROM_LAYOUT_HELP_STRING"\n"
453#endif
Jeroen Hofstee0e350f82014-06-23 00:22:08 +0200454)