From patchwork Tue Jan 9 09:12:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jorge Ramirez-Ortiz, Gmail" X-Patchwork-Id: 123931 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3977373qgn; Tue, 9 Jan 2018 04:45:46 -0800 (PST) X-Google-Smtp-Source: ACJfBotbSn5WQvcym09VaWUKnMNrp7kPmiDON2Y5ebl27PCGbQL5NpJCgtF7KkhX9e6ppsQyzdU1 X-Received: by 10.80.231.13 with SMTP id a13mr21224923edn.264.1515501946040; Tue, 09 Jan 2018 04:45:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515501946; cv=none; d=google.com; s=arc-20160816; b=BmiUbSx2Q3MAXsePA87XpdT4TdQ9C9zsxCRMIjS3LY4RS49wUpS00xpnDAZjPpe5R6 gryT+mydMxdkUXJqEuUrg9X4TcRoDX6vlSvCQZRJ9EDqBXvvMQDDMxaTs33qN/mqZ/Fd adaMxC81iYc/DAtNPjAxT2H7SvpbFiRfekYPhGSTUncrcFWL7m/Bl9NbIzy/KX6pWoG2 VS2DWp60jhzIxkgt/XaTGOTDxIV3pwvQZRE+xAtYa+1vPMmzmQd1YUj9argC5J0PCcko xvRlm2DDJ9Kt5UvRNkiokmoevoHde/xSW5pP84zGLutPWp0Wb34kThfBdTmc2z9ADv6K Bu+A== 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=hvlQFVgbiED3rtKw8y4zwjSQUG2Xo1yw4bNjpvkWwCs=; b=VAMrSdRozlviajhBg9TY19ZFz0O2qlzCzblyDAfQqj6pPqjh5HPUWlnJo9YcBIZXTV o2988+Z7I+Nm8vuu4YkwWYDqx+4LsZ9HAmK0O18AW81n6k03k0rRKmZAgI04CLtc3Rkb CfLHrQwlSBNrfTFqrWh/qVUN6NYFcM7KCZy7UJHL1y4G5DAHvZdNzc+ANMtsbdoxnttY 8/9OzROcSe7iktB4Rr47/2iHberH214mD1SjRbbhChloUNl6+27iL50kvBzCMCV3H+l1 eX+VCo0p9DjIeM62f0BWOMWapRQqf23KwaQ9np1x88jQEC3GQNLP/0Z55Fom2ni/8BMi izGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=GkrfOMqQ; 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=gmail.com Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 34si9541293edi.265.2018.01.09.04.45.45; Tue, 09 Jan 2018 04:45:46 -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=@gmail.com header.s=20161025 header.b=GkrfOMqQ; 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=gmail.com Received: by lists.denx.de (Postfix, from userid 105) id 9B50FC21FB8; Tue, 9 Jan 2018 12:40:14 +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=FREEMAIL_FROM, 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 D7684C22051; Tue, 9 Jan 2018 12:34:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2CB31C21F98; Tue, 9 Jan 2018 09:12:44 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by lists.denx.de (Postfix) with ESMTPS id CADEBC22072 for ; Tue, 9 Jan 2018 09:12:43 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id b76so19240457wmg.1 for ; Tue, 09 Jan 2018 01:12:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=DGa8NPaKlVxCJ0cRoxqtwgwkC8YEprG7ZNL6mGwjjpk=; b=GkrfOMqQnNhNHLA6Z2rI/0Dga2Q1I0le05fPYd1Smv0kRwkuB8jp4H8lMC6zTy3Zt1 8xE2HVZCSmaiD0IMxcXnZy8g1KNAkuMLU3oQZHszjso3T4DOmJS3B6+cXZ5pgXelUkdt bfuuRO6k19Dc+sS5Ea1j6hL91CLXd6EkehrfiG91F7S7VWPunsuAOW6cOgSXSwLR8PtZ n4daP/QUFbQslBNI44RhXpg5OyFChQClXCe5CczhLMX9DR4lXsHDRiy4huP2CxcwWDr9 nUc6lmE/B9W5MyIe8n5F1ACxLMJlKuHiXSoxp3hiTlCc0ByXwhSpJ0/6Y796evz6jvtP 5IJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=DGa8NPaKlVxCJ0cRoxqtwgwkC8YEprG7ZNL6mGwjjpk=; b=NMasb/eWjFYdAM5eQspRdhND8b5bPMXlqc1LhgRXLXztAziFNexeqpK+GiQmGnqDbp 6G/mfDdEStNQ30tNIZDq9KUStGXwiIgKZ/ScVUhQkCREwWHLudkcvTf7dnP2Hcuv5PiX NfNATXe/3cFzGJGNppRyqDWFAbWt27VQCYFaqabcsr2W/rX6MIxbbEqg1nVcaUqRfNuh XMYn2udHvDqJWjnnDIYcMZcbycE1asw9orN++0PI8SJTDouztrWfKGCA69yf22lVekmG JB4u8vwvwsycrZUIdQG3R1fPgLp7b2MzzYtLpXVxPBR1gUqQSfGuU5XjN0s5h9QpncY2 7dGQ== X-Gm-Message-State: AKGB3mKD9bPP317xBnMPxgPKugNP4SbEAwV8sCKCRWUAYHONGS6GObN3 02jW23orCQEjw0gM7oB3dfw= X-Received: by 10.28.1.196 with SMTP id 187mr12409006wmb.154.1515489163542; Tue, 09 Jan 2018 01:12:43 -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 b8sm18496598wma.2.2018.01.09.01.12.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Jan 2018 01:12:42 -0800 (PST) From: Jorge Ramirez-Ortiz To: jorge.ramirez.ortiz@gmail.com, pbrobinson@gmail.com, u-boot@lists.denx.de Date: Tue, 9 Jan 2018 10:12:32 +0100 Message-Id: <1515489154-6946-5-git-send-email-jorge.ramirez.ortiz@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515489154-6946-1-git-send-email-jorge.ramirez.ortiz@gmail.com> References: <1515489154-6946-1-git-send-email-jorge.ramirez.ortiz@gmail.com> X-Mailman-Approved-At: Tue, 09 Jan 2018 12:34:33 +0000 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" From: Jorge Ramirez-Ortiz 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