From patchwork Thu Jun 25 04:10:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Lozano X-Patchwork-Id: 242975 List-Id: U-Boot discussion From: walter.lozano at collabora.com (Walter Lozano) Date: Thu, 25 Jun 2020 01:10:03 -0300 Subject: [PATCH v4 00/14] improve OF_PLATDATA support Message-ID: <20200625041017.26204-1-walter.lozano@collabora.com> When using OF_PLATDATA dtbs are converted to C structs in order to save space as we can remove both dtbs and libraries from TPL/SPL binaries. This patchset tries to improve its support by overcoming some limitations in the current implementation First, the support for scan and check for valid driver/aliases is added in order to generate U_BOOT_DEVICE entries with valid driver names. Secondly, the way information about linked noded (phandle) is generated in C structs is improved in order to make it easier to get a device associated to its data. Lastly the support for the property cd-gpios is added, which is used to configure the card detection gpio on MMC is added. This implementation is based in discussion in [1], [2] and [3] [1] https://patchwork.ozlabs.org/patch/1249198/ [2] https://patchwork.ozlabs.org/project/uboot/list/?series=167495&state=* [3] https://patchwork.ozlabs.org/project/uboot/list/?series=176759&state=* Changes for v4 - Fix syntax error on dtoc Changes for v3 - Split patches to separate core from tools changes - Squash patches to avoid errors on tests - Fix lines longer than 80 chars Changes for v2 - Rename drivers to match compatible strings - Fix out-of-trees usage of dtoc - Fix test coverage - Improve documentation - Improve format Walter Lozano (14): drivers: rename drivers to match compatible string dtoc: add missing code comments core: add support for U_BOOT_DRIVER_ALIAS dtoc: add support to scan drivers dtoc: add option to disable warnings dm: doc: update of-plat with the support for driver aliases core: drop const for struct driver_info core: extend struct driver_info to point to device sandbox: Move section u_boot_list to make it RW dtoc: extend dtoc to use struct driver_info when linking nodes dm: doc: update of-plat with new phandle support arm: dts: include gpio nodes for card detect dtoc: update dtb_platdata to support cd-gpios dtoc: add test for cd-gpios arch/arm/dts/da850-evm-u-boot.dtsi | 4 + arch/arm/dts/da850-lcdk-u-boot.dtsi | 4 + arch/arm/dts/rk3288-u-boot.dtsi | 4 + arch/arm/dts/rk3288-veyron-speedy-u-boot.dtsi | 2 +- arch/arm/dts/rk3288-veyron-u-boot.dtsi | 11 + .../mach-at91/arm926ejs/at91sam9260_devices.c | 6 +- .../arm926ejs/at91sam9m10g45_devices.c | 10 +- arch/arm/mach-rockchip/rk3328/syscon_rk3328.c | 4 +- arch/sandbox/cpu/u-boot-spl.lds | 2 +- board/davinci/da8xxevm/omapl138_lcdk.c | 2 +- board/sandbox/sandbox.c | 2 +- doc/driver-model/of-plat.rst | 38 ++- drivers/clk/at91/clk-master.c | 4 +- drivers/clk/at91/clk-peripheral.c | 4 +- drivers/clk/at91/pmc.c | 6 +- drivers/clk/clk-uclass.c | 11 +- drivers/core/device.c | 28 +- drivers/core/root.c | 6 +- drivers/core/simple-bus.c | 4 +- drivers/gpio/at91_gpio.c | 4 +- drivers/gpio/da8xx_gpio.c | 4 +- drivers/gpio/mxs_gpio.c | 8 +- drivers/gpio/rk_gpio.c | 4 +- drivers/gpio/sandbox.c | 6 +- drivers/i2c/rk_i2c.c | 6 +- drivers/input/cros_ec_keyb.c | 4 +- drivers/misc/cros_ec_sandbox.c | 4 +- drivers/misc/irq-uclass.c | 10 +- drivers/mmc/davinci_mmc.c | 4 +- drivers/mmc/ftsdc010_mci.c | 2 +- drivers/mmc/mxsmmc.c | 7 +- drivers/mmc/rockchip_dw_mmc.c | 7 +- drivers/mmc/rockchip_sdhci.c | 2 +- drivers/mtd/spi/sf-uclass.c | 2 +- drivers/mtd/spi/sf_probe.c | 6 +- drivers/pinctrl/nxp/pinctrl-mxs.c | 6 +- drivers/pinctrl/pinctrl-at91.c | 6 +- drivers/pinctrl/rockchip/pinctrl-rk3188.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3288.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3328.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3368.c | 2 +- drivers/power/pmic/rk8xx.c | 6 +- drivers/power/regulator/fixed.c | 4 +- drivers/ram/rockchip/dmc-rk3368.c | 2 +- drivers/ram/rockchip/sdram_rk3188.c | 2 +- drivers/ram/rockchip/sdram_rk3288.c | 2 +- drivers/ram/rockchip/sdram_rk3328.c | 2 +- drivers/ram/rockchip/sdram_rk3399.c | 2 +- drivers/serial/ns16550.c | 4 + drivers/serial/sandbox.c | 6 +- drivers/spi/mxs_spi.c | 8 +- drivers/spi/rk_spi.c | 10 +- drivers/spi/sandbox_spi.c | 4 +- drivers/tpm/tpm_tis_sandbox.c | 4 +- drivers/video/rockchip/rk3288_vop.c | 4 +- drivers/video/sandbox_sdl.c | 4 +- drivers/watchdog/at91sam9_wdt.c | 4 +- include/clk.h | 4 +- include/dm/device-internal.h | 2 +- include/dm/device.h | 22 ++ include/dm/platdata.h | 14 + test/dm/gpio.c | 2 +- test/dm/spi.c | 6 +- test/py/tests/test_bind.py | 54 ++-- tools/dtoc/dtb_platdata.py | 143 ++++++++- tools/dtoc/dtoc_test_invalid_driver.dts | 15 + tools/dtoc/dtoc_test_phandle_cd_gpios.dts | 42 +++ tools/dtoc/test_dtoc.py | 287 +++++++++++++----- 68 files changed, 672 insertions(+), 239 deletions(-) create mode 100644 arch/arm/dts/rk3288-veyron-u-boot.dtsi create mode 100644 tools/dtoc/dtoc_test_invalid_driver.dts create mode 100644 tools/dtoc/dtoc_test_phandle_cd_gpios.dts