* [PATCH v5 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply
@ 2024-11-11 11:19 Tudor Ambarus
2024-11-11 11:19 ` [PATCH v5 2/3] mtd: spi-nor: use local variable for struct device Tudor Ambarus
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Tudor Ambarus @ 2024-11-11 11:19 UTC (permalink / raw)
To: peng.fan, m.felsch
Cc: pratyush, mwalle, miquel.raynal, richard, 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, v5: 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.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v5 2/3] mtd: spi-nor: use local variable for struct device
2024-11-11 11:19 [PATCH v5 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply Tudor Ambarus
@ 2024-11-11 11:19 ` Tudor Ambarus
2024-11-12 13:06 ` Pratyush Yadav
2024-11-11 11:19 ` [PATCH v5 3/3] mtd: spi-nor: support vcc-supply regulator Tudor Ambarus
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Tudor Ambarus @ 2024-11-11 11:19 UTC (permalink / raw)
To: peng.fan, m.felsch
Cc: pratyush, mwalle, miquel.raynal, richard, robh, krzk+dt, conor+dt,
shawnguo, s.hauer, kernel, festevam, linux-mtd, devicetree,
linux-kernel, imx, linux-arm-kernel, Tudor Ambarus
Use a local variable for the struct device pointers to avoid
dereferencing.
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
v5: new patch
drivers/mtd/spi-nor/core.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index b6f374ded390..2a329084505c 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3576,7 +3576,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,13 +3587,13 @@ static int spi_nor_probe(struct spi_mem *spimem)
char *flash_name;
int ret;
- nor = devm_kzalloc(&spi->dev, sizeof(*nor), GFP_KERNEL);
+ nor = devm_kzalloc(dev, sizeof(*nor), GFP_KERNEL);
if (!nor)
return -ENOMEM;
nor->spimem = spimem;
- nor->dev = &spi->dev;
- spi_nor_set_flash_node(nor, spi->dev.of_node);
+ nor->dev = dev;
+ spi_nor_set_flash_node(nor, dev->of_node);
spi_mem_set_drvdata(spimem, nor);
@@ -3628,9 +3629,8 @@ static int spi_nor_probe(struct spi_mem *spimem)
*/
if (nor->params->page_size > PAGE_SIZE) {
nor->bouncebuf_size = nor->params->page_size;
- devm_kfree(nor->dev, nor->bouncebuf);
- nor->bouncebuf = devm_kmalloc(nor->dev,
- nor->bouncebuf_size,
+ devm_kfree(dev, nor->bouncebuf);
+ nor->bouncebuf = devm_kmalloc(dev, nor->bouncebuf_size,
GFP_KERNEL);
if (!nor->bouncebuf)
return -ENOMEM;
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v5 3/3] mtd: spi-nor: support vcc-supply regulator
2024-11-11 11:19 [PATCH v5 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply Tudor Ambarus
2024-11-11 11:19 ` [PATCH v5 2/3] mtd: spi-nor: use local variable for struct device Tudor Ambarus
@ 2024-11-11 11:19 ` Tudor Ambarus
2024-11-12 13:06 ` Pratyush Yadav
2024-11-12 13:03 ` [PATCH v5 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply Pratyush Yadav
2024-12-06 16:11 ` Pratyush Yadav
3 siblings, 1 reply; 7+ messages in thread
From: Tudor Ambarus @ 2024-11-11 11:19 UTC (permalink / raw)
To: peng.fan, m.felsch
Cc: pratyush, mwalle, miquel.raynal, richard, 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().]
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
v5: introduce the local dev variable to its own patch
v4: move the devm_regulator_get_enable() call from spi_nor_scan to
spi_nor_probe(). We no longer add support for the drivers under
drivers/mtd/spi-nor/controllers/. Those drivers shall be moved under
drivers/spi.
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 2a329084505c..19eb98bd6821 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>
@@ -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;
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v5 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply
2024-11-11 11:19 [PATCH v5 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply Tudor Ambarus
2024-11-11 11:19 ` [PATCH v5 2/3] mtd: spi-nor: use local variable for struct device Tudor Ambarus
2024-11-11 11:19 ` [PATCH v5 3/3] mtd: spi-nor: support vcc-supply regulator Tudor Ambarus
@ 2024-11-12 13:03 ` Pratyush Yadav
2024-12-06 16:11 ` Pratyush Yadav
3 siblings, 0 replies; 7+ messages in thread
From: Pratyush Yadav @ 2024-11-12 13:03 UTC (permalink / raw)
To: Tudor Ambarus
Cc: peng.fan, m.felsch, pratyush, mwalle, miquel.raynal, richard,
robh, krzk+dt, conor+dt, shawnguo, s.hauer, kernel, festevam,
linux-mtd, devicetree, linux-kernel, imx, linux-arm-kernel,
Peng Fan
On Mon, Nov 11 2024, Tudor Ambarus wrote:
> 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>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v5 2/3] mtd: spi-nor: use local variable for struct device
2024-11-11 11:19 ` [PATCH v5 2/3] mtd: spi-nor: use local variable for struct device Tudor Ambarus
@ 2024-11-12 13:06 ` Pratyush Yadav
0 siblings, 0 replies; 7+ messages in thread
From: Pratyush Yadav @ 2024-11-12 13:06 UTC (permalink / raw)
To: Tudor Ambarus
Cc: peng.fan, m.felsch, pratyush, mwalle, miquel.raynal, richard,
robh, krzk+dt, conor+dt, shawnguo, s.hauer, kernel, festevam,
linux-mtd, devicetree, linux-kernel, imx, linux-arm-kernel
On Mon, Nov 11 2024, Tudor Ambarus wrote:
> Use a local variable for the struct device pointers to avoid
> dereferencing.
>
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v5 3/3] mtd: spi-nor: support vcc-supply regulator
2024-11-11 11:19 ` [PATCH v5 3/3] mtd: spi-nor: support vcc-supply regulator Tudor Ambarus
@ 2024-11-12 13:06 ` Pratyush Yadav
0 siblings, 0 replies; 7+ messages in thread
From: Pratyush Yadav @ 2024-11-12 13:06 UTC (permalink / raw)
To: Tudor Ambarus
Cc: peng.fan, m.felsch, pratyush, mwalle, miquel.raynal, richard,
robh, krzk+dt, conor+dt, shawnguo, s.hauer, kernel, festevam,
linux-mtd, devicetree, linux-kernel, imx, linux-arm-kernel,
Peng Fan
On Mon, Nov 11 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().]
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v5 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply
2024-11-11 11:19 [PATCH v5 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply Tudor Ambarus
` (2 preceding siblings ...)
2024-11-12 13:03 ` [PATCH v5 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply Pratyush Yadav
@ 2024-12-06 16:11 ` Pratyush Yadav
3 siblings, 0 replies; 7+ messages in thread
From: Pratyush Yadav @ 2024-12-06 16:11 UTC (permalink / raw)
To: Tudor Ambarus
Cc: peng.fan, m.felsch, pratyush, mwalle, miquel.raynal, richard,
robh, krzk+dt, conor+dt, shawnguo, s.hauer, kernel, festevam,
linux-mtd, devicetree, linux-kernel, imx, linux-arm-kernel,
Peng Fan
On Mon, Nov 11 2024, Tudor Ambarus wrote:
> 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>
Series applied to spi-nor/next. Thanks!
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-12-06 16:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-11 11:19 [PATCH v5 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply Tudor Ambarus
2024-11-11 11:19 ` [PATCH v5 2/3] mtd: spi-nor: use local variable for struct device Tudor Ambarus
2024-11-12 13:06 ` Pratyush Yadav
2024-11-11 11:19 ` [PATCH v5 3/3] mtd: spi-nor: support vcc-supply regulator Tudor Ambarus
2024-11-12 13:06 ` Pratyush Yadav
2024-11-12 13:03 ` [PATCH v5 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply Pratyush Yadav
2024-12-06 16:11 ` 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).