blob: ef70b79942cd8517453c999cef2cdbc52f1f5fb1 [file] [log] [blame]
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -08001/*
2 * linux/arch/arm/mach-omap2/board-2430sdp.c
3 *
4 * Copyright (C) 2006 Texas Instruments
5 *
6 * Modified from mach-omap2/board-generic.c
7 *
8 * Initial Code : Based on a patch from Komal Shah and Richard Woodruff
9 * Updated the Code for 2430 SDP : Syed Mohammed Khasim
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/mtd/mtd.h>
20#include <linux/mtd/partitions.h>
21#include <linux/delay.h>
Tony Lindgren90c62bf2008-12-10 17:37:17 -080022#include <linux/i2c/twl4030.h>
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -080023#include <linux/err.h>
24#include <linux/clk.h>
Russell Kingfced80c2008-09-06 12:10:45 +010025#include <linux/io.h>
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -080026
Russell Kinga09e64f2008-08-05 16:14:15 +010027#include <mach/hardware.h>
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -080028#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <asm/mach/flash.h>
32
Russell Kinga09e64f2008-08-05 16:14:15 +010033#include <mach/gpio.h>
34#include <mach/mux.h>
35#include <mach/board.h>
36#include <mach/common.h>
37#include <mach/gpmc.h>
Felipe Balbi18cb7ac2009-03-23 18:34:06 -070038#include <mach/usb.h>
Tony Lindgren1a48e152009-05-28 13:23:52 -070039#include <mach/gpmc-smc91x.h>
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -080040
Tony Lindgren90c62bf2008-12-10 17:37:17 -080041#include "mmc-twl4030.h"
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -080042
Tony Lindgrena362fdb2009-03-23 18:07:35 -070043#define SDP2430_CS0_BASE 0x04000000
Tony Lindgrena362fdb2009-03-23 18:07:35 -070044
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -080045static struct mtd_partition sdp2430_partitions[] = {
46 /* bootloader (U-Boot, etc) in first sector */
47 {
48 .name = "bootloader",
49 .offset = 0,
50 .size = SZ_256K,
51 .mask_flags = MTD_WRITEABLE, /* force read-only */
52 },
53 /* bootloader params in the next sector */
54 {
55 .name = "params",
56 .offset = MTDPART_OFS_APPEND,
57 .size = SZ_128K,
58 .mask_flags = 0,
59 },
60 /* kernel */
61 {
62 .name = "kernel",
63 .offset = MTDPART_OFS_APPEND,
64 .size = SZ_2M,
65 .mask_flags = 0
66 },
67 /* file system */
68 {
69 .name = "filesystem",
70 .offset = MTDPART_OFS_APPEND,
71 .size = MTDPART_SIZ_FULL,
72 .mask_flags = 0
73 }
74};
75
76static struct flash_platform_data sdp2430_flash_data = {
77 .map_name = "cfi_probe",
78 .width = 2,
79 .parts = sdp2430_partitions,
80 .nr_parts = ARRAY_SIZE(sdp2430_partitions),
81};
82
83static struct resource sdp2430_flash_resource = {
84 .start = SDP2430_CS0_BASE,
85 .end = SDP2430_CS0_BASE + SZ_64M - 1,
86 .flags = IORESOURCE_MEM,
87};
88
89static struct platform_device sdp2430_flash_device = {
90 .name = "omapflash",
91 .id = 0,
92 .dev = {
93 .platform_data = &sdp2430_flash_data,
94 },
95 .num_resources = 1,
96 .resource = &sdp2430_flash_resource,
97};
98
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -080099static struct platform_device *sdp2430_devices[] __initdata = {
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800100 &sdp2430_flash_device,
101};
102
Tony Lindgren1a48e152009-05-28 13:23:52 -0700103#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91x_MODULE)
104
105static struct omap_smc91x_platform_data board_smc91x_data = {
106 .cs = 5,
107 .gpio_irq = 149,
108 .flags = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 |
109 IORESOURCE_IRQ_LOWLEVEL,
110
111};
112
113static void __init board_smc91x_init(void)
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800114{
Tony Lindgren1a48e152009-05-28 13:23:52 -0700115 if (omap_rev() > OMAP3430_REV_ES1_0)
116 board_smc91x_data.gpio_irq = 6;
117 else
118 board_smc91x_data.gpio_irq = 29;
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800119
Tony Lindgren1a48e152009-05-28 13:23:52 -0700120 gpmc_smc91x_init(&board_smc91x_data);
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800121}
122
Tony Lindgren1a48e152009-05-28 13:23:52 -0700123#else
124
125static inline void board_smc91x_init(void)
126{
127}
128
129#endif
130
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800131static void __init omap_2430sdp_init_irq(void)
132{
Paul Walmsley87246b72009-01-28 12:27:39 -0700133 omap2_init_common_hw(NULL);
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800134 omap_init_irq();
135 omap_gpio_init();
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800136}
137
138static struct omap_uart_config sdp2430_uart_config __initdata = {
139 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
140};
141
142static struct omap_board_config_kernel sdp2430_config[] = {
143 {OMAP_TAG_UART, &sdp2430_uart_config},
144};
145
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800146
147static struct twl4030_gpio_platform_data sdp2430_gpio_data = {
148 .gpio_base = OMAP_MAX_GPIO_LINES,
149 .irq_base = TWL4030_GPIO_IRQ_BASE,
150 .irq_end = TWL4030_GPIO_IRQ_END,
151};
152
153static struct twl4030_platform_data sdp2430_twldata = {
154 .irq_base = TWL4030_IRQ_BASE,
155 .irq_end = TWL4030_IRQ_END,
156
157 /* platform_data for children goes here */
158 .gpio = &sdp2430_gpio_data,
159};
160
161static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = {
162 {
163 I2C_BOARD_INFO("twl4030", 0x48),
164 .flags = I2C_CLIENT_WAKE,
165 .irq = INT_24XX_SYS_NIRQ,
166 .platform_data = &sdp2430_twldata,
167 },
168};
169
170static int __init omap2430_i2c_init(void)
171{
172 omap_register_i2c_bus(1, 400, NULL, 0);
173 omap_register_i2c_bus(2, 2600, sdp2430_i2c_boardinfo,
174 ARRAY_SIZE(sdp2430_i2c_boardinfo));
175 return 0;
176}
177
178static struct twl4030_hsmmc_info mmc[] __initdata = {
179 {
180 .mmc = 1,
181 .wires = 4,
182 .gpio_cd = -EINVAL,
183 .gpio_wp = -EINVAL,
184 .ext_clock = 1,
185 },
186 {} /* Terminator */
187};
188
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800189static void __init omap_2430sdp_init(void)
190{
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800191 omap2430_i2c_init();
192
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800193 platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
194 omap_board_config = sdp2430_config;
195 omap_board_config_size = ARRAY_SIZE(sdp2430_config);
196 omap_serial_init();
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800197 twl4030_mmc_init(mmc);
Felipe Balbi18cb7ac2009-03-23 18:34:06 -0700198 usb_musb_init();
Tony Lindgren1a48e152009-05-28 13:23:52 -0700199 board_smc91x_init();
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800200}
201
202static void __init omap_2430sdp_map_io(void)
203{
Paul Walmsleyc8d2eb82008-05-07 16:55:13 -0700204 omap2_set_globals_243x();
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800205 omap2_map_common_io();
206}
207
208MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
209 /* Maintainer: Syed Khasim - Texas Instruments Inc */
210 .phys_io = 0x48000000,
211 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
212 .boot_params = 0x80000100,
213 .map_io = omap_2430sdp_map_io,
214 .init_irq = omap_2430sdp_init_irq,
215 .init_machine = omap_2430sdp_init,
216 .timer = &omap_timer,
217MACHINE_END