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

CRISv32: add device tree support

Add support for booting CRISv32 with a built-in device tree.

Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>

authored by

Rabin Vincent and committed by
Jesper Nilsson
a9f75ac5 43f7071e

+46
+6
arch/cris/Kconfig
··· 54 54 select OLD_SIGACTION 55 55 select ARCH_REQUIRE_GPIOLIB 56 56 select IRQ_DOMAIN if ETRAX_ARCH_V32 57 + select OF if ETRAX_ARCH_V32 58 + select OF_EARLY_FLATTREE if ETRAX_ARCH_V32 57 59 58 60 config HZ 59 61 int ··· 64 62 config NR_CPUS 65 63 int 66 64 default "1" 65 + 66 + config BUILTIN_DTB 67 + string "DTB to build into the kernel image" 68 + depends on OF 67 69 68 70 source "init/Kconfig" 69 71
+4
arch/cris/Makefile
··· 40 40 MACH := 41 41 endif 42 42 43 + ifneq ($(CONFIG_BUILTIN_DTB),"") 44 + core-$(CONFIG_OF) += arch/cris/boot/dts/ 45 + endif 46 + 43 47 LD = $(CROSS_COMPILE)ld -mcrislinux 44 48 45 49 OBJCOPYFLAGS := -O binary -R .note -R .comment -S
+6
arch/cris/boot/dts/Makefile
··· 1 + BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB)).dtb.o 2 + ifneq ($(CONFIG_BUILTIN_DTB),"") 3 + obj-$(CONFIG_OF) += $(BUILTIN_DTB) 4 + endif 5 + 6 + clean-files := *.dtb.S
+1
arch/cris/kernel/Makefile
··· 7 7 extra-y := vmlinux.lds 8 8 9 9 obj-y := process.o traps.o irq.o ptrace.o setup.o time.o sys_cris.o 10 + obj-y += devicetree.o 10 11 11 12 obj-$(CONFIG_MODULES) += crisksyms.o 12 13 obj-$(CONFIG_MODULES) += module.o
+14
arch/cris/kernel/devicetree.c
··· 1 + #include <linux/init.h> 2 + #include <linux/bootmem.h> 3 + #include <linux/printk.h> 4 + 5 + void __init early_init_dt_add_memory_arch(u64 base, u64 size) 6 + { 7 + pr_err("%s(%llx, %llx)\n", 8 + __func__, base, size); 9 + } 10 + 11 + void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) 12 + { 13 + return alloc_bootmem_align(size, align); 14 + }
+15
arch/cris/kernel/setup.c
··· 19 19 #include <linux/utsname.h> 20 20 #include <linux/pfn.h> 21 21 #include <linux/cpu.h> 22 + #include <linux/of.h> 23 + #include <linux/of_fdt.h> 24 + #include <linux/of_platform.h> 22 25 #include <asm/setup.h> 23 26 #include <arch/system.h> 24 27 ··· 66 63 unsigned long bootmap_size; 67 64 unsigned long start_pfn, max_pfn; 68 65 unsigned long memory_start; 66 + 67 + #ifdef CONFIG_OF 68 + early_init_dt_scan(__dtb_start); 69 + #endif 69 70 70 71 /* register an initial console printing routine for printk's */ 71 72 ··· 148 141 149 142 reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT); 150 143 144 + unflatten_and_copy_device_tree(); 145 + 151 146 /* paging_init() sets up the MMU and marks all pages as reserved */ 152 147 153 148 paging_init(); ··· 213 204 214 205 subsys_initcall(topology_init); 215 206 207 + static int __init cris_of_init(void) 208 + { 209 + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 210 + return 0; 211 + } 212 + core_initcall(cris_of_init);