aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2010-02-05 06:14:49 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-02-07 22:44:11 -0500
commitc793c1b0c8ea11b46caf5a532752214b27a2df42 (patch)
tree1d8cbdaaff4d6a19c8891c8c551e1d205902c9ba /arch
parent9e9622d1a064705181bea0600ea9eacd95adab7f (diff)
ARM: mach-shmobile: SH-Mobile G3 support.
This adds preliminary support for the SH-Mobile G-series. The SH-Mobile G-series is a series of ARM/SH multi-core CPUs that aside from the ARM MPU are primarily composed of existing SH IP blocks. This includes initial support for the SH7367 (SH-Mobile G3) CPU and the G3EVM reference board. Only timer, serial console, and NOR flash are supported at this point. Patches for the interrupt controller, pinmux support, clock framework and runtime pm will be submitted as feature patches on top of this. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig7
-rw-r--r--arch/arm/Makefile1
-rw-r--r--arch/arm/mach-shmobile/Kconfig53
-rw-r--r--arch/arm/mach-shmobile/Makefile12
-rw-r--r--arch/arm/mach-shmobile/Makefile.boot9
-rw-r--r--arch/arm/mach-shmobile/board-g3evm.c127
-rw-r--r--arch/arm/mach-shmobile/clock-sh7367.c89
-rw-r--r--arch/arm/mach-shmobile/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h11
-rw-r--r--arch/arm/mach-shmobile/include/mach/dma.h1
-rw-r--r--arch/arm/mach-shmobile/include/mach/entry-macro.S39
-rw-r--r--arch/arm/mach-shmobile/include/mach/gpio.h1
-rw-r--r--arch/arm/mach-shmobile/include/mach/hardware.h7
-rw-r--r--arch/arm/mach-shmobile/include/mach/io.h9
-rw-r--r--arch/arm/mach-shmobile/include/mach/irqs.h10
-rw-r--r--arch/arm/mach-shmobile/include/mach/memory.h7
-rw-r--r--arch/arm/mach-shmobile/include/mach/system.h14
-rw-r--r--arch/arm/mach-shmobile/include/mach/timex.h6
-rw-r--r--arch/arm/mach-shmobile/include/mach/uncompress.h21
-rw-r--r--arch/arm/mach-shmobile/include/mach/vmalloc.h6
-rw-r--r--arch/arm/mach-shmobile/setup-sh7367.c241
-rw-r--r--arch/arm/mach-shmobile/timer.c46
22 files changed, 724 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 184a6bd54825..55764a1c8763 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -584,6 +584,11 @@ config ARCH_MSM
584 interface to the ARM9 modem processor which runs the baseband stack 584 interface to the ARM9 modem processor which runs the baseband stack
585 and controls some vital subsystems (clock and power control, etc). 585 and controls some vital subsystems (clock and power control, etc).
586 586
587config ARCH_SHMOBILE
588 bool "Renesas SH-Mobile"
589 help
590 Support for Renesas's SH-Mobile ARM platforms
591
587config ARCH_RPC 592config ARCH_RPC
588 bool "RiscPC" 593 bool "RiscPC"
589 select ARCH_ACORN 594 select ARCH_ACORN
@@ -822,6 +827,8 @@ source "arch/arm/mach-s3c6400/Kconfig"
822source "arch/arm/mach-s3c6410/Kconfig" 827source "arch/arm/mach-s3c6410/Kconfig"
823endif 828endif
824 829
830source "arch/arm/mach-shmobile/Kconfig"
831
825source "arch/arm/plat-stmp3xxx/Kconfig" 832source "arch/arm/plat-stmp3xxx/Kconfig"
826 833
827if ARCH_S5PC1XX 834if ARCH_S5PC1XX
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 356d702c0808..177775fe514d 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -165,6 +165,7 @@ machine-$(CONFIG_ARCH_S3C64XX) := s3c6400 s3c6410
165machine-$(CONFIG_ARCH_S5PC1XX) := s5pc100 165machine-$(CONFIG_ARCH_S5PC1XX) := s5pc100
166machine-$(CONFIG_ARCH_SA1100) := sa1100 166machine-$(CONFIG_ARCH_SA1100) := sa1100
167machine-$(CONFIG_ARCH_SHARK) := shark 167machine-$(CONFIG_ARCH_SHARK) := shark
168machine-$(CONFIG_ARCH_SHMOBILE) := shmobile
168machine-$(CONFIG_ARCH_STMP378X) := stmp378x 169machine-$(CONFIG_ARCH_STMP378X) := stmp378x
169machine-$(CONFIG_ARCH_STMP37XX) := stmp37xx 170machine-$(CONFIG_ARCH_STMP37XX) := stmp37xx
170machine-$(CONFIG_ARCH_U300) := u300 171machine-$(CONFIG_ARCH_U300) := u300
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
new file mode 100644
index 000000000000..8f4eb13b5869
--- /dev/null
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -0,0 +1,53 @@
1if ARCH_SHMOBILE
2
3comment "SH-Mobile System Type"
4
5config ARCH_SH7367
6 bool "SH-Mobile G3 (SH7367)"
7 select CPU_V6
8 select HAVE_CLK
9 select COMMON_CLKDEV
10 select GENERIC_TIME
11 select GENERIC_CLOCKEVENTS
12
13comment "SH-Mobile Board Type"
14
15config MACH_G3EVM
16 bool "G3EVM board"
17 depends on ARCH_SH7367
18
19comment "SH-Mobile System Configuration"
20
21menu "Memory configuration"
22
23config MEMORY_START
24 hex "Physical memory start address"
25 default "0x50000000" if MACH_G3EVM
26 default "0x00000000"
27 ---help---
28 Tweak this only when porting to a new machine which does not
29 already have a defconfig. Changing it from the known correct
30 value on any of the known systems will only lead to disaster.
31
32config MEMORY_SIZE
33 hex "Physical memory size"
34 default "0x08000000" if MACH_G3EVM
35 default "0x04000000"
36 help
37 This sets the default memory size assumed by your kernel. It can
38 be overridden as normal by the 'mem=' argument on the kernel command
39 line.
40
41endmenu
42
43menu "Timer and clock configuration"
44
45config SH_TIMER_CMT
46 bool "CMT timer driver"
47 default y
48 help
49 This enables build of the CMT timer driver.
50
51endmenu
52
53endif
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
new file mode 100644
index 000000000000..3eca521853d2
--- /dev/null
+++ b/arch/arm/mach-shmobile/Makefile
@@ -0,0 +1,12 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Common objects
6obj-y := timer.o
7
8# CPU objects
9obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o
10
11# Board objects
12obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o
diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
new file mode 100644
index 000000000000..1c08ee9de86a
--- /dev/null
+++ b/arch/arm/mach-shmobile/Makefile.boot
@@ -0,0 +1,9 @@
1__ZRELADDR := $(shell /bin/bash -c 'printf "0x%08x" \
2 $$[$(CONFIG_MEMORY_START) + 0x8000]')
3
4 zreladdr-y := $(__ZRELADDR)
5
6# Unsupported legacy stuff
7#
8#params_phys-y (Instead: Pass atags pointer in r2)
9#initrd_phys-y (Instead: Use compiled-in initramfs)
diff --git a/arch/arm/mach-shmobile/board-g3evm.c b/arch/arm/mach-shmobile/board-g3evm.c
new file mode 100644
index 000000000000..b4b202718e4d
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-g3evm.c
@@ -0,0 +1,127 @@
1/*
2 * G3EVM board support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/platform_device.h>
25#include <linux/delay.h>
26#include <linux/mtd/mtd.h>
27#include <linux/mtd/partitions.h>
28#include <linux/mtd/physmap.h>
29#include <linux/io.h>
30#include <mach/common.h>
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/map.h>
34
35static struct mtd_partition nor_flash_partitions[] = {
36 {
37 .name = "loader",
38 .offset = 0x00000000,
39 .size = 512 * 1024,
40 },
41 {
42 .name = "bootenv",
43 .offset = MTDPART_OFS_APPEND,
44 .size = 512 * 1024,
45 },
46 {
47 .name = "kernel_ro",
48 .offset = MTDPART_OFS_APPEND,
49 .size = 8 * 1024 * 1024,
50 .mask_flags = MTD_WRITEABLE,
51 },
52 {
53 .name = "kernel",
54 .offset = MTDPART_OFS_APPEND,
55 .size = 8 * 1024 * 1024,
56 },
57 {
58 .name = "data",
59 .offset = MTDPART_OFS_APPEND,
60 .size = MTDPART_SIZ_FULL,
61 },
62};
63
64static struct physmap_flash_data nor_flash_data = {
65 .width = 2,
66 .parts = nor_flash_partitions,
67 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
68};
69
70static struct resource nor_flash_resources[] = {
71 [0] = {
72 .start = 0x00000000,
73 .end = 0x08000000 - 1,
74 .flags = IORESOURCE_MEM,
75 }
76};
77
78static struct platform_device nor_flash_device = {
79 .name = "physmap-flash",
80 .dev = {
81 .platform_data = &nor_flash_data,
82 },
83 .num_resources = ARRAY_SIZE(nor_flash_resources),
84 .resource = nor_flash_resources,
85};
86
87
88static struct platform_device *g3evm_devices[] __initdata = {
89 &nor_flash_device,
90};
91
92static struct map_desc g3evm_io_desc[] __initdata = {
93 /* create a 1:1 entity map for 0xe6xxxxxx
94 * used by CPGA, INTC and PFC.
95 */
96 {
97 .virtual = 0xe6000000,
98 .pfn = __phys_to_pfn(0xe6000000),
99 .length = 256 << 20,
100 .type = MT_DEVICE_NONSHARED
101 },
102};
103
104static void __init g3evm_map_io(void)
105{
106 iotable_init(g3evm_io_desc, ARRAY_SIZE(g3evm_io_desc));
107
108 /* setup early devices and clocks here as well */
109 sh7367_add_early_devices();
110 sh7367_clock_init();
111}
112
113static void __init g3evm_init(void)
114{
115 sh7367_add_standard_devices();
116
117 platform_add_devices(g3evm_devices, ARRAY_SIZE(g3evm_devices));
118}
119
120MACHINE_START(G3EVM, "g3evm")
121 .phys_io = 0xe6000000,
122 .io_pg_offst = ((0xe6000000) >> 18) & 0xfffc,
123 .map_io = g3evm_map_io,
124 .init_irq = sh7367_init_irq,
125 .init_machine = g3evm_init,
126 .timer = &shmobile_timer,
127MACHINE_END
diff --git a/arch/arm/mach-shmobile/clock-sh7367.c b/arch/arm/mach-shmobile/clock-sh7367.c
new file mode 100644
index 000000000000..3b2e3f2fc7ea
--- /dev/null
+++ b/arch/arm/mach-shmobile/clock-sh7367.c
@@ -0,0 +1,89 @@
1/*
2 * Preliminary clock framework support for sh7367
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#include <linux/init.h>
20#include <linux/module.h>
21#include <linux/kernel.h>
22#include <linux/list.h>
23#include <linux/clk.h>
24
25struct clk {
26 const char *name;
27 unsigned long rate;
28};
29
30#include <asm/clkdev.h>
31
32int __clk_get(struct clk *clk)
33{
34 return 1;
35}
36EXPORT_SYMBOL(__clk_get);
37
38void __clk_put(struct clk *clk)
39{
40}
41EXPORT_SYMBOL(__clk_put);
42
43
44int clk_enable(struct clk *clk)
45{
46 return 0;
47}
48EXPORT_SYMBOL(clk_enable);
49
50void clk_disable(struct clk *clk)
51{
52}
53EXPORT_SYMBOL(clk_disable);
54
55unsigned long clk_get_rate(struct clk *clk)
56{
57 return clk ? clk->rate : 0;
58}
59EXPORT_SYMBOL(clk_get_rate);
60
61/* a static peripheral clock for now - enough to get sh-sci working */
62static struct clk peripheral_clk = {
63 .name = "peripheral_clk",
64 .rate = 48000000,
65};
66
67/* a static rclk for now - enough to get sh_cmt working */
68static struct clk r_clk = {
69 .name = "r_clk",
70 .rate = 32768,
71};
72
73static struct clk_lookup lookups[] = {
74 {
75 .clk = &peripheral_clk,
76 }, {
77 .clk = &r_clk,
78 }
79};
80
81void __init sh7367_clock_init(void)
82{
83 int i;
84
85 for (i = 0; i < ARRAY_SIZE(lookups); i++) {
86 lookups[i].con_id = lookups[i].clk->name;
87 clkdev_add(&lookups[i]);
88 }
89}
diff --git a/arch/arm/mach-shmobile/include/mach/clkdev.h b/arch/arm/mach-shmobile/include/mach/clkdev.h
new file mode 100644
index 000000000000..36d0163a857a
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4int __clk_get(struct clk *clk);
5void __clk_put(struct clk *clk);
6
7#endif /* __ASM_MACH_CLKDEV_H */
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
new file mode 100644
index 000000000000..d771afa79eb6
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -0,0 +1,11 @@
1#ifndef __ARCH_MACH_COMMON_H
2#define __ARCH_MACH_COMMON_H
3
4extern struct sys_timer shmobile_timer;
5
6extern void sh7367_init_irq(void);
7extern void sh7367_add_early_devices(void);
8extern void sh7367_add_standard_devices(void);
9extern void sh7367_clock_init(void);
10
11#endif /* __ARCH_MACH_COMMON_H */
diff --git a/arch/arm/mach-shmobile/include/mach/dma.h b/arch/arm/mach-shmobile/include/mach/dma.h
new file mode 100644
index 000000000000..40a8c178f10d
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/dma.h
@@ -0,0 +1 @@
/* empty */
diff --git a/arch/arm/mach-shmobile/include/mach/entry-macro.S b/arch/arm/mach-shmobile/include/mach/entry-macro.S
new file mode 100644
index 000000000000..796b304050cc
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/entry-macro.S
@@ -0,0 +1,39 @@
1/*
2 * Copyright (C) 2008 Renesas Solutions Corp.
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; version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17#include <mach/hardware.h>
18#include <mach/irqs.h>
19
20 .macro disable_fiq
21 .endm
22
23 .macro get_irqnr_preamble, base, tmp
24 .endm
25
26 .macro arch_ret_to_user, tmp1, tmp2
27 .endm
28
29 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
30 ldr \base, =INTFLGA
31 ldr \irqnr, [\base]
32 cmp \irqnr, #0
33 beq 1000f
34 /* intevt to irq number */
35 lsr \irqnr, \irqnr, #0x5
36 subs \irqnr, \irqnr, #16
37
381000:
39 .endm
diff --git a/arch/arm/mach-shmobile/include/mach/gpio.h b/arch/arm/mach-shmobile/include/mach/gpio.h
new file mode 100644
index 000000000000..40a8c178f10d
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/gpio.h
@@ -0,0 +1 @@
/* empty */
diff --git a/arch/arm/mach-shmobile/include/mach/hardware.h b/arch/arm/mach-shmobile/include/mach/hardware.h
new file mode 100644
index 000000000000..3f0ef194603e
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/hardware.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_MACH_HARDWARE_H
2#define __ASM_MACH_HARDWARE_H
3
4/* INTFLGA register - used by low level interrupt code in entry-macro.S */
5#define INTFLGA 0xe6980018
6
7#endif /* __ASM_MACH_HARDWARE_H */
diff --git a/arch/arm/mach-shmobile/include/mach/io.h b/arch/arm/mach-shmobile/include/mach/io.h
new file mode 100644
index 000000000000..7339fe46cb7c
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/io.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_MACH_IO_H
2#define __ASM_MACH_IO_H
3
4#define IO_SPACE_LIMIT 0xffffffff
5
6#define __io(a) ((void __iomem *)(a))
7#define __mem_pci(a) (a)
8
9#endif /* __ASM_MACH_IO_H */
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h
new file mode 100644
index 000000000000..5179b72e1ee3
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/irqs.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_MACH_IRQS_H
2#define __ASM_MACH_IRQS_H
3
4#define NR_IRQS 512
5#define NR_IRQS_LEGACY 8
6
7#define evt2irq(evt) (((evt) >> 5) - 16)
8#define irq2evt(irq) (((irq) + 16) << 5)
9
10#endif /* __ASM_MACH_IRQS_H */
diff --git a/arch/arm/mach-shmobile/include/mach/memory.h b/arch/arm/mach-shmobile/include/mach/memory.h
new file mode 100644
index 000000000000..e188183f4dce
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/memory.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_MACH_MEMORY_H
2#define __ASM_MACH_MEMORY_H
3
4#define PHYS_OFFSET UL(CONFIG_MEMORY_START)
5#define MEM_SIZE UL(CONFIG_MEMORY_SIZE)
6
7#endif /* __ASM_MACH_MEMORY_H */
diff --git a/arch/arm/mach-shmobile/include/mach/system.h b/arch/arm/mach-shmobile/include/mach/system.h
new file mode 100644
index 000000000000..76a687eeaa22
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/system.h
@@ -0,0 +1,14 @@
1#ifndef __ASM_ARCH_SYSTEM_H
2#define __ASM_ARCH_SYSTEM_H
3
4static inline void arch_idle(void)
5{
6 cpu_do_idle();
7}
8
9static inline void arch_reset(char mode, const char *cmd)
10{
11 cpu_reset(0);
12}
13
14#endif
diff --git a/arch/arm/mach-shmobile/include/mach/timex.h b/arch/arm/mach-shmobile/include/mach/timex.h
new file mode 100644
index 000000000000..ae0d8d825c23
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/timex.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_MACH_TIMEX_H
2#define __ASM_MACH_TIMEX_H
3
4#define CLOCK_TICK_RATE 1193180 /* unused i8253 PIT value */
5
6#endif /* __ASM_MACH_TIMEX_H */
diff --git a/arch/arm/mach-shmobile/include/mach/uncompress.h b/arch/arm/mach-shmobile/include/mach/uncompress.h
new file mode 100644
index 000000000000..0bd7556b1387
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/uncompress.h
@@ -0,0 +1,21 @@
1#ifndef __ASM_MACH_UNCOMPRESS_H
2#define __ASM_MACH_UNCOMPRESS_H
3
4/*
5 * This does not append a newline
6 */
7static void putc(int c)
8{
9}
10
11static inline void flush(void)
12{
13}
14
15static void arch_decomp_setup(void)
16{
17}
18
19#define arch_decomp_wdog()
20
21#endif /* __ASM_MACH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-shmobile/include/mach/vmalloc.h b/arch/arm/mach-shmobile/include/mach/vmalloc.h
new file mode 100644
index 000000000000..fb3c4f1ab252
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/vmalloc.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_MACH_VMALLOC_H
2#define __ASM_MACH_VMALLOC_H
3
4#define VMALLOC_END (PAGE_OFFSET + 0x24000000)
5
6#endif /* __ASM_MACH_VMALLOC_H */
diff --git a/arch/arm/mach-shmobile/setup-sh7367.c b/arch/arm/mach-shmobile/setup-sh7367.c
new file mode 100644
index 000000000000..840e5bcf2d68
--- /dev/null
+++ b/arch/arm/mach-shmobile/setup-sh7367.c
@@ -0,0 +1,241 @@
1/*
2 * sh7367 processor support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/platform_device.h>
25#include <linux/delay.h>
26#include <linux/input.h>
27#include <linux/io.h>
28#include <linux/serial_sci.h>
29#include <linux/sh_intc.h>
30#include <linux/sh_timer.h>
31#include <mach/hardware.h>
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34
35static struct plat_sci_port scif0_platform_data = {
36 .mapbase = 0xe6c40000,
37 .flags = UPF_BOOT_AUTOCONF,
38 .type = PORT_SCIF,
39 .irqs = { 80, 80, 80, 80 },
40};
41
42static struct platform_device scif0_device = {
43 .name = "sh-sci",
44 .id = 0,
45 .dev = {
46 .platform_data = &scif0_platform_data,
47 },
48};
49
50static struct plat_sci_port scif1_platform_data = {
51 .mapbase = 0xe6c50000,
52 .flags = UPF_BOOT_AUTOCONF,
53 .type = PORT_SCIF,
54 .irqs = { 81, 81, 81, 81 },
55};
56
57static struct platform_device scif1_device = {
58 .name = "sh-sci",
59 .id = 1,
60 .dev = {
61 .platform_data = &scif1_platform_data,
62 },
63};
64
65static struct plat_sci_port scif2_platform_data = {
66 .mapbase = 0xe6c60000,
67 .flags = UPF_BOOT_AUTOCONF,
68 .type = PORT_SCIF,
69 .irqs = { 82, 82, 82, 82 },
70};
71
72static struct platform_device scif2_device = {
73 .name = "sh-sci",
74 .id = 2,
75 .dev = {
76 .platform_data = &scif2_platform_data,
77 },
78};
79
80static struct plat_sci_port scif3_platform_data = {
81 .mapbase = 0xe6c70000,
82 .flags = UPF_BOOT_AUTOCONF,
83 .type = PORT_SCIF,
84 .irqs = { 83, 83, 83, 83 },
85};
86
87static struct platform_device scif3_device = {
88 .name = "sh-sci",
89 .id = 3,
90 .dev = {
91 .platform_data = &scif3_platform_data,
92 },
93};
94
95static struct plat_sci_port scif4_platform_data = {
96 .mapbase = 0xe6c80000,
97 .flags = UPF_BOOT_AUTOCONF,
98 .type = PORT_SCIF,
99 .irqs = { 89, 89, 89, 89 },
100};
101
102static struct platform_device scif4_device = {
103 .name = "sh-sci",
104 .id = 4,
105 .dev = {
106 .platform_data = &scif4_platform_data,
107 },
108};
109
110static struct plat_sci_port scif5_platform_data = {
111 .mapbase = 0xe6cb0000,
112 .flags = UPF_BOOT_AUTOCONF,
113 .type = PORT_SCIF,
114 .irqs = { 90, 90, 90, 90 },
115};
116
117static struct platform_device scif5_device = {
118 .name = "sh-sci",
119 .id = 5,
120 .dev = {
121 .platform_data = &scif5_platform_data,
122 },
123};
124
125static struct plat_sci_port scif6_platform_data = {
126 .mapbase = 0xe6c30000,
127 .flags = UPF_BOOT_AUTOCONF,
128 .type = PORT_SCIF,
129 .irqs = { 91, 91, 91, 91 },
130};
131
132static struct platform_device scif6_device = {
133 .name = "sh-sci",
134 .id = 6,
135 .dev = {
136 .platform_data = &scif6_platform_data,
137 },
138};
139
140static struct sh_timer_config cmt10_platform_data = {
141 .name = "CMT10",
142 .channel_offset = 0x10,
143 .timer_bit = 0,
144 .clk = "r_clk",
145 .clockevent_rating = 125,
146 .clocksource_rating = 125,
147};
148
149static struct resource cmt10_resources[] = {
150 [0] = {
151 .name = "CMT10",
152 .start = 0xe6138010,
153 .end = 0xe613801b,
154 .flags = IORESOURCE_MEM,
155 },
156 [1] = {
157 .start = 72,
158 .flags = IORESOURCE_IRQ,
159 },
160};
161
162static struct platform_device cmt10_device = {
163 .name = "sh_cmt",
164 .id = 10,
165 .dev = {
166 .platform_data = &cmt10_platform_data,
167 },
168 .resource = cmt10_resources,
169 .num_resources = ARRAY_SIZE(cmt10_resources),
170};
171
172static struct platform_device *sh7367_early_devices[] __initdata = {
173 &scif0_device,
174 &scif1_device,
175 &scif2_device,
176 &scif3_device,
177 &scif4_device,
178 &scif5_device,
179 &scif6_device,
180 &cmt10_device,
181};
182
183void __init sh7367_add_standard_devices(void)
184{
185 platform_add_devices(sh7367_early_devices,
186 ARRAY_SIZE(sh7367_early_devices));
187}
188
189#define SYMSTPCR2 0xe6158048
190#define SYMSTPCR2_CMT1 (1 << 29)
191
192void __init sh7367_add_early_devices(void)
193{
194 /* enable clock to CMT1 */
195 __raw_writel(__raw_readl(SYMSTPCR2) & ~SYMSTPCR2_CMT1, SYMSTPCR2);
196
197 early_platform_add_devices(sh7367_early_devices,
198 ARRAY_SIZE(sh7367_early_devices));
199}
200
201enum {
202 UNUSED = 0,
203
204 /* interrupt sources INTCA */
205
206 SCIFA0, SCIFA1, SCIFA2, SCIFA3, SCIFA4, SCIFA5, SCIFB,
207 CMT10,
208};
209
210static struct intc_vect vectors[] = {
211 INTC_VECT(CMT10, 0xb00),
212 INTC_VECT(SCIFA0, 0xc00), INTC_VECT(SCIFA1, 0xc20),
213 INTC_VECT(SCIFA2, 0xc40), INTC_VECT(SCIFA3, 0xc60),
214 INTC_VECT(SCIFA4, 0xd20), INTC_VECT(SCIFA5, 0xd40),
215 INTC_VECT(SCIFB, 0xd60),
216};
217
218static struct intc_mask_reg mask_registers[] = {
219 { 0xe6940094, 0xe69400d4, 8, /* IMR5A / IMCR5A */
220 { 0, 0, 0, 0, SCIFA3, SCIFA2, SCIFA1, SCIFA0 } },
221 { 0xe6940098, 0xe69400d8, 8, /* IMR6A / IMCR6A */
222 { SCIFB, SCIFA5, SCIFA4, 0, 0, 0, 0, 0 } },
223 { 0xe69400a4, 0xe69400e4, 8, /* IMR9A / IMCR9A */
224 { 0, 0, 0, CMT10, 0, 0, 0, 0 } },
225};
226
227static struct intc_prio_reg prio_registers[] = {
228 { 0xe6940014, 0, 16, 4, /* IPRFA */ { 0, 0, 0, CMT10 } },
229 { 0xe6940018, 0, 16, 4, /* IPRGA */ { SCIFA0, SCIFA1,
230 SCIFA2, SCIFA3 } },
231 { 0xe6940020, 0, 16, 4, /* IPRIA */ { 0, SCIFA4, 0, 0 } },
232 { 0xe6940034, 0, 16, 4, /* IPRNA */ { SCIFB, SCIFA5, 0, 0 } },
233};
234
235static DECLARE_INTC_DESC(intc_desc, "sh7367", vectors, NULL, mask_registers,
236 prio_registers, NULL);
237
238void __init sh7367_init_irq(void)
239{
240 register_intc_controller(&intc_desc);
241}
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
new file mode 100644
index 000000000000..895794b543cd
--- /dev/null
+++ b/arch/arm/mach-shmobile/timer.c
@@ -0,0 +1,46 @@
1/*
2 * SH-Mobile Timer
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2002 - 2009 Paul Mundt
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21#include <linux/platform_device.h>
22#include <asm/mach/time.h>
23
24static void __init shmobile_late_time_init(void)
25{
26 /*
27 * Make sure all compiled-in early timers register themselves.
28 *
29 * Run probe() for two "earlytimer" devices, these will be the
30 * clockevents and clocksource devices respectively. In the event
31 * that only a clockevents device is available, we -ENODEV on the
32 * clocksource and the jiffies clocksource is used transparently
33 * instead. No error handling is necessary here.
34 */
35 early_platform_driver_register_all("earlytimer");
36 early_platform_driver_probe("earlytimer", 2, 0);
37}
38
39static void __init shmobile_timer_init(void)
40{
41 late_time_init = shmobile_late_time_init;
42}
43
44struct sys_timer shmobile_timer = {
45 .init = shmobile_timer_init,
46};