2 * linux/arch/sh/boards/se/7722/setup.c
4 * Copyright (C) 2007 Nobuhiro Iwamatsu
6 * Hitachi UL SolutionEngine 7722 Support.
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
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 <mach-se/mach/se7722.h>
19 #include <mach-se/mach/mrshpc.h>
20 #include <asm/machvec.h>
21 #include <asm/clock.h>
23 #include <asm/heartbeat.h>
24 #include <asm/sh_keysc.h>
27 static struct heartbeat_data heartbeat_data
= {
31 static struct resource heartbeat_resources
[] = {
35 .flags
= IORESOURCE_MEM
,
39 static struct platform_device heartbeat_device
= {
43 .platform_data
= &heartbeat_data
,
45 .num_resources
= ARRAY_SIZE(heartbeat_resources
),
46 .resource
= heartbeat_resources
,
50 static struct smc91x_platdata smc91x_info
= {
51 .flags
= SMC91X_USE_16BIT
,
54 static struct resource smc91x_eth_resources
[] = {
56 .name
= "smc91x-regs" ,
57 .start
= PA_LAN
+ 0x300,
58 .end
= PA_LAN
+ 0x300 + 0x10 ,
59 .flags
= IORESOURCE_MEM
,
64 .flags
= IORESOURCE_IRQ
,
68 static struct platform_device smc91x_eth_device
= {
72 .dma_mask
= NULL
, /* don't use dma */
73 .coherent_dma_mask
= 0xffffffff,
74 .platform_data
= &smc91x_info
,
76 .num_resources
= ARRAY_SIZE(smc91x_eth_resources
),
77 .resource
= smc91x_eth_resources
,
80 static struct resource cf_ide_resources
[] = {
82 .start
= PA_MRSHPC_IO
+ 0x1f0,
83 .end
= PA_MRSHPC_IO
+ 0x1f0 + 8 ,
84 .flags
= IORESOURCE_IO
,
87 .start
= PA_MRSHPC_IO
+ 0x1f0 + 0x206,
88 .end
= PA_MRSHPC_IO
+ 0x1f0 +8 + 0x206 + 8,
89 .flags
= IORESOURCE_IO
,
94 .flags
= IORESOURCE_IRQ
,
98 static struct platform_device cf_ide_device
= {
99 .name
= "pata_platform",
101 .num_resources
= ARRAY_SIZE(cf_ide_resources
),
102 .resource
= cf_ide_resources
,
105 static struct sh_keysc_info sh_keysc_info
= {
106 .mode
= SH_KEYSC_MODE_1
, /* KEYOUT0->5, KEYIN0->4 */
109 .keycodes
= { /* SW1 -> SW30 */
110 KEY_A
, KEY_B
, KEY_C
, KEY_D
, KEY_E
,
111 KEY_F
, KEY_G
, KEY_H
, KEY_I
, KEY_J
,
112 KEY_K
, KEY_L
, KEY_M
, KEY_N
, KEY_O
,
113 KEY_P
, KEY_Q
, KEY_R
, KEY_S
, KEY_T
,
114 KEY_U
, KEY_V
, KEY_W
, KEY_X
, KEY_Y
,
116 KEY_HOME
, KEY_SLEEP
, KEY_WAKEUP
, KEY_COFFEE
, /* life */
120 static struct resource sh_keysc_resources
[] = {
124 .flags
= IORESOURCE_MEM
,
128 .flags
= IORESOURCE_IRQ
,
132 static struct platform_device sh_keysc_device
= {
134 .id
= 0, /* "keysc0" clock */
135 .num_resources
= ARRAY_SIZE(sh_keysc_resources
),
136 .resource
= sh_keysc_resources
,
138 .platform_data
= &sh_keysc_info
,
142 static struct platform_device
*se7722_devices
[] __initdata
= {
149 static int __init
se7722_devices_setup(void)
151 mrshpc_setup_windows();
152 return platform_add_devices(se7722_devices
, ARRAY_SIZE(se7722_devices
));
154 device_initcall(se7722_devices_setup
);
156 static void __init
se7722_setup(char **cmdline_p
)
158 ctrl_outw(0x010D, FPGA_OUT
); /* FPGA */
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 */
164 ctrl_outw(0x0020, PORT_PSELD
);
167 ctrl_outw(0x0003, PORT_PSELB
);
168 ctrl_outw(0xe000, PORT_PSELC
);
169 ctrl_outw(0x0000, PORT_PKCR
);
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 */
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
);
189 static 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
,