blob: eb1775e381d803092c5fc6d24a8dc85bcf69e16d [file] [log] [blame]
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -07001/*
2 * Board support file for OMAP4430 SDP.
3 *
4 * Copyright (C) 2009 Texas Instruments
5 *
6 * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
7 *
8 * Based on mach-omap2/board-3430sdp.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/io.h>
19#include <linux/gpio.h>
Maulik Mankadbce06682010-02-17 14:09:32 -080020#include <linux/usb/otg.h>
Abraham Arceb2aa5e52010-05-14 12:05:26 -070021#include <linux/spi/spi.h>
Balaji T K6e30a7d2010-05-12 08:27:30 +000022#include <linux/i2c/twl.h>
23#include <linux/regulator/machine.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070024
25#include <mach/hardware.h>
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070026#include <mach/omap4-common.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070027#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30
Tony Lindgrence491cf2009-10-20 09:40:47 -070031#include <plat/board.h>
32#include <plat/common.h>
33#include <plat/control.h>
34#include <plat/timer-gp.h>
Maulik Mankadbce06682010-02-17 14:09:32 -080035#include <plat/usb.h>
kishore kadiyala717c1fb2010-05-15 18:21:06 +000036#include <plat/mmc.h>
37#include "hsmmc.h"
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070038
Abraham Arceb2aa5e52010-05-14 12:05:26 -070039#define ETH_KS8851_IRQ 34
40#define ETH_KS8851_POWER_ON 48
41#define ETH_KS8851_QUART 138
42
43static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
44 {
45 .modalias = "ks8851",
46 .bus_num = 1,
47 .chip_select = 0,
48 .max_speed_hz = 24000000,
49 .irq = ETH_KS8851_IRQ,
50 },
51};
52
53static int omap_ethernet_init(void)
54{
55 int status;
56
57 /* Request of GPIO lines */
58
59 status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
60 if (status) {
61 pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
62 return status;
63 }
64
65 status = gpio_request(ETH_KS8851_QUART, "quart");
66 if (status) {
67 pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
68 goto error1;
69 }
70
71 status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
72 if (status) {
73 pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
74 goto error2;
75 }
76
77 /* Configuration of requested GPIO lines */
78
79 status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
80 if (status) {
81 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
82 goto error3;
83 }
84
85 status = gpio_direction_output(ETH_KS8851_QUART, 1);
86 if (status) {
87 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
88 goto error3;
89 }
90
91 status = gpio_direction_input(ETH_KS8851_IRQ);
92 if (status) {
93 pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
94 goto error3;
95 }
96
97 return 0;
98
99error3:
100 gpio_free(ETH_KS8851_IRQ);
101error2:
102 gpio_free(ETH_KS8851_QUART);
103error1:
104 gpio_free(ETH_KS8851_POWER_ON);
105 return status;
106}
107
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700108static struct platform_device sdp4430_lcd_device = {
109 .name = "sdp4430_lcd",
110 .id = -1,
111};
112
113static struct platform_device *sdp4430_devices[] __initdata = {
114 &sdp4430_lcd_device,
115};
116
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700117static struct omap_lcd_config sdp4430_lcd_config __initdata = {
118 .ctrl_name = "internal",
119};
120
121static struct omap_board_config_kernel sdp4430_config[] __initdata = {
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700122 { OMAP_TAG_LCD, &sdp4430_lcd_config },
123};
124
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700125static void __init omap_4430sdp_init_irq(void)
126{
Santosh Shilimkar5b7815b2009-10-22 14:48:14 -0700127 omap_board_config = sdp4430_config;
128 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
Jean Pihet58cda882009-07-24 19:43:25 -0600129 omap2_init_common_hw(NULL, NULL);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700130#ifdef CONFIG_OMAP_32K_TIMER
131 omap2_gp_clockevent_set_gptimer(1);
132#endif
133 gic_init_irq();
134 omap_gpio_init();
135}
136
Maulik Mankadbce06682010-02-17 14:09:32 -0800137static struct omap_musb_board_data musb_board_data = {
138 .interface_type = MUSB_INTERFACE_UTMI,
139 .mode = MUSB_PERIPHERAL,
140 .power = 100,
141};
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000142
143static struct omap2_hsmmc_info mmc[] = {
144 {
145 .mmc = 1,
146 .wires = 8,
147 .gpio_wp = -EINVAL,
148 },
149 {
150 .mmc = 2,
151 .wires = 8,
152 .gpio_cd = -EINVAL,
153 .gpio_wp = -EINVAL,
154 .nonremovable = true,
155 },
156 {} /* Terminator */
157};
158
Santosh Shilimkar50263912010-08-02 13:18:03 +0300159static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
160 {
161 .supply = "vmmc",
162 .dev_name = "mmci-omap-hs.1",
163 },
164};
Balaji T K6e30a7d2010-05-12 08:27:30 +0000165static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
166 {
167 .supply = "vmmc",
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000168 .dev_name = "mmci-omap-hs.0",
Balaji T K6e30a7d2010-05-12 08:27:30 +0000169 },
Balaji T K6e30a7d2010-05-12 08:27:30 +0000170};
171
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000172static int omap4_twl6030_hsmmc_late_init(struct device *dev)
173{
174 int ret = 0;
175 struct platform_device *pdev = container_of(dev,
176 struct platform_device, dev);
177 struct omap_mmc_platform_data *pdata = dev->platform_data;
178
179 /* Setting MMC1 Card detect Irq */
180 if (pdev->id == 0)
181 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
182 MMCDETECT_INTR_OFFSET;
183 return ret;
184}
185
186static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
187{
188 struct omap_mmc_platform_data *pdata = dev->platform_data;
189
190 pdata->init = omap4_twl6030_hsmmc_late_init;
191}
192
193static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
194{
195 struct omap2_hsmmc_info *c;
196
197 omap2_hsmmc_init(controllers);
198 for (c = controllers; c->mmc; c++)
199 omap4_twl6030_hsmmc_set_late_init(c->dev);
200
201 return 0;
202}
203
Balaji T K6e30a7d2010-05-12 08:27:30 +0000204static struct regulator_init_data sdp4430_vaux1 = {
205 .constraints = {
206 .min_uV = 1000000,
207 .max_uV = 3000000,
208 .apply_uV = true,
209 .valid_modes_mask = REGULATOR_MODE_NORMAL
210 | REGULATOR_MODE_STANDBY,
211 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
212 | REGULATOR_CHANGE_MODE
213 | REGULATOR_CHANGE_STATUS,
214 },
Santosh Shilimkar50263912010-08-02 13:18:03 +0300215 .num_consumer_supplies = 1,
216 .consumer_supplies = sdp4430_vaux_supply,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000217};
218
219static struct regulator_init_data sdp4430_vaux2 = {
220 .constraints = {
221 .min_uV = 1200000,
222 .max_uV = 2800000,
223 .apply_uV = true,
224 .valid_modes_mask = REGULATOR_MODE_NORMAL
225 | REGULATOR_MODE_STANDBY,
226 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
227 | REGULATOR_CHANGE_MODE
228 | REGULATOR_CHANGE_STATUS,
229 },
230};
231
232static struct regulator_init_data sdp4430_vaux3 = {
233 .constraints = {
234 .min_uV = 1000000,
235 .max_uV = 3000000,
236 .apply_uV = true,
237 .valid_modes_mask = REGULATOR_MODE_NORMAL
238 | REGULATOR_MODE_STANDBY,
239 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
240 | REGULATOR_CHANGE_MODE
241 | REGULATOR_CHANGE_STATUS,
242 },
243};
244
245/* VMMC1 for MMC1 card */
246static struct regulator_init_data sdp4430_vmmc = {
247 .constraints = {
248 .min_uV = 1200000,
249 .max_uV = 3000000,
250 .apply_uV = true,
251 .valid_modes_mask = REGULATOR_MODE_NORMAL
252 | REGULATOR_MODE_STANDBY,
253 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
254 | REGULATOR_CHANGE_MODE
255 | REGULATOR_CHANGE_STATUS,
256 },
Santosh Shilimkar50263912010-08-02 13:18:03 +0300257 .num_consumer_supplies = 1,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000258 .consumer_supplies = sdp4430_vmmc_supply,
259};
260
261static struct regulator_init_data sdp4430_vpp = {
262 .constraints = {
263 .min_uV = 1800000,
264 .max_uV = 2500000,
265 .apply_uV = true,
266 .valid_modes_mask = REGULATOR_MODE_NORMAL
267 | REGULATOR_MODE_STANDBY,
268 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
269 | REGULATOR_CHANGE_MODE
270 | REGULATOR_CHANGE_STATUS,
271 },
272};
273
274static struct regulator_init_data sdp4430_vusim = {
275 .constraints = {
276 .min_uV = 1200000,
277 .max_uV = 2900000,
278 .apply_uV = true,
279 .valid_modes_mask = REGULATOR_MODE_NORMAL
280 | REGULATOR_MODE_STANDBY,
281 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
282 | REGULATOR_CHANGE_MODE
283 | REGULATOR_CHANGE_STATUS,
284 },
285};
286
287static struct regulator_init_data sdp4430_vana = {
288 .constraints = {
289 .min_uV = 2100000,
290 .max_uV = 2100000,
291 .apply_uV = true,
292 .valid_modes_mask = REGULATOR_MODE_NORMAL
293 | REGULATOR_MODE_STANDBY,
294 .valid_ops_mask = REGULATOR_CHANGE_MODE
295 | REGULATOR_CHANGE_STATUS,
296 },
297};
298
299static struct regulator_init_data sdp4430_vcxio = {
300 .constraints = {
301 .min_uV = 1800000,
302 .max_uV = 1800000,
303 .apply_uV = true,
304 .valid_modes_mask = REGULATOR_MODE_NORMAL
305 | REGULATOR_MODE_STANDBY,
306 .valid_ops_mask = REGULATOR_CHANGE_MODE
307 | REGULATOR_CHANGE_STATUS,
308 },
309};
310
311static struct regulator_init_data sdp4430_vdac = {
312 .constraints = {
313 .min_uV = 1800000,
314 .max_uV = 1800000,
315 .apply_uV = true,
316 .valid_modes_mask = REGULATOR_MODE_NORMAL
317 | REGULATOR_MODE_STANDBY,
318 .valid_ops_mask = REGULATOR_CHANGE_MODE
319 | REGULATOR_CHANGE_STATUS,
320 },
321};
322
323static struct regulator_init_data sdp4430_vusb = {
324 .constraints = {
325 .min_uV = 3300000,
326 .max_uV = 3300000,
327 .apply_uV = true,
328 .valid_modes_mask = REGULATOR_MODE_NORMAL
329 | REGULATOR_MODE_STANDBY,
330 .valid_ops_mask = REGULATOR_CHANGE_MODE
331 | REGULATOR_CHANGE_STATUS,
332 },
333};
334
335static struct twl4030_platform_data sdp4430_twldata = {
336 .irq_base = TWL6030_IRQ_BASE,
337 .irq_end = TWL6030_IRQ_END,
338
339 /* Regulators */
340 .vmmc = &sdp4430_vmmc,
341 .vpp = &sdp4430_vpp,
342 .vusim = &sdp4430_vusim,
343 .vana = &sdp4430_vana,
344 .vcxio = &sdp4430_vcxio,
345 .vdac = &sdp4430_vdac,
346 .vusb = &sdp4430_vusb,
347 .vaux1 = &sdp4430_vaux1,
348 .vaux2 = &sdp4430_vaux2,
349 .vaux3 = &sdp4430_vaux3,
350};
351
352static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
353 {
354 I2C_BOARD_INFO("twl6030", 0x48),
355 .flags = I2C_CLIENT_WAKE,
356 .irq = OMAP44XX_IRQ_SYS_1N,
357 .platform_data = &sdp4430_twldata,
358 },
359};
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300360static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
361 {
362 I2C_BOARD_INFO("tmp105", 0x48),
363 },
364};
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000365static int __init omap4_i2c_init(void)
366{
367 /*
368 * Phoenix Audio IC needs I2C1 to
369 * start with 400 KHz or less
370 */
Balaji T K6e30a7d2010-05-12 08:27:30 +0000371 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
372 ARRAY_SIZE(sdp4430_i2c_boardinfo));
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000373 omap_register_i2c_bus(2, 400, NULL, 0);
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300374 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
375 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000376 omap_register_i2c_bus(4, 400, NULL, 0);
377 return 0;
378}
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700379static void __init omap_4430sdp_init(void)
380{
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700381 int status;
382
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000383 omap4_i2c_init();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700384 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700385 omap_serial_init();
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000386 omap4_twl6030_hsmmc_init(mmc);
Maulik Mankadbce06682010-02-17 14:09:32 -0800387 /* OMAP4 SDP uses internal transceiver so register nop transceiver */
388 usb_nop_xceiv_register();
Santosh Shilimkarae46ec772010-02-16 19:29:20 +0530389 /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
390 if (!cpu_is_omap44xx())
391 usb_musb_init(&musb_board_data);
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700392
393 status = omap_ethernet_init();
394 if (status) {
395 pr_err("Ethernet initialization failed: %d\n", status);
396 } else {
397 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
398 spi_register_board_info(sdp4430_spi_board_info,
399 ARRAY_SIZE(sdp4430_spi_board_info));
400 }
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700401}
402
403static void __init omap_4430sdp_map_io(void)
404{
405 omap2_set_globals_443x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800406 omap44xx_map_common_io();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700407}
408
409MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
410 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
411 .phys_io = 0x48000000,
Santosh Shilimkarb4224b22009-10-19 17:25:55 -0700412 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700413 .boot_params = 0x80000100,
414 .map_io = omap_4430sdp_map_io,
415 .init_irq = omap_4430sdp_init_irq,
416 .init_machine = omap_4430sdp_init,
417 .timer = &omap_timer,
418MACHINE_END