dm: Introduce device tree support in SPL (for Rockchip)
Subsystems (11)
v2 cover dm: Introduce device tree support in SPL (for Rockchip)
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 a new 'fdtgrep' tool for this. The 45KB Firefly device tree reduces to 558 bytes when unused material is removed.
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 8694 bytes with my Linaro 4.8.2 compiler, including the device tree, using Thumb-2 and with a hacked build so that CONFIG_USE_PRIVATE_LIBGCC is enabled. Of this:
1768 bytes is driver model core code
1556 bytes is device tree code
558 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 6758 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.
This series has not yet been tested on a Radxa Rock Pro but is likely to work there also, using the Firefly config. Future work will add support for this board also.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54303
Changes in v2:
- Simplify the support for CONFIG_SYS_NS16550_MEM32
- Also drop the memory table space
- Add a new patch for memalign_simple()
- Add new patch to remove unused strings from a device tree
- Add new patch with fdt_first/next_region() functions
- Add new patch with fdtgrep tool
- Add new patch to reduce SPL device tree size with fdtgrep
- Tidy up license headers and remove SPL #ifdefs
- Tidy up license headers
- Tidy up license headers and remove SPL #ifdefs
- Drop use of CONFIG_USE_PRIVATE_LIBGCC=y
- Tidy up license headers and remove SPL #ifdefs
Simon Glass (18):
dm: ns16550: Support CONFIG_SYS_NS16550_MEM32 with driver model
fdt: arm: Drop device tree padding
dts: Disable device tree for SPL on all boards
dm: serial: Don't support CONFIG_CONS_INDEX with device tree Add a simple version of memalign()
Remove SPL undefine of CONFIG_OF_CONTROL
mkimage: Display a better list of available image types
fdt: Add a function to remove unused strings from a device tree
fdt: Add fdt_first/next_region() functions
fdt: Add fdtgrep tool
dm: Reduce SPL device tree size
dm: rockchip: Add serial support
rockchip: Bring in RK3288 device tree file includes and bindings
rockchip: Add base SoC files
rockchip: Add basic support for firefly-rk3288
rockchip: Add the beginnings of an image tool
rockchip: Add a simple README
rockchip: Add basic support for jerry
Makefile | 2 +- arch/arm/Kconfig | 18 + 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/cros-ec-sbs.dtsi | 16 + arch/arm/dts/rk3288-firefly.dts | 44 + arch/arm/dts/rk3288-firefly.dtsi | 454 ++++++ arch/arm/dts/rk3288-jerry.dts | 203 +++ arch/arm/dts/rk3288-thermal.dtsi | 88 ++ arch/arm/dts/rk3288-veyron-chromebook.dtsi | 200 +++ arch/arm/dts/rk3288-veyron.dtsi | 808 +++++++++++ arch/arm/dts/rk3288.dtsi | 1458 ++++++++++++++++++++ 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 | 23 + 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 | 26 + arch/arm/mach-tegra/Kconfig | 3 + 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 + board/google/chromebook_jerry/Kconfig | 15 + board/google/chromebook_jerry/MAINTAINERS | 6 + board/google/chromebook_jerry/Makefile | 7 + board/google/chromebook_jerry/jerry.c | 7 + board/google/common/Makefile | 2 +- common/image.c | 59 +- common/malloc_simple.c | 14 + configs/am335x_boneblack_vboot_defconfig | 1 + configs/arches_defconfig | 1 + configs/canyonlands_defconfig | 1 + configs/chromebook_jerry_defconfig | 10 + configs/firefly-rk3288_defconfig | 10 + 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/Makefile | 2 + drivers/serial/Kconfig | 9 + drivers/serial/Makefile | 1 + drivers/serial/ns16550.c | 4 + drivers/serial/serial-uclass.c | 69 +- drivers/serial/serial_rockchip.c | 41 + dts/Kconfig | 12 + include/config_uncmd_spl.h | 2 + include/configs/chromebook_jerry.h | 50 + include/configs/firefly-rk3288.h | 50 + include/dt-bindings/clock/rk3288-cru.h | 370 +++++ include/dt-bindings/clock/rockchip,rk808.h | 11 + include/dt-bindings/pinctrl/rockchip.h | 26 + include/dt-bindings/power-domain/rk3288.h | 11 + include/image.h | 12 + include/libfdt.h | 256 +++- include/ns16550.h | 2 +- lib/libfdt/Makefile | 2 +- lib/libfdt/fdt_region.c | 492 +++++++ lib/libfdt/fdt_rw.c | 32 + scripts/Makefile.spl | 28 + scripts/Makefile.uncmd_spl | 2 + tools/Makefile | 7 +- tools/fdtgrep.c | 1234 +++++++++++++++++ tools/mkimage.c | 59 +- tools/rkimage.c | 63 + 87 files changed, 7057 insertions(+), 73 deletions(-) create mode 100644 arch/arm/dts/cros-ec-sbs.dtsi 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-jerry.dts create mode 100644 arch/arm/dts/rk3288-thermal.dtsi create mode 100644 arch/arm/dts/rk3288-veyron-chromebook.dtsi create mode 100644 arch/arm/dts/rk3288-veyron.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 board/google/chromebook_jerry/Kconfig create mode 100644 board/google/chromebook_jerry/MAINTAINERS create mode 100644 board/google/chromebook_jerry/Makefile create mode 100644 board/google/chromebook_jerry/jerry.c create mode 100644 configs/chromebook_jerry_defconfig 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/chromebook_jerry.h 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 lib/libfdt/fdt_region.c create mode 100644 tools/fdtgrep.c create mode 100644 tools/rkimage.c
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 1/18 dm: ns16550: Support CONFIG_SYS_NS16550_MEM32 with driver model
This option is used by some boards, so support it with driver model. This is really ugly - we should rewrite this driver once all users are moved to driver model.
---
Changes in v2:
- Simplify the support for CONFIG_SYS_NS16550_MEM32
drivers/serial/ns16550.c | 4 ++++ include/ns16550.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/serial/ns16550.c +4 -0
@@ -65,6 +65,8 @@ static inline void serial_out_shift(void *addr, int shift, int value)out_le32 (addr, value);#elif defined(CONFIG_SYS_NS16550_MEM32 ) && defined(CONFIG_SYS_BIG_ENDIAN )out_be32 (addr, value); +#elif defined(CONFIG_SYS_NS16550_MEM32 ) +writel (value, addr);#elif defined(CONFIG_SYS_BIG_ENDIAN )writeb (value, addr + (1 << shift) -1 );#else
@@ -80,6 +82,8 @@ static inline int serial_in_shift(void *addr, int shift)return in_le32 (addr);#elif defined(CONFIG_SYS_NS16550_MEM32 ) && defined(CONFIG_SYS_BIG_ENDIAN )return in_be32 (addr); +#elif defined(CONFIG_SYS_NS16550_MEM32 ) +return readl (addr);#elif defined(CONFIG_SYS_BIG_ENDIAN )return readb (addr + (1 << shift) -1 );#else
include/ns16550.h +1 -1
@@ -33,7 +33,7 @@#if !defined(CONFIG_SYS_NS16550_REG_SIZE ) || (CONFIG_SYS_NS16550_REG_SIZE ==0 )#error "Please define NS16550 registers size." -#elif defined(CONFIG_SYS_NS16550_MEM32 ) +#elif defined(CONFIG_SYS_NS16550_MEM32 ) && !defined(CONFIG_DM_SERIAL )#define UART_REG (x) u32 x#elif (CONFIG_SYS_NS16550_REG_SIZE >0 )#define UART_REG (x) \
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 1/18 dm: ns16550: Support CONFIG_SYS_NS16550_MEM32 with driver model
Quoted 5 lines · Simon Glass
This option is used by some boards, so support it with driver model. This is really ugly - we should rewrite this driver once all users are moved to driver model.
Signed-off-by Simon Glass <[email protected]>
Quoted 8 lines
---
Changes in v2:
- Simplify the support forCONFIG_SYS_NS16550_MEM32drivers/serial/ns16550.c | 4 ++++ include/ns16550.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
Applied to u-boot-dm.
PATCH v2 2/18 fdt: arm: Drop device tree padding
In reply to Simon GlassThe 4KB padding doesn't seem necessary since we don't normally adjust the control device tree file within U-Boot. Also drop the memory table space.
---
Changes in v2:
- Also drop the memory table space
arch/arm/dts/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/dts/Makefile +2 -1
@@ -132,7 +132,8 @@ dtb-$(CONFIG_MACH_SUN9I) += \ targets += $(dtb-y) -DTC_FLAGS += -R 4 -p 0x1000 +# Add any required device tree compiler flags here +DTC_FLAGS += PHONY += dtbs dtbs: $(addprefix $(obj)/, $(dtb-y))
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 2/18 fdt: arm: Drop device tree padding
Quoted 11 lines · Simon Glass
The 4KB padding doesn't seem necessary since we don't normally adjust the control device tree file within U-Boot. Also drop the memory table space.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Also drop the memory table spacearch/arm/dts/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Applied to u-boot-dm.
PATCH v2 3/18 dts: Disable device tree for SPL on all boards
In reply to Simon GlassWe plan to enable device tree in SPL by default. Before doing this, explicitly disable it for all boards.
---
Changes in v2: None
arch/arm/Kconfig | 2 ++ arch/arm/cpu/armv7/exynos/Kconfig | 8 ++++++++ arch/arm/cpu/armv7/s5pc1xx/Kconfig | 2 ++ arch/arm/mach-tegra/Kconfig | 3 +++ configs/am335x_boneblack_vboot_defconfig | 1 + configs/arches_defconfig | 1 + configs/canyonlands_defconfig | 1 + 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 + 22 files changed, 33 insertions(+)
arch/arm/Kconfig +2 -0
@@ -666,6 +666,7 @@ config TEGRA select SUPPORT_SPL select SPL select OF_CONTROL + select SPL_DISABLE_OF_CONTROL select CPU_V7 select DM select DM_SPI_FLASH
@@ -792,6 +793,7 @@ config ARCH_UNIPHIER select DM select DM_SERIAL select DM_I2C + select SPL_DISABLE_OF_CONTROL config TARGET_STM32F429_DISCOVERY bool "Support STM32F429 Discovery"
arch/arm/cpu/armv7/exynos/Kconfig +8 -0
@@ -7,6 +7,7 @@ config TARGET_SMDKV310 select SUPPORT_SPL bool "Exynos4210 SMDKV310 board" select OF_CONTROL + select SPL_DISABLE_OF_CONTROL config TARGET_TRATS bool "Exynos4210 Trats board"
@@ -27,6 +28,7 @@ config TARGET_ODROID config TARGET_ODROID_XU3 bool "Exynos5422 Odroid board" select OF_CONTROL + select SPL_DISABLE_OF_CONTROL config TARGET_ARNDALE bool "Exynos5250 Arndale board"
@@ -34,31 +36,37 @@ config TARGET_ARNDALE select CPU_V7_HAS_VIRT select SUPPORT_SPL select OF_CONTROL + select SPL_DISABLE_OF_CONTROL config TARGET_SMDK5250 bool "SMDK5250 board" select SUPPORT_SPL select OF_CONTROL + select SPL_DISABLE_OF_CONTROL config TARGET_SNOW bool "Snow board" select SUPPORT_SPL select OF_CONTROL + select SPL_DISABLE_OF_CONTROL config TARGET_SMDK5420 bool "SMDK5420 board" select SUPPORT_SPL select OF_CONTROL + select SPL_DISABLE_OF_CONTROL config TARGET_PEACH_PI bool "Peach Pi board" select SUPPORT_SPL select OF_CONTROL + select SPL_DISABLE_OF_CONTROL config TARGET_PEACH_PIT bool "Peach Pit board" select SUPPORT_SPL select OF_CONTROL + select SPL_DISABLE_OF_CONTROL endchoice
arch/arm/cpu/armv7/s5pc1xx/Kconfig +2 -0
@@ -6,10 +6,12 @@ choice config TARGET_S5P_GONI bool "S5P Goni board" select OF_CONTROL + select SPL_DISABLE_OF_CONTROL config TARGET_SMDKC100 bool "Support smdkc100 board" select OF_CONTROL + select SPL_DISABLE_OF_CONTROL endchoice
arch/arm/mach-tegra/Kconfig +3 -0
@@ -26,6 +26,9 @@ config USE_PRIVATE_LIBGCC config SPL_DM default y +config SPL_DISABLE_OF_CONTROL + default y + source "arch/arm/mach-tegra/tegra20/Kconfig" source "arch/arm/mach-tegra/tegra30/Kconfig" source "arch/arm/mach-tegra/tegra114/Kconfig"
configs/am335x_boneblack_vboot_defconfig +1 -0
@@ -5,6 +5,7 @@ CONFIG_SYS_EXTRA_OPTIONS="EMMC_BOOT,ENABLE_VBOOT" CONFIG_ARM=y CONFIG_TARGET_AM335X_EVM=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="am335x-boneblack" CONFIG_FIT=y CONFIG_FIT_VERBOSE=y
configs/arches_defconfig +1 -0
@@ -4,4 +4,5 @@ CONFIG_TARGET_CANYONLANDS=y CONFIG_ARCHES=y CONFIG_DEFAULT_DEVICE_TREE="arches" CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_OF_SEPARATE=y
configs/canyonlands_defconfig +1 -0
@@ -4,5 +4,6 @@ CONFIG_TARGET_CANYONLANDS=y CONFIG_CANYONLANDS=y CONFIG_DEFAULT_DEVICE_TREE="canyonlands" CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_OF_EMBED=y CONFIG_REGEX=y
configs/galileo_defconfig +1 -0
@@ -2,6 +2,7 @@ CONFIG_X86=y CONFIG_VENDOR_INTEL=y CONFIG_TARGET_GALILEO=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_OF_SEPARATE=y CONFIG_DEFAULT_DEVICE_TREE="galileo" CONFIG_ETH_DESIGNWARE=y
configs/microblaze-generic_defconfig +1 -0
@@ -2,5 +2,6 @@ CONFIG_SPL=y CONFIG_MICROBLAZE=y CONFIG_TARGET_MICROBLAZE_GENERIC=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_OF_EMBED=y CONFIG_DEFAULT_DEVICE_TREE="microblaze-generic"
configs/odroid_defconfig +1 -0
@@ -2,6 +2,7 @@ CONFIG_ARM=y CONFIG_ARCH_EXYNOS=y CONFIG_TARGET_ODROID=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="exynos4412-odroid" CONFIG_DM_I2C=y CONFIG_DM_I2C_COMPAT=y
configs/origen_defconfig +1 -0
@@ -3,4 +3,5 @@ CONFIG_ARM=y CONFIG_ARCH_EXYNOS=y CONFIG_TARGET_ORIGEN=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="exynos4210-origen"
configs/s5pc210_universal_defconfig +1 -0
@@ -2,4 +2,5 @@ CONFIG_ARM=y CONFIG_ARCH_EXYNOS=y CONFIG_TARGET_S5PC210_UNIVERSAL=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="exynos4210-universal_c210"
configs/socfpga_socrates_defconfig +1 -0
@@ -3,6 +3,7 @@ CONFIG_ARM=y CONFIG_ARCH_SOCFPGA=y CONFIG_TARGET_SOCFPGA_CYCLONE5=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_socrates" CONFIG_ETH_DESIGNWARE=y CONFIG_NETDEVICES=y
configs/trats2_defconfig +1 -0
@@ -2,5 +2,6 @@ CONFIG_ARM=y CONFIG_ARCH_EXYNOS=y CONFIG_TARGET_TRATS2=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="exynos4412-trats2" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
configs/trats_defconfig +1 -0
@@ -2,4 +2,5 @@ CONFIG_ARM=y CONFIG_ARCH_EXYNOS=y CONFIG_TARGET_TRATS=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="exynos4210-trats"
configs/zynq_microzed_defconfig +1 -0
@@ -4,6 +4,7 @@ CONFIG_ARCH_ZYNQ=y CONFIG_TARGET_ZYNQ_MICROZED=y CONFIG_OF_CONTROL=y # CONFIG_SYS_MALLOC_F is not set +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_FIT_SIGNATURE=y
configs/zynq_zc70x_defconfig +1 -0
@@ -3,6 +3,7 @@ CONFIG_ARM=y CONFIG_ARCH_ZYNQ=y CONFIG_TARGET_ZYNQ_ZC70X=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="zynq-zc702" # CONFIG_SYS_MALLOC_F is not set CONFIG_FIT=y
configs/zynq_zc770_xm010_defconfig +1 -0
@@ -4,6 +4,7 @@ CONFIG_ARM=y CONFIG_ARCH_ZYNQ=y CONFIG_TARGET_ZYNQ_ZC770=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="zynq-zc770-xm010" # CONFIG_SYS_MALLOC_F is not set CONFIG_FIT=y
configs/zynq_zc770_xm012_defconfig +1 -0
@@ -4,6 +4,7 @@ CONFIG_ARM=y CONFIG_ARCH_ZYNQ=y CONFIG_TARGET_ZYNQ_ZC770=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="zynq-zc770-xm012" # CONFIG_SYS_MALLOC_F is not set CONFIG_FIT=y
configs/zynq_zc770_xm013_defconfig +1 -0
@@ -4,6 +4,7 @@ CONFIG_ARM=y CONFIG_ARCH_ZYNQ=y CONFIG_TARGET_ZYNQ_ZC770=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="zynq-zc770-xm013" # CONFIG_SYS_MALLOC_F is not set CONFIG_FIT=y
configs/zynq_zed_defconfig +1 -0
@@ -3,6 +3,7 @@ CONFIG_ARM=y CONFIG_ARCH_ZYNQ=y CONFIG_TARGET_ZYNQ_ZED=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="zynq-zed" # CONFIG_SYS_MALLOC_F is not set CONFIG_FIT=y
configs/zynq_zybo_defconfig +1 -0
@@ -3,6 +3,7 @@ CONFIG_ARM=y CONFIG_ARCH_ZYNQ=y CONFIG_TARGET_ZYNQ_ZYBO=y CONFIG_OF_CONTROL=y +CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="zynq-zybo" # CONFIG_SYS_MALLOC_F is not set CONFIG_FIT=y
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 3/18 dts: Disable device tree for SPL on all boards
Quoted 23 lines · Simon Glass
We plan to enable device tree in SPL by default. Before doing this, explicitly disable it for all boards.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
arch/arm/Kconfig | 2 ++ arch/arm/cpu/armv7/exynos/Kconfig | 8 ++++++++ arch/arm/cpu/armv7/s5pc1xx/Kconfig | 2 ++ arch/arm/mach-tegra/Kconfig | 3 +++ configs/am335x_boneblack_vboot_defconfig | 1 + configs/arches_defconfig | 1 + configs/canyonlands_defconfig | 1 + 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 +
Quoted 8 lines
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 + 22 files changed, 33 insertions(+)
Applied to u-boot-dm.
PATCH v2 4/18 dm: serial: Don't support CONFIG_CONS_INDEX with device tree
In reply to Simon GlassThis feature should be deprecated for new boards, and significantly adds to SPL code size. Drop it. Instead, we can use stdout-path in the /chosen node.
---
Changes in v2: None
drivers/serial/serial-uclass.c | 69 ++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 32 deletions(-)
drivers/serial/serial-uclass.c +37 -32
@@ -30,49 +30,54 @@ static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE;static void serial_find_console_or_panic (void ) {struct udevice *dev; - -#ifdef CONFIG_OF_CONTROL int node; -/* Check for a chosen console */ - node =fdtdec_get_chosen_node (gd->fdt_blob,"stdout-path" ); -if (node <0 ) - node =fdt_path_offset (gd->fdt_blob,"console" ); -if (!uclass_get_device_by_of_offset (UCLASS_SERIAL , node, &dev)) { - gd->cur_serial_dev = dev; -return ; - } - -/* -* If the console is not marked to be bound before relocation, bind -* it anyway. -*/ -if (node >0 && - !lists_bind_fdt (gd->dm_root, gd->fdt_blob, node, &dev)) { -if (!device_probe (dev)) { +if (OF_CONTROL ) { +/* Check for a chosen console */ + node =fdtdec_get_chosen_node (gd->fdt_blob,"stdout-path" ); +if (node <0 ) + node =fdt_path_offset (gd->fdt_blob,"console" ); +if (!uclass_get_device_by_of_offset (UCLASS_SERIAL , node, + &dev)) { gd->cur_serial_dev = dev;return ; } - } -#endif -/* -* Try to use CONFIG_CONS_INDEX if available (it is numbered from 1!). -* -* Failing that, get the device with sequence number 0, or in extremis -* just the first serial device we can find. But we insist on having -* a console (even if it is silent). -*/ + +/* +* If the console is not marked to be bound before relocation, +* bind it anyway. +*/ +if (node >0 && + !lists_bind_fdt (gd->dm_root, gd->fdt_blob, node, &dev)) { +if (!device_probe (dev)) { + gd->cur_serial_dev = dev; +return ; + } + } + }else { +/* +* Try to use CONFIG_CONS_INDEX if available (it is numbered +* from 1!). +* +* Failing that, get the device with sequence number 0, or in +* extremis just the first serial device we can find. But we +* insist on having a console (even if it is silent). +*/ #ifdef CONFIG_CONS_INDEX #define INDEX (CONFIG_CONS_INDEX - 1)#else #define INDEX 0#endif -if (uclass_get_device_by_seq (UCLASS_SERIAL ,INDEX , &dev) && -uclass_get_device (UCLASS_SERIAL ,INDEX , &dev) && - (uclass_first_device (UCLASS_SERIAL , &dev) || !dev)) -panic_str ("No serial driver found" ); +if (!uclass_get_device_by_seq (UCLASS_SERIAL ,INDEX , &dev) || + !uclass_get_device (UCLASS_SERIAL ,INDEX , &dev) || + (!uclass_first_device (UCLASS_SERIAL , &dev) || dev)) { + gd->cur_serial_dev = dev; +return ; + }#undef INDEX - gd->cur_serial_dev = dev; + } + +panic_str ("No serial driver found" ); }/* Called prior to relocation */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 4/18 dm: serial: Don't support CONFIG_CONS_INDEX with device tree
Quoted 11 lines · Simon Glass
This feature should be deprecated for new boards, and significantly adds to SPL code size. Drop it. Instead, we can use stdout-path in the /chosen node.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
drivers/serial/serial-uclass.c | 69 ++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 32 deletions(-)
Applied to u-boot-dm.
PATCH v2 5/18 Add a simple version of memalign()
In reply to Simon GlassThis is used when the full malloc() is not available.
---
Changes in v2:
- Add a new patch for memalign_simple()
common/malloc_simple.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
common/malloc_simple.c +14 -0
@@ -26,6 +26,20 @@ void *malloc_simple(size_t bytes)return ptr; } +void *memalign_simple (size_t align,size_t bytes) +{ +ulong addr, new_ptr; +void *ptr; + + addr =ALIGN (gd->malloc_base + gd->malloc_ptr, bytes); + new_ptr = addr + bytes; +if (new_ptr > gd->malloc_limit) +return NULL ; + ptr =map_sysmem (addr, bytes); + gd->malloc_ptr =ALIGN (new_ptr,sizeof (new_ptr)); +return ptr; +} +#ifdef CONFIG_SYS_MALLOC_SIMPLE void *calloc (size_t nmemb,size_t elem_size) {
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 5/18 Add a simple version of memalign()
Quoted 10 lines · Simon Glass
This is used when the full
malloc()is not available.Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Add a new patch formemalign_simple()common/malloc_simple.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
Applied to u-boot-dm.
PATCH v2 6/18 Remove SPL undefine of CONFIG_OF_CONTROL
In reply to Simon GlassAllow SPL to be built with this option so that we can support device tree control. Disable the simple bus for now in SPL. It may be needed later.
---
Changes in v2: None
drivers/core/Makefile | 2 ++ include/config_uncmd_spl.h | 2 ++ scripts/Makefile.uncmd_spl | 2 ++ 3 files changed, 6 insertions(+)
drivers/core/Makefile +2 -0
@@ -5,5 +5,7 @@ # obj-$(CONFIG_DM) += device.o lists.o root.o uclass.o util.o +ifndef CONFIG_SPL_BUILD obj-$(CONFIG_OF_CONTROL) += simple-bus.o +endif obj-$(CONFIG_DM_DEVICE_REMOVE) += device-remove.o
include/config_uncmd_spl.h +2 -0
@@ -20,7 +20,9 @@#undef CONFIG_CMD_SNTP#undef CONFIG_CMD_TFTPPUT#undef CONFIG_CMD_TFTPSRV +#ifdef CONFIG_SPL_DISABLE_OF_CONTROL #undef CONFIG_OF_CONTROL +#endif #ifndef CONFIG_SPL_DM #undef CONFIG_DM_SERIAL
scripts/Makefile.uncmd_spl +2 -0
@@ -3,7 +3,9 @@ # TODO: Invent a better way ifdef CONFIG_SPL_BUILD +ifdef CONFIG_SPL_DISABLE_OF_CONTROL CONFIG_OF_CONTROL= +endif ifndef CONFIG_SPL_DM CONFIG_DM_SERIAL=
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 6/18 Remove SPL undefine of CONFIG_OF_CONTROL
Quoted 4 lines · Simon Glass
Allow SPL to be built with this option so that we can support device tree control. Disable the simple bus for now in SPL. It may be needed later.
Signed-off-by Simon Glass <[email protected]>
Quoted 8 lines
---
Changes in v2: None
drivers/core/Makefile | 2 ++ include/config_uncmd_spl.h | 2 ++ scripts/Makefile.uncmd_spl | 2 ++ 3 files changed, 6 insertions(+)
Applied to u-boot-dm.
PATCH v2 7/18 mkimage: Display a better list of available image types
In reply to Simon GlassOffer to display the available image types in help. Also, rather than hacking the genimg_get_type_id() function to display a list of types, do this in the tool. Also, sort the list.
The list of image types is quite long, and hard to discover. Print it out when we show help information.
---
Changes in v2: None
common/image.c | 58 +++++++++++++++++++++++++++++++------------------------- include/image.h | 11 +++++++++++ tools/mkimage.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 95 insertions(+), 33 deletions(-)
common/image.c +32 -26
@@ -543,6 +543,15 @@ void genimg_print_time(time_t timestamp) }#endif +const table_entry_t *get_table_entry (const table_entry_t *table,int id) +{ +for (; table->id >=0 ; ++table) { +if (table->id == id) +return table; + } +return NULL ; +} +/** * get_table_entry_name - translate entry id to long name * @table: pointer to a translation table for entries of a specific type
@@ -559,15 +568,14 @@ void genimg_print_time(time_t timestamp)*/ char *get_table_entry_name (const table_entry_t *table,char *msg,int id) { -for (; table->id >=0 ; ++table) { - if (table->id == id) + table =get_table_entry (table, id); +if (!table) +return msg;#if defined(USE_HOSTCC ) || !defined(CONFIG_NEEDS_MANUAL_RELOC ) -return table->lname; +return table->lname;#else -return table->lname + gd->reloc_off; +return table->lname + gd->reloc_off;#endif - } -return (msg); }const char *genimg_get_os_name (uint8_t os)
@@ -586,6 +594,20 @@ const char *genimg_get_type_name(uint8_t type)return (get_table_entry_name (uimage_type,"Unknown Image" , type)); } +const char *genimg_get_type_short_name (uint8_t type) +{ +const table_entry_t *table; + + table =get_table_entry (uimage_type, type); +if (!table) +return "unknown" ; +#if defined(USE_HOSTCC ) || !defined(CONFIG_NEEDS_MANUAL_RELOC ) +return table->sname; +#else +return table->sname + gd->reloc_off; +#endif +} +const char *genimg_get_comp_name (uint8_t comp) { return (get_table_entry_name(uimage_comp, "Unknown Compression",
@@ -610,34 +632,18 @@ int get_table_entry_id(const table_entry_t *table, const char *table_name, const char *name) { const table_entry_t *t; -#ifdef USE_HOSTCC -int first =1 ; - -for (t = table; t->id >=0 ; ++t) { -if (t->sname &&strcasecmp (t->sname, name) ==0 ) -return (t->id); - } -fprintf (stderr,"\nInvalid %s Type - valid names are" , table_name); -for (t = table; t->id >=0 ; ++t) { -if (t->sname ==NULL ) -continue ; -fprintf (stderr,"%c %s" , (first) ?':' :',' , t->sname); - first =0 ; - } -fprintf (stderr,"\n" ); -#else for (t = table; t->id >=0 ; ++t) {#ifdef CONFIG_NEEDS_MANUAL_RELOC -if (t->sname &&strcmp (t->sname + gd->reloc_off, name) ==0 ) +if (t->sname &&strcasecmp (t->sname + gd->reloc_off, name) ==0 ) #else - if (t->sname && strcmp(t->sname, name) == 0) + if (t->sname && strcasecmp(t->sname, name) == 0)#endif return (t->id); }debug ("Invalid %s Type: %s\n" , table_name, name); -#endif /* USE_HOSTCC */ -return (-1 ); + +return -1 ; }int genimg_get_os_id (const char *name)
include/image.h +11 -0
@@ -245,6 +245,8 @@ struct lmb;#define IH_TYPE_X86_SETUP 20/* x86 setup.bin Image */ #define IH_TYPE_LPC32XXIMAGE 21/* x86 setup.bin Image */ +#define IH_TYPE_COUNT 22/* Number of image types */ +/* * Compression Types */
@@ -410,6 +412,15 @@ char *get_table_entry_name(const table_entry_t *table, char *msg, int id);const char *genimg_get_os_name (uint8_t os);const char *genimg_get_arch_name (uint8_t arch);const char *genimg_get_type_name (uint8_t type); + +/** +* genimg_get_type_short_name() - get the short name for an image type +* +* @param type Image type (IH_TYPE_...) +* @return image short name, or "unknown" if unknown +*/ +const char *genimg_get_type_short_name (uint8_t type); +const char *genimg_get_comp_name (uint8_t comp);int genimg_get_os_id (const char *name);int genimg_get_arch_id (const char *name);
tools/mkimage.c +52 -7
78 lines not on this page · raw message
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 8/18 fdt: Add a function to remove unused strings from a device tree
In reply to Simon GlassProperty names are stored in a string table. When a node property is removed, the string table is not updated since other nodes may have a property with the same name.
Thus it is possible for the string table to build up a number of unused strings. Add a function to remove these. This works by building a new device tree from the old one, adding strings one by one as needed.
---
Changes in v2:
- Add new patch to remove unused strings from a device tree
include/libfdt.h | 17 +++++++++++++++++ lib/libfdt/fdt_rw.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+)
include/libfdt.h +17 -0
@@ -1646,6 +1646,23 @@ int fdt_del_node(void *fdt, int nodeoffset);const char *fdt_strerror (int errval); +/** +* fdt_remove_unused_strings() - Remove any unused strings from an FDT +* +* This creates a new device tree in @new with unused strings removed. The +* called can then use fdt_pack() to minimise the space consumed. +* +* @old: Old device tree blog +* @new: Place to put new device tree blob, which must be as large as +* @old +* @return +* 0, on success +* -FDT_ERR_BADOFFSET, corrupt device tree +* -FDT_ERR_NOSPACE, out of space, which should not happen unless there +* is something very wrong with the device tree input +*/ +int fdt_remove_unused_strings (const void *old,void *new); +struct fdt_region {int offset;int size;
lib/libfdt/fdt_rw.c +32 -0
@@ -449,3 +449,35 @@ int fdt_pack(void *fdt)return 0 ; } + +int fdt_remove_unused_strings (const void *old,void *new) +{ +const struct fdt_property *old_prop; +struct fdt_property *new_prop; +int size =fdt_totalsize (old); +int next_offset, offset; +const char *str; +int ret; +int tag =FDT_PROP ; + +/* Make a copy and remove the strings */ +memcpy (new, old, size); +fdt_set_size_dt_strings (new,0 ); + +/* Add every property name back into the new string table */ +for (offset =0 ; tag !=FDT_END ; offset = next_offset) { + tag =fdt_next_tag (old, offset, &next_offset); +if (tag !=FDT_PROP ) +continue ; + old_prop =fdt_get_property_by_offset (old, offset,NULL ); + new_prop = (struct fdt_property *)(unsigned long ) +fdt_get_property_by_offset (new, offset,NULL ); + str =fdt_string (old,fdt32_to_cpu (old_prop->nameoff)); + ret =_fdt_find_add_string (new, str); +if (ret <0 ) +return ret; + new_prop->nameoff =cpu_to_fdt32 (ret); + } + +return 0 ; +}
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 9/18 fdt: Add fdt_first/next_region() functions
In reply to Simon GlassThese have been sent upstream but not accessed to libfdt. For now, bring these into U-Boot to enable fdtgrep to operate. We will use fdtgrep to cut device tree files down for SPL.
---
Changes in v2:
- Add new patch with fdt_first/next_region() functions
include/libfdt.h | 239 ++++++++++++++++++++++- lib/libfdt/Makefile | 2 +- lib/libfdt/fdt_region.c | 492 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 731 insertions(+), 2 deletions(-) create mode 100644 lib/libfdt/fdt_region.c
include/libfdt.h +238 -1
@@ -121,7 +121,12 @@/* FDT_ERR_BADNCELLS: Device tree has a #address-cells, #size-cells * or similar property with a bad format or value */ -#define FDT_ERR_MAX 14 +#define FDT_ERR_TOODEEP 15 +/* FDT_ERR_TOODEEP: The depth of a node has exceeded the internal +* libfdt limit. This can happen if you have more than +* FDT_MAX_DEPTH nested nodes. */ + +#define FDT_ERR_MAX 15/**********************************************************************/ /* Low-level functions (you probably don't need these) */
@@ -1668,6 +1673,77 @@ struct fdt_region {int size; }; +/* +* Flags for fdt_find_regions() +* +* Add a region for the string table (always the last region) +*/ +#define FDT_REG_ADD_STRING_TAB (1 << 0) + +/* +* Add all supernodes of a matching node/property, useful for creating a +* valid subset tree +*/ +#define FDT_REG_SUPERNODES (1 << 1) + +/* Add the FDT_BEGIN_NODE tags of subnodes, including their names */ +#define FDT_REG_DIRECT_SUBNODES (1 << 2) + +/* Add all subnodes of a matching node */ +#define FDT_REG_ALL_SUBNODES (1 << 3) + +/* Add a region for the mem_rsvmap table (always the first region) */ +#define FDT_REG_ADD_MEM_RSVMAP (1 << 4) + +/* Indicates what an fdt part is (node, property, value) */ +#define FDT_IS_NODE (1 << 0) +#define FDT_IS_PROP (1 << 1) +#define FDT_IS_VALUE (1 << 2)/* not supported */ +#define FDT_IS_COMPAT (1 << 3)/* used internally */ +#define FDT_NODE_HAS_PROP (1 << 4)/* node contains prop */ + +#define FDT_ANY_GLOBAL (FDT_IS_NODE | FDT_IS_PROP | FDT_IS_VALUE | \ + FDT_IS_COMPAT) +#define FDT_IS_ANY 0x1f/* all the above */ + +/* We set a reasonable limit on the number of nested nodes */ +#define FDT_MAX_DEPTH 32 + +/* Decribes what we want to include from the current tag */ +enum want_t { +WANT_NOTHING , +WANT_NODES_ONLY ,/* No properties */ +WANT_NODES_AND_PROPS ,/* Everything for one level */ +WANT_ALL_NODES_AND_PROPS /* Everything for all levels */ +}; + +/* Keeps track of the state at parent nodes */ +struct fdt_subnode_stack { +int offset;/* Offset of node */ +enum want_t want;/* The 'want' value here */ +int included;/* 1 if we included this node, 0 if not */ +}; + +struct fdt_region_ptrs { +int depth;/* Current tree depth */ +int done;/* What we have completed scanning */ +enum want_t want;/* What we are currently including */ +char *end;/* Pointer to end of full node path */ +int nextoffset;/* Next node offset to check */ +}; + +/* The state of our finding algortihm */ +struct fdt_region_state { +struct fdt_subnode_stack stack[FDT_MAX_DEPTH ];/* node stack */ +struct fdt_region *region;/* Contains list of regions found */ +int count;/* Numnber of regions found */ +const void *fdt;/* FDT blob */ +int max_regions;/* Maximum regions to find */ +int can_merge;/* 1 if we can merge with previous region */ +int start;/* Start position of current region */ +struct fdt_region_ptrs ptrs;/* Pointers for what we are up to */ +}; +/** * fdt_find_regions() - find regions in device tree *
@@ -1727,4 +1803,165 @@ int fdt_find_regions(const void *fdt, char * const inc[], int inc_count, struct fdt_region region[], int max_regions, char *path, int path_len, int add_string_tab); +/** +* fdt_first_region() - find regions in device tree +* +* Given a nodes and properties to include and properties to exclude, find +* the regions of the device tree which describe those included parts. +* +* The use for this function is twofold. Firstly it provides a convenient +* way of performing a structure-aware grep of the tree. For example it is +* possible to grep for a node and get all the properties associated with +* that node. Trees can be subsetted easily, by specifying the nodes that +* are required, and then writing out the regions returned by this function. +* This is useful for small resource-constrained systems, such as boot +* loaders, which want to use an FDT but do not need to know about all of +* it. +* +* Secondly it makes it easy to hash parts of the tree and detect changes. +* The intent is to get a list of regions which will be invariant provided +* those parts are invariant. For example, if you request a list of regions +* for all nodes but exclude the property "data", then you will get the +* same region contents regardless of any change to "data" properties. +* +* This function can be used to produce a byte-stream to send to a hashing +* function to verify that critical parts of the FDT have not changed. +* Note that semantically null changes in order could still cause false +* hash misses. Such reordering might happen if the tree is regenerated +* from source, and nodes are reordered (the bytes-stream will be emitted +* in a different order and mnay hash functions will detect this). However +* if an existing tree is modified using libfdt functions, such as +* fdt_add_subnode() and fdt_setprop(), then this problem is avoided. +* +* The nodes/properties to include/exclude are defined by a function +* provided by the caller. This function is called for each node and +* property, and must return: +* +* 0 - to exclude this part +* 1 - to include this part +* -1 - for FDT_IS_PROP only: no information is available, so include +* if its containing node is included +* +* The last case is only used to deal with properties. Often a property is +* included if its containing node is included - this is the case where +* -1 is returned.. However if the property is specifically required to be +* included/excluded, then 0 or 1 can be returned. Note that including a +* property when the FDT_REG_SUPERNODES flag is given will force its +* containing node to be included since it is not valid to have a property +* that is not in a node. +* +* Using the information provided, the inclusion of a node can be controlled +* either by a node name or its compatible string, or any other property +* that the function can determine. +* +* As an example, including node "/" means to include the root node and all +* root properties. A flag provides a way of also including supernodes (of +* which there is none for the root node), and another flag includes +* immediate subnodes, so in this case we would get the FDT_BEGIN_NODE and +* FDT_END_NODE of all subnodes of /. +* +* The subnode feature helps in a hashing situation since it prevents the +* root node from changing@all. Any change to non-excluded properties, +* names of subnodes or number of subnodes would be detected. +* +* When used with FITs this provides the ability to hash and sign parts of +* the FIT based on different configurations in the FIT. Then it is +* impossible to change anything about that configuration (include images +* attached to the configuration), but it may be possible to add new +* configurations, new images or new signatures within the existing +* framework. +* +* Adding new properties to a device tree may result in the string table +* being extended (if the new property names are different from those +* already added). This function can optionally include a region for +* the string table so that this can be part of the hash too. This is always +* the last region. +* +* The FDT also has a mem_rsvmap table which can also be included, and is +* always the first region if so. +* +* The device tree header is not included in the region list. Since the +* contents of the FDT are changing (shrinking, often), the caller will need +* to regenerate the header anyway. +* +* @fdt: Device tree to check +* @h_include: Function to call to determine whether to include a part or +* not: +* +* @priv: Private pointer as passed to fdt_find_regions() +* @fdt: Pointer to FDT blob +* @offset: Offset of this node / property +* @type: Type of this part, FDT_IS_... +* @data: Pointer to data (node name, property name, compatible +* string, value (not yet supported) +* @size: Size of data, or 0 if none +* @return 0 to exclude, 1 to include, -1 if no information is +* available +* @priv: Private pointer passed to h_include +* @region: Returns list of regions, sorted by offset +* @max_regions: Maximum length of region list +* @path: Pointer to a temporary string for the function to use for +* building path names +* @path_len: Length of path, must be large enough to hold the longest +* path in the tree +* @flags: Various flags that control the region algortihm, see +* FDT_REG_... +* @return number of regions in list. If this is >max_regions then the +* region array was exhausted. You should increase max_regions and try +* the call again. Only the first max_regions elements are available in the +* array. +* +* On error a -ve value is return, which can be: +* +* -FDT_ERR_BADSTRUCTURE (too deep or more END tags than BEGIN tags +* -FDT_ERR_BADLAYOUT +* -FDT_ERR_NOSPACE (path area is too small) +*/ +int fdt_first_region (const void *fdt, +int (*h_include)(void *priv,const void *fdt,int offset, +int type,const char *data,int size), +void *priv,struct fdt_region *region, +char *path,int path_len,int flags, +struct fdt_region_state *info); + +/** fdt_next_region() - find next region +* +* See fdt_first_region() for full description. This function finds the +* next region according to the provided parameters, which must be the same +* as passed to fdt_first_region(). +* +* This function can additionally return -FDT_ERR_NOTFOUND when there are no +* more regions +*/ +int fdt_next_region (const void *fdt, +int (*h_include)(void *priv,const void *fdt,int offset, +int type,const char *data,int size), +void *priv,struct fdt_region *region, +char *path,int path_len,int flags, +struct fdt_region_state *info); + +/** +* fdt_add_alias_regions() - find aliases that point to existing regions +* +* Once a device tree grep is complete some of the nodes will be present +* and some will have been dropped. This function checks all the alias nodes +* to figure out which points point to nodes which are still present. These +* aliases need to be kept, along with the nodes they reference. +* +* Given a list of regions function finds the aliases that still apply and +* adds more regions to the list for these. This function is called after +* fdt_next_region() has finished returning regions and requires the same +* state. +* +* @fdt: Device tree file to reference +* @region: List of regions that will be kept +* @count: Number of regions +* @max_regions: Number of entries that can fit in @region +* @info: Region state as returned from fdt_next_region() +* @return new number of regions in @region (i.e. count + the number added) +* or -FDT_ERR_NOSPACE if there was not enough space. +*/ +int fdt_add_alias_regions (const void *fdt,struct fdt_region *region,int count, +int max_regions,struct fdt_region_state *info); +#endif /* _LIBFDT_H */
lib/libfdt/Makefile +1 -1
@@ -6,4 +6,4 @@ # obj-y += fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_sw.o fdt_wip.o \ - fdt_empty_tree.o fdt_addresses.o + fdt_empty_tree.o fdt_addresses.o fdt_region.o
lib/libfdt/fdt_region.c new file +492 -0
492 lines not on this page · raw message
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 10/18 fdt: Add fdtgrep tool
In reply to Simon GlassThis tool allows us to extract subsets of a device tree file. It is used by the SPL vuild, which needs to cut down the device tree size for use in limited memory.
This tool was originally written for libfdt but it has not been accepted upstream, so for now, include it in U-Boot. Several utilfdt library functions been included inline here.
If fdtgrep is eventually accepted in libfdt then we can bring that version of libfdt in here, and drop fdtgrep (requiring that fdtgrep is provided by the user).
If it is not accepted then another approach would be to write a special tool for chopping down device tree files for SPL. While it would use the same libfdt support, it would be less code than fdtgrep.c because it would not have general-purpose functions.
Another approach (which was used with v1 of this series) is to sprinkler all the device tree files with #ifdef. I don't like that idea.
---
Changes in v2:
- Add new patch with fdtgrep tool
tools/Makefile | 6 +- tools/fdtgrep.c | 1234 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1239 insertions(+), 1 deletion(-) create mode 100644 tools/fdtgrep.c
tools/Makefile +5 -1
@@ -58,7 +58,8 @@ hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o # Flattened device tree objects LIBFDT_OBJS := $(addprefix lib/libfdt/, \ - fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_wip.o) + fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_wip.o \ + fdt_region.o) RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \ rsa-sign.o rsa-verify.o rsa-checksum.o \ rsa-mod-exp.o)
@@ -154,6 +155,9 @@ hostprogs-$(CONFIG_ARMADA_XP) += kwboot hostprogs-y += proftool hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela +hostprogs-y += fdtgrep +fdtgrep-objs += $(LIBFDT_OBJS) fdtgrep.o + # We build some files with extra pedantic flags to try to minimize things # that won't build on some weird host compiler -- though there are lots of # exceptions for files that aren't complaint.
tools/fdtgrep.c new file +1234 -0
1,234 lines not on this page · raw message
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 11/18 dm: Reduce SPL device tree size
In reply to Simon GlassThe SPL device tree size must be minimised to save memory. Only include properties that are needed by SPL - this is determined by the presence of the "u-boot,dm-pre-reloc" property. Also remove a predefined list of unused properties from the nodes that remain.
---
Changes in v2:
- Add new patch to reduce SPL device tree size with fdtgrep
Makefile | 2 +- arch/arm/cpu/u-boot-spl.lds | 2 +- dts/Kconfig | 12 ++++++++++++ scripts/Makefile.spl | 28 ++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 2 deletions(-)
Makefile +1 -1
@@ -1255,7 +1255,7 @@ u-boot.lds: $(LDSCRIPT) prepare FORCE spl/u-boot-spl.bin: spl/u-boot-spl @: -spl/u-boot-spl: tools prepare +spl/u-boot-spl: tools prepare $(if $(CONFIG_OF_SEPARATE),dts/dt.dtb) $(Q)$(MAKE) obj=spl -f $(srctree)/scripts/Makefile.spl all spl/sunxi-spl.bin: spl/u-boot-spl
arch/arm/cpu/u-boot-spl.lds +1 -1
@@ -66,7 +66,7 @@ SECTIONS . = ALIGN(4); __bss_end = .; } - + __bss_size = __bss_end - __bss_start; .dynsym _image_binary_end : { *(.dynsym) } .dynbss : { *(.dynbss) } .dynstr : { *(.dynstr*) }
dts/Kconfig +12 -0
@@ -56,4 +56,16 @@ config DEFAULT_DEVICE_TREE It can be overridden from the command line: $ make DEVICE_TREE=<device-tree-name> +config OF_SPL_REMOVE_PROPS + string "List of device tree properties to drop for SPL" + depends on OF_CONTROL && SPL + default "pinctrl-0 pinctrl-names clocks clock-names interrupts interrupt-parent" + help + Since SPL normally runs in a reduced memory space, the device tree + is cut down to only what is needed to load and start U-Boot. Only + nodes marked with the property "u-boot,dm-pre-reloc" will be + included. In addition, some properties are not used by U-Boot and + can be discarded. This option defines the list of properties to + discard. + endmenu
scripts/Makefile.spl +28 -0
@@ -151,6 +151,8 @@ boot.bin: $(obj)/u-boot-spl.bin ALL-y += $(obj)/$(SPL_BIN).bin $(obj)/$(SPL_BIN).cfg +ALL-$(CONFIG_OF_SEPARATE) += $(obj)/$(SPL_BIN)-pad.bin $(obj)/$(SPL_BIN)-dtb.bin + ifdef CONFIG_SAMSUNG ALL-y += $(obj)/$(BOARD)-spl.bin endif
@@ -165,6 +167,32 @@ endif all: $(ALL-y) +quiet_cmd_cat = CAT $@ +cmd_cat = cat $(filter-out $(PHONY), $^) > $@ + +$(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN).bin $(obj)/$(SPL_BIN)-pad.bin \ + $(obj)/$(SPL_BIN).dtb FORCE + $(call if_changed,cat) + +# Create a file that pads from the end of u-boot-spl.bin to bss_end +$(obj)/$(SPL_BIN)-pad.bin: $(obj)/$(SPL_BIN) + @bss_size_str=$(shell $(NM) $< | awk 'BEGIN {size = 0} /__bss_size/ {size = $$1} END {print "ibase=16; " size}' | bc); \ + dd if=/dev/zero of=$@ bs=1 count=$${bss_size_str} 2>/dev/null; + +# Pass the original device tree file through fdtgrep twice. The first pass +# removes any unwanted nodes (i.e. those which don't have the +# 'u-boot,dm-pre-reloc' property and thus are not needed by SPL. The second +# pass removes various unused properties from the remaining nodes. +# The output is typically a much smaller device tree file. +quiet_cmd_fdtgrep = FDTGREP $@ + cmd_fdtgrep = $(objtree)/tools/fdtgrep -b u-boot,dm-pre-reloc -RT $< \ + -n /chosen -O dtb | \ + $(objtree)/tools/fdtgrep -r -O dtb - -o $@ \ + $(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS))) + +$(obj)/$(SPL_BIN).dtb: dts/dt.dtb + $(call cmd,fdtgrep) + quiet_cmd_cpp_cfg = CFG $@ cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \ -D__ASSEMBLY__ -x assembler-with-cpp -P -dM -E -o $@ $<
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 12/18 dm: rockchip: Add serial support
In reply to Simon GlassAdd support for the Rockchip serial device using the ns16550 driver. This uses driver model and device tree for both SPL and U-Boot proper.
---
Changes in v2: None
drivers/serial/Kconfig | 9 +++++++++ drivers/serial/Makefile | 1 + drivers/serial/serial_rockchip.c | 41 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 drivers/serial/serial_rockchip.c
drivers/serial/Kconfig +9 -0
@@ -76,6 +76,15 @@ config DEBUG_UART_SHIFT value. Use this value to specify the shift to use, where 0=byte registers, 2=32-bit word registers, etc. +config ROCKCHIP_SERIAL + bool "Rockchip on-chip UART support" + depends on ARCH_UNIPHIER && DM_SERIAL + help + Select this to enable a debug UART for Rockchip devices. This uses + the ns16550 driver. You will need to #define CONFIG_SYS_NS16550 in + your board config header. The clock input is automatically set to + use the oscillator (24MHz). + config UNIPHIER_SERIAL bool "UniPhier on-chip UART support" depends on ARCH_UNIPHIER && DM_SERIAL
drivers/serial/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_ZYNQ_SERIAL) += serial_zynq.o obj-$(CONFIG_BFIN_SERIAL) += serial_bfin.o obj-$(CONFIG_FSL_LPUART) += serial_lpuart.o obj-$(CONFIG_MXS_AUART) += mxs_auart.o +obj-$(CONFIG_ROCKCHIP_SERIAL) += serial_rockchip.o obj-$(CONFIG_ARC_SERIAL) += serial_arc.o obj-$(CONFIG_TEGRA_SERIAL) += serial_tegra.o obj-$(CONFIG_UNIPHIER_SERIAL) += serial_uniphier.o
drivers/serial/serial_rockchip.c new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 13/18 rockchip: Bring in RK3288 device tree file includes and bindings
In reply to Simon GlassBring in required device tree files from Linux. Since mainline Linux is somewhat behind, use the files from the Chromium tree. We can re-sync once further code is acccepted upstream.
---
Changes in v2:
- Tidy up license headers and remove SPL #ifdefs
arch/arm/dts/rk3288-thermal.dtsi | 88 ++ arch/arm/dts/rk3288.dtsi | 1458 ++++++++++++++++++++ .../clock/rockchip,rk3288-cru.txt | 61 + doc/device-tree-bindings/clock/rockchip.txt | 77 ++ .../pinctrl/rockchip,pinctrl.txt | 157 +++ .../thermal/rockchip-thermal.txt | 68 + include/dt-bindings/clock/rk3288-cru.h | 370 +++++ include/dt-bindings/clock/rockchip,rk808.h | 11 + include/dt-bindings/pinctrl/rockchip.h | 26 + include/dt-bindings/power-domain/rk3288.h | 11 + 10 files changed, 2327 insertions(+) create mode 100644 arch/arm/dts/rk3288-thermal.dtsi create mode 100644 arch/arm/dts/rk3288.dtsi 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 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
arch/arm/dts/rk3288-thermal.dtsi new file +88 -0
@@ -0,0 +1,88 @@ +/* + * Device Tree Source for RK3288 SoC thermal + * + * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd + * + * SPDX-License-Identifier: GPL-2.0 + */ + +#include <dt-bindings/thermal/thermal.h> + +reserve_thermal: reserve_thermal { + polling-delay-passive = <1000>; /* milliseconds */ + polling-delay = <5000>; /* milliseconds */ + + /* sensor ID */ + thermal-sensors = <&tsadc 0>; + +}; + +cpu_thermal: cpu_thermal { + polling-delay-passive = <100>; /* milliseconds */ + polling-delay = <5000>; /* milliseconds */ + + /* sensor ID */ + thermal-sensors = <&tsadc 1>; + linux,hwmon; + + trips { + cpu_alert0: cpu_alert0 { + temperature = <70000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "passive"; + }; + cpu_alert1: cpu_alert1 { + temperature = <75000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "passive"; + }; + cpu_crit: cpu_crit { + temperature = <100000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&cpu_alert0>; + cooling-device = + <&cpu0 THERMAL_NO_LIMIT 6>; + }; + map1 { + trip = <&cpu_alert1>; + cooling-device = + <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + +gpu_thermal: gpu_thermal { + polling-delay-passive = <100>; /* milliseconds */ + polling-delay = <5000>; /* milliseconds */ + + /* sensor ID */ + thermal-sensors = <&tsadc 2>; + linux,hwmon; + + trips { + gpu_alert0: gpu_alert0 { + temperature = <80000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "passive"; + }; + gpu_crit: gpu_crit { + temperature = <100000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&gpu_alert0>; + cooling-device = + <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +};
arch/arm/dts/rk3288.dtsi new file +1458 -0
1,458 lines not on this page · raw message
doc/device-tree-bindings/clock/rockchip,rk3288-cru.txt new file +61 -0
61 lines not on this page · raw message
doc/device-tree-bindings/clock/rockchip.txt new file +77 -0
77 lines not on this page · raw message
doc/device-tree-bindings/pinctrl/rockchip,pinctrl.txt new file +157 -0
157 lines not on this page · raw message
doc/device-tree-bindings/thermal/rockchip-thermal.txt new file +68 -0
68 lines not on this page · raw message
include/dt-bindings/clock/rk3288-cru.h new file +370 -0
370 lines not on this page · raw message
include/dt-bindings/clock/rockchip,rk808.h new file +11 -0
@@ -0,0 +1,11 @@ +/* +* This header provides constants clk index RK808 pmic clkout +*/ +#ifndef _CLK_ROCKCHIP_RK808 +#define _CLK_ROCKCHIP_RK808 + +/* CLOCKOUT index */ +#define RK808_CLKOUT0 0 +#define RK808_CLKOUT1 1 + +#endif
include/dt-bindings/pinctrl/rockchip.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* Header providing constants for Rockchip pinctrl bindings. +* +* Copyright (c) 2013 MundoReader S.L. +* Author: Heiko Stuebner <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __DT_BINDINGS_ROCKCHIP_PINCTRL_H__ +#define __DT_BINDINGS_ROCKCHIP_PINCTRL_H__ + +#define RK_GPIO0 0 +#define RK_GPIO1 1 +#define RK_GPIO2 2 +#define RK_GPIO3 3 +#define RK_GPIO4 4 +#define RK_GPIO6 6 + +#define RK_FUNC_GPIO 0 +#define RK_FUNC_1 1 +#define RK_FUNC_2 2 +#define RK_FUNC_3 3 +#define RK_FUNC_4 4 + +#endif
include/dt-bindings/power-domain/rk3288.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef __DT_BINDINGS_POWER_DOMAIN_RK3288_H__ +#define __DT_BINDINGS_POWER_DOMAIN_RK3288_H__ + +/* RK3288 power domain index */ +#define RK3288_PD_GPU 0 +#define RK3288_PD_VIO 1 +#define RK3288_PD_VIDEO 2 +#define RK3288_PD_HEVC 3 +#define RK3288_PD_PERI 4 + +#endif
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 14/18 rockchip: Add base SoC files
In reply to Simon GlassAdd some basic files required to allow the SoC to start up. This is a minimal set, enough only to display a serial message in SPL and hang.
---
Changes in v2:
- Tidy up license headers
arch/arm/Kconfig | 16 +++ arch/arm/Makefile | 1 + 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 | 23 ++++ 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 | 6 + 11 files changed, 338 insertions(+) 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
arch/arm/Kconfig +16 -0
@@ -799,6 +799,20 @@ config TARGET_STM32F429_DISCOVERY bool "Support STM32F429 Discovery" select CPU_V7M +config ARCH_ROCKCHIP + bool "Support Rockchip SoCs" + select SUPPORT_SPL + select SPL + select OF_CONTROL + select CPU_V7 + select DM + select SPL_DM + select DM_SERIAL + select DM_SPI + select DM_SPI_FLASH + select DM_I2C + select DM_GPIO + endchoice source "arch/arm/mach-at91/Kconfig"
@@ -833,6 +847,8 @@ source "arch/arm/mach-orion5x/Kconfig" source "arch/arm/cpu/armv7/rmobile/Kconfig" +source "arch/arm/mach-rockchip/Kconfig" + source "arch/arm/cpu/armv7/s5pc1xx/Kconfig" source "arch/arm/mach-socfpga/Kconfig"
arch/arm/Makefile +1 -0
@@ -54,6 +54,7 @@ machine-$(CONFIG_ARCH_NOMADIK) += nomadik # TODO: rename CONFIG_ORION5X -> CONFIG_ARCH_ORION5X machine-$(CONFIG_ORION5X) += orion5x machine-$(CONFIG_ARCH_SOCFPGA) += socfpga +machine-$(CONFIG_ARCH_ROCKCHIP) += rockchip machine-$(CONFIG_TEGRA) += tegra machine-$(CONFIG_ARCH_UNIPHIER) += uniphier machine-$(CONFIG_ARCH_VERSATILE) += versatile
arch/arm/include/asm/arch-rockchip/clock.h new file +12 -0
@@ -0,0 +1,12 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0 +*/ + +#ifndef _ASM_ARCH_CLOCK_H +#define _ASM_ARCH_CLOCK_H + +#define OSC_HZ (24 * 1000 * 1000) + +#endif
arch/arm/include/asm/arch-rockchip/gpio.h new file +5 -0
@@ -0,0 +1,5 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/
arch/arm/include/asm/arch-rockchip/grf.h new file +181 -0
181 lines not on this page · raw message
arch/arm/mach-rockchip/Kconfig new file +23 -0
@@ -0,0 +1,23 @@ +if ARCH_ROCKCHIP + +config ROCKCHIP_RK3288 + bool "Support Rockchip RK3288" + help + The Rockchip RK3288 is a ARM-based SoC with a quad-core Cortex-A17 + including NEON and GPU, 1MB L2 cache, Mali-T7 graphics, two + video interfaces supporting HDMI and eDP, several DDR3 options + and video codec support. Peripherals include Gigabit Ethernet, + USB2 host and OTG, SDIO, I2S, UART,s, SPI, I2C and PWMs. + +config SYS_MALLOC_F + default y + +config SYS_MALLOC_F_LEN + default 0x800 + +config ROCKCHIP_SERIAL + default y + +source "arch/arm/mach-rockchip/rk3288/Kconfig" + +endif
arch/arm/mach-rockchip/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +# +# Copyright (c) 2014 Google, Inc +# +# SPDX-License-Identifier: GPL-2.0+ +# + +ifdef CONFIG_SPL_BUILD +obj-y += board-spl.o +else +obj-y += board.o +endif +obj-y += common.o
arch/arm/mach-rockchip/board-spl.c new file +54 -0
54 lines not on this page · raw message
arch/arm/mach-rockchip/board.c new file +17 -0
@@ -0,0 +1,17 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> + +int board_init (void ) +{ +return 0 ; +} + +int dram_init (void ) +{ +return 0 ; +}
arch/arm/mach-rockchip/common.c new file +11 -0
@@ -0,0 +1,11 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> + +void reset_cpu (ulong addr) +{ +}
arch/arm/mach-rockchip/rk3288/Kconfig new file +6 -0
@@ -0,0 +1,6 @@ +if ROCKCHIP_RK3288 + +config SYS_SOC + default "rockchip" + +endif
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 15/18 rockchip: Add basic support for firefly-rk3288
In reply to Simon GlassThe Firefly RK3288 is a suitable target board for initial mainline Rockchip support. It includes a good set of peripherals, a recent SoC and it is readily available.
This adds only some basic files required to allow the baord to display a serial message in SPL and hang.
---
Changes in v2:
- Tidy up license headers and remove SPL #ifdefs
- Drop use of CONFIG_USE_PRIVATE_LIBGCC=y
arch/arm/dts/Makefile | 2 + arch/arm/dts/rk3288-firefly.dts | 44 +++ arch/arm/dts/rk3288-firefly.dtsi | 454 ++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3288/Kconfig | 10 + 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 + configs/firefly-rk3288_defconfig | 10 + include/configs/firefly-rk3288.h | 50 +++ 10 files changed, 605 insertions(+) create mode 100644 arch/arm/dts/rk3288-firefly.dts create mode 100644 arch/arm/dts/rk3288-firefly.dtsi 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 include/configs/firefly-rk3288.h
arch/arm/dts/Makefile +2 -0
@@ -14,6 +14,8 @@ dtb-$(CONFIG_EXYNOS5) += exynos5250-arndale.dtb \ exynos5420-peach-pit.dtb \ exynos5800-peach-pi.dtb \ exynos5422-odroidxu3.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += \ + rk3288-firefly.dtb dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \ tegra20-medcom-wide.dtb \ tegra20-paz00.dtb \
arch/arm/dts/rk3288-firefly.dts new file +44 -0
44 lines not on this page · raw message
arch/arm/dts/rk3288-firefly.dtsi new file +454 -0
454 lines not on this page · raw message
arch/arm/mach-rockchip/rk3288/Kconfig +10 -0
@@ -1,6 +1,16 @@ if ROCKCHIP_RK3288 +config TARGET_FIREFLY_RK3288 + bool "Firefly-RK3288" + help + Firefly is a RK3288-based development board with 2 USB ports, + HDMI, VGA, micro-SD card, audio, WiFi and Gigabit Ethernet, It + also includes on-board eMMC and 1GB of SDRAM. Expansion connectors + provide access to display pins, I2C, SPI, UART and GPIOs. + config SYS_SOC default "rockchip" +source "board/firefly/firefly-rk3288/Kconfig" + endif
board/firefly/firefly-rk3288/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_FIREFLY_RK3288 + +config SYS_BOARD + default "firefly-rk3288" + +config SYS_VENDOR + default "firefly" + +config SYS_CONFIG_NAME + default "firefly-rk3288" + +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + +endif
board/firefly/firefly-rk3288/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +FIREFLY +M: Simon Glass <[email protected]> +S: Maintained +F: board/firefly/firefly-rk3288 +F: include/configs/firefly-rk3288.h +F: configs/firefly-rk3288_defconfig
board/firefly/firefly-rk3288/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# (C) Copyright 2015 Google, Inc +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += firefly-rk3288.o
board/firefly/firefly-rk3288/firefly-rk3288.c new file +7 -0
@@ -0,0 +1,7 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h>
configs/firefly-rk3288_defconfig new file +10 -0
@@ -0,0 +1,10 @@ +CONFIG_ARM=y +CONFIG_ARCH_ROCKCHIP=y +CONFIG_ROCKCHIP_RK3288=y +CONFIG_TARGET_FIREFLY_RK3288=y +CONFIG_DEFAULT_DEVICE_TREE="rk3288-firefly" +CONFIG_DEBUG_UART=y +CONFIG_DEBUG_UART_NS16550=y +CONFIG_DEBUG_UART_BASE=0xff690000 +CONFIG_DEBUG_UART_CLOCK=24000000 +CONFIG_DEBUG_UART_SHIFT=2
include/configs/firefly-rk3288.h new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 16/18 rockchip: Add the beginnings of an image tool
In reply to Simon GlassRockchip SoCs require certain formats for code that they execute, The simplest format is a 4-byte header at the start of a binary file. Add support for this intiially.
---
Changes in v2: None
common/image.c | 1 + include/image.h | 3 ++- tools/Makefile | 1 + tools/rkimage.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 tools/rkimage.c
common/image.c +1 -0
@@ -151,6 +151,7 @@ static const table_entry_t uimage_type[] = { { IH_TYPE_ATMELIMAGE, "atmelimage", "ATMEL ROM-Boot Image",}, { IH_TYPE_X86_SETUP, "x86_setup", "x86 setup.bin", }, { IH_TYPE_LPC32XXIMAGE, "lpc32xximage", "LPC32XX Boot Image", }, + { IH_TYPE_ROCKCHIP, "rockchip", "Rockchip Boot Image" }, { -1, "", "", }, };
include/image.h +2 -1
@@ -244,8 +244,9 @@ struct lmb;#define IH_TYPE_SOCFPGAIMAGE 19/* Altera SOCFPGA Preloader */ #define IH_TYPE_X86_SETUP 20/* x86 setup.bin Image */ #define IH_TYPE_LPC32XXIMAGE 21/* x86 setup.bin Image */ +#define IH_TYPE_ROCKCHIP 22/* Rockchip Boot Image */ -#define IH_TYPE_COUNT 22/* Number of image types */ +#define IH_TYPE_COUNT 23/* Number of image types */ /* * Compression Types
tools/Makefile +1 -0
@@ -90,6 +90,7 @@ dumpimage-mkimage-objs := aisimage.o \ os_support.o \ pblimage.o \ pbl_crc32.o \ + rkimage.o \ socfpgaimage.o \ lib/sha1.o \ lib/sha256.o \
tools/rkimage.c new file +63 -0
63 lines not on this page · raw message
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 17/18 rockchip: Add a simple README
In reply to Simon GlassAdd a few notes on how to try out the Rockchip support so far.
---
Changes in v2: None
doc/README.rockchip | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 doc/README.rockchip
doc/README.rockchip new file +83 -0
@@ -0,0 +1,83 @@ +# +# Copyright (C) 2015 Google. Inc +# Written by Simon Glass <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +U-Boot on Rockchip +================== + +There are several repositories available with versions of U-Boot that support +many Rockchip devices [1] [2]. + +The current mainline support is experimental only and is not useful for +anything. It should provide a base on which to build. + + +Prerequisites +============= + +You will need: + + - Firefly RK3288 baord + - Power connection to 5V using the supplied micro-USB power cable + - Separate USB serial cable attached to your computer and the Firefly + (connect to the micro-USB connector below the logo) + - rkflashtool [3] + - openssl (sudo apt-get install openssl) + - Serial UART connection [4] + - Suitable ARM cross compiler, e.g.: + sudo apt-get install gcc-4.7-arm-linux-gnueabi + + +Building +======== + +At present, only Firefly RK3288 is supported. You can use the firefly-rk3288 +configuration for this. + + CROSS_COMPILE=arm-linux-gnueabi- make O=firefly firefly-rk3288_defconfig all + +(or you can use another cross compiler if you prefer) + + +Writing to the board +==================== + +Only USB is supported. For this to work you must get your board into ROM +boot mode, either by erasing your MMC or (perhaps) holding the recovery +button when you boot the board. To erase your MMC, you can boot into Linux +and type (as root) 'dd if=/dev/zero of=/dev/mmcblk0 bs=1M'. + +To create a suitable image and write it to the board: + + ./firefly/tools/mkimage -T rockchip -d firefly/spl/u-boot-spl-dtb.bin out + cat out | openssl rc4 -K 7c4e0304550509072d2c7b38170d1711 | rkflashtool l + +If all goes well you should something like: + + U-Boot SPL 2015.04-rc2-00123-gc5b539a-dirty (Feb 27 2015 - 09:35:31) + SPL: Unsupported Boot Device! + ### ERROR ### Please RESET the board ### + +You will need to reset the board before each time you try. Yes, that's all +it does so far. + + +Future work +=========== + +Immediate priorities are: + +- Support SPL clock init +- Support loading U-Boot from MMC +- Boot U-Boot to a prompt + +There are plenty of patches in the links below to help with this work. + + +[1] https://github.com/rkchrome/uboot.git +[2] https://github.com/linux-rockchip/u-boot-rockchip.git branch u-boot-rk3288 +[3] https://github.com/linux-rockchip/rkflashtool.git +[4] http://wiki.t-firefly.com/index.php/Firefly-RK3288/Serial_debug/en
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH v2 18/18 rockchip: Add basic support for jerry
In reply to Simon GlassThis builds and displays an SPL message, but does not function beyond that.
---
Changes in v2:
- Tidy up license headers and remove SPL #ifdefs
arch/arm/dts/Makefile | 3 +- arch/arm/dts/cros-ec-sbs.dtsi | 16 + arch/arm/dts/rk3288-jerry.dts | 203 ++++++++ arch/arm/dts/rk3288-veyron-chromebook.dtsi | 200 +++++++ arch/arm/dts/rk3288-veyron.dtsi | 808 +++++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3288/Kconfig | 10 + board/google/chromebook_jerry/Kconfig | 15 + board/google/chromebook_jerry/MAINTAINERS | 6 + board/google/chromebook_jerry/Makefile | 7 + board/google/chromebook_jerry/jerry.c | 7 + board/google/common/Makefile | 2 +- configs/chromebook_jerry_defconfig | 10 + include/configs/chromebook_jerry.h | 50 ++ 13 files changed, 1335 insertions(+), 2 deletions(-) create mode 100644 arch/arm/dts/cros-ec-sbs.dtsi create mode 100644 arch/arm/dts/rk3288-jerry.dts create mode 100644 arch/arm/dts/rk3288-veyron-chromebook.dtsi create mode 100644 arch/arm/dts/rk3288-veyron.dtsi create mode 100644 board/google/chromebook_jerry/Kconfig create mode 100644 board/google/chromebook_jerry/MAINTAINERS create mode 100644 board/google/chromebook_jerry/Makefile create mode 100644 board/google/chromebook_jerry/jerry.c create mode 100644 configs/chromebook_jerry_defconfig create mode 100644 include/configs/chromebook_jerry.h
arch/arm/dts/Makefile +2 -1
@@ -15,7 +15,8 @@ dtb-$(CONFIG_EXYNOS5) += exynos5250-arndale.dtb \ exynos5800-peach-pi.dtb \ exynos5422-odroidxu3.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += \ - rk3288-firefly.dtb + rk3288-firefly.dtb \ + rk3288-jerry.dtb dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \ tegra20-medcom-wide.dtb \ tegra20-paz00.dtb \
arch/arm/dts/cros-ec-sbs.dtsi new file +16 -0
@@ -0,0 +1,16 @@ +/* + * Smart battery dts fragment for devices that use cros-ec-sbs + * + * Copyright (c) 2015 Google, Inc + * + * SPDX-License-Identifier: GPL-2.0 +*/ + +&i2c_tunnel { + battery: sbs-battery at b { + compatible = "sbs,sbs-battery"; + reg = <0xb>; + sbs,i2c-retry-count = <2>; + sbs,poll-retry-count = <1>; + }; +};
arch/arm/dts/rk3288-jerry.dts new file +203 -0
203 lines not on this page · raw message
arch/arm/dts/rk3288-veyron-chromebook.dtsi new file +200 -0
200 lines not on this page · raw message
arch/arm/dts/rk3288-veyron.dtsi new file +808 -0
808 lines not on this page · raw message
arch/arm/mach-rockchip/rk3288/Kconfig +10 -0
@@ -8,9 +8,19 @@ config TARGET_FIREFLY_RK3288 also includes on-board eMMC and 1GB of SDRAM. Expansion connectors provide access to display pins, I2C, SPI, UART and GPIOs. +config TARGET_CHROMEBOOK_JERRY + bool "Google/Rockchip Veyron-Jerry Chromebook" + help + Jerry is a RK3288-based clamshell device with 2 USB 3.0 ports, + HDMI, an 11.9 inch EDP display, micro-SD card, touchpad and + WiFi. It includes a Chrome OS EC (Cortex-M3) to provide access to + the keyboard and battery functions. + config SYS_SOC default "rockchip" +source "board/google/chromebook_jerry/Kconfig" + source "board/firefly/firefly-rk3288/Kconfig" endif
board/google/chromebook_jerry/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_CHROMEBOOK_JERRY + +config SYS_BOARD + default "chromebook_jerry" + +config SYS_VENDOR + default "google" + +config SYS_CONFIG_NAME + default "chromebook_jerry" + +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + +endif
board/google/chromebook_jerry/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +CHROMEBOOK JERRY BOARD +M: Simon Glass <[email protected]> +S: Maintained +F: board/google/chromebook_jerry/ +F: include/configs/chromebook_jerry.h +F: configs/chromebook_jerry_defconfig
board/google/chromebook_jerry/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# (C) Copyright 2015 Google, Inc +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += jerry.o
board/google/chromebook_jerry/jerry.c new file +7 -0
@@ -0,0 +1,7 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h>
board/google/common/Makefile +1 -1
@@ -4,4 +4,4 @@ # SPDX-License-Identifier: GPL-2.0+ # -obj-y += early_init.o +obj-$(CONFIG_X86) += early_init.o
configs/chromebook_jerry_defconfig new file +10 -0
@@ -0,0 +1,10 @@ ++S:CONFIG_ARM=y ++S:CONFIG_ARCH_ROCKCHIP=y ++S:CONFIG_ROCKCHIP_RK3288=y ++S:CONFIG_TARGET_CHROMEBOOK_JERRY=y ++S:CONFIG_DEFAULT_DEVICE_TREE="rk3288-jerry" ++S:CONFIG_DEBUG_UART=y ++S:CONFIG_DEBUG_UART_NS16550=y ++S:CONFIG_DEBUG_UART_BASE=0xff690000 ++S:CONFIG_DEBUG_UART_CLOCK=24000000 ++S:CONFIG_DEBUG_UART_SHIFT=2
include/configs/chromebook_jerry.h new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
2.2.0.rc0.207.ga3a616c
v2 cover dm: Introduce device tree support in SPL (for Rockchip)
In reply to Simon GlassHi Tom,
Quoted 3 lines · Simon Glass
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.
I'd like to apply some of these - they are assigned to you in patchwork. I need to be a little careful with the device tree SPL change to make sure it does not affect any existing boards (and do a final test with the boards I have). Is this OK with you or would you prefer to apply some yourself?
For now I don't want to apply all the Rockchip patches, as I have a much more functional port now and want to avoid churn. I'll tidy those patches up and see how we get them applied later.
[snip]
Regards,
Simon
v2 cover dm: Introduce device tree support in SPL (for Rockchip)
Hi Tom,
Quoted 13 lines · Simon Glass
Hi Tom,
Quoted 3 lines · Simon Glass
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.
I'd like to apply some of these - they are assigned to you in patchwork. I need to be a little careful with the device tree SPL change to make sure it does not affect any existing boards (and do a final test with the boards I have). Is this OK with you or would you prefer to apply some yourself?
Quoted 5 lines
For now I don't want to apply all the Rockchip patches, as I have a much more functional port now and want to avoid churn. I'll tidy those patches up and see how we get them applied later.
[snip]
I'll go ahead and apply these and send a pull request. It tests out OK on the platforms I have.
Regards,
Simon
v2 cover dm: Introduce device tree support in SPL (for Rockchip)
Quoted 16 lines · Simon Glass
Hi Tom,
Quoted 13 lines · Simon Glass
Hi Tom,
Quoted 3 lines · Simon Glass
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.
I'd like to apply some of these - they are assigned to you in patchwork. I need to be a little careful with the device tree SPL change to make sure it does not affect any existing boards (and do a final test with the boards I have). Is this OK with you or would you prefer to apply some yourself?
Quoted 8 lines
Quoted 5 lines
For now I don't want to apply all the Rockchip patches, as I have a much more functional port now and want to avoid churn. I'll tidy those patches up and see how we get them applied later.
[snip]
I'll go ahead and apply these and send a pull request. It tests out OK on the platforms I have.
OK, thanks.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150611/2e433522/attachment.sig>