summaryrefslogtreecommitdiff
path: root/include/dm/device.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-02-03 16:01:04 +0300
committerSimon Glass <sjg@chromium.org>2021-03-22 09:23:27 +0300
commit735ddfc638bf3ffdf6888f5502bddbbfa6b3636e (patch)
tree67311f136093e5b3a1d1295ab6847f280538a037 /include/dm/device.h
parent67c053341ff65e1fa6386f633492c7fc9d03fe18 (diff)
downloadu-boot-735ddfc638bf3ffdf6888f5502bddbbfa6b3636e.tar.xz
dtoc: Support headers needed for drivers
Typically dtoc can detect the header file needed for a driver by looking for the structs that it uses. For example, if a driver as a .priv_auto that uses 'struct serial_priv', then dtoc can search header files for the definition of that struct and use the file. In some cases, enums are used in drivers, typically with the .data field of struct udevice_id. Since dtoc does not support searching for these, add a way to tell dtoc which header to use. This works as a macro included in the driver definition. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm/device.h')
-rw-r--r--include/dm/device.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/dm/device.h b/include/dm/device.h
index 84df5b9e95..45010b4df9 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -386,6 +386,24 @@ struct driver {
#define DM_PHASE(_phase)
/**
+ * Declare a macro to declare a header needed for a driver. Often the correct
+ * header can be found automatically, but only for struct declarations. For
+ * enums and #defines used in the driver declaration and declared in a different
+ * header from the structs, this macro must be used.
+ *
+ * This macro produces no code but its information will be parsed by dtoc. The
+ * macro can be used multiple times with different headers, for the same driver.
+ * Put it within the U_BOOT_DRIVER() declaration, e.g.:
+ *
+ * U_BOOT_DRIVER(cpu) = {
+ * .name = ...
+ * ...
+ * DM_HEADER(<asm/cpu.h>)
+ * };
+ */
+#define DM_HEADER(_hdr)
+
+/**
* dev_get_plat() - Get the platform data for a device
*
* This checks that dev is not NULL, but no other checks for now