From patchwork Tue Nov 13 14:01:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680765 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 418AA14DB for ; Tue, 13 Nov 2018 14:05:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EABD2896D for ; Tue, 13 Nov 2018 14:05:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C53528A31; Tue, 13 Nov 2018 14:05:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B28A2889C for ; Tue, 13 Nov 2018 14:05:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387679AbeKNAAO (ORCPT ); Tue, 13 Nov 2018 19:00:14 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:35387 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387569AbeKNAAN (ORCPT ); Tue, 13 Nov 2018 19:00:13 -0500 Received: by mail-wm1-f66.google.com with SMTP id t15-v6so11575461wmt.0 for ; Tue, 13 Nov 2018 06:01:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0uqZU8gDHiv/neEGi/hrgDK8MU/UOgRvLZjvxfNOd/I=; b=pXLEyYVi7xk0SDGCkD5Y1ijc20sYg43PO7FF5Ii9S7OMZMW80DFLiF+kCgRmUqxyiR o3bcuXYEa54fs2rggnBxWAa6iAM1kzvQVzhkWPUHnelnFzHhILejvVhWx3g3manDZ4xt Gfnhk0eLmrS2IAfQOJzCRBqP0kv1oT19u8VW0XkrHrnp+fob5e5aBYD4fbbBooLGPnOR a+0gn4pB9BDdohjzrBwvryRKmanWXkSSMBqmskFsDMAD2SaaseafMiaCt4zHSYjLLWbc C67jmWgjPFs5Lw0Css3+YkWBhQHRvMdQbfWwM99LWk0Y0ZB1eZg4dXVgb1y4EvJWfVEf fG8Q== 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=0uqZU8gDHiv/neEGi/hrgDK8MU/UOgRvLZjvxfNOd/I=; b=NDBnvuDcN8xGgmUaX05b9hHqNWuc0Q8qKaYMNJgOZsxO55pEkAVDRFKHE4Fdtvf9tK dVixDR9AGznCHGhxrfvrXlpsjjtnZ1PRgET+3HJZycXElNwJ3n6CEEZyQMVreaa8l1f3 WPpLDDM7oyPZG0rZOseSyreNv/4BKF7HdSjyvPpQCKfBk4RBMlKeBf9LkkIbnJ2n7c/U dlnrTmnA9fMSNYXVFJonRfsH1Ucxj1CvIXkA6vQzULtbPiFCksI7IU1bblxldltj55xw XXgEofQg8YyilBG6+yF6CbESf/4whojL6+icKaPXJYGKbgTP08cV9IjXYoklonGXBt0c 1CLQ== X-Gm-Message-State: AGRZ1gIgmHuBEZ4IE3aNGz7Lcj3/L5480oQbOKkv8/+ni+SOOx5OTqgh 8D3JKQj+96EXkcnjhccikexpfw== X-Google-Smtp-Source: AJdET5cGhZk6/cOVbPrvR9ypywUUj8C/WS5YdF9VjGZLtBZXxc7blVkWSGEcBSlK5+2a4sBzMvRZVw== X-Received: by 2002:a1c:7fc1:: with SMTP id a184mr1113108wmd.55.1542117715063; Tue, 13 Nov 2018 06:01:55 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.01.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:01:54 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 01/25] nvmem: add new config option Date: Tue, 13 Nov 2018 15:01:09 +0100 Message-Id: <20181113140133.17385-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want to add nvmem support for MTD. TI DaVinci is the first platform that will be using it, but only in non-DT mode. In order not to introduce any new interface to supporting of which we would have to commit - add a new config option that tells nvmem not to use the DT node of the parent device. This way we won't be creating nvmem devices corresponding with MTD partitions defined in device tree. By default MTD will set this new field to true. Once a set of bindings for MTD nvmem cells is agreed upon, we'll be able to remove this option. Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/core.c | 3 ++- include/linux/nvmem-provider.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 9b18ce90f907..ac7971e8154e 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -604,7 +604,8 @@ 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; - nvmem->dev.of_node = config->dev->of_node; + if (!config->no_of_node) + nvmem->dev.of_node = config->dev->of_node; if (config->id == -1 && config->name) { dev_set_name(&nvmem->dev, "%s", config->name); diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 1e3283c2af77..e53545e9852b 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -30,6 +30,7 @@ typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset, * @ncells: Number of elements in cells. * @read_only: Device is read-only. * @root_only: Device is accessibly to root only. + * @no_of_node: Device should not use the parent's of_node even if it's !NULL. * @reg_read: Callback to read data. * @reg_write: Callback to write data. * @size: Device size. @@ -53,6 +54,7 @@ struct nvmem_config { int ncells; bool read_only; bool root_only; + bool no_of_node; nvmem_reg_read_t reg_read; nvmem_reg_write_t reg_write; int size;