提交 a38c3af8 编写于 作者: S Stefan Agner 提交者: Tom Rini

mtd: nand: raw: allow to disable unneeded ECC layouts

Each ECC layout consumes about 2984 bytes in the .data section. Allow
to disable the default ECC layouts if a driver is known to provide its
own ECC layout.
Signed-off-by: NStefan Agner <stefan.agner@toradex.com>
Reviewed-by: NLukasz Majewski <lukma@denx.de>
Reviewed-by: NMiquel Raynal <miquel.raynal@bootlin.com>
上级 aac0c29d
...@@ -9,6 +9,12 @@ config SYS_NAND_SELF_INIT ...@@ -9,6 +9,12 @@ config SYS_NAND_SELF_INIT
This option, if enabled, provides more flexible and linux-like This option, if enabled, provides more flexible and linux-like
NAND initialization process. NAND initialization process.
config SYS_NAND_DRIVER_ECC_LAYOUT
bool
help
Omit standard ECC layouts to safe space. Select this if your driver
is known to provide its own ECC layout.
config NAND_ATMEL config NAND_ATMEL
bool "Support Atmel NAND controller" bool "Support Atmel NAND controller"
imply SYS_NAND_USE_FLASH_BBT imply SYS_NAND_USE_FLASH_BBT
...@@ -81,6 +87,7 @@ config NAND_OMAP_ELM ...@@ -81,6 +87,7 @@ config NAND_OMAP_ELM
config NAND_VF610_NFC config NAND_VF610_NFC
bool "Support for Freescale NFC for VF610" bool "Support for Freescale NFC for VF610"
select SYS_NAND_SELF_INIT select SYS_NAND_SELF_INIT
select SYS_NAND_DRIVER_ECC_LAYOUT
imply CMD_NAND imply CMD_NAND
help help
Enables support for NAND Flash Controller on some Freescale Enables support for NAND Flash Controller on some Freescale
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <linux/errno.h> #include <linux/errno.h>
/* Define default oob placement schemes for large and small page devices */ /* Define default oob placement schemes for large and small page devices */
#ifdef CONFIG_SYS_NAND_DRIVER_ECC_LAYOUT
static struct nand_ecclayout nand_oob_8 = { static struct nand_ecclayout nand_oob_8 = {
.eccbytes = 3, .eccbytes = 3,
.eccpos = {0, 1, 2}, .eccpos = {0, 1, 2},
...@@ -89,6 +90,7 @@ static struct nand_ecclayout nand_oob_128 = { ...@@ -89,6 +90,7 @@ static struct nand_ecclayout nand_oob_128 = {
{.offset = 2, {.offset = 2,
.length = 78} } .length = 78} }
}; };
#endif
static int nand_get_device(struct mtd_info *mtd, int new_state); static int nand_get_device(struct mtd_info *mtd, int new_state);
...@@ -4339,6 +4341,7 @@ int nand_scan_tail(struct mtd_info *mtd) ...@@ -4339,6 +4341,7 @@ int nand_scan_tail(struct mtd_info *mtd)
*/ */
if (!ecc->layout && (ecc->mode != NAND_ECC_SOFT_BCH)) { if (!ecc->layout && (ecc->mode != NAND_ECC_SOFT_BCH)) {
switch (mtd->oobsize) { switch (mtd->oobsize) {
#ifdef CONFIG_SYS_NAND_DRIVER_ECC_LAYOUT
case 8: case 8:
ecc->layout = &nand_oob_8; ecc->layout = &nand_oob_8;
break; break;
...@@ -4351,6 +4354,7 @@ int nand_scan_tail(struct mtd_info *mtd) ...@@ -4351,6 +4354,7 @@ int nand_scan_tail(struct mtd_info *mtd)
case 128: case 128:
ecc->layout = &nand_oob_128; ecc->layout = &nand_oob_128;
break; break;
#endif
default: default:
pr_warn("No oob scheme defined for oobsize %d\n", pr_warn("No oob scheme defined for oobsize %d\n",
mtd->oobsize); mtd->oobsize);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册