spi-nor: add optional vcc-supply and enable it for i.MX93
v3 cover spi-nor: add optional vcc-supply and enable it for i.MX93
spi-nor flash needs power supply to work properly, the power supply could be software controlled. So need enable the power before using the flash.
Patch 1,2 is to add vcc-supply for spi-nor
Patch 3 is to add overlays for i.MX93-11x11-EVK
---
Changes in v3:
- Rebased to linux-next next-20241025
- Drop patch 3 which is to add i.MX93 flexspi overlay device tree.
- Typo "spi nor" -> "SPI NOR" in patch 1
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Add A-b for patch 1, typo in patch 1
- Use devm_regulator_get_enable in patch 2
I still keep it in spi_nor_scan because it is in probe stage.
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Peng Fan (2):
dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply
mtd: spi-nor: support vcc-supply regulator
Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml | 4 ++++ drivers/mtd/spi-nor/core.c | 5 +++++ 2 files changed, 9 insertions(+)
---
base-commit: 7c98818f1183b7e4b6757901b41b0e37293aa28c
change-id: 20240920-spi-34231ea74761
Best regards,
Signature · 1 line
Peng Fan <[email protected]>
PATCH v3 1/2 dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply
From: Peng Fan <[email protected]>
Introduce optional vcc-supply property, SPI NOR flashes needs power supply to work properly. The power supply maybe software controlable per board design.
--- Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml +4 -0
@@ -96,6 +96,10 @@ properties: If "broken-flash-reset" is present then having this property does not make any difference. + vcc-supply: + description: + Supply for the SPI NOR power. + spi-cpol: true spi-cpha: true
Signature · 1 line
2.37.1
PATCH v3 2/2 mtd: spi-nor: support vcc-supply regulator
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
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.
--- drivers/mtd/spi-nor/core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mtd/spi-nor/core.c +5 -0
@@ -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>
@@ -3465,6 +3466,10 @@ int spi_nor_scan(struct spi_nor *nor, const char *name,if (!nor->bouncebuf)return -ENOMEM ; + ret =devm_regulator_get_enable (dev,"vcc" ); +if (ret) +return ret; + ret =spi_nor_hw_reset (nor);if (ret)return ret;
Signature · 1 line
2.37.1
Re: [PATCH v3 2/2] mtd: spi-nor: support vcc-supply regulator
Quoted 7 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
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 <[email protected]>
Re: [PATCH v3 2/2] mtd: spi-nor: support vcc-supply regulator
In reply to Peng Fan (OSS)Quoted 24 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
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 <[email protected]>--- drivers/mtd/spi-nor/core.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/mtd/spi-nor/core.c +1
-0@@ -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>
drivers/mtd/spi-nor/core.c int spi_nor_scan(struct spi_nor *nor, const char *name, · line 3471
Quoted 6 lines
drivers/mtd/spi-nor/core.c +3
-0@@ -3465,6 +3466,10 @@ int spi_nor_scan(struct spi_nor *nor, const char *name,if (!nor->bouncebuf)return -ENOMEM ; + ret =devm_regulator_get_enable (dev,"vcc" ); +if (ret) +return ret;
This is all looking good, but please move it to spi_nor_probe().
All the SPI NOR controllers need to move to spi/. We stopped adding support for the SPI NOR controllers few years ago.
Quoted 5 lines
drivers/mtd/spi-nor/core.c +1
-0+ ret =spi_nor_hw_reset (nor);if (ret)return ret;