devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH v4 1/2] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply
@ 2024-10-29 10:22 Tudor Ambarus
  2024-10-29 10:22 ` [RESEND PATCH v4 2/2] mtd: spi-nor: support vcc-supply regulator Tudor Ambarus
  0 siblings, 1 reply; 5+ messages in thread
From: Tudor Ambarus @ 2024-10-29 10:22 UTC (permalink / raw)
  To: peng.fan, m.felsch
  Cc: pratyush, mwalle, miquel.raynal, richard, vigneshr, robh, krzk+dt,
	conor+dt, shawnguo, s.hauer, kernel, festevam, linux-mtd,
	devicetree, linux-kernel, imx, linux-arm-kernel, Peng Fan,
	Tudor Ambarus

From: Peng Fan <peng.fan@nxp.com>

Introduce optional vcc-supply property, SPI NOR flashes needs power supply
to work properly. The power supply maybe software controlable per board
design.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
v4: no changes

 Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
index 6e3afb42926e..335f8204aa1e 100644
--- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
+++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
@@ -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
 
-- 
2.47.0.163.g1226f6d8fa-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [RESEND PATCH v4 2/2] mtd: spi-nor: support vcc-supply regulator
  2024-10-29 10:22 [RESEND PATCH v4 1/2] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply Tudor Ambarus
@ 2024-10-29 10:22 ` Tudor Ambarus
  2024-11-11 14:02   ` Pratyush Yadav
  0 siblings, 1 reply; 5+ messages in thread
From: Tudor Ambarus @ 2024-10-29 10:22 UTC (permalink / raw)
  To: peng.fan, m.felsch
  Cc: pratyush, mwalle, miquel.raynal, richard, vigneshr, robh, krzk+dt,
	conor+dt, shawnguo, s.hauer, kernel, festevam, linux-mtd,
	devicetree, linux-kernel, imx, linux-arm-kernel, Peng Fan,
	Tudor Ambarus

From: Peng Fan <peng.fan@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@nxp.com>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
[ta: move devm_regulator_get_enable() to spi_nor_probe(). Add local dev
variable to avoid dereferences.]
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
v4:
- move devm_regulator_get_enable() to spi_nor_probe().
- add local dev variable to avoid dereferences.

 drivers/mtd/spi-nor/core.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index b6f374ded390..29441f2bab5d 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>
@@ -3576,7 +3577,8 @@ static int spi_nor_create_write_dirmap(struct spi_nor *nor)
 static int spi_nor_probe(struct spi_mem *spimem)
 {
 	struct spi_device *spi = spimem->spi;
-	struct flash_platform_data *data = dev_get_platdata(&spi->dev);
+	struct device *dev = &spi->dev;
+	struct flash_platform_data *data = dev_get_platdata(dev);
 	struct spi_nor *nor;
 	/*
 	 * Enable all caps by default. The core will mask them after
@@ -3586,12 +3588,16 @@ static int spi_nor_probe(struct spi_mem *spimem)
 	char *flash_name;
 	int ret;
 
-	nor = devm_kzalloc(&spi->dev, sizeof(*nor), GFP_KERNEL);
+	ret = devm_regulator_get_enable(dev, "vcc");
+	if (ret)
+		return ret;
+
+	nor = devm_kzalloc(dev, sizeof(*nor), GFP_KERNEL);
 	if (!nor)
 		return -ENOMEM;
 
 	nor->spimem = spimem;
-	nor->dev = &spi->dev;
+	nor->dev = dev;
 	spi_nor_set_flash_node(nor, spi->dev.of_node);
 
 	spi_mem_set_drvdata(spimem, nor);
-- 
2.47.0.163.g1226f6d8fa-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH v4 2/2] mtd: spi-nor: support vcc-supply regulator
  2024-10-29 10:22 ` [RESEND PATCH v4 2/2] mtd: spi-nor: support vcc-supply regulator Tudor Ambarus
@ 2024-11-11 14:02   ` Pratyush Yadav
  2024-11-12  7:01     ` Tudor Ambarus
  0 siblings, 1 reply; 5+ messages in thread
From: Pratyush Yadav @ 2024-11-11 14:02 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: peng.fan, m.felsch, pratyush, mwalle, miquel.raynal, richard,
	vigneshr, robh, krzk+dt, conor+dt, shawnguo, s.hauer, kernel,
	festevam, linux-mtd, devicetree, linux-kernel, imx,
	linux-arm-kernel, Peng Fan

On Tue, Oct 29 2024, Tudor Ambarus wrote:

> From: Peng Fan <peng.fan@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@nxp.com>
> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> [ta: move devm_regulator_get_enable() to spi_nor_probe(). Add local dev
> variable to avoid dereferences.]
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>

Reviewed-by: Pratyush Yadav <pratyush@kernel.org>

-- 
Regards,
Pratyush Yadav

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH v4 2/2] mtd: spi-nor: support vcc-supply regulator
  2024-11-11 14:02   ` Pratyush Yadav
@ 2024-11-12  7:01     ` Tudor Ambarus
  2024-11-12 13:02       ` Pratyush Yadav
  0 siblings, 1 reply; 5+ messages in thread
From: Tudor Ambarus @ 2024-11-12  7:01 UTC (permalink / raw)
  To: Pratyush Yadav
  Cc: peng.fan, m.felsch, mwalle, miquel.raynal, richard, vigneshr,
	robh, krzk+dt, conor+dt, shawnguo, s.hauer, kernel, festevam,
	linux-mtd, devicetree, linux-kernel, imx, linux-arm-kernel,
	Peng Fan



On 11/11/24 2:02 PM, Pratyush Yadav wrote:
> On Tue, Oct 29 2024, Tudor Ambarus wrote:
> 
>> From: Peng Fan <peng.fan@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@nxp.com>
>> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
>> [ta: move devm_regulator_get_enable() to spi_nor_probe(). Add local dev
>> variable to avoid dereferences.]
>> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> 
> Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
> 

thanks, Pratyush. I sent a v5 here, where I introduce the temporary
variable to struct device in its dedicated patch. Would you mind adding
the R-b tag there?
https://lore.kernel.org/linux-mtd/20241111111946.9048-1-tudor.ambarus@linaro.org/

btw, I try to keep patchwork in sync, so you can see the status of
patches there as well:

https://patchwork.ozlabs.org/project/linux-mtd/list/?series=&submitter=&state=&q=spi-nor&archive=&delegate=

Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH v4 2/2] mtd: spi-nor: support vcc-supply regulator
  2024-11-12  7:01     ` Tudor Ambarus
@ 2024-11-12 13:02       ` Pratyush Yadav
  0 siblings, 0 replies; 5+ messages in thread
From: Pratyush Yadav @ 2024-11-12 13:02 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: Pratyush Yadav, peng.fan, m.felsch, mwalle, miquel.raynal,
	richard, vigneshr, robh, krzk+dt, conor+dt, shawnguo, s.hauer,
	kernel, festevam, linux-mtd, devicetree, linux-kernel, imx,
	linux-arm-kernel, Peng Fan

On Tue, Nov 12 2024, Tudor Ambarus wrote:

> On 11/11/24 2:02 PM, Pratyush Yadav wrote:
>> On Tue, Oct 29 2024, Tudor Ambarus wrote:
>> 
>>> From: Peng Fan <peng.fan@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@nxp.com>
>>> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
>>> [ta: move devm_regulator_get_enable() to spi_nor_probe(). Add local dev
>>> variable to avoid dereferences.]
>>> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
>> 
>> Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
>> 
>
> thanks, Pratyush. I sent a v5 here, where I introduce the temporary
> variable to struct device in its dedicated patch. Would you mind adding
> the R-b tag there?
> https://lore.kernel.org/linux-mtd/20241111111946.9048-1-tudor.ambarus@linaro.org/

Ah, I missed that in the many emails in by mailbox. Will take a look.

>
> btw, I try to keep patchwork in sync, so you can see the status of
> patches there as well:
>
> https://patchwork.ozlabs.org/project/linux-mtd/list/?series=&submitter=&state=&q=spi-nor&archive=&delegate=
>
> Thanks!

-- 
Regards,
Pratyush Yadav

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-12 13:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-29 10:22 [RESEND PATCH v4 1/2] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply Tudor Ambarus
2024-10-29 10:22 ` [RESEND PATCH v4 2/2] mtd: spi-nor: support vcc-supply regulator Tudor Ambarus
2024-11-11 14:02   ` Pratyush Yadav
2024-11-12  7:01     ` Tudor Ambarus
2024-11-12 13:02       ` Pratyush Yadav

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).