From: Geert Uytterhoeven <geert@linux-m68k.org>
To: David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>
Cc: Marek Vasut <marex@denx.de>, Sourav Poddar <sourav.poddar@ti.com>,
linux-mtd@lists.infradead.org,
Geert Uytterhoeven <geert+renesas@linux-m68k.org>,
linux-spi@vger.kernel.org
Subject: [PATCH 2/4] mtd: m25p80: Set rx_nbits for Quad SPI transfers
Date: Tue, 21 Jan 2014 13:59:17 +0100 [thread overview]
Message-ID: <1390309159-19643-3-git-send-email-geert@linux-m68k.org> (raw)
In-Reply-To: <1390309159-19643-1-git-send-email-geert@linux-m68k.org>
From: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
When using the Quad Read opcode, SPI masters still use Single SPI
transfers, as spi_transfer.rx_nbits defaults to SPI_NBITS_SINGLE.
Use SPI_NBITS_QUAD to fix this.
While an earlier version of commit 3487a63955c34ea508bcf4ca5131ddd953876e2d
("drivers: mtd: m25p80: add quad read support") did this correctly, it was
forgotten in the version that got merged.
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
---
drivers/mtd/devices/m25p80.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 320c6a308630..ad1913909702 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -489,6 +489,16 @@ static inline int m25p80_dummy_cycles_read(struct m25p *flash)
}
}
+static inline unsigned int m25p80_rx_nbits(const struct m25p *flash)
+{
+ switch (flash->flash_read) {
+ case M25P80_QUAD:
+ return 4;
+ default:
+ return 0;
+ }
+}
+
/*
* Read an address range from the flash chip. The address range
* may be any size provided it is within the physical boundaries.
@@ -519,6 +529,7 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
spi_message_add_tail(&t[0], &m);
t[1].rx_buf = buf;
+ t[1].rx_nbits = m25p80_rx_nbits(flash);
t[1].len = len;
spi_message_add_tail(&t[1], &m);
--
1.7.9.5
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2014-01-21 12:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-21 12:59 [PATCH 0/4] m25p80 Quad/Dual updates Geert Uytterhoeven
2014-01-21 12:59 ` [PATCH 1/4] mtd: m25p80: Enable Quad SPI read transfers for s25fl512s Geert Uytterhoeven
[not found] ` <1390309159-19643-2-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2014-01-21 15:13 ` Marek Vasut
2014-01-21 12:59 ` Geert Uytterhoeven [this message]
[not found] ` <1390309159-19643-3-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2014-01-21 15:18 ` [PATCH 2/4] mtd: m25p80: Set rx_nbits for Quad SPI transfers Marek Vasut
2014-01-21 12:59 ` [PATCH 3/4] mtd: m25p80: Add dual read support Geert Uytterhoeven
[not found] ` <1390309159-19643-4-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2014-01-21 15:42 ` Marek Vasut
2014-01-21 12:59 ` [PATCH 4/4] mtd: m25p80: Enable Dual SPI read transfers for s25fl256s1 and s25fl512s Geert Uytterhoeven
[not found] ` <1390309159-19643-5-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2014-01-21 15:42 ` Marek Vasut
[not found] ` <201401211642.55461.marex-ynQEQJNshbs@public.gmane.org>
2014-01-21 15:58 ` Geert Uytterhoeven
[not found] ` <CAMuHMdVMDO9nKQPgNwz47H2mK6kKreNYiyn-AFOB2KryRpSgoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-01-21 16:10 ` Marek Vasut
[not found] ` <1390309159-19643-1-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2014-01-23 2:01 ` [PATCH 0/4] m25p80 Quad/Dual updates Huang Shijie
[not found] ` <20140123020153.GA6229-Fb7DQEYuewWctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2014-01-25 9:06 ` Brian Norris
2014-01-28 5:26 ` Brian Norris
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=1390309159-19643-3-git-send-email-geert@linux-m68k.org \
--to=geert@linux-m68k.org \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=geert+renesas@linux-m68k.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=marex@denx.de \
--cc=sourav.poddar@ti.com \
/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).