All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Simon Glass <sjg@chromium.org>,
	Walter Lozano <walter.lozano@collabora.com>
Subject: [PATCH 01/11] dtoc: Further improve documentation about warnings
Date: Wed, 18 Aug 2021 21:40:23 -0600	[thread overview]
Message-ID: <20210819034033.1617201-2-sjg@chromium.org> (raw)
In-Reply-To: <20210819034033.1617201-1-sjg@chromium.org>

Split this information into subsections and expand it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 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


  reply	other threads:[~2021-08-19  3:41 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19  3:40 [PATCH 00/11] sandbox: Minor fixes and improvements Simon Glass
2021-08-19  3:40 ` Simon Glass [this message]
2021-09-23  2:08   ` [PATCH 01/11] dtoc: Further improve documentation about warnings Tom Rini
2021-08-19  3:40 ` [PATCH 02/11] sandbox: Correct handling of --rm_memory Simon Glass
2021-09-23  2:08   ` Tom Rini
2021-08-19  3:40 ` [PATCH 03/11] sandbox: Add license headers to the dts files Simon Glass
2021-09-23  2:08   ` Tom Rini
2021-08-19  3:40 ` [PATCH 04/11] btrfs: Suppress the message about missing filesystem Simon Glass
2021-08-19 10:31   ` Marek Behún
2021-08-19 10:48   ` Qu Wenruo
2021-09-23  2:08   ` Tom Rini
2021-08-19  3:40 ` [PATCH 05/11] sqfs: " Simon Glass
2021-08-19  7:03   ` Miquel Raynal
2021-09-23  2:08   ` Tom Rini
2021-08-19  3:40 ` [PATCH 06/11] test: Tidy a comment in the bloblist test Simon Glass
2021-09-23  2:08   ` Tom Rini
2021-08-19  3:40 ` [PATCH 07/11] dm: core: Fix a few incorrect comments on first/next functions Simon Glass
2021-09-23  2:09   ` Tom Rini
2021-08-19  3:40 ` [PATCH 08/11] sandbox: Add a way to find the size of a file Simon Glass
2021-08-19 10:27   ` Marek Behún
2021-09-23  2:09   ` Tom Rini
2021-08-19  3:40 ` [PATCH 09/11] sandbox: Add a way to map a file into memory Simon Glass
2021-08-19 10:28   ` Marek Behún
2021-09-23  2:09   ` Tom Rini
2021-09-24  2:48     ` Simon Glass
2021-08-19  3:40 ` [PATCH 10/11] sandbox: mmc: Support a backing file Simon Glass
2021-08-28  5:15   ` Jaehoon Chung
2021-08-28  6:39   ` Sean Anderson
2021-09-18  9:34     ` Simon Glass
2021-09-16 18:40   ` Tom Rini
2021-09-18  9:34     ` Simon Glass
2021-09-18 13:16       ` Tom Rini
2021-09-18 16:31         ` Simon Glass
2021-09-20  3:18           ` Simon Glass
2021-10-21 20:17             ` Simon Glass
2021-08-19  3:40 ` [PATCH 11/11] test: Add a way to skip console checking until a string matches Simon Glass
2021-09-23  2:09   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210819034033.1617201-2-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=walter.lozano@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.