All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7 00/10] Add error checking to spi-nor read and write
@ 2016-05-06  0:31 Brian Norris
  2016-05-06  0:31 ` [PATCH v7 01/10] mtd: spi-nor: change return value of read/write Brian Norris
                   ` (12 more replies)
  0 siblings, 13 replies; 16+ messages in thread
From: Brian Norris @ 2016-05-06  0:31 UTC (permalink / raw)
  To: linux-mtd
  Cc: Heiner Kallweit, Brian Norris, Han Xu, Michal Suchanek,
	Boris Brezillon, Javier Martinez Canillas, Rafal Milecki,
	Jagan Teki, Andrew F. Davis, Mika Westerberg, Gabor Juhos,
	Bean Huo, linux-kernel, Bayi Cheng, Joachim Eastwood,
	Cyrille Pitchen

Hi,

I'm picking up Michal's patch set, since he dropped it on the floor, and it's
useful for others. My additions:

 * rebased on latest
 * added fixes for drivers that have been merged in the meantime
 * addressed most of Heiner's comments

I've put some v6->v7 change info in the patch descriptions as well.

Tested on m25p80 only.

Regards,
Brian
Brian Norris (2):
  mtd: mtk-quadspi: return amount of data transferred or error in
    read/write
  mtd: nxp-spifi: return amount of data transferred or error in
    read/write

Michal Suchanek (8):
  mtd: spi-nor: change return value of read/write
  mtd: m25p80: return amount of data transferred or error in read/write
  mtd: fsl-quadspi: return amount of data read/written or error
  mtd: spi-nor: check return value from write
  mtd: spi-nor: stop passing around retlen
  mtd: spi-nor: simplify write loop
  mtd: spi-nor: add read loop
  mtd: m25p80: read in spi_max_transfer_size chunks

 drivers/mtd/devices/m25p80.c      |  37 +++++++++-----
 drivers/mtd/spi-nor/fsl-quadspi.c |  29 +++++------
 drivers/mtd/spi-nor/mtk-quadspi.c |  42 +++++++++-------
 drivers/mtd/spi-nor/nxp-spifi.c   |  25 +++++-----
 drivers/mtd/spi-nor/spi-nor.c     | 100 +++++++++++++++++++++++++-------------
 include/linux/mtd/spi-nor.h       |   8 +--
 6 files changed, 148 insertions(+), 93 deletions(-)

-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v7 01/10] mtd: spi-nor: change return value of read/write
  2016-05-06  0:31 [PATCH v7 00/10] Add error checking to spi-nor read and write Brian Norris
@ 2016-05-06  0:31 ` Brian Norris
  2016-05-06  0:31 ` [PATCH v7 02/10] mtd: m25p80: return amount of data transferred or error in read/write Brian Norris
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Brian Norris @ 2016-05-06  0:31 UTC (permalink / raw)
  To: linux-mtd
  Cc: Heiner Kallweit, Brian Norris, Han Xu, Michal Suchanek,
	Boris Brezillon, Javier Martinez Canillas, Rafal Milecki,
	Jagan Teki, Andrew F. Davis, Mika Westerberg, Gabor Juhos,
	Bean Huo, linux-kernel, Bayi Cheng, Joachim Eastwood,
	Cyrille Pitchen

From: Michal Suchanek <hramrach@gmail.com>

Change the return value of spi-nor device read and write methods to
allow returning amount of data transferred and errors as
read(2)/write(2) does.

Also, start handling positive returns in spi_nor_read(), since we want
to convert drivers to start returning the read-length both via *retlen
and the return code. (We don't need to do the same transition process
for spi_nor_write(), since ->write() didn't used to have a return code
at all.)

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
v6 -> v7:
 * added handling of positive return codes to spi_nor_read() to help preserve
   bisectability

 drivers/mtd/devices/m25p80.c      |  5 +++--
 drivers/mtd/spi-nor/fsl-quadspi.c |  5 +++--
 drivers/mtd/spi-nor/mtk-quadspi.c | 26 ++++++++++++++++++--------
 drivers/mtd/spi-nor/nxp-spifi.c   | 12 ++++++------
 drivers/mtd/spi-nor/spi-nor.c     |  5 ++++-
 include/linux/mtd/spi-nor.h       |  4 ++--
 6 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 9d6854467651..3bd75e87ed89 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -73,7 +73,7 @@ static int m25p80_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
 	return spi_write(spi, flash->command, len + 1);
 }
 
-static void m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
+static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
 			size_t *retlen, const u_char *buf)
 {
 	struct m25p *flash = nor->priv;
@@ -101,6 +101,7 @@ static void m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
 	spi_sync(spi, &m);
 
 	*retlen += m.actual_length - cmd_sz;
+	return 0;
 }
 
 static inline unsigned int m25p80_rx_nbits(struct spi_nor *nor)
@@ -119,7 +120,7 @@ static inline unsigned int m25p80_rx_nbits(struct spi_nor *nor)
  * Read an address range from the nor chip.  The address range
  * may be any size provided it is within the physical boundaries.
  */
-static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
+static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
 			size_t *retlen, u_char *buf)
 {
 	struct m25p *flash = nor->priv;
diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 9ab2b51d54b8..74dc155e1b3b 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -868,7 +868,7 @@ static int fsl_qspi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
 	return ret;
 }
 
-static void fsl_qspi_write(struct spi_nor *nor, loff_t to,
+static ssize_t fsl_qspi_write(struct spi_nor *nor, loff_t to,
 		size_t len, size_t *retlen, const u_char *buf)
 {
 	struct fsl_qspi *q = nor->priv;
@@ -878,9 +878,10 @@ static void fsl_qspi_write(struct spi_nor *nor, loff_t to,
 
 	/* invalid the data in the AHB buffer. */
 	fsl_qspi_invalid(q);
+	return 0;
 }
 
-static int fsl_qspi_read(struct spi_nor *nor, loff_t from,
+static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from,
 		size_t len, size_t *retlen, u_char *buf)
 {
 	struct fsl_qspi *q = nor->priv;
diff --git a/drivers/mtd/spi-nor/mtk-quadspi.c b/drivers/mtd/spi-nor/mtk-quadspi.c
index 8bed1a4cb79c..ab92ac0f6b2b 100644
--- a/drivers/mtd/spi-nor/mtk-quadspi.c
+++ b/drivers/mtd/spi-nor/mtk-quadspi.c
@@ -243,8 +243,8 @@ static void mt8173_nor_set_addr(struct mt8173_nor *mt8173_nor, u32 addr)
 	writeb(addr & 0xff, mt8173_nor->base + MTK_NOR_RADR3_REG);
 }
 
-static int mt8173_nor_read(struct spi_nor *nor, loff_t from, size_t length,
-			   size_t *retlen, u_char *buffer)
+static ssize_t mt8173_nor_read(struct spi_nor *nor, loff_t from, size_t length,
+			       size_t *retlen, u_char *buffer)
 {
 	int i, ret;
 	int addr = (int)from;
@@ -297,36 +297,46 @@ static int mt8173_nor_write_buffer(struct mt8173_nor *mt8173_nor, int addr,
 	return mt8173_nor_execute_cmd(mt8173_nor, MTK_NOR_WR_CMD);
 }
 
-static void mt8173_nor_write(struct spi_nor *nor, loff_t to, size_t len,
-			     size_t *retlen, const u_char *buf)
+static ssize_t mt8173_nor_write(struct spi_nor *nor, loff_t to, size_t len,
+				size_t *retlen, const u_char *buf)
 {
 	int ret;
 	struct mt8173_nor *mt8173_nor = nor->priv;
 
 	ret = mt8173_nor_write_buffer_enable(mt8173_nor);
-	if (ret < 0)
+	if (ret < 0) {
 		dev_warn(mt8173_nor->dev, "write buffer enable failed!\n");
+		return ret;
+	}
 
 	while (len >= SFLASH_WRBUF_SIZE) {
 		ret = mt8173_nor_write_buffer(mt8173_nor, to, buf);
-		if (ret < 0)
+		if (ret < 0) {
 			dev_err(mt8173_nor->dev, "write buffer failed!\n");
+			return ret;
+		}
 		len -= SFLASH_WRBUF_SIZE;
 		to += SFLASH_WRBUF_SIZE;
 		buf += SFLASH_WRBUF_SIZE;
 		(*retlen) += SFLASH_WRBUF_SIZE;
 	}
 	ret = mt8173_nor_write_buffer_disable(mt8173_nor);
-	if (ret < 0)
+	if (ret < 0) {
 		dev_warn(mt8173_nor->dev, "write buffer disable failed!\n");
+		return ret;
+	}
 
 	if (len) {
 		ret = mt8173_nor_write_single_byte(mt8173_nor, to, (int)len,
 						   (u8 *)buf);
-		if (ret < 0)
+		if (ret < 0) {
 			dev_err(mt8173_nor->dev, "write single byte failed!\n");
+			return ret;
+		}
 		(*retlen) += len;
 	}
+
+	return 0;
 }
 
 static int mt8173_nor_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
diff --git a/drivers/mtd/spi-nor/nxp-spifi.c b/drivers/mtd/spi-nor/nxp-spifi.c
index ae428cb0e04b..187adba5e69f 100644
--- a/drivers/mtd/spi-nor/nxp-spifi.c
+++ b/drivers/mtd/spi-nor/nxp-spifi.c
@@ -172,8 +172,8 @@ static int nxp_spifi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
 	return nxp_spifi_wait_for_cmd(spifi);
 }
 
-static int nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len,
-			  size_t *retlen, u_char *buf)
+static ssize_t nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len,
+			      size_t *retlen, u_char *buf)
 {
 	struct nxp_spifi *spifi = nor->priv;
 	int ret;
@@ -188,8 +188,8 @@ static int nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len,
 	return 0;
 }
 
-static void nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len,
-			    size_t *retlen, const u_char *buf)
+static ssize_t nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len,
+			       size_t *retlen, const u_char *buf)
 {
 	struct nxp_spifi *spifi = nor->priv;
 	u32 cmd;
@@ -197,7 +197,7 @@ static void nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len,
 
 	ret = nxp_spifi_set_memory_mode_off(spifi);
 	if (ret)
-		return;
+		return ret;
 
 	writel(to, spifi->io_base + SPIFI_ADDR);
 	*retlen += len;
@@ -212,7 +212,7 @@ static void nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len,
 	while (len--)
 		writeb(*buf++, spifi->io_base + SPIFI_DATA);
 
-	nxp_spifi_wait_for_cmd(spifi);
+	return nxp_spifi_wait_for_cmd(spifi);
 }
 
 static int nxp_spifi_erase(struct spi_nor *nor, loff_t offs)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 157841dc3e99..f7ffec60a460 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1033,7 +1033,10 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
 	ret = nor->read(nor, from, len, retlen, buf);
 
 	spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ);
-	return ret;
+	if (ret < 0)
+		return ret;
+
+	return 0;
 }
 
 static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 3c36113a88e1..a21c9e4f1fdf 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -172,9 +172,9 @@ struct spi_nor {
 	int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
 	int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
 
-	int (*read)(struct spi_nor *nor, loff_t from,
+	ssize_t (*read)(struct spi_nor *nor, loff_t from,
 			size_t len, size_t *retlen, u_char *read_buf);
-	void (*write)(struct spi_nor *nor, loff_t to,
+	ssize_t (*write)(struct spi_nor *nor, loff_t to,
 			size_t len, size_t *retlen, const u_char *write_buf);
 	int (*erase)(struct spi_nor *nor, loff_t offs);
 
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 02/10] mtd: m25p80: return amount of data transferred or error in read/write
  2016-05-06  0:31 [PATCH v7 00/10] Add error checking to spi-nor read and write Brian Norris
  2016-05-06  0:31 ` [PATCH v7 01/10] mtd: spi-nor: change return value of read/write Brian Norris
@ 2016-05-06  0:31 ` Brian Norris
  2016-05-06  0:31 ` [PATCH v7 03/10] mtd: fsl-quadspi: return amount of data read/written or error Brian Norris
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Brian Norris @ 2016-05-06  0:31 UTC (permalink / raw)
  To: linux-mtd
  Cc: Heiner Kallweit, Brian Norris, Han Xu, Michal Suchanek,
	Boris Brezillon, Javier Martinez Canillas, Rafal Milecki,
	Jagan Teki, Andrew F. Davis, Mika Westerberg, Gabor Juhos,
	Bean Huo, linux-kernel, Bayi Cheng, Joachim Eastwood,
	Cyrille Pitchen

From: Michal Suchanek <hramrach@gmail.com>

Add checking of SPI transfer errors and return them from read/write
functions. Also return the amount of data transferred.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
v6 -> v7:
 * handle the special spi_flash_read() SPI support that has been added recently

 drivers/mtd/devices/m25p80.c | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 3bd75e87ed89..2ef5a6015276 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -81,6 +81,7 @@ static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
 	struct spi_transfer t[2] = {};
 	struct spi_message m;
 	int cmd_sz = m25p_cmdsz(nor);
+	ssize_t ret;
 
 	spi_message_init(&m);
 
@@ -98,10 +99,15 @@ static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
 	t[1].len = len;
 	spi_message_add_tail(&t[1], &m);
 
-	spi_sync(spi, &m);
+	ret = spi_sync(spi, &m);
+	if (ret)
+		return ret;
 
-	*retlen += m.actual_length - cmd_sz;
-	return 0;
+	ret = m.actual_length - cmd_sz;
+	if (ret < 0)
+		return -EIO;
+	*retlen += ret;
+	return ret;
 }
 
 static inline unsigned int m25p80_rx_nbits(struct spi_nor *nor)
@@ -128,13 +134,13 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
 	struct spi_transfer t[2];
 	struct spi_message m;
 	unsigned int dummy = nor->read_dummy;
+	ssize_t ret;
 
 	/* convert the dummy cycles to the number of bytes */
 	dummy /= 8;
 
 	if (spi_flash_read_supported(spi)) {
 		struct spi_flash_read_message msg;
-		int ret;
 
 		memset(&msg, 0, sizeof(msg));
 
@@ -151,7 +157,9 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
 
 		ret = spi_flash_read(spi, &msg);
 		*retlen = msg.retlen;
-		return ret;
+		if (ret < 0)
+			return ret;
+		return msg.retlen;
 	}
 
 	spi_message_init(&m);
@@ -169,10 +177,15 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
 	t[1].len = len;
 	spi_message_add_tail(&t[1], &m);
 
-	spi_sync(spi, &m);
+	ret = spi_sync(spi, &m);
+	if (ret)
+		return ret;
 
-	*retlen = m.actual_length - m25p_cmdsz(nor) - dummy;
-	return 0;
+	ret = m.actual_length - m25p_cmdsz(nor) - dummy;
+	if (ret < 0)
+		return -EIO;
+	*retlen += ret;
+	return ret;
 }
 
 /*
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 03/10] mtd: fsl-quadspi: return amount of data read/written or error
  2016-05-06  0:31 [PATCH v7 00/10] Add error checking to spi-nor read and write Brian Norris
  2016-05-06  0:31 ` [PATCH v7 01/10] mtd: spi-nor: change return value of read/write Brian Norris
  2016-05-06  0:31 ` [PATCH v7 02/10] mtd: m25p80: return amount of data transferred or error in read/write Brian Norris
@ 2016-05-06  0:31 ` Brian Norris
  2016-05-06  0:31 ` [PATCH v7 04/10] mtd: mtk-quadspi: return amount of data transferred or error in read/write Brian Norris
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Brian Norris @ 2016-05-06  0:31 UTC (permalink / raw)
  To: linux-mtd
  Cc: Heiner Kallweit, Brian Norris, Han Xu, Michal Suchanek,
	Boris Brezillon, Javier Martinez Canillas, Rafal Milecki,
	Jagan Teki, Andrew F. Davis, Mika Westerberg, Gabor Juhos,
	Bean Huo, linux-kernel, Bayi Cheng, Joachim Eastwood,
	Cyrille Pitchen

From: Michal Suchanek <hramrach@gmail.com>

Return amount of data read/written or error as read(2)/write(2) does.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
v6 -> v7:
 * moved some *retlen changes to patch 7 to preserve bisectability

 drivers/mtd/spi-nor/fsl-quadspi.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 74dc155e1b3b..ea296769f015 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -618,7 +618,7 @@ static inline void fsl_qspi_invalid(struct fsl_qspi *q)
 	qspi_writel(q, reg, q->iobase + QUADSPI_MCR);
 }
 
-static int fsl_qspi_nor_write(struct fsl_qspi *q, struct spi_nor *nor,
+static ssize_t fsl_qspi_nor_write(struct fsl_qspi *q, struct spi_nor *nor,
 				u8 opcode, unsigned int to, u32 *txbuf,
 				unsigned count, size_t *retlen)
 {
@@ -647,8 +647,11 @@ static int fsl_qspi_nor_write(struct fsl_qspi *q, struct spi_nor *nor,
 	/* Trigger it */
 	ret = fsl_qspi_runcmd(q, opcode, to, count);
 
-	if (ret == 0 && retlen)
-		*retlen += count;
+	if (ret == 0) {
+		if (retlen)
+			*retlen += count;
+		return count;
+	}
 
 	return ret;
 }
@@ -860,6 +863,8 @@ static int fsl_qspi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
 	} else if (len > 0) {
 		ret = fsl_qspi_nor_write(q, nor, opcode, 0,
 					(u32 *)buf, len, NULL);
+		if (ret > 0)
+			return 0;
 	} else {
 		dev_err(q->dev, "invalid cmd %d\n", opcode);
 		ret = -EINVAL;
@@ -873,12 +878,12 @@ static ssize_t fsl_qspi_write(struct spi_nor *nor, loff_t to,
 {
 	struct fsl_qspi *q = nor->priv;
 
-	fsl_qspi_nor_write(q, nor, nor->program_opcode, to,
+	ssize_t ret = fsl_qspi_nor_write(q, nor, nor->program_opcode, to,
 				(u32 *)buf, len, retlen);
 
 	/* invalid the data in the AHB buffer. */
 	fsl_qspi_invalid(q);
-	return 0;
+	return ret;
 }
 
 static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from,
@@ -925,7 +930,7 @@ static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from,
 		len);
 
 	*retlen += len;
-	return 0;
+	return len;
 }
 
 static int fsl_qspi_erase(struct spi_nor *nor, loff_t offs)
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 04/10] mtd: mtk-quadspi: return amount of data transferred or error in read/write
  2016-05-06  0:31 [PATCH v7 00/10] Add error checking to spi-nor read and write Brian Norris
                   ` (2 preceding siblings ...)
  2016-05-06  0:31 ` [PATCH v7 03/10] mtd: fsl-quadspi: return amount of data read/written or error Brian Norris
@ 2016-05-06  0:31 ` Brian Norris
  2016-05-06  0:31 ` [PATCH v7 05/10] mtd: nxp-spifi: " Brian Norris
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Brian Norris @ 2016-05-06  0:31 UTC (permalink / raw)
  To: linux-mtd
  Cc: Heiner Kallweit, Brian Norris, Han Xu, Michal Suchanek,
	Boris Brezillon, Javier Martinez Canillas, Rafal Milecki,
	Jagan Teki, Andrew F. Davis, Mika Westerberg, Gabor Juhos,
	Bean Huo, linux-kernel, Bayi Cheng, Joachim Eastwood,
	Cyrille Pitchen

Add checking of SPI transfer errors and return them from read/write
functions. Also return the amount of data transferred.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
New in v7

 drivers/mtd/spi-nor/mtk-quadspi.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/spi-nor/mtk-quadspi.c b/drivers/mtd/spi-nor/mtk-quadspi.c
index ab92ac0f6b2b..e85687126c25 100644
--- a/drivers/mtd/spi-nor/mtk-quadspi.c
+++ b/drivers/mtd/spi-nor/mtk-quadspi.c
@@ -261,7 +261,7 @@ static ssize_t mt8173_nor_read(struct spi_nor *nor, loff_t from, size_t length,
 			return ret;
 		buf[i] = readb(mt8173_nor->base + MTK_NOR_RDATA_REG);
 	}
-	return 0;
+	return length;
 }
 
 static int mt8173_nor_write_single_byte(struct mt8173_nor *mt8173_nor,
@@ -302,6 +302,7 @@ static ssize_t mt8173_nor_write(struct spi_nor *nor, loff_t to, size_t len,
 {
 	int ret;
 	struct mt8173_nor *mt8173_nor = nor->priv;
+	size_t i;
 
 	ret = mt8173_nor_write_buffer_enable(mt8173_nor);
 	if (ret < 0) {
@@ -309,13 +310,12 @@ static ssize_t mt8173_nor_write(struct spi_nor *nor, loff_t to, size_t len,
 		return ret;
 	}
 
-	while (len >= SFLASH_WRBUF_SIZE) {
+	for (i = 0; i + SFLASH_WRBUF_SIZE <= len; i += SFLASH_WRBUF_SIZE) {
 		ret = mt8173_nor_write_buffer(mt8173_nor, to, buf);
 		if (ret < 0) {
 			dev_err(mt8173_nor->dev, "write buffer failed!\n");
 			return ret;
 		}
-		len -= SFLASH_WRBUF_SIZE;
 		to += SFLASH_WRBUF_SIZE;
 		buf += SFLASH_WRBUF_SIZE;
 		(*retlen) += SFLASH_WRBUF_SIZE;
@@ -326,9 +326,9 @@ static ssize_t mt8173_nor_write(struct spi_nor *nor, loff_t to, size_t len,
 		return ret;
 	}
 
-	if (len) {
-		ret = mt8173_nor_write_single_byte(mt8173_nor, to, (int)len,
-						   (u8 *)buf);
+	if (i < len) {
+		ret = mt8173_nor_write_single_byte(mt8173_nor, to,
+						   (int)(len - i), (u8 *)buf);
 		if (ret < 0) {
 			dev_err(mt8173_nor->dev, "write single byte failed!\n");
 			return ret;
@@ -336,7 +336,7 @@ static ssize_t mt8173_nor_write(struct spi_nor *nor, loff_t to, size_t len,
 		(*retlen) += len;
 	}
 
-	return 0;
+	return len;
 }
 
 static int mt8173_nor_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 05/10] mtd: nxp-spifi: return amount of data transferred or error in read/write
  2016-05-06  0:31 [PATCH v7 00/10] Add error checking to spi-nor read and write Brian Norris
                   ` (3 preceding siblings ...)
  2016-05-06  0:31 ` [PATCH v7 04/10] mtd: mtk-quadspi: return amount of data transferred or error in read/write Brian Norris
@ 2016-05-06  0:31 ` Brian Norris
  2016-05-06  0:31 ` [PATCH v7 06/10] mtd: spi-nor: check return value from write Brian Norris
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Brian Norris @ 2016-05-06  0:31 UTC (permalink / raw)
  To: linux-mtd
  Cc: Heiner Kallweit, Brian Norris, Han Xu, Michal Suchanek,
	Boris Brezillon, Javier Martinez Canillas, Rafal Milecki,
	Jagan Teki, Andrew F. Davis, Mika Westerberg, Gabor Juhos,
	Bean Huo, linux-kernel, Bayi Cheng, Joachim Eastwood,
	Cyrille Pitchen

Add checking of SPI transfer errors and return them from read/write
functions. Also return the amount of data transferred.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
New in v7

 drivers/mtd/spi-nor/nxp-spifi.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/spi-nor/nxp-spifi.c b/drivers/mtd/spi-nor/nxp-spifi.c
index 187adba5e69f..b0fb86996b8f 100644
--- a/drivers/mtd/spi-nor/nxp-spifi.c
+++ b/drivers/mtd/spi-nor/nxp-spifi.c
@@ -185,7 +185,7 @@ static ssize_t nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len,
 	memcpy_fromio(buf, spifi->flash_base + from, len);
 	*retlen += len;
 
-	return 0;
+	return len;
 }
 
 static ssize_t nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len,
@@ -194,6 +194,7 @@ static ssize_t nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len,
 	struct nxp_spifi *spifi = nor->priv;
 	u32 cmd;
 	int ret;
+	size_t i;
 
 	ret = nxp_spifi_set_memory_mode_off(spifi);
 	if (ret)
@@ -209,10 +210,14 @@ static ssize_t nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len,
 	      SPIFI_CMD_FRAMEFORM(spifi->nor.addr_width + 1);
 	writel(cmd, spifi->io_base + SPIFI_CMD);
 
-	while (len--)
-		writeb(*buf++, spifi->io_base + SPIFI_DATA);
+	for (i = 0; i < len; i++)
+		writeb(buf[i], spifi->io_base + SPIFI_DATA);
 
-	return nxp_spifi_wait_for_cmd(spifi);
+	ret = nxp_spifi_wait_for_cmd(spifi);
+	if (ret)
+		return ret;
+
+	return len;
 }
 
 static int nxp_spifi_erase(struct spi_nor *nor, loff_t offs)
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 06/10] mtd: spi-nor: check return value from write
  2016-05-06  0:31 [PATCH v7 00/10] Add error checking to spi-nor read and write Brian Norris
                   ` (4 preceding siblings ...)
  2016-05-06  0:31 ` [PATCH v7 05/10] mtd: nxp-spifi: " Brian Norris
@ 2016-05-06  0:31 ` Brian Norris
  2016-05-06  0:31 ` [PATCH v7 07/10] mtd: spi-nor: stop passing around retlen Brian Norris
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Brian Norris @ 2016-05-06  0:31 UTC (permalink / raw)
  To: linux-mtd
  Cc: Heiner Kallweit, Brian Norris, Han Xu, Michal Suchanek,
	Boris Brezillon, Javier Martinez Canillas, Rafal Milecki,
	Jagan Teki, Andrew F. Davis, Mika Westerberg, Gabor Juhos,
	Bean Huo, linux-kernel, Bayi Cheng, Joachim Eastwood,
	Cyrille Pitchen

From: Michal Suchanek <hramrach@gmail.com>

SPI NOR hardware drivers now return useful value from their write
functions so check them.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
v6 -> v7:
 * no change

 drivers/mtd/spi-nor/spi-nor.c | 45 ++++++++++++++++++++++++++++++-------------
 1 file changed, 32 insertions(+), 13 deletions(-)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index f7ffec60a460..dd5c9eb9b9e0 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1062,10 +1062,14 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
 		nor->program_opcode = SPINOR_OP_BP;
 
 		/* write one byte. */
-		nor->write(nor, to, 1, retlen, buf);
+		ret = nor->write(nor, to, 1, retlen, buf);
+		if (ret < 0)
+			goto sst_write_err;
+		WARN(ret != 1, "While writing 1 byte written %i bytes\n",
+		     (int)ret);
 		ret = spi_nor_wait_till_ready(nor);
 		if (ret)
-			goto time_out;
+			goto sst_write_err;
 	}
 	to += actual;
 
@@ -1074,10 +1078,14 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
 		nor->program_opcode = SPINOR_OP_AAI_WP;
 
 		/* write two bytes. */
-		nor->write(nor, to, 2, retlen, buf + actual);
+		ret = nor->write(nor, to, 2, retlen, buf + actual);
+		if (ret < 0)
+			goto sst_write_err;
+		WARN(ret != 2, "While writing 2 bytes written %i bytes\n",
+		     (int)ret);
 		ret = spi_nor_wait_till_ready(nor);
 		if (ret)
-			goto time_out;
+			goto sst_write_err;
 		to += 2;
 		nor->sst_write_second = true;
 	}
@@ -1086,21 +1094,24 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
 	write_disable(nor);
 	ret = spi_nor_wait_till_ready(nor);
 	if (ret)
-		goto time_out;
+		goto sst_write_err;
 
 	/* Write out trailing byte if it exists. */
 	if (actual != len) {
 		write_enable(nor);
 
 		nor->program_opcode = SPINOR_OP_BP;
-		nor->write(nor, to, 1, retlen, buf + actual);
-
+		ret = nor->write(nor, to, 1, retlen, buf + actual);
+		if (ret < 0)
+			goto sst_write_err;
+		WARN(ret != 1, "While writing 1 byte written %i bytes\n",
+		     (int)ret);
 		ret = spi_nor_wait_till_ready(nor);
 		if (ret)
-			goto time_out;
+			goto sst_write_err;
 		write_disable(nor);
 	}
-time_out:
+sst_write_err:
 	spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE);
 	return ret;
 }
@@ -1129,14 +1140,18 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
 
 	/* do all the bytes fit onto one page? */
 	if (page_offset + len <= nor->page_size) {
-		nor->write(nor, to, len, retlen, buf);
+		ret = nor->write(nor, to, len, retlen, buf);
+		if (ret < 0)
+			goto write_err;
 	} else {
 		/* the size of data remaining on the first page */
 		page_size = nor->page_size - page_offset;
-		nor->write(nor, to, page_size, retlen, buf);
+		ret = nor->write(nor, to, page_size, retlen, buf);
+		if (ret < 0)
+			goto write_err;
 
 		/* write everything in nor->page_size chunks */
-		for (i = page_size; i < len; i += page_size) {
+		for (i = ret; i < len; ) {
 			page_size = len - i;
 			if (page_size > nor->page_size)
 				page_size = nor->page_size;
@@ -1147,7 +1162,11 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
 
 			write_enable(nor);
 
-			nor->write(nor, to + i, page_size, retlen, buf + i);
+			ret = nor->write(nor, to + i, page_size, retlen,
+					 buf + i);
+			if (ret < 0)
+				goto write_err;
+			i += ret;
 		}
 	}
 
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 07/10] mtd: spi-nor: stop passing around retlen
  2016-05-06  0:31 [PATCH v7 00/10] Add error checking to spi-nor read and write Brian Norris
                   ` (5 preceding siblings ...)
  2016-05-06  0:31 ` [PATCH v7 06/10] mtd: spi-nor: check return value from write Brian Norris
@ 2016-05-06  0:31 ` Brian Norris
  2016-05-06  0:31 ` [PATCH v7 08/10] mtd: spi-nor: simplify write loop Brian Norris
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Brian Norris @ 2016-05-06  0:31 UTC (permalink / raw)
  To: linux-mtd
  Cc: Heiner Kallweit, Brian Norris, Han Xu, Michal Suchanek,
	Boris Brezillon, Javier Martinez Canillas, Rafal Milecki,
	Jagan Teki, Andrew F. Davis, Mika Westerberg, Gabor Juhos,
	Bean Huo, linux-kernel, Bayi Cheng, Joachim Eastwood,
	Cyrille Pitchen

From: Michal Suchanek <hramrach@gmail.com>

Do not pass retlen to hardware driver read/write functions. Update it in
spi-nor generic driver instead.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
v6 -> v7:
 * fix new drivers

 drivers/mtd/devices/m25p80.c      |  7 ++-----
 drivers/mtd/spi-nor/fsl-quadspi.c | 17 ++++++-----------
 drivers/mtd/spi-nor/mtk-quadspi.c |  8 +++-----
 drivers/mtd/spi-nor/nxp-spifi.c   |  6 ++----
 drivers/mtd/spi-nor/spi-nor.c     | 21 +++++++++++++--------
 include/linux/mtd/spi-nor.h       |  4 ++--
 6 files changed, 28 insertions(+), 35 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 2ef5a6015276..eab46d211ae6 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -74,7 +74,7 @@ static int m25p80_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
 }
 
 static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
-			size_t *retlen, const u_char *buf)
+			    const u_char *buf)
 {
 	struct m25p *flash = nor->priv;
 	struct spi_device *spi = flash->spi;
@@ -106,7 +106,6 @@ static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
 	ret = m.actual_length - cmd_sz;
 	if (ret < 0)
 		return -EIO;
-	*retlen += ret;
 	return ret;
 }
 
@@ -127,7 +126,7 @@ static inline unsigned int m25p80_rx_nbits(struct spi_nor *nor)
  * may be any size provided it is within the physical boundaries.
  */
 static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
-			size_t *retlen, u_char *buf)
+			   u_char *buf)
 {
 	struct m25p *flash = nor->priv;
 	struct spi_device *spi = flash->spi;
@@ -156,7 +155,6 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
 		msg.data_nbits = m25p80_rx_nbits(nor);
 
 		ret = spi_flash_read(spi, &msg);
-		*retlen = msg.retlen;
 		if (ret < 0)
 			return ret;
 		return msg.retlen;
@@ -184,7 +182,6 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
 	ret = m.actual_length - m25p_cmdsz(nor) - dummy;
 	if (ret < 0)
 		return -EIO;
-	*retlen += ret;
 	return ret;
 }
 
diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index ea296769f015..5c82e4ef1904 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -620,7 +620,7 @@ static inline void fsl_qspi_invalid(struct fsl_qspi *q)
 
 static ssize_t fsl_qspi_nor_write(struct fsl_qspi *q, struct spi_nor *nor,
 				u8 opcode, unsigned int to, u32 *txbuf,
-				unsigned count, size_t *retlen)
+				unsigned count)
 {
 	int ret, i, j;
 	u32 tmp;
@@ -647,11 +647,8 @@ static ssize_t fsl_qspi_nor_write(struct fsl_qspi *q, struct spi_nor *nor,
 	/* Trigger it */
 	ret = fsl_qspi_runcmd(q, opcode, to, count);
 
-	if (ret == 0) {
-		if (retlen)
-			*retlen += count;
+	if (ret == 0)
 		return count;
-	}
 
 	return ret;
 }
@@ -862,7 +859,7 @@ static int fsl_qspi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
 
 	} else if (len > 0) {
 		ret = fsl_qspi_nor_write(q, nor, opcode, 0,
-					(u32 *)buf, len, NULL);
+					(u32 *)buf, len);
 		if (ret > 0)
 			return 0;
 	} else {
@@ -874,12 +871,11 @@ static int fsl_qspi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
 }
 
 static ssize_t fsl_qspi_write(struct spi_nor *nor, loff_t to,
-		size_t len, size_t *retlen, const u_char *buf)
+			      size_t len, const u_char *buf)
 {
 	struct fsl_qspi *q = nor->priv;
-
 	ssize_t ret = fsl_qspi_nor_write(q, nor, nor->program_opcode, to,
-				(u32 *)buf, len, retlen);
+					 (u32 *)buf, len);
 
 	/* invalid the data in the AHB buffer. */
 	fsl_qspi_invalid(q);
@@ -887,7 +883,7 @@ static ssize_t fsl_qspi_write(struct spi_nor *nor, loff_t to,
 }
 
 static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from,
-		size_t len, size_t *retlen, u_char *buf)
+			     size_t len, u_char *buf)
 {
 	struct fsl_qspi *q = nor->priv;
 	u8 cmd = nor->read_opcode;
@@ -929,7 +925,6 @@ static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from,
 	memcpy(buf, q->ahb_addr + q->chip_base_addr + from - q->memmap_offs,
 		len);
 
-	*retlen += len;
 	return len;
 }
 
diff --git a/drivers/mtd/spi-nor/mtk-quadspi.c b/drivers/mtd/spi-nor/mtk-quadspi.c
index e85687126c25..21c31b373cd3 100644
--- a/drivers/mtd/spi-nor/mtk-quadspi.c
+++ b/drivers/mtd/spi-nor/mtk-quadspi.c
@@ -244,7 +244,7 @@ static void mt8173_nor_set_addr(struct mt8173_nor *mt8173_nor, u32 addr)
 }
 
 static ssize_t mt8173_nor_read(struct spi_nor *nor, loff_t from, size_t length,
-			       size_t *retlen, u_char *buffer)
+			       u_char *buffer)
 {
 	int i, ret;
 	int addr = (int)from;
@@ -255,7 +255,7 @@ static ssize_t mt8173_nor_read(struct spi_nor *nor, loff_t from, size_t length,
 	mt8173_nor_set_read_mode(mt8173_nor);
 	mt8173_nor_set_addr(mt8173_nor, addr);
 
-	for (i = 0; i < length; i++, (*retlen)++) {
+	for (i = 0; i < length; i++) {
 		ret = mt8173_nor_execute_cmd(mt8173_nor, MTK_NOR_PIO_READ_CMD);
 		if (ret < 0)
 			return ret;
@@ -298,7 +298,7 @@ static int mt8173_nor_write_buffer(struct mt8173_nor *mt8173_nor, int addr,
 }
 
 static ssize_t mt8173_nor_write(struct spi_nor *nor, loff_t to, size_t len,
-				size_t *retlen, const u_char *buf)
+				const u_char *buf)
 {
 	int ret;
 	struct mt8173_nor *mt8173_nor = nor->priv;
@@ -318,7 +318,6 @@ static ssize_t mt8173_nor_write(struct spi_nor *nor, loff_t to, size_t len,
 		}
 		to += SFLASH_WRBUF_SIZE;
 		buf += SFLASH_WRBUF_SIZE;
-		(*retlen) += SFLASH_WRBUF_SIZE;
 	}
 	ret = mt8173_nor_write_buffer_disable(mt8173_nor);
 	if (ret < 0) {
@@ -333,7 +332,6 @@ static ssize_t mt8173_nor_write(struct spi_nor *nor, loff_t to, size_t len,
 			dev_err(mt8173_nor->dev, "write single byte failed!\n");
 			return ret;
 		}
-		(*retlen) += len;
 	}
 
 	return len;
diff --git a/drivers/mtd/spi-nor/nxp-spifi.c b/drivers/mtd/spi-nor/nxp-spifi.c
index b0fb86996b8f..73a14f40928b 100644
--- a/drivers/mtd/spi-nor/nxp-spifi.c
+++ b/drivers/mtd/spi-nor/nxp-spifi.c
@@ -173,7 +173,7 @@ static int nxp_spifi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
 }
 
 static ssize_t nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len,
-			      size_t *retlen, u_char *buf)
+			      u_char *buf)
 {
 	struct nxp_spifi *spifi = nor->priv;
 	int ret;
@@ -183,13 +183,12 @@ static ssize_t nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len,
 		return ret;
 
 	memcpy_fromio(buf, spifi->flash_base + from, len);
-	*retlen += len;
 
 	return len;
 }
 
 static ssize_t nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len,
-			       size_t *retlen, const u_char *buf)
+			       const u_char *buf)
 {
 	struct nxp_spifi *spifi = nor->priv;
 	u32 cmd;
@@ -201,7 +200,6 @@ static ssize_t nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len,
 		return ret;
 
 	writel(to, spifi->io_base + SPIFI_ADDR);
-	*retlen += len;
 
 	cmd = SPIFI_CMD_DOUT |
 	      SPIFI_CMD_DATALEN(len) |
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index dd5c9eb9b9e0..937e8d6a28bb 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1030,12 +1030,13 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
 	if (ret)
 		return ret;
 
-	ret = nor->read(nor, from, len, retlen, buf);
+	ret = nor->read(nor, from, len, buf);
 
 	spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ);
 	if (ret < 0)
 		return ret;
 
+	*retlen += ret;
 	return 0;
 }
 
@@ -1062,7 +1063,7 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
 		nor->program_opcode = SPINOR_OP_BP;
 
 		/* write one byte. */
-		ret = nor->write(nor, to, 1, retlen, buf);
+		ret = nor->write(nor, to, 1, buf);
 		if (ret < 0)
 			goto sst_write_err;
 		WARN(ret != 1, "While writing 1 byte written %i bytes\n",
@@ -1078,7 +1079,7 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
 		nor->program_opcode = SPINOR_OP_AAI_WP;
 
 		/* write two bytes. */
-		ret = nor->write(nor, to, 2, retlen, buf + actual);
+		ret = nor->write(nor, to, 2, buf + actual);
 		if (ret < 0)
 			goto sst_write_err;
 		WARN(ret != 2, "While writing 2 bytes written %i bytes\n",
@@ -1101,7 +1102,7 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
 		write_enable(nor);
 
 		nor->program_opcode = SPINOR_OP_BP;
-		ret = nor->write(nor, to, 1, retlen, buf + actual);
+		ret = nor->write(nor, to, 1, buf + actual);
 		if (ret < 0)
 			goto sst_write_err;
 		WARN(ret != 1, "While writing 1 byte written %i bytes\n",
@@ -1110,8 +1111,10 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
 		if (ret)
 			goto sst_write_err;
 		write_disable(nor);
+		actual += 1;
 	}
 sst_write_err:
+	*retlen += actual;
 	spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE);
 	return ret;
 }
@@ -1140,15 +1143,17 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
 
 	/* do all the bytes fit onto one page? */
 	if (page_offset + len <= nor->page_size) {
-		ret = nor->write(nor, to, len, retlen, buf);
+		ret = nor->write(nor, to, len, buf);
 		if (ret < 0)
 			goto write_err;
+		*retlen += ret;
 	} else {
 		/* the size of data remaining on the first page */
 		page_size = nor->page_size - page_offset;
-		ret = nor->write(nor, to, page_size, retlen, buf);
+		ret = nor->write(nor, to, page_size, buf);
 		if (ret < 0)
 			goto write_err;
+		*retlen += ret;
 
 		/* write everything in nor->page_size chunks */
 		for (i = ret; i < len; ) {
@@ -1162,10 +1167,10 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
 
 			write_enable(nor);
 
-			ret = nor->write(nor, to + i, page_size, retlen,
-					 buf + i);
+			ret = nor->write(nor, to + i, page_size, buf + i);
 			if (ret < 0)
 				goto write_err;
+			*retlen += ret;
 			i += ret;
 		}
 	}
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index a21c9e4f1fdf..43c290566d20 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -173,9 +173,9 @@ struct spi_nor {
 	int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
 
 	ssize_t (*read)(struct spi_nor *nor, loff_t from,
-			size_t len, size_t *retlen, u_char *read_buf);
+			size_t len, u_char *read_buf);
 	ssize_t (*write)(struct spi_nor *nor, loff_t to,
-			size_t len, size_t *retlen, const u_char *write_buf);
+			size_t len, const u_char *write_buf);
 	int (*erase)(struct spi_nor *nor, loff_t offs);
 
 	int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 08/10] mtd: spi-nor: simplify write loop
  2016-05-06  0:31 [PATCH v7 00/10] Add error checking to spi-nor read and write Brian Norris
                   ` (6 preceding siblings ...)
  2016-05-06  0:31 ` [PATCH v7 07/10] mtd: spi-nor: stop passing around retlen Brian Norris
@ 2016-05-06  0:31 ` Brian Norris
  2016-05-06  0:31 ` [PATCH v7 09/10] mtd: spi-nor: add read loop Brian Norris
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Brian Norris @ 2016-05-06  0:31 UTC (permalink / raw)
  To: linux-mtd
  Cc: Heiner Kallweit, Brian Norris, Han Xu, Michal Suchanek,
	Boris Brezillon, Javier Martinez Canillas, Rafal Milecki,
	Jagan Teki, Andrew F. Davis, Mika Westerberg, Gabor Juhos,
	Bean Huo, linux-kernel, Bayi Cheng, Joachim Eastwood,
	Cyrille Pitchen

From: Michal Suchanek <hramrach@gmail.com>

The spi-nor write loop assumes that what is passed to the hardware
driver write() is what gets written.

When write() writes less than page size at once data is dropped on the
floor. Check the amount of data writen and exit if it does not match
requested amount.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
v6 -> v7:
 * fix the page_offset calculation, as suggested by Han

 drivers/mtd/spi-nor/spi-nor.c | 58 +++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 33 deletions(-)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 937e8d6a28bb..ff96e1b54384 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1128,8 +1128,8 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
 	size_t *retlen, const u_char *buf)
 {
 	struct spi_nor *nor = mtd_to_spi_nor(mtd);
-	u32 page_offset, page_size, i;
-	int ret;
+	size_t page_offset, page_remain, i;
+	ssize_t ret;
 
 	dev_dbg(nor->dev, "to 0x%08x, len %zd\n", (u32)to, len);
 
@@ -1137,45 +1137,37 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
 	if (ret)
 		return ret;
 
-	write_enable(nor);
-
-	page_offset = to & (nor->page_size - 1);
+	for (i = 0; i < len; ) {
+		ssize_t written;
 
-	/* do all the bytes fit onto one page? */
-	if (page_offset + len <= nor->page_size) {
-		ret = nor->write(nor, to, len, buf);
-		if (ret < 0)
-			goto write_err;
-		*retlen += ret;
-	} else {
+		page_offset = (to + i) & (nor->page_size - 1);
+		WARN_ONCE(page_offset,
+			  "Writing at offset %zu into a NOR page. Writing partial pages may decrease reliability and increase wear of NOR flash.",
+			  page_offset);
 		/* the size of data remaining on the first page */
-		page_size = nor->page_size - page_offset;
-		ret = nor->write(nor, to, page_size, buf);
+		page_remain = min_t(size_t,
+				    nor->page_size - page_offset, len - i);
+
+		write_enable(nor);
+		ret = nor->write(nor, to + i, page_remain, buf + i);
 		if (ret < 0)
 			goto write_err;
-		*retlen += ret;
-
-		/* write everything in nor->page_size chunks */
-		for (i = ret; i < len; ) {
-			page_size = len - i;
-			if (page_size > nor->page_size)
-				page_size = nor->page_size;
-
-			ret = spi_nor_wait_till_ready(nor);
-			if (ret)
-				goto write_err;
+		written = ret;
 
-			write_enable(nor);
-
-			ret = nor->write(nor, to + i, page_size, buf + i);
-			if (ret < 0)
-				goto write_err;
-			*retlen += ret;
-			i += ret;
+		ret = spi_nor_wait_till_ready(nor);
+		if (ret)
+			goto write_err;
+		*retlen += written;
+		i += written;
+		if (written != page_remain) {
+			dev_err(nor->dev,
+				"While writing %zu bytes written %zd bytes\n",
+				page_remain, written);
+			ret = -EIO;
+			goto write_err;
 		}
 	}
 
-	ret = spi_nor_wait_till_ready(nor);
 write_err:
 	spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE);
 	return ret;
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 09/10] mtd: spi-nor: add read loop
  2016-05-06  0:31 [PATCH v7 00/10] Add error checking to spi-nor read and write Brian Norris
                   ` (7 preceding siblings ...)
  2016-05-06  0:31 ` [PATCH v7 08/10] mtd: spi-nor: simplify write loop Brian Norris
@ 2016-05-06  0:31 ` Brian Norris
  2016-05-06  0:31 ` [PATCH v7 10/10] mtd: m25p80: read in spi_max_transfer_size chunks Brian Norris
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Brian Norris @ 2016-05-06  0:31 UTC (permalink / raw)
  To: linux-mtd
  Cc: Heiner Kallweit, Brian Norris, Han Xu, Michal Suchanek,
	Boris Brezillon, Javier Martinez Canillas, Rafal Milecki,
	Jagan Teki, Andrew F. Davis, Mika Westerberg, Gabor Juhos,
	Bean Huo, linux-kernel, Bayi Cheng, Joachim Eastwood,
	Cyrille Pitchen

From: Michal Suchanek <hramrach@gmail.com>

mtdblock and ubi do not handle the situation when read returns less data
than requested. Loop in spi-nor until buffer is filled or an error is
returned.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
v6 -> v7:
 * no change

 drivers/mtd/spi-nor/spi-nor.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index ff96e1b54384..a78adcda1b85 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1030,14 +1030,27 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
 	if (ret)
 		return ret;
 
-	ret = nor->read(nor, from, len, buf);
+	while (len) {
+		ret = nor->read(nor, from, len, buf);
+		if (ret == 0) {
+			/* We shouldn't see 0-length reads */
+			ret = -EIO;
+			goto read_err;
+		}
+		if (ret < 0)
+			goto read_err;
 
-	spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ);
-	if (ret < 0)
-		return ret;
+		WARN_ON(ret > len);
+		*retlen += ret;
+		buf += ret;
+		from += ret;
+		len -= ret;
+	}
+	ret = 0;
 
-	*retlen += ret;
-	return 0;
+read_err:
+	spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ);
+	return ret;
 }
 
 static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 10/10] mtd: m25p80: read in spi_max_transfer_size chunks
  2016-05-06  0:31 [PATCH v7 00/10] Add error checking to spi-nor read and write Brian Norris
                   ` (8 preceding siblings ...)
  2016-05-06  0:31 ` [PATCH v7 09/10] mtd: spi-nor: add read loop Brian Norris
@ 2016-05-06  0:31 ` Brian Norris
  2016-05-16 19:47 ` [PATCH v7 00/10] Add error checking to spi-nor read and write Michal Suchanek
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Brian Norris @ 2016-05-06  0:31 UTC (permalink / raw)
  To: linux-mtd
  Cc: Heiner Kallweit, Brian Norris, Han Xu, Michal Suchanek,
	Boris Brezillon, Javier Martinez Canillas, Rafal Milecki,
	Jagan Teki, Andrew F. Davis, Mika Westerberg, Gabor Juhos,
	Bean Huo, linux-kernel, Bayi Cheng, Joachim Eastwood,
	Cyrille Pitchen

From: Michal Suchanek <hramrach@gmail.com>

Take into account transfer size limitation of SPI master.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
v6 -> v7:
 * use min() instead of min_t()

 drivers/mtd/devices/m25p80.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index eab46d211ae6..9cf7fcd28034 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -172,7 +172,7 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
 
 	t[1].rx_buf = buf;
 	t[1].rx_nbits = m25p80_rx_nbits(nor);
-	t[1].len = len;
+	t[1].len = min(len, spi_max_transfer_size(spi));
 	spi_message_add_tail(&t[1], &m);
 
 	ret = spi_sync(spi, &m);
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v7 00/10] Add error checking to spi-nor read and write
  2016-05-06  0:31 [PATCH v7 00/10] Add error checking to spi-nor read and write Brian Norris
                   ` (9 preceding siblings ...)
  2016-05-06  0:31 ` [PATCH v7 10/10] mtd: m25p80: read in spi_max_transfer_size chunks Brian Norris
@ 2016-05-16 19:47 ` Michal Suchanek
  2016-05-18  1:24   ` Brian Norris
  2016-05-23 16:08 ` Cyrille Pitchen
  2016-06-02  0:26 ` Brian Norris
  12 siblings, 1 reply; 16+ messages in thread
From: Michal Suchanek @ 2016-05-16 19:47 UTC (permalink / raw)
  To: Brian Norris
  Cc: MTD Maling List, Heiner Kallweit, Han Xu, Boris Brezillon,
	Javier Martinez Canillas, Rafal Milecki, Jagan Teki,
	Andrew F. Davis, Mika Westerberg, Gabor Juhos, Bean Huo,
	Linux Kernel Mailing List, Bayi Cheng, Joachim Eastwood,
	Cyrille Pitchen

Hello,

On 6 May 2016 at 02:31, Brian Norris <computersforpeace@gmail.com> wrote:
> Hi,
>
> I'm picking up Michal's patch set, since he dropped it on the floor, and it's
> useful for others. My additions:
>
>  * rebased on latest
>  * added fixes for drivers that have been merged in the meantime
>  * addressed most of Heiner's comments
>

Since that offset error slipped into the previous rebase I was
planning to do some more thorough testing before resubmit but did not
get to it yet.

Thanks for picking this up.

Michal

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v7 00/10] Add error checking to spi-nor read and write
  2016-05-16 19:47 ` [PATCH v7 00/10] Add error checking to spi-nor read and write Michal Suchanek
@ 2016-05-18  1:24   ` Brian Norris
  2016-05-26 20:12     ` Michal Suchanek
  0 siblings, 1 reply; 16+ messages in thread
From: Brian Norris @ 2016-05-18  1:24 UTC (permalink / raw)
  To: Michal Suchanek
  Cc: MTD Maling List, Heiner Kallweit, Han Xu, Boris Brezillon,
	Javier Martinez Canillas, Rafal Milecki, Jagan Teki,
	Andrew F. Davis, Mika Westerberg, Gabor Juhos, Bean Huo,
	Linux Kernel Mailing List, Bayi Cheng, Joachim Eastwood,
	Cyrille Pitchen

On Mon, May 16, 2016 at 09:47:20PM +0200, Michal Suchanek wrote:
> Hello,
> 
> On 6 May 2016 at 02:31, Brian Norris <computersforpeace@gmail.com> wrote:
> > Hi,
> >
> > I'm picking up Michal's patch set, since he dropped it on the floor, and it's
> > useful for others. My additions:
> >
> >  * rebased on latest
> >  * added fixes for drivers that have been merged in the meantime
> >  * addressed most of Heiner's comments
> >
> 
> Since that offset error slipped into the previous rebase I was
> planning to do some more thorough testing before resubmit but did not
> get to it yet.
> 
> Thanks for picking this up.

No problem. If you get the chance, one or more of
{Reviewed,Tested,Acked}-by would be helpful.

Brian

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v7 00/10] Add error checking to spi-nor read and write
  2016-05-06  0:31 [PATCH v7 00/10] Add error checking to spi-nor read and write Brian Norris
                   ` (10 preceding siblings ...)
  2016-05-16 19:47 ` [PATCH v7 00/10] Add error checking to spi-nor read and write Michal Suchanek
@ 2016-05-23 16:08 ` Cyrille Pitchen
  2016-06-02  0:26 ` Brian Norris
  12 siblings, 0 replies; 16+ messages in thread
From: Cyrille Pitchen @ 2016-05-23 16:08 UTC (permalink / raw)
  To: Brian Norris, linux-mtd
  Cc: Heiner Kallweit, Han Xu, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Rafal Milecki, Jagan Teki,
	Andrew F. Davis, Mika Westerberg, Gabor Juhos, Bean Huo,
	linux-kernel, Bayi Cheng, Joachim Eastwood

Hi all,

I've tested this series on a sama5d2 xplained board + Macronix mx25l25673g
using the atmel-quadspi driver I'm about to submit (wihtout any additional
patches of the spi-nor framework to enhance the support of QSPI memories).

Best regards,

Cyrille

Tested-by Cyrille Pitchen <cyrille.pitchen@atmel.com>

Le 06/05/2016 02:31, Brian Norris a écrit :
> Hi,
> 
> I'm picking up Michal's patch set, since he dropped it on the floor, and it's
> useful for others. My additions:
> 
>  * rebased on latest
>  * added fixes for drivers that have been merged in the meantime
>  * addressed most of Heiner's comments
> 
> I've put some v6->v7 change info in the patch descriptions as well.
> 
> Tested on m25p80 only.
> 
> Regards,
> Brian
> Brian Norris (2):
>   mtd: mtk-quadspi: return amount of data transferred or error in
>     read/write
>   mtd: nxp-spifi: return amount of data transferred or error in
>     read/write
> 
> Michal Suchanek (8):
>   mtd: spi-nor: change return value of read/write
>   mtd: m25p80: return amount of data transferred or error in read/write
>   mtd: fsl-quadspi: return amount of data read/written or error
>   mtd: spi-nor: check return value from write
>   mtd: spi-nor: stop passing around retlen
>   mtd: spi-nor: simplify write loop
>   mtd: spi-nor: add read loop
>   mtd: m25p80: read in spi_max_transfer_size chunks
> 
>  drivers/mtd/devices/m25p80.c      |  37 +++++++++-----
>  drivers/mtd/spi-nor/fsl-quadspi.c |  29 +++++------
>  drivers/mtd/spi-nor/mtk-quadspi.c |  42 +++++++++-------
>  drivers/mtd/spi-nor/nxp-spifi.c   |  25 +++++-----
>  drivers/mtd/spi-nor/spi-nor.c     | 100 +++++++++++++++++++++++++-------------
>  include/linux/mtd/spi-nor.h       |   8 +--
>  6 files changed, 148 insertions(+), 93 deletions(-)
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v7 00/10] Add error checking to spi-nor read and write
  2016-05-18  1:24   ` Brian Norris
@ 2016-05-26 20:12     ` Michal Suchanek
  0 siblings, 0 replies; 16+ messages in thread
From: Michal Suchanek @ 2016-05-26 20:12 UTC (permalink / raw)
  To: Brian Norris
  Cc: MTD Maling List, Heiner Kallweit, Han Xu, Boris Brezillon,
	Javier Martinez Canillas, Rafal Milecki, Jagan Teki,
	Andrew F. Davis, Mika Westerberg, Gabor Juhos, Bean Huo,
	Linux Kernel Mailing List, Bayi Cheng, Joachim Eastwood,
	Cyrille Pitchen

Hello,

On 18 May 2016 at 03:24, Brian Norris <computersforpeace@gmail.com> wrote:
> On Mon, May 16, 2016 at 09:47:20PM +0200, Michal Suchanek wrote:
>> Hello,
>>
>> On 6 May 2016 at 02:31, Brian Norris <computersforpeace@gmail.com> wrote:
>> > Hi,
>> >
>> > I'm picking up Michal's patch set, since he dropped it on the floor, and it's
>> > useful for others. My additions:
>> >
>> >  * rebased on latest
>> >  * added fixes for drivers that have been merged in the meantime
>> >  * addressed most of Heiner's comments
>> >
>>
>> Since that offset error slipped into the previous rebase I was
>> planning to do some more thorough testing before resubmit but did not
>> get to it yet.
>>
>> Thanks for picking this up.
>
> No problem. If you get the chance, one or more of
> {Reviewed,Tested,Acked}-by would be helpful.
>

I did not get to look at the new changes in detail.
Acked-by: Michal Suchanek <hramrach@gmail.com>
Tested-by: Michal Suchanek <hramrach@gmail.com> on the parts which are
not vendor-specific.

I used spi-sun4i with m25p80 driver.

Thanks

Michal

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v7 00/10] Add error checking to spi-nor read and write
  2016-05-06  0:31 [PATCH v7 00/10] Add error checking to spi-nor read and write Brian Norris
                   ` (11 preceding siblings ...)
  2016-05-23 16:08 ` Cyrille Pitchen
@ 2016-06-02  0:26 ` Brian Norris
  12 siblings, 0 replies; 16+ messages in thread
From: Brian Norris @ 2016-06-02  0:26 UTC (permalink / raw)
  To: linux-mtd
  Cc: Heiner Kallweit, Han Xu, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Rafal Milecki, Jagan Teki,
	Andrew F. Davis, Mika Westerberg, Gabor Juhos, Bean Huo,
	linux-kernel, Bayi Cheng, Joachim Eastwood, Cyrille Pitchen

On Thu, May 05, 2016 at 05:31:46PM -0700, Brian Norris wrote:
> Hi,
> 
> I'm picking up Michal's patch set, since he dropped it on the floor, and it's
> useful for others. My additions:
> 
>  * rebased on latest
>  * added fixes for drivers that have been merged in the meantime
>  * addressed most of Heiner's comments
> 
> I've put some v6->v7 change info in the patch descriptions as well.
> 
> Tested on m25p80 only.

Pushed to l2-mtd.git, with Cyrille's and Michal's {Tested,Acked}-by's.

Regards,
Brian

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-06-02  0:26 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-06  0:31 [PATCH v7 00/10] Add error checking to spi-nor read and write Brian Norris
2016-05-06  0:31 ` [PATCH v7 01/10] mtd: spi-nor: change return value of read/write Brian Norris
2016-05-06  0:31 ` [PATCH v7 02/10] mtd: m25p80: return amount of data transferred or error in read/write Brian Norris
2016-05-06  0:31 ` [PATCH v7 03/10] mtd: fsl-quadspi: return amount of data read/written or error Brian Norris
2016-05-06  0:31 ` [PATCH v7 04/10] mtd: mtk-quadspi: return amount of data transferred or error in read/write Brian Norris
2016-05-06  0:31 ` [PATCH v7 05/10] mtd: nxp-spifi: " Brian Norris
2016-05-06  0:31 ` [PATCH v7 06/10] mtd: spi-nor: check return value from write Brian Norris
2016-05-06  0:31 ` [PATCH v7 07/10] mtd: spi-nor: stop passing around retlen Brian Norris
2016-05-06  0:31 ` [PATCH v7 08/10] mtd: spi-nor: simplify write loop Brian Norris
2016-05-06  0:31 ` [PATCH v7 09/10] mtd: spi-nor: add read loop Brian Norris
2016-05-06  0:31 ` [PATCH v7 10/10] mtd: m25p80: read in spi_max_transfer_size chunks Brian Norris
2016-05-16 19:47 ` [PATCH v7 00/10] Add error checking to spi-nor read and write Michal Suchanek
2016-05-18  1:24   ` Brian Norris
2016-05-26 20:12     ` Michal Suchanek
2016-05-23 16:08 ` Cyrille Pitchen
2016-06-02  0:26 ` Brian Norris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.