blob: e9904cd6982bad704260e4a5c247ddb8342a3a65 [file] [log] [blame]
wdenk38635852002-08-27 05:55:31 +00001/*
2 * (C) Copyright 2000, 2001
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
wdenk38635852002-08-27 05:55:31 +00006 */
7
d4f5c722005-08-12 21:16:13 +02008/*
9 * Support for read and write access to EEPROM like memory devices. This
10 * includes regular EEPROM as well as FRAM (ferroelectic nonvolaile RAM).
11 * FRAM devices read and write data at bus speed. In particular, there is no
Peter Meerwalde506a002012-02-08 05:31:53 +000012 * write delay. Also, there is no limit imposed on the number of bytes that can
d4f5c722005-08-12 21:16:13 +020013 * be transferred with a single read or write.
Wolfgang Denk6617aae2005-08-19 00:46:54 +020014 *
d4f5c722005-08-12 21:16:13 +020015 * Use the following configuration options to ensure no unneeded performance
16 * degradation (typical for EEPROM) is incured for FRAM memory:
Wolfgang Denk6617aae2005-08-19 00:46:54 +020017 *
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020018 * #define CONFIG_SYS_I2C_FRAM
19 * #undef CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
d4f5c722005-08-12 21:16:13 +020020 *
21 */
22
wdenk38635852002-08-27 05:55:31 +000023#include <common.h>
24#include <config.h>
25#include <command.h>
26#include <i2c.h>
27
wdenk38635852002-08-27 05:55:31 +000028extern void eeprom_init (void);
29extern int eeprom_read (unsigned dev_addr, unsigned offset,
30 uchar *buffer, unsigned cnt);
31extern int eeprom_write (unsigned dev_addr, unsigned offset,
32 uchar *buffer, unsigned cnt);
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020033#if defined(CONFIG_SYS_EEPROM_WREN)
Stefan Roese98f4a3d2005-09-22 09:04:17 +020034extern int eeprom_write_enable (unsigned dev_addr, int state);
35#endif
wdenk38635852002-08-27 05:55:31 +000036
37
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020038#if defined(CONFIG_SYS_EEPROM_X40430)
wdenk38635852002-08-27 05:55:31 +000039 /* Maximum number of times to poll for acknowledge after write */
40#define MAX_ACKNOWLEDGE_POLLS 10
41#endif
42
43/* ------------------------------------------------------------------------- */
44
Jon Loeligerbaa26db2007-07-08 17:51:39 -050045#if defined(CONFIG_CMD_EEPROM)
Jeroen Hofstee0e350f82014-06-23 00:22:08 +020046static int do_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk38635852002-08-27 05:55:31 +000047{
48 const char *const fmt =
49 "\nEEPROM @0x%lX %s: addr %08lx off %04lx count %ld ... ";
50
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020051#if defined(CONFIG_SYS_I2C_MULTI_EEPROMS)
wdenk38635852002-08-27 05:55:31 +000052 if (argc == 6) {
53 ulong dev_addr = simple_strtoul (argv[2], NULL, 16);
54 ulong addr = simple_strtoul (argv[3], NULL, 16);
55 ulong off = simple_strtoul (argv[4], NULL, 16);
56 ulong cnt = simple_strtoul (argv[5], NULL, 16);
57#else
58 if (argc == 5) {
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020059 ulong dev_addr = CONFIG_SYS_DEF_EEPROM_ADDR;
wdenk38635852002-08-27 05:55:31 +000060 ulong addr = simple_strtoul (argv[2], NULL, 16);
61 ulong off = simple_strtoul (argv[3], NULL, 16);
62 ulong cnt = simple_strtoul (argv[4], NULL, 16);
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020063#endif /* CONFIG_SYS_I2C_MULTI_EEPROMS */
wdenk38635852002-08-27 05:55:31 +000064
Heiko Schocher548738b2010-01-07 08:55:40 +010065# if !defined(CONFIG_SPI) || defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
wdenk38635852002-08-27 05:55:31 +000066 eeprom_init ();
67# endif /* !CONFIG_SPI */
68
69 if (strcmp (argv[1], "read") == 0) {
70 int rcode;
71
72 printf (fmt, dev_addr, argv[1], addr, off, cnt);
73
74 rcode = eeprom_read (dev_addr, off, (uchar *) addr, cnt);
75
wdenk4b9206e2004-03-23 22:14:11 +000076 puts ("done\n");
wdenk38635852002-08-27 05:55:31 +000077 return rcode;
78 } else if (strcmp (argv[1], "write") == 0) {
79 int rcode;
80
81 printf (fmt, dev_addr, argv[1], addr, off, cnt);
82
83 rcode = eeprom_write (dev_addr, off, (uchar *) addr, cnt);
84
wdenk4b9206e2004-03-23 22:14:11 +000085 puts ("done\n");
wdenk38635852002-08-27 05:55:31 +000086 return rcode;
87 }
88 }
89
Simon Glass4c12eeb2011-12-10 08:44:01 +000090 return CMD_RET_USAGE;
wdenk38635852002-08-27 05:55:31 +000091}
Jon Loeliger90253172007-07-10 11:02:44 -050092#endif
wdenk38635852002-08-27 05:55:31 +000093
94/*-----------------------------------------------------------------------
95 *
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020096 * for CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 2 (16-bit EEPROM address) offset is
wdenk38635852002-08-27 05:55:31 +000097 * 0x000nxxxx for EEPROM address selectors at n, offset xxxx in EEPROM.
98 *
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020099 * for CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 1 (8-bit EEPROM page address) offset is
wdenk38635852002-08-27 05:55:31 +0000100 * 0x00000nxx for EEPROM address selectors and page number at n.
101 */
102
Heiko Schocher548738b2010-01-07 08:55:40 +0100103#if !defined(CONFIG_SPI) || defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200104#if !defined(CONFIG_SYS_I2C_EEPROM_ADDR_LEN) || CONFIG_SYS_I2C_EEPROM_ADDR_LEN < 1 || CONFIG_SYS_I2C_EEPROM_ADDR_LEN > 2
105#error CONFIG_SYS_I2C_EEPROM_ADDR_LEN must be 1 or 2
wdenk38635852002-08-27 05:55:31 +0000106#endif
107#endif
108
109int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt)
110{
111 unsigned end = offset + cnt;
112 unsigned blk_off;
113 int rcode = 0;
114
115 /* Read data until done or would cross a page boundary.
116 * We must write the address again when changing pages
117 * because the next page may be in a different device.
118 */
119 while (offset < end) {
d4f5c722005-08-12 21:16:13 +0200120 unsigned alen, len;
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200121#if !defined(CONFIG_SYS_I2C_FRAM)
d4f5c722005-08-12 21:16:13 +0200122 unsigned maxlen;
123#endif
124
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200125#if CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 1 && !defined(CONFIG_SPI_X)
wdenk38635852002-08-27 05:55:31 +0000126 uchar addr[2];
127
128 blk_off = offset & 0xFF; /* block offset */
129
130 addr[0] = offset >> 8; /* block number */
131 addr[1] = blk_off; /* block offset */
132 alen = 2;
133#else
134 uchar addr[3];
135
136 blk_off = offset & 0xFF; /* block offset */
137
138 addr[0] = offset >> 16; /* block number */
139 addr[1] = offset >> 8; /* upper address octet */
140 addr[2] = blk_off; /* lower address octet */
141 alen = 3;
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200142#endif /* CONFIG_SYS_I2C_EEPROM_ADDR_LEN, CONFIG_SPI_X */
wdenk38635852002-08-27 05:55:31 +0000143
144 addr[0] |= dev_addr; /* insert device address */
145
d4f5c722005-08-12 21:16:13 +0200146 len = end - offset;
147
148 /*
149 * For a FRAM device there is no limit on the number of the
150 * bytes that can be ccessed with the single read or write
151 * operation.
152 */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200153#if !defined(CONFIG_SYS_I2C_FRAM)
wdenk38635852002-08-27 05:55:31 +0000154 maxlen = 0x100 - blk_off;
155 if (maxlen > I2C_RXTX_LEN)
156 maxlen = I2C_RXTX_LEN;
wdenk38635852002-08-27 05:55:31 +0000157 if (len > maxlen)
158 len = maxlen;
d4f5c722005-08-12 21:16:13 +0200159#endif
160
Heiko Schocher548738b2010-01-07 08:55:40 +0100161#if defined(CONFIG_SPI) && !defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
wdenk38635852002-08-27 05:55:31 +0000162 spi_read (addr, alen, buffer, len);
163#else
Christian Gmeiner189d2572015-02-11 15:19:31 +0100164#if defined(CONFIG_SYS_I2C_EEPROM_BUS)
165 i2c_set_bus_num(CONFIG_SYS_I2C_EEPROM_BUS);
166#endif
Kuo-Jung Su6ca6d082013-12-02 16:02:59 +0800167 if (i2c_read(addr[0], offset, alen - 1, buffer, len))
wdenk38635852002-08-27 05:55:31 +0000168 rcode = 1;
169#endif
170 buffer += len;
171 offset += len;
172 }
d4f5c722005-08-12 21:16:13 +0200173
wdenk38635852002-08-27 05:55:31 +0000174 return rcode;
175}
176
177/*-----------------------------------------------------------------------
178 *
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200179 * for CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 2 (16-bit EEPROM address) offset is
wdenk38635852002-08-27 05:55:31 +0000180 * 0x000nxxxx for EEPROM address selectors at n, offset xxxx in EEPROM.
181 *
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200182 * for CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 1 (8-bit EEPROM page address) offset is
wdenk38635852002-08-27 05:55:31 +0000183 * 0x00000nxx for EEPROM address selectors and page number at n.
184 */
185
186int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt)
187{
188 unsigned end = offset + cnt;
189 unsigned blk_off;
190 int rcode = 0;
191
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200192#if defined(CONFIG_SYS_EEPROM_X40430)
wdenk38635852002-08-27 05:55:31 +0000193 uchar contr_r_addr[2];
194 uchar addr_void[2];
195 uchar contr_reg[2];
196 uchar ctrl_reg_v;
197 int i;
198#endif
199
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200200#if defined(CONFIG_SYS_EEPROM_WREN)
Stefan Roese98f4a3d2005-09-22 09:04:17 +0200201 eeprom_write_enable (dev_addr,1);
202#endif
wdenk38635852002-08-27 05:55:31 +0000203 /* Write data until done or would cross a write page boundary.
204 * We must write the address again when changing pages
205 * because the address counter only increments within a page.
206 */
207
208 while (offset < end) {
d4f5c722005-08-12 21:16:13 +0200209 unsigned alen, len;
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200210#if !defined(CONFIG_SYS_I2C_FRAM)
d4f5c722005-08-12 21:16:13 +0200211 unsigned maxlen;
212#endif
213
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200214#if CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 1 && !defined(CONFIG_SPI_X)
wdenk38635852002-08-27 05:55:31 +0000215 uchar addr[2];
216
217 blk_off = offset & 0xFF; /* block offset */
218
219 addr[0] = offset >> 8; /* block number */
220 addr[1] = blk_off; /* block offset */
221 alen = 2;
222#else
223 uchar addr[3];
224
225 blk_off = offset & 0xFF; /* block offset */
226
227 addr[0] = offset >> 16; /* block number */
228 addr[1] = offset >> 8; /* upper address octet */
229 addr[2] = blk_off; /* lower address octet */
230 alen = 3;
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200231#endif /* CONFIG_SYS_I2C_EEPROM_ADDR_LEN, CONFIG_SPI_X */
wdenk38635852002-08-27 05:55:31 +0000232
233 addr[0] |= dev_addr; /* insert device address */
234
d4f5c722005-08-12 21:16:13 +0200235 len = end - offset;
236
237 /*
238 * For a FRAM device there is no limit on the number of the
Michael Jonesf9a78b82011-07-14 22:09:28 +0000239 * bytes that can be accessed with the single read or write
d4f5c722005-08-12 21:16:13 +0200240 * operation.
241 */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200242#if !defined(CONFIG_SYS_I2C_FRAM)
d4f5c722005-08-12 21:16:13 +0200243
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200244#if defined(CONFIG_SYS_EEPROM_PAGE_WRITE_BITS)
wdenk38635852002-08-27 05:55:31 +0000245
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200246#define EEPROM_PAGE_SIZE (1 << CONFIG_SYS_EEPROM_PAGE_WRITE_BITS)
wdenk38635852002-08-27 05:55:31 +0000247#define EEPROM_PAGE_OFFSET(x) ((x) & (EEPROM_PAGE_SIZE - 1))
248
249 maxlen = EEPROM_PAGE_SIZE - EEPROM_PAGE_OFFSET(blk_off);
250#else
251 maxlen = 0x100 - blk_off;
252#endif
253 if (maxlen > I2C_RXTX_LEN)
254 maxlen = I2C_RXTX_LEN;
255
wdenk38635852002-08-27 05:55:31 +0000256 if (len > maxlen)
257 len = maxlen;
d4f5c722005-08-12 21:16:13 +0200258#endif
259
Heiko Schocher548738b2010-01-07 08:55:40 +0100260#if defined(CONFIG_SPI) && !defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
wdenk38635852002-08-27 05:55:31 +0000261 spi_write (addr, alen, buffer, len);
262#else
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200263#if defined(CONFIG_SYS_EEPROM_X40430)
wdenk38635852002-08-27 05:55:31 +0000264 /* Get the value of the control register.
265 * Set current address (internal pointer in the x40430)
266 * to 0x1ff.
267 */
268 contr_r_addr[0] = 9;
269 contr_r_addr[1] = 0xff;
270 addr_void[0] = 0;
271 addr_void[1] = addr[1];
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200272#ifdef CONFIG_SYS_I2C_EEPROM_ADDR
273 contr_r_addr[0] |= CONFIG_SYS_I2C_EEPROM_ADDR;
274 addr_void[0] |= CONFIG_SYS_I2C_EEPROM_ADDR;
wdenk38635852002-08-27 05:55:31 +0000275#endif
276 contr_reg[0] = 0xff;
277 if (i2c_read (contr_r_addr[0], contr_r_addr[1], 1, contr_reg, 1) != 0) {
278 rcode = 1;
279 }
280 ctrl_reg_v = contr_reg[0];
281
282 /* Are any of the eeprom blocks write protected?
283 */
284 if (ctrl_reg_v & 0x18) {
285 ctrl_reg_v &= ~0x18; /* reset block protect bits */
286 ctrl_reg_v |= 0x02; /* set write enable latch */
287 ctrl_reg_v &= ~0x04; /* clear RWEL */
288
289 /* Set write enable latch.
290 */
291 contr_reg[0] = 0x02;
292 if (i2c_write (contr_r_addr[0], 0xff, 1, contr_reg, 1) != 0) {
293 rcode = 1;
294 }
295
296 /* Set register write enable latch.
297 */
298 contr_reg[0] = 0x06;
299 if (i2c_write (contr_r_addr[0], 0xFF, 1, contr_reg, 1) != 0) {
300 rcode = 1;
301 }
302
303 /* Modify ctrl register.
304 */
305 contr_reg[0] = ctrl_reg_v;
306 if (i2c_write (contr_r_addr[0], 0xFF, 1, contr_reg, 1) != 0) {
307 rcode = 1;
308 }
309
310 /* The write (above) is an operation on NV memory.
311 * These can take some time (~5ms), and the device
312 * will not respond to further I2C messages till
313 * it's completed the write.
314 * So poll device for an I2C acknowledge.
315 * When we get one we know we can continue with other
316 * operations.
317 */
318 contr_reg[0] = 0;
319 for (i = 0; i < MAX_ACKNOWLEDGE_POLLS; i++) {
wdenkaacf9a42003-01-17 16:27:01 +0000320 if (i2c_read (addr_void[0], addr_void[1], 1, contr_reg, 1) == 0)
wdenk38635852002-08-27 05:55:31 +0000321 break; /* got ack */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200322#if defined(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS)
323 udelay(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
wdenk38635852002-08-27 05:55:31 +0000324#endif
325 }
326 if (i == MAX_ACKNOWLEDGE_POLLS) {
wdenk4b9206e2004-03-23 22:14:11 +0000327 puts ("EEPROM poll acknowledge failed\n");
wdenk38635852002-08-27 05:55:31 +0000328 rcode = 1;
329 }
330 }
331
332 /* Is the write enable latch on?.
333 */
334 else if (!(ctrl_reg_v & 0x02)) {
335 /* Set write enable latch.
336 */
337 contr_reg[0] = 0x02;
338 if (i2c_write (contr_r_addr[0], 0xFF, 1, contr_reg, 1) != 0) {
339 rcode = 1;
340 }
341 }
342 /* Write is enabled ... now write eeprom value.
343 */
344#endif
Christian Gmeiner189d2572015-02-11 15:19:31 +0100345#if defined(CONFIG_SYS_I2C_EEPROM_BUS)
346 i2c_set_bus_num(CONFIG_SYS_I2C_EEPROM_BUS);
347#endif
Kuo-Jung Su6ca6d082013-12-02 16:02:59 +0800348 if (i2c_write(addr[0], offset, alen - 1, buffer, len))
wdenk38635852002-08-27 05:55:31 +0000349 rcode = 1;
350
351#endif
352 buffer += len;
353 offset += len;
354
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200355#if defined(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS)
356 udelay(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
wdenk38635852002-08-27 05:55:31 +0000357#endif
358 }
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200359#if defined(CONFIG_SYS_EEPROM_WREN)
Stefan Roese98f4a3d2005-09-22 09:04:17 +0200360 eeprom_write_enable (dev_addr,0);
361#endif
wdenk38635852002-08-27 05:55:31 +0000362 return rcode;
363}
364
Heiko Schocher548738b2010-01-07 08:55:40 +0100365#if !defined(CONFIG_SPI) || defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
wdenk6dd652f2003-06-19 23:40:20 +0000366int
367eeprom_probe (unsigned dev_addr, unsigned offset)
368{
369 unsigned char chip;
370
371 /* Probe the chip address
372 */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200373#if CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 1 && !defined(CONFIG_SPI_X)
wdenk6dd652f2003-06-19 23:40:20 +0000374 chip = offset >> 8; /* block number */
375#else
376 chip = offset >> 16; /* block number */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200377#endif /* CONFIG_SYS_I2C_EEPROM_ADDR_LEN, CONFIG_SPI_X */
wdenk6dd652f2003-06-19 23:40:20 +0000378
379 chip |= dev_addr; /* insert device address */
380
381 return (i2c_probe (chip));
382}
383#endif
384
wdenk38635852002-08-27 05:55:31 +0000385/*-----------------------------------------------------------------------
386 * Set default values
387 */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200388#ifndef CONFIG_SYS_I2C_SPEED
389#define CONFIG_SYS_I2C_SPEED 50000
wdenk38635852002-08-27 05:55:31 +0000390#endif
391
wdenk38635852002-08-27 05:55:31 +0000392void eeprom_init (void)
393{
Heiko Schocher548738b2010-01-07 08:55:40 +0100394
395#if defined(CONFIG_SPI) && !defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
wdenk38635852002-08-27 05:55:31 +0000396 spi_init_f ();
397#endif
Valentin Longchamp4bf3a562014-10-14 11:16:33 +0200398#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT)
399 i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
wdenk38635852002-08-27 05:55:31 +0000400#endif
401}
Heiko Schocher548738b2010-01-07 08:55:40 +0100402
wdenk38635852002-08-27 05:55:31 +0000403/*-----------------------------------------------------------------------
404 */
Jon Loeliger90253172007-07-10 11:02:44 -0500405
wdenk8bde7f72003-06-27 21:31:46 +0000406/***************************************************/
407
Jon Loeligerbaa26db2007-07-08 17:51:39 -0500408#if defined(CONFIG_CMD_EEPROM)
wdenk8bde7f72003-06-27 21:31:46 +0000409
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200410#ifdef CONFIG_SYS_I2C_MULTI_EEPROMS
wdenk0d498392003-07-01 21:06:45 +0000411U_BOOT_CMD(
412 eeprom, 6, 1, do_eeprom,
Peter Tyser2fb26042009-01-27 18:03:12 -0600413 "EEPROM sub-system",
wdenk8bde7f72003-06-27 21:31:46 +0000414 "read devaddr addr off cnt\n"
415 "eeprom write devaddr addr off cnt\n"
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200416 " - read/write `cnt' bytes from `devaddr` EEPROM at offset `off'"
Jeroen Hofstee0e350f82014-06-23 00:22:08 +0200417)
wdenk8bde7f72003-06-27 21:31:46 +0000418#else /* One EEPROM */
wdenk0d498392003-07-01 21:06:45 +0000419U_BOOT_CMD(
420 eeprom, 5, 1, do_eeprom,
Peter Tyser2fb26042009-01-27 18:03:12 -0600421 "EEPROM sub-system",
wdenk8bde7f72003-06-27 21:31:46 +0000422 "read addr off cnt\n"
423 "eeprom write addr off cnt\n"
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200424 " - read/write `cnt' bytes at EEPROM offset `off'"
Jeroen Hofstee0e350f82014-06-23 00:22:08 +0200425)
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200426#endif /* CONFIG_SYS_I2C_MULTI_EEPROMS */
wdenk8bde7f72003-06-27 21:31:46 +0000427
Jon Loeliger90253172007-07-10 11:02:44 -0500428#endif