blob: eb97dca5b736c4fce596c74c55476ace350b3424 [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>
Nobuhiro Iwamatsu9c88b6b2007-11-07 14:56:46 +090019#include <asm/heartbeat.h>
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +090020
21/* Heartbeat */
Nobuhiro Iwamatsu9c88b6b2007-11-07 14:56:46 +090022static struct heartbeat_data heartbeat_data = {
23 .regsize = 16,
24};
25
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +090026static struct resource heartbeat_resources[] = {
27 [0] = {
28 .start = PA_LED,
Paul Mundta1fd3062007-08-23 15:11:44 +090029 .end = PA_LED,
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +090030 .flags = IORESOURCE_MEM,
31 },
32};
33
34static struct platform_device heartbeat_device = {
35 .name = "heartbeat",
36 .id = -1,
Nobuhiro Iwamatsu9c88b6b2007-11-07 14:56:46 +090037 .dev = {
38 .platform_data = &heartbeat_data,
39 },
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +090040 .num_resources = ARRAY_SIZE(heartbeat_resources),
41 .resource = heartbeat_resources,
42};
43
44/* SMC91x */
45static 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,
51 },
52 [1] = {
53 .start = SMC_IRQ,
54 .end = SMC_IRQ,
55 .flags = IORESOURCE_IRQ,
56 },
57};
58
59static 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,
65 },
66 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
67 .resource = smc91x_eth_resources,
68};
69
70static struct resource cf_ide_resources[] = {
71 [0] = {
72 .start = PA_MRSHPC_IO + 0x1f0,
73 .end = PA_MRSHPC_IO + 0x1f0 + 8 ,
74 .flags = IORESOURCE_IO,
75 },
76 [1] = {
77 .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
78 .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8,
79 .flags = IORESOURCE_IO,
80 },
81 [2] = {
82 .start = MRSHPC_IRQ0,
Magnus Damm493a3582007-07-18 17:54:10 +090083 .end = MRSHPC_IRQ0,
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +090084 .flags = IORESOURCE_IRQ,
85 },
86};
87
88static 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,
93};
94
95static struct platform_device *se7722_devices[] __initdata = {
96 &heartbeat_device,
97 &smc91x_eth_device,
98 &cf_ide_device,
99};
100
101static int __init se7722_devices_setup(void)
102{
103 return platform_add_devices(se7722_devices,
104 ARRAY_SIZE(se7722_devices));
105}
106device_initcall(se7722_devices_setup);
107
108static void __init se7722_setup(char **cmdline_p)
109{
110 ctrl_outw(0x010D, FPGA_OUT); /* FPGA */
111
112 ctrl_outl(0x00051001, MSTPCR0);
113 ctrl_outl(0x00000000, MSTPCR1);
Yoshihiro Shimoda16f393d2007-10-30 13:05:51 +0900114 /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC, USB */
115 ctrl_outl(0xffffb7c0, MSTPCR2);
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +0900116
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 */
119
120 /* LCDC I/O */
121 ctrl_outw(0x0020, PORT_PSELD);
122
123 /* SIOF1*/
124 ctrl_outw(0x0003, PORT_PSELB);
125 ctrl_outw(0xe000, PORT_PSELC);
126 ctrl_outw(0x0000, PORT_PKCR);
127
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 */
134
135 /* KEYSC */
136 ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */
137 ctrl_outw(0x0000, PORT_PYCR);
138 ctrl_outw(0x0000, PORT_PZCR);
139}
140
141/*
142 * The Machine Vector
143 */
Paul Mundt82f81f42007-05-15 15:19:34 +0900144static struct sh_machine_vector mv_se7722 __initmv = {
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +0900145 .mv_name = "Solution Engine 7722" ,
146 .mv_setup = se7722_setup ,
Magnus Damm493a3582007-07-18 17:54:10 +0900147 .mv_nr_irqs = SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_NR,
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +0900148 .mv_init_irq = init_se7722_IRQ,
Ryusuke Sakato6865f0e2007-05-01 09:45:29 +0900149};