]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - arch/sh/boards/snapgear/setup.c
sh: Get multiple boards in one image working again.
[mirror_ubuntu-focal-kernel.git] / arch / sh / boards / snapgear / setup.c
CommitLineData
373e68b5 1/*
1da177e4
LT
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 */
1da177e4
LT
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>
1da177e4 21#include <asm/machvec.h>
373e68b5 22#include <asm/snapgear.h>
1da177e4
LT
23#include <asm/irq.h>
24#include <asm/io.h>
373e68b5 25#include <asm/rtc.h>
1da177e4
LT
26#include <asm/cpu/timer.h>
27
1da177e4
LT
28extern void secureedge5410_rtc_init(void);
29extern void pcibios_init(void);
30
31/****************************************************************************/
32/*
33 * EraseConfig handling functions
34 */
35
35f3c518 36static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
1da177e4
LT
37{
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 */
6d20819f 49 if (request_irq(IRL0_IRQ, eraseconfig_interrupt, IRQF_DISABLED,
1da177e4
LT
50 "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
bd71ab88
JL
71static struct ipr_data snapgear_ipr_map[] = {
72 make_ipr_irq(IRL0_IRQ, IRL0_IPR_ADDR, IRL0_IPR_POS, IRL0_PRIORITY);
73 make_ipr_irq(IRL1_IRQ, IRL1_IPR_ADDR, IRL1_IPR_POS, IRL1_PRIORITY);
74 make_ipr_irq(IRL2_IRQ, IRL2_IPR_ADDR, IRL2_IPR_POS, IRL2_PRIORITY);
75 make_ipr_irq(IRL3_IRQ, IRL3_IPR_ADDR, IRL3_IPR_POS, IRL3_PRIORITY);
76};
77
1da177e4
LT
78static void __init init_snapgear_IRQ(void)
79{
80 /* enable individual interrupt mode for externals */
81 ctrl_outw(ctrl_inw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR);
82
83 printk("Setup SnapGear IRQ/IPR ...\n");
84
bd71ab88 85 make_ipr_irq(snapgear_ipr_map, ARRAY_SIZE(snapgear_ipr_map));
1da177e4
LT
86}
87
2c7834a6
PM
88/*
89 * Initialize the board
90 */
91static void __init snapgear_setup(char **cmdline_p)
1da177e4 92{
2c7834a6 93 board_time_init = secureedge5410_rtc_init;
1da177e4
LT
94}
95
96/*
97 * The Machine Vector
98 */
1da177e4 99struct sh_machine_vector mv_snapgear __initmv = {
2c7834a6
PM
100 .mv_name = "SnapGear SecureEdge5410",
101 .mv_setup = snapgear_setup,
1da177e4
LT
102 .mv_nr_irqs = 72,
103
104 .mv_inb = snapgear_inb,
105 .mv_inw = snapgear_inw,
106 .mv_inl = snapgear_inl,
107 .mv_outb = snapgear_outb,
108 .mv_outw = snapgear_outw,
109 .mv_outl = snapgear_outl,
110
111 .mv_inb_p = snapgear_inb_p,
112 .mv_inw_p = snapgear_inw,
113 .mv_inl_p = snapgear_inl,
114 .mv_outb_p = snapgear_outb_p,
115 .mv_outw_p = snapgear_outw,
116 .mv_outl_p = snapgear_outl,
117
1da177e4
LT
118 .mv_init_irq = init_snapgear_IRQ,
119};
120ALIAS_MV(snapgear)