From patchwork Fri Jan 5 10:28:42 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: 123489 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp634349qgn; Fri, 5 Jan 2018 02:32:46 -0800 (PST) X-Google-Smtp-Source: ACJfBovH9M5PqHNy1ljWVOeCY3Fx15coNkwu/NZnOKt6BqLlO63VsTiKet4IPNq0Zdk1dBq8kwxP X-Received: by 10.80.244.12 with SMTP id r12mr3445225edm.2.1515148366630; Fri, 05 Jan 2018 02:32:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515148366; cv=none; d=google.com; s=arc-20160816; b=O4fgmK+GXWN5xpKZXh2C+mlFSQGht7CVdC6ydZ4kpNAacazyMfFGWtMDCD4iFCpwfO G7ieisVey1LkHDgisrgLxDncfrt06UvzOt95KgyeO9CLlaxLfC4kzxWtLOh66lVH4cCo 0E+fzpyOivmmLk74Wy0KkkjqU6111cPXHAfRH00jKBTSJ089lV5ZqwbPra8kExMa3uuO mSg9gdDkrLdZ6l4CJSS8JUyNNAz+vxdhiHUolVLg/TbXYEmZPkzZyDhiVI7v4AXgH1tq vPSaXu+rMC9aoqs0VFB/4dHQtQFidzvMXHa67k9RGRctGq/9s25px7olXgzanywcDhJa 7/gQ== 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=TmAaOUF9i1MgbbQtZhVsu+0v1ppjjpIMQNzpvWz6K9o=; b=0RJfmAL5XPa6BYHBmW9783t9IDMw31ko4GXs7Qhq+7MrmHoKJnnIFKVJ4iojHmr1BT p8/HWn9VoM648m/AD8NflIxUoizlU9se0at4DhyFp64JofkM85SIhOmDw51sS7Pq8CtZ c8CK2JZ1wTcIl/FNE6jWQF5oV5QVi3g2mWPqBh9cgxlEnlrG63M79fL7GNjsuriVl+RU pKpF4h3q1K4baEytiEY2juJmodJ6BvY4L/b2WcrIDJjjYupmkYnufQ2PydSpv3KkNkyy oXVXXcldCqkAGY1RL2I/ZY2OhBajodZ4oEmNTw6MvmjGlmX1crqdZzWyQHWHaxzOhL6g 5Wog== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NyaMd7VQ; 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 e16si1584928ede.427.2018.01.05.02.32.46; Fri, 05 Jan 2018 02:32: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=@linaro.org header.s=google header.b=NyaMd7VQ; 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 08652C21EC8; Fri, 5 Jan 2018 10:32:42 +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 BADBDC21E5A; Fri, 5 Jan 2018 10:28:58 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4145AC21DC1; Fri, 5 Jan 2018 10:28:54 +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 0AD6EC21E13 for ; Fri, 5 Jan 2018 10:28:51 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id 9so1551704wme.4 for ; Fri, 05 Jan 2018 02:28:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=9pFfsSHGvEpykZaFmJYB2ofWm6ZDsM39EBqArbAirYE=; b=NyaMd7VQigIPqH3oP3/DR8RbaDFx4cbWeHsv1ziud4+2rwT/Y78vW8pMnuhtweSnJ1 yAwAnlfhCTNN+76p+G1JxYO8CyOiIUSNhCAW3d35gI39DfjE1k8VPzppwjcR0j0t9Cow QwARe1QsxMqarktBDiQWFQzFEvNY0NTCn0Oe4= 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=9pFfsSHGvEpykZaFmJYB2ofWm6ZDsM39EBqArbAirYE=; b=a+RnALDnU9nBba9TGRE1git7FZJSGQNaKZ6HrCTpi2McNOOExv0rc2cIJg/JrIEy8s 6VsRlO0BlRHnbDJMQJwoRpWogf1dSi6/G27BiFV9VMC6doANpT5P4vYoGNgSzxKWz9s2 k76eMYCffFO/gX4MmDhUSb+sKs1xnRKu42CYzDwmEGTKMY0kG/1N071D87FJPk6thZd5 QgXtdob/DRF+fyB1Hf3xUB5h/NDOB7kNkCsfkUSb2wvsLRsMsYD9HJAj1Iq6z/EXV/P3 OmAPxsplyTQq6W+vnh8KpeBafcNgcLAgcfJOgZ/Xbf4WBvFtFQf/nOJTl8GA6tryOcB5 7Opw== X-Gm-Message-State: AKGB3mJh08oZbh7oJmxtyA9lK0iiLMexDvucKP/baW77hJunyzB9os22 Iom3pWkQw/R3ftXQKXnFds2CRg== X-Received: by 10.28.241.1 with SMTP id p1mr2062443wmh.111.1515148130637; Fri, 05 Jan 2018 02:28:50 -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 n33sm10364286wrn.76.2018.01.05.02.28.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Jan 2018 02:28:49 -0800 (PST) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, u-boot@lists.denx.de Date: Fri, 5 Jan 2018 11:28:42 +0100 Message-Id: <1515148122-30049-3-git-send-email-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515148122-30049-1-git-send-email-jorge.ramirez-ortiz@linaro.org> References: <1515148122-30049-1-git-send-email-jorge.ramirez-ortiz@linaro.org> Subject: [U-Boot] [PATCH 03/03] dm: core: parse chosen node 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: Rob Clark This is the node that would contain, for example, the framebuffer setup by an earlier stage. Signed-off-by: Rob Clark --- arch/sandbox/dts/test.dts | 7 +++++++ drivers/core/root.c | 12 ++++++++++++ test/dm/bus.c | 2 +- test/dm/test-fdt.c | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index e67d428..3f9e788 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -478,6 +478,13 @@ wdt0: wdt@0 { compatible = "sandbox,wdt"; }; + + chosen { + chosen-test { + compatible = "denx,u-boot-fdt-test"; + reg = <9 1>; + }; + }; }; #include "sandbox_pmic.dtsi" diff --git a/drivers/core/root.c b/drivers/core/root.c index 976e2c4..5a1c599 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -266,6 +266,18 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob, for (offset = fdt_first_subnode(blob, offset); offset > 0; offset = fdt_next_subnode(blob, offset)) { + + /* "chosen" node isn't a device itself but may contain some: */ + if (!strcmp(fdt_get_name(blob, offset, NULL), "chosen")) { + pr_debug("parsing subnodes of \"chosen\"\n"); + + err = dm_scan_fdt_node(parent, blob, offset, + pre_reloc_only); + if (err && !ret) + ret = err; + continue; + } + if (pre_reloc_only && !dm_fdt_pre_reloc(blob, offset)) continue; diff --git a/test/dm/bus.c b/test/dm/bus.c index 7006d41..1da398a 100644 --- a/test/dm/bus.c +++ b/test/dm/bus.c @@ -105,7 +105,7 @@ UCLASS_DRIVER(testbus) = { /* Test that we can probe for children */ static int dm_test_bus_children(struct unit_test_state *uts) { - int num_devices = 6; + int num_devices = 7; struct udevice *bus; struct uclass *uc; diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index dcc2ef8..920ccbf 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -167,7 +167,7 @@ int dm_check_devices(struct unit_test_state *uts, int num_devices) /* Test that FDT-based binding works correctly */ static int dm_test_fdt(struct unit_test_state *uts) { - const int num_devices = 6; + const int num_devices = 7; struct udevice *dev; struct uclass *uc; int ret;