External ECC engines & Macronix support
Subsystems (5)
Miquel Raynal
maintainerv2 cover External ECC engines & Macronix support
Hello all,
This series is now stable and brings support for external/modular ECC engines, and let SPI controller using the ECC framework.
As a first example, Macronix ECC engine can be used as an external engine (takes the data, proceeds to the calculations, writes back the ECC bytes) or as a pipelined engine doing on-the-fly calculations (which is very common in the raw NAND world).
In the device tree, the ECC engine should be described as a separated DT node. Then:
* external case: the flash node should provide a nand-ecc-engine property pointing to the ECC engine node.
* pipelined case: the flash node should provide a nand-ecc-engine property pointing to the SPI controller, itself with another nand-ecc-engine property pointing at the ECC engine node.
This series comes with a bunch of improvements on the binding side as well.
Cheers,
Miquèl
Changes in v2:
* Fixed the bindings and added Rob's acks when relevant.
* Added locking in the ECC engine driver.
* Brought more changes in the core in order to bring the ECC information into the spi_mem_op structure with the idea of avoiding any races between parallel calls on the same engine.
* Reorganized the ECC driver entirely in order to have a per-engine mxic structure plus a per-NAND context. This lead to a number of changes internally which cannot all be listed.
Changes since the RFC:
* Rebased on top of v5.15-rc1.
* Fixed the dirmap configuration.
* Added the various tags received.
* Fixed the bindings as reported by the robots.
* Fixed the return value of the helper counting bitflips.
* Included a fix from Jaime Liao in the external pattern logic.
* Added the yaml conversion of Macronix SPI controller description.
* Added the yaml conversion of the SPI-NAND description.
* Created a nand-chip.yaml file to share properties between SPI-NAND and raw NAND.
Mason Yang (1):
mtd: spinand: macronix: Use random program load
Miquel Raynal (19):
dt-bindings: mtd: nand-controller: Fix the reg property description
dt-bindings: mtd: nand-controller: Fix a comment in the examples
dt-bindings: mtd: nand-chip: Create a NAND chip description
dt-bindings: mtd: spi-nand: Convert spi-nand description file to yaml
dt-bindings: vendor-prefixes: Clarify Macronix prefix
dt-bindings: spi: mxic: The interrupt property is not mandatory
dt-bindings: spi: mxic: Convert to yaml
dt-bindings: spi: mxic: Document the nand-ecc-engine property
dt-bindings: mtd: Describe Macronix NAND ECC engine
mtd: nand: ecc: Add infrastructure to support hardware engines
mtd: nand: Add a new helper to retrieve the ECC context
mtd: nand: mxic-ecc: Add Macronix external ECC engine support
mtd: nand: mxic-ecc: Support SPI pipelined mode
mtd: spinand: Create direct mapping descriptors for ECC operations
spi: mxic: Fix the transmit path
spi: mxic: Create a helper to configure the controller before an
operation
spi: mxic: Create a helper to ease the start of an operation
spi: mxic: Add support for direct mapping
spi: mxic: Add support for pipelined ECC operations
.../bindings/mtd/mxicy,nand-ecc-engine.yaml | 77 ++ .../devicetree/bindings/mtd/nand-chip.yaml | 71 ++ .../bindings/mtd/nand-controller.yaml | 57 +- .../devicetree/bindings/mtd/spi-nand.txt | 5 - .../devicetree/bindings/mtd/spi-nand.yaml | 27 + .../bindings/spi/mxicy,mx25f0a-spi.yaml | 66 ++ .../devicetree/bindings/spi/spi-mxic.txt | 34 - .../devicetree/bindings/vendor-prefixes.yaml | 3 + drivers/mtd/nand/Kconfig | 6 + drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/core.c | 10 +- drivers/mtd/nand/ecc-mxic.c | 901 ++++++++++++++++++ drivers/mtd/nand/ecc.c | 88 ++ drivers/mtd/nand/spi/core.c | 28 +- drivers/mtd/nand/spi/macronix.c | 2 +- drivers/spi/spi-mxic.c | 326 ++++++- include/linux/mtd/nand-ecc-mxic.h | 50 + include/linux/mtd/nand.h | 33 + include/linux/mtd/spinand.h | 2 + include/linux/spi/spi-mem.h | 3 + 20 files changed, 1642 insertions(+), 148 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/mxicy,nand-ecc-engine.yaml create mode 100644 Documentation/devicetree/bindings/mtd/nand-chip.yaml delete mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.txt create mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.yaml create mode 100644 Documentation/devicetree/bindings/spi/mxicy,mx25f0a-spi.yaml delete mode 100644 Documentation/devicetree/bindings/spi/spi-mxic.txt create mode 100644 drivers/mtd/nand/ecc-mxic.c create mode 100644 include/linux/mtd/nand-ecc-mxic.h
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 1/20 dt-bindings: mtd: nand-controller: Fix the reg property description
The reg property of a NAND device always references the chip-select(s). The ready/busy lines are described in the nand-rb property. I believe this was a harmless copy/paste error during the conversion to yaml.
--- Documentation/devicetree/bindings/mtd/nand-controller.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/mtd/nand-controller.yaml +1 -1
@@ -55,7 +55,7 @@ patternProperties: properties: reg: description: - Contains the native Ready/Busy IDs. + Contains the chip-select IDs. nand-ecc-engine: allOf:
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 2/20 dt-bindings: mtd: nand-controller: Fix a comment in the examples
In reply to Miquel RaynalThe controller properties should be in the controller 'parent' node, while properties in the children nodes are specific to the NAND *chip*. This error was already present during the yaml conversion.
--- Documentation/devicetree/bindings/mtd/nand-controller.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/mtd/nand-controller.yaml +1 -1
@@ -184,7 +184,7 @@ examples: nand-use-soft-ecc-engine; nand-ecc-algo = "bch"; - /* controller specific properties */ + /* NAND chip specific properties */ }; nand@1 {
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 3/20 dt-bindings: mtd: nand-chip: Create a NAND chip description
In reply to Miquel RaynalMove the NAND chip description out of the NAND controller file. Indeed, a subsequent part of the properties supported by a raw NAND chip are also supported by SPI-NAND chips. So let's create a generic NAND chip description which will be pulled by nand-controller.yaml and later by spi-nand.yaml as well.
--- .../devicetree/bindings/mtd/nand-chip.yaml | 71 +++++++++++++++++++ .../bindings/mtd/nand-controller.yaml | 53 ++------------ 2 files changed, 75 insertions(+), 49 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/nand-chip.yaml
Documentation/devicetree/bindings/mtd/nand-chip.yaml new file +71 -0
@@ -0,0 +1,71 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/nand-chip.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NAND Chip and NAND Controller Generic Binding + +maintainers: + - Miquel Raynal <[email protected]> + +description: | + This file covers the generic description of a NAND chip. It implies that the + bus interface should not be taken into account: both raw NAND devices and + SPI-NAND devices are concerned by this description. + +properties: + reg: + description: + Contains the chip-select IDs. + + nand-ecc-engine: + allOf: + - $ref: /schemas/types.yaml#/definitions/phandle + description: | + A phandle on the hardware ECC engine if any. There are + basically three possibilities: + 1/ The ECC engine is part of the NAND controller, in this + case the phandle should reference the parent node. + 2/ The ECC engine is part of the NAND part (on-die), in this + case the phandle should reference the node itself. + 3/ The ECC engine is external, in this case the phandle should + reference the specific ECC engine node. + + nand-use-soft-ecc-engine: + type: boolean + description: Use a software ECC engine. + + nand-no-ecc-engine: + type: boolean + description: Do not use any ECC correction. + + nand-ecc-algo: + description: + Desired ECC algorithm. + $ref: /schemas/types.yaml#/definitions/string + enum: [hamming, bch, rs] + + nand-ecc-strength: + description: + Maximum number of bits that can be corrected per ECC step. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + + nand-ecc-step-size: + description: + Number of data bytes covered by a single ECC step. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + + secure-regions: + $ref: /schemas/types.yaml#/definitions/uint64-matrix + description: + Regions in the NAND chip which are protected using a secure element + like Trustzone. This property contains the start address and size of + the secure regions present. + +required: + - reg + +additionalProperties: true
Documentation/devicetree/bindings/mtd/nand-controller.yaml +4 -49
88 lines not on this page · raw message
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Rob Herring
maintainerRe: [PATCH v2 03/20] dt-bindings: mtd: nand-chip: Create a NAND chip description
Quoted 6 lines · Miquel Raynal
Move the NAND chip description out of the NAND controller file. Indeed, a subsequent part of the properties supported by a raw NAND chip are also supported by SPI-NAND chips. So let's create a generic NAND chip description which will be pulled by
nand-controller.yamland later byspi-nand.yamlas well.
Quoted 7 lines
Signed-off-by Miquel Raynal <[email protected]>--- .../devicetree/bindings/mtd/nand-chip.yaml | 71 +++++++++++++++++++ .../bindings/mtd/nand-controller.yaml | 53 ++------------ 2 files changed, 75 insertions(+), 49 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/nand-chip.yaml
Running 'make dtbs_check' with the schema in this patch gives the following warnings. Consider if they are expected or the schema is incorrect. These may not be new warnings.
Note that it is not yet a requirement to have 0 warnings for dtbs_check. This will change in the future.
Full log is available here: https://patchwork.ozlabs.org/patch/1560072
nand-controller@112000: '#address-cells' is a required property
arch/arm/boot/dts/imx6dl-aristainetos2_4.dt.yaml arch/arm/boot/dts/imx6dl-aristainetos2_7.dt.yaml arch/arm/boot/dts/imx6dl-aristainetos_4.dt.yaml arch/arm/boot/dts/imx6dl-aristainetos_7.dt.yaml arch/arm/boot/dts/imx6dl-gw51xx.dt.yaml arch/arm/boot/dts/imx6dl-gw52xx.dt.yaml arch/arm/boot/dts/imx6dl-gw53xx.dt.yaml arch/arm/boot/dts/imx6dl-gw54xx.dt.yaml arch/arm/boot/dts/imx6dl-gw551x.dt.yaml arch/arm/boot/dts/imx6dl-gw552x.dt.yaml arch/arm/boot/dts/imx6dl-gw553x.dt.yaml arch/arm/boot/dts/imx6dl-gw5907.dt.yaml arch/arm/boot/dts/imx6dl-gw5910.dt.yaml arch/arm/boot/dts/imx6dl-gw5912.dt.yaml arch/arm/boot/dts/imx6dl-gw5913.dt.yaml arch/arm/boot/dts/imx6dl-icore.dt.yaml arch/arm/boot/dts/imx6dl-icore-mipi.dt.yaml arch/arm/boot/dts/imx6dl-phytec-mira-rdk-nand.dt.yaml arch/arm/boot/dts/imx6dl-phytec-pbab01.dt.yaml arch/arm/boot/dts/imx6dl-sabreauto.dt.yaml arch/arm/boot/dts/imx6dl-tx6dl-comtft.dt.yaml arch/arm/boot/dts/imx6dl-tx6s-8034.dt.yaml arch/arm/boot/dts/imx6dl-tx6s-8034-mb7.dt.yaml arch/arm/boot/dts/imx6dl-tx6u-801x.dt.yaml arch/arm/boot/dts/imx6dl-tx6u-80xx-mb7.dt.yaml arch/arm/boot/dts/imx6dl-tx6u-811x.dt.yaml arch/arm/boot/dts/imx6dl-tx6u-81xx-mb7.dt.yaml arch/arm/boot/dts/imx6q-cm-fx6.dt.yaml arch/arm/boot/dts/imx6q-evi.dt.yaml arch/arm/boot/dts/imx6q-gw51xx.dt.yaml arch/arm/boot/dts/imx6q-gw52xx.dt.yaml arch/arm/boot/dts/imx6q-gw53xx.dt.yaml arch/arm/boot/dts/imx6q-gw54xx.dt.yaml arch/arm/boot/dts/imx6q-gw551x.dt.yaml arch/arm/boot/dts/imx6q-gw552x.dt.yaml arch/arm/boot/dts/imx6q-gw553x.dt.yaml arch/arm/boot/dts/imx6q-gw5907.dt.yaml arch/arm/boot/dts/imx6q-gw5910.dt.yaml arch/arm/boot/dts/imx6q-gw5912.dt.yaml arch/arm/boot/dts/imx6q-gw5913.dt.yaml arch/arm/boot/dts/imx6q-icore.dt.yaml arch/arm/boot/dts/imx6q-icore-mipi.dt.yaml arch/arm/boot/dts/imx6q-icore-ofcap10.dt.yaml arch/arm/boot/dts/imx6q-icore-ofcap12.dt.yaml arch/arm/boot/dts/imx6q-logicpd.dt.yaml arch/arm/boot/dts/imx6q-phytec-mira-rdk-nand.dt.yaml arch/arm/boot/dts/imx6q-phytec-pbab01.dt.yaml arch/arm/boot/dts/imx6qp-phytec-mira-rdk-nand.dt.yaml arch/arm/boot/dts/imx6qp-sabreauto.dt.yaml arch/arm/boot/dts/imx6q-sabreauto.dt.yaml arch/arm/boot/dts/imx6q-tx6q-1010-comtft.dt.yaml arch/arm/boot/dts/imx6q-tx6q-1010.dt.yaml arch/arm/boot/dts/imx6q-tx6q-10x0-mb7.dt.yaml arch/arm/boot/dts/imx6q-tx6q-1110.dt.yaml arch/arm/boot/dts/imx6q-tx6q-11x0-mb7.dt.yaml arch/arm/boot/dts/imx6q-utilite-pro.dt.yaml
nand-controller@112000: '#size-cells' is a required property
arch/arm/boot/dts/imx6dl-aristainetos2_4.dt.yaml arch/arm/boot/dts/imx6dl-aristainetos2_7.dt.yaml arch/arm/boot/dts/imx6dl-aristainetos_4.dt.yaml arch/arm/boot/dts/imx6dl-aristainetos_7.dt.yaml arch/arm/boot/dts/imx6dl-gw51xx.dt.yaml arch/arm/boot/dts/imx6dl-gw52xx.dt.yaml arch/arm/boot/dts/imx6dl-gw53xx.dt.yaml arch/arm/boot/dts/imx6dl-gw54xx.dt.yaml arch/arm/boot/dts/imx6dl-gw551x.dt.yaml arch/arm/boot/dts/imx6dl-gw552x.dt.yaml arch/arm/boot/dts/imx6dl-gw553x.dt.yaml arch/arm/boot/dts/imx6dl-gw5907.dt.yaml arch/arm/boot/dts/imx6dl-gw5910.dt.yaml arch/arm/boot/dts/imx6dl-gw5912.dt.yaml arch/arm/boot/dts/imx6dl-gw5913.dt.yaml arch/arm/boot/dts/imx6dl-icore.dt.yaml arch/arm/boot/dts/imx6dl-icore-mipi.dt.yaml arch/arm/boot/dts/imx6dl-phytec-mira-rdk-nand.dt.yaml arch/arm/boot/dts/imx6dl-phytec-pbab01.dt.yaml arch/arm/boot/dts/imx6dl-sabreauto.dt.yaml arch/arm/boot/dts/imx6dl-tx6dl-comtft.dt.yaml arch/arm/boot/dts/imx6dl-tx6s-8034.dt.yaml arch/arm/boot/dts/imx6dl-tx6s-8034-mb7.dt.yaml arch/arm/boot/dts/imx6dl-tx6u-801x.dt.yaml arch/arm/boot/dts/imx6dl-tx6u-80xx-mb7.dt.yaml arch/arm/boot/dts/imx6dl-tx6u-811x.dt.yaml arch/arm/boot/dts/imx6dl-tx6u-81xx-mb7.dt.yaml arch/arm/boot/dts/imx6q-cm-fx6.dt.yaml arch/arm/boot/dts/imx6q-evi.dt.yaml arch/arm/boot/dts/imx6q-gw51xx.dt.yaml arch/arm/boot/dts/imx6q-gw52xx.dt.yaml arch/arm/boot/dts/imx6q-gw53xx.dt.yaml arch/arm/boot/dts/imx6q-gw54xx.dt.yaml arch/arm/boot/dts/imx6q-gw551x.dt.yaml arch/arm/boot/dts/imx6q-gw552x.dt.yaml arch/arm/boot/dts/imx6q-gw553x.dt.yaml arch/arm/boot/dts/imx6q-gw5907.dt.yaml arch/arm/boot/dts/imx6q-gw5910.dt.yaml arch/arm/boot/dts/imx6q-gw5912.dt.yaml arch/arm/boot/dts/imx6q-gw5913.dt.yaml arch/arm/boot/dts/imx6q-icore.dt.yaml arch/arm/boot/dts/imx6q-icore-mipi.dt.yaml arch/arm/boot/dts/imx6q-icore-ofcap10.dt.yaml arch/arm/boot/dts/imx6q-icore-ofcap12.dt.yaml arch/arm/boot/dts/imx6q-logicpd.dt.yaml arch/arm/boot/dts/imx6q-phytec-mira-rdk-nand.dt.yaml arch/arm/boot/dts/imx6q-phytec-pbab01.dt.yaml arch/arm/boot/dts/imx6qp-phytec-mira-rdk-nand.dt.yaml arch/arm/boot/dts/imx6qp-sabreauto.dt.yaml arch/arm/boot/dts/imx6q-sabreauto.dt.yaml arch/arm/boot/dts/imx6q-tx6q-1010-comtft.dt.yaml arch/arm/boot/dts/imx6q-tx6q-1010.dt.yaml arch/arm/boot/dts/imx6q-tx6q-10x0-mb7.dt.yaml arch/arm/boot/dts/imx6q-tx6q-1110.dt.yaml arch/arm/boot/dts/imx6q-tx6q-11x0-mb7.dt.yaml arch/arm/boot/dts/imx6q-utilite-pro.dt.yaml
nand-controller@18028000: nand@0:nand-ecc-algo:0: 'hw' is not one of ['hamming', 'bch', 'rs']
arch/arm/boot/dts/bcm53016-meraki-mr32.dt.yaml
nand-controller@1806000: #size-cells:0:0: 0 was expected
arch/arm/boot/dts/imx6sx-nitrogen6sx.dt.yaml arch/arm/boot/dts/imx6sx-sabreauto.dt.yaml arch/arm/boot/dts/imx6sx-sdb.dt.yaml arch/arm/boot/dts/imx6sx-sdb-mqs.dt.yaml arch/arm/boot/dts/imx6sx-sdb-reva.dt.yaml arch/arm/boot/dts/imx6sx-sdb-sai.dt.yaml arch/arm/boot/dts/imx6sx-softing-vining-2000.dt.yaml arch/arm/boot/dts/imx6sx-udoo-neo-basic.dt.yaml arch/arm/boot/dts/imx6sx-udoo-neo-extended.dt.yaml arch/arm/boot/dts/imx6sx-udoo-neo-full.dt.yaml arch/arm/boot/dts/imx6ul-14x14-evk.dt.yaml arch/arm/boot/dts/imx6ul-ccimx6ulsbcexpress.dt.yaml arch/arm/boot/dts/imx6ul-ccimx6ulsbcpro.dt.yaml arch/arm/boot/dts/imx6ul-geam.dt.yaml arch/arm/boot/dts/imx6ul-isiot-emmc.dt.yaml arch/arm/boot/dts/imx6ul-isiot-nand.dt.yaml arch/arm/boot/dts/imx6ul-kontron-n6310-s-43.dt.yaml arch/arm/boot/dts/imx6ul-kontron-n6310-s.dt.yaml arch/arm/boot/dts/imx6ull-14x14-evk.dt.yaml arch/arm/boot/dts/imx6ull-colibri-emmc-eval-v3.dt.yaml arch/arm/boot/dts/imx6ull-colibri-eval-v3.dt.yaml arch/arm/boot/dts/imx6ull-colibri-wifi-eval-v3.dt.yaml arch/arm/boot/dts/imx6ul-liteboard.dt.yaml arch/arm/boot/dts/imx6ull-myir-mys-6ulx-eval.dt.yaml arch/arm/boot/dts/imx6ull-opos6uldev.dt.yaml arch/arm/boot/dts/imx6ull-phytec-segin-ff-rdk-emmc.dt.yaml arch/arm/boot/dts/imx6ull-phytec-segin-ff-rdk-nand.dt.yaml arch/arm/boot/dts/imx6ull-phytec-segin-lc-rdk-nand.dt.yaml arch/arm/boot/dts/imx6ul-opos6uldev.dt.yaml arch/arm/boot/dts/imx6ul-phytec-segin-ff-rdk-emmc.dt.yaml arch/arm/boot/dts/imx6ul-phytec-segin-ff-rdk-nand.dt.yaml arch/arm/boot/dts/imx6ul-pico-dwarf.dt.yaml arch/arm/boot/dts/imx6ul-pico-hobbit.dt.yaml arch/arm/boot/dts/imx6ul-pico-pi.dt.yaml arch/arm/boot/dts/imx6ul-prti6g.dt.yaml arch/arm/boot/dts/imx6ul-tx6ul-0010.dt.yaml arch/arm/boot/dts/imx6ul-tx6ul-0011.dt.yaml arch/arm/boot/dts/imx6ul-tx6ul-mainboard.dt.yaml arch/arm/boot/dts/imx6ulz-14x14-evk.dt.yaml
nand-controller@1b30000: nand@0:secure-regions: More than one condition true in oneOf schema:
arch/arm/boot/dts/qcom-sdx55-t55.dt.yaml arch/arm/boot/dts/qcom-sdx55-telit-fn980-tlb.dt.yaml
nand-controller@33002000: #size-cells:0:0: 0 was expected
arch/arm64/boot/dts/freescale/imx8mm-beacon-kit.dt.yaml arch/arm64/boot/dts/freescale/imx8mm-ddr4-evk.dt.yaml arch/arm64/boot/dts/freescale/imx8mm-evk.dt.yaml arch/arm64/boot/dts/freescale/imx8mm-icore-mx8mm-ctouch2.dt.yaml arch/arm64/boot/dts/freescale/imx8mm-icore-mx8mm-edimm2.2.dt.yaml arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dt.yaml arch/arm64/boot/dts/freescale/imx8mm-nitrogen-r2.dt.yaml arch/arm64/boot/dts/freescale/imx8mm-var-som-symphony.dt.yaml arch/arm64/boot/dts/freescale/imx8mm-venice-gw71xx-0x.dt.yaml arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x.dt.yaml arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x.dt.yaml arch/arm64/boot/dts/freescale/imx8mm-venice-gw7901.dt.yaml arch/arm64/boot/dts/freescale/imx8mm-venice-gw7902.dt.yaml arch/arm64/boot/dts/freescale/imx8mn-beacon-kit.dt.yaml arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dt.yaml arch/arm64/boot/dts/freescale/imx8mn-evk.dt.yaml arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dt.yaml arch/arm64/boot/dts/freescale/imx8mn-venice-gw7902.dt.yaml arch/arm/boot/dts/imx7d-cl-som-imx7.dt.yaml arch/arm/boot/dts/imx7d-colibri-aster.dt.yaml arch/arm/boot/dts/imx7d-colibri-emmc-aster.dt.yaml arch/arm/boot/dts/imx7d-colibri-emmc-eval-v3.dt.yaml arch/arm/boot/dts/imx7d-colibri-eval-v3.dt.yaml arch/arm/boot/dts/imx7d-flex-concentrator.dt.yaml arch/arm/boot/dts/imx7d-flex-concentrator-mfg.dt.yaml arch/arm/boot/dts/imx7d-mba7.dt.yaml arch/arm/boot/dts/imx7d-meerkat96.dt.yaml arch/arm/boot/dts/imx7d-nitrogen7.dt.yaml arch/arm/boot/dts/imx7d-pico-dwarf.dt.yaml arch/arm/boot/dts/imx7d-pico-hobbit.dt.yaml arch/arm/boot/dts/imx7d-pico-nymph.dt.yaml arch/arm/boot/dts/imx7d-pico-pi.dt.yaml arch/arm/boot/dts/imx7d-remarkable2.dt.yaml arch/arm/boot/dts/imx7d-sbc-imx7.dt.yaml arch/arm/boot/dts/imx7d-sdb.dt.yaml arch/arm/boot/dts/imx7d-sdb-reva.dt.yaml arch/arm/boot/dts/imx7d-sdb-sht11.dt.yaml arch/arm/boot/dts/imx7d-zii-rmu2.dt.yaml arch/arm/boot/dts/imx7d-zii-rpu2.dt.yaml arch/arm/boot/dts/imx7s-colibri-aster.dt.yaml arch/arm/boot/dts/imx7s-colibri-eval-v3.dt.yaml arch/arm/boot/dts/imx7s-mba7.dt.yaml arch/arm/boot/dts/imx7s-warp.dt.yaml
nand-controller@8000c000: #size-cells:0:0: 0 was expected
arch/arm/boot/dts/imx23-evk.dt.yaml arch/arm/boot/dts/imx23-olinuxino.dt.yaml arch/arm/boot/dts/imx23-sansa.dt.yaml arch/arm/boot/dts/imx23-stmp378x_devb.dt.yaml arch/arm/boot/dts/imx23-xfi3.dt.yaml arch/arm/boot/dts/imx28-apf28dev.dt.yaml arch/arm/boot/dts/imx28-apf28.dt.yaml arch/arm/boot/dts/imx28-apx4devkit.dt.yaml arch/arm/boot/dts/imx28-cfa10036.dt.yaml arch/arm/boot/dts/imx28-cfa10037.dt.yaml arch/arm/boot/dts/imx28-cfa10049.dt.yaml arch/arm/boot/dts/imx28-cfa10055.dt.yaml arch/arm/boot/dts/imx28-cfa10056.dt.yaml arch/arm/boot/dts/imx28-cfa10057.dt.yaml arch/arm/boot/dts/imx28-cfa10058.dt.yaml arch/arm/boot/dts/imx28-duckbill-2-485.dt.yaml arch/arm/boot/dts/imx28-duckbill-2.dt.yaml arch/arm/boot/dts/imx28-duckbill-2-enocean.dt.yaml arch/arm/boot/dts/imx28-duckbill-2-spi.dt.yaml arch/arm/boot/dts/imx28-duckbill.dt.yaml arch/arm/boot/dts/imx28-eukrea-mbmx283lc.dt.yaml arch/arm/boot/dts/imx28-eukrea-mbmx287lc.dt.yaml arch/arm/boot/dts/imx28-evk.dt.yaml arch/arm/boot/dts/imx28-m28cu3.dt.yaml arch/arm/boot/dts/imx28-m28evk.dt.yaml arch/arm/boot/dts/imx28-sps1.dt.yaml arch/arm/boot/dts/imx28-ts4600.dt.yaml arch/arm/boot/dts/imx28-tx28.dt.yaml arch/arm/boot/dts/imx28-xea.dt.yaml
nand-controller: #address-cells:0:0: 1 was expected
arch/arm/boot/dts/aks-cdu.dt.yaml arch/arm/boot/dts/animeo_ip.dt.yaml arch/arm/boot/dts/at91-ariag25.dt.yaml arch/arm/boot/dts/at91-ariettag25.dt.yaml arch/arm/boot/dts/at91-cosino_mega2560.dt.yaml arch/arm/boot/dts/at91-dvk_som60.dt.yaml arch/arm/boot/dts/at91-foxg20.dt.yaml arch/arm/boot/dts/at91-gatwick.dt.yaml arch/arm/boot/dts/at91-kizbox2-2.dt.yaml arch/arm/boot/dts/at91-kizbox3-hs.dt.yaml arch/arm/boot/dts/at91-kizbox.dt.yaml arch/arm/boot/dts/at91-kizboxmini-base.dt.yaml arch/arm/boot/dts/at91-kizboxmini-mb.dt.yaml arch/arm/boot/dts/at91-kizboxmini-rd.dt.yaml arch/arm/boot/dts/at91-lmu5000.dt.yaml arch/arm/boot/dts/at91-nattis-2-natte-2.dt.yaml arch/arm/boot/dts/at91-q5xr5.dt.yaml arch/arm/boot/dts/at91-qil_a9260.dt.yaml arch/arm/boot/dts/at91sam9260ek.dt.yaml arch/arm/boot/dts/at91sam9261ek.dt.yaml arch/arm/boot/dts/at91sam9263ek.dt.yaml arch/arm/boot/dts/at91sam9263ek.dt.yaml arch/arm/boot/dts/at91sam9g15ek.dt.yaml arch/arm/boot/dts/at91sam9g20ek_2mmc.dt.yaml arch/arm/boot/dts/at91sam9g20ek.dt.yaml arch/arm/boot/dts/at91sam9g25ek.dt.yaml arch/arm/boot/dts/at91sam9g25-gardena-smart-gateway.dt.yaml arch/arm/boot/dts/at91sam9g35ek.dt.yaml arch/arm/boot/dts/at91-sam9_l9260.dt.yaml arch/arm/boot/dts/at91sam9m10g45ek.dt.yaml arch/arm/boot/dts/at91sam9n12ek.dt.yaml arch/arm/boot/dts/at91sam9rlek.dt.yaml arch/arm/boot/dts/at91sam9x25ek.dt.yaml arch/arm/boot/dts/at91sam9x35ek.dt.yaml arch/arm/boot/dts/at91-sam9x60ek.dt.yaml arch/arm/boot/dts/at91-sama5d27_som1_ek.dt.yaml arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dt.yaml arch/arm/boot/dts/at91-sama5d2_icp.dt.yaml arch/arm/boot/dts/at91-sama5d2_ptc_ek.dt.yaml arch/arm/boot/dts/at91-sama5d2_xplained.dt.yaml arch/arm/boot/dts/at91-sama5d3_xplained.dt.yaml arch/arm/boot/dts/at91-sama5d4ek.dt.yaml arch/arm/boot/dts/at91-sama5d4_ma5d4evk.dt.yaml arch/arm/boot/dts/at91-sama5d4_xplained.dt.yaml arch/arm/boot/dts/at91-smartkiz.dt.yaml arch/arm/boot/dts/at91-tse850-3.dt.yaml arch/arm/boot/dts/at91-vinco.dt.yaml arch/arm/boot/dts/at91-wb45n.dt.yaml arch/arm/boot/dts/at91-wb50n.dt.yaml arch/arm/boot/dts/ethernut5.dt.yaml arch/arm/boot/dts/evk-pro3.dt.yaml arch/arm/boot/dts/pm9g45.dt.yaml arch/arm/boot/dts/sama5d31ek.dt.yaml arch/arm/boot/dts/sama5d33ek.dt.yaml arch/arm/boot/dts/sama5d34ek.dt.yaml arch/arm/boot/dts/sama5d35ek.dt.yaml arch/arm/boot/dts/sama5d36ek_cmp.dt.yaml arch/arm/boot/dts/sama5d36ek.dt.yaml arch/arm/boot/dts/tny_a9260.dt.yaml arch/arm/boot/dts/tny_a9263.dt.yaml arch/arm/boot/dts/tny_a9263.dt.yaml arch/arm/boot/dts/tny_a9g20.dt.yaml arch/arm/boot/dts/usb_a9260.dt.yaml arch/arm/boot/dts/usb_a9263.dt.yaml arch/arm/boot/dts/usb_a9263.dt.yaml arch/arm/boot/dts/usb_a9g20.dt.yaml arch/arm/boot/dts/usb_a9g20_lpw.dt.yaml
nand-controller@d8000000: #size-cells:0:0: 0 was expected
arch/arm/boot/dts/imx27-apf27dev.dt.yaml arch/arm/boot/dts/imx27-apf27.dt.yaml arch/arm/boot/dts/imx27-eukrea-mbimxsd27-baseboard.dt.yaml arch/arm/boot/dts/imx27-pdk.dt.yaml arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dt.yaml arch/arm/boot/dts/imx27-phytec-phycore-rdk.dt.yaml
nand-controller: #size-cells:0:0: 0 was expected
arch/arm/boot/dts/aks-cdu.dt.yaml arch/arm/boot/dts/animeo_ip.dt.yaml arch/arm/boot/dts/at91-ariag25.dt.yaml arch/arm/boot/dts/at91-ariettag25.dt.yaml arch/arm/boot/dts/at91-cosino_mega2560.dt.yaml arch/arm/boot/dts/at91-dvk_som60.dt.yaml arch/arm/boot/dts/at91-foxg20.dt.yaml arch/arm/boot/dts/at91-gatwick.dt.yaml arch/arm/boot/dts/at91-kizbox2-2.dt.yaml arch/arm/boot/dts/at91-kizbox3-hs.dt.yaml arch/arm/boot/dts/at91-kizbox.dt.yaml arch/arm/boot/dts/at91-kizboxmini-base.dt.yaml arch/arm/boot/dts/at91-kizboxmini-mb.dt.yaml arch/arm/boot/dts/at91-kizboxmini-rd.dt.yaml arch/arm/boot/dts/at91-lmu5000.dt.yaml arch/arm/boot/dts/at91-nattis-2-natte-2.dt.yaml arch/arm/boot/dts/at91-q5xr5.dt.yaml arch/arm/boot/dts/at91-qil_a9260.dt.yaml arch/arm/boot/dts/at91sam9260ek.dt.yaml arch/arm/boot/dts/at91sam9261ek.dt.yaml arch/arm/boot/dts/at91sam9263ek.dt.yaml arch/arm/boot/dts/at91sam9263ek.dt.yaml arch/arm/boot/dts/at91sam9g15ek.dt.yaml arch/arm/boot/dts/at91sam9g20ek_2mmc.dt.yaml arch/arm/boot/dts/at91sam9g20ek.dt.yaml arch/arm/boot/dts/at91sam9g25ek.dt.yaml arch/arm/boot/dts/at91sam9g25-gardena-smart-gateway.dt.yaml arch/arm/boot/dts/at91sam9g35ek.dt.yaml arch/arm/boot/dts/at91-sam9_l9260.dt.yaml arch/arm/boot/dts/at91sam9m10g45ek.dt.yaml arch/arm/boot/dts/at91sam9n12ek.dt.yaml arch/arm/boot/dts/at91sam9rlek.dt.yaml arch/arm/boot/dts/at91sam9x25ek.dt.yaml arch/arm/boot/dts/at91sam9x35ek.dt.yaml arch/arm/boot/dts/at91-sam9x60ek.dt.yaml arch/arm/boot/dts/at91-sama5d27_som1_ek.dt.yaml arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dt.yaml arch/arm/boot/dts/at91-sama5d2_icp.dt.yaml arch/arm/boot/dts/at91-sama5d2_ptc_ek.dt.yaml arch/arm/boot/dts/at91-sama5d2_xplained.dt.yaml arch/arm/boot/dts/at91-sama5d3_xplained.dt.yaml arch/arm/boot/dts/at91-sama5d4ek.dt.yaml arch/arm/boot/dts/at91-sama5d4_ma5d4evk.dt.yaml arch/arm/boot/dts/at91-sama5d4_xplained.dt.yaml arch/arm/boot/dts/at91-smartkiz.dt.yaml arch/arm/boot/dts/at91-tse850-3.dt.yaml arch/arm/boot/dts/at91-vinco.dt.yaml arch/arm/boot/dts/at91-wb45n.dt.yaml arch/arm/boot/dts/at91-wb50n.dt.yaml arch/arm/boot/dts/ethernut5.dt.yaml arch/arm/boot/dts/evk-pro3.dt.yaml arch/arm/boot/dts/pm9g45.dt.yaml arch/arm/boot/dts/sama5d31ek.dt.yaml arch/arm/boot/dts/sama5d33ek.dt.yaml arch/arm/boot/dts/sama5d34ek.dt.yaml arch/arm/boot/dts/sama5d35ek.dt.yaml arch/arm/boot/dts/sama5d36ek_cmp.dt.yaml arch/arm/boot/dts/sama5d36ek.dt.yaml arch/arm/boot/dts/tny_a9260.dt.yaml arch/arm/boot/dts/tny_a9263.dt.yaml arch/arm/boot/dts/tny_a9263.dt.yaml arch/arm/boot/dts/tny_a9g20.dt.yaml arch/arm/boot/dts/usb_a9260.dt.yaml arch/arm/boot/dts/usb_a9263.dt.yaml arch/arm/boot/dts/usb_a9263.dt.yaml arch/arm/boot/dts/usb_a9g20.dt.yaml arch/arm/boot/dts/usb_a9g20_lpw.dt.yaml
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH v2 03/20] dt-bindings: mtd: nand-chip: Create a NAND chip description
In reply to Miquel RaynalQuoted 32 lines · Miquel Raynal
Move the NAND chip description out of the NAND controller file. Indeed, a subsequent part of the properties supported by a raw NAND chip are also supported by SPI-NAND chips. So let's create a generic NAND chip description which will be pulled by
nand-controller.yamland later byspi-nand.yamlas well.Signed-off-by Miquel Raynal <[email protected]>--- .../devicetree/bindings/mtd/nand-chip.yaml | 71 +++++++++++++++++++ .../bindings/mtd/nand-controller.yaml | 53 ++------------ 2 files changed, 75 insertions(+), 49 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/nand-chip.yamlDocumentation/devicetree/bindings/mtd/nand-chip.yaml new file +13
-0@@ -0,0 +1,71 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/nand-chip.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NAND Chip and NAND Controller Generic Binding + +maintainers: + - Miquel Raynal <[email protected]> + +description: | + This file covers the generic description of a NAND chip. It implies that the
Documentation/devicetree/bindings/mtd/nand-chip.yaml line 23
Quoted 10 lines
Documentation/devicetree/bindings/mtd/nand-chip.yaml new file +10
-0+ bus interface should not be taken into account: both raw NAND devices and + SPI-NAND devices are concerned by this description. + +properties: + reg: + description: + Contains the chip-select IDs. + + nand-ecc-engine: + allOf:
Can you drop the allOf here.
Quoted 53 lines
Documentation/devicetree/bindings/mtd/nand-chip.yaml new file +48
-0+ - $ref: /schemas/types.yaml#/definitions/phandle + description: | + A phandle on the hardware ECC engine if any. There are + basically three possibilities: + 1/ The ECC engine is part of the NAND controller, in this + case the phandle should reference the parent node. + 2/ The ECC engine is part of the NAND part (on-die), in this + case the phandle should reference the node itself. + 3/ The ECC engine is external, in this case the phandle should + reference the specific ECC engine node. + + nand-use-soft-ecc-engine: + type: boolean + description: Use a software ECC engine. + + nand-no-ecc-engine: + type: boolean + description: Do not use any ECC correction. + + nand-ecc-algo: + description: + Desired ECC algorithm. + $ref: /schemas/types.yaml#/definitions/string + enum: [hamming, bch, rs] + + nand-ecc-strength: + description: + Maximum number of bits that can be corrected per ECC step. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + + nand-ecc-step-size: + description: + Number of data bytes covered by a single ECC step. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + + secure-regions: + $ref: /schemas/types.yaml#/definitions/uint64-matrix + description: + Regions in the NAND chip which are protected using a secure element + like Trustzone. This property contains the start address and size of + the secure regions present. + +required: + - reg + +additionalProperties: trueDocumentation/devicetree/bindings/mtd/nand-controller.yaml +0
-0
Documentation/devicetree/bindings/mtd/nand-controller.yaml properties: · line 56
Quoted 5 lines
Documentation/devicetree/bindings/mtd/nand-controller.yaml +2
-0@@ -52,32 +52,15 @@ properties: patternProperties: "^nand@[a-f0-9]$": type: object + + allOf:
Also not needed here.
With that,
Quoted 2 lines
Documentation/devicetree/bindings/mtd/nand-controller.yaml +2
-0+ - $ref: "nand-chip.yaml#" +
Miquel Raynal
maintainerPATCH v2 4/20 dt-bindings: mtd: spi-nand: Convert spi-nand description file to yaml
In reply to Miquel RaynalLet's get rid of spi-nand.txt by converting it to yaml schema. While at converting this file, let's actually pull all the generic properties from nand-chip.yaml which might apply to a SPI-NAND chip.
--- .../devicetree/bindings/mtd/spi-nand.txt | 5 ---- .../devicetree/bindings/mtd/spi-nand.yaml | 27 +++++++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) delete mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.txt create mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.yaml
Documentation/devicetree/bindings/mtd/spi-nand.txt deleted +0 -5
@@ -1,5 +0,0 @@ -SPI NAND flash - -Required properties: -- compatible: should be "spi-nand" -- reg: should encode the chip-select line used to access the NAND chip
Documentation/devicetree/bindings/mtd/spi-nand.yaml new file +27 -0
@@ -0,0 +1,27 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/spi-nand.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: SPI-NAND flash device tree bindings + +maintainers: + - Miquel Raynal <[email protected]> + +allOf: + - $ref: "nand-chip.yaml#" + +properties: + compatible: + const: spi-nand + + reg: + maxItems: 1 + description: Encode the chip-select line on the SPI bus + +required: + - compatible + - reg + +unevaluatedProperties: false
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 5/20 dt-bindings: vendor-prefixes: Clarify Macronix prefix
In reply to Miquel RaynalWhen looking at compatible prefixes, Macronix is sometimes referred as "mxicy":
- mxicy,mx25r1635f
- mxicy,mx25u6435f
- mxicy,mx25v8035f
- mxicy,mx25f0a-spi
and sometimes as "mxic":
- mxic,multi-itfc-v009-nand-controller
- mxic,enable-randomizer-otp
The oldest prefix that is also the one preferred by Macronix engineers is "mxicy", so document the other one and mark it deprecated.
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +3 -0
@@ -774,6 +774,9 @@ patternProperties: description: Mundo Reader S.L. "^murata,.*": description: Murata Manufacturing Co., Ltd. + "^mxic,.*": + description: Macronix International Co., Ltd. + deprecated: true "^mxicy,.*": description: Macronix International Co., Ltd. "^myir,.*":
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 6/20 dt-bindings: spi: mxic: The interrupt property is not mandatory
In reply to Miquel RaynalThe interrupt property is not mandatory at all, this property should not be part of the required properties list, so move it into the optional properties list.
--- Documentation/devicetree/bindings/spi/spi-mxic.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/spi/spi-mxic.txt +3 -1
@@ -8,11 +8,13 @@ Required properties: - reg: should contain 2 entries, one for the registers and one for the direct mapping area - reg-names: should contain "regs" and "dirmap" -- interrupts: interrupt line connected to the SPI controller - clock-names: should contain "ps_clk", "send_clk" and "send_dly_clk" - clocks: should contain 3 entries for the "ps_clk", "send_clk" and "send_dly_clk" clocks +Optional properties: +- interrupts: interrupt line connected to the SPI controller + Example: spi@43c30000 {
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 7/20 dt-bindings: spi: mxic: Convert to yaml
In reply to Miquel RaynalStraightforward conversion from regular text to yaml schema of the Macronix SPI controller DT bindings.
--- .../bindings/spi/mxicy,mx25f0a-spi.yaml | 60 +++++++++++++++++++ .../devicetree/bindings/spi/spi-mxic.txt | 36 ----------- 2 files changed, 60 insertions(+), 36 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/mxicy,mx25f0a-spi.yaml delete mode 100644 Documentation/devicetree/bindings/spi/spi-mxic.txt
Documentation/devicetree/bindings/spi/mxicy,mx25f0a-spi.yaml new file +60 -0
@@ -0,0 +1,60 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/spi/mxicy,mx25f0a-spi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Macronix SPI controller device tree bindings + +maintainers: + - Miquel Raynal <[email protected]> + +allOf: + - $ref: "spi-controller.yaml#" + +properties: + compatible: + const: mxicy,mx25f0a-spi + + reg: + minItems: 2 + maxItems: 2 + + reg-names: + items: + - const: regs + - const: dirmap + + interrupts: + maxItems: 1 + + clocks: + minItems: 3 + maxItems: 3 + + clock-names: + items: + - const: send_clk + - const: send_dly_clk + - const: ps_clk + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + +unevaluatedProperties: false + +examples: + - | + spi@43c30000 { + compatible = "mxicy,mx25f0a-spi"; + reg = <0x43c30000 0x10000>, <0xa0000000 0x20000000>; + reg-names = "regs", "dirmap"; + clocks = <&clkwizard 0>, <&clkwizard 1>, <&clkc 18>; + clock-names = "send_clk", "send_dly_clk", "ps_clk"; + #address-cells = <1>; + #size-cells = <0>; + };
Documentation/devicetree/bindings/spi/spi-mxic.txt deleted +0 -36
@@ -1,36 +0,0 @@ -Macronix SPI controller Device Tree Bindings --------------------------------------------- - -Required properties: -- compatible: should be "mxicy,mx25f0a-spi" -- #address-cells: should be 1 -- #size-cells: should be 0 -- reg: should contain 2 entries, one for the registers and one for the direct - mapping area -- reg-names: should contain "regs" and "dirmap" -- clock-names: should contain "ps_clk", "send_clk" and "send_dly_clk" -- clocks: should contain 3 entries for the "ps_clk", "send_clk" and - "send_dly_clk" clocks - -Optional properties: -- interrupts: interrupt line connected to the SPI controller - -Example: - - spi@43c30000 { - compatible = "mxicy,mx25f0a-spi"; - reg = <0x43c30000 0x10000>, <0xa0000000 0x20000000>; - reg-names = "regs", "dirmap"; - clocks = <&clkwizard 0>, <&clkwizard 1>, <&clkc 18>; - clock-names = "send_clk", "send_dly_clk", "ps_clk"; - #address-cells = <1>; - #size-cells = <0>; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - spi-tx-bus-width = <4>; - spi-rx-bus-width = <4>; - }; - };
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 8/20 dt-bindings: spi: mxic: Document the nand-ecc-engine property
In reply to Miquel RaynalThis SPI controller supports interacting with an external ECC engine. The nand-ecc-engine property already exist in the NAND world but also applies to SPI controller nodes which have external correction capabilities like Macronix's.
--- .../devicetree/bindings/spi/mxicy,mx25f0a-spi.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/spi/mxicy,mx25f0a-spi.yaml +6 -0
@@ -38,6 +38,12 @@ properties: - const: send_dly_clk - const: ps_clk + nand-ecc-engine: + allOf: + - $ref: /schemas/types.yaml#/definitions/phandle + description: NAND ECC engine used by the SPI controller in order to perform + on-the-fly correction when using a SPI-NAND memory. + required: - compatible - reg
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 9/20 dt-bindings: mtd: Describe Macronix NAND ECC engine
In reply to Miquel RaynalDescribe Macronix NAND ECC engine. This engine may be used as an external engine or can be pipelined with either a raw NAND controller or a SPI controller. Both hardware designs with a SPI controller are shown in the examples.
--- .../bindings/mtd/mxicy,nand-ecc-engine.yaml | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/mxicy,nand-ecc-engine.yaml
Documentation/devicetree/bindings/mtd/mxicy,nand-ecc-engine.yaml new file +77 -0
@@ -0,0 +1,77 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/mxicy,nand-ecc-engine.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Macronix NAND ECC engine device tree bindings + +maintainers: + - Miquel Raynal <[email protected]> + +properties: + compatible: + const: mxicy,nand-ecc-engine-rev3 + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + interrupts: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + /* External configuration */ + spi_controller0: spi@43c30000 { + compatible = "mxicy,mx25f0a-spi"; + reg = <0x43c30000 0x10000>, <0xa0000000 0x4000000>; + reg-names = "regs", "dirmap"; + clocks = <&clkwizard 0>, <&clkwizard 1>, <&clkc 15>; + clock-names = "send_clk", "send_dly_clk", "ps_clk"; + #address-cells = <1>; + #size-cells = <0>; + + flash@0 { + compatible = "spi-nand"; + reg = <0>; + nand-ecc-engine = <&ecc_engine0>; + }; + }; + + ecc_engine0: ecc@43c40000 { + compatible = "mxicy,nand-ecc-engine-rev3"; + reg = <0x43c40000 0x10000>; + }; + + - | + /* Pipelined configuration */ + spi_controller1: spi@43c30000 { + compatible = "mxicy,mx25f0a-spi"; + reg = <0x43c30000 0x10000>, <0xa0000000 0x4000000>; + reg-names = "regs", "dirmap"; + clocks = <&clkwizard 0>, <&clkwizard 1>, <&clkc 15>; + clock-names = "send_clk", "send_dly_clk", "ps_clk"; + #address-cells = <1>; + #size-cells = <0>; + nand-ecc-engine = <&ecc_engine1>; + + flash@0 { + compatible = "spi-nand"; + reg = <0>; + nand-ecc-engine = <&spi_controller1>; + }; + }; + + ecc_engine1: ecc@43c40000 { + compatible = "mxicy,nand-ecc-engine-rev3"; + reg = <0x43c40000 0x10000>; + };
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 10/20 mtd: spinand: macronix: Use random program load
In reply to Miquel RaynalFrom: Mason Yang <[email protected]>
Macronix SPI-NAND chips might benefit from an external ECC engine. Such an engine might need to access random columns, thus needing to use random commands (0x84 instead of 0x02).
--- drivers/mtd/nand/spi/macronix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/spi/macronix.c +1 -1
@@ -20,7 +20,7 @@ static SPINAND_OP_VARIANTS(read_cache_variants, static SPINAND_OP_VARIANTS(write_cache_variants, SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), - SPINAND_PROG_LOAD(true, 0, NULL, 0)); + SPINAND_PROG_LOAD(false, 0, NULL, 0)); static SPINAND_OP_VARIANTS(update_cache_variants, SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 11/20 mtd: nand: ecc: Add infrastructure to support hardware engines
In reply to Miquel RaynalAdd the necessary helpers to register/unregister hardware ECC engines that will be called from ECC engine drivers.
Also add helpers to get the right engine from the user perspective. Keep a reference of the in use ECC engine in order to prevent modules to be unloaded. Put the reference when the engine gets retired.
A static list of hardware (only) ECC engines is setup to keep track of the registered engines.
--- drivers/mtd/nand/core.c | 10 +++-- drivers/mtd/nand/ecc.c | 88 ++++++++++++++++++++++++++++++++++++++++ include/linux/mtd/nand.h | 28 +++++++++++++ 3 files changed, 123 insertions(+), 3 deletions(-)
drivers/mtd/nand/core.c +7 -3
@@ -232,7 +232,9 @@ static int nanddev_get_ecc_engine(struct nand_device *nand) nand->ecc.engine =nand_ecc_get_on_die_hw_engine (nand);break ;case NAND_ECC_ENGINE_TYPE_ON_HOST : -pr_err ("On-host hardware ECC engines not supported yet\n" ); + nand->ecc.engine =nand_ecc_get_on_host_hw_engine (nand); +if (PTR_ERR (nand->ecc.engine) == -EPROBE_DEFER ) +return -EPROBE_DEFER ;break ;default :pr_err ("Missing ECC engine type\n" );
@@ -252,7 +254,7 @@ static int nanddev_put_ecc_engine(struct nand_device *nand) {switch (nand->ecc.ctx.conf.engine_type) {case NAND_ECC_ENGINE_TYPE_ON_HOST : -pr_err ("On-host hardware ECC engines not supported yet\n" ); +nand_ecc_put_on_host_hw_engine (nand);break ;case NAND_ECC_ENGINE_TYPE_NONE :case NAND_ECC_ENGINE_TYPE_SOFT :
@@ -297,7 +299,9 @@ int nanddev_ecc_engine_init(struct nand_device *nand)/* Look for the ECC engine to use */ ret =nanddev_get_ecc_engine (nand);if (ret) { -pr_err ("No ECC engine found\n" ); +if (ret != -EPROBE_DEFER ) +pr_err ("No ECC engine found\n" ); +return ret; }
drivers/mtd/nand/ecc.c +88 -0
100 lines not on this page · raw message
include/linux/mtd/nand.h +28 -0
@@ -263,12 +263,36 @@ struct nand_ecc_engine_ops { struct nand_page_io_req *req); }; +/** +* enum nand_ecc_engine_integration - How the NAND ECC engine is integrated +* @NAND_ECC_ENGINE_INTEGRATION_INVALID: Invalid value +* @NAND_ECC_ENGINE_INTEGRATION_PIPELINED: Pipelined engine, performs on-the-fly +* correction, does not need to copy +* data around +* @NAND_ECC_ENGINE_INTEGRATION_PIPELINED: External engine, needs to bring the +* data into its own area before use +*/ +enum nand_ecc_engine_integration { +NAND_ECC_ENGINE_INTEGRATION_INVALID , +NAND_ECC_ENGINE_INTEGRATION_PIPELINED , +NAND_ECC_ENGINE_INTEGRATION_EXTERNAL , +}; +/** * struct nand_ecc_engine - ECC engine abstraction for NAND devices +* @dev: Host device +* @node: Private field for registration time * @ops: ECC engine operations +* @integration: How the engine is integrated with the host +* (only relevant on %NAND_ECC_ENGINE_TYPE_ON_HOST engines) +* @priv: Private data */ struct nand_ecc_engine { +struct device *dev; +struct list_head node;struct nand_ecc_engine_ops *ops; +enum nand_ecc_engine_integration integration; +void *priv; };void of_get_nand_ecc_user_config (struct nand_device *nand);
@@ -279,8 +303,12 @@ int nand_ecc_prepare_io_req(struct nand_device *nand,int nand_ecc_finish_io_req (struct nand_device *nand,struct nand_page_io_req *req);bool nand_ecc_is_strong_enough (struct nand_device *nand); +int nand_ecc_register_on_host_hw_engine (struct nand_ecc_engine *engine); +int nand_ecc_unregister_on_host_hw_engine (struct nand_ecc_engine *engine);struct nand_ecc_engine *nand_ecc_get_sw_engine (struct nand_device *nand);struct nand_ecc_engine *nand_ecc_get_on_die_hw_engine (struct nand_device *nand); +struct nand_ecc_engine *nand_ecc_get_on_host_hw_engine (struct nand_device *nand); +void nand_ecc_put_on_host_hw_engine (struct nand_device *nand);#if IS_ENABLED (CONFIG_MTD_NAND_ECC_SW_HAMMING )struct nand_ecc_engine *nand_ecc_sw_hamming_get_engine (void );
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 12/20 mtd: nand: Add a new helper to retrieve the ECC context
In reply to Miquel RaynalIntroduce nand_to_ecc_ctx() which will allow to easily jump to the private pointer of an ECC context given a NAND device. This is very handy, from the prepare or finish ECC hook, to get the internal context out of the NAND device object.
--- include/linux/mtd/nand.h | 5 +++++ 1 file changed, 5 insertions(+)
include/linux/mtd/nand.h +5 -0
@@ -990,6 +990,11 @@ int nanddev_markbad(struct nand_device *nand, const struct nand_pos *pos);int nanddev_ecc_engine_init (struct nand_device *nand);void nanddev_ecc_engine_cleanup (struct nand_device *nand); +static inline void *nand_to_ecc_ctx (struct nand_device *nand) +{ +return nand->ecc.ctx.priv; +} +/* BBT related functions */ enum nand_bbt_block_status {NAND_BBT_BLOCK_STATUS_UNKNOWN ,
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 13/20 mtd: nand: mxic-ecc: Add Macronix external ECC engine support
In reply to Miquel RaynalSome SPI-NAND chips do not support on-die ECC. For these chips, correction must apply on the SPI controller end. In order to avoid doing all the calculations by software, Macronix provides a specific engine that can offload the intensive work.
Add Macronix ECC engine support, this engine can work in conjunction with a SPI controller and a raw NAND controller, it can be pipelined or external and supports linear and syndrome layouts.
Right now the simplest configuration is supported: SPI controller external and linear ECC engine.
--- drivers/mtd/nand/Kconfig | 6 + drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/ecc-mxic.c | 693 ++++++++++++++++++++++++++++++++++++ 3 files changed, 700 insertions(+) create mode 100644 drivers/mtd/nand/ecc-mxic.c
drivers/mtd/nand/Kconfig +6 -0
@@ -46,6 +46,12 @@ config MTD_NAND_ECC_SW_BCH ECC codes. They are used with NAND devices requiring more than 1 bit of error correction. +config MTD_NAND_ECC_MXIC + bool "Macronix external hardware ECC engine" + select MTD_NAND_ECC + help + This enables support for the hardware ECC engine from Macronix. + endmenu endmenu
drivers/mtd/nand/Makefile +1 -0
@@ -10,3 +10,4 @@ obj-y += spi/ nandcore-$(CONFIG_MTD_NAND_ECC) += ecc.o nandcore-$(CONFIG_MTD_NAND_ECC_SW_HAMMING) += ecc-sw-hamming.o nandcore-$(CONFIG_MTD_NAND_ECC_SW_BCH) += ecc-sw-bch.o +nandcore-$(CONFIG_MTD_NAND_ECC_MXIC) += ecc-mxic.o
drivers/mtd/nand/ecc-mxic.c new file +693 -0
693 lines not on this page · raw message
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 14/20 mtd: nand: mxic-ecc: Support SPI pipelined mode
In reply to Miquel RaynalIntroduce the support for another possible configuration: the ECC engine may work as DMA master (pipelined) and move itself the data to/from the NAND chip into the buffer, applying the necessary corrections/computations on the fly.
This driver offers an ECC engine implementation that must be instatiated from a SPI controller driver.
--- drivers/mtd/nand/ecc-mxic.c | 210 +++++++++++++++++++++++++++++- include/linux/mtd/nand-ecc-mxic.h | 50 +++++++ 2 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 include/linux/mtd/nand-ecc-mxic.h
drivers/mtd/nand/ecc-mxic.c +209 -1
@@ -16,6 +16,7 @@#include <linux/module.h> #include <linux/mtd/mtd.h> #include <linux/mtd/nand.h> +#include <linux/mtd/nand-ecc-mxic.h> #include <linux/mutex.h> #include <linux/of_device.h> #include <linux/of_platform.h>
@@ -40,7 +41,9 @@#define INTRPT_SIG_EN 0x0C/* Host Controller Configuration */ #define HC_CONFIG 0x10 +#define DEV2MEM 0/* TRANS_TYP_DMA in the spec */ #define MEM2MEM BIT(4)/* TRANS_TYP_IO in the spec */ +#define MAPPING BIT(5)/* TRANS_TYP_MAPPING in the spec */ #define ECC_PACKED 0/* LAYOUT_TYP_INTEGRATED in the spec */ #define ECC_INTERLEAVED BIT(2)/* LAYOUT_TYP_DISTRIBUTED in the spec */ #define BURST_TYP_FIXED 0
@@ -87,6 +90,7 @@ struct mxic_ecc_engine {int irq;struct completion complete;struct nand_ecc_engine external_engine; +struct nand_ecc_engine pipelined_engine;struct mutex lock; };
@@ -104,6 +108,7 @@ struct mxic_ecc_ctx {u8 *oobwithstat;struct scatterlist sg[2 ];struct nand_page_io_req *req; +unsigned int pageoffs; };static struct mxic_ecc_engine *ext_ecc_eng_to_mxic (struct nand_ecc_engine *eng)
@@ -111,11 +116,19 @@ static struct mxic_ecc_engine *ext_ecc_eng_to_mxic(struct nand_ecc_engine *eng) return container_of(eng, struct mxic_ecc_engine, external_engine); } +static struct mxic_ecc_engine *pip_ecc_eng_to_mxic (struct nand_ecc_engine *eng) +{ + return container_of(eng, struct mxic_ecc_engine, pipelined_engine); +} +static struct mxic_ecc_engine *nand_to_mxic (struct nand_device *nand) {struct nand_ecc_engine *eng = nand->ecc.engine; -return ext_ecc_eng_to_mxic (eng); +if (eng->integration ==NAND_ECC_ENGINE_INTEGRATION_EXTERNAL ) +return ext_ecc_eng_to_mxic (eng); +else +return pip_ecc_eng_to_mxic (eng); } static int mxic_ecc_ooblayout_ecc(struct mtd_info *mtd, int section,
@@ -203,6 +216,31 @@ static irqreturn_t mxic_ecc_isr(int irq, void *dev_id)return IRQ_HANDLED ; } +static struct device *mxic_ecc_get_engine_dev (struct device *dev) +{ +struct platform_device *eccpdev; +struct device_node *np; + +/* +* If the device node contains this property, it means the device does +* not represent the actual ECC engine. +*/ + np =of_parse_phandle (dev->of_node,"nand-ecc-engine" ,0 ); +if (!np) +return dev; + + eccpdev =of_find_device_by_node (np); +if (!eccpdev) { +of_node_put (np); +return NULL ; + } + +platform_device_put (eccpdev); +of_node_put (np); + +return &eccpdev->dev; +} +static int mxic_ecc_init_ctx (struct nand_device *nand,struct device *dev) {struct mxic_ecc_engine *mxic =nand_to_mxic (nand);
@@ -364,6 +402,42 @@ static int mxic_ecc_init_ctx_external(struct nand_device *nand)return 0 ; } +static int mxic_ecc_init_ctx_pipelined (struct nand_device *nand) +{ +struct mxic_ecc_engine *mxic =nand_to_mxic (nand); +struct mxic_ecc_ctx *ctx; +struct device *dev; +int ret; + +/* +* In the case of a pipelined engine, the device registering the ECC +* engine is not the actual ECC engine device but the host controller. +*/ + dev =mxic_ecc_get_engine_dev (nand->ecc.engine->dev); +if (!dev) +return -EINVAL ; + +dev_info (dev,"Macronix ECC engine in pipelined/mapping mode\n" ); + + ret =mxic_ecc_init_ctx (nand, dev); +if (ret) +return ret; + + ctx =nand_to_ecc_ctx (nand); + +/* All steps should be handled in one go directly by the internal DMA */ +writel (ctx->steps, mxic->regs +CHUNK_CNT ); + +/* +* Interleaved ECC scheme cannot be used otherwise factory bad block +* markers would be lost. A packed layout is mandatory. +*/ +writel (BURST_TYP_INCREASING |ECC_PACKED |MAPPING , + mxic->regs +HC_CONFIG ); + +return 0 ; +} +static void mxic_ecc_cleanup_ctx (struct nand_device *nand) {struct mxic_ecc_ctx *ctx =nand_to_ecc_ctx (nand);
@@ -419,6 +493,18 @@ static int mxic_ecc_process_data(struct mxic_ecc_engine *mxic,return ret; } +int mxic_ecc_process_data_pipelined (struct nand_ecc_engine *eng, +unsigned int direction,dma_addr_t dirmap) +{ +struct mxic_ecc_engine *mxic =pip_ecc_eng_to_mxic (eng); + +if (dirmap) +writel (dirmap, mxic->regs +HC_SLV_ADDR ); + +return mxic_ecc_process_data (mxic, direction); +} +EXPORT_SYMBOL_GPL (mxic_ecc_process_data_pipelined); +static void mxic_ecc_extract_status_bytes (struct mxic_ecc_ctx *ctx) {u8 *buf = ctx->oobwithstat;
@@ -598,6 +684,65 @@ static int mxic_ecc_finish_io_req_external(struct nand_device *nand,return mxic_ecc_count_biterrs (mxic, nand); } +/* Pipelined ECC engine helpers */ +static int mxic_ecc_prepare_io_req_pipelined (struct nand_device *nand, +struct nand_page_io_req *req) +{ +struct mxic_ecc_engine *mxic =nand_to_mxic (nand); +struct mxic_ecc_ctx *ctx =nand_to_ecc_ctx (nand); +int nents; + +if (req->mode ==MTD_OPS_RAW ) +return 0 ; + +nand_ecc_tweak_req (&ctx->req_ctx, req); + ctx->req = req; + +/* Copy the OOB buffer and add room for the ECC engine status bytes */ +mxic_ecc_add_room_in_oobbuf (ctx, ctx->oobwithstat, ctx->req->oobbuf.in); + +sg_set_buf (&ctx->sg[0 ], req->databuf.in, req->datalen); +sg_set_buf (&ctx->sg[1 ], ctx->oobwithstat, + req->ooblen + (ctx->steps *STAT_BYTES )); + + nents =dma_map_sg (mxic->dev, ctx->sg,2 ,DMA_BIDIRECTIONAL ); +if (!nents) +return -EINVAL ; + +mutex_lock (&mxic->lock); + +writel (sg_dma_address (&ctx->sg[0 ]), mxic->regs +SDMA_MAIN_ADDR ); +writel (sg_dma_address (&ctx->sg[1 ]), mxic->regs +SDMA_SPARE_ADDR ); + +return 0 ; +} + +static int mxic_ecc_finish_io_req_pipelined (struct nand_device *nand, +struct nand_page_io_req *req) +{ +struct mxic_ecc_engine *mxic =nand_to_mxic (nand); +struct mxic_ecc_ctx *ctx =nand_to_ecc_ctx (nand); +int ret =0 ; + +if (req->mode ==MTD_OPS_RAW ) +return 0 ; + +mutex_unlock (&mxic->lock); + +dma_unmap_sg (mxic->dev, ctx->sg,2 ,DMA_BIDIRECTIONAL ); + +if (req->type ==NAND_PAGE_READ ) { +mxic_ecc_extract_status_bytes (ctx); +mxic_ecc_reconstruct_oobbuf (ctx, ctx->req->oobbuf.in, + ctx->oobwithstat); + ret =mxic_ecc_count_biterrs (mxic, nand); + } + +nand_ecc_restore_req (&ctx->req_ctx, req); + +return ret; +} +static struct nand_ecc_engine_ops mxic_ecc_engine_external_ops = { .init_ctx = mxic_ecc_init_ctx_external, .cleanup_ctx = mxic_ecc_cleanup_ctx,
@@ -605,6 +750,69 @@ static struct nand_ecc_engine_ops mxic_ecc_engine_external_ops = { .finish_io_req = mxic_ecc_finish_io_req_external, }; +static struct nand_ecc_engine_ops mxic_ecc_engine_pipelined_ops = { + .init_ctx = mxic_ecc_init_ctx_pipelined, + .cleanup_ctx = mxic_ecc_cleanup_ctx, + .prepare_io_req = mxic_ecc_prepare_io_req_pipelined, + .finish_io_req = mxic_ecc_finish_io_req_pipelined, +}; + +struct nand_ecc_engine_ops *mxic_ecc_get_pipelined_ops (void ) +{ +return &mxic_ecc_engine_pipelined_ops; +} +EXPORT_SYMBOL_GPL (mxic_ecc_get_pipelined_ops); + +static struct platform_device * +mxic_ecc_get_pdev (struct platform_device *spi_pdev) +{ +struct platform_device *eng_pdev; +struct device_node *np; + +/* Retrieve the nand-ecc-engine phandle */ + np =of_parse_phandle (spi_pdev->dev.of_node,"nand-ecc-engine" ,0 ); +if (!np) +return NULL ; + +/* Jump to the engine's device node */ + eng_pdev =of_find_device_by_node (np); +of_node_put (np); + +return eng_pdev; +} + +void mxic_ecc_put_pipelined_engine (struct nand_ecc_engine *eng) +{ +struct mxic_ecc_engine *mxic =pip_ecc_eng_to_mxic (eng); + +platform_device_put (to_platform_device (mxic->dev)); +} +EXPORT_SYMBOL_GPL (mxic_ecc_put_pipelined_engine); + +struct nand_ecc_engine * +mxic_ecc_get_pipelined_engine (struct platform_device *spi_pdev) +{ +struct platform_device *eng_pdev; +struct mxic_ecc_engine *mxic; + + eng_pdev =mxic_ecc_get_pdev (spi_pdev); +if (!eng_pdev) +return ERR_PTR (-ENODEV ); + + mxic =platform_get_drvdata (eng_pdev); +if (!mxic) { +platform_device_put (eng_pdev); +return ERR_PTR (-EPROBE_DEFER ); + } + +return &mxic->pipelined_engine; +} +EXPORT_SYMBOL_GPL (mxic_ecc_get_pipelined_engine); + +/* +* Only the external ECC engine is exported as the pipelined is SoC specific, so +* it is registered directly by the drivers that wrap it. +*/ static int mxic_ecc_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
include/linux/mtd/nand-ecc-mxic.h new file +50 -0
50 lines not on this page · raw message
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 15/20 mtd: spinand: Create direct mapping descriptors for ECC operations
In reply to Miquel RaynalIn order for pipelined ECC engines to be able to enable/disable the ECC engine only when needed and avoid races when future parallel-operations will be supported, we need to provide the information about the use of the ECC engine in the direct mapping hooks. As direct mapping configurations are meant to be static, it is best to create two new
mappings: one for regular 'raw' accesses and one for accesses involving correction. It is up to the driver to use or not the new ECC enable boolean contained in the spi-mem operation.
--- drivers/mtd/nand/spi/core.c | 28 ++++++++++++++++++++++++++-- include/linux/mtd/spinand.h | 2 ++ include/linux/spi/spi-mem.h | 3 +++ 3 files changed, 31 insertions(+), 2 deletions(-)
drivers/mtd/nand/spi/core.c +26 -2
@@ -381,7 +381,10 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand, } } - rdesc = spinand->dirmaps[req->pos.plane].rdesc; +if (req->mode ==MTD_OPS_RAW ) + rdesc = spinand->dirmaps[req->pos.plane].rdesc; +else + rdesc = spinand->dirmaps[req->pos.plane].rdesc_ecc;while (nbytes) { ret =spi_mem_dirmap_read (rdesc, column, nbytes, buf);
@@ -452,7 +455,10 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, req->ooblen); } - wdesc = spinand->dirmaps[req->pos.plane].wdesc; +if (req->mode ==MTD_OPS_RAW ) + wdesc = spinand->dirmaps[req->pos.plane].wdesc; +else + wdesc = spinand->dirmaps[req->pos.plane].wdesc_ecc;while (nbytes) { ret =spi_mem_dirmap_write (wdesc, column, nbytes, buf);
@@ -866,6 +872,24 @@ static int spinand_create_dirmap(struct spinand_device *spinand, spinand->dirmaps[plane].rdesc = desc; + info.op_tmpl = *spinand->op_templates.update_cache; + info.op_tmpl.ecc_en = true; + desc =devm_spi_mem_dirmap_create (&spinand->spimem->spi->dev, + spinand->spimem, &info); +if (IS_ERR (desc)) +return PTR_ERR (desc); + + spinand->dirmaps[plane].wdesc_ecc = desc; + + info.op_tmpl = *spinand->op_templates.read_cache; + info.op_tmpl.ecc_en = true; + desc =devm_spi_mem_dirmap_create (&spinand->spimem->spi->dev, + spinand->spimem, &info); +if (IS_ERR (desc)) +return PTR_ERR (desc); + + spinand->dirmaps[plane].rdesc_ecc = desc; +return 0 ; }
include/linux/mtd/spinand.h +2 -0
@@ -389,6 +389,8 @@ struct spinand_info {struct spinand_dirmap {struct spi_mem_dirmap_desc *wdesc;struct spi_mem_dirmap_desc *rdesc; +struct spi_mem_dirmap_desc *wdesc_ecc; +struct spi_mem_dirmap_desc *rdesc_ecc; };/**
include/linux/spi/spi-mem.h +3 -0
@@ -94,6 +94,7 @@ enum spi_mem_data_dir {* operation does not involve transferring data * @data.buf.in: input buffer (must be DMA-able) * @data.buf.out: output buffer (must be DMA-able) +* @ecc_en: error correction is required */ struct spi_mem_op { struct {
@@ -126,6 +127,8 @@ struct spi_mem_op {const void *out; } buf; } data; + +bool ecc_en; };#define SPI_MEM_OP (__cmd, __addr, __dummy, __data) \
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH v2 15/20] mtd: spinand: Create direct mapping descriptors for ECC operations
Quoted 9 lines · On Fri, 26 Nov 2021 12:39:19 +0100 Miquel Raynal <[email protected]>…
In order for pipelined ECC engines to be able to enable/disable the ECC engine only when needed and avoid races when future parallel-operations will be supported, we need to provide the information about the use of the ECC engine in the direct mapping hooks. As direct mapping configurations are meant to be static, it is best to create two new
mappings: one for regular 'raw' accesses and one for accesses involving correction. It is up to the driver to use or not the new ECC enable boolean contained in the spi-mem operation.
Quoted 5 lines
Signed-off-by Miquel Raynal <[email protected]>--- drivers/mtd/nand/spi/core.c | 28 ++++++++++++++++++++++++++-- include/linux/mtd/spinand.h | 2 ++ include/linux/spi/spi-mem.h | 3 +++
I'd split that patch in 2: one adding the ecc_en field to spi_mem_op and the other one using it in spinand.
Quoted 42 lines
3 files changed, 31 insertions(+), 2 deletions(-)drivers/mtd/nand/spi/core.c +16
-2@@ -381,7 +381,10 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand, } } - rdesc = spinand->dirmaps[req->pos.plane].rdesc; +if (req->mode ==MTD_OPS_RAW ) + rdesc = spinand->dirmaps[req->pos.plane].rdesc; +else + rdesc = spinand->dirmaps[req->pos.plane].rdesc_ecc;while (nbytes) { ret =spi_mem_dirmap_read (rdesc, column, nbytes, buf);@@ -452,7 +455,10 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, req->ooblen); } - wdesc = spinand->dirmaps[req->pos.plane].wdesc; +if (req->mode ==MTD_OPS_RAW ) + wdesc = spinand->dirmaps[req->pos.plane].wdesc; +else + wdesc = spinand->dirmaps[req->pos.plane].wdesc_ecc;while (nbytes) { ret =spi_mem_dirmap_write (wdesc, column, nbytes, buf);@@ -866,6 +872,24 @@ static int spinand_create_dirmap(struct spinand_device *spinand, spinand->dirmaps[plane].rdesc = desc; + info.op_tmpl = *spinand->op_templates.update_cache; + info.op_tmpl.ecc_en = true; + desc =devm_spi_mem_dirmap_create (&spinand->spimem->spi->dev, + spinand->spimem, &info); +if (IS_ERR (desc)) +return PTR_ERR (desc); + + spinand->dirmaps[plane].wdesc_ecc = desc;
drivers/mtd/nand/spi/core.c static int spinand_create_dirmap(struct spinand_device *spinand, · line 892
Quoted 10 lines
drivers/mtd/nand/spi/core.c +10
-0+ + info.op_tmpl = *spinand->op_templates.read_cache; + info.op_tmpl.ecc_en = true; + desc =devm_spi_mem_dirmap_create (&spinand->spimem->spi->dev, + spinand->spimem, &info); +if (IS_ERR (desc)) +return PTR_ERR (desc); + + spinand->dirmaps[plane].rdesc_ecc = desc; +
Direct mappings are not free (they might reserve a piece of MMIO address space depending on the spi-mem controller implementation), so I'd recommend creating those mapping only when strictly needed, that is, when dealing with a pipelined ECC.
Quoted 29 lines
drivers/mtd/nand/spi/core.c +0
-0return 0 ; }include/linux/mtd/spinand.h +2
-0@@ -389,6 +389,8 @@ struct spinand_info {struct spinand_dirmap {struct spi_mem_dirmap_desc *wdesc;struct spi_mem_dirmap_desc *rdesc; +struct spi_mem_dirmap_desc *wdesc_ecc; +struct spi_mem_dirmap_desc *rdesc_ecc; };/** include/linux/spi/spi-mem.h +1
-0@@ -94,6 +94,7 @@ enum spi_mem_data_dir {* operation does not involve transferring data * @data.buf.in: input buffer (must be DMA-able) * @data.buf.out: output buffer (must be DMA-able) +* @ecc_en: error correction is required */ struct spi_mem_op { struct {
include/linux/spi/spi-mem.h struct spi_mem_op { · line 134
Quoted 8 lines
include/linux/spi/spi-mem.h +2
-0@@ -126,6 +127,8 @@ struct spi_mem_op {const void *out; } buf; } data; + +bool ecc_en; };#define SPI_MEM_OP (__cmd, __addr, __dummy, __data) \
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerRe: [PATCH v2 15/20] mtd: spinand: Create direct mapping descriptors for ECC operations
Hi Boris,
[email protected] wrote on Fri, 26 Nov 2021 15:13:52 +0100:
Quoted 12 lines
Quoted 9 lines · On Fri, 26 Nov 2021 12:39:19 +0100 Miquel Raynal <[email protected]>…
In order for pipelined ECC engines to be able to enable/disable the ECC engine only when needed and avoid races when future parallel-operations will be supported, we need to provide the information about the use of the ECC engine in the direct mapping hooks. As direct mapping configurations are meant to be static, it is best to create two new
mappings: one for regular 'raw' accesses and one for accesses involving correction. It is up to the driver to use or not the new ECC enable boolean contained in the spi-mem operation.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Miquel Raynal <[email protected]>--- drivers/mtd/nand/spi/core.c | 28 ++++++++++++++++++++++++++-- include/linux/mtd/spinand.h | 2 ++ include/linux/spi/spi-mem.h | 3 +++I'd split that patch in 2: one adding the
ecc_enfield tospi_mem_opand the other one using it in spinand.
As this new spi_mem_op could not be used without the SPI-NAND changes I decided to put everything in a single patch, but no problem, I'll split it.
Quoted 50 lines
Quoted 50 lines
3 files changed, 31 insertions(+), 2 deletions(-)drivers/mtd/nand/spi/core.c +23
-2@@ -381,7 +381,10 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand, } } - rdesc = spinand->dirmaps[req->pos.plane].rdesc; +if (req->mode ==MTD_OPS_RAW ) + rdesc = spinand->dirmaps[req->pos.plane].rdesc; +else + rdesc = spinand->dirmaps[req->pos.plane].rdesc_ecc;while (nbytes) { ret =spi_mem_dirmap_read (rdesc, column, nbytes, buf);@@ -452,7 +455,10 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, req->ooblen); } - wdesc = spinand->dirmaps[req->pos.plane].wdesc; +if (req->mode ==MTD_OPS_RAW ) + wdesc = spinand->dirmaps[req->pos.plane].wdesc; +else + wdesc = spinand->dirmaps[req->pos.plane].wdesc_ecc;while (nbytes) { ret =spi_mem_dirmap_write (wdesc, column, nbytes, buf);@@ -866,6 +872,24 @@ static int spinand_create_dirmap(struct spinand_device *spinand, spinand->dirmaps[plane].rdesc = desc; + info.op_tmpl = *spinand->op_templates.update_cache; + info.op_tmpl.ecc_en = true; + desc =devm_spi_mem_dirmap_create (&spinand->spimem->spi->dev, + spinand->spimem, &info); +if (IS_ERR (desc)) +return PTR_ERR (desc); + + spinand->dirmaps[plane].wdesc_ecc = desc; + + info.op_tmpl = *spinand->op_templates.read_cache; + info.op_tmpl.ecc_en = true; + desc =devm_spi_mem_dirmap_create (&spinand->spimem->spi->dev, + spinand->spimem, &info); +if (IS_ERR (desc)) +return PTR_ERR (desc);
Quoted 8 lines
drivers/mtd/nand/spi/core.c static int spinand_create_dirmap(struct spinand_device *spinand, · line 892
Quoted 3 lines
drivers/mtd/nand/spi/core.c +3
-0+ + spinand->dirmaps[plane].rdesc_ecc = desc; +Direct mappings are not free (they might reserve a piece of MMIO address space depending on the spi-mem controller implementation), so I'd recommend creating those mapping only when strictly needed, that is, when dealing with a pipelined ECC.
That's what I tried to do in the first place, but unfortunately the direct mappings are instantiated at the time the SPI controller gets probed, which happens before the NAND flash being initialized and its ECC engine being picked. Hence, at this point, we don't really know what engine will be used with this ECC engine. I finally gave up and ended up creating 4 dirmaps (per lun). I know it's not optimal and in most cases consume more address space than needed but couldn't find a better solution yet :/
Quoted 33 lines
Quoted 33 lines
include/linux/mtd/spinand.h +2
-0@@ -389,6 +389,8 @@ struct spinand_info {struct spinand_dirmap {struct spi_mem_dirmap_desc *wdesc;struct spi_mem_dirmap_desc *rdesc; +struct spi_mem_dirmap_desc *wdesc_ecc; +struct spi_mem_dirmap_desc *rdesc_ecc; };/** include/linux/spi/spi-mem.h +3
-0@@ -94,6 +94,7 @@ enum spi_mem_data_dir {* operation does not involve transferring data * @data.buf.in: input buffer (must be DMA-able) * @data.buf.out: output buffer (must be DMA-able) +* @ecc_en: error correction is required */ struct spi_mem_op { struct {@@ -126,6 +127,8 @@ struct spi_mem_op {const void *out; } buf; } data; + +bool ecc_en; };
Quoted 2 lines
include/linux/spi/spi-mem.h struct spi_mem_op { · line 134
Quoted 1 line
include/linux/spi/spi-mem.h +0
-0#define SPI_MEM_OP (__cmd, __addr, __dummy, __data) \
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH v2 15/20] mtd: spinand: Create direct mapping descriptors for ECC operations
Quoted 28 lines · On Fri, 26 Nov 2021 15:42:23 +0100 Miquel Raynal <[email protected]>…
Quoted 19 lines
Quoted 19 lines
drivers/mtd/nand/spi/core.c +15
-0@@ -866,6 +872,24 @@ static int spinand_create_dirmap(struct spinand_device *spinand, spinand->dirmaps[plane].rdesc = desc; + info.op_tmpl = *spinand->op_templates.update_cache; + info.op_tmpl.ecc_en = true; + desc =devm_spi_mem_dirmap_create (&spinand->spimem->spi->dev, + spinand->spimem, &info); +if (IS_ERR (desc)) +return PTR_ERR (desc); + + spinand->dirmaps[plane].wdesc_ecc = desc; + + info.op_tmpl = *spinand->op_templates.read_cache; + info.op_tmpl.ecc_en = true; + desc =devm_spi_mem_dirmap_create (&spinand->spimem->spi->dev, + spinand->spimem, &info); +if (IS_ERR (desc)) +return PTR_ERR (desc);Quoted 8 lines
drivers/mtd/nand/spi/core.c static int spinand_create_dirmap(struct spinand_device *spinand, · line 892
Quoted 3 lines
drivers/mtd/nand/spi/core.c +3
-0+ + spinand->dirmaps[plane].rdesc_ecc = desc; +Direct mappings are not free (they might reserve a piece of MMIO address space depending on the spi-mem controller implementation), so I'd recommend creating those mapping only when strictly needed, that is, when dealing with a pipelined ECC.
Quoted 8 lines
That's what I tried to do in the first place, but unfortunately the direct mappings are instantiated at the time the SPI controller gets probed, which happens before the NAND flash being initialized and its ECC engine being picked. Hence, at this point, we don't really know what engine will be used with this ECC engine. I finally gave up and ended up creating 4 dirmaps (per lun). I know it's not optimal and in most cases consume more address space than needed but couldn't find a better solution yet :/
Why do you have to create the ECC mappings that early? Can't you just create them after the ECC initialization is done? AFAICT, they won't be used before that anyway.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerRe: [PATCH v2 15/20] mtd: spinand: Create direct mapping descriptors for ECC operations
Hi Boris,
[email protected] wrote on Fri, 26 Nov 2021 15:47:06 +0100:
Quoted 40 lines
Quoted 28 lines · On Fri, 26 Nov 2021 15:42:23 +0100 Miquel Raynal <[email protected]>…
Quoted 19 lines
Quoted 19 lines
drivers/mtd/nand/spi/core.c +15
-0@@ -866,6 +872,24 @@ static int spinand_create_dirmap(struct spinand_device *spinand, spinand->dirmaps[plane].rdesc = desc; + info.op_tmpl = *spinand->op_templates.update_cache; + info.op_tmpl.ecc_en = true; + desc =devm_spi_mem_dirmap_create (&spinand->spimem->spi->dev, + spinand->spimem, &info); +if (IS_ERR (desc)) +return PTR_ERR (desc); + + spinand->dirmaps[plane].wdesc_ecc = desc; + + info.op_tmpl = *spinand->op_templates.read_cache; + info.op_tmpl.ecc_en = true; + desc =devm_spi_mem_dirmap_create (&spinand->spimem->spi->dev, + spinand->spimem, &info); +if (IS_ERR (desc)) +return PTR_ERR (desc);Quoted 8 lines
drivers/mtd/nand/spi/core.c static int spinand_create_dirmap(struct spinand_device *spinand, · line 892
Quoted 3 lines
drivers/mtd/nand/spi/core.c +3
-0+ + spinand->dirmaps[plane].rdesc_ecc = desc; +Direct mappings are not free (they might reserve a piece of MMIO address space depending on the spi-mem controller implementation), so I'd recommend creating those mapping only when strictly needed, that is, when dealing with a pipelined ECC.
Quoted 8 lines
That's what I tried to do in the first place, but unfortunately the direct mappings are instantiated at the time the SPI controller gets probed, which happens before the NAND flash being initialized and its ECC engine being picked. Hence, at this point, we don't really know what engine will be used with this ECC engine. I finally gave up and ended up creating 4 dirmaps (per lun). I know it's not optimal and in most cases consume more address space than needed but couldn't find a better solution yet :/
Quoted 3 lines
Why do you have to create the ECC mappings that early? Can't you just create them after the ECC initialization is done? AFAICT, they won't be used before that anyway.
Yeah that's right, maybe we don't need them that early. I'll move things around and try that out.
Thanks!
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 16/20 spi: mxic: Fix the transmit path
In reply to Miquel RaynalBy working with external hardware ECC engines, we figured out that Under certain circumstances, it is needed for the SPI controller to check INT_TX_EMPTY and INT_RX_NOT_EMPTY in both receive and transmit path (not only in the receive path). The delay penalty being negligible, move this code in the common path.
--- drivers/spi/spi-mxic.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-)
drivers/spi/spi-mxic.c +12 -16
@@ -304,25 +304,21 @@ static int mxic_spi_data_xfer(struct mxic_spi *mxic, const void *txbuf,writel (data, mxic->regs +TXD (nbytes %4 )); + ret =readl_poll_timeout (mxic->regs +INT_STS , sts, + sts &INT_TX_EMPTY ,0 ,USEC_PER_SEC ); +if (ret) +return ret; + + ret =readl_poll_timeout (mxic->regs +INT_STS , sts, + sts &INT_RX_NOT_EMPTY ,0 , +USEC_PER_SEC ); +if (ret) +return ret; + + data =readl (mxic->regs +RXD );if (rxbuf) { - ret =readl_poll_timeout (mxic->regs +INT_STS , sts, - sts &INT_TX_EMPTY ,0 , -USEC_PER_SEC ); -if (ret) -return ret; - - ret =readl_poll_timeout (mxic->regs +INT_STS , sts, - sts &INT_RX_NOT_EMPTY ,0 , -USEC_PER_SEC ); -if (ret) -return ret; - - data =readl (mxic->regs +RXD ); data >>= (8 * (4 - nbytes));memcpy (rxbuf + pos, &data, nbytes); -WARN_ON (readl (mxic->regs +INT_STS ) &INT_RX_NOT_EMPTY ); - }else { -readl (mxic->regs +RXD ); }WARN_ON (readl (mxic->regs +INT_STS ) &INT_RX_NOT_EMPTY );
Signature · 6 lines
2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerPATCH v2 17/20 spi: mxic: Create a helper to configure the controller before an operation
In reply to Miquel RaynalCreate the mxic_spi_set_hc_cfg() helper to configure the HC_CFG register. This helper will soon be used by the dirmap implementation and having this code factorized out earlier will clarify this addition.
--- drivers/spi/spi-mxic.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)
drivers/spi/spi-mxic.c +19 -12
@@ -280,6 +280,22 @@ static void mxic_spi_hw_init(struct mxic_spi *mxic) mxic->regs + HC_CFG); } +static u32 mxic_spi_prep_hc_cfg (struct spi_device *spi,u32 flags) +{ +int nio =1 ; + +if (spi->mode & (SPI_TX_OCTAL |SPI_RX_OCTAL )) + nio =8 ; +else if (spi->mode & (SPI_TX_QUAD |SPI_RX_QUAD )) + nio =4 ; +else if (spi->mode & (SPI_TX_DUAL |SPI_RX_DUAL )) + nio =2 ; + +return flags |HC_CFG_NIO (nio) | +HC_CFG_TYPE (spi->chip_select,HC_CFG_TYPE_SPI_NOR ) | +HC_CFG_SLV_ACT (spi->chip_select) |HC_CFG_IDLE_SIO_LVL (1 ); +} +static int mxic_spi_data_xfer (struct mxic_spi *mxic,const void *txbuf,void *rxbuf,unsigned int len) {
@@ -357,7 +373,7 @@ static int mxic_spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) {struct mxic_spi *mxic =spi_master_get_devdata (mem->spi->master); -int nio =1 , i, ret; +int i, ret;u32 ss_ctrl;u8 addr[8 ], cmd[2 ];
@@ -365,18 +381,9 @@ static int mxic_spi_mem_exec_op(struct spi_mem *mem,if (ret)return ret; -if (mem->spi->mode & (SPI_TX_OCTAL |SPI_RX_OCTAL )) - nio =8 ; -else if (mem->spi->mode & (SPI_TX_QUAD |SPI_RX_QUAD )) - nio =4 ; -else if (mem->spi->mode & (SPI_TX_DUAL |SPI_RX_DUAL )) - nio =2 ; - -writel (HC_CFG_NIO (nio) | -HC_CFG_TYPE (mem->spi->chip_select,HC_CFG_TYPE_SPI_NOR ) | -HC_CFG_SLV_ACT (mem->spi->chip_select) |HC_CFG_IDLE_SIO_LVL (1 ) | -HC_CFG_MAN_CS_EN , +writel (mxic_spi_prep_hc_cfg (mem->spi,HC_CFG_MAN_CS_EN ), mxic->regs +HC_CFG ); +writel (HC_EN_BIT , mxic->regs +HC_EN ); ss_ctrl = OP_CMD_BYTES(op->cmd.nbytes) |
Signature · 1 line
2.27.0
Miquel Raynal
maintainerPATCH v2 18/20 spi: mxic: Create a helper to ease the start of an operation
In reply to Miquel RaynalCreate the mxic_spi_mem_prep_op_cfg() helper to provide the content to write to the register controlling the next IO command. This helper will soon be used by the dirmap implementation and having this code factorized out earlier will clarify this addition.
--- drivers/spi/spi-mxic.c | 53 +++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 24 deletions(-)
drivers/spi/spi-mxic.c +29 -24
@@ -296,6 +296,33 @@ static u32 mxic_spi_prep_hc_cfg(struct spi_device *spi, u32 flags)HC_CFG_SLV_ACT (spi->chip_select) |HC_CFG_IDLE_SIO_LVL (1 ); } +static u32 mxic_spi_mem_prep_op_cfg (const struct spi_mem_op *op) +{ +u32 cfg =OP_CMD_BYTES (op->cmd.nbytes) | +OP_CMD_BUSW (fls (op->cmd.buswidth) -1 ) | + (op->cmd.dtr ?OP_CMD_DDR :0 ); + +if (op->addr.nbytes) + cfg |=OP_ADDR_BYTES (op->addr.nbytes) | +OP_ADDR_BUSW (fls (op->addr.buswidth) -1 ) | + (op->addr.dtr ?OP_ADDR_DDR :0 ); + +if (op->dummy.nbytes) + cfg |=OP_DUMMY_CYC (op->dummy.nbytes); + +if (op->data.nbytes) { + cfg |=OP_DATA_BUSW (fls (op->data.buswidth) -1 ) | + (op->data.dtr ?OP_DATA_DDR :0 ); +if (op->data.dir ==SPI_MEM_DATA_IN ) { + cfg |=OP_READ ; +if (op->data.dtr) + cfg |=OP_DQS_EN ; + } + } + +return cfg; +} +static int mxic_spi_data_xfer (struct mxic_spi *mxic,const void *txbuf,void *rxbuf,unsigned int len) {
@@ -374,7 +401,6 @@ static int mxic_spi_mem_exec_op(struct spi_mem *mem, {struct mxic_spi *mxic =spi_master_get_devdata (mem->spi->master);int i, ret; -u32 ss_ctrl;u8 addr[8 ], cmd[2 ]; ret =mxic_spi_set_freq (mxic, mem->spi->max_speed_hz);
@@ -386,29 +412,8 @@ static int mxic_spi_mem_exec_op(struct spi_mem *mem,writel (HC_EN_BIT , mxic->regs +HC_EN ); - ss_ctrl =OP_CMD_BYTES (op->cmd.nbytes) | -OP_CMD_BUSW (fls (op->cmd.buswidth) -1 ) | - (op->cmd.dtr ?OP_CMD_DDR :0 ); - -if (op->addr.nbytes) - ss_ctrl |=OP_ADDR_BYTES (op->addr.nbytes) | -OP_ADDR_BUSW (fls (op->addr.buswidth) -1 ) | - (op->addr.dtr ?OP_ADDR_DDR :0 ); - -if (op->dummy.nbytes) - ss_ctrl |=OP_DUMMY_CYC (op->dummy.nbytes); - -if (op->data.nbytes) { - ss_ctrl |=OP_DATA_BUSW (fls (op->data.buswidth) -1 ) | - (op->data.dtr ?OP_DATA_DDR :0 ); -if (op->data.dir ==SPI_MEM_DATA_IN ) { - ss_ctrl |=OP_READ ; -if (op->data.dtr) - ss_ctrl |=OP_DQS_EN ; - } - } - -writel (ss_ctrl, mxic->regs +SS_CTRL (mem->spi->chip_select)); +writel (mxic_spi_mem_prep_op_cfg (op), + mxic->regs +SS_CTRL (mem->spi->chip_select));writel (readl (mxic->regs +HC_CFG ) |HC_CFG_MAN_CS_ASSERT , mxic->regs +HC_CFG );
Signature · 1 line
2.27.0
Miquel Raynal
maintainerPATCH v2 19/20 spi: mxic: Add support for direct mapping
In reply to Miquel RaynalImplement the ->dirmap_create() and ->dirmap_read/write() hooks to provide a fast path for read and write accesses.
--- drivers/spi/spi-mxic.c | 112 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 109 insertions(+), 3 deletions(-)
drivers/spi/spi-mxic.c +109 -3
@@ -172,6 +172,11 @@ struct mxic_spi {struct clk *send_dly_clk;void __iomem *regs;u32 cur_speed_hz; +struct { +void __iomem *map; +dma_addr_t dma; +size_t size; + } linear; };static int mxic_spi_clk_enable (struct mxic_spi *mxic)
@@ -296,7 +301,8 @@ static u32 mxic_spi_prep_hc_cfg(struct spi_device *spi, u32 flags)HC_CFG_SLV_ACT (spi->chip_select) |HC_CFG_IDLE_SIO_LVL (1 ); } -static u32 mxic_spi_mem_prep_op_cfg (const struct spi_mem_op *op) +static u32 mxic_spi_mem_prep_op_cfg (const struct spi_mem_op *op, +unsigned int data_len) {u32 cfg =OP_CMD_BYTES (op->cmd.nbytes) | OP_CMD_BUSW(fls(op->cmd.buswidth) - 1) |
@@ -310,7 +316,8 @@ static u32 mxic_spi_mem_prep_op_cfg(const struct spi_mem_op *op)if (op->dummy.nbytes) cfg |=OP_DUMMY_CYC (op->dummy.nbytes); -if (op->data.nbytes) { +/* Direct mapping data.nbytes field is not populated */ +if (data_len) { cfg |=OP_DATA_BUSW (fls (op->data.buswidth) -1 ) | (op->data.dtr ?OP_DATA_DDR :0 );if (op->data.dir ==SPI_MEM_DATA_IN ) {
@@ -371,6 +378,77 @@ static int mxic_spi_data_xfer(struct mxic_spi *mxic, const void *txbuf,return 0 ; } +static ssize_t mxic_spi_mem_dirmap_read (struct spi_mem_dirmap_desc *desc, +u64 offs,size_t len,void *buf) +{ +struct mxic_spi *mxic =spi_master_get_devdata (desc->mem->spi->master); +int ret; +u32 sts; + +if (WARN_ON (offs + desc->info.offset + len >U32_MAX )) +return -EINVAL ; + +writel (mxic_spi_prep_hc_cfg (desc->mem->spi,0 ), mxic->regs +HC_CFG ); + +writel (mxic_spi_mem_prep_op_cfg (&desc->info.op_tmpl, len), + mxic->regs +LRD_CFG ); +writel (desc->info.offset + offs, mxic->regs +LRD_ADDR ); + len =min_t (size_t, len, mxic->linear.size); +writel (len, mxic->regs +LRD_RANGE ); +writel (LMODE_CMD0 (desc->info.op_tmpl.cmd.opcode) | +LMODE_SLV_ACT (desc->mem->spi->chip_select) | +LMODE_EN , + mxic->regs +LRD_CTRL ); + +memcpy_fromio (buf, mxic->linear.map, len); + +writel (INT_LRD_DIS , mxic->regs +INT_STS ); +writel (0 , mxic->regs +LRD_CTRL ); + + ret =readl_poll_timeout (mxic->regs +INT_STS , sts, + sts &INT_LRD_DIS ,0 ,USEC_PER_SEC ); +if (ret) +return ret; + +return len; +} + +static ssize_t mxic_spi_mem_dirmap_write (struct spi_mem_dirmap_desc *desc, +u64 offs,size_t len, +const void *buf) +{ +struct mxic_spi *mxic =spi_master_get_devdata (desc->mem->spi->master); +u32 sts; +int ret; + +if (WARN_ON (offs + desc->info.offset + len >U32_MAX )) +return -EINVAL ; + +writel (mxic_spi_prep_hc_cfg (desc->mem->spi,0 ), mxic->regs +HC_CFG ); + +writel (mxic_spi_mem_prep_op_cfg (&desc->info.op_tmpl, len), + mxic->regs +LWR_CFG ); +writel (desc->info.offset + offs, mxic->regs +LWR_ADDR ); + len =min_t (size_t, len, mxic->linear.size); +writel (len, mxic->regs +LWR_RANGE ); +writel (LMODE_CMD0 (desc->info.op_tmpl.cmd.opcode) | +LMODE_SLV_ACT (desc->mem->spi->chip_select) | +LMODE_EN , + mxic->regs +LWR_CTRL ); + +memcpy_toio (mxic->linear.map, buf, len); + +writel (INT_LWR_DIS , mxic->regs +INT_STS ); +writel (0 , mxic->regs +LWR_CTRL ); + + ret =readl_poll_timeout (mxic->regs +INT_STS , sts, + sts &INT_LWR_DIS ,0 ,USEC_PER_SEC ); +if (ret) +return ret; + +return len; +} +static bool mxic_spi_mem_supports_op (struct spi_mem *mem,const struct spi_mem_op *op) {
@@ -396,6 +474,22 @@ static bool mxic_spi_mem_supports_op(struct spi_mem *mem,return spi_mem_dtr_supports_op (mem, op); } +static int mxic_spi_mem_dirmap_create (struct spi_mem_dirmap_desc *desc) +{ +struct mxic_spi *mxic =spi_master_get_devdata (desc->mem->spi->master); + +if (!mxic->linear.map) +return -EINVAL ; + +if (desc->info.offset + desc->info.length >U32_MAX ) +return -EINVAL ; + +if (!mxic_spi_mem_supports_op (desc->mem, &desc->info.op_tmpl)) +return -EOPNOTSUPP ; + +return 0 ; +} +static int mxic_spi_mem_exec_op (struct spi_mem *mem,const struct spi_mem_op *op) {
@@ -412,7 +506,7 @@ static int mxic_spi_mem_exec_op(struct spi_mem *mem,writel (HC_EN_BIT , mxic->regs +HC_EN ); -writel (mxic_spi_mem_prep_op_cfg (op), +writel (mxic_spi_mem_prep_op_cfg (op, op->data.nbytes), mxic->regs +SS_CTRL (mem->spi->chip_select)); writel(readl(mxic->regs + HC_CFG) | HC_CFG_MAN_CS_ASSERT,
@@ -454,6 +548,9 @@ static int mxic_spi_mem_exec_op(struct spi_mem *mem,static const struct spi_controller_mem_ops mxic_spi_mem_ops = { .supports_op = mxic_spi_mem_supports_op, .exec_op = mxic_spi_mem_exec_op, + .dirmap_create = mxic_spi_mem_dirmap_create, + .dirmap_read = mxic_spi_mem_dirmap_read, + .dirmap_write = mxic_spi_mem_dirmap_write, };static void mxic_spi_set_cs (struct spi_device *spi,bool lvl)
@@ -583,6 +680,15 @@ static int mxic_spi_probe(struct platform_device *pdev)if (IS_ERR (mxic->regs))return PTR_ERR (mxic->regs); + res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"dirmap" ); + mxic->linear.map =devm_ioremap_resource (&pdev->dev, res); +if (!IS_ERR (mxic->linear.map)) { + mxic->linear.dma = res->start; + mxic->linear.size =resource_size (res); + }else { + mxic->linear.map =NULL ; + } +pm_runtime_enable (&pdev->dev); master->auto_runtime_pm = true;
Signature · 1 line
2.27.0
Miquel Raynal
maintainerPATCH v2 20/20 spi: mxic: Add support for pipelined ECC operations
In reply to Miquel RaynalSome SPI-NAND chips do not have a proper on-die ECC engine providing error correction/detection. This is particularly an issue on embedded devices with limited resources because all the computations must happen in software, unless an external hardware engine is provided.
These external engines are new and can be of two categories: external or pipelined. Macronix is providing both, the former being already supported. The second, however, is very SoC implementation dependent and must be instantiated by the SPI host controller directly.
An entire subsystem has been contributed to support these engines which makes the insertion into another subsystem such as SPI quite straightforward without the need for a lot of specific functions.
--- drivers/spi/spi-mxic.c | 112 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 110 insertions(+), 2 deletions(-)
drivers/spi/spi-mxic.c +110 -2
@@ -12,6 +12,8 @@#include <linux/io.h> #include <linux/iopoll.h> #include <linux/module.h> +#include <linux/mtd/nand.h> +#include <linux/mtd/nand-ecc-mxic.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/spi/spi.h>
@@ -167,6 +169,7 @@#define HW_TEST (x) (0xe0 + ((x) * 4))struct mxic_spi { +struct device *dev;struct clk *ps_clk;struct clk *send_clk;struct clk *send_dly_clk;
@@ -177,6 +180,12 @@ struct mxic_spi {dma_addr_t dma;size_t size; } linear; + +struct { +bool use_pipelined_conf; +struct nand_ecc_engine *pipelined_engine; +void *ctx; + } ecc; };static int mxic_spi_clk_enable (struct mxic_spi *mxic)
@@ -400,7 +409,15 @@ static ssize_t mxic_spi_mem_dirmap_read(struct spi_mem_dirmap_desc *desc,LMODE_EN , mxic->regs + LRD_CTRL); -memcpy_fromio (buf, mxic->linear.map, len); +if (mxic->ecc.use_pipelined_conf && desc->info.op_tmpl.ecc_en) { + ret =mxic_ecc_process_data_pipelined (mxic->ecc.pipelined_engine, +NAND_PAGE_READ , + mxic->linear.dma + offs); +if (ret) +return ret; + }else { +memcpy_fromio (buf, mxic->linear.map, len); + }writel (INT_LRD_DIS , mxic->regs +INT_STS );writel (0 , mxic->regs +LRD_CTRL );
@@ -436,7 +453,15 @@ static ssize_t mxic_spi_mem_dirmap_write(struct spi_mem_dirmap_desc *desc,LMODE_EN , mxic->regs + LWR_CTRL); -memcpy_toio (mxic->linear.map, buf, len); +if (mxic->ecc.use_pipelined_conf && desc->info.op_tmpl.ecc_en) { + ret =mxic_ecc_process_data_pipelined (mxic->ecc.pipelined_engine, +NAND_PAGE_WRITE , + mxic->linear.dma + offs); +if (ret) +return ret; + }else { +memcpy_toio (mxic->linear.map, buf, len); + }writel (INT_LWR_DIS , mxic->regs +INT_STS );writel (0 , mxic->regs +LWR_CTRL );
@@ -615,6 +640,80 @@ static int mxic_spi_transfer_one(struct spi_master *master,return 0 ; } +/* ECC wrapper */ +static int mxic_spi_mem_ecc_init_ctx (struct nand_device *nand) +{ +struct nand_ecc_engine_ops *ops =mxic_ecc_get_pipelined_ops (); +struct mxic_spi *mxic = nand->ecc.engine->priv; + + mxic->ecc.use_pipelined_conf = true; + +return ops->init_ctx (nand); +} + +static void mxic_spi_mem_ecc_cleanup_ctx (struct nand_device *nand) +{ +struct nand_ecc_engine_ops *ops =mxic_ecc_get_pipelined_ops (); +struct mxic_spi *mxic = nand->ecc.engine->priv; + + mxic->ecc.use_pipelined_conf = false; + + ops->cleanup_ctx (nand); +} + +static int mxic_spi_mem_ecc_prepare_io_req (struct nand_device *nand, +struct nand_page_io_req *req) +{ +struct nand_ecc_engine_ops *ops =mxic_ecc_get_pipelined_ops (); + +return ops->prepare_io_req (nand, req); +} + +static int mxic_spi_mem_ecc_finish_io_req (struct nand_device *nand, +struct nand_page_io_req *req) +{ +struct nand_ecc_engine_ops *ops =mxic_ecc_get_pipelined_ops (); + +return ops->finish_io_req (nand, req); +} + +static struct nand_ecc_engine_ops mxic_spi_mem_ecc_engine_pipelined_ops = { + .init_ctx = mxic_spi_mem_ecc_init_ctx, + .cleanup_ctx = mxic_spi_mem_ecc_cleanup_ctx, + .prepare_io_req = mxic_spi_mem_ecc_prepare_io_req, + .finish_io_req = mxic_spi_mem_ecc_finish_io_req, +}; + +static void mxic_spi_mem_ecc_remove (struct mxic_spi *mxic) +{ +if (mxic->ecc.pipelined_engine) { +mxic_ecc_put_pipelined_engine (mxic->ecc.pipelined_engine); +nand_ecc_unregister_on_host_hw_engine (mxic->ecc.pipelined_engine); + } +} + +static int mxic_spi_mem_ecc_probe (struct platform_device *pdev, +struct mxic_spi *mxic) +{ +struct nand_ecc_engine *eng; + +if (!mxic_ecc_get_pipelined_ops ()) +return -EOPNOTSUPP ; + + eng =mxic_ecc_get_pipelined_engine (pdev); +if (IS_ERR (eng)) +return PTR_ERR (eng); + + eng->dev = &pdev->dev; + eng->integration =NAND_ECC_ENGINE_INTEGRATION_PIPELINED ; + eng->ops = &mxic_spi_mem_ecc_engine_pipelined_ops; + eng->priv = mxic; + mxic->ecc.pipelined_engine = eng; +nand_ecc_register_on_host_hw_engine (eng); + +return 0 ; +} +static int __maybe_unused mxic_spi_runtime_suspend (struct device *dev) {struct spi_master *master =dev_get_drvdata (dev);
@@ -660,6 +759,7 @@ static int mxic_spi_probe(struct platform_device *pdev)platform_set_drvdata (pdev, master); mxic =spi_master_get_devdata (master); + mxic->dev = &pdev->dev; master->dev.of_node = pdev->dev.of_node;
@@ -705,6 +805,12 @@ static int mxic_spi_probe(struct platform_device *pdev)mxic_spi_hw_init (mxic); + ret =mxic_spi_mem_ecc_probe (pdev, mxic); +if (ret == -EPROBE_DEFER ) { +pm_runtime_disable (&pdev->dev); +return ret; + } + ret =spi_register_master (master);if (ret) {dev_err (&pdev->dev,"spi_register_master failed\n" );
@@ -717,8 +823,10 @@ static int mxic_spi_probe(struct platform_device *pdev)static int mxic_spi_remove (struct platform_device *pdev) {struct spi_master *master =platform_get_drvdata (pdev); +struct mxic_spi *mxic =spi_master_get_devdata (master);pm_runtime_disable (&pdev->dev); +mxic_spi_mem_ecc_remove (mxic);spi_unregister_master (master);return 0 ;
Signature · 1 line
2.27.0
kernel test robot
build botRe: [PATCH v2 20/20] spi: mxic: Add support for pipelined ECC operations
I love your patch! Perhaps something to improve:
Hi Miquel,
I love your patch! Perhaps something to improve:
[auto build test WARNING on mtd/nand/next]
[also build test WARNING on broonie-spi/for-next mtd/mtd/next mtd/mtd/fixes v5.16-rc2 next-20211126] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Miquel-Raynal/External-ECC-engines-Macronix-support/20211126-195956 base: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next config: xtensa-buildonly-randconfig-r006-20211125 (https://download.01.org/0day-ci/archive/20211127/202111270526.T8x5Nyq1-lkp(a)intel.com/config) compiler: xtensa-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/0804d6ccdf15e7a65743d048d01d876a54070b6b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Miquel-Raynal/External-ECC-engines-Macronix-support/20211126-195956 git checkout 0804d6ccdf15e7a65743d048d01d876a54070b6b
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=xtensa SHELL=/bin/bash drivers/spi/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
In file included from drivers/spi/spi-mxic.c:16:
>> include/linux/mtd/nand-ecc-mxic.h:34:1: warning: no previous prototype for 'mxic_ecc_get_pipelined_engine' [-Wmissing-prototypes]
34 | mxic_ecc_get_pipelined_engine(struct platform_device *spi_pdev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/mtd/nand-ecc-mxic.h:39:6: warning: no previous prototype for 'mxic_ecc_put_pipelined_engine' [-Wmissing-prototypes]
39 | void mxic_ecc_put_pipelined_engine(struct nand_ecc_engine *eng) {}
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~vim +/mxic_ecc_get_pipelined_engine +34 include/linux/mtd/nand-ecc-mxic.h
a19f28121341b52 Miquel Raynal 2021-11-26 32
a19f28121341b52 Miquel Raynal 2021-11-26 33 struct nand_ecc_engine *
a19f28121341b52 Miquel Raynal 2021-11-26 @34 mxic_ecc_get_pipelined_engine(struct platform_device *spi_pdev)
a19f28121341b52 Miquel Raynal 2021-11-26 35 {
a19f28121341b52 Miquel Raynal 2021-11-26 36 return ERR_PTR(-EOPNOTSUPP);
a19f28121341b52 Miquel Raynal 2021-11-26 37 }a19f28121341b52 Miquel Raynal 2021-11-26 38a19f28121341b52 Miquel Raynal 2021-11-26 @39 void mxic_ecc_put_pipelined_engine(struct nand_ecc_engine *eng) {} a19f28121341b52 Miquel Raynal 2021-11-26 40
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH v2 20/20] spi: mxic: Add support for pipelined ECC operations
In reply to Miquel RaynalI love your patch! Yet something to improve:
Hi Miquel,
I love your patch! Yet something to improve:
[auto build test ERROR on mtd/nand/next]
[also build test ERROR on broonie-spi/for-next mtd/mtd/next mtd/mtd/fixes v5.16-rc2 next-20211126] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Miquel-Raynal/External-ECC-engines-Macronix-support/20211126-195956 base: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next config: csky-buildonly-randconfig-r004-20211126 (https://download.01.org/0day-ci/archive/20211127/202111271552.AOgIHVI2-lkp(a)intel.com/config) compiler: csky-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/0804d6ccdf15e7a65743d048d01d876a54070b6b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Miquel-Raynal/External-ECC-engines-Macronix-support/20211126-195956 git checkout 0804d6ccdf15e7a65743d048d01d876a54070b6b
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=csky SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
csky-linux-ld: drivers/spi/spi-mxic.o: in function `mxic_spi_remove':
>> spi-mxic.c:(.text+0xba4): undefined reference to `nand_ecc_unregister_on_host_hw_engine'
csky-linux-ld: drivers/spi/spi-mxic.o: in function `mxic_ecc_put_pipelined_engine':
spi-mxic.c:(.text+0xbc8): undefined reference to `nand_ecc_unregister_on_host_hw_engine'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Mark Brown
maintainerQuoted 4 lines · Miquel Raynal
As a first example, Macronix ECC engine can be used as an external engine (takes the data, proceeds to the calculations, writes back the ECC bytes) or as a pipelined engine doing on-the-fly calculations (which is very common in the raw NAND world).
The SPI bits of this look fine (most of the smarts are in the MTD code!), what's the plan for getting this merged?
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerHi Mark,
[email protected] wrote on Fri, 26 Nov 2021 13:37:18 +0000:
Quoted 9 lines · Miquel Raynal
Quoted 5 lines
As a first example, Macronix ECC engine can be used as an external engine (takes the data, proceeds to the calculations, writes back the ECC bytes) or as a pipelined engine doing on-the-fly calculations (which is very common in the raw NAND world).
The SPI bits of this look fine (most of the smarts are in the MTD code!), what's the plan for getting this merged?
Great! Thanks for the feedback.
If you acknowledge the SPI bits I believe I can carry the entire series through the MTD tree. If you fear conflicts and need an immutable tag I can also do that.
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 3 lines · Miquel Raynal
If you acknowledge the SPI bits I believe I can carry the entire series through the MTD tree. If you fear conflicts and need an immutable tag I can also do that.
It'd be good to have the tag just in case, there's generally a lot of work in this area.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerHi Mark,
[email protected] wrote on Fri, 26 Nov 2021 14:13:34 +0000:
Quoted 8 lines · Miquel Raynal
Quoted 4 lines
If you acknowledge the SPI bits I believe I can carry the entire series through the MTD tree. If you fear conflicts and need an immutable tag I can also do that.
It'd be good to have the tag just in case, there's generally a lot of work in this area.
Sure.
Quoted 1 line
Reviewed-by Mark Brown <[email protected]>
I'll need to send a v3, shall I add this tag to all the spi and spi binding changes?
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/