From: Peng Fan Date: Mon, 11 Nov 2024 11:19:46 +0000 (+0200) Subject: mtd: spi-nor: support vcc-supply regulator X-Git-Tag: v6.14-rc1~89^2~1^2~5 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d8bde4fd663667822956ad76dc33f0bbfa57bee8;p=users%2Fgriffoul%2Flinux.git mtd: spi-nor: support vcc-supply regulator 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 Reviewed-by: Marco Felsch [ta: move devm_regulator_get_enable() to spi_nor_probe().] Signed-off-by: Tudor Ambarus Reviewed-by: Pratyush Yadav Signed-off-by: Pratyush Yadav Link: https://lore.kernel.org/r/20241111111946.9048-3-tudor.ambarus@linaro.org --- diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 0b50293fc373..7ba89ffeaf2d 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -3587,6 +3588,10 @@ static int spi_nor_probe(struct spi_mem *spimem) char *flash_name; int ret; + ret = devm_regulator_get_enable(dev, "vcc"); + if (ret) + return ret; + nor = devm_kzalloc(dev, sizeof(*nor), GFP_KERNEL); if (!nor) return -ENOMEM;