Commit | Line | Data |
---|---|---|
5283ecb5 | 1 | /* |
5283ecb5 PM |
2 | * Renesas Solutions Highlander R7780RP-1 Support. |
3 | * | |
257440b0 PM |
4 | * Copyright (C) 2002 Atom Create Engineering Co., Ltd. |
5 | * Copyright (C) 2006 Paul Mundt | |
6 | * | |
7 | * This file is subject to the terms and conditions of the GNU General Public | |
8 | * License. See the file "COPYING" in the main directory of this archive | |
9 | * for more details. | |
5283ecb5 | 10 | */ |
5283ecb5 PM |
11 | #include <linux/init.h> |
12 | #include <linux/irq.h> | |
9a7ef6d5 | 13 | #include <linux/interrupt.h> |
082c44d2 PM |
14 | #include <linux/io.h> |
15 | #include <asm/r7780rp.h> | |
5283ecb5 PM |
16 | |
17 | #ifdef CONFIG_SH_R7780MP | |
18 | static int mask_pos[] = {12, 11, 9, 14, 15, 8, 13, 6, 5, 4, 3, 2, 0, 0, 1, 0}; | |
19 | #else | |
20 | static int mask_pos[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 5, 6, 4, 0, 1, 2, 0}; | |
21 | #endif | |
22 | ||
5283ecb5 PM |
23 | static void enable_r7780rp_irq(unsigned int irq) |
24 | { | |
5283ecb5 | 25 | /* Set priority in IPR back to original value */ |
257440b0 | 26 | ctrl_outw(ctrl_inw(IRLCNTR1) | (1 << mask_pos[irq]), IRLCNTR1); |
5283ecb5 PM |
27 | } |
28 | ||
257440b0 | 29 | static void disable_r7780rp_irq(unsigned int irq) |
5283ecb5 | 30 | { |
257440b0 PM |
31 | /* Set the priority in IPR to 0 */ |
32 | ctrl_outw(ctrl_inw(IRLCNTR1) & (0xffff ^ (1 << mask_pos[irq])), | |
33 | IRLCNTR1); | |
5283ecb5 PM |
34 | } |
35 | ||
257440b0 | 36 | static struct irq_chip r7780rp_irq_chip __read_mostly = { |
709bc44c | 37 | .name = "R7780RP", |
257440b0 PM |
38 | .mask = disable_r7780rp_irq, |
39 | .unmask = enable_r7780rp_irq, | |
40 | .mask_ack = disable_r7780rp_irq, | |
5283ecb5 PM |
41 | }; |
42 | ||
5283ecb5 PM |
43 | /* |
44 | * Initialize IRQ setting | |
45 | */ | |
46 | void __init init_r7780rp_IRQ(void) | |
47 | { | |
48 | int i; | |
49 | ||
257440b0 PM |
50 | for (i = 0; i < 15; i++) { |
51 | disable_irq_nosync(i); | |
709bc44c PM |
52 | set_irq_chip_and_handler_name(i, &r7780rp_irq_chip, |
53 | handle_level_irq, "level"); | |
8884c4cb | 54 | enable_r7780rp_irq(i); |
257440b0 | 55 | } |
5283ecb5 | 56 | } |