Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / arch / sh / boards / se / 7722 / setup.c
blobb1a3d9d0172f50678c5add2c1388bb5094afbcf2
1 /*
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
10 * for more details.
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/ata_platform.h>
16 #include <asm/machvec.h>
17 #include <asm/se7722.h>
18 #include <asm/io.h>
19 #include <asm/heartbeat.h>
21 /* Heartbeat */
22 static struct heartbeat_data heartbeat_data = {
23 .regsize = 16,
26 static struct resource heartbeat_resources[] = {
27 [0] = {
28 .start = PA_LED,
29 .end = PA_LED,
30 .flags = IORESOURCE_MEM,
34 static struct platform_device heartbeat_device = {
35 .name = "heartbeat",
36 .id = -1,
37 .dev = {
38 .platform_data = &heartbeat_data,
40 .num_resources = ARRAY_SIZE(heartbeat_resources),
41 .resource = heartbeat_resources,
44 /* SMC91x */
45 static struct resource smc91x_eth_resources[] = {
46 [0] = {
47 .name = "smc91x-regs" ,
48 .start = PA_LAN + 0x300,
49 .end = PA_LAN + 0x300 + 0x10 ,
50 .flags = IORESOURCE_MEM,
52 [1] = {
53 .start = SMC_IRQ,
54 .end = SMC_IRQ,
55 .flags = IORESOURCE_IRQ,
59 static struct platform_device smc91x_eth_device = {
60 .name = "smc91x",
61 .id = 0,
62 .dev = {
63 .dma_mask = NULL, /* don't use dma */
64 .coherent_dma_mask = 0xffffffff,
66 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
67 .resource = smc91x_eth_resources,
70 static struct resource cf_ide_resources[] = {
71 [0] = {
72 .start = PA_MRSHPC_IO + 0x1f0,
73 .end = PA_MRSHPC_IO + 0x1f0 + 8 ,
74 .flags = IORESOURCE_IO,
76 [1] = {
77 .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
78 .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8,
79 .flags = IORESOURCE_IO,
81 [2] = {
82 .start = MRSHPC_IRQ0,
83 .end = MRSHPC_IRQ0,
84 .flags = IORESOURCE_IRQ,
88 static struct platform_device cf_ide_device = {
89 .name = "pata_platform",
90 .id = -1,
91 .num_resources = ARRAY_SIZE(cf_ide_resources),
92 .resource = cf_ide_resources,
95 static struct platform_device *se7722_devices[] __initdata = {
96 &heartbeat_device,
97 &smc91x_eth_device,
98 &cf_ide_device,
101 static int __init se7722_devices_setup(void)
103 return platform_add_devices(se7722_devices,
104 ARRAY_SIZE(se7722_devices));
106 device_initcall(se7722_devices_setup);
108 static void __init se7722_setup(char **cmdline_p)
110 ctrl_outw(0x010D, FPGA_OUT); /* FPGA */
112 ctrl_outl(0x00051001, MSTPCR0);
113 ctrl_outl(0x00000000, MSTPCR1);
114 /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC, USB */
115 ctrl_outl(0xffffb7c0, MSTPCR2);
117 ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */
118 ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */
120 /* LCDC I/O */
121 ctrl_outw(0x0020, PORT_PSELD);
123 /* SIOF1*/
124 ctrl_outw(0x0003, PORT_PSELB);
125 ctrl_outw(0xe000, PORT_PSELC);
126 ctrl_outw(0x0000, PORT_PKCR);
128 /* LCDC */
129 ctrl_outw(0x4020, PORT_PHCR);
130 ctrl_outw(0x0000, PORT_PLCR);
131 ctrl_outw(0x0000, PORT_PMCR);
132 ctrl_outw(0x0002, PORT_PRCR);
133 ctrl_outw(0x0000, PORT_PXCR); /* LCDC,CS6A */
135 /* KEYSC */
136 ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */
137 ctrl_outw(0x0000, PORT_PYCR);
138 ctrl_outw(0x0000, PORT_PZCR);
142 * The Machine Vector
144 static struct sh_machine_vector mv_se7722 __initmv = {
145 .mv_name = "Solution Engine 7722" ,
146 .mv_setup = se7722_setup ,
147 .mv_nr_irqs = SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_NR,
148 .mv_init_irq = init_se7722_IRQ,