]> err.no Git - linux-2.6/blob - arch/sh/boards/se/7722/setup.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen...
[linux-2.6] / arch / sh / boards / se / 7722 / setup.c
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 <asm/machvec.h>
18 #include <asm/se7722.h>
19 #include <asm/io.h>
20 #include <asm/heartbeat.h>
21 #include <asm/sh_keysc.h>
22
23 /* Heartbeat */
24 static struct heartbeat_data heartbeat_data = {
25         .regsize = 16,
26 };
27
28 static struct resource heartbeat_resources[] = {
29         [0] = {
30                 .start  = PA_LED,
31                 .end    = PA_LED,
32                 .flags  = IORESOURCE_MEM,
33         },
34 };
35
36 static struct platform_device heartbeat_device = {
37         .name           = "heartbeat",
38         .id             = -1,
39         .dev = {
40                 .platform_data = &heartbeat_data,
41         },
42         .num_resources  = ARRAY_SIZE(heartbeat_resources),
43         .resource       = heartbeat_resources,
44 };
45
46 /* SMC91x */
47 static struct resource smc91x_eth_resources[] = {
48         [0] = {
49                 .name   = "smc91x-regs" ,
50                 .start  = PA_LAN + 0x300,
51                 .end    = PA_LAN + 0x300 + 0x10 ,
52                 .flags  = IORESOURCE_MEM,
53         },
54         [1] = {
55                 .start  = SMC_IRQ,
56                 .end    = SMC_IRQ,
57                 .flags  = IORESOURCE_IRQ,
58         },
59 };
60
61 static struct platform_device smc91x_eth_device = {
62         .name           = "smc91x",
63         .id             = 0,
64         .dev = {
65                 .dma_mask               = NULL,         /* don't use dma */
66                 .coherent_dma_mask      = 0xffffffff,
67         },
68         .num_resources  = ARRAY_SIZE(smc91x_eth_resources),
69         .resource       = smc91x_eth_resources,
70 };
71
72 static struct resource cf_ide_resources[] = {
73         [0] = {
74                 .start  = PA_MRSHPC_IO + 0x1f0,
75                 .end    = PA_MRSHPC_IO + 0x1f0 + 8 ,
76                 .flags  = IORESOURCE_IO,
77         },
78         [1] = {
79                 .start  = PA_MRSHPC_IO + 0x1f0 + 0x206,
80                 .end    = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8,
81                 .flags  = IORESOURCE_IO,
82         },
83         [2] = {
84                 .start  = MRSHPC_IRQ0,
85                 .end    = MRSHPC_IRQ0,
86                 .flags  = IORESOURCE_IRQ,
87         },
88 };
89
90 static struct platform_device cf_ide_device  = {
91         .name           = "pata_platform",
92         .id             = -1,
93         .num_resources  = ARRAY_SIZE(cf_ide_resources),
94         .resource       = cf_ide_resources,
95 };
96
97 static struct sh_keysc_info sh_keysc_info = {
98         .mode = SH_KEYSC_MODE_1, /* KEYOUT0->5, KEYIN0->4 */
99         .scan_timing = 3,
100         .delay = 5,
101         .keycodes = { /* SW1 -> SW30 */
102                 KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,
103                 KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
104                 KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
105                 KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T,
106                 KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y,
107                 KEY_Z,
108                 KEY_HOME, KEY_SLEEP, KEY_WAKEUP, KEY_COFFEE, /* life */
109         },
110 };
111
112 static struct resource sh_keysc_resources[] = {
113         [0] = {
114                 .start  = 0x044b0000,
115                 .end    = 0x044b000f,
116                 .flags  = IORESOURCE_MEM,
117         },
118         [1] = {
119                 .start  = 79,
120                 .flags  = IORESOURCE_IRQ,
121         },
122 };
123
124 static struct platform_device sh_keysc_device = {
125         .name           = "sh_keysc",
126         .num_resources  = ARRAY_SIZE(sh_keysc_resources),
127         .resource       = sh_keysc_resources,
128         .dev    = {
129                 .platform_data  = &sh_keysc_info,
130         },
131 };
132
133 static struct platform_device *se7722_devices[] __initdata = {
134         &heartbeat_device,
135         &smc91x_eth_device,
136         &cf_ide_device,
137         &sh_keysc_device,
138 };
139
140 static int __init se7722_devices_setup(void)
141 {
142         return platform_add_devices(se7722_devices,
143                 ARRAY_SIZE(se7722_devices));
144 }
145 device_initcall(se7722_devices_setup);
146
147 static void __init se7722_setup(char **cmdline_p)
148 {
149         ctrl_outw(0x010D, FPGA_OUT);    /* FPGA */
150
151         ctrl_outl(0x00051001, MSTPCR0);
152         ctrl_outl(0x00000000, MSTPCR1);
153         /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC, USB */
154         ctrl_outl(0xffffb7c0, MSTPCR2);
155
156         ctrl_outw(0x0000, PORT_PECR);   /* PORT E 1 = IRQ5 ,E 0 = BS */
157         ctrl_outw(0x1000, PORT_PJCR);   /* PORT J 1 = IRQ1,J 0 =IRQ0 */
158
159         /* LCDC I/O */
160         ctrl_outw(0x0020, PORT_PSELD);
161
162         /* SIOF1*/
163         ctrl_outw(0x0003, PORT_PSELB);
164         ctrl_outw(0xe000, PORT_PSELC);
165         ctrl_outw(0x0000, PORT_PKCR);
166
167         /* LCDC */
168         ctrl_outw(0x4020, PORT_PHCR);
169         ctrl_outw(0x0000, PORT_PLCR);
170         ctrl_outw(0x0000, PORT_PMCR);
171         ctrl_outw(0x0002, PORT_PRCR);
172         ctrl_outw(0x0000, PORT_PXCR);   /* LCDC,CS6A */
173
174         /* KEYSC */
175         ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */
176         ctrl_outw(0x0000, PORT_PYCR);
177         ctrl_outw(0x0000, PORT_PZCR);
178         ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA);
179         ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC);
180 }
181
182 /*
183  * The Machine Vector
184  */
185 static struct sh_machine_vector mv_se7722 __initmv = {
186         .mv_name                = "Solution Engine 7722" ,
187         .mv_setup               = se7722_setup ,
188         .mv_nr_irqs             = SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_NR,
189         .mv_init_irq            = init_se7722_IRQ,
190 };