]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/arm/mach-shmobile/board-ap4evb.c
ARM: mach-shmobile: SH-Mobile AP4 support.
[net-next-2.6.git] / arch / arm / mach-shmobile / board-ap4evb.c
CommitLineData
2b7eda63
MD
1/*
2 * AP4EVB board support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/platform_device.h>
25#include <linux/delay.h>
26#include <linux/mtd/mtd.h>
27#include <linux/mtd/partitions.h>
28#include <linux/mtd/physmap.h>
29#include <linux/io.h>
30#include <mach/common.h>
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/map.h>
34
35static struct mtd_partition nor_flash_partitions[] = {
36 {
37 .name = "loader",
38 .offset = 0x00000000,
39 .size = 512 * 1024,
40 },
41 {
42 .name = "bootenv",
43 .offset = MTDPART_OFS_APPEND,
44 .size = 512 * 1024,
45 },
46 {
47 .name = "kernel_ro",
48 .offset = MTDPART_OFS_APPEND,
49 .size = 8 * 1024 * 1024,
50 .mask_flags = MTD_WRITEABLE,
51 },
52 {
53 .name = "kernel",
54 .offset = MTDPART_OFS_APPEND,
55 .size = 8 * 1024 * 1024,
56 },
57 {
58 .name = "data",
59 .offset = MTDPART_OFS_APPEND,
60 .size = MTDPART_SIZ_FULL,
61 },
62};
63
64static struct physmap_flash_data nor_flash_data = {
65 .width = 2,
66 .parts = nor_flash_partitions,
67 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
68};
69
70static struct resource nor_flash_resources[] = {
71 [0] = {
72 .start = 0x00000000,
73 .end = 0x08000000 - 1,
74 .flags = IORESOURCE_MEM,
75 }
76};
77
78static struct platform_device nor_flash_device = {
79 .name = "physmap-flash",
80 .dev = {
81 .platform_data = &nor_flash_data,
82 },
83 .num_resources = ARRAY_SIZE(nor_flash_resources),
84 .resource = nor_flash_resources,
85};
86
87
88static struct platform_device *ap4evb_devices[] __initdata = {
89 &nor_flash_device,
90};
91
92static struct map_desc ap4evb_io_desc[] __initdata = {
93 /* create a 1:1 entity map for 0xe6xxxxxx
94 * used by CPGA, INTC and PFC.
95 */
96 {
97 .virtual = 0xe6000000,
98 .pfn = __phys_to_pfn(0xe6000000),
99 .length = 256 << 20,
100 .type = MT_DEVICE_NONSHARED
101 },
102};
103
104static void __init ap4evb_map_io(void)
105{
106 iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc));
107
108 /* setup early devices and clocks here as well */
109 sh7372_add_early_devices();
110 sh7367_clock_init(); /* use g3 clocks for now */
111}
112
113static void __init ap4evb_init(void)
114{
115 sh7372_add_standard_devices();
116
117 platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
118}
119
120MACHINE_START(AP4EVB, "ap4evb")
121 .phys_io = 0xe6000000,
122 .io_pg_offst = ((0xe6000000) >> 18) & 0xfffc,
123 .map_io = ap4evb_map_io,
124 .init_irq = sh7372_init_irq,
125 .init_machine = ap4evb_init,
126 .timer = &shmobile_timer,
127MACHINE_END