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>
This commit is contained in:
parent
43f7071e10
commit
a9f75ac5a2
@ -54,6 +54,8 @@ config CRIS
|
|||||||
select OLD_SIGACTION
|
select OLD_SIGACTION
|
||||||
select ARCH_REQUIRE_GPIOLIB
|
select ARCH_REQUIRE_GPIOLIB
|
||||||
select IRQ_DOMAIN if ETRAX_ARCH_V32
|
select IRQ_DOMAIN if ETRAX_ARCH_V32
|
||||||
|
select OF if ETRAX_ARCH_V32
|
||||||
|
select OF_EARLY_FLATTREE if ETRAX_ARCH_V32
|
||||||
|
|
||||||
config HZ
|
config HZ
|
||||||
int
|
int
|
||||||
@ -63,6 +65,10 @@ config NR_CPUS
|
|||||||
int
|
int
|
||||||
default "1"
|
default "1"
|
||||||
|
|
||||||
|
config BUILTIN_DTB
|
||||||
|
string "DTB to build into the kernel image"
|
||||||
|
depends on OF
|
||||||
|
|
||||||
source "init/Kconfig"
|
source "init/Kconfig"
|
||||||
|
|
||||||
source "kernel/Kconfig.freezer"
|
source "kernel/Kconfig.freezer"
|
||||||
|
@ -40,6 +40,10 @@ else
|
|||||||
MACH :=
|
MACH :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_BUILTIN_DTB),"")
|
||||||
|
core-$(CONFIG_OF) += arch/cris/boot/dts/
|
||||||
|
endif
|
||||||
|
|
||||||
LD = $(CROSS_COMPILE)ld -mcrislinux
|
LD = $(CROSS_COMPILE)ld -mcrislinux
|
||||||
|
|
||||||
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
|
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
|
||||||
|
6
arch/cris/boot/dts/Makefile
Normal file
6
arch/cris/boot/dts/Makefile
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB)).dtb.o
|
||||||
|
ifneq ($(CONFIG_BUILTIN_DTB),"")
|
||||||
|
obj-$(CONFIG_OF) += $(BUILTIN_DTB)
|
||||||
|
endif
|
||||||
|
|
||||||
|
clean-files := *.dtb.S
|
@ -7,6 +7,7 @@ CPPFLAGS_vmlinux.lds := -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
|
|||||||
extra-y := vmlinux.lds
|
extra-y := vmlinux.lds
|
||||||
|
|
||||||
obj-y := process.o traps.o irq.o ptrace.o setup.o time.o sys_cris.o
|
obj-y := process.o traps.o irq.o ptrace.o setup.o time.o sys_cris.o
|
||||||
|
obj-y += devicetree.o
|
||||||
|
|
||||||
obj-$(CONFIG_MODULES) += crisksyms.o
|
obj-$(CONFIG_MODULES) += crisksyms.o
|
||||||
obj-$(CONFIG_MODULES) += module.o
|
obj-$(CONFIG_MODULES) += module.o
|
||||||
|
14
arch/cris/kernel/devicetree.c
Normal file
14
arch/cris/kernel/devicetree.c
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include <linux/init.h>
|
||||||
|
#include <linux/bootmem.h>
|
||||||
|
#include <linux/printk.h>
|
||||||
|
|
||||||
|
void __init early_init_dt_add_memory_arch(u64 base, u64 size)
|
||||||
|
{
|
||||||
|
pr_err("%s(%llx, %llx)\n",
|
||||||
|
__func__, base, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
|
||||||
|
{
|
||||||
|
return alloc_bootmem_align(size, align);
|
||||||
|
}
|
@ -19,6 +19,9 @@
|
|||||||
#include <linux/utsname.h>
|
#include <linux/utsname.h>
|
||||||
#include <linux/pfn.h>
|
#include <linux/pfn.h>
|
||||||
#include <linux/cpu.h>
|
#include <linux/cpu.h>
|
||||||
|
#include <linux/of.h>
|
||||||
|
#include <linux/of_fdt.h>
|
||||||
|
#include <linux/of_platform.h>
|
||||||
#include <asm/setup.h>
|
#include <asm/setup.h>
|
||||||
#include <arch/system.h>
|
#include <arch/system.h>
|
||||||
|
|
||||||
@ -64,6 +67,10 @@ void __init setup_arch(char **cmdline_p)
|
|||||||
unsigned long start_pfn, max_pfn;
|
unsigned long start_pfn, max_pfn;
|
||||||
unsigned long memory_start;
|
unsigned long memory_start;
|
||||||
|
|
||||||
|
#ifdef CONFIG_OF
|
||||||
|
early_init_dt_scan(__dtb_start);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* register an initial console printing routine for printk's */
|
/* register an initial console printing routine for printk's */
|
||||||
|
|
||||||
init_etrax_debug();
|
init_etrax_debug();
|
||||||
@ -141,6 +148,8 @@ void __init setup_arch(char **cmdline_p)
|
|||||||
|
|
||||||
reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT);
|
reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT);
|
||||||
|
|
||||||
|
unflatten_and_copy_device_tree();
|
||||||
|
|
||||||
/* paging_init() sets up the MMU and marks all pages as reserved */
|
/* paging_init() sets up the MMU and marks all pages as reserved */
|
||||||
|
|
||||||
paging_init();
|
paging_init();
|
||||||
@ -204,3 +213,9 @@ static int __init topology_init(void)
|
|||||||
|
|
||||||
subsys_initcall(topology_init);
|
subsys_initcall(topology_init);
|
||||||
|
|
||||||
|
static int __init cris_of_init(void)
|
||||||
|
{
|
||||||
|
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
core_initcall(cris_of_init);
|
||||||
|
Loading…
Reference in New Issue
Block a user