| Paul Mundt | 373e68b | 2006-09-27 15:41:24 +0900 | [diff] [blame] | 1 | /* | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 |  * linux/arch/sh/boards/snapgear/setup.c | 
 | 3 |  * | 
 | 4 |  * Copyright (C) 2002  David McCullough <davidm@snapgear.com> | 
 | 5 |  * Copyright (C) 2003  Paul Mundt <lethal@linux-sh.org> | 
 | 6 |  * | 
 | 7 |  * Based on files with the following comments: | 
 | 8 |  * | 
 | 9 |  *           Copyright (C) 2000  Kazumoto Kojima | 
 | 10 |  * | 
 | 11 |  *           Modified for 7751 Solution Engine by | 
 | 12 |  *           Ian da Silva and Jeremy Siegel, 2001. | 
 | 13 |  */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <linux/init.h> | 
 | 15 | #include <linux/irq.h> | 
 | 16 | #include <linux/interrupt.h> | 
 | 17 | #include <linux/timer.h> | 
 | 18 | #include <linux/delay.h> | 
 | 19 | #include <linux/module.h> | 
 | 20 | #include <linux/sched.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #include <asm/machvec.h> | 
| Paul Mundt | 7639a45 | 2008-10-20 13:02:48 +0900 | [diff] [blame] | 22 | #include <mach/snapgear.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | #include <asm/irq.h> | 
 | 24 | #include <asm/io.h> | 
| Paul Mundt | f15cbe6 | 2008-07-29 08:09:44 +0900 | [diff] [blame] | 25 | #include <cpu/timer.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | /* | 
 | 28 |  * EraseConfig handling functions | 
 | 29 |  */ | 
 | 30 |  | 
| Paul Mundt | 35f3c51 | 2006-10-06 15:31:16 +0900 | [diff] [blame] | 31 | static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | { | 
| Paul Mundt | 6d1c76d | 2007-11-08 11:24:33 +0900 | [diff] [blame] | 33 | 	(void)ctrl_inb(0xb8000000);	/* dummy read */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 |  | 
 | 35 | 	printk("SnapGear: erase switch interrupt!\n"); | 
 | 36 |  | 
 | 37 | 	return IRQ_HANDLED; | 
 | 38 | } | 
 | 39 |  | 
 | 40 | static int __init eraseconfig_init(void) | 
 | 41 | { | 
 | 42 | 	printk("SnapGear: EraseConfig init\n"); | 
 | 43 | 	/* Setup "EraseConfig" switch on external IRQ 0 */ | 
| Thomas Gleixner | 6d20819 | 2006-07-01 19:29:25 -0700 | [diff] [blame] | 44 | 	if (request_irq(IRL0_IRQ, eraseconfig_interrupt, IRQF_DISABLED, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | 				"Erase Config", NULL)) | 
 | 46 | 		printk("SnapGear: failed to register IRQ%d for Reset witch\n", | 
 | 47 | 				IRL0_IRQ); | 
 | 48 | 	else | 
 | 49 | 		printk("SnapGear: registered EraseConfig switch on IRQ%d\n", | 
 | 50 | 				IRL0_IRQ); | 
 | 51 | 	return(0); | 
 | 52 | } | 
 | 53 |  | 
 | 54 | module_init(eraseconfig_init); | 
 | 55 |  | 
 | 56 | /****************************************************************************/ | 
 | 57 | /* | 
 | 58 |  * Initialize IRQ setting | 
 | 59 |  * | 
 | 60 |  * IRL0 = erase switch | 
 | 61 |  * IRL1 = eth0 | 
 | 62 |  * IRL2 = eth1 | 
 | 63 |  * IRL3 = crypto | 
 | 64 |  */ | 
 | 65 |  | 
 | 66 | static void __init init_snapgear_IRQ(void) | 
 | 67 | { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | 	printk("Setup SnapGear IRQ/IPR ...\n"); | 
| Magnus Damm | d59645d | 2007-08-03 14:23:35 +0900 | [diff] [blame] | 69 | 	/* enable individual interrupt mode for externals */ | 
 | 70 | 	plat_irq_setup_pins(IRQ_MODE_IRQ); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | } | 
 | 72 |  | 
| Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 73 | /* | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 |  * The Machine Vector | 
 | 75 |  */ | 
| Paul Mundt | 82f81f4 | 2007-05-15 15:19:34 +0900 | [diff] [blame] | 76 | static struct sh_machine_vector mv_snapgear __initmv = { | 
| Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 77 | 	.mv_name		= "SnapGear SecureEdge5410", | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | 	.mv_nr_irqs		= 72, | 
 | 79 |  | 
 | 80 | 	.mv_inb			= snapgear_inb, | 
 | 81 | 	.mv_inw			= snapgear_inw, | 
 | 82 | 	.mv_inl			= snapgear_inl, | 
 | 83 | 	.mv_outb		= snapgear_outb, | 
 | 84 | 	.mv_outw		= snapgear_outw, | 
 | 85 | 	.mv_outl		= snapgear_outl, | 
 | 86 |  | 
 | 87 | 	.mv_inb_p		= snapgear_inb_p, | 
 | 88 | 	.mv_inw_p		= snapgear_inw, | 
 | 89 | 	.mv_inl_p		= snapgear_inl, | 
 | 90 | 	.mv_outb_p		= snapgear_outb_p, | 
 | 91 | 	.mv_outw_p		= snapgear_outw, | 
 | 92 | 	.mv_outl_p		= snapgear_outl, | 
 | 93 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | 	.mv_init_irq		= init_snapgear_IRQ, | 
 | 95 | }; |