From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60786C4338F for ; Thu, 19 Aug 2021 03:41:07 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D1CC2606A5 for ; Thu, 19 Aug 2021 03:41:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D1CC2606A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6230982E67; Thu, 19 Aug 2021 05:40:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="MtPGumDA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1533782E85; Thu, 19 Aug 2021 05:40:50 +0200 (CEST) Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F32D682DD7 for ; Thu, 19 Aug 2021 05:40:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x22c.google.com with SMTP id u10so6655918oiw.4 for ; Wed, 18 Aug 2021 20:40:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EQWi8kydank6unHCW/H7K1JJJnv6kVmLjtEPbxVn4s4=; b=MtPGumDAV3Lz1S5NbQtzj8u+PEpNIL1Puo2PzsMKXMZLvWksRYG3HeJ37IDPnKgDdl cgpnHAe5aT88xmWahtwxLvZESLJ/L5pHW9oTVgOVcZSD/BBGnW8QjHcLB+jZAqZ+8eMd 9tez0jWUmjshex1u6fIMKx6F0VaVnr8e3j3jE= 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:mime-version:content-transfer-encoding; bh=EQWi8kydank6unHCW/H7K1JJJnv6kVmLjtEPbxVn4s4=; b=pwvHb2dheOxY+gQMjozAn0XI3YB8q0SDHyN00fgEtqbeS0Dig8YHwHT1JkGjnRur8A VKGaPAE8wvR3RRbaMj+YJhUCm44KLSxc/JQ+Dz+pcQbA3ze/xQu3KcX7NJk/7eMT6VU5 ypL42siwGdygzH+Ffmo2rBCcVEC6HFyCjJiyDSt8lPM+6VPI9xT5/QNPbnK//HcMv59y CfROiT5L7jTgMy3Ft8Ssus3t86cFS7vMQYHDxlqtz0Ga/4qsMRIaEzKWrNOc5WLJ67Md YBLDLL2jtHww3LhOBMRJkPOGhzPSF42pgIAVE3HDPet/lFZK3ytc4NXR8YeOXB0kHoNX vt4A== X-Gm-Message-State: AOAM532+V0XfSzoiRZ1nOo7FgbONH55qjdClfKDizJIcel18SpkG0/ed 3BbW5OODjSzbgxRlL0CXmc50I924caudFQ== X-Google-Smtp-Source: ABdhPJyPZWM3fsnTgItei0bKXOD/nROo6DfpmCHxF7+TUa4d3RmXJZmj0ma5q3ukHws3Os5Ek45V4g== X-Received: by 2002:aca:b656:: with SMTP id g83mr1134481oif.84.1629344441126; Wed, 18 Aug 2021 20:40:41 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id q27sm415877oof.12.2021.08.18.20.40.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 20:40:40 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Walter Lozano Subject: [PATCH 01/11] dtoc: Further improve documentation about warnings Date: Wed, 18 Aug 2021 21:40:23 -0600 Message-Id: <20210819034033.1617201-2-sjg@chromium.org> X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog In-Reply-To: <20210819034033.1617201-1-sjg@chromium.org> References: <20210819034033.1617201-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Split this information into subsections and expand it. Signed-off-by: Simon Glass --- doc/develop/driver-model/of-plat.rst | 92 ++++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 4 deletions(-) diff --git a/doc/develop/driver-model/of-plat.rst b/doc/develop/driver-model/of-plat.rst index 8a8eaed4c11..0bd978759c7 100644 --- a/doc/develop/driver-model/of-plat.rst +++ b/doc/develop/driver-model/of-plat.rst @@ -600,6 +600,11 @@ as a macro included in the driver definition:: Problems -------- +This section shows some common problems and how to fix them. + +Driver not found +~~~~~~~~~~~~~~~~ + In some cases you will you see something like this:: WARNING: the driver rockchip_rk3188_grf was not found in the driver list @@ -633,6 +638,9 @@ the devicetree. For example, if the devicetree has:: then dtoc looks at the first compatible string ("rockchip,rk3188-grf"), converts that to a C identifier (rockchip_rk3188_grf) and then looks for that. +Missing .compatible or Missing .id +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Various things can cause dtoc to fail to find the driver and it tries to warn about these. For example: @@ -649,6 +657,82 @@ Checks are also made to confirm that the referenced driver has a .compatible member and a .id member. The first provides the array of compatible strings and the second provides the uclass ID. +Missing parent +~~~~~~~~~~~~~~ + +When a device is used, its parent must be present as well. If you see an error +like:: + + Node '/i2c@0/emul/emul0' requires parent node '/i2c@0/emul' but it is not in + the valid list + +it indicates that you are using a node whose parent is not present in the +devicetree. In this example, if you look at the device tree output +(e.g. fdtdump tpl/u-boot-tpl.dtb in your build directory), you may see something +like this:: + + emul { + emul0 { + compatible = "sandbox,i2c-rtc-emul"; + #emul-cells = <0x00000000>; + phandle = <0x00000003>; + }; + }; + +In this example, 'emul0' exists but its parent 'emul' has no properties. These +have been dropped by fdtgrep in an effort to reduce the devicetree size. This +indicates that the two nodes have different phase settings. Looking at the +source .dts:: + + i2c_emul: emul { + u-boot,dm-spl; + reg = <0xff>; + compatible = "sandbox,i2c-emul-parent"; + emul0: emul0 { + u-boot,dm-pre-reloc; + compatible = "sandbox,i2c-rtc-emul"; + #emul-cells = <0>; + }; + }; + +you can see that the child node 'emul0' usees 'u-boot,dm-pre-reloc', indicating +that the node is present in all SPL builds, but its parent uses 'u-boot,dm-spl' +indicating it is only present in SPL, not TPL. For a TPL build, this will fail +with the above message. The fix is to change 'emul0' to use the same +'u-boot,dm-spl' condition, so that it is not present in TPL, like its parent. + +Link errors / undefined reference +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Sometimes dtoc does not find the problem for you, but something is wrong and +you get a link error, e.g.:: + + :(.u_boot_list_2_udevice_2_spl_test5+0x0): undefined reference to + `_u_boot_list_2_driver_2_sandbox_spl_test' + /usr/bin/ld: dts/dt-uclass.o:(.u_boot_list_2_uclass_2_misc+0x8): + undefined reference to `_u_boot_list_2_uclass_driver_2_misc' + +The first one indicates that the device cannot find its driver. This means that +there is a driver 'sandbox_spl_test' but it is not compiled into the build. +Check your Kconfig settings to make sure it is. If you don't want that in the +build, adjust your phase settings, e.g. by using 'u-boot,dm-spl' in the node +to exclude it from the TPL build:: + + spl-test5 { + u-boot,dm-tpl; + compatible = "sandbox,spl-test"; + stringarray = "tpl"; + }; + +We can drop the 'u-boot,dm-tpl' line so this node won't appear in the TPL +devicetree and thus the driver won't be needed. + +The second error above indicates that the MISC uclass is needed by the driver +(since it is in the MISC uclass) but that uclass is not compiled in the build. +The fix above would fix this error too. But if you do want this uclass in the +build, check your Kconfig settings to make sure the uclass is being built +(CONFIG_MISC in this case). + Caveats ------- @@ -697,7 +781,7 @@ Internals --------- Generated files -``````````````` +~~~~~~~~~~~~~~~ When enabled, dtoc generates the following five files: @@ -738,7 +822,7 @@ spl/dt-plat.c. CONFIG options -`````````````` +~~~~~~~~~~~~~~ Several CONFIG options are used to control the behaviour of of-platdata, all available for both SPL and TPL: @@ -793,7 +877,7 @@ READ_ONLY the nodes cannot be updated, OF_PLATDATA_NO_BIND is enabled. Data structures -``````````````` +~~~~~~~~~~~~~~~ A few extra data structures are used with of-platdata: @@ -821,7 +905,7 @@ A few extra data structures are used with of-platdata: `device_get_by_ofplat_idx()`. Other changes -````````````` +~~~~~~~~~~~~~ Some other changes are made with of-platdata: -- 2.33.0.rc1.237.g0d66db33f3-goog