1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-25 12:31:17 +02:00

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>
This commit is contained in:
Simon Glass
2021-02-03 06:01:04 -07:00
parent 67c053341f
commit 735ddfc638
3 changed files with 29 additions and 0 deletions

View File

@@ -234,6 +234,7 @@ U_BOOT_DRIVER(i2c_tegra) = {
drv = scan._drivers['i2c_tegra']
self.assertEqual('i2c_tegra', drv.name)
self.assertEqual('', drv.phase)
self.assertEqual([], drv.headers)
def test_priv(self):
"""Test collection of struct info from drivers"""
@@ -252,6 +253,8 @@ U_BOOT_DRIVER(testing) = {
.per_child_auto = sizeof(struct some_cpriv),
.per_child_plat_auto = sizeof(struct some_cplat),
DM_PHASE(tpl)
DM_HEADER(<i2c.h>)
DM_HEADER(<asm/clk.h>)
};
'''
scan = src_scan.Scanner(None, False, None)
@@ -267,6 +270,7 @@ U_BOOT_DRIVER(testing) = {
self.assertEqual('some_cpriv', drv.child_priv)
self.assertEqual('some_cplat', drv.child_plat)
self.assertEqual('tpl', drv.phase)
self.assertEqual(['<i2c.h>', '<asm/clk.h>'], drv.headers)
self.assertEqual(1, len(scan._drivers))
def test_uclass_scan(self):