aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>2015-10-26 07:30:56 -0400
committerRalf Baechle <ralf@linux-mips.org>2015-11-11 02:38:44 -0500
commit9937f5fff889bde488c5ffd238dcb49e9b9cc7b7 (patch)
tree2ac3a86bd0914a3b264ade99152f73c052a1cb2e
parent552b8b363ede5fc53db343b67c0b2b5eaf783a11 (diff)
MIPS: xilfpga: Add mipsfpga platform code
The xilfpga platform will be DT only. Add required platform code. DT files have already been added separately. Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com> Cc: robh+dt@kernel.org Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Cc: devicetree@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/11364/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/Kbuild.platforms1
-rw-r--r--arch/mips/Kconfig23
-rw-r--r--arch/mips/include/asm/mach-xilfpga/irq.h18
-rw-r--r--arch/mips/xilfpga/Kconfig9
-rw-r--r--arch/mips/xilfpga/Makefile7
-rw-r--r--arch/mips/xilfpga/Platform3
-rw-r--r--arch/mips/xilfpga/init.c57
-rw-r--r--arch/mips/xilfpga/intc.c25
-rw-r--r--arch/mips/xilfpga/time.c41
9 files changed, 184 insertions, 0 deletions
diff --git a/arch/mips/Kbuild.platforms b/arch/mips/Kbuild.platforms
index a424e46b50af..a96c81d1d22e 100644
--- a/arch/mips/Kbuild.platforms
+++ b/arch/mips/Kbuild.platforms
@@ -33,6 +33,7 @@ platforms += sibyte
33platforms += sni 33platforms += sni
34platforms += txx9 34platforms += txx9
35platforms += vr41xx 35platforms += vr41xx
36platforms += xilfpga
36 37
37# include the platform specific files 38# include the platform specific files
38include $(patsubst %, $(srctree)/arch/mips/%/Platform, $(platforms)) 39include $(patsubst %, $(srctree)/arch/mips/%/Platform, $(platforms))
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index a65341a03712..218aa67a2c52 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -404,6 +404,28 @@ config MACH_PISTACHIO
404 help 404 help
405 This enables support for the IMG Pistachio SoC platform. 405 This enables support for the IMG Pistachio SoC platform.
406 406
407config MACH_XILFPGA
408 bool "MIPSfpga Xilinx based boards"
409 select ARCH_REQUIRE_GPIOLIB
410 select BOOT_ELF32
411 select BOOT_RAW
412 select BUILTIN_DTB
413 select CEVT_R4K
414 select COMMON_CLK
415 select CSRC_R4K
416 select IRQ_MIPS_CPU
417 select LIBFDT
418 select MIPS_CPU_SCACHE
419 select SYS_HAS_EARLY_PRINTK
420 select SYS_HAS_CPU_MIPS32_R2
421 select SYS_SUPPORTS_32BIT_KERNEL
422 select SYS_SUPPORTS_LITTLE_ENDIAN
423 select SYS_SUPPORTS_ZBOOT_UART16550
424 select USE_OF
425 select USE_GENERIC_EARLY_PRINTK_8250
426 help
427 This enables support for the IMG University Program MIPSfpga platform.
428
407config MIPS_MALTA 429config MIPS_MALTA
408 bool "MIPS Malta board" 430 bool "MIPS Malta board"
409 select ARCH_MAY_HAVE_PC_FDC 431 select ARCH_MAY_HAVE_PC_FDC
@@ -970,6 +992,7 @@ source "arch/mips/loongson32/Kconfig"
970source "arch/mips/loongson64/Kconfig" 992source "arch/mips/loongson64/Kconfig"
971source "arch/mips/netlogic/Kconfig" 993source "arch/mips/netlogic/Kconfig"
972source "arch/mips/paravirt/Kconfig" 994source "arch/mips/paravirt/Kconfig"
995source "arch/mips/xilfpga/Kconfig"
973 996
974endmenu 997endmenu
975 998
diff --git a/arch/mips/include/asm/mach-xilfpga/irq.h b/arch/mips/include/asm/mach-xilfpga/irq.h
new file mode 100644
index 000000000000..0132a5b91f57
--- /dev/null
+++ b/arch/mips/include/asm/mach-xilfpga/irq.h
@@ -0,0 +1,18 @@
1/*
2 * Copyright (C) 2015 Imagination Technologies
3 * Author: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#ifndef __MIPS_ASM_MACH_XILFPGA_IRQ_H__
12#define __MIPS_ASM_MACH_XILFPGA_IRQ_H__
13
14#define NR_IRQS 32
15
16#include_next <irq.h>
17
18#endif /* __MIPS_ASM_MACH_XILFPGA_IRQ_H__ */
diff --git a/arch/mips/xilfpga/Kconfig b/arch/mips/xilfpga/Kconfig
new file mode 100644
index 000000000000..42a030a0edba
--- /dev/null
+++ b/arch/mips/xilfpga/Kconfig
@@ -0,0 +1,9 @@
1choice
2 prompt "Machine type"
3 depends on MACH_XILFPGA
4 default XILFPGA_NEXYS4DDR
5
6config XILFPGA_NEXYS4DDR
7 bool "Nexys4DDR by Digilent"
8
9endchoice
diff --git a/arch/mips/xilfpga/Makefile b/arch/mips/xilfpga/Makefile
new file mode 100644
index 000000000000..a4deec6fadbc
--- /dev/null
+++ b/arch/mips/xilfpga/Makefile
@@ -0,0 +1,7 @@
1#
2# Makefile for the Xilfpga
3#
4
5obj-y += init.o
6obj-y += intc.o
7obj-y += time.o
diff --git a/arch/mips/xilfpga/Platform b/arch/mips/xilfpga/Platform
new file mode 100644
index 000000000000..ed375afe3d39
--- /dev/null
+++ b/arch/mips/xilfpga/Platform
@@ -0,0 +1,3 @@
1platform-$(CONFIG_MACH_XILFPGA) += xilfpga/
2cflags-$(CONFIG_MACH_XILFPGA) += -I$(srctree)/arch/mips/include/asm/mach-xilfpga
3load-$(CONFIG_MACH_XILFPGA) += 0xffffffff80100000
diff --git a/arch/mips/xilfpga/init.c b/arch/mips/xilfpga/init.c
new file mode 100644
index 000000000000..ce2aee2169ac
--- /dev/null
+++ b/arch/mips/xilfpga/init.c
@@ -0,0 +1,57 @@
1/*
2 * Xilfpga platform setup
3 *
4 * Copyright (C) 2015 Imagination Technologies
5 * Author: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 */
11
12#include <linux/of_fdt.h>
13#include <linux/of_platform.h>
14
15#include <asm/prom.h>
16
17#define XILFPGA_UART_BASE 0xb0401000
18
19const char *get_system_type(void)
20{
21 return "MIPSfpga";
22}
23
24void __init plat_mem_setup(void)
25{
26 __dt_setup_arch(__dtb_start);
27 strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
28}
29
30void __init prom_init(void)
31{
32 setup_8250_early_printk_port(XILFPGA_UART_BASE, 2, 50000);
33}
34
35void __init prom_free_prom_memory(void)
36{
37}
38
39void __init device_tree_init(void)
40{
41 if (!initial_boot_params)
42 return;
43
44 unflatten_and_copy_device_tree();
45}
46
47static int __init plat_of_setup(void)
48{
49 if (!of_have_populated_dt())
50 panic("Device tree not present");
51
52 if (of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL))
53 panic("Failed to populate DT");
54
55 return 0;
56}
57arch_initcall(plat_of_setup);
diff --git a/arch/mips/xilfpga/intc.c b/arch/mips/xilfpga/intc.c
new file mode 100644
index 000000000000..c4d1a716b347
--- /dev/null
+++ b/arch/mips/xilfpga/intc.c
@@ -0,0 +1,25 @@
1/*
2 * Xilfpga interrupt controller setup
3 *
4 * Copyright (C) 2015 Imagination Technologies
5 * Author: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 */
11
12#include <linux/of.h>
13#include <linux/of_irq.h>
14
15#include <asm/irq_cpu.h>
16
17static struct of_device_id of_irq_ids[] __initdata = {
18 { .compatible = "mti,cpu-interrupt-controller", .data = mips_cpu_irq_of_init },
19 {},
20};
21
22void __init arch_init_irq(void)
23{
24 of_irq_init(of_irq_ids);
25}
diff --git a/arch/mips/xilfpga/time.c b/arch/mips/xilfpga/time.c
new file mode 100644
index 000000000000..a1c0fc8893e8
--- /dev/null
+++ b/arch/mips/xilfpga/time.c
@@ -0,0 +1,41 @@
1/*
2 * Xilfpga clocksource/timer setup
3 *
4 * Copyright (C) 2015 Imagination Technologies
5 * Author: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 */
11
12#include <linux/clk.h>
13#include <linux/clk-provider.h>
14#include <linux/clocksource.h>
15#include <linux/of.h>
16
17#include <asm/time.h>
18
19void __init plat_time_init(void)
20{
21 struct device_node *np;
22 struct clk *clk;
23
24 of_clk_init(NULL);
25 clocksource_of_init();
26
27 np = of_get_cpu_node(0, NULL);
28 if (!np) {
29 pr_err("Failed to get CPU node\n");
30 return;
31 }
32
33 clk = of_clk_get(np, 0);
34 if (IS_ERR(clk)) {
35 pr_err("Failed to get CPU clock: %ld\n", PTR_ERR(clk));
36 return;
37 }
38
39 mips_hpt_frequency = clk_get_rate(clk) / 2;
40 clk_put(clk);
41}