* [PATCH V3 25/63 resend] Newly erased page read workaround
[not found] <cover.1292833228.git.viresh.kumar@st.com>
@ 2010-12-20 9:19 ` Viresh Kumar
2011-01-14 5:21 ` viresh kumar
[not found] ` <187ed7b3996c7f37ce782d847d3ecc761c3e52b8.1292833228.git.viresh.kumar@st.com>
1 sibling, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2010-12-20 9:19 UTC (permalink / raw)
To: linux-mtd, dwmw2
Cc: Viresh Kumar, rajeev-dlh.kumar, armando.visconti, Vipin Kumar,
shiraz.hashim, amit.virdi, vipulkumar.samar, deepak.sikri,
linux-arm-kernel
From: Vipin Kumar <vipin.kumar@st.com>
A newly erased page contains ff in data as well as spare area. While reading an
erased page, the read out ecc from spare area does not match the ecc generated
by fsmc ecc hardware accelarator. This is because ecc of data ff ff is not ff
ff. This leads to errors when jffs2 fs erases and reads back the pages to
ensure consistency.
This patch adds a software workaround to ensure that the ecc check is not
performed for erased pages. An erased page is checked by checking data as ff ff.
Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
drivers/mtd/nand/fsmc_nand.c | 28 ++++++++++++++++++++++------
1 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
index 02edfba..d3f0d8d 100644
--- a/drivers/mtd/nand/fsmc_nand.c
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -385,7 +385,7 @@ static int fsmc_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
struct fsmc_nand_data *host = container_of(mtd,
struct fsmc_nand_data, mtd);
struct fsmc_eccplace *ecc_place = host->ecc_place;
- int i, j, s, stat, eccsize = chip->ecc.size;
+ int i, j, k, s, stat, eccsize = chip->ecc.size;
int eccbytes = chip->ecc.bytes;
int eccsteps = chip->ecc.steps;
uint8_t *p = buf;
@@ -425,11 +425,27 @@ static int fsmc_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
memcpy(&ecc_code[i], oob, 13);
chip->ecc.calculate(mtd, p, &ecc_calc[i]);
- stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]);
- if (stat < 0)
- mtd->ecc_stats.failed++;
- else
- mtd->ecc_stats.corrected += stat;
+ /*
+ * This is a temporary erase check. A newly erased page read
+ * would result in an ecc error because the oob data is also
+ * erased to FF and the calculated ecc for an FF data is not
+ * FF..FF.
+ * This is a workaround to skip performing correction in case
+ * data is FF..FF
+ */
+ for (k = 0; k < eccsize; k++) {
+ if (*(p + k) != 0xff)
+ break;
+ }
+
+ if (k < eccsize) {
+ stat = chip->ecc.correct(mtd, p, &ecc_code[i],
+ &ecc_calc[i]);
+ if (stat < 0)
+ mtd->ecc_stats.failed++;
+ else
+ mtd->ecc_stats.corrected += stat;
+ }
}
return 0;
--
1.7.2.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH V3 36/63] ST SPEAr : FSMC (Flexible Static Memory Controller) NOR interface driver
[not found] ` <187ed7b3996c7f37ce782d847d3ecc761c3e52b8.1292833228.git.viresh.kumar@st.com>
@ 2010-12-26 15:38 ` Linus Walleij
2011-01-03 3:48 ` viresh kumar
0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2010-12-26 15:38 UTC (permalink / raw)
To: Viresh Kumar
Cc: rajeev-dlh.kumar, armando.visconti, Vipin Kumar, shiraz.hashim,
amit.virdi, vipulkumar.samar, linux-mtd, deepak.sikri,
linux-arm-kernel
2010/12/20 Viresh Kumar <viresh.kumar@st.com>:
> SPEAr1300 SoC supports FSMC to interface with various memories
> (NOR/NAND/SRAM). This patch adds the support for FSMC over NOR interface.
>
> The driver being used is driver/mtd/maps/physmap.c
OK..
(...)
> diff --git a/arch/arm/mach-spear13xx/fsmc-nor.c b/arch/arm/mach-spear13xx/fsmc-nor.c
> new file mode 100644
> index 0000000..03234b6
> --- /dev/null
> +++ b/arch/arm/mach-spear13xx/fsmc-nor.c
What is this file doing in mach-spear13xx? Several other platforms
like U300 and Nomadik use the same NOR controller.
This should be in drivers/mtd/* somewhere I believe?
> @@ -0,0 +1,85 @@
> +/*
> + * arch/arm/mach-spear13xx/fsmc-nor.c
> + *
> + * FSMC (Flexible Static Memory Controller) interface for NOR
> + *
> + * Copyright (C) 2010 ST Microelectronics
> + * Vipin Kumar<vipin.kumar@st.com>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/err.h>
> +#include <linux/init.h>
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <plat/fsmc.h>
Use <linux/mtd/fsmc.h> as include file, get rid of plat/fsmc.h.
Extend that .h file with the stuff you need.
We need to keep definitions for MTD NOR, NAND and OneNAND using FSMC
in this file so as to keep things simple. One header file is enough, and it's
very generic too, FSMC is not for plat-spear/* but also U300, Nomadik and
Ux500.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V3 36/63] ST SPEAr : FSMC (Flexible Static Memory Controller) NOR interface driver
2010-12-26 15:38 ` [PATCH V3 36/63] ST SPEAr : FSMC (Flexible Static Memory Controller) NOR interface driver Linus Walleij
@ 2011-01-03 3:48 ` viresh kumar
0 siblings, 0 replies; 4+ messages in thread
From: viresh kumar @ 2011-01-03 3:48 UTC (permalink / raw)
To: Linus Walleij
Cc: Rajeev KUMAR, Armando VISCONTI, Vipin KUMAR, Shiraz HASHIM,
Amit VIRDI, Vipul Kumar SAMAR, linux-mtd@lists.infradead.org,
Deepak SIKRI, linux-arm-kernel@lists.infradead.org
Linus,
On 12/26/2010 09:08 PM, Linus Walleij wrote:
> 2010/12/20 Viresh Kumar <viresh.kumar@st.com>:
>
(...)
>> diff --git a/arch/arm/mach-spear13xx/fsmc-nor.c b/arch/arm/mach-spear13xx/fsmc-nor.c
>> new file mode 100644
>> index 0000000..03234b6
>> --- /dev/null
>> +++ b/arch/arm/mach-spear13xx/fsmc-nor.c
>
> What is this file doing in mach-spear13xx? Several other platforms
> like U300 and Nomadik use the same NOR controller.
>
> This should be in drivers/mtd/* somewhere I believe?
>
>> @@ -0,0 +1,85 @@
>> +/*
>> + * arch/arm/mach-spear13xx/fsmc-nor.c
>> + *
>> + * FSMC (Flexible Static Memory Controller) interface for NOR
>> + *
>> + * Copyright (C) 2010 ST Microelectronics
>> + * Vipin Kumar<vipin.kumar@st.com>
>> + *
>> + * This file is licensed under the terms of the GNU General Public
>> + * License version 2. This program is licensed "as is" without any
>> + * warranty of any kind, whether express or implied.
>> + */
>> +
>> +#include <linux/clk.h>
>> +#include <linux/err.h>
>> +#include <linux/init.h>
>> +#include <linux/err.h>
>> +#include <linux/io.h>
>> +#include <plat/fsmc.h>
>
> Use <linux/mtd/fsmc.h> as include file, get rid of plat/fsmc.h.
> Extend that .h file with the stuff you need.
>
> We need to keep definitions for MTD NOR, NAND and OneNAND using FSMC
> in this file so as to keep things simple. One header file is enough, and it's
> very generic too, FSMC is not for plat-spear/* but also U300, Nomadik and
> Ux500.
>
Yes i agree. I will remove patches related to fsmc from this patch series and will
send them separately.
--
viresh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V3 25/63 resend] Newly erased page read workaround
2010-12-20 9:19 ` [PATCH V3 25/63 resend] Newly erased page read workaround Viresh Kumar
@ 2011-01-14 5:21 ` viresh kumar
0 siblings, 0 replies; 4+ messages in thread
From: viresh kumar @ 2011-01-14 5:21 UTC (permalink / raw)
To: linux-mtd@lists.infradead.org, dwmw2@infradead.org,
linus.walleij@stericsson.com
Cc: Rajeev KUMAR, Armando VISCONTI, Vipin KUMAR, Shiraz HASHIM,
Amit VIRDI, Vipul Kumar SAMAR, Deepak SIKRI,
linux-arm-kernel@lists.infradead.org
On 12/20/2010 02:49 PM, Viresh KUMAR wrote:
> From: Vipin Kumar <vipin.kumar@st.com>
>
> A newly erased page contains ff in data as well as spare area. While reading an
> erased page, the read out ecc from spare area does not match the ecc generated
> by fsmc ecc hardware accelarator. This is because ecc of data ff ff is not ff
> ff. This leads to errors when jffs2 fs erases and reads back the pages to
> ensure consistency.
>
> This patch adds a software workaround to ensure that the ecc check is not
> performed for erased pages. An erased page is checked by checking data as ff ff.
David,
Does this patch looks fine to you??
--
viresh
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-14 5:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1292833228.git.viresh.kumar@st.com>
2010-12-20 9:19 ` [PATCH V3 25/63 resend] Newly erased page read workaround Viresh Kumar
2011-01-14 5:21 ` viresh kumar
[not found] ` <187ed7b3996c7f37ce782d847d3ecc761c3e52b8.1292833228.git.viresh.kumar@st.com>
2010-12-26 15:38 ` [PATCH V3 36/63] ST SPEAr : FSMC (Flexible Static Memory Controller) NOR interface driver Linus Walleij
2011-01-03 3:48 ` viresh kumar
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).