Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[pandora-kernel.git] / arch / arm / mach-omap2 / board-n8x0.c
1 /*
2  * linux/arch/arm/mach-omap2/board-n8x0.c
3  *
4  * Copyright (C) 2005-2009 Nokia Corporation
5  * Author: Juha Yrjola <juha.yrjola@nokia.com>
6  *
7  * Modified from mach-omap2/board-generic.c
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  */
13
14 #include <linux/clk.h>
15 #include <linux/delay.h>
16 #include <linux/gpio.h>
17 #include <linux/init.h>
18 #include <linux/io.h>
19 #include <linux/stddef.h>
20 #include <linux/spi/spi.h>
21 #include <linux/usb/musb.h>
22
23 #include <asm/mach/arch.h>
24 #include <asm/mach-types.h>
25
26 #include <plat/board.h>
27 #include <plat/common.h>
28 #include <mach/irqs.h>
29 #include <plat/mcspi.h>
30 #include <plat/onenand.h>
31 #include <plat/serial.h>
32
33 static struct omap2_mcspi_device_config p54spi_mcspi_config = {
34         .turbo_mode     = 0,
35         .single_channel = 1,
36 };
37
38 static struct spi_board_info n800_spi_board_info[] __initdata = {
39         {
40                 .modalias       = "p54spi",
41                 .bus_num        = 2,
42                 .chip_select    = 0,
43                 .max_speed_hz   = 48000000,
44                 .controller_data = &p54spi_mcspi_config,
45         },
46 };
47
48 #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
49         defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
50
51 static struct mtd_partition onenand_partitions[] = {
52         {
53                 .name           = "bootloader",
54                 .offset         = 0,
55                 .size           = 0x20000,
56                 .mask_flags     = MTD_WRITEABLE,        /* Force read-only */
57         },
58         {
59                 .name           = "config",
60                 .offset         = MTDPART_OFS_APPEND,
61                 .size           = 0x60000,
62         },
63         {
64                 .name           = "kernel",
65                 .offset         = MTDPART_OFS_APPEND,
66                 .size           = 0x200000,
67         },
68         {
69                 .name           = "initfs",
70                 .offset         = MTDPART_OFS_APPEND,
71                 .size           = 0x400000,
72         },
73         {
74                 .name           = "rootfs",
75                 .offset         = MTDPART_OFS_APPEND,
76                 .size           = MTDPART_SIZ_FULL,
77         },
78 };
79
80 static struct omap_onenand_platform_data board_onenand_data = {
81         .cs             = 0,
82         .gpio_irq       = 26,
83         .parts          = onenand_partitions,
84         .nr_parts       = ARRAY_SIZE(onenand_partitions),
85         .flags          = ONENAND_SYNC_READ,
86 };
87
88 static void __init n8x0_onenand_init(void)
89 {
90         gpmc_onenand_init(&board_onenand_data);
91 }
92
93 #else
94
95 static void __init n8x0_onenand_init(void) {}
96
97 #endif
98
99 static void __init n8x0_map_io(void)
100 {
101         omap2_set_globals_242x();
102         omap2_map_common_io();
103 }
104
105 static void __init n8x0_init_irq(void)
106 {
107         omap2_init_common_hw(NULL, NULL);
108         omap_init_irq();
109         omap_gpio_init();
110 }
111
112 static void __init n8x0_init_machine(void)
113 {
114         /* FIXME: add n810 spi devices */
115         spi_register_board_info(n800_spi_board_info,
116                                 ARRAY_SIZE(n800_spi_board_info));
117
118         omap_serial_init();
119         n8x0_onenand_init();
120 }
121
122 MACHINE_START(NOKIA_N800, "Nokia N800")
123         .phys_io        = 0x48000000,
124         .io_pg_offst    = ((0xfa000000) >> 18) & 0xfffc,
125         .boot_params    = 0x80000100,
126         .map_io         = n8x0_map_io,
127         .init_irq       = n8x0_init_irq,
128         .init_machine   = n8x0_init_machine,
129         .timer          = &omap_timer,
130 MACHINE_END
131
132 MACHINE_START(NOKIA_N810, "Nokia N810")
133         .phys_io        = 0x48000000,
134         .io_pg_offst    = ((0xfa000000) >> 18) & 0xfffc,
135         .boot_params    = 0x80000100,
136         .map_io         = n8x0_map_io,
137         .init_irq       = n8x0_init_irq,
138         .init_machine   = n8x0_init_machine,
139         .timer          = &omap_timer,
140 MACHINE_END
141
142 MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
143         .phys_io        = 0x48000000,
144         .io_pg_offst    = ((0xfa000000) >> 18) & 0xfffc,
145         .boot_params    = 0x80000100,
146         .map_io         = n8x0_map_io,
147         .init_irq       = n8x0_init_irq,
148         .init_machine   = n8x0_init_machine,
149         .timer          = &omap_timer,
150 MACHINE_END