From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miquel Raynal Date: Fri, 7 Dec 2018 11:06:24 +0100 Subject: [U-Boot] [PATCH v1] mtd: nand: raw: allow to disable unneeded ECC layouts In-Reply-To: <20181206135709.8518-1-stefan@agner.ch> References: <20181206135709.8518-1-stefan@agner.ch> Message-ID: <20181207110624.450f3b50@xps13> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de Hi Stefan, Stefan Agner wrote on Thu, 6 Dec 2018 14:57:09 +0100: > From: Stefan Agner >=20 > 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. >=20 > Signed-off-by: Stefan Agner > --- >=20 > drivers/mtd/nand/raw/Kconfig | 7 +++++++ > drivers/mtd/nand/raw/nand_base.c | 4 ++++ > 2 files changed, 11 insertions(+) >=20 > diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig > index 008f7b4b4b..b06c45788a 100644 > --- a/drivers/mtd/nand/raw/Kconfig > +++ b/drivers/mtd/nand/raw/Kconfig > @@ -9,6 +9,12 @@ config SYS_NAND_SELF_INIT > This option, if enabled, provides more flexible and linux-like > NAND initialization process. > =20 > +config SYS_NAND_DRIVER_ECC_LAYOUT > + bool > + help > + Omit standard ECC layouts to safe space. Select this if your driver s/safe/save/ > + is known to provide its own ECC layout. layout*s*? > + > config NAND_ATMEL > bool "Support Atmel NAND controller" > imply SYS_NAND_USE_FLASH_BBT > @@ -81,6 +87,7 @@ config NAND_OMAP_ELM > config NAND_VF610_NFC > bool "Support for Freescale NFC for VF610" > select SYS_NAND_SELF_INIT > + select SYS_NAND_DRIVER_ECC_LAYOUT > imply CMD_NAND > help > Enables support for NAND Flash Controller on some Freescale > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand= _base.c > index 92daebe120..6d2ff58d86 100644 > --- a/drivers/mtd/nand/raw/nand_base.c > +++ b/drivers/mtd/nand/raw/nand_base.c > @@ -47,6 +47,7 @@ > #include > =20 > /* 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 =3D { > .eccbytes =3D 3, > .eccpos =3D {0, 1, 2}, > @@ -89,6 +90,7 @@ static struct nand_ecclayout nand_oob_128 =3D { > {.offset =3D 2, > .length =3D 78} } > }; > +#endif > =20 > static int nand_get_device(struct mtd_info *mtd, int new_state); > =20 > @@ -4339,6 +4341,7 @@ int nand_scan_tail(struct mtd_info *mtd) > */ > if (!ecc->layout && (ecc->mode !=3D NAND_ECC_SOFT_BCH)) { > switch (mtd->oobsize) { > +#ifdef CONFIG_SYS_NAND_DRIVER_ECC_LAYOUT > case 8: > ecc->layout =3D &nand_oob_8; > break; > @@ -4351,6 +4354,7 @@ int nand_scan_tail(struct mtd_info *mtd) > case 128: > ecc->layout =3D &nand_oob_128; > break; > +#endif > default: > pr_warn("No oob scheme defined for oobsize %d\n", > mtd->oobsize); I don't like very much the #ifdef approach to compile-out zones in the code. I don't have an alternative for now (maybe have the layouts in a different file?). I would also like to hear Boris' point of view. Thanks, Miqu=C3=A8l