aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/mach-se/7722
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-07-29 08:01:19 -0400
committerPaul Mundt <lethal@linux-sh.org>2008-07-29 08:01:19 -0400
commitda2014a2b080e7f3024a4eb6917d47069ad9620b (patch)
treecfde12c6d4b5baa222966b14a676f107992cf786 /arch/sh/boards/mach-se/7722
parent71b8064e7df5698520d73b4c1566a3dbc98eb9ef (diff)
sh: Shuffle the board directories in to mach groups.
This flattens out the board directories in to individual mach groups, we will use this for getting rid of unneeded directories, simplifying the build system, and becoming more coherent with the refactored arch/sh/include topology. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards/mach-se/7722')
-rw-r--r--arch/sh/boards/mach-se/7722/Makefile10
-rw-r--r--arch/sh/boards/mach-se/7722/irq.c76
-rw-r--r--arch/sh/boards/mach-se/7722/setup.c194
3 files changed, 280 insertions, 0 deletions
diff --git a/arch/sh/boards/mach-se/7722/Makefile b/arch/sh/boards/mach-se/7722/Makefile
new file mode 100644
index 000000000000..8694373389e5
--- /dev/null
+++ b/arch/sh/boards/mach-se/7722/Makefile
@@ -0,0 +1,10 @@
1#
2# Makefile for the HITACHI UL SolutionEngine 7722 specific parts of the kernel
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License. See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8#
9
10obj-y := setup.o irq.o
diff --git a/arch/sh/boards/mach-se/7722/irq.c b/arch/sh/boards/mach-se/7722/irq.c
new file mode 100644
index 000000000000..0b03f3f610b8
--- /dev/null
+++ b/arch/sh/boards/mach-se/7722/irq.c
@@ -0,0 +1,76 @@
1/*
2 * linux/arch/sh/boards/se/7722/irq.c
3 *
4 * Copyright (C) 2007 Nobuhiro Iwamatsu
5 *
6 * Hitachi UL SolutionEngine 7722 Support.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/interrupt.h>
15#include <asm/irq.h>
16#include <asm/io.h>
17#include <asm/se7722.h>
18
19static void disable_se7722_irq(unsigned int irq)
20{
21 unsigned int bit = irq - SE7722_FPGA_IRQ_BASE;
22 ctrl_outw(ctrl_inw(IRQ01_MASK) | 1 << bit, IRQ01_MASK);
23}
24
25static void enable_se7722_irq(unsigned int irq)
26{
27 unsigned int bit = irq - SE7722_FPGA_IRQ_BASE;
28 ctrl_outw(ctrl_inw(IRQ01_MASK) & ~(1 << bit), IRQ01_MASK);
29}
30
31static struct irq_chip se7722_irq_chip __read_mostly = {
32 .name = "SE7722-FPGA",
33 .mask = disable_se7722_irq,
34 .unmask = enable_se7722_irq,
35 .mask_ack = disable_se7722_irq,
36};
37
38static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc)
39{
40 unsigned short intv = ctrl_inw(IRQ01_STS);
41 struct irq_desc *ext_desc;
42 unsigned int ext_irq = SE7722_FPGA_IRQ_BASE;
43
44 intv &= (1 << SE7722_FPGA_IRQ_NR) - 1;
45
46 while (intv) {
47 if (intv & 1) {
48 ext_desc = irq_desc + ext_irq;
49 handle_level_irq(ext_irq, ext_desc);
50 }
51 intv >>= 1;
52 ext_irq++;
53 }
54}
55
56/*
57 * Initialize IRQ setting
58 */
59void __init init_se7722_IRQ(void)
60{
61 int i;
62
63 ctrl_outw(0, IRQ01_MASK); /* disable all irqs */
64 ctrl_outw(0x2000, 0xb03fffec); /* mrshpc irq enable */
65
66 for (i = 0; i < SE7722_FPGA_IRQ_NR; i++)
67 set_irq_chip_and_handler_name(SE7722_FPGA_IRQ_BASE + i,
68 &se7722_irq_chip,
69 handle_level_irq, "level");
70
71 set_irq_chained_handler(IRQ0_IRQ, se7722_irq_demux);
72 set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW);
73
74 set_irq_chained_handler(IRQ1_IRQ, se7722_irq_demux);
75 set_irq_type(IRQ1_IRQ, IRQ_TYPE_LEVEL_LOW);
76}
diff --git a/arch/sh/boards/mach-se/7722/setup.c b/arch/sh/boards/mach-se/7722/setup.c
new file mode 100644
index 000000000000..6e228ea59788
--- /dev/null
+++ b/arch/sh/boards/mach-se/7722/setup.c
@@ -0,0 +1,194 @@
1/*
2 * linux/arch/sh/boards/se/7722/setup.c
3 *
4 * Copyright (C) 2007 Nobuhiro Iwamatsu
5 *
6 * Hitachi UL SolutionEngine 7722 Support.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 *
12 */
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/ata_platform.h>
16#include <linux/input.h>
17#include <linux/smc91x.h>
18#include <asm/machvec.h>
19#include <asm/clock.h>
20#include <asm/se7722.h>
21#include <asm/io.h>
22#include <asm/heartbeat.h>
23#include <asm/sh_keysc.h>
24
25/* Heartbeat */
26static struct heartbeat_data heartbeat_data = {
27 .regsize = 16,
28};
29
30static struct resource heartbeat_resources[] = {
31 [0] = {
32 .start = PA_LED,
33 .end = PA_LED,
34 .flags = IORESOURCE_MEM,
35 },
36};
37
38static struct platform_device heartbeat_device = {
39 .name = "heartbeat",
40 .id = -1,
41 .dev = {
42 .platform_data = &heartbeat_data,
43 },
44 .num_resources = ARRAY_SIZE(heartbeat_resources),
45 .resource = heartbeat_resources,
46};
47
48/* SMC91x */
49static struct smc91x_platdata smc91x_info = {
50 .flags = SMC91X_USE_16BIT,
51};
52
53static struct resource smc91x_eth_resources[] = {
54 [0] = {
55 .name = "smc91x-regs" ,
56 .start = PA_LAN + 0x300,
57 .end = PA_LAN + 0x300 + 0x10 ,
58 .flags = IORESOURCE_MEM,
59 },
60 [1] = {
61 .start = SMC_IRQ,
62 .end = SMC_IRQ,
63 .flags = IORESOURCE_IRQ,
64 },
65};
66
67static struct platform_device smc91x_eth_device = {
68 .name = "smc91x",
69 .id = 0,
70 .dev = {
71 .dma_mask = NULL, /* don't use dma */
72 .coherent_dma_mask = 0xffffffff,
73 .platform_data = &smc91x_info,
74 },
75 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
76 .resource = smc91x_eth_resources,
77};
78
79static struct resource cf_ide_resources[] = {
80 [0] = {
81 .start = PA_MRSHPC_IO + 0x1f0,
82 .end = PA_MRSHPC_IO + 0x1f0 + 8 ,
83 .flags = IORESOURCE_IO,
84 },
85 [1] = {
86 .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
87 .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8,
88 .flags = IORESOURCE_IO,
89 },
90 [2] = {
91 .start = MRSHPC_IRQ0,
92 .end = MRSHPC_IRQ0,
93 .flags = IORESOURCE_IRQ,
94 },
95};
96
97static struct platform_device cf_ide_device = {
98 .name = "pata_platform",
99 .id = -1,
100 .num_resources = ARRAY_SIZE(cf_ide_resources),
101 .resource = cf_ide_resources,
102};
103
104static struct sh_keysc_info sh_keysc_info = {
105 .mode = SH_KEYSC_MODE_1, /* KEYOUT0->5, KEYIN0->4 */
106 .scan_timing = 3,
107 .delay = 5,
108 .keycodes = { /* SW1 -> SW30 */
109 KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,
110 KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
111 KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
112 KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T,
113 KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y,
114 KEY_Z,
115 KEY_HOME, KEY_SLEEP, KEY_WAKEUP, KEY_COFFEE, /* life */
116 },
117};
118
119static struct resource sh_keysc_resources[] = {
120 [0] = {
121 .start = 0x044b0000,
122 .end = 0x044b000f,
123 .flags = IORESOURCE_MEM,
124 },
125 [1] = {
126 .start = 79,
127 .flags = IORESOURCE_IRQ,
128 },
129};
130
131static struct platform_device sh_keysc_device = {
132 .name = "sh_keysc",
133 .num_resources = ARRAY_SIZE(sh_keysc_resources),
134 .resource = sh_keysc_resources,
135 .dev = {
136 .platform_data = &sh_keysc_info,
137 },
138};
139
140static struct platform_device *se7722_devices[] __initdata = {
141 &heartbeat_device,
142 &smc91x_eth_device,
143 &cf_ide_device,
144 &sh_keysc_device,
145};
146
147static int __init se7722_devices_setup(void)
148{
149 clk_always_enable("mstp214"); /* KEYSC */
150
151 return platform_add_devices(se7722_devices,
152 ARRAY_SIZE(se7722_devices));
153}
154device_initcall(se7722_devices_setup);
155
156static void __init se7722_setup(char **cmdline_p)
157{
158 ctrl_outw(0x010D, FPGA_OUT); /* FPGA */
159
160 ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */
161 ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */
162
163 /* LCDC I/O */
164 ctrl_outw(0x0020, PORT_PSELD);
165
166 /* SIOF1*/
167 ctrl_outw(0x0003, PORT_PSELB);
168 ctrl_outw(0xe000, PORT_PSELC);
169 ctrl_outw(0x0000, PORT_PKCR);
170
171 /* LCDC */
172 ctrl_outw(0x4020, PORT_PHCR);
173 ctrl_outw(0x0000, PORT_PLCR);
174 ctrl_outw(0x0000, PORT_PMCR);
175 ctrl_outw(0x0002, PORT_PRCR);
176 ctrl_outw(0x0000, PORT_PXCR); /* LCDC,CS6A */
177
178 /* KEYSC */
179 ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */
180 ctrl_outw(0x0000, PORT_PYCR);
181 ctrl_outw(0x0000, PORT_PZCR);
182 ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA);
183 ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC);
184}
185
186/*
187 * The Machine Vector
188 */
189static struct sh_machine_vector mv_se7722 __initmv = {
190 .mv_name = "Solution Engine 7722" ,
191 .mv_setup = se7722_setup ,
192 .mv_nr_irqs = SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_NR,
193 .mv_init_irq = init_se7722_IRQ,
194};