From patchwork Wed Jan 10 10:34:38 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: 124044 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp1493892edr; Wed, 10 Jan 2018 02:43:40 -0800 (PST) X-Google-Smtp-Source: ACJfBosqpZS6Zpn2vVdK9ct5Byfuf3vpnDP4zMDvAOj6KQ2/fnZUU0eOTtvKnQ/yPnFOKJ+auhc5 X-Received: by 10.80.182.203 with SMTP id f11mr2387710ede.157.1515581020259; Wed, 10 Jan 2018 02:43:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515581020; cv=none; d=google.com; s=arc-20160816; b=bxkhpVEpnW21q6sg9PdkOxCLS+rb+RGuMJCsBv3aYYjVw50DXbPy98JSahb0EKW+zj PQHFK+hvIe//nQ9duDixI6CFC5A3ByN2tp0gDEfwZCqi/hPTnX6aa8yST89+elXo5Gvu ormA+4m9V8Dm95rskBfzjZLJpsr0hCcYrVsQ9NSVJB77rvi+xQpVH6/2+u5F8njVScEA OzQ6dRLnF59zl0FnhYizhDZ6F1I/bN/njFA/pkYxr1HmMQTeUsH8DOgr5AhmNAgQDLzO BKLXriVTdwGYy2YVOMuo35331dpdFex9IdSdc3N2USEjt7jH1zSX9rmQTKms8/2BOBlX t5ZA== 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=NNmpMtBWaiYU9SVIGSuXJsxL0WyR6vVan6c/pRh2hvKXlaPNK/85SR/8W1VTU5pdBa lHgeJEX7uOQ5sT3EKyf2OHMx9ULW0noDdLFl4xNXS/7LuSx1wxwgA0sGzWt/QmxlavrE OLdJJNvPoxFvQbuV/fnJCLgNi3QsgznUJYE0nkNHsRui4zmHXkXiPFVU+mxw9d1ks75C 7gt/5dU7WgrNK4pgBjJ1VKwGASGhhGn+c9pz5mt2KZ6P9J7N0payCvwrzpDl5IaCD6jv guhglutRezuOOnh+gkAIgzQ4qc9GzZ9rCo63sKR767k8GWWjXEIfT2J3tv3CsuS8ZDxr BJag== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=RHTcOgdb; 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 x65si2027566ede.301.2018.01.10.02.43.39; Wed, 10 Jan 2018 02:43:40 -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=RHTcOgdb; 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 994E9C2214A; Wed, 10 Jan 2018 10:42:16 +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_H2, 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 EC5E9C2215A; Wed, 10 Jan 2018 10:36:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 83E38C22192; Wed, 10 Jan 2018 10:35:02 +0000 (UTC) Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by lists.denx.de (Postfix) with ESMTPS id 426CFC21E08 for ; Wed, 10 Jan 2018 10:34:54 +0000 (UTC) Received: by mail-wr0-f195.google.com with SMTP id w107so16875947wrb.9 for ; Wed, 10 Jan 2018 02:34:54 -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=RHTcOgdbuaa89gXI4g37Hkoo8H4QFa8FORsdV2B32+R235zJC/LJj+TplzGK+9DndH FzGzBTv4ayOkM1cVGz16mi8JPXAoLn6e0pWq09UV2fPUhBwt8pBSUp6MwWNpWSdRRsks 3h8IdKs9/ogkuQ2d0v01WmnKTz+9t7ofGhaKUhX9VjTAwjlTtG9Jcz8VIrbYiA5hEOv2 JVcaDNLW9cvdOsD+bTPEuBP7dInwgtc9Aeet8HpED9ARtJ39r9Z8IKbaSLbFCtGRrQQq /MxaDZHwy2oM+bVgU3L0niobOX17eUUWEImQHC6AHt2nV7May8TQrCpsnASACbK96iY8 kWsQ== 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=oWyXGyi+2tHugoJt2aeYoZPpPtWP4lbOxuATvBihcGdObLsRSfZ8yVWoY/csf7D87F kUyuzSqn3NpF3HeC8ORObuk9GXHjLrsBzzvJKVHFaMW7fIhayVXNPYH6QoJ238kCzNQl dy7VsJkwNWZ6kxtpkRA0Raole76f93ZEZOqOr+OQ/dQvI3ZQ+qOV5cqjkL0UNehEvwIT bld6ALZvUWSYRq2Js80+3uNUE7ZJgRrx3ZQ35IWmFbLaf9s77azhLVmzRG38ciaNCjeN DXaU0PCy9LW65cYSJEpT1Mk2CVXq2Dj8/B5nV/DRs1fjM1fZhDB+AvnIa/6j4F1PLV+1 wd/g== X-Gm-Message-State: AKwxytcZLD0buGNvKGlXMG2Pgq9Thh6yn2RqGlaMHREEfmVwgSlu7cyL K6byF1l/iHIWkcOnWg8awC6mOg== X-Received: by 10.223.134.227 with SMTP id 32mr97017wry.176.1515580493746; Wed, 10 Jan 2018 02:34:53 -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 i33sm21484737wri.90.2018.01.10.02.34.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Jan 2018 02:34:53 -0800 (PST) From: Jorge Ramirez-Ortiz To: u-boot@lists.denx.de Date: Wed, 10 Jan 2018 11:34:38 +0100 Message-Id: <1515580480-26075-5-git-send-email-jorge.ramirez.ortiz@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515580480-26075-1-git-send-email-jorge.ramirez.ortiz@gmail.com> References: <1515580480-26075-1-git-send-email-jorge.ramirez.ortiz@gmail.com> Subject: [U-Boot] [PATCH v1 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