From patchwork Fri Jun 29 09:40:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10496027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EE36B6022E for ; Fri, 29 Jun 2018 09:46:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FCA32989E for ; Fri, 29 Jun 2018 09:46:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 815F9298A6; Fri, 29 Jun 2018 09:46:55 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham 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 217C32989E for ; Fri, 29 Jun 2018 09:46:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754677AbeF2Jku (ORCPT ); Fri, 29 Jun 2018 05:40:50 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:43358 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933673AbeF2Jkr (ORCPT ); Fri, 29 Jun 2018 05:40:47 -0400 Received: by mail-wr0-f194.google.com with SMTP id c5-v6so8198132wrs.10 for ; Fri, 29 Jun 2018 02:40:46 -0700 (PDT) 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; bh=g7UpIifBzzlHofhCVWyJaw6cfbiRR9ZhvkhoeVpGg5M=; b=0kpUEV03j1mvInFsLtalEfZMaWcGsUNYAnFPBd2wl1QyRfU1T7V0Mla0oSSs5bT9zL j25nhqT7ZLBhx3US3Q5RhpqbWxvVthWyc/zwhrvlMSzAZVaI5VRESDNml0VXUII/lrQm f4nVXFJcuVzbDtx6GbcGdzbzYr7szzd4/wFszze1ibYOnrIYM1beFAXfGc43c/rr4Atn 4B1R16gtjVjNiYr3oEnj73dr7amaEosgnlAtSqxq5U1lJvMO8JIaywZ7c4biMlZdqxsx eBcQI6WLv4nepN51hhIIonGxFJtGNbT0L83ivbYqKkjAAKiJCl+RdXDWGxjFWRp+lkV7 caLA== 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; bh=g7UpIifBzzlHofhCVWyJaw6cfbiRR9ZhvkhoeVpGg5M=; b=DhNRhj7eS2S7Dg2+bC+kp3hCA4Y38yuxY2eOq5yUEJy1um12CFJovBOVdPq4Wvk6Nz 5XWqDOE8AGYPhstI445Cd+O4lq0LbfTNMVFejNvg+yh78rhPcJ7sqcd46g4CQTsfjLSN H7OoihPp29kBVpfOvBCV5EfZpUoNjt8LWal93BsRa8KQpeD1Zk4e8LKpfcxmqCjPABgN /v1e9L+aFqac/D5pEoBbjugodtc5Yj+SO1sLcg3uvxyVUlqDZFURJZ9mwvwH2+I3DjKN shKcMoR0NNICiTMRlzytdw7J5xJeyGKVK3q6h9axBxM2GiBTQA2EMci4Lw4OsEchd3jA nAjg== X-Gm-Message-State: APt69E0oZd7qZUhorCKt7MytIlyGxM6DHZ8iUDW+DQJtJguzAcoG7kD1 8lSrklcsY0XgbSZeVBYPxJKIBg== X-Google-Smtp-Source: AAOMgpcZKV8OR13dLTBEB8kRKij9oPYm6SUlDyIfl7hmR2Nomfp94V2fOrnn9K55Klm10Y77Oyy92g== X-Received: by 2002:adf:f482:: with SMTP id l2-v6mr8685670wro.259.1530265246041; Fri, 29 Jun 2018 02:40:46 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-NIC-1-55-10.w2-15.abo.wanadoo.fr. [2.15.147.10]) by smtp.gmail.com with ESMTPSA id d102-v6sm1386394wma.10.2018.06.29.02.40.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Jun 2018 02:40:45 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Lukas Wunner , Rob Herring , Florian Fainelli , Dan Carpenter , Ivan Khoronzhuk , David Lechner , Greg Kroah-Hartman , Andrew Lunn , Jonathan Corbet Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, netdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v4 02/18] Documentation: nvmem: document lookup entries Date: Fri, 29 Jun 2018 11:40:23 +0200 Message-Id: <20180629094039.7543-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180629094039.7543-1-brgl@bgdev.pl> References: <20180629094039.7543-1-brgl@bgdev.pl> 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 Describe the usage of nvmem cell lookup tables. Signed-off-by: Bartosz Golaszewski Acked-by: Srinivas Kandagatla --- Documentation/nvmem/nvmem.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Documentation/nvmem/nvmem.txt b/Documentation/nvmem/nvmem.txt index 8d8d8f58f96f..9d5e3ca2b4f3 100644 --- a/Documentation/nvmem/nvmem.txt +++ b/Documentation/nvmem/nvmem.txt @@ -58,6 +58,34 @@ static int qfprom_probe(struct platform_device *pdev) It is mandatory that the NVMEM provider has a regmap associated with its struct device. Failure to do would return error code from nvmem_register(). +Additionally it is possible to create nvmem cell lookup entries and register +them with the nvmem framework from machine code as shown in the example below: + +static struct nvmem_cell_lookup foobar_lookup = { + .info = { + .name = "mac-address", + .offset = 0xd000, + .bytes = ERH_ALEN, + }, + .nvmem_name = "foobar", +}; + +static void foobar_register(void) +{ + ... + nvmem_add_lookup_table(&foobar_lookup, 1); + ... +} + +A lookup entry table can be later removed if needed: + +static void foobar_fini(void) +{ + ... + nvmem_del_lookup_table(&foobar_lookup, 1); + ... +} + NVMEM Consumers +++++++++++++++