Re: [PATCH v2 1/3] mtd: rawnand: nand_base: support for 'NAND_IS_BOOT_MEDIUM' flag

Michael Nazzareno Trimarchi <[email protected]>
Newsgroups io.groups.u-boot-amlogic,org.u-boot-project.lists.u-boot
Message-ID <CAOf5uw=hQv4WUQuFgw7RsZSQYW1Az0_sUvO=_8kqOFdK945pUA@mail.gmail.com>
Hi

On Mon, Aug 26, 2024 at 8:17 AM Arseniy Krasnov
<[email protected]> wrote:
>
> Based on Linux kernel:
> commit f922bd798bb9 ("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: Arseniy Krasnov <[email protected]>
> ---
>  Changelog:
>  v1 -> v2:
>   * Place 'NAND_IS_BOOT_MEDIUM' according its numerical value.
>
>  drivers/mtd/nand/raw/nand_base.c | 3 +++
>  include/linux/mtd/rawnand.h      | 5 +++++
>  2 files changed, 8 insertions(+)
>
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index c40a0f23d7..ed605b4af5 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -4458,6 +4458,9 @@ static int nand_dt_init(struct mtd_info *mtd, struct nand_chip *chip, ofnode nod
>         if (ret == 16)
>                 chip->options |= NAND_BUSWIDTH_16;
>
> +       if (ofnode_read_bool(node, "nand-is-boot-medium"))
> +               chip->options |= NAND_IS_BOOT_MEDIUM;
> +
>         if (ofnode_read_bool(node, "nand-on-flash-bbt"))
>                 chip->bbt_options |= NAND_BBT_USE_FLASH;
>
> diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
> index fb002ae641..61690e816f 100644
> --- a/include/linux/mtd/rawnand.h
> +++ b/include/linux/mtd/rawnand.h
> @@ -248,6 +248,11 @@ enum nand_ecc_algo {
>   * kmap'ed, vmalloc'ed highmem buffers being passed from upper layers
>   */
>  #define NAND_USE_BOUNCE_BUFFER 0x00100000
> +/*
> + * 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 */
>  /* bbt has already been read */
> --

I will then backport this from linux kernel
dd6ed5c9890b759ba1b56697b9f3f50e71909e43

Reviewed-by: Michael Trimarchi <[email protected]>

> 2.30.1
>



--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.