ARM: OMAP2/3: Add generic smc91x support when connected to GPMC
[deliverable/linux.git] / arch / arm / mach-omap2 / board-2430sdp.c
CommitLineData
72d0f1c3
SMK
1/*
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>
90c62bf0 22#include <linux/i2c/twl4030.h>
72d0f1c3
SMK
23#include <linux/err.h>
24#include <linux/clk.h>
fced80c7 25#include <linux/io.h>
72d0f1c3 26
a09e64fb 27#include <mach/hardware.h>
72d0f1c3
SMK
28#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <asm/mach/flash.h>
32
a09e64fb
RK
33#include <mach/gpio.h>
34#include <mach/mux.h>
35#include <mach/board.h>
36#include <mach/common.h>
37#include <mach/gpmc.h>
18cb7aca 38#include <mach/usb.h>
1a48e157 39#include <mach/gpmc-smc91x.h>
72d0f1c3 40
90c62bf0 41#include "mmc-twl4030.h"
72d0f1c3 42
a362fdbd 43#define SDP2430_CS0_BASE 0x04000000
a362fdbd 44
72d0f1c3
SMK
45static 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
72d0f1c3 99static struct platform_device *sdp2430_devices[] __initdata = {
72d0f1c3
SMK
100 &sdp2430_flash_device,
101};
102
1a48e157 103#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91x_MODULE)
72d0f1c3 104
1a48e157
TL
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,
44595982 110
1a48e157 111};
72d0f1c3 112
1a48e157
TL
113static void __init board_smc91x_init(void)
114{
115 if (omap_rev() > OMAP3430_REV_ES1_0)
116 board_smc91x_data.gpio_irq = 6;
117 else
118 board_smc91x_data.gpio_irq = 29;
72d0f1c3 119
1a48e157
TL
120 gpmc_smc91x_init(&board_smc91x_data);
121}
72d0f1c3 122
1a48e157 123#else
72d0f1c3 124
1a48e157
TL
125static inline void board_smc91x_init(void)
126{
72d0f1c3
SMK
127}
128
1a48e157
TL
129#endif
130
72d0f1c3
SMK
131static void __init omap_2430sdp_init_irq(void)
132{
87246b75 133 omap2_init_common_hw(NULL);
72d0f1c3
SMK
134 omap_init_irq();
135 omap_gpio_init();
72d0f1c3
SMK
136}
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
90c62bf0
TL
146
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
72d0f1c3
SMK
189static void __init omap_2430sdp_init(void)
190{
90c62bf0
TL
191 omap2430_i2c_init();
192
72d0f1c3
SMK
193 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();
90c62bf0 197 twl4030_mmc_init(mmc);
18cb7aca 198 usb_musb_init();
1a48e157 199 board_smc91x_init();
72d0f1c3
SMK
200}
201
202static void __init omap_2430sdp_map_io(void)
203{
c8d2eb8e 204 omap2_set_globals_243x();
72d0f1c3
SMK
205 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
This page took 0.167927 seconds and 5 git commands to generate.