]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mtd: spi: sf_dataflash: Add print message while erase error
authorWenyou.Yang@microchip.com <Wenyou.Yang@microchip.com>
Fri, 21 Jul 2017 05:26:09 +0000 (13:26 +0800)
committerJagan Teki <jagan@amarulasolutions.com>
Tue, 8 Aug 2017 07:04:27 +0000 (12:34 +0530)
Add the print message to tell us why the erase operation doesn't work.

Signed-off-by: Wenyou Yang <wenyou.yang@microchip.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@openedev.com>
drivers/mtd/spi/sf_dataflash.c

index bcddfa07556bb9f1bd68b6606f29d20e22b84375..e5c0e12faa392f0ffd0a2e0cdf593b266dda726a 100644 (file)
@@ -134,11 +134,17 @@ static int spi_dataflash_erase(struct udevice *dev, u32 offset, size_t len)
        debug("%s: erase addr=0x%x len 0x%x\n", dev->name, offset, len);
 
        div_u64_rem(len, spi_flash->page_size, &rem);
-       if (rem)
+       if (rem) {
+               printf("%s: len(0x%x) isn't the multiple of page size(0x%x)\n",
+                      dev->name, len, spi_flash->page_size);
                return -EINVAL;
+       }
        div_u64_rem(offset, spi_flash->page_size, &rem);
-       if (rem)
+       if (rem) {
+               printf("%s: offset(0x%x) isn't the multiple of page size(0x%x)\n",
+                      dev->name, offset, spi_flash->page_size);
                return -EINVAL;
+       }
 
        status = spi_claim_bus(spi);
        if (status) {