From: Brian Norris <computersforpeace@gmail.com>
To: <linux-mtd@lists.infradead.org>
Cc: Marek Vasut <marex@denx.de>, Huang Shijie <b32955@freescale.com>,
Brian Norris <computersforpeace@gmail.com>,
zajec5@gmail.com
Subject: [RFC 8/8] debug: mtd: spi-nor: add BUG_ON() prints to check for !ready
Date: Wed, 6 Aug 2014 18:17:02 -0700 [thread overview]
Message-ID: <1407374222-8448-9-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1407374222-8448-1-git-send-email-computersforpeace@gmail.com>
I hacked around the wait-till-ready sequencing just now, so let's add
some debug checks for now.
These probably shouldn't be included in mainline (or at least they
should be toned down to something less drastic; WARN_ON() perhaps?). I'm
just using these for test purposes.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
This patch is really just for testing. I don't think we really need it,
although I suppose some form of it couldn't hurt...
drivers/mtd/spi-nor/spi-nor.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index d08d9f8bb9bd..c2e53e02fe27 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -226,6 +226,8 @@ static int erase_chip(struct spi_nor *nor)
{
dev_dbg(nor->dev, " %lldKiB\n", (long long)(nor->mtd->size >> 10));
+ BUG_ON(spi_nor_ready(nor) <= 0);
+
return nor->write_reg(nor, SPINOR_OP_CHIP_ERASE, NULL, 0, 0);
}
@@ -278,6 +280,8 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
if (ret)
return ret;
+ BUG_ON(spi_nor_ready(nor) <= 0);
+
write_enable(nor);
/* whole-chip erase? */
@@ -339,6 +343,8 @@ static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
if (ret)
return ret;
+ BUG_ON(spi_nor_ready(nor) <= 0);
+
status_old = read_sr(nor);
if (offset < mtd->size - (mtd->size / 2))
@@ -381,6 +387,8 @@ static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
if (ret)
return ret;
+ BUG_ON(spi_nor_ready(nor) <= 0);
+
status_old = read_sr(nor);
if (offset+len > mtd->size - (mtd->size / 64))
@@ -678,6 +686,8 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
if (ret)
return ret;
+ BUG_ON(spi_nor_ready(nor) <= 0);
+
ret = nor->read(nor, from, len, retlen, buf);
spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ);
@@ -697,6 +707,8 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
if (ret)
return ret;
+ BUG_ON(spi_nor_ready(nor) <= 0);
+
write_enable(nor);
nor->sst_write_second = false;
@@ -768,6 +780,8 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
if (ret)
return ret;
+ BUG_ON(spi_nor_ready(nor) <= 0);
+
write_enable(nor);
page_offset = to & (nor->page_size - 1);
--
1.9.1
next prev parent reply other threads:[~2014-08-07 1:21 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-07 1:16 [PATCH 0/8] mtd: spi-nor: refactor wait-till-ready Brian Norris
2014-08-07 1:16 ` [PATCH 1/8] mtd: spi-nor: eliminate duplicate spi_nor_wait_till_{, fsr}_ready() code Brian Norris
2014-08-07 14:23 ` Marek Vasut
2014-08-09 6:25 ` Huang Shijie
2014-08-11 17:59 ` Brian Norris
2014-09-10 7:26 ` [PATCH v2 1/10] " Brian Norris
2014-08-07 1:16 ` [PATCH 2/8] mtd: spi-nor: handle timeout errors in spi_nor_write() Brian Norris
2014-08-07 14:23 ` Marek Vasut
2014-08-09 7:37 ` Huang Shijie
2014-08-07 1:16 ` [PATCH 3/8] mtd: spi-nor: move "wait-till-ready" checks into erase/write functions Brian Norris
2014-08-07 14:24 ` Marek Vasut
2014-08-09 8:42 ` Huang Shijie
2014-08-11 18:23 ` Brian Norris
2014-08-12 1:37 ` Huang Shijie
2014-08-07 1:16 ` [PATCH 4/8] mtd: m25p80: drop wait-till-ready checks Brian Norris
2014-08-07 14:24 ` Marek Vasut
2014-08-07 1:16 ` [PATCH 5/8] mtd: fsl-quadspi: " Brian Norris
2014-08-07 14:24 ` Marek Vasut
2014-08-07 1:17 ` [PATCH 6/8] mtd: spi-nor: drop replaceable wait-till-ready function pointer Brian Norris
2014-08-07 14:25 ` Marek Vasut
2014-08-09 9:53 ` Huang Shijie
2014-08-11 18:43 ` Brian Norris
2014-08-12 1:16 ` Huang Shijie
2014-09-10 7:02 ` Brian Norris
2014-08-12 5:13 ` Rafał Miłecki
2014-08-12 5:14 ` Rafał Miłecki
2014-08-07 1:17 ` [PATCH 7/8] mtd: spi-nor: factor out write_enable() for erase commands Brian Norris
2014-08-07 14:25 ` Marek Vasut
2014-08-09 10:52 ` Huang Shijie
2014-08-11 18:48 ` Brian Norris
2014-08-12 0:59 ` Huang Shijie
2014-09-10 7:05 ` Brian Norris
2014-09-10 15:20 ` Huang Shijie
2014-09-10 7:47 ` Brian Norris
2014-09-10 16:12 ` Huang Shijie
2014-09-10 23:25 ` Brian Norris
2014-11-05 10:29 ` [PATCH v2] " Brian Norris
2014-11-06 3:39 ` Huang Shijie
2014-12-01 8:19 ` Brian Norris
2014-08-07 1:17 ` Brian Norris [this message]
2014-08-07 14:26 ` [RFC 8/8] debug: mtd: spi-nor: add BUG_ON() prints to check for !ready Marek Vasut
2014-11-05 10:10 ` [PATCH 0/8] mtd: spi-nor: refactor wait-till-ready 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=1407374222-8448-9-git-send-email-computersforpeace@gmail.com \
--to=computersforpeace@gmail.com \
--cc=b32955@freescale.com \
--cc=linux-mtd@lists.infradead.org \
--cc=marex@denx.de \
--cc=zajec5@gmail.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).