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