[PATCH] mtd: sf: Set SF parameters as env variables
Pratyush Yadav
p.yadav at ti.com
Thu Sep 23 20:53:18 CEST 2021
On 14/09/21 05:28AM, Marek Vasut wrote:
> Set the SF page size, erase block size and total size as an environment
> variable after "sf probe". This lets us discern boards with multiple
> distinct SPI flash options and also e.g. set mtdparts accordingly.
I don't quite follow the rationale for making these environment
variables. Wouldn't you be better off finding this info out via mtd or
sf command?
>
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Jagan Teki <jagan at amarulasolutions.com>
> Cc: Vignesh R <vigneshr at ti.com>
> ---
> drivers/mtd/spi/spi-nor-core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
> index d5d905fa5a1..448653b9931 100644
> --- a/drivers/mtd/spi/spi-nor-core.c
> +++ b/drivers/mtd/spi/spi-nor-core.c
> @@ -15,6 +15,7 @@
> #include <dm.h>
> #include <dm/device_compat.h>
> #include <dm/devres.h>
> +#include <env.h>
> #include <linux/bitops.h>
> #include <linux/err.h>
> #include <linux/errno.h>
> @@ -3829,8 +3830,11 @@ int spi_nor_scan(struct spi_nor *nor)
> #ifndef CONFIG_SPL_BUILD
> printf("SF: Detected %s with page size ", nor->name);
> print_size(nor->page_size, ", erase size ");
> + env_set_hex("sf_pagesize", nor->page_size);
> print_size(nor->erase_size, ", total ");
> + env_set_hex("sf_erasesize", nor->erase_size);
> print_size(nor->size, "");
> + env_set_hex("sf_size", nor->size);
> puts("\n");
> #endif
>
> --
> 2.33.0
>
--
Regards,
Pratyush Yadav
Texas Instruments Inc.
More information about the U-Boot
mailing list