From patchwork Tue Mar 7 21:01:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 736364 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vd8LK6Lh4z9sNC for ; Wed, 8 Mar 2017 08:04:57 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AbJziHsr"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rW54AgjCiixEKshwe77MWkFhSZS53gOoiWoDWDgTgNk=; b=AbJziHsrAqdQJR PCFcUd9hhU7XaELr/LTEHHPC/pC3bRUb2SfOoeXzeG4qK1rBWHAcMSM5Qea7KNUccKs9Eo5T9f5nI 0kwuIIJSmpZibCVb9aNGGO0r6ulL6py//L5vH9XqaaU+6FM8xcKOuciZz8oG6JI+uVGlNseiBNs8N no/CXMum+dM6dn/uvomnNrUyH90BTUrJfIlLIFBm70pSWXl1l5R6Gts7+rPuaKgWK80COFikNHZf9 0VYYvc6/db9GNDPAf41T8wW4lLfl7OJqU2v0YaA5OjFrBUlXxpsiGZBjw2fpWHBAb9IiDGFhQQmUQ pUeel4JZLsY/J2/n8zHw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1clMHv-0001aA-JU; Tue, 07 Mar 2017 21:04:55 +0000 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1clMEm-0007tz-59 for linux-mtd@lists.infradead.org; Tue, 07 Mar 2017 21:01:48 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id C1ABE207EE; Tue, 7 Mar 2017 22:01:18 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (46-253-188-173.dynamic.monzoon.net [46.253.188.173]) by mail.free-electrons.com (Postfix) with ESMTPSA id 5B7B5207CC; Tue, 7 Mar 2017 22:01:08 +0100 (CET) Date: Tue, 7 Mar 2017 22:01:07 +0100 From: Boris Brezillon To: Alban Subject: Re: [PATCH v2 1/2] doc: bindings: Add bindings documentation for mtd nvmem Message-ID: <20170307220107.03436537@bbrezillon> In-Reply-To: <1488875164-30440-2-git-send-email-albeu@free.fr> References: <1488875164-30440-1-git-send-email-albeu@free.fr> <1488875164-30440-2-git-send-email-albeu@free.fr> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170307_130140_681754_F7AD9CD3 X-CRM114-Status: GOOD ( 19.10 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Moritz Fischer , devicetree@vger.kernel.org, Richard Weinberger , linux-kernel@vger.kernel.org, Marek Vasut , Rob Herring , Srinivas Kandagatla , linux-mtd@lists.infradead.org, Maxime Ripard , Brian Norris , David Woodhouse , Cyrille Pitchen Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org On Tue, 7 Mar 2017 09:26:03 +0100 Alban wrote: > Config data for drivers, like MAC addresses, is often stored in MTD. > Add a binding that define how such data storage can be represented in > device tree. > > Signed-off-by: Alban > --- > Changelog: > v2: * Added a "Required properties" section with the nvmem-provider > property > --- > .../devicetree/bindings/nvmem/mtd-nvmem.txt | 33 ++++++++++++++++++++++ > 1 file changed, 33 insertions(+) > create mode 100644 Documentation/devicetree/bindings/nvmem/mtd-nvmem.txt > > diff --git a/Documentation/devicetree/bindings/nvmem/mtd-nvmem.txt b/Documentation/devicetree/bindings/nvmem/mtd-nvmem.txt > new file mode 100644 > index 0000000..8ed25e6 > --- /dev/null > +++ b/Documentation/devicetree/bindings/nvmem/mtd-nvmem.txt > @@ -0,0 +1,33 @@ > += NVMEM in MTD = > + > +Config data for drivers, like MAC addresses, is often stored in MTD. > +This binding define how such data storage can be represented in device tree. > + > +An MTD can be defined as an NVMEM provider by adding the `nvmem-provider` > +property to their node. If everyone agrees that this is actually needed, then it should definitely go in the nvmem binding doc, and we should patch all nvmem providers to define this property (even if we keep supporting nodes that are not defining it). I'm not fully convinced yet, but I might be wrong. I also think we should take the "nvmem under flash node without partitions" into account now, or at least have a clear plan on how we want to represent it. Something like that? flash { partitions { part@X { nvmem { #address-cells = <1>; #size-cells = <1>; cell@Y { }; }; }; }; nvmem { #address-cells = <1>; #size-cells = <1>; cell@X { }; }; }; Note that patching nvmem core to support the subnode case should be pretty easy (see below). --->8--- diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 408b521ee520..507c6190505b 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -465,7 +465,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) nvmem->priv = config->priv; nvmem->reg_read = config->reg_read; nvmem->reg_write = config->reg_write; - np = config->dev->of_node; + np = config->of_node ? : config->dev->of_node; nvmem->dev.of_node = np; dev_set_name(&nvmem->dev, "%s%d", config->name ? : "nvmem", config->id); diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index cd93416d762e..ec2f5116d62d 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -21,6 +21,7 @@ typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset, struct nvmem_config { struct device *dev; + struct device_node *of_node; const char *name; int id; struct module *owner;