irq.c 1.3 KB
Newer Older
K
kogiidena 已提交
1 2 3
/*
 * arch/sh/boards/landisk/irq.c
 *
K
kogiidena 已提交
4 5 6 7
 * I-O DATA Device, Inc. LANDISK Support
 *
 * Copyright (C) 2005-2007 kogiidena
 *
K
kogiidena 已提交
8 9 10
 * Copyright (C) 2001  Ian da Silva, Jeremy Siegel
 * Based largely on io_se.c.
 *
K
kogiidena 已提交
11 12 13
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
K
kogiidena 已提交
14 15 16
 */
#include <linux/init.h>
#include <linux/irq.h>
P
Paul Mundt 已提交
17 18
#include <linux/interrupt.h>
#include <linux/io.h>
P
Paul Mundt 已提交
19
#include <mach/iodata_landisk.h>
K
kogiidena 已提交
20 21 22 23 24

static void disable_landisk_irq(unsigned int irq)
{
	unsigned char mask = 0xff ^ (0x01 << (irq - 5));

K
kogiidena 已提交
25
	ctrl_outb(ctrl_inb(PA_IMASK) & mask, PA_IMASK);
K
kogiidena 已提交
26 27 28 29 30 31
}

static void enable_landisk_irq(unsigned int irq)
{
	unsigned char value = (0x01 << (irq - 5));

K
kogiidena 已提交
32
	ctrl_outb(ctrl_inb(PA_IMASK) | value, PA_IMASK);
K
kogiidena 已提交
33 34
}

K
kogiidena 已提交
35 36 37 38 39
static struct irq_chip landisk_irq_chip __read_mostly = {
	.name		= "LANDISK",
	.mask		= disable_landisk_irq,
	.unmask		= enable_landisk_irq,
	.mask_ack	= disable_landisk_irq,
K
kogiidena 已提交
40 41 42 43 44 45 46 47 48
};

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

K
kogiidena 已提交
49 50 51 52 53 54 55
	for (i = 5; i < 14; i++) {
		disable_irq_nosync(i);
		set_irq_chip_and_handler_name(i, &landisk_irq_chip,
					      handle_level_irq, "level");
		enable_landisk_irq(i);
	}
	ctrl_outb(0x00, PA_PWRINT_CLR);
K
kogiidena 已提交
56
}