From patchwork Thu Mar 11 09:56:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 399018 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=-14.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, 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=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 AAEF5C433DB for ; Thu, 11 Mar 2021 17:04:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B90264FF5 for ; Thu, 11 Mar 2021 17:04:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbhCKRDo (ORCPT ); Thu, 11 Mar 2021 12:03:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229657AbhCKRDm (ORCPT ); Thu, 11 Mar 2021 12:03:42 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2076C061574; Thu, 11 Mar 2021 09:03:41 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id h13so3861059eds.5; Thu, 11 Mar 2021 09:03:41 -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:mime-version :content-transfer-encoding; bh=AIJvF8THgvNIIJY7o0rd8q2CMHcgDSy7Mtu5dW42sFA=; b=oHvYAKs8vlQsGGeTCxnbGmFJRdubhK9l9eDvFETPrXX9cQ7MlU5fEAM0qMn1C7xchN YohhK3VVAFGYyqcR46GscrLSOwBqOC8DGU5uTlA+Vpc61R9ZoDyWxwVXvAqzNq2+eoNb VMsGujlugvf1G0oOs6vCypmtB9xIQqYp6W3J+kjg2Sayn6B9fqAMdNasJiN5TuCCSjM/ JB3nztXsccELBZkyeuy3Z3uH8hBl/ALzgqBPPilDUFOd5dmSxnP17KKDRcMG9jw5cMBF jb8CogOCyTD0cSSO1m+s/g4DzFYtm3m4su1yk3a6ZqdMIKH5pzI3Hfxle3x9ihR0Tajz enfA== 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:mime-version :content-transfer-encoding; bh=AIJvF8THgvNIIJY7o0rd8q2CMHcgDSy7Mtu5dW42sFA=; b=Cbl2wNLYqq5hD9rHML52rANCM5y/bsd0ycj1wCm6kNjkK8vhaC1mdKmeLC8q47WwI+ G+NLICPEdXweu8r4Trn00KZBYjPBwX5pna8DMbqCJMrUyLGqUSio5X5viurq6blzpAsi E4mA6NgZPMyzi4XFHz9pn1YNlenxbSnD9ayHbyfG7l9tMwZ6GAnBUGBPjRE/f+Mq/QZM xYeVmm4ENYPczWLgP5r5kUeW0ZC1nOaty9tIKHY/dtvZTPbo/sWI115ikRHfZWu3CUaJ BiALiLfVJr7XTwc+4lXFxKrm3o4AwPsTt6mjKN7RONkmJmrjwBEiPfCnh51gt+064J+7 JG0g== X-Gm-Message-State: AOAM530dsRWjBVGZK9mBNgZ5Zbb+dGThD8WQT7qofPdMbg4PTeKSdXuF Gz7Ld+P3DjOJIW9fqrDiiyo= X-Google-Smtp-Source: ABdhPJwETXnVswKC4ZC4+FSyf5TAqqX9vnXmWFxa0O9LzcMWBXQwYxWCRSqufx1WJgXXxc52XIj3Aw== X-Received: by 2002:a05:6402:1004:: with SMTP id c4mr9610447edu.364.1615482220575; Thu, 11 Mar 2021 09:03:40 -0800 (PST) Received: from Ansuel-xps.localdomain (93-35-189-2.ip56.fastwebnet.it. [93.35.189.2]) by smtp.googlemail.com with ESMTPSA id b4sm1627205edh.40.2021.03.11.09.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 09:03:40 -0800 (PST) From: Ansuel Smith To: Rob Herring Cc: Ansuel Smith , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Srinivas Kandagatla , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 1/3] mtd: core: add nvmem-cells compatible to parse mtd as nvmem cells Date: Thu, 11 Mar 2021 10:56:58 +0100 Message-Id: <20210311095715.17048-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Partitions that contains the nvmem-cells compatible will register their direct subonodes as nvmem cells and the node will be treated as a nvmem provider. Signed-off-by: Ansuel Smith --- drivers/mtd/mtdcore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 2d6423d89a17..ac1b4f176a17 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -531,6 +531,7 @@ static int mtd_nvmem_reg_read(void *priv, unsigned int offset, static int mtd_nvmem_add(struct mtd_info *mtd) { + struct device_node *node = mtd_get_of_node(mtd); struct nvmem_config config = {}; config.id = -1; @@ -543,7 +544,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd) config.stride = 1; config.read_only = true; config.root_only = true; - config.no_of_node = true; + config.no_of_node = !of_device_is_compatible(node, "nvmem-cells"); config.priv = mtd; mtd->nvmem = nvmem_register(&config); From patchwork Thu Mar 11 09:56:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 399017 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=-14.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, 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 F1633C433E0 for ; Thu, 11 Mar 2021 17:04:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD80064FF3 for ; Thu, 11 Mar 2021 17:04:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229692AbhCKRER (ORCPT ); Thu, 11 Mar 2021 12:04:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229819AbhCKRDr (ORCPT ); Thu, 11 Mar 2021 12:03:47 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD039C061574; Thu, 11 Mar 2021 09:03:46 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id bf3so3867751edb.6; Thu, 11 Mar 2021 09:03:46 -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=0SX53bYeJpoRn/Rj8EJYnn/yWlrMIeX4TZ6gWcrZofc=; b=dRoK/5Y9w7PG6auT6ZudfCM6FOG7DpqSmflGRRG4DKuffxACMDeG1P5mfGHpBl/SmO rkGL2d3HCT5kFv0KaZp5pCxoeGZbLyWifomOXRKzZrcQrMtbTz4FbhV74xbFdAPknJAW oGyVyrW0/zNg5bENsUQ/Tnl2DMzf9xJvXQfIiFC3MXBskpU8/MGx05dX5/2e3u+6KC3U GNXBjKaGpLr6PCfXgs9h94ie2OTL7TApL6IEDcEgiK28rp9DDJQ+JZwLCq52lhvTxUXh V5dz7YAh4hoPPGBvDkVPrVETr8zbZnBsKgiJ8WaQWsKEJXFtaXXoAoUKIBdOJ2kCPpWn ZodQ== 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=0SX53bYeJpoRn/Rj8EJYnn/yWlrMIeX4TZ6gWcrZofc=; b=bYiyBsICduxFZBSbGQIpTyQ/nSRDi7RwKlmqcBW+NkOX/b9LaVONP50i3wGCAp+NtL HatB3GAWnzA9ygLDIzokjLkbQzPwjTpLjiJGxbhxni/efYBpO6zSQ9PETDcKU7jQIJmS ItgZHZXH7s2Jkov6n8U7ZWmRqB5UCHONsVsvoPQt3aHyKLenyQMGQp7WINLA8/KkHHOl JztdhfdYpD8TMFHGgfSOawPkZO5wjWflQ1RqVJN6ZIR2dA3A8fMP/LrhCKw6b8fryca4 Cwq3sV2YyKp/dOTKAFYbZV2wYzuN4+vMaLGxe0R1FzCOVD4SPJhF0MRYrLg5vpPnF1Cd cyIg== X-Gm-Message-State: AOAM532nCH2qkVM44tc1cM7zP2N9kccjnnG8XHz2exi+2rwpB+woPz1o vNEwC/GX7dMnIpjL0/joJfY= X-Google-Smtp-Source: ABdhPJzWjm/dVhAPjRJToEBbtc/5CZdeISlWchLsH+0sJdKagZmW8JyR4LY5IR8mK2hdQKi5DcKMSQ== X-Received: by 2002:a05:6402:704:: with SMTP id w4mr9933440edx.175.1615482225554; Thu, 11 Mar 2021 09:03:45 -0800 (PST) Received: from Ansuel-xps.localdomain (93-35-189-2.ip56.fastwebnet.it. [93.35.189.2]) by smtp.googlemail.com with ESMTPSA id b4sm1627205edh.40.2021.03.11.09.03.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 09:03:45 -0800 (PST) From: Ansuel Smith To: Rob Herring Cc: Ansuel Smith , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Srinivas Kandagatla , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 2/3] devicetree: nvmem: nvmem: drop $nodename restriction Date: Thu, 11 Mar 2021 10:56:59 +0100 Message-Id: <20210311095715.17048-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210311095715.17048-1-ansuelsmth@gmail.com> References: <20210311095715.17048-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Drop $nodename restriction as now mtd partition can also be used as nvmem provider. Signed-off-by: Ansuel Smith --- Documentation/devicetree/bindings/nvmem/nvmem.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/Documentation/devicetree/bindings/nvmem/nvmem.yaml b/Documentation/devicetree/bindings/nvmem/nvmem.yaml index 7481a9e48f19..b8dc3d2b6e92 100644 --- a/Documentation/devicetree/bindings/nvmem/nvmem.yaml +++ b/Documentation/devicetree/bindings/nvmem/nvmem.yaml @@ -20,9 +20,6 @@ description: | storage device. properties: - $nodename: - pattern: "^(eeprom|efuse|nvram)(@.*|-[0-9a-f])*$" - "#address-cells": const: 1 From patchwork Thu Mar 11 09:57:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 397765 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=-14.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, 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 2687AC433E9 for ; Thu, 11 Mar 2021 17:04:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD8ED64FF6 for ; Thu, 11 Mar 2021 17:04:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229867AbhCKRER (ORCPT ); Thu, 11 Mar 2021 12:04:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229862AbhCKRDw (ORCPT ); Thu, 11 Mar 2021 12:03:52 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01902C061574; Thu, 11 Mar 2021 09:03:52 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id ci14so47560276ejc.7; Thu, 11 Mar 2021 09:03:51 -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=n5Nl3CoPrKUbvXcQoRdyX4Oe5Nctcc661QmqCsoFZxk=; b=q6FIKJwkFQWBJ1OXleqfTG1T2TT3DkkLrAwZdQI3EH9fhKo5oEz9qft+OYmencIYQ4 jz7IDbNM3N5Nk8gEmiPbI17fjhnNGvcUS1PHGTeRBHyiIpbh0h+7uJ2owsdpeNpOPgV5 zNttiPoV+Ax6V699cZE2C/M2rvXwe8eoQtgEeG9rOzVeqX4mdbV/riILcIHXcQCsPPHQ uFah9LhZ2M8BXkll+vIYAI5iwpXX+OT4rlduJKeRDp1nyBhXJU0u3u+IrGPFZzl/KwJx PFHO4KJrRgWtJG1lHljMuHwL0vDKBmp2RLeNnbYE2yXzG26+11zwSGI4fhxKttWn48x4 spgg== 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=n5Nl3CoPrKUbvXcQoRdyX4Oe5Nctcc661QmqCsoFZxk=; b=TGIyjX4roduo1oa/qE9Gb+5ga50N7O/JdI/GhKzV9cbb3XQEN/c4cc/ne1UVtDolED 6+azITwqhEROeZiM+R/lFOQa+lx/XxXpYAjQguOR5ammaMLFjUbUjXYk0DLhvCMEPJ2V 7avdgm239/ar01fIu3tPPfQJh6xh+Ibdyf2bMj1Pcd6VfV5UV2esusi3zrExxOva5brs JwQ3jI6PXSQFGQw40fwWb9Hqo4vPVWtRPZIy5F94pBcsEIYz2KAfgRmK7wPY0XePouw/ lOxATdhEuTfSXrMIXOt37QLVzJ75H0gnieF1plUQucITBgxh9MFRkT9FJdmODiRYTeU0 y40w== X-Gm-Message-State: AOAM530d2gej3qN6d92Nm046RnXadfSEZlMtfaAVd6H3/Ws9QqHTyvGP o/zgqzhnzW6NC7reVGVZvCU= X-Google-Smtp-Source: ABdhPJzq/YatFckEfu+VF1H6Ea1sveBij0Xf3qb2wyQA4o1MhfevCcixqQxnAVUri761sfyZf4SLXw== X-Received: by 2002:a17:907:76bb:: with SMTP id jw27mr3981655ejc.366.1615482230637; Thu, 11 Mar 2021 09:03:50 -0800 (PST) Received: from Ansuel-xps.localdomain (93-35-189-2.ip56.fastwebnet.it. [93.35.189.2]) by smtp.googlemail.com with ESMTPSA id b4sm1627205edh.40.2021.03.11.09.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 09:03:50 -0800 (PST) From: Ansuel Smith To: Rob Herring Cc: Ansuel Smith , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Srinivas Kandagatla , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 3/3] dt-bindings: mtd: Document use of nvmem-cells compatible Date: Thu, 11 Mar 2021 10:57:00 +0100 Message-Id: <20210311095715.17048-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210311095715.17048-1-ansuelsmth@gmail.com> References: <20210311095715.17048-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Document nvmem-cells compatible used to treat mtd partitions as a nvmem provider. Signed-off-by: Ansuel Smith Reviewed-by: Rob Herring --- .../bindings/mtd/partitions/nvmem-cells.yaml | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/partitions/nvmem-cells.yaml diff --git a/Documentation/devicetree/bindings/mtd/partitions/nvmem-cells.yaml b/Documentation/devicetree/bindings/mtd/partitions/nvmem-cells.yaml new file mode 100644 index 000000000000..b53faf87d4e4 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/partitions/nvmem-cells.yaml @@ -0,0 +1,99 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/partitions/nvmem-cells.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nvmem cells + +description: | + Any partition containing the compatible "nvmem-cells" will register as a + nvmem provider. + Each direct subnodes represents a nvmem cell following the nvmem binding. + Nvmem binding to declare nvmem-cells can be found in: + Documentation/devicetree/bindings/nvmem/nvmem.yaml + +maintainers: + - Ansuel Smith + +allOf: + - $ref: "../../nvmem/nvmem.yaml#" + +properties: + compatible: + const: nvmem-cells + +required: + - compatible + +additionalProperties: true + +examples: + - | + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* ... */ + + }; + art: art@1200000 { + compatible = "nvmem-cells"; + 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-cells"; + 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>; + }; + }; + };