blob: f968f17891a4f87980b359ef46bd6db7c40187e1 [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 */
Paul Mundt39c11982010-10-29 18:59:58 +090044 if (request_irq(irq, eraseconfig_interrupt, IRQF_DISABLED,
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 "Erase Config", NULL))
46 printk("SnapGear: failed to register IRQ%d for Reset witch\n",
Paul Mundt39c11982010-10-29 18:59:58 +090047 irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 else
49 printk("SnapGear: registered EraseConfig switch on IRQ%d\n",
Paul Mundt39c11982010-10-29 18:59:58 +090050 irq);
51 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070052}
Linus Torvalds1da177e2005-04-16 15:20:36 -070053module_init(eraseconfig_init);
54
Linus Torvalds1da177e2005-04-16 15:20:36 -070055/*
56 * Initialize IRQ setting
57 *
58 * IRL0 = erase switch
59 * IRL1 = eth0
60 * IRL2 = eth1
61 * IRL3 = crypto
62 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070063static void __init init_snapgear_IRQ(void)
64{
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 printk("Setup SnapGear IRQ/IPR ...\n");
Magnus Dammd59645d2007-08-03 14:23:35 +090066 /* enable individual interrupt mode for externals */
67 plat_irq_setup_pins(IRQ_MODE_IRQ);
Linus Torvalds1da177e2005-04-16 15:20:36 -070068}
69
Paul Mundt2c7834a2006-09-27 18:17:31 +090070/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 * The Machine Vector
72 */
Paul Mundt82f81f42007-05-15 15:19:34 +090073static struct sh_machine_vector mv_snapgear __initmv = {
Paul Mundt2c7834a2006-09-27 18:17:31 +090074 .mv_name = "SnapGear SecureEdge5410",
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 .mv_nr_irqs = 72,
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 .mv_init_irq = init_snapgear_IRQ,
77};