Skip to contentSkip to conversation

mtd: devices: add support for microchip 48l640 EERAM

PATCH Applied Heiko Schocher 2 participants 5 messages Jun 7, 2021 – Jun 11, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v4 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.

Any comments to driver?

Changes in v4:
- work in comments from Rob:
- change title to
Microchip 48l640 (and similar) serial EERAM bindings
- rename spi-eeram to eeram
- Add Reviewed-by tag from Rob

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 v4 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 v4:
- work in comments from Rob:
- change title to
Microchip 48l640 (and similar) serial EERAM bindings
- rename spi-eeram to eeram
- Add Reviewed-by tag from Rob

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..2cdf6bf3dc4ab
@@ -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: Microchip 48l640 (and similar) serial EERAM bindings
+
+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>;
+
+      eeram@0 {
+        compatible = "microchip,48l640";
+        reg = <0>;
+        spi-max-frequency = <20000000>;
+      };
+    };
+...
Signature · 1 line
2.31.1
#3 lore raw

PATCH v4 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.

(no changes since v3)

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