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);