2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* linux/arch/m68k/sun3/sun3ints.c -- Sun-3(x) Linux interrupt handling code
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/kernel_stat.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <asm/segment.h>
|
|
|
|
#include <asm/intersil.h>
|
|
|
|
#include <asm/oplib.h>
|
|
|
|
#include <asm/sun3ints.h>
|
2006-10-07 21:16:45 +08:00
|
|
|
#include <asm/irq_regs.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/seq_file.h>
|
|
|
|
|
|
|
|
extern void sun3_leds (unsigned char);
|
|
|
|
|
|
|
|
void sun3_disable_interrupts(void)
|
|
|
|
{
|
|
|
|
sun3_disable_irq(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void sun3_enable_interrupts(void)
|
|
|
|
{
|
|
|
|
sun3_enable_irq(0);
|
|
|
|
}
|
|
|
|
|
2008-07-18 03:16:27 +08:00
|
|
|
static int led_pattern[8] = {
|
2005-04-17 06:20:36 +08:00
|
|
|
~(0x80), ~(0x01),
|
|
|
|
~(0x40), ~(0x02),
|
|
|
|
~(0x20), ~(0x04),
|
|
|
|
~(0x10), ~(0x08)
|
|
|
|
};
|
|
|
|
|
|
|
|
volatile unsigned char* sun3_intreg;
|
|
|
|
|
|
|
|
void sun3_enable_irq(unsigned int irq)
|
|
|
|
{
|
2006-06-25 20:47:05 +08:00
|
|
|
*sun3_intreg |= (1 << irq);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void sun3_disable_irq(unsigned int irq)
|
|
|
|
{
|
2006-06-25 20:47:05 +08:00
|
|
|
*sun3_intreg &= ~(1 << irq);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-10-07 21:16:45 +08:00
|
|
|
static irqreturn_t sun3_int7(int irq, void *dev_id)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2011-08-19 04:46:01 +08:00
|
|
|
unsigned int cnt;
|
|
|
|
|
|
|
|
cnt = kstat_irqs_cpu(irq, 0);
|
|
|
|
if (!(cnt % 2000))
|
|
|
|
sun3_leds(led_pattern[cnt % 16000 / 2000]);
|
2005-04-17 06:20:36 +08:00
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2006-10-07 21:16:45 +08:00
|
|
|
static irqreturn_t sun3_int5(int irq, void *dev_id)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2011-08-19 04:46:01 +08:00
|
|
|
unsigned int cnt;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#ifdef CONFIG_SUN3
|
|
|
|
intersil_clear();
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SUN3
|
|
|
|
intersil_clear();
|
|
|
|
#endif
|
2011-01-27 23:00:06 +08:00
|
|
|
xtime_update(1);
|
2006-10-07 21:16:45 +08:00
|
|
|
update_process_times(user_mode(get_irq_regs()));
|
2011-08-19 04:46:01 +08:00
|
|
|
cnt = kstat_irqs_cpu(irq, 0);
|
|
|
|
if (!(cnt % 20))
|
|
|
|
sun3_leds(led_pattern[cnt % 160 / 20]);
|
2005-04-17 06:20:36 +08:00
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2006-10-07 21:16:45 +08:00
|
|
|
static irqreturn_t sun3_vec255(int irq, void *dev_id)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
// intersil_clear();
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2011-04-18 04:53:04 +08:00
|
|
|
static void sun3_irq_enable(struct irq_data *data)
|
|
|
|
{
|
|
|
|
sun3_enable_irq(data->irq);
|
|
|
|
};
|
|
|
|
|
|
|
|
static void sun3_irq_disable(struct irq_data *data)
|
|
|
|
{
|
|
|
|
sun3_disable_irq(data->irq);
|
|
|
|
};
|
|
|
|
|
2011-04-14 04:31:28 +08:00
|
|
|
static struct irq_chip sun3_irq_chip = {
|
2006-06-25 20:47:05 +08:00
|
|
|
.name = "sun3",
|
2011-04-14 04:31:28 +08:00
|
|
|
.irq_startup = m68k_irq_startup,
|
|
|
|
.irq_shutdown = m68k_irq_shutdown,
|
2011-04-18 04:53:04 +08:00
|
|
|
.irq_enable = sun3_irq_enable,
|
|
|
|
.irq_disable = sun3_irq_disable,
|
2011-08-18 20:46:46 +08:00
|
|
|
.irq_mask = sun3_irq_disable,
|
|
|
|
.irq_unmask = sun3_irq_enable,
|
2006-06-25 20:47:05 +08:00
|
|
|
};
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-07-20 11:33:28 +08:00
|
|
|
void __init sun3_init_IRQ(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2006-06-25 20:47:05 +08:00
|
|
|
*sun3_intreg = 1;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-08-18 20:46:46 +08:00
|
|
|
m68k_setup_irq_controller(&sun3_irq_chip, handle_level_irq, IRQ_AUTO_1,
|
|
|
|
7);
|
2011-09-11 17:54:50 +08:00
|
|
|
m68k_setup_user_interrupt(VEC_USER, 128);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-12-30 21:05:24 +08:00
|
|
|
if (request_irq(IRQ_AUTO_5, sun3_int5, 0, "int5", NULL))
|
|
|
|
pr_err("Couldn't register %s interrupt\n", "int5");
|
|
|
|
if (request_irq(IRQ_AUTO_7, sun3_int7, 0, "int7", NULL))
|
|
|
|
pr_err("Couldn't register %s interrupt\n", "int7");
|
|
|
|
if (request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL))
|
|
|
|
pr_err("Couldn't register %s interrupt\n", "vec255");
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|