mbox series

[v2,00/14] improve OF_PLATDATA support

Message ID 20200619145555.863-1-walter.lozano@collabora.com
Headers show
Series improve OF_PLATDATA support | expand

Message

Walter Lozano June 19, 2020, 2:55 p.m. UTC
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=*

Walter Lozano (14):
  drivers: rename drivers to match compatible string
  dtoc: add missing code comments
  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
  dtoc: extend dtoc to use struct driver_info when linking nodes
  dm: doc: update of-plat with new phandle support
  dtoc: update tests to match new platdata
  sandbox: Move section u_boot_list to make it RW
  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                    | 138 ++++++++-
 tools/dtoc/dtoc_test_driver_alias.dts         |  20 ++
 tools/dtoc/dtoc_test_invalid_driver.dts       |  15 +
 tools/dtoc/dtoc_test_phandle_cd_gpios.dts     |  42 +++
 tools/dtoc/test_dtoc.py                       | 286 +++++++++++++-----
 69 files changed, 686 insertions(+), 239 deletions(-)
 create mode 100644 arch/arm/dts/rk3288-veyron-u-boot.dtsi
 create mode 100644 tools/dtoc/dtoc_test_driver_alias.dts
 create mode 100644 tools/dtoc/dtoc_test_invalid_driver.dts
 create mode 100644 tools/dtoc/dtoc_test_phandle_cd_gpios.dts

Comments

Simon Glass June 23, 2020, 2 p.m. UTC | #1
Hi Walter,

On Fri, 19 Jun 2020 at 08:56, Walter Lozano <walter.lozano at collabora.com> wrote:
>
> 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=*
>
> Walter Lozano (14):
>   drivers: rename drivers to match compatible string
>   dtoc: add missing code comments
>   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
>   dtoc: extend dtoc to use struct driver_info when linking nodes
>   dm: doc: update of-plat with new phandle support
>   dtoc: update tests to match new platdata
>   sandbox: Move section u_boot_list to make it RW
>   arm: dts: include gpio nodes for card detect
>   dtoc: update dtb_platdata to support cd-gpios
>   dtoc add test for cd-gpios
>

One quick point - can you please check the line lengths in the Python
code? It looks like some of the lines are over 80cols. That's OK if
you are trying to avoid skipping a string which is the first
parameter, but otherwise, it should be possible to avoid it.

Regards,
Simon
Walter Lozano June 23, 2020, 7:54 p.m. UTC | #2
On 23/6/20 11:00, Simon Glass wrote:
> Hi Walter,
>
> On Fri, 19 Jun 2020 at 08:56, Walter Lozano <walter.lozano at collabora.com> wrote:
>> 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=*
>>
>> Walter Lozano (14):
>>    drivers: rename drivers to match compatible string
>>    dtoc: add missing code comments
>>    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
>>    dtoc: extend dtoc to use struct driver_info when linking nodes
>>    dm: doc: update of-plat with new phandle support
>>    dtoc: update tests to match new platdata
>>    sandbox: Move section u_boot_list to make it RW
>>    arm: dts: include gpio nodes for card detect
>>    dtoc: update dtb_platdata to support cd-gpios
>>    dtoc add test for cd-gpios
>>
> One quick point - can you please check the line lengths in the Python
> code? It looks like some of the lines are over 80cols. That's OK if
> you are trying to avoid skipping a string which is the first
> parameter, but otherwise, it should be possible to avoid it.
>

Sure. I thought checkpatch.pl would warn me, but it looks it didn't. 
Thanks for pointing the issue.

Regards,

Walter