All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/10] add error checking to spi-nor read and write
@ 2015-12-01 16:51 ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

Hello,

as this is getting discussed a lot lately I am sending a rebase of the spi-nor patchset on top of current MTD patch queue.

I need to do some testing of the rebase with some actual SPI device.

However, I do not have the espi hardware and I hope to get testing on that platform as well.

Also I would like to get comments on the integration of the spi_max_transfer_size

Thanks

Michal

Michal Suchanek (10):
  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 read/write
  mtd: spi-nor: stop passing around retlen
  mtd: spi-nor: simplify write loop
  mtd: spi-nor: add read loop
  spi: expose master transfer size limitation.
  spi: fsl-espi: expose maximum transfer size limit
  spi: m25p80: read in spi_max_transfer_size chunks

 drivers/mtd/devices/m25p80.c      | 34 +++++++++-----
 drivers/mtd/spi-nor/fsl-quadspi.c | 29 ++++++------
 drivers/mtd/spi-nor/spi-nor.c     | 95 +++++++++++++++++++++++++--------------
 drivers/spi/spi-fsl-espi.c        |  6 +++
 include/linux/mtd/spi-nor.h       |  8 ++--
 include/linux/spi/spi.h           | 15 +++++++
 6 files changed, 125 insertions(+), 62 deletions(-)

-- 
2.6.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v5 01/10] mtd: spi-nor: change return value of read/write
  2015-12-01 16:51 ` Michal Suchanek
@ 2015-12-01 16:51   ` Michal Suchanek
  -1 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

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.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---

 - avoid compiler warning
---
 drivers/mtd/devices/m25p80.c      | 5 +++--
 drivers/mtd/spi-nor/fsl-quadspi.c | 5 +++--
 include/linux/mtd/spi-nor.h       | 4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index c9c3b7f..6ee3bb3 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 54640f1..10d2b59 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -822,7 +822,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;
@@ -832,9 +832,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/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 7bed974..6080701 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -171,9 +171,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.6.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v5 00/10] add error checking to spi-nor read and write
@ 2015-12-01 16:51 ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

Hello,

as this is getting discussed a lot lately I am sending a rebase of the spi-nor patchset on top of current MTD patch queue.

I need to do some testing of the rebase with some actual SPI device.

However, I do not have the espi hardware and I hope to get testing on that platform as well.

Also I would like to get comments on the integration of the spi_max_transfer_size

Thanks

Michal

Michal Suchanek (10):
  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 read/write
  mtd: spi-nor: stop passing around retlen
  mtd: spi-nor: simplify write loop
  mtd: spi-nor: add read loop
  spi: expose master transfer size limitation.
  spi: fsl-espi: expose maximum transfer size limit
  spi: m25p80: read in spi_max_transfer_size chunks

 drivers/mtd/devices/m25p80.c      | 34 +++++++++-----
 drivers/mtd/spi-nor/fsl-quadspi.c | 29 ++++++------
 drivers/mtd/spi-nor/spi-nor.c     | 95 +++++++++++++++++++++++++--------------
 drivers/spi/spi-fsl-espi.c        |  6 +++
 include/linux/mtd/spi-nor.h       |  8 ++--
 include/linux/spi/spi.h           | 15 +++++++
 6 files changed, 125 insertions(+), 62 deletions(-)

-- 
2.6.2

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

* [PATCH v5 01/10] mtd: spi-nor: change return value of read/write
@ 2015-12-01 16:51   ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

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.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---

 - avoid compiler warning
---
 drivers/mtd/devices/m25p80.c      | 5 +++--
 drivers/mtd/spi-nor/fsl-quadspi.c | 5 +++--
 include/linux/mtd/spi-nor.h       | 4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index c9c3b7f..6ee3bb3 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 54640f1..10d2b59 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -822,7 +822,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;
@@ -832,9 +832,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/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 7bed974..6080701 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -171,9 +171,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.6.2

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

* [PATCH v5 02/10] mtd: m25p80: return amount of data transferred or error in read/write
  2015-12-01 16:51 ` Michal Suchanek
@ 2015-12-01 16:51   ` Michal Suchanek
  -1 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

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>
---
 drivers/mtd/devices/m25p80.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 6ee3bb3..fc694fd 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,6 +134,7 @@ 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;
@@ -147,10 +154,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.6.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v5 03/10] mtd: fsl-quadspi: return amount of data read/written or error
  2015-12-01 16:51 ` Michal Suchanek
@ 2015-12-01 16:51   ` Michal Suchanek
  -1 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

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

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---
 drivers/mtd/spi-nor/fsl-quadspi.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 10d2b59..9beb739 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -575,7 +575,7 @@ static inline void fsl_qspi_invalid(struct fsl_qspi *q)
 	writel(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)
 {
@@ -604,8 +604,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;
 }
@@ -814,6 +817,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;
@@ -827,12 +832,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,
@@ -878,8 +883,7 @@ 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 0;
+	return len;
 }
 
 static int fsl_qspi_erase(struct spi_nor *nor, loff_t offs)
-- 
2.6.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v5 04/10] mtd: spi-nor: check return value from read/write
  2015-12-01 16:51 ` Michal Suchanek
@ 2015-12-01 16:51   ` Michal Suchanek
  -1 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

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

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---
 drivers/mtd/spi-nor/spi-nor.c | 50 +++++++++++++++++++++++++++++++------------
 1 file changed, 36 insertions(+), 14 deletions(-)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index b7c038c..5f91bfa 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -910,7 +910,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,
@@ -936,10 +939,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;
 
@@ -948,10 +955,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;
 	}
@@ -960,21 +971,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;
 }
@@ -1003,14 +1017,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;
@@ -1021,7 +1039,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.6.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v5 03/10] mtd: fsl-quadspi: return amount of data read/written or error
@ 2015-12-01 16:51   ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

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

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---
 drivers/mtd/spi-nor/fsl-quadspi.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 10d2b59..9beb739 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -575,7 +575,7 @@ static inline void fsl_qspi_invalid(struct fsl_qspi *q)
 	writel(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)
 {
@@ -604,8 +604,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;
 }
@@ -814,6 +817,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;
@@ -827,12 +832,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,
@@ -878,8 +883,7 @@ 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 0;
+	return len;
 }
 
 static int fsl_qspi_erase(struct spi_nor *nor, loff_t offs)
-- 
2.6.2

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

* [PATCH v5 02/10] mtd: m25p80: return amount of data transferred or error in read/write
@ 2015-12-01 16:51   ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

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>
---
 drivers/mtd/devices/m25p80.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 6ee3bb3..fc694fd 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,6 +134,7 @@ 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;
@@ -147,10 +154,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.6.2

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

* [PATCH v5 04/10] mtd: spi-nor: check return value from read/write
@ 2015-12-01 16:51   ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

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

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---
 drivers/mtd/spi-nor/spi-nor.c | 50 +++++++++++++++++++++++++++++++------------
 1 file changed, 36 insertions(+), 14 deletions(-)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index b7c038c..5f91bfa 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -910,7 +910,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,
@@ -936,10 +939,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;
 
@@ -948,10 +955,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;
 	}
@@ -960,21 +971,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;
 }
@@ -1003,14 +1017,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;
@@ -1021,7 +1039,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.6.2

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

* [PATCH v5 07/10] mtd: spi-nor: add read loop
  2015-12-01 16:51 ` Michal Suchanek
@ 2015-12-01 16:51   ` Michal Suchanek
  -1 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

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>

---
 - use WARN_ON rather than BUG_ON
---
 drivers/mtd/spi-nor/spi-nor.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 115c123..ded79ae 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -907,14 +907,22 @@ 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)
+			goto read_err;
+
+		WARN_ON(ret > len);
+		*retlen += ret;
+		buf += ret;
+		from += ret;
+		len -= ret;
+	}
+	ret = 0;
 
+read_err:
 	spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ);
-	if (ret < 0)
-		return ret;
-
-	*retlen += ret;
-	return 0;
+	return ret;
 }
 
 static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
-- 
2.6.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v5 06/10] mtd: spi-nor: simplify write loop
  2015-12-01 16:51 ` Michal Suchanek
@ 2015-12-01 16:51   ` Michal Suchanek
  -1 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

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>

---

 - add warning when writing incomplete pages
 - refuse to continue writing when full page was not written
---
 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 3d02803..115c123 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1005,8 +1005,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);
 
@@ -1014,45 +1014,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 & (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.6.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v5 05/10] mtd: spi-nor: stop passing around retlen
  2015-12-01 16:51 ` Michal Suchanek
@ 2015-12-01 16:51   ` Michal Suchanek
  -1 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

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>
---
 drivers/mtd/devices/m25p80.c      |  6 ++----
 drivers/mtd/spi-nor/fsl-quadspi.c | 16 ++++++----------
 drivers/mtd/spi-nor/spi-nor.c     | 21 +++++++++++++--------
 include/linux/mtd/spi-nor.h       |  4 ++--
 4 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index fc694fd..58ecfa4 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;
@@ -161,7 +160,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 9beb739..7491fbb 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -577,7 +577,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;
@@ -604,11 +604,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;
 }
@@ -816,7 +813,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 {
@@ -828,12 +825,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);
@@ -841,7 +837,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;
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 5f91bfa..3d02803 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -907,12 +907,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;
 }
 
@@ -939,7 +940,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",
@@ -955,7 +956,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",
@@ -978,7 +979,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",
@@ -987,8 +988,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;
 }
@@ -1017,15 +1020,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; ) {
@@ -1039,10 +1044,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 6080701..c4b059b 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -172,9 +172,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.6.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v5 07/10] mtd: spi-nor: add read loop
@ 2015-12-01 16:51   ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

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>

---
 - use WARN_ON rather than BUG_ON
---
 drivers/mtd/spi-nor/spi-nor.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 115c123..ded79ae 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -907,14 +907,22 @@ 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)
+			goto read_err;
+
+		WARN_ON(ret > len);
+		*retlen += ret;
+		buf += ret;
+		from += ret;
+		len -= ret;
+	}
+	ret = 0;
 
+read_err:
 	spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ);
-	if (ret < 0)
-		return ret;
-
-	*retlen += ret;
-	return 0;
+	return ret;
 }
 
 static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
-- 
2.6.2

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

* [PATCH v5 06/10] mtd: spi-nor: simplify write loop
@ 2015-12-01 16:51   ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

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>

---

 - add warning when writing incomplete pages
 - refuse to continue writing when full page was not written
---
 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 3d02803..115c123 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1005,8 +1005,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);
 
@@ -1014,45 +1014,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 & (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.6.2

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

* [PATCH v5 05/10] mtd: spi-nor: stop passing around retlen
@ 2015-12-01 16:51   ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

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>
---
 drivers/mtd/devices/m25p80.c      |  6 ++----
 drivers/mtd/spi-nor/fsl-quadspi.c | 16 ++++++----------
 drivers/mtd/spi-nor/spi-nor.c     | 21 +++++++++++++--------
 include/linux/mtd/spi-nor.h       |  4 ++--
 4 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index fc694fd..58ecfa4 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;
@@ -161,7 +160,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 9beb739..7491fbb 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -577,7 +577,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;
@@ -604,11 +604,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;
 }
@@ -816,7 +813,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 {
@@ -828,12 +825,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);
@@ -841,7 +837,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;
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 5f91bfa..3d02803 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -907,12 +907,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;
 }
 
@@ -939,7 +940,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",
@@ -955,7 +956,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",
@@ -978,7 +979,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",
@@ -987,8 +988,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;
 }
@@ -1017,15 +1020,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; ) {
@@ -1039,10 +1044,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 6080701..c4b059b 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -172,9 +172,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.6.2

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

* [PATCH v5 08/10] spi: expose master transfer size limitation.
  2015-12-01 16:51 ` Michal Suchanek
@ 2015-12-01 16:51   ` Michal Suchanek
  -1 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

On some SPI controllers it is not feasible to transfer arbitrary amount
of data at once.

When the limit on transfer size is a few kilobytes at least it makes
sense to use the SPI hardware rather than reverting to gpio driver.

The protocol drivers need a way to check that they do not sent overly
long messages, though.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---
 include/linux/spi/spi.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index cce80e6..9598bae 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -425,6 +425,12 @@ struct spi_master {
 #define SPI_MASTER_MUST_RX      BIT(3)		/* requires rx */
 #define SPI_MASTER_MUST_TX      BIT(4)		/* requires tx */
 
+	/*
+	 * on some hardware transfer size may be constrained
+	 * the limit may depend on device transfer settings
+	 */
+	size_t (*max_transfer_size)(struct spi_device *spi);
+
 	/* lock and mutex for SPI bus locking */
 	spinlock_t		bus_lock_spinlock;
 	struct mutex		bus_lock_mutex;
@@ -832,6 +838,15 @@ extern int spi_async(struct spi_device *spi, struct spi_message *message);
 extern int spi_async_locked(struct spi_device *spi,
 			    struct spi_message *message);
 
+static inline size_t
+spi_max_transfer_size(struct spi_device *spi)
+{
+	struct spi_master *master = spi->master;
+	if (!master->max_transfer_size)
+		return 0;
+	return master->max_transfer_size(spi);
+}
+
 /*---------------------------------------------------------------------------*/
 
 /* All these synchronous SPI transfer routines are utilities layered
-- 
2.6.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v5 09/10] spi: fsl-espi: expose maximum transfer size limit
  2015-12-01 16:51 ` Michal Suchanek
@ 2015-12-01 16:51   ` Michal Suchanek
  -1 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

The fsl-espi hardware can trasfer at most 64K data so report teh
limitation.

Based on patch by Heiner Kallweit <hkallweit1@gmail.com>

CC: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---
 drivers/spi/spi-fsl-espi.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index c27124a..7fd6a4c 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -643,6 +643,11 @@ static int fsl_espi_runtime_resume(struct device *dev)
 }
 #endif
 
+static size_t fsl_espi_max_transfer_size(struct spi_device *spi)
+{
+	return SPCOM_TRANLEN_MAX;
+}
+
 static struct spi_master * fsl_espi_probe(struct device *dev,
 		struct resource *mem, unsigned int irq)
 {
@@ -670,6 +675,7 @@ static struct spi_master * fsl_espi_probe(struct device *dev,
 	master->cleanup = fsl_espi_cleanup;
 	master->transfer_one_message = fsl_espi_do_one_msg;
 	master->auto_runtime_pm = true;
+	master->max_transfer_size = fsl_espi_max_transfer_size;
 
 	mpc8xxx_spi = spi_master_get_devdata(master);
 
-- 
2.6.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v5 10/10] spi: m25p80: read in spi_max_transfer_size chunks
  2015-12-01 16:51 ` Michal Suchanek
@ 2015-12-01 16:51   ` Michal Suchanek
  -1 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

Take into account transfer size limitation of SPI master.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---
 drivers/mtd/devices/m25p80.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 58ecfa4..4f21755 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -150,7 +150,10 @@ 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;
+	if (spi_max_transfer_size(spi))
+		t[1].len = min_t(size_t, len, spi_max_transfer_size(spi));
+	else
+		t[1].len = len;
 	spi_message_add_tail(&t[1], &m);
 
 	ret = spi_sync(spi, &m);
-- 
2.6.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-01 16:51   ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

On some SPI controllers it is not feasible to transfer arbitrary amount
of data at once.

When the limit on transfer size is a few kilobytes at least it makes
sense to use the SPI hardware rather than reverting to gpio driver.

The protocol drivers need a way to check that they do not sent overly
long messages, though.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---
 include/linux/spi/spi.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index cce80e6..9598bae 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -425,6 +425,12 @@ struct spi_master {
 #define SPI_MASTER_MUST_RX      BIT(3)		/* requires rx */
 #define SPI_MASTER_MUST_TX      BIT(4)		/* requires tx */
 
+	/*
+	 * on some hardware transfer size may be constrained
+	 * the limit may depend on device transfer settings
+	 */
+	size_t (*max_transfer_size)(struct spi_device *spi);
+
 	/* lock and mutex for SPI bus locking */
 	spinlock_t		bus_lock_spinlock;
 	struct mutex		bus_lock_mutex;
@@ -832,6 +838,15 @@ extern int spi_async(struct spi_device *spi, struct spi_message *message);
 extern int spi_async_locked(struct spi_device *spi,
 			    struct spi_message *message);
 
+static inline size_t
+spi_max_transfer_size(struct spi_device *spi)
+{
+	struct spi_master *master = spi->master;
+	if (!master->max_transfer_size)
+		return 0;
+	return master->max_transfer_size(spi);
+}
+
 /*---------------------------------------------------------------------------*/
 
 /* All these synchronous SPI transfer routines are utilities layered
-- 
2.6.2

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

* [PATCH v5 09/10] spi: fsl-espi: expose maximum transfer size limit
@ 2015-12-01 16:51   ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

The fsl-espi hardware can trasfer at most 64K data so report teh
limitation.

Based on patch by Heiner Kallweit <hkallweit1@gmail.com>

CC: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---
 drivers/spi/spi-fsl-espi.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index c27124a..7fd6a4c 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -643,6 +643,11 @@ static int fsl_espi_runtime_resume(struct device *dev)
 }
 #endif
 
+static size_t fsl_espi_max_transfer_size(struct spi_device *spi)
+{
+	return SPCOM_TRANLEN_MAX;
+}
+
 static struct spi_master * fsl_espi_probe(struct device *dev,
 		struct resource *mem, unsigned int irq)
 {
@@ -670,6 +675,7 @@ static struct spi_master * fsl_espi_probe(struct device *dev,
 	master->cleanup = fsl_espi_cleanup;
 	master->transfer_one_message = fsl_espi_do_one_msg;
 	master->auto_runtime_pm = true;
+	master->max_transfer_size = fsl_espi_max_transfer_size;
 
 	mpc8xxx_spi = spi_master_get_devdata(master);
 
-- 
2.6.2

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

* [PATCH v5 10/10] spi: m25p80: read in spi_max_transfer_size chunks
@ 2015-12-01 16:51   ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-01 16:51 UTC (permalink / raw)
  To: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Mark Brown, Michal Suchanek, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌 ,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

Take into account transfer size limitation of SPI master.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---
 drivers/mtd/devices/m25p80.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 58ecfa4..4f21755 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -150,7 +150,10 @@ 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;
+	if (spi_max_transfer_size(spi))
+		t[1].len = min_t(size_t, len, spi_max_transfer_size(spi));
+	else
+		t[1].len = len;
 	spi_message_add_tail(&t[1], &m);
 
 	ret = spi_sync(spi, &m);
-- 
2.6.2

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-01 19:58     ` Mark Brown
  0 siblings, 0 replies; 39+ messages in thread
From: Mark Brown @ 2015-12-01 19:58 UTC (permalink / raw)
  To: Michal Suchanek
  Cc: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Boris Brezillon, Javier Martinez Canillas, Stephen Warren,
	Andrew F. Davis, Marek Vasut, Rafał Miłecki,
	Mika Westerberg, Gabor Juhos, Bean Huo 霍斌斌,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

[-- Attachment #1: Type: text/plain, Size: 912 bytes --]

On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
> On some SPI controllers it is not feasible to transfer arbitrary amount
> of data at once.
> 
> When the limit on transfer size is a few kilobytes at least it makes
> sense to use the SPI hardware rather than reverting to gpio driver.

> +	/*
> +	 * on some hardware transfer size may be constrained
> +	 * the limit may depend on device transfer settings
> +	 */
> +	size_t (*max_transfer_size)(struct spi_device *spi);

Heiner submitted a *very* similar patch just now with a straight
variable plus accessor instead of a function and using a name with _msg.
I'm ambivalent on the implementation but prefer the naming here since
that's more the limitation we're trying to express I think (some
hardware does have limiations about multple transfers too).  Can the two
of you come up with something that works for both of you?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-01 19:58     ` Mark Brown
  0 siblings, 0 replies; 39+ messages in thread
From: Mark Brown @ 2015-12-01 19:58 UTC (permalink / raw)
  To: Michal Suchanek
  Cc: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Boris Brezillon, Javier Martinez Canillas, Stephen Warren,
	Andrew F. Davis, Marek Vasut, Rafał Miłecki,
	Mika Westerberg, Gabor Juhos, Bean Huo 霍斌斌,
	Furquan Shaikh, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 912 bytes --]

On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
> On some SPI controllers it is not feasible to transfer arbitrary amount
> of data at once.
> 
> When the limit on transfer size is a few kilobytes at least it makes
> sense to use the SPI hardware rather than reverting to gpio driver.

> +	/*
> +	 * on some hardware transfer size may be constrained
> +	 * the limit may depend on device transfer settings
> +	 */
> +	size_t (*max_transfer_size)(struct spi_device *spi);

Heiner submitted a *very* similar patch just now with a straight
variable plus accessor instead of a function and using a name with _msg.
I'm ambivalent on the implementation but prefer the naming here since
that's more the limitation we're trying to express I think (some
hardware does have limiations about multple transfers too).  Can the two
of you come up with something that works for both of you?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-01 21:07       ` Heiner Kallweit
  0 siblings, 0 replies; 39+ messages in thread
From: Heiner Kallweit @ 2015-12-01 21:07 UTC (permalink / raw)
  To: Mark Brown, Michal Suchanek
  Cc: David Woodhouse, Brian Norris, Han Xu, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

Am 01.12.2015 um 20:58 schrieb Mark Brown:
> On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
>> On some SPI controllers it is not feasible to transfer arbitrary amount
>> of data at once.
>>
>> When the limit on transfer size is a few kilobytes at least it makes
>> sense to use the SPI hardware rather than reverting to gpio driver.
> 
>> +	/*
>> +	 * on some hardware transfer size may be constrained
>> +	 * the limit may depend on device transfer settings
>> +	 */
>> +	size_t (*max_transfer_size)(struct spi_device *spi);
> 
> Heiner submitted a *very* similar patch just now with a straight
> variable plus accessor instead of a function and using a name with _msg.
> I'm ambivalent on the implementation but prefer the naming here since
> that's more the limitation we're trying to express I think (some
> hardware does have limiations about multple transfers too).  Can the two
> of you come up with something that works for both of you?
> 
Sure .. Just one inquiry:
When you say "the naming here" you refer to Michal's or my version?

Actually I like in Michal's hook that it directly takes a struct spi_device.
This saves the caller one level of indirection as the caller usually will
deal with a spi_device and not a spi_master.

If you're fine with Michal's version then this is also fine with me,
especially as the functionality is the same.


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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-01 21:07       ` Heiner Kallweit
  0 siblings, 0 replies; 39+ messages in thread
From: Heiner Kallweit @ 2015-12-01 21:07 UTC (permalink / raw)
  To: Mark Brown, Michal Suchanek
  Cc: David Woodhouse, Brian Norris, Han Xu, Boris Brezillon,
	Javier Martinez Canillas, Stephen Warren, Andrew F. Davis,
	Marek Vasut, Rafał Miłecki, Mika Westerberg,
	Gabor Juhos, Bean Huo 霍斌斌,
	Furquan Shaikh, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA

Am 01.12.2015 um 20:58 schrieb Mark Brown:
> On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
>> On some SPI controllers it is not feasible to transfer arbitrary amount
>> of data at once.
>>
>> When the limit on transfer size is a few kilobytes at least it makes
>> sense to use the SPI hardware rather than reverting to gpio driver.
> 
>> +	/*
>> +	 * on some hardware transfer size may be constrained
>> +	 * the limit may depend on device transfer settings
>> +	 */
>> +	size_t (*max_transfer_size)(struct spi_device *spi);
> 
> Heiner submitted a *very* similar patch just now with a straight
> variable plus accessor instead of a function and using a name with _msg.
> I'm ambivalent on the implementation but prefer the naming here since
> that's more the limitation we're trying to express I think (some
> hardware does have limiations about multple transfers too).  Can the two
> of you come up with something that works for both of you?
> 
Sure .. Just one inquiry:
When you say "the naming here" you refer to Michal's or my version?

Actually I like in Michal's hook that it directly takes a struct spi_device.
This saves the caller one level of indirection as the caller usually will
deal with a spi_device and not a spi_master.

If you're fine with Michal's version then this is also fine with me,
especially as the functionality is the same.

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-01 21:31         ` Mark Brown
  0 siblings, 0 replies; 39+ messages in thread
From: Mark Brown @ 2015-12-01 21:31 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Michal Suchanek, David Woodhouse, Brian Norris, Han Xu,
	Boris Brezillon, Javier Martinez Canillas, Stephen Warren,
	Andrew F. Davis, Marek Vasut, Rafał Miłecki,
	Mika Westerberg, Gabor Juhos, Bean Huo 霍斌斌,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

On Tue, Dec 01, 2015 at 10:07:55PM +0100, Heiner Kallweit wrote:

> Sure .. Just one inquiry:
> When you say "the naming here" you refer to Michal's or my version?

Michael's (transfer).

> Actually I like in Michal's hook that it directly takes a struct spi_device.
> This saves the caller one level of indirection as the caller usually will
> deal with a spi_device and not a spi_master.

> If you're fine with Michal's version then this is also fine with me,
> especially as the functionality is the same.

OK.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-01 21:31         ` Mark Brown
  0 siblings, 0 replies; 39+ messages in thread
From: Mark Brown @ 2015-12-01 21:31 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Michal Suchanek, David Woodhouse, Brian Norris, Han Xu,
	Boris Brezillon, Javier Martinez Canillas, Stephen Warren,
	Andrew F. Davis, Marek Vasut, Rafał Miłecki,
	Mika Westerberg, Gabor Juhos, Bean Huo 霍斌斌,
	Furquan Shaikh, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

On Tue, Dec 01, 2015 at 10:07:55PM +0100, Heiner Kallweit wrote:

> Sure .. Just one inquiry:
> When you say "the naming here" you refer to Michal's or my version?

Michael's (transfer).

> Actually I like in Michal's hook that it directly takes a struct spi_device.
> This saves the caller one level of indirection as the caller usually will
> deal with a spi_device and not a spi_master.

> If you're fine with Michal's version then this is also fine with me,
> especially as the functionality is the same.

OK.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
  2015-12-01 16:51   ` Michal Suchanek
  (?)
  (?)
@ 2015-12-01 23:12   ` Mark Brown
  2015-12-02  9:38       ` Michal Suchanek
  2015-12-04 14:30       ` Martin Sperl
  -1 siblings, 2 replies; 39+ messages in thread
From: Mark Brown @ 2015-12-01 23:12 UTC (permalink / raw)
  To: Michal Suchanek
  Cc: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Boris Brezillon, Javier Martinez Canillas, Stephen Warren,
	Andrew F. Davis, Marek Vasut, Rafał Miłecki,
	Mika Westerberg, Gabor Juhos, Bean Huo 霍斌斌,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:

> +static inline size_t
> +spi_max_transfer_size(struct spi_device *spi)
> +{
> +	struct spi_master *master = spi->master;
> +	if (!master->max_transfer_size)
> +		return 0;
> +	return master->max_transfer_size(spi);
> +}

Can we change this to return SIZE_MAX instead (ie, the maximum value for
a size_t)?  That way callers don't need to worry if there is a limit, if
they want to handle it they can just unconditionally assume that a limit
will be provided.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-02  9:38       ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-02  9:38 UTC (permalink / raw)
  To: Mark Brown
  Cc: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Boris Brezillon, Javier Martinez Canillas, Stephen Warren,
	Andrew F. Davis, Marek Vasut, Rafał Miłecki,
	Mika Westerberg, Gabor Juhos, Bean Huo 霍斌斌,
	Furquan Shaikh, MTD Maling List, Linux Kernel Mailing List,
	linux-spi

On 2 December 2015 at 00:12, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
>
>> +static inline size_t
>> +spi_max_transfer_size(struct spi_device *spi)
>> +{
>> +     struct spi_master *master = spi->master;
>> +     if (!master->max_transfer_size)
>> +             return 0;
>> +     return master->max_transfer_size(spi);
>> +}
>
> Can we change this to return SIZE_MAX instead (ie, the maximum value for
> a size_t)?  That way callers don't need to worry if there is a limit, if
> they want to handle it they can just unconditionally assume that a limit
> will be provided.

Yes, that sounds reasonable.

Thanks

Michal

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-02  9:38       ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-02  9:38 UTC (permalink / raw)
  To: Mark Brown
  Cc: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Boris Brezillon, Javier Martinez Canillas, Stephen Warren,
	Andrew F. Davis, Marek Vasut, Rafał Miłecki,
	Mika Westerberg, Gabor Juhos, Bean Huo 霍斌斌,
	Furquan Shaikh, MTD Maling List, Linux Kernel Mailing List,
	linux-spi

On 2 December 2015 at 00:12, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
>
>> +static inline size_t
>> +spi_max_transfer_size(struct spi_device *spi)
>> +{
>> +     struct spi_master *master = spi->master;
>> +     if (!master->max_transfer_size)
>> +             return 0;
>> +     return master->max_transfer_size(spi);
>> +}
>
> Can we change this to return SIZE_MAX instead (ie, the maximum value for
> a size_t)?  That way callers don't need to worry if there is a limit, if
> they want to handle it they can just unconditionally assume that a limit
> will be provided.

Yes, that sounds reasonable.

Thanks

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-02  9:55       ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-02  9:55 UTC (permalink / raw)
  To: Mark Brown
  Cc: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Boris Brezillon, Javier Martinez Canillas, Stephen Warren,
	Andrew F. Davis, Marek Vasut, Rafał Miłecki,
	Mika Westerberg, Gabor Juhos, Bean Huo 霍斌斌,
	Furquan Shaikh, MTD Maling List, Linux Kernel Mailing List,
	linux-spi

On 1 December 2015 at 20:58, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
>> On some SPI controllers it is not feasible to transfer arbitrary amount
>> of data at once.
>>
>> When the limit on transfer size is a few kilobytes at least it makes
>> sense to use the SPI hardware rather than reverting to gpio driver.
>
>> +     /*
>> +      * on some hardware transfer size may be constrained
>> +      * the limit may depend on device transfer settings
>> +      */
>> +     size_t (*max_transfer_size)(struct spi_device *spi);
>
> Heiner submitted a *very* similar patch just now with a straight
> variable plus accessor instead of a function and using a name with _msg.
> I'm ambivalent on the implementation but prefer the naming here since
> that's more the limitation we're trying to express I think (some
> hardware does have limiations about multple transfers too).  Can the two
> of you come up with something that works for both of you?

Sorry, missed there is a patch because it shows in the middle of the
discussion for me.

I don't really care which one it is so long as I can get the last
patch in this series based on it.

Thanks

Michal

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-02  9:55       ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-02  9:55 UTC (permalink / raw)
  To: Mark Brown
  Cc: Heiner Kallweit, David Woodhouse, Brian Norris, Han Xu,
	Boris Brezillon, Javier Martinez Canillas, Stephen Warren,
	Andrew F. Davis, Marek Vasut, Rafał Miłecki,
	Mika Westerberg, Gabor Juhos, Bean Huo 霍斌斌,
	Furquan Shaikh, MTD Maling List, Linux Kernel Mailing List,
	linux-spi

On 1 December 2015 at 20:58, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
>> On some SPI controllers it is not feasible to transfer arbitrary amount
>> of data at once.
>>
>> When the limit on transfer size is a few kilobytes at least it makes
>> sense to use the SPI hardware rather than reverting to gpio driver.
>
>> +     /*
>> +      * on some hardware transfer size may be constrained
>> +      * the limit may depend on device transfer settings
>> +      */
>> +     size_t (*max_transfer_size)(struct spi_device *spi);
>
> Heiner submitted a *very* similar patch just now with a straight
> variable plus accessor instead of a function and using a name with _msg.
> I'm ambivalent on the implementation but prefer the naming here since
> that's more the limitation we're trying to express I think (some
> hardware does have limiations about multple transfers too).  Can the two
> of you come up with something that works for both of you?

Sorry, missed there is a patch because it shows in the middle of the
discussion for me.

I don't really care which one it is so long as I can get the last
patch in this series based on it.

Thanks

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-04 14:30       ` Martin Sperl
  0 siblings, 0 replies; 39+ messages in thread
From: Martin Sperl @ 2015-12-04 14:30 UTC (permalink / raw)
  To: Mark Brown
  Cc: Michal Suchanek, Heiner Kallweit, David Woodhouse, Brian Norris,
	Han Xu, Boris Brezillon, Javier Martinez Canillas,
	Stephen Warren, Andrew F. Davis, Marek Vasut,
	Rafał Miłecki, Mika Westerberg, Gabor Juhos,
	Bean Huo 霍斌斌,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi


> On 02.12.2015, at 00:12, Mark Brown <broonie@kernel.org> wrote:
> 
> On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
> 
>> +static inline size_t
>> +spi_max_transfer_size(struct spi_device *spi)
>> +{
>> +	struct spi_master *master = spi->master;
>> +	if (!master->max_transfer_size)
>> +		return 0;
>> +	return master->max_transfer_size(spi);
>> +}
> 
> Can we change this to return SIZE_MAX instead (ie, the maximum value for
> a size_t)?  That way callers don't need to worry if there is a limit, if
> they want to handle it they can just unconditionally assume that a limit
> will be provided.

As I just came across: spi_master.max_dma_len, so I wonder how this 
value would differ from the proposed spi_master.max_transfer_size
on specific HW?

For all practical purposes I would assume both are identical.

Martin


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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-04 14:30       ` Martin Sperl
  0 siblings, 0 replies; 39+ messages in thread
From: Martin Sperl @ 2015-12-04 14:30 UTC (permalink / raw)
  To: Mark Brown
  Cc: Michal Suchanek, Heiner Kallweit, David Woodhouse, Brian Norris,
	Han Xu, Boris Brezillon, Javier Martinez Canillas,
	Stephen Warren, Andrew F. Davis, Marek Vasut,
	Rafał Miłecki, Mika Westerberg, Gabor Juhos,
	Bean Huo 霍斌斌,
	Furquan Shaikh, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA


> On 02.12.2015, at 00:12, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> 
> On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
> 
>> +static inline size_t
>> +spi_max_transfer_size(struct spi_device *spi)
>> +{
>> +	struct spi_master *master = spi->master;
>> +	if (!master->max_transfer_size)
>> +		return 0;
>> +	return master->max_transfer_size(spi);
>> +}
> 
> Can we change this to return SIZE_MAX instead (ie, the maximum value for
> a size_t)?  That way callers don't need to worry if there is a limit, if
> they want to handle it they can just unconditionally assume that a limit
> will be provided.

As I just came across: spi_master.max_dma_len, so I wonder how this 
value would differ from the proposed spi_master.max_transfer_size
on specific HW?

For all practical purposes I would assume both are identical.

Martin

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-04 16:45         ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-04 16:45 UTC (permalink / raw)
  To: Martin Sperl
  Cc: Mark Brown, Heiner Kallweit, David Woodhouse, Brian Norris,
	Han Xu, Boris Brezillon, Javier Martinez Canillas,
	Stephen Warren, Andrew F. Davis, Marek Vasut,
	Rafał Miłecki, Mika Westerberg, Gabor Juhos,
	Bean Huo 霍斌斌,
	Furquan Shaikh, MTD Maling List, Linux Kernel Mailing List,
	linux-spi

On 4 December 2015 at 15:30, Martin Sperl <martin@sperl.org> wrote:
>
>> On 02.12.2015, at 00:12, Mark Brown <broonie@kernel.org> wrote:
>>
>> On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
>>
>>> +static inline size_t
>>> +spi_max_transfer_size(struct spi_device *spi)
>>> +{
>>> +    struct spi_master *master = spi->master;
>>> +    if (!master->max_transfer_size)
>>> +            return 0;
>>> +    return master->max_transfer_size(spi);
>>> +}
>>
>> Can we change this to return SIZE_MAX instead (ie, the maximum value for
>> a size_t)?  That way callers don't need to worry if there is a limit, if
>> they want to handle it they can just unconditionally assume that a limit
>> will be provided.
>
> As I just came across: spi_master.max_dma_len, so I wonder how this
> value would differ from the proposed spi_master.max_transfer_size
> on specific HW?
>
> For all practical purposes I would assume both are identical.

They aren't.

Some SPI masters don't use DMA. Some SPI master drivers can drive CS
manually so they can glue multiple DMA (or whatever) transfers into
single logical SPI transfer transparently. And some cannot. Hence this
limit.

That said I don't know what is the purpose of spi_master.max_dma_len.
It is seldom used. It seems to be used as a hint for the DMA buffer
size in spi.c only.

It is set in 3 drivers.

Thanks

Michal

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-04 16:45         ` Michal Suchanek
  0 siblings, 0 replies; 39+ messages in thread
From: Michal Suchanek @ 2015-12-04 16:45 UTC (permalink / raw)
  To: Martin Sperl
  Cc: Mark Brown, Heiner Kallweit, David Woodhouse, Brian Norris,
	Han Xu, Boris Brezillon, Javier Martinez Canillas,
	Stephen Warren, Andrew F. Davis, Marek Vasut,
	Rafał Miłecki, Mika Westerberg, Gabor Juhos,
	Bean Huo 霍斌斌,
	Furquan Shaikh, MTD Maling List, Linux Kernel Mailing List,
	linux-spi

On 4 December 2015 at 15:30, Martin Sperl <martin-d5rIkyn9cnPYtjvyW6yDsg@public.gmane.org> wrote:
>
>> On 02.12.2015, at 00:12, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>>
>> On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
>>
>>> +static inline size_t
>>> +spi_max_transfer_size(struct spi_device *spi)
>>> +{
>>> +    struct spi_master *master = spi->master;
>>> +    if (!master->max_transfer_size)
>>> +            return 0;
>>> +    return master->max_transfer_size(spi);
>>> +}
>>
>> Can we change this to return SIZE_MAX instead (ie, the maximum value for
>> a size_t)?  That way callers don't need to worry if there is a limit, if
>> they want to handle it they can just unconditionally assume that a limit
>> will be provided.
>
> As I just came across: spi_master.max_dma_len, so I wonder how this
> value would differ from the proposed spi_master.max_transfer_size
> on specific HW?
>
> For all practical purposes I would assume both are identical.

They aren't.

Some SPI masters don't use DMA. Some SPI master drivers can drive CS
manually so they can glue multiple DMA (or whatever) transfers into
single logical SPI transfer transparently. And some cannot. Hence this
limit.

That said I don't know what is the purpose of spi_master.max_dma_len.
It is seldom used. It seems to be used as a hint for the DMA buffer
size in spi.c only.

It is set in 3 drivers.

Thanks

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-07 20:18         ` Mark Brown
  0 siblings, 0 replies; 39+ messages in thread
From: Mark Brown @ 2015-12-07 20:18 UTC (permalink / raw)
  To: Martin Sperl
  Cc: Michal Suchanek, Heiner Kallweit, David Woodhouse, Brian Norris,
	Han Xu, Boris Brezillon, Javier Martinez Canillas,
	Stephen Warren, Andrew F. Davis, Marek Vasut,
	Rafał Miłecki, Mika Westerberg, Gabor Juhos,
	Bean Huo 霍斌斌,
	Furquan Shaikh, linux-mtd, linux-kernel, linux-spi

[-- Attachment #1: Type: text/plain, Size: 879 bytes --]

On Fri, Dec 04, 2015 at 03:30:50PM +0100, Martin Sperl wrote:
> > On 02.12.2015, at 00:12, Mark Brown <broonie@kernel.org> wrote:

> > Can we change this to return SIZE_MAX instead (ie, the maximum value for
> > a size_t)?  That way callers don't need to worry if there is a limit, if
> > they want to handle it they can just unconditionally assume that a limit
> > will be provided.

> As I just came across: spi_master.max_dma_len, so I wonder how this 
> value would differ from the proposed spi_master.max_transfer_size
> on specific HW?

> For all practical purposes I would assume both are identical.

Yeah, we should probably just remove the DMA specific one in time though
it may be useful for some devices with built in DMA engines if they're
oddly limited I'm not sure how practical their DMA would be if it
differed from the overall transfer length.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH v5 08/10] spi: expose master transfer size limitation.
@ 2015-12-07 20:18         ` Mark Brown
  0 siblings, 0 replies; 39+ messages in thread
From: Mark Brown @ 2015-12-07 20:18 UTC (permalink / raw)
  To: Martin Sperl
  Cc: Michal Suchanek, Heiner Kallweit, David Woodhouse, Brian Norris,
	Han Xu, Boris Brezillon, Javier Martinez Canillas,
	Stephen Warren, Andrew F. Davis, Marek Vasut,
	Rafał Miłecki, Mika Westerberg, Gabor Juhos,
	Bean Huo 霍斌斌,
	Furquan Shaikh, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 908 bytes --]

On Fri, Dec 04, 2015 at 03:30:50PM +0100, Martin Sperl wrote:
> > On 02.12.2015, at 00:12, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:

> > Can we change this to return SIZE_MAX instead (ie, the maximum value for
> > a size_t)?  That way callers don't need to worry if there is a limit, if
> > they want to handle it they can just unconditionally assume that a limit
> > will be provided.

> As I just came across: spi_master.max_dma_len, so I wonder how this 
> value would differ from the proposed spi_master.max_transfer_size
> on specific HW?

> For all practical purposes I would assume both are identical.

Yeah, we should probably just remove the DMA specific one in time though
it may be useful for some devices with built in DMA engines if they're
oddly limited I'm not sure how practical their DMA would be if it
differed from the overall transfer length.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2015-12-07 20:18 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-01 16:51 [PATCH v5 00/10] add error checking to spi-nor read and write Michal Suchanek
2015-12-01 16:51 ` Michal Suchanek
2015-12-01 16:51 ` [PATCH v5 01/10] mtd: spi-nor: change return value of read/write Michal Suchanek
2015-12-01 16:51   ` Michal Suchanek
2015-12-01 16:51 ` [PATCH v5 02/10] mtd: m25p80: return amount of data transferred or error in read/write Michal Suchanek
2015-12-01 16:51   ` Michal Suchanek
2015-12-01 16:51 ` [PATCH v5 04/10] mtd: spi-nor: check return value from read/write Michal Suchanek
2015-12-01 16:51   ` Michal Suchanek
2015-12-01 16:51 ` [PATCH v5 03/10] mtd: fsl-quadspi: return amount of data read/written or error Michal Suchanek
2015-12-01 16:51   ` Michal Suchanek
2015-12-01 16:51 ` [PATCH v5 07/10] mtd: spi-nor: add read loop Michal Suchanek
2015-12-01 16:51   ` Michal Suchanek
2015-12-01 16:51 ` [PATCH v5 06/10] mtd: spi-nor: simplify write loop Michal Suchanek
2015-12-01 16:51   ` Michal Suchanek
2015-12-01 16:51 ` [PATCH v5 05/10] mtd: spi-nor: stop passing around retlen Michal Suchanek
2015-12-01 16:51   ` Michal Suchanek
2015-12-01 16:51 ` [PATCH v5 08/10] spi: expose master transfer size limitation Michal Suchanek
2015-12-01 16:51   ` Michal Suchanek
2015-12-01 19:58   ` Mark Brown
2015-12-01 19:58     ` Mark Brown
2015-12-01 21:07     ` Heiner Kallweit
2015-12-01 21:07       ` Heiner Kallweit
2015-12-01 21:31       ` Mark Brown
2015-12-01 21:31         ` Mark Brown
2015-12-02  9:55     ` Michal Suchanek
2015-12-02  9:55       ` Michal Suchanek
2015-12-01 23:12   ` Mark Brown
2015-12-02  9:38     ` Michal Suchanek
2015-12-02  9:38       ` Michal Suchanek
2015-12-04 14:30     ` Martin Sperl
2015-12-04 14:30       ` Martin Sperl
2015-12-04 16:45       ` Michal Suchanek
2015-12-04 16:45         ` Michal Suchanek
2015-12-07 20:18       ` Mark Brown
2015-12-07 20:18         ` Mark Brown
2015-12-01 16:51 ` [PATCH v5 10/10] spi: m25p80: read in spi_max_transfer_size chunks Michal Suchanek
2015-12-01 16:51   ` Michal Suchanek
2015-12-01 16:51 ` [PATCH v5 09/10] spi: fsl-espi: expose maximum transfer size limit Michal Suchanek
2015-12-01 16:51   ` Michal Suchanek

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.