summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/spi
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-10-01 12:22:24 -0600
committerSimon Glass <sjg@chromium.org>2018-10-09 04:40:27 -0600
commit5e24a2ef8bf4f09b18cf4e943c73bfdd169a7581 (patch)
tree1904eaa99bc48ca33ac63d8eb3b325d21c34902b /drivers/mtd/spi
parent42116f644b33d4c9e7b495ec87612aa922452453 (diff)
downloadu-boot-5e24a2ef8bf4f09b18cf4e943c73bfdd169a7581.tar.gz
u-boot-5e24a2ef8bf4f09b18cf4e943c73bfdd169a7581.tar.xz
u-boot-5e24a2ef8bf4f09b18cf4e943c73bfdd169a7581.zip
dm: spi: Add logging of some return values
When SPI flash operations fail it is helpful to be able to see the error codes and where they are generated. Add logging to capture this information for read operations. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/mtd/spi')
-rw-r--r--drivers/mtd/spi/sf-uclass.c6
-rw-r--r--drivers/mtd/spi/sf_probe.c2
-rw-r--r--drivers/mtd/spi/spi_flash.c8
3 files changed, 8 insertions, 8 deletions
diff --git a/drivers/mtd/spi/sf-uclass.c b/drivers/mtd/spi/sf-uclass.c
index 3858f77a6d..662525f016 100644
--- a/drivers/mtd/spi/sf-uclass.c
+++ b/drivers/mtd/spi/sf-uclass.c
@@ -14,18 +14,18 @@ DECLARE_GLOBAL_DATA_PTR;
int spi_flash_read_dm(struct udevice *dev, u32 offset, size_t len, void *buf)
{
- return sf_get_ops(dev)->read(dev, offset, len, buf);
+ return log_ret(sf_get_ops(dev)->read(dev, offset, len, buf));
}
int spi_flash_write_dm(struct udevice *dev, u32 offset, size_t len,
const void *buf)
{
- return sf_get_ops(dev)->write(dev, offset, len, buf);
+ return log_ret(sf_get_ops(dev)->write(dev, offset, len, buf));
}
int spi_flash_erase_dm(struct udevice *dev, u32 offset, size_t len)
{
- return sf_get_ops(dev)->erase(dev, offset, len);
+ return log_ret(sf_get_ops(dev)->erase(dev, offset, len));
}
/*
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index 42c7cdedf6..94fde2ae7a 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -97,7 +97,7 @@ static int spi_flash_std_read(struct udevice *dev, u32 offset, size_t len,
{
struct spi_flash *flash = dev_get_uclass_priv(dev);
- return spi_flash_cmd_read_ops(flash, offset, len, buf);
+ return log_ret(spi_flash_cmd_read_ops(flash, offset, len, buf));
}
static int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len,
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 7113c855fe..9230060364 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -471,14 +471,14 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
u8 cmdsz;
u32 remain_len, read_len, read_addr;
int bank_sel = 0;
- int ret = -1;
+ int ret = 0;
/* Handle memory-mapped SPI */
if (flash->memory_map) {
ret = spi_claim_bus(spi);
if (ret) {
debug("SF: unable to claim SPI bus\n");
- return ret;
+ return log_ret(ret);
}
spi_xfer(spi, 0, NULL, NULL, SPI_XFER_MMAP);
spi_flash_copy_mmap(data, flash->memory_map + offset, len);
@@ -501,7 +501,7 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
#ifdef CONFIG_SPI_FLASH_BAR
ret = write_bar(flash, read_addr);
if (ret < 0)
- return ret;
+ return log_ret(ret);
bank_sel = flash->bank_curr;
#endif
remain_len = ((SPI_FLASH_16MB_BOUN << flash->shift) *
@@ -531,7 +531,7 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
ret = clean_bar(flash);
#endif
- return ret;
+ return log_ret(ret);
}
#ifdef CONFIG_SPI_FLASH_SST