* [PATCH v2 1/3] mtd: mchp48l640: make WEL behaviour configurable
2024-12-03 9:37 [PATCH v2 0/3] Add support for Fujitsu MB85RS128TY Jonas Rebmann
@ 2024-12-03 9:37 ` Jonas Rebmann
2024-12-03 9:55 ` Heiko Schocher
2024-12-03 9:37 ` [PATCH v2 2/3] dt-bindings: mtd: mchp48l640 add mb85rs128ty compatible Jonas Rebmann
2024-12-03 9:37 ` [PATCH v2 3/3] mtd: mchp48l640: add support for Fujitsu MB85RS128TY FRAM Jonas Rebmann
2 siblings, 1 reply; 7+ messages in thread
From: Jonas Rebmann @ 2024-12-03 9:37 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Schocher
Cc: linux-mtd, linux-kernel, devicetree, David Jander, kernel, Jonas Rebmann
From: David Jander <david@protonic.nl>
The 48L640 resets the WEL bit (the Write Enable Latch bit in the status
register) to zero on the completion of write operations. In preparation
to support chips behaving differently, introduce .auto_disable_wel
capability, and, if it's missing, explicitly reset the WEL bit after
writes.
Signed-off-by: David Jander <david@protonic.nl>
Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
drivers/mtd/devices/mchp48l640.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/devices/mchp48l640.c b/drivers/mtd/devices/mchp48l640.c
index f576e6a890e859e7d20aeeb2ede4ca0acf4850fc..4cdd24aaed416fc7e40a8060b5c7eaf6684fc6d5 100644
--- a/drivers/mtd/devices/mchp48l640.c
+++ b/drivers/mtd/devices/mchp48l640.c
@@ -27,6 +27,7 @@
struct mchp48_caps {
unsigned int size;
unsigned int page_size;
+ bool auto_disable_wel;
};
struct mchp48l640_flash {
@@ -194,9 +195,15 @@ static int mchp48l640_write_page(struct mtd_info *mtd, loff_t to, size_t len,
else
goto fail;
- ret = mchp48l640_waitforbit(flash, MCHP48L640_STATUS_WEL, false);
- if (ret)
- goto fail;
+ if (flash->caps->auto_disable_wel) {
+ ret = mchp48l640_waitforbit(flash, MCHP48L640_STATUS_WEL, false);
+ if (ret)
+ goto fail;
+ } else {
+ ret = mchp48l640_write_prepare(flash, false);
+ if (ret)
+ goto fail;
+ }
kfree(cmd);
return 0;
@@ -293,6 +300,7 @@ static int mchp48l640_read(struct mtd_info *mtd, loff_t from, size_t len,
static const struct mchp48_caps mchp48l640_caps = {
.size = SZ_8K,
.page_size = 32,
+ .auto_disable_wel = true,
};
static int mchp48l640_probe(struct spi_device *spi)
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v2 1/3] mtd: mchp48l640: make WEL behaviour configurable
2024-12-03 9:37 ` [PATCH v2 1/3] mtd: mchp48l640: make WEL behaviour configurable Jonas Rebmann
@ 2024-12-03 9:55 ` Heiko Schocher
0 siblings, 0 replies; 7+ messages in thread
From: Heiko Schocher @ 2024-12-03 9:55 UTC (permalink / raw)
To: Jonas Rebmann, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-mtd, linux-kernel, devicetree, David Jander, kernel
Hello Jonas,
On 03.12.24 10:37, Jonas Rebmann wrote:
> From: David Jander <david@protonic.nl>
>
> The 48L640 resets the WEL bit (the Write Enable Latch bit in the status
> register) to zero on the completion of write operations. In preparation
> to support chips behaving differently, introduce .auto_disable_wel
> capability, and, if it's missing, explicitly reset the WEL bit after
> writes.
>
> Signed-off-by: David Jander <david@protonic.nl>
> Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
> ---
> drivers/mtd/devices/mchp48l640.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
Reviewed-by: Heiko Schocher <hs@denx.de>
Thanks!
bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs@denx.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] dt-bindings: mtd: mchp48l640 add mb85rs128ty compatible
2024-12-03 9:37 [PATCH v2 0/3] Add support for Fujitsu MB85RS128TY Jonas Rebmann
2024-12-03 9:37 ` [PATCH v2 1/3] mtd: mchp48l640: make WEL behaviour configurable Jonas Rebmann
@ 2024-12-03 9:37 ` Jonas Rebmann
2024-12-03 9:47 ` Krzysztof Kozlowski
2024-12-03 9:37 ` [PATCH v2 3/3] mtd: mchp48l640: add support for Fujitsu MB85RS128TY FRAM Jonas Rebmann
2 siblings, 1 reply; 7+ messages in thread
From: Jonas Rebmann @ 2024-12-03 9:37 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Schocher
Cc: linux-mtd, linux-kernel, devicetree, David Jander, kernel, Jonas Rebmann
Add a compatible string to support Fujitsu MB85RS128TY.
Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml b/Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml
index 0ff32bd00bf6aee279fa78c624d8d47c6162f7f1..11f64056a28f98ad633265b00605ffd2c3e026c8 100644
--- a/Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml
+++ b/Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml
@@ -16,8 +16,9 @@ description: |
properties:
compatible:
- items:
- - const: microchip,48l640
+ enum:
+ - microchip,48l640
+ - fujitsu,mb85rs128ty
reg:
maxItems: 1
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v2 2/3] dt-bindings: mtd: mchp48l640 add mb85rs128ty compatible
2024-12-03 9:37 ` [PATCH v2 2/3] dt-bindings: mtd: mchp48l640 add mb85rs128ty compatible Jonas Rebmann
@ 2024-12-03 9:47 ` Krzysztof Kozlowski
0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2024-12-03 9:47 UTC (permalink / raw)
To: Jonas Rebmann, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Heiko Schocher
Cc: linux-mtd, linux-kernel, devicetree, David Jander, kernel
On 03/12/2024 10:37, Jonas Rebmann wrote:
> Add a compatible string to support Fujitsu MB85RS128TY.
>
> Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
> ---
> Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml b/Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml
> index 0ff32bd00bf6aee279fa78c624d8d47c6162f7f1..11f64056a28f98ad633265b00605ffd2c3e026c8 100644
> --- a/Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml
> +++ b/Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml
> @@ -16,8 +16,9 @@ description: |
>
> properties:
> compatible:
> - items:
> - - const: microchip,48l640
> + enum:
> + - microchip,48l640
> + - fujitsu,mb85rs128ty
Keep alphabetical order. That's generic rule for all compatible lists in
bindings and drivers. It's a rule for many other growing things as well,
because it helps to avoid conflicts.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] mtd: mchp48l640: add support for Fujitsu MB85RS128TY FRAM
2024-12-03 9:37 [PATCH v2 0/3] Add support for Fujitsu MB85RS128TY Jonas Rebmann
2024-12-03 9:37 ` [PATCH v2 1/3] mtd: mchp48l640: make WEL behaviour configurable Jonas Rebmann
2024-12-03 9:37 ` [PATCH v2 2/3] dt-bindings: mtd: mchp48l640 add mb85rs128ty compatible Jonas Rebmann
@ 2024-12-03 9:37 ` Jonas Rebmann
2024-12-03 10:01 ` Heiko Schocher
2 siblings, 1 reply; 7+ messages in thread
From: Jonas Rebmann @ 2024-12-03 9:37 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Schocher
Cc: linux-mtd, linux-kernel, devicetree, David Jander, kernel, Jonas Rebmann
From: David Jander <david@protonic.nl>
The Fujitsu FRAM chips use the same command set as Microchip EERAM.
The only differences are that the Fujitsu FRAM chips don't really have a
page size limit, nor do they automatically reset the WEL bit.
Signed-off-by: David Jander <david@protonic.nl>
Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
drivers/mtd/devices/mchp48l640.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/mtd/devices/mchp48l640.c b/drivers/mtd/devices/mchp48l640.c
index 4cdd24aaed416fc7e40a8060b5c7eaf6684fc6d5..7584d0ba93969d79ba3d9c7a97bc63bd0e5ef327 100644
--- a/drivers/mtd/devices/mchp48l640.c
+++ b/drivers/mtd/devices/mchp48l640.c
@@ -303,6 +303,12 @@ static const struct mchp48_caps mchp48l640_caps = {
.auto_disable_wel = true,
};
+static const struct mchp48_caps mb85rs128ty_caps = {
+ .size = SZ_16K,
+ .page_size = 256,
+ .auto_disable_wel = false,
+};
+
static int mchp48l640_probe(struct spi_device *spi)
{
struct mchp48l640_flash *flash;
@@ -361,6 +367,10 @@ static const struct of_device_id mchp48l640_of_table[] = {
.compatible = "microchip,48l640",
.data = &mchp48l640_caps,
},
+ {
+ .compatible = "fujitsu,mb85rs128ty",
+ .data = &mb85rs128ty_caps,
+ },
{}
};
MODULE_DEVICE_TABLE(of, mchp48l640_of_table);
@@ -370,6 +380,10 @@ static const struct spi_device_id mchp48l640_spi_ids[] = {
.name = "48l640",
.driver_data = (kernel_ulong_t)&mchp48l640_caps,
},
+ {
+ .name = "mb85rs128ty",
+ .driver_data = (kernel_ulong_t)&mb85rs128ty_caps,
+ },
{}
};
MODULE_DEVICE_TABLE(spi, mchp48l640_spi_ids);
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v2 3/3] mtd: mchp48l640: add support for Fujitsu MB85RS128TY FRAM
2024-12-03 9:37 ` [PATCH v2 3/3] mtd: mchp48l640: add support for Fujitsu MB85RS128TY FRAM Jonas Rebmann
@ 2024-12-03 10:01 ` Heiko Schocher
0 siblings, 0 replies; 7+ messages in thread
From: Heiko Schocher @ 2024-12-03 10:01 UTC (permalink / raw)
To: Jonas Rebmann, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-mtd, linux-kernel, devicetree, David Jander, kernel
Hello Jonas,
On 03.12.24 10:37, Jonas Rebmann wrote:
> From: David Jander <david@protonic.nl>
>
> The Fujitsu FRAM chips use the same command set as Microchip EERAM.
> The only differences are that the Fujitsu FRAM chips don't really have a
> page size limit, nor do they automatically reset the WEL bit.
>
> Signed-off-by: David Jander <david@protonic.nl>
> Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
> ---
> drivers/mtd/devices/mchp48l640.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
Reviewed-by: Heiko Schocher <hs@denx.de>
Thanks!
bye,
Heiko
--
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs@denx.de
^ permalink raw reply [flat|nested] 7+ messages in thread