mtd: rawnand: add an option to specify NAND chip as a boot device

Allow to define a NAND chip as a boot device. This can be helpful
for the selection of the ECC algorithm and strength in case the boot
ROM supports only a subset of controller provided options.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
Stefan Agner 2018-06-24 23:27:23 +02:00 committed by Miquel Raynal
parent f308d7353d
commit f922bd798b
3 changed files with 13 additions and 0 deletions

View File

@ -43,6 +43,10 @@ Optional NAND chip properties:
This is particularly useful when only the in-band area is This is particularly useful when only the in-band area is
used by the upper layers, and you want to make your NAND used by the upper layers, and you want to make your NAND
as reliable as possible. as reliable as possible.
- nand-is-boot-medium: Whether the NAND chip is a boot medium. Drivers might use
this information to select ECC algorithms supported by
the boot ROM or similar restrictions.
- nand-rb: shall contain the native Ready/Busy ids. - nand-rb: shall contain the native Ready/Busy ids.
The ECC strength and ECC step size properties define the correction capability The ECC strength and ECC step size properties define the correction capability

View File

@ -5859,6 +5859,9 @@ static int nand_dt_init(struct nand_chip *chip)
if (of_get_nand_bus_width(dn) == 16) if (of_get_nand_bus_width(dn) == 16)
chip->options |= NAND_BUSWIDTH_16; chip->options |= NAND_BUSWIDTH_16;
if (of_property_read_bool(dn, "nand-is-boot-medium"))
chip->options |= NAND_IS_BOOT_MEDIUM;
if (of_get_nand_on_flash_bbt(dn)) if (of_get_nand_on_flash_bbt(dn))
chip->bbt_options |= NAND_BBT_USE_FLASH; chip->bbt_options |= NAND_BBT_USE_FLASH;

View File

@ -219,6 +219,12 @@ enum nand_ecc_algo {
*/ */
#define NAND_WAIT_TCCS 0x00200000 #define NAND_WAIT_TCCS 0x00200000
/*
* Whether the NAND chip is a boot medium. Drivers might use this information
* to select ECC algorithms supported by the boot ROM or similar restrictions.
*/
#define NAND_IS_BOOT_MEDIUM 0x00400000
/* Options set by nand scan */ /* Options set by nand scan */
/* Nand scan has allocated controller struct */ /* Nand scan has allocated controller struct */
#define NAND_CONTROLLER_ALLOC 0x80000000 #define NAND_CONTROLLER_ALLOC 0x80000000