1 /*
2  * Copyright (C) 2002  David McCullough <davidm@snapgear.com>
3  * Copyright (C) 2003  Paul Mundt <lethal@linux-sh.org>
4  *
5  * Based on files with the following comments:
6  *
7  *           Copyright (C) 2000  Kazumoto Kojima
8  *
9  *           Modified for 7751 Solution Engine by
10  *           Ian da Silva and Jeremy Siegel, 2001.
11  */
12 #include <linux/init.h>
13 #include <linux/irq.h>
14 #include <linux/interrupt.h>
15 #include <linux/timer.h>
16 #include <linux/delay.h>
17 #include <linux/sched.h>
18 #include <asm/machvec.h>
19 #include <mach/secureedge5410.h>
20 #include <asm/irq.h>
21 #include <asm/io.h>
22 #include <cpu/timer.h>
23 
24 unsigned short secureedge5410_ioport;
25 
26 /*
27  * EraseConfig handling functions
28  */
29 static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
30 {
31 	printk("SnapGear: erase switch interrupt!\n");
32 
33 	return IRQ_HANDLED;
34 }
35 
36 static int __init eraseconfig_init(void)
37 {
38 	unsigned int irq = evt2irq(0x240);
39 
40 	printk("SnapGear: EraseConfig init\n");
41 
42 	/* Setup "EraseConfig" switch on external IRQ 0 */
43 	if (request_irq(irq, eraseconfig_interrupt, 0, "Erase Config", NULL))
44 		printk("SnapGear: failed to register IRQ%d for Reset witch\n",
45 				irq);
46 	else
47 		printk("SnapGear: registered EraseConfig switch on IRQ%d\n",
48 				irq);
49 	return 0;
50 }
51 device_initcall(eraseconfig_init);
52 
53 /*
54  * Initialize IRQ setting
55  *
56  * IRL0 = erase switch
57  * IRL1 = eth0
58  * IRL2 = eth1
59  * IRL3 = crypto
60  */
61 static void __init init_snapgear_IRQ(void)
62 {
63 	printk("Setup SnapGear IRQ/IPR ...\n");
64 	/* enable individual interrupt mode for externals */
65 	plat_irq_setup_pins(IRQ_MODE_IRQ);
66 }
67 
68 /*
69  * The Machine Vector
70  */
71 static struct sh_machine_vector mv_snapgear __initmv = {
72 	.mv_name		= "SnapGear SecureEdge5410",
73 	.mv_init_irq		= init_snapgear_IRQ,
74 };
75