blob: 369250b2b8e9f9f67e467bb8308787094acc924b [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>
Peter Ujfalusicf825e02011-06-01 11:30:38 +030025#include <linux/regulator/fixed.h>
Hemanth V509b6d92010-08-02 13:18:04 +030026#include <linux/leds.h>
Hemanth Vf389f4c2010-12-17 18:15:08 -080027#include <linux/leds_pwm.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070028
29#include <mach/hardware.h>
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070030#include <mach/omap4-common.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070031#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/map.h>
34
Tony Lindgrence491cf2009-10-20 09:40:47 -070035#include <plat/board.h>
36#include <plat/common.h>
Maulik Mankadbce06682010-02-17 14:09:32 -080037#include <plat/usb.h>
kishore kadiyala717c1fb2010-05-15 18:21:06 +000038#include <plat/mmc.h>
Syed Rafiuddin59556762010-12-27 05:51:45 +000039#include <plat/omap4-keypad.h>
Tomi Valkeinena0b38cc2011-05-11 14:05:07 +030040#include <video/omapdss.h>
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070041
Benoit Coussonfb6bf632010-08-10 17:43:15 +020042#include "mux.h"
kishore kadiyala717c1fb2010-05-15 18:21:06 +000043#include "hsmmc.h"
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070044#include "timer-gp.h"
Paul Walmsley4814ced2010-10-08 11:40:20 -060045#include "control.h"
Mike Rapoportfbd80712011-04-25 01:09:06 +030046#include "common-board-devices.h"
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070047
Abraham Arceb2aa5e52010-05-14 12:05:26 -070048#define ETH_KS8851_IRQ 34
49#define ETH_KS8851_POWER_ON 48
50#define ETH_KS8851_QUART 138
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -070051#define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
52#define OMAP4_SFH7741_ENABLE_GPIO 188
Mythri P K0425b482011-03-08 18:50:09 +053053#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
54#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
Abraham Arceb2aa5e52010-05-14 12:05:26 -070055
Syed Rafiuddin59556762010-12-27 05:51:45 +000056static const int sdp4430_keymap[] = {
57 KEY(0, 0, KEY_E),
58 KEY(0, 1, KEY_R),
59 KEY(0, 2, KEY_T),
60 KEY(0, 3, KEY_HOME),
61 KEY(0, 4, KEY_F5),
62 KEY(0, 5, KEY_UNKNOWN),
63 KEY(0, 6, KEY_I),
64 KEY(0, 7, KEY_LEFTSHIFT),
65
66 KEY(1, 0, KEY_D),
67 KEY(1, 1, KEY_F),
68 KEY(1, 2, KEY_G),
69 KEY(1, 3, KEY_SEND),
70 KEY(1, 4, KEY_F6),
71 KEY(1, 5, KEY_UNKNOWN),
72 KEY(1, 6, KEY_K),
73 KEY(1, 7, KEY_ENTER),
74
75 KEY(2, 0, KEY_X),
76 KEY(2, 1, KEY_C),
77 KEY(2, 2, KEY_V),
78 KEY(2, 3, KEY_END),
79 KEY(2, 4, KEY_F7),
80 KEY(2, 5, KEY_UNKNOWN),
81 KEY(2, 6, KEY_DOT),
82 KEY(2, 7, KEY_CAPSLOCK),
83
84 KEY(3, 0, KEY_Z),
85 KEY(3, 1, KEY_KPPLUS),
86 KEY(3, 2, KEY_B),
87 KEY(3, 3, KEY_F1),
88 KEY(3, 4, KEY_F8),
89 KEY(3, 5, KEY_UNKNOWN),
90 KEY(3, 6, KEY_O),
91 KEY(3, 7, KEY_SPACE),
92
93 KEY(4, 0, KEY_W),
94 KEY(4, 1, KEY_Y),
95 KEY(4, 2, KEY_U),
96 KEY(4, 3, KEY_F2),
97 KEY(4, 4, KEY_VOLUMEUP),
98 KEY(4, 5, KEY_UNKNOWN),
99 KEY(4, 6, KEY_L),
100 KEY(4, 7, KEY_LEFT),
101
102 KEY(5, 0, KEY_S),
103 KEY(5, 1, KEY_H),
104 KEY(5, 2, KEY_J),
105 KEY(5, 3, KEY_F3),
106 KEY(5, 4, KEY_F9),
107 KEY(5, 5, KEY_VOLUMEDOWN),
108 KEY(5, 6, KEY_M),
109 KEY(5, 7, KEY_RIGHT),
110
111 KEY(6, 0, KEY_Q),
112 KEY(6, 1, KEY_A),
113 KEY(6, 2, KEY_N),
114 KEY(6, 3, KEY_BACK),
115 KEY(6, 4, KEY_BACKSPACE),
116 KEY(6, 5, KEY_UNKNOWN),
117 KEY(6, 6, KEY_P),
118 KEY(6, 7, KEY_UP),
119
120 KEY(7, 0, KEY_PROG1),
121 KEY(7, 1, KEY_PROG2),
122 KEY(7, 2, KEY_PROG3),
123 KEY(7, 3, KEY_PROG4),
124 KEY(7, 4, KEY_F4),
125 KEY(7, 5, KEY_UNKNOWN),
126 KEY(7, 6, KEY_OK),
127 KEY(7, 7, KEY_DOWN),
128};
129
130static struct matrix_keymap_data sdp4430_keymap_data = {
131 .keymap = sdp4430_keymap,
132 .keymap_size = ARRAY_SIZE(sdp4430_keymap),
133};
134
135static struct omap4_keypad_platform_data sdp4430_keypad_data = {
136 .keymap_data = &sdp4430_keymap_data,
137 .rows = 8,
138 .cols = 8,
139};
Hemanth V509b6d92010-08-02 13:18:04 +0300140static struct gpio_led sdp4430_gpio_leds[] = {
141 {
142 .name = "omap4:green:debug0",
143 .gpio = 61,
144 },
145 {
146 .name = "omap4:green:debug1",
147 .gpio = 30,
148 },
149 {
150 .name = "omap4:green:debug2",
151 .gpio = 7,
152 },
153 {
154 .name = "omap4:green:debug3",
155 .gpio = 8,
156 },
157 {
158 .name = "omap4:green:debug4",
159 .gpio = 50,
160 },
161 {
162 .name = "omap4:blue:user",
163 .gpio = 169,
164 },
165 {
166 .name = "omap4:red:user",
167 .gpio = 170,
168 },
169 {
170 .name = "omap4:green:user",
171 .gpio = 139,
172 },
173
174};
175
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700176static struct gpio_keys_button sdp4430_gpio_keys[] = {
177 {
178 .desc = "Proximity Sensor",
179 .type = EV_SW,
180 .code = SW_FRONT_PROXIMITY,
181 .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
182 .active_low = 0,
183 }
184};
185
Hemanth V509b6d92010-08-02 13:18:04 +0300186static struct gpio_led_platform_data sdp4430_led_data = {
187 .leds = sdp4430_gpio_leds,
188 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
189};
190
Hemanth Vf389f4c2010-12-17 18:15:08 -0800191static struct led_pwm sdp4430_pwm_leds[] = {
192 {
193 .name = "omap4:green:chrg",
194 .pwm_id = 1,
195 .max_brightness = 255,
196 .pwm_period_ns = 7812500,
197 },
198};
199
200static struct led_pwm_platform_data sdp4430_pwm_data = {
201 .num_leds = ARRAY_SIZE(sdp4430_pwm_leds),
202 .leds = sdp4430_pwm_leds,
203};
204
205static struct platform_device sdp4430_leds_pwm = {
206 .name = "leds_pwm",
207 .id = -1,
208 .dev = {
209 .platform_data = &sdp4430_pwm_data,
210 },
211};
212
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700213static int omap_prox_activate(struct device *dev)
214{
215 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
216 return 0;
217}
218
219static void omap_prox_deactivate(struct device *dev)
220{
221 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
222}
223
224static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
225 .buttons = sdp4430_gpio_keys,
226 .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
227 .enable = omap_prox_activate,
228 .disable = omap_prox_deactivate,
229};
230
231static struct platform_device sdp4430_gpio_keys_device = {
232 .name = "gpio-keys",
233 .id = -1,
234 .dev = {
235 .platform_data = &sdp4430_gpio_keys_data,
236 },
237};
238
Hemanth V509b6d92010-08-02 13:18:04 +0300239static struct platform_device sdp4430_leds_gpio = {
240 .name = "leds-gpio",
241 .id = -1,
242 .dev = {
243 .platform_data = &sdp4430_led_data,
244 },
245};
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700246static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
247 {
248 .modalias = "ks8851",
249 .bus_num = 1,
250 .chip_select = 0,
251 .max_speed_hz = 24000000,
252 .irq = ETH_KS8851_IRQ,
253 },
254};
255
Igor Grinbergbc593f52011-05-03 18:22:09 +0300256static struct gpio sdp4430_eth_gpios[] __initdata = {
257 { ETH_KS8851_POWER_ON, GPIOF_OUT_INIT_HIGH, "eth_power" },
258 { ETH_KS8851_QUART, GPIOF_OUT_INIT_HIGH, "quart" },
259 { ETH_KS8851_IRQ, GPIOF_IN, "eth_irq" },
260};
261
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700262static int __init omap_ethernet_init(void)
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700263{
264 int status;
265
266 /* Request of GPIO lines */
Igor Grinbergbc593f52011-05-03 18:22:09 +0300267 status = gpio_request_array(sdp4430_eth_gpios,
268 ARRAY_SIZE(sdp4430_eth_gpios));
269 if (status)
270 pr_err("Cannot request ETH GPIOs\n");
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700271
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700272 return status;
273}
274
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700275static struct platform_device sdp4430_lcd_device = {
276 .name = "sdp4430_lcd",
277 .id = -1,
278};
279
Peter Ujfalusicf825e02011-06-01 11:30:38 +0300280static struct regulator_consumer_supply sdp4430_vbat_supply[] = {
281 REGULATOR_SUPPLY("vddvibl", "twl6040-vibra"),
282 REGULATOR_SUPPLY("vddvibr", "twl6040-vibra"),
283};
284
285static struct regulator_init_data sdp4430_vbat_data = {
286 .constraints = {
287 .always_on = 1,
288 },
289 .num_consumer_supplies = ARRAY_SIZE(sdp4430_vbat_supply),
290 .consumer_supplies = sdp4430_vbat_supply,
291};
292
293static struct fixed_voltage_config sdp4430_vbat_pdata = {
294 .supply_name = "VBAT",
295 .microvolts = 3750000,
296 .init_data = &sdp4430_vbat_data,
297 .gpio = -EINVAL,
298};
299
300static struct platform_device sdp4430_vbat = {
301 .name = "reg-fixed-voltage",
302 .id = -1,
303 .dev = {
304 .platform_data = &sdp4430_vbat_pdata,
305 },
306};
307
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700308static struct platform_device *sdp4430_devices[] __initdata = {
309 &sdp4430_lcd_device,
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700310 &sdp4430_gpio_keys_device,
Hemanth V509b6d92010-08-02 13:18:04 +0300311 &sdp4430_leds_gpio,
Hemanth Vf389f4c2010-12-17 18:15:08 -0800312 &sdp4430_leds_pwm,
Peter Ujfalusicf825e02011-06-01 11:30:38 +0300313 &sdp4430_vbat,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700314};
315
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700316static struct omap_lcd_config sdp4430_lcd_config __initdata = {
317 .ctrl_name = "internal",
318};
319
320static struct omap_board_config_kernel sdp4430_config[] __initdata = {
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700321 { OMAP_TAG_LCD, &sdp4430_lcd_config },
322};
323
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800324static void __init omap_4430sdp_init_early(void)
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700325{
Paul Walmsley48057342010-12-21 15:25:10 -0700326 omap2_init_common_infrastructure();
327 omap2_init_common_devices(NULL, NULL);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700328#ifdef CONFIG_OMAP_32K_TIMER
329 omap2_gp_clockevent_set_gptimer(1);
330#endif
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700331}
332
Maulik Mankadbce06682010-02-17 14:09:32 -0800333static struct omap_musb_board_data musb_board_data = {
334 .interface_type = MUSB_INTERFACE_UTMI,
Hema HK09e72002010-12-10 18:11:42 +0530335 .mode = MUSB_OTG,
Maulik Mankadbce06682010-02-17 14:09:32 -0800336 .power = 100,
337};
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000338
339static struct omap2_hsmmc_info mmc[] = {
340 {
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000341 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000342 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000343 .gpio_cd = -EINVAL,
344 .gpio_wp = -EINVAL,
345 .nonremovable = true,
kishore kadiyala64be9782010-10-01 16:35:28 -0700346 .ocr_mask = MMC_VDD_29_30,
Balaji T Kb1c1df72011-05-30 19:55:34 +0530347 .no_off_init = true,
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000348 },
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530349 {
350 .mmc = 1,
351 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
352 .gpio_wp = -EINVAL,
353 },
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000354 {} /* Terminator */
355};
356
Santosh Shilimkar50263912010-08-02 13:18:03 +0300357static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
358 {
359 .supply = "vmmc",
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530360 .dev_name = "omap_hsmmc.1",
Santosh Shilimkar50263912010-08-02 13:18:03 +0300361 },
362};
Balaji T K6e30a7d2010-05-12 08:27:30 +0000363
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000364static int omap4_twl6030_hsmmc_late_init(struct device *dev)
365{
366 int ret = 0;
367 struct platform_device *pdev = container_of(dev,
368 struct platform_device, dev);
369 struct omap_mmc_platform_data *pdata = dev->platform_data;
370
371 /* Setting MMC1 Card detect Irq */
kishore kadiyala72f2e2c2010-09-24 17:13:20 +0000372 if (pdev->id == 0) {
373 ret = twl6030_mmc_card_detect_config();
374 if (ret)
375 pr_err("Failed configuring MMC1 card detect\n");
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000376 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
377 MMCDETECT_INTR_OFFSET;
kishore kadiyala72f2e2c2010-09-24 17:13:20 +0000378 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
379 }
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000380 return ret;
381}
382
383static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
384{
Benoit Cousson531c21b2010-10-01 16:35:26 -0700385 struct omap_mmc_platform_data *pdata;
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000386
Benoit Cousson531c21b2010-10-01 16:35:26 -0700387 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
388 if (!dev) {
389 pr_err("Failed %s\n", __func__);
390 return;
391 }
392 pdata = dev->platform_data;
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000393 pdata->init = omap4_twl6030_hsmmc_late_init;
394}
395
396static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
397{
398 struct omap2_hsmmc_info *c;
399
400 omap2_hsmmc_init(controllers);
401 for (c = controllers; c->mmc; c++)
402 omap4_twl6030_hsmmc_set_late_init(c->dev);
403
404 return 0;
405}
406
Balaji T K6e30a7d2010-05-12 08:27:30 +0000407static struct regulator_init_data sdp4430_vaux1 = {
408 .constraints = {
409 .min_uV = 1000000,
410 .max_uV = 3000000,
411 .apply_uV = true,
412 .valid_modes_mask = REGULATOR_MODE_NORMAL
413 | REGULATOR_MODE_STANDBY,
414 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
415 | REGULATOR_CHANGE_MODE
416 | REGULATOR_CHANGE_STATUS,
417 },
Santosh Shilimkar50263912010-08-02 13:18:03 +0300418 .num_consumer_supplies = 1,
419 .consumer_supplies = sdp4430_vaux_supply,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000420};
421
Balaji T K6e30a7d2010-05-12 08:27:30 +0000422static struct regulator_init_data sdp4430_vusim = {
423 .constraints = {
424 .min_uV = 1200000,
425 .max_uV = 2900000,
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 },
433};
434
Misael Lopez Cruz89b83042011-02-11 19:50:37 -0600435static struct twl4030_codec_data twl6040_codec = {
436 /* single-step ramp for headset and handsfree */
437 .hs_left_step = 0x0f,
438 .hs_right_step = 0x0f,
439 .hf_left_step = 0x1d,
440 .hf_right_step = 0x1d,
441};
442
Peter Ujfalusicf825e02011-06-01 11:30:38 +0300443static struct twl4030_vibra_data twl6040_vibra = {
444 .vibldrv_res = 8,
445 .vibrdrv_res = 3,
446 .viblmotor_res = 10,
447 .vibrmotor_res = 10,
448 .vddvibl_uV = 0, /* fixed volt supply - VBAT */
449 .vddvibr_uV = 0, /* fixed volt supply - VBAT */
450};
451
452static struct twl4030_audio_data twl6040_audio = {
Misael Lopez Cruz89b83042011-02-11 19:50:37 -0600453 .codec = &twl6040_codec,
Peter Ujfalusicf825e02011-06-01 11:30:38 +0300454 .vibra = &twl6040_vibra,
455 .audpwron_gpio = 127,
456 .naudint_irq = OMAP44XX_IRQ_SYS_2N,
457 .irq_base = TWL6040_CODEC_IRQ_BASE,
458};
459
Balaji T K6e30a7d2010-05-12 08:27:30 +0000460static struct twl4030_platform_data sdp4430_twldata = {
Peter Ujfalusicf825e02011-06-01 11:30:38 +0300461 .audio = &twl6040_audio,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000462 /* Regulators */
Balaji T K6e30a7d2010-05-12 08:27:30 +0000463 .vusim = &sdp4430_vusim,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000464 .vaux1 = &sdp4430_vaux1,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000465};
466
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300467static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
468 {
469 I2C_BOARD_INFO("tmp105", 0x48),
470 },
Hemanth Vd048aca2010-12-17 18:15:08 -0800471 {
472 I2C_BOARD_INFO("bh1780", 0x29),
473 },
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300474};
Shubhrajyoti Datta0df891b2010-09-23 18:22:47 -0700475static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
476 {
477 I2C_BOARD_INFO("hmc5843", 0x1e),
478 },
479};
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000480static int __init omap4_i2c_init(void)
481{
Peter Ujfalusi1e0f9cd2011-06-07 10:26:46 +0300482 omap4_pmic_get_config(&sdp4430_twldata, TWL_COMMON_PDATA_USB,
483 TWL_COMMON_REGULATOR_VDAC |
484 TWL_COMMON_REGULATOR_VAUX2 |
485 TWL_COMMON_REGULATOR_VAUX3 |
486 TWL_COMMON_REGULATOR_VMMC |
487 TWL_COMMON_REGULATOR_VPP |
488 TWL_COMMON_REGULATOR_VANA |
489 TWL_COMMON_REGULATOR_VCXIO |
490 TWL_COMMON_REGULATOR_VUSB |
491 TWL_COMMON_REGULATOR_CLK32KG);
Mike Rapoportfbd80712011-04-25 01:09:06 +0300492 omap4_pmic_init("twl6030", &sdp4430_twldata);
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000493 omap_register_i2c_bus(2, 400, NULL, 0);
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300494 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
495 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
Shubhrajyoti Datta0df891b2010-09-23 18:22:47 -0700496 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
497 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000498 return 0;
499}
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700500
501static void __init omap_sfh7741prox_init(void)
502{
Igor Grinbergbc593f52011-05-03 18:22:09 +0300503 int error;
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700504
Igor Grinbergbc593f52011-05-03 18:22:09 +0300505 error = gpio_request_one(OMAP4_SFH7741_ENABLE_GPIO,
506 GPIOF_OUT_INIT_LOW, "sfh7741");
507 if (error < 0)
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700508 pr_err("%s:failed to request GPIO %d, error %d\n",
509 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700510}
511
Mythri P K0425b482011-03-08 18:50:09 +0530512static void sdp4430_hdmi_mux_init(void)
513{
514 /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
515 omap_mux_init_signal("hdmi_hpd",
516 OMAP_PIN_INPUT_PULLUP);
517 omap_mux_init_signal("hdmi_cec",
518 OMAP_PIN_INPUT_PULLUP);
519 /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
520 omap_mux_init_signal("hdmi_ddc_scl",
521 OMAP_PIN_INPUT_PULLUP);
522 omap_mux_init_signal("hdmi_ddc_sda",
523 OMAP_PIN_INPUT_PULLUP);
524}
525
Igor Grinbergbc593f52011-05-03 18:22:09 +0300526static struct gpio sdp4430_hdmi_gpios[] = {
527 { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" },
528 { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
529};
530
Mythri P K0425b482011-03-08 18:50:09 +0530531static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
532{
533 int status;
534
Igor Grinbergbc593f52011-05-03 18:22:09 +0300535 status = gpio_request_array(sdp4430_hdmi_gpios,
536 ARRAY_SIZE(sdp4430_hdmi_gpios));
537 if (status)
538 pr_err("%s: Cannot request HDMI GPIOs\n", __func__);
Mythri P K0425b482011-03-08 18:50:09 +0530539
540 return status;
541}
542
543static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
544{
545 gpio_free(HDMI_GPIO_LS_OE);
546 gpio_free(HDMI_GPIO_HPD);
547}
548
549static struct omap_dss_device sdp4430_hdmi_device = {
550 .name = "hdmi",
551 .driver_name = "hdmi_panel",
552 .type = OMAP_DISPLAY_TYPE_HDMI,
Archit Taneja6cb07b22011-04-12 13:52:25 +0530553 .clocks = {
554 .dispc = {
555 .dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK,
556 },
557 .hdmi = {
558 .regn = 15,
559 .regm2 = 1,
560 },
561 },
Mythri P K0425b482011-03-08 18:50:09 +0530562 .platform_enable = sdp4430_panel_enable_hdmi,
563 .platform_disable = sdp4430_panel_disable_hdmi,
564 .channel = OMAP_DSS_CHANNEL_DIGIT,
565};
566
567static struct omap_dss_device *sdp4430_dss_devices[] = {
568 &sdp4430_hdmi_device,
569};
570
571static struct omap_dss_board_info sdp4430_dss_data = {
572 .num_devices = ARRAY_SIZE(sdp4430_dss_devices),
573 .devices = sdp4430_dss_devices,
574 .default_device = &sdp4430_hdmi_device,
575};
576
577void omap_4430sdp_display_init(void)
578{
579 sdp4430_hdmi_mux_init();
580 omap_display_init(&sdp4430_dss_data);
581}
582
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200583#ifdef CONFIG_OMAP_MUX
584static struct omap_board_mux board_mux[] __initdata = {
Tony Lindgren7d4ca852011-01-11 15:31:45 -0800585 OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200586 { .reg_offset = OMAP_MUX_TERMINATOR },
587};
R Sricharandae33522011-03-11 06:04:44 +0000588
589static struct omap_device_pad serial2_pads[] __initdata = {
590 OMAP_MUX_STATIC("uart2_cts.uart2_cts",
591 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
592 OMAP_MUX_STATIC("uart2_rts.uart2_rts",
593 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
594 OMAP_MUX_STATIC("uart2_rx.uart2_rx",
595 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
596 OMAP_MUX_STATIC("uart2_tx.uart2_tx",
597 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
598};
599
600static struct omap_device_pad serial3_pads[] __initdata = {
601 OMAP_MUX_STATIC("uart3_cts_rctx.uart3_cts_rctx",
602 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
603 OMAP_MUX_STATIC("uart3_rts_sd.uart3_rts_sd",
604 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
605 OMAP_MUX_STATIC("uart3_rx_irrx.uart3_rx_irrx",
606 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
607 OMAP_MUX_STATIC("uart3_tx_irtx.uart3_tx_irtx",
608 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
609};
610
611static struct omap_device_pad serial4_pads[] __initdata = {
612 OMAP_MUX_STATIC("uart4_rx.uart4_rx",
613 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
614 OMAP_MUX_STATIC("uart4_tx.uart4_tx",
615 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
616};
617
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700618static struct omap_board_data serial2_data __initdata = {
R Sricharandae33522011-03-11 06:04:44 +0000619 .id = 1,
620 .pads = serial2_pads,
621 .pads_cnt = ARRAY_SIZE(serial2_pads),
622};
623
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700624static struct omap_board_data serial3_data __initdata = {
R Sricharandae33522011-03-11 06:04:44 +0000625 .id = 2,
626 .pads = serial3_pads,
627 .pads_cnt = ARRAY_SIZE(serial3_pads),
628};
629
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700630static struct omap_board_data serial4_data __initdata = {
R Sricharandae33522011-03-11 06:04:44 +0000631 .id = 3,
632 .pads = serial4_pads,
633 .pads_cnt = ARRAY_SIZE(serial4_pads),
634};
635
636static inline void board_serial_init(void)
637{
638 struct omap_board_data bdata;
639 bdata.flags = 0;
640 bdata.pads = NULL;
641 bdata.pads_cnt = 0;
642 bdata.id = 0;
643 /* pass dummy data for UART1 */
644 omap_serial_init_port(&bdata);
645
646 omap_serial_init_port(&serial2_data);
647 omap_serial_init_port(&serial3_data);
648 omap_serial_init_port(&serial4_data);
649}
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200650#else
651#define board_mux NULL
R Sricharandae33522011-03-11 06:04:44 +0000652
653static inline void board_serial_init(void)
654{
655 omap_serial_init();
656}
657 #endif
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200658
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700659static void __init omap_4430sdp_init(void)
660{
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700661 int status;
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200662 int package = OMAP_PACKAGE_CBS;
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700663
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200664 if (omap_rev() == OMAP4430_REV_ES1_0)
665 package = OMAP_PACKAGE_CBL;
Colin Cross21a42c92011-05-04 14:57:57 -0700666 omap4_mux_init(board_mux, NULL, package);
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200667
Tony Lindgrene41cccf2011-02-24 14:36:03 -0800668 omap_board_config = sdp4430_config;
669 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
670
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000671 omap4_i2c_init();
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700672 omap_sfh7741prox_init();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700673 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
R Sricharandae33522011-03-11 06:04:44 +0000674 board_serial_init();
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000675 omap4_twl6030_hsmmc_init(mmc);
Keshava Munegowda6aa85a52010-11-21 23:23:42 +0530676
Felipe Balbi46960842010-12-07 09:57:59 +0200677 usb_musb_init(&musb_board_data);
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700678
679 status = omap_ethernet_init();
680 if (status) {
681 pr_err("Ethernet initialization failed: %d\n", status);
682 } else {
683 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
684 spi_register_board_info(sdp4430_spi_board_info,
685 ARRAY_SIZE(sdp4430_spi_board_info));
686 }
Syed Rafiuddin59556762010-12-27 05:51:45 +0000687
688 status = omap4_keyboard_init(&sdp4430_keypad_data);
689 if (status)
690 pr_err("Keypad initialization failed: %d\n", status);
Mythri P K0425b482011-03-08 18:50:09 +0530691
692 omap_4430sdp_display_init();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700693}
694
695static void __init omap_4430sdp_map_io(void)
696{
697 omap2_set_globals_443x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800698 omap44xx_map_common_io();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700699}
700
701MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
702 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700703 .boot_params = 0x80000100,
Russell King71ee7da2010-05-23 10:18:16 +0100704 .reserve = omap_reserve,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800705 .map_io = omap_4430sdp_map_io,
706 .init_early = omap_4430sdp_init_early,
707 .init_irq = gic_init_irq,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700708 .init_machine = omap_4430sdp_init,
709 .timer = &omap_timer,
710MACHINE_END