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