diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2016-06-04 03:10:03 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2016-07-06 11:38:54 -0400 |
commit | 0db943ec029a1ced48c71617706a1e8d782c9676 (patch) | |
tree | fae3c7b665cef929d895543d2fd727b2a100fb26 | |
parent | 32981ea5b98682a70fdd27f2246fcd2c4e10126b (diff) |
ARM: clps711x: Add basic DT support
This patch adds basic support to run Cirrus Logic ARMv4T CPUs
with device-tree support.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r-- | arch/arm/mach-clps711x/Kconfig | 9 | ||||
-rw-r--r-- | arch/arm/mach-clps711x/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-clps711x/board-dt.c | 82 |
3 files changed, 92 insertions, 0 deletions
diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig index f711498c180c..f21700cf61f4 100644 --- a/arch/arm/mach-clps711x/Kconfig +++ b/arch/arm/mach-clps711x/Kconfig | |||
@@ -2,6 +2,15 @@ if ARCH_CLPS711X | |||
2 | 2 | ||
3 | menu "CLPS711X/EP721X/EP731X Implementations" | 3 | menu "CLPS711X/EP721X/EP731X Implementations" |
4 | 4 | ||
5 | config MACH_CLPS711X_DT | ||
6 | bool "Device-tree support" | ||
7 | select CLKSRC_OF | ||
8 | select OF_IRQ | ||
9 | select USE_OF | ||
10 | help | ||
11 | Select this if you want to experiment device-tree with | ||
12 | ARMv4T Cirrus Logic chips. | ||
13 | |||
5 | config ARCH_AUTCPU12 | 14 | config ARCH_AUTCPU12 |
6 | bool "AUTCPU12" | 15 | bool "AUTCPU12" |
7 | help | 16 | help |
diff --git a/arch/arm/mach-clps711x/Makefile b/arch/arm/mach-clps711x/Makefile index f04151efd96a..ef6df40214b7 100644 --- a/arch/arm/mach-clps711x/Makefile +++ b/arch/arm/mach-clps711x/Makefile | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | obj-y := common.o devices.o | 7 | obj-y := common.o devices.o |
8 | 8 | ||
9 | obj-$(CONFIG_MACH_CLPS711X_DT) += board-dt.o | ||
9 | obj-$(CONFIG_ARCH_AUTCPU12) += board-autcpu12.o | 10 | obj-$(CONFIG_ARCH_AUTCPU12) += board-autcpu12.o |
10 | obj-$(CONFIG_ARCH_CDB89712) += board-cdb89712.o | 11 | obj-$(CONFIG_ARCH_CDB89712) += board-cdb89712.o |
11 | obj-$(CONFIG_ARCH_CLEP7312) += board-clep7312.o | 12 | obj-$(CONFIG_ARCH_CLEP7312) += board-clep7312.o |
diff --git a/arch/arm/mach-clps711x/board-dt.c b/arch/arm/mach-clps711x/board-dt.c new file mode 100644 index 000000000000..ee1f83b1a332 --- /dev/null +++ b/arch/arm/mach-clps711x/board-dt.c | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | * Author: Alexander Shiyan <shc_work@mail.ru>, 2016 | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include <linux/io.h> | ||
11 | #include <linux/of_fdt.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | #include <linux/random.h> | ||
14 | #include <linux/sizes.h> | ||
15 | |||
16 | #include <linux/mfd/syscon/clps711x.h> | ||
17 | |||
18 | #include <asm/system_info.h> | ||
19 | #include <asm/system_misc.h> | ||
20 | #include <asm/mach/arch.h> | ||
21 | #include <asm/mach/map.h> | ||
22 | |||
23 | #define CLPS711X_VIRT_BASE IOMEM(0xfeff4000) | ||
24 | #define CLPS711X_PHYS_BASE (0x80000000) | ||
25 | # define SYSFLG1 (0x0140) | ||
26 | # define HALT (0x0800) | ||
27 | # define UNIQID (0x2440) | ||
28 | # define RANDID0 (0x2700) | ||
29 | # define RANDID1 (0x2704) | ||
30 | # define RANDID2 (0x2708) | ||
31 | # define RANDID3 (0x270c) | ||
32 | |||
33 | static struct map_desc clps711x_io_desc __initdata = { | ||
34 | .virtual = (unsigned long)CLPS711X_VIRT_BASE, | ||
35 | .pfn = __phys_to_pfn(CLPS711X_PHYS_BASE), | ||
36 | .length = 48 * SZ_1K, | ||
37 | .type = MT_DEVICE, | ||
38 | }; | ||
39 | |||
40 | static void __init clps711x_map_io(void) | ||
41 | { | ||
42 | iotable_init(&clps711x_io_desc, 1); | ||
43 | } | ||
44 | |||
45 | static const struct resource clps711x_cpuidle_res = | ||
46 | DEFINE_RES_MEM(CLPS711X_PHYS_BASE + HALT, SZ_128); | ||
47 | |||
48 | static void __init clps711x_init(void) | ||
49 | { | ||
50 | u32 id[5]; | ||
51 | |||
52 | id[0] = readl(CLPS711X_VIRT_BASE + UNIQID); | ||
53 | id[1] = readl(CLPS711X_VIRT_BASE + RANDID0); | ||
54 | id[2] = readl(CLPS711X_VIRT_BASE + RANDID1); | ||
55 | id[3] = readl(CLPS711X_VIRT_BASE + RANDID2); | ||
56 | id[4] = readl(CLPS711X_VIRT_BASE + RANDID3); | ||
57 | system_rev = SYSFLG1_VERID(readl(CLPS711X_VIRT_BASE + SYSFLG1)); | ||
58 | |||
59 | add_device_randomness(id, sizeof(id)); | ||
60 | |||
61 | system_serial_low = id[0]; | ||
62 | |||
63 | platform_device_register_simple("clps711x-cpuidle", PLATFORM_DEVID_NONE, | ||
64 | &clps711x_cpuidle_res, 1); | ||
65 | } | ||
66 | |||
67 | static void clps711x_restart(enum reboot_mode mode, const char *cmd) | ||
68 | { | ||
69 | soft_restart(0); | ||
70 | } | ||
71 | |||
72 | static const char *clps711x_compat[] __initconst = { | ||
73 | "cirrus,ep7209", | ||
74 | NULL | ||
75 | }; | ||
76 | |||
77 | DT_MACHINE_START(CLPS711X_DT, "Cirrus Logic CLPS711X (Device Tree Support)") | ||
78 | .dt_compat = clps711x_compat, | ||
79 | .map_io = clps711x_map_io, | ||
80 | .init_late = clps711x_init, | ||
81 | .restart = clps711x_restart, | ||
82 | MACHINE_END | ||