diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2012-05-12 16:20:36 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2012-05-12 16:20:36 -0400 |
commit | 15d2c83948a3f47095017dbcf2060132bcd8c00c (patch) | |
tree | 9652e40ee1a8fb09555bdeff645157a679577730 | |
parent | e994d5eb7c3e45e13eb4fc882a47238f8dc4d63e (diff) | |
parent | 3b7b70552afe351a8bd8fff1eb2d60aab2206576 (diff) |
Merge branch 'renesas-dt' into renesas-soc-core
* renesas-dt:
ARM: mach-shmobile: sh7372 generic board support via DT V2
ARM: mach-shmobile: Rework sh7372 INTCS demuxer V2
ARM: mach-shmobile: Use INTC_IRQ_PINS_16H on sh7372
ARM: mach-shmobile: Use 0x3400 as INTCS vector offset
ARM: mach-shmobile: Introduce INTC_IRQ_PINS_16H
ARM: mach-shmobile: Introduce shmobile_setup_delay()
-rw-r--r-- | arch/arm/boot/dts/sh7372.dtsi | 21 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/common.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/intc.h | 44 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/irqs.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/intc-sh7372.c | 34 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/setup-sh7372.c | 48 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/timer.c | 17 |
7 files changed, 155 insertions, 13 deletions
diff --git a/arch/arm/boot/dts/sh7372.dtsi b/arch/arm/boot/dts/sh7372.dtsi new file mode 100644 index 000000000000..677fc603f8b3 --- /dev/null +++ b/arch/arm/boot/dts/sh7372.dtsi | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Device Tree Source for the sh7372 SoC | ||
3 | * | ||
4 | * Copyright (C) 2012 Renesas Solutions Corp. | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public License | ||
7 | * version 2. This program is licensed "as is" without any warranty of any | ||
8 | * kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | /include/ "skeleton.dtsi" | ||
12 | |||
13 | / { | ||
14 | compatible = "renesas,sh7372"; | ||
15 | |||
16 | cpus { | ||
17 | cpu@0 { | ||
18 | compatible = "arm,cortex-a8"; | ||
19 | }; | ||
20 | }; | ||
21 | }; | ||
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index c85e6ecda606..ff5f12fd742f 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | extern void shmobile_earlytimer_init(void); | 4 | extern void shmobile_earlytimer_init(void); |
5 | extern struct sys_timer shmobile_timer; | 5 | extern struct sys_timer shmobile_timer; |
6 | extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz, | ||
7 | unsigned int mult, unsigned int div); | ||
6 | struct twd_local_timer; | 8 | struct twd_local_timer; |
7 | extern void shmobile_setup_console(void); | 9 | extern void shmobile_setup_console(void); |
8 | extern void shmobile_secondary_vector(void); | 10 | extern void shmobile_secondary_vector(void); |
diff --git a/arch/arm/mach-shmobile/include/mach/intc.h b/arch/arm/mach-shmobile/include/mach/intc.h index 8b22258c8caa..a5603c76cfe0 100644 --- a/arch/arm/mach-shmobile/include/mach/intc.h +++ b/arch/arm/mach-shmobile/include/mach/intc.h | |||
@@ -142,6 +142,50 @@ static struct intc_desc p ## _desc __initdata = { \ | |||
142 | p ## _sense_registers, p ## _ack_registers) \ | 142 | p ## _sense_registers, p ## _ack_registers) \ |
143 | } | 143 | } |
144 | 144 | ||
145 | #define INTC_IRQ_PINS_16H(p, base, vect, str) \ | ||
146 | \ | ||
147 | static struct resource p ## _resources[] __initdata = { \ | ||
148 | [0] = { \ | ||
149 | .start = base, \ | ||
150 | .end = base + 0x64, \ | ||
151 | .flags = IORESOURCE_MEM, \ | ||
152 | }, \ | ||
153 | }; \ | ||
154 | \ | ||
155 | enum { \ | ||
156 | p ## _UNUSED = 0, \ | ||
157 | INTC_IRQ_PINS_ENUM_16H(p), \ | ||
158 | }; \ | ||
159 | \ | ||
160 | static struct intc_vect p ## _vectors[] __initdata = { \ | ||
161 | INTC_IRQ_PINS_VECT_16H(p, vect), \ | ||
162 | }; \ | ||
163 | \ | ||
164 | static struct intc_mask_reg p ## _mask_registers[] __initdata = { \ | ||
165 | INTC_IRQ_PINS_MASK_16H(p, base), \ | ||
166 | }; \ | ||
167 | \ | ||
168 | static struct intc_prio_reg p ## _prio_registers[] __initdata = { \ | ||
169 | INTC_IRQ_PINS_PRIO_16H(p, base), \ | ||
170 | }; \ | ||
171 | \ | ||
172 | static struct intc_sense_reg p ## _sense_registers[] __initdata = { \ | ||
173 | INTC_IRQ_PINS_SENSE_16H(p, base), \ | ||
174 | }; \ | ||
175 | \ | ||
176 | static struct intc_mask_reg p ## _ack_registers[] __initdata = { \ | ||
177 | INTC_IRQ_PINS_ACK_16H(p, base), \ | ||
178 | }; \ | ||
179 | \ | ||
180 | static struct intc_desc p ## _desc __initdata = { \ | ||
181 | .name = str, \ | ||
182 | .resource = p ## _resources, \ | ||
183 | .num_resources = ARRAY_SIZE(p ## _resources), \ | ||
184 | .hw = INTC_HW_DESC(p ## _vectors, NULL, \ | ||
185 | p ## _mask_registers, p ## _prio_registers, \ | ||
186 | p ## _sense_registers, p ## _ack_registers) \ | ||
187 | } | ||
188 | |||
145 | #define INTC_IRQ_PINS_32(p, base, vect, str) \ | 189 | #define INTC_IRQ_PINS_32(p, base, vect, str) \ |
146 | \ | 190 | \ |
147 | static struct resource p ## _resources[] __initdata = { \ | 191 | static struct resource p ## _resources[] __initdata = { \ |
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h index 4e686cc201fc..06a5da3c3050 100644 --- a/arch/arm/mach-shmobile/include/mach/irqs.h +++ b/arch/arm/mach-shmobile/include/mach/irqs.h | |||
@@ -7,7 +7,7 @@ | |||
7 | #define gic_spi(nr) ((nr) + 32) | 7 | #define gic_spi(nr) ((nr) + 32) |
8 | 8 | ||
9 | /* INTCS */ | 9 | /* INTCS */ |
10 | #define INTCS_VECT_BASE 0x2200 | 10 | #define INTCS_VECT_BASE 0x3400 |
11 | #define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect)) | 11 | #define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect)) |
12 | #define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt)) | 12 | #define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt)) |
13 | 13 | ||
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c index 6447e0af52d4..2587a22842f2 100644 --- a/arch/arm/mach-shmobile/intc-sh7372.c +++ b/arch/arm/mach-shmobile/intc-sh7372.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
22 | #include <linux/module.h> | ||
22 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
23 | #include <linux/io.h> | 24 | #include <linux/io.h> |
24 | #include <linux/sh_intc.h> | 25 | #include <linux/sh_intc.h> |
@@ -305,14 +306,16 @@ static DECLARE_INTC_DESC(intca_desc, "sh7372-intca", | |||
305 | intca_mask_registers, intca_prio_registers, | 306 | intca_mask_registers, intca_prio_registers, |
306 | NULL); | 307 | NULL); |
307 | 308 | ||
308 | INTC_IRQ_PINS_32(intca_irq_pins, 0xe6900000, | 309 | INTC_IRQ_PINS_16(intca_irq_pins_lo, 0xe6900000, |
309 | INTC_VECT, "sh7372-intca-irq-pins"); | 310 | INTC_VECT, "sh7372-intca-irq-lo"); |
311 | |||
312 | INTC_IRQ_PINS_16H(intca_irq_pins_hi, 0xe6900000, | ||
313 | INTC_VECT, "sh7372-intca-irq-hi"); | ||
314 | |||
310 | enum { | 315 | enum { |
311 | UNUSED_INTCS = 0, | 316 | UNUSED_INTCS = 0, |
312 | ENABLED_INTCS, | 317 | ENABLED_INTCS, |
313 | 318 | ||
314 | INTCS, | ||
315 | |||
316 | /* interrupt sources INTCS */ | 319 | /* interrupt sources INTCS */ |
317 | 320 | ||
318 | /* IRQ0S - IRQ31S */ | 321 | /* IRQ0S - IRQ31S */ |
@@ -426,8 +429,6 @@ static struct intc_vect intcs_vectors[] = { | |||
426 | INTCS_VECT(CPORTS2R, 0x1a20), | 429 | INTCS_VECT(CPORTS2R, 0x1a20), |
427 | /* CEC */ | 430 | /* CEC */ |
428 | INTCS_VECT(JPU6E, 0x1a80), | 431 | INTCS_VECT(JPU6E, 0x1a80), |
429 | |||
430 | INTC_VECT(INTCS, 0xf80), | ||
431 | }; | 432 | }; |
432 | 433 | ||
433 | static struct intc_group intcs_groups[] __initdata = { | 434 | static struct intc_group intcs_groups[] __initdata = { |
@@ -490,9 +491,6 @@ static struct intc_mask_reg intcs_mask_registers[] = { | |||
490 | { 0xffd5019c, 0xffd501dc, 8, /* IMR7SA3 / IMCR7SA3 */ | 491 | { 0xffd5019c, 0xffd501dc, 8, /* IMR7SA3 / IMCR7SA3 */ |
491 | { MFIS2_INTCS, CPORTS2R, 0, 0, | 492 | { MFIS2_INTCS, CPORTS2R, 0, 0, |
492 | JPU6E, 0, 0, 0 } }, | 493 | JPU6E, 0, 0, 0 } }, |
493 | { 0xffd20104, 0, 16, /* INTAMASK */ | ||
494 | { 0, 0, 0, 0, 0, 0, 0, 0, | ||
495 | 0, 0, 0, 0, 0, 0, 0, INTCS } }, | ||
496 | }; | 494 | }; |
497 | 495 | ||
498 | /* Priority is needed for INTCA to receive the INTCS interrupt */ | 496 | /* Priority is needed for INTCA to receive the INTCS interrupt */ |
@@ -557,18 +555,30 @@ static void __iomem *intcs_ffd5; | |||
557 | void __init sh7372_init_irq(void) | 555 | void __init sh7372_init_irq(void) |
558 | { | 556 | { |
559 | void __iomem *intevtsa; | 557 | void __iomem *intevtsa; |
558 | int n; | ||
560 | 559 | ||
561 | intcs_ffd2 = ioremap_nocache(0xffd20000, PAGE_SIZE); | 560 | intcs_ffd2 = ioremap_nocache(0xffd20000, PAGE_SIZE); |
562 | intevtsa = intcs_ffd2 + 0x100; | 561 | intevtsa = intcs_ffd2 + 0x100; |
563 | intcs_ffd5 = ioremap_nocache(0xffd50000, PAGE_SIZE); | 562 | intcs_ffd5 = ioremap_nocache(0xffd50000, PAGE_SIZE); |
564 | 563 | ||
565 | register_intc_controller(&intca_desc); | 564 | register_intc_controller(&intca_desc); |
566 | register_intc_controller(&intca_irq_pins_desc); | 565 | register_intc_controller(&intca_irq_pins_lo_desc); |
566 | register_intc_controller(&intca_irq_pins_hi_desc); | ||
567 | register_intc_controller(&intcs_desc); | 567 | register_intc_controller(&intcs_desc); |
568 | 568 | ||
569 | /* setup dummy cascade chip for INTCS */ | ||
570 | n = evt2irq(0xf80); | ||
571 | irq_alloc_desc_at(n, numa_node_id()); | ||
572 | irq_set_chip_and_handler_name(n, &dummy_irq_chip, | ||
573 | handle_level_irq, "level"); | ||
574 | set_irq_flags(n, IRQF_VALID); /* yuck */ | ||
575 | |||
569 | /* demux using INTEVTSA */ | 576 | /* demux using INTEVTSA */ |
570 | irq_set_handler_data(evt2irq(0xf80), (void *)intevtsa); | 577 | irq_set_handler_data(n, (void *)intevtsa); |
571 | irq_set_chained_handler(evt2irq(0xf80), intcs_demux); | 578 | irq_set_chained_handler(n, intcs_demux); |
579 | |||
580 | /* unmask INTCS in INTAMASK */ | ||
581 | iowrite16(0, intcs_ffd2 + 0x104); | ||
572 | } | 582 | } |
573 | 583 | ||
574 | static unsigned short ffd2[0x200]; | 584 | static unsigned short ffd2[0x200]; |
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c index 2fe8f83ca124..4c7fece5ef92 100644 --- a/arch/arm/mach-shmobile/setup-sh7372.c +++ b/arch/arm/mach-shmobile/setup-sh7372.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/of_platform.h> | ||
25 | #include <linux/uio_driver.h> | 26 | #include <linux/uio_driver.h> |
26 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
27 | #include <linux/input.h> | 28 | #include <linux/input.h> |
@@ -1092,3 +1093,50 @@ void __init sh7372_add_early_devices(void) | |||
1092 | /* override timer setup with soc-specific code */ | 1093 | /* override timer setup with soc-specific code */ |
1093 | shmobile_timer.init = sh7372_earlytimer_init; | 1094 | shmobile_timer.init = sh7372_earlytimer_init; |
1094 | } | 1095 | } |
1096 | |||
1097 | #ifdef CONFIG_USE_OF | ||
1098 | |||
1099 | void __init sh7372_add_early_devices_dt(void) | ||
1100 | { | ||
1101 | shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */ | ||
1102 | |||
1103 | early_platform_add_devices(sh7372_early_devices, | ||
1104 | ARRAY_SIZE(sh7372_early_devices)); | ||
1105 | |||
1106 | /* setup early console here as well */ | ||
1107 | shmobile_setup_console(); | ||
1108 | } | ||
1109 | |||
1110 | static const struct of_dev_auxdata sh7372_auxdata_lookup[] __initconst = { | ||
1111 | { } | ||
1112 | }; | ||
1113 | |||
1114 | void __init sh7372_add_standard_devices_dt(void) | ||
1115 | { | ||
1116 | /* clocks are setup late during boot in the case of DT */ | ||
1117 | sh7372_clock_init(); | ||
1118 | |||
1119 | platform_add_devices(sh7372_early_devices, | ||
1120 | ARRAY_SIZE(sh7372_early_devices)); | ||
1121 | |||
1122 | of_platform_populate(NULL, of_default_bus_match_table, | ||
1123 | sh7372_auxdata_lookup, NULL); | ||
1124 | } | ||
1125 | |||
1126 | static const char *sh7372_boards_compat_dt[] __initdata = { | ||
1127 | "renesas,sh7372", | ||
1128 | NULL, | ||
1129 | }; | ||
1130 | |||
1131 | DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)") | ||
1132 | .map_io = sh7372_map_io, | ||
1133 | .init_early = sh7372_add_early_devices_dt, | ||
1134 | .nr_irqs = NR_IRQS_LEGACY, | ||
1135 | .init_irq = sh7372_init_irq, | ||
1136 | .handle_irq = shmobile_handle_irq_intc, | ||
1137 | .init_machine = sh7372_add_standard_devices_dt, | ||
1138 | .timer = &shmobile_timer, | ||
1139 | .dt_compat = sh7372_boards_compat_dt, | ||
1140 | MACHINE_END | ||
1141 | |||
1142 | #endif /* CONFIG_USE_OF */ | ||
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c index 8b79e7917a23..cba39d866687 100644 --- a/arch/arm/mach-shmobile/timer.c +++ b/arch/arm/mach-shmobile/timer.c | |||
@@ -19,9 +19,26 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/delay.h> | ||
22 | #include <asm/mach/time.h> | 23 | #include <asm/mach/time.h> |
23 | #include <asm/smp_twd.h> | 24 | #include <asm/smp_twd.h> |
24 | 25 | ||
26 | void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz, | ||
27 | unsigned int mult, unsigned int div) | ||
28 | { | ||
29 | /* calculate a worst-case loops-per-jiffy value | ||
30 | * based on maximum cpu core mhz setting and the | ||
31 | * __delay() implementation in arch/arm/lib/delay.S | ||
32 | * | ||
33 | * this will result in a longer delay than expected | ||
34 | * when the cpu core runs on lower frequencies. | ||
35 | */ | ||
36 | |||
37 | unsigned int value = (1000000 * mult) / (HZ * div); | ||
38 | |||
39 | lpj_fine = max_cpu_core_mhz * value; | ||
40 | } | ||
41 | |||
25 | static void __init shmobile_late_time_init(void) | 42 | static void __init shmobile_late_time_init(void) |
26 | { | 43 | { |
27 | /* | 44 | /* |