blob: 0bae9041acebaa04e9a9dede1593096267bb2750 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 Torvalds1da177e2005-04-16 15:20:36 -070011#include <linux/init.h>
Paul Mundt9c575482007-02-15 18:20:52 +090012#include <linux/interrupt.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/irq.h>
Paul Mundt9c575482007-02-15 18:20:52 +090014#include <linux/interrupt.h>
Paul Mundt082c44d2006-10-19 16:16:18 +090015#include <linux/io.h>
16#include <asm/rts7751r2d.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
18#if defined(CONFIG_RTS7751R2D_REV11)
19static int mask_pos[] = {11, 9, 8, 12, 10, 6, 5, 4, 7, 14, 13, 0, 0, 0, 0};
20#else
21static int mask_pos[] = {6, 11, 9, 8, 12, 10, 5, 4, 7, 14, 13, 0, 0, 0, 0};
22#endif
23
24extern int voyagergx_irq_demux(int irq);
25extern void setup_voyagergx_irq(void);
26
Paul Mundt9c575482007-02-15 18:20:52 +090027static void enable_rts7751r2d_irq(unsigned int irq)
Linus Torvalds1da177e2005-04-16 15:20:36 -070028{
Paul Mundt9c575482007-02-15 18:20:52 +090029 /* Set priority in IPR back to original value */
30 ctrl_outw(ctrl_inw(IRLCNTR1) | (1 << mask_pos[irq]), IRLCNTR1);
Linus Torvalds1da177e2005-04-16 15:20:36 -070031}
32
33static void disable_rts7751r2d_irq(unsigned int irq)
34{
Linus Torvalds1da177e2005-04-16 15:20:36 -070035 /* Set the priority in IPR to 0 */
Paul Mundt9c575482007-02-15 18:20:52 +090036 ctrl_outw(ctrl_inw(IRLCNTR1) & (0xffff ^ (1 << mask_pos[irq])),
37 IRLCNTR1);
Linus Torvalds1da177e2005-04-16 15:20:36 -070038}
39
40int rts7751r2d_irq_demux(int irq)
41{
Paul Mundt9c575482007-02-15 18:20:52 +090042 return voyagergx_irq_demux(irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070043}
44
Paul Mundt9c575482007-02-15 18:20:52 +090045static struct irq_chip rts7751r2d_irq_chip __read_mostly = {
46 .name = "rts7751r2d",
47 .mask = disable_rts7751r2d_irq,
48 .unmask = enable_rts7751r2d_irq,
49 .mask_ack = disable_rts7751r2d_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -070050};
51
Linus Torvalds1da177e2005-04-16 15:20:36 -070052/*
53 * Initialize IRQ setting
54 */
55void __init init_rts7751r2d_IRQ(void)
56{
57 int i;
58
59 /* IRL0=KEY Input
60 * IRL1=Ethernet
61 * IRL2=CF Card
62 * IRL3=CF Card Insert
63 * IRL4=PCMCIA
64 * IRL5=VOYAGER
65 * IRL6=RTC Alarm
66 * IRL7=RTC Timer
67 * IRL8=SD Card
68 * IRL9=PCI Slot #1
69 * IRL10=PCI Slot #2
70 * IRL11=Extention #0
71 * IRL12=Extention #1
72 * IRL13=Extention #2
73 * IRL14=Extention #3
74 */
75
Paul Mundt9c575482007-02-15 18:20:52 +090076 for (i=0; i<15; i++) {
77 disable_irq_nosync(i);
78 set_irq_chip_and_handler_name(i, &rts7751r2d_irq_chip,
79 handle_level_irq, "level");
80 enable_rts7751r2d_irq(i);
81 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070082
83 setup_voyagergx_irq();
84}