Commit 96bbf55651fc2bedc175830d22179e384d640d99

Authored by Jagannadha Sutradharudu Teki
1 parent 0d3b596aa3

cmd_sf: Add print mesg for 'sf erase' command

This patch adds a print messages while using 'sf erase' command
to make sure that how many bytes erased in flash device.

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Acked-by: Tom Rini <trini@ti.com>

Showing 2 changed files with 5 additions and 10 deletions Side-by-side Diff

... ... @@ -305,12 +305,10 @@
305 305 }
306 306  
307 307 ret = spi_flash_erase(flash, offset, len);
308   - if (ret) {
309   - printf("SPI flash %s failed\n", argv[0]);
310   - return 1;
311   - }
  308 + printf("SF: %zu bytes @ %#x Erased: %s\n", (size_t)len, (u32)offset,
  309 + ret ? "ERROR" : "OK");
312 310  
313   - return 0;
  311 + return ret == 0 ? 0 : 1;
314 312 }
315 313  
316 314 #ifdef CONFIG_CMD_SF_TEST
drivers/mtd/spi/spi_flash.c
... ... @@ -207,7 +207,7 @@
207 207  
208 208 int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len)
209 209 {
210   - u32 start, end, erase_size;
  210 + u32 end, erase_size;
211 211 int ret;
212 212 u8 cmd[4];
213 213  
... ... @@ -227,8 +227,7 @@
227 227 cmd[0] = CMD_ERASE_4K;
228 228 else
229 229 cmd[0] = CMD_ERASE_64K;
230   - start = offset;
231   - end = start + len;
  230 + end = offset + len;
232 231  
233 232 while (offset < end) {
234 233 spi_flash_addr(offset, cmd);
... ... @@ -249,8 +248,6 @@
249 248 if (ret)
250 249 goto out;
251 250 }
252   -
253   - debug("SF: Successfully erased %zu bytes @ %#x\n", len, start);
254 251  
255 252 out:
256 253 spi_release_bus(flash->spi);