blob: 97ec67ffec2b8b9925f17eb9a9b70cb8f3b2d1df [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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <linux/sched.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <asm/machvec.h>
Paul Mundtf6eec8d2010-10-29 19:06:53 +090019#include <mach/secureedge5410.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <asm/irq.h>
21#include <asm/io.h>
Paul Mundtf15cbe62008-07-29 08:09:44 +090022#include <cpu/timer.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Paul Mundt39c11982010-10-29 18:59:58 +090024unsigned short secureedge5410_ioport;
25
Linus Torvalds1da177e2005-04-16 15:20:36 -070026/*
27 * EraseConfig handling functions
28 */
Paul Mundt35f3c512006-10-06 15:31:16 +090029static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -070030{
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 printk("SnapGear: erase switch interrupt!\n");
32
33 return IRQ_HANDLED;
34}
35
36static int __init eraseconfig_init(void)
37{
Paul Mundt39c11982010-10-29 18:59:58 +090038 unsigned int irq = evt2irq(0x240);
39
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 printk("SnapGear: EraseConfig init\n");
Paul Mundt39c11982010-10-29 18:59:58 +090041
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 /* Setup "EraseConfig" switch on external IRQ 0 */
Yong Zhangd11584a2011-10-22 17:56:28 +080043 if (request_irq(irq, eraseconfig_interrupt, 0, "Erase Config", NULL))
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 printk("SnapGear: failed to register IRQ%d for Reset witch\n",
Paul Mundt39c11982010-10-29 18:59:58 +090045 irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 else
47 printk("SnapGear: registered EraseConfig switch on IRQ%d\n",
Paul Mundt39c11982010-10-29 18:59:58 +090048 irq);
49 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070050}
Paul Gortmakerf368d472016-04-22 14:07:03 -040051device_initcall(eraseconfig_init);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
Linus Torvalds1da177e2005-04-16 15:20:36 -070053/*
54 * Initialize IRQ setting
55 *
56 * IRL0 = erase switch
57 * IRL1 = eth0
58 * IRL2 = eth1
59 * IRL3 = crypto
60 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070061static void __init init_snapgear_IRQ(void)
62{
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 printk("Setup SnapGear IRQ/IPR ...\n");
Magnus Dammd59645d2007-08-03 14:23:35 +090064 /* enable individual interrupt mode for externals */
65 plat_irq_setup_pins(IRQ_MODE_IRQ);
Linus Torvalds1da177e2005-04-16 15:20:36 -070066}
67
Paul Mundt2c7834a2006-09-27 18:17:31 +090068/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 * The Machine Vector
70 */
Paul Mundt82f81f42007-05-15 15:19:34 +090071static struct sh_machine_vector mv_snapgear __initmv = {
Paul Mundt2c7834a2006-09-27 18:17:31 +090072 .mv_name = "SnapGear SecureEdge5410",
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 .mv_init_irq = init_snapgear_IRQ,
74};