2 * board-omap3pandora.c (Pandora Handheld Console)
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * version 2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 #include <linux/clk.h>
21 #include <linux/delay.h>
22 #include <linux/err.h>
23 #include <linux/init.h>
25 #include <linux/kernel.h>
26 #include <linux/platform_device.h>
28 #include <linux/i2c/twl4030.h>
30 #include <linux/mtd/mtd.h>
31 #include <linux/mtd/nand.h>
32 #include <linux/mtd/partitions.h>
34 #include <asm/mach-types.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/flash.h>
37 #include <asm/mach/map.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>
45 #include <mach/nand.h>
46 #include <mach/usb-ehci.h>
47 #include <mach/usb-musb.h>
49 #include "sdram-micron-mt46h32m32lf-6.h"
50 #include "mmc-twl4030.h"
53 #define NAND_BLOCK_SIZE SZ_128K
54 #define GPMC_CS0_BASE 0x60
55 #define GPMC_CS_SIZE 0x30
57 static struct mtd_partition omap3pandora_nand_partitions[] = {
60 .offset = 0, /* Offset = 0x00000 */
61 .size = 4 * NAND_BLOCK_SIZE,
62 .mask_flags = MTD_WRITEABLE
65 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
66 .size = 14 * NAND_BLOCK_SIZE,
68 .name = "uboot environment",
69 .offset = MTDPART_OFS_APPEND, /* Offset = 0x240000 */
70 .size = 2 * NAND_BLOCK_SIZE,
73 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
74 .size = 32 * NAND_BLOCK_SIZE,
77 .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */
78 .size = MTDPART_SIZ_FULL,
82 static struct omap_nand_platform_data omap3pandora_nand_data = {
83 .parts = omap3pandora_nand_partitions,
84 .nr_parts = ARRAY_SIZE(omap3pandora_nand_partitions),
85 .dma_channel = -1, /* disable DMA in OMAP NAND driver */
88 static struct resource omap3pandora_nand_resource[] = {
90 .flags = IORESOURCE_MEM,
94 static struct platform_device omap3pandora_nand_device = {
98 .platform_data = &omap3pandora_nand_data,
100 .num_resources = ARRAY_SIZE(omap3pandora_nand_resource),
101 .resource = omap3pandora_nand_resource,
104 static void __init omap3pandora_flash_init(void)
107 u8 nandcs = GPMC_CS_NUM + 1;
109 u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
111 /* find out the chip-select on which NAND exists */
112 while (cs < GPMC_CS_NUM) {
114 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
116 if ((ret & 0xC00) == 0x800) {
117 printk(KERN_INFO "Found NAND on CS%d\n", cs);
118 if (nandcs > GPMC_CS_NUM)
124 if (nandcs > GPMC_CS_NUM) {
125 printk(KERN_INFO "NAND: Unable to find configuration "
130 if (nandcs < GPMC_CS_NUM) {
131 omap3pandora_nand_data.cs = nandcs;
132 omap3pandora_nand_data.gpmc_cs_baseaddr = (void *)
133 (gpmc_base_add + GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE);
134 omap3pandora_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add);
136 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
137 if (platform_device_register(&omap3pandora_nand_device) < 0)
138 printk(KERN_ERR "Unable to register NAND device\n");
142 static struct omap_uart_config omap3pandora_uart_config __initdata = {
143 .enabled_uarts = (1 << 2), /* UART3 */
146 static struct twl4030_gpio_platform_data omap3pandora_gpio_data = {
147 .gpio_base = OMAP_MAX_GPIO_LINES,
148 .irq_base = TWL4030_GPIO_IRQ_BASE,
149 .irq_end = TWL4030_GPIO_IRQ_END,
152 static struct twl4030_usb_data omap3pandora_usb_data = {
153 .usb_mode = T2_USB_MODE_ULPI,
156 static struct twl4030_platform_data omap3pandora_twldata = {
157 .irq_base = TWL4030_IRQ_BASE,
158 .irq_end = TWL4030_IRQ_END,
159 .gpio = &omap3pandora_gpio_data,
160 .usb = &omap3pandora_usb_data,
163 static struct i2c_board_info __initdata omap3pandora_i2c_boardinfo[] = {
165 I2C_BOARD_INFO("twl4030", 0x48),
166 .flags = I2C_CLIENT_WAKE,
167 .irq = INT_34XX_SYS_NIRQ,
168 .platform_data = &omap3pandora_twldata,
172 static int __init omap3pandora_i2c_init(void)
174 omap_register_i2c_bus(1, 2600, omap3pandora_i2c_boardinfo,
175 ARRAY_SIZE(omap3pandora_i2c_boardinfo));
176 /* i2c2 pins are not connected */
177 omap_register_i2c_bus(3, 400, NULL, 0);
181 static void __init omap3pandora_init_irq(void)
183 omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
188 static struct platform_device omap3pandora_lcd_device = {
189 .name = "pandora_lcd",
193 static struct omap_lcd_config omap3pandora_lcd_config __initdata = {
194 .ctrl_name = "internal",
197 static struct omap_board_config_kernel omap3pandora_config[] __initdata = {
198 { OMAP_TAG_UART, &omap3pandora_uart_config },
199 { OMAP_TAG_LCD, &omap3pandora_lcd_config },
202 static struct platform_device *omap3pandora_devices[] __initdata = {
203 &omap3pandora_lcd_device,
206 static struct twl4030_hsmmc_info mmc[] __initdata = {
216 static void __init omap3pandora_init(void)
218 omap3pandora_i2c_init();
219 platform_add_devices(omap3pandora_devices, ARRAY_SIZE(omap3pandora_devices));
220 omap_board_config = omap3pandora_config;
221 omap_board_config_size = ARRAY_SIZE(omap3pandora_config);
226 omap3pandora_flash_init();
229 static void __init omap3pandora_map_io(void)
231 omap2_set_globals_343x();
232 omap2_map_common_io();
235 MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
236 .phys_io = 0x48000000,
237 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
238 .boot_params = 0x80000100,
239 .map_io = omap3pandora_map_io,
240 .init_irq = omap3pandora_init_irq,
241 .init_machine = omap3pandora_init,
242 .timer = &omap_timer,