[PATCH 00/49] dm: Add dtoc implementation of device instantiation (part D)
Simon Glass
sjg at chromium.org
Tue Dec 29 04:34:46 CET 2020
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 largely 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.
A small tree-wide rename is included to make the naming more consistent.
Without that, the new terminology would be hard to follow.
This is part D of the overall effort. The next series will focus on the
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
The final result (WIP, not reviewable) is available at
u-boot-dm/tin-working but note this only works for sandbox_spl and
chromebook_coral
[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/
Simon Glass (49):
dtoc: Tidy up pylint warnings in test
dtoc: Use None to mean stdout
dtoc: Test the stdout output
dtoc: Allow providing a directory to write files to
dtoc: Allow outputing to multiple files
dtoc: Add an 'all' command
Makefile: Invoke dtoc only once
dm: Rename U_BOOT_DEVICE() to U_BOOT_DRVINFO()
dm: Rename DM_GET_DEVICE() to DM_DRVINFO_GET()
dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()
dm: Rename U_BOOT_DRIVER_ALIAS to DM_DRIVER_ALIAS
concurrencytest: Fix Python3 warning
dtoc: Run tests using test_util
dtoc: Add a header comment to each generated file
dtoc: Rename dt-platdata.c to dt-plat.c
dtoc: Add the method for each command to OutputFile
dtoc: Allow specifying the base directory for tests
dtoc: Output nodes in order
dtoc: Drop dm_populate_phandle_data()
dtoc: Split source-code scanning to a separate file
dtoc: Move src_scan tests to a separate file
dtoc: Tidy up src_scan tests
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: 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
dtoc: Generate uclass devices
dtoc: Generate device instances
arch/arm/lib/gic-v3-its.c | 10 +-
arch/arm/mach-aspeed/ast2500/clk_ast2500.c | 2 +-
.../mach-at91/arm926ejs/at91sam9260_devices.c | 2 +-
.../arm926ejs/at91sam9m10g45_devices.c | 2 +-
arch/arm/mach-imx/mx6/soc.c | 2 +-
arch/arm/mach-imx/mx7/soc.c | 2 +-
arch/arm/mach-k3/am6_init.c | 2 +-
arch/arm/mach-k3/common.c | 2 +-
arch/arm/mach-k3/j721e_init.c | 2 +-
arch/arm/mach-lpc32xx/devices.c | 4 +-
arch/arm/mach-mediatek/mt7629/init.c | 4 +-
arch/arm/mach-mediatek/mt8516/init.c | 2 +-
arch/arm/mach-omap2/am33xx/board.c | 10 +-
arch/arm/mach-omap2/omap3/board.c | 2 +-
arch/arm/mach-rockchip/misc.c | 4 +-
arch/arm/mach-rockchip/px30/clk_px30.c | 2 +-
arch/arm/mach-rockchip/rk3036/clk_rk3036.c | 2 +-
arch/arm/mach-rockchip/rk3128/clk_rk3128.c | 2 +-
arch/arm/mach-rockchip/rk3188/clk_rk3188.c | 2 +-
arch/arm/mach-rockchip/rk322x/clk_rk322x.c | 2 +-
arch/arm/mach-rockchip/rk3288/clk_rk3288.c | 2 +-
arch/arm/mach-rockchip/rk3308/clk_rk3308.c | 2 +-
arch/arm/mach-rockchip/rk3328/clk_rk3328.c | 2 +-
arch/arm/mach-rockchip/rk3368/clk_rk3368.c | 2 +-
arch/arm/mach-rockchip/rk3399/clk_rk3399.c | 4 +-
arch/arm/mach-rockchip/rv1108/clk_rv1108.c | 2 +-
arch/arm/mach-socfpga/clock_manager_agilex.c | 2 +-
arch/arm/mach-stm32mp/bsec.c | 2 +-
arch/arm/mach-stm32mp/cmd_stm32key.c | 2 +-
.../mach-stm32mp/cmd_stm32prog/stm32prog.c | 6 +-
arch/arm/mach-stm32mp/cpu.c | 6 +-
arch/arm/mach-tegra/board.c | 2 +-
arch/arm/mach-tegra/board2.c | 2 +-
arch/arm/mach-uniphier/micro-support-card.c | 2 +-
arch/arm/mach-zynq/clk.c | 4 +-
arch/arm/mach-zynq/timer.c | 2 +-
arch/mips/mach-mtmips/mt7628/init.c | 2 +-
arch/riscv/lib/sifive_clint.c | 2 +-
board/armltd/integrator/integrator.c | 2 +-
board/armltd/total_compute/total_compute.c | 2 +-
board/armltd/vexpress64/vexpress64.c | 2 +-
board/bluewater/gurnard/gurnard.c | 2 +-
board/bluewater/snapper9260/snapper9260.c | 2 +-
board/cadence/xtfpga/xtfpga.c | 4 +-
board/cavium/thunderx/thunderx.c | 4 +-
board/compulab/cm_fx6/cm_fx6.c | 2 +-
board/davinci/da8xxevm/omapl138_lcdk.c | 4 +-
board/dhelectronics/dh_stm32mp1/board.c | 6 +-
board/freescale/ls1012afrdm/eth.c | 4 +-
board/freescale/ls1012aqds/eth.c | 4 +-
board/freescale/ls1012ardb/eth.c | 4 +-
board/freescale/lx2160a/lx2160a.c | 4 +-
board/gateworks/gw_ventana/gw_ventana.c | 2 +-
board/google/gru/gru.c | 2 +-
board/hisilicon/hikey/hikey.c | 4 +-
board/hisilicon/hikey960/hikey960.c | 2 +-
board/hisilicon/poplar/poplar.c | 2 +-
board/isee/igep00x0/igep00x0.c | 2 +-
board/lg/sniper/sniper.c | 2 +-
board/nokia/rx51/rx51.c | 2 +-
board/nvidia/jetson-tk1/jetson-tk1.c | 2 +-
board/nvidia/nyan-big/nyan-big.c | 2 +-
board/renesas/ulcb/cpld.c | 2 +-
board/sandbox/sandbox.c | 2 +-
board/siemens/corvus/board.c | 2 +-
board/sifive/fu540/fu540.c | 2 +-
board/st/common/cmd_stboard.c | 2 +-
board/st/common/stm32mp_dfu.c | 4 +-
board/st/common/stpmic1.c | 4 +-
board/st/common/stusb160x.c | 2 +-
board/st/stm32mp1/stm32mp1.c | 12 +-
board/st/stv0991/stv0991.c | 2 +-
board/sysam/amcore/amcore.c | 2 +-
board/ti/am335x/board.c | 6 +-
board/ti/j721e/evm.c | 4 +-
board/timll/devkit8000/devkit8000.c | 2 +-
board/toradex/apalis-tk1/apalis-tk1.c | 4 +-
board/toradex/apalis_imx6/apalis_imx6.c | 2 +-
.../toradex/colibri-imx6ull/colibri-imx6ull.c | 2 +-
board/toradex/colibri_imx6/colibri_imx6.c | 2 +-
board/toradex/colibri_pxa270/colibri_pxa270.c | 4 +-
doc/driver-model/design.rst | 18 +-
doc/driver-model/of-plat.rst | 35 +-
doc/driver-model/remoteproc-framework.rst | 2 +-
doc/driver-model/spi-howto.rst | 4 +-
drivers/clk/clk_stm32mp1.c | 2 +-
drivers/clk/clk_zynqmp.c | 2 +-
drivers/clk/imx/clk-imx8.c | 2 +-
drivers/clk/mediatek/clk-mtk.c | 6 +-
drivers/clk/sifive/fu540-prci.c | 2 +-
drivers/core/root.c | 3 -
drivers/crypto/fsl/fsl_rsa.c | 2 +-
drivers/crypto/rsa_mod_exp/mod_exp_sw.c | 2 +-
drivers/demo/demo-pdata.c | 10 +-
drivers/firmware/scmi/scmi_agent-uclass.c | 4 +-
drivers/gpio/gpio-uclass.c | 2 +-
drivers/gpio/imx_rgpio2p.c | 4 +-
drivers/gpio/mxc_gpio.c | 4 +-
drivers/gpio/mxs_gpio.c | 2 +-
drivers/gpio/sandbox.c | 2 +-
drivers/i2c/rk_i2c.c | 2 +-
drivers/misc/i2c_eeprom.c | 2 +-
drivers/misc/rockchip-efuse.c | 2 +-
drivers/misc/stm32mp_fuse.c | 16 +-
drivers/misc/test_drv.c | 11 +-
drivers/mmc/fsl_esdhc_imx.c | 2 +-
drivers/mmc/mxsmmc.c | 2 +-
drivers/mmc/rockchip_dw_mmc.c | 4 +-
drivers/mtd/nand/raw/arasan_nfc.c | 2 +-
drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c | 2 +-
drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c | 2 +-
drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c | 2 +-
drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c | 2 +-
drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c | 2 +-
drivers/mtd/nand/raw/davinci_nand.c | 2 +-
drivers/mtd/nand/raw/denali_dt.c | 2 +-
drivers/mtd/nand/raw/mxs_nand_dt.c | 2 +-
drivers/mtd/nand/raw/octeontx_nand.c | 6 +-
drivers/mtd/nand/raw/pxa3xx_nand.c | 2 +-
drivers/mtd/nand/raw/stm32_fmc2_nand.c | 2 +-
drivers/mtd/nand/raw/tegra_nand.c | 2 +-
drivers/mtd/nand/raw/vf610_nfc.c | 2 +-
drivers/mtd/nand/raw/zynq_nand.c | 2 +-
drivers/mtd/spi/sf_probe.c | 2 +-
drivers/pinctrl/nxp/pinctrl-imx6.c | 2 +-
drivers/pinctrl/nxp/pinctrl-mxs.c | 2 +-
drivers/pinctrl/pinctrl-at91.c | 2 +-
drivers/power/pmic/rk8xx.c | 2 +-
drivers/remoteproc/sandbox_testproc.c | 2 +-
drivers/reset/reset-ast2500.c | 2 +-
drivers/rtc/emul_rtc.c | 2 +-
drivers/serial/ns16550.c | 6 +-
drivers/serial/sandbox.c | 2 +-
drivers/spi/mxs_spi.c | 2 +-
drivers/spi/rk_spi.c | 2 +-
drivers/sysreset/sysreset_sandbox.c | 4 +-
drivers/timer/sandbox_timer.c | 2 +-
drivers/video/lg4573.c | 2 +-
drivers/video/sunxi/sunxi_de2.c | 2 +-
drivers/video/sunxi/sunxi_dw_hdmi.c | 2 +-
drivers/video/sunxi/sunxi_lcd.c | 2 +-
dts/Kconfig | 31 +-
include/dm/device.h | 42 +-
include/dm/lists.h | 2 +-
include/dm/platdata.h | 28 +-
include/dm/platform_data/spi_pl022.h | 2 +-
include/dm/test.h | 5 +
include/dm/uclass.h | 2 +-
include/linux/mtd/spi-nor.h | 2 +-
scripts/Makefile.spl | 27 +-
test/dm/core.c | 8 +-
test/dm/test-fdt.c | 6 +-
tools/concurrencytest/concurrencytest.py | 4 +-
tools/dtoc/dtb_platdata.py | 911 +++++++++----
tools/dtoc/dtoc_test_scan_drivers.cxx | 1 -
tools/dtoc/main.py | 56 +-
tools/dtoc/src_scan.py | 736 ++++++++++
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 | 1190 ++++++++++++++---
tools/dtoc/test_fdt.py | 31 +-
tools/dtoc/test_src_scan.py | 492 +++++++
tools/patman/tools.py | 8 +
185 files changed, 3482 insertions(+), 808 deletions(-)
delete mode 100644 tools/dtoc/dtoc_test_scan_drivers.cxx
create mode 100644 tools/dtoc/src_scan.py
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%)
create mode 100644 tools/dtoc/test_src_scan.py
--
2.29.2.729.g45daf8777d-goog
More information about the U-Boot
mailing list