ARM: mach-shmobile: Add mackerel board support
[linux-2.6-block.git] / arch / arm / mach-shmobile / board-mackerel.c
CommitLineData
920adc75
KM
1/*
2 * mackerel board support
3 *
4 * Copyright (C) 2010 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * based on ap4evb
8 * Copyright (C) 2010 Magnus Damm
9 * Copyright (C) 2008 Yoshihiro Shimoda
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 2 of the License.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24#include <linux/kernel.h>
25#include <linux/init.h>
26#include <linux/interrupt.h>
27#include <linux/irq.h>
28#include <linux/platform_device.h>
29#include <linux/gpio.h>
30#include <linux/input.h>
31#include <linux/io.h>
32#include <linux/mtd/mtd.h>
33#include <linux/mtd/partitions.h>
34#include <linux/mtd/physmap.h>
35
36#include <mach/common.h>
37#include <mach/sh7372.h>
38
39#include <asm/mach/arch.h>
40#include <asm/mach/time.h>
41#include <asm/mach/map.h>
42#include <asm/mach-types.h>
43
44/*
45 * Address Interface BusWidth note
46 * ------------------------------------------------------------------
47 * 0x0000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = ON
48 * 0x0800_0000 user area -
49 * 0x1000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = OFF
50 * 0x1400_0000 Ether (LAN9220) 16bit
51 * 0x1600_0000 user area - cannot use with NAND
52 * 0x1800_0000 user area -
53 * 0x1A00_0000 -
54 * 0x4000_0000 LPDDR2-SDRAM (POP) 32bit
55 */
56
57/* MTD */
58static struct mtd_partition nor_flash_partitions[] = {
59 {
60 .name = "loader",
61 .offset = 0x00000000,
62 .size = 512 * 1024,
63 .mask_flags = MTD_WRITEABLE,
64 },
65 {
66 .name = "bootenv",
67 .offset = MTDPART_OFS_APPEND,
68 .size = 512 * 1024,
69 .mask_flags = MTD_WRITEABLE,
70 },
71 {
72 .name = "kernel_ro",
73 .offset = MTDPART_OFS_APPEND,
74 .size = 8 * 1024 * 1024,
75 .mask_flags = MTD_WRITEABLE,
76 },
77 {
78 .name = "kernel",
79 .offset = MTDPART_OFS_APPEND,
80 .size = 8 * 1024 * 1024,
81 },
82 {
83 .name = "data",
84 .offset = MTDPART_OFS_APPEND,
85 .size = MTDPART_SIZ_FULL,
86 },
87};
88
89static struct physmap_flash_data nor_flash_data = {
90 .width = 2,
91 .parts = nor_flash_partitions,
92 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
93};
94
95static struct resource nor_flash_resources[] = {
96 [0] = {
97 .start = 0x00000000,
98 .end = 0x08000000 - 1,
99 .flags = IORESOURCE_MEM,
100 }
101};
102
103static struct platform_device nor_flash_device = {
104 .name = "physmap-flash",
105 .dev = {
106 .platform_data = &nor_flash_data,
107 },
108 .num_resources = ARRAY_SIZE(nor_flash_resources),
109 .resource = nor_flash_resources,
110};
111
112static struct platform_device *mackerel_devices[] __initdata = {
113 &nor_flash_device,
114};
115
116static struct map_desc mackerel_io_desc[] __initdata = {
117 /* create a 1:1 entity map for 0xe6xxxxxx
118 * used by CPGA, INTC and PFC.
119 */
120 {
121 .virtual = 0xe6000000,
122 .pfn = __phys_to_pfn(0xe6000000),
123 .length = 256 << 20,
124 .type = MT_DEVICE_NONSHARED
125 },
126};
127
128static void __init mackerel_map_io(void)
129{
130 iotable_init(mackerel_io_desc, ARRAY_SIZE(mackerel_io_desc));
131
132 /* setup early devices and console here as well */
133 sh7372_add_early_devices();
134 shmobile_setup_console();
135}
136
137static void __init mackerel_init(void)
138{
139 sh7372_pinmux_init();
140
141 /* enable SCIFA0 */
142 gpio_request(GPIO_FN_SCIFA0_TXD, NULL);
143 gpio_request(GPIO_FN_SCIFA0_RXD, NULL);
144
145 sh7372_add_standard_devices();
146
147 platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
148}
149
150static void __init mackerel_timer_init(void)
151{
152 sh7372_clock_init();
153 shmobile_timer.init();
154}
155
156static struct sys_timer mackerel_timer = {
157 .init = mackerel_timer_init,
158};
159
160MACHINE_START(MACKEREL, "mackerel")
161 .map_io = mackerel_map_io,
162 .init_irq = sh7372_init_irq,
163 .init_machine = mackerel_init,
164 .timer = &mackerel_timer,
165MACHINE_END