]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/sh/boards/mach-ecovec24/setup.c
sh: modify to enable boot for EcoVec24
[net-next-2.6.git] / arch / sh / boards / mach-ecovec24 / setup.c
CommitLineData
4138b740
KM
1/*
2 * Copyright (C) 2009 Renesas Solutions Corp.
3 *
4 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/init.h>
12#include <linux/device.h>
13#include <linux/platform_device.h>
14#include <linux/mtd/physmap.h>
15#include <linux/gpio.h>
16#include <linux/interrupt.h>
17#include <asm/io.h>
18#include <asm/heartbeat.h>
19#include <cpu/sh7724.h>
20
21/*
b7056bc1
KM
22 * Address Interface BusWidth
23 *-----------------------------------------
24 * 0x0000_0000 uboot 16bit
25 * 0x0004_0000 Linux romImage 16bit
26 * 0x0014_0000 MTD for Linux 16bit
27 * 0x0400_0000 Internal I/O 16/32bit
28 * 0x0800_0000 DRAM 32bit
29 * 0x1800_0000 MFI 16bit
4138b740
KM
30 */
31
32/* Heartbeat */
33static unsigned char led_pos[] = { 0, 1, 2, 3 };
34static struct heartbeat_data heartbeat_data = {
35 .regsize = 8,
36 .nr_bits = 4,
37 .bit_pos = led_pos,
38};
39
40static struct resource heartbeat_resources[] = {
41 [0] = {
42 .start = 0xA405012C, /* PTG */
43 .end = 0xA405012E - 1,
44 .flags = IORESOURCE_MEM,
45 },
46};
47
48static struct platform_device heartbeat_device = {
49 .name = "heartbeat",
50 .id = -1,
51 .dev = {
52 .platform_data = &heartbeat_data,
53 },
54 .num_resources = ARRAY_SIZE(heartbeat_resources),
55 .resource = heartbeat_resources,
56};
57
58/* MTD */
59static struct mtd_partition nor_flash_partitions[] = {
60 {
b7056bc1 61 .name = "boot loader",
4138b740 62 .offset = 0,
b7056bc1 63 .size = (5 * 1024 * 1024),
4138b740 64 .mask_flags = MTD_CAP_ROM,
4138b740
KM
65 }, {
66 .name = "free-area",
67 .offset = MTDPART_OFS_APPEND,
68 .size = MTDPART_SIZ_FULL,
69 },
70};
71
72static struct physmap_flash_data nor_flash_data = {
73 .width = 2,
74 .parts = nor_flash_partitions,
75 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
76};
77
78static struct resource nor_flash_resources[] = {
79 [0] = {
80 .name = "NOR Flash",
81 .start = 0x00000000,
82 .end = 0x03ffffff,
83 .flags = IORESOURCE_MEM,
84 }
85};
86
87static struct platform_device nor_flash_device = {
88 .name = "physmap-flash",
89 .resource = nor_flash_resources,
90 .num_resources = ARRAY_SIZE(nor_flash_resources),
91 .dev = {
92 .platform_data = &nor_flash_data,
93 },
94};
95
96static struct platform_device *ecovec_devices[] __initdata = {
97 &heartbeat_device,
98 &nor_flash_device,
99};
100
101static int __init devices_setup(void)
102{
103 /* enable SCIFA0 */
104 gpio_request(GPIO_FN_SCIF0_TXD, NULL);
105 gpio_request(GPIO_FN_SCIF0_RXD, NULL);
4138b740
KM
106
107 /* enable debug LED */
108 gpio_request(GPIO_PTG0, NULL);
109 gpio_request(GPIO_PTG1, NULL);
110 gpio_request(GPIO_PTG2, NULL);
111 gpio_request(GPIO_PTG3, NULL);
b7056bc1
KM
112 gpio_direction_output(GPIO_PTG0, 0);
113 gpio_direction_output(GPIO_PTG1, 0);
114 gpio_direction_output(GPIO_PTG2, 0);
115 gpio_direction_output(GPIO_PTG3, 0);
4138b740
KM
116
117 return platform_add_devices(ecovec_devices,
118 ARRAY_SIZE(ecovec_devices));
119}
120device_initcall(devices_setup);
121
122static struct sh_machine_vector mv_ecovec __initmv = {
123 .mv_name = "R0P7724 (EcoVec)",
124};