diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-10 13:49:16 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-12 22:19:51 +0100 |
commit | 3d0668a6032c9aaee3ab901d63e4b13e571a93ba (patch) | |
tree | b5f2e7e05c4294846dc4df266cb0d87037f94bec /arch | |
parent | e6ec5937e3bfc68e98d95939aea7012ada55199d (diff) | |
download | barebox-3d0668a6032c9aaee3ab901d63e4b13e571a93ba.tar.gz barebox-3d0668a6032c9aaee3ab901d63e4b13e571a93ba.tar.xz |
ARM: Initial dts support
- Add rules to generate dtb files in arch/arm/dts/
- add an initcall which unflattens and probes the internal devicetree
- Add skeleton devicetree
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/Kconfig | 8 | ||||
-rw-r--r-- | arch/arm/Makefile | 12 | ||||
-rw-r--r-- | arch/arm/cpu/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/cpu/dtb.c | 41 | ||||
-rw-r--r-- | arch/arm/dts/Makefile | 10 | ||||
-rw-r--r-- | arch/arm/dts/skeleton.dtsi | 13 | ||||
-rw-r--r-- | arch/arm/lib/barebox.lds.S | 2 |
7 files changed, 87 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 7ac134e159..97af260feb 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -17,6 +17,14 @@ config HAVE_MACH_ARM_HEAD menu "System Type" +config BUILTIN_DTB + bool "link a DTB into the barebox image" + depends on OFTREE + +config BUILTIN_DTB_NAME + string "DTB to build into the barebox image" + depends on BUILTIN_DTB + choice prompt "ARM system type" diff --git a/arch/arm/Makefile b/arch/arm/Makefile index b98d6b86a7..6c24b1a0ae 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -254,6 +254,16 @@ zbarebox.S zbarebox.bin zbarebox: barebox.bin archclean: $(MAKE) $(clean)=$(pbl) +dts := arch/arm/dts + +%.dtb: scripts + $(Q)$(MAKE) $(build)=$(dts) $(dts)/$@ + +dtbs: scripts + $(Q)$(MAKE) $(build)=$(dts) dtbs + +KBUILD_DTBS := dtbs + KBUILD_IMAGE ?= $(KBUILD_BINARY) archprepare: maketools @@ -277,6 +287,8 @@ endif common-y += $(BOARD) $(MACH) common-y += arch/arm/lib/ arch/arm/cpu/ +common-$(CONFIG_BUILTIN_DTB) += arch/arm/dts/ + lds-y := arch/arm/lib/barebox.lds CLEAN_FILES += include/generated/mach-types.h arch/arm/lib/barebox.lds barebox-flash-image diff --git a/arch/arm/cpu/Makefile b/arch/arm/cpu/Makefile index 44410eec95..525a1806fe 100644 --- a/arch/arm/cpu/Makefile +++ b/arch/arm/cpu/Makefile @@ -8,6 +8,7 @@ obj-y += start.o setupc.o # obj-$(CONFIG_CMD_ARM_CPUINFO) += cpuinfo.o obj-$(CONFIG_CMD_ARM_MMUINFO) += mmuinfo.o +obj-$(CONFIG_BUILTIN_DTB) += dtb.o obj-$(CONFIG_MMU) += mmu.o cache.o mmu-early.o pbl-$(CONFIG_MMU) += cache.o mmu-early.o obj-$(CONFIG_CPU_32v4T) += cache-armv4.o diff --git a/arch/arm/cpu/dtb.c b/arch/arm/cpu/dtb.c new file mode 100644 index 0000000000..10b73bd519 --- /dev/null +++ b/arch/arm/cpu/dtb.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2013 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#include <common.h> +#include <init.h> +#include <of.h> + +extern char __dtb_start[]; + +static int of_arm_init(void) +{ + struct device_node *root; + + root = of_get_root_node(); + if (root) + return 0; + + root = of_unflatten_dtb(NULL, __dtb_start); + if (root) { + pr_debug("using internal DTB\n"); + of_set_root_node(root); + if (IS_ENABLED(CONFIG_OFDEVICE)) + of_probe(); + } + + return 0; +} +core_initcall(of_arm_init); diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile new file mode 100644 index 0000000000..3ee89247e0 --- /dev/null +++ b/arch/arm/dts/Makefile @@ -0,0 +1,10 @@ + +BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_NAME)).dtb.o +obj-$(CONFIG_BUILTIN_DTB) += $(BUILTIN_DTB) + +targets += dtbs +targets += $(dtb-y) + +dtbs: $(addprefix $(obj)/, $(dtb-y)) + +clean-files := *.dtb *.dtb.S diff --git a/arch/arm/dts/skeleton.dtsi b/arch/arm/dts/skeleton.dtsi new file mode 100644 index 0000000000..b41d241de2 --- /dev/null +++ b/arch/arm/dts/skeleton.dtsi @@ -0,0 +1,13 @@ +/* + * Skeleton device tree; the bare minimum needed to boot; just include and + * add a compatible value. The bootloader will typically populate the memory + * node. + */ + +/ { + #address-cells = <1>; + #size-cells = <1>; + chosen { }; + aliases { }; + memory { device_type = "memory"; reg = <0 0>; }; +}; diff --git a/arch/arm/lib/barebox.lds.S b/arch/arm/lib/barebox.lds.S index e5aee8cd82..269f307f73 100644 --- a/arch/arm/lib/barebox.lds.S +++ b/arch/arm/lib/barebox.lds.S @@ -88,6 +88,8 @@ SECTIONS __usymtab : { BAREBOX_SYMS } __usymtab_end = .; + .dtb : { BAREBOX_DTB() } + _edata = .; . = ALIGN(4); __bss_start = .; |