blob: 2b594f6000022c9904ea9df0a9ab1aabb8483328 [file] [log] [blame]
Paul Mundt373e68b2006-09-27 15:41:24 +09001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * 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 Torvalds1da177e2005-04-16 15:20:36 -070014#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 Torvalds1da177e2005-04-16 15:20:36 -070021#include <asm/machvec.h>
Paul Mundt373e68b2006-09-27 15:41:24 +090022#include <asm/snapgear.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include <asm/irq.h>
24#include <asm/io.h>
Paul Mundt373e68b2006-09-27 15:41:24 +090025#include <asm/rtc.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070026#include <asm/cpu/timer.h>
27
Linus Torvalds1da177e2005-04-16 15:20:36 -070028extern void secureedge5410_rtc_init(void);
29extern void pcibios_init(void);
30
31/****************************************************************************/
32/*
33 * EraseConfig handling functions
34 */
35
Paul Mundt35f3c512006-10-06 15:31:16 +090036static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -070037{
38 volatile char dummy __attribute__((unused)) = * (volatile char *) 0xb8000000;
39
40 printk("SnapGear: erase switch interrupt!\n");
41
42 return IRQ_HANDLED;
43}
44
45static int __init eraseconfig_init(void)
46{
47 printk("SnapGear: EraseConfig init\n");
48 /* Setup "EraseConfig" switch on external IRQ 0 */
Thomas Gleixner6d208192006-07-01 19:29:25 -070049 if (request_irq(IRL0_IRQ, eraseconfig_interrupt, IRQF_DISABLED,
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 "Erase Config", NULL))
51 printk("SnapGear: failed to register IRQ%d for Reset witch\n",
52 IRL0_IRQ);
53 else
54 printk("SnapGear: registered EraseConfig switch on IRQ%d\n",
55 IRL0_IRQ);
56 return(0);
57}
58
59module_init(eraseconfig_init);
60
61/****************************************************************************/
62/*
63 * Initialize IRQ setting
64 *
65 * IRL0 = erase switch
66 * IRL1 = eth0
67 * IRL2 = eth1
68 * IRL3 = crypto
69 */
70
71static void __init init_snapgear_IRQ(void)
72{
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 printk("Setup SnapGear IRQ/IPR ...\n");
Magnus Dammd59645d2007-08-03 14:23:35 +090074 /* enable individual interrupt mode for externals */
75 plat_irq_setup_pins(IRQ_MODE_IRQ);
Linus Torvalds1da177e2005-04-16 15:20:36 -070076}
77
Paul Mundt2c7834a2006-09-27 18:17:31 +090078/*
79 * Initialize the board
80 */
81static void __init snapgear_setup(char **cmdline_p)
Linus Torvalds1da177e2005-04-16 15:20:36 -070082{
Paul Mundt2c7834a2006-09-27 18:17:31 +090083 board_time_init = secureedge5410_rtc_init;
Linus Torvalds1da177e2005-04-16 15:20:36 -070084}
85
86/*
87 * The Machine Vector
88 */
Paul Mundt82f81f42007-05-15 15:19:34 +090089static struct sh_machine_vector mv_snapgear __initmv = {
Paul Mundt2c7834a2006-09-27 18:17:31 +090090 .mv_name = "SnapGear SecureEdge5410",
91 .mv_setup = snapgear_setup,
Linus Torvalds1da177e2005-04-16 15:20:36 -070092 .mv_nr_irqs = 72,
93
94 .mv_inb = snapgear_inb,
95 .mv_inw = snapgear_inw,
96 .mv_inl = snapgear_inl,
97 .mv_outb = snapgear_outb,
98 .mv_outw = snapgear_outw,
99 .mv_outl = snapgear_outl,
100
101 .mv_inb_p = snapgear_inb_p,
102 .mv_inw_p = snapgear_inw,
103 .mv_inl_p = snapgear_inl,
104 .mv_outb_p = snapgear_outb_p,
105 .mv_outw_p = snapgear_outw,
106 .mv_outl_p = snapgear_outl,
107
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 .mv_init_irq = init_snapgear_IRQ,
109};