From patchwork Tue Nov 13 14:01:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680761 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 EAD4014E2 for ; Tue, 13 Nov 2018 14:05:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D686926E74 for ; Tue, 13 Nov 2018 14:05:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7AD32894D; Tue, 13 Nov 2018 14:05:30 +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 8CC3A26E74 for ; Tue, 13 Nov 2018 14:05:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387728AbeKNADp (ORCPT ); Tue, 13 Nov 2018 19:03:45 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:33108 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387732AbeKNAAT (ORCPT ); Tue, 13 Nov 2018 19:00:19 -0500 Received: by mail-wm1-f67.google.com with SMTP id f19-v6so11281653wmb.0 for ; Tue, 13 Nov 2018 06:02:01 -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=H8x7i2Y0NQGhPOwYVcZG4ieMSrsXoI3OcuJ/XVYngLQ=; b=hPfwQE70p7pPEvw9+TUWD5NNH4b9dL17YrJaEUNEtZ7KYndN9V+FdRwV5aYAMttn0v QXve1XUIFOuEJJRuCd1VqaBj5QqxVpR9PMgABcgvfqvwoSl0undeasFfaTHFdE4oMd99 NcpL+1vyCCTTCfw1FOPmuveSOihp2RQpm3badhB9t273Qfu75hsUKkZx6PVqGP2zSMAJ M26MNR9rMwfRrVJYb4xVlmgb06t1aAnvUvPlHJ0ObUd95oNDAVMKAyVLecHO/OHTS9yf ejOGxnb6Vpp0Gmee1NYG2V4oHSrfk/ZF1Xcg9k9Z4EcjX+pATrJuI8AN4Lo8A7xNiw/7 /eNw== 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=H8x7i2Y0NQGhPOwYVcZG4ieMSrsXoI3OcuJ/XVYngLQ=; b=MM8IZbyyY7bhTrgFTMOmPU6IynKYZ7Nb2SxPqWRHVMtFge0HchQcLbeMt33ITkhaeu QUoGSlhdS8QqVxPTsx+UBzQKTc8ASyI7ZoMceICDIlmsed96h6kokUJbWN4VcPwRWjv+ SIe8OBqRFSQjrBQ1JeUjSYK6KkTRQKk+4mKVX8CBG2MHdcOb2hxNpSolzhWF/REMkf6O aHo56IUOvxP2iJQW4l7fD98bR0c41P8eQ4S4+3pp+DeWCuOmY6tG/UNq/AJggUi6EoV+ dHrvJXPluredsnnCzS7XeEMlzMdt4hqOoR3vzL/9Lujyb9t8YGvVF8e0GE6QFLP6ybSJ YBSg== X-Gm-Message-State: AGRZ1gIBmxg0q+Ciim/8tCSIODYjbOIdFX/zT7GN6LbW9fWaMOjPJZ6u Q/cXOZbskVVxzt9wISPOeTnf/g== X-Google-Smtp-Source: AJdET5dFcmh9LMc8AGT0EEsXUesVg/vqWwWx5Zo9mOUI6KdJwAKlRZQfUs9KoHRfAeOBsCksGprZXg== X-Received: by 2002:a1c:bc82:: with SMTP id m124-v6mr3337326wmf.76.1542117720757; Tue, 13 Nov 2018 06:02:00 -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.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:00 -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 04/25] ARM: davinci: dm644x-evm: use cell nvmem lookup for mac address Date: Tue, 13 Nov 2018 15:01:12 +0100 Message-Id: <20181113140133.17385-5-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-dm644x-evm.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index e4a8f9225d16..e1428115067f 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -510,6 +511,27 @@ static struct pcf857x_platform_data pcf_data_u35 = { * - ... newer boards may have more */ +static struct nvmem_cell_info dm644evm_nvmem_cells[] = { + { + .name = "macaddr", + .offset = 0x7f00, + .bytes = ETH_ALEN, + } +}; + +static struct nvmem_cell_table dm644evm_nvmem_cell_table = { + .nvmem_name = "1-00500", + .cells = dm644evm_nvmem_cells, + .ncells = ARRAY_SIZE(dm644evm_nvmem_cells), +}; + +static struct nvmem_cell_lookup dm644evm_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, @@ -842,6 +864,8 @@ static __init void davinci_evm_init(void) platform_add_devices(davinci_evm_devices, ARRAY_SIZE(davinci_evm_devices)); #ifdef CONFIG_I2C + nvmem_add_cell_table(&dm644evm_nvmem_cell_table); + nvmem_add_cell_lookups(&dm644evm_nvmem_cell_lookup, 1); evm_init_i2c(); davinci_setup_mmc(0, &dm6446evm_mmc_config); #endif