Add MediaTek MT7986 NAND ECC engine support
Subsystems (5)
v6 cover Add MediaTek MT7986 NAND ECC engine support
This patch series split from bellow series which pick-up mtd relevant patches
https://lore.kernel.org/all/[email protected].
This series add MediaTek MT7986 NAND ECC controller support, split ECC engine with rawnand controller in bindings and change to YAML schema.
Changes since V5:
- Split from previous series V4.
- Fix warning by change mtk-nand.txt references to new yaml file.
Changes since V4:
- Split arm and arm64 dts patch for fix existing NAND controller node name.
Changes since V3:
- Correct mediatek,mtk-nfc.yaml dt-bindings.
Changes since V2:
- Change ECC err_mask value with GENMASK macro.
- Change snfi mediatek,rx-latch-latency to mediatek,rx-latch-latency-ns.
- Add a separate patch for DTS change.
- Move common description to top-level pattern properties.
- Drop redundant parts in dt-bindings.
Changes since V1:
- Improve and perfect dt-bindings documentation.
- Change existing node name to match NAND controller DT bingings.
- Fix issues reported by dt_binding_check.
- Fix issues reported by dtbs_check.
Xiangsheng Hou (5):
dt-bindings: mtd: Split ECC engine with rawnand controller
arm64: dts: mediatek: Fix existing NAND controller node name
arm: dts: mediatek: Fix existing NAND controller node name
dt-bindings: mtd: mediatek,nand-ecc-engine: Add compatible for MT7986
mtd: nand: ecc-mtk: Add ECC support fot MT7986 IC
.../bindings/mtd/mediatek,mtk-nfc.yaml | 155 +++++++++++++++ .../mtd/mediatek,nand-ecc-engine.yaml | 63 +++++++ .../devicetree/bindings/mtd/mtk-nand.txt | 176 ------------------ MAINTAINERS | 2 +- arch/arm/boot/dts/mt2701.dtsi | 2 +- arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 2 +- arch/arm64/boot/dts/mediatek/mt7622.dtsi | 2 +- drivers/mtd/nand/ecc-mtk.c | 28 ++- 8 files changed, 247 insertions(+), 183 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/mediatek,mtk-nfc.yaml create mode 100644 Documentation/devicetree/bindings/mtd/mediatek,nand-ecc-engine.yaml delete mode 100644 Documentation/devicetree/bindings/mtd/mtk-nand.txt
Signature · 1 line
2.25.1
PATCH v6 1/5 dt-bindings: mtd: Split ECC engine with rawnand controller
Split MediaTek ECC engine with rawnand controller and convert to YAML schema.
--- .../bindings/mtd/mediatek,mtk-nfc.yaml | 155 +++++++++++++++ .../mtd/mediatek,nand-ecc-engine.yaml | 62 ++++++ .../devicetree/bindings/mtd/mtk-nand.txt | 176 ------------------ MAINTAINERS | 2 +- 4 files changed, 218 insertions(+), 177 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/mediatek,mtk-nfc.yaml create mode 100644 Documentation/devicetree/bindings/mtd/mediatek,nand-ecc-engine.yaml delete mode 100644 Documentation/devicetree/bindings/mtd/mtk-nand.txt
Documentation/devicetree/bindings/mtd/mediatek,mtk-nfc.yaml new file +155 -0
@@ -0,0 +1,155 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/mediatek,mtk-nfc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek(MTK) SoCs raw NAND FLASH controller (NFC) + +maintainers: + - Xiangsheng Hou <[email protected]> + +properties: + compatible: + enum: + - mediatek,mt2701-nfc + - mediatek,mt2712-nfc + - mediatek,mt7622-nfc + + reg: + items: + - description: Base physical address and size of NFI. + + interrupts: + items: + - description: NFI interrupt + + clocks: + items: + - description: clock used for the controller + - description: clock used for the pad + + clock-names: + items: + - const: nfi_clk + - const: pad_clk + + ecc-engine: + description: device-tree node of the required ECC engine. + $ref: /schemas/types.yaml#/definitions/phandle + +patternProperties: + "^nand@[a-f0-9]$": + $ref: nand-chip.yaml# + unevaluatedProperties: false + properties: + reg: + maximum: 1 + nand-on-flash-bbt: true + nand-ecc-mode: + const: hw + +allOf: + - $ref: nand-controller.yaml# + + - if: + properties: + compatible: + contains: + const: mediatek,mt2701-nfc + then: + patternProperties: + "^nand@[a-f0-9]$": + properties: + nand-ecc-step-size: + enum: [ 512, 1024 ] + nand-ecc-strength: + enum: [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 28, 32, 36, + 40, 44, 48, 52, 56, 60] + + - if: + properties: + compatible: + contains: + const: mediatek,mt2712-nfc + then: + patternProperties: + "^nand@[a-f0-9]$": + properties: + nand-ecc-step-size: + enum: [ 512, 1024 ] + nand-ecc-strength: + enum: [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 28, 32, 36, + 40, 44, 48, 52, 56, 60, 68, 72, 80] + + - if: + properties: + compatible: + contains: + const: mediatek,mt7622-nfc + then: + patternProperties: + "^nand@[a-f0-9]$": + properties: + nand-ecc-step-size: + const: 512 + nand-ecc-strength: + enum: [4, 6, 8, 10, 12] + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + - ecc-engine + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/mt2701-clk.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + + soc { + #address-cells = <2>; + #size-cells = <2>; + + nand-controller@1100d000 { + compatible = "mediatek,mt2701-nfc"; + reg = <0 0x1100d000 0 0x1000>; + interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_LOW>; + clocks = <&pericfg CLK_PERI_NFI>, + <&pericfg CLK_PERI_NFI_PAD>; + clock-names = "nfi_clk", "pad_clk"; + ecc-engine = <&bch>; + #address-cells = <1>; + #size-cells = <0>; + + nand@0 { + reg = <0>; + + nand-on-flash-bbt; + nand-ecc-mode = "hw"; + nand-ecc-step-size = <1024>; + nand-ecc-strength = <24>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + preloader@0 { + label = "pl"; + read-only; + reg = <0x0 0x400000>; + }; + android@400000 { + label = "android"; + reg = <0x400000 0x12c00000>; + }; + }; + }; + }; + };
Documentation/devicetree/bindings/mtd/mediatek,nand-ecc-engine.yaml new file +62 -0
62 lines not on this page · raw message
Documentation/devicetree/bindings/mtd/mtk-nand.txt deleted +0 -176
176 lines not on this page · raw message
MAINTAINERS +1 -1
@@ -13088,7 +13088,7 @@ F: drivers/phy/ralink/phy-mt7621-pci.c MEDIATEK NAND CONTROLLER DRIVER L: [email protected] S: Orphan -F: Documentation/devicetree/bindings/mtd/mtk-nand.txt +F: Documentation/devicetree/bindings/mtd/mediatek,mtk-nfc.yaml F: drivers/mtd/nand/raw/mtk_* MEDIATEK PMIC LED DRIVER
Signature · 1 line
2.25.1
Re: [PATCH v6 1/5] dt-bindings: mtd: Split ECC engine with rawnand controller
Quoted 6 lines · Xiangsheng Hou
Split MediaTek ECC engine with rawnand controller and convert to YAML schema.
Signed-off-by Xiangsheng Hou <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>Reported-by kernel test robot <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
PATCH v6 2/5 arm64: dts: mediatek: Fix existing NAND controller node name
In reply to Xiangsheng HouChange the existing node name in order to match NAND controller DT bindings.
--- arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 2 +- arch/arm64/boot/dts/mediatek/mt7622.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/mediatek/mt2712e.dtsi +1 -1
@@ -559,7 +559,7 @@ spi0: spi@1100a000 { status = "disabled"; }; - nandc: nfi@1100e000 { + nandc: nand-controller@1100e000 { compatible = "mediatek,mt2712-nfc"; reg = <0 0x1100e000 0 0x1000>; interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
arch/arm64/boot/dts/mediatek/mt7622.dtsi +1 -1
@@ -538,7 +538,7 @@ bluetooth { }; }; - nandc: nfi@1100d000 { + nandc: nand-controller@1100d000 { compatible = "mediatek,mt7622-nfc"; reg = <0 0x1100D000 0 0x1000>; interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
Signature · 1 line
2.25.1
Re: [PATCH v6 2/5] arm64: dts: mediatek: Fix existing NAND controller node name
Quoted 5 lines · Xiangsheng Hou
Change the existing node name in order to match NAND controller DT bindings.
Signed-off-by Xiangsheng Hou <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>
Queued for the next merge window, thanks!
Quoted 31 lines
--- arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 2 +- arch/arm64/boot/dts/mediatek/mt7622.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/arm64/boot/dts/mediatek/mt2712e.dtsi +1
-1@@ -559,7 +559,7 @@ spi0: spi@1100a000 { status = "disabled"; }; - nandc: nfi@1100e000 { + nandc: nand-controller@1100e000 { compatible = "mediatek,mt2712-nfc"; reg = <0 0x1100e000 0 0x1000>; interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;arch/arm64/boot/dts/mediatek/mt7622.dtsi +1
-1@@ -538,7 +538,7 @@ bluetooth { }; }; - nandc: nfi@1100d000 { + nandc: nand-controller@1100d000 { compatible = "mediatek,mt7622-nfc"; reg = <0 0x1100D000 0 0x1000>; interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
PATCH v6 3/5 arm: dts: mediatek: Fix existing NAND controller node name
In reply to Xiangsheng HouChange the existing node name in order to match NAND controller DT bindings.
--- arch/arm/boot/dts/mt2701.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/mt2701.dtsi +1 -1
@@ -359,7 +359,7 @@ thermal: thermal@1100b000 { mediatek,apmixedsys = <&apmixedsys>; }; - nandc: nfi@1100d000 { + nandc: nand-controller@1100d000 { compatible = "mediatek,mt2701-nfc"; reg = <0 0x1100d000 0 0x1000>; interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_LOW>;
Signature · 1 line
2.25.1
Re: [PATCH v6 3/5] arm: dts: mediatek: Fix existing NAND controller node name
Quoted 5 lines · Xiangsheng Hou
Change the existing node name in order to match NAND controller DT bindings.
Signed-off-by Xiangsheng Hou <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>
Queued for the next merge window, thanks!
Quoted 17 lines
--- arch/arm/boot/dts/mt2701.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/boot/dts/mt2701.dtsi +1
-1@@ -359,7 +359,7 @@ thermal: thermal@1100b000 { mediatek,apmixedsys = <&apmixedsys>; }; - nandc: nfi@1100d000 { + nandc: nand-controller@1100d000 { compatible = "mediatek,mt2701-nfc"; reg = <0 0x1100d000 0 0x1000>; interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_LOW>;
PATCH v6 4/5 dt-bindings: mtd: mediatek,nand-ecc-engine: Add compatible for MT7986
In reply to Xiangsheng HouAdd dt-bindings documentation of ECC for MediaTek MT7986 SoC platform.
--- .../devicetree/bindings/mtd/mediatek,nand-ecc-engine.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/mtd/mediatek,nand-ecc-engine.yaml +1 -0
@@ -18,6 +18,7 @@ properties: - mediatek,mt2701-ecc - mediatek,mt2712-ecc - mediatek,mt7622-ecc + - mediatek,mt7986-ecc reg: items:
Signature · 1 line
2.25.1
Re: [PATCH v6 4/5] dt-bindings: mtd: mediatek,nand-ecc-engine: Add compatible for MT7986
Quoted 5 lines · Xiangsheng Hou
Add dt-bindings documentation of ECC for MediaTek MT7986 SoC platform.
Signed-off-by Xiangsheng Hou <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
PATCH v6 5/5 mtd: nand: ecc-mtk: Add ECC support fot MT7986 IC
In reply to Xiangsheng HouAdd ECC support fot MT7986 IC, and change err_mask value with GENMASK macro.
--- drivers/mtd/nand/ecc-mtk.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)
drivers/mtd/nand/ecc-mtk.c +25 -3
@@ -40,6 +40,10 @@#define ECC_IDLE_REG (op) ((op) == ECC_ENCODE ? ECC_ENCIDLE : ECC_DECIDLE)#define ECC_CTL_REG (op) ((op) == ECC_ENCODE ? ECC_ENCCON : ECC_DECCON) +#define ECC_ERRMASK_MT7622 GENMASK(4, 0) +#define ECC_ERRMASK_MT2701 GENMASK(5, 0) +#define ECC_ERRMASK_MT2712 GENMASK(6, 0) +struct mtk_ecc_caps {u32 err_mask;u32 err_shift;
@@ -79,6 +83,10 @@ static const u8 ecc_strength_mt7622[] = {4 ,6 ,8 ,10 ,12 }; +static const u8 ecc_strength_mt7986[] = { +4 ,6 ,8 ,10 ,12 ,14 ,16 ,18 ,20 ,22 ,24 +}; +enum mtk_ecc_regs {ECC_ENCPAR00 , ECC_ENCIRQ_EN,
@@ -451,7 +459,7 @@ unsigned int mtk_ecc_get_parity_bits(struct mtk_ecc *ecc)EXPORT_SYMBOL (mtk_ecc_get_parity_bits);static const struct mtk_ecc_caps mtk_ecc_caps_mt2701 = { - .err_mask =0x3f , + .err_mask =ECC_ERRMASK_MT2701 , .err_shift =8 , .ecc_strength = ecc_strength_mt2701, .ecc_regs = mt2701_ecc_regs,
@@ -462,7 +470,7 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt2701 = { };static const struct mtk_ecc_caps mtk_ecc_caps_mt2712 = { - .err_mask =0x7f , + .err_mask =ECC_ERRMASK_MT2712 , .err_shift =8 , .ecc_strength = ecc_strength_mt2712, .ecc_regs = mt2712_ecc_regs,
@@ -473,7 +481,7 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt2712 = { };static const struct mtk_ecc_caps mtk_ecc_caps_mt7622 = { - .err_mask =0x1f , + .err_mask =ECC_ERRMASK_MT7622 , .err_shift =5 , .ecc_strength = ecc_strength_mt7622, .ecc_regs = mt7622_ecc_regs,
@@ -483,6 +491,17 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt7622 = { .pg_irq_sel = 0, }; +static const struct mtk_ecc_caps mtk_ecc_caps_mt7986 = { + .err_mask =ECC_ERRMASK_MT7622 , + .err_shift =8 , + .ecc_strength = ecc_strength_mt7986, + .ecc_regs = mt2712_ecc_regs, + .num_ecc_strength =11 , + .ecc_mode_shift =5 , + .parity_bits =14 , + .pg_irq_sel =1 , +}; +static const struct of_device_id mtk_ecc_dt_match[] = { { .compatible ="mediatek,mt2701-ecc" ,
@@ -493,6 +512,9 @@ static const struct of_device_id mtk_ecc_dt_match[] = { }, { .compatible = "mediatek,mt7622-ecc", .data = &mtk_ecc_caps_mt7622, + }, { + .compatible = "mediatek,mt7986-ecc", + .data = &mtk_ecc_caps_mt7986, }, {}, };
Signature · 1 line
2.25.1
Re: [PATCH v6 5/5] mtd: nand: ecc-mtk: Add ECC support fot MT7986 IC
Quoted 5 lines · Xiangsheng Hou
Add ECC support fot MT7986 IC, and change
err_maskvalue with GENMASK macro.Signed-off-by Xiangsheng Hou <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>
Quoted 85 lines
--- drivers/mtd/nand/ecc-mtk.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)drivers/mtd/nand/ecc-mtk.c +25
-3@@ -40,6 +40,10 @@#define ECC_IDLE_REG (op) ((op) == ECC_ENCODE ? ECC_ENCIDLE : ECC_DECIDLE)#define ECC_CTL_REG (op) ((op) == ECC_ENCODE ? ECC_ENCCON : ECC_DECCON) +#define ECC_ERRMASK_MT7622 GENMASK(4, 0) +#define ECC_ERRMASK_MT2701 GENMASK(5, 0) +#define ECC_ERRMASK_MT2712 GENMASK(6, 0) +struct mtk_ecc_caps {u32 err_mask;u32 err_shift;@@ -79,6 +83,10 @@ static const u8 ecc_strength_mt7622[] = {4 ,6 ,8 ,10 ,12 }; +static const u8 ecc_strength_mt7986[] = { +4 ,6 ,8 ,10 ,12 ,14 ,16 ,18 ,20 ,22 ,24 +}; +enum mtk_ecc_regs {ECC_ENCPAR00 , ECC_ENCIRQ_EN,@@ -451,7 +459,7 @@ unsigned int mtk_ecc_get_parity_bits(struct mtk_ecc *ecc)EXPORT_SYMBOL (mtk_ecc_get_parity_bits);static const struct mtk_ecc_caps mtk_ecc_caps_mt2701 = { - .err_mask =0x3f , + .err_mask =ECC_ERRMASK_MT2701 , .err_shift =8 , .ecc_strength = ecc_strength_mt2701, .ecc_regs = mt2701_ecc_regs,@@ -462,7 +470,7 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt2701 = { };static const struct mtk_ecc_caps mtk_ecc_caps_mt2712 = { - .err_mask =0x7f , + .err_mask =ECC_ERRMASK_MT2712 , .err_shift =8 , .ecc_strength = ecc_strength_mt2712, .ecc_regs = mt2712_ecc_regs,@@ -473,7 +481,7 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt2712 = { };static const struct mtk_ecc_caps mtk_ecc_caps_mt7622 = { - .err_mask =0x1f , + .err_mask =ECC_ERRMASK_MT7622 , .err_shift =5 , .ecc_strength = ecc_strength_mt7622, .ecc_regs = mt7622_ecc_regs,@@ -483,6 +491,17 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt7622 = { .pg_irq_sel = 0, }; +static const struct mtk_ecc_caps mtk_ecc_caps_mt7986 = { + .err_mask =ECC_ERRMASK_MT7622 , + .err_shift =8 , + .ecc_strength = ecc_strength_mt7986, + .ecc_regs = mt2712_ecc_regs, + .num_ecc_strength =11 , + .ecc_mode_shift =5 , + .parity_bits =14 , + .pg_irq_sel =1 , +}; +static const struct of_device_id mtk_ecc_dt_match[] = { { .compatible ="mediatek,mt2701-ecc" ,@@ -493,6 +512,9 @@ static const struct of_device_id mtk_ecc_dt_match[] = { }, { .compatible = "mediatek,mt7622-ecc", .data = &mtk_ecc_caps_mt7622, + }, { + .compatible = "mediatek,mt7986-ecc", + .data = &mtk_ecc_caps_mt7986, }, {}, };
Re: [PATCH v6 5/5] mtd: nand: ecc-mtk: Add ECC support fot MT7986 IC
In reply to Xiangsheng HouQuoted 6 lines · Xiangsheng Hou
Add ECC support fot MT7986 IC, and change
err_maskvalue with GENMASK macro.Signed-off-by Xiangsheng Hou <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>Reviewed-by Matthias Brugger <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel