File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -739,6 +739,26 @@ endmenu
739739
740740menu "Boot options"
741741
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+
742762config ZERO_PAGE_OFFSET
743763 hex
744764 default "0x00010000" if PAGE_SIZE_64KB || SH_RTS7751R2D || \
Original file line number Diff line number Diff line change @@ -130,6 +130,8 @@ head-y := arch/sh/kernel/head_$(BITS).o
130130core-y += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/
131131core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/
132132
133+ core-$(CONFIG_USE_BUILTIN_DTB) += arch/sh/boot/dts/
134+
133135# Mach groups
134136machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se
135137machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx
Original file line number Diff line number Diff line change @@ -124,13 +124,22 @@ static void __init sh_of_time_init(void)
124124
125125static void __init sh_of_setup (char * * cmdline_p )
126126{
127+ struct device_node * root ;
128+
129+ #ifdef CONFIG_USE_BUILTIN_DTB
130+ unflatten_and_copy_device_tree ();
131+ #else
127132 unflatten_device_tree ();
133+ #endif
128134
129135 board_time_init = sh_of_time_init ;
130136
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+ }
134143
135144 sh_of_smp_probe ();
136145}
Original file line number Diff line number Diff line change 1+ obj-$(CONFIG_USE_BUILTIN_DTB) += $(patsubst "% ",% ,$(CONFIG_BUILTIN_DTB_SOURCE ) ) .dtb.o
2+
3+ clean-files := *.dtb.S
Original file line number Diff line number Diff line change @@ -251,7 +251,11 @@ void __ref sh_fdt_init(phys_addr_t dt_phys)
251251 /* Avoid calling an __init function on secondary cpus. */
252252 if (done ) return ;
253253
254+ #ifdef CONFIG_USE_BUILTIN_DTB
255+ dt_virt = __dtb_start ;
256+ #else
254257 dt_virt = phys_to_virt (dt_phys );
258+ #endif
255259
256260 if (!dt_virt || !early_init_dt_scan (dt_virt )) {
257261 pr_crit ("Error: invalid device tree blob"
You can’t perform that action at this time.
0 commit comments