blob: 4052cf494a51db3de6c82002e4a04f47d4805e1f [file] [log] [blame]
Tom Rini10e47792018-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
m8a484c602005-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 Meerwaldc48ae8c2012-02-08 05:31:53 +000011 * write delay. Also, there is no limit imposed on the number of bytes that can
m8a484c602005-08-12 21:16:13 +020012 * be transferred with a single read or write.
Wolfgang Denke4e5e4e2005-08-19 00:46:54 +020013 *
m8a484c602005-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 Denke4e5e4e2005-08-19 00:46:54 +020016 *
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020017 * #define CONFIG_SYS_I2C_FRAM
18 * #undef CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
m8a484c602005-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 Kiryanov91f226a2016-04-16 17:55:12 +030026#include <eeprom_layout.h>
wdenk38635852002-08-27 05:55:31 +000027
Marek Vasut704a0962015-11-10 20:53:18 +010028#ifndef CONFIG_SYS_I2C_SPEED
29#define CONFIG_SYS_I2C_SPEED 50000
Stefan Roesed9d97742005-09-22 09:04:17 +020030#endif
wdenk38635852002-08-27 05:55:31 +000031
Marek Vasutd848b082015-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 Vasut42086792015-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 Sixdf0a9142016-04-20 10:44:52 +020040#ifndef I2C_RXTX_LEN
41#define I2C_RXTX_LEN 128
42#endif
43
Marek Vasut42086792015-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 Vasut704a0962015-11-10 20:53:18 +010047/*
Jean-Christophe PLAGNIOL-VILLARD03836942008-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-VILLARD03836942008-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 Schocher9bb0dd52010-01-07 08:55:40 +010054#if !defined(CONFIG_SPI) || defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
Marek Vasut704a0962015-11-10 20:53:18 +010055#if !defined(CONFIG_SYS_I2C_EEPROM_ADDR_LEN) || \
Marek Vasuta24ea7a2015-11-10 20:53:33 +010056 (CONFIG_SYS_I2C_EEPROM_ADDR_LEN < 1) || \
57 (CONFIG_SYS_I2C_EEPROM_ADDR_LEN > 2)
Jean-Christophe PLAGNIOL-VILLARD03836942008-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
Marek Vasut704a0962015-11-10 20:53:18 +010060#endif
61
Marek Vasut2a632ffc2015-11-10 20:53:25 +010062__weak int eeprom_write_enable(unsigned dev_addr, int state)
63{
64 return 0;
65}
Marek Vasut704a0962015-11-10 20:53:18 +010066
Marek Vasutf422ae72015-11-10 20:53:31 +010067void eeprom_init(int bus)
Marek Vasut704a0962015-11-10 20:53:18 +010068{
69 /* SPI EEPROM */
Adam Ford4e96ff82018-04-15 13:51:26 -040070#if defined(CONFIG_MPC8XX_SPI) && !defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
Marek Vasuta1d4aeb2015-11-10 20:53:27 +010071 spi_init_f();
Marek Vasut704a0962015-11-10 20:53:18 +010072#endif
73
74 /* I2C EEPROM */
Marek Vasutf422ae72015-11-10 20:53:31 +010075#if defined(CONFIG_SYS_I2C)
76 if (bus >= 0)
77 i2c_set_bus_num(bus);
Marek Vasut704a0962015-11-10 20:53:18 +010078 i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
wdenk38635852002-08-27 05:55:31 +000079#endif
Marek Vasut704a0962015-11-10 20:53:18 +010080}
wdenk38635852002-08-27 05:55:31 +000081
Marek Vasut6ae59572015-11-10 20:53:24 +010082static int eeprom_addr(unsigned dev_addr, unsigned offset, uchar *addr)
83{
84 unsigned blk_off;
85 int alen;
86
87 blk_off = offset & 0xff; /* block offset */
88#if CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 1
89 addr[0] = offset >> 8; /* block number */
90 addr[1] = blk_off; /* block offset */
91 alen = 2;
92#else
93 addr[0] = offset >> 16; /* block number */
94 addr[1] = offset >> 8; /* upper address octet */
95 addr[2] = blk_off; /* lower address octet */
96 alen = 3;
97#endif /* CONFIG_SYS_I2C_EEPROM_ADDR_LEN */
98
99 addr[0] |= dev_addr; /* insert device address */
100
101 return alen;
102}
103
Marek Vasutd062c482015-11-10 20:53:29 +0100104static int eeprom_len(unsigned offset, unsigned end)
105{
106 unsigned len = end - offset;
107
108 /*
109 * For a FRAM device there is no limit on the number of the
110 * bytes that can be ccessed with the single read or write
111 * operation.
112 */
113#if !defined(CONFIG_SYS_I2C_FRAM)
114 unsigned blk_off = offset & 0xff;
115 unsigned maxlen = EEPROM_PAGE_SIZE - EEPROM_PAGE_OFFSET(blk_off);
116
117 if (maxlen > I2C_RXTX_LEN)
118 maxlen = I2C_RXTX_LEN;
119
120 if (len > maxlen)
121 len = maxlen;
122#endif
123
124 return len;
125}
126
Marek Vasut78990c72015-11-10 20:53:23 +0100127static int eeprom_rw_block(unsigned offset, uchar *addr, unsigned alen,
128 uchar *buffer, unsigned len, bool read)
129{
130 int ret = 0;
131
132 /* SPI */
Adam Ford4e96ff82018-04-15 13:51:26 -0400133#if defined(CONFIG_MPC8XX_SPI) && !defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
Marek Vasut78990c72015-11-10 20:53:23 +0100134 if (read)
135 spi_read(addr, alen, buffer, len);
136 else
137 spi_write(addr, alen, buffer, len);
138#else /* I2C */
139
140#if defined(CONFIG_SYS_I2C_EEPROM_BUS)
141 i2c_set_bus_num(CONFIG_SYS_I2C_EEPROM_BUS);
142#endif
143
144 if (read)
145 ret = i2c_read(addr[0], offset, alen - 1, buffer, len);
146 else
147 ret = i2c_write(addr[0], offset, alen - 1, buffer, len);
148
149 if (ret)
150 ret = 1;
151#endif
152 return ret;
153}
154
Marek Vasut7a237212015-11-10 20:53:30 +0100155static int eeprom_rw(unsigned dev_addr, unsigned offset, uchar *buffer,
156 unsigned cnt, bool read)
wdenk38635852002-08-27 05:55:31 +0000157{
158 unsigned end = offset + cnt;
Marek Vasut7a237212015-11-10 20:53:30 +0100159 unsigned alen, len;
wdenk38635852002-08-27 05:55:31 +0000160 int rcode = 0;
Marek Vasut6ae59572015-11-10 20:53:24 +0100161 uchar addr[3];
wdenk38635852002-08-27 05:55:31 +0000162
wdenk38635852002-08-27 05:55:31 +0000163 while (offset < end) {
Marek Vasut6ae59572015-11-10 20:53:24 +0100164 alen = eeprom_addr(dev_addr, offset, addr);
wdenk38635852002-08-27 05:55:31 +0000165
Marek Vasutd062c482015-11-10 20:53:29 +0100166 len = eeprom_len(offset, end);
m8a484c602005-08-12 21:16:13 +0200167
Marek Vasut7a237212015-11-10 20:53:30 +0100168 rcode = eeprom_rw_block(offset, addr, alen, buffer, len, read);
Marek Vasut78990c72015-11-10 20:53:23 +0100169
wdenk38635852002-08-27 05:55:31 +0000170 buffer += len;
171 offset += len;
Marek Vasut7a237212015-11-10 20:53:30 +0100172
173 if (!read)
174 udelay(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
wdenk38635852002-08-27 05:55:31 +0000175 }
m8a484c602005-08-12 21:16:13 +0200176
wdenk38635852002-08-27 05:55:31 +0000177 return rcode;
178}
179
Marek Vasut7a237212015-11-10 20:53:30 +0100180int eeprom_read(unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt)
wdenk38635852002-08-27 05:55:31 +0000181{
Marek Vasut7a237212015-11-10 20:53:30 +0100182 /*
183 * Read data until done or would cross a page boundary.
184 * We must write the address again when changing pages
185 * because the next page may be in a different device.
186 */
187 return eeprom_rw(dev_addr, offset, buffer, cnt, 1);
188}
189
Marek Vasuta24ea7a2015-11-10 20:53:33 +0100190int eeprom_write(unsigned dev_addr, unsigned offset,
191 uchar *buffer, unsigned cnt)
Marek Vasut7a237212015-11-10 20:53:30 +0100192{
193 int ret;
wdenk38635852002-08-27 05:55:31 +0000194
Marek Vasut2a632ffc2015-11-10 20:53:25 +0100195 eeprom_write_enable(dev_addr, 1);
196
Marek Vasut704a0962015-11-10 20:53:18 +0100197 /*
198 * Write data until done or would cross a write page boundary.
wdenk38635852002-08-27 05:55:31 +0000199 * We must write the address again when changing pages
200 * because the address counter only increments within a page.
201 */
Alexey Brodkin90eed7f2015-12-14 18:45:34 +0300202 ret = eeprom_rw(dev_addr, offset, buffer, cnt, 0);
Marek Vasut2a632ffc2015-11-10 20:53:25 +0100203
204 eeprom_write_enable(dev_addr, 0);
Marek Vasut7a237212015-11-10 20:53:30 +0100205 return ret;
wdenk38635852002-08-27 05:55:31 +0000206}
207
Nikita Kiryanovadb62f02016-04-16 17:55:11 +0300208static int parse_numeric_param(char *str)
209{
210 char *endptr;
211 int value = simple_strtol(str, &endptr, 16);
212
213 return (*endptr != '\0') ? -1 : value;
214}
215
216/**
217 * parse_i2c_bus_addr - parse the i2c bus and i2c devaddr parameters
218 *
219 * @i2c_bus: address to store the i2c bus
220 * @i2c_addr: address to store the device i2c address
221 * @argc: count of command line arguments left to parse
222 * @argv: command line arguments left to parse
223 * @argc_no_bus_addr: argc value we expect to see when bus & addr aren't given
224 *
225 * @returns: number of arguments parsed or CMD_RET_USAGE if error
226 */
227static int parse_i2c_bus_addr(int *i2c_bus, ulong *i2c_addr, int argc,
228 char * const argv[], int argc_no_bus_addr)
229{
230 int argc_no_bus = argc_no_bus_addr + 1;
231 int argc_bus_addr = argc_no_bus_addr + 2;
232
233#ifdef CONFIG_SYS_DEF_EEPROM_ADDR
234 if (argc == argc_no_bus_addr) {
235 *i2c_bus = -1;
236 *i2c_addr = CONFIG_SYS_DEF_EEPROM_ADDR;
237
238 return 0;
239 }
240#endif
241 if (argc == argc_no_bus) {
242 *i2c_bus = -1;
243 *i2c_addr = parse_numeric_param(argv[0]);
244
245 return 1;
246 }
247
248 if (argc == argc_bus_addr) {
249 *i2c_bus = parse_numeric_param(argv[0]);
250 *i2c_addr = parse_numeric_param(argv[1]);
251
252 return 2;
253 }
254
255 return CMD_RET_USAGE;
256}
257
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300258#ifdef CONFIG_CMD_EEPROM_LAYOUT
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300259
260__weak int eeprom_parse_layout_version(char *str)
261{
262 return LAYOUT_VERSION_UNRECOGNIZED;
263}
264
265static unsigned char eeprom_buf[CONFIG_SYS_EEPROM_SIZE];
266
Nikita Kiryanov91f226a2016-04-16 17:55:12 +0300267#endif
268
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300269enum eeprom_action {
Nikita Kiryanov91f226a2016-04-16 17:55:12 +0300270 EEPROM_READ,
271 EEPROM_WRITE,
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300272 EEPROM_PRINT,
273 EEPROM_UPDATE,
274 EEPROM_ACTION_INVALID,
275};
276
277static enum eeprom_action parse_action(char *cmd)
278{
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300279 if (!strncmp(cmd, "read", 4))
280 return EEPROM_READ;
281 if (!strncmp(cmd, "write", 5))
282 return EEPROM_WRITE;
283#ifdef CONFIG_CMD_EEPROM_LAYOUT
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300284 if (!strncmp(cmd, "print", 5))
285 return EEPROM_PRINT;
286 if (!strncmp(cmd, "update", 6))
287 return EEPROM_UPDATE;
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300288#endif
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300289
290 return EEPROM_ACTION_INVALID;
291}
292
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300293static int eeprom_execute_command(enum eeprom_action action, int i2c_bus,
Nikita Kiryanov91f226a2016-04-16 17:55:12 +0300294 ulong i2c_addr, int layout_ver, char *key,
295 char *value, ulong addr, ulong off, ulong cnt)
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300296{
Nikita Kiryanov91f226a2016-04-16 17:55:12 +0300297 int rcode = 0;
298 const char *const fmt =
299 "\nEEPROM @0x%lX %s: addr %08lx off %04lx count %ld ... ";
300#ifdef CONFIG_CMD_EEPROM_LAYOUT
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300301 struct eeprom_layout layout;
Nikita Kiryanov91f226a2016-04-16 17:55:12 +0300302#endif
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300303
304 if (action == EEPROM_ACTION_INVALID)
305 return CMD_RET_USAGE;
306
307 eeprom_init(i2c_bus);
Nikita Kiryanov91f226a2016-04-16 17:55:12 +0300308 if (action == EEPROM_READ) {
309 printf(fmt, i2c_addr, "read", addr, off, cnt);
310
311 rcode = eeprom_read(i2c_addr, off, (uchar *)addr, cnt);
312
313 puts("done\n");
314 return rcode;
315 } else if (action == EEPROM_WRITE) {
316 printf(fmt, i2c_addr, "write", addr, off, cnt);
317
318 rcode = eeprom_write(i2c_addr, off, (uchar *)addr, cnt);
319
320 puts("done\n");
321 return rcode;
322 }
323
324#ifdef CONFIG_CMD_EEPROM_LAYOUT
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300325 rcode = eeprom_read(i2c_addr, 0, eeprom_buf, CONFIG_SYS_EEPROM_SIZE);
326 if (rcode < 0)
327 return rcode;
328
329 eeprom_layout_setup(&layout, eeprom_buf, CONFIG_SYS_EEPROM_SIZE,
330 layout_ver);
331
332 if (action == EEPROM_PRINT) {
333 layout.print(&layout);
334 return 0;
335 }
336
337 layout.update(&layout, key, value);
338
339 rcode = eeprom_write(i2c_addr, 0, layout.data, CONFIG_SYS_EEPROM_SIZE);
Nikita Kiryanov91f226a2016-04-16 17:55:12 +0300340#endif
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300341
342 return rcode;
343}
344
345#define NEXT_PARAM(argc, index) { (argc)--; (index)++; }
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300346int do_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300347{
348 int layout_ver = LAYOUT_VERSION_AUTODETECT;
349 enum eeprom_action action = EEPROM_ACTION_INVALID;
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300350 int i2c_bus = -1, index = 0;
351 ulong i2c_addr = -1, addr = 0, cnt = 0, off = 0;
352 int ret;
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300353 char *field_name = "";
354 char *field_value = "";
355
356 if (argc <= 1)
357 return CMD_RET_USAGE;
358
359 NEXT_PARAM(argc, index); /* Skip program name */
360
361 action = parse_action(argv[index]);
362 NEXT_PARAM(argc, index);
363
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300364 if (action == EEPROM_ACTION_INVALID)
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300365 return CMD_RET_USAGE;
366
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300367#ifdef CONFIG_CMD_EEPROM_LAYOUT
368 if (action == EEPROM_PRINT || action == EEPROM_UPDATE) {
369 if (!strcmp(argv[index], "-l")) {
370 NEXT_PARAM(argc, index);
371 layout_ver = eeprom_parse_layout_version(argv[index]);
372 NEXT_PARAM(argc, index);
373 }
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300374 }
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300375#endif
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300376
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300377 switch (action) {
378 case EEPROM_READ:
379 case EEPROM_WRITE:
380 ret = parse_i2c_bus_addr(&i2c_bus, &i2c_addr, argc,
381 argv + index, 3);
382 break;
383 case EEPROM_PRINT:
384 ret = parse_i2c_bus_addr(&i2c_bus, &i2c_addr, argc,
385 argv + index, 0);
386 break;
387 case EEPROM_UPDATE:
388 ret = parse_i2c_bus_addr(&i2c_bus, &i2c_addr, argc,
389 argv + index, 2);
390 break;
391 default:
392 /* Get compiler to stop whining */
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300393 return CMD_RET_USAGE;
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300394 }
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300395
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300396 if (ret == CMD_RET_USAGE)
397 return ret;
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300398
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300399 while (ret--)
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300400 NEXT_PARAM(argc, index);
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300401
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300402 if (action == EEPROM_READ || action == EEPROM_WRITE) {
403 addr = parse_numeric_param(argv[index]);
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300404 NEXT_PARAM(argc, index);
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300405 off = parse_numeric_param(argv[index]);
406 NEXT_PARAM(argc, index);
407 cnt = parse_numeric_param(argv[index]);
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300408 }
409
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300410#ifdef CONFIG_CMD_EEPROM_LAYOUT
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300411 if (action == EEPROM_UPDATE) {
412 field_name = argv[index];
413 NEXT_PARAM(argc, index);
414 field_value = argv[index];
415 NEXT_PARAM(argc, index);
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300416 }
417#endif
418
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300419 return eeprom_execute_command(action, i2c_bus, i2c_addr, layout_ver,
420 field_name, field_value, addr, off, cnt);
Marek Vasut704a0962015-11-10 20:53:18 +0100421}
wdenk57b2d802003-06-27 21:31:46 +0000422
wdenkf287a242003-07-01 21:06:45 +0000423U_BOOT_CMD(
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300424 eeprom, 8, 1, do_eeprom,
Peter Tyserdfb72b82009-01-27 18:03:12 -0600425 "EEPROM sub-system",
Marek Vasut4d17f712015-11-10 20:53:32 +0100426 "read <bus> <devaddr> addr off cnt\n"
427 "eeprom write <bus> <devaddr> addr off cnt\n"
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200428 " - read/write `cnt' bytes from `devaddr` EEPROM at offset `off'"
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300429#ifdef CONFIG_CMD_EEPROM_LAYOUT
430 "\n"
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300431 "eeprom print [-l <layout_version>] <bus> <devaddr>\n"
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300432 " - Print layout fields and their data in human readable format\n"
Nikita Kiryanov9e559fd2016-04-16 17:55:13 +0300433 "eeprom update [-l <layout_version>] <bus> <devaddr> field_name field_value\n"
Nikita Kiryanov37dda1c2016-04-16 17:55:03 +0300434 " - Update a specific eeprom field with new data.\n"
435 " The new data must be written in the same human readable format as shown by the print command.\n"
436 "\n"
437 "LAYOUT VERSIONS\n"
438 "The -l option can be used to force the command to interpret the EEPROM data using the chosen layout.\n"
439 "If the -l option is omitted, the command will auto detect the layout based on the data in the EEPROM.\n"
440 "The values which can be provided with the -l option are:\n"
441 CONFIG_EEPROM_LAYOUT_HELP_STRING"\n"
442#endif
Jeroen Hofsteef384fbf2014-06-23 00:22:08 +0200443)