Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5402912imu; Tue, 13 Nov 2018 06:08:31 -0800 (PST) X-Google-Smtp-Source: AJdET5dz70mFLg5XUthouTCnxHrwgY3DK4g+rpohk5s8MLwgYC8Q4ukfjowpXBf/ERVo6yOlL7Iq X-Received: by 2002:a17:902:4165:: with SMTP id e92-v6mr5303258pld.209.1542118111578; Tue, 13 Nov 2018 06:08:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542118111; cv=none; d=google.com; s=arc-20160816; b=yYm8T5hkCBVqWjZ6iXnjhtYxcheim6RTcWFSPgyZDGMM5l8kq0Ctp0hX8UkCSC8ruW 6omOpKLUzhKAIA2eD3bidFEacordZrQNWWb3gOvnd11HbATOSAb4ZrsYtD9A1FjgGFD8 6BamdPP8172KDsTaCh6itbGPKbR5/gEfoLNSsD1NUK4OGS9coeKyvCwl9GDzQL70mlBU JBeN6h2ZJI4Pg75k+kqfB2gi4THrCjAX/eCZ+mUQzzqRjOjc0t3iGmV9ROedF74XMs91 liDNbwmeU1YRUJjI5ueiSCuiS4KeYauW2Ncj7vkjqxaWf5WyTUFjTzSbRwR8GZUuQciM zWFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0nBaGmCe8u5S4UVpGAAxUhIXM3J5gHJ7tC52GdLpEYw=; b=hOGGHmgGZWup9f5aqLAOX3NVlxDavBauOF0i7mXBKqfRV5teNHWZrWEV0YyqiEMMA9 Yhq9A5ZXfqHvE670Nk5108YxZKUMRYxReHpZgLqtGD+XaHjjsw6vkl4esfK7Ige0iQSv CJBubYNeVKRmeL/uaQaAdX0ukQoHD6eP6sj81OKNTQkFdwkNcp6wl77CBqFsEQTnLp1I 3zSJbQkzDJgFbu7Z9ftUPTH4dwZVW+abnd/vq0r3GDReJmPX9zDHBreatwqVblIbe9ji uGZicC2RDKoVNejiVDKEmHDvVY6vOxVJUyr1QUsJkVF7riu4qZHZlgtFrlm19up3RfCF ObpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=2JE+mT1M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q64si20314140pga.280.2018.11.13.06.07.47; Tue, 13 Nov 2018 06:08:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=2JE+mT1M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387817AbeKNAA0 (ORCPT + 99 others); Tue, 13 Nov 2018 19:00:26 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:37563 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387791AbeKNAAY (ORCPT ); Tue, 13 Nov 2018 19:00:24 -0500 Received: by mail-wr1-f68.google.com with SMTP id o15-v6so13421923wrv.4 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=qTqKLoR9gjvOxdLRfI7MUjqKLMNUnZ+wAIoWUb6PaP3yuMhEGT1CQy+NtMhl8ClUXe JhDca0OK3IdCUWY9H9SNGNWoGWFT5SnCsF3OqMsbvq3ussYTm2E89pE1BQKaaGmc4X8v W9qL1g4Zv/ShlC5f9j/lz6VkCHgNbvwLdn1/gtET6g6NLQCD6FrKEgQ6dAE34+nVe+fk qh8VeuDsJX6rmaKB22WZ9i4vn5FA+K9PWZduqMdE7njoKJLMeYtmAYwmkJj1LdOw/X0m ia3BUPUw7ydomwCqAxwbqgnH6pNuSg493OO7e3SI/97bEyIG4Dd7XDPcoYkPQcma5T25 JlTw== X-Gm-Message-State: AGRZ1gLsZRrBkCNLXKWqkXLfdwT31V0ZrO0pmK/q7yvBb50sBN1NjCDk 6247Gu4IYZf0NmPQwlMNKpeEsA== 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.19.1