From nobody Sat Sep 21 11:30:49 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22A3DC352A1 for ; Mon, 28 Nov 2022 02:08:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229926AbiK1CId (ORCPT ); Sun, 27 Nov 2022 21:08:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbiK1CIN (ORCPT ); Sun, 27 Nov 2022 21:08:13 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3122C5FC6; Sun, 27 Nov 2022 18:08:06 -0800 (PST) X-UUID: d6641431d4cf4f8ba3872537d7c01ce2-20221128 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=x2ZO9T8uDBfvg9Y7/Aj3WgqyBAmho6hFPvG3GNVeqUM=; b=APR/Bb2WvRqMpWbMEu36Aflgqv67msoHCjNx/toaDlTt7qi5BOGUEprV94y1iB5xFr22oQOvuvaQfrCqS3Z4gPnIkqeS/yw+w6zD5UnA4icWGnviq9s9grFU7TM5n3oT3W3aWfFM9X/FsDoNmc9vlBuhjkOvlCFRQI3l6bTYWw4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.14,REQID:cf11ef01-7144-4009-899e-684c8ba1a9e3,IP:0,U RL:25,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-META: VersionHash:dcaaed0,CLOUDID:57a0721e-5e1d-4ab5-ab8e-3e04efc02b30,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: d6641431d4cf4f8ba3872537d7c01ce2-20221128 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 895200316; Mon, 28 Nov 2022 10:08:00 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 28 Nov 2022 10:07:58 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 28 Nov 2022 10:07:57 +0800 From: Xiangsheng Hou To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Mark Brown , Chuanhong Guo CC: Xiangsheng Hou , , , , , , , , Subject: [PATCH 8/9] dt-bindings: mtd: Split ECC engine with rawnand controller Date: Mon, 28 Nov 2022 10:06:12 +0800 Message-ID: <20221128020613.14821-9-xiangsheng.hou@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221128020613.14821-1-xiangsheng.hou@mediatek.com> References: <20221128020613.14821-1-xiangsheng.hou@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Split MediaTek ECC engine with rawnand controller and convert to YAML schema. Signed-off-by: Xiangsheng Hou --- .../bindings/mtd/mtk,nand-ecc-engine.yaml | 60 ++++++ .../devicetree/bindings/mtd/mtk-nand.txt | 176 ------------------ .../devicetree/bindings/mtd/mtk-nand.yaml | 92 +++++++++ 3 files changed, 152 insertions(+), 176 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/mtk,nand-ecc-engi= ne.yaml delete mode 100644 Documentation/devicetree/bindings/mtd/mtk-nand.txt create mode 100644 Documentation/devicetree/bindings/mtd/mtk-nand.yaml diff --git a/Documentation/devicetree/bindings/mtd/mtk,nand-ecc-engine.yaml= b/Documentation/devicetree/bindings/mtd/mtk,nand-ecc-engine.yaml new file mode 100644 index 000000000000..80321157e928 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/mtk,nand-ecc-engine.yaml @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/mtk,nand-ecc-engine.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek(MTK) SoCs NAND ECC engine + +maintainers: + - Xiangsheng Hou + +description: | + MTK NAND ECC engine can cowork with MTK raw NAND and SPI NAND controller. + +properties: + compatible: + enum: + - mediatek,mt2701-ecc + - mediatek,mt2712-ecc + - mediatek,mt7622-ecc + + reg: + items: + - description: Base physical address and size of ECC. + + interrupts: + items: + - description: ECC interrupt + + clocks: + minItems: 1 + items: + - description: clock used for the controller + +required: + - compatible + - reg + - interrupts + - clocks + +unevaluatedProperties: false + +examples: + - | + #include + #include + #include + + soc { + #address-cells =3D <2>; + #size-cells =3D <2>; + + bch: ecc@1100e000 { + compatible =3D "mediatek,mt2701-ecc"; + reg =3D <0 0x1100e000 0 0x1000>; + interrupts =3D ; + clocks =3D <&pericfg CLK_PERI_NFI_ECC>; + }; + }; + diff --git a/Documentation/devicetree/bindings/mtd/mtk-nand.txt b/Documenta= tion/devicetree/bindings/mtd/mtk-nand.txt deleted file mode 100644 index 4d3ec5e4ff8a..000000000000 --- a/Documentation/devicetree/bindings/mtd/mtk-nand.txt +++ /dev/null @@ -1,176 +0,0 @@ -MTK SoCs NAND FLASH controller (NFC) DT binding - -This file documents the device tree bindings for MTK SoCs NAND controllers. -The functional split of the controller requires two drivers to operate: -the nand controller interface driver and the ECC engine driver. - -The hardware description for both devices must be captured as device -tree nodes. - -1) NFC NAND Controller Interface (NFI): -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - -The first part of NFC is NAND Controller Interface (NFI) HW. -Required NFI properties: -- compatible: Should be one of - "mediatek,mt2701-nfc", - "mediatek,mt2712-nfc", - "mediatek,mt7622-nfc". -- reg: Base physical address and size of NFI. -- interrupts: Interrupts of NFI. -- clocks: NFI required clocks. -- clock-names: NFI clocks internal name. -- ecc-engine: Required ECC Engine node. -- #address-cells: NAND chip index, should be 1. -- #size-cells: Should be 0. - -Example: - - nandc: nfi@1100d000 { - compatible =3D "mediatek,mt2701-nfc"; - reg =3D <0 0x1100d000 0 0x1000>; - interrupts =3D ; - clocks =3D <&pericfg CLK_PERI_NFI>, - <&pericfg CLK_PERI_NFI_PAD>; - clock-names =3D "nfi_clk", "pad_clk"; - ecc-engine =3D <&bch>; - #address-cells =3D <1>; - #size-cells =3D <0>; - }; - -Platform related properties, should be set in {platform_name}.dts: -- children nodes: NAND chips. - -Children nodes properties: -- reg: Chip Select Signal, default 0. - Set as reg =3D <0>, <1> when need 2 CS. -Optional: -- nand-on-flash-bbt: Store BBT on NAND Flash. -- nand-ecc-mode: the NAND ecc mode (check driver for supported modes) -- nand-ecc-step-size: Number of data bytes covered by a single ECC step. - valid values: - 512 and 1024 on mt2701 and mt2712. - 512 only on mt7622. - 1024 is recommended for large page NANDs. -- nand-ecc-strength: Number of bits to correct per ECC step. - The valid values that each controller supports: - mt2701: 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 28, - 32, 36, 40, 44, 48, 52, 56, 60. - mt2712: 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 28, - 32, 36, 40, 44, 48, 52, 56, 60, 68, 72, 80. - mt7622: 4, 6, 8, 10, 12, 14, 16. - The strength should be calculated as follows: - E =3D (S - F) * 8 / B - S =3D O / (P / Q) - E : nand-ecc-strength. - S : spare size per sector. - F : FDM size, should be in the range [1,8]. - It is used to store free oob data. - O : oob size. - P : page size. - Q : nand-ecc-step-size. - B : number of parity bits needed to correct - 1 bitflip. - According to MTK NAND controller design, - this number depends on max ecc step size - that MTK NAND controller supports. - If max ecc step size supported is 1024, - then it should be always 14. And if max - ecc step size is 512, then it should be - always 13. - If the result does not match any one of the listed - choices above, please select the smaller valid value from - the list. - (otherwise the driver will do the adjustment at runtime) -- pinctrl-names: Default NAND pin GPIO setting name. -- pinctrl-0: GPIO setting node. - -Example: - &pio { - nand_pins_default: nanddefault { - pins_dat { - pinmux =3D , - , - , - , - , - , - , - , - ; - input-enable; - drive-strength =3D ; - bias-pull-up; - }; - - pins_we { - pinmux =3D ; - drive-strength =3D ; - bias-pull-up =3D ; - }; - - pins_ale { - pinmux =3D ; - drive-strength =3D ; - bias-pull-down =3D ; - }; - }; - }; - - &nandc { - status =3D "okay"; - pinctrl-names =3D "default"; - pinctrl-0 =3D <&nand_pins_default>; - nand@0 { - reg =3D <0>; - nand-on-flash-bbt; - nand-ecc-mode =3D "hw"; - nand-ecc-strength =3D <24>; - nand-ecc-step-size =3D <1024>; - }; - }; - -NAND chip optional subnodes: -- Partitions, see Documentation/devicetree/bindings/mtd/partition.txt - -Example: - nand@0 { - partitions { - compatible =3D "fixed-partitions"; - #address-cells =3D <1>; - #size-cells =3D <1>; - - preloader@0 { - label =3D "pl"; - read-only; - reg =3D <0x00000000 0x00400000>; - }; - android@00400000 { - label =3D "android"; - reg =3D <0x00400000 0x12c00000>; - }; - }; - }; - -2) ECC Engine: -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - -Required BCH properties: -- compatible: Should be one of - "mediatek,mt2701-ecc", - "mediatek,mt2712-ecc", - "mediatek,mt7622-ecc". -- reg: Base physical address and size of ECC. -- interrupts: Interrupts of ECC. -- clocks: ECC required clocks. -- clock-names: ECC clocks internal name. - -Example: - - bch: ecc@1100e000 { - compatible =3D "mediatek,mt2701-ecc"; - reg =3D <0 0x1100e000 0 0x1000>; - interrupts =3D ; - clocks =3D <&pericfg CLK_PERI_NFI_ECC>; - clock-names =3D "nfiecc_clk"; - }; diff --git a/Documentation/devicetree/bindings/mtd/mtk-nand.yaml b/Document= ation/devicetree/bindings/mtd/mtk-nand.yaml new file mode 100644 index 000000000000..47a1334bcddd --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/mtk-nand.yaml @@ -0,0 +1,92 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/mtk-nand.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek(MTK) SoCs raw NAND FLASH controller (NFC) device tree bind= ings + +maintainers: + - Xiangsheng Hou + +allOf: + - $ref: "nand-controller.yaml#" + +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: + minItems: 2 + items: + - description: clock used for the controller + - description: clock used for the pad + + clock-names: + minItems: 2 + items: + - const: nfi_clk + - const: pad_clk + + nand-ecc-engine: + description: Required ECC Engine node + $ref: /schemas/types.yaml#/definitions/phandle + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + - nand-ecc-engine + - "#address-cells" + - "#size-cells" + +unevaluatedProperties: false + +examples: + - | + #include + #include + #include + + soc { + #address-cells =3D <2>; + #size-cells =3D <2>; + + nandc: nfi@1100d000 { + compatible =3D "mediatek,mt2701-nfc"; + reg =3D <0 0x1100d000 0 0x1000>; + interrupts =3D ; + clocks =3D <&pericfg CLK_PERI_NFI>, + <&pericfg CLK_PERI_NFI_PAD>; + clock-names =3D "nfi_clk", "pad_clk"; + nand-ecc-engine =3D <&bch>; + #address-cells =3D <1>; + #size-cells =3D <0>; + }; + + bch: ecc@1100e000 { + compatible =3D "mediatek,mt2701-ecc"; + reg =3D <0 0x1100e000 0 0x1000>; + interrupts =3D ; + clocks =3D <&pericfg CLK_PERI_NFI_ECC>; + }; + }; --=20 2.25.1