blob: 03b63457e1780c9fb3c77ec5bf185eaa4abfd7f0 [file] [log] [blame]
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +09001/*
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/pata_platform.h>
16#include <asm/machvec.h>
17#include <asm/se7722.h>
18#include <asm/io.h>
19
20/* Heartbeat */
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +090021static struct resource heartbeat_resources[] = {
22 [0] = {
23 .start = PA_LED,
Paul Mundta1fd3062007-08-23 15:11:44 +090024 .end = PA_LED,
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +090025 .flags = IORESOURCE_MEM,
26 },
27};
28
29static struct platform_device heartbeat_device = {
30 .name = "heartbeat",
31 .id = -1,
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +090032 .num_resources = ARRAY_SIZE(heartbeat_resources),
33 .resource = heartbeat_resources,
34};
35
36/* SMC91x */
37static struct resource smc91x_eth_resources[] = {
38 [0] = {
39 .name = "smc91x-regs" ,
40 .start = PA_LAN + 0x300,
41 .end = PA_LAN + 0x300 + 0x10 ,
42 .flags = IORESOURCE_MEM,
43 },
44 [1] = {
45 .start = SMC_IRQ,
46 .end = SMC_IRQ,
47 .flags = IORESOURCE_IRQ,
48 },
49};
50
51static struct platform_device smc91x_eth_device = {
52 .name = "smc91x",
53 .id = 0,
54 .dev = {
55 .dma_mask = NULL, /* don't use dma */
56 .coherent_dma_mask = 0xffffffff,
57 },
58 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
59 .resource = smc91x_eth_resources,
60};
61
62static struct resource cf_ide_resources[] = {
63 [0] = {
64 .start = PA_MRSHPC_IO + 0x1f0,
65 .end = PA_MRSHPC_IO + 0x1f0 + 8 ,
66 .flags = IORESOURCE_IO,
67 },
68 [1] = {
69 .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
70 .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8,
71 .flags = IORESOURCE_IO,
72 },
73 [2] = {
74 .start = MRSHPC_IRQ0,
Magnus Damm493a3582007-07-18 17:54:10 +090075 .end = MRSHPC_IRQ0,
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +090076 .flags = IORESOURCE_IRQ,
77 },
78};
79
80static struct platform_device cf_ide_device = {
81 .name = "pata_platform",
82 .id = -1,
83 .num_resources = ARRAY_SIZE(cf_ide_resources),
84 .resource = cf_ide_resources,
85};
86
87static struct platform_device *se7722_devices[] __initdata = {
88 &heartbeat_device,
89 &smc91x_eth_device,
90 &cf_ide_device,
91};
92
93static int __init se7722_devices_setup(void)
94{
95 return platform_add_devices(se7722_devices,
96 ARRAY_SIZE(se7722_devices));
97}
98device_initcall(se7722_devices_setup);
99
100static void __init se7722_setup(char **cmdline_p)
101{
102 ctrl_outw(0x010D, FPGA_OUT); /* FPGA */
103
104 ctrl_outl(0x00051001, MSTPCR0);
105 ctrl_outl(0x00000000, MSTPCR1);
106 /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC */
Paul Mundt8786c952007-08-20 13:03:41 +0900107 ctrl_outl(0xffffbfC0, MSTPCR2);
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +0900108
109 ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */
110 ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */
111
112 /* LCDC I/O */
113 ctrl_outw(0x0020, PORT_PSELD);
114
115 /* SIOF1*/
116 ctrl_outw(0x0003, PORT_PSELB);
117 ctrl_outw(0xe000, PORT_PSELC);
118 ctrl_outw(0x0000, PORT_PKCR);
119
120 /* LCDC */
121 ctrl_outw(0x4020, PORT_PHCR);
122 ctrl_outw(0x0000, PORT_PLCR);
123 ctrl_outw(0x0000, PORT_PMCR);
124 ctrl_outw(0x0002, PORT_PRCR);
125 ctrl_outw(0x0000, PORT_PXCR); /* LCDC,CS6A */
126
127 /* KEYSC */
128 ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */
129 ctrl_outw(0x0000, PORT_PYCR);
130 ctrl_outw(0x0000, PORT_PZCR);
131}
132
133/*
134 * The Machine Vector
135 */
Paul Mundt82f81f42007-05-15 15:19:34 +0900136static struct sh_machine_vector mv_se7722 __initmv = {
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +0900137 .mv_name = "Solution Engine 7722" ,
138 .mv_setup = se7722_setup ,
Magnus Damm493a3582007-07-18 17:54:10 +0900139 .mv_nr_irqs = SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_NR,
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +0900140 .mv_init_irq = init_se7722_IRQ,
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +0900141};