[U-Boot] [PATCH 0/29] dm: Introduce device tree support in SPL (for Rockchip)

Simon Glass sjg at chromium.org
Sat Feb 28 06:06:24 CET 2015


With driver model SPL support in place the remaining driver difference
between U-Boot proper and SPL is that SPL does not support device tree.
This series adds this support, using a Rockchip board as an example.

One problem with device tree is that U-Boot has no way of dropping features
it does not need or use. For SPL this problem needs to be solved and this
series uses the preprocessor for this. The 45KB Firefly device tree reduces
to 693 bytes when unused material is removed. A better solution might
involve the 'fdtgrep' tool but this has not made it into the device tree
compiler as yet.

This series includes some changes aimed at reduce code size in SPL,
including:
- dropping alias sequence support (the aliases node) since many boards just
    use a single UART in SPL
- adding a smaller panic() function that does not support printf()-format
    strings
- removing device unbind code which will never be used in SPL

Overall the resulting SPL binary is 8829 bytes with my Linaro 4.8.2 compiler,
including the device tree, using Thumb-2. Of this:

1768 bytes is driver model core code
1556 bytes is device tree code
693 bytes is the device tree itself
4756 is other code, including serial drivers, rodata and data

The last figure includes rodata incorrectly added by the tool chain [1].
With a bug-fixed gcc 4.9.2 the total size is 6893 bytes including device
tree.

Approximately 750 bytes is used for strings and driver data (root device
and serial) associated with driver model and device tree. This adds up an
overhead of around 4750 bytes for driver model and device tree, including
the code, rodata and device tree itself.

It should therefore be possible to use driver model and device tree in
SPL for board that have enough SRAM. Clearly 4KB is impossible without
further work (perhaps removing some error strings). I suspect 8KB would
be tricky, allowing only 3KB for stack and other code. But 16KB should
work OK.

SRAM sizes for recent SoCs I am aware of are:

Rockchip RK3288:     96KB
Tegra 124:           128KB
Samsung Exynos 5420: 384KB

The Rockchip Firefly was chosen for this work since it is a fairly recent
board and is readily available. Rockchip engineers have been actively
upstreaming code to Linux in the past year and there is a very
full-featured U-Boot available. But it is invisible to most U-Boot
people - mainline Rockchip support seems well overdue. This series does
not make a serious start on that, since it only prints a message in SPL
and then hangs, but additional work should get it booting to a prompt.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54303


Simon Glass (29):
  serial: ns16550: Add an option to specify the debug UART register
    shift
  dm: ns16550: Support non-byte register spacing with driver model
  dm: ns16550: Support CONFIG_SYS_NS16550_MEM32 with driver model
  serial: ns16550: Remove unnecessary init on UART setup
  fdt: arm: Drop device tree padding
  dm: core: Allow sequence alias support to be removed for SPL
  dm: core: Remove unbind operations when not required
  dm: Add a panic_str() function to reduce code size
  dm: core: Drop device removal error path when not supported
  fdt: sandbox: Move setup code from board_f to fdtdec
  fdt: Rename setup_fdt() and make it prepare also
  Move initf_malloc() to a common place
  Correct malloc_limit value for pre-relocation malloc()
  fdt: Add an option to disable device tree in SPL
  dts: Disable device tree for SPL on all boards
  fdt: Allow FDT functions to be built for SPL
  dm: core: Select device tree control correctly for SPL
  dm: Init device tree as well as driver model in SPL
  dm: serial: Don't support CONFIG_CONS_INDEX with device tree
  Remove SPL undefine of CONFIG_OF_CONTROL
  fdt: arm: Build device tree in SPL
  dm: rockchip: Add serial support
  rockchip: Bring in RK3288 device tree file includes and bindings
  rockchip: dts: Adjust device tree files for U-Boot SPL
  rockchip: Add base SoC files
  rockchip: Add basic support for firefly-rk3288
  mkimage: Display a better list of available image types
  rockchip: Add the beginnings of an image tool
  rockchip: Add a simple README

 arch/arm/Kconfig                                   |   11 +
 arch/arm/Makefile                                  |    1 +
 arch/arm/cpu/armv7/exynos/Kconfig                  |    8 +
 arch/arm/cpu/armv7/s5pc1xx/Kconfig                 |    2 +
 arch/arm/cpu/u-boot-spl.lds                        |    2 +-
 arch/arm/dts/Makefile                              |    6 +-
 arch/arm/dts/rk3288-firefly.dts                    |   82 ++
 arch/arm/dts/rk3288-firefly.dtsi                   |  496 +++++++
 arch/arm/dts/rk3288-thermal.dtsi                   |   90 ++
 arch/arm/dts/rk3288.dtsi                           | 1480 ++++++++++++++++++++
 arch/arm/include/asm/arch-rockchip/clock.h         |   12 +
 arch/arm/include/asm/arch-rockchip/gpio.h          |    5 +
 arch/arm/include/asm/arch-rockchip/grf.h           |  181 +++
 arch/arm/mach-rockchip/Kconfig                     |   44 +
 arch/arm/mach-rockchip/Makefile                    |   12 +
 arch/arm/mach-rockchip/board-spl.c                 |   54 +
 arch/arm/mach-rockchip/board.c                     |   17 +
 arch/arm/mach-rockchip/common.c                    |   11 +
 arch/arm/mach-rockchip/rk3288/Kconfig              |   16 +
 arch/arm/mach-tegra/Kconfig                        |    3 +
 arch/sandbox/cpu/cpu.c                             |   41 +
 arch/sandbox/include/asm/u-boot-sandbox.h          |    8 +
 board/firefly/firefly-rk3288/Kconfig               |   15 +
 board/firefly/firefly-rk3288/MAINTAINERS           |    6 +
 board/firefly/firefly-rk3288/Makefile              |    7 +
 board/firefly/firefly-rk3288/firefly-rk3288.c      |    7 +
 common/board_f.c                                   |   84 +-
 common/dlmalloc.c                                  |   11 +
 common/image.c                                     |   55 +-
 common/spl/spl.c                                   |   22 +-
 configs/Linksprite_pcDuino3_fdt_defconfig          |    1 +
 configs/am335x_boneblack_vboot_defconfig           |    1 +
 configs/arches_defconfig                           |    1 +
 configs/canyonlands_defconfig                      |    1 +
 configs/firefly-rk3288_defconfig                   |   11 +
 configs/galileo_defconfig                          |    1 +
 configs/microblaze-generic_defconfig               |    1 +
 configs/odroid_defconfig                           |    1 +
 configs/origen_defconfig                           |    1 +
 configs/s5pc210_universal_defconfig                |    1 +
 configs/socfpga_socrates_defconfig                 |    1 +
 configs/trats2_defconfig                           |    1 +
 configs/trats_defconfig                            |    1 +
 configs/zynq_microzed_defconfig                    |    1 +
 configs/zynq_zc70x_defconfig                       |    1 +
 configs/zynq_zc770_xm010_defconfig                 |    1 +
 configs/zynq_zc770_xm012_defconfig                 |    1 +
 configs/zynq_zc770_xm013_defconfig                 |    1 +
 configs/zynq_zed_defconfig                         |    1 +
 configs/zynq_zybo_defconfig                        |    1 +
 doc/README.rockchip                                |   83 ++
 .../clock/rockchip,rk3288-cru.txt                  |   61 +
 doc/device-tree-bindings/clock/rockchip.txt        |   77 +
 .../pinctrl/rockchip,pinctrl.txt                   |  157 +++
 .../thermal/rockchip-thermal.txt                   |   68 +
 drivers/core/Kconfig                               |    9 +
 drivers/core/Makefile                              |    2 +
 drivers/core/device.c                              |   54 +-
 drivers/core/root.c                                |   14 +-
 drivers/core/uclass.c                              |    4 +
 drivers/serial/Kconfig                             |   19 +
 drivers/serial/Makefile                            |    1 +
 drivers/serial/ns16550.c                           |   44 +-
 drivers/serial/serial-uclass.c                     |   69 +-
 drivers/serial/serial_rockchip.c                   |   41 +
 dts/Kconfig                                        |   11 +-
 dts/Makefile                                       |    9 +-
 include/config_uncmd_spl.h                         |    3 +
 include/configs/firefly-rk3288.h                   |   50 +
 include/dm/uclass-internal.h                       |    8 +
 include/dt-bindings/clock/rk3288-cru.h             |  378 +++++
 include/dt-bindings/clock/rockchip,rk808.h         |   11 +
 include/dt-bindings/pinctrl/rockchip.h             |   34 +
 include/dt-bindings/power-domain/rk3288.h          |   11 +
 include/dt-bindings/thermal/thermal.h              |   17 +
 include/fdtdec.h                                   |   16 +
 include/image.h                                    |   12 +
 include/malloc.h                                   |    3 +
 include/vsprintf.h                                 |   23 +
 lib/Makefile                                       |    6 +
 lib/fdtdec.c                                       |   39 +-
 lib/vsprintf.c                                     |   23 +-
 scripts/Makefile.lib                               |   12 +-
 scripts/Makefile.spl                               |   35 +
 scripts/Makefile.uncmd_spl                         |    2 +
 tools/Makefile                                     |    1 +
 tools/mkimage.c                                    |   59 +-
 tools/rkimage.c                                    |   63 +
 88 files changed, 4136 insertions(+), 212 deletions(-)
 create mode 100644 arch/arm/dts/rk3288-firefly.dts
 create mode 100644 arch/arm/dts/rk3288-firefly.dtsi
 create mode 100644 arch/arm/dts/rk3288-thermal.dtsi
 create mode 100644 arch/arm/dts/rk3288.dtsi
 create mode 100644 arch/arm/include/asm/arch-rockchip/clock.h
 create mode 100644 arch/arm/include/asm/arch-rockchip/gpio.h
 create mode 100644 arch/arm/include/asm/arch-rockchip/grf.h
 create mode 100644 arch/arm/mach-rockchip/Kconfig
 create mode 100644 arch/arm/mach-rockchip/Makefile
 create mode 100644 arch/arm/mach-rockchip/board-spl.c
 create mode 100644 arch/arm/mach-rockchip/board.c
 create mode 100644 arch/arm/mach-rockchip/common.c
 create mode 100644 arch/arm/mach-rockchip/rk3288/Kconfig
 create mode 100644 board/firefly/firefly-rk3288/Kconfig
 create mode 100644 board/firefly/firefly-rk3288/MAINTAINERS
 create mode 100644 board/firefly/firefly-rk3288/Makefile
 create mode 100644 board/firefly/firefly-rk3288/firefly-rk3288.c
 create mode 100644 configs/firefly-rk3288_defconfig
 create mode 100644 doc/README.rockchip
 create mode 100644 doc/device-tree-bindings/clock/rockchip,rk3288-cru.txt
 create mode 100644 doc/device-tree-bindings/clock/rockchip.txt
 create mode 100644 doc/device-tree-bindings/pinctrl/rockchip,pinctrl.txt
 create mode 100644 doc/device-tree-bindings/thermal/rockchip-thermal.txt
 create mode 100644 drivers/serial/serial_rockchip.c
 create mode 100644 include/configs/firefly-rk3288.h
 create mode 100644 include/dt-bindings/clock/rk3288-cru.h
 create mode 100644 include/dt-bindings/clock/rockchip,rk808.h
 create mode 100644 include/dt-bindings/pinctrl/rockchip.h
 create mode 100644 include/dt-bindings/power-domain/rk3288.h
 create mode 100644 include/dt-bindings/thermal/thermal.h
 create mode 100644 tools/rkimage.c

-- 
2.2.0.rc0.207.ga3a616c



More information about the U-Boot mailing list