* [PATCH 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply
2024-09-20 8:54 [PATCH 0/3] spi-nor: add optional vcc-supply and enable it for i.MX93 Peng Fan (OSS)
@ 2024-09-20 8:54 ` Peng Fan (OSS)
2024-09-24 20:33 ` Rob Herring (Arm)
2024-09-25 7:50 ` Michael Walle
2024-09-20 8:54 ` [PATCH 2/3] mtd: spi-nor: support vcc-supply regulator Peng Fan (OSS)
2024-09-20 8:54 ` [PATCH 3/3] arm64: dts: imx93-11x11-evk: add overlays for flexspi flash Peng Fan (OSS)
2 siblings, 2 replies; 8+ messages in thread
From: Peng Fan (OSS) @ 2024-09-20 8:54 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam
Cc: linux-mtd, devicetree, linux-kernel, imx, linux-arm-kernel,
Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Introduce optional vcc-supply property, spi nor flash needs power supply
to work properly. The power supply maybe software controlable per board
design.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
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..bab0617a51d5 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.37.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply
2024-09-20 8:54 ` [PATCH 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply Peng Fan (OSS)
@ 2024-09-24 20:33 ` Rob Herring (Arm)
2024-09-25 7:50 ` Michael Walle
1 sibling, 0 replies; 8+ messages in thread
From: Rob Herring (Arm) @ 2024-09-24 20:33 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Vignesh Raghavendra, devicetree, Michael Walle, Peng Fan,
Krzysztof Kozlowski, Pengutronix Kernel Team, linux-arm-kernel,
imx, Tudor Ambarus, Conor Dooley, Shawn Guo, Richard Weinberger,
Sascha Hauer, linux-mtd, Fabio Estevam, Miquel Raynal,
linux-kernel, Pratyush Yadav
On Fri, 20 Sep 2024 16:54:06 +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Introduce optional vcc-supply property, spi nor flash needs power supply
> to work properly. The power supply maybe software controlable per board
> design.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml | 4 ++++
> 1 file changed, 4 insertions(+)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply
2024-09-20 8:54 ` [PATCH 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply Peng Fan (OSS)
2024-09-24 20:33 ` Rob Herring (Arm)
@ 2024-09-25 7:50 ` Michael Walle
1 sibling, 0 replies; 8+ messages in thread
From: Michael Walle @ 2024-09-25 7:50 UTC (permalink / raw)
To: Peng Fan (OSS), Tudor Ambarus, Pratyush Yadav, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam
Cc: linux-mtd, devicetree, linux-kernel, imx, linux-arm-kernel,
Peng Fan
[-- Attachment #1: Type: text/plain, Size: 331 bytes --]
Hi,
since you respin anyway.
On Fri Sep 20, 2024 at 10:54 AM CEST, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Introduce optional vcc-supply property, spi nor flash needs power supply
SPI NOR flashes
> to work properly. The power supply maybe software controlable per board
> design.
-michael
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] mtd: spi-nor: support vcc-supply regulator
2024-09-20 8:54 [PATCH 0/3] spi-nor: add optional vcc-supply and enable it for i.MX93 Peng Fan (OSS)
2024-09-20 8:54 ` [PATCH 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply Peng Fan (OSS)
@ 2024-09-20 8:54 ` Peng Fan (OSS)
2024-09-20 9:09 ` Marco Felsch
2024-09-20 21:40 ` Frank Li
2024-09-20 8:54 ` [PATCH 3/3] arm64: dts: imx93-11x11-evk: add overlays for flexspi flash Peng Fan (OSS)
2 siblings, 2 replies; 8+ messages in thread
From: Peng Fan (OSS) @ 2024-09-20 8:54 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam
Cc: linux-mtd, devicetree, linux-kernel, imx, linux-arm-kernel,
Peng Fan
From: Peng Fan <peng.fan@nxp.com>
spi nor flash needs power supply to work properly. The power supply
maybe software controllable per board design. So add the support
for an optional vcc-supply regulator.
Signed-off-by: Peng Fan <peng.fan@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..0449afe6bb20 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_optional(dev, "vcc");
+ if (ret)
+ return ret;
+
ret = spi_nor_hw_reset(nor);
if (ret)
return ret;
--
2.37.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] mtd: spi-nor: support vcc-supply regulator
2024-09-20 8:54 ` [PATCH 2/3] mtd: spi-nor: support vcc-supply regulator Peng Fan (OSS)
@ 2024-09-20 9:09 ` Marco Felsch
2024-09-20 21:40 ` Frank Li
1 sibling, 0 replies; 8+ messages in thread
From: Marco Felsch @ 2024-09-20 9:09 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, devicetree, Peng Fan, imx,
linux-kernel, linux-mtd, linux-arm-kernel
On 24-09-20, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> spi nor flash needs power supply to work properly. The power supply
> maybe software controllable per board design. So add the support
> for an optional vcc-supply regulator.
>
> Signed-off-by: Peng Fan <peng.fan@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..0449afe6bb20 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_optional(dev, "vcc");
> + if (ret)
This returns -ENODEV if no regulator was specified. In general all
SPI-NOR devices need a VCC supply, so don't use the regulator optional
API here, please check the regulator API doc.
In contrast to that the dt-bindings should have the vcc-supply as
optional to not cause a regression for exisiting systems.
Regards,
Marco
> + return ret;
> +
> ret = spi_nor_hw_reset(nor);
> if (ret)
> return ret;
>
> --
> 2.37.1
>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] mtd: spi-nor: support vcc-supply regulator
2024-09-20 8:54 ` [PATCH 2/3] mtd: spi-nor: support vcc-supply regulator Peng Fan (OSS)
2024-09-20 9:09 ` Marco Felsch
@ 2024-09-20 21:40 ` Frank Li
1 sibling, 0 replies; 8+ messages in thread
From: Frank Li @ 2024-09-20 21:40 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, linux-mtd, devicetree,
linux-kernel, imx, linux-arm-kernel, Peng Fan
On Fri, Sep 20, 2024 at 04:54:07PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> spi nor flash needs power supply to work properly. The power supply
> maybe software controllable per board design. So add the support
> for an optional vcc-supply regulator.
>
> Signed-off-by: Peng Fan <peng.fan@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..0449afe6bb20 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_optional(dev, "vcc");
> + if (ret)
> + return ret;
> +
I think devm_regulator_get_enable_optional() should be called in
spi_nor_probe(). spi_nor_scan() is public API, which may call many time.
That will cause regulartor reference counter wrong.
Frank
> ret = spi_nor_hw_reset(nor);
> if (ret)
> return ret;
>
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] arm64: dts: imx93-11x11-evk: add overlays for flexspi flash
2024-09-20 8:54 [PATCH 0/3] spi-nor: add optional vcc-supply and enable it for i.MX93 Peng Fan (OSS)
2024-09-20 8:54 ` [PATCH 1/3] dt-bindings: mtd: jedec,spi-nor: add optional vcc-supply Peng Fan (OSS)
2024-09-20 8:54 ` [PATCH 2/3] mtd: spi-nor: support vcc-supply regulator Peng Fan (OSS)
@ 2024-09-20 8:54 ` Peng Fan (OSS)
2 siblings, 0 replies; 8+ messages in thread
From: Peng Fan (OSS) @ 2024-09-20 8:54 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam
Cc: linux-mtd, devicetree, linux-kernel, imx, linux-arm-kernel,
Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add overlays for the flexspi flash connected using M.2 interface.
The M.2 interface could be connected with M.2 flash card.
The M.2 interface needs PCIE power to work properly, the flash card
needs 1.8V voltage to work properly.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm64/boot/dts/freescale/Makefile | 3 ++
.../dts/freescale/imx93-11x11-evk-flexspi-m2.dtso | 59 ++++++++++++++++++++++
arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts | 10 ++++
3 files changed, 72 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/Makefile b/arch/arm64/boot/dts/freescale/Makefile
index 9d3df8b218a2..8f82aae85fe0 100644
--- a/arch/arm64/boot/dts/freescale/Makefile
+++ b/arch/arm64/boot/dts/freescale/Makefile
@@ -241,6 +241,7 @@ dtb-$(CONFIG_ARCH_MXC) += imx8qxp-tqma8xqp-mba8xx.dtb
dtb-$(CONFIG_ARCH_MXC) += imx8ulp-evk.dtb
dtb-$(CONFIG_ARCH_MXC) += imx93-9x9-qsb.dtb
dtb-$(CONFIG_ARCH_MXC) += imx93-11x11-evk.dtb
+dtb-$(CONFIG_ARCH_MXC) += imx93-11x11-evk-flexspi-m2.dtb
dtb-$(CONFIG_ARCH_MXC) += imx93-14x14-evk.dtb
dtb-$(CONFIG_ARCH_MXC) += imx93-kontron-bl-osm-s.dtb
dtb-$(CONFIG_ARCH_MXC) += imx93-phyboard-segin.dtb
@@ -249,6 +250,8 @@ dtb-$(CONFIG_ARCH_MXC) += imx93-tqma9352-mba93xxla.dtb
dtb-$(CONFIG_ARCH_MXC) += imx93-var-som-symphony.dtb
dtb-$(CONFIG_ARCH_MXC) += imx95-19x19-evk.dtb
+imx93-11x11-evk-flexspi-m2-dtbs := imx93-11x11-evk.dtb imx93-11x11-evk-flexspi-m2.dtbo
+
imx8mm-venice-gw72xx-0x-imx219-dtbs := imx8mm-venice-gw72xx-0x.dtb imx8mm-venice-gw72xx-0x-imx219.dtbo
imx8mm-venice-gw72xx-0x-rpidsi-dtbs := imx8mm-venice-gw72xx-0x.dtb imx8mm-venice-gw72xx-0x-rpidsi.dtbo
imx8mm-venice-gw72xx-0x-rs232-rts-dtbs := imx8mm-venice-gw72xx-0x.dtb imx8mm-venice-gw72xx-0x-rs232-rts.dtbo
diff --git a/arch/arm64/boot/dts/freescale/imx93-11x11-evk-flexspi-m2.dtso b/arch/arm64/boot/dts/freescale/imx93-11x11-evk-flexspi-m2.dtso
new file mode 100644
index 000000000000..f307789546a2
--- /dev/null
+++ b/arch/arm64/boot/dts/freescale/imx93-11x11-evk-flexspi-m2.dtso
@@ -0,0 +1,59 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2024 NXP
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include "imx93-pinfunc.h"
+
+/dts-v1/;
+/plugin/;
+
+&{/} {
+ reg_spinor_vcc: regulator-spinor {
+ compatible = "regulator-fixed";
+ regulator-name = "SPINOR";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ vin-supply = <®_m2_pwr>;
+ gpio = <&pcal6524 20 GPIO_ACTIVE_HIGH>;
+ startup-delay-us = <2000>;
+ enable-active-high;
+ };
+};
+
+&usdhc3 {
+ status = "disabled";
+};
+
+&flexspi1 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_flexspi1>;
+ status = "okay";
+
+ mt25qu512abb8e12: flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ vcc-supply = <®_spinor_vcc>;
+ reset-gpios = <&pcal6524 12 GPIO_ACTIVE_LOW>;
+ spi-max-frequency = <133000000>;
+ spi-tx-bus-width = <4>;
+ spi-rx-bus-width = <4>;
+ };
+};
+
+&iomuxc {
+ pinctrl_flexspi1: flexspi1grp {
+ fsl,pins = <
+ MX93_PAD_SD3_CLK__FLEXSPI1_A_SCLK 0x3fe
+ MX93_PAD_SD3_CMD__FLEXSPI1_A_SS0_B 0x3fe
+ MX93_PAD_SD3_DATA0__FLEXSPI1_A_DATA00 0x3fe
+ MX93_PAD_SD3_DATA1__FLEXSPI1_A_DATA01 0x3fe
+ MX93_PAD_SD3_DATA2__FLEXSPI1_A_DATA02 0x3fe
+ MX93_PAD_SD3_DATA3__FLEXSPI1_A_DATA03 0x3fe
+ >;
+ };
+};
diff --git a/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts b/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts
index 8d036b3962e9..2eefa65fbfa8 100644
--- a/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts
@@ -78,6 +78,16 @@ reg_vref_1v8: regulator-adc-vref {
regulator-max-microvolt = <1800000>;
};
+ reg_m2_pwr: regulator-m2-pwr {
+ compatible = "regulator-fixed";
+ regulator-name = "M.2-power";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ gpio = <&pcal6524 13 GPIO_ACTIVE_HIGH>;
+ startup-delay-us = <2000>;
+ enable-active-high;
+ };
+
reg_usdhc2_vmmc: regulator-usdhc2 {
compatible = "regulator-fixed";
pinctrl-names = "default";
--
2.37.1
^ permalink raw reply related [flat|nested] 8+ messages in thread