diff options
author | Tom Rini <trini@konsulko.com> | 2021-02-26 20:41:19 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-02-26 20:41:19 +0300 |
commit | b839fc9d47bbfc4ab4f0817a03e0e0e25b93e925 (patch) | |
tree | f55e07d4642e0fa931842268c5b000cbb7bcd7e8 /cmd | |
parent | a3c6d287bae38c6b342d6c0940df1f45b5c766a6 (diff) | |
parent | 783a15b35131abc599ec6deca55cf841d2e7c208 (diff) | |
download | u-boot-b839fc9d47bbfc4ab4f0817a03e0e0e25b93e925.tar.xz |
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-spi
- new GigaDevice flash ids
- fixes for imx, nxp_spi drivers
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/sf.c | 29 |
1 files changed, 18 insertions, 11 deletions
@@ -344,8 +344,11 @@ static int do_spi_flash_erase(int argc, char *const argv[]) } ret = spi_flash_erase(flash, offset, size); - printf("SF: %zu bytes @ %#x Erased: %s\n", (size_t)size, (u32)offset, - ret ? "ERROR" : "OK"); + printf("SF: %zu bytes @ %#x Erased: ", (size_t)size, (u32)offset); + if (ret) + printf("ERROR %d\n", ret); + else + printf("OK\n"); return ret == 0 ? 0 : 1; } @@ -442,20 +445,22 @@ static int spi_flash_test(struct spi_flash *flash, uint8_t *buf, ulong len, ulong offset, uint8_t *vbuf) { struct test_info test; - int i; + int err, i; printf("SPI flash test:\n"); memset(&test, '\0', sizeof(test)); test.base_ms = get_timer(0); test.bytes = len; - if (spi_flash_erase(flash, offset, len)) { - printf("Erase failed\n"); + err = spi_flash_erase(flash, offset, len); + if (err) { + printf("Erase failed (err = %d)\n", err); return -1; } spi_test_next_stage(&test); - if (spi_flash_read(flash, offset, len, vbuf)) { - printf("Check read failed\n"); + err = spi_flash_read(flash, offset, len, vbuf); + if (err) { + printf("Check read failed (err = %d)\n", err); return -1; } for (i = 0; i < len; i++) { @@ -468,15 +473,17 @@ static int spi_flash_test(struct spi_flash *flash, uint8_t *buf, ulong len, } spi_test_next_stage(&test); - if (spi_flash_write(flash, offset, len, buf)) { - printf("Write failed\n"); + err = spi_flash_write(flash, offset, len, buf); + if (err) { + printf("Write failed (err = %d)\n", err); return -1; } memset(vbuf, '\0', len); spi_test_next_stage(&test); - if (spi_flash_read(flash, offset, len, vbuf)) { - printf("Read failed\n"); + err = spi_flash_read(flash, offset, len, vbuf); + if (err) { + printf("Read failed (ret = %d)\n", err); return -1; } spi_test_next_stage(&test); |