diff options
author | Magnus Damm <damm@opensource.se> | 2010-11-17 05:59:31 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-11-18 01:45:21 -0500 |
commit | 6d9598e24d50a8c72f48a3864327484a30aaee44 (patch) | |
tree | 4ff6d28a73306df0fe4853833010ca58a8ab8450 | |
parent | 6d72ad35f1bfaf6e52ca7133cb51ce0e36f17528 (diff) |
ARM: mach-shmobile: Initial AG5 and AG5EVM support
This patch adds initial support for Renesas SH-Mobile AG5.
At this point the AG5 CPU support is limited to the ARM
core, SCIF serial and a CMT timer together with L2 cache
and the GIC. The AG5EVM board also supports Ethernet.
Future patches will add support for GPIO, INTCS, CPGA
and platform data / driver updates for devices such as
IIC, LCDC, FSI, KEYSC, CEU and SDHI among others.
The code in entry-macro.S will be cleaned up when the
ARM IRQ demux code improvements have been merged.
Depends on the AG5EVM mach-type recently registered but
not yet present in arch/arm/tools/mach-types.
As the AG5EVM board comes with 512MiB memory it is
recommended to turn on HIGHMEM.
Many thanks to Yoshii-san for initial bring up.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/arm/mach-shmobile/Kconfig | 12 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/board-ag5evm.c | 159 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/clock-sh73a0.c | 101 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/common.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/entry-macro.S | 78 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/irqs.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/sh73a0.h | 6 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/setup-sh73a0.c | 234 | ||||
-rw-r--r-- | arch/arm/mm/Kconfig | 2 | ||||
-rw-r--r-- | drivers/serial/sh-sci.h | 7 |
11 files changed, 607 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index cc543430170f..e397a92888f2 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig | |||
@@ -20,6 +20,12 @@ config ARCH_SH7372 | |||
20 | select SH_CLK_CPG | 20 | select SH_CLK_CPG |
21 | select ARCH_WANT_OPTIONAL_GPIOLIB | 21 | select ARCH_WANT_OPTIONAL_GPIOLIB |
22 | 22 | ||
23 | config ARCH_SH73A0 | ||
24 | bool "SH-Mobile AG5 (R8A73A00)" | ||
25 | select CPU_V7 | ||
26 | select SH_CLK_CPG | ||
27 | select ARM_GIC | ||
28 | |||
23 | comment "SH-Mobile Board Type" | 29 | comment "SH-Mobile Board Type" |
24 | 30 | ||
25 | config MACH_G3EVM | 31 | config MACH_G3EVM |
@@ -51,6 +57,10 @@ config AP4EVB_WVGA | |||
51 | 57 | ||
52 | endchoice | 58 | endchoice |
53 | 59 | ||
60 | config MACH_AG5EVM | ||
61 | bool "AG5EVM board" | ||
62 | depends on ARCH_SH73A0 | ||
63 | |||
54 | comment "SH-Mobile System Configuration" | 64 | comment "SH-Mobile System Configuration" |
55 | 65 | ||
56 | menu "Memory configuration" | 66 | menu "Memory configuration" |
@@ -60,6 +70,7 @@ config MEMORY_START | |||
60 | default "0x50000000" if MACH_G3EVM | 70 | default "0x50000000" if MACH_G3EVM |
61 | default "0x40000000" if MACH_G4EVM | 71 | default "0x40000000" if MACH_G4EVM |
62 | default "0x40000000" if MACH_AP4EVB | 72 | default "0x40000000" if MACH_AP4EVB |
73 | default "0x40000000" if MACH_AG5EVM | ||
63 | default "0x00000000" | 74 | default "0x00000000" |
64 | ---help--- | 75 | ---help--- |
65 | Tweak this only when porting to a new machine which does not | 76 | Tweak this only when porting to a new machine which does not |
@@ -71,6 +82,7 @@ config MEMORY_SIZE | |||
71 | default "0x08000000" if MACH_G3EVM | 82 | default "0x08000000" if MACH_G3EVM |
72 | default "0x08000000" if MACH_G4EVM | 83 | default "0x08000000" if MACH_G4EVM |
73 | default "0x10000000" if MACH_AP4EVB | 84 | default "0x10000000" if MACH_AP4EVB |
85 | default "0x20000000" if MACH_AG5EVM | ||
74 | default "0x04000000" | 86 | default "0x04000000" |
75 | help | 87 | help |
76 | This sets the default memory size assumed by your kernel. It can | 88 | This sets the default memory size assumed by your kernel. It can |
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile index ae416fe7daf2..7a8705ef6d8f 100644 --- a/arch/arm/mach-shmobile/Makefile +++ b/arch/arm/mach-shmobile/Makefile | |||
@@ -9,6 +9,7 @@ obj-y := timer.o console.o clock.o pm_runtime.o | |||
9 | obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o | 9 | obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o |
10 | obj-$(CONFIG_ARCH_SH7377) += setup-sh7377.o clock-sh7377.o intc-sh7377.o | 10 | obj-$(CONFIG_ARCH_SH7377) += setup-sh7377.o clock-sh7377.o intc-sh7377.o |
11 | obj-$(CONFIG_ARCH_SH7372) += setup-sh7372.o clock-sh7372.o intc-sh7372.o | 11 | obj-$(CONFIG_ARCH_SH7372) += setup-sh7372.o clock-sh7372.o intc-sh7372.o |
12 | obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o clock-sh73a0.o | ||
12 | 13 | ||
13 | # Pinmux setup | 14 | # Pinmux setup |
14 | pfc-$(CONFIG_ARCH_SH7367) := pfc-sh7367.o | 15 | pfc-$(CONFIG_ARCH_SH7367) := pfc-sh7367.o |
@@ -20,3 +21,4 @@ obj-$(CONFIG_GENERIC_GPIO) += $(pfc-y) | |||
20 | obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o | 21 | obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o |
21 | obj-$(CONFIG_MACH_G4EVM) += board-g4evm.o | 22 | obj-$(CONFIG_MACH_G4EVM) += board-g4evm.o |
22 | obj-$(CONFIG_MACH_AP4EVB) += board-ap4evb.o | 23 | obj-$(CONFIG_MACH_AP4EVB) += board-ap4evb.o |
24 | obj-$(CONFIG_MACH_AG5EVM) += board-ag5evm.o | ||
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c new file mode 100644 index 000000000000..bade04accc80 --- /dev/null +++ b/arch/arm/mach-shmobile/board-ag5evm.c | |||
@@ -0,0 +1,159 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-shmobile/board-ag5evm.c | ||
3 | * | ||
4 | * Copyright (C) 2010 Takashi Yoshii <yoshii.takashi.zj@renesas.com> | ||
5 | * Copyright (C) 2009 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> | ||
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 | |||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/irq.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/delay.h> | ||
28 | #include <linux/io.h> | ||
29 | #include <linux/dma-mapping.h> | ||
30 | #include <linux/serial_sci.h> | ||
31 | #include <linux/smsc911x.h> | ||
32 | #include <linux/gpio.h> | ||
33 | #include <mach/hardware.h> | ||
34 | #include <mach/sh73a0.h> | ||
35 | #include <mach/common.h> | ||
36 | #include <asm/mach-types.h> | ||
37 | #include <asm/mach/arch.h> | ||
38 | #include <asm/mach/map.h> | ||
39 | #include <asm/mach/time.h> | ||
40 | #include <asm/hardware/gic.h> | ||
41 | #include <asm/hardware/cache-l2x0.h> | ||
42 | #include <asm/traps.h> | ||
43 | |||
44 | static struct resource smsc9220_resources[] = { | ||
45 | [0] = { | ||
46 | .start = 0x14000000, | ||
47 | .end = 0x14000000 + SZ_64K - 1, | ||
48 | .flags = IORESOURCE_MEM, | ||
49 | }, | ||
50 | [1] = { | ||
51 | .start = gic_spi(33), /* PINT1 */ | ||
52 | .flags = IORESOURCE_IRQ, | ||
53 | }, | ||
54 | }; | ||
55 | |||
56 | static struct smsc911x_platform_config smsc9220_platdata = { | ||
57 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, | ||
58 | .phy_interface = PHY_INTERFACE_MODE_MII, | ||
59 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | ||
60 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, | ||
61 | }; | ||
62 | |||
63 | static struct platform_device eth_device = { | ||
64 | .name = "smsc911x", | ||
65 | .id = 0, | ||
66 | .dev = { | ||
67 | .platform_data = &smsc9220_platdata, | ||
68 | }, | ||
69 | .resource = smsc9220_resources, | ||
70 | .num_resources = ARRAY_SIZE(smsc9220_resources), | ||
71 | }; | ||
72 | |||
73 | static struct platform_device *ag5evm_devices[] __initdata = { | ||
74 | ð_device, | ||
75 | }; | ||
76 | |||
77 | static struct map_desc ag5evm_io_desc[] __initdata = { | ||
78 | /* create a 1:1 entity map for 0xe6xxxxxx | ||
79 | * used by CPGA, INTC and PFC. | ||
80 | */ | ||
81 | { | ||
82 | .virtual = 0xe6000000, | ||
83 | .pfn = __phys_to_pfn(0xe6000000), | ||
84 | .length = 256 << 20, | ||
85 | .type = MT_DEVICE_NONSHARED | ||
86 | }, | ||
87 | }; | ||
88 | |||
89 | static void __init ag5evm_map_io(void) | ||
90 | { | ||
91 | iotable_init(ag5evm_io_desc, ARRAY_SIZE(ag5evm_io_desc)); | ||
92 | |||
93 | /* setup early devices and console here as well */ | ||
94 | sh73a0_add_early_devices(); | ||
95 | shmobile_setup_console(); | ||
96 | } | ||
97 | |||
98 | #define PINTC_ADDR 0xe6900000 | ||
99 | #define PINTER0A (PINTC_ADDR + 0xa0) | ||
100 | #define PINTCR0A (PINTC_ADDR + 0xb0) | ||
101 | |||
102 | void __init ag5evm_init_irq(void) | ||
103 | { | ||
104 | /* setup PINT: enable PINTA2 as active low */ | ||
105 | __raw_writel(__raw_readl(PINTER0A) | (1<<29), PINTER0A); | ||
106 | __raw_writew(__raw_readw(PINTCR0A) | (2<<10), PINTCR0A); | ||
107 | |||
108 | gic_dist_init(0, __io(0xf0001000), 29); | ||
109 | gic_cpu_init(0, __io(0xf0000100)); | ||
110 | } | ||
111 | |||
112 | #define PORT144CR 0xe6052090 | ||
113 | #define PORT145CR 0xe6052091 | ||
114 | |||
115 | #define PORT154CR 0xe605209a | ||
116 | #define PORT155CR 0xe605209b | ||
117 | #define PORT156CR 0xe605209c | ||
118 | #define PORT157CR 0xe605209d | ||
119 | |||
120 | #define PORTR159_128DR 0xe6056004 | ||
121 | |||
122 | static void __init ag5evm_init(void) | ||
123 | { | ||
124 | /* enable SCIFA2 */ | ||
125 | __raw_writeb(0x12, PORT154CR); /* TXD */ | ||
126 | __raw_writeb(0x22, PORT155CR); /* RXD */ | ||
127 | __raw_writeb(0x12, PORT156CR); /* RTS */ | ||
128 | __raw_writeb(0x22, PORT157CR); /* CTS */ | ||
129 | |||
130 | /* enable SMSC911X */ | ||
131 | __raw_writeb(0x20, PORT144CR); /* PINTA2 */ | ||
132 | __raw_writeb(0x10, PORT145CR); /* RESET */ | ||
133 | __raw_writel(__raw_readl(PORTR159_128DR) & ~(1 << 17), PORTR159_128DR); | ||
134 | |||
135 | #ifdef CONFIG_CACHE_L2X0 | ||
136 | /* Shared attribute override enable, 64K*8way */ | ||
137 | l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff); | ||
138 | #endif | ||
139 | sh73a0_add_standard_devices(); | ||
140 | platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices)); | ||
141 | } | ||
142 | |||
143 | static void __init ag5evm_timer_init(void) | ||
144 | { | ||
145 | sh73a0_clock_init(); | ||
146 | shmobile_timer.init(); | ||
147 | return; | ||
148 | } | ||
149 | |||
150 | struct sys_timer ag5evm_timer = { | ||
151 | .init = ag5evm_timer_init, | ||
152 | }; | ||
153 | |||
154 | MACHINE_START(AG5EVM, "ag5evm") | ||
155 | .map_io = ag5evm_map_io, | ||
156 | .init_irq = ag5evm_init_irq, | ||
157 | .init_machine = ag5evm_init, | ||
158 | .timer = &ag5evm_timer, | ||
159 | MACHINE_END | ||
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c new file mode 100644 index 000000000000..f2390aefefe8 --- /dev/null +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * sh73a0 clock framework support | ||
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; either 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/io.h> | ||
22 | #include <linux/sh_clk.h> | ||
23 | #include <mach/common.h> | ||
24 | #include <asm/clkdev.h> | ||
25 | |||
26 | #define SMSTPCR0 0xe6150130 | ||
27 | #define SMSTPCR1 0xe6150134 | ||
28 | #define SMSTPCR2 0xe6150138 | ||
29 | #define SMSTPCR3 0xe615013c | ||
30 | #define SMSTPCR4 0xe6150140 | ||
31 | #define SMSTPCR5 0xe6150144 | ||
32 | |||
33 | /* Fixed 32 KHz root clock from EXTALR pin */ | ||
34 | static struct clk r_clk = { | ||
35 | .rate = 32768, | ||
36 | }; | ||
37 | |||
38 | /* Temporarily fixed 48 MHz SUB clock */ | ||
39 | static struct clk sub_clk = { | ||
40 | .rate = 48000000, | ||
41 | }; | ||
42 | |||
43 | static struct clk *main_clks[] = { | ||
44 | &r_clk, | ||
45 | &sub_clk, | ||
46 | }; | ||
47 | |||
48 | enum { MSTP219, | ||
49 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, | ||
50 | MSTP331, MSTP329, | ||
51 | MSTP_NR }; | ||
52 | |||
53 | #define MSTP(_parent, _reg, _bit, _flags) \ | ||
54 | SH_CLK_MSTP32(_parent, _reg, _bit, _flags) | ||
55 | |||
56 | static struct clk mstp_clks[MSTP_NR] = { | ||
57 | [MSTP219] = MSTP(&sub_clk, SMSTPCR2, 19, 0), /* SCIFA7 */ | ||
58 | [MSTP207] = MSTP(&sub_clk, SMSTPCR2, 7, 0), /* SCIFA5 */ | ||
59 | [MSTP206] = MSTP(&sub_clk, SMSTPCR2, 6, 0), /* SCIFB */ | ||
60 | [MSTP204] = MSTP(&sub_clk, SMSTPCR2, 4, 0), /* SCIFA0 */ | ||
61 | [MSTP203] = MSTP(&sub_clk, SMSTPCR2, 3, 0), /* SCIFA1 */ | ||
62 | [MSTP202] = MSTP(&sub_clk, SMSTPCR2, 2, 0), /* SCIFA2 */ | ||
63 | [MSTP201] = MSTP(&sub_clk, SMSTPCR2, 1, 0), /* SCIFA3 */ | ||
64 | [MSTP200] = MSTP(&sub_clk, SMSTPCR2, 0, 0), /* SCIFA4 */ | ||
65 | [MSTP331] = MSTP(&sub_clk, SMSTPCR3, 31, 0), /* SCIFA6 */ | ||
66 | [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ | ||
67 | }; | ||
68 | |||
69 | #define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } | ||
70 | |||
71 | static struct clk_lookup lookups[] = { | ||
72 | /* MSTP32 clocks */ | ||
73 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */ | ||
74 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ | ||
75 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ | ||
76 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ | ||
77 | CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */ | ||
78 | CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), /* SCIFA2 */ | ||
79 | CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */ | ||
80 | CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */ | ||
81 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */ | ||
82 | CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ | ||
83 | }; | ||
84 | |||
85 | void __init sh73a0_clock_init(void) | ||
86 | { | ||
87 | int k, ret = 0; | ||
88 | |||
89 | for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++) | ||
90 | ret = clk_register(main_clks[k]); | ||
91 | |||
92 | if (!ret) | ||
93 | ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); | ||
94 | |||
95 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); | ||
96 | |||
97 | if (!ret) | ||
98 | clk_init(); | ||
99 | else | ||
100 | panic("failed to setup sh73a0 clocks\n"); | ||
101 | } | ||
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index efeef778a875..f1dbcdca61ba 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h | |||
@@ -30,4 +30,8 @@ extern void sh7372_pinmux_init(void); | |||
30 | extern struct clk sh7372_extal1_clk; | 30 | extern struct clk sh7372_extal1_clk; |
31 | extern struct clk sh7372_extal2_clk; | 31 | extern struct clk sh7372_extal2_clk; |
32 | 32 | ||
33 | extern void sh73a0_add_early_devices(void); | ||
34 | extern void sh73a0_add_standard_devices(void); | ||
35 | extern void sh73a0_clock_init(void); | ||
36 | |||
33 | #endif /* __ARCH_MACH_COMMON_H */ | 37 | #endif /* __ARCH_MACH_COMMON_H */ |
diff --git a/arch/arm/mach-shmobile/include/mach/entry-macro.S b/arch/arm/mach-shmobile/include/mach/entry-macro.S index a285d13c7416..c0c264366d7a 100644 --- a/arch/arm/mach-shmobile/include/mach/entry-macro.S +++ b/arch/arm/mach-shmobile/include/mach/entry-macro.S | |||
@@ -20,6 +20,7 @@ | |||
20 | .macro disable_fiq | 20 | .macro disable_fiq |
21 | .endm | 21 | .endm |
22 | 22 | ||
23 | #if !defined(CONFIG_ARCH_SH73A0) | ||
23 | .macro get_irqnr_preamble, base, tmp | 24 | .macro get_irqnr_preamble, base, tmp |
24 | ldr \base, =INTFLGA | 25 | ldr \base, =INTFLGA |
25 | .endm | 26 | .endm |
@@ -37,3 +38,80 @@ | |||
37 | 38 | ||
38 | 1000: | 39 | 1000: |
39 | .endm | 40 | .endm |
41 | #else | ||
42 | /* | ||
43 | * arch/arm/mach-realview/include/mach/entry-macro.S | ||
44 | * | ||
45 | * Low-level IRQ helper macros for RealView platforms | ||
46 | * | ||
47 | * This file is licensed under the terms of the GNU General Public | ||
48 | * License version 2. This program is licensed "as is" without any | ||
49 | * warranty of any kind, whether express or implied. | ||
50 | */ | ||
51 | #include <asm/hardware/gic.h> | ||
52 | |||
53 | .macro get_irqnr_preamble, base, tmp | ||
54 | ldr \base, =(0xf0000100) | ||
55 | .endm | ||
56 | |||
57 | .macro arch_ret_to_user, tmp1, tmp2 | ||
58 | .endm | ||
59 | |||
60 | /* | ||
61 | * The interrupt numbering scheme is defined in the | ||
62 | * interrupt controller spec. To wit: | ||
63 | * | ||
64 | * Interrupts 0-15 are IPI | ||
65 | * 16-28 are reserved | ||
66 | * 29-31 are local. We allow 30 to be used for the watchdog. | ||
67 | * 32-1020 are global | ||
68 | * 1021-1022 are reserved | ||
69 | * 1023 is "spurious" (no interrupt) | ||
70 | * | ||
71 | * For now, we ignore all local interrupts so only return an interrupt if it's | ||
72 | * between 30 and 1020. The test_for_ipi routine below will pick up on IPIs. | ||
73 | * | ||
74 | * A simple read from the controller will tell us the number of the highest | ||
75 | * priority enabled interrupt. We then just need to check whether it is in the | ||
76 | * valid range for an IRQ (30-1020 inclusive). | ||
77 | */ | ||
78 | |||
79 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp | ||
80 | |||
81 | ldr \irqstat, [\base, #GIC_CPU_INTACK] | ||
82 | /* bits 12-10 = src CPU, 9-0 = int # */ | ||
83 | |||
84 | ldr \tmp, =1021 | ||
85 | bic \irqnr, \irqstat, #0x1c00 | ||
86 | cmp \irqnr, #29 | ||
87 | cmpcc \irqnr, \irqnr | ||
88 | cmpne \irqnr, \tmp | ||
89 | cmpcs \irqnr, \irqnr | ||
90 | |||
91 | .endm | ||
92 | |||
93 | /* We assume that irqstat (the raw value of the IRQ acknowledge | ||
94 | * register) is preserved from the macro above. | ||
95 | * If there is an IPI, we immediately signal end of interrupt on the | ||
96 | * controller, since this requires the original irqstat value which | ||
97 | * we won't easily be able to recreate later. | ||
98 | */ | ||
99 | |||
100 | .macro test_for_ipi, irqnr, irqstat, base, tmp | ||
101 | bic \irqnr, \irqstat, #0x1c00 | ||
102 | cmp \irqnr, #16 | ||
103 | strcc \irqstat, [\base, #GIC_CPU_EOI] | ||
104 | cmpcs \irqnr, \irqnr | ||
105 | .endm | ||
106 | |||
107 | /* As above, this assumes that irqstat and base are preserved.. */ | ||
108 | |||
109 | .macro test_for_ltirq, irqnr, irqstat, base, tmp | ||
110 | bic \irqnr, \irqstat, #0x1c00 | ||
111 | mov \tmp, #0 | ||
112 | cmp \irqnr, #29 | ||
113 | moveq \tmp, #1 | ||
114 | streq \irqstat, [\base, #GIC_CPU_EOI] | ||
115 | cmp \tmp, #0 | ||
116 | .endm | ||
117 | #endif | ||
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h index fa15b5f8a001..09e0ab7d343e 100644 --- a/arch/arm/mach-shmobile/include/mach/irqs.h +++ b/arch/arm/mach-shmobile/include/mach/irqs.h | |||
@@ -3,6 +3,9 @@ | |||
3 | 3 | ||
4 | #define NR_IRQS 512 | 4 | #define NR_IRQS 512 |
5 | 5 | ||
6 | /* GIC */ | ||
7 | #define gic_spi(nr) ((nr) + 32) | ||
8 | |||
6 | /* INTCA */ | 9 | /* INTCA */ |
7 | #define evt2irq(evt) (((evt) >> 5) - 16) | 10 | #define evt2irq(evt) (((evt) >> 5) - 16) |
8 | #define irq2evt(irq) (((irq) + 16) << 5) | 11 | #define irq2evt(irq) (((irq) + 16) << 5) |
diff --git a/arch/arm/mach-shmobile/include/mach/sh73a0.h b/arch/arm/mach-shmobile/include/mach/sh73a0.h new file mode 100644 index 000000000000..5d691fe5181c --- /dev/null +++ b/arch/arm/mach-shmobile/include/mach/sh73a0.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_SH73A0_H__ | ||
2 | #define __ASM_SH73A0_H__ | ||
3 | |||
4 | /* This will soon be replaced by pinmux enums */ | ||
5 | |||
6 | #endif /* __ASM_SH73A0_H__ */ | ||
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c new file mode 100644 index 000000000000..0bc110615aa9 --- /dev/null +++ b/arch/arm/mach-shmobile/setup-sh73a0.c | |||
@@ -0,0 +1,234 @@ | |||
1 | /* | ||
2 | * sh73a0 processor support | ||
3 | * | ||
4 | * Copyright (C) 2010 Takashi Yoshii | ||
5 | * Copyright (C) 2010 Magnus Damm | ||
6 | * Copyright (C) 2008 Yoshihiro Shimoda | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; version 2 of the License. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | */ | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/irq.h> | ||
25 | #include <linux/platform_device.h> | ||
26 | #include <linux/delay.h> | ||
27 | #include <linux/input.h> | ||
28 | #include <linux/io.h> | ||
29 | #include <linux/serial_sci.h> | ||
30 | #include <linux/sh_intc.h> | ||
31 | #include <linux/sh_timer.h> | ||
32 | #include <mach/hardware.h> | ||
33 | #include <asm/mach-types.h> | ||
34 | #include <asm/mach/arch.h> | ||
35 | |||
36 | static struct plat_sci_port scif0_platform_data = { | ||
37 | .mapbase = 0xe6c40000, | ||
38 | .flags = UPF_BOOT_AUTOCONF, | ||
39 | .type = PORT_SCIFA, | ||
40 | .irqs = { gic_spi(72), gic_spi(72), | ||
41 | gic_spi(72), gic_spi(72) }, | ||
42 | }; | ||
43 | |||
44 | static struct platform_device scif0_device = { | ||
45 | .name = "sh-sci", | ||
46 | .id = 0, | ||
47 | .dev = { | ||
48 | .platform_data = &scif0_platform_data, | ||
49 | }, | ||
50 | }; | ||
51 | |||
52 | static struct plat_sci_port scif1_platform_data = { | ||
53 | .mapbase = 0xe6c50000, | ||
54 | .flags = UPF_BOOT_AUTOCONF, | ||
55 | .type = PORT_SCIFA, | ||
56 | .irqs = { gic_spi(73), gic_spi(73), | ||
57 | gic_spi(73), gic_spi(73) }, | ||
58 | }; | ||
59 | |||
60 | static struct platform_device scif1_device = { | ||
61 | .name = "sh-sci", | ||
62 | .id = 1, | ||
63 | .dev = { | ||
64 | .platform_data = &scif1_platform_data, | ||
65 | }, | ||
66 | }; | ||
67 | |||
68 | static struct plat_sci_port scif2_platform_data = { | ||
69 | .mapbase = 0xe6c60000, | ||
70 | .flags = UPF_BOOT_AUTOCONF, | ||
71 | .type = PORT_SCIFA, | ||
72 | .irqs = { gic_spi(74), gic_spi(74), | ||
73 | gic_spi(74), gic_spi(74) }, | ||
74 | }; | ||
75 | |||
76 | static struct platform_device scif2_device = { | ||
77 | .name = "sh-sci", | ||
78 | .id = 2, | ||
79 | .dev = { | ||
80 | .platform_data = &scif2_platform_data, | ||
81 | }, | ||
82 | }; | ||
83 | |||
84 | static struct plat_sci_port scif3_platform_data = { | ||
85 | .mapbase = 0xe6c70000, | ||
86 | .flags = UPF_BOOT_AUTOCONF, | ||
87 | .type = PORT_SCIFA, | ||
88 | .irqs = { gic_spi(75), gic_spi(75), | ||
89 | gic_spi(75), gic_spi(75) }, | ||
90 | }; | ||
91 | |||
92 | static struct platform_device scif3_device = { | ||
93 | .name = "sh-sci", | ||
94 | .id = 3, | ||
95 | .dev = { | ||
96 | .platform_data = &scif3_platform_data, | ||
97 | }, | ||
98 | }; | ||
99 | |||
100 | static struct plat_sci_port scif4_platform_data = { | ||
101 | .mapbase = 0xe6c80000, | ||
102 | .flags = UPF_BOOT_AUTOCONF, | ||
103 | .type = PORT_SCIFA, | ||
104 | .irqs = { gic_spi(78), gic_spi(78), | ||
105 | gic_spi(78), gic_spi(78) }, | ||
106 | }; | ||
107 | |||
108 | static struct platform_device scif4_device = { | ||
109 | .name = "sh-sci", | ||
110 | .id = 4, | ||
111 | .dev = { | ||
112 | .platform_data = &scif4_platform_data, | ||
113 | }, | ||
114 | }; | ||
115 | |||
116 | static struct plat_sci_port scif5_platform_data = { | ||
117 | .mapbase = 0xe6cb0000, | ||
118 | .flags = UPF_BOOT_AUTOCONF, | ||
119 | .type = PORT_SCIFA, | ||
120 | .irqs = { gic_spi(79), gic_spi(79), | ||
121 | gic_spi(79), gic_spi(79) }, | ||
122 | }; | ||
123 | |||
124 | static struct platform_device scif5_device = { | ||
125 | .name = "sh-sci", | ||
126 | .id = 5, | ||
127 | .dev = { | ||
128 | .platform_data = &scif5_platform_data, | ||
129 | }, | ||
130 | }; | ||
131 | |||
132 | static struct plat_sci_port scif6_platform_data = { | ||
133 | .mapbase = 0xe6cc0000, | ||
134 | .flags = UPF_BOOT_AUTOCONF, | ||
135 | .type = PORT_SCIFA, | ||
136 | .irqs = { gic_spi(156), gic_spi(156), | ||
137 | gic_spi(156), gic_spi(156) }, | ||
138 | }; | ||
139 | |||
140 | static struct platform_device scif6_device = { | ||
141 | .name = "sh-sci", | ||
142 | .id = 6, | ||
143 | .dev = { | ||
144 | .platform_data = &scif6_platform_data, | ||
145 | }, | ||
146 | }; | ||
147 | |||
148 | static struct plat_sci_port scif7_platform_data = { | ||
149 | .mapbase = 0xe6cd0000, | ||
150 | .flags = UPF_BOOT_AUTOCONF, | ||
151 | .type = PORT_SCIFA, | ||
152 | .irqs = { gic_spi(143), gic_spi(143), | ||
153 | gic_spi(143), gic_spi(143) }, | ||
154 | }; | ||
155 | |||
156 | static struct platform_device scif7_device = { | ||
157 | .name = "sh-sci", | ||
158 | .id = 7, | ||
159 | .dev = { | ||
160 | .platform_data = &scif7_platform_data, | ||
161 | }, | ||
162 | }; | ||
163 | |||
164 | static struct plat_sci_port scif8_platform_data = { | ||
165 | .mapbase = 0xe6c30000, | ||
166 | .flags = UPF_BOOT_AUTOCONF, | ||
167 | .type = PORT_SCIFB, | ||
168 | .irqs = { gic_spi(80), gic_spi(80), | ||
169 | gic_spi(80), gic_spi(80) }, | ||
170 | }; | ||
171 | |||
172 | static struct platform_device scif8_device = { | ||
173 | .name = "sh-sci", | ||
174 | .id = 8, | ||
175 | .dev = { | ||
176 | .platform_data = &scif8_platform_data, | ||
177 | }, | ||
178 | }; | ||
179 | |||
180 | static struct sh_timer_config cmt10_platform_data = { | ||
181 | .name = "CMT10", | ||
182 | .channel_offset = 0x10, | ||
183 | .timer_bit = 0, | ||
184 | .clockevent_rating = 125, | ||
185 | .clocksource_rating = 125, | ||
186 | }; | ||
187 | |||
188 | static struct resource cmt10_resources[] = { | ||
189 | [0] = { | ||
190 | .name = "CMT10", | ||
191 | .start = 0xe6138010, | ||
192 | .end = 0xe613801b, | ||
193 | .flags = IORESOURCE_MEM, | ||
194 | }, | ||
195 | [1] = { | ||
196 | .start = gic_spi(65), | ||
197 | .flags = IORESOURCE_IRQ, | ||
198 | }, | ||
199 | }; | ||
200 | |||
201 | static struct platform_device cmt10_device = { | ||
202 | .name = "sh_cmt", | ||
203 | .id = 10, | ||
204 | .dev = { | ||
205 | .platform_data = &cmt10_platform_data, | ||
206 | }, | ||
207 | .resource = cmt10_resources, | ||
208 | .num_resources = ARRAY_SIZE(cmt10_resources), | ||
209 | }; | ||
210 | |||
211 | static struct platform_device *sh73a0_early_devices[] __initdata = { | ||
212 | &scif0_device, | ||
213 | &scif1_device, | ||
214 | &scif2_device, | ||
215 | &scif3_device, | ||
216 | &scif4_device, | ||
217 | &scif5_device, | ||
218 | &scif6_device, | ||
219 | &scif7_device, | ||
220 | &scif8_device, | ||
221 | &cmt10_device, | ||
222 | }; | ||
223 | |||
224 | void __init sh73a0_add_standard_devices(void) | ||
225 | { | ||
226 | platform_add_devices(sh73a0_early_devices, | ||
227 | ARRAY_SIZE(sh73a0_early_devices)); | ||
228 | } | ||
229 | |||
230 | void __init sh73a0_add_early_devices(void) | ||
231 | { | ||
232 | early_platform_add_devices(sh73a0_early_devices, | ||
233 | ARRAY_SIZE(sh73a0_early_devices)); | ||
234 | } | ||
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index 4414a01e1e8a..8206842ddd9e 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig | |||
@@ -772,7 +772,7 @@ config CACHE_L2X0 | |||
772 | depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || \ | 772 | depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || \ |
773 | REALVIEW_EB_A9MP || ARCH_MX35 || ARCH_MX31 || MACH_REALVIEW_PBX || \ | 773 | REALVIEW_EB_A9MP || ARCH_MX35 || ARCH_MX31 || MACH_REALVIEW_PBX || \ |
774 | ARCH_NOMADIK || ARCH_OMAP4 || ARCH_S5PV310 || ARCH_TEGRA || \ | 774 | ARCH_NOMADIK || ARCH_OMAP4 || ARCH_S5PV310 || ARCH_TEGRA || \ |
775 | ARCH_U8500 || ARCH_VEXPRESS_CA9X4 | 775 | ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || ARCH_SHMOBILE |
776 | default y | 776 | default y |
777 | select OUTER_CACHE | 777 | select OUTER_CACHE |
778 | select OUTER_CACHE_SYNC | 778 | select OUTER_CACHE_SYNC |
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index d2352ac437c5..4bc614e4221c 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h | |||
@@ -31,6 +31,7 @@ | |||
31 | # define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0 | 31 | # define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0 |
32 | #elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \ | 32 | #elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \ |
33 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ | 33 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ |
34 | defined(CONFIG_ARCH_SH73A0) || \ | ||
34 | defined(CONFIG_ARCH_SH7367) || \ | 35 | defined(CONFIG_ARCH_SH7367) || \ |
35 | defined(CONFIG_ARCH_SH7377) || \ | 36 | defined(CONFIG_ARCH_SH7377) || \ |
36 | defined(CONFIG_ARCH_SH7372) | 37 | defined(CONFIG_ARCH_SH7372) |
@@ -244,6 +245,7 @@ | |||
244 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ | 245 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
245 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ | 246 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ |
246 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ | 247 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ |
248 | defined(CONFIG_ARCH_SH73A0) || \ | ||
247 | defined(CONFIG_ARCH_SH7367) || \ | 249 | defined(CONFIG_ARCH_SH7367) || \ |
248 | defined(CONFIG_ARCH_SH7377) || \ | 250 | defined(CONFIG_ARCH_SH7377) || \ |
249 | defined(CONFIG_ARCH_SH7372) | 251 | defined(CONFIG_ARCH_SH7372) |
@@ -280,6 +282,7 @@ | |||
280 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ | 282 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
281 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ | 283 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ |
282 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ | 284 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ |
285 | defined(CONFIG_ARCH_SH73A0) || \ | ||
283 | defined(CONFIG_ARCH_SH7367) || \ | 286 | defined(CONFIG_ARCH_SH7367) || \ |
284 | defined(CONFIG_ARCH_SH7377) || \ | 287 | defined(CONFIG_ARCH_SH7377) || \ |
285 | defined(CONFIG_ARCH_SH7372) | 288 | defined(CONFIG_ARCH_SH7372) |
@@ -378,6 +381,7 @@ | |||
378 | } | 381 | } |
379 | 382 | ||
380 | #if defined(CONFIG_CPU_SH3) || \ | 383 | #if defined(CONFIG_CPU_SH3) || \ |
384 | defined(CONFIG_ARCH_SH73A0) || \ | ||
381 | defined(CONFIG_ARCH_SH7367) || \ | 385 | defined(CONFIG_ARCH_SH7367) || \ |
382 | defined(CONFIG_ARCH_SH7377) || \ | 386 | defined(CONFIG_ARCH_SH7377) || \ |
383 | defined(CONFIG_ARCH_SH7372) | 387 | defined(CONFIG_ARCH_SH7372) |
@@ -391,6 +395,7 @@ | |||
391 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ | 395 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
392 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ | 396 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ |
393 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ | 397 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ |
398 | defined(CONFIG_ARCH_SH73A0) || \ | ||
394 | defined(CONFIG_ARCH_SH7367) || \ | 399 | defined(CONFIG_ARCH_SH7367) || \ |
395 | defined(CONFIG_ARCH_SH7377) | 400 | defined(CONFIG_ARCH_SH7377) |
396 | #define SCIF_FNS(name, scif_offset, scif_size) \ | 401 | #define SCIF_FNS(name, scif_offset, scif_size) \ |
@@ -433,6 +438,7 @@ | |||
433 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ | 438 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
434 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ | 439 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ |
435 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ | 440 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ |
441 | defined(CONFIG_ARCH_SH73A0) || \ | ||
436 | defined(CONFIG_ARCH_SH7367) || \ | 442 | defined(CONFIG_ARCH_SH7367) || \ |
437 | defined(CONFIG_ARCH_SH7377) | 443 | defined(CONFIG_ARCH_SH7377) |
438 | 444 | ||
@@ -632,6 +638,7 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
632 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ | 638 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
633 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ | 639 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ |
634 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ | 640 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ |
641 | defined(CONFIG_ARCH_SH73A0) || \ | ||
635 | defined(CONFIG_ARCH_SH7367) || \ | 642 | defined(CONFIG_ARCH_SH7367) || \ |
636 | defined(CONFIG_ARCH_SH7377) || \ | 643 | defined(CONFIG_ARCH_SH7377) || \ |
637 | defined(CONFIG_ARCH_SH7372) | 644 | defined(CONFIG_ARCH_SH7372) |