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: 858209 X-Patchwork-Delegate: trini@ti.com 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RHTcOgdb"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zGlwp3Lndz9ryk for ; Wed, 10 Jan 2018 21:43:38 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 280D1C2217E; 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-Google-Smtp-Source: ACJfBosrt1LsZNfSQs7L8utJY9Zlg6yyp/D0xlLxBNTXmV6xjhOEOZhDw4af0ke7ZHk/F1O15EHqQg== 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