board-secureedge5410.c 1.8 KB
Newer Older
1
/*
L
Linus Torvalds 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 * Copyright (C) 2002  David McCullough <davidm@snapgear.com>
 * Copyright (C) 2003  Paul Mundt <lethal@linux-sh.org>
 *
 * Based on files with the following comments:
 *
 *           Copyright (C) 2000  Kazumoto Kojima
 *
 *           Modified for 7751 Solution Engine by
 *           Ian da Silva and Jeremy Siegel, 2001.
 */
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/timer.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <asm/machvec.h>
20
#include <mach/secureedge5410.h>
L
Linus Torvalds 已提交
21 22
#include <asm/irq.h>
#include <asm/io.h>
P
Paul Mundt 已提交
23
#include <cpu/timer.h>
L
Linus Torvalds 已提交
24

25 26
unsigned short secureedge5410_ioport;

L
Linus Torvalds 已提交
27 28 29
/*
 * EraseConfig handling functions
 */
P
Paul Mundt 已提交
30
static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
L
Linus Torvalds 已提交
31
{
32
	ctrl_delay();	/* dummy read */
L
Linus Torvalds 已提交
33 34 35 36 37 38 39 40

	printk("SnapGear: erase switch interrupt!\n");

	return IRQ_HANDLED;
}

static int __init eraseconfig_init(void)
{
41 42
	unsigned int irq = evt2irq(0x240);

L
Linus Torvalds 已提交
43
	printk("SnapGear: EraseConfig init\n");
44

L
Linus Torvalds 已提交
45
	/* Setup "EraseConfig" switch on external IRQ 0 */
46
	if (request_irq(irq, eraseconfig_interrupt, IRQF_DISABLED,
L
Linus Torvalds 已提交
47 48
				"Erase Config", NULL))
		printk("SnapGear: failed to register IRQ%d for Reset witch\n",
49
				irq);
L
Linus Torvalds 已提交
50 51
	else
		printk("SnapGear: registered EraseConfig switch on IRQ%d\n",
52 53
				irq);
	return 0;
L
Linus Torvalds 已提交
54 55 56 57 58 59 60 61 62 63 64 65 66 67
}
module_init(eraseconfig_init);

/*
 * Initialize IRQ setting
 *
 * IRL0 = erase switch
 * IRL1 = eth0
 * IRL2 = eth1
 * IRL3 = crypto
 */
static void __init init_snapgear_IRQ(void)
{
	printk("Setup SnapGear IRQ/IPR ...\n");
68 69
	/* enable individual interrupt mode for externals */
	plat_irq_setup_pins(IRQ_MODE_IRQ);
L
Linus Torvalds 已提交
70 71 72 73 74
}

/*
 * The Machine Vector
 */
P
Paul Mundt 已提交
75
static struct sh_machine_vector mv_snapgear __initmv = {
P
Paul Mundt 已提交
76
	.mv_name		= "SnapGear SecureEdge5410",
L
Linus Torvalds 已提交
77 78 79
	.mv_nr_irqs		= 72,
	.mv_init_irq		= init_snapgear_IRQ,
};