]>
Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
f30c2269 | 2 | * linux/arch/sh/boards/renesas/systemh/irq.c |
1da177e4 LT |
3 | * |
4 | * Copyright (C) 2000 Kazumoto Kojima | |
5 | * | |
6 | * Hitachi SystemH Support. | |
7 | * | |
8 | * Modified for 7751 SystemH by | |
9 | * Jonathan Short. | |
10 | */ | |
11 | ||
1da177e4 LT |
12 | #include <linux/init.h> |
13 | #include <linux/irq.h> | |
0e25f710 | 14 | #include <linux/interrupt.h> |
bd0a22d2 | 15 | #include <linux/io.h> |
1da177e4 | 16 | |
7639a454 | 17 | #include <mach/systemh7751.h> |
1da177e4 LT |
18 | #include <asm/smc37c93x.h> |
19 | ||
20 | /* address of external interrupt mask register | |
21 | * address must be set prior to use these (maybe in init_XXX_irq()) | |
22 | * XXX : is it better to use .config than specifying it in code? */ | |
23 | static unsigned long *systemh_irq_mask_register = (unsigned long *)0xB3F10004; | |
24 | static unsigned long *systemh_irq_request_register = (unsigned long *)0xB3F10000; | |
25 | ||
5f010384 | 26 | static void disable_systemh_irq(struct irq_data *data) |
1da177e4 | 27 | { |
5f010384 | 28 | unsigned long val, mask = 0x01 << 1; |
1da177e4 | 29 | |
5f010384 PM |
30 | /* Clear the "irq"th bit in the mask and set it in the request */ |
31 | val = __raw_readl((unsigned long)systemh_irq_mask_register); | |
32 | val &= ~mask; | |
33 | __raw_writel(val, (unsigned long)systemh_irq_mask_register); | |
1da177e4 | 34 | |
5f010384 PM |
35 | val = __raw_readl((unsigned long)systemh_irq_request_register); |
36 | val |= mask; | |
37 | __raw_writel(val, (unsigned long)systemh_irq_request_register); | |
1da177e4 LT |
38 | } |
39 | ||
5f010384 | 40 | static void enable_systemh_irq(struct irq_data *data) |
1da177e4 | 41 | { |
5f010384 | 42 | unsigned long val, mask = 0x01 << 1; |
1da177e4 | 43 | |
5f010384 PM |
44 | /* Set "irq"th bit in the mask register */ |
45 | val = __raw_readl((unsigned long)systemh_irq_mask_register); | |
46 | val |= mask; | |
47 | __raw_writel(val, (unsigned long)systemh_irq_mask_register); | |
1da177e4 LT |
48 | } |
49 | ||
5f010384 PM |
50 | static struct irq_chip systemh_irq_type = { |
51 | .name = "SystemH Register", | |
52 | .irq_unmask = enable_systemh_irq, | |
53 | .irq_mask = disable_systemh_irq, | |
54 | }; | |
1da177e4 | 55 | |
1da177e4 LT |
56 | void make_systemh_irq(unsigned int irq) |
57 | { | |
58 | disable_irq_nosync(irq); | |
bd0a22d2 | 59 | set_irq_chip_and_handler(irq, &systemh_irq_type, handle_level_irq); |
5f010384 | 60 | disable_systemh_irq(irq_get_irq_data(irq)); |
1da177e4 | 61 | } |