[PATCH v2 00/33] dm: Add dtoc implementation of device instantiation (part D)
Simon Glass
sjg at chromium.org
Wed Feb 3 14:00:48 CET 2021
By way of background, in May[1] and July[2] two 'tiny-dm' series were
sent out, showing a possible way to reduce the overhead of driver model in
SPL. The potential impact of that work was described in the cover
letter[3].
While this was a successful demonstration, all but eliminating the
overhead of driver model, it was not very practical, since it would have
required substantial effort to adapt drivers used in SPL to what was
effectively a parallel driver model.
Instead, after much discussion [4], it was decided to try to use the
tiny-dm methods to adapt the existing of-platdata infrastructure. This is
considerably more work up front but should result in much less effort for
maintainers, along with a single, more consistent driver model.
Of the options mentioned in [3], the following are implemented (in dtoc
only, not driver model) as part of this series (CS=reduces code size,
DS=reduces data size):
CS - drop driver_bind() and create devices (struct udevice) at
build-time
CS - allocate all device- and uclass-private data at build-time
In addition the following was completed in an earlier series:
CS / DS - Combine req_seq and seq and calculate the new value at
build-time
So this series updates dtoc to support generating devices and uclasses
that are ready for use when SPL starts and don't need to be bound.
This 'build-time' instantiation helps to reduce the code-size overhead of
driver model in SPL.
As part of this series, a new -i option is added to dtoc. This changes it
to emit build-time-instantiated devices. Separate Kconfig options control
instantiation and whether run-time binding is supported.
Several corner cases have come up in making this work on sandbox_spl and
chromebook_coral. It is possible that others will come up in the future,
but it should be possible to adapt things to address these, based on the
work here.
This is part D of the overall effort. The final series includes the
driver model implementation, as well as updating the documentation.
To find out what the new generated files look like, see the last four
patches of this series.
It is available at u-boot-dm/prepd-working
[1] http://patchwork.ozlabs.org/project/uboot/list/?series=179128&state=*
[2] http://patchwork.ozlabs.org/project/uboot/list/?series=187295&state=*
[3] https://lists.denx.de/pipermail/u-boot/2020-July/418433.html
[4] http://patchwork.ozlabs.org/project/uboot/patch/20200525093539.1.Ibf2d19439cde35e39192a9d4a8dad23539fae2e6@changeid/
Changes in v2:
- New patch
- New patch
- New patch
- Drop patches previously applied
- Update cover letter
- Fix the naming for uclass_plat_name so it is different from uclass_priv
- Tidy up tabbing to make the code output line up better
- Add a summary to the top of the generated file
Simon Glass (33):
bootstage: Fix dependency for BOOTSTAGE_RECORD_COUNT
dtoc: Scan drivers for available information
dtoc: Save scan information across test runs
dtoc: Ignore unwanted files when scanning for drivers
dtoc: Collect priv/plat struct info from drivers
dtoc: Support scanning of uclasses
dtoc: Support scanning of structs in header files
dtoc: Move test files into a test/ directory
dtoc: Rename sandbox_i2c_test and sandbox_pmic_test
dtoc: Add some extra properties to nodes
dtoc: Make use of node properties
dtoc: Process nodes to set up required properties
dtoc: Track nodes which are actually used
dtoc: Support tracking the phase of U-Boot
Makefile: Pass the U-Boot phase to dtoc
dtoc: Support headers needed for drivers
dtoc: Process driver aliases along with drivers
dtoc: Warn of duplicate drivers
dtoc: Read aliases for uclasses
dtoc: Detect drivers only at the start of start of line
dtoc: Assign a sequence number to each node
dtoc: Set up the uclasses that are used
dtoc: Support processing the root node
dtoc: Add an option for device instantiation
dm: of-platadata: Add option for device instantiation
dtoc: Add support for decl file
dtoc: Don't generate platform data with instantiation
sandbox: Make sandbox,emul more conventional
sandbox: i2c: Rename driver names to work with of-platdata
dtoc: Tidy up the list of supported phandle properties
dtoc: Generate a summary in the dt-plat.c file
dtoc: Generate uclass devices
dtoc: Generate device instances
arch/sandbox/dts/sandbox.dtsi | 6 +-
arch/sandbox/dts/test.dts | 4 +-
common/Kconfig.boot | 3 +
common/bootstage.c | 2 +-
doc/driver-model/of-plat.rst | 3 +-
doc/driver-model/pci-info.rst | 1 +
drivers/i2c/i2c-emul-uclass.c | 4 +-
drivers/misc/test_drv.c | 11 +-
drivers/rtc/i2c_rtc_emul.c | 2 +-
dts/Kconfig | 23 +-
include/dm/device.h | 34 +
include/dm/test.h | 5 +
scripts/Makefile.spl | 6 +-
test/dm/test-fdt.c | 6 +-
tools/dtoc/dtb_platdata.py | 620 +++++++++-
tools/dtoc/dtoc_test_scan_drivers.cxx | 1 -
tools/dtoc/main.py | 9 +-
tools/dtoc/src_scan.py | 597 +++++++++-
tools/dtoc/{ => test}/dtoc_test.dts | 0
tools/dtoc/{ => test}/dtoc_test_add_prop.dts | 0
tools/dtoc/{ => test}/dtoc_test_addr32.dts | 0
tools/dtoc/{ => test}/dtoc_test_addr32_64.dts | 0
tools/dtoc/{ => test}/dtoc_test_addr64.dts | 0
tools/dtoc/{ => test}/dtoc_test_addr64_32.dts | 0
tools/dtoc/test/dtoc_test_alias_bad.dts | 58 +
tools/dtoc/test/dtoc_test_alias_bad_path.dts | 58 +
tools/dtoc/test/dtoc_test_alias_bad_uc.dts | 58 +
tools/dtoc/{ => test}/dtoc_test_aliases.dts | 0
tools/dtoc/{ => test}/dtoc_test_bad_reg.dts | 0
tools/dtoc/{ => test}/dtoc_test_bad_reg2.dts | 0
.../{ => test}/dtoc_test_driver_alias.dts | 0
tools/dtoc/{ => test}/dtoc_test_empty.dts | 0
tools/dtoc/test/dtoc_test_inst.dts | 58 +
.../{ => test}/dtoc_test_invalid_driver.dts | 0
tools/dtoc/{ => test}/dtoc_test_phandle.dts | 0
.../dtoc/{ => test}/dtoc_test_phandle_bad.dts | 0
.../{ => test}/dtoc_test_phandle_bad2.dts | 0
.../{ => test}/dtoc_test_phandle_cd_gpios.dts | 0
.../{ => test}/dtoc_test_phandle_reorder.dts | 0
.../{ => test}/dtoc_test_phandle_single.dts | 0
tools/dtoc/test/dtoc_test_scan_drivers.cxx | 5 +
tools/dtoc/{ => test}/dtoc_test_simple.dts | 4 +-
tools/dtoc/test_dtoc.py | 1023 ++++++++++++++++-
tools/dtoc/test_fdt.py | 31 +-
tools/dtoc/test_src_scan.py | 397 ++++++-
45 files changed, 2847 insertions(+), 182 deletions(-)
delete mode 100644 tools/dtoc/dtoc_test_scan_drivers.cxx
rename tools/dtoc/{ => test}/dtoc_test.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_add_prop.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_addr32.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_addr32_64.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_addr64.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_addr64_32.dts (100%)
create mode 100644 tools/dtoc/test/dtoc_test_alias_bad.dts
create mode 100644 tools/dtoc/test/dtoc_test_alias_bad_path.dts
create mode 100644 tools/dtoc/test/dtoc_test_alias_bad_uc.dts
rename tools/dtoc/{ => test}/dtoc_test_aliases.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_bad_reg.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_bad_reg2.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_driver_alias.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_empty.dts (100%)
create mode 100644 tools/dtoc/test/dtoc_test_inst.dts
rename tools/dtoc/{ => test}/dtoc_test_invalid_driver.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_phandle.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_phandle_bad.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_phandle_bad2.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_phandle_cd_gpios.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_phandle_reorder.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_phandle_single.dts (100%)
create mode 100644 tools/dtoc/test/dtoc_test_scan_drivers.cxx
rename tools/dtoc/{ => test}/dtoc_test_simple.dts (93%)
--
2.30.0.365.g02bc693789-goog
More information about the U-Boot
mailing list