From patchwork Tue Feb 16 19:56:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 383412 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 603FCC433E6 for ; Tue, 16 Feb 2021 19:57:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A8ED64E85 for ; Tue, 16 Feb 2021 19:57:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229896AbhBPT5Q (ORCPT ); Tue, 16 Feb 2021 14:57:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229705AbhBPT5N (ORCPT ); Tue, 16 Feb 2021 14:57:13 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DDC2C06174A; Tue, 16 Feb 2021 11:56:33 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id y26so18474637eju.13; Tue, 16 Feb 2021 11:56:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gTKUWEdr7X7gHT2/c0rh/4HOUp41ym8Za7G+Wwf9Lwk=; b=jzGuKPTMZQWNehBBdJksfFwA4UOge6d9q760lIxNyncm7nBdfugSgxT1Keg1HPzAGd JLTkJogzs3pxn3/srZQRlM9pKm51nUl1kC4rxUo5QDMbTY5n3zVLepdEOytL2FUre2Oq ojgUAT6EOzqAFDUj3t+wJcw536Kuqg0NisJaSSSsLq+H/LMKkUpR3X5NmJ79Gh5VCXx2 000XzNjAt7yUQ+q/cwGySF6KRhgbUZyPDQ7tGfPHLfnWkpnVsWwlossT9gjdsMktQD3H SCL5QVA+TqcmyT8SzfQ+cd8c1ANJv/41oqptoBynUPMcsX1gzKIyiRrs0LS0IbH24o2P uUNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gTKUWEdr7X7gHT2/c0rh/4HOUp41ym8Za7G+Wwf9Lwk=; b=mXMR7k9eado5d2jpC4N4vyDHSQZ6LMjB5OxUCTNaDEZPK+OWAy9BCb10O4K0pl8rtE CHJ2oywoFyuu4aiObY03zq2UxgJlwNX8uNw60b6RTKEqBrx/y+EsQmAG5X4z3bWUX3cp ACkU2QnEh5kx4ljeMVb3KsuBgEiyPmq1bBrT4uSWHGTRjiDqcMjPT1X6uDWM+CidKRul QcRXP34txZ6/zTlE7A20GyzlSSQqJh7iLN/uQcKk2dw9301yP68qwQZHJtvVkwArEQGQ ZO0NftVkQCfhS21Lq3LZQstET8GkiGJwfIoi4d37bzSJt6NY09QbzwGQf8xPr1q6fdRr tLcQ== X-Gm-Message-State: AOAM533rqNR4EjR6Rq/pmpk1ORVJk5q3g0lji4DCA61+/NnLI0g16rTF bxeS/3RPsIwQ2SpkvlQORMM= X-Google-Smtp-Source: ABdhPJzK70XRIZgLLT7o/B2o/FVR+4gONsXyljCh7z9pr7UcUcn/7nBvSDLpE9BN9tCvYHYZsl0Ihg== X-Received: by 2002:a17:906:c1c1:: with SMTP id bw1mr22551444ejb.86.1613505391883; Tue, 16 Feb 2021 11:56:31 -0800 (PST) Received: from Ansuel-xps.localdomain (host-87-6-252-11.retail.telecomitalia.it. [87.6.252.11]) by smtp.googlemail.com with ESMTPSA id rh22sm963332ejb.105.2021.02.16.11.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 11:56:31 -0800 (PST) From: Ansuel Smith To: Richard Weinberger Cc: Ansuel Smith , Miquel Raynal , Vignesh Raghavendra , Rob Herring , Boris Brezillon , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] mtd: partitions: ofpart: skip subnodes parse with compatible Date: Tue, 16 Feb 2021 20:56:09 +0100 Message-Id: <20210216195618.27959-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210216195618.27959-1-ansuelsmth@gmail.com> References: <20210216195618.27959-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org If a partitions structure is not used, parse direct subnodes as fixed-partitions only if a compatible is not found or is of type fixed-partition. A parser can be used directly on the subnode and subnodes should not be parsed as fixed-partitions by default. Signed-off-by: Ansuel Smith --- drivers/mtd/parsers/ofpart.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mtd/parsers/ofpart.c b/drivers/mtd/parsers/ofpart.c index daf507c123e6..4b363dd0311c 100644 --- a/drivers/mtd/parsers/ofpart.c +++ b/drivers/mtd/parsers/ofpart.c @@ -50,6 +50,11 @@ static int parse_fixed_partitions(struct mtd_info *master, master->name, mtd_node); ofpart_node = mtd_node; dedicated = false; + + /* Skip parsing direct subnodes if a compatible is found and is not fixed-partitions */ + if (node_has_compatible(ofpart_node) && + !of_device_is_compatible(ofpart_node, "fixed-partitions")) + return 0; } else if (!of_device_is_compatible(ofpart_node, "fixed-partitions")) { /* The 'partitions' subnode might be used by another parser */ return 0; From patchwork Tue Feb 16 19:56:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 383411 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6080EC433DB for ; Tue, 16 Feb 2021 19:57:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23BD664EB1 for ; Tue, 16 Feb 2021 19:57:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230221AbhBPT5m (ORCPT ); Tue, 16 Feb 2021 14:57:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230131AbhBPT52 (ORCPT ); Tue, 16 Feb 2021 14:57:28 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F111CC061786; Tue, 16 Feb 2021 11:56:47 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id s11so13789866edd.5; Tue, 16 Feb 2021 11:56:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B+rzS0sRv0J3BMSreb/SAsip/5NpGgjcUC0WZfb9UMo=; b=P829sFMk/HWVFCWbkQIJU/89lQDZeC45HCHpcn9LsGhhvULh0Rc8y5ABYl2SNV1+c+ v1DyM6QoHi4WKWeTdxZDhcipCVlUrUt5PLqwc9Iq/ZsWOTNLL3GuAdXw4Yxe/fiQIKZ5 MpRAQpj66M2vXLc5FrNEYppq+8Pgdr+JtQsID7fVfQqTRDkAfOifeU5gH7ViTt5FRk3o PINFRppuVBcSVy6xTiTgfTESUakptpbgK4x+Fq/ggWFawDmpqkMQDohBfuGuPXtDhtxI t+g+HQwu0/F5odB0Mkj7T1abe8Go2xl+84IIRqtrOUzZ15YzlbB5kGvs9csejtNAx17r es9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B+rzS0sRv0J3BMSreb/SAsip/5NpGgjcUC0WZfb9UMo=; b=OJ8n5oPezLtL4MTtiP8t5OEPrxw61AXSLj+ks1VYlKOaBKxYH1sBecVUzS4OZ4flR/ jy1SB6l+Z5b5N5aw+g0TPwx9V/NQ+N1KX2kD5e5KiGsf4bjd9RxWm8GhkHJxVFCkFXO9 ItVKSrN8mSDSYlARiOvdsDk070oTap8Sz1Ra3yt3+scdmEUg8dgWtfSmZi7pbDL5ZwN4 Yaw6hVjXJfAicSs4ECvUWcfrrHjApiDO/EHS6MevI90MPFRvbWz8ZCNNPo9Udi7+T9hl ynIGzvsQaxGN1dgOAQZxDW6GeqE4JABqFDAve4/5g/ZzfsYvdUjjVyB0TNJzJ2qsOrI6 8WCA== X-Gm-Message-State: AOAM531mGPMauGdJ/+QycHJ40eqQKTCzUz3t60zhcY2tIwLNh6EpWUg6 9BY0n7CPymyStnWujMStwLo= X-Google-Smtp-Source: ABdhPJxSU1ROjWCus6NqmtJLmIujUXHamSni+RhVcPcKr6gQPFjIzIAsjejgqQwMC97UpYq4eB/bwg== X-Received: by 2002:a05:6402:3494:: with SMTP id v20mr23442045edc.146.1613505406562; Tue, 16 Feb 2021 11:56:46 -0800 (PST) Received: from Ansuel-xps.localdomain (host-87-6-252-11.retail.telecomitalia.it. [87.6.252.11]) by smtp.googlemail.com with ESMTPSA id rh22sm963332ejb.105.2021.02.16.11.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 11:56:46 -0800 (PST) From: Ansuel Smith To: Richard Weinberger Cc: Ansuel Smith , Miquel Raynal , Vignesh Raghavendra , Rob Herring , Boris Brezillon , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] dt-bindings: mtd: Document use of nvmem-partitions compatible Date: Tue, 16 Feb 2021 20:56:11 +0100 Message-Id: <20210216195618.27959-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210216195618.27959-1-ansuelsmth@gmail.com> References: <20210216195618.27959-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Document nvmem-partitions compatible used to treat mtd partitions as a nvmem provider. Signed-off-by: Ansuel Smith --- .../mtd/partitions/nvmem-partitions.yaml | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/partitions/nvmem-partitions.yaml diff --git a/Documentation/devicetree/bindings/mtd/partitions/nvmem-partitions.yaml b/Documentation/devicetree/bindings/mtd/partitions/nvmem-partitions.yaml new file mode 100644 index 000000000000..1ff283febcaa --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/partitions/nvmem-partitions.yaml @@ -0,0 +1,105 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/partitions/nvmem-partitions.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nvmem partitions + +description: | + This binding can be used to treat the specific partition as a nvmem provider. + Each direct subnodes represents the nvmem cells and won't be parsed as fixed-partitions. + Fixed-partitions bindings described in fixed-partitions.yaml apply to the nvmem provider node. + +maintainers: + - Ansuel Smith + +properties: + compatible: + const: nvmem-partitions + + "#address-cells": true + + "#size-cells": true + + reg: + description: partition's offset and size within the flash + maxItems: 1 + +required: + - compatible + - "#address-cells" + - "#size-cells" + - reg + +additionalProperties: true + +examples: + - | + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* ... */ + + }; + art: art@1200000 { + compatible = "nvmem-partitions"; + reg = <0x1200000 0x0140000>; + label = "art"; + read-only; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_gmac1: macaddr_gmac1@0 { + reg = <0x0 0x6>; + }; + + macaddr_gmac2: macaddr_gmac2@6 { + reg = <0x6 0x6>; + }; + + pre_cal_24g: pre_cal_24g@1000 { + reg = <0x1000 0x2f20>; + }; + + pre_cal_5g: pre_cal_5g@5000{ + reg = <0x5000 0x2f20>; + }; + }; + - | + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x000000 0x100000>; + read-only; + }; + + firmware@100000 { + compatible = "brcm,trx"; + label = "firmware"; + reg = <0x100000 0xe00000>; + }; + + calibration@f00000 { + compatible = "nvmem-partitions"; + label = "calibration"; + reg = <0xf00000 0x100000>; + ranges = <0 0xf00000 0x100000>; + #address-cells = <1>; + #size-cells = <1>; + + wifi0@0 { + reg = <0x000000 0x080000>; + }; + + wifi1@80000 { + reg = <0x080000 0x080000>; + }; + }; + };