From patchwork Tue Feb 16 21:26:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1441125 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=Rgd6s5A+; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=EaxJ5CEL; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DgDbN6NH5z9sBJ for ; Wed, 17 Feb 2021 08:28:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8ndSUEJOokxGBOuwVyQKM05ymxvllZA7nCbpIowK3h8=; b=Rgd6s5A+vegInqukeYpPOaDle wpTb2p4GSaOgZ98yokY0mOeUwDUYMfVP5YWqy6izTYWlEff8SHgdw3azGIb7VhfK5g43y4R8Avw71 /EKsjugFaw+1lJOKdfIbtUHC0QJqQmuEXXKGNxNOTKOndlHvtdhYS5f0ihW3LPFX0Alk/x95ih6/4 VbPWf5sAQyVJ65SXtfMid5/7sJQDfiBbgIXj7B3EaWHHUgz1q0virT1+is8yQjfBL1EEL6pUph0HE bdC+gGpPVKq61g41a0CPtXm3NlOU/ebQ5xvr6ITr3vk3g2YZ6sORH+zfLg1/DEfwfjaZI5kJRSrnW DOtzin6zw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lC7sF-0004Zj-Je; Tue, 16 Feb 2021 21:27:11 +0000 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lC7sC-0004Yq-Or for linux-mtd@lists.infradead.org; Tue, 16 Feb 2021 21:27:10 +0000 Received: by mail-wr1-x42a.google.com with SMTP id b3so15056559wrj.5 for ; Tue, 16 Feb 2021 13:27:08 -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=GDofa5l7P6G0aPshCRUpeDnHopahisIJ3Z8CdpNi7O8=; b=EaxJ5CEL06ZrL7LAe9TlR5b7kiHOmU47EzQvPcKa8nlwaykJh4kgBLOjTIto8Tew0W pagLkvyl6VZhgjag9+87+Y8R6iT4r8gRzCuBW3o6Vzpft9KaiXAucNkkuZGy+JDZbLSu kUn99XJUjerF7D+DzNPnHRjbIizQXwettsJ+CAySvhup+TiQEQhj8AlXHL+ikuDN8ZAC JGLKxMpc0UlK1j8yVLDBnaa5CmPqHtDJBgnbQoqM54N2LyMtS5B8dW/4niQWyO6BDKW3 1i/r6ShckSkNS+FC9WMI6ab3O0jK2tpVfpDfj6tG+L1eIrOovjWjo1LqBhzJmdgl3J0Y KSkw== 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=GDofa5l7P6G0aPshCRUpeDnHopahisIJ3Z8CdpNi7O8=; b=pWZE/ZA+CvVS/OTNstb152x5FO4X9GiU1DPz2qpZFGrmRl0daVyxoX2mLZpzkvdkbq Js5Q5TKyyZn0pm+rOk+gRYdbN0vQ2Vbv/UlEsF/YLv1OtQNs+lPmNLCtxS5Cnn/NMXvI VlL7DhSf+P67b2gWeceg53yFK8hslycNxHvtmexhrGJi9AXVFBV4Pv7h7nP8GpSE1Sbf /lkIjoeRAwLUHADJ5K9A6goZ2arHHQkE+W786YPw3ufo3Lqf/oDxfD2tuWwvp/ovR/bA 2diPQbK2SZZTY+/pU9Jm8/F8xRTcpp7YlGBWet/k+j4WnJYMv3Icc25Ov4k7Y5Fa2aD/ 91ww== X-Gm-Message-State: AOAM531aLF8EXNO1nYoe4AmmH4pJwp2OrrahUEVrFDgRrO7Ox35zg2DQ 4yigmadFRih5Wya+JOhmTj4= X-Google-Smtp-Source: ABdhPJxGN5rFGltSfdK4JsTkjNuZGmY97moou1E5YYGCHexloAkgXNVPxE6lGC8yljZHXMBTwjXI8g== X-Received: by 2002:adf:bbca:: with SMTP id z10mr25753146wrg.168.1613510827298; Tue, 16 Feb 2021 13:27:07 -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 s14sm7132182wmj.23.2021.02.16.13.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 13:27:07 -0800 (PST) From: Ansuel Smith To: Richard Weinberger Subject: [PATCH v2 2/3] mtd: core: add nvmem-partitions compatible to parse mtd as nvmem cells Date: Tue, 16 Feb 2021 22:26:27 +0100 Message-Id: <20210216212638.28382-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210216212638.28382-1-ansuelsmth@gmail.com> References: <20210216212638.28382-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210216_162709_254318_3E2EFD0E X-CRM114-Status: GOOD ( 14.50 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:42a listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [ansuelsmth[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Vignesh Raghavendra , Boris Brezillon , linux-kernel@vger.kernel.org, Rob Herring , linux-mtd@lists.infradead.org, Miquel Raynal , Ansuel Smith Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Partitions that contains the nvmem-partitions compatible will register their direct subonodes as nvmem cells and the node will be treated as a nvmem provider. Signed-off-by: Ansuel Smith Tested-by: Rafał Miłecki --- 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..29d257678a86 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-partitions"); config.priv = mtd; mtd->nvmem = nvmem_register(&config);