Skip to contentSkip to conversation

mtd: devices: add support for microchip 48l640 EERAM

PATCH Superseded Heiko Schocher 2 participants 5 messages Jun 1, 2021 – Jun 3, 2021

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover mtd: devices: add support for microchip 48l640 EERAM

add support for microchip 48l640 eeram connected via SPI. Patch 1 introduces devicetree documentation and patch 2 the driver.

Changes in v3:
Add Fabio to cc
drop dev_dbg() in mchp48l640_read() as not really needed to fix warning which kernel test robot found for
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
add Reported-by: kernel test robot <[email protected]> add Fabio to cc

Changes in v2:
as Rob helped, fix warnings from running command
'make DT_CHECKER_FLAGS=-m dt_binding_check'
- fix build warnings
- add Fabios Tested-by

Heiko Schocher (2):
mtd: devices: add devicetree documentation for microchip 48l640
mtd: devices: add support for microchip 48l640 EERAM

 .../bindings/mtd/microchip,mchp48l640.yaml    |  45 +++
 drivers/mtd/devices/Kconfig                   |   6 +
 drivers/mtd/devices/Makefile                  |   1 +
 drivers/mtd/devices/mchp48l640.c              | 373 ++++++++++++++++++
 4 files changed, 425 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml
 create mode 100644 drivers/mtd/devices/mchp48l640.c
Signature · 1 line
2.31.1
#1 lore raw

PATCH v3 1/2 mtd: devices: add devicetree documentation for microchip 48l640

The Microchip 48l640 is a 8KByte EERAM connected via SPI. Add devicetree bindings documentation.

---

Changes in v3:
Add Fabio to cc

Changes in v2:
as Rob helped, fix warnings from running command
'make DT_CHECKER_FLAGS=-m dt_binding_check'

 .../bindings/mtd/microchip,mchp48l640.yaml    | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml new file +45 -0
new file mode 100644
index 0000000000000..08089f2db0761
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/mtd/microchip,mchp48l640.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: MTD SPI driver for Microchip 48l640 (and similar) serial EERAM
+
+maintainers:
+  - Heiko Schocher <[email protected]>
+
+description: |
+  The Microchip 48l640 is a 8KByte EERAM connected via SPI.
+
+  datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/20006055B.pdf
+
+properties:
+  compatible:
+    items:
+      - const: microchip,48l640
+
+  reg:
+    maxItems: 1
+
+  spi-max-frequency: true
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      spi-eeram@0 {
+        compatible = "microchip,48l640";
+        reg = <0>;
+        spi-max-frequency = <20000000>;
+      };
+    };
+...
Signature · 1 line
2.31.1
maintainer Reviewed-by on v3 1/2
#2 lore raw

Re: [PATCH v3 1/2] mtd: devices: add devicetree documentation for microchip 48l640

Quoted 23 lines · Heiko Schocher

The Microchip 48l640 is a 8KByte EERAM connected via SPI. Add devicetree bindings documentation.

---

Changes in v3:
Add Fabio to cc

Changes in v2:
as Rob helped, fix warnings from running command
'make DT_CHECKER_FLAGS=-m dt_binding_check'

 .../bindings/mtd/microchip,mchp48l640.yaml    | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml new file +0 -0
new file mode 100644
index 0000000000000..08089f2db0761

Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml new file +7 -0
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/mtd/microchip,mchp48l640.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: MTD SPI driver for Microchip 48l640 (and similar) serial EERAM

This is not the driver.

Quoted 22 lines
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml new file +22 -0
+
+maintainers:
+  - Heiko Schocher <[email protected]>
+
+description: |
+  The Microchip 48l640 is a 8KByte EERAM connected via SPI.
+
+  datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/20006055B.pdf
+
+properties:
+  compatible:
+    items:
+      - const: microchip,48l640
+
+  reg:
+    maxItems: 1
+
+  spi-max-frequency: true
+
+required:
+  - compatible
+  - reg

Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml line 39

Quoted 10 lines
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml new file +10 -0
+
+additionalProperties: false
+
+examples:
+  - |
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      spi-eeram@0 {

eeram@0

Otherwise,

Quoted 8 lines
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml new file +6 -0
+        compatible = "microchip,48l640";
+        reg = <0>;
+        spi-max-frequency = <20000000>;
+      };
+    };
+...
Signature · 1 line
2.31.1
#3 lore raw

Re: [PATCH v3 1/2] mtd: devices: add devicetree documentation for microchip 48l640

Hello Rob,

Quoted 18 lines · Rob Herring
Quoted 17 lines · Heiko Schocher

The Microchip 48l640 is a 8KByte EERAM connected via SPI. Add devicetree bindings documentation.

---

Changes in v3:
Add Fabio to cc

Changes in v2:
as Rob helped, fix warnings from running command
'make DT_CHECKER_FLAGS=-m dt_binding_check'

 .../bindings/mtd/microchip,mchp48l640.yaml    | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml
Quoted 15 lines

Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml line 7

Quoted 13 lines
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml new file +7 -0
new file mode 100644
index 0000000000000..08089f2db0761
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/mtd/microchip,mchp48l640.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: MTD SPI driver for Microchip 48l640 (and similar) serial EERAM

This is not the driver.

Ok, I would change to:

title: Microchip 48l640 (and similar) serial EERAM bindings

ok?

Quoted 26 lines
Quoted 26 lines
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml new file +26 -0
+
+maintainers:
+  - Heiko Schocher <[email protected]>
+
+description: |
+  The Microchip 48l640 is a 8KByte EERAM connected via SPI.
+
+  datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/20006055B.pdf
+
+properties:
+  compatible:
+    items:
+      - const: microchip,48l640
+
+  reg:
+    maxItems: 1
+
+  spi-max-frequency: true
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
Quoted 8 lines

Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml line 39

Quoted 6 lines
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml new file +6 -0
+  - |
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      spi-eeram@0 {

eeram@0

changed.

Quoted 3 lines

Otherwise,

Thanks for your time!

I would wait with a v4 if I get comments for the driver (or wait some time...)

Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml new file +6 -0
+        compatible = "microchip,48l640";
+        reg = <0>;
+        spi-max-frequency = <20000000>;
+      };
+    };
+...
Signature · 1 line
2.31.1

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#4 lore raw

PATCH v3 2/2 mtd: devices: add support for microchip 48l640 EERAM

In reply to Heiko Schocher

The Microchip 48l640 is a 8KByte EERAM connected via SPI.

---
I tried to use drivers/mtd/devices/mchp23k256.c but this driver does not use any status register and there seems slight differences in registers (no write enable register for example), so I decided to make a new driver.

This driver sets the continuous mode bit in Status register, which states you can write continuous ... but after writting 32 bytes the chip goes into an undefined state, so driver now writes data in 32 byte chunks.

I also tried to use regmap, but it leads in a lot of more code, and as this chip has only spi interface it makes no sense, or?

Tested this driver on board imx8mp-phyboard-pollux-rdk board, which is already in mainline.

Made some tbot tests, which write at random offset random length bytes with dd and and random content. Reread the data after a reboot and compare with the written data. Works fine.

Changes in v3:
drop dev_dbg() in mchp48l640_read() as not really needed to fix warning which kernel test robot found for
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
add Reported-by: kernel test robot <[email protected]> add Fabio to cc

Changes in v2:
- fix build warnings
- add Fabios Tested-by

 drivers/mtd/devices/Kconfig      |   6 +
 drivers/mtd/devices/Makefile     |   1 +
 drivers/mtd/devices/mchp48l640.c | 373 +++++++++++++++++++++++++++++++
 3 files changed, 380 insertions(+)
 create mode 100644 drivers/mtd/devices/mchp48l640.c
drivers/mtd/devices/Kconfig +6 -0
index 0f4c2d823de84..79cb981ececc9 100644
@@ -89,6 +89,12 @@ config MTD_MCHP23K256
 	  platform data, or a device tree description if you want to
 	  specify device partitioning
 
+config MTD_MCHP48L640
+	tristate "Microchip 48L640 EERAM"
+	depends on SPI_MASTER
+	help
+	  This enables access to Microchip 48L640 EERAM chips, using SPI.
+
 config MTD_SPEAR_SMI
 	tristate "SPEAR MTD NOR Support through SMI controller"
 	depends on PLAT_SPEAR || COMPILE_TEST
drivers/mtd/devices/Makefile +1 -0
index 991c8d12c0160..0362cf6bdc67f 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_MTD_LART)		+= lart.o
 obj-$(CONFIG_MTD_BLOCK2MTD)	+= block2mtd.o
 obj-$(CONFIG_MTD_DATAFLASH)	+= mtd_dataflash.o
 obj-$(CONFIG_MTD_MCHP23K256)	+= mchp23k256.o
+obj-$(CONFIG_MTD_MCHP48L640)	+= mchp48l640.o
 obj-$(CONFIG_MTD_SPEAR_SMI)	+= spear_smi.o
 obj-$(CONFIG_MTD_SST25L)	+= sst25l.o
 obj-$(CONFIG_MTD_BCM47XXSFLASH)	+= bcm47xxsflash.o
drivers/mtd/devices/mchp48l640.c new file +373 -0

373 lines not on this page · raw message

Signature · 1 line
2.31.1