blob: 333ceb2c8fb02a465c8533712e0cc3f387b95eb5 [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>
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -070023#include <linux/gpio_keys.h>
Balaji T K6e30a7d2010-05-12 08:27:30 +000024#include <linux/regulator/machine.h>
Hemanth V509b6d92010-08-02 13:18:04 +030025#include <linux/leds.h>
Hemanth Vf389f4c2010-12-17 18:15:08 -080026#include <linux/leds_pwm.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070027
28#include <mach/hardware.h>
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070029#include <mach/omap4-common.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070030#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33
Tony Lindgrence491cf2009-10-20 09:40:47 -070034#include <plat/board.h>
35#include <plat/common.h>
Maulik Mankadbce06682010-02-17 14:09:32 -080036#include <plat/usb.h>
kishore kadiyala717c1fb2010-05-15 18:21:06 +000037#include <plat/mmc.h>
Syed Rafiuddin59556762010-12-27 05:51:45 +000038#include <plat/omap4-keypad.h>
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070039
Benoit Coussonfb6bf632010-08-10 17:43:15 +020040#include "mux.h"
kishore kadiyala717c1fb2010-05-15 18:21:06 +000041#include "hsmmc.h"
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070042#include "timer-gp.h"
Paul Walmsley4814ced2010-10-08 11:40:20 -060043#include "control.h"
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070044
Abraham Arceb2aa5e52010-05-14 12:05:26 -070045#define ETH_KS8851_IRQ 34
46#define ETH_KS8851_POWER_ON 48
47#define ETH_KS8851_QUART 138
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -070048#define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
49#define OMAP4_SFH7741_ENABLE_GPIO 188
Abraham Arceb2aa5e52010-05-14 12:05:26 -070050
Syed Rafiuddin59556762010-12-27 05:51:45 +000051static const int sdp4430_keymap[] = {
52 KEY(0, 0, KEY_E),
53 KEY(0, 1, KEY_R),
54 KEY(0, 2, KEY_T),
55 KEY(0, 3, KEY_HOME),
56 KEY(0, 4, KEY_F5),
57 KEY(0, 5, KEY_UNKNOWN),
58 KEY(0, 6, KEY_I),
59 KEY(0, 7, KEY_LEFTSHIFT),
60
61 KEY(1, 0, KEY_D),
62 KEY(1, 1, KEY_F),
63 KEY(1, 2, KEY_G),
64 KEY(1, 3, KEY_SEND),
65 KEY(1, 4, KEY_F6),
66 KEY(1, 5, KEY_UNKNOWN),
67 KEY(1, 6, KEY_K),
68 KEY(1, 7, KEY_ENTER),
69
70 KEY(2, 0, KEY_X),
71 KEY(2, 1, KEY_C),
72 KEY(2, 2, KEY_V),
73 KEY(2, 3, KEY_END),
74 KEY(2, 4, KEY_F7),
75 KEY(2, 5, KEY_UNKNOWN),
76 KEY(2, 6, KEY_DOT),
77 KEY(2, 7, KEY_CAPSLOCK),
78
79 KEY(3, 0, KEY_Z),
80 KEY(3, 1, KEY_KPPLUS),
81 KEY(3, 2, KEY_B),
82 KEY(3, 3, KEY_F1),
83 KEY(3, 4, KEY_F8),
84 KEY(3, 5, KEY_UNKNOWN),
85 KEY(3, 6, KEY_O),
86 KEY(3, 7, KEY_SPACE),
87
88 KEY(4, 0, KEY_W),
89 KEY(4, 1, KEY_Y),
90 KEY(4, 2, KEY_U),
91 KEY(4, 3, KEY_F2),
92 KEY(4, 4, KEY_VOLUMEUP),
93 KEY(4, 5, KEY_UNKNOWN),
94 KEY(4, 6, KEY_L),
95 KEY(4, 7, KEY_LEFT),
96
97 KEY(5, 0, KEY_S),
98 KEY(5, 1, KEY_H),
99 KEY(5, 2, KEY_J),
100 KEY(5, 3, KEY_F3),
101 KEY(5, 4, KEY_F9),
102 KEY(5, 5, KEY_VOLUMEDOWN),
103 KEY(5, 6, KEY_M),
104 KEY(5, 7, KEY_RIGHT),
105
106 KEY(6, 0, KEY_Q),
107 KEY(6, 1, KEY_A),
108 KEY(6, 2, KEY_N),
109 KEY(6, 3, KEY_BACK),
110 KEY(6, 4, KEY_BACKSPACE),
111 KEY(6, 5, KEY_UNKNOWN),
112 KEY(6, 6, KEY_P),
113 KEY(6, 7, KEY_UP),
114
115 KEY(7, 0, KEY_PROG1),
116 KEY(7, 1, KEY_PROG2),
117 KEY(7, 2, KEY_PROG3),
118 KEY(7, 3, KEY_PROG4),
119 KEY(7, 4, KEY_F4),
120 KEY(7, 5, KEY_UNKNOWN),
121 KEY(7, 6, KEY_OK),
122 KEY(7, 7, KEY_DOWN),
123};
124
125static struct matrix_keymap_data sdp4430_keymap_data = {
126 .keymap = sdp4430_keymap,
127 .keymap_size = ARRAY_SIZE(sdp4430_keymap),
128};
129
130static struct omap4_keypad_platform_data sdp4430_keypad_data = {
131 .keymap_data = &sdp4430_keymap_data,
132 .rows = 8,
133 .cols = 8,
134};
Hemanth V509b6d92010-08-02 13:18:04 +0300135static struct gpio_led sdp4430_gpio_leds[] = {
136 {
137 .name = "omap4:green:debug0",
138 .gpio = 61,
139 },
140 {
141 .name = "omap4:green:debug1",
142 .gpio = 30,
143 },
144 {
145 .name = "omap4:green:debug2",
146 .gpio = 7,
147 },
148 {
149 .name = "omap4:green:debug3",
150 .gpio = 8,
151 },
152 {
153 .name = "omap4:green:debug4",
154 .gpio = 50,
155 },
156 {
157 .name = "omap4:blue:user",
158 .gpio = 169,
159 },
160 {
161 .name = "omap4:red:user",
162 .gpio = 170,
163 },
164 {
165 .name = "omap4:green:user",
166 .gpio = 139,
167 },
168
169};
170
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700171static struct gpio_keys_button sdp4430_gpio_keys[] = {
172 {
173 .desc = "Proximity Sensor",
174 .type = EV_SW,
175 .code = SW_FRONT_PROXIMITY,
176 .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
177 .active_low = 0,
178 }
179};
180
Hemanth V509b6d92010-08-02 13:18:04 +0300181static struct gpio_led_platform_data sdp4430_led_data = {
182 .leds = sdp4430_gpio_leds,
183 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
184};
185
Hemanth Vf389f4c2010-12-17 18:15:08 -0800186static struct led_pwm sdp4430_pwm_leds[] = {
187 {
188 .name = "omap4:green:chrg",
189 .pwm_id = 1,
190 .max_brightness = 255,
191 .pwm_period_ns = 7812500,
192 },
193};
194
195static struct led_pwm_platform_data sdp4430_pwm_data = {
196 .num_leds = ARRAY_SIZE(sdp4430_pwm_leds),
197 .leds = sdp4430_pwm_leds,
198};
199
200static struct platform_device sdp4430_leds_pwm = {
201 .name = "leds_pwm",
202 .id = -1,
203 .dev = {
204 .platform_data = &sdp4430_pwm_data,
205 },
206};
207
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700208static int omap_prox_activate(struct device *dev)
209{
210 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
211 return 0;
212}
213
214static void omap_prox_deactivate(struct device *dev)
215{
216 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
217}
218
219static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
220 .buttons = sdp4430_gpio_keys,
221 .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
222 .enable = omap_prox_activate,
223 .disable = omap_prox_deactivate,
224};
225
226static struct platform_device sdp4430_gpio_keys_device = {
227 .name = "gpio-keys",
228 .id = -1,
229 .dev = {
230 .platform_data = &sdp4430_gpio_keys_data,
231 },
232};
233
Hemanth V509b6d92010-08-02 13:18:04 +0300234static struct platform_device sdp4430_leds_gpio = {
235 .name = "leds-gpio",
236 .id = -1,
237 .dev = {
238 .platform_data = &sdp4430_led_data,
239 },
240};
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700241static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
242 {
243 .modalias = "ks8851",
244 .bus_num = 1,
245 .chip_select = 0,
246 .max_speed_hz = 24000000,
247 .irq = ETH_KS8851_IRQ,
248 },
249};
250
251static int omap_ethernet_init(void)
252{
253 int status;
254
255 /* Request of GPIO lines */
256
257 status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
258 if (status) {
259 pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
260 return status;
261 }
262
263 status = gpio_request(ETH_KS8851_QUART, "quart");
264 if (status) {
265 pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
266 goto error1;
267 }
268
269 status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
270 if (status) {
271 pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
272 goto error2;
273 }
274
275 /* Configuration of requested GPIO lines */
276
277 status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
278 if (status) {
279 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
280 goto error3;
281 }
282
283 status = gpio_direction_output(ETH_KS8851_QUART, 1);
284 if (status) {
285 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
286 goto error3;
287 }
288
289 status = gpio_direction_input(ETH_KS8851_IRQ);
290 if (status) {
291 pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
292 goto error3;
293 }
294
295 return 0;
296
297error3:
298 gpio_free(ETH_KS8851_IRQ);
299error2:
300 gpio_free(ETH_KS8851_QUART);
301error1:
302 gpio_free(ETH_KS8851_POWER_ON);
303 return status;
304}
305
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700306static struct platform_device sdp4430_lcd_device = {
307 .name = "sdp4430_lcd",
308 .id = -1,
309};
310
311static struct platform_device *sdp4430_devices[] __initdata = {
312 &sdp4430_lcd_device,
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700313 &sdp4430_gpio_keys_device,
Hemanth V509b6d92010-08-02 13:18:04 +0300314 &sdp4430_leds_gpio,
Hemanth Vf389f4c2010-12-17 18:15:08 -0800315 &sdp4430_leds_pwm,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700316};
317
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700318static struct omap_lcd_config sdp4430_lcd_config __initdata = {
319 .ctrl_name = "internal",
320};
321
322static struct omap_board_config_kernel sdp4430_config[] __initdata = {
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700323 { OMAP_TAG_LCD, &sdp4430_lcd_config },
324};
325
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800326static void __init omap_4430sdp_init_early(void)
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700327{
Paul Walmsley48057342010-12-21 15:25:10 -0700328 omap2_init_common_infrastructure();
329 omap2_init_common_devices(NULL, NULL);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700330#ifdef CONFIG_OMAP_32K_TIMER
331 omap2_gp_clockevent_set_gptimer(1);
332#endif
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700333}
334
Maulik Mankadbce06682010-02-17 14:09:32 -0800335static struct omap_musb_board_data musb_board_data = {
336 .interface_type = MUSB_INTERFACE_UTMI,
Hema HK09e72002010-12-10 18:11:42 +0530337 .mode = MUSB_OTG,
Maulik Mankadbce06682010-02-17 14:09:32 -0800338 .power = 100,
339};
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000340
Hema HKe70357e2010-12-10 18:09:52 +0530341static struct twl4030_usb_data omap4_usbphy_data = {
342 .phy_init = omap4430_phy_init,
343 .phy_exit = omap4430_phy_exit,
344 .phy_power = omap4430_phy_power,
345 .phy_set_clock = omap4430_phy_set_clk,
Hema HKee896e32011-02-17 12:06:07 +0530346 .phy_suspend = omap4430_phy_suspend,
Hema HKe70357e2010-12-10 18:09:52 +0530347};
348
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000349static struct omap2_hsmmc_info mmc[] = {
350 {
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000351 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000352 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000353 .gpio_cd = -EINVAL,
354 .gpio_wp = -EINVAL,
355 .nonremovable = true,
kishore kadiyala64be9782010-10-01 16:35:28 -0700356 .ocr_mask = MMC_VDD_29_30,
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000357 },
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530358 {
359 .mmc = 1,
360 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
361 .gpio_wp = -EINVAL,
362 },
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000363 {} /* Terminator */
364};
365
Santosh Shilimkar50263912010-08-02 13:18:03 +0300366static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
367 {
368 .supply = "vmmc",
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530369 .dev_name = "omap_hsmmc.1",
Santosh Shilimkar50263912010-08-02 13:18:03 +0300370 },
371};
Balaji T K6e30a7d2010-05-12 08:27:30 +0000372static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
373 {
374 .supply = "vmmc",
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530375 .dev_name = "omap_hsmmc.0",
Balaji T K6e30a7d2010-05-12 08:27:30 +0000376 },
Balaji T K6e30a7d2010-05-12 08:27:30 +0000377};
378
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000379static int omap4_twl6030_hsmmc_late_init(struct device *dev)
380{
381 int ret = 0;
382 struct platform_device *pdev = container_of(dev,
383 struct platform_device, dev);
384 struct omap_mmc_platform_data *pdata = dev->platform_data;
385
386 /* Setting MMC1 Card detect Irq */
kishore kadiyala72f2e2c2010-09-24 17:13:20 +0000387 if (pdev->id == 0) {
388 ret = twl6030_mmc_card_detect_config();
389 if (ret)
390 pr_err("Failed configuring MMC1 card detect\n");
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000391 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
392 MMCDETECT_INTR_OFFSET;
kishore kadiyala72f2e2c2010-09-24 17:13:20 +0000393 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
394 }
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000395 return ret;
396}
397
398static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
399{
Benoit Cousson531c21b2010-10-01 16:35:26 -0700400 struct omap_mmc_platform_data *pdata;
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000401
Benoit Cousson531c21b2010-10-01 16:35:26 -0700402 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
403 if (!dev) {
404 pr_err("Failed %s\n", __func__);
405 return;
406 }
407 pdata = dev->platform_data;
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000408 pdata->init = omap4_twl6030_hsmmc_late_init;
409}
410
411static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
412{
413 struct omap2_hsmmc_info *c;
414
415 omap2_hsmmc_init(controllers);
416 for (c = controllers; c->mmc; c++)
417 omap4_twl6030_hsmmc_set_late_init(c->dev);
418
419 return 0;
420}
421
Balaji T K6e30a7d2010-05-12 08:27:30 +0000422static struct regulator_init_data sdp4430_vaux1 = {
423 .constraints = {
424 .min_uV = 1000000,
425 .max_uV = 3000000,
426 .apply_uV = true,
427 .valid_modes_mask = REGULATOR_MODE_NORMAL
428 | REGULATOR_MODE_STANDBY,
429 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
430 | REGULATOR_CHANGE_MODE
431 | REGULATOR_CHANGE_STATUS,
432 },
Santosh Shilimkar50263912010-08-02 13:18:03 +0300433 .num_consumer_supplies = 1,
434 .consumer_supplies = sdp4430_vaux_supply,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000435};
436
437static struct regulator_init_data sdp4430_vaux2 = {
438 .constraints = {
439 .min_uV = 1200000,
440 .max_uV = 2800000,
441 .apply_uV = true,
442 .valid_modes_mask = REGULATOR_MODE_NORMAL
443 | REGULATOR_MODE_STANDBY,
444 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
445 | REGULATOR_CHANGE_MODE
446 | REGULATOR_CHANGE_STATUS,
447 },
448};
449
450static struct regulator_init_data sdp4430_vaux3 = {
451 .constraints = {
452 .min_uV = 1000000,
453 .max_uV = 3000000,
454 .apply_uV = true,
455 .valid_modes_mask = REGULATOR_MODE_NORMAL
456 | REGULATOR_MODE_STANDBY,
457 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
458 | REGULATOR_CHANGE_MODE
459 | REGULATOR_CHANGE_STATUS,
460 },
461};
462
463/* VMMC1 for MMC1 card */
464static struct regulator_init_data sdp4430_vmmc = {
465 .constraints = {
466 .min_uV = 1200000,
467 .max_uV = 3000000,
468 .apply_uV = true,
469 .valid_modes_mask = REGULATOR_MODE_NORMAL
470 | REGULATOR_MODE_STANDBY,
471 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
472 | REGULATOR_CHANGE_MODE
473 | REGULATOR_CHANGE_STATUS,
474 },
Santosh Shilimkar50263912010-08-02 13:18:03 +0300475 .num_consumer_supplies = 1,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000476 .consumer_supplies = sdp4430_vmmc_supply,
477};
478
479static struct regulator_init_data sdp4430_vpp = {
480 .constraints = {
481 .min_uV = 1800000,
482 .max_uV = 2500000,
483 .apply_uV = true,
484 .valid_modes_mask = REGULATOR_MODE_NORMAL
485 | REGULATOR_MODE_STANDBY,
486 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
487 | REGULATOR_CHANGE_MODE
488 | REGULATOR_CHANGE_STATUS,
489 },
490};
491
492static struct regulator_init_data sdp4430_vusim = {
493 .constraints = {
494 .min_uV = 1200000,
495 .max_uV = 2900000,
496 .apply_uV = true,
497 .valid_modes_mask = REGULATOR_MODE_NORMAL
498 | REGULATOR_MODE_STANDBY,
499 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
500 | REGULATOR_CHANGE_MODE
501 | REGULATOR_CHANGE_STATUS,
502 },
503};
504
505static struct regulator_init_data sdp4430_vana = {
506 .constraints = {
507 .min_uV = 2100000,
508 .max_uV = 2100000,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000509 .valid_modes_mask = REGULATOR_MODE_NORMAL
510 | REGULATOR_MODE_STANDBY,
511 .valid_ops_mask = REGULATOR_CHANGE_MODE
512 | REGULATOR_CHANGE_STATUS,
513 },
514};
515
516static struct regulator_init_data sdp4430_vcxio = {
517 .constraints = {
518 .min_uV = 1800000,
519 .max_uV = 1800000,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000520 .valid_modes_mask = REGULATOR_MODE_NORMAL
521 | REGULATOR_MODE_STANDBY,
522 .valid_ops_mask = REGULATOR_CHANGE_MODE
523 | REGULATOR_CHANGE_STATUS,
524 },
525};
526
527static struct regulator_init_data sdp4430_vdac = {
528 .constraints = {
529 .min_uV = 1800000,
530 .max_uV = 1800000,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000531 .valid_modes_mask = REGULATOR_MODE_NORMAL
532 | REGULATOR_MODE_STANDBY,
533 .valid_ops_mask = REGULATOR_CHANGE_MODE
534 | REGULATOR_CHANGE_STATUS,
535 },
536};
537
538static struct regulator_init_data sdp4430_vusb = {
539 .constraints = {
540 .min_uV = 3300000,
541 .max_uV = 3300000,
542 .apply_uV = true,
543 .valid_modes_mask = REGULATOR_MODE_NORMAL
544 | REGULATOR_MODE_STANDBY,
545 .valid_ops_mask = REGULATOR_CHANGE_MODE
546 | REGULATOR_CHANGE_STATUS,
547 },
548};
549
550static struct twl4030_platform_data sdp4430_twldata = {
551 .irq_base = TWL6030_IRQ_BASE,
552 .irq_end = TWL6030_IRQ_END,
553
554 /* Regulators */
555 .vmmc = &sdp4430_vmmc,
556 .vpp = &sdp4430_vpp,
557 .vusim = &sdp4430_vusim,
558 .vana = &sdp4430_vana,
559 .vcxio = &sdp4430_vcxio,
560 .vdac = &sdp4430_vdac,
561 .vusb = &sdp4430_vusb,
562 .vaux1 = &sdp4430_vaux1,
563 .vaux2 = &sdp4430_vaux2,
564 .vaux3 = &sdp4430_vaux3,
Hema HKe70357e2010-12-10 18:09:52 +0530565 .usb = &omap4_usbphy_data
Balaji T K6e30a7d2010-05-12 08:27:30 +0000566};
567
568static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
569 {
570 I2C_BOARD_INFO("twl6030", 0x48),
571 .flags = I2C_CLIENT_WAKE,
572 .irq = OMAP44XX_IRQ_SYS_1N,
573 .platform_data = &sdp4430_twldata,
574 },
575};
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300576static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
577 {
578 I2C_BOARD_INFO("tmp105", 0x48),
579 },
Hemanth Vd048aca2010-12-17 18:15:08 -0800580 {
581 I2C_BOARD_INFO("bh1780", 0x29),
582 },
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300583};
Shubhrajyoti Datta0df891b2010-09-23 18:22:47 -0700584static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
585 {
586 I2C_BOARD_INFO("hmc5843", 0x1e),
587 },
588};
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000589static int __init omap4_i2c_init(void)
590{
591 /*
592 * Phoenix Audio IC needs I2C1 to
593 * start with 400 KHz or less
594 */
Balaji T K6e30a7d2010-05-12 08:27:30 +0000595 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
596 ARRAY_SIZE(sdp4430_i2c_boardinfo));
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000597 omap_register_i2c_bus(2, 400, NULL, 0);
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300598 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
599 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
Shubhrajyoti Datta0df891b2010-09-23 18:22:47 -0700600 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
601 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000602 return 0;
603}
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700604
605static void __init omap_sfh7741prox_init(void)
606{
607 int error;
608
609 error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741");
610 if (error < 0) {
611 pr_err("%s:failed to request GPIO %d, error %d\n",
612 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
613 return;
614 }
615
616 error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
617 if (error < 0) {
618 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
619 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
620 gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
621 }
622}
623
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200624#ifdef CONFIG_OMAP_MUX
625static struct omap_board_mux board_mux[] __initdata = {
Tony Lindgren7d4ca852011-01-11 15:31:45 -0800626 OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200627 { .reg_offset = OMAP_MUX_TERMINATOR },
628};
R Sricharandae33522011-03-11 06:04:44 +0000629
630static struct omap_device_pad serial2_pads[] __initdata = {
631 OMAP_MUX_STATIC("uart2_cts.uart2_cts",
632 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
633 OMAP_MUX_STATIC("uart2_rts.uart2_rts",
634 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
635 OMAP_MUX_STATIC("uart2_rx.uart2_rx",
636 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
637 OMAP_MUX_STATIC("uart2_tx.uart2_tx",
638 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
639};
640
641static struct omap_device_pad serial3_pads[] __initdata = {
642 OMAP_MUX_STATIC("uart3_cts_rctx.uart3_cts_rctx",
643 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
644 OMAP_MUX_STATIC("uart3_rts_sd.uart3_rts_sd",
645 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
646 OMAP_MUX_STATIC("uart3_rx_irrx.uart3_rx_irrx",
647 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
648 OMAP_MUX_STATIC("uart3_tx_irtx.uart3_tx_irtx",
649 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
650};
651
652static struct omap_device_pad serial4_pads[] __initdata = {
653 OMAP_MUX_STATIC("uart4_rx.uart4_rx",
654 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
655 OMAP_MUX_STATIC("uart4_tx.uart4_tx",
656 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
657};
658
659static struct omap_board_data serial2_data = {
660 .id = 1,
661 .pads = serial2_pads,
662 .pads_cnt = ARRAY_SIZE(serial2_pads),
663};
664
665static struct omap_board_data serial3_data = {
666 .id = 2,
667 .pads = serial3_pads,
668 .pads_cnt = ARRAY_SIZE(serial3_pads),
669};
670
671static struct omap_board_data serial4_data = {
672 .id = 3,
673 .pads = serial4_pads,
674 .pads_cnt = ARRAY_SIZE(serial4_pads),
675};
676
677static inline void board_serial_init(void)
678{
679 struct omap_board_data bdata;
680 bdata.flags = 0;
681 bdata.pads = NULL;
682 bdata.pads_cnt = 0;
683 bdata.id = 0;
684 /* pass dummy data for UART1 */
685 omap_serial_init_port(&bdata);
686
687 omap_serial_init_port(&serial2_data);
688 omap_serial_init_port(&serial3_data);
689 omap_serial_init_port(&serial4_data);
690}
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200691#else
692#define board_mux NULL
R Sricharandae33522011-03-11 06:04:44 +0000693
694static inline void board_serial_init(void)
695{
696 omap_serial_init();
697}
698 #endif
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200699
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700700static void __init omap_4430sdp_init(void)
701{
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700702 int status;
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200703 int package = OMAP_PACKAGE_CBS;
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700704
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200705 if (omap_rev() == OMAP4430_REV_ES1_0)
706 package = OMAP_PACKAGE_CBL;
707 omap4_mux_init(board_mux, package);
708
Tony Lindgrene41cccf2011-02-24 14:36:03 -0800709 omap_board_config = sdp4430_config;
710 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
711
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000712 omap4_i2c_init();
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700713 omap_sfh7741prox_init();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700714 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
R Sricharandae33522011-03-11 06:04:44 +0000715 board_serial_init();
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000716 omap4_twl6030_hsmmc_init(mmc);
Keshava Munegowda6aa85a52010-11-21 23:23:42 +0530717
Felipe Balbi46960842010-12-07 09:57:59 +0200718 usb_musb_init(&musb_board_data);
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700719
720 status = omap_ethernet_init();
721 if (status) {
722 pr_err("Ethernet initialization failed: %d\n", status);
723 } else {
724 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
725 spi_register_board_info(sdp4430_spi_board_info,
726 ARRAY_SIZE(sdp4430_spi_board_info));
727 }
Syed Rafiuddin59556762010-12-27 05:51:45 +0000728
729 status = omap4_keyboard_init(&sdp4430_keypad_data);
730 if (status)
731 pr_err("Keypad initialization failed: %d\n", status);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700732}
733
734static void __init omap_4430sdp_map_io(void)
735{
736 omap2_set_globals_443x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800737 omap44xx_map_common_io();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700738}
739
740MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
741 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700742 .boot_params = 0x80000100,
Russell King71ee7da2010-05-23 10:18:16 +0100743 .reserve = omap_reserve,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800744 .map_io = omap_4430sdp_map_io,
745 .init_early = omap_4430sdp_init_early,
746 .init_irq = gic_init_irq,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700747 .init_machine = omap_4430sdp_init,
748 .timer = &omap_timer,
749MACHINE_END