Message ID | 20180531221637.6017-3-stefan@agner.ch |
---|---|
State | Superseded |
Headers | show |
Series | mtd: rawnand: add NVIDIA Tegra NAND flash support | expand |
On Fri, 1 Jun 2018 00:16:33 +0200 Stefan Agner <stefan@agner.ch> wrote: > 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> > --- > Documentation/devicetree/bindings/mtd/nand.txt | 4 ++++ > drivers/mtd/nand/raw/nand_base.c | 3 +++ > include/linux/mtd/rawnand.h | 6 ++++++ > 3 files changed, 13 insertions(+) > > diff --git a/Documentation/devicetree/bindings/mtd/nand.txt b/Documentation/devicetree/bindings/mtd/nand.txt > index 8bb11d809429..8daf81b9748c 100644 > --- a/Documentation/devicetree/bindings/mtd/nand.txt > +++ b/Documentation/devicetree/bindings/mtd/nand.txt > @@ -43,6 +43,10 @@ Optional NAND chip properties: > This is particularly useful when only the in-band area is > used by the upper layers, and you want to make your NAND > 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. > > The ECC strength and ECC step size properties define the correction capability > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c > index 9eb5678dd6d0..c8fb7c9855e2 100644 > --- a/drivers/mtd/nand/raw/nand_base.c > +++ b/drivers/mtd/nand/raw/nand_base.c > @@ -5826,6 +5826,9 @@ static int nand_dt_init(struct nand_chip *chip) > if (of_get_nand_bus_width(dn) == 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)) > chip->bbt_options |= NAND_BBT_USE_FLASH; > > diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h > index 6a82da8c44ce..8e54fcf2fa94 100644 > --- a/include/linux/mtd/rawnand.h > +++ b/include/linux/mtd/rawnand.h > @@ -212,6 +212,12 @@ enum nand_ecc_algo { > */ > #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 */ > /* Nand scan has allocated controller struct */ > #define NAND_CONTROLLER_ALLOC 0x80000000 -- To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Jun 01, 2018 at 12:16:33AM +0200, Stefan Agner wrote: > 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> > --- > Documentation/devicetree/bindings/mtd/nand.txt | 4 ++++ > drivers/mtd/nand/raw/nand_base.c | 3 +++ > include/linux/mtd/rawnand.h | 6 ++++++ > 3 files changed, 13 insertions(+) > > diff --git a/Documentation/devicetree/bindings/mtd/nand.txt b/Documentation/devicetree/bindings/mtd/nand.txt > index 8bb11d809429..8daf81b9748c 100644 > --- a/Documentation/devicetree/bindings/mtd/nand.txt > +++ b/Documentation/devicetree/bindings/mtd/nand.txt > @@ -43,6 +43,10 @@ Optional NAND chip properties: > This is particularly useful when only the in-band area is > used by the upper layers, and you want to make your NAND > 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. > + Shouldn't this be a partition level option? You could conceivably do one ECC type for boot area and something else for the rest of the NAND. > - nand-rb: shall contain the native Ready/Busy ids. > > The ECC strength and ECC step size properties define the correction capability > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c > index 9eb5678dd6d0..c8fb7c9855e2 100644 > --- a/drivers/mtd/nand/raw/nand_base.c > +++ b/drivers/mtd/nand/raw/nand_base.c > @@ -5826,6 +5826,9 @@ static int nand_dt_init(struct nand_chip *chip) > if (of_get_nand_bus_width(dn) == 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)) > chip->bbt_options |= NAND_BBT_USE_FLASH; > > diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h > index 6a82da8c44ce..8e54fcf2fa94 100644 > --- a/include/linux/mtd/rawnand.h > +++ b/include/linux/mtd/rawnand.h > @@ -212,6 +212,12 @@ enum nand_ecc_algo { > */ > #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 */ > /* Nand scan has allocated controller struct */ > #define NAND_CONTROLLER_ALLOC 0x80000000 > -- > 2.17.0 > -- To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Rob, On Tue, 5 Jun 2018 14:11:02 -0600 Rob Herring <robh@kernel.org> wrote: > On Fri, Jun 01, 2018 at 12:16:33AM +0200, Stefan Agner wrote: > > 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> > > --- > > Documentation/devicetree/bindings/mtd/nand.txt | 4 ++++ > > drivers/mtd/nand/raw/nand_base.c | 3 +++ > > include/linux/mtd/rawnand.h | 6 ++++++ > > 3 files changed, 13 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/mtd/nand.txt b/Documentation/devicetree/bindings/mtd/nand.txt > > index 8bb11d809429..8daf81b9748c 100644 > > --- a/Documentation/devicetree/bindings/mtd/nand.txt > > +++ b/Documentation/devicetree/bindings/mtd/nand.txt > > @@ -43,6 +43,10 @@ Optional NAND chip properties: > > This is particularly useful when only the in-band area is > > used by the upper layers, and you want to make your NAND > > 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. > > + > > Shouldn't this be a partition level option? You could conceivably do one > ECC type for boot area and something else for the rest of the NAND. I tried that a long time ago [1]. The result was far from perfect. I'm not saying it's impossible to do it, but it definitely requires a lot of work if we want to do it properly. Also, what about boards that are not defining their partitions in the DT but through the command line (using mtdparts)? That means patching the mtdparts part parser to also take the ECC setup into account. Regards, Boris [1]http://lists.infradead.org/pipermail/linux-mtd/2015-July/060600.html -- To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/Documentation/devicetree/bindings/mtd/nand.txt b/Documentation/devicetree/bindings/mtd/nand.txt index 8bb11d809429..8daf81b9748c 100644 --- a/Documentation/devicetree/bindings/mtd/nand.txt +++ b/Documentation/devicetree/bindings/mtd/nand.txt @@ -43,6 +43,10 @@ Optional NAND chip properties: This is particularly useful when only the in-band area is used by the upper layers, and you want to make your NAND 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. The ECC strength and ECC step size properties define the correction capability diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 9eb5678dd6d0..c8fb7c9855e2 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -5826,6 +5826,9 @@ static int nand_dt_init(struct nand_chip *chip) if (of_get_nand_bus_width(dn) == 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)) chip->bbt_options |= NAND_BBT_USE_FLASH; diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index 6a82da8c44ce..8e54fcf2fa94 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h @@ -212,6 +212,12 @@ enum nand_ecc_algo { */ #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 */ /* Nand scan has allocated controller struct */ #define NAND_CONTROLLER_ALLOC 0x80000000
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> --- Documentation/devicetree/bindings/mtd/nand.txt | 4 ++++ drivers/mtd/nand/raw/nand_base.c | 3 +++ include/linux/mtd/rawnand.h | 6 ++++++ 3 files changed, 13 insertions(+)