From patchwork Tue Nov 13 14:01:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680765 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 418AA14DB for ; Tue, 13 Nov 2018 14:05:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EABD2896D for ; Tue, 13 Nov 2018 14:05:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C53528A31; Tue, 13 Nov 2018 14:05:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B28A2889C for ; Tue, 13 Nov 2018 14:05:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387679AbeKNAAO (ORCPT ); Tue, 13 Nov 2018 19:00:14 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:35387 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387569AbeKNAAN (ORCPT ); Tue, 13 Nov 2018 19:00:13 -0500 Received: by mail-wm1-f66.google.com with SMTP id t15-v6so11575461wmt.0 for ; Tue, 13 Nov 2018 06:01:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0uqZU8gDHiv/neEGi/hrgDK8MU/UOgRvLZjvxfNOd/I=; b=pXLEyYVi7xk0SDGCkD5Y1ijc20sYg43PO7FF5Ii9S7OMZMW80DFLiF+kCgRmUqxyiR o3bcuXYEa54fs2rggnBxWAa6iAM1kzvQVzhkWPUHnelnFzHhILejvVhWx3g3manDZ4xt Gfnhk0eLmrS2IAfQOJzCRBqP0kv1oT19u8VW0XkrHrnp+fob5e5aBYD4fbbBooLGPnOR a+0gn4pB9BDdohjzrBwvryRKmanWXkSSMBqmskFsDMAD2SaaseafMiaCt4zHSYjLLWbc C67jmWgjPFs5Lw0Css3+YkWBhQHRvMdQbfWwM99LWk0Y0ZB1eZg4dXVgb1y4EvJWfVEf fG8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0uqZU8gDHiv/neEGi/hrgDK8MU/UOgRvLZjvxfNOd/I=; b=NDBnvuDcN8xGgmUaX05b9hHqNWuc0Q8qKaYMNJgOZsxO55pEkAVDRFKHE4Fdtvf9tK dVixDR9AGznCHGhxrfvrXlpsjjtnZ1PRgET+3HJZycXElNwJ3n6CEEZyQMVreaa8l1f3 WPpLDDM7oyPZG0rZOseSyreNv/4BKF7HdSjyvPpQCKfBk4RBMlKeBf9LkkIbnJ2n7c/U dlnrTmnA9fMSNYXVFJonRfsH1Ucxj1CvIXkA6vQzULtbPiFCksI7IU1bblxldltj55xw XXgEofQg8YyilBG6+yF6CbESf/4whojL6+icKaPXJYGKbgTP08cV9IjXYoklonGXBt0c 1CLQ== X-Gm-Message-State: AGRZ1gIgmHuBEZ4IE3aNGz7Lcj3/L5480oQbOKkv8/+ni+SOOx5OTqgh 8D3JKQj+96EXkcnjhccikexpfw== X-Google-Smtp-Source: AJdET5cGhZk6/cOVbPrvR9ypywUUj8C/WS5YdF9VjGZLtBZXxc7blVkWSGEcBSlK5+2a4sBzMvRZVw== X-Received: by 2002:a1c:7fc1:: with SMTP id a184mr1113108wmd.55.1542117715063; Tue, 13 Nov 2018 06:01:55 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.01.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:01:54 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 01/25] nvmem: add new config option Date: Tue, 13 Nov 2018 15:01:09 +0100 Message-Id: <20181113140133.17385-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want to add nvmem support for MTD. TI DaVinci is the first platform that will be using it, but only in non-DT mode. In order not to introduce any new interface to supporting of which we would have to commit - add a new config option that tells nvmem not to use the DT node of the parent device. This way we won't be creating nvmem devices corresponding with MTD partitions defined in device tree. By default MTD will set this new field to true. Once a set of bindings for MTD nvmem cells is agreed upon, we'll be able to remove this option. Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/core.c | 3 ++- include/linux/nvmem-provider.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 9b18ce90f907..ac7971e8154e 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -604,7 +604,8 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) nvmem->priv = config->priv; nvmem->reg_read = config->reg_read; nvmem->reg_write = config->reg_write; - nvmem->dev.of_node = config->dev->of_node; + if (!config->no_of_node) + nvmem->dev.of_node = config->dev->of_node; if (config->id == -1 && config->name) { dev_set_name(&nvmem->dev, "%s", config->name); diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 1e3283c2af77..e53545e9852b 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -30,6 +30,7 @@ typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset, * @ncells: Number of elements in cells. * @read_only: Device is read-only. * @root_only: Device is accessibly to root only. + * @no_of_node: Device should not use the parent's of_node even if it's !NULL. * @reg_read: Callback to read data. * @reg_write: Callback to write data. * @size: Device size. @@ -53,6 +54,7 @@ struct nvmem_config { int ncells; bool read_only; bool root_only; + bool no_of_node; nvmem_reg_read_t reg_read; nvmem_reg_write_t reg_write; int size; From patchwork Tue Nov 13 14:01:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680701 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 AC3E714DB for ; Tue, 13 Nov 2018 14:02:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A4772A99F for ; Tue, 13 Nov 2018 14:02:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DF5F2A9B5; Tue, 13 Nov 2018 14:02: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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 073472A99F for ; Tue, 13 Nov 2018 14:02:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387698AbeKNAAQ (ORCPT ); Tue, 13 Nov 2018 19:00:16 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:43419 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387649AbeKNAAP (ORCPT ); Tue, 13 Nov 2018 19:00:15 -0500 Received: by mail-wr1-f66.google.com with SMTP id y3-v6so13410939wrh.10 for ; Tue, 13 Nov 2018 06:01:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ksw4hZ+0N23CBRzViPcOA1hnkMZq7TwewkS2aWR80tA=; b=1ikfHGcPDC7civleiORZ2R6ytLyQkE+DF3bz38/TlgOGb4db6Pb5oyhZCqXDaGbq9u DMPdIAFqsnfD+HrHgIQRcFmJaUKvccb3hcn6kXpyiVb5WWDx8MKiSsTIKNeBAqS12BmK WTGRTHXYdtkpZ4bXgwIK9/EQ06exjzKtDLzIv0x9ygty09EtOkezSa7WPzHm/dtfUVc0 3TM292Mj0wUaEsBOyUFj3K1IrRLUtm6dISO4RJGy7DiDHtY+lmfEZpEdrXRWQq/44uqt jGXp6oIku4gvdtFVjyTgRR7z9WmtcqiX44GF0l5Msezrhrptp4uLgVx/09rGO1tOlIai c0QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ksw4hZ+0N23CBRzViPcOA1hnkMZq7TwewkS2aWR80tA=; b=Kr3IAlus8/lsxjVoLTITr+suYx/Tluqw3BH7cpCfxjFpRYikSDespugGiCUqcmPrmc HAWNiid9VKxXQYNBfr08QTGZnj29HP0mZZiRbwTegtZ5uzex1iPp14805fQ5jrWEDBb1 a41W05GE2ukIJCeC5GTHealn6+xfLD722j+4dNfFo+Np7VOnVH8U31oG9plf1NxFROCE 5CksJVpnjuRIOZ+K37xWvPF0ekB632ty5Pmpx7qvOhmtRXKMHG6yXRwgUp4gBHY9GbZm 20QmVIJu2utLAU8BQoEI9Fx4CRhjW5cjFb/iSfC4rAZp06lgPe3GtRDqfAGlMkKrrOF9 ba7A== X-Gm-Message-State: AGRZ1gLt6YLZHDFH5+5uxsj630pooOdZ/x0AAwNXoky0/qaGS3z8Gmi2 XDaltojn02+pI6cv+GTfbdU6Rg== X-Google-Smtp-Source: AJdET5ckp3K70W7StwZJeboEAtFKzDmx/OnuA1iLeoinTgd75JyxZfX9FHcefhNMMtZoneFrPyq7Mg== X-Received: by 2002:adf:eb0b:: with SMTP id s11-v6mr5036642wrn.102.1542117716930; Tue, 13 Nov 2018 06:01:56 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.01.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:01:56 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Alban Bedel , Bartosz Golaszewski Subject: [PATCH v2 02/25] mtd: add support for reading MTD devices via the nvmem API Date: Tue, 13 Nov 2018 15:01:10 +0100 Message-Id: <20181113140133.17385-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: 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. We don't support device tree systems for now. Signed-off-by: Alban Bedel [Bartosz: - include linux/nvmem-provider.h - set the name of the nvmem provider - set no_of_node to true in nvmem_config - don't check the return value of nvmem_unregister() - it cannot fail - tweaked the commit message] Signed-off-by: Bartosz Golaszewski Acked-by: Boris Brezillon --- drivers/mtd/Kconfig | 1 + drivers/mtd/mtdcore.c | 56 +++++++++++++++++++++++++++++++++++++++++ include/linux/mtd/mtd.h | 2 ++ 3 files changed, 59 insertions(+) diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig index c77f537323ec..efbe7a6f1d8f 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 97ac219c082e..5f1053d995b0 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -488,6 +489,50 @@ 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.name = mtd->name; + config.owner = THIS_MODULE; + 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.no_of_node = true; + config.priv = mtd; + + mtd->nvmem = nvmem_register(&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 +615,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 +645,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); @@ -637,6 +689,10 @@ int del_mtd_device(struct mtd_info *mtd) mtd->index, mtd->name, mtd->usecount); ret = -EBUSY; } else { + /* Try to remove the NVMEM provider */ + if (mtd->nvmem) + nvmem_unregister(mtd->nvmem); + device_unregister(&mtd->dev); idr_remove(&mtd_idr, mtd->index); diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index cd0be91bdefa..545070c2ee64 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -341,6 +342,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 Tue Nov 13 14:01:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680703 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 D02F414DB for ; Tue, 13 Nov 2018 14:02:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEBEF2A98B for ; Tue, 13 Nov 2018 14:02:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2C952A9B1; Tue, 13 Nov 2018 14:02:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 385BE2A9AD for ; Tue, 13 Nov 2018 14:02:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387701AbeKNAAR (ORCPT ); Tue, 13 Nov 2018 19:00:17 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36548 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387695AbeKNAAQ (ORCPT ); Tue, 13 Nov 2018 19:00:16 -0500 Received: by mail-wm1-f67.google.com with SMTP id s11so2180563wmh.1 for ; Tue, 13 Nov 2018 06:01:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gfq4XRjjbAnhbxC0lgPGakIYrPJx0tENtiXKTaGI3BI=; b=flIOjd+6kFlVvUssc1XI60NRDkppc7AOUcbQs8WkhSZGBtFjuBtU92y0kC3j5xhchk EipnF51qbtzluJ7dOwyp2IZKZnW0goqSf4MX/Em6jBiAZ4t4o9vhyxHZMfmAR5t+0HNB Ys3aiIuvhVa/+O3hF79UN7yh33qkyNEaBHuoHtVGfnGn5wbe9z2H+eo+f1Zc3FbVJmFH 8wnPA/EP0FnSaiP9QX43G6lCFSupgWHMp9SxOXaEZSK+jonH5iwJ7bJ9LqtGYSorTV7D +WVQzV15CLUc45vAnldhnf018i57oWUwEnopThjG6YXezJDiQrsT0rb0PF0ZQqXACH93 udbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gfq4XRjjbAnhbxC0lgPGakIYrPJx0tENtiXKTaGI3BI=; b=AaiYbYxbsBvey8ajRvjc6hXBF2BCkyQbk8EHtFjCGifdMwxrILhHKWsGbeMW4yGEGk /uceKknxyLrFWwULpzuNT1q4BjWcsWfoaO7FfFrQVNxRxkL453pyD/ws50VkePNDHRQ0 bkWlY19lkfMBZlyBXnkKKxq/Hr+BAFvoKScQ1lR1JQvSzGav3B4BxhVekiR7usp/4t2d NFeUIKsxj7SGTazYIsuaQne0lpJdrfI9mEXyTeBjiE17aRt6VuU47PmHO7qvNXrbyxm6 6IKMsKQ3XK6yPTVvqUztiKiqNOL4PhraWcpwlodaYrpX2C16rTCgXro4ub6Jn6QkWbm3 CIcg== X-Gm-Message-State: AGRZ1gKSUobbumKfUNVLu3px9uTA5sDJ8a4AjNz7HHGz3n5GmKbsX05Q WR8Yy/chVI+SSsv/PtKWYxPlUA== X-Google-Smtp-Source: AJdET5dVFYdef5NnXnoThRlxYuwormlMCw9pHVyvcwkVBO5TMKrATK3PcV48UNjo/+oa88y/xv/4uw== X-Received: by 2002:a1c:58c5:: with SMTP id m188-v6mr3181760wmb.85.1542117718885; Tue, 13 Nov 2018 06:01:58 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.01.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:01:58 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 03/25] ARM: davinci: dm365-evm: use cell nvmem lookup for mac address Date: Tue, 13 Nov 2018 15:01:11 +0100 Message-Id: <20181113140133.17385-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support nvmem lookups and cell definitions for machine code. Add relevant data structures for the mac-address stored in at24 EEPROM. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-dm365-evm.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c index 8143756ff38b..8703fc18dd3b 100644 --- a/arch/arm/mach-davinci/board-dm365-evm.c +++ b/arch/arm/mach-davinci/board-dm365-evm.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -203,6 +204,27 @@ static struct platform_device davinci_aemif_device = { .num_resources = ARRAY_SIZE(davinci_aemif_resources), }; +static struct nvmem_cell_info davinci_nvmem_cells[] = { + { + .name = "macaddr", + .offset = 0x7f00, + .bytes = ETH_ALEN, + } +}; + +static struct nvmem_cell_table davinci_nvmem_cell_table = { + .nvmem_name = "1-00500", + .cells = davinci_nvmem_cells, + .ncells = ARRAY_SIZE(davinci_nvmem_cells), +}; + +static struct nvmem_cell_lookup davinci_nvmem_cell_lookup = { + .nvmem_name = "1-00500", + .cell_name = "macaddr", + .dev_id = "davinci_emac.1", + .con_id = "mac-address", +}; + static struct at24_platform_data eeprom_info = { .byte_len = (256*1024) / 8, .page_size = 64, @@ -781,6 +803,9 @@ static __init void dm365_evm_init(void) if (ret) pr_warn("%s: GPIO init failed: %d\n", __func__, ret); + nvmem_add_cell_table(&davinci_nvmem_cell_table); + nvmem_add_cell_lookups(&davinci_nvmem_cell_lookup, 1); + evm_init_i2c(); davinci_serial_init(dm365_serial_device); From patchwork Tue Nov 13 14:01:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680761 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 EAD4014E2 for ; Tue, 13 Nov 2018 14:05:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D686926E74 for ; Tue, 13 Nov 2018 14:05:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7AD32894D; Tue, 13 Nov 2018 14:05:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CC3A26E74 for ; Tue, 13 Nov 2018 14:05:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387728AbeKNADp (ORCPT ); Tue, 13 Nov 2018 19:03:45 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:33108 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387732AbeKNAAT (ORCPT ); Tue, 13 Nov 2018 19:00:19 -0500 Received: by mail-wm1-f67.google.com with SMTP id f19-v6so11281653wmb.0 for ; Tue, 13 Nov 2018 06:02:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=H8x7i2Y0NQGhPOwYVcZG4ieMSrsXoI3OcuJ/XVYngLQ=; b=hPfwQE70p7pPEvw9+TUWD5NNH4b9dL17YrJaEUNEtZ7KYndN9V+FdRwV5aYAMttn0v QXve1XUIFOuEJJRuCd1VqaBj5QqxVpR9PMgABcgvfqvwoSl0undeasFfaTHFdE4oMd99 NcpL+1vyCCTTCfw1FOPmuveSOihp2RQpm3badhB9t273Qfu75hsUKkZx6PVqGP2zSMAJ M26MNR9rMwfRrVJYb4xVlmgb06t1aAnvUvPlHJ0ObUd95oNDAVMKAyVLecHO/OHTS9yf ejOGxnb6Vpp0Gmee1NYG2V4oHSrfk/ZF1Xcg9k9Z4EcjX+pATrJuI8AN4Lo8A7xNiw/7 /eNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H8x7i2Y0NQGhPOwYVcZG4ieMSrsXoI3OcuJ/XVYngLQ=; b=MM8IZbyyY7bhTrgFTMOmPU6IynKYZ7Nb2SxPqWRHVMtFge0HchQcLbeMt33ITkhaeu QUoGSlhdS8QqVxPTsx+UBzQKTc8ASyI7ZoMceICDIlmsed96h6kokUJbWN4VcPwRWjv+ SIe8OBqRFSQjrBQ1JeUjSYK6KkTRQKk+4mKVX8CBG2MHdcOb2hxNpSolzhWF/REMkf6O aHo56IUOvxP2iJQW4l7fD98bR0c41P8eQ4S4+3pp+DeWCuOmY6tG/UNq/AJggUi6EoV+ dHrvJXPluredsnnCzS7XeEMlzMdt4hqOoR3vzL/9Lujyb9t8YGvVF8e0GE6QFLP6ybSJ YBSg== X-Gm-Message-State: AGRZ1gIBmxg0q+Ciim/8tCSIODYjbOIdFX/zT7GN6LbW9fWaMOjPJZ6u Q/cXOZbskVVxzt9wISPOeTnf/g== X-Google-Smtp-Source: AJdET5dFcmh9LMc8AGT0EEsXUesVg/vqWwWx5Zo9mOUI6KdJwAKlRZQfUs9KoHRfAeOBsCksGprZXg== X-Received: by 2002:a1c:bc82:: with SMTP id m124-v6mr3337326wmf.76.1542117720757; Tue, 13 Nov 2018 06:02:00 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.01.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:00 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 04/25] ARM: davinci: dm644x-evm: use cell nvmem lookup for mac address Date: Tue, 13 Nov 2018 15:01:12 +0100 Message-Id: <20181113140133.17385-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support nvmem lookups and cell definitions for machine code. Add relevant data structures for the mac-address stored in at24 EEPROM. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-dm644x-evm.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index e4a8f9225d16..e1428115067f 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -510,6 +511,27 @@ static struct pcf857x_platform_data pcf_data_u35 = { * - ... newer boards may have more */ +static struct nvmem_cell_info dm644evm_nvmem_cells[] = { + { + .name = "macaddr", + .offset = 0x7f00, + .bytes = ETH_ALEN, + } +}; + +static struct nvmem_cell_table dm644evm_nvmem_cell_table = { + .nvmem_name = "1-00500", + .cells = dm644evm_nvmem_cells, + .ncells = ARRAY_SIZE(dm644evm_nvmem_cells), +}; + +static struct nvmem_cell_lookup dm644evm_nvmem_cell_lookup = { + .nvmem_name = "1-00500", + .cell_name = "macaddr", + .dev_id = "davinci_emac.1", + .con_id = "mac-address", +}; + static struct at24_platform_data eeprom_info = { .byte_len = (256*1024) / 8, .page_size = 64, @@ -842,6 +864,8 @@ static __init void davinci_evm_init(void) platform_add_devices(davinci_evm_devices, ARRAY_SIZE(davinci_evm_devices)); #ifdef CONFIG_I2C + nvmem_add_cell_table(&dm644evm_nvmem_cell_table); + nvmem_add_cell_lookups(&dm644evm_nvmem_cell_lookup, 1); evm_init_i2c(); davinci_setup_mmc(0, &dm6446evm_mmc_config); #endif From patchwork Tue Nov 13 14:01:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680705 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 6A38718F0 for ; Tue, 13 Nov 2018 14:02:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 599E72A99C for ; Tue, 13 Nov 2018 14:02:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5457B2A9B3; Tue, 13 Nov 2018 14:02: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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED0D02A9B4 for ; Tue, 13 Nov 2018 14:02:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387721AbeKNAAU (ORCPT ); Tue, 13 Nov 2018 19:00:20 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:37544 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387742AbeKNAAU (ORCPT ); Tue, 13 Nov 2018 19:00:20 -0500 Received: by mail-wm1-f67.google.com with SMTP id p2-v6so11484407wmc.2 for ; Tue, 13 Nov 2018 06:02:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9klMrKm/3PJPsH9a0HqCufZa/6Vrvj6NDHHgs6SRwqk=; b=jDdFw9kRW9gcJvRRdAZyjHYhnvNLGzy+wQsmSewMZw3DgFsy0N44E2WjOqJg63UxgX 3Z7tsCFbJDX/A1LvBBFuQI7ansJBzUW3ylklFfSQDmxSjVvA5gYoOPZOtQr86pYHhn3b C6agZtyhqW6wai5t3iC9y1MVTAgU7XJLCDHokBZ0C8Xcg2D8ZF23aj4kDiyjyAoC1CuS fXrN48zjXbOe5evTX8KZwLoP9WuQT4+gM69XqzU8vucZ6Kf6NWOE6QzgnhQg7LXd05cQ UgKZEqOKo9bBDwcjVE93vxVDw3XSQ1UPjJg+nC0g8PCgbOcw38bnkfYgAWAH5G4tHsFP +4Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9klMrKm/3PJPsH9a0HqCufZa/6Vrvj6NDHHgs6SRwqk=; b=fARghBEIEPsmlHHdfaPi4WDnPf7hGssZ8yGsG+/C1DyvRA1mp33oZyMgZiKe7n2LJY Jmq/Ysgcslby6VnTehUiBzdzL1ri2L1vuBTbcvnfIFqiivUU6hum0LSsfGUsf8TVumWX vn7VNVw9ZdjHgx5UB7IwE9QI8s7TeBptHJjyMgoBUhZHrad6XT5d5+7um/f0D7rjcu2t TgwkAHlRpxVvkXyyC6h/hSonVwb20lxzVv8n8cju01bCsFypsMImZ7cTjH2mpLZMAI61 g6D4kCpWeN0Wcep+zrkywBcyFW7dgXoJEKxM4CDSki8Kq5yTjK+9HQ5JvD0eyuRLO3SB yvfQ== X-Gm-Message-State: AGRZ1gLbPK9iTIiXY0/ju5y1YWkR42mI9P/ZNo4JHu2zIHBAyHSrf5eB ZCGd7CnvFmPBAAj7ZdexqP9ldg== X-Google-Smtp-Source: AJdET5eh9qS2xiVsYcwo2W/msU20vv4lzowJVug19BE2Xd2dwUU26CVKyFE+TK95TPRYawmJ6efSsg== X-Received: by 2002:a1c:730b:: with SMTP id d11-v6mr3319072wmb.107.1542117722512; Tue, 13 Nov 2018 06:02:02 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:01 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 05/25] ARM: davinci: dm646x-evm: use cell nvmem lookup for mac address Date: Tue, 13 Nov 2018 15:01:13 +0100 Message-Id: <20181113140133.17385-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support nvmem lookups and cell definitions for machine code. Add relevant data structures for the mac-address stored in at24 EEPROM. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-dm646x-evm.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c index 3e5ee09ee717..8d5be6dd2019 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -342,6 +343,27 @@ static struct pcf857x_platform_data pcf_data = { * - ... newer boards may have more */ +static struct nvmem_cell_info dm646x_evm_nvmem_cells[] = { + { + .name = "macaddr", + .offset = 0x7f00, + .bytes = ETH_ALEN, + } +}; + +static struct nvmem_cell_table dm646x_evm_nvmem_cell_table = { + .nvmem_name = "1-00500", + .cells = dm646x_evm_nvmem_cells, + .ncells = ARRAY_SIZE(dm646x_evm_nvmem_cells), +}; + +static struct nvmem_cell_lookup dm646x_evm_nvmem_cell_lookup = { + .nvmem_name = "1-00500", + .cell_name = "macaddr", + .dev_id = "davinci_emac.1", + .con_id = "mac-address", +}; + static struct at24_platform_data eeprom_info = { .byte_len = (256*1024) / 8, .page_size = 64, @@ -815,6 +837,8 @@ static __init void evm_init(void) pr_warn("%s: GPIO init failed: %d\n", __func__, ret); #ifdef CONFIG_I2C + nvmem_add_cell_table(&dm646x_evm_nvmem_cell_table); + nvmem_add_cell_lookups(&dm646x_evm_nvmem_cell_lookup, 1); evm_init_i2c(); #endif From patchwork Tue Nov 13 14:01:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680759 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 B0AA614DB for ; Tue, 13 Nov 2018 14:05:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F6A726E74 for ; Tue, 13 Nov 2018 14:05:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 901FD28800; Tue, 13 Nov 2018 14:05:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 358E926E74 for ; Tue, 13 Nov 2018 14:05:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388179AbeKNADa (ORCPT ); Tue, 13 Nov 2018 19:03:30 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:51355 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387728AbeKNAAW (ORCPT ); Tue, 13 Nov 2018 19:00:22 -0500 Received: by mail-wm1-f68.google.com with SMTP id w7-v6so12036033wmc.1 for ; Tue, 13 Nov 2018 06:02:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MBcgf2nPd9qfbo4Sweh/oy//ofcxfsuOB7x8NJzIAM8=; b=s82lrLNEYvwtPScP0erBPVI689DjeHX8K4Z2YOKi/1SbNbd5eo7CfaNHSJrgMzuut8 zO9Bk5ivNlOydFEoQPPxnbcqLp/U4mY2k4zRm7qjZMBma4vcA71t7SDjzF2DoXfqwRUk laP2HhyYakJMGwV8sacGOq2A3J7+j4hCQKw5rnguQdLzm4fWk1zrLnNZVbaPz6T8yl+D GEjGlToCDSuoQyN/7vRoBRg59OXWmif238qYqlvAuxVy+dukgnvPQqlnJBwOp3e6FNF0 5ax3cKWrCE+n/67huJiBalkiyMjGD5PL/H+thxMH3HmaxR5DpbPPGcTbx+wXAjfqxZ+I I6fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MBcgf2nPd9qfbo4Sweh/oy//ofcxfsuOB7x8NJzIAM8=; b=QClq723uuySQR3ghWNVNb/hnMhaoLN8VB1gSvIF3+Z4Ib0MBbqNEaXMlmeCOjCkpd7 4rwG4cqepL2tq2LBcx4O4cdHJo4NCr1+jtrEAXsnViTAnnX/XTXKCpjxFJ9sq8mhH7Ts ndim/mzce3zYPSmnPPSW7zLq7vToW5XHy26d6+ZeN+YxgJ1St3GqFl6geIH2tTKZg8Qq oIDMxy6YLV6ey+GXR80nQ7zfpB+ewYsqbGP2IpSUID+u2J7rC/eWQ3c2AZ5tq4soqZzN RtFvCoWvbbeYuDvedpHPZHqzJCW7oUGxBadCXd/IORG8TX4ZjENPI3krRBwu2SR9+XGO 8x2A== X-Gm-Message-State: AGRZ1gKhI/owuoJSZpjKWMxNryUxK1+sH3COYrW/8IlHmSyEKPzVimHi aJEfTqh+G+pwk3L8YsKorMm50g== X-Google-Smtp-Source: AJdET5eo0yk9C4P5t7GkAu/UgDBxNFHT6slEZbPHc0cit4MGTQjXPt6qB9J90xv8PBV774TU6lRppQ== X-Received: by 2002:a7b:c7d3:: with SMTP id z19-v6mr3147764wmk.151.1542117724688; Tue, 13 Nov 2018 06:02:04 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:03 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 06/25] ARM: davinci: da830-evm: use cell nvmem lookup for mac address Date: Tue, 13 Nov 2018 15:01:14 +0100 Message-Id: <20181113140133.17385-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support nvmem lookups and cell definitions for machine code. Add relevant data structures for the mac-address stored in at24 EEPROM. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-da830-evm.c | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index 7d8ab36ff83d..e52ec1619b70 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -435,6 +436,27 @@ 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_info da830_evm_nvmem_cells[] = { + { + .name = "macaddr", + .offset = 0x7f00, + .bytes = ETH_ALEN, + } +}; + +static struct nvmem_cell_table da830_evm_nvmem_cell_table = { + .nvmem_name = "1-00500", + .cells = da830_evm_nvmem_cells, + .ncells = ARRAY_SIZE(da830_evm_nvmem_cells), +}; + +static struct nvmem_cell_lookup da830_evm_nvmem_cell_lookup = { + .nvmem_name = "1-00500", + .cell_name = "macaddr", + .dev_id = "davinci_emac.1", + .con_id = "mac-address", +}; + static struct at24_platform_data da830_evm_i2c_eeprom_info = { .byte_len = SZ_256K / 8, .page_size = 64, @@ -620,6 +642,10 @@ static __init void da830_evm_init(void) __func__, ret); davinci_serial_init(da8xx_serial_device); + + nvmem_add_cell_table(&da830_evm_nvmem_cell_table); + nvmem_add_cell_lookups(&da830_evm_nvmem_cell_lookup, 1); + i2c_register_board_info(1, da830_evm_i2c_devices, ARRAY_SIZE(da830_evm_i2c_devices)); From patchwork Tue Nov 13 14:01:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680709 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 BBC8614DB for ; Tue, 13 Nov 2018 14:02:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAB972A99C for ; Tue, 13 Nov 2018 14:02:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E78E2A9B8; Tue, 13 Nov 2018 14:02: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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 330F32A99C for ; Tue, 13 Nov 2018 14:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387806AbeKNAA0 (ORCPT ); Tue, 13 Nov 2018 19:00:26 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33086 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387790AbeKNAAY (ORCPT ); Tue, 13 Nov 2018 19:00:24 -0500 Received: by mail-wr1-f68.google.com with SMTP id u9-v6so13458676wrr.0 for ; Tue, 13 Nov 2018 06:02:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0nBaGmCe8u5S4UVpGAAxUhIXM3J5gHJ7tC52GdLpEYw=; b=2JE+mT1MHwAJB9tMw7ZKBp/ZTRI9D1TvxAJJi+MOUi9GyzhUTfoCywDSOLBlpvnf9u LLdzWD/qqqRyaGwTmvCZh82uJVEXArdE5iGRdZshN2ym4q9Bt510dJ1jcLdpVIAfk2TK 7r65XjuS+KsX6897coZMa4La9TbNLn1R9fIFw61FXKyHr1KLBXmoEuwPzX6oVKZaObiZ ULWBfXRMOgXsFHb9fszKVRQEWnEUoLM4d4mv7py/Me2OK5iOoX+bo+pB0O05aPojZbMC Pw4N7k77lPVTvbsc7xJYpH1l9dRWJBsTqXuDn6D090NhjL/36px6Bm3m62WXPxKiApWd jAXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0nBaGmCe8u5S4UVpGAAxUhIXM3J5gHJ7tC52GdLpEYw=; b=qEf7zclwdnjh28y4OQYE1KpdtMbLIbL0AW2wnYqDLLbGAVeWXT4SHws5CNQeKhaLXm aAYNGQWIz4kbff5w4He7wh31SKhFcKMMHmGGJzVZPdrf5fUtHB1R61Cuaji+ERD6khO1 4BjaR2KS7rZL0Uzy+ixQWDVeaG8Leom0FV/TEsVGshjC2MpWPO5Z2e0GXuNBFAj+S6E6 54PqHjic60Harj57P3lFIypa0lZnUwaYh3CupmYe/20n+24fUNgv+hKeFz9e+BqfWPxJ TeV6BJUCkAL+DN6k1VK6ZNEuJ/KOzwK2jcDd/pQTlS0BDZY9sKvW5Zk3jaQHRvO/CpNC zzHQ== X-Gm-Message-State: AGRZ1gKdrjqVLxuN6d5F/jEIQliXQfygTenh2U7Ds3UrvHpt8GY0yjIx sLuvmmDN6qrxtHNUarMyRhVloQ== X-Google-Smtp-Source: AJdET5edcxTPvfdf26vGBHt0p8MJGe74nWAFbrLFpUABbvq1P0sFXZKijao2Y5aEZMtYGy8ZPU627Q== X-Received: by 2002:adf:93e6:: with SMTP id 93-v6mr4932479wrp.311.1542117726462; Tue, 13 Nov 2018 06:02:06 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:05 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 07/25] ARM: davinci: mityomapl138: use cell nvmem lookup for mac address Date: Tue, 13 Nov 2018 15:01:15 +0100 Message-Id: <20181113140133.17385-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support nvmem lookups and cell definitions for machine code. Add relevant data structures for the mac-address stored in at24 EEPROM. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-mityomapl138.c | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c index 2933e0c87cfa..8df16e81b69e 100644 --- a/arch/arm/mach-davinci/board-mityomapl138.c +++ b/arch/arm/mach-davinci/board-mityomapl138.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -161,6 +162,31 @@ static void read_factory_config(struct nvmem_device *nvmem, void *context) mityomapl138_cpufreq_init(partnum); } +/* + * We don't define a cell for factory config as it will be accessed from the + * board file using the nvmem notifier chain. + */ +static struct nvmem_cell_info mityomapl138_nvmem_cells[] = { + { + .name = "macaddr", + .offset = 0x64, + .bytes = ETH_ALEN, + } +}; + +static struct nvmem_cell_table mityomapl138_nvmem_cell_table = { + .nvmem_name = "1-00500", + .cells = mityomapl138_nvmem_cells, + .ncells = ARRAY_SIZE(mityomapl138_nvmem_cells), +}; + +static struct nvmem_cell_lookup mityomapl138_nvmem_cell_lookup = { + .nvmem_name = "1-00500", + .cell_name = "macaddr", + .dev_id = "davinci_emac.1", + .con_id = "mac-address", +}; + static struct at24_platform_data mityomapl138_fd_chip = { .byte_len = 256, .page_size = 8, @@ -543,6 +569,9 @@ static void __init mityomapl138_init(void) davinci_serial_init(da8xx_serial_device); + nvmem_add_cell_table(&mityomapl138_nvmem_cell_table); + nvmem_add_cell_lookups(&mityomapl138_nvmem_cell_lookup, 1); + ret = da8xx_register_i2c(0, &mityomap_i2c_0_pdata); if (ret) pr_warn("i2c0 registration failed: %d\n", ret); From patchwork Tue Nov 13 14:01:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680757 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 7ECFF14E2 for ; Tue, 13 Nov 2018 14:05:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69FE026E74 for ; Tue, 13 Nov 2018 14:05:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C8D128684; Tue, 13 Nov 2018 14:05:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5A2426E74 for ; Tue, 13 Nov 2018 14:05:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733293AbeKNAD3 (ORCPT ); Tue, 13 Nov 2018 19:03:29 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:35714 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387792AbeKNAA0 (ORCPT ); Tue, 13 Nov 2018 19:00:26 -0500 Received: by mail-wr1-f66.google.com with SMTP id z16-v6so13461721wrv.2 for ; Tue, 13 Nov 2018 06:02:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2dGXQZPFaTjyJ9mbBpSbIbBRV6cQuE8HcUaZBf8FEvM=; b=vO//26UF3txJxtF/2FCpjLmGd2dVHLNEN4upAAl6DlwQOZBtNjhOd7m652wyigewuB vM70iRUYi0eXzIuma6nuWHxed3jdh3GzpMtfIPEC4if70duX2MOLSrKqeyCb4B1NkQFd S4Iw7UqriQGMsUqkEUlNPbXVL67xhSoRsr/VUXn9jIrZDbuYqXqBRjFJ3oxg4wQI0UYt ZGeBxHJVDGPjsSvBiBB5fXl876Km+cBW4QVdOqGUEd3PKnd4TqpXzW/aOoHVuhZenq/2 jYbvQYQCdWm0F/1iiDJXRnO4wC0gN7YNSNaulIS4pX7pw3JCdligOFr9VfFpSXGs9MM7 T1Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2dGXQZPFaTjyJ9mbBpSbIbBRV6cQuE8HcUaZBf8FEvM=; b=NdCpXdo3uIBCaBLG59x6+SbOlsXEN5+0Vg7UrnACIRV78wthASN4olYTVfNHftxRZ7 yJ3Z9z3eGnSNjqat35zrAIq/1Xd6fimSfM1hgrMq3rCwUeVG/Uhak9ED24/bqxv3yy72 QAgtHUdFqw2OZrz961m8H+iy9iYhlxnBb1iLtyvvJFtTDTO4zwRpAK0scGn5TLleOSO9 NWc5Vkc84ER9Xlapm1WjoJymA3yIviOjCd7lxyAefruP7GTXmNJkpnWRBt8Y8hr6ENPZ sqlAU0ACL/Dr80Spj9DFcn/cbyqIUiDZBH5J7CLGBC89V9wXnOYbknxALUKE4NwcdfCc 9sng== X-Gm-Message-State: AGRZ1gKyRPnbUiQPNdbuZRhfcDDLQFYxMStJqcZ3zi7m/8BzG3+4miZn EFNIXuMjxrpPbDkGmrL6cTcGyQ== X-Google-Smtp-Source: AJdET5dZ1kKaEOAo9CCIMFvceqpnOF650fkNUXufEbms5NWmS8ZOjj3kjC8ZSJ0SgytoS9e22Cz6kA== X-Received: by 2002:adf:eb0b:: with SMTP id s11-v6mr5037323wrn.102.1542117728193; Tue, 13 Nov 2018 06:02:08 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:07 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 08/25] ARM: davinci: dm850-evm: use cell nvmem lookup for mac address Date: Tue, 13 Nov 2018 15:01:16 +0100 Message-Id: <20181113140133.17385-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support nvmem lookups and cell definitions for machine code. Add relevant data structures for the mac-address stored in at24 EEPROM. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-da850-evm.c | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index e1a949b47306..bac2162e2153 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -100,6 +101,31 @@ static struct mtd_partition da850evm_spiflash_part[] = { }, }; +static struct nvmem_cell_info da850evm_nvmem_cells[] = { + { + .name = "macaddr", + .offset = 0x0, + .bytes = ETH_ALEN, + } +}; + +static struct nvmem_cell_table da850evm_nvmem_cell_table = { + /* + * The nvmem name differs from the partition name because of the + * internal works of the nvmem framework. + */ + .nvmem_name = "MAC-Address0", + .cells = da850evm_nvmem_cells, + .ncells = ARRAY_SIZE(da850evm_nvmem_cells), +}; + +static struct nvmem_cell_lookup da850evm_nvmem_cell_lookup = { + .nvmem_name = "MAC-Address0", + .cell_name = "macaddr", + .dev_id = "davinci_emac.1", + .con_id = "mac-address", +}; + static struct flash_platform_data da850evm_spiflash_data = { .name = "m25p80", .parts = da850evm_spiflash_part, @@ -1395,6 +1421,9 @@ static __init void da850_evm_init(void) davinci_serial_init(da8xx_serial_device); + nvmem_add_cell_table(&da850evm_nvmem_cell_table); + nvmem_add_cell_lookups(&da850evm_nvmem_cell_lookup, 1); + i2c_register_board_info(1, da850_evm_i2c_devices, ARRAY_SIZE(da850_evm_i2c_devices)); From patchwork Tue Nov 13 14:01:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680755 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 BEB7A14E2 for ; Tue, 13 Nov 2018 14:04:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAE1026E74 for ; Tue, 13 Nov 2018 14:04:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99D3828684; Tue, 13 Nov 2018 14:04:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7876626E74 for ; Tue, 13 Nov 2018 14:04:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387868AbeKNAA3 (ORCPT ); Tue, 13 Nov 2018 19:00:29 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:53373 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387826AbeKNAA2 (ORCPT ); Tue, 13 Nov 2018 19:00:28 -0500 Received: by mail-wm1-f66.google.com with SMTP id f10-v6so12017569wme.3 for ; Tue, 13 Nov 2018 06:02:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2eIRMJcdB28q8gd3gkQor3tkK+DGn7qHJn7Cj+8GDeU=; b=amZHdIrnSs7c8jZW92v9Kikt9NDZvSE6hQEPbCPyn2jDxbBwywkhabdh36IBU1q31I o6pm2Jczv5JXrWUl1K6fffJWSjND3io0wOOjtrrItgj0If9D69u/xKrIZ25/2lITShgd Dny/nLUQJnoKUvKCJlxVTnRy6FnlDomyFFy3tp/bVeVjVDPRGVgcDndIQiZ06fPpztU/ fww7ux7TxKoOvD0fTJIWQFDm2FArtwBTw4VL7xqfYIVlenWeRRCSBjvEkihfOAD081ix zZ/lY675M6RTp+UAvj+yhod3/e4INrDAygE5LGpdh2JWXoVGrAE49on7RWLPp9uaHVYN g7tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2eIRMJcdB28q8gd3gkQor3tkK+DGn7qHJn7Cj+8GDeU=; b=iQmco1OgaLhrprAMuaeXBiSNVZCHwUvGYpLLFiR1heoWVwmPMo5+KDEKDxPahW1hgF Y3W5zXDW4Qiw8H/+oCVtMCoTV+9gAcCOZVENILzV7iBteWlj2JmerVoVKVl/LhsMnFbm yiN89UWKpLhzfttEwB1RhkK97ZKVygVpCtAdWcLOddn/hqZMk1R7z7pWBGYPTZKXIjDm 96FhphuwDUs0I41BkCMVnxjYgXQ5pM7iP+NwlwD7JDu2cmq+a4v+UPCoQSkAfWb7PGcp r05q0x4Kdsw0eLXWrNd1dZQFD0xS48dSzMlyAdG+BFj9R3P5eu89NPlS8pC9tV8Kju0s Qhag== X-Gm-Message-State: AGRZ1gLnP2KPdYxLkVxrr0eTYuH6tqEDH86tqfW4EdC7/C+QTCy3VM0w Ls+cBWLNRyjg9oDRpgHtdaVuUg== X-Google-Smtp-Source: AJdET5eoE64XWNNiFm19EqpK/Nc3Y8dt7f/33XUO4NGqA04C77zBLDLjisFr8ov6/0MZ+gkc3J/b9A== X-Received: by 2002:a1c:38c5:: with SMTP id f188-v6mr3268849wma.19.1542117729980; Tue, 13 Nov 2018 06:02:09 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:09 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 09/25] ARM: davinci: da850-evm: remove unnecessary include Date: Tue, 13 Nov 2018 15:01:17 +0100 Message-Id: <20181113140133.17385-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski 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 bac2162e2153..6a29baf0a289 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 Tue Nov 13 14:01:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680711 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 794BD14E2 for ; Tue, 13 Nov 2018 14:02:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68E022A9BD for ; Tue, 13 Nov 2018 14:02:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BE872A9C7; Tue, 13 Nov 2018 14:02:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8D062A9C1 for ; Tue, 13 Nov 2018 14:02:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387888AbeKNAAa (ORCPT ); Tue, 13 Nov 2018 19:00:30 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39235 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387853AbeKNAA3 (ORCPT ); Tue, 13 Nov 2018 19:00:29 -0500 Received: by mail-wr1-f65.google.com with SMTP id b13so13407283wrx.6 for ; Tue, 13 Nov 2018 06:02:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ccuz9dZlPq5ZTOzECk8TCynM67LjW14hECdEnE8yAoo=; b=Y1Ikk8NgQXMqwpoVUP121s+8HRZcWcJ2uhzlSaFno9Jt35RotfDNIizNFi2pJSERdE JY3i7MHMmIdMxBfGAOZXFfscqNPbJorgU6YlbYEPchiKNNSmauwS+CqByewU7L5P2Pb2 Ty+35fPZUl9PamqqCj1kh83hinbakmM/par85eA1i9xi7NSmU7BaXT5njEonCBrre3bp ZjjKoYd0lZFz9AkNwYz30Cpt/TT+zvrwVg9+76xjFlrdXY9Ie8Ata8EZ1rlmlC/9A9XG hZENno7gq9eKRmpVgJ7OziWoK2RubCX81HdDrJ74k73B+qpIt9XZzAfY/RQpLZ5lsH+B ZPQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ccuz9dZlPq5ZTOzECk8TCynM67LjW14hECdEnE8yAoo=; b=efQLK5WC9oH588CPjDdzCEKAqHHovnjdOVdIj5mTKRoVgWIqQGyXBnES8iHYHdbUAA m49dv+/pLEvarKaXGTH1Tl/JvHafR8hgPb7neJPTEJt0w70uANNEzfAFJksQBGH8ign2 NfFJYMUFAmGDptYfBLMb5JLYIpLlLtluvRE1hVc5ZnL5UuWQxkQrR7789sTnoKski1px xeZD37Ye+zRonFk8giyWFPTKMiofJRYU/8+j57L7kdqQPXfDKh3HEEwKKxG8T6315AXl o3AvI47/S9gEzFzb+X+SGb7DJ2Yc+1v4uNOFF1B/QCkbVgnTus9uAqJuqlFDflWKnjIo ZcmA== X-Gm-Message-State: AGRZ1gKAAG3ILkl7RkCNvwh6ORmSNVbORC46v4Ot/881VvPi1b+GxEdg Rmd2hO0u50u+KrkjTMAy+VD+yQ== X-Google-Smtp-Source: AJdET5eG9CTFTnCYCng22fl6MqKtw+y6SlVDe065gFz+CvwaX0lJzR27KK+1HT0w6VQ4Oij2wpEgHA== X-Received: by 2002:a5d:4b05:: with SMTP id v5-v6mr4999594wrq.5.1542117731700; Tue, 13 Nov 2018 06:02:11 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:11 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 10/25] net: ethernet: provide nvmem_get_mac_address() Date: Tue, 13 Nov 2018 15:01:18 +0100 Message-Id: <20181113140133.17385-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We already have of_get_nvmem_mac_address() but some non-DT systems want to read the MAC address from NVMEM too. Implement a generalized routine that takes struct device as argument. Signed-off-by: Bartosz Golaszewski --- include/linux/etherdevice.h | 1 + net/ethernet/eth.c | 38 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 572e11bb8696..2c0af7b00715 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -32,6 +32,7 @@ struct device; int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr); unsigned char *arch_get_platform_mac_address(void); +int nvmem_get_mac_address(struct device *dev, void *addrbuf); u32 eth_get_headlen(void *data, unsigned int max_len); __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); extern const struct header_ops eth_header_ops; diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index fd8faa0dfa61..df38593d1bb4 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -548,3 +549,40 @@ int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr) return 0; } EXPORT_SYMBOL(eth_platform_get_mac_address); + +/** + * Obtain the MAC address from an nvmem cell named 'mac-address' associated + * with given device. + * + * @dev: Device with which the mac-address cell is associated. + * @addrbuf: Buffer to which the MAC address will be copied on success. + * + * Returns 0 on success or a negative error number on failure. + */ +int nvmem_get_mac_address(struct device *dev, void *addrbuf) +{ + struct nvmem_cell *cell; + const void *mac; + size_t len; + + cell = nvmem_cell_get(dev, "mac-address"); + if (IS_ERR(cell)) + return PTR_ERR(cell); + + mac = nvmem_cell_read(cell, &len); + nvmem_cell_put(cell); + + if (IS_ERR(mac)) + return PTR_ERR(mac); + + if (len != ETH_ALEN || !is_valid_ether_addr(mac)) { + kfree(mac); + return -EINVAL; + } + + ether_addr_copy(addrbuf, mac); + kfree(mac); + + return 0; +} +EXPORT_SYMBOL(nvmem_get_mac_address); From patchwork Tue Nov 13 14:01:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680751 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 B385814E2 for ; Tue, 13 Nov 2018 14:04:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1A372094F for ; Tue, 13 Nov 2018 14:04:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9587528684; Tue, 13 Nov 2018 14:04:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46CDF2094F for ; Tue, 13 Nov 2018 14:04:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387885AbeKNAAc (ORCPT ); Tue, 13 Nov 2018 19:00:32 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:36581 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387882AbeKNAAb (ORCPT ); Tue, 13 Nov 2018 19:00:31 -0500 Received: by mail-wm1-f68.google.com with SMTP id s11so2181592wmh.1 for ; Tue, 13 Nov 2018 06:02:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Wc5Df3TA4f94uLSsVA/a5jHyDSL54/2MBnBTB6cxEnk=; b=1vYYzEVMAGadRKLT0RQ86f6NaJeDBQdRo5PcIQW+gjQaEMORE5p4BmSYnozx2+bm01 Q2CjN2KqClhs3TvHGgbhYqzQXBryzHjpEVYV9sYA6qh5JjGG5V51d7dvn/OwjoJf7W0h Oa4OoBuyk4LpExaIlebw8tG81zlEMlBJ+qPS+KDG71vZtZIfZHyMc8wKG4ywI1oI9vSM aL3U5atBVGsibUiB+VAQqZZQcSrLbRRfNw1X+If+93zWPfsBjLFSbKNldeD47SVTv3Z7 6W42HFENmnRdP/h6KFZzTdTQjdgNiBU4isB59h9pougLYIerBRIyB+YEzk4MQIefVS7g bnfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Wc5Df3TA4f94uLSsVA/a5jHyDSL54/2MBnBTB6cxEnk=; b=UYqxB4HPUFMsrzggi80exlttgPaea0/HpyQAsZQVMnE1IvN9DK7W5y98tnHdfYTBBr f92xTtG8skyPcA0qdTgs/BT9cxpU9LMP876mH13gGq2LbOHEiW4nJKZqW+cZwIoh5LU5 Vxaw0h5UZ+QVQgnRCbtIjoimziu2TNe1wcQox26owMoU/BvVg5A3zIjvf/4ym4tKTJ6G MRA8zom6/fLLyApXQmheR/xmfVbC8uDO1g67PM6hkZETcCOB/WkLAuWAiTJocz6axQ2V whRa+dIFY1kclaiP9+aOWlvfYghOVk6GhJPMoxMN3YqF+qzW4J8Uu1u8QZoGg5W7c6AH 8kBg== X-Gm-Message-State: AGRZ1gI0zzC84ZUleqQUTS9/xLLCThGmlGQIVkfRPuOAT0cLZweLpzMu xGiTtAALE50lerO0PqOPFgdTfQ== X-Google-Smtp-Source: AJdET5eCneZzsonjCIJKb/v0cfrebw9r5UEFvH3gsPSan+oKyRzFwJATmLjnp+gyJK9zwU1UItgv/w== X-Received: by 2002:a1c:f30b:: with SMTP id q11-v6mr3301060wmq.45.1542117733498; Tue, 13 Nov 2018 06:02:13 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:12 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 11/25] net: cadence: switch to using nvmem_get_mac_address() Date: Tue, 13 Nov 2018 15:01:19 +0100 Message-Id: <20181113140133.17385-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now have a generalized helper routine to read the MAC address from nvmem which takes struct device as argument. The nvmem subsystem will then try device tree first before all other potential providers. Signed-off-by: Bartosz Golaszewski Acked-by: Nicolas Ferre --- drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 1d86b4d5645a..d9a208f7bb40 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4055,7 +4055,7 @@ static int macb_probe(struct platform_device *pdev) if (mac) { ether_addr_copy(bp->dev->dev_addr, mac); } else { - err = of_get_nvmem_mac_address(np, bp->dev->dev_addr); + err = nvmem_get_mac_address(&pdev->dev, bp->dev->dev_addr); if (err) { if (err == -EPROBE_DEFER) goto err_out_free_netdev; From patchwork Tue Nov 13 14:01:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680749 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 B8B1F14E2 for ; Tue, 13 Nov 2018 14:04:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A641C2094F for ; Tue, 13 Nov 2018 14:04:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99E5F28684; Tue, 13 Nov 2018 14:04:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3939D2094F for ; Tue, 13 Nov 2018 14:04:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387930AbeKNAAf (ORCPT ); Tue, 13 Nov 2018 19:00:35 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:51376 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387851AbeKNAAe (ORCPT ); Tue, 13 Nov 2018 19:00:34 -0500 Received: by mail-wm1-f68.google.com with SMTP id w7-v6so12036745wmc.1 for ; Tue, 13 Nov 2018 06:02:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ow7Ut1GNJ0NN6XzS8yWgikbMVrG9z5cqZIlLq+KQDIE=; b=bv00UTRtZfOTTESxlTwAP96Arhu8T5PCHrwxCFRnOc/Oew7CX7onM+8BVynHJ1ewPq H92YdHhZJxvAxuAQViJWKmgjAYYpAyxssPxW2bS73xu6kVuE1MeguhWX5zNNROFNt5IK Wkpq52HSVVGrkcsAPWyg78ES3X1G5fTD/xfkeux4KNE7/MgHAiXOzTffGrcjtKm9Zk3S 7XDqtNs/D3ERfaLn5rWXejg1atmqKKw22zrgVFAfiUhB7fq1hrNHA6aSNaav0JxqDX+2 eg51yFk5xxxQu8pxQgxFilbzRAe8Y2ynr3AO/XWyZVecGLfYoGdDWW7TlTuMAHRMwADY TCyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ow7Ut1GNJ0NN6XzS8yWgikbMVrG9z5cqZIlLq+KQDIE=; b=CTbWq3KT0izT/K8ActYg/bcq6qMQKvH1drwoLFNqUAseWMUcdHNDrZPsM3do3sv6Tb qYzxaq/69ZMmUsvfFJJNXQwlIr2/hfhzEgcHw/52l1OCmk3UGqVUkjKOdVd3ROmme9i7 9/vkv8ia6iZBYlSDEDj8e/BbmYFTv/nIe7hEdst6F81akGALl9RMsUJAmhyXEYJd2txu A6oSaAHucCHKIO9UtBBw6+DqF78np101z1sNPHlB6wFs17rTdv6Ecvq2imhIaNQVwXww H9nuVwzzLPYjE+pGHJGNIJ5P0GO1pH7T2kj3Zb+RtKGpjXk7keFDqHKEW9+IFXFjzqXu t0ug== X-Gm-Message-State: AGRZ1gLGb2q0k0l7/r9fwkU8cMBnhUro2km/3tmFJSeECQA1/m/u6xK5 sYoxz0h4OtK05EhRaAl1hwfiXw== X-Google-Smtp-Source: AJdET5f1p898rgta//ar53TLhYOFfejlqpL3mlIo0fcQPy1QiZ+3q7s7/E75x/rDi2YpkEA93n4W2A== X-Received: by 2002:a1c:3c83:: with SMTP id j125-v6mr3222964wma.65.1542117735429; Tue, 13 Nov 2018 06:02:15 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:14 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 12/25] of: net: kill of_get_nvmem_mac_address() Date: Tue, 13 Nov 2018 15:01:20 +0100 Message-Id: <20181113140133.17385-13-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We've switched all users to nvmem_get_mac_address(). Remove the now dead code. Signed-off-by: Bartosz Golaszewski Reviewed-by: Rob Herring --- drivers/of/of_net.c | 39 --------------------------------------- include/linux/of_net.h | 6 ------ 2 files changed, 45 deletions(-) diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c index 53189d4022a6..810ab0fbcccb 100644 --- a/drivers/of/of_net.c +++ b/drivers/of/of_net.c @@ -81,42 +81,3 @@ const void *of_get_mac_address(struct device_node *np) return of_get_mac_addr(np, "address"); } EXPORT_SYMBOL(of_get_mac_address); - -/** - * Obtain the MAC address from an nvmem provider named 'mac-address' through - * device tree. - * On success, copies the new address into memory pointed to by addr and - * returns 0. Returns a negative error code otherwise. - * @np: Device tree node containing the nvmem-cells phandle - * @addr: Pointer to receive the MAC address using ether_addr_copy() - */ -int of_get_nvmem_mac_address(struct device_node *np, void *addr) -{ - struct nvmem_cell *cell; - const void *mac; - size_t len; - int ret; - - cell = of_nvmem_cell_get(np, "mac-address"); - if (IS_ERR(cell)) - return PTR_ERR(cell); - - mac = nvmem_cell_read(cell, &len); - - nvmem_cell_put(cell); - - if (IS_ERR(mac)) - return PTR_ERR(mac); - - if (len < ETH_ALEN || !is_valid_ether_addr(mac)) { - ret = -EINVAL; - } else { - ether_addr_copy(addr, mac); - ret = 0; - } - - kfree(mac); - - return ret; -} -EXPORT_SYMBOL(of_get_nvmem_mac_address); diff --git a/include/linux/of_net.h b/include/linux/of_net.h index 90d81ee9e6a0..9cd72aab76fe 100644 --- a/include/linux/of_net.h +++ b/include/linux/of_net.h @@ -13,7 +13,6 @@ struct net_device; extern int of_get_phy_mode(struct device_node *np); extern const void *of_get_mac_address(struct device_node *np); -extern int of_get_nvmem_mac_address(struct device_node *np, void *addr); extern struct net_device *of_find_net_device_by_node(struct device_node *np); #else static inline int of_get_phy_mode(struct device_node *np) @@ -26,11 +25,6 @@ static inline const void *of_get_mac_address(struct device_node *np) return NULL; } -static inline int of_get_nvmem_mac_address(struct device_node *np, void *addr) -{ - return -ENODEV; -} - static inline struct net_device *of_find_net_device_by_node(struct device_node *np) { return NULL; From patchwork Tue Nov 13 14:01:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680713 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 433EF14DB for ; Tue, 13 Nov 2018 14:02:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 332C62A9BB for ; Tue, 13 Nov 2018 14:02:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26F872A9C0; Tue, 13 Nov 2018 14:02:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9B1B2A9BE for ; Tue, 13 Nov 2018 14:02:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387922AbeKNAAg (ORCPT ); Tue, 13 Nov 2018 19:00:36 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:37569 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387883AbeKNAAf (ORCPT ); Tue, 13 Nov 2018 19:00:35 -0500 Received: by mail-wm1-f67.google.com with SMTP id p2-v6so11485332wmc.2 for ; Tue, 13 Nov 2018 06:02:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f7gfNo0gVKcDfyj3+9h+7K8WG/3dMlnqMt9RiFsd5OU=; b=oGMfCF5OK/DFgVAZh3Rr9U5F+3+4HDDdwtYaoNXWsvJdQ9FPpc2idSDfHlsKVgZbuH RejXdfaoXgVLoZjHBw6+KgD+sHBNqrCqQmLJDDmfMvb0M3lSpvjp37Cgl8pwaAE1XKtY WqEdsMolG/O8VhNJHsbYh45O7FRUPQ14M1cA5mLypKrVYs7lh8Q5Kk0CBiKNMG1qHt1Y hVnqj5V+4roGp6UtwBUgpWh6Njxh1UgU7jAlakCED4RMksvPt7S5mHVZRaUmBZc2P6f0 xWdQfvqe33aZjMryRKn6M/RVxTuu4AG3Q2C54iWIHLxK/Ik6I19JRTSM0lUIX4+UVrP/ QXlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f7gfNo0gVKcDfyj3+9h+7K8WG/3dMlnqMt9RiFsd5OU=; b=BPTv66ILr1PMDxEYgpScxiAnaBc93jIax0WhsvcNYVxYjJZoawtSaXEWsl3mgyBAxM lujBwh7fMPCgQxJqt7fWb8cnQXYC84qTT7Dg/U4pgLj7ryvc+anscB0RrgbIjBxFP7iA 9hL85podmVobfjMJ5iEyJGCEG+Djw/2F41LOSpY1ebHSIYBZXKK/fIzcdFi/Z4ykOJnm jH8pmfjLInBUV7nWggelsuHLcBFVAxaftDf6wiBCnQRexGRSLsSaFYubMILzNQHjHtdY +tWUNBCdG3jptvUxSnxURCZ5STbgJsVzw/8wqy/IAB3QX54evxtcl2A/JZSOFwsTRbJ6 fQFQ== X-Gm-Message-State: AGRZ1gKxOCTtHFfek3p46apTSW5WRwwZmKz7Cm/AKVgE+e5jSkNgyQ7b YMd7JPnZWYmECLuPyBgs2pUKrQ== X-Google-Smtp-Source: AJdET5eC/isFPP/JoAHtDczboZRSpAdwg7+nsuETdSWEk/5qbg/R9UpvhswrRmqH3RC9hQD4j2v5tw== X-Received: by 2002:a1c:2746:: with SMTP id n67-v6mr3358593wmn.116.1542117737445; Tue, 13 Nov 2018 06:02:17 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:16 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 13/25] net: davinci_emac: use nvmem_get_mac_address() Date: Tue, 13 Nov 2018 15:01:21 +0100 Message-Id: <20181113140133.17385-14-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski All DaVinci boards still supported in board files now define nvmem cells containing the MAC address. We want to stop using the setup callback from at24 so the MAC address for those users will no longer be provided over platform data. If we didn't get a valid MAC in pdata, try nvmem before resorting to a random MAC. Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/ti/davinci_emac.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 9153db120352..840820402cd0 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c @@ -1912,11 +1912,15 @@ static int davinci_emac_probe(struct platform_device *pdev) ether_addr_copy(ndev->dev_addr, priv->mac_addr); if (!is_valid_ether_addr(priv->mac_addr)) { - /* Use random MAC if none passed */ - eth_hw_addr_random(ndev); - memcpy(priv->mac_addr, ndev->dev_addr, ndev->addr_len); - dev_warn(&pdev->dev, "using random MAC addr: %pM\n", - priv->mac_addr); + /* Try nvmem if MAC wasn't passed over pdata or DT. */ + rc = nvmem_get_mac_address(&pdev->dev, priv->mac_addr); + if (rc) { + /* Use random MAC if still none obtained. */ + eth_hw_addr_random(ndev); + memcpy(priv->mac_addr, ndev->dev_addr, ndev->addr_len); + dev_warn(&pdev->dev, "using random MAC addr: %pM\n", + priv->mac_addr); + } } ndev->netdev_ops = &emac_netdev_ops; From patchwork Tue Nov 13 14:01:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680715 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 C5A1314E2 for ; Tue, 13 Nov 2018 14:02:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B49BF2A91E for ; Tue, 13 Nov 2018 14:02:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1C7C2A9C0; Tue, 13 Nov 2018 14:02: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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F58D2A9B6 for ; Tue, 13 Nov 2018 14:02:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387971AbeKNAAi (ORCPT ); Tue, 13 Nov 2018 19:00:38 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:50870 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387959AbeKNAAi (ORCPT ); Tue, 13 Nov 2018 19:00:38 -0500 Received: by mail-wm1-f65.google.com with SMTP id 124-v6so12121125wmw.0 for ; Tue, 13 Nov 2018 06:02:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OoIJe4mIDvTgdZuFApCm4Rth6o5WcRAhu1RpXcDbEn4=; b=I63cr+tbCx/td55Gvhzg57rRGVH/mP7GtwF3VQsJ+v0oIhaEfYxqxReO3Cv/96MVZC E3WqUkG/YivISQ+MKMYdujDmHFek7v09UbndzW1jCRO7lSbtmbMHgNqLTOtCp+ILUpCJ wiFeYVmMa8w+D5Jtk8MPRItODnXt6oNU10b6A9NNlxfexfGDTl95uOQv6+ikrFnTEmBd I6ZBmA9XehvRbIRABqf7mFEzURQ7fRoDStQnGkPa4PgT95zy0s78ItpZkILPGXwBugkd PYarMYhnWnfPCKu/1C8ADlyP0pWtGHy3pLxW8zskbMJAOcA3E93F6aUJGU7dMhG5F7td gchQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OoIJe4mIDvTgdZuFApCm4Rth6o5WcRAhu1RpXcDbEn4=; b=MK97upuLfXZNKT/iqbzaqoEOIffl/EVne6xoe/xp862DVWLikeAGByAK0LnyKIDaQf SyB/H9TR8eqfuWnCP6vzEcMSS81hwG+we3sqNSGNBOJfis7KyEgJFsgvP3aeiSC4MfFT HS0DksbuVmURgXxOc+3f2YhU90FS9aqlW0Kr9VZ0dKFqvi9MCSvi2zRhxx5gbRjBo4Rz 1ZGx5e3I4I3OI37wcjGRahXteoaTXhOkoTNg6ocFg9HsYULy80vrASB1gaVeQsZLSlyk HLRFKRKJ70koFPIc//uhapjvwB01/ojnh5tFFjkdMZRtFxNa+FdEXLCdoh0hoU9kpSXp M9nA== X-Gm-Message-State: AGRZ1gJuiFv3W1UxrxwG1Dq7RWc31WvPnb/atkqZipXH3VUnXN1TOihf rPhq0w8TYNUt1kM7Pn3sBFfA7Q== X-Google-Smtp-Source: AJdET5eBWqbpkPuDG25XfcRJdhNFcl9LxodbjbwiolEO+3PzHNwJNw6+CIjZNsn9xz6HcjOhubC8pA== X-Received: by 2002:a1c:38c5:: with SMTP id f188-v6mr3269398wma.19.1542117739313; Tue, 13 Nov 2018 06:02:19 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:18 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 14/25] ARM: davinci: da850-evm: remove dead MTD code Date: Tue, 13 Nov 2018 15:01:22 +0100 Message-Id: <20181113140133.17385-15-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We 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 6a29baf0a289..128dd7d8dff6 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -150,32 +150,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", @@ -1494,8 +1468,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 Tue Nov 13 14:01: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: 10680745 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 111D914E2 for ; Tue, 13 Nov 2018 14:04:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1F891FFEB for ; Tue, 13 Nov 2018 14:04:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5C8E26E74; Tue, 13 Nov 2018 14:04: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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 950EC1FFEB for ; Tue, 13 Nov 2018 14:04:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387990AbeKNAAk (ORCPT ); Tue, 13 Nov 2018 19:00:40 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36599 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387967AbeKNAAj (ORCPT ); Tue, 13 Nov 2018 19:00:39 -0500 Received: by mail-wm1-f67.google.com with SMTP id s11so2182135wmh.1 for ; Tue, 13 Nov 2018 06:02:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rzIOy5k8NvgMAGaMyhICjOaJC80/j9SQ1XPs3RN4Qj8=; b=czxsBaTIPylrdoZnIop/vzqSbcMKwqBFiN/pcIU147oEk9zTP3NdX9TSPh78RwQtE9 3jRDWdnsbuepnfF0ABAlMrqHS87O+5tsZ9sbMTyQBOpifi/7XMrMX/V7gwZodPwGsJGi dqVY+O4clHSia80j4pbhTM9h5nt6AVkTadJxhRQYOmlYeHNwoi2CRAGHTiDNUDPsXys7 0HKhWFEeX6T1V0Up53zF8ieYCV7cF0dbCYEzPCRajntX2XIQJoiQwtUUwXeV2TEJ+cd1 Cbd3d0z6KKefOsE3gRi19GLQivBI6DvvhWfLII38bPV+xKCsUWZVviX8ATVE12fXl0Qo rryA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rzIOy5k8NvgMAGaMyhICjOaJC80/j9SQ1XPs3RN4Qj8=; b=csVRsXPZ8cR/iI6QCosXoT8Zqc1FZmcOgDEDfEfMgxF2fi+CudcqjbLLUUdf3bWXAm yey5Z4nWhzhBlEWPe8LFvPMVqjR3vi5aDM08s2mJZvoauLsf2R4C+nlq9p4ZE3RBqIDb w3V0AzAoY0JVtiKPHmBq69DpYuzYDnMSUjD2kGfRKwPvJQutDdEU6un7aOo1BCNdChjO vd1Lu6d7oSdeAOMapMB561oYbl/qfAJ/ZDUwy8tLkUDZ8oXYjDaLnFPkEkdWl5Jk2y8x pCV3fDB904uxbiTNO6tX7axXOfq6szRSDVBeMAUqKxud5GH/FH18tzeWvyntBAmkYBSz 1bHw== X-Gm-Message-State: AGRZ1gLAVmHhbwjxJqXLCBoTGmWXoQTL0/QKYOk3TmJYUu3UDmbBkfgY jseFT4gfgcHzmDEDeAtv433g/A== X-Google-Smtp-Source: AJdET5cejNO1sjS5Rs8mSVv9N6GwUYu0qmNgnOpUOzqnv3+pTsBtyBxBNVY+mFQOeYTglyIswaPP8A== X-Received: by 2002:a1c:b8d:: with SMTP id 135-v6mr3273167wml.128.1542117741207; Tue, 13 Nov 2018 06:02:21 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:20 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 15/25] ARM: davinci: mityomapl138: don't read the MAC address from machine code Date: Tue, 13 Nov 2018 15:01:23 +0100 Message-Id: <20181113140133.17385-16-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski 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 8df16e81b69e..3286dc2457a5 100644 --- a/arch/arm/mach-davinci/board-mityomapl138.c +++ b/arch/arm/mach-davinci/board-mityomapl138.c @@ -121,7 +121,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"); @@ -147,13 +146,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 Tue Nov 13 14:01: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: 10680743 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 BDB3914E2 for ; Tue, 13 Nov 2018 14:04:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA6F61FFEB for ; Tue, 13 Nov 2018 14:04:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D8B22856B; Tue, 13 Nov 2018 14:04:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3ADE71FFEB for ; Tue, 13 Nov 2018 14:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388017AbeKNAAm (ORCPT ); Tue, 13 Nov 2018 19:00:42 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33110 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387992AbeKNAAl (ORCPT ); Tue, 13 Nov 2018 19:00:41 -0500 Received: by mail-wr1-f65.google.com with SMTP id u9-v6so13459811wrr.0 for ; Tue, 13 Nov 2018 06:02:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nCKNyyyX49gJ9CaNap8tpDC+pK+u47mv+sMMopDxMTM=; b=JoZ1fiVE9ZF9GTDTPgNWKBckmgnqA1IB3gWL7zEF47gEGDK1+c59xiqItVL7kGGzUy dpyiuUUBsS8uXZoOraEzosPpYXdotzv/aGqX1RuNtxEWdZTqa7IpQ03wq+dKz6wtOuxb z85vrevS5euHqqIsIGzROloIry2wZrsTpK4hqkwVhbmM5skOGrAMJIxTK5wR1D2sxYaK VdZ+BuGqCpooXV9vGPFfrAwk3OtNb8WrlzFxpsCcCqz710Sc4mj64K1pIV3DLuTrq6Nn rii9XOkFbEtRdo/Pvf4wrrPNDyTWx4J/7WC7T00ZsHOVqAmkXSjHFDB4hOogAqdhlOeJ +zOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nCKNyyyX49gJ9CaNap8tpDC+pK+u47mv+sMMopDxMTM=; b=ApMQcMDULwzwgZaw/qejwuTqeF/8J+pPVphu5sBXoenjMccR0yo3wTQXW1bqn0yZnG yq6ItwHNQIbbAUebtODgXhiX6Dxz3w+zy8uUaNNGgo/hEWY9AYvpvplu9U5ATCZduc9H MkTKa2wFfSvRl4mOk87O70CNVlBC7kefADgL2K+KP+Zk0fSsxmigwJPJ5FLGDvVQWmDm 3jhzEMIBxSib80cTd2KuU5Rro6YqwFYzpicM/N9UbvL3zsfvECrmjSo2aEpBScbkAmy5 TSWfLd+jjBZPwRGVGaGNcOUW83BLrl5Wtg6HF5looxLrxmEAehz2NT/grPEbSrd2uc2k W8Sg== X-Gm-Message-State: AGRZ1gItOOcAAfwUb7BYVgS+OF1KPCydydiQbHlPBPycZXk0NHCRaAb0 M6hKCcyIa4q1GQuovBwRBuPXp0qsKks= X-Google-Smtp-Source: AJdET5dx7aWCy2FTz6P99trjv8Or2uBMgv0C6q57D9QHMF9jLch6v+RP2iHksk6DIXv07QNT8LqFEQ== X-Received: by 2002:a5d:4b05:: with SMTP id v5-v6mr5000343wrq.5.1542117743205; Tue, 13 Nov 2018 06:02:23 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:22 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 16/25] ARM: davinci: dm365-evm: use device properties for at24 eeprom Date: Tue, 13 Nov 2018 15:01:24 +0100 Message-Id: <20181113140133.17385-17-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want to 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 8703fc18dd3b..f016584285b0 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 @@ -225,18 +225,15 @@ static struct nvmem_cell_lookup davinci_nvmem_cell_lookup = { .con_id = "mac-address", }; -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 Tue Nov 13 14:01: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: 10680739 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 5E6C014DB for ; Tue, 13 Nov 2018 14:03:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F15E28AE6 for ; Tue, 13 Nov 2018 14:03:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3314C28B60; Tue, 13 Nov 2018 14:03: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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA14528D90 for ; Tue, 13 Nov 2018 14:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387681AbeKNACM (ORCPT ); Tue, 13 Nov 2018 19:02:12 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:53084 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388013AbeKNAAn (ORCPT ); Tue, 13 Nov 2018 19:00:43 -0500 Received: by mail-wm1-f66.google.com with SMTP id r11-v6so12019897wmb.2 for ; Tue, 13 Nov 2018 06:02:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sPuMqMq9r2hIniTC2IBiHD0FDPb8NBERuqBhYrjNhTE=; b=IDljafRjAEOauqjxFmN1aBn6PcPzI03ubbHWQId+R0m8iLm5HwH7ZGWm8DF/0zk6D6 8Y+9C5jWPK6BYd/oFQWB6zUQd1b3/QXbcKuqSIMX5uVo6NkhdSuofrD08F3N1cETUgOG mPBe4SwESiWeFOTf4A3iyKd4TbiL1rZTXAGVAY+z3658ZbFky24wuJ9dUHSUjh0tuMmU U5lMPlHr4gDFBSpB4fMTm/uGaDAp0TYEdwcvWNwh4oBPLexahiUYfO9nQ2484xx+INkQ 69IcVq1iuDC/3VIuwOkkh/FGMKa0WNPB86qnO+Az1ECSQjV5pVontyGkxpVUo3a7R2Wf s76g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sPuMqMq9r2hIniTC2IBiHD0FDPb8NBERuqBhYrjNhTE=; b=FcPZUn9T0MBw/sp6Ntd2Z6y7wdnIzp+UCEbHe5SjZQ5a38uX/xMedhF6vIPc3Mtbor o7ycYmQydYLiQNKpMHTR6KdXD6OzSiGVlyZzDCozWhq6Fa9hkllpagwqXe7D+B8l2v8f XPo2SCojRlUO4qXBWdhsfGzn03YaASGylzZDhC4xqnnJ6S7ghzuVgK5gK/2YTF5umrdH 40liO7E3fOMy6dxQQ5z3dpG0LRNOfSAvTyBl9ix2ijiTDxCf4sj1cB+MbNSUMNXtCQ+M eVAFgwMU7PxCt8j0BlBhnx/0xhZlvtqTZbN0WtNX2AlOJJfi1caCIhKpr0Irrn1RPuXF 5yCg== X-Gm-Message-State: AGRZ1gIR6GQ8YYUCYWWhoNG4XMHjeT1ifL1z2t6rmTBZe9k2/Jbpuv8I f/GOa06nXgwAbfXtubEIHxLX/Q== X-Google-Smtp-Source: AJdET5ffOXzcrmnj/X9DmPRLspwEQNS02Hmpuhdm53pLYF5ldj1o5KZ1HztDac1HlLqZ965HC/gAGQ== X-Received: by 2002:a1c:38c5:: with SMTP id f188-v6mr3269738wma.19.1542117744928; Tue, 13 Nov 2018 06:02:24 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:24 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 17/25] ARM: davinci: da830-evm: use device properties for at24 eeprom Date: Tue, 13 Nov 2018 15:01:25 +0100 Message-Id: <20181113140133.17385-18-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want to 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 e52ec1619b70..ddd871d8b44c 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 @@ -457,12 +457,9 @@ static struct nvmem_cell_lookup da830_evm_nvmem_cell_lookup = { .con_id = "mac-address", }; -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, @@ -496,7 +493,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 Tue Nov 13 14:01: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: 10680737 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 7CBC314E2 for ; Tue, 13 Nov 2018 14:03:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CA1328B80 for ; Tue, 13 Nov 2018 14:03:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A82F28BFC; Tue, 13 Nov 2018 14:03:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F5E028BA1 for ; Tue, 13 Nov 2018 14:03:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733245AbeKNACB (ORCPT ); Tue, 13 Nov 2018 19:02:01 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:54686 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388054AbeKNAAp (ORCPT ); Tue, 13 Nov 2018 19:00:45 -0500 Received: by mail-wm1-f65.google.com with SMTP id r63-v6so12090899wma.4 for ; Tue, 13 Nov 2018 06:02:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NtdPGnoNcOA+uAMeykOlFvJi5M25GSj2otU8Jlp5mq4=; b=w014nPI1uJ7XLo9ncewVaZ4F3wu8fqdaXRgFGCsxn5ZsTiXFGgW8T+bc8vpPfzKJx8 g8vkxFQ2VzBmEDQ37zLwng0EVbgn0Z5b4Lr4vSmo1oQcaDy/PmrITZ/b8MXCbarvNwzP f/OGvH4iIKmWWo9ibBjb1LRaD43qlMciij1OCUqjM/XjMJ2nLJ8Q+mylydEHvj8l8Jgp 7789G2xZdpCi5eYrMggu+ZglSi3o9lCnqeVYnS0X3fdFuv27r3gkPCdTNX27PPJzS5Xv 3+vkukmuOlvhkZe2B0WlFmC/WS413912TxnPtz/uqEv19c7D2sFzO8NGpr626Nmrn3EQ CWdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NtdPGnoNcOA+uAMeykOlFvJi5M25GSj2otU8Jlp5mq4=; b=jCXVx6k3Vwc1woRkeajS06YPUC15llDy8sQHyR8djathMzgUHBnGLpADQNR9qZAh6d 9hmeyJWXSPLFCpRmZlAsSVdu+0e8/ULAEg72MgjICFRbSwljz1u8DHyXZY/IxzluUDKc 8CCx2T7Ro+Al3iHreCMZNCfbS039DlQzwexIXxuPRpy8E/Moj4BnMxu40kHpWhV2dsw2 38ogfp3iEa51qES2MlSrn6wz4gve8P5CB/vG1klRFvQodIO79nIWjcTzGTcQhFxo67Zn HMR/XiCjLnsbeNSWU0PqzYppOfzs4DldqFRxIwHIo8fPWHHfV5MCegT83+ur4dyXF5bc /OJA== X-Gm-Message-State: AGRZ1gLkn23TIcyCNsS0h0ayVr5CkQQpzNnN/I+R7Tlg98cRx0qkQviE hksSIsbWzT1GEyX/i0T712z0Ew== X-Google-Smtp-Source: AJdET5fLy10Q+h27Bzq/mjdp88BBAVLtFCdLs2zd+Oh1qCRYRTe/HiO6Yxd4u0R30FeSSyuhnJgtbg== X-Received: by 2002:a1c:730b:: with SMTP id d11-v6mr3320577wmb.107.1542117746750; Tue, 13 Nov 2018 06:02:26 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:26 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 18/25] ARM: davinci: dm644x-evm: use device properties for at24 eeprom Date: Tue, 13 Nov 2018 15:01:26 +0100 Message-Id: <20181113140133.17385-19-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want to 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 | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index e1428115067f..efe4e170e87d 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 @@ -532,12 +532,9 @@ static struct nvmem_cell_lookup dm644evm_nvmem_cell_lookup = { .con_id = "mac-address", }; -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), + { } }; /* @@ -647,7 +644,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 Tue Nov 13 14:01: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: 10680717 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 0C87014E2 for ; Tue, 13 Nov 2018 14:02:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED2552A9AD for ; Tue, 13 Nov 2018 14:02:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0A6B2A9B3; Tue, 13 Nov 2018 14:02:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74A962A9B5 for ; Tue, 13 Nov 2018 14:02:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388089AbeKNAAr (ORCPT ); Tue, 13 Nov 2018 19:00:47 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:42200 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388012AbeKNAAq (ORCPT ); Tue, 13 Nov 2018 19:00:46 -0500 Received: by mail-wr1-f65.google.com with SMTP id u5-v6so8159491wrn.9 for ; Tue, 13 Nov 2018 06:02:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hh5b2k/7h0Wkn2rLn6NIi7mvwMbeZ/cPsG4EAD277Kg=; b=WDK4EXYCVbg5UVTt1LLa9JA2tefJbGBaRGYu4BQMHUTVwo9nrZI/x2Pg9f2m6SfJqi gXZZE1ZXbYo4CxQKosHQtqkTQO5nZIzNSHtUS0IFQC18X7RvFcQjkpQW2uJ0GLMCwuUj AJ+BFW67RMtcYQUKm8llOhqDviNNsM5NY87UcplZWCENknMzcJt76olth3ghcb7bmcOv ot/W6azDogQYZHpmIqsZirtRURlBAZbUN2rYh9tH5KqFQ4F8nhcM+vlrnxP35T5IH5Yh h8Tvd8sXrlMymXWdCXXHobgUx8FJ6iUUW9fNUiDB8dpmMsTl78IBPpVY3AZU6M54XEEs O3/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hh5b2k/7h0Wkn2rLn6NIi7mvwMbeZ/cPsG4EAD277Kg=; b=Tqbi3VJNyPWyfZJyysCxYiEfsxIo/DLSEjMd9OYlT4KgT9B0m/ChFo1tGS6LBLp5Rc gQ+xpgof5wuR8EiaqW7qzNHYzHSExJNsmj9Tfelhdvjha00Ea3NLFAX0jAefHd5NSTDj uEDcnJfKrnLR0E+FiNPvLDmZLd9B9WJPmO+/n4HEv57xIYWD6fYSyuwxN/otK5cpzmRW rnGeyALG9KDgIwFhEs6UXqhB6eLqFjWikNWkSzNUtSJGF50Ime4fFnAeqcF9OlnlS8Fb ibrmjsXZblna/hN93wN7xdCDAoxQFnWUTGR93PSTM3epVCpUZ64civOhs6vK1Ms8w73v +lkA== X-Gm-Message-State: AGRZ1gJevIRP+jncmz4lSgaWMZsbDxg+xyGw3/93Fg+X4kx/fg6qwNoW AOqPswI4oVHFYetXGv/PibMoRA== X-Google-Smtp-Source: AJdET5cMvvcmsFaY7r8GYj7Me90MKajqiYiB22Zb0Nu3oX9oxsFP2cXbd1d6owPbeGt/U3pul0Qp/Q== X-Received: by 2002:adf:e543:: with SMTP id z3-v6mr2568196wrm.238.1542117748660; Tue, 13 Nov 2018 06:02:28 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:28 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 19/25] ARM: davinci: dm646x-evm: use device properties for at24 eeprom Date: Tue, 13 Nov 2018 15:01:27 +0100 Message-Id: <20181113140133.17385-20-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want to 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 8d5be6dd2019..02b57face113 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 @@ -364,12 +364,9 @@ static struct nvmem_cell_lookup dm646x_evm_nvmem_cell_lookup = { .con_id = "mac-address", }; -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 @@ -440,7 +437,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 Tue Nov 13 14:01: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: 10680733 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 6966214DB for ; Tue, 13 Nov 2018 14:03:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5775E28481 for ; Tue, 13 Nov 2018 14:03:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4ABDE2894D; Tue, 13 Nov 2018 14:03: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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1959E28AE1 for ; Tue, 13 Nov 2018 14:03:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388012AbeKNAAt (ORCPT ); Tue, 13 Nov 2018 19:00:49 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40793 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388093AbeKNAAt (ORCPT ); Tue, 13 Nov 2018 19:00:49 -0500 Received: by mail-wr1-f67.google.com with SMTP id p4so4266468wrt.7 for ; Tue, 13 Nov 2018 06:02:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3+tDzntZFfY3GLS/4lI4221oPwYjWwUsoPxzbNeGoww=; b=DUVq818XztF17potVvI9i1PK86EqQtT0jlWPLbOegWOH4yTLmtdDDz4q21BC3B/eYI YoKQo6AYE35b03fTLwXQ2o2KyF4nWWkmoUerwPL5EL3tMRj9T8IiIj45nI3sItiosz7P wdmmlLh+RjotdnEw62fOngzb/NCZRISqqHsO7bhR68cznZ96cSW3HhGrdYbPu+q+Tb9m q9uDdpiGrUClJhH1qf4ZLVCRaXFOJ0laD0ECnlukekcdTqstB5oebQuN3KeWEF9VYnpW gKupXEvepZHzekUG7o1wCIN99mJq5t1gjjgltVvG5lb9VVKSPt6uyEmnsaxmGyxrFT+0 pZLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3+tDzntZFfY3GLS/4lI4221oPwYjWwUsoPxzbNeGoww=; b=i1xhVXBuBDTxSGMR/d22/yUEGjP8aHywVlv/zgyRDIbityVPzUi7sr1x1iVCFlcqW8 VkvjBfCL7qTDAZ5k+4w+zh2w/CuRH61cDe+jyXPuHymJJvPanwOKToSR4R0NzN6wqT/l SsFO6PY0+VIQvB+ONBTwptu+pCZJ1LmCYSzXKhG56eQ/Tr7Rm5HtWl1gkqevfgIqclTU /mNY4gWZrfDl9VvZL7qtrLlKtEFufPjTJ0Axyj6Qf5IyknRO3fkcEHgzGgfKYwthVJT8 kSg0Z7FYiYKsoYmsNp7Nlop+5lsDsOuTPtQa0GVMgmX8IQ0fJS/nBwN48n+S8nF5e32q 08UQ== X-Gm-Message-State: AGRZ1gIpHphu20dmV5csrS8WDnBndMvWv6TQPZzaf6NGVZ7ZJABNJa0U Uyg/MYpYI9/QSdR2GEKV8+36Yw== X-Google-Smtp-Source: AJdET5fUa7P4pqTkNLMJPx+aR+6iEMAGcJAORVawMii9aSn1PUmSuSdfVOcHiOSJabclU1KqVRDk4w== X-Received: by 2002:adf:ded1:: with SMTP id i17-v6mr5283755wrn.307.1542117750456; Tue, 13 Nov 2018 06:02:30 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:29 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 20/25] ARM: davinci: sffsdr: fix the at24 eeprom device name Date: Tue, 13 Nov 2018 15:01:28 +0100 Message-Id: <20181113140133.17385-21-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski 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 792bb84d5011..acd9778ffa07 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 Tue Nov 13 14:01: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: 10680719 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 A165A14DB for ; Tue, 13 Nov 2018 14:02:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EF382A989 for ; Tue, 13 Nov 2018 14:02:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82D5A2A9BD; Tue, 13 Nov 2018 14:02:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 245E72A989 for ; Tue, 13 Nov 2018 14:02:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388114AbeKNAAw (ORCPT ); Tue, 13 Nov 2018 19:00:52 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36626 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388098AbeKNAAu (ORCPT ); Tue, 13 Nov 2018 19:00:50 -0500 Received: by mail-wm1-f67.google.com with SMTP id s11so2182914wmh.1 for ; Tue, 13 Nov 2018 06:02:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ztnUf8638FUSA3Znei2oPXxpgrZCrlfwVxJL7f5VqxM=; b=zZ2+34Dgw8tffkWguG4iGMsMH70bbh6uhUNdkKwDhFjL4IRxWYrOU+2yvIBpAuTHZx 4xh5JA1UYHCUlYMAkx/bJ0Dl573316D/C8p4BroweHER1WfBAnp73CxyfRQ8x2N81O/l 57HLn+U1/gQ0dRAKmgtEW4XmL0/PGfjW5IIEd0Kodi0H38dOQyJWnUpGobPQ7nFSvSg+ S8o+glqZDkMR+y6PgS2rlmSF72xcTIESNGIPQIh/5lvlUZcljPRALzpcRXrDrDFNpARu 3nL1DwDRcjN1u3nic0kAru5TCge19MNd02RjoKwGXljpk63ecdA9Lik9Wc0W9IyR0AQ/ xIwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ztnUf8638FUSA3Znei2oPXxpgrZCrlfwVxJL7f5VqxM=; b=RM7Do22MIR/aGU8n8A2g6ncMtcsUmV2GT0G0vA4RspfWKlcC0M46zKIOi8Fn7CL6OZ W8ZdKr1JE00ZZVDzcnJiI3BsKL3tuD3+za1ual+S5u6rtanZspgdF/PUxwikRpBwDC9I 5rKLxojHyXYPi+h7Q4TJXcji2SOBlBsaMArkmOTFwCNlPZ+LOO1ELGW/fvFjyW/23wZw I6CFJeYcqvkVyhs3ymJlZCnucHOXIGpX3l6QUez0jEqZ/6OFJCjhGOr6rxpo4xExpJiT eiJVXaghbVzNljwaGRYaBBnVIHvIDWoqM+V9xDX4T8GOEtcaoEZdmK/Cwr/xXK5efeoW QScQ== X-Gm-Message-State: AGRZ1gLHTH0Mv2hpRcSaOYQvRBrzBsROOrrog79nvHfP8XJH8J1MLIbG h05F2bvklgR6NQfmgfyMvIZC1Q== X-Google-Smtp-Source: AJdET5fZDtnaImMGTTAvHsDmPnjEU9pLpWpgoZ9sBGQD4RDKI5fISFfh8jg9ZcLoSmrmKmjrcKTJ9w== X-Received: by 2002:a1c:e3d4:: with SMTP id a203-v6mr3298181wmh.16.1542117752512; Tue, 13 Nov 2018 06:02:32 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:31 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 21/25] ARM: davinci: sffsdr: use device properties for at24 eeprom Date: Tue, 13 Nov 2018 15:01:29 +0100 Message-Id: <20181113140133.17385-22-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want to 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 acd9778ffa07..ff14de1396c8 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 Tue Nov 13 14:01: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: 10680729 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 5439018F0 for ; Tue, 13 Nov 2018 14:03:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40C3A2A9C4 for ; Tue, 13 Nov 2018 14:03:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DE782A9CF; Tue, 13 Nov 2018 14:03:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E06A32A9C6 for ; Tue, 13 Nov 2018 14:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388112AbeKNAAx (ORCPT ); Tue, 13 Nov 2018 19:00:53 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:38298 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388108AbeKNAAw (ORCPT ); Tue, 13 Nov 2018 19:00:52 -0500 Received: by mail-wr1-f67.google.com with SMTP id e3-v6so13460631wrs.5 for ; Tue, 13 Nov 2018 06:02:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+MhstBAWAWTvjV+7n2ZSuyCNluyXHXlSjobSaNP/M+U=; b=Sxu9i8eOfulldiOW2s6lrLD0kGLvUFXrjFvDiI91iV+FcVDZ5z1S8rnXXIv8CdlXM9 lx7GA9Lhz3RYE6o9IGN/Kx8eGTjTuaYpGeOJsqMuCGp2gRZIewhkzjKa3vUKlzEitboM U+nS7lvfka2Ql9lEEC2drCGonOpS8H4cJQEwb+/D5BMDeAfn9+R6j8LTsc2S/Piswvgg yldLYLgtyrfeZ4lf2mn0e8i/83PyeWv/54eYj7SOEyEcr5phSmlrKTD6B34cAJarXcl8 ACip3WuKeY4hnsSFwv/ZviaJ+Wsf0bnnIXrJUsgg7XO2ZomEIWERn0lxZxGRsNynSAfv 3gvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+MhstBAWAWTvjV+7n2ZSuyCNluyXHXlSjobSaNP/M+U=; b=HG10rZ0qz3QlBdBmhA5wVQ2znlSO0Q+IwwRNmYUmKpyzOw0/cOPaw57Sb3FSiJwuE7 eZkf2M1ACV/mNz5d81HmeQOdDy7LYRa87Pw1LyyzICgd2Qxq9g7rhC85s2Nh21DMDxkn XKX570m6IPtzBDw9oVWMb7aeMJ6vU8BKTMqjqjpIJHc1w5nHc7tLk4nAeRjyTsuffntB xvDrrHZZe3WHTb8Eht4dI2mN0sK//Gacrmm3rFfJUWZCrciwRDqCLwblEmZbaMz6AB4G eisM7zn7/yWz6k86if2KauAs6pIcRTOLRVI94oAD8jeTHRu01L9W1ULL4tKtp63ug11U iaQA== X-Gm-Message-State: AGRZ1gJviebBpEK7NyvTUskOaiLlP83YwaBdKt8yxB4RpHwK7ltXPW0p 91i3dgnB5KG33Y74oGI4Yv/bsw== X-Google-Smtp-Source: AJdET5cYRF0z03J3+LXc6zQEY2KOalWWGv3duPIopAzahTAXJAf6RsHxNQP+5fXdh/tbkc05Ilp98g== X-Received: by 2002:adf:be0f:: with SMTP id n15mr2375313wrh.267.1542117754451; Tue, 13 Nov 2018 06:02:34 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:33 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 22/25] ARM: davinci: remove dead code related to MAC address reading Date: Tue, 13 Nov 2018 15:01:30 +0100 Message-Id: <20181113140133.17385-23-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski There are no more users of davinci_get_mac_addr(). Remove it. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/common.c | 15 --------------- include/linux/davinci_emac.h | 1 - 2 files changed, 16 deletions(-) diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c index e1d0f0d841ff..0c638fe15dcb 100644 --- a/arch/arm/mach-davinci/common.c +++ b/arch/arm/mach-davinci/common.c @@ -26,21 +26,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..28e6cf1356da 100644 --- a/include/linux/davinci_emac.h +++ b/include/linux/davinci_emac.h @@ -46,5 +46,4 @@ enum { EMAC_VERSION_2, /* DM646x */ }; -void davinci_get_mac_addr(struct nvmem_device *nvmem, void *context); #endif From patchwork Tue Nov 13 14:01: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: 10680721 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 CD9DF14DB for ; Tue, 13 Nov 2018 14:02:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB9382A900 for ; Tue, 13 Nov 2018 14:02:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B92E12A9BD; Tue, 13 Nov 2018 14:02:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 502892A900 for ; Tue, 13 Nov 2018 14:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388155AbeKNAAz (ORCPT ); Tue, 13 Nov 2018 19:00:55 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:39378 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388154AbeKNAAy (ORCPT ); Tue, 13 Nov 2018 19:00:54 -0500 Received: by mail-wm1-f67.google.com with SMTP id u13-v6so11540625wmc.4 for ; Tue, 13 Nov 2018 06:02:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=syCNYOhWI2Fa3CkPeYThsu7drj9CGAM/9EZeMe/84fg=; b=PJL8eMa9+jAOQEZNJcbJMuSBrsGHEjmzI10SPdojyC87xlN5V9crDDWQ+lH3v/VzOM 1BgbUtHLRcXfw/YhVhc1RMPR1tHbbr2h2C490+AKByKBjNr5cdg0KaSMeQ2FXZ3djCDX WT6Ys3rYvkQbowoqMbQhCP6WyvgYuMh3LVETsVbCH14uid6zYbfsgiJgv/1Gdx3TjQco dEjOKY9M6u1ZSaJ7RFTHKm9BhVsHRDywikCx2ORM+ukOBDPEiUcYp9J8RjeXrLgxxrv6 WHI8fixQ+evqM5Ip9WfK8/u4WR2v+o8N/UryB/bOM8UPhppphIXf4VLR9ztQb3dMp4Q+ VXDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=syCNYOhWI2Fa3CkPeYThsu7drj9CGAM/9EZeMe/84fg=; b=YqgcnDGz18vRzp0WGA1f5WsYAZ2mYaaaD9VDbeP0VzNpAgXShIQySmRk4JqAgYHloz sKVW1nQXajq8ju0Bx767NOSPDEeEH957B/JE1jXet2k2MGsRDCilCaPN5Pjx8flOuZkJ RJv1wvdPKrxKdDNSYB5cWuFanQ9BJsGISQAq31Wux0eRc1bpwesLGHZ7Dgyrxv30J9BS OmXeggKBpQxEvE2aXyi5wbVDiIofCJpcwQ9RtN2D8hI8pTGEoWove8IiZQL6b9Inz8+w Ilqzg9zdSWkXQIcZgSJ4jOT+4Mdf0V8GcYULvRab4xX4UW4a6qtJ1+qXAyFyIMm3rlgU UtvQ== X-Gm-Message-State: AGRZ1gKH1GbkdO5Wr1hKtRRNkc1NND05Z+SVv/FfoJ+4Q5+54gHFraWY BqqsN4VZLyAKPjTsZcRg1xFIiITUjMY= X-Google-Smtp-Source: AJdET5ePKezX6JsMVmB21bIh2rzVp1xhzc1G5EZ2Oj5DB2QjqGjdRdYo3Cs8BUYnOEw6tUiFG4ab/A== X-Received: by 2002:a1c:5f85:: with SMTP id t127-v6mr3313396wmb.44.1542117756310; Tue, 13 Nov 2018 06:02:36 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:35 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 23/25] ARM: davinci: mityomapl138: use nvmem notifiers Date: Tue, 13 Nov 2018 15:01:31 +0100 Message-Id: <20181113140133.17385-24-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski 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 3286dc2457a5..ac1a1699d185 100644 --- a/arch/arm/mach-davinci/board-mityomapl138.c +++ b/arch/arm/mach-davinci/board-mityomapl138.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include #include #include @@ -117,10 +119,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_dev_name(nvmem), "1-00500") != 0) + return NOTIFY_DONE; if (!IS_BUILTIN(CONFIG_NVMEM)) { pr_warn("Factory Config not available without CONFIG_NVMEM\n"); @@ -152,8 +159,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, +}; + /* * We don't define a cell for factory config as it will be accessed from the * board file using the nvmem notifier chain. @@ -183,8 +196,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 = { @@ -561,6 +572,7 @@ static void __init mityomapl138_init(void) davinci_serial_init(da8xx_serial_device); + nvmem_register_notifier(&mityomapl138_nvmem_notifier); nvmem_add_cell_table(&mityomapl138_nvmem_cell_table); nvmem_add_cell_lookups(&mityomapl138_nvmem_cell_lookup, 1); From patchwork Tue Nov 13 14:01: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: 10680725 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 61C9714E2 for ; Tue, 13 Nov 2018 14:02:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5022A2A90C for ; Tue, 13 Nov 2018 14:02:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43B0F2A9B1; Tue, 13 Nov 2018 14:02:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECBB22A972 for ; Tue, 13 Nov 2018 14:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388163AbeKNAA4 (ORCPT ); Tue, 13 Nov 2018 19:00:56 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38302 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388160AbeKNAAz (ORCPT ); Tue, 13 Nov 2018 19:00:55 -0500 Received: by mail-wr1-f65.google.com with SMTP id e3-v6so13460847wrs.5 for ; Tue, 13 Nov 2018 06:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oXTGXgrClMlW8LabyP51oPTHLt1d9TPP5bN7Oy9yaTQ=; b=qExkY58TSHKmcZ1oSE4ta3JVB/dZ7ysem4RkJ7UwxHTzIVAaaqhUGZFtX5xnJZEO7B W3SAjTgBoTp9oHtINAtFynUeoz0Sqjyb9mQ2TJdrO19sk+arZqmg+nkLiSartLtzhP+f P23j1odqmOwAr5DE1Ic/aXE4uKDvJx68JSx92otoazG1b6ObvBw2AhXK5nvHkeRkd84d j2B8OWBC0gSZGNAolUa8THCZ7pO3cbrHtPgWP0+LbeglVSFHL1f38OYA9N0NTX+l5JDj F9wBKtNYmOsZsedkleyU/+91f58h2VEKaMgSL3LJOg63TNKdkhDhygme2UDB97oCl9Xq 733A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oXTGXgrClMlW8LabyP51oPTHLt1d9TPP5bN7Oy9yaTQ=; b=dDCax+Ijpz3yo2ByIUS8pZHlFkEl1ZdicuS/f/0K/dH1EktWO1+fWXBL4L/LfxOZXB pidXIwrDkHCBXFyAFcH5ugr8oLCs8MuJA10zsm6Iw1zskU0RbWacYBkYBCAXzSLPeWx/ IxK/cbRQoIA+jBNHZHZYKdbvmyrNuvs/m9BUGc6Lc3iw2ez8bzZb4mbEyDjcWaTVw3pC G3833quC32uOb7IP9dUjj1VByrxB6FqRj6ybcfXfbFnHCvnizAZ+Cv+02qoMMmTlZzRM oqN5Y7zdmtjlI+q0DsLAtdJkK2GaEkaNdd9W/SGCn0xOn7qQv8TyV5FSnTuPSGtYGDly m8TA== X-Gm-Message-State: AGRZ1gKSHTdHiN2rkV7vKAqrtRFUDn+ZX/vIrh1lsXuhQnUQ7QIvuy1y tGe+MDRBDbJUFZXTlj028knI3Q== X-Google-Smtp-Source: AJdET5flT2RltjYvUfFa01zp/XWVLFWbb6gSf/AtfAY9TcWAKa6PTi5TTrKaXY9u4JY8vhtJ5NX6uw== X-Received: by 2002:a5d:6405:: with SMTP id z5-v6mr4882632wru.64.1542117758021; Tue, 13 Nov 2018 06:02:38 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:37 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 24/25] ARM: davinci: mityomapl138: use device properties for at24 eeprom Date: Tue, 13 Nov 2018 15:01:32 +0100 Message-Id: <20181113140133.17385-25-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We want to 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 --- arch/arm/mach-davinci/board-mityomapl138.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c index ac1a1699d185..a381b26328d8 100644 --- a/arch/arm/mach-davinci/board-mityomapl138.c +++ b/arch/arm/mach-davinci/board-mityomapl138.c @@ -14,13 +14,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include #include #include @@ -192,10 +192,10 @@ static struct nvmem_cell_lookup mityomapl138_nvmem_cell_lookup = { .con_id = "mac-address", }; -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 = { @@ -324,7 +324,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 Tue Nov 13 14:01: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: 10680723 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 140A514E2 for ; Tue, 13 Nov 2018 14:02:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 005CA2A980 for ; Tue, 13 Nov 2018 14:02:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F24742A9C0; Tue, 13 Nov 2018 14:02:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA8692A9C5 for ; Tue, 13 Nov 2018 14:02:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388170AbeKNAA7 (ORCPT ); Tue, 13 Nov 2018 19:00:59 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35783 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388167AbeKNAA7 (ORCPT ); Tue, 13 Nov 2018 19:00:59 -0500 Received: by mail-wr1-f68.google.com with SMTP id z16-v6so13463742wrv.2 for ; Tue, 13 Nov 2018 06:02:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iOIa5X6V4cgJ8Er7nxbPwFfoAVpLi0/2bfR7wn0jpPY=; b=olbsR3bryUL+m8cdBqebdbl5sXiBN6FUNTIZZrrRemVlScb33XIwsuM9Q9JcwdtlaI 3uldKDTKUG0/HCy3olbzzAGVV3WMn5IaxgRBtR+z2cfOvBvCJfMz7jPlmmOY9ovfqpnW W7peLuHFcHJRN79Qkfs6u4BwO3jrld5XA2jhNz46Qv2dT17h7Sb5uuxfnVggmm3AEINA ixyyOemKA4Mrg+EtP2ZxEoY0HNP93lKrKE5QUVRryKO1H+nLj5B4n4IWsMivfWSg8Qnv 8i57Osmv1WgjjkOJc7SqrwWBR3rnzS9qoGU2Rtur7p44jllEE7YXbhqhSVK0aEaSoNtr /pkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iOIa5X6V4cgJ8Er7nxbPwFfoAVpLi0/2bfR7wn0jpPY=; b=Hx6l1B26FIGdXjuIVJO69kP+kFpUPSky1+7v1dUg+b1hgABuEw8fIQ2nE1bkIfYPIj Z2qrAC2sUx82pZfzVr+V+63r0HdweeWQ911FDZm3Fkj/3h7A4Zty1c3ABO1U9edvrIuE qZrklAXwAV42P88V3cgX0CgU7ML3wHbif68/crbsvB4uLM8pnwF+MdGyyZTD7339oNcw IkTfMpkwCrav/3ibNOw1/F/WRjzAG54BRLubJCQzLJNZg8qpvv0MdbrN8bSf6jzPmuNp DywAAeRqvyytehnJD2whJ1W/s8JfIkAkfvxsoVoSmwGV/qPhrqFbww4vvF6n/3wueVUJ b/nw== X-Gm-Message-State: AGRZ1gImc3bp5lDHwtm1ByUjEUONoK4eLXfBtZ3cIxdSOe7Zc/7l/2Iw 451du73/MQ50CY4yLOsaKAtFEA== X-Google-Smtp-Source: AJdET5cElr1EIc919X00x8jS3UjEmAF6AlgNsuVE+jywos4OXpcGORBZeCSnsTE50fMcsp3jQTkJeQ== X-Received: by 2002:adf:f8d0:: with SMTP id f16-v6mr5271023wrq.265.1542117759794; Tue, 13 Nov 2018 06:02:39 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:39 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 25/25] eeprom: at24: remove at24_platform_data Date: Tue, 13 Nov 2018 15:01:33 +0100 Message-Id: <20181113140133.17385-26-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski 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 --- MAINTAINERS | 1 - drivers/misc/eeprom/at24.c | 162 +++++++++++++---------------- include/linux/platform_data/at24.h | 60 ----------- 3 files changed, 75 insertions(+), 148 deletions(-) delete mode 100644 include/linux/platform_data/at24.h diff --git a/MAINTAINERS b/MAINTAINERS index 0abecc528dac..b3ee25e95bd0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2456,7 +2456,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 636ed7149793..f189a5307abd 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 @@ -107,10 +121,6 @@ module_param_named(write_timeout, at24_write_timeout, uint, 0); MODULE_PARM_DESC(at24_write_timeout, "Time (in ms) to try writes (default 25)"); struct at24_chip_data { - /* - * these fields mirror their equivalents in - * struct at24_platform_data - */ u32 byte_len; u8 flags; }; @@ -468,63 +478,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, "address-width", &val); - if (!err) { - switch (val) { - case 8: - if (chip->flags & AT24_FLAG_ADDR16) - dev_warn(dev, "Override address width to be 8, while default is 16\n"); - chip->flags &= ~AT24_FLAG_ADDR16; - break; - case 16: - chip->flags |= AT24_FLAG_ADDR16; - break; - default: - dev_warn(dev, "Bad \"address-width\" property: %u\n", - val); - } - } - - 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)); @@ -541,13 +499,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) @@ -616,7 +570,8 @@ static int at24_probe(struct i2c_client *client) { struct regmap_config regmap_config = { }; struct nvmem_config nvmem_config = { }; - struct at24_platform_data pdata = { }; + u32 byte_len, page_size, flags, addrw; + const struct at24_chip_data *cdata; struct device *dev = &client->dev; bool i2c_fn_i2c, i2c_fn_block; unsigned int i, num_addresses; @@ -631,35 +586,72 @@ 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) - return 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, "address-width", &addrw); + if (!err) { + switch (addrw) { + case 8: + if (flags & AT24_FLAG_ADDR16) + dev_warn(dev, + "Override address width to be 8, while default is 16\n"); + flags &= ~AT24_FLAG_ADDR16; + break; + case 16: + flags |= AT24_FLAG_ADDR16; + break; + default: + dev_warn(dev, "Bad \"address-width\" property: %u\n", + addrw); + } + } + + err = device_property_read_u32(dev, "size", &byte_len); + if (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); @@ -672,11 +664,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; @@ -684,10 +676,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; } @@ -730,7 +722,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)) { @@ -739,13 +731,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 */