irq.c 1.8 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10 11
/*
 * linux/arch/sh/boards/renesas/rts7751r2d/irq.c
 *
 * Copyright (C) 2000  Kazumoto Kojima
 *
 * Renesas Technology Sales RTS7751R2D Support.
 *
 * Modified for RTS7751R2D by
 * Atom Create Engineering Co., Ltd. 2002.
 */
#include <linux/init.h>
P
Paul Mundt 已提交
12
#include <linux/interrupt.h>
L
Linus Torvalds 已提交
13
#include <linux/irq.h>
P
Paul Mundt 已提交
14
#include <linux/interrupt.h>
P
Paul Mundt 已提交
15
#include <linux/io.h>
M
Magnus Damm 已提交
16
#include <asm/voyagergx.h>
P
Paul Mundt 已提交
17
#include <asm/rts7751r2d.h>
L
Linus Torvalds 已提交
18 19 20 21 22 23 24

#if defined(CONFIG_RTS7751R2D_REV11)
static int mask_pos[] = {11, 9, 8, 12, 10, 6, 5, 4, 7, 14, 13, 0, 0, 0, 0};
#else
static int mask_pos[] = {6, 11, 9, 8, 12, 10, 5, 4, 7, 14, 13, 0, 0, 0, 0};
#endif

P
Paul Mundt 已提交
25
static void enable_rts7751r2d_irq(unsigned int irq)
L
Linus Torvalds 已提交
26
{
P
Paul Mundt 已提交
27 28
	/* Set priority in IPR back to original value */
	ctrl_outw(ctrl_inw(IRLCNTR1) | (1 << mask_pos[irq]), IRLCNTR1);
L
Linus Torvalds 已提交
29 30 31 32 33
}

static void disable_rts7751r2d_irq(unsigned int irq)
{
	/* Set the priority in IPR to 0 */
P
Paul Mundt 已提交
34 35
	ctrl_outw(ctrl_inw(IRLCNTR1) & (0xffff ^ (1 << mask_pos[irq])),
		  IRLCNTR1);
L
Linus Torvalds 已提交
36 37 38 39
}

int rts7751r2d_irq_demux(int irq)
{
M
Magnus Damm 已提交
40
	return irq;
L
Linus Torvalds 已提交
41 42
}

P
Paul Mundt 已提交
43 44 45 46 47
static struct irq_chip rts7751r2d_irq_chip __read_mostly = {
	.name		= "rts7751r2d",
	.mask		= disable_rts7751r2d_irq,
	.unmask		= enable_rts7751r2d_irq,
	.mask_ack	= disable_rts7751r2d_irq,
L
Linus Torvalds 已提交
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
};

/*
 * Initialize IRQ setting
 */
void __init init_rts7751r2d_IRQ(void)
{
	int i;

	/* IRL0=KEY Input
	 * IRL1=Ethernet
	 * IRL2=CF Card
	 * IRL3=CF Card Insert
	 * IRL4=PCMCIA
	 * IRL5=VOYAGER
	 * IRL6=RTC Alarm
	 * IRL7=RTC Timer
	 * IRL8=SD Card
	 * IRL9=PCI Slot #1
	 * IRL10=PCI Slot #2
	 * IRL11=Extention #0
	 * IRL12=Extention #1
	 * IRL13=Extention #2
	 * IRL14=Extention #3
	 */

P
Paul Mundt 已提交
74 75 76 77 78 79
	for (i=0; i<15; i++) {
		disable_irq_nosync(i);
		set_irq_chip_and_handler_name(i, &rts7751r2d_irq_chip,
					      handle_level_irq, "level");
		enable_rts7751r2d_irq(i);
	}
L
Linus Torvalds 已提交
80 81 82

	setup_voyagergx_irq();
}