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/gpio.h>
31 #include <mach/sh7367.h>
32 #include <mach/common.h>
33 #include <asm/mach-types.h>
34 #include <asm/mach/arch.h>
35 #include <asm/mach/map.h>
37 static struct mtd_partition nor_flash_partitions[] = {
45 .offset = MTDPART_OFS_APPEND,
50 .offset = MTDPART_OFS_APPEND,
51 .size = 8 * 1024 * 1024,
52 .mask_flags = MTD_WRITEABLE,
56 .offset = MTDPART_OFS_APPEND,
57 .size = 8 * 1024 * 1024,
61 .offset = MTDPART_OFS_APPEND,
62 .size = MTDPART_SIZ_FULL,
66 static struct physmap_flash_data nor_flash_data = {
68 .parts = nor_flash_partitions,
69 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
72 static struct resource nor_flash_resources[] = {
75 .end = 0x08000000 - 1,
76 .flags = IORESOURCE_MEM,
80 static struct platform_device nor_flash_device = {
81 .name = "physmap-flash",
83 .platform_data = &nor_flash_data,
85 .num_resources = ARRAY_SIZE(nor_flash_resources),
86 .resource = nor_flash_resources,
90 static struct platform_device *g3evm_devices[] __initdata = {
94 static struct map_desc g3evm_io_desc[] __initdata = {
95 /* create a 1:1 entity map for 0xe6xxxxxx
96 * used by CPGA, INTC and PFC.
99 .virtual = 0xe6000000,
100 .pfn = __phys_to_pfn(0xe6000000),
102 .type = MT_DEVICE_NONSHARED
106 static void __init g3evm_map_io(void)
108 iotable_init(g3evm_io_desc, ARRAY_SIZE(g3evm_io_desc));
110 /* setup early devices, clocks and console here as well */
111 sh7367_add_early_devices();
113 shmobile_setup_console();
116 static void __init g3evm_init(void)
118 sh7367_pinmux_init();
121 gpio_request(GPIO_PORT22, NULL);
122 gpio_direction_output(GPIO_PORT22, 1);
123 gpio_export(GPIO_PORT22, 0);
126 gpio_request(GPIO_PORT23, NULL);
127 gpio_direction_output(GPIO_PORT23, 1);
128 gpio_export(GPIO_PORT23, 0);
131 gpio_request(GPIO_PORT24, NULL);
132 gpio_direction_output(GPIO_PORT24, 1);
133 gpio_export(GPIO_PORT24, 0);
136 gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
137 gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
138 gpio_request(GPIO_FN_SCIFA1_CTS, NULL);
139 gpio_request(GPIO_FN_SCIFA1_RTS, NULL);
141 sh7367_add_standard_devices();
143 platform_add_devices(g3evm_devices, ARRAY_SIZE(g3evm_devices));
146 MACHINE_START(G3EVM, "g3evm")
147 .phys_io = 0xe6000000,
148 .io_pg_offst = ((0xe6000000) >> 18) & 0xfffc,
149 .map_io = g3evm_map_io,
150 .init_irq = sh7367_init_irq,
151 .init_machine = g3evm_init,
152 .timer = &shmobile_timer,