Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: add support for linking a builtin device tree blob in the kernel

Signed-off-by: Rich Felker <dalias@libc.org>

+41 -3
+20
arch/sh/Kconfig
··· 739 739 740 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 762 config ZERO_PAGE_OFFSET 743 763 hex 744 764 default "0x00010000" if PAGE_SIZE_64KB || SH_RTS7751R2D || \
+2
arch/sh/Makefile
··· 130 130 core-y += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/ 131 131 core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/ 132 132 133 + core-$(CONFIG_USE_BUILTIN_DTB) += arch/sh/boot/dts/ 134 + 133 135 # Mach groups 134 136 machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se 135 137 machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx
+12 -3
arch/sh/boards/of-generic.c
··· 124 124 125 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 132 unflatten_device_tree(); 133 + #endif 128 134 129 135 board_time_init = sh_of_time_init; 130 136 131 - sh_mv.mv_name = of_flat_dt_get_machine_name(); 132 - if (!sh_mv.mv_name) 133 - sh_mv.mv_name = "Unknown SH model"; 137 + sh_mv.mv_name = "Unknown SH model"; 138 + root = of_find_node_by_path("/"); 139 + if (root) { 140 + of_property_read_string(root, "model", &sh_mv.mv_name); 141 + of_node_put(root); 142 + } 134 143 135 144 sh_of_smp_probe(); 136 145 }
+3
arch/sh/boot/dts/Makefile
··· 1 + obj-$(CONFIG_USE_BUILTIN_DTB) += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o 2 + 3 + clean-files := *.dtb.S
+4
arch/sh/kernel/setup.c
··· 251 251 /* Avoid calling an __init function on secondary cpus. */ 252 252 if (done) return; 253 253 254 + #ifdef CONFIG_USE_BUILTIN_DTB 255 + dt_virt = __dtb_start; 256 + #else 254 257 dt_virt = phys_to_virt(dt_phys); 258 + #endif 255 259 256 260 if (!dt_virt || !early_init_dt_scan(dt_virt)) { 257 261 pr_crit("Error: invalid device tree blob"