[PATCH v2 2/3] mtd: spi-nor: support vcc-supply regulator

Miquel Raynal miquel.raynal at bootlin.com
Mon Sep 30 02:19:14 PDT 2024


Hi,

peng.fan at oss.nxp.com wrote on Mon, 30 Sep 2024 17:22:25 +0800:

> From: Peng Fan <peng.fan at nxp.com>
> 
> SPI NOR flashes needs power supply to work properly. The power supply
> maybe software controllable per board design. So add the support
> for an vcc-supply regulator.
> 
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> ---
>  drivers/mtd/spi-nor/core.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 9d6e85bf227b..5249c8b13916 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -17,6 +17,7 @@
>  #include <linux/mtd/spi-nor.h>
>  #include <linux/mutex.h>
>  #include <linux/of_platform.h>
> +#include <linux/regulator/consumer.h>
>  #include <linux/sched/task_stack.h>
>  #include <linux/sizes.h>
>  #include <linux/slab.h>
> @@ -3462,6 +3463,10 @@ int spi_nor_scan(struct spi_nor *nor, const char *name,
>  	if (!nor->bouncebuf)
>  		return -ENOMEM;
>  
> +	ret = devm_regulator_get_enable(dev, "vcc");

					_optional ?

> +	if (ret)
> +		return ret;
> +
>  	ret = spi_nor_hw_reset(nor);
>  	if (ret)
>  		return ret;
> 


Thanks,
Miquèl



More information about the linux-mtd mailing list