blob: 98b36205aa7bf2723c871515c97801f1d18079b3 [file] [log] [blame]
Paul Mundt373e68b2006-09-27 15:41:24 +09001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * 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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#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/module.h>
18#include <linux/sched.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <asm/machvec.h>
Paul Mundtf6eec8d2010-10-29 19:06:53 +090020#include <mach/secureedge5410.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <asm/irq.h>
22#include <asm/io.h>
Paul Mundtf15cbe62008-07-29 08:09:44 +090023#include <cpu/timer.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
Paul Mundt39c11982010-10-29 18:59:58 +090025unsigned short secureedge5410_ioport;
26
Linus Torvalds1da177e2005-04-16 15:20:36 -070027/*
28 * EraseConfig handling functions
29 */
Paul Mundt35f3c512006-10-06 15:31:16 +090030static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -070031{
Linus Torvalds1da177e2005-04-16 15:20:36 -070032 printk("SnapGear: erase switch interrupt!\n");
33
34 return IRQ_HANDLED;
35}
36
37static int __init eraseconfig_init(void)
38{
Paul Mundt39c11982010-10-29 18:59:58 +090039 unsigned int irq = evt2irq(0x240);
40
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 printk("SnapGear: EraseConfig init\n");
Paul Mundt39c11982010-10-29 18:59:58 +090042
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 /* Setup "EraseConfig" switch on external IRQ 0 */
Yong Zhangd11584a2011-10-22 17:56:28 +080044 if (request_irq(irq, eraseconfig_interrupt, 0, "Erase Config", NULL))
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 printk("SnapGear: failed to register IRQ%d for Reset witch\n",
Paul Mundt39c11982010-10-29 18:59:58 +090046 irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 else
48 printk("SnapGear: registered EraseConfig switch on IRQ%d\n",
Paul Mundt39c11982010-10-29 18:59:58 +090049 irq);
50 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070051}
Linus Torvalds1da177e2005-04-16 15:20:36 -070052module_init(eraseconfig_init);
53
Linus Torvalds1da177e2005-04-16 15:20:36 -070054/*
55 * Initialize IRQ setting
56 *
57 * IRL0 = erase switch
58 * IRL1 = eth0
59 * IRL2 = eth1
60 * IRL3 = crypto
61 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070062static void __init init_snapgear_IRQ(void)
63{
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 printk("Setup SnapGear IRQ/IPR ...\n");
Magnus Dammd59645d2007-08-03 14:23:35 +090065 /* enable individual interrupt mode for externals */
66 plat_irq_setup_pins(IRQ_MODE_IRQ);
Linus Torvalds1da177e2005-04-16 15:20:36 -070067}
68
Paul Mundt2c7834a2006-09-27 18:17:31 +090069/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 * The Machine Vector
71 */
Paul Mundt82f81f42007-05-15 15:19:34 +090072static struct sh_machine_vector mv_snapgear __initmv = {
Paul Mundt2c7834a2006-09-27 18:17:31 +090073 .mv_name = "SnapGear SecureEdge5410",
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 .mv_init_irq = init_snapgear_IRQ,
75};