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