From patchwork Fri Jan 5 10:29:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 123497 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp640167qgn; Fri, 5 Jan 2018 02:39:24 -0800 (PST) X-Google-Smtp-Source: ACJfBouBsddnt7aeJ+ir04+dxaJcX5mVmI7YjtJmXQnzpLPFCUE6/+TZ4grFrfxnafcTq9lk1Zrg X-Received: by 10.80.180.236 with SMTP id x41mr3608779edd.241.1515148764695; Fri, 05 Jan 2018 02:39:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515148764; cv=none; d=google.com; s=arc-20160816; b=I6k/t7kWbUqt4CGTRbvBGXCJbITBRdqOR/Ek2eFGOh3MT82OO4GDRylktRHDfgBnAI Zy3+XlwJjB5UcN/6gulmEwxS5ox3emngzGod+IKEEowEWyvg+XX5mijY+TNiq1EgDZji LBr3PwieGRg8ZT3M1i//OmNVe1dLXqWRtawocSDT7L7wk350fc5vjedk1Mpc/kOQmIqN xDiuLVkVd6OdxlQDgrDzS79uHTg2hk/J+osTJJADk+N1d22Uo9CPNYNQWvjHXlbbZKSG FNnA/g+wpKWp+5ZB92QM16hfYY9jmyPV6ZIntQolWhbkB52jSCi36kq5Su/LJFSCWVlT 9O3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:arc-authentication-results; bh=/ZuqaSxGzKkOYOlaBnTEYb5XIQpMQuhgdc5B85UABWw=; b=0G40oTn5HcH8x8dG9oxzMZVMF+9/Y1odiOqP+JhRh0z0TJe8SyGrzw0Og9S9LaShY8 xm6hSuWgVwiyFnlaThASF1nCYmFJrFWb8kkI/H8pwYTNNe2vHFmh/e/QzfhjoAkEyc6C ZwUnnFFVeXcFAg3cYDzor5V1zDBY/YNbR1oWCiVebiuVd9nm2mEPnjeLwuZ79TiMdkAB HPDp9syQFOKqD1iKt0KIn9up1uh0uvqcTcJE1/9zfSkCel4B+/ZwWNZ3Y33xopIs2Hks FW/l5ews9inl9ELOGIKFBzLax3OsfXsuNFxQBZCUBrabgqj64MciyhiBDdCT+lglpraU eOww== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=dptpi3zB; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 31si3410089ede.425.2018.01.05.02.39.24; Fri, 05 Jan 2018 02:39:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=dptpi3zB; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 4D794C21E14; Fri, 5 Jan 2018 10:37:36 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID 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 3816BC21EC2; Fri, 5 Jan 2018 10:32:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AE4FFC21EA6; Fri, 5 Jan 2018 10:32:40 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id AC5EFC21E42 for ; Fri, 5 Jan 2018 10:30:07 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id 9so1558847wme.4 for ; Fri, 05 Jan 2018 02:30:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+UtnboSB9B19vLq2gJas75cDHsqjbUxUyvalJUMf1IA=; b=dptpi3zB5r+ze8U3MfiC5ik5TRnIrQ7iAJPwOSdXAzb1s8LpmyzcPD5DohNCjL/tRP 0H07U5MBTPfzRi+ym9HfdzJqbAzpbE3wrk6sysHrKuwyufC9MZYIQHK8womCSI/mtpnB TJHi+HjEd7JkNtHP2LKDkxCmwCMFLdmWLVtjQ= 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; bh=+UtnboSB9B19vLq2gJas75cDHsqjbUxUyvalJUMf1IA=; b=QRi57JECbdHyGFdNuSFYiCEN8eXzHLm1ijh+46X2VCEmayJHZK6JxSkqRTlMVcFEFX 9JuRqEzSj5DrU91OYqfk/bPwTtkTUAJKMCcK4+fdhBOOnx3U0BCCdHf8oYfgxm+tcnke vSeBPPrX+rz9FIhzMfuzX7dB29/YrTp+G1an3KPOJPxGQaD7y2l8LFoNWTlwlkrP2hpT +8P6GYwja7yFTfBB/FeknNjfO8ujgyiLEFQ4ppCRVVcPFrfeQATnoXFgcRJUJIASnR+r fYTw707uEkX8pX816+2RHDH/wxBgQQ9vHHdJ85AKePtDYg6rmNSKQRAZBpC3npQamBOF i6qg== X-Gm-Message-State: AKGB3mKf0Te8pRL3DQ43UGHCdFHVHwq8oLf+jibKQWZy/hgPYbTx5izd gP9mrp+/fc0HqhIiRi/BlTDRMA== X-Received: by 10.28.111.11 with SMTP id k11mr1913311wmc.119.1515148207282; Fri, 05 Jan 2018 02:30:07 -0800 (PST) Received: from igloo.80.58.61.254 (141.pool85-51-114.dynamic.orange.es. [85.51.114.141]) by smtp.gmail.com with ESMTPSA id w40sm3719020wrc.79.2018.01.05.02.30.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Jan 2018 02:30:06 -0800 (PST) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, u-boot@lists.denx.de Date: Fri, 5 Jan 2018 11:29:55 +0100 Message-Id: <1515148197-30234-5-git-send-email-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515148197-30234-1-git-send-email-jorge.ramirez-ortiz@linaro.org> References: <1515148197-30234-1-git-send-email-jorge.ramirez-ortiz@linaro.org> Subject: [U-Boot] [PATCH 05/07] db410c: use the device tree parsed by the lk loader. 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" We dont need to keep copies of the properties that we are going to fixup since we will be using the dtb provided by the firmware. Signed-off-by: Jorge Ramirez-Ortiz --- board/qualcomm/dragonboard410c/dragonboard410c.c | 71 ++++++++++++++---------- configs/dragonboard410c_defconfig | 1 + 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c index 8ef4338..236160a 100644 --- a/board/qualcomm/dragonboard410c/dragonboard410c.c +++ b/board/qualcomm/dragonboard410c/dragonboard410c.c @@ -15,14 +15,22 @@ DECLARE_GLOBAL_DATA_PTR; /* pointer to the device tree ammended by the firmware */ -extern const void *fw_dtb; +extern void *fw_dtb; -static char wlan_mac[ARP_HLEN]; -static char bt_mac[ARP_HLEN]; +void *board_fdt_blob_setup(void) +{ + if (fdt_magic(fw_dtb) != FDT_MAGIC) { + printf("Firmware provided invalid dtb!\n"); + return NULL; + } + + return fw_dtb; +} int dram_init(void) { gd->ram_size = PHYS_SDRAM_1_SIZE; + return 0; } @@ -138,36 +146,43 @@ int misc_init_r(void) int board_init(void) { - int offset, len; - const char *mac; - - /* take a copy of the firmware information (the user could unknownly - overwrite that DDR via tftp or other means) */ - - offset = fdt_node_offset_by_compatible(fw_dtb, -1, "qcom,wcnss-wlan"); - if (offset >= 0) { - mac = fdt_getprop(fw_dtb, offset, "local-mac-address", &len); - if (mac) - memcpy(wlan_mac, mac, ARP_HLEN); - } - - offset = fdt_node_offset_by_compatible(fw_dtb, -1, "qcom,wcnss-bt"); - if (offset >= 0) { - mac = fdt_getprop(fw_dtb, offset, "local-bd-address", &len); - if (mac) - memcpy(bt_mac, mac, ARP_HLEN); - } - return 0; } int ft_board_setup(void *blob, bd_t *bd) { - do_fixup_by_compat(blob, "qcom,wcnss-wlan", "local-mac-address", - wlan_mac, ARP_HLEN, 1); - - do_fixup_by_compat(blob, "qcom,wcnss-bt", "local-bd-address", - bt_mac, ARP_HLEN, 1); + int offset, len, i; + const char *mac; + struct { + const char *compatible; + const char *property; + } fix[] = { + [0] = { + /* update the kernel's dtb with wlan mac */ + .compatible = "qcom,wcnss-wlan", + .property = "local-mac-address", + }, + [1] = { + /* update the kernel's dtb with bt mac */ + .compatible = "qcom,wcnss-bt", + .property = "local-bd-address", + }, + }; + + for ( i = 0; i < sizeof(fix)/sizeof(fix[0]); i++) { + + offset = fdt_node_offset_by_compatible(gd->fdt_blob, -1, + fix[i].compatible); + if (offset < 0) + continue; + + mac = fdt_getprop(gd->fdt_blob, offset, fix[i].property, &len); + if (mac) + do_fixup_by_compat(blob, + fix[i].compatible, + fix[i].property, + mac, ARP_HLEN, 1); + } return 0; } diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconfig index de923ad..4389f52 100644 --- a/configs/dragonboard410c_defconfig +++ b/configs/dragonboard410c_defconfig @@ -47,3 +47,4 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_MMC=y CONFIG_OF_BOARD_SETUP=y CONFIG_PSCI_RESET=y +CONFIG_OF_SEPARATE=y