mtd: devices: add support for microchip 48l640 EERAM
Subsystems (2)
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.
Heiko Schocher (2):
mtd: devices: add devicetree documentation for microchip 48l640
mtd: devices: add support for microchip 48l640 EERAM
.../bindings/mtd/microchip,mchp48l640.yaml | 40 ++ drivers/mtd/devices/Kconfig | 6 + drivers/mtd/devices/Makefile | 1 + drivers/mtd/devices/mchp48l640.c | 379 ++++++++++++++++++ 4 files changed, 426 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml create mode 100644 drivers/mtd/devices/mchp48l640.c
Signature · 1 line
2.30.2
PATCH 1/2 mtd: devices: add devicetree documentation for microchip 48l640
The Microchip 48l640 is a 8KByte EERAM connected via SPI. Add devicetree bindings documentation.
---
I must admit that I created the file
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml
by hand, looking into other yaml files...
Is there a way to check such a file to its correctness?
.../bindings/mtd/microchip,mchp48l640.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml new file +40 -0
@@ -0,0 +1,40 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +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 + +examples: + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + + spi-eeram@0 { + compatible = "microchip,48l640"; + reg = <0>; + spi-max-frequency = <20000000>; + }; + }; +...
Signature · 1 line
2.30.2
Rob Herring
maintainerRe: [PATCH v1 1/2] mtd: devices: add devicetree documentation for microchip 48l640
Quoted 9 lines · Heiko Schocher
The Microchip 48l640 is a 8KByte EERAM connected via SPI. Add devicetree bindings documentation.
Signed-off-by Heiko Schocher <[email protected]>---
I must admit that I created the file
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml
Quoted 8 lines
by hand, looking into other yaml files...
Is there a way to check such a file to its correctness?
.../bindings/mtd/microchip,mchp48l640.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
Traceback (most recent call last):
File "/usr/local/bin/dt-doc-validate", line 67, in <module>
ret = check_doc(f)
File "/usr/local/bin/dt-doc-validate", line 33, in check_doc
for error in sorted(dtschema.DTValidator.iter_schema_errors(testtree), key=lambda e: e.linecol):
File "/usr/local/lib/python3.8/dist-packages/dtschema/lib.py", line 723, in iter_schema_errors
meta_schema = cls.resolver.resolve_from_url(schema['$schema'])
KeyError: '$schema'
make[1]: *** Deleting file 'Documentation/devicetree/bindings/processed-schema-examples.json'
Traceback (most recent call last):
File "/usr/local/bin/dt-mk-schema", line 38, in <module>
schemas = dtschema.process_schemas(args.schemas, core_schema=(not args.useronly))
File "/usr/local/lib/python3.8/dist-packages/dtschema/lib.py", line 587, in process_schemas
sch = process_schema(os.path.abspath(filename))
File "/usr/local/lib/python3.8/dist-packages/dtschema/lib.py", line 568, in process_schema
DTValidator.check_schema(schema)
File "/usr/local/lib/python3.8/dist-packages/dtschema/lib.py", line 738, in check_schema
meta_schema = cls.resolver.resolve_from_url(schema['$schema'])
KeyError: '$schema'
make[1]: *** [Documentation/devicetree/bindings/Makefile:62: Documentation/devicetree/bindings/processed-schema-examples.json] Error 1
make: *** [Makefile:1416: dt_binding_check] Error 2
See https://patchwork.ozlabs.org/patch/1485038
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
Re: [PATCH v1 1/2] mtd: devices: add devicetree documentation for microchip 48l640
Hello Rob,
Quoted 52 lines · Rob Herring
Quoted 9 lines · Heiko Schocher
The Microchip 48l640 is a 8KByte EERAM connected via SPI. Add devicetree bindings documentation.
Signed-off-by Heiko Schocher <[email protected]>---
I must admit that I created the file
Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yamlQuoted 8 lines
by hand, looking into other yaml files...
Is there a way to check such a file to its correctness?
.../bindings/mtd/microchip,mchp48l640.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/microchip,mchp48l640.yamlMy bot found errors running 'make DT_CHECKER_FLAGS=-m
dt_binding_check' on your patch (DT_CHECKER_FLAGSis new in v5.13):yamllint warnings/errors:
dtschema/dtc warnings/errors:
Traceback (most recent call last):
File "/usr/local/bin/dt-doc-validate", line 67, in <module>
ret =check_doc(f)
File "/usr/local/bin/dt-doc-validate", line 33, incheck_doc
for error insorted(dtschema.DTValidator.iter_schema_errors(testtree), key=lambda e: e.linecol):
File "/usr/local/lib/python3.8/dist-packages/dtschema/lib.py", line 723, initer_schema_errors
meta_schema=cls.resolver.resolve_from_url(schema['$schema'])
KeyError: '$schema'
make[1]: *** Deleting file 'Documentation/devicetree/bindings/processed-schema-examples.json'
Traceback (most recent call last):
File "/usr/local/bin/dt-mk-schema", line 38, in <module>
schemas =dtschema.process_schemas(args.schemas, core_schema=(not args.useronly))
File "/usr/local/lib/python3.8/dist-packages/dtschema/lib.py", line 587, inprocess_schemas
sch = process_schema(os.path.abspath(filename))
File "/usr/local/lib/python3.8/dist-packages/dtschema/lib.py", line 568, inprocess_schema
DTValidator.check_schema(schema)
File "/usr/local/lib/python3.8/dist-packages/dtschema/lib.py", line 738, incheck_schema
meta_schema=cls.resolver.resolve_from_url(schema['$schema'])
KeyError: '$schema'
make[1]: *** [Documentation/devicetree/bindings/Makefile:62:Documentation/devicetree/bindings/processed-schema-examples.json] Error 1
make: *** [Makefile:1416:dt_binding_check] Error 2See https://patchwork.ozlabs.org/patch/1485038
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
Quoted 7 lines
If you already ran 'make
dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:pip3 install dtschema --upgrade
Please check and re-submit.
I just setup this stuff, and have now a
'make DT_CHECKER_FLAGS=-m dt_binding_check'
running without warnings from my new yaml file.
Thanks for your help!
Will send a v2 soon...
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]
PATCH 2/2 mtd: devices: add support for microchip 48l640 EERAM
In reply to Heiko SchocherThe 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.
drivers/mtd/devices/Kconfig | 6 + drivers/mtd/devices/Makefile | 1 + drivers/mtd/devices/mchp48l640.c | 379 +++++++++++++++++++++++++++++++ 3 files changed, 386 insertions(+) create mode 100644 drivers/mtd/devices/mchp48l640.c
drivers/mtd/devices/Kconfig +6 -0
@@ -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
@@ -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 +379 -0
379 lines not on this page · raw message
Signature · 1 line
2.30.2
Hi Heiko,
Quoted 18 lines · Heiko Schocher
The Microchip 48l640 is a 8KByte EERAM connected via SPI.
Signed-off-by Heiko Schocher <[email protected]>---
I tried to usedrivers/mtd/devices/mchp23k256.cbut 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?
Quoted 6 lines
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.
Works for me too on an imx7d based board, thanks: