4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
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.
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.
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
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>
30 #include <mach/common.h>
31 #include <asm/mach-types.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/map.h>
35 static struct mtd_partition nor_flash_partitions[] = {
43 .offset = MTDPART_OFS_APPEND,
48 .offset = MTDPART_OFS_APPEND,
49 .size = 8 * 1024 * 1024,
50 .mask_flags = MTD_WRITEABLE,
54 .offset = MTDPART_OFS_APPEND,
55 .size = 8 * 1024 * 1024,
59 .offset = MTDPART_OFS_APPEND,
60 .size = MTDPART_SIZ_FULL,
64 static struct physmap_flash_data nor_flash_data = {
66 .parts = nor_flash_partitions,
67 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
70 static struct resource nor_flash_resources[] = {
73 .end = 0x08000000 - 1,
74 .flags = IORESOURCE_MEM,
78 static struct platform_device nor_flash_device = {
79 .name = "physmap-flash",
81 .platform_data = &nor_flash_data,
83 .num_resources = ARRAY_SIZE(nor_flash_resources),
84 .resource = nor_flash_resources,
88 static struct platform_device *ap4evb_devices[] __initdata = {
92 static struct map_desc ap4evb_io_desc[] __initdata = {
93 /* create a 1:1 entity map for 0xe6xxxxxx
94 * used by CPGA, INTC and PFC.
97 .virtual = 0xe6000000,
98 .pfn = __phys_to_pfn(0xe6000000),
100 .type = MT_DEVICE_NONSHARED
104 static void __init ap4evb_map_io(void)
106 iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc));
108 /* setup early devices and clocks here as well */
109 sh7372_add_early_devices();
110 sh7367_clock_init(); /* use g3 clocks for now */
113 static void __init ap4evb_init(void)
115 sh7372_add_standard_devices();
117 platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
120 MACHINE_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,