1 From bc418cd2652f47a327e27f978caa3d85f9558b09 Mon Sep 17 00:00:00 2001
2 From: Brian Norris <computersforpeace@gmail.com>
3 Date: Thu, 5 May 2016 17:31:51 -0700
4 Subject: [PATCH 05/10] mtd: nxp-spifi: return amount of data transferred or
7 Add checking of SPI transfer errors and return them from read/write
8 functions. Also return the amount of data transferred.
10 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
12 drivers/mtd/spi-nor/nxp-spifi.c | 13 +++++++++----
13 1 file changed, 9 insertions(+), 4 deletions(-)
15 --- a/drivers/mtd/spi-nor/nxp-spifi.c
16 +++ b/drivers/mtd/spi-nor/nxp-spifi.c
17 @@ -185,7 +185,7 @@ static ssize_t nxp_spifi_read(struct spi
18 memcpy_fromio(buf, spifi->flash_base + from, len);
25 static ssize_t nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len,
26 @@ -194,6 +194,7 @@ static ssize_t nxp_spifi_write(struct sp
27 struct nxp_spifi *spifi = nor->priv;
32 ret = nxp_spifi_set_memory_mode_off(spifi);
34 @@ -209,10 +210,14 @@ static ssize_t nxp_spifi_write(struct sp
35 SPIFI_CMD_FRAMEFORM(spifi->nor.addr_width + 1);
36 writel(cmd, spifi->io_base + SPIFI_CMD);
39 - writeb(*buf++, spifi->io_base + SPIFI_DATA);
40 + for (i = 0; i < len; i++)
41 + writeb(buf[i], spifi->io_base + SPIFI_DATA);
43 - return nxp_spifi_wait_for_cmd(spifi);
44 + ret = nxp_spifi_wait_for_cmd(spifi);
51 static int nxp_spifi_erase(struct spi_nor *nor, loff_t offs)