All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH, 1/2] mtd: m25p80: Let m25p80_read() fallback to spi transfer
@ 2017-01-20 21:50 Kamal Dasu
  2017-01-20 21:50 ` [PATCH, 2/2] spi: bcm-qspi: Fix return code from bcm_qspi_flash_read() Kamal Dasu
  2017-01-20 22:38 ` [PATCH, 1/2] mtd: m25p80: Let m25p80_read() fallback to spi transfer Marek Vasut
  0 siblings, 2 replies; 17+ messages in thread
From: Kamal Dasu @ 2017-01-20 21:50 UTC (permalink / raw)
  To: cyrille.pitchen, marex, broonie
  Cc: linux-mtd, f.fainelli, bcm-kernel-feedback-list, Kamal Dasu

In m25p80_read() even though spi_flash_read() is supported
by some drivers, under certain circumstances like unaligned
buffer, address or address range limitations on certain SoCs
let it fallback to core spi reads. Such drivers are expected
to return -EINVAL so that the m25p80_read() uses standard
spi transfer.

Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
---
 drivers/mtd/devices/m25p80.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 9cf7fcd..7b7f2cc 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -155,9 +155,16 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
 		msg.data_nbits = m25p80_rx_nbits(nor);
 
 		ret = spi_flash_read(spi, &msg);
-		if (ret < 0)
+
+		if (ret >= 0)
+			return msg.retlen;
+
+		/*
+		 * some spi master drivers might need to fallback to
+		 * normal spi transfer
+		 */
+		if (ret != -EINVAL)
 			return ret;
-		return msg.retlen;
 	}
 
 	spi_message_init(&m);
-- 
1.9.1

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

end of thread, other threads:[~2017-01-30 17:11 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-20 21:50 [PATCH, 1/2] mtd: m25p80: Let m25p80_read() fallback to spi transfer Kamal Dasu
2017-01-20 21:50 ` [PATCH, 2/2] spi: bcm-qspi: Fix return code from bcm_qspi_flash_read() Kamal Dasu
2017-01-20 22:40   ` Marek Vasut
2017-01-20 22:38 ` [PATCH, 1/2] mtd: m25p80: Let m25p80_read() fallback to spi transfer Marek Vasut
2017-01-20 23:53   ` Michal Suchanek
2017-01-21  0:15     ` Marek Vasut
2017-01-23 23:41       ` Kamal Dasu
2017-01-25  2:08         ` Marek Vasut
2017-01-25  6:29           ` Michal Suchanek
2017-01-25 10:20             ` Marek Vasut
2017-01-25 11:10             ` Cyrille Pitchen
2017-01-25 16:28           ` Kamal Dasu
2017-01-25 16:39             ` Marek Vasut
2017-01-25 17:10               ` Kamal Dasu
2017-01-25 20:17                 ` Marek Vasut
2017-01-29 11:16             ` R, Vignesh
2017-01-30 17:11               ` Kamal Dasu

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.