linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kamal Dasu <kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
	vikram.prakash-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
	andy.fung-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
	jon.mason-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
	Kamal Dasu <kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH, V4, 5/5] mtd: m25p80: Let m25p80_read() fallback to spi transfer
Date: Fri, 17 Jun 2016 17:03:53 -0400	[thread overview]
Message-ID: <1466197433-11290-5-git-send-email-kdasu.kdev@gmail.com> (raw)
In-Reply-To: <1466197433-11290-1-git-send-email-kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

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 -EAGAIN so that the m25p80_read() uses standard
spi transfer.

Signed-off-by: Kamal Dasu <kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/mtd/devices/m25p80.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 9d68544..3f90542 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -149,8 +149,11 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
 		msg.data_nbits = m25p80_rx_nbits(nor);
 
 		ret = spi_flash_read(spi, &msg);
-		*retlen = msg.retlen;
-		return ret;
+		/* some drivers might need to fallback to spi transfer */
+		if (ret != -EAGAIN) {
+			*retlen = msg.retlen;
+			return ret;
+		}
 	}
 
 	spi_message_init(&m);
-- 
1.9.1

--
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

  parent reply	other threads:[~2016-06-17 21:03 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-17 21:03 [PATCH, V4, 1/5] Documentation: dt: spi-bcm-qspi: NSP, NS2, BRCMSTB SoC bindings Kamal Dasu
     [not found] ` <1466197433-11290-1-git-send-email-kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-17 21:03   ` [PATCH, V4, 2/5] spi: bcm-qspi: Add SPI flash and MSPI driver Kamal Dasu
     [not found]     ` <1466197433-11290-2-git-send-email-kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-22 16:07       ` Mark Brown
     [not found]         ` <20160622160726.GQ28202-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-06-22 17:13           ` Florian Fainelli
     [not found]             ` <576AC71C.9090202-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-23  9:27               ` Mark Brown
2016-07-01 15:39           ` Kamal Dasu
     [not found]             ` <CAKekbevYN3CLvqQs3stUXDFEMREMOJ0g4+w7Zsno1kV-ieYEiw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-01 16:07               ` Mark Brown
     [not found]                 ` <20160701160753.GX6247-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-12 22:06                   ` Kamal Dasu
     [not found]                     ` <CAC=U0a3WN9TGw7zwwP3qFf5MUsRteUcVLytFgjnP4zScZS0xXA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-13 11:10                       ` Mark Brown
     [not found]                         ` <20160713111053.GG9976-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-13 21:34                           ` Florian Fainelli
     [not found]                             ` <5786B401.2050306-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-07-13 22:36                               ` Mark Brown
     [not found]                                 ` <20160713223638.GI9976-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-19 22:15                                   ` Florian Fainelli
     [not found]                                     ` <578EA695.1030909-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-07-20 11:25                                       ` Mark Brown
     [not found]                                         ` <20160720112547.GE6509-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-20 19:41                                           ` Florian Fainelli
     [not found]                                             ` <578FD3D7.9030402-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-07-28 18:28                                               ` Mark Brown
     [not found]                                                 ` <20160728182803.GI11806-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-29  0:34                                                   ` Florian Fainelli
     [not found]                                                     ` <e3a069ad-ca2b-7c12-bde1-5566f5fe24d3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-07-29 11:44                                                       ` Mark Brown
2016-07-21 22:06                                           ` Florian Fainelli
     [not found]                                             ` <583d6ec8-b367-b53a-7d9e-1d7ee06004c0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-07-21 22:47                                               ` Mark Brown
2016-07-28 18:34                                               ` Mark Brown
2016-06-17 21:03   ` [PATCH, V4, 3/5] arm: dts: Add bcm-nsp and bcm958625k support Kamal Dasu
2016-06-17 21:03   ` [PATCH, V4, 4/5] arm64: dts: Add ns2 SoC support Kamal Dasu
2016-06-17 21:03   ` Kamal Dasu [this message]
     [not found]     ` <1466197433-11290-5-git-send-email-kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-22 16:08       ` [PATCH, V4, 5/5] mtd: m25p80: Let m25p80_read() fallback to spi transfer Mark Brown
2016-06-22 14:51   ` [PATCH, V4, 1/5] Documentation: dt: spi-bcm-qspi: NSP, NS2, BRCMSTB SoC bindings Mark Brown
     [not found]     ` <20160622145141.GN28202-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-06-22 17:10       ` Florian Fainelli
     [not found]         ` <576AC69F.6080507-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-23  9:26           ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1466197433-11290-5-git-send-email-kdasu.kdev@gmail.com \
    --to=kdasu.kdev-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=andy.fung-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=jon.mason-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=vikram.prakash-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).