diff options
author | Rich Felker <dalias@libc.org> | 2016-03-25 21:24:30 -0400 |
---|---|---|
committer | Rich Felker <dalias@libc.org> | 2016-07-30 23:33:32 -0400 |
commit | 190fe191cfbead9fe089453dd092869c9469c6d4 (patch) | |
tree | 10dfa2b780644c5fe43b3cf53901ac4a04963384 | |
parent | ff18143ceed3424b7d6cdb8659b9692fa734f0d8 (diff) |
sh: add support for linking a builtin device tree blob in the kernel
Signed-off-by: Rich Felker <dalias@libc.org>
-rw-r--r-- | arch/sh/Kconfig | 20 | ||||
-rw-r--r-- | arch/sh/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/boards/of-generic.c | 15 | ||||
-rw-r--r-- | arch/sh/boot/dts/Makefile | 3 | ||||
-rw-r--r-- | arch/sh/kernel/setup.c | 4 |
5 files changed, 41 insertions, 3 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 0d5f3a9bb315..ceeda5c1a70a 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -739,6 +739,26 @@ endmenu | |||
739 | 739 | ||
740 | menu "Boot options" | 740 | menu "Boot options" |
741 | 741 | ||
742 | config USE_BUILTIN_DTB | ||
743 | bool "Use builtin DTB" | ||
744 | default n | ||
745 | depends on SH_DEVICE_TREE | ||
746 | help | ||
747 | Link a device tree blob for particular hardware into the kernel, | ||
748 | suppressing use of the DTB pointer provided by the bootloader. | ||
749 | This option should only be used with legacy bootloaders that are | ||
750 | not capable of providing a DTB to the kernel, or for experimental | ||
751 | hardware without stable device tree bindings. | ||
752 | |||
753 | config BUILTIN_DTB_SOURCE | ||
754 | string "Source file for builtin DTB" | ||
755 | default "" | ||
756 | depends on USE_BUILTIN_DTB | ||
757 | help | ||
758 | Base name (without suffix, relative to arch/sh/boot/dts) for the | ||
759 | a DTS file that will be used to produce the DTB linked into the | ||
760 | kernel. | ||
761 | |||
742 | config ZERO_PAGE_OFFSET | 762 | config ZERO_PAGE_OFFSET |
743 | hex | 763 | hex |
744 | default "0x00010000" if PAGE_SIZE_64KB || SH_RTS7751R2D || \ | 764 | default "0x00010000" if PAGE_SIZE_64KB || SH_RTS7751R2D || \ |
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index bf5b3f5f4962..3b2c8b4827d0 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile | |||
@@ -130,6 +130,8 @@ head-y := arch/sh/kernel/head_$(BITS).o | |||
130 | core-y += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/ | 130 | core-y += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/ |
131 | core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/ | 131 | core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/ |
132 | 132 | ||
133 | core-$(CONFIG_USE_BUILTIN_DTB) += arch/sh/boot/dts/ | ||
134 | |||
133 | # Mach groups | 135 | # Mach groups |
134 | machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se | 136 | machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se |
135 | machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx | 137 | machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx |
diff --git a/arch/sh/boards/of-generic.c b/arch/sh/boards/of-generic.c index 911ffb9f115b..1fb6d5714bae 100644 --- a/arch/sh/boards/of-generic.c +++ b/arch/sh/boards/of-generic.c | |||
@@ -124,13 +124,22 @@ static void __init sh_of_time_init(void) | |||
124 | 124 | ||
125 | static void __init sh_of_setup(char **cmdline_p) | 125 | static void __init sh_of_setup(char **cmdline_p) |
126 | { | 126 | { |
127 | struct device_node *root; | ||
128 | |||
129 | #ifdef CONFIG_USE_BUILTIN_DTB | ||
130 | unflatten_and_copy_device_tree(); | ||
131 | #else | ||
127 | unflatten_device_tree(); | 132 | unflatten_device_tree(); |
133 | #endif | ||
128 | 134 | ||
129 | board_time_init = sh_of_time_init; | 135 | board_time_init = sh_of_time_init; |
130 | 136 | ||
131 | sh_mv.mv_name = of_flat_dt_get_machine_name(); | 137 | sh_mv.mv_name = "Unknown SH model"; |
132 | if (!sh_mv.mv_name) | 138 | root = of_find_node_by_path("/"); |
133 | sh_mv.mv_name = "Unknown SH model"; | 139 | if (root) { |
140 | of_property_read_string(root, "model", &sh_mv.mv_name); | ||
141 | of_node_put(root); | ||
142 | } | ||
134 | 143 | ||
135 | sh_of_smp_probe(); | 144 | sh_of_smp_probe(); |
136 | } | 145 | } |
diff --git a/arch/sh/boot/dts/Makefile b/arch/sh/boot/dts/Makefile new file mode 100644 index 000000000000..e5ce3a0de7f4 --- /dev/null +++ b/arch/sh/boot/dts/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | obj-$(CONFIG_USE_BUILTIN_DTB) += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o | ||
2 | |||
3 | clean-files := *.dtb.S | ||
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index 5d34605b58b5..5b9eb70311e3 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c | |||
@@ -251,7 +251,11 @@ void __ref sh_fdt_init(phys_addr_t dt_phys) | |||
251 | /* Avoid calling an __init function on secondary cpus. */ | 251 | /* Avoid calling an __init function on secondary cpus. */ |
252 | if (done) return; | 252 | if (done) return; |
253 | 253 | ||
254 | #ifdef CONFIG_USE_BUILTIN_DTB | ||
255 | dt_virt = __dtb_start; | ||
256 | #else | ||
254 | dt_virt = phys_to_virt(dt_phys); | 257 | dt_virt = phys_to_virt(dt_phys); |
258 | #endif | ||
255 | 259 | ||
256 | if (!dt_virt || !early_init_dt_scan(dt_virt)) { | 260 | if (!dt_virt || !early_init_dt_scan(dt_virt)) { |
257 | pr_crit("Error: invalid device tree blob" | 261 | pr_crit("Error: invalid device tree blob" |