2 * board-overo.c (Gumstix Overo)
4 * Initial code: Steve Sakoman <steve@sakoman.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 #include <linux/clk.h>
23 #include <linux/delay.h>
24 #include <linux/err.h>
25 #include <linux/init.h>
27 #include <linux/kernel.h>
28 #include <linux/platform_device.h>
29 #include <linux/mtd/mtd.h>
30 #include <linux/mtd/nand.h>
31 #include <linux/mtd/partitions.h>
33 #include <asm/mach-types.h>
34 #include <asm/mach/arch.h>
35 #include <asm/mach/flash.h>
36 #include <asm/mach/map.h>
38 #include <mach/board-overo.h>
39 #include <mach/board.h>
40 #include <mach/common.h>
41 #include <mach/gpio.h>
42 #include <mach/gpmc.h>
43 #include <mach/hardware.h>
44 #include <mach/hsmmc.h>
45 #include <mach/nand.h>
46 #include <mach/usb-ehci.h>
47 #include <mach/usb-musb.h>
49 #include "sdram-micron-mt46h32m32lf-6.h"
51 #define NAND_BLOCK_SIZE SZ_128K
52 #define GPMC_CS0_BASE 0x60
53 #define GPMC_CS_SIZE 0x30
55 static struct mtd_partition overo_nand_partitions[] = {
58 .offset = 0, /* Offset = 0x00000 */
59 .size = 4 * NAND_BLOCK_SIZE,
60 .mask_flags = MTD_WRITEABLE
64 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
65 .size = 14 * NAND_BLOCK_SIZE,
68 .name = "uboot environment",
69 .offset = MTDPART_OFS_APPEND, /* Offset = 0x240000 */
70 .size = 2 * NAND_BLOCK_SIZE,
74 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
75 .size = 32 * NAND_BLOCK_SIZE,
79 .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */
80 .size = MTDPART_SIZ_FULL,
84 static struct omap_nand_platform_data overo_nand_data = {
85 .parts = overo_nand_partitions,
86 .nr_parts = ARRAY_SIZE(overo_nand_partitions),
87 .dma_channel = -1, /* disable DMA in OMAP NAND driver */
90 static struct resource overo_nand_resource = {
91 .flags = IORESOURCE_MEM,
94 static struct platform_device overo_nand_device = {
98 .platform_data = &overo_nand_data,
101 .resource = &overo_nand_resource,
105 static void __init overo_flash_init(void)
108 u8 nandcs = GPMC_CS_NUM + 1;
110 u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
112 /* find out the chip-select on which NAND exists */
113 while (cs < GPMC_CS_NUM) {
115 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
117 if ((ret & 0xC00) == 0x800) {
118 printk(KERN_INFO "Found NAND on CS%d\n", cs);
119 if (nandcs > GPMC_CS_NUM)
125 if (nandcs > GPMC_CS_NUM) {
126 printk(KERN_INFO "NAND: Unable to find configuration "
131 if (nandcs < GPMC_CS_NUM) {
132 overo_nand_data.cs = nandcs;
133 overo_nand_data.gpmc_cs_baseaddr = (void *)
134 (gpmc_base_add + GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE);
135 overo_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add);
137 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
138 if (platform_device_register(&overo_nand_device) < 0)
139 printk(KERN_ERR "Unable to register NAND device\n");
142 static struct omap_uart_config overo_uart_config __initdata = {
143 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
146 static int __init overo_i2c_init(void)
148 omap_register_i2c_bus(1, 2600, NULL, 0);
149 /* i2c2 pins are used for gpio */
150 omap_register_i2c_bus(3, 400, NULL, 0);
154 static void __init overo_init_irq(void)
156 omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
161 static struct omap_mmc_config overo_mmc_config __initdata = {
172 static struct platform_device overo_twl4030rtc_device = {
173 .name = "twl4030_rtc",
177 static struct platform_device overo_lcd_device = {
182 static struct omap_lcd_config overo_lcd_config __initdata = {
183 .ctrl_name = "internal",
186 static struct omap_board_config_kernel overo_config[] __initdata = {
187 { OMAP_TAG_UART, &overo_uart_config },
188 { OMAP_TAG_MMC, &overo_mmc_config },
189 { OMAP_TAG_LCD, &overo_lcd_config },
192 static struct platform_device *overo_devices[] __initdata = {
194 #ifdef CONFIG_RTC_DRV_TWL4030
195 &overo_twl4030rtc_device,
199 static void __init overo_init(void)
202 platform_add_devices(overo_devices, ARRAY_SIZE(overo_devices));
203 omap_board_config = overo_config;
204 omap_board_config_size = ARRAY_SIZE(overo_config);
211 if ((gpio_request(OVERO_GPIO_W2W_NRESET,
212 "OVERO_GPIO_W2W_NRESET") == 0) &&
213 (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {
214 gpio_export(OVERO_GPIO_W2W_NRESET, 0);
215 gpio_set_value(OVERO_GPIO_W2W_NRESET, 0);
217 gpio_set_value(OVERO_GPIO_W2W_NRESET, 1);
219 printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_W2W_NRESET\n");
222 if ((gpio_request(OVERO_GPIO_BT_NRESET, "OVERO_GPIO_BT_NRESET") == 0) &&
223 (gpio_direction_output(OVERO_GPIO_BT_NRESET, 1) == 0)) {
224 gpio_export(OVERO_GPIO_BT_NRESET, 0);
225 gpio_set_value(OVERO_GPIO_BT_NRESET, 0);
227 gpio_set_value(OVERO_GPIO_BT_NRESET, 1);
229 printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_BT_NRESET\n");
232 if ((gpio_request(OVERO_GPIO_USBH_CPEN, "OVERO_GPIO_USBH_CPEN") == 0) &&
233 (gpio_direction_output(OVERO_GPIO_USBH_CPEN, 1) == 0))
234 gpio_export(OVERO_GPIO_USBH_CPEN, 0);
236 printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_USBH_CPEN\n");
238 if ((gpio_request(OVERO_GPIO_USBH_NRESET,
239 "OVERO_GPIO_USBH_NRESET") == 0) &&
240 (gpio_direction_output(OVERO_GPIO_USBH_NRESET, 1) == 0))
241 gpio_export(OVERO_GPIO_USBH_NRESET, 0);
243 printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_USBH_NRESET\n");
246 static void __init overo_map_io(void)
248 omap2_set_globals_343x();
249 omap2_map_common_io();
252 MACHINE_START(OVERO, "Gumstix Overo")
253 .phys_io = 0x48000000,
254 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
255 .boot_params = 0x80000100,
256 .map_io = overo_map_io,
257 .init_irq = overo_init_irq,
258 .init_machine = overo_init,
259 .timer = &omap_timer,