* [PATCH 1/4] CRIS: add device tree support
@ 2015-02-08 15:35 Rabin Vincent
2015-02-08 15:35 ` [PATCH 2/4] CRISv32: add irq domains support Rabin Vincent
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Rabin Vincent @ 2015-02-08 15:35 UTC (permalink / raw)
To: jesper.nilsson; +Cc: linux-cris-kernel, devicetree, linux-kernel, Rabin Vincent
Add support for booting CRIS with a built-in device tree.
Signed-off-by: Rabin Vincent <rabin@rab.in>
---
arch/cris/Kconfig | 6 ++++++
arch/cris/Makefile | 4 ++++
arch/cris/boot/dts/Makefile | 6 ++++++
arch/cris/kernel/Makefile | 1 +
arch/cris/kernel/devicetree.c | 14 ++++++++++++++
arch/cris/kernel/setup.c | 13 +++++++++++++
6 files changed, 44 insertions(+)
create mode 100644 arch/cris/boot/dts/Makefile
create mode 100644 arch/cris/kernel/devicetree.c
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 8474c66..cbbc2dc 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -53,11 +53,17 @@ config CRIS
select OLD_SIGSUSPEND
select OLD_SIGACTION
select ARCH_REQUIRE_GPIOLIB
+ select OF
+ select OF_EARLY_FLATTREE
config HZ
int
default 100
+config BUILTIN_DTB
+ string "DTB to build into the kernel image"
+ depends on OF
+
source "init/Kconfig"
source "kernel/Kconfig.freezer"
diff --git a/arch/cris/Makefile b/arch/cris/Makefile
index 39dc7d0..4a5404b 100644
--- a/arch/cris/Makefile
+++ b/arch/cris/Makefile
@@ -40,6 +40,10 @@ else
MACH :=
endif
+ifneq ($(CONFIG_BUILTIN_DTB),"")
+core-$(CONFIG_OF) += arch/cris/boot/dts/
+endif
+
LD = $(CROSS_COMPILE)ld -mcrislinux
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
diff --git a/arch/cris/boot/dts/Makefile b/arch/cris/boot/dts/Makefile
new file mode 100644
index 0000000..faf69fb
--- /dev/null
+++ b/arch/cris/boot/dts/Makefile
@@ -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
diff --git a/arch/cris/kernel/Makefile b/arch/cris/kernel/Makefile
index b45640b..edef71f 100644
--- a/arch/cris/kernel/Makefile
+++ b/arch/cris/kernel/Makefile
@@ -7,6 +7,7 @@ CPPFLAGS_vmlinux.lds := -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
extra-y := vmlinux.lds
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) += module.o
diff --git a/arch/cris/kernel/devicetree.c b/arch/cris/kernel/devicetree.c
new file mode 100644
index 0000000..53ff8d7
--- /dev/null
+++ b/arch/cris/kernel/devicetree.c
@@ -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);
+}
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index 905b70e..f11538e 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -19,6 +19,9 @@
#include <linux/utsname.h>
#include <linux/pfn.h>
#include <linux/cpu.h>
+#include <linux/of.h>
+#include <linux/of_fdt.h>
+#include <linux/of_platform.h>
#include <asm/setup.h>
#include <arch/system.h>
@@ -64,6 +67,8 @@ void __init setup_arch(char **cmdline_p)
unsigned long start_pfn, max_pfn;
unsigned long memory_start;
+ early_init_dt_scan(__dtb_start);
+
/* register an initial console printing routine for printk's */
init_etrax_debug();
@@ -141,6 +146,8 @@ void __init setup_arch(char **cmdline_p)
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();
@@ -204,3 +211,9 @@ static int __init topology_init(void)
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);
--
2.1.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/4] CRISv32: add irq domains support
2015-02-08 15:35 [PATCH 1/4] CRIS: add device tree support Rabin Vincent
@ 2015-02-08 15:35 ` Rabin Vincent
2015-02-09 9:40 ` Jesper Nilsson
2015-02-08 15:35 ` [PATCH 3/4] CRIS: document CRISv32 intc bindings Rabin Vincent
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Rabin Vincent @ 2015-02-08 15:35 UTC (permalink / raw)
To: jesper.nilsson; +Cc: linux-cris-kernel, devicetree, linux-kernel, Rabin Vincent
Add support for IRQ domains to the CRISv32 interrupt controller.
Signed-off-by: Rabin Vincent <rabin@rab.in>
---
arch/cris/Kconfig | 1 +
arch/cris/arch-v32/kernel/irq.c | 28 +++++++++++++++++++++++++---
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index cbbc2dc..66f71df 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -55,6 +55,7 @@ config CRIS
select ARCH_REQUIRE_GPIOLIB
select OF
select OF_EARLY_FLATTREE
+ select IRQ_DOMAIN if ETRAX_ARCH_V32
config HZ
int
diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c
index 25437ae..bc871d2 100644
--- a/arch/cris/arch-v32/kernel/irq.c
+++ b/arch/cris/arch-v32/kernel/irq.c
@@ -10,6 +10,8 @@
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/profile.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/threads.h>
@@ -431,6 +433,19 @@ crisv32_do_multiple(struct pt_regs* regs)
irq_exit();
}
+static int crisv32_irq_map(struct irq_domain *h, unsigned int virq,
+ irq_hw_number_t hw_irq_num)
+{
+ irq_set_chip_and_handler(virq, &crisv32_irq_type, handle_simple_irq);
+
+ return 0;
+}
+
+static struct irq_domain_ops crisv32_irq_ops = {
+ .map = crisv32_irq_map,
+ .xlate = irq_domain_xlate_onecell,
+};
+
/*
* This is called by start_kernel. It fixes the IRQ masks and setup the
* interrupt vector table to point to bad_interrupt pointers.
@@ -441,6 +456,8 @@ init_IRQ(void)
int i;
int j;
reg_intr_vect_rw_mask vect_mask = {0};
+ struct device_node *np;
+ struct irq_domain *domain;
/* Clear all interrupts masks. */
for (i = 0; i < NBR_REGS; i++)
@@ -449,10 +466,15 @@ init_IRQ(void)
for (i = 0; i < 256; i++)
etrax_irv->v[i] = weird_irq;
- /* Point all IRQ's to bad handlers. */
+ np = of_find_compatible_node(NULL, NULL, "axis,crisv32-intc");
+ domain = irq_domain_add_legacy(np, NR_IRQS - FIRST_IRQ,
+ FIRST_IRQ, FIRST_IRQ,
+ &crisv32_irq_ops, NULL);
+ BUG_ON(!domain);
+ irq_set_default_host(domain);
+ of_node_put(np);
+
for (i = FIRST_IRQ, j = 0; j < NR_IRQS; i++, j++) {
- irq_set_chip_and_handler(j, &crisv32_irq_type,
- handle_simple_irq);
set_exception_vector(i, interrupt[j]);
}
--
2.1.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/4] CRIS: document CRISv32 intc bindings
2015-02-08 15:35 [PATCH 1/4] CRIS: add device tree support Rabin Vincent
2015-02-08 15:35 ` [PATCH 2/4] CRISv32: add irq domains support Rabin Vincent
@ 2015-02-08 15:35 ` Rabin Vincent
[not found] ` <1423409745-2230-3-git-send-email-rabin-66gdRtMMWGc@public.gmane.org>
2015-02-08 15:35 ` [PATCH 4/4] CRIS: add Axis 88 board device tree Rabin Vincent
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Rabin Vincent @ 2015-02-08 15:35 UTC (permalink / raw)
To: jesper.nilsson; +Cc: linux-cris-kernel, devicetree, linux-kernel, Rabin Vincent
Add the DT bindings documentation for the CRISV32 interrupt controller.
Signed-off-by: Rabin Vincent <rabin@rab.in>
---
.../interrupt-controller/axis,crisv32-intc.txt | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
create mode 100644 Documentation/devicetree/bindings/interrupt-controller/axis,crisv32-intc.txt
diff --git a/Documentation/devicetree/bindings/interrupt-controller/axis,crisv32-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/axis,crisv32-intc.txt
new file mode 100644
index 0000000..3726f14
--- /dev/null
+++ b/Documentation/devicetree/bindings/interrupt-controller/axis,crisv32-intc.txt
@@ -0,0 +1,18 @@
+Axis CRISv32 interrupt controller
+
+Required properties:
+- compatible: Compatible property value should be "axis,cris32-intc"
+
+- reg: Physical base address of the controller and length of memory mapped
+ region.
+
+- interrupt-controller : Identifies the node as an interrupt controller
+
+Example:
+
+interrupt-controller {
+ compatible = "axis,crisv32-intc";
+ interrupt-controller;
+ reg = <0xb001c000 0x1000>;
+ #interrupt-cells = <1>;
+};
--
2.1.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/4] CRIS: add Axis 88 board device tree
2015-02-08 15:35 [PATCH 1/4] CRIS: add device tree support Rabin Vincent
2015-02-08 15:35 ` [PATCH 2/4] CRISv32: add irq domains support Rabin Vincent
2015-02-08 15:35 ` [PATCH 3/4] CRIS: document CRISv32 intc bindings Rabin Vincent
@ 2015-02-08 15:35 ` Rabin Vincent
2015-02-09 9:46 ` Jesper Nilsson
2015-02-09 9:39 ` [PATCH 1/4] CRIS: add device tree support Jesper Nilsson
2015-02-22 19:42 ` [PATCHv2 1/2] CRISv32: add irq domains support Rabin Vincent
4 siblings, 1 reply; 11+ messages in thread
From: Rabin Vincent @ 2015-02-08 15:35 UTC (permalink / raw)
To: jesper.nilsson; +Cc: linux-cris-kernel, devicetree, linux-kernel, Rabin Vincent
Add a minimal device tree for the ETRAX FS SoC and the Axis 88 developer
board.
Signed-off-by: Rabin Vincent <rabin@rab.in>
---
arch/cris/boot/dts/dev88.dts | 18 ++++++++++++++++++
arch/cris/boot/dts/etraxfs.dtsi | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+)
create mode 100644 arch/cris/boot/dts/dev88.dts
create mode 100644 arch/cris/boot/dts/etraxfs.dtsi
diff --git a/arch/cris/boot/dts/dev88.dts b/arch/cris/boot/dts/dev88.dts
new file mode 100644
index 0000000..4fa5a3f
--- /dev/null
+++ b/arch/cris/boot/dts/dev88.dts
@@ -0,0 +1,18 @@
+/dts-v1/;
+
+/include/ "etraxfs.dtsi"
+
+/ {
+ model = "Axis 88 Developer Board";
+ compatible = "axis,dev88";
+
+ aliases {
+ serial0 = &uart0;
+ };
+
+ soc {
+ uart0: serial@b00260000 {
+ status = "okay";
+ };
+ };
+};
diff --git a/arch/cris/boot/dts/etraxfs.dtsi b/arch/cris/boot/dts/etraxfs.dtsi
new file mode 100644
index 0000000..909bced
--- /dev/null
+++ b/arch/cris/boot/dts/etraxfs.dtsi
@@ -0,0 +1,38 @@
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ interrupt-parent = <&intc>;
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ cpu@0 {
+ device_type = "cpu";
+ model = "axis,crisv32";
+ reg = <0>;
+ };
+ };
+
+ soc {
+ compatible = "simple-bus";
+ model = "etraxfs";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges;
+
+ intc: interrupt-controller {
+ compatible = "axis,crisv32-intc";
+ reg = <0xb001c000 0x1000>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+
+ serial@b00260000 {
+ compatible = "axis,etraxfs-uart";
+ reg = <0xb0026000 0x1000>;
+ interrupts = <68>;
+ status = "disabled";
+ };
+ };
+};
--
2.1.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/4] CRIS: add device tree support
2015-02-08 15:35 [PATCH 1/4] CRIS: add device tree support Rabin Vincent
` (2 preceding siblings ...)
2015-02-08 15:35 ` [PATCH 4/4] CRIS: add Axis 88 board device tree Rabin Vincent
@ 2015-02-09 9:39 ` Jesper Nilsson
2015-02-22 19:42 ` [PATCHv2 1/2] CRISv32: add irq domains support Rabin Vincent
4 siblings, 0 replies; 11+ messages in thread
From: Jesper Nilsson @ 2015-02-09 9:39 UTC (permalink / raw)
To: Rabin Vincent
Cc: Jesper Nilsson, linux-cris-kernel, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
On Sun, Feb 08, 2015 at 04:35:42PM +0100, Rabin Vincent wrote:
> Add support for booting CRIS with a built-in device tree.
>
> Signed-off-by: Rabin Vincent <rabin@rab.in>
Looks good, putting it in the CRIS tree for 3.20.
/^JN - Jesper Nilsson
--
Jesper Nilsson -- jesper.nilsson@axis.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/4] CRISv32: add irq domains support
2015-02-08 15:35 ` [PATCH 2/4] CRISv32: add irq domains support Rabin Vincent
@ 2015-02-09 9:40 ` Jesper Nilsson
0 siblings, 0 replies; 11+ messages in thread
From: Jesper Nilsson @ 2015-02-09 9:40 UTC (permalink / raw)
To: Rabin Vincent
Cc: Jesper Nilsson, linux-cris-kernel, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
On Sun, Feb 08, 2015 at 04:35:43PM +0100, Rabin Vincent wrote:
> Add support for IRQ domains to the CRISv32 interrupt controller.
>
> Signed-off-by: Rabin Vincent <rabin@rab.in>
Looks good, putting it in the CRIS tree for 3.20.
/^JN - Jesper Nilsson
--
Jesper Nilsson -- jesper.nilsson@axis.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] CRIS: document CRISv32 intc bindings
2015-02-08 15:35 ` [PATCH 3/4] CRIS: document CRISv32 intc bindings Rabin Vincent
@ 2015-02-09 9:45 ` Jesper Nilsson
0 siblings, 0 replies; 11+ messages in thread
From: Jesper Nilsson @ 2015-02-09 9:45 UTC (permalink / raw)
To: Rabin Vincent
Cc: Jesper Nilsson, linux-cris-kernel,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Sun, Feb 08, 2015 at 04:35:44PM +0100, Rabin Vincent wrote:
> Add the DT bindings documentation for the CRISV32 interrupt controller.
>
> Signed-off-by: Rabin Vincent <rabin-66gdRtMMWGc@public.gmane.org>
Looks good, putting it in the CRIS tree for 3.20.
/^JN - Jesper Nilsson
--
Jesper Nilsson -- jesper.nilsson-VrBV9hrLPhE@public.gmane.org
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] CRIS: document CRISv32 intc bindings
@ 2015-02-09 9:45 ` Jesper Nilsson
0 siblings, 0 replies; 11+ messages in thread
From: Jesper Nilsson @ 2015-02-09 9:45 UTC (permalink / raw)
To: Rabin Vincent
Cc: Jesper Nilsson, linux-cris-kernel, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
On Sun, Feb 08, 2015 at 04:35:44PM +0100, Rabin Vincent wrote:
> Add the DT bindings documentation for the CRISV32 interrupt controller.
>
> Signed-off-by: Rabin Vincent <rabin@rab.in>
Looks good, putting it in the CRIS tree for 3.20.
/^JN - Jesper Nilsson
--
Jesper Nilsson -- jesper.nilsson@axis.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/4] CRIS: add Axis 88 board device tree
2015-02-08 15:35 ` [PATCH 4/4] CRIS: add Axis 88 board device tree Rabin Vincent
@ 2015-02-09 9:46 ` Jesper Nilsson
0 siblings, 0 replies; 11+ messages in thread
From: Jesper Nilsson @ 2015-02-09 9:46 UTC (permalink / raw)
To: Rabin Vincent
Cc: Jesper Nilsson, linux-cris-kernel, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
On Sun, Feb 08, 2015 at 04:35:45PM +0100, Rabin Vincent wrote:
> Add a minimal device tree for the ETRAX FS SoC and the Axis 88 developer
> board.
>
> Signed-off-by: Rabin Vincent <rabin@rab.in>
Looks good, putting it in the CRIS tree for 3.20.
/^JN - Jesper Nilsson
--
Jesper Nilsson -- jesper.nilsson@axis.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCHv2 1/2] CRISv32: add irq domains support
2015-02-08 15:35 [PATCH 1/4] CRIS: add device tree support Rabin Vincent
` (3 preceding siblings ...)
2015-02-09 9:39 ` [PATCH 1/4] CRIS: add device tree support Jesper Nilsson
@ 2015-02-22 19:42 ` Rabin Vincent
2015-02-22 19:42 ` [PATCHv2 2/2] CRISv32: add device tree support Rabin Vincent
4 siblings, 1 reply; 11+ messages in thread
From: Rabin Vincent @ 2015-02-22 19:42 UTC (permalink / raw)
To: jesper.nilsson; +Cc: linux-kernel, linux-cris-kernel, devicetree, Rabin Vincent
Add support for IRQ domains to the CRISv32 interrupt controller.
Signed-off-by: Rabin Vincent <rabin@rab.in>
---
V2: No changes, but reorder so that this patch is before the OF patch, to avoid
build errors.
arch/cris/Kconfig | 1 +
arch/cris/arch-v32/kernel/irq.c | 28 +++++++++++++++++++++++++---
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 8474c66..3c94c96 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -53,6 +53,7 @@ config CRIS
select OLD_SIGSUSPEND
select OLD_SIGACTION
select ARCH_REQUIRE_GPIOLIB
+ select IRQ_DOMAIN if ETRAX_ARCH_V32
config HZ
int
diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c
index 25437ae..bc871d2 100644
--- a/arch/cris/arch-v32/kernel/irq.c
+++ b/arch/cris/arch-v32/kernel/irq.c
@@ -10,6 +10,8 @@
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/profile.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/threads.h>
@@ -431,6 +433,19 @@ crisv32_do_multiple(struct pt_regs* regs)
irq_exit();
}
+static int crisv32_irq_map(struct irq_domain *h, unsigned int virq,
+ irq_hw_number_t hw_irq_num)
+{
+ irq_set_chip_and_handler(virq, &crisv32_irq_type, handle_simple_irq);
+
+ return 0;
+}
+
+static struct irq_domain_ops crisv32_irq_ops = {
+ .map = crisv32_irq_map,
+ .xlate = irq_domain_xlate_onecell,
+};
+
/*
* This is called by start_kernel. It fixes the IRQ masks and setup the
* interrupt vector table to point to bad_interrupt pointers.
@@ -441,6 +456,8 @@ init_IRQ(void)
int i;
int j;
reg_intr_vect_rw_mask vect_mask = {0};
+ struct device_node *np;
+ struct irq_domain *domain;
/* Clear all interrupts masks. */
for (i = 0; i < NBR_REGS; i++)
@@ -449,10 +466,15 @@ init_IRQ(void)
for (i = 0; i < 256; i++)
etrax_irv->v[i] = weird_irq;
- /* Point all IRQ's to bad handlers. */
+ np = of_find_compatible_node(NULL, NULL, "axis,crisv32-intc");
+ domain = irq_domain_add_legacy(np, NR_IRQS - FIRST_IRQ,
+ FIRST_IRQ, FIRST_IRQ,
+ &crisv32_irq_ops, NULL);
+ BUG_ON(!domain);
+ irq_set_default_host(domain);
+ of_node_put(np);
+
for (i = FIRST_IRQ, j = 0; j < NR_IRQS; i++, j++) {
- irq_set_chip_and_handler(j, &crisv32_irq_type,
- handle_simple_irq);
set_exception_vector(i, interrupt[j]);
}
--
2.1.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCHv2 2/2] CRISv32: add device tree support
2015-02-22 19:42 ` [PATCHv2 1/2] CRISv32: add irq domains support Rabin Vincent
@ 2015-02-22 19:42 ` Rabin Vincent
0 siblings, 0 replies; 11+ messages in thread
From: Rabin Vincent @ 2015-02-22 19:42 UTC (permalink / raw)
To: jesper.nilsson; +Cc: linux-kernel, linux-cris-kernel, devicetree, Rabin Vincent
Add support for booting CRISv32 with a built-in device tree.
Signed-off-by: Rabin Vincent <rabin@rab.in>
---
V2: Reorder to be after irqdomains patch and restrict to CRISv32 for now to
avoid build errors on CRISv10.
arch/cris/Kconfig | 6 ++++++
arch/cris/Makefile | 4 ++++
arch/cris/boot/dts/Makefile | 6 ++++++
arch/cris/kernel/Makefile | 1 +
arch/cris/kernel/devicetree.c | 14 ++++++++++++++
arch/cris/kernel/setup.c | 15 +++++++++++++++
6 files changed, 46 insertions(+)
create mode 100644 arch/cris/boot/dts/Makefile
create mode 100644 arch/cris/kernel/devicetree.c
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 3c94c96..eb11774 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -54,11 +54,17 @@ config CRIS
select OLD_SIGACTION
select ARCH_REQUIRE_GPIOLIB
select IRQ_DOMAIN if ETRAX_ARCH_V32
+ select OF if ETRAX_ARCH_V32
+ select OF_EARLY_FLATTREE if ETRAX_ARCH_V32
config HZ
int
default 100
+config BUILTIN_DTB
+ string "DTB to build into the kernel image"
+ depends on OF
+
source "init/Kconfig"
source "kernel/Kconfig.freezer"
diff --git a/arch/cris/Makefile b/arch/cris/Makefile
index 39dc7d0..4a5404b 100644
--- a/arch/cris/Makefile
+++ b/arch/cris/Makefile
@@ -40,6 +40,10 @@ else
MACH :=
endif
+ifneq ($(CONFIG_BUILTIN_DTB),"")
+core-$(CONFIG_OF) += arch/cris/boot/dts/
+endif
+
LD = $(CROSS_COMPILE)ld -mcrislinux
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
diff --git a/arch/cris/boot/dts/Makefile b/arch/cris/boot/dts/Makefile
new file mode 100644
index 0000000..faf69fb
--- /dev/null
+++ b/arch/cris/boot/dts/Makefile
@@ -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
diff --git a/arch/cris/kernel/Makefile b/arch/cris/kernel/Makefile
index b45640b..edef71f 100644
--- a/arch/cris/kernel/Makefile
+++ b/arch/cris/kernel/Makefile
@@ -7,6 +7,7 @@ CPPFLAGS_vmlinux.lds := -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
extra-y := vmlinux.lds
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) += module.o
diff --git a/arch/cris/kernel/devicetree.c b/arch/cris/kernel/devicetree.c
new file mode 100644
index 0000000..53ff8d7
--- /dev/null
+++ b/arch/cris/kernel/devicetree.c
@@ -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);
+}
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index 905b70e..bb12aa9 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -19,6 +19,9 @@
#include <linux/utsname.h>
#include <linux/pfn.h>
#include <linux/cpu.h>
+#include <linux/of.h>
+#include <linux/of_fdt.h>
+#include <linux/of_platform.h>
#include <asm/setup.h>
#include <arch/system.h>
@@ -64,6 +67,10 @@ void __init setup_arch(char **cmdline_p)
unsigned long start_pfn, max_pfn;
unsigned long memory_start;
+#ifdef CONFIG_OF
+ early_init_dt_scan(__dtb_start);
+#endif
+
/* register an initial console printing routine for printk's */
init_etrax_debug();
@@ -141,6 +148,8 @@ void __init setup_arch(char **cmdline_p)
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();
@@ -204,3 +213,9 @@ static int __init topology_init(void)
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);
--
2.1.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-02-22 19:42 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-08 15:35 [PATCH 1/4] CRIS: add device tree support Rabin Vincent
2015-02-08 15:35 ` [PATCH 2/4] CRISv32: add irq domains support Rabin Vincent
2015-02-09 9:40 ` Jesper Nilsson
2015-02-08 15:35 ` [PATCH 3/4] CRIS: document CRISv32 intc bindings Rabin Vincent
[not found] ` <1423409745-2230-3-git-send-email-rabin-66gdRtMMWGc@public.gmane.org>
2015-02-09 9:45 ` Jesper Nilsson
2015-02-09 9:45 ` Jesper Nilsson
2015-02-08 15:35 ` [PATCH 4/4] CRIS: add Axis 88 board device tree Rabin Vincent
2015-02-09 9:46 ` Jesper Nilsson
2015-02-09 9:39 ` [PATCH 1/4] CRIS: add device tree support Jesper Nilsson
2015-02-22 19:42 ` [PATCHv2 1/2] CRISv32: add irq domains support Rabin Vincent
2015-02-22 19:42 ` [PATCHv2 2/2] CRISv32: add device tree support Rabin Vincent
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.