Skip to content

dm: Add dtoc implementation of device instantiation (part D)

Simon Glass u-boot 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest33 patches 3 repliesIn review
  2. v149 patches 0 repliesSuperseded

Changes in v2 from the cover letter

- 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

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/33bootstage: Fix dependency for BOOTSTAGE_RECORD_COUNTcommon/Kconfig.boot common/bootstage.c+4 -10 replies
1/33bootstage: Fix dependency for BOOTSTAGE_RECORD_COUNT+0 -00 replies
2/33dtoc: Scan drivers for available informationtools/dtoc/src_scan.py tools/dtoc/test_src_scan.py+311 -140 replies
2/33dtoc: Scan drivers for available information+0 -00 replies
3/33dtoc: Save scan information across test runstools/dtoc/dtb_platdata.py tools/dtoc/main.py tools/dtoc/test_dtoc.py+43 -100 replies
3/33dtoc: Save scan information across test runs+0 -00 replies
4/33dtoc: Ignore unwanted files when scanning for driverstools/dtoc/src_scan.py tools/dtoc/test_src_scan.py+9 -10 replies
4/33dtoc: Ignore unwanted files when scanning for drivers+0 -00 replies
5/33dtoc: Collect priv/plat struct info from driverstools/dtoc/src_scan.py tools/dtoc/test_src_scan.py+55 -20 replies
5/33dtoc: Collect priv/plat struct info from drivers+0 -00 replies
6/33dtoc: Support scanning of uclassestools/dtoc/src_scan.py tools/dtoc/test_src_scan.py+177 -00 replies
6/33dtoc: Support scanning of uclasses+0 -00 replies
7/33dtoc: Support scanning of structs in header filestools/dtoc/src_scan.py tools/dtoc/test_src_scan.py+128 -30 replies
7/33dtoc: Support scanning of structs in header files+0 -00 replies
8/33dtoc: Move test files into a test/ directorytools/dtoc/test/dtoc_test.dts tools/dtoc/test/dtoc_test_add_prop.dts tools/dtoc/test/dtoc_test_addr32.dts +20 more+24 -120 replies
8/33dtoc: Move test files into a test/ directory+0 -00 replies
9/33dtoc: Rename sandbox_i2c_test and sandbox_pmic_testtools/dtoc/test/dtoc_test_simple.dts tools/dtoc/test_dtoc.py+8 -80 replies
9/33dtoc: Rename sandbox_i2c_test and sandbox_pmic_test+0 -00 replies
10/33dtoc: Add some extra properties to nodestools/dtoc/dtb_platdata.py+37 -00 replies
10/33dtoc: Add some extra properties to nodes+0 -00 replies
11/33dtoc: Make use of node propertiestools/dtoc/dtb_platdata.py+19 -260 replies
11/33dtoc: Make use of node properties+0 -00 replies
12/33dtoc: Process nodes to set up required propertiestools/dtoc/dtb_platdata.py tools/dtoc/src_scan.py tools/dtoc/test_dtoc.py+124 -00 replies
12/33dtoc: Process nodes to set up required properties+0 -00 replies
13/33dtoc: Track nodes which are actually usedtools/dtoc/dtb_platdata.py tools/dtoc/src_scan.py tools/dtoc/test_dtoc.py +1 more+37 -40 replies
13/33dtoc: Track nodes which are actually used+0 -00 replies
14/33dtoc: Support tracking the phase of U-Bootinclude/dm/device.h tools/dtoc/dtb_platdata.py tools/dtoc/main.py +3 more+47 -120 replies
14/33dtoc: Support tracking the phase of U-Boot+0 -00 replies
15/33Makefile: Pass the U-Boot phase to dtocscripts/Makefile.spl+1 -10 replies
15/33Makefile: Pass the U-Boot phase to dtoc+0 -00 replies
16/33dtoc: Support headers needed for driversinclude/dm/device.h tools/dtoc/src_scan.py tools/dtoc/test_src_scan.py+29 -00 replies
16/33dtoc: Support headers needed for drivers+0 -00 replies
17/33dtoc: Process driver aliases along with driversdoc/driver-model/of-plat.rst tools/dtoc/src_scan.py tools/dtoc/test/dtoc_test_scan_drivers.cxx+11 -123 replies
17/33dtoc: Process driver aliases along with drivers+0 -00 replies
18/33dtoc: Warn of duplicate driverstools/dtoc/src_scan.py tools/dtoc/test_src_scan.py+122 -10 replies
18/33dtoc: Warn of duplicate drivers+0 -00 replies
19/33dtoc: Read aliases for uclassestools/dtoc/dtb_platdata.py tools/dtoc/src_scan.py tools/dtoc/test/dtoc_test_alias_bad.dts +4 more+345 -30 replies
19/33dtoc: Read aliases for uclasses+0 -00 replies
20/33dtoc: Detect drivers only at the start of start of linetools/dtoc/src_scan.py+2 -20 replies
20/33dtoc: Detect drivers only at the start of start of line+0 -00 replies
21/33dtoc: Assign a sequence number to each nodedrivers/misc/test_drv.c test/dm/test-fdt.c tools/dtoc/dtb_platdata.py +1 more+53 -200 replies
21/33dtoc: Assign a sequence number to each node+0 -00 replies
22/33dtoc: Set up the uclasses that are usedtools/dtoc/dtb_platdata.py tools/dtoc/src_scan.py tools/dtoc/test_dtoc.py +1 more+119 -180 replies
22/33dtoc: Set up the uclasses that are used+0 -00 replies
23/33dtoc: Support processing the root nodetools/dtoc/dtb_platdata.py tools/dtoc/src_scan.py tools/dtoc/test_dtoc.py +1 more+59 -200 replies
23/33dtoc: Support processing the root node+0 -00 replies
24/33dtoc: Add an option for device instantiationtools/dtoc/dtb_platdata.py tools/dtoc/main.py tools/dtoc/test_dtoc.py+36 -220 replies
24/33dtoc: Add an option for device instantiation+0 -00 replies
25/33dm: of-platadata: Add option for device instantiationdts/Kconfig scripts/Makefile.spl+25 -20 replies
25/33dm: of-platadata: Add option for device instantiation+0 -00 replies
26/33dtoc: Add support for decl filetools/dtoc/dtb_platdata.py tools/dtoc/test_dtoc.py+120 -70 replies
26/33dtoc: Add support for decl file+0 -00 replies
27/33dtoc: Don't generate platform data with instantiationtools/dtoc/dtb_platdata.py tools/dtoc/test_dtoc.py+75 -130 replies
27/33dtoc: Don't generate platform data with instantiation+0 -00 replies
28/33sandbox: Make sandbox,emul more conventionalarch/sandbox/dts/sandbox.dtsi doc/driver-model/pci-info.rst+6 -10 replies
28/33sandbox: Make sandbox,emul more conventional+0 -00 replies
29/33sandbox: i2c: Rename driver names to work with of-platdataarch/sandbox/dts/test.dts drivers/i2c/i2c-emul-uclass.c drivers/rtc/i2c_rtc_emul.c+5 -50 replies
29/33sandbox: i2c: Rename driver names to work with of-platdata+0 -00 replies
30/33dtoc: Tidy up the list of supported phandle propertiestools/dtoc/dtb_platdata.py+21 -70 replies
30/33dtoc: Tidy up the list of supported phandle properties+0 -00 replies
31/33dtoc: Generate a summary in the dt-plat.c filetools/dtoc/dtb_platdata.py tools/dtoc/test_dtoc.py+169 -350 replies
31/33dtoc: Generate a summary in the dt-plat.c file+0 -00 replies
32/33dtoc: Generate uclass devicesdrivers/misc/test_drv.c include/dm/test.h tools/dtoc/dtb_platdata.py +1 more+250 -130 replies
32/33dtoc: Generate uclass devices+0 -00 replies
33/33dtoc: Generate device instancesdrivers/misc/test_drv.c tools/dtoc/dtb_platdata.py tools/dtoc/test_dtoc.py+484 -150 replies
33/33dtoc: Generate device instances+0 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/33] dm: Add dtoc implementation of device instantiation (part D)

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 at 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%)
Signature · 1 line
2.30.0.365.g02bc693789-goog