Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Command for accessing SPI flash. |
| 3 | * |
| 4 | * Copyright (C) 2008 Atmel Corporation |
Mike Frysinger | 4166ee5 | 2009-10-09 17:12:44 -0400 | [diff] [blame] | 5 | * Licensed under the GPL-2 or later. |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 6 | */ |
Mike Frysinger | 4166ee5 | 2009-10-09 17:12:44 -0400 | [diff] [blame] | 7 | |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 8 | #include <common.h> |
Simon Glass | 8d1af94 | 2011-08-22 16:03:46 -0700 | [diff] [blame] | 9 | #include <malloc.h> |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 10 | #include <spi_flash.h> |
| 11 | |
| 12 | #include <asm/io.h> |
| 13 | |
| 14 | #ifndef CONFIG_SF_DEFAULT_SPEED |
| 15 | # define CONFIG_SF_DEFAULT_SPEED 1000000 |
| 16 | #endif |
| 17 | #ifndef CONFIG_SF_DEFAULT_MODE |
| 18 | # define CONFIG_SF_DEFAULT_MODE SPI_MODE_3 |
| 19 | #endif |
Eric Nelson | c1173bd | 2012-01-31 10:52:07 -0700 | [diff] [blame] | 20 | #ifndef CONFIG_SF_DEFAULT_CS |
| 21 | # define CONFIG_SF_DEFAULT_CS 0 |
| 22 | #endif |
| 23 | #ifndef CONFIG_SF_DEFAULT_BUS |
| 24 | # define CONFIG_SF_DEFAULT_BUS 0 |
| 25 | #endif |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 26 | |
| 27 | static struct spi_flash *flash; |
| 28 | |
Richard Retanubun | 334eb4b | 2011-02-16 16:39:44 -0500 | [diff] [blame] | 29 | |
| 30 | /* |
| 31 | * This function computes the length argument for the erase command. |
| 32 | * The length on which the command is to operate can be given in two forms: |
| 33 | * 1. <cmd> offset len - operate on <'offset', 'len') |
| 34 | * 2. <cmd> offset +len - operate on <'offset', 'round_up(len)') |
| 35 | * If the second form is used and the length doesn't fall on the |
| 36 | * sector boundary, than it will be adjusted to the next sector boundary. |
| 37 | * If it isn't in the flash, the function will fail (return -1). |
| 38 | * Input: |
| 39 | * arg: length specification (i.e. both command arguments) |
| 40 | * Output: |
| 41 | * len: computed length for operation |
| 42 | * Return: |
| 43 | * 1: success |
| 44 | * -1: failure (bad format, bad address). |
| 45 | */ |
| 46 | static int sf_parse_len_arg(char *arg, ulong *len) |
| 47 | { |
| 48 | char *ep; |
| 49 | char round_up_len; /* indicates if the "+length" form used */ |
| 50 | ulong len_arg; |
| 51 | |
| 52 | round_up_len = 0; |
| 53 | if (*arg == '+') { |
| 54 | round_up_len = 1; |
| 55 | ++arg; |
| 56 | } |
| 57 | |
| 58 | len_arg = simple_strtoul(arg, &ep, 16); |
| 59 | if (ep == arg || *ep != '\0') |
| 60 | return -1; |
| 61 | |
| 62 | if (round_up_len && flash->sector_size > 0) |
Anton Staaf | 155cfb5 | 2011-09-02 13:45:28 +0000 | [diff] [blame] | 63 | *len = ROUND(len_arg, flash->sector_size); |
Richard Retanubun | 334eb4b | 2011-02-16 16:39:44 -0500 | [diff] [blame] | 64 | else |
| 65 | *len = len_arg; |
| 66 | |
| 67 | return 1; |
| 68 | } |
| 69 | |
James Miller | a683c28 | 2012-09-28 14:28:00 +0000 | [diff] [blame^] | 70 | /** |
| 71 | * This function takes a byte length and a delta unit of time to compute the |
| 72 | * approximate bytes per second |
| 73 | * |
| 74 | * @param len amount of bytes currently processed |
| 75 | * @param start_ms start time of processing in ms |
| 76 | * @return bytes per second if OK, 0 on error |
| 77 | */ |
| 78 | static ulong bytes_per_second(unsigned int len, ulong start_ms) |
| 79 | { |
| 80 | /* less accurate but avoids overflow */ |
| 81 | if (len >= ((unsigned int) -1) / 1024) |
| 82 | return len / (max(get_timer(start_ms) / 1024, 1)); |
| 83 | else |
| 84 | return 1024 * len / max(get_timer(start_ms), 1); |
| 85 | } |
| 86 | |
Wolfgang Denk | 54841ab | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 87 | static int do_spi_flash_probe(int argc, char * const argv[]) |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 88 | { |
Eric Nelson | c1173bd | 2012-01-31 10:52:07 -0700 | [diff] [blame] | 89 | unsigned int bus = CONFIG_SF_DEFAULT_BUS; |
| 90 | unsigned int cs = CONFIG_SF_DEFAULT_CS; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 91 | unsigned int speed = CONFIG_SF_DEFAULT_SPEED; |
| 92 | unsigned int mode = CONFIG_SF_DEFAULT_MODE; |
| 93 | char *endp; |
| 94 | struct spi_flash *new; |
| 95 | |
Eric Nelson | c1173bd | 2012-01-31 10:52:07 -0700 | [diff] [blame] | 96 | if (argc >= 2) { |
| 97 | cs = simple_strtoul(argv[1], &endp, 0); |
| 98 | if (*argv[1] == 0 || (*endp != 0 && *endp != ':')) |
Mike Frysinger | 8a07de0 | 2011-04-12 02:21:31 -0400 | [diff] [blame] | 99 | return -1; |
Eric Nelson | c1173bd | 2012-01-31 10:52:07 -0700 | [diff] [blame] | 100 | if (*endp == ':') { |
| 101 | if (endp[1] == 0) |
| 102 | return -1; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 103 | |
Eric Nelson | c1173bd | 2012-01-31 10:52:07 -0700 | [diff] [blame] | 104 | bus = cs; |
| 105 | cs = simple_strtoul(endp + 1, &endp, 0); |
| 106 | if (*endp != 0) |
| 107 | return -1; |
| 108 | } |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | if (argc >= 3) { |
| 112 | speed = simple_strtoul(argv[2], &endp, 0); |
| 113 | if (*argv[2] == 0 || *endp != 0) |
Mike Frysinger | 8a07de0 | 2011-04-12 02:21:31 -0400 | [diff] [blame] | 114 | return -1; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 115 | } |
| 116 | if (argc >= 4) { |
TsiChung Liew | 6e8d58d | 2009-06-30 14:30:19 +0000 | [diff] [blame] | 117 | mode = simple_strtoul(argv[3], &endp, 16); |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 118 | if (*argv[3] == 0 || *endp != 0) |
Mike Frysinger | 8a07de0 | 2011-04-12 02:21:31 -0400 | [diff] [blame] | 119 | return -1; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | new = spi_flash_probe(bus, cs, speed, mode); |
| 123 | if (!new) { |
| 124 | printf("Failed to initialize SPI flash at %u:%u\n", bus, cs); |
| 125 | return 1; |
| 126 | } |
| 127 | |
| 128 | if (flash) |
| 129 | spi_flash_free(flash); |
| 130 | flash = new; |
| 131 | |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 132 | return 0; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 133 | } |
| 134 | |
Simon Glass | 8d1af94 | 2011-08-22 16:03:46 -0700 | [diff] [blame] | 135 | /** |
| 136 | * Write a block of data to SPI flash, first checking if it is different from |
| 137 | * what is already there. |
| 138 | * |
| 139 | * If the data being written is the same, then *skipped is incremented by len. |
| 140 | * |
| 141 | * @param flash flash context pointer |
| 142 | * @param offset flash offset to write |
| 143 | * @param len number of bytes to write |
| 144 | * @param buf buffer to write from |
| 145 | * @param cmp_buf read buffer to use to compare data |
| 146 | * @param skipped Count of skipped data (incremented by this function) |
| 147 | * @return NULL if OK, else a string containing the stage which failed |
| 148 | */ |
| 149 | static const char *spi_flash_update_block(struct spi_flash *flash, u32 offset, |
| 150 | size_t len, const char *buf, char *cmp_buf, size_t *skipped) |
| 151 | { |
Andreas Bießmann | a97f6ef | 2011-12-15 09:56:53 +0100 | [diff] [blame] | 152 | debug("offset=%#x, sector_size=%#x, len=%#zx\n", |
Simon Glass | 8d1af94 | 2011-08-22 16:03:46 -0700 | [diff] [blame] | 153 | offset, flash->sector_size, len); |
| 154 | if (spi_flash_read(flash, offset, len, cmp_buf)) |
| 155 | return "read"; |
| 156 | if (memcmp(cmp_buf, buf, len) == 0) { |
Andreas Bießmann | a97f6ef | 2011-12-15 09:56:53 +0100 | [diff] [blame] | 157 | debug("Skip region %x size %zx: no change\n", |
Simon Glass | 8d1af94 | 2011-08-22 16:03:46 -0700 | [diff] [blame] | 158 | offset, len); |
| 159 | *skipped += len; |
| 160 | return NULL; |
| 161 | } |
| 162 | if (spi_flash_erase(flash, offset, len)) |
| 163 | return "erase"; |
| 164 | if (spi_flash_write(flash, offset, len, buf)) |
| 165 | return "write"; |
| 166 | return NULL; |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * Update an area of SPI flash by erasing and writing any blocks which need |
| 171 | * to change. Existing blocks with the correct data are left unchanged. |
| 172 | * |
| 173 | * @param flash flash context pointer |
| 174 | * @param offset flash offset to write |
| 175 | * @param len number of bytes to write |
| 176 | * @param buf buffer to write from |
| 177 | * @return 0 if ok, 1 on error |
| 178 | */ |
| 179 | static int spi_flash_update(struct spi_flash *flash, u32 offset, |
| 180 | size_t len, const char *buf) |
| 181 | { |
| 182 | const char *err_oper = NULL; |
| 183 | char *cmp_buf; |
| 184 | const char *end = buf + len; |
| 185 | size_t todo; /* number of bytes to do in this pass */ |
Kumar Gala | 8e8a4bc | 2011-10-03 04:35:47 +0000 | [diff] [blame] | 186 | size_t skipped = 0; /* statistics */ |
James Miller | a683c28 | 2012-09-28 14:28:00 +0000 | [diff] [blame^] | 187 | const ulong start_time = get_timer(0); |
| 188 | size_t scale = 1; |
| 189 | const char *start_buf = buf; |
| 190 | ulong delta; |
Simon Glass | 8d1af94 | 2011-08-22 16:03:46 -0700 | [diff] [blame] | 191 | |
James Miller | a683c28 | 2012-09-28 14:28:00 +0000 | [diff] [blame^] | 192 | if (end - buf >= 200) |
| 193 | scale = (end - buf) / 100; |
Simon Glass | 8d1af94 | 2011-08-22 16:03:46 -0700 | [diff] [blame] | 194 | cmp_buf = malloc(flash->sector_size); |
| 195 | if (cmp_buf) { |
James Miller | a683c28 | 2012-09-28 14:28:00 +0000 | [diff] [blame^] | 196 | ulong last_update = get_timer(0); |
| 197 | |
Kumar Gala | 8e8a4bc | 2011-10-03 04:35:47 +0000 | [diff] [blame] | 198 | for (; buf < end && !err_oper; buf += todo, offset += todo) { |
Simon Glass | 8d1af94 | 2011-08-22 16:03:46 -0700 | [diff] [blame] | 199 | todo = min(end - buf, flash->sector_size); |
James Miller | a683c28 | 2012-09-28 14:28:00 +0000 | [diff] [blame^] | 200 | if (get_timer(last_update) > 100) { |
| 201 | printf(" \rUpdating, %zu%% %lu B/s", |
| 202 | 100 - (end - buf) / scale, |
| 203 | bytes_per_second(buf - start_buf, |
| 204 | start_time)); |
| 205 | last_update = get_timer(0); |
| 206 | } |
Simon Glass | 8d1af94 | 2011-08-22 16:03:46 -0700 | [diff] [blame] | 207 | err_oper = spi_flash_update_block(flash, offset, todo, |
| 208 | buf, cmp_buf, &skipped); |
| 209 | } |
| 210 | } else { |
| 211 | err_oper = "malloc"; |
| 212 | } |
| 213 | free(cmp_buf); |
James Miller | a683c28 | 2012-09-28 14:28:00 +0000 | [diff] [blame^] | 214 | putc('\r'); |
Simon Glass | 8d1af94 | 2011-08-22 16:03:46 -0700 | [diff] [blame] | 215 | if (err_oper) { |
| 216 | printf("SPI flash failed in %s step\n", err_oper); |
| 217 | return 1; |
| 218 | } |
James Miller | a683c28 | 2012-09-28 14:28:00 +0000 | [diff] [blame^] | 219 | |
| 220 | delta = get_timer(start_time); |
| 221 | printf("%zu bytes written, %zu bytes skipped", len - skipped, |
| 222 | skipped); |
| 223 | printf(" in %ld.%lds, speed %ld B/s\n", |
| 224 | delta / 1000, delta % 1000, bytes_per_second(len, start_time)); |
Kumar Gala | 8e8a4bc | 2011-10-03 04:35:47 +0000 | [diff] [blame] | 225 | |
Simon Glass | 8d1af94 | 2011-08-22 16:03:46 -0700 | [diff] [blame] | 226 | return 0; |
| 227 | } |
| 228 | |
Wolfgang Denk | 54841ab | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 229 | static int do_spi_flash_read_write(int argc, char * const argv[]) |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 230 | { |
| 231 | unsigned long addr; |
| 232 | unsigned long offset; |
| 233 | unsigned long len; |
| 234 | void *buf; |
| 235 | char *endp; |
| 236 | int ret; |
| 237 | |
| 238 | if (argc < 4) |
Mike Frysinger | 8a07de0 | 2011-04-12 02:21:31 -0400 | [diff] [blame] | 239 | return -1; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 240 | |
| 241 | addr = simple_strtoul(argv[1], &endp, 16); |
| 242 | if (*argv[1] == 0 || *endp != 0) |
Mike Frysinger | 8a07de0 | 2011-04-12 02:21:31 -0400 | [diff] [blame] | 243 | return -1; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 244 | offset = simple_strtoul(argv[2], &endp, 16); |
| 245 | if (*argv[2] == 0 || *endp != 0) |
Mike Frysinger | 8a07de0 | 2011-04-12 02:21:31 -0400 | [diff] [blame] | 246 | return -1; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 247 | len = simple_strtoul(argv[3], &endp, 16); |
| 248 | if (*argv[3] == 0 || *endp != 0) |
Mike Frysinger | 8a07de0 | 2011-04-12 02:21:31 -0400 | [diff] [blame] | 249 | return -1; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 250 | |
Gerlando Falauto | 8649399 | 2012-04-03 04:34:13 +0000 | [diff] [blame] | 251 | /* Consistency checking */ |
| 252 | if (offset + len > flash->size) { |
| 253 | printf("ERROR: attempting %s past flash size (%#x)\n", |
| 254 | argv[0], flash->size); |
| 255 | return 1; |
| 256 | } |
| 257 | |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 258 | buf = map_physmem(addr, len, MAP_WRBACK); |
| 259 | if (!buf) { |
| 260 | puts("Failed to map physical memory\n"); |
| 261 | return 1; |
| 262 | } |
| 263 | |
Simon Glass | 8d1af94 | 2011-08-22 16:03:46 -0700 | [diff] [blame] | 264 | if (strcmp(argv[0], "update") == 0) |
| 265 | ret = spi_flash_update(flash, offset, len, buf); |
| 266 | else if (strcmp(argv[0], "read") == 0) |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 267 | ret = spi_flash_read(flash, offset, len, buf); |
| 268 | else |
| 269 | ret = spi_flash_write(flash, offset, len, buf); |
| 270 | |
| 271 | unmap_physmem(buf, len); |
| 272 | |
| 273 | if (ret) { |
| 274 | printf("SPI flash %s failed\n", argv[0]); |
| 275 | return 1; |
| 276 | } |
| 277 | |
| 278 | return 0; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 279 | } |
| 280 | |
Wolfgang Denk | 54841ab | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 281 | static int do_spi_flash_erase(int argc, char * const argv[]) |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 282 | { |
| 283 | unsigned long offset; |
| 284 | unsigned long len; |
| 285 | char *endp; |
| 286 | int ret; |
| 287 | |
| 288 | if (argc < 3) |
Mike Frysinger | 8a07de0 | 2011-04-12 02:21:31 -0400 | [diff] [blame] | 289 | return -1; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 290 | |
| 291 | offset = simple_strtoul(argv[1], &endp, 16); |
| 292 | if (*argv[1] == 0 || *endp != 0) |
Mike Frysinger | 8a07de0 | 2011-04-12 02:21:31 -0400 | [diff] [blame] | 293 | return -1; |
Richard Retanubun | 334eb4b | 2011-02-16 16:39:44 -0500 | [diff] [blame] | 294 | |
| 295 | ret = sf_parse_len_arg(argv[2], &len); |
| 296 | if (ret != 1) |
Mike Frysinger | 8a07de0 | 2011-04-12 02:21:31 -0400 | [diff] [blame] | 297 | return -1; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 298 | |
Gerlando Falauto | 8649399 | 2012-04-03 04:34:13 +0000 | [diff] [blame] | 299 | /* Consistency checking */ |
| 300 | if (offset + len > flash->size) { |
| 301 | printf("ERROR: attempting %s past flash size (%#x)\n", |
| 302 | argv[0], flash->size); |
| 303 | return 1; |
| 304 | } |
| 305 | |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 306 | ret = spi_flash_erase(flash, offset, len); |
| 307 | if (ret) { |
| 308 | printf("SPI flash %s failed\n", argv[0]); |
| 309 | return 1; |
| 310 | } |
| 311 | |
| 312 | return 0; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 313 | } |
| 314 | |
Wolfgang Denk | 54841ab | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 315 | static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 316 | { |
| 317 | const char *cmd; |
Mike Frysinger | 8a07de0 | 2011-04-12 02:21:31 -0400 | [diff] [blame] | 318 | int ret; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 319 | |
| 320 | /* need at least two arguments */ |
| 321 | if (argc < 2) |
| 322 | goto usage; |
| 323 | |
| 324 | cmd = argv[1]; |
Mike Frysinger | 8a07de0 | 2011-04-12 02:21:31 -0400 | [diff] [blame] | 325 | --argc; |
| 326 | ++argv; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 327 | |
Mike Frysinger | 8a07de0 | 2011-04-12 02:21:31 -0400 | [diff] [blame] | 328 | if (strcmp(cmd, "probe") == 0) { |
| 329 | ret = do_spi_flash_probe(argc, argv); |
| 330 | goto done; |
| 331 | } |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 332 | |
| 333 | /* The remaining commands require a selected device */ |
| 334 | if (!flash) { |
| 335 | puts("No SPI flash selected. Please run `sf probe'\n"); |
| 336 | return 1; |
| 337 | } |
| 338 | |
Simon Glass | 8d1af94 | 2011-08-22 16:03:46 -0700 | [diff] [blame] | 339 | if (strcmp(cmd, "read") == 0 || strcmp(cmd, "write") == 0 || |
| 340 | strcmp(cmd, "update") == 0) |
Mike Frysinger | 8a07de0 | 2011-04-12 02:21:31 -0400 | [diff] [blame] | 341 | ret = do_spi_flash_read_write(argc, argv); |
| 342 | else if (strcmp(cmd, "erase") == 0) |
| 343 | ret = do_spi_flash_erase(argc, argv); |
| 344 | else |
| 345 | ret = -1; |
| 346 | |
| 347 | done: |
| 348 | if (ret != -1) |
| 349 | return ret; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 350 | |
| 351 | usage: |
Simon Glass | 4c12eeb | 2011-12-10 08:44:01 +0000 | [diff] [blame] | 352 | return CMD_RET_USAGE; |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 353 | } |
| 354 | |
| 355 | U_BOOT_CMD( |
| 356 | sf, 5, 1, do_spi_flash, |
Peter Tyser | 2fb2604 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 357 | "SPI flash sub-system", |
Eric Nelson | c1173bd | 2012-01-31 10:52:07 -0700 | [diff] [blame] | 358 | "probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus\n" |
Haavard Skinnemoen | b636846 | 2008-05-16 11:10:34 +0200 | [diff] [blame] | 359 | " and chip select\n" |
| 360 | "sf read addr offset len - read `len' bytes starting at\n" |
| 361 | " `offset' to memory at `addr'\n" |
| 362 | "sf write addr offset len - write `len' bytes from memory\n" |
| 363 | " at `addr' to flash at `offset'\n" |
Richard Retanubun | 334eb4b | 2011-02-16 16:39:44 -0500 | [diff] [blame] | 364 | "sf erase offset [+]len - erase `len' bytes from `offset'\n" |
Simon Glass | 8d1af94 | 2011-08-22 16:03:46 -0700 | [diff] [blame] | 365 | " `+len' round up `len' to block size\n" |
| 366 | "sf update addr offset len - erase and write `len' bytes from memory\n" |
| 367 | " at `addr' to flash at `offset'" |
Wolfgang Denk | a89c33d | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 368 | ); |