aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/boards/mach-sdk7786/Makefile2
-rw-r--r--arch/sh/boards/mach-sdk7786/nmi.c83
-rw-r--r--arch/sh/boards/mach-sdk7786/setup.c1
-rw-r--r--arch/sh/include/mach-sdk7786/mach/fpga.h8
4 files changed, 93 insertions, 1 deletions
diff --git a/arch/sh/boards/mach-sdk7786/Makefile b/arch/sh/boards/mach-sdk7786/Makefile
index 23ff7d4ac491..8ae56e9560ac 100644
--- a/arch/sh/boards/mach-sdk7786/Makefile
+++ b/arch/sh/boards/mach-sdk7786/Makefile
@@ -1,4 +1,4 @@
1obj-y := fpga.o irq.o setup.o 1obj-y := fpga.o irq.o nmi.o setup.o
2 2
3obj-$(CONFIG_GENERIC_GPIO) += gpio.o 3obj-$(CONFIG_GENERIC_GPIO) += gpio.o
4obj-$(CONFIG_HAVE_SRAM_POOL) += sram.o 4obj-$(CONFIG_HAVE_SRAM_POOL) += sram.o
diff --git a/arch/sh/boards/mach-sdk7786/nmi.c b/arch/sh/boards/mach-sdk7786/nmi.c
new file mode 100644
index 000000000000..edcfa1f568ba
--- /dev/null
+++ b/arch/sh/boards/mach-sdk7786/nmi.c
@@ -0,0 +1,83 @@
1/*
2 * SDK7786 FPGA NMI Support.
3 *
4 * Copyright (C) 2010 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/string.h>
13#include <mach/fpga.h>
14
15enum {
16 NMI_MODE_MANUAL,
17 NMI_MODE_AUX,
18 NMI_MODE_MASKED,
19 NMI_MODE_ANY,
20 NMI_MODE_UNKNOWN,
21};
22
23/*
24 * Default to the manual NMI switch.
25 */
26static unsigned int __initdata nmi_mode = NMI_MODE_ANY;
27
28static int __init nmi_mode_setup(char *str)
29{
30 if (!str)
31 return 0;
32
33 if (strcmp(str, "manual") == 0)
34 nmi_mode = NMI_MODE_MANUAL;
35 else if (strcmp(str, "aux") == 0)
36 nmi_mode = NMI_MODE_AUX;
37 else if (strcmp(str, "masked") == 0)
38 nmi_mode = NMI_MODE_MASKED;
39 else if (strcmp(str, "any") == 0)
40 nmi_mode = NMI_MODE_ANY;
41 else {
42 nmi_mode = NMI_MODE_UNKNOWN;
43 pr_warning("Unknown NMI mode %s\n", str);
44 }
45
46 printk("Set NMI mode to %d\n", nmi_mode);
47 return 0;
48}
49early_param("nmi_mode", nmi_mode_setup);
50
51void __init sdk7786_nmi_init(void)
52{
53 unsigned int source, mask, tmp;
54
55 switch (nmi_mode) {
56 case NMI_MODE_MANUAL:
57 source = NMISR_MAN_NMI;
58 mask = NMIMR_MAN_NMIM;
59 break;
60 case NMI_MODE_AUX:
61 source = NMISR_AUX_NMI;
62 mask = NMIMR_AUX_NMIM;
63 break;
64 case NMI_MODE_ANY:
65 source = NMISR_MAN_NMI | NMISR_AUX_NMI;
66 mask = NMIMR_MAN_NMIM | NMIMR_AUX_NMIM;
67 break;
68 case NMI_MODE_MASKED:
69 case NMI_MODE_UNKNOWN:
70 default:
71 source = mask = 0;
72 break;
73 }
74
75 /* Set the NMI source */
76 tmp = fpga_read_reg(NMISR);
77 tmp &= ~NMISR_MASK;
78 tmp |= source;
79 fpga_write_reg(tmp, NMISR);
80
81 /* And the IRQ masking */
82 fpga_write_reg(NMIMR_MASK ^ mask, NMIMR);
83}
diff --git a/arch/sh/boards/mach-sdk7786/setup.c b/arch/sh/boards/mach-sdk7786/setup.c
index 7e0c4e3878e0..75e4ddbbec3e 100644
--- a/arch/sh/boards/mach-sdk7786/setup.c
+++ b/arch/sh/boards/mach-sdk7786/setup.c
@@ -237,6 +237,7 @@ static void __init sdk7786_setup(char **cmdline_p)
237 pr_info("Renesas Technology Europe SDK7786 support:\n"); 237 pr_info("Renesas Technology Europe SDK7786 support:\n");
238 238
239 sdk7786_fpga_init(); 239 sdk7786_fpga_init();
240 sdk7786_nmi_init();
240 241
241 pr_info("\tPCB revision:\t%d\n", fpga_read_reg(PCBRR) & 0xf); 242 pr_info("\tPCB revision:\t%d\n", fpga_read_reg(PCBRR) & 0xf);
242 243
diff --git a/arch/sh/include/mach-sdk7786/mach/fpga.h b/arch/sh/include/mach-sdk7786/mach/fpga.h
index 40f0c2d3690c..a9cdac469927 100644
--- a/arch/sh/include/mach-sdk7786/mach/fpga.h
+++ b/arch/sh/include/mach-sdk7786/mach/fpga.h
@@ -14,11 +14,16 @@
14#define INTTESTR 0x040 14#define INTTESTR 0x040
15#define SYSSR 0x050 15#define SYSSR 0x050
16#define NRGPR 0x060 16#define NRGPR 0x060
17
17#define NMISR 0x070 18#define NMISR 0x070
19#define NMISR_MAN_NMI BIT(0)
20#define NMISR_AUX_NMI BIT(1)
21#define NMISR_MASK (NMISR_MAN_NMI | NMISR_AUX_NMI)
18 22
19#define NMIMR 0x080 23#define NMIMR 0x080
20#define NMIMR_MAN_NMIM BIT(0) /* Manual NMI mask */ 24#define NMIMR_MAN_NMIM BIT(0) /* Manual NMI mask */
21#define NMIMR_AUX_NMIM BIT(1) /* Auxiliary NMI mask */ 25#define NMIMR_AUX_NMIM BIT(1) /* Auxiliary NMI mask */
26#define NMIMR_MASK (NMIMR_MAN_NMIM | NMIMR_AUX_NMIM)
22 27
23#define INTBSR 0x090 28#define INTBSR 0x090
24#define INTBMR 0x0a0 29#define INTBMR 0x0a0
@@ -126,6 +131,9 @@
126extern void __iomem *sdk7786_fpga_base; 131extern void __iomem *sdk7786_fpga_base;
127extern void sdk7786_fpga_init(void); 132extern void sdk7786_fpga_init(void);
128 133
134/* arch/sh/boards/mach-sdk7786/nmi.c */
135extern void sdk7786_nmi_init(void);
136
129#define SDK7786_FPGA_REGADDR(reg) (sdk7786_fpga_base + (reg)) 137#define SDK7786_FPGA_REGADDR(reg) (sdk7786_fpga_base + (reg))
130 138
131/* 139/*