Hi Krzysztof, krzysztof.kozlowski@xxxxxxxxxx wrote on Thu, 8 Dec 2022 11:27:27 +0100: > On 08/12/2022 11:00, Miquel Raynal wrote: > > Hi Krzysztof, > > > > krzysztof.kozlowski@xxxxxxxxxx wrote on Thu, 8 Dec 2022 10:44:17 +0100: > > > >> On 08/12/2022 07:29, Xiangsheng Hou wrote: > >>> Split MediaTek ECC engine with rawnand controller and convert to > >>> YAML schema. > >>> > >>> Signed-off-by: Xiangsheng Hou <xiangsheng.hou@xxxxxxxxxxxx> > >>> --- > >>> .../bindings/mtd/mediatek,mtk-nfc.yaml | 154 +++++++++++++++ > >>> .../mtd/mediatek,nand-ecc-engine.yaml | 62 ++++++ > >>> .../devicetree/bindings/mtd/mtk-nand.txt | 176 ------------------ > >>> 3 files changed, 216 insertions(+), 176 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 > >>> > >>> diff --git a/Documentation/devicetree/bindings/mtd/mediatek,mtk-nfc.yaml b/Documentation/devicetree/bindings/mtd/mediatek,mtk-nfc.yaml > >>> new file mode 100644 > >>> index 000000000000..eb1a44c7ae4e > >>> --- /dev/null > >>> +++ b/Documentation/devicetree/bindings/mtd/mediatek,mtk-nfc.yaml > >>> @@ -0,0 +1,154 @@ > >>> +# 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 <xiangsheng.hou@xxxxxxxxxxxx> > >>> + > >>> +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]$": > >>> + type: object > >> > >> This should be instead: > >> $ref: nand-chip.yaml# > >> unevaluatedProperties: false > >> > >> and then properties below (due to current dtschema limitations) should > >> list properties from nand-controller.yaml: > >> > >> nand-on-flash-bbt: true > >> > >> Optionally, we could create additional schema - nand-controller-chip, > >> which would be referenced directly by nand-controller and itself would > >> ref nand-chip. > > > > Isn't this enough? (in linux-next) > > https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/tree/Documentation/devicetree/bindings/mtd/nand-controller.yaml?h=mtd/next#n54 > > No, I tested it and it does not work as intended. In this particular > case. I think this is a limitation of dtschema, because binding itself > looks fine. The problem is that you have: > 1. mtk-nfc having nand@ children. mtk-nfc references nand-controller > which brings these children. > 2. However nand-controller while bringing these children does two things: > a. ref: nand-chip > b. add more propeties > > 3. The mtk-nfc must further extend the nand@ child. > 4. If you add "unevaluatedProperties: false" you notice warnings of > unevaluated propertie from nand-controller children. Thanks for the details. Any chances this can eventually be fixed at dt-schema level? Thanks, Miquèl