From patchwork Wed Aug 8 15:31: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: 10560211 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 E241313BB for ; Wed, 8 Aug 2018 15:34:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCA8629E6D for ; Wed, 8 Aug 2018 15:34:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF2D929EF1; Wed, 8 Aug 2018 15:34:34 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3C7BF29E6D for ; Wed, 8 Aug 2018 15:34:34 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=24dyUBGh2fWnWDpT45Pq9RBQ41N9IhhBQgAOjGExHDU=; b=OLmqlMnRmp+n8MeCQ75xJV/O3m Yp908mvt5EmzowQfILm4kaF2gfz/avDyxUWjYMLqKLMLiVsSJzqnA8Vq/tRfaBp4DJZXnFy6353+P JZMS0qIymsQQnAWdUhCuVaJx1GhDE6Ug8n5QvMeefJ/I5qYA/oHqA8439elHhX/QHnifRlPG067T8 4HOobAi0N4/a5olwAaQEizMfkO3jLGUmKo9lzCv6WQWsXwFpVy9n4HEGkdIhu/IaM8Qb6qudEfpCR o2wURYQtiTV7/WhhrlCa8OFAI9M1ZWLh3kbd0P4WIBfeWt/+TnfDQO50ppA77mw5zUjCEwjCKkdHs zTxSTYDg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTk-0005Bg-AD; Wed, 08 Aug 2018 15:34:28 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQSv-0003xy-AT for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:33:42 +0000 Received: by mail-wr1-x441.google.com with SMTP id b15-v6so2388143wrv.10 for ; Wed, 08 Aug 2018 08:33:28 -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=C6+lAOCD7xYYjqAwsyLpdNynP10DYfCMxlDsoPITD5U=; b=iykSHf10yMyrpl8DK+aj/cdwz2SbHXCRaXdZtNJe3p9PGb0iT0ftaNi1BzDboHGfvL G3dWHCHn8XwpuDBz53tc9Uk2kF6ycWEx2FEYl4G717TBKqdwtAZqHBhv6uOVOsPiFJEt mVFxZJ4VCikZF1nUhGerB1dWPWmufG/76nwSjUsAqsxbVYqPJaMc/BpaMiZkILRXCpxN yu1OqSK0Fg9hQIYw9vajzfamUNX9DwCNwRit9wZ68R23C1HRR04gqcmclSxcjTzXRsy7 JSJGWwex37E0QsHA00GfTcbUp53L4Tl3mh7nggMqpO6SMW2tGtkN0kuea23oBM3t+4Gq zeaw== 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=C6+lAOCD7xYYjqAwsyLpdNynP10DYfCMxlDsoPITD5U=; b=hugsAsqEhFehgzIzSepH3gW75MJhsI809NbOTjWg7lYP7ChW38APj7TJvgVymncDND DJNYfZnpJCIRhjw01Rx7lKMGnZexcv9avhZx2AqRzn8vmyXG0/PugdsvKOxywOfY8iTd xI4YtgjmyXKpToQDrxctJXKI9mz4ZVQIB2LNinZ4M+7BOrycqzg/9Z8rRuAIs+8LP5r/ VbLMD+VakKxPZQTWE10BKUGgd1UensAWeFUU4057IGEjciJv7bLQKydUr7JSRCje4LB+ GSW+eTQJ2BVfGhazh4drHMrIPU/JCCv3ncXy5LCw2AJw2N1k4N1/FTAeG0iTyEzx2LHJ PbHw== X-Gm-Message-State: AOUpUlH4+/PoRPcFdIqfeZrLPFnv12M37q5Pk84G83AdoES8w/bAUuEZ 44DWUfUSw/VMmG34C3GmzG9O/Q== X-Google-Smtp-Source: AA+uWPz5Aatwx8UH6q7o1lWq/4CPfRcqcA4mDFTckUaPyDCUE913fsWSNL+wnTxCUDaZ2EtZk0r2rQ== X-Received: by 2002:a5d:5088:: with SMTP id a8-v6mr2289235wrt.37.1533742407252; Wed, 08 Aug 2018 08:33:27 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:26 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 01/28] nvmem: add support for cell lookups Date: Wed, 8 Aug 2018 17:31:23 +0200 Message-Id: <20180808153150.23444-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_083337_774696_0C5D9B7E X-CRM114-Status: GOOD ( 24.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We can currently only register nvmem cells from device tree or by manually calling nvmem_add_cells(). The latter options however forces users to make sure that the nvmem provider with which the cells are associated is registered before the call. This patch proposes a new solution inspired by other frameworks that offer resource lookups (GPIO, PWM etc.). It adds functions that allow machine code to register nvmem lookup which are later lazily used to add corresponding nvmem cells and remove them if no longer needed. Signed-off-by: Bartosz Golaszewski Acked-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 77 +++++++++++++++++++++++++++++++++- include/linux/nvmem-consumer.h | 6 +++ include/linux/nvmem-provider.h | 10 +++++ 3 files changed, 92 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 514d1dfc5630..329ea5b8f809 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -62,6 +62,9 @@ static DEFINE_IDA(nvmem_ida); static LIST_HEAD(nvmem_cells); static DEFINE_MUTEX(nvmem_cells_mutex); +static LIST_HEAD(nvmem_cell_lookups); +static DEFINE_MUTEX(nvmem_lookup_mutex); + #ifdef CONFIG_DEBUG_LOCK_ALLOC static struct lock_class_key eeprom_lock_key; #endif @@ -247,6 +250,41 @@ static const struct attribute_group *nvmem_ro_root_dev_groups[] = { NULL, }; +/** + * nvmem_add_lookup_table() - register a number of nvmem cell lookup entries + * + * @lookup: array of nvmem cell lookup entries + * @nentries: number of lookup entries in the array + */ +void nvmem_add_lookup_table(struct nvmem_cell_lookup *lookup, size_t nentries) +{ + int i; + + mutex_lock(&nvmem_lookup_mutex); + for (i = 0; i < nentries; i++) + list_add_tail(&lookup[i].list, &nvmem_cell_lookups); + mutex_unlock(&nvmem_lookup_mutex); +} +EXPORT_SYMBOL_GPL(nvmem_add_lookup_table); + +/** + * nvmem_del_lookup_table() - unregister a set of previously added nvmem cell + * lookup entries + * + * @lookup: array of nvmem cell lookup entries + * @nentries: number of lookup entries in the array + */ +void nvmem_del_lookup_table(struct nvmem_cell_lookup *lookup, size_t nentries) +{ + int i; + + mutex_lock(&nvmem_lookup_mutex); + for (i = 0; i < nentries; i++) + list_del(&lookup[i].list); + mutex_unlock(&nvmem_lookup_mutex); +} +EXPORT_SYMBOL_GPL(nvmem_del_lookup_table); + static void nvmem_release(struct device *dev) { struct nvmem_device *nvmem = to_nvmem_device(dev); @@ -916,6 +954,39 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, EXPORT_SYMBOL_GPL(of_nvmem_cell_get); #endif +static struct nvmem_cell *nvmem_cell_from_lookup(const char *cell_id) +{ + struct nvmem_cell *cell = ERR_PTR(-ENOENT); + struct nvmem_cell_lookup *lookup; + struct nvmem_device *nvmem; + int rc; + + mutex_lock(&nvmem_lookup_mutex); + + list_for_each_entry(lookup, &nvmem_cell_lookups, list) { + if (strcmp(cell_id, lookup->info.name) == 0) { + nvmem = nvmem_find(lookup->nvmem_name); + if (!nvmem) { + cell = ERR_PTR(-EPROBE_DEFER); + goto out; + } + + rc = nvmem_add_cells(nvmem, &lookup->info, 1); + if (rc) { + cell = ERR_PTR(rc); + goto out; + } + + cell = nvmem_cell_get_from_list(cell_id); + break; + } + } + +out: + mutex_unlock(&nvmem_lookup_mutex); + return cell; +} + /** * nvmem_cell_get() - Get nvmem cell of device form a given cell name * @@ -940,7 +1011,11 @@ struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *cell_id) if (!cell_id) return ERR_PTR(-EINVAL); - return nvmem_cell_get_from_list(cell_id); + cell = nvmem_cell_get_from_list(cell_id); + if (!IS_ERR(cell) || PTR_ERR(cell) == -EPROBE_DEFER) + return cell; + + return nvmem_cell_from_lookup(cell_id); } EXPORT_SYMBOL_GPL(nvmem_cell_get); diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index 4e85447f7860..f4b5d3186e94 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -29,6 +29,12 @@ struct nvmem_cell_info { unsigned int nbits; }; +struct nvmem_cell_lookup { + struct nvmem_cell_info info; + struct list_head list; + const char *nvmem_name; +}; + #if IS_ENABLED(CONFIG_NVMEM) /* Cell based interface */ diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 24def6ad09bb..6a17d722062b 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -17,6 +17,7 @@ struct nvmem_device; struct nvmem_cell_info; +struct nvmem_cell_lookup; typedef int (*nvmem_reg_read_t)(void *priv, unsigned int offset, void *val, size_t bytes); typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset, @@ -72,6 +73,9 @@ struct nvmem_config { struct nvmem_device *nvmem_register(const struct nvmem_config *cfg); int nvmem_unregister(struct nvmem_device *nvmem); +void nvmem_add_lookup_table(struct nvmem_cell_lookup *lookup, size_t nentries); +void nvmem_del_lookup_table(struct nvmem_cell_lookup *lookup, size_t nentries); + struct nvmem_device *devm_nvmem_register(struct device *dev, const struct nvmem_config *cfg); @@ -92,6 +96,12 @@ static inline int nvmem_unregister(struct nvmem_device *nvmem) return -ENOSYS; } +static inline void +nvmem_add_lookup_table(struct nvmem_cell_lookup *lookup, size_t nentries) {} + +static inline void +nvmem_del_lookup_table(struct nvmem_cell_lookup *lookup, size_t nentries) {} + static inline struct nvmem_device * devm_nvmem_register(struct device *dev, const struct nvmem_config *c) { From patchwork Wed Aug 8 15:31:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560205 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 5E34815A6 for ; Wed, 8 Aug 2018 15:34:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 489C529E6D for ; Wed, 8 Aug 2018 15:34:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39BBF29EF1; Wed, 8 Aug 2018 15:34:23 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D5B8629E6D for ; Wed, 8 Aug 2018 15:34:22 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=VLJ4iuMfi3bwjq1ox+IhPquwVE+OIz/5K7him4h4NCQ=; b=NTOUke0e++6GxtuA1bGLF+HCZl 4aS8laTH89nXml2/OV7iTlUT3QWzHiZiNZeUS/IyR4zacwXGiAjKPK+7tWBy0t9gzYhhwSQZS3m7p Namw8jXxc7EPBc/SWVjqKAm5s524lk9/Gg5OgUJmft2YuaBBOhY2ydwAmaxKOJfnhCHAzMHotDno4 K7VAqlhfji9wiCqvIFCfW1wqd0h3hw9Dq9fTgvG00Qxevey/j/PMTuNN6BzUzRj+brj+Tm4GV39ac imanctP/AsRhx3ARSWM8PA2L1LTh+BeIdvtnW47zzFuy5c4q1/1YZdJiizHhz5AfjG52rquv79zeA Y6nlQ9KQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTX-0004wF-D9; Wed, 08 Aug 2018 15:34:15 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQSv-0003y8-9m for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:33:42 +0000 Received: by mail-wr1-x441.google.com with SMTP id h9-v6so2420309wro.3 for ; Wed, 08 Aug 2018 08:33:30 -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=auDnQ2msgcUIg2cR1NJaWEIgp9qglPcIziHCsh4zH4c=; b=i0TceG1lfus+3BKletcKWO3nK/kouvjNQ7m41aqTlvkDGShVKicbJizZHKDcw3Xqt+ HPr21z1eaCC7xAYrE6QY5AYgYSjdpdncEKSuTuYtGsJMlOxdr1Xs06f0jThoaM5E5FPt RDoXE6k+MkI0htttCqe3Z533KoWRVj+IGT1KP/BBWIUee236jV5xzx3s/WuaxDl0jp05 XCNQAg3Rv3YvBaDXWZKo4rYHxI8zIBvMJI6UUfP5/mVir7hVqVimhQlrXmh2SFn1dkzK 6WoaZtFaMc8ktSCQafPsfjp+uQWjcGeBBFPjxiDX0PsUVROXEtmgSb5yWl9ElgSrCvZm HUfQ== 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=auDnQ2msgcUIg2cR1NJaWEIgp9qglPcIziHCsh4zH4c=; b=jqlVAto8AtnAjKxltLuw77sZqiEikftMA7/8XetPsp1b6R59wvpTxjlCBvMi5f6yqg wsD54AZfsiB1xlgxn1KORG4ab3Lei/lWGUjcu5URpnkywmfAgbrh4EUOrNIGTIfklW2w 3JYh43GubTOyif2CSR+HcgSX+02SIggyz71s+Nwodhp+S9xyjwM1Hj8nKkN8H2RbHPD/ XlxQ8sAXjgH3Zca/gJlo04Y8P3RkUvtibZ5DNx3K46DMqe3WRpncL755sQAvckWboMdE DN0mR4bUlFajBmI5zXW4LOdv+bjdvZygS55DDLIQ98+R/80XlEEC38oYfKD4Q7S3ICSw GxUA== X-Gm-Message-State: AOUpUlGALj5vJ+zX6fdCr2BcFFO1YJ4XfkXS1+mkgQNTASoiZWcstaPW v3zuzpptqS6e/OXKIYUkBIcciw== X-Google-Smtp-Source: AA+uWPzXSa//8V3H1avfMZTefmddl6h0FyaPd0yH7CY96wAZDwMdcsR62BaE3h96tK/j1eDfbq7FHA== X-Received: by 2002:adf:eec9:: with SMTP id a9-v6mr2368667wrp.21.1533742409371; Wed, 08 Aug 2018 08:33:29 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:28 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 02/28] Documentation: nvmem: document lookup entries Date: Wed, 8 Aug 2018 17:31:24 +0200 Message-Id: <20180808153150.23444-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_083337_715759_9D4CDBFB X-CRM114-Status: GOOD ( 17.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Describe the usage of nvmem cell lookup tables. Signed-off-by: Bartosz Golaszewski --- 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 +++++++++++++++ From patchwork Wed Aug 8 15:31:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560225 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 D88691057 for ; Wed, 8 Aug 2018 15:35:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C508929E6F for ; Wed, 8 Aug 2018 15:35:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B825C2A9C3; Wed, 8 Aug 2018 15:35:32 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 52F0A29E6F for ; Wed, 8 Aug 2018 15:35:32 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=dkJEVGDYsK8oae3M387VJPSUJK2wl0ywJjNIrLFLcis=; b=DWe6R/T8nCGT9fnN6E+yZDJLdk Gbj5wseVL+oGokIYXWsMv03O28syWvOgx6QyiKvkvcV9B2pAZbcssV+I80adxBPJKrVo9mDHRpaua LjfrMfFAkLT00R7ICBnQod6AoqoYr3zX+EtuxEj9f4BiskmjpOWUFD0Npwz8Tsp9f0zrU1ytu7wYr B0mW1oryuBOZ3Trd6O0jwVGzkswb1LzqLVWh/Fj6aa/wd+NMM0MubU1F86WuSY/1Oh8JnuNRoNPFT 5y4gs2/pUFH1Lfx5MuSVLYRk8w0kmgl6T+4ZweSUGKL3yJDIaVwkS3gzy3GQ/c82Sp1i+Y6dGojX2 AxWhoUlw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQUh-0006dS-OC; Wed, 08 Aug 2018 15:35:27 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQT1-0003zT-4D for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:33:50 +0000 Received: by mail-wr1-x442.google.com with SMTP id j5-v6so2391732wrr.8 for ; Wed, 08 Aug 2018 08:33:32 -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=0/AcFQWG5GWA8z8qElGqK0mK/sub6hcCVMsKNMHf7yU=; b=e77HNEXQK7pu4RBRZeCmNPrKeduXRuP9S9cTxoYQ3X+TxcPsLBof2AMUE0NxymJprz aSLozu5Jg/24ZnLaT7WNNLjUfTHXGAedexjwjMe1wVI4m9+SEruVZc0IY4c+44KPWLMw N7LsTQ/H39KweZ99N/07jtuj3+IlYRuGMjFuDMHDmu115wheS5SrCmYOFrCVbLhBIvrS jNM/6Mj281twAPkZvxS8Fb+Tzq815NdY+ScQKrRVooXrSmWto1y4CbrvU2t+rGzouMF9 nScHpKlfurLk468ZkktF3JWjS8MjJGTzcJ/A5CfGeTTOVauyWnKRr1nksHOZ3swBB1bQ G/dA== 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=0/AcFQWG5GWA8z8qElGqK0mK/sub6hcCVMsKNMHf7yU=; b=sju7ahy4lrYzJx7Joi578yhKVc80LCFLZMN6bGmtAeIIxtwUMfAS1o/0ZUKh7adFUh nC81I4iOWBu/bhazZmOu1seReGf5mx+9X55+JVJqYftlKlpvNMCbHeBmEJ/UEhx5nJbw kGIJt6wh97KF2c73mYenSUKFYsF193cOvu5zhHhojYxphCPlgfTi+8ocrAJibPVofpGZ lCYZTe91Ph5NAoHtF2G9/lHBbLdnl5u2h2oygLETKiAftaLdFb722rw1FLb+VYskCUh/ rxgT5EDKk+NIOC3uw3L3LD6CHZ/KKEfDrQMOQw+06b3WQaPn2svBoepHtuR8QMBlzD4F vv9A== X-Gm-Message-State: AOUpUlHbNPTr6lHZIjajdttc6RXMCQwW7qxkRk6AXdDsOoOzBpvJflRb Yl4T441arYCOCTOCA4kQQ+UzFQ== X-Google-Smtp-Source: AA+uWPxR5HmEXh9KfDK+gx6BHy1jALE7ffWZSAb4PHIBslPHrDIi5/8Bk3oEBQxwnC4JQKq67Hijdw== X-Received: by 2002:adf:d842:: with SMTP id k2-v6mr2256361wrl.26.1533742411481; Wed, 08 Aug 2018 08:33:31 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:30 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 03/28] nvmem: add a notifier chain Date: Wed, 8 Aug 2018 17:31:25 +0200 Message-Id: <20180808153150.23444-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_083343_499952_CCE72098 X-CRM114-Status: GOOD ( 19.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Add a blocking notifier chain with two events (add and remove) so that users can get notified about the addition of nvmem devices they're waiting for. We'll use this instead of the at24 setup callback in the mityomapl138 board file. Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/core.c | 20 ++++++++++++++++++++ include/linux/nvmem-consumer.h | 18 ++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 329ea5b8f809..128c8e51bff2 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -65,6 +65,8 @@ static DEFINE_MUTEX(nvmem_cells_mutex); static LIST_HEAD(nvmem_cell_lookups); static DEFINE_MUTEX(nvmem_lookup_mutex); +static BLOCKING_NOTIFIER_HEAD(nvmem_notifier); + #ifdef CONFIG_DEBUG_LOCK_ALLOC static struct lock_class_key eeprom_lock_key; #endif @@ -479,6 +481,18 @@ static int nvmem_setup_compat(struct nvmem_device *nvmem, return 0; } +int nvmem_register_notifier(struct notifier_block *nb) +{ + return blocking_notifier_chain_register(&nvmem_notifier, nb); +} +EXPORT_SYMBOL_GPL(nvmem_register_notifier); + +int nvmem_unregister_notifier(struct notifier_block *nb) +{ + return blocking_notifier_chain_unregister(&nvmem_notifier, nb); +} +EXPORT_SYMBOL_GPL(nvmem_unregister_notifier); + /** * nvmem_register() - Register a nvmem device for given nvmem_config. * Also creates an binary entry in /sys/bus/nvmem/devices/dev-name/nvmem @@ -559,6 +573,10 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) if (config->cells) nvmem_add_cells(nvmem, config->cells, config->ncells); + rval = blocking_notifier_call_chain(&nvmem_notifier, NVMEM_ADD, nvmem); + if (rval) + goto err_device_del; + return nvmem; err_device_del: @@ -586,6 +604,8 @@ int nvmem_unregister(struct nvmem_device *nvmem) } mutex_unlock(&nvmem_mutex); + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_REMOVE, nvmem); + if (nvmem->flags & FLAG_COMPAT) device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom); diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index f4b5d3186e94..ae4d30347602 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -14,6 +14,7 @@ #include #include +#include struct device; struct device_node; @@ -35,6 +36,11 @@ struct nvmem_cell_lookup { const char *nvmem_name; }; +enum { + NVMEM_ADD = 1, + NVMEM_REMOVE, +}; + #if IS_ENABLED(CONFIG_NVMEM) /* Cell based interface */ @@ -61,6 +67,8 @@ ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, int nvmem_device_cell_write(struct nvmem_device *nvmem, struct nvmem_cell_info *info, void *buf); +int nvmem_register_notifier(struct notifier_block *nb); +int nvmem_unregister_notifier(struct notifier_block *nb); #else static inline struct nvmem_cell *nvmem_cell_get(struct device *dev, @@ -149,6 +157,16 @@ static inline int nvmem_device_write(struct nvmem_device *nvmem, { return -ENOSYS; } + +static inline int nvmem_register_notifier(struct notifier_block *nb) +{ + return -ENOSYS; +} + +static inline int int nvmem_unregister_notifier(struct notifier_block *nb) +{ + return -ENOSYS; +} #endif /* CONFIG_NVMEM */ #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) From patchwork Wed Aug 8 15:31:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560271 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 1432315A6 for ; Wed, 8 Aug 2018 15:41:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C37802B1FE for ; Wed, 8 Aug 2018 15:41:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF4782B1F0; Wed, 8 Aug 2018 15:41:08 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4BC6E2B221 for ; Wed, 8 Aug 2018 15:41:08 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=157EGcf8ey0eJ25iYViPzF2anm7jghIzVEX/EMy3ja8=; b=kbPcIdwwITxQh5tGzklYEux9Bi CxA97VRzWXXctx87AyQb4Pzu6W8YSIH5pdNnOBb38E/j4KOu6P1tB8dOfRs8Skc/z8BAgfs5Q3eA1 63k6nYrDNSWWcoGo8KaWqL9S2UYXkg24J21iw5oT/H4pyCbWQumzo8ZQGo7hPbWQnFmwS4hu7ISNo 41owiqP01csCJxGN6OqgnLU+98BFkkQZyhPHgwRZiAScImRaLF2tlUnMg8cV+GjlZuNEVSOWaQd/7 sEShUQ0pU6tvCdnK0bzT9yspU4mNPu4NKglaRh7WcLaZzvOeiaSgdmMZauRn9y8hxNhRIdMzUkQK7 C6P4VAFA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQaA-0004GO-7q; Wed, 08 Aug 2018 15:41:06 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQSv-00042s-2Q for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:33:39 +0000 Received: by mail-wr1-x444.google.com with SMTP id v14-v6so2410699wro.5 for ; Wed, 08 Aug 2018 08:33:35 -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=C1ENfkoTLjW8E17DVw+md+9F6tiK3Z1VCNCm2wV2Sh0=; b=jPZR1hu5zBkXG9rS/CQnTD+BZj8gpnkEM9pKhPLQz0sLHXzfppDAMqcLQFOncyiayL rcgsB1mru/+1XB8kdyDRoOaZWdkJ9787WgUisZ3SwQu6vxr0DWYU+8s7bZfb3tPHnOfx MN7FvU1aDT9UWADNBnCICEQRJeIjS9RXJ/vH0wJGuXyu3aG+C325BwmowNd64S6gSX3c 2KBqPJN/aZ4+c8BfDyWBd9RflXfeVcQcUEpO1Xk34IIirtmqfodmt/Q8onTCMOw43QZY DSmzGCckG9dDMZ4Ao9YVf9JvLyk4SdAkJwe7Ey3AjTpN9PSjaLtO/jqq+QkIdAybK02N Vq/Q== 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=C1ENfkoTLjW8E17DVw+md+9F6tiK3Z1VCNCm2wV2Sh0=; b=lwvS0IEYk/pbnGAMI283Fp2aPBVT8IpRDh35n6IVD0lYR98pBCueGwxmDS59NOk9ZJ /Q51Y/RRU//hWd/3WUrWHhtjnIr2Q985v3jabu1E5Ix8FznnldBVCmw73O/UWWKl0GI8 xSfigaBOF/5Y1exYEIGSF4/1Btz91+lOg6AX24/RK5czODHoR63CF2p/TsNirvksLgKV Na52NJwm9T+5uGvAj6YmtFN+3Waun+w/HX6wANqU3QKKwPraJ/yKDSbzHtFpUfZks9il 6drLDP6A0+4n33RC3D9Pr1qjGU0OVyH6ntXExCw/qLdfSj5i0IExNdPwGXEaYGteIClD OVGg== X-Gm-Message-State: AOUpUlF+JviyYb7nRjgPXNhCuTEZzMQX8Jd1EHDwlT21dOpTBHWYsxS7 526y/VHEniG3tznXW17MndJofQ== X-Google-Smtp-Source: AA+uWPyeKUZkZ5lzpR7fQUL35EZxOiMcdK+l1BV3+kpdv59GQTqxqPRSG5Tzp1r0MeLy0jLVvWQO+A== X-Received: by 2002:adf:f091:: with SMTP id n17-v6mr2355042wro.49.1533742413825; Wed, 08 Aug 2018 08:33:33 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:33 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 04/28] nvmem: provide nvmem_device_name() Date: Wed, 8 Aug 2018 17:31:26 +0200 Message-Id: <20180808153150.23444-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_083337_454261_85EC12D1 X-CRM114-Status: GOOD ( 17.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Kernel users don't have any means of checking the names of nvmem devices. Add a routine that returns the name of the nvmem provider. This will be useful for nvmem notifier subscribers - otherwise they can't check what device is being added/removed. Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/core.c | 6 ++++++ include/linux/nvmem-consumer.h | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 128c8e51bff2..b040370292a7 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -1440,6 +1440,12 @@ int nvmem_device_write(struct nvmem_device *nvmem, } EXPORT_SYMBOL_GPL(nvmem_device_write); +const char *nvmem_device_name(struct nvmem_device *nvmem) +{ + return dev_name(&nvmem->dev); +} +EXPORT_SYMBOL_GPL(nvmem_device_name); + static int __init nvmem_init(void) { return bus_register(&nvmem_bus_type); diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index ae4d30347602..c4000a218f67 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -69,6 +69,8 @@ int nvmem_device_cell_write(struct nvmem_device *nvmem, int nvmem_register_notifier(struct notifier_block *nb); int nvmem_unregister_notifier(struct notifier_block *nb); + +const char *nvmem_device_name(struct nvmem_device *nvmem); #else static inline struct nvmem_cell *nvmem_cell_get(struct device *dev, @@ -167,6 +169,11 @@ static inline int int nvmem_unregister_notifier(struct notifier_block *nb) { return -ENOSYS; } + +static inline const char *nvmem_device_name(struct nvmem_device *nvmem) +{ + return ERR_PTR(-ENOSYS); +} #endif /* CONFIG_NVMEM */ #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) From patchwork Wed Aug 8 15:31:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560229 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 D242C15A6 for ; Wed, 8 Aug 2018 15:35:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC3DB29F05 for ; Wed, 8 Aug 2018 15:35:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAB112AD3F; Wed, 8 Aug 2018 15:35:47 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 564CC29F05 for ; Wed, 8 Aug 2018 15:35:47 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=ivZuXXsGvJmD5vc6cynRzFe9jamhmUKVT2e4RX+Ph2U=; b=IWR79uvJxfBJI8XmNL0fdokhOn eIfe2bmlvSYuo+IhN0939MwvYXT3h26TXdfKzH8saaVe1asp/H9EWYQcgHU9FPuN+psWBl41VK+xy U6sXkX5q+0uos5t/T2+nZuxkD2sa+UabQwgZIFYexqlmHego+bBN8YE2+9l77r0Zdgg5Yn58PkJH0 aN/glxPj5mBKKAo52Iwks2eyzhzx7h7e8Z2X6WnO+W873LOLGenEtk5rqEweTVRqRoBim3wvyvWGq CTsd2vR9USd2/1wXenf1SuxxTYHHfruiKbVZJ+NvENyadWst49+F26ld2WAL19UXxg8XN63aZvydr yjmzbfLA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQUt-0006vf-5M; Wed, 08 Aug 2018 15:35:39 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQT5-000469-Rq for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:33:51 +0000 Received: by mail-wm0-x244.google.com with SMTP id l2-v6so957779wme.1 for ; Wed, 08 Aug 2018 08:33:37 -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=DW0C9V3JvjZMYtKc8VK2o7U2J9FYgSOIQQygiNDbrgo=; b=AcuLJY17W5Clw2yPL5HLD6Zj836DwoaBCJaGP+qN0/Y43HV50mrYYtYYqk2g0jc5dI wd6kpW8QSnFeZCA+aTIDvicCoF/3c9f1s8FlRMEhisMjdBLYNAx95XuE0Os2yGdjIaI3 +SCJ70xWZUGUsGafHrxPQjv4OaFwaD2CElfJhalZ7uds3s8VdEfbm/Ppl8w0xUc9G/m9 tB0sdr/1VtZs+OShiP45q9K0juxDsN9SLMKZBOYHkYKCBt90SdbENcs2DIl+r+Iz2vg+ p4skoT8ny2aLmTgtM/kuyX8zj0UHZBvtyh/N+/pcdzAOu8GGShyguIP5OHLOwI3bblhH NiKQ== 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=DW0C9V3JvjZMYtKc8VK2o7U2J9FYgSOIQQygiNDbrgo=; b=jIhqs530FNtFC+2DSOFfNDQbzJsuE08YtEeTeaNMBsOf/4nSEX5cD5Jqt7UXo73wXT vkcGnV03i45JYu8BlmuMQcP37J9hsUZ/7/RT8BumI/ypKPczrI85n85iLdqOHQ/lSGdm iTrLChcYIVswX83NcSR77cfywj9lHEzpleNNeY8veJUAlr38loVx/k+A5dasWoMcHNMV tpIlhp7xeKy9lDJMdj2M5hlR1ZGOqHffFg27dcFM74aWvCWWwmAmrumkOWwS1wSIde81 miAmGQcWXGDtR4tClY78ajne7g+eB5FnMUmR50gXHZ1eDhQoBTERRE3iq1ix9b23GsxQ Lukg== X-Gm-Message-State: AOUpUlF9NrSWefxrtjpa/XawySngarbloSO7uXrYiXGREMtJ/y0kz8w0 bgLBcigx212VY/spY6h0a1WxRA== X-Google-Smtp-Source: AA+uWPxd1LO/WvVi1GIoWBanTKcpOlXMsLtYBnwvackLfen0yF3M6D0EYdVb2dOx9LyK7QBoUTIHag== X-Received: by 2002:a1c:8587:: with SMTP id h129-v6mr2050951wmd.105.1533742416039; Wed, 08 Aug 2018 08:33:36 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:35 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 05/28] nvmem: remove the name field from struct nvmem_device Date: Wed, 8 Aug 2018 17:31:27 +0200 Message-Id: <20180808153150.23444-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_083348_288904_2EE1B3D3 X-CRM114-Status: GOOD ( 18.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski This field is never set and is only used in a single error message. Remove the field and use nvmem_device_name() instead. Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index b040370292a7..6c825ce866b6 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -26,7 +26,6 @@ #include struct nvmem_device { - const char *name; struct module *owner; struct device dev; int stride; @@ -712,7 +711,7 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np, if (!try_module_get(nvmem->owner)) { dev_err(&nvmem->dev, "could not increase module refcount for cell %s\n", - nvmem->name); + nvmem_device_name(nvmem)); mutex_lock(&nvmem_mutex); nvmem->users--; From patchwork Wed Aug 8 15:31:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560233 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 5C4A215A6 for ; Wed, 8 Aug 2018 15:36:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46CC129F05 for ; Wed, 8 Aug 2018 15:36:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39C1F2AD3F; Wed, 8 Aug 2018 15:36:10 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B98A429F05 for ; Wed, 8 Aug 2018 15:36:09 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=eUHdI0niQbOgDjD14+Mermj1DUNBxX6/aFZl9ddMxPI=; b=Lo5nfn9wk78IlNWZCYgPHAF+WP V0p3WvZwD9GTF86oHFJ87yspI0aEybrqgkSemmslHAsTIoIRu9teYsSibwwsEcAsoJMdIuBuTOKnf TrOo+2c6/LhQh1TSjikihMHf0RtC3nZ8Ig9W+qBQ8oBdIxmiJs3jLMxZQQVTB0N2Kgx/NDDxn3vec 7fT/PDR8rp28r1o9fQLQAINs6haBod8hE4i5w2iYBzvzpGORPfiq3AJOIC915lvplZmkcpm/kc2dW eSwQxxNL8pXP4dACwIn9bGPnkJ/mbiJlP5YyTHszw2HnW8z/SO5iFja7fw8p6ECN441fENst9oYda rl9xMKww==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQVG-0007aV-DN; Wed, 08 Aug 2018 15:36:02 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQT7-0004AB-Bu for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:33:57 +0000 Received: by mail-wr1-x441.google.com with SMTP id u12-v6so2411834wrr.4 for ; Wed, 08 Aug 2018 08:33:39 -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=yrklqQoVna1AmqNCU3D6TLUmDxCRyEqqCAbn0AY+9ek=; b=tGOhqhgB+VQgpU+wvkZEyKTCEfpDSRa9otYxlA03cNtCasel7cpD3/KdUhww2wm4Pm fjecI5ekdjsXq/qtOgD40K5558+7j9MiGovw1hv3MRtLpIZAn7heVXGUqXD+JfqmsnwQ TXJRpYoLiDY6qtKE7TgSXcyICr489v0zRi6FJ1fUuu3+eticUHpF2b2AOogwbp9BmN/N NGIEklrO1b7ixyrtRAQoTrGihAn1LjnzY3rew+cvC68zGxI58LDEa5CmJ7R3xwj8Risv 7GOXKvnUmzX7bbj5hXhy5QCUv3xKFAEv+/DkgzpyWsFci4GBN+q6Y+8dWoVmQTjRJM3W q00g== 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=yrklqQoVna1AmqNCU3D6TLUmDxCRyEqqCAbn0AY+9ek=; b=TAGYinTLNXZ9sVvvzHDU9MHKwjkPiu51sjeynRnefG0ofbTs4MSm7Sp693FNCbEmmv O1siO3lKF0WN1flOWLQa7/nc+l3qPUCDBgZAIwjGNQ/AJJTwT68XLg/TWS8e/LUQAGpt XG8jWmMBYY4jMGJVxC3nNG0ATObcXAnEhpoPj9ApTCWuobl5bl4oZFVr9i89RWcM85ee h5k4De74/2As2u+shxVH649pklG8LQjS5djZqY4yte7DPvcoGTZV2RbOwnUQqnvGQUZM GwG1VC+HMDvqkNKztg/GgjGJAqUmRmHEuLcgqJ1dJbKGv8AdpvGQZsISH9Vf9bd5rElA +neQ== X-Gm-Message-State: AOUpUlFIEv0MQI6nAn934tPleulZDV1RPwMkaUuTDwib6+24lhpDAze3 0ZPyIwLSVFb6GjIjqAsKtYr9GQ== X-Google-Smtp-Source: AA+uWPwEASbCLgwuQsHEGaZm9m+7/XT8CXQ1Qp5WvwSSMK3JkUQrEpoFZ6K2BNuLsbgiE22k2QymAQ== X-Received: by 2002:adf:9a55:: with SMTP id z79-v6mr2083051wrb.153.1533742418005; Wed, 08 Aug 2018 08:33:38 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:37 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 06/28] mtd: Add support for reading MTD devices via the nvmem API Date: Wed, 8 Aug 2018 17:31:28 +0200 Message-Id: <20180808153150.23444-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_083350_088761_B4B948F9 X-CRM114-Status: GOOD ( 22.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alban Bedel Allow drivers that use the nvmem API to read data stored on MTD devices. For this the mtd devices are registered as read-only NVMEM providers. On OF systems only devices that have the 'nvmem-provider' property are registered, on non-OF system all MTD devices are registered. Signed-off-by: Alban Bedel [Bartosz: - use the managed variant of nvmem_register(), - set the nvmem name] Signed-off-by: Bartosz Golaszewski --- drivers/mtd/Kconfig | 1 + drivers/mtd/mtdcore.c | 50 +++++++++++++++++++++++++++++++++++++++++ include/linux/mtd/mtd.h | 2 ++ 3 files changed, 53 insertions(+) diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig index 46ab7feec6b6..f5549482d0df 100644 --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig @@ -1,5 +1,6 @@ menuconfig MTD tristate "Memory Technology Device (MTD) support" + imply NVMEM help Memory Technology Devices are flash, RAM and similar chips, often used for solid state file systems on embedded devices. This option diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 42395df06be9..a57302eaceb5 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -488,6 +488,49 @@ int mtd_pairing_groups(struct mtd_info *mtd) } EXPORT_SYMBOL_GPL(mtd_pairing_groups); +static int mtd_nvmem_reg_read(void *priv, unsigned int offset, + void *val, size_t bytes) +{ + struct mtd_info *mtd = priv; + size_t retlen; + int err; + + err = mtd_read(mtd, offset, bytes, &retlen, val); + if (err && err != -EUCLEAN) + return err; + + return retlen == bytes ? 0 : -EIO; +} + +static int mtd_nvmem_add(struct mtd_info *mtd) +{ + struct nvmem_config config = { }; + + config.dev = &mtd->dev; + config.owner = THIS_MODULE; + config.name = mtd->name; + config.reg_read = mtd_nvmem_reg_read; + config.size = mtd->size; + config.word_size = 1; + config.stride = 1; + config.read_only = true; + config.root_only = true; + config.priv = mtd; + + mtd->nvmem = devm_nvmem_register(&mtd->dev, &config); + if (IS_ERR(mtd->nvmem)) { + /* Just ignore if there is no NVMEM support in the kernel */ + if (PTR_ERR(mtd->nvmem) == -ENOSYS) { + mtd->nvmem = NULL; + } else { + dev_err(&mtd->dev, "Failed to register NVMEM device\n"); + return PTR_ERR(mtd->nvmem); + } + } + + return 0; +} + static struct dentry *dfs_dir_mtd; /** @@ -570,6 +613,11 @@ int add_mtd_device(struct mtd_info *mtd) if (error) goto fail_added; + /* Add the nvmem provider */ + error = mtd_nvmem_add(mtd); + if (error) + goto fail_nvmem_add; + if (!IS_ERR_OR_NULL(dfs_dir_mtd)) { mtd->dbg.dfs_dir = debugfs_create_dir(dev_name(&mtd->dev), dfs_dir_mtd); if (IS_ERR_OR_NULL(mtd->dbg.dfs_dir)) { @@ -595,6 +643,8 @@ int add_mtd_device(struct mtd_info *mtd) __module_get(THIS_MODULE); return 0; +fail_nvmem_add: + device_unregister(&mtd->dev); fail_added: of_node_put(mtd_get_of_node(mtd)); idr_remove(&mtd_idr, i); diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index a86c4fa93115..8121c6582285 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -339,6 +340,7 @@ struct mtd_info { struct device dev; int usecount; struct mtd_debug_info dbg; + struct nvmem_device *nvmem; }; int mtd_ooblayout_ecc(struct mtd_info *mtd, int section, From patchwork Wed Aug 8 15:31:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560329 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 98B8414C0 for ; Wed, 8 Aug 2018 15:58:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC6E12ABD9 for ; Wed, 8 Aug 2018 15:58:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE9A72ABE8; Wed, 8 Aug 2018 15:58:02 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D0B722ABD9 for ; Wed, 8 Aug 2018 15:58:01 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=Ljgkesr7Vyr/rFzm6X6UsP8Rb/wsZrvLIokFTb4bIdY=; b=DlOosASOpVFuV/OGc6vwaVwlIp 9luCZMeGo0YBDKuRYGt4eH4Dg6V1vJhCJaDwRl87qt4lRTCl+VGGa32Vr2gmllleCtkT86/bRk9cj 5ShKTXWH4D3ZWy3lWOtiLeeBErA7ufw56fWsEoOshK3j+1o5SGRKguDkWJXWcYWgtUDVbJclZ/7TF dz7r9suRur8ytI0iykdf9eje4QIW/XbcPhPK4dgpvO6/veobZzZDBH8iBCRjBaSxZE78Rk9UGEzV5 MYE20f9cGaHUBWW8Jq/91Z0Itw9rbDHcKm/g5NzMDmgKTEZlRJrcxfRuDk9us30rUbBSTuouHBg0E J/pTVudw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQqS-00083A-MB; Wed, 08 Aug 2018 15:57:56 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQn6-0000yY-1R for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 15:54:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3db+EwdA0BE/nKODKMaepKnhT1t81s2qEJflbfjuR1A=; b=hHef4rfeHn1/5YOJuv6vNBt1Q E2l8yzlkkUCS6A3gvvi9drPrfgriFpsijt/mFPeH4g4FltBmcOHMDpqDfMlcVkvlLTPj9y7k16GuM owcpvbA198HDfjwRr+rkU1gcdlpfYSqRGFQYL6rvMPjN+3ooO9RYJtttYb7x1jDEBMvH+QRKXf4T8 YTYU6vnXdXx0whLu2jio/5gM/SfzUaQRU8CoiWNUAVluSRIgSC4NieXdwrR4baE9351pK1uxhvJKo 4PSKlDuMiE31UkVMx+NR8/X6zhb+CPWDI/MDMlFH9LiIQWxrQCTHhg+SNZQxeUSklz3NsTu5Q6vPk GwdjBoOKQ==; Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTC-0001Rw-Jk for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:33:55 +0000 Received: by mail-wr1-x442.google.com with SMTP id h10-v6so2403882wre.6 for ; Wed, 08 Aug 2018 08:33:41 -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=3db+EwdA0BE/nKODKMaepKnhT1t81s2qEJflbfjuR1A=; b=fO4u90gRjcwJ1PkoMrvfUoqbmGq/lYuIUldc48QmVBYbNkJFkz2gyQukVu4JTNrBCu 4UsEvaLrpuXhZlqYiH84ZBdMbEFONdoKwjKVbhJHQ26B7ebLQTjJH9pUDWMZ0KVwKRlE pdvJmEfg6MMindvOSEtSu/pqYSQQsbsT/jLgSOMC698QYXGPLMgB8Ca2LTqeTfJWYokE GNrAil+tILe7xAbtMnNqOkNbqC0PM6Z//6DnRbbR8PPJRFjGIt+ZgOTKi6tC1LYidaOq M3Jl95Rbiblq+r9g0Y/3ciiOog9D2AZXZTAJ8S/czLde/bQe1HlWLqDGI+ZSEQcW/AEN tmQQ== 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=3db+EwdA0BE/nKODKMaepKnhT1t81s2qEJflbfjuR1A=; b=tgVRh39OieM9EgFQbPcwLtbSc5p43vXx9dq6Alg8EM1nua0ZIun4dXYr0OHwQnD29R TBISo82izD+pMch1WBaCC/pmSG72waqT+KZONZZohgokjTriucV4s/nh81OPe8I0ZQDf WWOUznr1UIBcTSeLdQ3OlgQf0+f/+nUDp/RE+5T3wii+OqF27vpjQ7w3mT9w3tkmVlSg o/W/nuuOUaEoUEZ8zJGTLj5VJeALIalTqFoZNXKKgvfqKFYfWRc8Y51vFrjhBOPNjGiQ 8rttmn9dUoTxNsN0zmbPTSx1LDA43RCYt4mIf4wYeroXQHAZ2uAb1DrzHkroENphgBar Y9bg== X-Gm-Message-State: AOUpUlG6Ay+1iKtBHmvjWs3AyQavIMdqCUV2Prb/fGIfRjTVyI9aXpdn 53KYj48VksBBhvEap3g5TGnjPw== X-Google-Smtp-Source: AA+uWPzi/DfnxkWlzRJWkuCz9Vk5iiOrkjRdGpqxGNn1tqWZ1Bwdhofy38dZ4+bn8pt48LHVGuy/XQ== X-Received: by 2002:adf:9e84:: with SMTP id a4-v6mr2234951wrf.70.1533742419840; Wed, 08 Aug 2018 08:33:39 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:39 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 07/28] ARM: davinci: dm365-evm: use nvmem lookup for mac address Date: Wed, 8 Aug 2018 17:31:29 +0200 Message-Id: <20180808153150.23444-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_113354_690257_59780656 X-CRM114-Status: GOOD ( 17.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support nvmem lookups for machine code. Add a lookup for mac-address. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-dm365-evm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c index 435f7ec7d9af..cb0ac92a278e 100644 --- a/arch/arm/mach-davinci/board-dm365-evm.c +++ b/arch/arm/mach-davinci/board-dm365-evm.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -169,6 +170,15 @@ static struct platform_device davinci_nand_device = { }, }; +static struct nvmem_cell_lookup dm365evm_mac_address_cell = { + .info = { + .name = "mac-address", + .offset = 0x7f00, + .bytes = ETH_ALEN, + }, + .nvmem_name = "1-00500", +}; + static struct at24_platform_data eeprom_info = { .byte_len = (256*1024) / 8, .page_size = 64, @@ -769,6 +779,8 @@ static __init void dm365_evm_init(void) dm365_init_spi0(BIT(0), dm365_evm_spi_info, ARRAY_SIZE(dm365_evm_spi_info)); + + nvmem_add_lookup_table(&dm365evm_mac_address_cell, 1); } MACHINE_START(DAVINCI_DM365_EVM, "DaVinci DM365 EVM") From patchwork Wed Aug 8 15:31:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560349 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 32DCE139A for ; Wed, 8 Aug 2018 16:15:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CBCF2B0DC for ; Wed, 8 Aug 2018 16:15:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D0122B1CD; Wed, 8 Aug 2018 16:15:10 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9B9002B0DC for ; Wed, 8 Aug 2018 16:15:09 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=p0As8HdXAHGI0PC8tba7fnBFa/iZvFj8j+FfDIDuzrc=; b=FITuNjulLPleYCKIKqwFxA4GgH BgBDNrw1oXahAMHSZrVwn/geUvn9byGs8HH2yj3h42qMpyxi3n8whM7wkBYRvY+S4L5alMk3KZvy/ cL2osr11D4egsmZ5m1XKmnAgc8hyF80CKJfl7pfkefVekifpODqihbHZyT+1fWiryNJqEkTfUgqN8 QAC28nUnrfZXCSS+ElzGOGTO1ZvV4EEhPgAwpc50MTPbqaIF6P8PMFTdz1galpaOVS9vxWHeOhToO lgtaVt95xNViXSpj2KYJHHvQmVjmYBnXanSEQDquWA09UDjnk5rq01RCLRXqQ0fcVcoG676FuETWR 4veZNtsQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnR72-00015x-1C; Wed, 08 Aug 2018 16:15:04 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnR5I-0005mi-9e for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 16:13:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3wRKI0ad1H2vl0yNJFc7xc7E5f/unJTGeQQy+eD1Wno=; b=oWJxXg+G4+GagHdeEIhaGYZ6/ kyiW++fqaclGv726Qm3uFtRZEf2uSxNj5Kms4+VfRCJn12SjEyYvNjWn0iJS4vqfhMJN73YXAa8Dp 9jhdEoYL7D9QjG8mvT3zB1AJd0/o0VSy/1u4vb6TjwP8bUgk4CrmQ6Rc92T6ltrJTzjkPIPQjfjb2 B5w1cyB+imR1Wx7J1G7QJ4Z9qJ5asUa88Ed3YlQ9fAOSs4dMYZXs9GogInOCGUxthO2tGWstA9kwa 8/SBjqVjDhHxQUDa/7setOuwlFGEDYuWj2//H2sDBfGGNUQjUWatK7G+CqEja8/qVIJK6aQaqkxqR BBMGOo59Q==; Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQT2-0002rN-8b for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:33:46 +0000 Received: by mail-wr1-x443.google.com with SMTP id f12-v6so2378756wrv.12 for ; Wed, 08 Aug 2018 08:33:42 -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=3wRKI0ad1H2vl0yNJFc7xc7E5f/unJTGeQQy+eD1Wno=; b=aJkLKR3bbxHEvPsHktybDHMDjy8Or0i5AfpgguA+wvFfLA/nY9ls2YSzs1tEKn4V9x P+o36ClWOqMj1Advaed1Z0ga5zZQdXXtWHsGQuqVnIkIvkVqyyeu/+/XyHHuaHHL+OZ2 rBcr2W0DMDRW8+D2HfoO06Zz6pnrDpvaZDQRRtuVPYXRx4/UE226U5DZnwqZG7LnaYAP hlpfBbBXv64mPAfxxOQjiXcdCbTLYXJaja25aXaFuJnrATzXhFrRxOkpHhk1ET0dfXlv h/LBjsVnENhIfMR+Ajx0LsK+BlrR/+YD5EJqHuouER3WZ0Z4UQWeUnssUSwycbROWtOC zclg== 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=3wRKI0ad1H2vl0yNJFc7xc7E5f/unJTGeQQy+eD1Wno=; b=uoUxhXwa9e8f9xZhSWeDledni+SFgnIWW2gmoAaj8kQAWid4UOOMeG/FK89jxQGmEQ cBLyKFNmJXUd3ZhZ0lzyPmGflNn7WVhasy3EGVJL6RN+j45aTfmbxAgcU2WgJGZg1ml+ t3lvYqWbt8HVM+FxD3zud5S0EtVpFE4ykACKUPvFDutQnPdBv4X6kdtZBrdLhYeV4g/C Di03Gddl337/x8CkaEuvttkmbMj10A6bVEjkLMVTgWlFdUSjEvrcgl6SNhE+L+RKS49x WBV7Sbx3CLUWYyTxrLEB8nONsqWrFI9SJP+82DyK1QD/2xPBRjnHTweJuydeHfEFAsKe IFag== X-Gm-Message-State: AOUpUlGhRZb8U+c42bHJ7XL5jtMMpoQKVl/B7tycoJ85lxj8+gR5f2F0 b+nq4rB7fdXFyZELTge/OZtF3w== X-Google-Smtp-Source: AA+uWPwJYWYegcNZbeKMBZMz2f9+sA8gZ70FgajA1DqoBnfzNa2LMBRAIYx1EGku1SjfhgcmiS3nlQ== X-Received: by 2002:adf:8362:: with SMTP id 89-v6mr2319554wrd.147.1533742421830; Wed, 08 Aug 2018 08:33:41 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:41 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 08/28] ARM: davinci: dm644-evm: use nvmem lookup for mac address Date: Wed, 8 Aug 2018 17:31:30 +0200 Message-Id: <20180808153150.23444-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_163344_434317_98EC811A X-CRM114-Status: GOOD ( 19.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support nvmem lookups for machine code. Add a lookup for mac-address. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-dm644x-evm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index 48436f74fd71..6d35c6e1b0bd 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -476,6 +477,15 @@ static struct pcf857x_platform_data pcf_data_u35 = { * - ... newer boards may have more */ +static struct nvmem_cell_lookup dm6446evm_mac_address_cell = { + .info = { + .name = "mac-address", + .offset = 0x7f00, + .bytes = ETH_ALEN, + }, + .nvmem_name = "1-00500", +}; + static struct at24_platform_data eeprom_info = { .byte_len = (256*1024) / 8, .page_size = 64, @@ -828,6 +838,8 @@ static __init void davinci_evm_init(void) phy_register_fixup_for_uid(LXT971_PHY_ID, LXT971_PHY_MASK, davinci_phy_fixup); } + + nvmem_add_lookup_table(&dm6446evm_mac_address_cell, 1); } MACHINE_START(DAVINCI_EVM, "DaVinci DM644x EVM") From patchwork Wed Aug 8 15:31:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560319 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 CDDB414C0 for ; Wed, 8 Aug 2018 15:57:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B89BD2B1AD for ; Wed, 8 Aug 2018 15:57:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC6D62B1C5; Wed, 8 Aug 2018 15:57:26 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 55FE12B1AD for ; Wed, 8 Aug 2018 15:57:26 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=BpDRBnuvOAdeCJptlzaAaTVqX8EHivljMghwxcPE4Ms=; b=mxkgt9Qzsqt0jIpKFTFALEvnPy BkpayxjQ4VBNf0ueYdWvcq5PryRBkrGatOXa9aARSoD89Hfg2va5Um9HxYosp30rzOHjz0silNCZx VJhe0loDkAUHZptMExo2mLWTN7IqFZBQLaKnqJ1G7I2vkzfWS2IxpDYc1SBLlfvrb1NgUgrNOwL1O qAEBvDw8KU6fNGmUaEcRXcPZkH1ehFwnFTor0R0a0aG0KXJYZiUsGrl05xMa+9An/nty/cdGs7Jxn NxLafIIPKAPzrkJ0XD1BAfBx3ZDKzszP2QoFktIJkcaj6YAZshwcsFfSoVuzRh2NHEwqay0nkdRdH dUAAv78A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQpu-0007K8-N6; Wed, 08 Aug 2018 15:57:22 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQn1-0000yY-6g for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 15:54:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=fI+k8Vv3yG+m9/MHc2+cp7aa8pgPxuuoC1DpPepTxjM=; b=mexn8JFcw8qj3eW++PWcTR/Nz EETEmFBF2cY1trm+HA5b9IBRAOA4FFG4Z7zGxGr4dEMLyFii/pvN1TjQMQBOgtawI8Lj1ggAhaop6 UhYznEg6jIEyVs51pe8D9k23im3sMyFWsancvo3LclbLGk5Ll86rxw7lKhr6MKOKe2LVmwv3RSQgX FJHwEFdWl894EmR8rV1aFmmSaftgx3b/wRJy5I34sCzY8kI+MR9T0SteSlsrY1YqWDzzxRKEQuS3k qXq2v1eVJID8lAiv9YLeMFIagc41weCfGcvqum7NdqP7RG/gW6FvPngToAvBAjN525ZcAqqD1TiEY 1Ig6umCGQ==; Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTE-0001SF-GX for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:33:57 +0000 Received: by mail-wm0-x241.google.com with SMTP id n11-v6so3208793wmc.2 for ; Wed, 08 Aug 2018 08:33: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=fI+k8Vv3yG+m9/MHc2+cp7aa8pgPxuuoC1DpPepTxjM=; b=wrfabtZwU/d/lWONYUx0VOtQu0zRo8SDOMXGZaxGqjyRN8QWvxmyd6SbS3aq7lswg/ S9hPghko6V8V3f8jt6p4L6xkFi8AoJxRmBJHLLzrQXQrxjDTw1+Ysm+1wzTx4ELwjlNY t48/wtltq44OJVKx9fmN3gMtDLRvE5ElvSNAQDwAj2qnsvezlONIf1sZJQRSQh55hRj6 37cUooOzfaTwRD835fPQAugWzVe5139PKPLxSXfqbNmUweCECgZqFePK8OKH6uihv3L1 SIBBPnWxdwQNOoAVph2Ir7hv628hKFY6pj7rXguqwP0/yTZ0/CSTFZJVDKlLtsxSOtsj gvNA== 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=fI+k8Vv3yG+m9/MHc2+cp7aa8pgPxuuoC1DpPepTxjM=; b=j0MxScEefOLVLySwqJbAxiXMnw02t37KQ2lM4pcmYkBTuxBgU9JD76qygKspRvh8Ii ru8ehEvmdNF/SeJBf+VaoxdVUFM7oNAECiofiVi+R6HOQjaE7YmdDM2nV/jxj9L8JXSp mIJAvufKz57wwFKe6x9VQZjDFtRS5EfAe+nk5Caq0xl59ux0aLHiRx7RiUXNH51qTJes bh4rrAYxoJOLDUTUCwR6bjghutehsa1BH4VIFfOvqzw9T3X0wTbB2UvVrsnbGyiywJqs AJfLgS/Jt0+wX8AHpDPlmF8rBbdIqUKqnEEfrdIPHS4MNc5RC2sp7kSe958/S0cFaD9w HgYQ== X-Gm-Message-State: AOUpUlFOmYnPg9GAq5MKjtSw/hJuFx2kRd7f3VHbEYB7jjSpWaH8Lq7Y 24yTXsA65xefF2deHO7PehKQfg== X-Google-Smtp-Source: AA+uWPwazS5HeG9UE/Vvb9p8w/R3WbqH+H5qN34D7bAmSZJ2/5xRLNYNJdPw+q4bssU/6gkiZ1Kb2Q== X-Received: by 2002:a1c:55c2:: with SMTP id j185-v6mr2240121wmb.104.1533742424512; Wed, 08 Aug 2018 08:33:44 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:43 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 09/28] ARM: davinci: dm646x-evm: use nvmem lookup for mac address Date: Wed, 8 Aug 2018 17:31:31 +0200 Message-Id: <20180808153150.23444-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_113356_701107_9037BF86 X-CRM114-Status: GOOD ( 17.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support nvmem lookups for machine code. Add a lookup for mac-address. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-dm646x-evm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c index 584064fdabf5..5a9de47bc8a2 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -310,6 +311,15 @@ static struct pcf857x_platform_data pcf_data = { * - ... newer boards may have more */ +static struct nvmem_cell_lookup dm646x_evm_mac_address_cell = { + .info = { + .name = "mac-address", + .offset = 0x7f00, + .bytes = ETH_ALEN, + }, + .nvmem_name = "1-00500", +}; + static struct at24_platform_data eeprom_info = { .byte_len = (256*1024) / 8, .page_size = 64, @@ -802,6 +812,8 @@ static __init void evm_init(void) davinci_init_ide(); soc_info->emac_pdata->phy_id = DM646X_EVM_PHY_ID; + + nvmem_add_lookup_table(&dm646x_evm_mac_address_cell, 1); } MACHINE_START(DAVINCI_DM6467_EVM, "DaVinci DM646x EVM") From patchwork Wed Aug 8 15:31:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560325 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 A2D75139A for ; Wed, 8 Aug 2018 15:57:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EC2A2B1AD for ; Wed, 8 Aug 2018 15:57:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82DEA2B1C5; Wed, 8 Aug 2018 15:57:40 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 31FB42B1AD for ; Wed, 8 Aug 2018 15:57:40 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=L48882hmhIUbtx4542rWhX5Mo8a1zLeBqkWXg2QxbBM=; b=QltUTODPDbA19YuMEM5u5dBQ7x /Nka//MgLI5muy1lwJ02XC4vm8GdotulHfnBosiaLcfbzrbEk4C/T+gaLAk7h+syZ+EoQRUJK4Epk hO75ePa+OtgycrFzoNQgqOTrKLlNwCq2l+0FHgqd1ANbFZ9WWLvhpFv5hPuMWVwRjqikqhnW+lHaB Yc9D40zHQOkg2cWE4pUUMzw2HTUfV1UTqd/uHsLgojIvgptPm+rq2z8i48eLatz85M4ApSxYnsnl1 EC+dcm3jFXi44P7iXlLJxz2PYhCc3ScSJXBZ0cDQBet2eKmXdp18K61rUC+2SJV7fRJG92HgzWAD0 FqD1uO9g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQq5-0007YH-TU; Wed, 08 Aug 2018 15:57:34 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQn2-0000yY-Q4 for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 15:54:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=UaMCnpUR2BVBntYfvCxdZ/Bq79Ac4uMXuz598bqXs7A=; b=CuxIiiVW6zzusz+wWQpQAo7hp 2/m7vSSxmUjD9ym/8ybeydMrjpQImJB3T600sVuGVWnTOfYi35ECQHwjuhWHDC0WoYR5zIwZ9toPQ 4p5gmRYPW/BURBP82oCTwkQz1eMwbstS9TSaO76tI6evS+NE7tQzXFCrS2r5R3dZ2OY+O0GbADUN9 hTTFasbPF9Nc6R7UIgjeofclHVzpso6HJmV19wWhcs1eXRw9kpiXbyJJF8Z9EZQNShn1vrTJWfmSW BtSs1u2l91aHuOAy6Ae1sGv2kPzVYO1giU8IZSvninfoaknVM0f6lSMrupF+qKBt4BZkVKmvme41C 7DtHRQXhQ==; Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTE-0001SM-Ga for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:33:57 +0000 Received: by mail-wm0-x241.google.com with SMTP id r24-v6so957029wmh.0 for ; Wed, 08 Aug 2018 08:33:48 -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=UaMCnpUR2BVBntYfvCxdZ/Bq79Ac4uMXuz598bqXs7A=; b=sX3LdCS9jckTwsFoDRZe2ahO/owvgdq6cCChJEa3aJ/Et9TzlvzCyrDD7WxkyMlRZ0 QlmREy2BfoqdyqUZeHX1IIi6UXlScQkArZuw+rSqneDpZTM+uXC/9EMA4XdNsOrEH63/ DEjqcfmns62vUHPQGv9DpafvUOgLrUIi5CkNVwgafZCRFEf6D2zT+L6fwHuCSvVP8w+z Xyaia7fBe/EKYz+IMDXA3ALQ77NU56rAD+ydVE6EJaQHy3boTJgDNrjbL8f46DozzXZl Q8BB0z7JQY9DwwAodb65jGQ0c2/htq8XqjQMofOnm+dUSg6yk7e1akmeQi+Z/eb8A9WN uNUg== 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=UaMCnpUR2BVBntYfvCxdZ/Bq79Ac4uMXuz598bqXs7A=; b=MX+IlvTMgdPXx/CjEpIKcXWyDvKLMysTs897o4s9T6brpUNDqsSsEKF6+3sofzDM1A XU/S73rPKywdw93m/m5j8ut/yHAv3al3jyzI0uakHZOTmshFTDNCLi2GM5QcOEfxfcQZ 1kgTORvoCtziqOx8ZyaMSalc9Kxy8ntWbf2heU8wQqb6kW1n70Jnnw1WSZn1UawbMfCt MzyWFJpNRFIoJ0d+4ykeX8S0WjIhdMdnSzuqyL1HgYUfCulzBTewBQ6ITfXf4frxjQfQ /gUlGKvGxc/jgbPznuxO71hseZdVK4K4+OyvrcjeswAOJ1LsUzuG881pDCIlZ/nOQOQk UT6A== X-Gm-Message-State: AOUpUlGHCj3Yu0dcTAnul6WBFEhtsGhQ+bvZAcDtk5LlIunHR8J+TNH2 oGqO0XXKOgzZrIpthOjIupPjzw== X-Google-Smtp-Source: AA+uWPzQ9VeXMiG4JZ0oeQCVGPA/T8xSjsOuZm7kvb61zqx6AKdW4uGEdhiMynnKhDRO7KHKjTwLKg== X-Received: by 2002:a1c:c241:: with SMTP id s62-v6mr2326164wmf.146.1533742426569; Wed, 08 Aug 2018 08:33:46 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:45 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 10/28] ARM: davinci: da830-evm: use nvmem lookup for mac address Date: Wed, 8 Aug 2018 17:31:32 +0200 Message-Id: <20180808153150.23444-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_113356_699535_8A0B8753 X-CRM114-Status: GOOD ( 17.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support nvmem lookups for machine code. Add a lookup for mac-address. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-da830-evm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index 14a6fc061744..4a2fe8142a2f 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -409,6 +410,15 @@ static inline void da830_evm_init_lcdc(int mux_mode) static inline void da830_evm_init_lcdc(int mux_mode) { } #endif +static struct nvmem_cell_lookup da830_evm_mac_address_cell = { + .info = { + .name = "mac-address", + .offset = 0x7f00, + .bytes = ETH_ALEN, + }, + .nvmem_name = "1-00500", +}; + static struct at24_platform_data da830_evm_i2c_eeprom_info = { .byte_len = SZ_256K / 8, .page_size = 64, @@ -618,6 +628,8 @@ static __init void da830_evm_init(void) pr_warn("%s: spi 0 registration failed: %d\n", __func__, ret); regulator_has_full_constraints(); + + nvmem_add_lookup_table(&da830_evm_mac_address_cell, 1); } #ifdef CONFIG_SERIAL_8250_CONSOLE From patchwork Wed Aug 8 15:31:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560351 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 B673615A6 for ; Wed, 8 Aug 2018 16:25:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A19C02B2A3 for ; Wed, 8 Aug 2018 16:25:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 915D72B2A6; Wed, 8 Aug 2018 16:25: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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 24BAD2B2A3 for ; Wed, 8 Aug 2018 16:25:55 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=s0JXlddBqrp6UgDD/kjttwAxMzFBEpYD1ELnqY+ywvI=; b=VvmuOdDSTqW8JpjWSU/0qHwDtd N0S+wSVAncuSzz+vYUkdL8L0ndlk2KwbpDfHhA4Vziqwam4q7xfDzkSALoz1u3kKkcW6XqYNV8n6s kugb7xIwjQgQzoki97QVmAAsnkngRQ+3Z+UNEtz+SHzTLq2hSGQ0FsMgnt275b1rosnpEExLJmY+v nRkHitaMCS8fZFalJHKHSe3fbrdhzqAuQFEm0uBiZieEnYj5zIlwevTLUFZLi0XQ52lD/XiIMsO8g wBD0lw+DDFYosmByz1RnBXc4htGoXIAHIyD5kyFNUQ8HP91ljulIHYr7/El7iD2QIs8zaUhIhmH+l OMAwFgZA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnRHR-0001Zh-8f; Wed, 08 Aug 2018 16:25:49 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnR5C-0005fR-Dw for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 16:13:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5gXeisQUg9CT/e0TVeNKIqgvnnNtiYjxB6KBG0kRtOg=; b=RH/OS04t0p0gnRSM8tDUvHOWj bfQjfdwO2fZqfrmRwefSmCZOMbNpxJ+7Mln3V0pJPes9N965Mf+Zee6PJpLcnff6Ly09PPHoqBgDs aQMEAL6KqUqSjmnO88V87uhszPo4JBHdjnwEhPQDkqJmMzbbj371TsyTHdFYVq24ndU6Jlh9VJi4Q L46VU+TnhnVdNBcyYmqh89ElSaHCcf9NYVpK45RN3uA5CxO4vytsI8xODvu0YT4PHSFY4B0SLgPUA LYANnj1WmlFzXqPQ9atIMakfpn62MuIehy2bsoYCkSOwyB4i4S3w7y3h/D9dM5rMVbeyi5/2kmA8C MclGvC9KQ==; Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTF-0002tl-27 for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:04 +0000 Received: by mail-wm0-x244.google.com with SMTP id l2-v6so958183wme.1 for ; Wed, 08 Aug 2018 08:33:49 -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=5gXeisQUg9CT/e0TVeNKIqgvnnNtiYjxB6KBG0kRtOg=; b=QkqXrrSRt28avbRFzep8u9o6/pMPtCVFMth9MyQLeywkgPV8oV+NTVwVkzumsndxpi +VAvWKHMtM7vT4ZLp4l8fD4uW2WE6UMRN959AV0jA9BfDTAdocYUEmP5NIb+CVd3xCk7 2wjDVsIsY6gnK5vhsesri/PIO7HQbFuIWSqA2pFEDEgPJG5zVQptJYr8gxWvl6IUZGi8 3lpfQf6lmDMldihqejMTRbykRmG586A70Ol2XxJzuOwp02fwNCDjn8NXJH5hNMnXvqvJ gDWabQGU2oLKuOKuBhWjGw7ihf4UhS1zrOaty2BXAEXbVDOUnB64vNb61+mwLutOjIIP n2lA== 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=5gXeisQUg9CT/e0TVeNKIqgvnnNtiYjxB6KBG0kRtOg=; b=imXCeAYWX7coe0ejR+iYTQW7nicn6YmC4cLXe7u30D7jDI20mHvVbLbh0PW7pUKW1a ttu1TRkXqVyjvVXBv968SrpYq11uAosHD9Cf4qsdANs/eF6XaieqTeD/cyCWfQU67iFQ xBikEqdZqV6T6t3XbbrDGQEzF+JT0b/pFJRVz0TPXSuQGfdiR38X3bFKLwYbMvQz4Twz TTeMbwUb8I4eYPdflQS+JYTlAd7Vz346i+/j51WctNzHTk6mNOFjkekD9Txt/oFs7swO ghUWDiOiuKRWmbN+nN8T86n+7eSmoQE62TrmzDfCmJIgWIkZlOJyWPEcz5raebv3m4d5 J6fw== X-Gm-Message-State: AOUpUlFVuHyXqFn2oRWMZ0y2oYK+bZkg/HA+bbDz9aoXoxFdLyoK1rSg E2onhfXo3g5I9dGEpdOt9i31Bg== X-Google-Smtp-Source: AA+uWPyvPIzatEonKFWgeZF7rzsjDFKGwKfCcqafIbk0zTDsLtnA7s8uZUy6D5jEhIepXbTZODtf5Q== X-Received: by 2002:a7b:c013:: with SMTP id c19-v6mr1901158wmb.53.1533742428438; Wed, 08 Aug 2018 08:33:48 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:47 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 11/28] ARM: davinci: mityomapl138: add nvmem cells lookup entries Date: Wed, 8 Aug 2018 17:31:33 +0200 Message-Id: <20180808153150.23444-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_163357_229863_2C9B8684 X-CRM114-Status: GOOD ( 18.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support nvmem lookups for machine code. Add a lookup for mac-address. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-mityomapl138.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c index 37b3e48a21d1..b5be51c0451e 100644 --- a/arch/arm/mach-davinci/board-mityomapl138.c +++ b/arch/arm/mach-davinci/board-mityomapl138.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -160,6 +161,25 @@ static void read_factory_config(struct nvmem_device *nvmem, void *context) mityomapl138_cpufreq_init(partnum); } +static struct nvmem_cell_lookup mityomapl138_nvmem_cells[] = { + { + .info = { + .name = "factory-config", + .offset = 0x0, + .bytes = sizeof(struct factory_config), + }, + .nvmem_name = "1-00500", + }, + { + .info = { + .name = "mac-address", + .offset = 0x64, + .bytes = ETH_ALEN, + }, + .nvmem_name = "1-00500", + } +}; + static struct at24_platform_data mityomapl138_fd_chip = { .byte_len = 256, .page_size = 8, @@ -534,6 +554,8 @@ static void __init mityomapl138_init(void) if (ret) pr_warn("spi 1 registration failed: %d\n", ret); + nvmem_add_lookup_table(mityomapl138_nvmem_cells, + ARRAY_SIZE(mityomapl138_nvmem_cells)); mityomapl138_config_emac(); ret = da8xx_register_rtc(); From patchwork Wed Aug 8 15:31:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560293 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 8300B14E5 for ; Wed, 8 Aug 2018 15:55:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CDB32B12A for ; Wed, 8 Aug 2018 15:55:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D0D32B1AB; Wed, 8 Aug 2018 15:55:49 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E5BDD2B12A for ; Wed, 8 Aug 2018 15:55:48 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=puzczipEQBsOswmpi0ILu/yjO4wI1TjzkCH2HoWH4SQ=; b=m32cmvAJVc1NakhwHIzBS8g+xI 4xX9OGprY7/VPiIMBXJX1RuuisZzIrEdPJCAirxiASNEXn155Zq1NkAM1akDgbtsPDS+TFCYdUPHT /67DwXOFno1iIVAa8hnRK0w1FoVY/XYg6RlDMjFuQ+L9kLSou0MNUNLFIFC3FP4lwz8JywaTkZsq6 0Yku2ZLbcVwJxU0uqSwHnuAo55x2UXXap6Cp0XxBc2kqJbFwb/LJSV24olgd0/cEAFQHGxH0H5goQ Y8RsbQij17NY4p2SsE/5+NA1WvR5qgBymOFGuxC0uCUu4uWxX7AAvfIuqaXeQMaOrvCbXxmPWBW18 HqQ0XmGA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQoN-0004Zf-Fu; Wed, 08 Aug 2018 15:55:47 +0000 Received: from mail-wm0-f67.google.com ([74.125.82.67]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTK-0004R0-Fw for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:24 +0000 Received: by mail-wm0-f67.google.com with SMTP id c14-v6so3184419wmb.4 for ; Wed, 08 Aug 2018 08:33:52 -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=sGOzUdYoefHsqeEVpETOZKTrsiIrdDWkhYzQ4MVNoLM=; b=cggQzO/93LG4Ij5L8Kjw5OtZD4R+Xn3/ud7uGfm7stR4t8PLMuetQby1uNWl5BKucN QMOLDiJ4WpC+U2Oc3FdrskC6mzJf1HtRqbVHEj5/5PVTWEXYXj3Yvk7NNnePH2DEtMuE +2wpkQL3LNoeXXs4tJD7yhDN2tow7d8UMWQpexy4kW4It+dSr7gKyHDkdNOcRhGoLw4W IDdkLta2tMmDtN3uV+mB8/W7LTT8kaQxqvPlD7p3WIQQFOTAs3pbF+mbSOmF/wXmexrL ZdTgaH9cgz182EEdjbpP+Pg95mtV1DZ6B0SXyt1fTm9cTCgR6o4Ezihybw0cR9NSkEf/ 143w== 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=sGOzUdYoefHsqeEVpETOZKTrsiIrdDWkhYzQ4MVNoLM=; b=DoLCKeKQr1wWTD86FtspIobvua3qsqk0v7gqIyUD4VVI4UqNfN8d5RTjA/yPPhNlQG f2caiQrCSZRjxtIWN9PqpUjylIbWjzKNchcbDSkvOltGEQkCCLBT1or/RpHalfr9Q6cF 9Qlu45Zfumf1OuvBKoYMU0t8DcuK8cCWd5ndr0jesSP8ZfcAQF91XxBYCQVH1CAKo3F1 fPpN3MhxuYrOuacUdf4wTRNHC5pHixuEi9qermDozPMzUwjexQxY9ekfN9S93Fr3u15K BAuAFYTf4dqOmQKV3/qqyDoP3SkI7q0u6AwOLckQ8fohhdljZvcpfH6OsZaIfsSEpsga glNA== X-Gm-Message-State: AOUpUlHUzN0YivtRsHS2LH78qCk8yS5uHIAu+RzXrgkdM68CoSDrv2x6 5Ed9CyJE9THnOIgTnLzH2UmEvg== X-Google-Smtp-Source: AA+uWPyc0yqSUqvSbIZ9GQ0fQtkypRMmK/5NeEG1AMKT0dqCxEcMcDEiygbjIbPm14RgK076rWQoNg== X-Received: by 2002:a1c:ed1a:: with SMTP id l26-v6mr2298030wmh.61.1533742430519; Wed, 08 Aug 2018 08:33:50 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:49 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 12/28] ARM: davinci: da850-evm: use nvmem lookup for mac address Date: Wed, 8 Aug 2018 17:31:34 +0200 Message-Id: <20180808153150.23444-13-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_083402_844141_0BB20D2A X-CRM114-Status: GOOD ( 18.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support nvmem lookups for machine code. Add a lookup for mac-address. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-da850-evm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 6d5beb11bd96..5a634a04ec69 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -99,6 +100,19 @@ static struct mtd_partition da850evm_spiflash_part[] = { }, }; +static struct nvmem_cell_lookup da850evm_mac_address_cell = { + .info = { + .name = "mac-address", + .offset = 0x0, + .bytes = ETH_ALEN, + }, + /* + * The nvmem name differs from the partition name because of the + * internal works of the nvmem framework. + */ + .nvmem_name = "MAC-Address0", +}; + static struct flash_platform_data da850evm_spiflash_data = { .name = "m25p80", .parts = da850evm_spiflash_part, @@ -1447,6 +1461,8 @@ static __init void da850_evm_init(void) pr_warn("%s: spi info registration failed: %d\n", __func__, ret); + nvmem_add_lookup_table(&da850evm_mac_address_cell, 1); + ret = da8xx_register_spi_bus(1, ARRAY_SIZE(da850evm_spi_info)); if (ret) pr_warn("%s: SPI 1 registration failed: %d\n", __func__, ret); From patchwork Wed Aug 8 15:31:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560247 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 BB91015A6 for ; Wed, 8 Aug 2018 15:36:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A778929E6F for ; Wed, 8 Aug 2018 15:36:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 992792A9C3; Wed, 8 Aug 2018 15:36:58 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2AD0F29E6F for ; Wed, 8 Aug 2018 15:36:58 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=XC++8yxyME0DI2UlDQhnFGNU+iGN+n7k1mjvptPoD0U=; b=PSMcI709A4oLbhKbbKOj1i3LXW 6trbFChkcL9n9ka3z11qOZFf0VGwRoystaeTWu0iWQM64uucJ4sETs6PmJ5D2ABgMgsxzGr0DgX22 OtH+TRaj2AL+3/8OrV3SAjku2y4D3Bj/p4z3IR3uPJ9eFKBOt+I+S3PHBuFPY+PkyHPuk7n2rK4/o 9MBkiopWJsb3ha+PCAfwes9cjUzVOBo7pZPeCm9k9lNLYn2i1Nqua2FuD8Q7fL+/6CpP7cY/bifeZ oKc192eXDhBPnzElR2vLdJ9ScG5BYPhFyy1+sL5IAcuAx5gjfEw7iQC/wXzICypsrABQhBYmvsk7E ibSPfcXQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQW2-0000Ve-Dz; Wed, 08 Aug 2018 15:36:50 +0000 Received: from mail-wr1-f65.google.com ([209.85.221.65]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTM-0004Ts-CQ for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:24 +0000 Received: by mail-wr1-f65.google.com with SMTP id r16-v6so2383394wrt.11 for ; Wed, 08 Aug 2018 08:33:54 -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=Vbd/0hAQ6eCPDyxiTiuvrAkBoIff8s2ba/U1T9sJXTg=; b=PR+7YOqiZOzBTyjKf7M66m3klRA/U9weUzmP9+aCiWzkdO6ze1RDxPr1P76HiHU8ZL ttgPjdwmRvyHiyB21jsC+Zno32y3TWwxLRC5PXA/48g9E1tQqE3m+l/Gm4fei1FYrcia rwv6tI0ol6Z9lxrG22K89NNJiWUErGlR/roY7vDNmq1Iolz6D7Gz9tT4qLkKnVA8SNd8 9UdR+1wrSH3nYQolNcqRxmYQN5JhOUnhwnymWxXy0OHwMyBBWRU13Pgyc75YP4shcQsy HGucNRnRwzuodzwGzXmBnYV3HeDKuOIhS/aeF3JXm5r+VkRSYxTGKzQMtktI87wL/9/n +uVg== 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=Vbd/0hAQ6eCPDyxiTiuvrAkBoIff8s2ba/U1T9sJXTg=; b=aQxwukvE7MlRLroCdASrY7ZCU1pHebpoLGTE9DqgBx04SqEhyY8PE30ZY/uwFXlLRZ Ndu5ow8qRe9CNs1qoP4VMW8GJqUNlPqnp28lxNXZCb0ielOe3TxYK0eLOhSS0WBjOWFk ly5drtNC99NStxslujpKRqAyoJCT3F+l+4INNnO7cZmELN5DEYNHksUB6z5fRe6tpk54 Je1NoBi5hEZPD4SiHfHDGmkPKbCbv5AHqU1twNFrshZMjHEMKSPfu8isRaVne9L91q4k fhOwcxPqrFgkXs5d5TrX1CsqUaJa8vJF4qs1/TbGsjFMvW4wYUwn44spCpwOqU2Rg0lz Ml+w== X-Gm-Message-State: AOUpUlGeUdiAa1n3CUPFGUharwUSZqq9nffrXmKfkNBid4mL2TQ+Qk6w j5vG3Fn+xitJQP02jS2HHMywsg== X-Google-Smtp-Source: AA+uWPxNagFpRt5CCQmRfILD0QzSb04bio2p6FouUI1jwHT1NysHnR44GeKKDUdI2d0f5xqDIab+lg== X-Received: by 2002:a5d:4147:: with SMTP id c7-v6mr2335638wrq.61.1533742432406; Wed, 08 Aug 2018 08:33:52 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:51 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 13/28] ARM: davinci: da850-evm: remove unnecessary include Date: Wed, 8 Aug 2018 17:31:35 +0200 Message-Id: <20180808153150.23444-14-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_083405_073650_5CE80087 X-CRM114-Status: GOOD ( 16.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski The include file for at24_platform_data is not needed in this file. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-da850-evm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 5a634a04ec69..521a26b5c20d 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include From patchwork Wed Aug 8 15:31:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560305 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 C0635174A for ; Wed, 8 Aug 2018 15:56:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABA832B1AD for ; Wed, 8 Aug 2018 15:56:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D7E22B1B6; Wed, 8 Aug 2018 15:56:19 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 520D02B1AD for ; Wed, 8 Aug 2018 15:56:19 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=RH4m76nomD4zAOaZXudgOhwJTa333ytZqNAxSf0UFJI=; b=KP5Wmp9QsGps6TvJC7l8Jo0acJ yjbGiq2Lefftu6GdLgs0m2RyMvcr7II8dKg9iusadp8QhbxWUyFX3hlTlr9RbvvEvsEhBNUU+Sil4 BdtHYx6OCpSk87zVj9BNxQQic8hxjCTodhwoJEQNchwrBRej6L9mpiNT8jdYYC5QHTi7YDwihazYt IMQkCJVr5pwOxfp2jwhhupxGKCwZcblLEO5ACftL19dneiGfQT+3shGIXOHLUvRgUb1SPAb0cMrAU 0k7EHj1ohnuEWrL2T8g6wiOk/O+KJ5S2goHHnbt85sUsg6a4jK2S3/wCOMflpfHwBDJ2vjRKenGN3 p6+o07BA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQop-0005Lm-81; Wed, 08 Aug 2018 15:56:15 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQmm-0000yY-27 for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 15:54:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GhxBsIfK86giZ9cjSjQgHpsWxFiMvzhSUErcIymDujg=; b=2gL2U4kS5E6l6aj55cq8/2Cfd g40plCmQ/F+MISikdtwbJTxr5P5bxt06NZjFwSw8+iePOV8FZvHGDu0IIMVEk7DAYklgXiK6zdxbP 0rlImTGT5TtqfGEOFCVXp5PzZmSnzBiV5VzV83olw/7/53waDRSoUU+3/mHO+auIY3SldeNUvPe18 x6zDYwMmyJMVVARRLnFiPIIrTpsp3yFqS/GcyoQ9jpl4ZTTLfJP2upgjX4rmh+fkiieN+1dfp+D0z CHOs3Nn0BPbQ+U16E+td+NZAi9puGSzB7Q7dGCCH7KEPBz/+ywq3emr452tGMtQCRwSH4PHaoq1sl BInEYC2qw==; Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTO-0001TO-8Z for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:11 +0000 Received: by mail-wr1-x441.google.com with SMTP id u12-v6so2412595wrr.4 for ; Wed, 08 Aug 2018 08:33:56 -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=GhxBsIfK86giZ9cjSjQgHpsWxFiMvzhSUErcIymDujg=; b=ZqPg9nBeYD7Jj4LbD/qxHP8mdIaP9ehKNQ4AiXOn4oOR+a5ZAukUE+JSxk5Awm7see 4zC84eGwAAGMLSh2/XuOWxIK/te5rwrHxpT/bW0eu4kwE+HgrDCmjcnYhBbK1Qg0g0iK olWgZ0mraa0LMdGszgAYyHjeeetJwyAyZbU1zQSSiUKih9toBsrwLiDr1y6F05nH50pt xTGMmDnYdUzQv6qqFh2GzahD1ZQ82M0164l1drphkhkbh33+AxbLUcfoQCOitNqO3oOr Us8whYMDibcOLJ0MkFa3pnVGRkdt1rdTb+bEsP68ccMWss+wLl39D21hrtsygCAddcBi HsLw== 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=GhxBsIfK86giZ9cjSjQgHpsWxFiMvzhSUErcIymDujg=; b=HPff099AnKO0yS8ZHHPNWkkoX68GeMklXXWn6ub2CSoLu3kHP/RloBV0YWyDqndUfs OJ2/PwcHbNFqTe5ErobQqEbMPWMEnV+fR/HE4vzqbbMJ+GRi104E/M0WNhgPnbLQaSVn +V/oLwYgcvGpkdl/ShvhXxILrDFA06DHd3MahYoe5/54hWzHPR3bB5TMIXJZIr/lIwxq Bph2HQOaCewxvvFudqRgtkr0nX/wsH6AHzWjdAN12wibwr7UHN8CImBnXS5sC3YTamMl 8CZM1ERcjUfchS6DQzYRgmZa8xVhFv0bUt47Ee98EtNeRzE71Do9h4s9T/Xhz+PdFzI4 6bTg== X-Gm-Message-State: AOUpUlGxVRGyLjGh+wgI3FDIDqv118+bcmZ5EutqFZl5jzEw4rOCX+eb Y9Z5GWxPvygWYGQG6YDl4VKsGg== X-Google-Smtp-Source: AA+uWPytVmDjddx7tRYYs/vrCyUbG7+F7GSlQDH5jICevieM/gzTCUd/yRKlDppGuaWlecpoKEfSTg== X-Received: by 2002:adf:fcc3:: with SMTP id f3-v6mr2213453wrs.216.1533742434493; Wed, 08 Aug 2018 08:33:54 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:53 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 14/28] net: split eth_platform_get_mac_address() into subroutines Date: Wed, 8 Aug 2018 17:31:36 +0200 Message-Id: <20180808153150.23444-15-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_113406_455244_E2BE9608 X-CRM114-Status: GOOD ( 17.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want do add more sources from which to read the MAC address. In order to avoid bloating this function too much, start by splitting it into subroutines, each of which takes care of reading the MAC from one source. Signed-off-by: Bartosz Golaszewski --- net/ethernet/eth.c | 48 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index ee28440f57c5..cf54cdf042b7 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -525,26 +525,52 @@ unsigned char * __weak arch_get_platform_mac_address(void) return NULL; } -int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr) +static int mac_address_from_of(struct device *dev, u8 *mac_addr) { const unsigned char *addr; - struct device_node *dp; + struct device_node *np; - if (dev_is_pci(dev)) - dp = pci_device_to_OF_node(to_pci_dev(dev)); - else - dp = dev->of_node; + np = dev_is_pci(dev) ? pci_device_to_OF_node(to_pci_dev(dev)) + : dev->of_node; - addr = NULL; - if (dp) - addr = of_get_mac_address(dp); - if (!addr) - addr = arch_get_platform_mac_address(); + if (!np) + return -ENODEV; + addr = of_get_mac_address(np); if (!addr) return -ENODEV; + if (!addr || !is_valid_ether_addr(addr)) + return -ENODEV; + + ether_addr_copy(mac_addr, addr); + return 0; +} + +static int mac_address_from_arch(u8 *mac_addr) +{ + const unsigned char *addr; + + addr = arch_get_platform_mac_address(); + if (!addr || !is_valid_ether_addr(addr)) + return -ENODEV; + ether_addr_copy(mac_addr, addr); return 0; } + +int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr) +{ + int rv; + + rv = mac_address_from_of(dev, mac_addr); + if (!rv) + return 0; + + rv = mac_address_from_arch(mac_addr); + if (!rv) + return 0; + + return -ENODEV; +} EXPORT_SYMBOL(eth_platform_get_mac_address); From patchwork Wed Aug 8 15:31:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560291 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 4B82F15A6 for ; Wed, 8 Aug 2018 15:55:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36EDE2B12A for ; Wed, 8 Aug 2018 15:55:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29D7A2B1AB; Wed, 8 Aug 2018 15:55:36 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CDC722B12A for ; Wed, 8 Aug 2018 15:55:35 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=ykyTo+wYZOB1008HvP891Bha3aMIeLhdfSMBFMyI/R8=; b=JPAQ4BI7hsPjwtatjldqNpGZiL iswxPPQgRKXzwwo+/S7JU/VlgKq0OctLpBZFPJC5uP1WBDocg9h6vrnA70vj746vYXFCQhgpQLnWU zfM30OdvdHzTRzyEEhZhd3dGFaZGvBR1zfFO2Q4FhWT+TlYekRNlK2Soockj2aNUsgX97bxWjdQ6u BBrJGB9egZmSYWvGvIZsBuvdU+58wVQIyEyBPXEyJ97Olb8qVYg3pNPTAK3DVIimQD2wAe+iS/s7a ZChaC9WDbvd0m8geCDKxpvMM9dCvf1V5PFwFTPYIS8Ssip7y62QNmmuiYqFeSSnrRnqvqwim/3+25 Pu96ps4w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQo8-00047v-0L; Wed, 08 Aug 2018 15:55:32 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQmh-0000yY-Df for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 15:54:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=0gvZONlvYfavZIv9YJMRdLBNbGF8vyYhSH/TZ/EBwZA=; b=YvL5NLwsnZpVHYeXMCdzrA9fL DnRTLF/L3vJ3Qcsil/FaLDTLgB0Evx6yIuuZpdGVsjlmLmbhppKejHT2TY+ded7UkrvNqJF9/Sl6v l404Aie9hOOJVTBaIb98QrKS3Wv64+cssos4/xkwe4hRDwRHoAv0pChOh0ZqIzMF+VsfaNM2mOA7C mtL9gRAsKPlX1pD/wMcMk+KxClwK+I1XIe/IbhZY22sXshFydh7d9ABHCRrK54wsKGznw4j8eRvoD Dx+ZpSymOo77/L8OrebmDHseqNVk9KGc2f4C09zCWs99j0q+5OnTvzudlCgJBobMiTxHcez1fsZfX 7AYFlHgRw==; Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTO-0001UB-Cr for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:13 +0000 Received: by mail-wr1-x443.google.com with SMTP id c13-v6so2426252wrt.1 for ; Wed, 08 Aug 2018 08:33:57 -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=0gvZONlvYfavZIv9YJMRdLBNbGF8vyYhSH/TZ/EBwZA=; b=gEPEyL/JokYkdCKr49rlPlBQcmVPQq092r43UkxD367PT4KOvaSD7l4mHIrepfh+qk O3PCLryWHVpOtDaGaSIy6FSAIBFh2+OCX3SnIMDHW6BWtgtN0kAaUTAycsyEthK7bOHU Tj387dMBc2P2mOx9zoY88ky4aDSN6RlO1SaCXRqm0hvynIJ/XLzP2R8CvgJyp/nTkoBQ oBZUomwCAWMLQ3rjtkjmanRkF2c7JF6wIONQxrLUinjiatX8iT6FGETuLFGdmd0RW1GW rO7GskZbkXv6VepMIm8DPMc4tFNMt1t3ZZOmH95M29McJWd16P0G1AgBB8cJYK/u8MLk DeSw== 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=0gvZONlvYfavZIv9YJMRdLBNbGF8vyYhSH/TZ/EBwZA=; b=Lbyf59OPm20LR+LQKB2f/ciKkzMqiuWOuOVbbxMBwAyurFAAsxAr8K1bvxjkDsfsJ/ 4JU93Ytu4QO0ol8aGX7oCTPjLgBuDkby+jeVvKJwFtxiZv9ws1I5aZxh3zbQUcablWUA d+9M40l2XSxcJ9Xotu8K7mm28dXvqP7Y5cX1QuX3oFuzPaKorZHDbWOria6Ks0dSDhx1 K+jD9KfBVj9FOM2SrwR/GlbgtjxExlu7hURNT5EeXG3YqCsdOrc1CuYzttvVkskw4CIn In4FAYWU0LV2J3s6GLisfegXXo8lXC6gM0W0ESqfHINFwohdg5P68+NubtHUd6S7UOYD 0yeA== X-Gm-Message-State: AOUpUlF8f2eBOxNcMxwmREVzLrFM6rqsvl5rbp9xpTDgJxDBpOsuGFQf kqwsqkl0S63miiq42hYw35A+FQ== X-Google-Smtp-Source: AA+uWPym0hgYSkW6WpkgTKfzcASPGWLiGx8AZeYfr8F/H+4RHblTOS5BwXUPqWjcp49gdDNt7mMRsw== X-Received: by 2002:adf:f850:: with SMTP id d16-v6mr2110252wrq.172.1533742436383; Wed, 08 Aug 2018 08:33:56 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:55 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 15/28] net: add support for nvmem to eth_platform_get_mac_address() Date: Wed, 8 Aug 2018 17:31:37 +0200 Message-Id: <20180808153150.23444-16-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_113406_612282_77CE23DD X-CRM114-Status: GOOD ( 20.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Many non-DT platforms read the MAC address from EEPROM. Usually it's either done with callbacks defined in board files or from SoC-specific ethernet drivers. In order to generalize this, try to read the MAC from nvmem in eth_platform_get_mac_address() using a standard lookup name: "mac-address". Signed-off-by: Bartosz Golaszewski --- net/ethernet/eth.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index cf54cdf042b7..98bc280b8a62 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -559,6 +560,39 @@ static int mac_address_from_arch(u8 *mac_addr) return 0; } +static int mac_address_from_nvmem(struct device *dev, u8 *mac_addr) +{ + const unsigned char *addr; + struct nvmem_cell *cell; + size_t alen; + int rv = 0; + + cell = nvmem_cell_get(dev, "mac-address"); + if (IS_ERR(cell)) + return PTR_ERR(cell); + + addr = nvmem_cell_read(cell, &alen); + if (IS_ERR(addr)) { + rv = PTR_ERR(addr); + goto put_nvmem; + } + + if (alen != ETH_ALEN || !is_valid_ether_addr(addr)) { + rv = -ENODEV; + goto free_addr; + } + + ether_addr_copy(mac_addr, addr); + +free_addr: + kfree(addr); + +put_nvmem: + nvmem_cell_put(cell); + + return rv; +} + int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr) { int rv; @@ -571,6 +605,10 @@ int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr) if (!rv) return 0; + rv = mac_address_from_nvmem(dev, mac_addr); + if (!rv) + return 0; + return -ENODEV; } EXPORT_SYMBOL(eth_platform_get_mac_address); From patchwork Wed Aug 8 15:31:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560345 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 E79BA13B4 for ; Wed, 8 Aug 2018 16:14:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3EA128876 for ; Wed, 8 Aug 2018 16:14:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6D892B185; Wed, 8 Aug 2018 16:14:06 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7115B28876 for ; Wed, 8 Aug 2018 16:14:06 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=yPT43/R2ngUwf6MNcwcE9DygpQA9pKdjL783bjpY1Gg=; b=uA9xTqYfsa6Zv2IbvcD96l30vZ rO9z6YkzmUu0jJ94ltHDAy+Hu919V1zpmYTEefEwXDiHrGKpwLvLWtioTW967QGpTVBPuF6tRPX/j eq22XjSmXVnF0ZPck9c39ipk5FBo9LWuzjKOnrjfXmaK3rZKtHxnsvMtv8/TCKIfPVqhfZaI3KQMD 9Wrzmqyw3F6Zzl3paYlPjhuy+fnHJpwLeoJGBw/7v+NQ0R+gu9nV+BcQ2nwO4HpYnAIBOCGWAvb/b bxkK+KFuZKFaKEDjDGz6hSJWti6kz8qND3FtlQfYMcjJuDbslN0p3/wEWlwHidqr55W2nBYFoigy+ e00/r0hw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnR5z-0008B4-03; Wed, 08 Aug 2018 16:13:59 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnR5B-0005h1-Es for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 16:13:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=8UdSyH1lOqINYeO+r/ZsFoxAxuXuxmjPqoo8dlrZx/U=; b=TWLo2S+g5g8auX8vALzgVGb5i 3Ztvv8KQZmrKIRfa81Y5wrRRzGgpUYz3TDMGzV0ldiXeI/FBveecyitS4X+CGCifUFTa0Lg/qkXyK OflzK+62EiYlDS3DYl6AHfJgAzZOFgRXcHlBzCQB5YEVo/uEURzT4I6jfAJGcAi/Djk7vlQTNQbq1 PYcCozK5naFadicRhuTi9xh6j4F7X34qvXQNPwrltvLomywnw2ExL6wpcabqEWm0HrKEqnj3R4fD9 m4s0e2Gadl0OBq9FoZsQ/5WMy75XJ2dW9NZtOjH/B+7POOIqpwF4uhibyitC3cs32uQiqjU9cSeIq bEIDie3Nw==; Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTR-0002yC-I5 for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:12 +0000 Received: by mail-wr1-x444.google.com with SMTP id e7-v6so2390323wrs.9 for ; Wed, 08 Aug 2018 08:33:59 -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=8UdSyH1lOqINYeO+r/ZsFoxAxuXuxmjPqoo8dlrZx/U=; b=C2WWfRY4OGQFixB3NWDziO1RloZdC5VKqUI28ihiyz/MSJfGy4l7a6UducfkAOKq67 UsOMLJx1OlZBcl3LuNHmZS3D0ixwzGNI59pu+2Klhl/y/dRAwLh/lmEAsW6F/n8VU+zx dRb8PIoIT4Y+7jzPPLPUyK/FRX/aGyLrZ9PqhHJDzmbUWiIXrHzHw9O5OwDSzhtMlg7T VX330EfpGsSD+uQMIeb8DGKeW7hMsl+YnAkX8djOaYxJeLiFmCmO1LsJRS92JokpUIks 24mA6u1gyxXTFxGGCrJHSxVSK5yx2bmHxL6WAgy6wNn+zJ5YeyVL9omuAKd6J4O/XV1y vc2g== 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=8UdSyH1lOqINYeO+r/ZsFoxAxuXuxmjPqoo8dlrZx/U=; b=LxSs/J1NMuKM2V9H1N8kOr0r9W5LacolKxzT6hdWuJ7SpEDjouS3zZW2zZ++/qKHzA 9ryBQ/yYlC3J5Bq7FgmYzWhqAi/dTCWpddTnuOE3wbfeMmCUljxNW+KvfYbjXthAvaYe 8TPvemF15oMBQjTxANex7D58wEdRzoBVSXk7+kEpwq0lXu1oYXYEEZb1tdW9TdLQdpi/ tUXHgkZsVdWqrcPay8Zsa0o12sfR4fxTi40ri3U0dnuHCMufMefKLzGEe2pLCOajpIuR I1Q5XzkhLPosrodILdBQ81hByeGqPUcqWUiQeLA7BJWCF9JuGxUSbfF2YI3voU3Cw7g2 1GlQ== X-Gm-Message-State: AOUpUlH80h0tvwFFD88bnpB25Y0yc0vG21+G9bM9KrFre1LhIodT6PHN knwRbHclWwRZ3ecUbS9CHSOi0w== X-Google-Smtp-Source: AA+uWPzK9N3srWQOKZizp+e36Bb1tujnskBeB665f8ip+bKvJb9nbUnCV0l1aVqnV0EM3B2GUzqrng== X-Received: by 2002:adf:8362:: with SMTP id 89-v6mr2320257wrd.147.1533742438492; Wed, 08 Aug 2018 08:33:58 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:57 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 16/28] net: davinci_emac: use eth_platform_get_mac_address() Date: Wed, 8 Aug 2018 17:31:38 +0200 Message-Id: <20180808153150.23444-17-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_163409_603556_F4C3ACD0 X-CRM114-Status: GOOD ( 20.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support nvmem in eth_platform_get_mac_address() and all boards have the mac-address cells defined. Stop getting the MAC from pdata and use the dedicated helper. Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/ti/davinci_emac.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index f270beebb428..5d01bad4baa5 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c @@ -1700,7 +1700,6 @@ davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv) const struct of_device_id *match; const struct emac_platform_data *auxdata; struct emac_platform_data *pdata = NULL; - const u8 *mac_addr; if (!IS_ENABLED(CONFIG_OF) || !pdev->dev.of_node) return dev_get_platdata(&pdev->dev); @@ -1712,12 +1711,6 @@ davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv) np = pdev->dev.of_node; pdata->version = EMAC_VERSION_2; - if (!is_valid_ether_addr(pdata->mac_addr)) { - mac_addr = of_get_mac_address(np); - if (mac_addr) - ether_addr_copy(pdata->mac_addr, mac_addr); - } - of_property_read_u32(np, "ti,davinci-ctrl-reg-offset", &pdata->ctrl_reg_offset); @@ -1819,8 +1812,11 @@ static int davinci_emac_probe(struct platform_device *pdev) goto err_free_netdev; } + rc = eth_platform_get_mac_address(&pdev->dev, priv->mac_addr); + if (rc == -EPROBE_DEFER) + return -EPROBE_DEFER; /* We'll get the MAC address later. */ + /* MAC addr and PHY mask , RMII enable info from platform_data */ - memcpy(priv->mac_addr, pdata->mac_addr, ETH_ALEN); priv->phy_id = pdata->phy_id; priv->rmii_en = pdata->rmii_en; priv->version = pdata->version; From patchwork Wed Aug 8 15:31:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560275 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 6425C1057 for ; Wed, 8 Aug 2018 15:42:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F0EB2B140 for ; Wed, 8 Aug 2018 15:42:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C3A52B1B2; Wed, 8 Aug 2018 15:42:11 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EA34C2B1EC for ; Wed, 8 Aug 2018 15:42:10 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=bIVmwEqrFdlbNXsvSCu/mLqUtd5LC9AfUCvjGQMvgoA=; b=j4kKhIEiqR9U1RE8tkqNIJdX+n UOEcuELNegeXQFEb8VKl02O5AY6hMgUht6uLUevOAuqRE8GaMI7GvBK8G3wHDlliRu3QAjGxBFvSQ dnh/Mj65co9zjs0IZ5mqKRvP8yhSgYWG5ACLv+HGw7SGRsuyJm6vDunjmWdZOm9Kx8kWeCeRaMea/ ZsaMKb+cflYeS2YOkoxARqPef/wuRoTnNoE2lhfjVL1xBrx2A/MNdvTryEgXYVv1X+0BsO9XX6sH8 NPBV9HdeJHSYFULiWOhBV6+N4RZPCNlk+5XOA9OOtl+WEPYcrkiP/hVhOYT5tySmLDlMF9vtR52MR bWBN4RiQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQb8-00050W-NE; Wed, 08 Aug 2018 15:42:06 +0000 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQb4-0004z9-0U for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:42:04 +0000 Received: by mail-wm0-x235.google.com with SMTP id o18-v6so3279296wmc.0 for ; Wed, 08 Aug 2018 08:41:51 -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=r2kUHt8xOX/X/PnpUK/Av4k3yjo3y+RVMVX0DZ8RBXo=; b=ty1U12OIvJhucNMEEeu9RaGvSZYf2d++pZdLnz+E54lJZfZRkI2ckP5SFmcK9F6ilz o2plWvwtgtEuNQuoar/L1oF7v8fOHBhwL9dj00S6Pi5SgZ7bDTYDJCrwfGy17JSqzUVe jQP01x3EYvua4MYEa2McyyKS61z91Ziw9sXMt0EIcuC+h12NUy3Ybsa+HnoH9xAxFH90 2cki2+r1ZfQeg+9jNBG8yRdnqhaf4GxNs+HnxvNdzJgOFDijrG71b86nEdo2+BtTyPwT XIIAvNq0+e74emyAxBh28Pq6TMQddvYsSdtSMzNPK/KqAyCd7cCzIo3xB/mS4lyO1YB8 WdPg== 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=r2kUHt8xOX/X/PnpUK/Av4k3yjo3y+RVMVX0DZ8RBXo=; b=KasRSpZN0przTyJfUYU2BUXmEJv7NesMSRMKarlqsAitRT7bM+1Qeelfv3LNK4j9Sf Fp0uptwwg6+tNccCPBkh1XFg2XCUrZZHXEkTK8JrAsm5NslOJvN8GxgB4X4y7u4YjPVo XUEecphbGYhKXxvOUCf5XYb3AhIZl6Va7ngB3jMkealbknwTAxNP0Gy2+94ciVgAx+EO 7/L4S3/eEmrTVK7UEog0qdTQT6RI3CQ8Qmg89+yTK3lnBV4B7Sc788eAj+XXbOjDSrKe kv+PXYktXDByRrneajv91MFuT1bn4WAq7DWlGTu+J8D19pNO75mM9kNdLc06UTMIKqPP 2b2Q== X-Gm-Message-State: AOUpUlF5MZITIZ7wBDF8mK4MyV04PgLGVsx65tHdHQtKdQ/5VClsqX6J v+VU6in9eqcBpPHPNcWYhvhYag== X-Google-Smtp-Source: AA+uWPxSdaaYW8LFrDsW/DIwfEwdJOZ2Xwx/7wLr35WIIXQvILnlMCijOISdhyvS8RJ/8dWFqFn8Tw== X-Received: by 2002:a1c:5c93:: with SMTP id q141-v6mr2225441wmb.133.1533742440530; Wed, 08 Aug 2018 08:34:00 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:59 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 17/28] ARM: davinci: da850-evm: remove dead MTD code Date: Wed, 8 Aug 2018 17:31:39 +0200 Message-Id: <20180808153150.23444-18-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_084202_143197_3E15D5E7 X-CRM114-Status: GOOD ( 18.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We no longer need to register the MTD notifier to read the MAC address as it's now being done in the emac driver. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-da850-evm.c | 28 ------------------------- 1 file changed, 28 deletions(-) diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 521a26b5c20d..1df796b67b82 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -137,32 +137,6 @@ static struct spi_board_info da850evm_spi_info[] = { }, }; -#ifdef CONFIG_MTD -static void da850_evm_m25p80_notify_add(struct mtd_info *mtd) -{ - char *mac_addr = davinci_soc_info.emac_pdata->mac_addr; - size_t retlen; - - if (!strcmp(mtd->name, "MAC-Address")) { - mtd_read(mtd, 0, ETH_ALEN, &retlen, mac_addr); - if (retlen == ETH_ALEN) - pr_info("Read MAC addr from SPI Flash: %pM\n", - mac_addr); - } -} - -static struct mtd_notifier da850evm_spi_notifier = { - .add = da850_evm_m25p80_notify_add, -}; - -static void da850_evm_setup_mac_addr(void) -{ - register_mtd_user(&da850evm_spi_notifier); -} -#else -static void da850_evm_setup_mac_addr(void) { } -#endif - static struct mtd_partition da850_evm_norflash_partition[] = { { .name = "bootloaders + env", @@ -1470,8 +1444,6 @@ static __init void da850_evm_init(void) if (ret) pr_warn("%s: SATA registration failed: %d\n", __func__, ret); - da850_evm_setup_mac_addr(); - ret = da8xx_register_rproc(); if (ret) pr_warn("%s: dsp/rproc registration failed: %d\n", From patchwork Wed Aug 8 15:31:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560253 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 1509815A6 for ; Wed, 8 Aug 2018 15:37:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00FE929E6F for ; Wed, 8 Aug 2018 15:37:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8E302A9C3; Wed, 8 Aug 2018 15:37:08 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 97FDD29E6F for ; Wed, 8 Aug 2018 15:37:08 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=3awP4YuPiY3MZdIbN/zkP7kvK7tN0CyRaCBVUlu1HlE=; b=LyQafxMn3B9zNkReZ6Bb8BhEYq uuvuMfpm2jaszCRRCmI1zWhBGWdP5rVy52jTeUv6111hCrKYMpDl1F1A/afQGcgdMoeXOmzhig+3b Enf5stpYnsLRwHUi1ZzV22+Ets947hImEiLm8paCQAbURxDbgojZPSj+IgjIi8i9DTpwmSQzrCbFq N92wOpdwEmgEApb/83WiJQ0BirEotZiIHERG0JiRP5lVlXavjqnuvaY3kZRw6a42Kit9onTY8oLEk CR9C4Z+Zl5VtstXBn/MlgejT6jdKaICVXt5wgnEVm556USNVktn2ute1vCSwgWAP1wLQtfgSceCyw WMzrj8cw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQWE-0000rD-58; Wed, 08 Aug 2018 15:37:02 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTW-0004gX-7H for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:33 +0000 Received: by mail-wr1-x429.google.com with SMTP id h14-v6so2377982wrw.13 for ; Wed, 08 Aug 2018 08:34:03 -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=yskxlK8HP/dt20rNOu7PQtYqAortOf6F4fEk7Jpuvng=; b=0ZP8sK9XBdVSH9MobfykpL+Uw9YJ6GOBO4g0FLbw5rMI0ZV/ywOn8AqHzeM19JM6kK ECh4d/wDg7PPGqMse2IUl/Ix+OIGI6Df2mPVv9Rq1pu85PS2f073OpzQUEdfUN1pwYBs 8Bccw/IWu7MjcYyiO3vh2xF/kUXTvH+to2+/GgNlLsoxVIMFsFJ5wbmyyJMlgzSWeEfK 7Km5q9GB/uVVPS79AKQhNixxtH6p20awJFiB1NLu3/ySEVYqRK77kFIK83cjFQiBLY02 zG7QbASRPikl5keWpttElubb+pvL7DgBi3W2iTpENH09QiiHmz4UysXZxWQQp31/OyNJ /cmA== 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=yskxlK8HP/dt20rNOu7PQtYqAortOf6F4fEk7Jpuvng=; b=RUj1R2y6Pc40ixxjzjhmLLgnAfG+VsRkRJV/FlJwsUOJ57tAXGuICzy3ax5ydZvr/m teNaU/W49cxTlLjXo4nJnHR89RcmRhjYMj5JZWk+MVWp+sdf8/a3D+MN8uUF5kFshT6e p+1eNFuJN560/PAscme3+dDcMJCUQZ1zkd+wWAIBBJY9Tf0/VHwOSTAg2OuM2rIPnjhr 7atrX6gFlJMyKXQuA2gblh+ZjL/FHnhhjGEnuviVZXFQM/lW0Ax07sYL3zUfbCY4Nb6f VDNfr5HleWI5Ga0dNzPqviozpFbNTuzCsXP89pf7Z0puCth9A7NKuAmW8b3ctcTcmZE+ qcxg== X-Gm-Message-State: AOUpUlGGcBm5B+dx56xWJ+l1DadIK2SfMDG8S7COkujmxMJVLKmY4mM8 kKXob8fO3gmCcR+1ESpBpMaQ6g== X-Google-Smtp-Source: AA+uWPy+A/xZSF1dc+kNomdE4Pa7ILiTGx4uje/TUWZ5xo23lqnVmFjpWsZ1QNaLe29vABpAtFa72w== X-Received: by 2002:adf:e887:: with SMTP id d7-v6mr2321857wrm.43.1533742442418; Wed, 08 Aug 2018 08:34:02 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.34.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:34:01 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 18/28] ARM: davinci: mityomapl138: don't read the MAC address from machine code Date: Wed, 8 Aug 2018 17:31:40 +0200 Message-Id: <20180808153150.23444-19-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_083414_772686_E1DB4674 X-CRM114-Status: GOOD ( 17.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski This is now done by the emac driver using a registered nvmem cell. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-mityomapl138.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c index b5be51c0451e..5c0a0557a361 100644 --- a/arch/arm/mach-davinci/board-mityomapl138.c +++ b/arch/arm/mach-davinci/board-mityomapl138.c @@ -120,7 +120,6 @@ static void read_factory_config(struct nvmem_device *nvmem, void *context) { int ret; const char *partnum = NULL; - struct davinci_soc_info *soc_info = &davinci_soc_info; if (!IS_BUILTIN(CONFIG_NVMEM)) { pr_warn("Factory Config not available without CONFIG_NVMEM\n"); @@ -146,13 +145,6 @@ static void read_factory_config(struct nvmem_device *nvmem, void *context) goto bad_config; } - pr_info("Found MAC = %pM\n", factory_config.mac); - if (is_valid_ether_addr(factory_config.mac)) - memcpy(soc_info->emac_pdata->mac_addr, - factory_config.mac, ETH_ALEN); - else - pr_warn("Invalid MAC found in factory config block\n"); - partnum = factory_config.partnum; pr_info("Part Number = %s\n", partnum); From patchwork Wed Aug 8 15:31:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560341 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 48D4E13B4 for ; Wed, 8 Aug 2018 16:13:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 338D428876 for ; Wed, 8 Aug 2018 16:13:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 265632B185; Wed, 8 Aug 2018 16:13:51 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BB84528876 for ; Wed, 8 Aug 2018 16:13:50 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=z7t0Z/Pp1oOjiQW8nYFZgReDdMtVre0h2+flCwK8aCI=; b=LZiFsDBnTpi6Gk1gjtaHSbbKFM iRJlWdbH0hPxupTHafYjTljx/DC1RP9pH7pm8SrpCX4IbP81xHtS1ajSdFyrU/ZF+2EVGNH8CYfHF StwYg03Petg9pkCBDG8+VuXI2XXHrhuy51KDjNm46hrL43WW6ucier6C9xif++Zt38HAkZE+PVPOj XrY7HdRgWOzrr9G0afPEz/olAZFx38yACh4taLoEqXQtyNvC81yltkY4a/3O2Nzv+xcNaOCfpMYMJ 75UAQXAbaR+TaTJGDDHmX6ubx1KaWS8tCT0WwREOL72zQbZqHAlS3uSLEAOLWAaJo2pr1ubWsSc4m cqlAhFkg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnR5m-0007vD-N4; Wed, 08 Aug 2018 16:13:46 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnR5A-0005hZ-5W for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 16:13:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ThSFa5TY9AN8ejL/oFTQ9UvkNub5vaaRPx6NCkwo95U=; b=EbBDkKSfxzuWpsKm89wQWHznB O587C+CK5wpnKc6bCdw2pN67lq4dRiT28a6qMdMklJmwGzLUn9hLM+oH6+KhRunOnaSkjg8PqjZAj Wh5OMVo5zHMtpz6ISCsNO7S1SL8ZqKPn9BiW/YOzSPGFYp5P8MqL4H7tl3vlS2EVD/sNvAOdgrb7Y lw2rqq39m8GhlMorUeMoCO2cdy9f7EGcU8puJVkZQid2EahO2Yh61iftlySVfICQEpHdGUUztDWtO HKBUTCqQud5O+DrwxyP2ey9YsRV7g2ong5eEzKnUOj+OeLFtGqQ96FphBe9jlxzGFkXpBRG8a5DZ5 hHlqjRPpA==; Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTW-0002zF-RA for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:19 +0000 Received: by mail-wr1-x441.google.com with SMTP id g6-v6so2427247wrp.0 for ; Wed, 08 Aug 2018 08:34:05 -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=ThSFa5TY9AN8ejL/oFTQ9UvkNub5vaaRPx6NCkwo95U=; b=x9M5T0VoamSKJspU6RNUsUy6KIRSSDioe4ly7gBcHx+d13+QZGPnxFBNnsExUNjdXd c60SpxM2BsVd6eO7EQ8/Zr8sj4WBEeeQaSTufUH9eI4BUlNqPm3tqMDWN0PpqIfAcGg7 HHRLA8dJWdN43Ot1HNbbrnLMi9h6XsVkANFrEnCHcIh9KZWfAza5WbjWAfz14IRp+5tm +d2jb37Eycq2jzQ4Lmufs0/QGSElis7cX6K24P0XJKOx2tAjfiX0aBG9uGkiGDASTshj Dp1HrD5LrY/WWxEF6GrqRPc61krRfGVbb9KNwEj0fA4zhz74LOs4UcYPsW6oNichH4Ks 19iA== 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=ThSFa5TY9AN8ejL/oFTQ9UvkNub5vaaRPx6NCkwo95U=; b=lpA6PtXR3ei8pB/3D0DsSazRkNR0CiAs0w7pEUmUPr0vBYndfJIUtK2TbPPbxPc9Yl dncQOLQndLMs4KqgbEimagXeiTqsV470N9kbMrYrD1aWQ6wtg2ku9v87/sQykORe5ZKV ajxS3NjIZ4bJE0TAkd/f/t/roxRCn+0NUULoWRx9aeEfchW4yjxHDGsopKjKWuWQanZ+ rrTpvfl7dG/TKV7OhCqs0ecL59AY/EOWyHFI5RdmbEogWHeIFS2E9dxxcYC6IdZAd82Y wZwq0sj9x7smtYmhMBx7/QSp55sSqX1wXpCY0TmppEzd4pBmnBANJ89Ohai8gwySuG8Y U1jw== X-Gm-Message-State: AOUpUlEKCxZmRqpqEwOZva7yLt1LaLfMWCqSiIlUOSVBugaVEJZriTLk Fdb6sV1QFEZ3eA1xdZG4KNVXrg== X-Google-Smtp-Source: AA+uWPz9Q62GrVDM1cbswEJ4atfiPSujjt5s4US58San4nh5F+aJUXoWLEK5/qW6BvjlnIC5n3N6vQ== X-Received: by 2002:adf:f091:: with SMTP id n17-v6mr2356346wro.49.1533742444479; Wed, 08 Aug 2018 08:34:04 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.34.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:34:03 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 19/28] ARM: davinci: dm365-evm: use device properties for at24 eeprom Date: Wed, 8 Aug 2018 17:31:41 +0200 Message-Id: <20180808153150.23444-20-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_163414_985382_B7006282 X-CRM114-Status: GOOD ( 19.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want to work towards phasing out the at24_platform_data structure. There are few users and its contents can be represented using generic device properties. Using device properties only will allow us to significantly simplify the at24 configuration code. Remove the at24_platform_data structure and replace it with an array of property entries. Drop the byte_len/size property, as the model name already implies the EEPROM's size. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- arch/arm/mach-davinci/board-dm365-evm.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c index cb0ac92a278e..b360d26e6caa 100644 --- a/arch/arm/mach-davinci/board-dm365-evm.c +++ b/arch/arm/mach-davinci/board-dm365-evm.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include @@ -179,18 +179,15 @@ static struct nvmem_cell_lookup dm365evm_mac_address_cell = { .nvmem_name = "1-00500", }; -static struct at24_platform_data eeprom_info = { - .byte_len = (256*1024) / 8, - .page_size = 64, - .flags = AT24_FLAG_ADDR16, - .setup = davinci_get_mac_addr, - .context = (void *)0x7f00, +static const struct property_entry eeprom_properties[] = { + PROPERTY_ENTRY_U32("pagesize", 64), + { } }; static struct i2c_board_info i2c_info[] = { { I2C_BOARD_INFO("24c256", 0x50), - .platform_data = &eeprom_info, + .properties = eeprom_properties, }, { I2C_BOARD_INFO("tlv320aic3x", 0x18), From patchwork Wed Aug 8 15:31:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560289 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 167B515A6 for ; Wed, 8 Aug 2018 15:55:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01C172B12A for ; Wed, 8 Aug 2018 15:55:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E86512B1AB; Wed, 8 Aug 2018 15:55:26 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9E07A2B12A for ; Wed, 8 Aug 2018 15:55:26 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=wkSW/lK18EdVPA5XsftFolqyhrdEaBBvUd4B2tqnFtw=; b=i1kdQqRehrSmydSX/W7XlWYJNH zqXqyYVQU3Empa3EMMAqyAzSlEjbb3idBTJLiJ/7XiZb8ewnWNb2Iu6trGOsOSC85oCS7oq9burnS b3c81ID2fnXxpxj614yn8yov60V4psw3VD52O80fwx3XDYP1iGDUVfvYiS67RrQPXqpE9pRiFsS62 45KzyfLlVPAzHvV36a0kmiVL83Y/59x24zR9q5g1Ehobtt19hsJLPq2c0Ok5cxcpo+ei+7BGyxnOn A/awWfKcZfxI49ajoT+JTwbUGppXkk9f1vrlSxKyQkk2waN8P0FmtLeB1nMDfgoUUSPn4abCM1Et+ X0v0f4Vg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQnv-0003nC-Kt; Wed, 08 Aug 2018 15:55:19 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQmV-0000yY-Ue for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 15:53:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=rch8KJsE+MJ0beUZglPz8x5CspIMoJnswVk3XvQsCog=; b=ViT1bXbkZZu59NR1K1IHmqvXn GmZKwwBezBgcnr2D7ikivN4AgKnwqMtAzMP6OBLiiE5PDQiNK0gT38bMQQkEfbLVU5mU1KPN7RMhU NF5iXI9N4xwK1WLKzsKo95Zs0hC/z/mgF6XeZDubb//DZlBC3h38S8VItNBKMOJ3BhvJzTd6R88rg LLPJr+41i4491A7yHcTN1l/hH8YcbkvtW8izG2baCL9k6+FJ5rpmkanjaeHEFr1001WhPSl33BWKL 5nVEEAtzZ7NJLEdvXrdtoQLnoc2qdEGKVYx9oWElJxbQJQ0SFJsZLeg7mSapJJC36knLhJ+NSZo3J czKtBieiQ==; Received: from mail-wm0-f67.google.com ([74.125.82.67]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTc-0001Y5-Mm for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:21 +0000 Received: by mail-wm0-f67.google.com with SMTP id w24-v6so3222332wmc.1 for ; Wed, 08 Aug 2018 08:34:10 -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=rch8KJsE+MJ0beUZglPz8x5CspIMoJnswVk3XvQsCog=; b=vJ0r2acVB4Nu3qPXmQW9pO5QKZOX+SwGlLyA4khrEE3dnSaQjXxpGLwc8wnnw8WpbX HqpKx49KnylI6lx0qm04LzWLkm7995G/rtTfD9hZ/5ovbO5Z2qgSvwiwtN6EYxv5Qsvf F6Apnr8/w3vY+IjhJzBR0xOeDnawxA4b9e9x6fLLtvEFiDIpn3tJ7yJROTDD/mRBjVOB O9LyFSa4uKGJVRTzS9XMtney42jKnmpzMBJyZIAvgBH1/9tEigkt+I1gw3HDY1WH38Uw vblIXEh0X4ZMV3hOFCeGp/vzLtQYmdEPRXIzl8g+ppL6+FwImtq8bLkB2gcrfJbtmy3M +S2w== 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=rch8KJsE+MJ0beUZglPz8x5CspIMoJnswVk3XvQsCog=; b=c/dlTzztgs0foUX1zhiP3GuknJVLt2UWBfAiWZ6qQf4nssgYIu8o7j3LaWPDPGPvKu g25E6TiuhqMxqITcC4lPFsvTAABAulD8chH115NrwVcoZHKDdhfUtpLjI3kiqDy2e80x DYJeoPI4YydHNzIbOVvJaZZeSxTn63ENKTrw6Wz0aakLvNf/3/iA4JRNsIDPdf0PQbze We2nzPUxrjWPhORInWdOf77jlpckGOSt1gakyq6DgSjILvBY/UvvZIMng/qPiYzLZ9Dq 2a6XBPkUb+j/qz+s02lu9RitD/x7Yl4kV5vaxbJmMLVnQ7XAVRIYLTGG3i7PWoJQbzTj yfkw== X-Gm-Message-State: AOUpUlE/471siZVXXjiOewDhImhNuhGsZhnE71eB/tHoGyuDEL5LIIqO oyVGdQu1lvtxcfkkd5WLdJc4dA== X-Google-Smtp-Source: AA+uWPwz3eviP94syy6mF/DOjez6dJu8/1hZrLr2Vcp549DXnEqrfzVQF5RMbxJFvQGrCb7mFmNnZA== X-Received: by 2002:a1c:98d6:: with SMTP id a205-v6mr2094895wme.62.1533742448491; Wed, 08 Aug 2018 08:34:08 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.34.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:34:07 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 20/28] ARM: davinci: da830-evm: use device properties for at24 eeprom Date: Wed, 8 Aug 2018 17:31:42 +0200 Message-Id: <20180808153150.23444-21-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_113420_801197_35C5D605 X-CRM114-Status: GOOD ( 18.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want to work towards phasing out the at24_platform_data structure. There are few users and its contents can be represented using generic device properties. Using device properties only will allow us to significantly simplify the at24 configuration code. Remove the at24_platform_data structure and replace it with an array of property entries. Drop the byte_len/size property, as the model name already implies the EEPROM's size. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- arch/arm/mach-davinci/board-da830-evm.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index 4a2fe8142a2f..08a23e777eca 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include @@ -419,12 +419,9 @@ static struct nvmem_cell_lookup da830_evm_mac_address_cell = { .nvmem_name = "1-00500", }; -static struct at24_platform_data da830_evm_i2c_eeprom_info = { - .byte_len = SZ_256K / 8, - .page_size = 64, - .flags = AT24_FLAG_ADDR16, - .setup = davinci_get_mac_addr, - .context = (void *)0x7f00, +static const struct property_entry da830_evm_i2c_eeprom_properties[] = { + PROPERTY_ENTRY_U32("pagesize", 64), + { } }; static int __init da830_evm_ui_expander_setup(struct i2c_client *client, @@ -458,7 +455,7 @@ static struct pcf857x_platform_data __initdata da830_evm_ui_expander_info = { static struct i2c_board_info __initdata da830_evm_i2c_devices[] = { { I2C_BOARD_INFO("24c256", 0x50), - .platform_data = &da830_evm_i2c_eeprom_info, + .properties = da830_evm_i2c_eeprom_properties, }, { I2C_BOARD_INFO("tlv320aic3x", 0x18), From patchwork Wed Aug 8 15:31:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560287 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 7764914C0 for ; Wed, 8 Aug 2018 15:54:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63CA22B12A for ; Wed, 8 Aug 2018 15:54:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56DDC2B1AB; Wed, 8 Aug 2018 15:54:58 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 063802B12A for ; Wed, 8 Aug 2018 15:54:58 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=wP/S+hy+MXdkFmzBjhKgnSGwoC72BeRxaHQDQdJ4qf0=; b=J97fYOBiqp7geNTy+glyQzNoyQ BAwnKjBa1VOp/fn7e3Fzgtju0ZCwAjWViAX+EB5mlQR1k6otN/f3jdQfAt3pIxuCGa80ALYtLg7xf 2QwoeWhqW7QFibm1EaUKI1lfjW2/r2CkYtcV4JO43hr7VkCvQqs1zqySyqI0qe8w6Gq5VbNKjPmuw CRHz+r+rU3goHl/M81Bj7GImap7mBLmlrDjji43Ej76Hp+QeMEMsg5c3mfPLn1RP+v6W/LMHluDuK O865sUZ7ggrISe2aRwyEErxFkTHdhubPVjlU3pe1gipUsgRCV0aieORthkaWgvpztbCYbibSjra4v aORphWFg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQnU-00033i-Q1; Wed, 08 Aug 2018 15:54:52 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQmS-0000yY-OJ for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 15:53:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=a/BOUiTdvWAmDk1aQD6bOGL0a+rPVeL/eLOK+TRSYBw=; b=bR6TzkeyT8ytMrWhrHYFF46BE KiPlb5u3f9LMIoV5sgtj0LIRyz9LJ8DYdSh3ZjmcvsNkMqV5GP6jVwzBc7M1bJUljvXNt1snyysRl v/fy7qbfy/xpv6SWxGvbM9OfVG3oITVSSlSsmk2N72MxjA+WzQrQahncWJVijdS0XxdKXsnwEwnU8 3LnJiXSF+8EC0BQ2P9fd2oFivjPjYSTYeMz6oByMeLNDuGSZz1HggoNiNLpg+H3NgFXK/Y+6DJGih xUtCHbdnOEUeX5xpIttUsf5mx+q8ekEMW4b/lfB6Ac8n77vcf/fq9XaS3io43xd6YQBOFrgQvjMY7 N8VZevFQQ==; Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTe-0001ZM-As for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:23 +0000 Received: by mail-wm0-x241.google.com with SMTP id r24-v6so957914wmh.0 for ; Wed, 08 Aug 2018 08:34:12 -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=a/BOUiTdvWAmDk1aQD6bOGL0a+rPVeL/eLOK+TRSYBw=; b=XWVIG9DAg21hfeGcQ001YukvUzI3hLmFhFbJL9E9LKfvMDBDtdj6O/WL+KF1zX98c+ 6lrWefYHk3PPIT9ix5DmwQe/RenzPWO73DW5zXaLPGKS0n/76eNwJ6x8dRUFP4AvIYpX w4wJmiXoH41F2X8U9nU6XA4Wf6hvlcXcFrRSuqZOdC42a784zl5qqS27ymeZh/1kM4Wl LTEl+wCatoeybcGry3jjKw84JgJwCUKPh3iE03TFLoA+e8L6U4MubHtJZX020Z6TVVhI oO/VjYnDzT8ipDY+uJgIs9K/biY5I/7AHR1dbsTIzWmad+yXM2+gpMUZqy8I2uiaVEY9 VP5Q== 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=a/BOUiTdvWAmDk1aQD6bOGL0a+rPVeL/eLOK+TRSYBw=; b=CaP4kEiegRl8L9+8FEaYwyjqilkJTcBt4HI9h2hOkSzhEeF5vQHS2jKkjnevZo/0Sk z+pkqUaxDLGLlvGxHOHhL6qYUx11BF6+S/enLm0U6PWnZsTszNLRF5KMTuChostqEjUj 6hNBBOt9jooY2a0l3BfySyuN3hzrp8l5Bnfo0T2+jd80iJmOuSYGVrI2iqt8n1rXzZIK 9cpDPG9Vu2GTqSAsHRrEEXLSDBPDomMffBWusRi8u41hVpKdg56ZexZXAbq511JOW1dJ XiG9F+uaFXQ4lsCczzWEubxoZQckD6rmtULOp4dUDpWCw+nYjwzrbI+CrPdtB1KTXWG1 0K7g== X-Gm-Message-State: AOUpUlHEWmIW+iP5AGtBKRkmtUuDmUOZnzO2VGz3zCIzz1gH55HiXj2B Ml1ZtykEr/dS2OtS/YC6+sk1eA== X-Google-Smtp-Source: AA+uWPzyExx7j3C2AK1GuIIoR03Rq84RTVVyrNda+80Xn0gntUo0tViWEpucOr8nY5YDlRZCtl+I0Q== X-Received: by 2002:a1c:f46:: with SMTP id 67-v6mr2072530wmp.122.1533742450496; Wed, 08 Aug 2018 08:34:10 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.34.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:34:09 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 21/28] ARM: davinci: dm644x-evm: use device properties for at24 eeprom Date: Wed, 8 Aug 2018 17:31:43 +0200 Message-Id: <20180808153150.23444-22-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_113422_417533_70097AF7 X-CRM114-Status: GOOD ( 16.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want to work towards phasing out the at24_platform_data structure. There are few users and its contents can be represented using generic device properties. Using device properties only will allow us to significantly simplify the at24 configuration code. Remove the at24_platform_data structure and replace it with an array of property entries. Drop the byte_len/size property, as the model name already implies the EEPROM's size. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- arch/arm/mach-davinci/board-dm644x-evm.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index 6d35c6e1b0bd..abfcf42da6fb 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c @@ -16,8 +16,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -486,12 +486,8 @@ static struct nvmem_cell_lookup dm6446evm_mac_address_cell = { .nvmem_name = "1-00500", }; -static struct at24_platform_data eeprom_info = { - .byte_len = (256*1024) / 8, - .page_size = 64, - .flags = AT24_FLAG_ADDR16, - .setup = davinci_get_mac_addr, - .context = (void *)0x7f00, +static const struct property_entry eeprom_properties[] = { + PROPERTY_ENTRY_U32("pagesize", 64), }; /* @@ -601,7 +597,7 @@ static struct i2c_board_info __initdata i2c_info[] = { }, { I2C_BOARD_INFO("24c256", 0x50), - .platform_data = &eeprom_info, + .properties = eeprom_properties, }, { I2C_BOARD_INFO("tlv320aic33", 0x1b), From patchwork Wed Aug 8 15:31:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560279 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 6B6C314C0 for ; Wed, 8 Aug 2018 15:53:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 226602A133 for ; Wed, 8 Aug 2018 15:53:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1520D2A147; Wed, 8 Aug 2018 15:53:15 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 213C02A133 for ; Wed, 8 Aug 2018 15:53:14 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=AyDHggjh5m5UIIvCOMJDdnv6CcCnPF//1yBb4BpY26I=; b=R9HvP9dNaZNAAOyGr2LJR0N8/R 5+CvI8lMC5PoRwqkNF4gtmizdW7yo5B2DJH9dtJnA/dj8Yv7Nmx9Gj9qd0k6W/kSDmqa/tP/3y/VO fuz4ouY+ZEUjggzWfMYa/j9QW48onyJQLbfIdanL4VrcJzPFWNuf6fMuhqjNPipUHviEEjDmb5QXh +P4mCMFVLheMeJ7mwOrpEDInvXTIMVa1asq7aQsAB/OJkr/N5Zv2NAeNiTL0r1ygkYdso3tBJFZBM aERliyoQelEi6xRP9dQZl6HWAVS1TwKbjvRPKi5jCpXnr2AXBjNwCSAfkuEIPL2IdWKuBZCBZT53t eta8xvgQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQlr-0000yg-QS; Wed, 08 Aug 2018 15:53:11 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQlq-0000yY-Jh for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 15:53:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=OvKwhd2mCBVUwPnMRE5AwwMx496gmP74HrCO7MDmB+U=; b=rGe13yViJNfet1WRVbSWaybvb g83L3vghx/jNdqGVDX21/Q3w0MHlk5HZTCu0TY53Wq/FHMpPd1Nk6LZZsqvIbWBKevInTI52AF/Ex hcWt6lOpqL5+tks0VnbtV6JdyC71OOaLiG2eAAyHAGFFZu0Fy/Su1GnPXP8fUgWSzrIi79r+X98mu SLTV2ojKbFSpi8vIUHMYLDnjj6orEjxXPNyANWGmf01DIGHstgF96odtTlocWsX4pgp8IkzudE1Sm wCGKvDZMqBqECqSmXESxTkjyX50z4F0o/1n45BdH8kwFlxF01XBF7V9vm+S54h0JaCezDdXmEWmcs 8sT0vBcMA==; Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTg-0001Zg-QB for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:27 +0000 Received: by mail-wm0-x244.google.com with SMTP id o18-v6so3251175wmc.0 for ; Wed, 08 Aug 2018 08:34:14 -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=OvKwhd2mCBVUwPnMRE5AwwMx496gmP74HrCO7MDmB+U=; b=S74xJ2V4qE2OWDv56e8ZgVKuC6BowTpGgNREJayNLwLD1IUpDA4vUU3xQC3TkvWvf0 QeWQIFp++qv7MWqofZr7LFgFDNZ7RFZvQl0PSWJKjzDVa3PnPRoea7XEvMfKV2FiEqIz wna4Yofjol0X/TnS153inNlMQ6b4gjzoPB7kZoYVCnR6FLEnBBSil2FrNSbGV4fG0RJX bYaNfB3U6b78SjkujVor02ZwG6i64fZFzYnrGsGM833bwqoiAbLXMY10cNq5iX04pLdL bKvClCNnyasWxLK3k+RzurJZRCdBFnP4aRS664aInm2cqah5gT6w6Ac/+CzU50phiAw4 ZgeA== 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=OvKwhd2mCBVUwPnMRE5AwwMx496gmP74HrCO7MDmB+U=; b=Nte8kl2aj2uVa/iAAdKPfFyjCgj1nPzByrFH+vY+3qxy5vWoHJERBsPgtz6qsNuUMH B/43CfeY4R4/3ODes2C0ShQ/0R4zcm5d9prUUogXY/xanJ6bV8ZRB2JQ88O9Gj0XR5ZP eMfn3+69JNlf9dD9j2CFzTiLHS81s9lcvx0Uu3ni6GUGyOfeUESRQtVWVI9iEjus/p3F gbM4ucylhXzEDuOHN5W3434pFrOYklaUowCI0Otye3aNmk6eeCdEWJqfVn1mBCB5gNsw S1Lg7eYkDUpstv2T3KmM3NOhfq77EuwzUHFSp+fQrkvmTGJFyB7rDr2aANweJ6H9DPDS Dxtw== X-Gm-Message-State: AOUpUlGS+LxCjKYECj5aGwsuNIEXTUTBgLRs7XycTKGFEa0c7zW1FHB0 7WqCP4KT4YhwMGocNgiM0CKWQA== X-Google-Smtp-Source: AA+uWPy5SKjo4TRcy8mU4g7AFlHYuqb9Vkvn6ZOQngBdjUuqkdRLeueIoyhUxuVpisqFKwBZDpKvGw== X-Received: by 2002:a1c:9f12:: with SMTP id i18-v6mr2156022wme.124.1533742452573; Wed, 08 Aug 2018 08:34:12 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.34.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:34:11 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 22/28] ARM: davinci: dm646x-evm: use device properties for at24 eeprom Date: Wed, 8 Aug 2018 17:31:44 +0200 Message-Id: <20180808153150.23444-23-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_113424_911302_9CECE15B X-CRM114-Status: GOOD ( 17.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want to work towards phasing out the at24_platform_data structure. There are few users and its contents can be represented using generic device properties. Using device properties only will allow us to significantly simplify the at24 configuration code. Remove the at24_platform_data structure and replace it with an array of property entries. Drop the byte_len/size property, as the model name already implies the EEPROM's size. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- arch/arm/mach-davinci/board-dm646x-evm.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c index 5a9de47bc8a2..5049f0c6cd1a 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -320,12 +320,9 @@ static struct nvmem_cell_lookup dm646x_evm_mac_address_cell = { .nvmem_name = "1-00500", }; -static struct at24_platform_data eeprom_info = { - .byte_len = (256*1024) / 8, - .page_size = 64, - .flags = AT24_FLAG_ADDR16, - .setup = davinci_get_mac_addr, - .context = (void *)0x7f00, +static const struct property_entry eeprom_properties[] = { + PROPERTY_ENTRY_U32("pagesize", 64), + { } }; #endif @@ -396,7 +393,7 @@ static void evm_init_cpld(void) static struct i2c_board_info __initdata i2c_info[] = { { I2C_BOARD_INFO("24c256", 0x50), - .platform_data = &eeprom_info, + .properties = eeprom_properties, }, { I2C_BOARD_INFO("pcf8574a", 0x38), From patchwork Wed Aug 8 15:31:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560339 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 7018013B4 for ; Wed, 8 Aug 2018 16:13:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B25228876 for ; Wed, 8 Aug 2018 16:13:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D2F72B185; Wed, 8 Aug 2018 16:13:42 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F2C5528876 for ; Wed, 8 Aug 2018 16:13:41 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=xr98pAGWTYr5+hR2mw0x0I+qJXLQGAf3nMV9XSwDArY=; b=l2P2xKdm2vRsO47aLKHNQ3FdIN WBi73+PNc31PBsfV/wB8GqWpUQGdpF47xv/t89YZuksIIz4PNb1DBYYCh5Hb8PNKUBkgPw8u8kqm9 V5binhuca87Y3BwXTP51BgcnWViBPuii1s2WKOYZCcXDu1jcPbOJeAVV761B/IvAP0szv2xYMzK/v xdmlUgEIBNQxmtnhIzcNg5q+lk2oV4uCKzM4m+H5l06NiLfqKUMpMF76oZNqNLlUSkayJMd5kDXi9 7I4QaxBG/2MWe8lY6Lx18pDrhsefgbFip+9napz8Cm09KwwV1wEDR7zUsNwl0WpZJAmhC9LpsSBkt 64WhLr3g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnR5b-0007hL-Ny; Wed, 08 Aug 2018 16:13:35 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnR59-0005hZ-51 for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 16:13:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3zmWRBLVjC00ebZcBXbf19VncOAWdFwL8jWPHWZ5uxI=; b=AgmzMKTZYm4IXKOSQ/Py4b4o+ 4aFZ3ahGudYGF3p+CzJalcnmWOfobBjZC2ZpTgU4tCV3bPRr0HFuXgbTmwtNHqiGaUP5muL2TGREy tTmOpp74e0/8y3D+jZK3Gdqp3llYa9qkTCo0hU3v4buYkz856Y+d+uqJYjsaC80Z900PZiyBIQFms 6mxWtja4Fv26tEAyUnEKB158TLpoDn4nmV7tgTiP8QHg7F2XqUvSF2gF2RsaGA8LfugQBcYbNwbvl ZUPftmEP0XIUgNnVEwHsjPlPhDabkZm3AhFAlXPBHW6tpQdtlAZ9qjKJ8Vovv9ZRoI9tCDzaT4k+U zqbeinT0A==; Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTh-00033V-Fn for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:27 +0000 Received: by mail-wm0-x241.google.com with SMTP id n11-v6so3210622wmc.2 for ; Wed, 08 Aug 2018 08:34:15 -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=3zmWRBLVjC00ebZcBXbf19VncOAWdFwL8jWPHWZ5uxI=; b=BT79WY5i/ylbNRfzAznyk8wdkT3VXpt6pWEmpgwydCoTZ0czuErKeNBMeL7yBf8iKF c7+2VCW8xW4qoWDD15hZrGSCDegyWDShx1e3p+T/tj/1MMkNeqPUXqoIoIJGytdYybDY xg4rK9gAio/gBv8vd/Oq8gjcTh6/1YoJ9PVD8qTaBB8Wle4V95R9ThkOjfcIP71stvW7 JNn+W9FLqYgqhgb4FFI4OjVuGPP1uWn1wPqPTcqpopWtiTz78LRNMnwWAB3fwvGvwSzk JGUTei9E55tPcf3v++D4wY5ExTheiksDCoUaz/Ji+B1LXHRrAodeJeApWmwABn+3TpUb LzUg== 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=3zmWRBLVjC00ebZcBXbf19VncOAWdFwL8jWPHWZ5uxI=; b=ad5b5oIf/rpWvBp+JNrK3kuDID9Owq7BatG5w+rH/cT5Xu/OeIS9hRkb8W2PsTMNWH WJFgjWz0NhAoqtxW6gykfp9a9aAIdoZxMpCBUydWonuPHVUG3Z+xFjxoXKSunYv735AP +7CUXAi9jKeVrFPFz16oi7tpchoXtA+LwJhE8JlXXFQzwJCxE2eBzjc3VoRr0EQGBcXv r2lyBsqDAww48JjUJVMIRjr8iqfnbUq1+eAhrGHSqbHQp8l6m3OKxlbUES+8q6lgxWjB f4AX2tqJpSiozMaRAnL+IQ7YAoubJI30phGjZdZX0kgBrfF6dS6PAksI0xC8Wmj+lNra CYOA== X-Gm-Message-State: AOUpUlEOLKQPwA/trP2vXo9YzuV8N/N5flUfYNCVusfleHZwfwzElAlO V94iOM0XEOCDqaOdgAAzEdBBuw== X-Google-Smtp-Source: AA+uWPzEi1m4ARfaadbvyqjj9z92+GFN6UYJ+IHVI7vlDPNnoQcxmZXmNTEZaNiSof0oVsPgocOOGA== X-Received: by 2002:a1c:8587:: with SMTP id h129-v6mr2052562wmd.105.1533742454486; Wed, 08 Aug 2018 08:34:14 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.34.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:34:13 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 23/28] ARM: davinci: sffsdr: fix the at24 eeprom device name Date: Wed, 8 Aug 2018 17:31:45 +0200 Message-Id: <20180808153150.23444-24-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_163425_526655_F56231A7 X-CRM114-Status: GOOD ( 20.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski The currently used 24lc64 i2c device name doesn't match against any of the devices supported by the at24 driver. Change it to the closest compatible chip. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-sffsdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c index e7c1728b0833..f6a4d094cbc3 100644 --- a/arch/arm/mach-davinci/board-sffsdr.c +++ b/arch/arm/mach-davinci/board-sffsdr.c @@ -100,7 +100,7 @@ static struct at24_platform_data eeprom_info = { static struct i2c_board_info __initdata i2c_info[] = { { - I2C_BOARD_INFO("24lc64", 0x50), + I2C_BOARD_INFO("24c64", 0x50), .platform_data = &eeprom_info, }, /* Other I2C devices: From patchwork Wed Aug 8 15:31:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560337 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 21C3213BB for ; Wed, 8 Aug 2018 16:13:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CE2C28BE7 for ; Wed, 8 Aug 2018 16:13:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 000B72A295; Wed, 8 Aug 2018 16:13:12 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8FABB28BE7 for ; Wed, 8 Aug 2018 16:13:12 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=6DSW47fT7e3QcptZwDGzsXDTBpFPmVRWOnio4gaBnqc=; b=MbX8FsTXwERYUIiqKgm4cv99XO YiH+YiXjQu7IZun1bheh6EG29+Plaf9OZOSYq6qC4HZZvPtPe4D1UsvB+HRBPojpqgbcFtUoRVzMT fWxYKO9j1zoXsz94B3wfrw3inthYZzncjdmCa2y+ZxPnJ2sN944/39q5y4SbqWhdDn17deK2htz4G f9d5UA4uvfSB8k680cxtcnn1uj7QUhjJVu/m3a4+v8Df3SRMknzhVLt0qtIz0+lN5o0mWgmyqEvor O/FKhYuQWbwuItTBr6ILq2MnBiPHyz7WsDk6oAeDeU5mZiFFbps4YwtujD7Xu4DBk0m0TZTZhvIv9 QeyKdmwQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnR5A-00075Q-0S; Wed, 08 Aug 2018 16:13:08 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnR57-0005mi-Kx for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 16:13:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=dK61Sm/OZ4gXBZLrnJshFkdxHXIagaw+2DY/FsoCvvI=; b=E08XgzhCkQpg4GoQSKHjyZ0jl GFQZZJ+bcaox60DA61wZlVhpqghrdZI13WsevxsNKFNr0Bt4KVQ5sMUkiW+FMwaEksdYL306P5PuA 61NoNyihnWQ48vEkJhBsKUcI2H5mlwWwIKmh+nruJsY39u8vilsa7Cj9IUuTVrSB4092lELw4bJXP A+cl451RQkgZwm76SnXfXGGyZvx9+sv/0AY505vdNvW3yw7CgifKMFt8qdPFSfK1PLygQ4/VxmF8c ghzyq3qO1suoUdK04VKoRLj/GD9LTnUlS93YD7OQSWNoqfDVt/ItQWobusM30O8ytvtSoSax2rQ99 8VWDwsS4Q==; Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTj-00033h-Bb for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:30 +0000 Received: by mail-wr1-x442.google.com with SMTP id b15-v6so2390682wrv.10 for ; Wed, 08 Aug 2018 08:34:17 -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=dK61Sm/OZ4gXBZLrnJshFkdxHXIagaw+2DY/FsoCvvI=; b=wx8KUUpDrXR1Yk8TEQeY2WiyIeyoTJOeBd43Kz2X1m8jbY0l2rDH9rnaauh6kSiv5d FctheraTETsKIZy1woSQCbBbz0MbtAMtsSZrioYwb9K9bTUyZkitk6VPRyE84NwAbpom kCqS7oxgxKj0m2OKqf8DxC+gaY/r6LiIHfzO9/m7cgo95buiVQ7nvrbd6FJtqEL9cmhR r8CATQ6/MB/ZxhA6pNVStq1a9fcXHNuGZywEdskRH3LLQKg+LR7j7XjU1UxOL9De6W6O wNr2H99NmVWD0ijZ3vxgUPYXe0L92typj+9+KxDNLWyC8aSqFdg5PDaUXzBmWdPAkiAJ qCMg== 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=dK61Sm/OZ4gXBZLrnJshFkdxHXIagaw+2DY/FsoCvvI=; b=Cq+Jso1KCCZmeZDoSrC6mVg6PxBK951kJcbOlEWG0O/Uo9nom0jYHeQ7PUT/pIY56k uLi9u4OSzDTkGaXy+T4tXxEhehMFPbqKlksF/YaA0P8x/IZTdzmikhQmXAlv8W+4ZUGr u50PUBoiBlIWWzFqvjZJIn3DXWVy+Ll8vfVjUaU0esvZs6ng23oCEwgH2R6YkkQXbk5i 9P9mCMJxKxG1+7LEO03kRpNSjr2fne6/b8wIpbTFquNElKqH1xo8qdvpyJk0sEqXE3Vs 0Zy7vE/S836NmtcNjgaASslfq+/C+icbUODTzdhyeTmqnwq6wtfQ7kb6QPpmDzY2NVfp Ekxw== X-Gm-Message-State: AOUpUlGr3Z/QIFovMwgpKgK3+5w6eI5SGAe11cxz2gU8tqpqVQAYVKDe 2SGBTK5kYew8gySxbq5x+lAoBg== X-Google-Smtp-Source: AA+uWPzxoGpu7emTO/neCYjOUZMXauI/VlSPU0CcyhJ0k+8pENeySiJE1yVk0PhrI70YNs7KID+5DQ== X-Received: by 2002:adf:9e84:: with SMTP id a4-v6mr2236524wrf.70.1533742456417; Wed, 08 Aug 2018 08:34:16 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.34.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:34:15 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 24/28] ARM: davinci: sffsdr: use device properties for at24 eeprom Date: Wed, 8 Aug 2018 17:31:46 +0200 Message-Id: <20180808153150.23444-25-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_163427_395370_7DB0F205 X-CRM114-Status: GOOD ( 19.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want to work towards phasing out the at24_platform_data structure. There are few users and its contents can be represented using generic device properties. Using device properties only will allow us to significantly simplify the at24 configuration code. Remove the at24_platform_data structure and replace it with an array of property entries. Drop the byte_len/size property, as the model name already implies the EEPROM's size. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- arch/arm/mach-davinci/board-sffsdr.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c index f6a4d094cbc3..680e5d7628a8 100644 --- a/arch/arm/mach-davinci/board-sffsdr.c +++ b/arch/arm/mach-davinci/board-sffsdr.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -92,16 +92,15 @@ static struct platform_device davinci_sffsdr_nandflash_device = { .resource = davinci_sffsdr_nandflash_resource, }; -static struct at24_platform_data eeprom_info = { - .byte_len = (64*1024) / 8, - .page_size = 32, - .flags = AT24_FLAG_ADDR16, +static const struct property_entry eeprom_properties[] = { + PROPERTY_ENTRY_U32("pagesize", 32), + { }, }; static struct i2c_board_info __initdata i2c_info[] = { { I2C_BOARD_INFO("24c64", 0x50), - .platform_data = &eeprom_info, + .properties = eeprom_properties, }, /* Other I2C devices: * MSP430, addr 0x23 (not used) From patchwork Wed Aug 8 15:31:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560285 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 2900314C0 for ; Wed, 8 Aug 2018 15:54:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1521F2B12A for ; Wed, 8 Aug 2018 15:54:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 094CF2B1AB; Wed, 8 Aug 2018 15:54:07 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6380F2B12A for ; Wed, 8 Aug 2018 15:54:06 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=vOudFbqvLCLvoxEZyKqJTYEmPt8FS30su+SWUyqLBKI=; b=V0LbSQu4l7rAQJf/DHTIhDuzsg styNlO/BK3M0b/pxqlimVW6nq1LIkwRZ84PODS3zZ01iH2s2AHCPBp0hKt10aqxhiCO4lNO/kdf+G j7Kbw9BLuf5nCBdaDIt3rIA6DyytyfEaV26uf9xL0h0CJYJWr4GJOHhSWmqvma76et+v/yfnbcmn8 pGqUHmgsExzvFSG1kk663KbrS6YS89RS1olmzOlfzKmLtsBu8vsLCeO/3hgI8f6Bj1ymZax7TbFDw MLsdRRyWq6TGNDtpYTrbpbAqD3KTgOhzsOwjjM4wH++42a19qXIQiR61Mzhgrx5jstPvA2zzkp3Mz zYIbg3Ow==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQmf-00023h-SM; Wed, 08 Aug 2018 15:54:01 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQmF-0000yY-RO for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 15:53:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=M7UsCvqnFt3W2bHK6DWe4k8iaOUKf7rLaco+g4nZ2Ys=; b=GbBKZ5e4Xoq7hrvr/nMUiVmAc HgHIuntU7tgG3dj1UIg6VSw0sh0knIl+bhG86I4iEVqGHtI6X1EfB0Jj970loTcJOzN1r718lROb4 mRtFC1N9rd8EEaZ7zgHixvB1qHjNO41uOXr8fMHOZIgvCc87MXPs8AUVlbSff/z03VbHXKzLV/MeA cp+lkYQ+Gp4m/tiYuPVbTYU+EhCjdS4McuIdnHaaHYKZJxEXprV2mkjOJXNVwjbtoNPmCs/562xkS RBAv72rUItzNT9xBPMmeC0OYLtxHKqJPYQ6XDtG7r35AZ9OsQXnTrt8jHJeAKtAwv/Gpit5zsKG8m rdjDRmskg==; Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTl-0001a5-UT for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:31 +0000 Received: by mail-wr1-x443.google.com with SMTP id h10-v6so2405814wre.6 for ; Wed, 08 Aug 2018 08:34:19 -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=M7UsCvqnFt3W2bHK6DWe4k8iaOUKf7rLaco+g4nZ2Ys=; b=wQ5VJBcvYrRS7XzApI6Ewk7Yh2aHYbgtfXrwvfm6MshVgyVhbPGV1/DwqQOiM80HmY Zix+HKApykFghM20kd+OAmvTLf7cCkmrnFOq/QvXfVsiPCGP/qtkgheug2QgJb5NMfLu KQz8yku0bHglBxhO2GL5ytkdZoz/X6nH2WmpLuO/SQVEEbDrsNH+Tf/UGbL3yrYGTZFZ e/8ixazqAbSEsisLFAzsYrTV8znqB4ARnUZ+g42md/LHwFdm4s4nN0uwKl/6swegoftM DvwSihE17QCX/CohxEJIE1jSmL/8jLFZx1G82ngk/+ynEDVjic/VKQisVIP6NAFAquIS vxbQ== 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=M7UsCvqnFt3W2bHK6DWe4k8iaOUKf7rLaco+g4nZ2Ys=; b=E6Io5Ii2HnE4MdP8orGLa7V1kmxfJtOYX6zyBnN0HFyhijTY0skBShIKR0abDXppPS +yIowYzNO/cZujTkC+3VGOZJkZRxzDC5rD6kWFLGrun8+4NGnpRrNdOFPp7g7YdjUnro FGgYOvMBqWeDKxUJAyEAxSWjhNvAoi16WlFwLlX5pl7Zt2rFWY4NzfVvf97d7ZUZzMcD GLYtOjbrKFD7Il9Ur6OVqalS3AkEExl3+OQMnC/6HmsX0JWORObvD93tawqt0j2qwZOQ SvPnvRLP19SEqBXAdhpCSr7/5czOkXAU8dWCaXQwcGeLy4VelaHREi0G/nTVsjtm3Bdr 2+aw== X-Gm-Message-State: AOUpUlEOu1qoLJQwKzlj26MpBiMmCe41t/F1WfsuqcUVf7h6OesekxRn /EaD/8yplDrUhI1nt/UqyWZrfQ== X-Google-Smtp-Source: AA+uWPwUxWzFD2iZAkFk/ZYc9NPSGQyMkmEjBY6HOUC2+Y9/EnglksJzTqPZaHJDUfZJ0skIHB7UKA== X-Received: by 2002:a5d:4cc5:: with SMTP id c5-v6mr2365511wrt.210.1533742458304; Wed, 08 Aug 2018 08:34:18 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.34.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:34:17 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 25/28] ARM: davinci: remove dead code related to MAC address reading Date: Wed, 8 Aug 2018 17:31:47 +0200 Message-Id: <20180808153150.23444-26-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_113430_049266_8C7271FA X-CRM114-Status: GOOD ( 16.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski There are no more users of davinci_get_mac_addr(). Remove it. Also remove the mac_addr field from the emac platform data struct. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/common.c | 15 --------------- include/linux/davinci_emac.h | 2 -- 2 files changed, 17 deletions(-) diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c index bcb6a7ba84e9..0c6cc354a4aa 100644 --- a/arch/arm/mach-davinci/common.c +++ b/arch/arm/mach-davinci/common.c @@ -28,21 +28,6 @@ EXPORT_SYMBOL(davinci_soc_info); void __iomem *davinci_intc_base; int davinci_intc_type; -void davinci_get_mac_addr(struct nvmem_device *nvmem, void *context) -{ - char *mac_addr = davinci_soc_info.emac_pdata->mac_addr; - off_t offset = (off_t)context; - - if (!IS_BUILTIN(CONFIG_NVMEM)) { - pr_warn("Cannot read MAC addr from EEPROM without CONFIG_NVMEM\n"); - return; - } - - /* Read MAC addr from EEPROM */ - if (nvmem_device_read(nvmem, offset, ETH_ALEN, mac_addr) == ETH_ALEN) - pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr); -} - static int __init davinci_init_id(struct davinci_soc_info *soc_info) { int i; diff --git a/include/linux/davinci_emac.h b/include/linux/davinci_emac.h index 05b97144d342..19888b27706d 100644 --- a/include/linux/davinci_emac.h +++ b/include/linux/davinci_emac.h @@ -19,7 +19,6 @@ struct mdio_platform_data { }; struct emac_platform_data { - char mac_addr[ETH_ALEN]; u32 ctrl_reg_offset; u32 ctrl_mod_reg_offset; u32 ctrl_ram_offset; @@ -46,5 +45,4 @@ enum { EMAC_VERSION_2, /* DM646x */ }; -void davinci_get_mac_addr(struct nvmem_device *nvmem, void *context); #endif From patchwork Wed Aug 8 15:31:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560283 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 D47B815A6 for ; Wed, 8 Aug 2018 15:53:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0E152B12A for ; Wed, 8 Aug 2018 15:53:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B374A2B185; Wed, 8 Aug 2018 15:53:39 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 56FF72B12A for ; Wed, 8 Aug 2018 15:53:39 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=wrLpzKkLbA4Nn82kNB1nn3EwvmLd5TxS3eAfbqz+fRk=; b=Qs5VFzpqG1xHwWzL0oxav8VUyk uI4dJKjoVSxVn6vXPnRXJqGFiZlVI4Z93Del24idX3jsueUl3V0x420juHeQnt3MIPK6WCkQXF3On nhVlX22jDObo5C9J1hozvZJBGmOi1ONFLk5ld8Spa+9xVgVzkBd5Ev7w5NfZppWDN3qqIW5mcqCYS isjCj1HJBrIE4OIP1NzL6oAQN1BIoR/3TOPRX6MlynhpBPxSe7c61d+wQjo/4kV9aujfVjXPcqdZq 203hutYfNzABRK5gf7FHtAFPtxbLWHebOYvhaLX9sWd3yLV/XguWhPUl5xybWiPfN9afRVqpRoE1e qZe9jinw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQmE-0001VQ-U9; Wed, 08 Aug 2018 15:53:35 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQm7-0000yY-Nv for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 15:53:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=FSHdY6zctlDkYyxEvPBDzCoV80UVARiCoyzJIuK3YLA=; b=Q1SnKnjJ2l2pjawtMymMkNCve fLa+7zrWoJ4It73A9fwI9zdywGYhxpYWLPI9XQ88CcOtaa66juXvpv9pyceBsPfmhwGSIdRQe66Qu 5Tt2XFBrMrWoNp6TcOUjy0G+Fr7/SgXBJUcLt0Q0VDlv8rUQ6Yk8W2ejt+WtdaSv5sTzfdsO4y8iA Y4gdnAOW1aXaR6RksTIZzkvB4dPXVjhDCT5srTbbmyPmlmugQ35alN6yq0fAHyxH7uIxwUJmQGD6H PYrH6LzD3QbONSnXGBhdKeU/eaZb7v+Cvx71Jg/8hmGtqYi5ns8RTZJK6W0GDDV1rz2YGs5HH56x9 CT+dWhZdQ==; Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTn-0001aW-RC for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:32 +0000 Received: by mail-wr1-x444.google.com with SMTP id c13-v6so2427555wrt.1 for ; Wed, 08 Aug 2018 08:34:21 -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=FSHdY6zctlDkYyxEvPBDzCoV80UVARiCoyzJIuK3YLA=; b=gAHlXd963WQRDMseqLKzq+CSBwUuAdYlGVYWDDqcgkLvPzZ3mjKXTxscWrDgMJAmWw Wvp1LRY0O3YiSP1OyZO+QaPTdvyFcvOc/RAynOtGMzMW0PpIhZEF6KgK4CL5zWWqPY5P PmmEVNzDs+WmoI+9X3zxmXtjAvTiCKI5N2bl5i93TNntKd7yoGuae56rPGG7Pgb9d1Wt t1x+UghQ8ebVKYvLrTEojYZ+A0cJhPxLTvdM5HJ7W3RDN/r0uJk2STc7Qu6MPyapwKRO TJOsU8Z+71nAQZlomaSN0ogD+f+2mDU43YpW/2H0fMM68C6TUVd6OZpHtWGpeY00WUB2 tomQ== 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=FSHdY6zctlDkYyxEvPBDzCoV80UVARiCoyzJIuK3YLA=; b=lI7endQGEmEQrCo54ZyAN65uGrO+UpBI4hb8w7j/uG+YR2Sm2RKFJtQcBQnZhi6KdK CxB4nezIBxMDvlo71NRPkod5HTlUuEMd+ynYJFLndd9xzv7fXz+g1NwBtTRx9kPu41iT p/9jtN+uOWyyA1OEEGqhnuuCmLuzlL+plPrnZhgUFAchppyAEN1yKeCFij4xXZXeVWDB ahxwQFJKS2YWahp7GjpOzNJ/6N4VnY94TNHSVG7VerXkYaUOdprrv2LroESuuOoku1Ys npnzLx3XSy6kI4FRZbYf5CXh5wxQOnmlcTMjdU7xHj4h0xdYv/D0mGno6apP5pDAZP++ 2uUw== X-Gm-Message-State: AOUpUlHwFvnV0xibUG7ah/o+wnx0acSU6o5o1+5pRD3uXpX+p6FDd/Qc 1Jr6z2xdES5mGCcUe92p5ea0hQ== X-Google-Smtp-Source: AA+uWPyUK+ZAquD4IIWwhTosIbWrpsz89OnHAL4DrHBb/QfLzilJnt0DZ6qPws2spLmz0eVqRpf0JA== X-Received: by 2002:adf:f790:: with SMTP id q16-v6mr2236663wrp.86.1533742460112; Wed, 08 Aug 2018 08:34:20 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.34.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:34:19 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 26/28] ARM: davinci: mityomapl138: use nvmem notifiers Date: Wed, 8 Aug 2018 17:31:48 +0200 Message-Id: <20180808153150.23444-27-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_113431_970304_15F5717F X-CRM114-Status: GOOD ( 19.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Stop using the at24_platform_data setup callback in favor of nvmem notifiers. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-mityomapl138.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c index 5c0a0557a361..17b67e26bc0e 100644 --- a/arch/arm/mach-davinci/board-mityomapl138.c +++ b/arch/arm/mach-davinci/board-mityomapl138.c @@ -15,12 +15,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include #include @@ -116,10 +118,15 @@ static void mityomapl138_cpufreq_init(const char *partnum) static void mityomapl138_cpufreq_init(const char *partnum) { } #endif -static void read_factory_config(struct nvmem_device *nvmem, void *context) +static int read_factory_config(struct notifier_block *nb, + unsigned long event, void *data) { int ret; const char *partnum = NULL; + struct nvmem_device *nvmem = data; + + if (strcmp(nvmem_device_name(nvmem), "1-00500") != 0) + return NOTIFY_DONE; if (!IS_BUILTIN(CONFIG_NVMEM)) { pr_warn("Factory Config not available without CONFIG_NVMEM\n"); @@ -151,8 +158,14 @@ static void read_factory_config(struct nvmem_device *nvmem, void *context) bad_config: /* default maximum speed is valid for all platforms */ mityomapl138_cpufreq_init(partnum); + + return NOTIFY_STOP; } +static struct notifier_block mityomapl138_nvmem_notifier = { + .notifier_call = read_factory_config, +}; + static struct nvmem_cell_lookup mityomapl138_nvmem_cells[] = { { .info = { @@ -176,8 +189,6 @@ static struct at24_platform_data mityomapl138_fd_chip = { .byte_len = 256, .page_size = 8, .flags = AT24_FLAG_READONLY | AT24_FLAG_IRUGO, - .setup = read_factory_config, - .context = NULL, }; static struct davinci_i2c_platform_data mityomap_i2c_0_pdata = { @@ -546,6 +557,7 @@ static void __init mityomapl138_init(void) if (ret) pr_warn("spi 1 registration failed: %d\n", ret); + nvmem_register_notifier(&mityomapl138_nvmem_notifier); nvmem_add_lookup_table(mityomapl138_nvmem_cells, ARRAY_SIZE(mityomapl138_nvmem_cells)); mityomapl138_config_emac(); From patchwork Wed Aug 8 15:31:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560281 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 2773D15A6 for ; Wed, 8 Aug 2018 15:53:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11F652A14A for ; Wed, 8 Aug 2018 15:53:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 045C42B174; Wed, 8 Aug 2018 15:53:25 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AD2512A14A for ; Wed, 8 Aug 2018 15:53:24 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=f4tEWqKmMHByhZGQ53UOA9sGUVnJQ7mazxN5P5/132M=; b=PlM4vTF+wjjW0WqunK6M+xUtAw ZdgAGlutbL0RzIOTidMfd9y2Q5uJ1VcWdNi2HTbBG9mTmA021I6jJkfoCR82eKkf7vedEdTkuZnas ej2bajl0SZ9BLhKvGjXa4q8zSIZBY/0Sf4+gxtqTVfUdbCQYR3qvrYAUe6zRuXPLqUMyujVD3WX6Q 9q1XU77HHVb2ZeDuSQG8IDF3c4OQaFRup4T4v8OP7lPXD5bPLOH5VDhR2Q2s24SoQu3Hn+q7uXico PLm6NS2ML4gXc9c4BiDNE9uOws8/kEpLKOHZqGUthtVSQwwZl5SH3fW9q3I36/IIMARAW7r2qw9Ha CYX6Defg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQm0-00018a-2S; Wed, 08 Aug 2018 15:53:20 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQlt-0000yY-HP for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Aug 2018 15:53:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5BmTvmpqVPdPXiWZLqUzgpWunx/nLJo3Onxdpacg0zI=; b=YiJiUrtuoTxE22SqyvgIR9VM4 Hg7hA51GxIKzqNOeR7vXrzUADVhzrbFHUr3fK2xgi6VYmYtOQ1+ZE2oGjQ/MNEesAwdfJJ0Y2xzkj fVMo1rfkc/+mZ3unl5u8qgZd4KbB0CoELR0gnmo/rl0cfszfRXi5YICanS0KM9b0mbH2dW3BF/47t 4C3jUiY62tKM4/p7YipfkhYioef4uHYqFv+8w76ySEOskyYpoJ/RSS4ffsVwx3xUT1jpkALg37fnK GkjUT+S4WBa8bWWY0v4/eE4UpQ1fGTrjjmYSrHXVigGNDEf6E5j6B2dWRkYOpsfM/FfqowByftatU QesK3MtMQ==; Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTq-0001c3-Vf for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:34:35 +0000 Received: by mail-wr1-x442.google.com with SMTP id b15-v6so2391080wrv.10 for ; Wed, 08 Aug 2018 08:34:24 -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=5BmTvmpqVPdPXiWZLqUzgpWunx/nLJo3Onxdpacg0zI=; b=Kis6cTi+w4SEAI/fwvgBrnj472bwYN+eyv3mo4kGmNQZDXxuLvKb94AGGLiHNSluxG 2U8ySAl8kvhqXbe2XhqUaf010LnH6lGXajML/GnE2zBMR1XM77EY31pxw/b1GdGnCZx5 gJOe0IfIUYJkGio9jj5W+yBVZYIlJGQVF54kEeEoMADSIZoHwsXHaBmI9vj7cwYVPs/D i3KLzjafr7kQx93rS+kuCWvz8fPGBU81PxZEPcgXnNzwETjXU43zkWGjIpBDTRBMFyiK DLgcYgpWKxPBpCaCZvyhg/gFXQiVf4u2d0Xs1jOd81NQQj0YaU7PeELSb+8PWjY8TE92 DySw== 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=5BmTvmpqVPdPXiWZLqUzgpWunx/nLJo3Onxdpacg0zI=; b=hg+p3DOkwH4XHukxzpeboJPa2CtvYra5pnvOlrIpCKwxy9YIdZ7khpylMv3/rkvKsK UvSS2xjh8jH5JZoZmka+3ZPFZLA4Ih3IvG2Y8v5h3Eti4A0GgcjVoBL0gpgKNWV51CBr IyiAbCxmq5FKncwr35nqHQQg5K+wzxqocr8M6PatPlsj8jK8IU+galHW6h8uW233NCyN Tk2+ws0iLWsr1ITulMjlIiXYqDGBAD3F750VkP7nGHd/BG/zzcDlDYh+WV2+bWECuIdo /PxA+rGBpITWwB0FtU3l5V+RphGnFCu7fVnj6KQ1VZWH4PBrTsPxIf7br1HqpCyBLccS 6kgg== X-Gm-Message-State: AOUpUlGVMFwu119ZOytexu7+L4g3YlLh1bOcIgEIiIZGaeG21Ir6epWH F1WF9iWTmgWimx0EPO8Q9cZXvg== X-Google-Smtp-Source: AA+uWPyV6VlTlRaeC+r3kKWHdhHVBLwAS1LLrrv0m4zb7VzKaj+yFJ5m6ik4UauW9bSl3bGOalwxjQ== X-Received: by 2002:a5d:4d8d:: with SMTP id b13-v6mr2149850wru.80.1533742463447; Wed, 08 Aug 2018 08:34:23 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.34.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:34:22 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 27/28] ARM: davinci: mityomapl138: use device properties for at24 eeprom Date: Wed, 8 Aug 2018 17:31:49 +0200 Message-Id: <20180808153150.23444-28-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_113435_061101_398B53FD X-CRM114-Status: GOOD ( 18.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want to work towards phasing out the at24_platform_data structure. There are few users and its contents can be represented using generic device properties. Using device properties only will allow us to significantly simplify the at24 configuration code. Remove the at24_platform_data structure and replace it with an array of property entries. Drop the byte_len/size property, as the model name already implies the EEPROM's size. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- arch/arm/mach-davinci/board-mityomapl138.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c index 17b67e26bc0e..be0fb7d17e25 100644 --- a/arch/arm/mach-davinci/board-mityomapl138.c +++ b/arch/arm/mach-davinci/board-mityomapl138.c @@ -14,11 +14,11 @@ #include #include #include +#include #include #include #include #include -#include #include #include #include @@ -185,10 +185,9 @@ static struct nvmem_cell_lookup mityomapl138_nvmem_cells[] = { } }; -static struct at24_platform_data mityomapl138_fd_chip = { - .byte_len = 256, - .page_size = 8, - .flags = AT24_FLAG_READONLY | AT24_FLAG_IRUGO, +static const struct property_entry mityomapl138_fd_chip_properties[] = { + PROPERTY_ENTRY_U32("pagesize", 8), + PROPERTY_ENTRY_BOOL("read-only"), }; static struct davinci_i2c_platform_data mityomap_i2c_0_pdata = { @@ -317,7 +316,7 @@ static struct i2c_board_info __initdata mityomap_tps65023_info[] = { }, { I2C_BOARD_INFO("24c02", 0x50), - .platform_data = &mityomapl138_fd_chip, + .properties = mityomapl138_fd_chip_properties, }, }; From patchwork Wed Aug 8 15:31:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560295 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 10BD1174A for ; Wed, 8 Aug 2018 15:56:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECD462B1A9 for ; Wed, 8 Aug 2018 15:55:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E02A32B1AD; Wed, 8 Aug 2018 15:55:59 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 36FC72B1A9 for ; Wed, 8 Aug 2018 15:55:59 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=3QoTrQ8Csc+gs7xDtr3fX2fCirfvIIlz8x5sEND8p8M=; b=PxEL6sZRfKNKrHI+cNSkWod4zX zVVhRDmckfymHMH6JfR0r7bHlw3+FSEGVrEUSLMLphESqopoFA1dYEquhJU9Fya6dQfUKb+7Y9GAF adIaCtiZE9whVTFFMGz/i+TUOAXXvGJykEZMW1RrarWD6fRL9GDQVIxkFKimBFvKmCMAoWb5Ub4qa HKD4RFq1JRRxcZAR8pZEOxRIQ8qwJ73WJqPpaI0HnyFxzJ9/i7jzNkNuw3etasmV3nhtDVXRT/hIS xPsx2zo7bnxsF9v9JBKT4ioAZTV79rHix2JDev2HwYrIprW0KJW1YCAsQ+wA/paRCOZXdti/b67E6 qKVdMW9A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQoS-0004hH-9w; Wed, 08 Aug 2018 15:55:52 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnQTs-0005BI-WD for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2018 15:35:05 +0000 Received: by mail-wm0-x244.google.com with SMTP id s12-v6so3209415wmc.0 for ; Wed, 08 Aug 2018 08:34:26 -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=zcgznE6S45cVW/uXU4633SP9xEXodj7KzWZ0OXtxtDk=; b=hp41/36Sz4I6u0BAoPv+5zcmevK1oBt8+72VIY5mpqFb1d8E5SyiqF0n+TQvluoGx5 ZBvrSbsC+/zMYtvp35XDQVxcjNkUiyi7zMB+kCfvL+R+vbRH99lP+ZojrJ1GLAxohb9n 1Q+XeZvvBGiAaCL9KyNprDvM247Q7FjoYwZK/SZs4P27IIYFQW07PA61KhpkKeYk1tqr jprIs4cBbtf7rx9v+WNk55rkVFgWwVR5IXf3bf0vZHF3s0UoOAWVY3I/t01ylLsDAF91 zdjb024MxCViihiWNqy6Ko7KWJOFK5Usc7GUlk4Ajjv4Xg5UDs7bGrG1xJSuVfX4HKEX 6Gjw== 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=zcgznE6S45cVW/uXU4633SP9xEXodj7KzWZ0OXtxtDk=; b=oixAad3S8ESYi+XHS962P0lpAgmn3jQw0xACXJH6hBVINMJjiGR2I9Es76+dVc+/pi 9+5exxraMx8pE9bdi3uHWFtlAPxGzhMqVpG2AajiRbxDUCSP4tJqhAZPQcxVSJT6CPoa cT/v8Ab/PYYyBWvG/v3tdpfj2nthhl+2L2aOAXZgENpxjZeohQV+DEyTlCL68YSdLrzu OMWUJ53Jl4DChPywEbj1JyG3VczilhgrEWHGbDDCvXyaC/3BC7ScYfIY9rrn7DJexYCI eQBL47FWATYsOLkpS4yJNHYWO92rRLpvFjEp0jsNC85iGF0DkMoy4w7j3hfqTI+etTc1 G6PA== X-Gm-Message-State: AOUpUlGN/eqYAsabKfABZ0LgWFTu4tRm1yuH9/tGItdAjwaQVYEavLn8 1K3pjAvk0VDxYNmMgHCN1Bo9Bg== X-Google-Smtp-Source: AA+uWPxLB52ys4SgAK5eYXVXXNnBWa/WBemSEpxtHR77QBXD+bjhZZRxO6B7g/dmrAM+5KRa19F+eA== X-Received: by 2002:a1c:e304:: with SMTP id a4-v6mr2241490wmh.0.1533742465354; Wed, 08 Aug 2018 08:34:25 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.34.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:34:24 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Subject: [PATCH 28/28] eeprom: at24: kill at24_platform_data Date: Wed, 8 Aug 2018 17:31:50 +0200 Message-Id: <20180808153150.23444-29-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180808_083437_462784_2879C544 X-CRM114-Status: GOOD ( 31.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski There are no more users of at24_platform_data. Remove the relevant header and modify the driver code to not use it anymore. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- MAINTAINERS | 1 - drivers/misc/eeprom/at24.c | 127 +++++++++++++---------------- include/linux/platform_data/at24.h | 60 -------------- 3 files changed, 57 insertions(+), 131 deletions(-) delete mode 100644 include/linux/platform_data/at24.h diff --git a/MAINTAINERS b/MAINTAINERS index 7cebd5bba8a8..8eb87a3548f8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2328,7 +2328,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git S: Maintained F: Documentation/devicetree/bindings/eeprom/at24.txt F: drivers/misc/eeprom/at24.c -F: include/linux/platform_data/at24.h ATA OVER ETHERNET (AOE) DRIVER M: "Ed L. Cashin" diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index f5cc517d1131..93642b4b47c5 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -22,10 +22,24 @@ #include #include #include -#include #include #include +/* Address pointer is 16 bit. */ +#define AT24_FLAG_ADDR16 BIT(7) +/* sysfs-entry will be read-only. */ +#define AT24_FLAG_READONLY BIT(6) +/* sysfs-entry will be world-readable. */ +#define AT24_FLAG_IRUGO BIT(5) +/* Take always 8 addresses (24c00). */ +#define AT24_FLAG_TAKE8ADDR BIT(4) +/* Factory-programmed serial number. */ +#define AT24_FLAG_SERIAL BIT(3) +/* Factory-programmed mac address. */ +#define AT24_FLAG_MAC BIT(2) +/* Does not auto-rollover reads to the next slave address. */ +#define AT24_FLAG_NO_RDROL BIT(1) + /* * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. * Differences between different vendor product lines (like Atmel AT24C or @@ -124,10 +138,6 @@ MODULE_PARM_DESC(at24_write_timeout, "Time (in ms) to try writes (default 25)"); usleep_range(1000, 1500), op_time = jiffies) struct at24_chip_data { - /* - * these fields mirror their equivalents in - * struct at24_platform_data - */ u32 byte_len; u8 flags; }; @@ -467,46 +477,11 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count) return 0; } -static void at24_properties_to_pdata(struct device *dev, - struct at24_platform_data *chip) -{ - int err; - u32 val; - - if (device_property_present(dev, "read-only")) - chip->flags |= AT24_FLAG_READONLY; - if (device_property_present(dev, "no-read-rollover")) - chip->flags |= AT24_FLAG_NO_RDROL; - - err = device_property_read_u32(dev, "size", &val); - if (!err) - chip->byte_len = val; - - err = device_property_read_u32(dev, "pagesize", &val); - if (!err) { - chip->page_size = val; - } else { - /* - * This is slow, but we can't know all eeproms, so we better - * play safe. Specifying custom eeprom-types via platform_data - * is recommended anyhow. - */ - chip->page_size = 1; - } -} - -static int at24_get_pdata(struct device *dev, struct at24_platform_data *pdata) +static const struct at24_chip_data *at24_get_chip_data(struct device *dev) { struct device_node *of_node = dev->of_node; const struct at24_chip_data *cdata; const struct i2c_device_id *id; - struct at24_platform_data *pd; - - pd = dev_get_platdata(dev); - if (pd) { - memcpy(pdata, pd, sizeof(*pdata)); - return 0; - } id = i2c_match_id(at24_ids, to_i2c_client(dev)); @@ -523,13 +498,9 @@ static int at24_get_pdata(struct device *dev, struct at24_platform_data *pdata) cdata = acpi_device_get_match_data(dev); if (!cdata) - return -ENODEV; + return ERR_PTR(-ENODEV); - pdata->byte_len = cdata->byte_len; - pdata->flags = cdata->flags; - at24_properties_to_pdata(dev, pdata); - - return 0; + return cdata; } static void at24_remove_dummy_clients(struct at24_data *at24) @@ -598,8 +569,9 @@ static int at24_probe(struct i2c_client *client) { struct regmap_config regmap_config = { }; struct nvmem_config nvmem_config = { }; - struct at24_platform_data pdata = { }; + const struct at24_chip_data *cdata; struct device *dev = &client->dev; + u32 byte_len, page_size, flags; bool i2c_fn_i2c, i2c_fn_block; unsigned int i, num_addresses; struct at24_data *at24; @@ -613,35 +585,54 @@ static int at24_probe(struct i2c_client *client) i2c_fn_block = i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WRITE_I2C_BLOCK); - err = at24_get_pdata(dev, &pdata); + cdata = at24_get_chip_data(dev); + if (IS_ERR(cdata)) + return PTR_ERR(cdata); + + err = device_property_read_u32(dev, "pagesize", &page_size); + if (err) + /* + * This is slow, but we can't know all eeproms, so we better + * play safe. Specifying custom eeprom-types via platform_data + * is recommended anyhow. + */ + page_size = 1; + + flags = cdata->flags; + if (device_property_present(dev, "read-only")) + flags |= AT24_FLAG_READONLY; + if (device_property_present(dev, "no-read-rollover")) + flags |= AT24_FLAG_NO_RDROL; + + err = device_property_read_u32(dev, "size", &byte_len); if (err) - return err; + byte_len = cdata->byte_len; if (!i2c_fn_i2c && !i2c_fn_block) - pdata.page_size = 1; + page_size = 1; - if (!pdata.page_size) { + if (!page_size) { dev_err(dev, "page_size must not be 0!\n"); return -EINVAL; } - if (!is_power_of_2(pdata.page_size)) + if (!is_power_of_2(page_size)) dev_warn(dev, "page_size looks suspicious (no power of 2)!\n"); - if (pdata.flags & AT24_FLAG_TAKE8ADDR) + if (flags & AT24_FLAG_TAKE8ADDR) num_addresses = 8; else - num_addresses = DIV_ROUND_UP(pdata.byte_len, - (pdata.flags & AT24_FLAG_ADDR16) ? 65536 : 256); + num_addresses = DIV_ROUND_UP(byte_len, + (flags & AT24_FLAG_ADDR16) ? 65536 : 256); - if ((pdata.flags & AT24_FLAG_SERIAL) && (pdata.flags & AT24_FLAG_MAC)) { + if ((flags & AT24_FLAG_SERIAL) && (flags & AT24_FLAG_MAC)) { dev_err(dev, "invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC."); return -EINVAL; } regmap_config.val_bits = 8; - regmap_config.reg_bits = (pdata.flags & AT24_FLAG_ADDR16) ? 16 : 8; + regmap_config.reg_bits = (flags & AT24_FLAG_ADDR16) ? 16 : 8; regmap_config.disable_locking = true; regmap = devm_regmap_init_i2c(client, ®map_config); @@ -654,11 +645,11 @@ static int at24_probe(struct i2c_client *client) return -ENOMEM; mutex_init(&at24->lock); - at24->byte_len = pdata.byte_len; - at24->page_size = pdata.page_size; - at24->flags = pdata.flags; + at24->byte_len = byte_len; + at24->page_size = page_size; + at24->flags = flags; at24->num_addresses = num_addresses; - at24->offset_adj = at24_get_offset_adj(pdata.flags, pdata.byte_len); + at24->offset_adj = at24_get_offset_adj(flags, byte_len); at24->client[0].client = client; at24->client[0].regmap = regmap; @@ -666,10 +657,10 @@ static int at24_probe(struct i2c_client *client) if (IS_ERR(at24->wp_gpio)) return PTR_ERR(at24->wp_gpio); - writable = !(pdata.flags & AT24_FLAG_READONLY); + writable = !(flags & AT24_FLAG_READONLY); if (writable) { at24->write_max = min_t(unsigned int, - pdata.page_size, at24_io_limit); + page_size, at24_io_limit); if (!i2c_fn_i2c && at24->write_max > I2C_SMBUS_BLOCK_MAX) at24->write_max = I2C_SMBUS_BLOCK_MAX; } @@ -712,7 +703,7 @@ static int at24_probe(struct i2c_client *client) nvmem_config.priv = at24; nvmem_config.stride = 1; nvmem_config.word_size = 1; - nvmem_config.size = pdata.byte_len; + nvmem_config.size = byte_len; at24->nvmem = devm_nvmem_register(dev, &nvmem_config); if (IS_ERR(at24->nvmem)) { @@ -721,13 +712,9 @@ static int at24_probe(struct i2c_client *client) } dev_info(dev, "%u byte %s EEPROM, %s, %u bytes/write\n", - pdata.byte_len, client->name, + byte_len, client->name, writable ? "writable" : "read-only", at24->write_max); - /* export data to kernel code */ - if (pdata.setup) - pdata.setup(at24->nvmem, pdata.context); - return 0; err_clients: diff --git a/include/linux/platform_data/at24.h b/include/linux/platform_data/at24.h deleted file mode 100644 index 63507ff464ee..000000000000 --- a/include/linux/platform_data/at24.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * at24.h - platform_data for the at24 (generic eeprom) driver - * (C) Copyright 2008 by Pengutronix - * (C) Copyright 2012 by Wolfram Sang - * same license as the driver - */ - -#ifndef _LINUX_AT24_H -#define _LINUX_AT24_H - -#include -#include -#include - -/** - * struct at24_platform_data - data to set up at24 (generic eeprom) driver - * @byte_len: size of eeprom in byte - * @page_size: number of byte which can be written in one go - * @flags: tunable options, check AT24_FLAG_* defines - * @setup: an optional callback invoked after eeprom is probed; enables kernel - code to access eeprom via nvmem, see example - * @context: optional parameter passed to setup() - * - * If you set up a custom eeprom type, please double-check the parameters. - * Especially page_size needs extra care, as you risk data loss if your value - * is bigger than what the chip actually supports! - * - * An example in pseudo code for a setup() callback: - * - * void get_mac_addr(struct nvmem_device *nvmem, void *context) - * { - * u8 *mac_addr = ethernet_pdata->mac_addr; - * off_t offset = context; - * - * // Read MAC addr from EEPROM - * if (nvmem_device_read(nvmem, offset, ETH_ALEN, mac_addr) == ETH_ALEN) - * pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr); - * } - * - * This function pointer and context can now be set up in at24_platform_data. - */ - -struct at24_platform_data { - u32 byte_len; /* size (sum of all addr) */ - u16 page_size; /* for writes */ - u8 flags; -#define AT24_FLAG_ADDR16 BIT(7) /* address pointer is 16 bit */ -#define AT24_FLAG_READONLY BIT(6) /* sysfs-entry will be read-only */ -#define AT24_FLAG_IRUGO BIT(5) /* sysfs-entry will be world-readable */ -#define AT24_FLAG_TAKE8ADDR BIT(4) /* take always 8 addresses (24c00) */ -#define AT24_FLAG_SERIAL BIT(3) /* factory-programmed serial number */ -#define AT24_FLAG_MAC BIT(2) /* factory-programmed mac address */ -#define AT24_FLAG_NO_RDROL BIT(1) /* does not auto-rollover reads to */ - /* the next slave address */ - - void (*setup)(struct nvmem_device *nvmem, void *context); - void *context; -}; - -#endif /* _LINUX_AT24_H */