From patchwork Wed Feb 13 21:46:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 1041619 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 440Cyw3VRsz9s7T for ; Thu, 14 Feb 2019 08:56:24 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 33411C220A4; Wed, 13 Feb 2019 21:52:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 58244C220CE; Wed, 13 Feb 2019 21:49:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6E27FC220C9; Wed, 13 Feb 2019 21:47:52 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by lists.denx.de (Postfix) with ESMTPS id 0E842C22038 for ; Wed, 13 Feb 2019 21:47:49 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 440Cn066pQz1r88x; Wed, 13 Feb 2019 22:47:48 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 440Cn05wlqz1rVwr; Wed, 13 Feb 2019 22:47:48 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id FArOX74fTRci; Wed, 13 Feb 2019 22:47:47 +0100 (CET) X-Auth-Info: ROhdvgllDHz/151NLl85ff0dFZU5a8m4Fl1nIAbntKE= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Wed, 13 Feb 2019 22:47:47 +0100 (CET) From: Lukasz Majewski To: Stefano Babic , u-boot@lists.denx.de, Fabio Estevam , Fabio Estevam , Stefan Agner , Marcel Ziswiler Date: Wed, 13 Feb 2019 22:46:58 +0100 Message-Id: <20190213214659.22106-22-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190213214659.22106-1-lukma@denx.de> References: <20190213214659.22106-1-lukma@denx.de> Cc: "Albert ARIBAUD \(3ADEV\)" Subject: [U-Boot] [PATCH v4 21/22] pcm052: mac: Provide board specific imx_get_mac_from_fuse() function X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This commit introduces the board specific function to read fused mac address. Signed-off-by: Lukasz Majewski --- Changes in v4: None Changes in v3: None Changes in v2: None board/phytec/pcm052/pcm052.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/board/phytec/pcm052/pcm052.c b/board/phytec/pcm052/pcm052.c index 721e25105a..1e443a5850 100644 --- a/board/phytec/pcm052/pcm052.c +++ b/board/phytec/pcm052/pcm052.c @@ -310,6 +310,47 @@ int board_init(void) } #ifdef CONFIG_TARGET_BK4R1 +void imx_get_mac_from_fuse(int dev_id, unsigned char *mac) +{ + struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR; + struct fuse_bank *bank = &ocotp->bank[4]; + struct fuse_bank4_regs *fuse = + (struct fuse_bank4_regs *)bank->fuse_regs; + u32 value; + + /* + * BK4 has different layout of stored MAC address + * than one used in imx_get_mac_from_fuse() @ generic.c + */ + + switch (dev_id) { + case 0: + value = readl(&fuse->mac_addr1); + + mac[0] = value >> 8; + mac[1] = value; + + value = readl(&fuse->mac_addr0); + mac[2] = value >> 24; + mac[3] = value >> 16; + mac[4] = value >> 8; + mac[5] = value; + break; + case 1: + value = readl(&fuse->mac_addr2); + + mac[0] = value >> 24; + mac[1] = value >> 16; + mac[2] = value >> 8; + mac[3] = value; + + value = readl(&fuse->mac_addr1); + mac[4] = value >> 24; + mac[5] = value >> 16; + break; + } +} + int board_late_init(void) { struct src *psrc = (struct src *)SRC_BASE_ADDR;