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