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 <linux/smsc911x.h>
31 #include <linux/gpio.h>
32 #include <mach/common.h>
33 #include <mach/sh7372.h>
34 #include <asm/mach-types.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/map.h>
39 static struct mtd_partition nor_flash_partitions[] = {
47 .offset = MTDPART_OFS_APPEND,
52 .offset = MTDPART_OFS_APPEND,
53 .size = 8 * 1024 * 1024,
54 .mask_flags = MTD_WRITEABLE,
58 .offset = MTDPART_OFS_APPEND,
59 .size = 8 * 1024 * 1024,
63 .offset = MTDPART_OFS_APPEND,
64 .size = MTDPART_SIZ_FULL,
68 static struct physmap_flash_data nor_flash_data = {
70 .parts = nor_flash_partitions,
71 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
74 static struct resource nor_flash_resources[] = {
77 .end = 0x08000000 - 1,
78 .flags = IORESOURCE_MEM,
82 static struct platform_device nor_flash_device = {
83 .name = "physmap-flash",
85 .platform_data = &nor_flash_data,
87 .num_resources = ARRAY_SIZE(nor_flash_resources),
88 .resource = nor_flash_resources,
92 static struct resource smc911x_resources[] = {
95 .end = 0x16000000 - 1,
96 .flags = IORESOURCE_MEM,
99 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
103 static struct smsc911x_platform_config smsc911x_info = {
104 .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
105 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
106 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
109 static struct platform_device smc911x_device = {
112 .num_resources = ARRAY_SIZE(smc911x_resources),
113 .resource = smc911x_resources,
115 .platform_data = &smsc911x_info,
119 static struct platform_device *ap4evb_devices[] __initdata = {
124 static struct map_desc ap4evb_io_desc[] __initdata = {
125 /* create a 1:1 entity map for 0xe6xxxxxx
126 * used by CPGA, INTC and PFC.
129 .virtual = 0xe6000000,
130 .pfn = __phys_to_pfn(0xe6000000),
132 .type = MT_DEVICE_NONSHARED
136 static void __init ap4evb_map_io(void)
138 iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc));
140 /* setup early devices, clocks and console here as well */
141 sh7372_add_early_devices();
142 sh7367_clock_init(); /* use g3 clocks for now */
143 shmobile_setup_console();
146 static void __init ap4evb_init(void)
148 sh7372_pinmux_init();
150 /* enable SMSC911X */
151 gpio_request(GPIO_FN_CS5A, NULL);
152 gpio_request(GPIO_FN_IRQ6_39, NULL);
154 sh7372_add_standard_devices();
156 platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
159 MACHINE_START(AP4EVB, "ap4evb")
160 .phys_io = 0xe6000000,
161 .io_pg_offst = ((0xe6000000) >> 18) & 0xfffc,
162 .map_io = ap4evb_map_io,
163 .init_irq = sh7372_init_irq,
164 .init_machine = ap4evb_init,
165 .timer = &shmobile_timer,