2006-09-27 14:59:17 +08:00
|
|
|
/*
|
|
|
|
* Renesas Solutions Highlander R7780RP-1 Support.
|
|
|
|
*
|
2006-10-06 14:33:00 +08:00
|
|
|
* Copyright (C) 2002 Atom Create Engineering Co., Ltd.
|
|
|
|
* Copyright (C) 2006 Paul Mundt
|
|
|
|
*
|
|
|
|
* 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.
|
2006-09-27 14:59:17 +08:00
|
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/irq.h>
|
2006-11-20 12:55:34 +08:00
|
|
|
#include <linux/interrupt.h>
|
2006-10-19 15:16:18 +08:00
|
|
|
#include <linux/io.h>
|
|
|
|
#include <asm/r7780rp.h>
|
2006-09-27 14:59:17 +08:00
|
|
|
|
2007-03-12 13:38:59 +08:00
|
|
|
#ifdef CONFIG_SH_R7780RP
|
2006-09-27 14:59:17 +08:00
|
|
|
static int mask_pos[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 5, 6, 4, 0, 1, 2, 0};
|
2007-03-12 13:38:59 +08:00
|
|
|
#elif defined(CONFIG_SH_R7780MP)
|
|
|
|
static int mask_pos[] = {12, 11, 9, 14, 15, 8, 13, 6, 5, 4, 3, 2, 0, 0, 1, 0};
|
|
|
|
#elif defined(CONFIG_SH_R7785RP)
|
|
|
|
static int mask_pos[] = {2, 11, 2, 2, 2, 2, 9, 8, 7, 5, 10, 2, 2, 2, 2, 2};
|
2006-09-27 14:59:17 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static void enable_r7780rp_irq(unsigned int irq)
|
|
|
|
{
|
|
|
|
/* Set priority in IPR back to original value */
|
2006-10-06 14:33:00 +08:00
|
|
|
ctrl_outw(ctrl_inw(IRLCNTR1) | (1 << mask_pos[irq]), IRLCNTR1);
|
2006-09-27 14:59:17 +08:00
|
|
|
}
|
|
|
|
|
2006-10-06 14:33:00 +08:00
|
|
|
static void disable_r7780rp_irq(unsigned int irq)
|
2006-09-27 14:59:17 +08:00
|
|
|
{
|
2006-10-06 14:33:00 +08:00
|
|
|
/* Set the priority in IPR to 0 */
|
|
|
|
ctrl_outw(ctrl_inw(IRLCNTR1) & (0xffff ^ (1 << mask_pos[irq])),
|
|
|
|
IRLCNTR1);
|
2006-09-27 14:59:17 +08:00
|
|
|
}
|
|
|
|
|
2006-10-06 14:33:00 +08:00
|
|
|
static struct irq_chip r7780rp_irq_chip __read_mostly = {
|
2006-10-19 16:32:56 +08:00
|
|
|
.name = "R7780RP",
|
2006-10-06 14:33:00 +08:00
|
|
|
.mask = disable_r7780rp_irq,
|
|
|
|
.unmask = enable_r7780rp_irq,
|
|
|
|
.mask_ack = disable_r7780rp_irq,
|
2006-09-27 14:59:17 +08:00
|
|
|
};
|
|
|
|
|
2007-03-12 13:38:59 +08:00
|
|
|
void make_r7780rp_irq(unsigned int irq)
|
2006-09-27 14:59:17 +08:00
|
|
|
{
|
2007-03-12 13:38:59 +08:00
|
|
|
disable_irq_nosync(irq);
|
|
|
|
set_irq_chip_and_handler_name(irq, &r7780rp_irq_chip,
|
|
|
|
handle_level_irq, "level");
|
|
|
|
enable_r7780rp_irq(irq);
|
2006-09-27 14:59:17 +08:00
|
|
|
}
|