* [PATCH] mtd: nand: support for Toshiba BENAND (Built-in ECC NAND)
@ 2015-06-10 7:08 KOBAYASHI Yoshitake
2015-06-10 7:50 ` Richard Weinberger
2015-06-10 8:14 ` Paul Bolle
0 siblings, 2 replies; 4+ messages in thread
From: KOBAYASHI Yoshitake @ 2015-06-10 7:08 UTC (permalink / raw)
To: dwmw2, computersforpeace, linux-mtd; +Cc: linux-kernel, KOBAYASHI Yoshitake
This patch enables support for Toshiba BENAND.
Toshiba BENAND is a SLC NAND solution that automatically generates ECC
inside NAND chip. Newer generation SLC NAND devices of today need multi-bit
hardware ECC by NAND controller in SoC. BENAND solution is ECC free,
has high performance and backward compatibility in NAND chip trend.
Signed-off-by: KOBAYASHI Yoshitake <yoshitake.kobayashi@toshiba.co.jp>
---
drivers/mtd/nand/Kconfig | 16 ++++++++++++++++
drivers/mtd/nand/Makefile | 1 +
drivers/mtd/nand/nand_base.c | 32 ++++++++++++++++++++++++++++++--
include/linux/mtd/nand.h | 3 +++
4 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 5897d8d..2f11d43 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -22,6 +22,22 @@ menuconfig MTD_NAND
if MTD_NAND
+config MTD_NAND_BENAND
+ tristate
+ depends on MTD_NAND_BENAND_ENABLE
+ default MTD_NAND
+
+config MTD_NAND_BENAND_ENABLE
+ bool "Support for Toshiba BENAND (Built-in ECC NAND)"
+ default y
+ help
+ Toshiba BENAND is a SLC NAND solution that automatically
+ generates ECC inside NAND chip.
+ Newer generation SLC NAND devices of today need multi-bit
+ hardware ECC by NAND controller in SoC.
+ BENAND solution is ECC free, has high performance and
+ backward compatibility in NAND chip trend.
+
config MTD_NAND_BCH
tristate
select BCH
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 582bbd05..afd26f0 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -3,6 +3,7 @@
#
obj-$(CONFIG_MTD_NAND) += nand.o
+obj-$(CONFIG_MTD_NAND_BENAND) += nand_benand.o
obj-$(CONFIG_MTD_NAND_ECC) += nand_ecc.o
obj-$(CONFIG_MTD_NAND_BCH) += nand_bch.o
obj-$(CONFIG_MTD_NAND_IDS) += nand_ids.o
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index c2e1232..98a8932 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -43,6 +43,7 @@
#include <linux/mtd/nand.h>
#include <linux/mtd/nand_ecc.h>
#include <linux/mtd/nand_bch.h>
+#include <linux/mtd/nand_benand.h>
#include <linux/interrupt.h>
#include <linux/bitops.h>
#include <linux/leds.h>
@@ -3526,8 +3527,17 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip,
if (id_len >= 6 && id_data[0] == NAND_MFR_TOSHIBA &&
nand_is_slc(chip) &&
(id_data[5] & 0x7) == 0x6 /* 24nm */ &&
- !(id_data[4] & 0x80) /* !BENAND */) {
- mtd->oobsize = 32 * mtd->writesize >> 9;
+ (id_data[4] & 0x80) /* BENAND */) {
+ pr_info("24nm BENAND\n");
+
+ if (IS_ENABLED(CONFIG_MTD_NAND_BENAND)) {
+ chip->ecc.mode = NAND_ECC_BENAND;
+ pr_info("Selected BENAND Driver\n");
+ }
+
+ } else {
+ pr_info("24nm SLC NAND\n");
+ mtd->oobsize = 32 * mtd->writesize >> 9; /* !BENAND */
}
}
@@ -4075,6 +4085,24 @@ int nand_scan_tail(struct mtd_info *mtd)
}
break;
+ case NAND_ECC_BENAND:
+ if (!mtd_nand_has_benand()) {
+ pr_warn("CONFIG_MTD_NAND_BENAND not enabled\n");
+ BUG();
+ }
+ ecc->calculate = NULL;
+ ecc->correct = NULL;
+ ecc->read_page = nand_read_page_benand;
+ ecc->read_subpage = nand_read_subpage_benand;
+ ecc->write_page = nand_write_page_raw;
+ ecc->read_page_raw = nand_read_page_raw;
+ ecc->write_page_raw = nand_write_page_raw;
+ ecc->read_oob = nand_read_oob_std;
+ ecc->write_oob = nand_write_oob_std;
+
+ nand_benand_init(mtd);
+ break;
+
case NAND_ECC_NONE:
pr_warn("NAND_ECC_NONE selected by board driver. This is not recommended!\n");
ecc->read_page = nand_read_page_raw;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 3d4ea7e..8f59ad9 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -101,6 +101,8 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
/* Status bits */
#define NAND_STATUS_FAIL 0x01
#define NAND_STATUS_FAIL_N1 0x02
+/* Recommended to rewrite for BENAND */
+#define NAND_STATUS_RECOM_REWRT 0x08
#define NAND_STATUS_TRUE_READY 0x20
#define NAND_STATUS_READY 0x40
#define NAND_STATUS_WP 0x80
@@ -115,6 +117,7 @@ typedef enum {
NAND_ECC_HW_SYNDROME,
NAND_ECC_HW_OOB_FIRST,
NAND_ECC_SOFT_BCH,
+ NAND_ECC_BENAND,
} nand_ecc_modes_t;
/*
--
1.7.2.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd: nand: support for Toshiba BENAND (Built-in ECC NAND)
2015-06-10 7:08 [PATCH] mtd: nand: support for Toshiba BENAND (Built-in ECC NAND) KOBAYASHI Yoshitake
@ 2015-06-10 7:50 ` Richard Weinberger
2015-06-11 14:41 ` KOBAYASHI Yoshitake
2015-06-10 8:14 ` Paul Bolle
1 sibling, 1 reply; 4+ messages in thread
From: Richard Weinberger @ 2015-06-10 7:50 UTC (permalink / raw)
To: KOBAYASHI Yoshitake
Cc: linux-mtd@lists.infradead.org, Brian Norris, David Woodhouse,
LKML
On Wed, Jun 10, 2015 at 9:08 AM, KOBAYASHI Yoshitake
<yoshitake.kobayashi@toshiba.co.jp> wrote:
> This patch enables support for Toshiba BENAND.
> Toshiba BENAND is a SLC NAND solution that automatically generates ECC
> inside NAND chip. Newer generation SLC NAND devices of today need multi-bit
> hardware ECC by NAND controller in SoC. BENAND solution is ECC free,
> has high performance and backward compatibility in NAND chip trend.
Do you have performance numbers?
How fast is it compared to a decent HW ECC engine?
Did you see my On-Die ECC series and Brian's comments on it?
https://lkml.org/lkml/2015/3/25/310
I suspect some of his comments will apply to you as well.
> Signed-off-by: KOBAYASHI Yoshitake <yoshitake.kobayashi@toshiba.co.jp>
> ---
> drivers/mtd/nand/Kconfig | 16 ++++++++++++++++
> drivers/mtd/nand/Makefile | 1 +
> drivers/mtd/nand/nand_base.c | 32 ++++++++++++++++++++++++++++++--
> include/linux/mtd/nand.h | 3 +++
> 4 files changed, 50 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
> index 5897d8d..2f11d43 100644
> --- a/drivers/mtd/nand/Kconfig
> +++ b/drivers/mtd/nand/Kconfig
> @@ -22,6 +22,22 @@ menuconfig MTD_NAND
>
> if MTD_NAND
>
> +config MTD_NAND_BENAND
> + tristate
> + depends on MTD_NAND_BENAND_ENABLE
> + default MTD_NAND
> +
> +config MTD_NAND_BENAND_ENABLE
> + bool "Support for Toshiba BENAND (Built-in ECC NAND)"
> + default y
> + help
> + Toshiba BENAND is a SLC NAND solution that automatically
> + generates ECC inside NAND chip.
> + Newer generation SLC NAND devices of today need multi-bit
> + hardware ECC by NAND controller in SoC.
> + BENAND solution is ECC free, has high performance and
> + backward compatibility in NAND chip trend.
> +
> config MTD_NAND_BCH
> tristate
> select BCH
> diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
> index 582bbd05..afd26f0 100644
> --- a/drivers/mtd/nand/Makefile
> +++ b/drivers/mtd/nand/Makefile
> @@ -3,6 +3,7 @@
> #
>
> obj-$(CONFIG_MTD_NAND) += nand.o
> +obj-$(CONFIG_MTD_NAND_BENAND) += nand_benand.o
nand_benand.c is not part of this patch.
Forgot a git add? :-)
--
Thanks,
//richard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd: nand: support for Toshiba BENAND (Built-in ECC NAND)
2015-06-10 7:08 [PATCH] mtd: nand: support for Toshiba BENAND (Built-in ECC NAND) KOBAYASHI Yoshitake
2015-06-10 7:50 ` Richard Weinberger
@ 2015-06-10 8:14 ` Paul Bolle
1 sibling, 0 replies; 4+ messages in thread
From: Paul Bolle @ 2015-06-10 8:14 UTC (permalink / raw)
To: KOBAYASHI Yoshitake; +Cc: linux-mtd, computersforpeace, dwmw2, linux-kernel
On Wed, 2015-06-10 at 16:08 +0900, KOBAYASHI Yoshitake wrote:
> drivers/mtd/nand/Kconfig | 16 ++++++++++++++++
> drivers/mtd/nand/Makefile | 1 +
> drivers/mtd/nand/nand_base.c | 32 ++++++++++++++++++++++++++++++--
> include/linux/mtd/nand.h | 3 +++
> 4 files changed, 50 insertions(+), 2 deletions(-)
This _doesn't_ add drivers/mtd/nand/nand_benand.c (or something
similar). And there's no file with that name in today's linux-next.
> --- a/drivers/mtd/nand/Makefile
> +++ b/drivers/mtd/nand/Makefile
> +obj-$(CONFIG_MTD_NAND_BENAND) += nand_benand.o
So there's another patch that adds drivers/mtd/nand/nand_benand.c?
Paul Bolle
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd: nand: support for Toshiba BENAND (Built-in ECC NAND)
2015-06-10 7:50 ` Richard Weinberger
@ 2015-06-11 14:41 ` KOBAYASHI Yoshitake
0 siblings, 0 replies; 4+ messages in thread
From: KOBAYASHI Yoshitake @ 2015-06-11 14:41 UTC (permalink / raw)
To: Richard Weinberger
Cc: linux-mtd@lists.infradead.org, Brian Norris, David Woodhouse,
LKML
On 2015/06/10 16:50, Richard Weinberger wrote:
> On Wed, Jun 10, 2015 at 9:08 AM, KOBAYASHI Yoshitake
> <yoshitake.kobayashi@toshiba.co.jp> wrote:
>> This patch enables support for Toshiba BENAND.
>> Toshiba BENAND is a SLC NAND solution that automatically generates ECC
>> inside NAND chip. Newer generation SLC NAND devices of today need multi-bit
>> hardware ECC by NAND controller in SoC. BENAND solution is ECC free,
>> has high performance and backward compatibility in NAND chip trend.
>
> Do you have performance numbers?
> How fast is it compared to a decent HW ECC engine?
Comparing with 24nm SLC NAND, BENAND is few percent faster in write and
more than 5 percent faster in read. But the result depends on usecase
and compared device. I will delete the last sentence.
> Did you see my On-Die ECC series and Brian's comments on it?
> https://lkml.org/lkml/2015/3/25/310
> I suspect some of his comments will apply to you as well.
Thanks for the suggestion.
I would like to post the current driver first to make it open, then
consider how to apply his comments. Because I made a big mistake.
-- <snip> --
>> +obj-$(CONFIG_MTD_NAND_BENAND) += nand_benand.o
>
> nand_benand.c is not part of this patch.
> Forgot a git add? :-)
Oh!.. I will repost it.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-11 14:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-10 7:08 [PATCH] mtd: nand: support for Toshiba BENAND (Built-in ECC NAND) KOBAYASHI Yoshitake
2015-06-10 7:50 ` Richard Weinberger
2015-06-11 14:41 ` KOBAYASHI Yoshitake
2015-06-10 8:14 ` Paul Bolle
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).