dtoc: Don't generate platform data with instantiation
This file is not used when instantiating devices. Update dtoc to skip
generating its contents and just add a comment instead.
Also it is useful to see the driver name and parent for each device.
Update the file to show that information, to avoid updating the same
tests twice.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py
index a51a7f3..c6e33d3 100755
--- a/tools/dtoc/test_dtoc.py
+++ b/tools/dtoc/test_dtoc.py
@@ -48,13 +48,15 @@
*/
'''
-C_HEADER = '''/*
+C_HEADER_PRE = '''/*
* DO NOT MODIFY
*
* Declares the U_BOOT_DRIVER() records and platform data.
* This was generated by dtoc from a .dtb (device tree binary) file.
*/
+'''
+C_HEADER = C_HEADER_PRE + '''
/* Allow use of U_BOOT_DRVINFO() in this file */
#define DT_PLAT_C
@@ -289,9 +291,11 @@
\tconst char *\tstringval;
};
'''
-
platdata_text = C_HEADER + '''
-/* Node /i2c@0 index 0 */
+/*
+ * Node /i2c@0 index 0
+ * driver sandbox_i2c parent None
+ */
static struct dtd_sandbox_i2c dtv_i2c_at_0 = {
};
U_BOOT_DRVINFO(i2c_at_0) = {
@@ -301,7 +305,10 @@
\t.parent_idx\t= -1,
};
-/* Node /i2c@0/pmic@9 index 1 */
+/*
+ * Node /i2c@0/pmic@9 index 1
+ * driver sandbox_pmic parent sandbox_i2c
+ */
static struct dtd_sandbox_pmic dtv_pmic_at_9 = {
\t.low_power\t\t= true,
\t.reg\t\t\t= {0x9, 0x0},
@@ -313,7 +320,10 @@
\t.parent_idx\t= 0,
};
-/* Node /spl-test index 2 */
+/*
+ * Node /spl-test index 2
+ * driver sandbox_spl_test parent None
+ */
static struct dtd_sandbox_spl_test dtv_spl_test = {
\t.boolval\t\t= true,
\t.bytearray\t\t= {0x6, 0x0, 0x0},
@@ -333,7 +343,10 @@
\t.parent_idx\t= -1,
};
-/* Node /spl-test2 index 3 */
+/*
+ * Node /spl-test2 index 3
+ * driver sandbox_spl_test parent None
+ */
static struct dtd_sandbox_spl_test dtv_spl_test2 = {
\t.acpi_name\t\t= "\\\\_SB.GPO0",
\t.bytearray\t\t= {0x1, 0x23, 0x34},
@@ -352,7 +365,10 @@
\t.parent_idx\t= -1,
};
-/* Node /spl-test3 index 4 */
+/*
+ * Node /spl-test3 index 4
+ * driver sandbox_spl_test parent None
+ */
static struct dtd_sandbox_spl_test dtv_spl_test3 = {
\t.longbytearray\t\t= {0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10,
\t\t0x0},
@@ -414,7 +430,10 @@
with open(output) as infile:
data = infile.read()
self._check_strings(C_HEADER + '''
-/* Node /gpios@0 index 0 */
+/*
+ * Node /gpios@0 index 0
+ * driver sandbox_gpio parent None
+ */
static struct dtd_sandbox_gpio dtv_gpios_at_0 = {
\t.gpio_bank_name\t\t= "a",
\t.gpio_controller\t= true,
@@ -942,7 +961,10 @@
with open(output) as infile:
data = infile.read()
self._check_strings(C_HEADER + '''
-/* Node /spl-test index 0 */
+/*
+ * Node /spl-test index 0
+ * driver sandbox_spl_test parent None
+ */
static struct dtd_sandbox_spl_test dtv_spl_test = {
\t.intval\t\t\t= 0x1,
};
@@ -953,7 +975,10 @@
\t.parent_idx\t= -1,
};
-/* Node /spl-test2 index 1 */
+/*
+ * Node /spl-test2 index 1
+ * driver sandbox_spl_test parent None
+ */
static struct dtd_sandbox_spl_test dtv_spl_test2 = {
\t.intarray\t\t= 0x5,
};
@@ -1226,3 +1251,11 @@
data = infile.read()
self._check_strings(self.decl_text_inst, data)
+
+ self.run_test(['platdata'], dtb_file, output, True)
+ with open(output) as infile:
+ data = infile.read()
+
+ self._check_strings(C_HEADER_PRE + '''
+/* This file is not used: --instantiate was enabled */
+''', data)