All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] mtd: spi-nor: stm32-quadspi: fixes
@ 2017-10-26 15:12 ` Ludovic Barre
  0 siblings, 0 replies; 23+ messages in thread
From: Ludovic Barre @ 2017-10-26 15:12 UTC (permalink / raw
  To: Cyrille Pitchen, Marek Vasut
  Cc: David Woodhouse, Brian Norris, Boris Brezillon,
	Richard Weinberger, Alexandre Torgue, Rob Herring, linux-mtd,
	linux-kernel, devicetree, linux-arm-kernel, Ludovic Barre

From: Ludovic Barre <ludovic.barre@st.com>

This series adds:
-Fix: to avoid compilation warning with older compiler
versions such as gcc-4.6.
This topic has been discussed on 2 threads with Geert and Arnd
https://lkml.org/lkml/2017/9/15/70
https://www.spinics.net/lists/arm-kernel/msg606269.html
-Fix: abort prefetching in memory-mapped mode as soon prefetching
could exceed nor size (not done by fsize limit)
-Change license text and Copyright

Changes v2:
with the right Cyrille's email (wedev4u.fr)

Geert Uytterhoeven (1):
  mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code

Ludovic Barre (2):
  mtd: spi-nor: stm32-quadspi: fix prefetching outside fsize
  mtd: spi-nor: stm32-quadspi: change license text

 drivers/mtd/spi-nor/stm32-quadspi.c | 35 +++++++++++++++++++++++++++++------
 1 file changed, 29 insertions(+), 6 deletions(-)

-- 
2.7.4

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

* [PATCH v2 0/3] mtd: spi-nor: stm32-quadspi: fixes
@ 2017-10-26 15:12 ` Ludovic Barre
  0 siblings, 0 replies; 23+ messages in thread
From: Ludovic Barre @ 2017-10-26 15:12 UTC (permalink / raw
  To: Cyrille Pitchen, Marek Vasut
  Cc: David Woodhouse, Brian Norris, Boris Brezillon,
	Richard Weinberger, Alexandre Torgue, Rob Herring, linux-mtd,
	linux-kernel, devicetree, linux-arm-kernel, Ludovic Barre

From: Ludovic Barre <ludovic.barre@st.com>

This series adds:
-Fix: to avoid compilation warning with older compiler
versions such as gcc-4.6.
This topic has been discussed on 2 threads with Geert and Arnd
https://lkml.org/lkml/2017/9/15/70
https://www.spinics.net/lists/arm-kernel/msg606269.html
-Fix: abort prefetching in memory-mapped mode as soon prefetching
could exceed nor size (not done by fsize limit)
-Change license text and Copyright

Changes v2:
with the right Cyrille's email (wedev4u.fr)

Geert Uytterhoeven (1):
  mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code

Ludovic Barre (2):
  mtd: spi-nor: stm32-quadspi: fix prefetching outside fsize
  mtd: spi-nor: stm32-quadspi: change license text

 drivers/mtd/spi-nor/stm32-quadspi.c | 35 +++++++++++++++++++++++++++++------
 1 file changed, 29 insertions(+), 6 deletions(-)

-- 
2.7.4

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

* [PATCH v2 0/3] mtd: spi-nor: stm32-quadspi: fixes
@ 2017-10-26 15:12 ` Ludovic Barre
  0 siblings, 0 replies; 23+ messages in thread
From: Ludovic Barre @ 2017-10-26 15:12 UTC (permalink / raw
  To: linux-arm-kernel

From: Ludovic Barre <ludovic.barre@st.com>

This series adds:
-Fix: to avoid compilation warning with older compiler
versions such as gcc-4.6.
This topic has been discussed on 2 threads with Geert and Arnd
https://lkml.org/lkml/2017/9/15/70
https://www.spinics.net/lists/arm-kernel/msg606269.html
-Fix: abort prefetching in memory-mapped mode as soon prefetching
could exceed nor size (not done by fsize limit)
-Change license text and Copyright

Changes v2:
with the right Cyrille's email (wedev4u.fr)

Geert Uytterhoeven (1):
  mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code

Ludovic Barre (2):
  mtd: spi-nor: stm32-quadspi: fix prefetching outside fsize
  mtd: spi-nor: stm32-quadspi: change license text

 drivers/mtd/spi-nor/stm32-quadspi.c | 35 +++++++++++++++++++++++++++++------
 1 file changed, 29 insertions(+), 6 deletions(-)

-- 
2.7.4

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

* [PATCH v2 1/3] mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code
  2017-10-26 15:12 ` Ludovic Barre
  (?)
@ 2017-10-26 15:12   ` Ludovic Barre
  -1 siblings, 0 replies; 23+ messages in thread
From: Ludovic Barre @ 2017-10-26 15:12 UTC (permalink / raw
  To: Cyrille Pitchen, Marek Vasut
  Cc: David Woodhouse, Brian Norris, Boris Brezillon,
	Richard Weinberger, Alexandre Torgue, Rob Herring, linux-mtd,
	linux-kernel, devicetree, linux-arm-kernel, Geert Uytterhoeven,
	Ludovic Barre

From: Geert Uytterhoeven <geert@linux-m68k.org>

With gcc 4.1.2:

    drivers/mtd/spi-nor/stm32-quadspi.c: In function ‘stm32_qspi_tx_poll’:
    drivers/mtd/spi-nor/stm32-quadspi.c:230: warning: ‘ret’ may be used uninitialized in this function

Indeed, if stm32_qspi_cmd.len is zero, ret will be uninitialized.
This length is passed from outside the driver using the
spi_nor.{read,write}{,_reg}() callbacks.

Several functions in drivers/mtd/spi-nor/spi-nor.c (e.g. write_enable(),
write_disable(), and erase_chip()) call spi_nor.write_reg() with a zero
length.

Fix this by returning an explicit zero on success.

Fixes: 0d43d7ab277a048c ("mtd: spi-nor: add driver for STM32 quad spi flash controller")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Ludovic Barre <ludovic.barre@st.com>
Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
---
 drivers/mtd/spi-nor/stm32-quadspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
index 86c0931..ad6a3e1 100644
--- a/drivers/mtd/spi-nor/stm32-quadspi.c
+++ b/drivers/mtd/spi-nor/stm32-quadspi.c
@@ -240,12 +240,12 @@ static int stm32_qspi_tx_poll(struct stm32_qspi *qspi,
 						 STM32_QSPI_FIFO_TIMEOUT_US);
 		if (ret) {
 			dev_err(qspi->dev, "fifo timeout (stat:%#x)\n", sr);
-			break;
+			return ret;
 		}
 		tx_fifo(buf++, qspi->io_base + QUADSPI_DR);
 	}
 
-	return ret;
+	return 0;
 }
 
 static int stm32_qspi_tx_mm(struct stm32_qspi *qspi,
-- 
2.7.4

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

* [PATCH v2 1/3] mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code
@ 2017-10-26 15:12   ` Ludovic Barre
  0 siblings, 0 replies; 23+ messages in thread
From: Ludovic Barre @ 2017-10-26 15:12 UTC (permalink / raw
  To: Cyrille Pitchen, Marek Vasut
  Cc: Boris Brezillon, Alexandre Torgue, devicetree, Richard Weinberger,
	linux-kernel, Rob Herring, linux-mtd, Ludovic Barre,
	Geert Uytterhoeven, Brian Norris, David Woodhouse,
	linux-arm-kernel

From: Geert Uytterhoeven <geert@linux-m68k.org>

With gcc 4.1.2:

    drivers/mtd/spi-nor/stm32-quadspi.c: In function ‘stm32_qspi_tx_poll’:
    drivers/mtd/spi-nor/stm32-quadspi.c:230: warning: ‘ret’ may be used uninitialized in this function

Indeed, if stm32_qspi_cmd.len is zero, ret will be uninitialized.
This length is passed from outside the driver using the
spi_nor.{read,write}{,_reg}() callbacks.

Several functions in drivers/mtd/spi-nor/spi-nor.c (e.g. write_enable(),
write_disable(), and erase_chip()) call spi_nor.write_reg() with a zero
length.

Fix this by returning an explicit zero on success.

Fixes: 0d43d7ab277a048c ("mtd: spi-nor: add driver for STM32 quad spi flash controller")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Ludovic Barre <ludovic.barre@st.com>
Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
---
 drivers/mtd/spi-nor/stm32-quadspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
index 86c0931..ad6a3e1 100644
--- a/drivers/mtd/spi-nor/stm32-quadspi.c
+++ b/drivers/mtd/spi-nor/stm32-quadspi.c
@@ -240,12 +240,12 @@ static int stm32_qspi_tx_poll(struct stm32_qspi *qspi,
 						 STM32_QSPI_FIFO_TIMEOUT_US);
 		if (ret) {
 			dev_err(qspi->dev, "fifo timeout (stat:%#x)\n", sr);
-			break;
+			return ret;
 		}
 		tx_fifo(buf++, qspi->io_base + QUADSPI_DR);
 	}
 
-	return ret;
+	return 0;
 }
 
 static int stm32_qspi_tx_mm(struct stm32_qspi *qspi,
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 1/3] mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code
@ 2017-10-26 15:12   ` Ludovic Barre
  0 siblings, 0 replies; 23+ messages in thread
From: Ludovic Barre @ 2017-10-26 15:12 UTC (permalink / raw
  To: linux-arm-kernel

From: Geert Uytterhoeven <geert@linux-m68k.org>

With gcc 4.1.2:

    drivers/mtd/spi-nor/stm32-quadspi.c: In function ?stm32_qspi_tx_poll?:
    drivers/mtd/spi-nor/stm32-quadspi.c:230: warning: ?ret? may be used uninitialized in this function

Indeed, if stm32_qspi_cmd.len is zero, ret will be uninitialized.
This length is passed from outside the driver using the
spi_nor.{read,write}{,_reg}() callbacks.

Several functions in drivers/mtd/spi-nor/spi-nor.c (e.g. write_enable(),
write_disable(), and erase_chip()) call spi_nor.write_reg() with a zero
length.

Fix this by returning an explicit zero on success.

Fixes: 0d43d7ab277a048c ("mtd: spi-nor: add driver for STM32 quad spi flash controller")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Ludovic Barre <ludovic.barre@st.com>
Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
---
 drivers/mtd/spi-nor/stm32-quadspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
index 86c0931..ad6a3e1 100644
--- a/drivers/mtd/spi-nor/stm32-quadspi.c
+++ b/drivers/mtd/spi-nor/stm32-quadspi.c
@@ -240,12 +240,12 @@ static int stm32_qspi_tx_poll(struct stm32_qspi *qspi,
 						 STM32_QSPI_FIFO_TIMEOUT_US);
 		if (ret) {
 			dev_err(qspi->dev, "fifo timeout (stat:%#x)\n", sr);
-			break;
+			return ret;
 		}
 		tx_fifo(buf++, qspi->io_base + QUADSPI_DR);
 	}
 
-	return ret;
+	return 0;
 }
 
 static int stm32_qspi_tx_mm(struct stm32_qspi *qspi,
-- 
2.7.4

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

* [PATCH v2 2/3] mtd: spi-nor: stm32-quadspi: fix prefetching outside fsize
  2017-10-26 15:12 ` Ludovic Barre
  (?)
@ 2017-10-26 15:12   ` Ludovic Barre
  -1 siblings, 0 replies; 23+ messages in thread
From: Ludovic Barre @ 2017-10-26 15:12 UTC (permalink / raw
  To: Cyrille Pitchen, Marek Vasut
  Cc: David Woodhouse, Brian Norris, Boris Brezillon,
	Richard Weinberger, Alexandre Torgue, Rob Herring, linux-mtd,
	linux-kernel, devicetree, linux-arm-kernel, Ludovic Barre

From: Ludovic Barre <ludovic.barre@st.com>

When memory-mapped mode is used, a prefetching mechanism fully
managed by the hardware allows to optimize the read from external
the QSPI memory. A 32-bytes FIFO is used for prefetching.
When the limit of flash size - fifo size is reached the prefetching
mechanism tries to read outside the fsize.
The stm32 quadspi hardware become busy and should be aborted.

Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
Reported-by: Bruno Herrera <bruherrera@gmail.com>
Tested-by: Bruno Herrera <bruherrera@gmail.com>
---
 drivers/mtd/spi-nor/stm32-quadspi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
index ad6a3e1..70710be 100644
--- a/drivers/mtd/spi-nor/stm32-quadspi.c
+++ b/drivers/mtd/spi-nor/stm32-quadspi.c
@@ -113,6 +113,7 @@
 #define STM32_MAX_MMAP_SZ	SZ_256M
 #define STM32_MAX_NORCHIP	2
 
+#define STM32_QSPI_FIFO_SZ	32
 #define STM32_QSPI_FIFO_TIMEOUT_US 30000
 #define STM32_QSPI_BUSY_TIMEOUT_US 100000
 
@@ -124,6 +125,7 @@ struct stm32_qspi_flash {
 	u32 presc;
 	u32 read_mode;
 	bool registered;
+	u32 prefetch_limit;
 };
 
 struct stm32_qspi {
@@ -272,6 +274,7 @@ static int stm32_qspi_send(struct stm32_qspi_flash *flash,
 {
 	struct stm32_qspi *qspi = flash->qspi;
 	u32 ccr, dcr, cr;
+	u32 last_byte;
 	int err;
 
 	err = stm32_qspi_wait_nobusy(qspi);
@@ -314,6 +317,10 @@ static int stm32_qspi_send(struct stm32_qspi_flash *flash,
 		if (err)
 			goto abort;
 		writel_relaxed(FCR_CTCF, qspi->io_base + QUADSPI_FCR);
+	} else {
+		last_byte = cmd->addr + cmd->len;
+		if (last_byte > flash->prefetch_limit)
+			goto abort;
 	}
 
 	return err;
@@ -322,7 +329,9 @@ static int stm32_qspi_send(struct stm32_qspi_flash *flash,
 	cr = readl_relaxed(qspi->io_base + QUADSPI_CR) | CR_ABORT;
 	writel_relaxed(cr, qspi->io_base + QUADSPI_CR);
 
-	dev_err(qspi->dev, "%s abort err:%d\n", __func__, err);
+	if (err)
+		dev_err(qspi->dev, "%s abort err:%d\n", __func__, err);
+
 	return err;
 }
 
@@ -550,6 +559,7 @@ static int stm32_qspi_flash_setup(struct stm32_qspi *qspi,
 	}
 
 	flash->fsize = FSIZE_VAL(mtd->size);
+	flash->prefetch_limit = mtd->size - STM32_QSPI_FIFO_SZ;
 
 	flash->read_mode = CCR_FMODE_MM;
 	if (mtd->size > qspi->mm_size)
-- 
2.7.4

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

* [PATCH v2 2/3] mtd: spi-nor: stm32-quadspi: fix prefetching outside fsize
@ 2017-10-26 15:12   ` Ludovic Barre
  0 siblings, 0 replies; 23+ messages in thread
From: Ludovic Barre @ 2017-10-26 15:12 UTC (permalink / raw
  To: Cyrille Pitchen, Marek Vasut
  Cc: David Woodhouse, Brian Norris, Boris Brezillon,
	Richard Weinberger, Alexandre Torgue, Rob Herring, linux-mtd,
	linux-kernel, devicetree, linux-arm-kernel, Ludovic Barre

From: Ludovic Barre <ludovic.barre@st.com>

When memory-mapped mode is used, a prefetching mechanism fully
managed by the hardware allows to optimize the read from external
the QSPI memory. A 32-bytes FIFO is used for prefetching.
When the limit of flash size - fifo size is reached the prefetching
mechanism tries to read outside the fsize.
The stm32 quadspi hardware become busy and should be aborted.

Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
Reported-by: Bruno Herrera <bruherrera@gmail.com>
Tested-by: Bruno Herrera <bruherrera@gmail.com>
---
 drivers/mtd/spi-nor/stm32-quadspi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
index ad6a3e1..70710be 100644
--- a/drivers/mtd/spi-nor/stm32-quadspi.c
+++ b/drivers/mtd/spi-nor/stm32-quadspi.c
@@ -113,6 +113,7 @@
 #define STM32_MAX_MMAP_SZ	SZ_256M
 #define STM32_MAX_NORCHIP	2
 
+#define STM32_QSPI_FIFO_SZ	32
 #define STM32_QSPI_FIFO_TIMEOUT_US 30000
 #define STM32_QSPI_BUSY_TIMEOUT_US 100000
 
@@ -124,6 +125,7 @@ struct stm32_qspi_flash {
 	u32 presc;
 	u32 read_mode;
 	bool registered;
+	u32 prefetch_limit;
 };
 
 struct stm32_qspi {
@@ -272,6 +274,7 @@ static int stm32_qspi_send(struct stm32_qspi_flash *flash,
 {
 	struct stm32_qspi *qspi = flash->qspi;
 	u32 ccr, dcr, cr;
+	u32 last_byte;
 	int err;
 
 	err = stm32_qspi_wait_nobusy(qspi);
@@ -314,6 +317,10 @@ static int stm32_qspi_send(struct stm32_qspi_flash *flash,
 		if (err)
 			goto abort;
 		writel_relaxed(FCR_CTCF, qspi->io_base + QUADSPI_FCR);
+	} else {
+		last_byte = cmd->addr + cmd->len;
+		if (last_byte > flash->prefetch_limit)
+			goto abort;
 	}
 
 	return err;
@@ -322,7 +329,9 @@ static int stm32_qspi_send(struct stm32_qspi_flash *flash,
 	cr = readl_relaxed(qspi->io_base + QUADSPI_CR) | CR_ABORT;
 	writel_relaxed(cr, qspi->io_base + QUADSPI_CR);
 
-	dev_err(qspi->dev, "%s abort err:%d\n", __func__, err);
+	if (err)
+		dev_err(qspi->dev, "%s abort err:%d\n", __func__, err);
+
 	return err;
 }
 
@@ -550,6 +559,7 @@ static int stm32_qspi_flash_setup(struct stm32_qspi *qspi,
 	}
 
 	flash->fsize = FSIZE_VAL(mtd->size);
+	flash->prefetch_limit = mtd->size - STM32_QSPI_FIFO_SZ;
 
 	flash->read_mode = CCR_FMODE_MM;
 	if (mtd->size > qspi->mm_size)
-- 
2.7.4

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

* [PATCH v2 2/3] mtd: spi-nor: stm32-quadspi: fix prefetching outside fsize
@ 2017-10-26 15:12   ` Ludovic Barre
  0 siblings, 0 replies; 23+ messages in thread
From: Ludovic Barre @ 2017-10-26 15:12 UTC (permalink / raw
  To: linux-arm-kernel

From: Ludovic Barre <ludovic.barre@st.com>

When memory-mapped mode is used, a prefetching mechanism fully
managed by the hardware allows to optimize the read from external
the QSPI memory. A 32-bytes FIFO is used for prefetching.
When the limit of flash size - fifo size is reached the prefetching
mechanism tries to read outside the fsize.
The stm32 quadspi hardware become busy and should be aborted.

Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
Reported-by: Bruno Herrera <bruherrera@gmail.com>
Tested-by: Bruno Herrera <bruherrera@gmail.com>
---
 drivers/mtd/spi-nor/stm32-quadspi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
index ad6a3e1..70710be 100644
--- a/drivers/mtd/spi-nor/stm32-quadspi.c
+++ b/drivers/mtd/spi-nor/stm32-quadspi.c
@@ -113,6 +113,7 @@
 #define STM32_MAX_MMAP_SZ	SZ_256M
 #define STM32_MAX_NORCHIP	2
 
+#define STM32_QSPI_FIFO_SZ	32
 #define STM32_QSPI_FIFO_TIMEOUT_US 30000
 #define STM32_QSPI_BUSY_TIMEOUT_US 100000
 
@@ -124,6 +125,7 @@ struct stm32_qspi_flash {
 	u32 presc;
 	u32 read_mode;
 	bool registered;
+	u32 prefetch_limit;
 };
 
 struct stm32_qspi {
@@ -272,6 +274,7 @@ static int stm32_qspi_send(struct stm32_qspi_flash *flash,
 {
 	struct stm32_qspi *qspi = flash->qspi;
 	u32 ccr, dcr, cr;
+	u32 last_byte;
 	int err;
 
 	err = stm32_qspi_wait_nobusy(qspi);
@@ -314,6 +317,10 @@ static int stm32_qspi_send(struct stm32_qspi_flash *flash,
 		if (err)
 			goto abort;
 		writel_relaxed(FCR_CTCF, qspi->io_base + QUADSPI_FCR);
+	} else {
+		last_byte = cmd->addr + cmd->len;
+		if (last_byte > flash->prefetch_limit)
+			goto abort;
 	}
 
 	return err;
@@ -322,7 +329,9 @@ static int stm32_qspi_send(struct stm32_qspi_flash *flash,
 	cr = readl_relaxed(qspi->io_base + QUADSPI_CR) | CR_ABORT;
 	writel_relaxed(cr, qspi->io_base + QUADSPI_CR);
 
-	dev_err(qspi->dev, "%s abort err:%d\n", __func__, err);
+	if (err)
+		dev_err(qspi->dev, "%s abort err:%d\n", __func__, err);
+
 	return err;
 }
 
@@ -550,6 +559,7 @@ static int stm32_qspi_flash_setup(struct stm32_qspi *qspi,
 	}
 
 	flash->fsize = FSIZE_VAL(mtd->size);
+	flash->prefetch_limit = mtd->size - STM32_QSPI_FIFO_SZ;
 
 	flash->read_mode = CCR_FMODE_MM;
 	if (mtd->size > qspi->mm_size)
-- 
2.7.4

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

* [PATCH v2 3/3] mtd: spi-nor: stm32-quadspi: change license text
  2017-10-26 15:12 ` Ludovic Barre
  (?)
@ 2017-10-26 15:12   ` Ludovic Barre
  -1 siblings, 0 replies; 23+ messages in thread
From: Ludovic Barre @ 2017-10-26 15:12 UTC (permalink / raw
  To: Cyrille Pitchen, Marek Vasut
  Cc: David Woodhouse, Brian Norris, Boris Brezillon,
	Richard Weinberger, Alexandre Torgue, Rob Herring, linux-mtd,
	linux-kernel, devicetree, linux-arm-kernel, Ludovic Barre

From: Ludovic Barre <ludovic.barre@st.com>

-Change the license text with long template.
-Change Copyright to STMicroelectronics.

Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
---
 drivers/mtd/spi-nor/stm32-quadspi.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
index 70710be..b3c7f6a 100644
--- a/drivers/mtd/spi-nor/stm32-quadspi.c
+++ b/drivers/mtd/spi-nor/stm32-quadspi.c
@@ -1,9 +1,22 @@
 /*
- * stm32_quadspi.c
+ * Driver for stm32 quadspi controller
  *
- * Copyright (C) 2017, Ludovic Barre
+ * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
+ * Author(s): Ludovic Barre author <ludovic.barre@st.com>.
  *
- * License terms: GNU General Public License (GPL), version 2
+ * License terms: GPL V2.0.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * This program. If not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/clk.h>
 #include <linux/errno.h>
-- 
2.7.4

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

* [PATCH v2 3/3] mtd: spi-nor: stm32-quadspi: change license text
@ 2017-10-26 15:12   ` Ludovic Barre
  0 siblings, 0 replies; 23+ messages in thread
From: Ludovic Barre @ 2017-10-26 15:12 UTC (permalink / raw
  To: Cyrille Pitchen, Marek Vasut
  Cc: David Woodhouse, Brian Norris, Boris Brezillon,
	Richard Weinberger, Alexandre Torgue, Rob Herring, linux-mtd,
	linux-kernel, devicetree, linux-arm-kernel, Ludovic Barre

From: Ludovic Barre <ludovic.barre@st.com>

-Change the license text with long template.
-Change Copyright to STMicroelectronics.

Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
---
 drivers/mtd/spi-nor/stm32-quadspi.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
index 70710be..b3c7f6a 100644
--- a/drivers/mtd/spi-nor/stm32-quadspi.c
+++ b/drivers/mtd/spi-nor/stm32-quadspi.c
@@ -1,9 +1,22 @@
 /*
- * stm32_quadspi.c
+ * Driver for stm32 quadspi controller
  *
- * Copyright (C) 2017, Ludovic Barre
+ * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
+ * Author(s): Ludovic Barre author <ludovic.barre@st.com>.
  *
- * License terms: GNU General Public License (GPL), version 2
+ * License terms: GPL V2.0.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * This program. If not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/clk.h>
 #include <linux/errno.h>
-- 
2.7.4

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

* [PATCH v2 3/3] mtd: spi-nor: stm32-quadspi: change license text
@ 2017-10-26 15:12   ` Ludovic Barre
  0 siblings, 0 replies; 23+ messages in thread
From: Ludovic Barre @ 2017-10-26 15:12 UTC (permalink / raw
  To: linux-arm-kernel

From: Ludovic Barre <ludovic.barre@st.com>

-Change the license text with long template.
-Change Copyright to STMicroelectronics.

Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
---
 drivers/mtd/spi-nor/stm32-quadspi.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
index 70710be..b3c7f6a 100644
--- a/drivers/mtd/spi-nor/stm32-quadspi.c
+++ b/drivers/mtd/spi-nor/stm32-quadspi.c
@@ -1,9 +1,22 @@
 /*
- * stm32_quadspi.c
+ * Driver for stm32 quadspi controller
  *
- * Copyright (C) 2017, Ludovic Barre
+ * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
+ * Author(s): Ludovic Barre author <ludovic.barre@st.com>.
  *
- * License terms: GNU General Public License (GPL), version 2
+ * License terms: GPL V2.0.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * This program. If not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/clk.h>
 #include <linux/errno.h>
-- 
2.7.4

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

* Re: [PATCH v2 1/3] mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code
  2017-10-26 15:12   ` Ludovic Barre
@ 2017-10-29 17:50     ` Cyrille Pitchen
  -1 siblings, 0 replies; 23+ messages in thread
From: Cyrille Pitchen @ 2017-10-29 17:50 UTC (permalink / raw
  To: Ludovic Barre, Marek Vasut
  Cc: David Woodhouse, Brian Norris, Boris Brezillon,
	Richard Weinberger, Alexandre Torgue, Rob Herring, linux-mtd,
	linux-kernel, devicetree, linux-arm-kernel, Geert Uytterhoeven

Hi Ludovic,

Le 26/10/2017 à 17:12, Ludovic Barre a écrit :
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> With gcc 4.1.2:
> 
>     drivers/mtd/spi-nor/stm32-quadspi.c: In function ‘stm32_qspi_tx_poll’:
>     drivers/mtd/spi-nor/stm32-quadspi.c:230: warning: ‘ret’ may be used uninitialized in this function
> 
> Indeed, if stm32_qspi_cmd.len is zero, ret will be uninitialized.
> This length is passed from outside the driver using the
> spi_nor.{read,write}{,_reg}() callbacks.
> 
> Several functions in drivers/mtd/spi-nor/spi-nor.c (e.g. write_enable(),
> write_disable(), and erase_chip()) call spi_nor.write_reg() with a zero
> length.
> 
> Fix this by returning an explicit zero on success.
> 
> Fixes: 0d43d7ab277a048c ("mtd: spi-nor: add driver for STM32 quad spi flash controller")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Acked-by: Ludovic Barre <ludovic.barre@st.com>
> Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
I removed your "Signed-off" because I think this is a mistake but kept
your "Acked-by" tag.

Applied to the spi-nor/next branch of l2-mtd.

Thanks!

> ---
>  drivers/mtd/spi-nor/stm32-quadspi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
> index 86c0931..ad6a3e1 100644
> --- a/drivers/mtd/spi-nor/stm32-quadspi.c
> +++ b/drivers/mtd/spi-nor/stm32-quadspi.c
> @@ -240,12 +240,12 @@ static int stm32_qspi_tx_poll(struct stm32_qspi *qspi,
>  						 STM32_QSPI_FIFO_TIMEOUT_US);
>  		if (ret) {
>  			dev_err(qspi->dev, "fifo timeout (stat:%#x)\n", sr);
> -			break;
> +			return ret;
>  		}
>  		tx_fifo(buf++, qspi->io_base + QUADSPI_DR);
>  	}
>  
> -	return ret;
> +	return 0;
>  }
>  
>  static int stm32_qspi_tx_mm(struct stm32_qspi *qspi,
> 

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

* [PATCH v2 1/3] mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code
@ 2017-10-29 17:50     ` Cyrille Pitchen
  0 siblings, 0 replies; 23+ messages in thread
From: Cyrille Pitchen @ 2017-10-29 17:50 UTC (permalink / raw
  To: linux-arm-kernel

Hi Ludovic,

Le 26/10/2017 ? 17:12, Ludovic Barre a ?crit?:
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> With gcc 4.1.2:
> 
>     drivers/mtd/spi-nor/stm32-quadspi.c: In function ?stm32_qspi_tx_poll?:
>     drivers/mtd/spi-nor/stm32-quadspi.c:230: warning: ?ret? may be used uninitialized in this function
> 
> Indeed, if stm32_qspi_cmd.len is zero, ret will be uninitialized.
> This length is passed from outside the driver using the
> spi_nor.{read,write}{,_reg}() callbacks.
> 
> Several functions in drivers/mtd/spi-nor/spi-nor.c (e.g. write_enable(),
> write_disable(), and erase_chip()) call spi_nor.write_reg() with a zero
> length.
> 
> Fix this by returning an explicit zero on success.
> 
> Fixes: 0d43d7ab277a048c ("mtd: spi-nor: add driver for STM32 quad spi flash controller")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Acked-by: Ludovic Barre <ludovic.barre@st.com>
> Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
I removed your "Signed-off" because I think this is a mistake but kept
your "Acked-by" tag.

Applied to the spi-nor/next branch of l2-mtd.

Thanks!

> ---
>  drivers/mtd/spi-nor/stm32-quadspi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
> index 86c0931..ad6a3e1 100644
> --- a/drivers/mtd/spi-nor/stm32-quadspi.c
> +++ b/drivers/mtd/spi-nor/stm32-quadspi.c
> @@ -240,12 +240,12 @@ static int stm32_qspi_tx_poll(struct stm32_qspi *qspi,
>  						 STM32_QSPI_FIFO_TIMEOUT_US);
>  		if (ret) {
>  			dev_err(qspi->dev, "fifo timeout (stat:%#x)\n", sr);
> -			break;
> +			return ret;
>  		}
>  		tx_fifo(buf++, qspi->io_base + QUADSPI_DR);
>  	}
>  
> -	return ret;
> +	return 0;
>  }
>  
>  static int stm32_qspi_tx_mm(struct stm32_qspi *qspi,
> 

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

* Re: [PATCH v2 3/3] mtd: spi-nor: stm32-quadspi: change license text
@ 2017-10-29 17:51     ` Cyrille Pitchen
  0 siblings, 0 replies; 23+ messages in thread
From: Cyrille Pitchen @ 2017-10-29 17:51 UTC (permalink / raw
  To: Ludovic Barre, Marek Vasut
  Cc: Boris Brezillon, Alexandre Torgue, devicetree, Richard Weinberger,
	linux-kernel, Rob Herring, linux-mtd, Brian Norris,
	David Woodhouse, linux-arm-kernel

Le 26/10/2017 à 17:12, Ludovic Barre a écrit :
> From: Ludovic Barre <ludovic.barre@st.com>
> 
> -Change the license text with long template.
> -Change Copyright to STMicroelectronics.
> 
> Signed-off-by: Ludovic Barre <ludovic.barre@st.com>

Applied to the spi-nor/next branch of l2-mtd

Thanks!
> ---
>  drivers/mtd/spi-nor/stm32-quadspi.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
> index 70710be..b3c7f6a 100644
> --- a/drivers/mtd/spi-nor/stm32-quadspi.c
> +++ b/drivers/mtd/spi-nor/stm32-quadspi.c
> @@ -1,9 +1,22 @@
>  /*
> - * stm32_quadspi.c
> + * Driver for stm32 quadspi controller
>   *
> - * Copyright (C) 2017, Ludovic Barre
> + * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
> + * Author(s): Ludovic Barre author <ludovic.barre@st.com>.
>   *
> - * License terms: GNU General Public License (GPL), version 2
> + * License terms: GPL V2.0.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published by
> + * the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
> + * details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * This program. If not, see <http://www.gnu.org/licenses/>.
>   */
>  #include <linux/clk.h>
>  #include <linux/errno.h>
> 

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

* Re: [PATCH v2 3/3] mtd: spi-nor: stm32-quadspi: change license text
@ 2017-10-29 17:51     ` Cyrille Pitchen
  0 siblings, 0 replies; 23+ messages in thread
From: Cyrille Pitchen @ 2017-10-29 17:51 UTC (permalink / raw
  To: Ludovic Barre, Marek Vasut
  Cc: Boris Brezillon, Alexandre Torgue,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Richard Weinberger,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Brian Norris,
	David Woodhouse,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Le 26/10/2017 à 17:12, Ludovic Barre a écrit :
> From: Ludovic Barre <ludovic.barre-qxv4g6HH51o@public.gmane.org>
> 
> -Change the license text with long template.
> -Change Copyright to STMicroelectronics.
> 
> Signed-off-by: Ludovic Barre <ludovic.barre-qxv4g6HH51o@public.gmane.org>

Applied to the spi-nor/next branch of l2-mtd

Thanks!
> ---
>  drivers/mtd/spi-nor/stm32-quadspi.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
> index 70710be..b3c7f6a 100644
> --- a/drivers/mtd/spi-nor/stm32-quadspi.c
> +++ b/drivers/mtd/spi-nor/stm32-quadspi.c
> @@ -1,9 +1,22 @@
>  /*
> - * stm32_quadspi.c
> + * Driver for stm32 quadspi controller
>   *
> - * Copyright (C) 2017, Ludovic Barre
> + * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
> + * Author(s): Ludovic Barre author <ludovic.barre-qxv4g6HH51o@public.gmane.org>.
>   *
> - * License terms: GNU General Public License (GPL), version 2
> + * License terms: GPL V2.0.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published by
> + * the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
> + * details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * This program. If not, see <http://www.gnu.org/licenses/>.
>   */
>  #include <linux/clk.h>
>  #include <linux/errno.h>
> 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" 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] 23+ messages in thread

* [PATCH v2 3/3] mtd: spi-nor: stm32-quadspi: change license text
@ 2017-10-29 17:51     ` Cyrille Pitchen
  0 siblings, 0 replies; 23+ messages in thread
From: Cyrille Pitchen @ 2017-10-29 17:51 UTC (permalink / raw
  To: linux-arm-kernel

Le 26/10/2017 ? 17:12, Ludovic Barre a ?crit?:
> From: Ludovic Barre <ludovic.barre@st.com>
> 
> -Change the license text with long template.
> -Change Copyright to STMicroelectronics.
> 
> Signed-off-by: Ludovic Barre <ludovic.barre@st.com>

Applied to the spi-nor/next branch of l2-mtd

Thanks!
> ---
>  drivers/mtd/spi-nor/stm32-quadspi.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
> index 70710be..b3c7f6a 100644
> --- a/drivers/mtd/spi-nor/stm32-quadspi.c
> +++ b/drivers/mtd/spi-nor/stm32-quadspi.c
> @@ -1,9 +1,22 @@
>  /*
> - * stm32_quadspi.c
> + * Driver for stm32 quadspi controller
>   *
> - * Copyright (C) 2017, Ludovic Barre
> + * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
> + * Author(s): Ludovic Barre author <ludovic.barre@st.com>.
>   *
> - * License terms: GNU General Public License (GPL), version 2
> + * License terms: GPL V2.0.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published by
> + * the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
> + * details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * This program. If not, see <http://www.gnu.org/licenses/>.
>   */
>  #include <linux/clk.h>
>  #include <linux/errno.h>
> 

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

* Re: [PATCH v2 2/3] mtd: spi-nor: stm32-quadspi: fix prefetching outside fsize
@ 2017-10-29 17:57     ` Cyrille Pitchen
  0 siblings, 0 replies; 23+ messages in thread
From: Cyrille Pitchen @ 2017-10-29 17:57 UTC (permalink / raw
  To: Ludovic Barre, Marek Vasut
  Cc: David Woodhouse, Brian Norris, Boris Brezillon,
	Richard Weinberger, Alexandre Torgue, Rob Herring, linux-mtd,
	linux-kernel, devicetree, linux-arm-kernel

Le 26/10/2017 à 17:12, Ludovic Barre a écrit :
> From: Ludovic Barre <ludovic.barre@st.com>
> 
> When memory-mapped mode is used, a prefetching mechanism fully
> managed by the hardware allows to optimize the read from external
> the QSPI memory. A 32-bytes FIFO is used for prefetching.
> When the limit of flash size - fifo size is reached the prefetching
> mechanism tries to read outside the fsize.
> The stm32 quadspi hardware become busy and should be aborted.
> 
> Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
> Reported-by: Bruno Herrera <bruherrera@gmail.com>
> Tested-by: Bruno Herrera <bruherrera@gmail.com>

Applied to the spi-nor/next branch of l2-mtd

Thanks!

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

* Re: [PATCH v2 2/3] mtd: spi-nor: stm32-quadspi: fix prefetching outside fsize
@ 2017-10-29 17:57     ` Cyrille Pitchen
  0 siblings, 0 replies; 23+ messages in thread
From: Cyrille Pitchen @ 2017-10-29 17:57 UTC (permalink / raw
  To: Ludovic Barre, Marek Vasut
  Cc: David Woodhouse, Brian Norris, Boris Brezillon,
	Richard Weinberger, Alexandre Torgue, Rob Herring,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Le 26/10/2017 à 17:12, Ludovic Barre a écrit :
> From: Ludovic Barre <ludovic.barre-qxv4g6HH51o@public.gmane.org>
> 
> When memory-mapped mode is used, a prefetching mechanism fully
> managed by the hardware allows to optimize the read from external
> the QSPI memory. A 32-bytes FIFO is used for prefetching.
> When the limit of flash size - fifo size is reached the prefetching
> mechanism tries to read outside the fsize.
> The stm32 quadspi hardware become busy and should be aborted.
> 
> Signed-off-by: Ludovic Barre <ludovic.barre-qxv4g6HH51o@public.gmane.org>
> Reported-by: Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Tested-by: Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Applied to the spi-nor/next branch of l2-mtd

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe devicetree" 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] 23+ messages in thread

* [PATCH v2 2/3] mtd: spi-nor: stm32-quadspi: fix prefetching outside fsize
@ 2017-10-29 17:57     ` Cyrille Pitchen
  0 siblings, 0 replies; 23+ messages in thread
From: Cyrille Pitchen @ 2017-10-29 17:57 UTC (permalink / raw
  To: linux-arm-kernel

Le 26/10/2017 ? 17:12, Ludovic Barre a ?crit?:
> From: Ludovic Barre <ludovic.barre@st.com>
> 
> When memory-mapped mode is used, a prefetching mechanism fully
> managed by the hardware allows to optimize the read from external
> the QSPI memory. A 32-bytes FIFO is used for prefetching.
> When the limit of flash size - fifo size is reached the prefetching
> mechanism tries to read outside the fsize.
> The stm32 quadspi hardware become busy and should be aborted.
> 
> Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
> Reported-by: Bruno Herrera <bruherrera@gmail.com>
> Tested-by: Bruno Herrera <bruherrera@gmail.com>

Applied to the spi-nor/next branch of l2-mtd

Thanks!

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

* Re: [PATCH v2 1/3] mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code
  2017-10-29 17:50     ` Cyrille Pitchen
  (?)
@ 2017-10-30  8:05       ` Ludovic BARRE
  -1 siblings, 0 replies; 23+ messages in thread
From: Ludovic BARRE @ 2017-10-30  8:05 UTC (permalink / raw
  To: Cyrille Pitchen, Marek Vasut
  Cc: David Woodhouse, Brian Norris, Boris Brezillon,
	Richard Weinberger, Alexandre Torgue, Rob Herring, linux-mtd,
	linux-kernel, devicetree, linux-arm-kernel, Geert Uytterhoeven

thanks Cyrille

indeed, the "Signed-off" on Geert'commit was a mistake

BR
Ludo
On 10/29/2017 06:50 PM, Cyrille Pitchen wrote:
> Hi Ludovic,
> 
> Le 26/10/2017 à 17:12, Ludovic Barre a écrit :
>> From: Geert Uytterhoeven <geert@linux-m68k.org>
>>
>> With gcc 4.1.2:
>>
>>      drivers/mtd/spi-nor/stm32-quadspi.c: In function ‘stm32_qspi_tx_poll’:
>>      drivers/mtd/spi-nor/stm32-quadspi.c:230: warning: ‘ret’ may be used uninitialized in this function
>>
>> Indeed, if stm32_qspi_cmd.len is zero, ret will be uninitialized.
>> This length is passed from outside the driver using the
>> spi_nor.{read,write}{,_reg}() callbacks.
>>
>> Several functions in drivers/mtd/spi-nor/spi-nor.c (e.g. write_enable(),
>> write_disable(), and erase_chip()) call spi_nor.write_reg() with a zero
>> length.
>>
>> Fix this by returning an explicit zero on success.
>>
>> Fixes: 0d43d7ab277a048c ("mtd: spi-nor: add driver for STM32 quad spi flash controller")
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>> Acked-by: Ludovic Barre <ludovic.barre@st.com>
>> Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
> I removed your "Signed-off" because I think this is a mistake but kept
> your "Acked-by" tag.
> 
> Applied to the spi-nor/next branch of l2-mtd.
> 
> Thanks!
> 
>> ---
>>   drivers/mtd/spi-nor/stm32-quadspi.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
>> index 86c0931..ad6a3e1 100644
>> --- a/drivers/mtd/spi-nor/stm32-quadspi.c
>> +++ b/drivers/mtd/spi-nor/stm32-quadspi.c
>> @@ -240,12 +240,12 @@ static int stm32_qspi_tx_poll(struct stm32_qspi *qspi,
>>   						 STM32_QSPI_FIFO_TIMEOUT_US);
>>   		if (ret) {
>>   			dev_err(qspi->dev, "fifo timeout (stat:%#x)\n", sr);
>> -			break;
>> +			return ret;
>>   		}
>>   		tx_fifo(buf++, qspi->io_base + QUADSPI_DR);
>>   	}
>>   
>> -	return ret;
>> +	return 0;
>>   }
>>   
>>   static int stm32_qspi_tx_mm(struct stm32_qspi *qspi,
>>
> 

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

* Re: [PATCH v2 1/3] mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code
@ 2017-10-30  8:05       ` Ludovic BARRE
  0 siblings, 0 replies; 23+ messages in thread
From: Ludovic BARRE @ 2017-10-30  8:05 UTC (permalink / raw
  To: Cyrille Pitchen, Marek Vasut
  Cc: David Woodhouse, Brian Norris, Boris Brezillon,
	Richard Weinberger, Alexandre Torgue, Rob Herring, linux-mtd,
	linux-kernel, devicetree, linux-arm-kernel, Geert Uytterhoeven

thanks Cyrille

indeed, the "Signed-off" on Geert'commit was a mistake

BR
Ludo
On 10/29/2017 06:50 PM, Cyrille Pitchen wrote:
> Hi Ludovic,
> 
> Le 26/10/2017 à 17:12, Ludovic Barre a écrit :
>> From: Geert Uytterhoeven <geert@linux-m68k.org>
>>
>> With gcc 4.1.2:
>>
>>      drivers/mtd/spi-nor/stm32-quadspi.c: In function ‘stm32_qspi_tx_poll’:
>>      drivers/mtd/spi-nor/stm32-quadspi.c:230: warning: ‘ret’ may be used uninitialized in this function
>>
>> Indeed, if stm32_qspi_cmd.len is zero, ret will be uninitialized.
>> This length is passed from outside the driver using the
>> spi_nor.{read,write}{,_reg}() callbacks.
>>
>> Several functions in drivers/mtd/spi-nor/spi-nor.c (e.g. write_enable(),
>> write_disable(), and erase_chip()) call spi_nor.write_reg() with a zero
>> length.
>>
>> Fix this by returning an explicit zero on success.
>>
>> Fixes: 0d43d7ab277a048c ("mtd: spi-nor: add driver for STM32 quad spi flash controller")
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>> Acked-by: Ludovic Barre <ludovic.barre@st.com>
>> Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
> I removed your "Signed-off" because I think this is a mistake but kept
> your "Acked-by" tag.
> 
> Applied to the spi-nor/next branch of l2-mtd.
> 
> Thanks!
> 
>> ---
>>   drivers/mtd/spi-nor/stm32-quadspi.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
>> index 86c0931..ad6a3e1 100644
>> --- a/drivers/mtd/spi-nor/stm32-quadspi.c
>> +++ b/drivers/mtd/spi-nor/stm32-quadspi.c
>> @@ -240,12 +240,12 @@ static int stm32_qspi_tx_poll(struct stm32_qspi *qspi,
>>   						 STM32_QSPI_FIFO_TIMEOUT_US);
>>   		if (ret) {
>>   			dev_err(qspi->dev, "fifo timeout (stat:%#x)\n", sr);
>> -			break;
>> +			return ret;
>>   		}
>>   		tx_fifo(buf++, qspi->io_base + QUADSPI_DR);
>>   	}
>>   
>> -	return ret;
>> +	return 0;
>>   }
>>   
>>   static int stm32_qspi_tx_mm(struct stm32_qspi *qspi,
>>
> 

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

* [PATCH v2 1/3] mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code
@ 2017-10-30  8:05       ` Ludovic BARRE
  0 siblings, 0 replies; 23+ messages in thread
From: Ludovic BARRE @ 2017-10-30  8:05 UTC (permalink / raw
  To: linux-arm-kernel

thanks Cyrille

indeed, the "Signed-off" on Geert'commit was a mistake

BR
Ludo
On 10/29/2017 06:50 PM, Cyrille Pitchen wrote:
> Hi Ludovic,
> 
> Le 26/10/2017 ? 17:12, Ludovic Barre a ?crit?:
>> From: Geert Uytterhoeven <geert@linux-m68k.org>
>>
>> With gcc 4.1.2:
>>
>>      drivers/mtd/spi-nor/stm32-quadspi.c: In function ?stm32_qspi_tx_poll?:
>>      drivers/mtd/spi-nor/stm32-quadspi.c:230: warning: ?ret? may be used uninitialized in this function
>>
>> Indeed, if stm32_qspi_cmd.len is zero, ret will be uninitialized.
>> This length is passed from outside the driver using the
>> spi_nor.{read,write}{,_reg}() callbacks.
>>
>> Several functions in drivers/mtd/spi-nor/spi-nor.c (e.g. write_enable(),
>> write_disable(), and erase_chip()) call spi_nor.write_reg() with a zero
>> length.
>>
>> Fix this by returning an explicit zero on success.
>>
>> Fixes: 0d43d7ab277a048c ("mtd: spi-nor: add driver for STM32 quad spi flash controller")
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>> Acked-by: Ludovic Barre <ludovic.barre@st.com>
>> Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
> I removed your "Signed-off" because I think this is a mistake but kept
> your "Acked-by" tag.
> 
> Applied to the spi-nor/next branch of l2-mtd.
> 
> Thanks!
> 
>> ---
>>   drivers/mtd/spi-nor/stm32-quadspi.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c
>> index 86c0931..ad6a3e1 100644
>> --- a/drivers/mtd/spi-nor/stm32-quadspi.c
>> +++ b/drivers/mtd/spi-nor/stm32-quadspi.c
>> @@ -240,12 +240,12 @@ static int stm32_qspi_tx_poll(struct stm32_qspi *qspi,
>>   						 STM32_QSPI_FIFO_TIMEOUT_US);
>>   		if (ret) {
>>   			dev_err(qspi->dev, "fifo timeout (stat:%#x)\n", sr);
>> -			break;
>> +			return ret;
>>   		}
>>   		tx_fifo(buf++, qspi->io_base + QUADSPI_DR);
>>   	}
>>   
>> -	return ret;
>> +	return 0;
>>   }
>>   
>>   static int stm32_qspi_tx_mm(struct stm32_qspi *qspi,
>>
> 

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

end of thread, other threads:[~2017-10-30  8:06 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-26 15:12 [PATCH v2 0/3] mtd: spi-nor: stm32-quadspi: fixes Ludovic Barre
2017-10-26 15:12 ` Ludovic Barre
2017-10-26 15:12 ` Ludovic Barre
2017-10-26 15:12 ` [PATCH v2 1/3] mtd: spi-nor: stm32-quadspi: Fix uninitialized error return code Ludovic Barre
2017-10-26 15:12   ` Ludovic Barre
2017-10-26 15:12   ` Ludovic Barre
2017-10-29 17:50   ` Cyrille Pitchen
2017-10-29 17:50     ` Cyrille Pitchen
2017-10-30  8:05     ` Ludovic BARRE
2017-10-30  8:05       ` Ludovic BARRE
2017-10-30  8:05       ` Ludovic BARRE
2017-10-26 15:12 ` [PATCH v2 2/3] mtd: spi-nor: stm32-quadspi: fix prefetching outside fsize Ludovic Barre
2017-10-26 15:12   ` Ludovic Barre
2017-10-26 15:12   ` Ludovic Barre
2017-10-29 17:57   ` Cyrille Pitchen
2017-10-29 17:57     ` Cyrille Pitchen
2017-10-29 17:57     ` Cyrille Pitchen
2017-10-26 15:12 ` [PATCH v2 3/3] mtd: spi-nor: stm32-quadspi: change license text Ludovic Barre
2017-10-26 15:12   ` Ludovic Barre
2017-10-26 15:12   ` Ludovic Barre
2017-10-29 17:51   ` Cyrille Pitchen
2017-10-29 17:51     ` Cyrille Pitchen
2017-10-29 17:51     ` Cyrille Pitchen

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.