Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/sh/boards/renesas/rts7751r2d/irq.c |
| 3 | * |
| 4 | * Copyright (C) 2000 Kazumoto Kojima |
| 5 | * |
| 6 | * Renesas Technology Sales RTS7751R2D Support. |
| 7 | * |
| 8 | * Modified for RTS7751R2D by |
| 9 | * Atom Create Engineering Co., Ltd. 2002. |
| 10 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <linux/init.h> |
Paul Mundt | 9c57548 | 2007-02-15 18:20:52 +0900 | [diff] [blame] | 12 | #include <linux/interrupt.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/irq.h> |
Paul Mundt | 9c57548 | 2007-02-15 18:20:52 +0900 | [diff] [blame] | 14 | #include <linux/interrupt.h> |
Paul Mundt | 082c44d | 2006-10-19 16:16:18 +0900 | [diff] [blame] | 15 | #include <linux/io.h> |
Magnus Damm | 48180ca | 2007-08-03 14:27:20 +0900 | [diff] [blame^] | 16 | #include <asm/voyagergx.h> |
Paul Mundt | 082c44d | 2006-10-19 16:16:18 +0900 | [diff] [blame] | 17 | #include <asm/rts7751r2d.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | |
| 19 | #if defined(CONFIG_RTS7751R2D_REV11) |
| 20 | static int mask_pos[] = {11, 9, 8, 12, 10, 6, 5, 4, 7, 14, 13, 0, 0, 0, 0}; |
| 21 | #else |
| 22 | static int mask_pos[] = {6, 11, 9, 8, 12, 10, 5, 4, 7, 14, 13, 0, 0, 0, 0}; |
| 23 | #endif |
| 24 | |
Paul Mundt | 9c57548 | 2007-02-15 18:20:52 +0900 | [diff] [blame] | 25 | static void enable_rts7751r2d_irq(unsigned int irq) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | { |
Paul Mundt | 9c57548 | 2007-02-15 18:20:52 +0900 | [diff] [blame] | 27 | /* Set priority in IPR back to original value */ |
| 28 | ctrl_outw(ctrl_inw(IRLCNTR1) | (1 << mask_pos[irq]), IRLCNTR1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | static void disable_rts7751r2d_irq(unsigned int irq) |
| 32 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | /* Set the priority in IPR to 0 */ |
Paul Mundt | 9c57548 | 2007-02-15 18:20:52 +0900 | [diff] [blame] | 34 | ctrl_outw(ctrl_inw(IRLCNTR1) & (0xffff ^ (1 << mask_pos[irq])), |
| 35 | IRLCNTR1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | int rts7751r2d_irq_demux(int irq) |
| 39 | { |
Magnus Damm | 48180ca | 2007-08-03 14:27:20 +0900 | [diff] [blame^] | 40 | return irq; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | } |
| 42 | |
Paul Mundt | 9c57548 | 2007-02-15 18:20:52 +0900 | [diff] [blame] | 43 | static struct irq_chip rts7751r2d_irq_chip __read_mostly = { |
| 44 | .name = "rts7751r2d", |
| 45 | .mask = disable_rts7751r2d_irq, |
| 46 | .unmask = enable_rts7751r2d_irq, |
| 47 | .mask_ack = disable_rts7751r2d_irq, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | }; |
| 49 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | /* |
| 51 | * Initialize IRQ setting |
| 52 | */ |
| 53 | void __init init_rts7751r2d_IRQ(void) |
| 54 | { |
| 55 | int i; |
| 56 | |
| 57 | /* IRL0=KEY Input |
| 58 | * IRL1=Ethernet |
| 59 | * IRL2=CF Card |
| 60 | * IRL3=CF Card Insert |
| 61 | * IRL4=PCMCIA |
| 62 | * IRL5=VOYAGER |
| 63 | * IRL6=RTC Alarm |
| 64 | * IRL7=RTC Timer |
| 65 | * IRL8=SD Card |
| 66 | * IRL9=PCI Slot #1 |
| 67 | * IRL10=PCI Slot #2 |
| 68 | * IRL11=Extention #0 |
| 69 | * IRL12=Extention #1 |
| 70 | * IRL13=Extention #2 |
| 71 | * IRL14=Extention #3 |
| 72 | */ |
| 73 | |
Paul Mundt | 9c57548 | 2007-02-15 18:20:52 +0900 | [diff] [blame] | 74 | for (i=0; i<15; i++) { |
| 75 | disable_irq_nosync(i); |
| 76 | set_irq_chip_and_handler_name(i, &rts7751r2d_irq_chip, |
| 77 | handle_level_irq, "level"); |
| 78 | enable_rts7751r2d_irq(i); |
| 79 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | |
| 81 | setup_voyagergx_irq(); |
| 82 | } |