blob: f6efff5f1650789e5fc19543a7b29c57a99258fb [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>
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -070025#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>
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -070041#include <linux/wl12xx.h>
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070042
Benoit Coussonfb6bf632010-08-10 17:43:15 +020043#include "mux.h"
kishore kadiyala717c1fb2010-05-15 18:21:06 +000044#include "hsmmc.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
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -070056#define GPIO_WIFI_PMENA 54
57#define GPIO_WIFI_IRQ 53
58
Syed Rafiuddin59556762010-12-27 05:51:45 +000059static const int sdp4430_keymap[] = {
60 KEY(0, 0, KEY_E),
61 KEY(0, 1, KEY_R),
62 KEY(0, 2, KEY_T),
63 KEY(0, 3, KEY_HOME),
64 KEY(0, 4, KEY_F5),
65 KEY(0, 5, KEY_UNKNOWN),
66 KEY(0, 6, KEY_I),
67 KEY(0, 7, KEY_LEFTSHIFT),
68
69 KEY(1, 0, KEY_D),
70 KEY(1, 1, KEY_F),
71 KEY(1, 2, KEY_G),
72 KEY(1, 3, KEY_SEND),
73 KEY(1, 4, KEY_F6),
74 KEY(1, 5, KEY_UNKNOWN),
75 KEY(1, 6, KEY_K),
76 KEY(1, 7, KEY_ENTER),
77
78 KEY(2, 0, KEY_X),
79 KEY(2, 1, KEY_C),
80 KEY(2, 2, KEY_V),
81 KEY(2, 3, KEY_END),
82 KEY(2, 4, KEY_F7),
83 KEY(2, 5, KEY_UNKNOWN),
84 KEY(2, 6, KEY_DOT),
85 KEY(2, 7, KEY_CAPSLOCK),
86
87 KEY(3, 0, KEY_Z),
88 KEY(3, 1, KEY_KPPLUS),
89 KEY(3, 2, KEY_B),
90 KEY(3, 3, KEY_F1),
91 KEY(3, 4, KEY_F8),
92 KEY(3, 5, KEY_UNKNOWN),
93 KEY(3, 6, KEY_O),
94 KEY(3, 7, KEY_SPACE),
95
96 KEY(4, 0, KEY_W),
97 KEY(4, 1, KEY_Y),
98 KEY(4, 2, KEY_U),
99 KEY(4, 3, KEY_F2),
100 KEY(4, 4, KEY_VOLUMEUP),
101 KEY(4, 5, KEY_UNKNOWN),
102 KEY(4, 6, KEY_L),
103 KEY(4, 7, KEY_LEFT),
104
105 KEY(5, 0, KEY_S),
106 KEY(5, 1, KEY_H),
107 KEY(5, 2, KEY_J),
108 KEY(5, 3, KEY_F3),
109 KEY(5, 4, KEY_F9),
110 KEY(5, 5, KEY_VOLUMEDOWN),
111 KEY(5, 6, KEY_M),
112 KEY(5, 7, KEY_RIGHT),
113
114 KEY(6, 0, KEY_Q),
115 KEY(6, 1, KEY_A),
116 KEY(6, 2, KEY_N),
117 KEY(6, 3, KEY_BACK),
118 KEY(6, 4, KEY_BACKSPACE),
119 KEY(6, 5, KEY_UNKNOWN),
120 KEY(6, 6, KEY_P),
121 KEY(6, 7, KEY_UP),
122
123 KEY(7, 0, KEY_PROG1),
124 KEY(7, 1, KEY_PROG2),
125 KEY(7, 2, KEY_PROG3),
126 KEY(7, 3, KEY_PROG4),
127 KEY(7, 4, KEY_F4),
128 KEY(7, 5, KEY_UNKNOWN),
129 KEY(7, 6, KEY_OK),
130 KEY(7, 7, KEY_DOWN),
131};
Shubhrajyoti Dattaf67df6c2011-07-05 03:38:24 -0700132static struct omap_device_pad keypad_pads[] __initdata = {
133 { .name = "kpd_col1.kpd_col1",
134 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
135 },
136 { .name = "kpd_col1.kpd_col1",
137 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
138 },
139 { .name = "kpd_col2.kpd_col2",
140 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
141 },
142 { .name = "kpd_col3.kpd_col3",
143 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
144 },
145 { .name = "kpd_col4.kpd_col4",
146 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
147 },
148 { .name = "kpd_col5.kpd_col5",
149 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
150 },
151 { .name = "gpmc_a23.kpd_col7",
152 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
153 },
154 { .name = "gpmc_a22.kpd_col6",
155 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
156 },
157 { .name = "kpd_row0.kpd_row0",
158 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
159 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
160 },
161 { .name = "kpd_row1.kpd_row1",
162 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
163 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
164 },
165 { .name = "kpd_row2.kpd_row2",
166 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
167 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
168 },
169 { .name = "kpd_row3.kpd_row3",
170 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
171 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
172 },
173 { .name = "kpd_row4.kpd_row4",
174 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
175 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
176 },
177 { .name = "kpd_row5.kpd_row5",
178 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
179 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
180 },
181 { .name = "gpmc_a18.kpd_row6",
182 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
183 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
184 },
185 { .name = "gpmc_a19.kpd_row7",
186 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
187 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
188 },
189};
Syed Rafiuddin59556762010-12-27 05:51:45 +0000190
191static struct matrix_keymap_data sdp4430_keymap_data = {
192 .keymap = sdp4430_keymap,
193 .keymap_size = ARRAY_SIZE(sdp4430_keymap),
194};
195
196static struct omap4_keypad_platform_data sdp4430_keypad_data = {
197 .keymap_data = &sdp4430_keymap_data,
198 .rows = 8,
199 .cols = 8,
200};
Shubhrajyoti Dattaf67df6c2011-07-05 03:38:24 -0700201
202static struct omap_board_data keypad_data = {
203 .id = 1,
204 .pads = keypad_pads,
205 .pads_cnt = ARRAY_SIZE(keypad_pads),
206};
207
Hemanth V509b6d92010-08-02 13:18:04 +0300208static struct gpio_led sdp4430_gpio_leds[] = {
209 {
210 .name = "omap4:green:debug0",
211 .gpio = 61,
212 },
213 {
214 .name = "omap4:green:debug1",
215 .gpio = 30,
216 },
217 {
218 .name = "omap4:green:debug2",
219 .gpio = 7,
220 },
221 {
222 .name = "omap4:green:debug3",
223 .gpio = 8,
224 },
225 {
226 .name = "omap4:green:debug4",
227 .gpio = 50,
228 },
229 {
230 .name = "omap4:blue:user",
231 .gpio = 169,
232 },
233 {
234 .name = "omap4:red:user",
235 .gpio = 170,
236 },
237 {
238 .name = "omap4:green:user",
239 .gpio = 139,
240 },
241
242};
243
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700244static struct gpio_keys_button sdp4430_gpio_keys[] = {
245 {
246 .desc = "Proximity Sensor",
247 .type = EV_SW,
248 .code = SW_FRONT_PROXIMITY,
249 .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
250 .active_low = 0,
251 }
252};
253
Hemanth V509b6d92010-08-02 13:18:04 +0300254static struct gpio_led_platform_data sdp4430_led_data = {
255 .leds = sdp4430_gpio_leds,
256 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
257};
258
Hemanth Vf389f4c2010-12-17 18:15:08 -0800259static struct led_pwm sdp4430_pwm_leds[] = {
260 {
261 .name = "omap4:green:chrg",
262 .pwm_id = 1,
263 .max_brightness = 255,
264 .pwm_period_ns = 7812500,
265 },
266};
267
268static struct led_pwm_platform_data sdp4430_pwm_data = {
269 .num_leds = ARRAY_SIZE(sdp4430_pwm_leds),
270 .leds = sdp4430_pwm_leds,
271};
272
273static struct platform_device sdp4430_leds_pwm = {
274 .name = "leds_pwm",
275 .id = -1,
276 .dev = {
277 .platform_data = &sdp4430_pwm_data,
278 },
279};
280
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700281static int omap_prox_activate(struct device *dev)
282{
283 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
284 return 0;
285}
286
287static void omap_prox_deactivate(struct device *dev)
288{
289 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
290}
291
292static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
293 .buttons = sdp4430_gpio_keys,
294 .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
295 .enable = omap_prox_activate,
296 .disable = omap_prox_deactivate,
297};
298
299static struct platform_device sdp4430_gpio_keys_device = {
300 .name = "gpio-keys",
301 .id = -1,
302 .dev = {
303 .platform_data = &sdp4430_gpio_keys_data,
304 },
305};
306
Hemanth V509b6d92010-08-02 13:18:04 +0300307static struct platform_device sdp4430_leds_gpio = {
308 .name = "leds-gpio",
309 .id = -1,
310 .dev = {
311 .platform_data = &sdp4430_led_data,
312 },
313};
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700314static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
315 {
316 .modalias = "ks8851",
317 .bus_num = 1,
318 .chip_select = 0,
319 .max_speed_hz = 24000000,
320 .irq = ETH_KS8851_IRQ,
321 },
322};
323
Igor Grinbergbc593f52011-05-03 18:22:09 +0300324static struct gpio sdp4430_eth_gpios[] __initdata = {
325 { ETH_KS8851_POWER_ON, GPIOF_OUT_INIT_HIGH, "eth_power" },
326 { ETH_KS8851_QUART, GPIOF_OUT_INIT_HIGH, "quart" },
327 { ETH_KS8851_IRQ, GPIOF_IN, "eth_irq" },
328};
329
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700330static int __init omap_ethernet_init(void)
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700331{
332 int status;
333
334 /* Request of GPIO lines */
Igor Grinbergbc593f52011-05-03 18:22:09 +0300335 status = gpio_request_array(sdp4430_eth_gpios,
336 ARRAY_SIZE(sdp4430_eth_gpios));
337 if (status)
338 pr_err("Cannot request ETH GPIOs\n");
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700339
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700340 return status;
341}
342
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700343static struct platform_device sdp4430_lcd_device = {
344 .name = "sdp4430_lcd",
345 .id = -1,
346};
347
348static struct platform_device *sdp4430_devices[] __initdata = {
349 &sdp4430_lcd_device,
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700350 &sdp4430_gpio_keys_device,
Hemanth V509b6d92010-08-02 13:18:04 +0300351 &sdp4430_leds_gpio,
Hemanth Vf389f4c2010-12-17 18:15:08 -0800352 &sdp4430_leds_pwm,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700353};
354
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700355static struct omap_lcd_config sdp4430_lcd_config __initdata = {
356 .ctrl_name = "internal",
357};
358
359static struct omap_board_config_kernel sdp4430_config[] __initdata = {
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700360 { OMAP_TAG_LCD, &sdp4430_lcd_config },
361};
362
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800363static void __init omap_4430sdp_init_early(void)
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700364{
Paul Walmsley48057342010-12-21 15:25:10 -0700365 omap2_init_common_infrastructure();
366 omap2_init_common_devices(NULL, NULL);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700367}
368
Maulik Mankadbce06682010-02-17 14:09:32 -0800369static struct omap_musb_board_data musb_board_data = {
370 .interface_type = MUSB_INTERFACE_UTMI,
Hema HK09e72002010-12-10 18:11:42 +0530371 .mode = MUSB_OTG,
Maulik Mankadbce06682010-02-17 14:09:32 -0800372 .power = 100,
373};
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000374
Hema HKe70357e2010-12-10 18:09:52 +0530375static struct twl4030_usb_data omap4_usbphy_data = {
376 .phy_init = omap4430_phy_init,
377 .phy_exit = omap4430_phy_exit,
378 .phy_power = omap4430_phy_power,
379 .phy_set_clock = omap4430_phy_set_clk,
Hema HKee896e32011-02-17 12:06:07 +0530380 .phy_suspend = omap4430_phy_suspend,
Hema HKe70357e2010-12-10 18:09:52 +0530381};
382
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000383static struct omap2_hsmmc_info mmc[] = {
384 {
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000385 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000386 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000387 .gpio_cd = -EINVAL,
388 .gpio_wp = -EINVAL,
389 .nonremovable = true,
kishore kadiyala64be9782010-10-01 16:35:28 -0700390 .ocr_mask = MMC_VDD_29_30,
Balaji T Kb1c1df72011-05-30 19:55:34 +0530391 .no_off_init = true,
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000392 },
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530393 {
394 .mmc = 1,
395 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
Silesh C V27a69d72011-07-05 03:38:23 -0700396 .gpio_cd = -EINVAL,
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530397 .gpio_wp = -EINVAL,
398 },
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -0700399 {
400 .mmc = 5,
401 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
402 .gpio_cd = -EINVAL,
403 .gpio_wp = -EINVAL,
404 .ocr_mask = MMC_VDD_165_195,
405 .nonremovable = true,
406 },
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000407 {} /* Terminator */
408};
409
Santosh Shilimkar50263912010-08-02 13:18:03 +0300410static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
Oleg Drokin786b01a2011-06-06 18:57:07 +0000411 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
Santosh Shilimkar50263912010-08-02 13:18:03 +0300412};
Oleg Drokin786b01a2011-06-06 18:57:07 +0000413
Balaji T K6e30a7d2010-05-12 08:27:30 +0000414static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
Oleg Drokin786b01a2011-06-06 18:57:07 +0000415 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
Balaji T K6e30a7d2010-05-12 08:27:30 +0000416};
417
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -0700418static struct regulator_consumer_supply omap4_sdp4430_vmmc5_supply = {
419 .supply = "vmmc",
420 .dev_name = "omap_hsmmc.4",
421};
422
423static struct regulator_init_data sdp4430_vmmc5 = {
424 .constraints = {
425 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
426 },
427 .num_consumer_supplies = 1,
428 .consumer_supplies = &omap4_sdp4430_vmmc5_supply,
429};
430
431static struct fixed_voltage_config sdp4430_vwlan = {
432 .supply_name = "vwl1271",
433 .microvolts = 1800000, /* 1.8V */
434 .gpio = GPIO_WIFI_PMENA,
435 .startup_delay = 70000, /* 70msec */
436 .enable_high = 1,
437 .enabled_at_boot = 0,
438 .init_data = &sdp4430_vmmc5,
439};
440
441static struct platform_device omap_vwlan_device = {
442 .name = "reg-fixed-voltage",
443 .id = 1,
444 .dev = {
445 .platform_data = &sdp4430_vwlan,
446 },
447};
448
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000449static int omap4_twl6030_hsmmc_late_init(struct device *dev)
450{
451 int ret = 0;
452 struct platform_device *pdev = container_of(dev,
453 struct platform_device, dev);
454 struct omap_mmc_platform_data *pdata = dev->platform_data;
455
456 /* Setting MMC1 Card detect Irq */
kishore kadiyala72f2e2c2010-09-24 17:13:20 +0000457 if (pdev->id == 0) {
458 ret = twl6030_mmc_card_detect_config();
459 if (ret)
460 pr_err("Failed configuring MMC1 card detect\n");
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000461 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
462 MMCDETECT_INTR_OFFSET;
kishore kadiyala72f2e2c2010-09-24 17:13:20 +0000463 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
464 }
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000465 return ret;
466}
467
468static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
469{
Benoit Cousson531c21b2010-10-01 16:35:26 -0700470 struct omap_mmc_platform_data *pdata;
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000471
Benoit Cousson531c21b2010-10-01 16:35:26 -0700472 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
473 if (!dev) {
474 pr_err("Failed %s\n", __func__);
475 return;
476 }
477 pdata = dev->platform_data;
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000478 pdata->init = omap4_twl6030_hsmmc_late_init;
479}
480
481static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
482{
483 struct omap2_hsmmc_info *c;
484
485 omap2_hsmmc_init(controllers);
486 for (c = controllers; c->mmc; c++)
487 omap4_twl6030_hsmmc_set_late_init(c->dev);
488
489 return 0;
490}
491
Balaji T K6e30a7d2010-05-12 08:27:30 +0000492static struct regulator_init_data sdp4430_vaux1 = {
493 .constraints = {
494 .min_uV = 1000000,
495 .max_uV = 3000000,
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 },
Oleg Drokin786b01a2011-06-06 18:57:07 +0000503 .num_consumer_supplies = ARRAY_SIZE(sdp4430_vaux_supply),
Santosh Shilimkar50263912010-08-02 13:18:03 +0300504 .consumer_supplies = sdp4430_vaux_supply,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000505};
506
507static struct regulator_init_data sdp4430_vaux2 = {
508 .constraints = {
509 .min_uV = 1200000,
510 .max_uV = 2800000,
511 .apply_uV = true,
512 .valid_modes_mask = REGULATOR_MODE_NORMAL
513 | REGULATOR_MODE_STANDBY,
514 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
515 | REGULATOR_CHANGE_MODE
516 | REGULATOR_CHANGE_STATUS,
517 },
518};
519
520static struct regulator_init_data sdp4430_vaux3 = {
521 .constraints = {
522 .min_uV = 1000000,
523 .max_uV = 3000000,
524 .apply_uV = true,
525 .valid_modes_mask = REGULATOR_MODE_NORMAL
526 | REGULATOR_MODE_STANDBY,
527 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
528 | REGULATOR_CHANGE_MODE
529 | REGULATOR_CHANGE_STATUS,
530 },
531};
532
533/* VMMC1 for MMC1 card */
534static struct regulator_init_data sdp4430_vmmc = {
535 .constraints = {
536 .min_uV = 1200000,
537 .max_uV = 3000000,
538 .apply_uV = true,
539 .valid_modes_mask = REGULATOR_MODE_NORMAL
540 | REGULATOR_MODE_STANDBY,
541 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
542 | REGULATOR_CHANGE_MODE
543 | REGULATOR_CHANGE_STATUS,
544 },
Santosh Shilimkar50263912010-08-02 13:18:03 +0300545 .num_consumer_supplies = 1,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000546 .consumer_supplies = sdp4430_vmmc_supply,
547};
548
549static struct regulator_init_data sdp4430_vpp = {
550 .constraints = {
551 .min_uV = 1800000,
552 .max_uV = 2500000,
553 .apply_uV = true,
554 .valid_modes_mask = REGULATOR_MODE_NORMAL
555 | REGULATOR_MODE_STANDBY,
556 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
557 | REGULATOR_CHANGE_MODE
558 | REGULATOR_CHANGE_STATUS,
559 },
560};
561
562static struct regulator_init_data sdp4430_vusim = {
563 .constraints = {
564 .min_uV = 1200000,
565 .max_uV = 2900000,
566 .apply_uV = true,
567 .valid_modes_mask = REGULATOR_MODE_NORMAL
568 | REGULATOR_MODE_STANDBY,
569 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
570 | REGULATOR_CHANGE_MODE
571 | REGULATOR_CHANGE_STATUS,
572 },
573};
574
575static struct regulator_init_data sdp4430_vana = {
576 .constraints = {
577 .min_uV = 2100000,
578 .max_uV = 2100000,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000579 .valid_modes_mask = REGULATOR_MODE_NORMAL
580 | REGULATOR_MODE_STANDBY,
581 .valid_ops_mask = REGULATOR_CHANGE_MODE
582 | REGULATOR_CHANGE_STATUS,
583 },
584};
585
586static struct regulator_init_data sdp4430_vcxio = {
587 .constraints = {
588 .min_uV = 1800000,
589 .max_uV = 1800000,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000590 .valid_modes_mask = REGULATOR_MODE_NORMAL
591 | REGULATOR_MODE_STANDBY,
592 .valid_ops_mask = REGULATOR_CHANGE_MODE
593 | REGULATOR_CHANGE_STATUS,
594 },
595};
596
597static struct regulator_init_data sdp4430_vdac = {
598 .constraints = {
599 .min_uV = 1800000,
600 .max_uV = 1800000,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000601 .valid_modes_mask = REGULATOR_MODE_NORMAL
602 | REGULATOR_MODE_STANDBY,
603 .valid_ops_mask = REGULATOR_CHANGE_MODE
604 | REGULATOR_CHANGE_STATUS,
605 },
606};
607
608static struct regulator_init_data sdp4430_vusb = {
609 .constraints = {
610 .min_uV = 3300000,
611 .max_uV = 3300000,
612 .apply_uV = true,
613 .valid_modes_mask = REGULATOR_MODE_NORMAL
614 | REGULATOR_MODE_STANDBY,
615 .valid_ops_mask = REGULATOR_CHANGE_MODE
616 | REGULATOR_CHANGE_STATUS,
617 },
618};
619
Balaji T K8af1b0d2011-02-10 18:45:26 +0530620static struct regulator_init_data sdp4430_clk32kg = {
621 .constraints = {
622 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -0700623 .always_on = true,
Balaji T K8af1b0d2011-02-10 18:45:26 +0530624 },
625};
626
Balaji T K6e30a7d2010-05-12 08:27:30 +0000627static struct twl4030_platform_data sdp4430_twldata = {
628 .irq_base = TWL6030_IRQ_BASE,
629 .irq_end = TWL6030_IRQ_END,
630
631 /* Regulators */
632 .vmmc = &sdp4430_vmmc,
633 .vpp = &sdp4430_vpp,
634 .vusim = &sdp4430_vusim,
635 .vana = &sdp4430_vana,
636 .vcxio = &sdp4430_vcxio,
637 .vdac = &sdp4430_vdac,
638 .vusb = &sdp4430_vusb,
639 .vaux1 = &sdp4430_vaux1,
640 .vaux2 = &sdp4430_vaux2,
641 .vaux3 = &sdp4430_vaux3,
Balaji T K8af1b0d2011-02-10 18:45:26 +0530642 .clk32kg = &sdp4430_clk32kg,
Hema HKe70357e2010-12-10 18:09:52 +0530643 .usb = &omap4_usbphy_data
Balaji T K6e30a7d2010-05-12 08:27:30 +0000644};
645
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300646static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
647 {
648 I2C_BOARD_INFO("tmp105", 0x48),
649 },
Hemanth Vd048aca2010-12-17 18:15:08 -0800650 {
651 I2C_BOARD_INFO("bh1780", 0x29),
652 },
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300653};
Shubhrajyoti Datta0df891b2010-09-23 18:22:47 -0700654static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
655 {
656 I2C_BOARD_INFO("hmc5843", 0x1e),
657 },
658};
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000659static int __init omap4_i2c_init(void)
660{
Mike Rapoportfbd80712011-04-25 01:09:06 +0300661 omap4_pmic_init("twl6030", &sdp4430_twldata);
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000662 omap_register_i2c_bus(2, 400, NULL, 0);
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300663 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
664 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
Shubhrajyoti Datta0df891b2010-09-23 18:22:47 -0700665 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
666 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000667 return 0;
668}
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700669
670static void __init omap_sfh7741prox_init(void)
671{
Igor Grinbergbc593f52011-05-03 18:22:09 +0300672 int error;
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700673
Igor Grinbergbc593f52011-05-03 18:22:09 +0300674 error = gpio_request_one(OMAP4_SFH7741_ENABLE_GPIO,
675 GPIOF_OUT_INIT_LOW, "sfh7741");
676 if (error < 0)
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700677 pr_err("%s:failed to request GPIO %d, error %d\n",
678 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700679}
680
Mythri P K0425b482011-03-08 18:50:09 +0530681static void sdp4430_hdmi_mux_init(void)
682{
683 /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
684 omap_mux_init_signal("hdmi_hpd",
685 OMAP_PIN_INPUT_PULLUP);
686 omap_mux_init_signal("hdmi_cec",
687 OMAP_PIN_INPUT_PULLUP);
688 /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
689 omap_mux_init_signal("hdmi_ddc_scl",
690 OMAP_PIN_INPUT_PULLUP);
691 omap_mux_init_signal("hdmi_ddc_sda",
692 OMAP_PIN_INPUT_PULLUP);
693}
694
Igor Grinbergbc593f52011-05-03 18:22:09 +0300695static struct gpio sdp4430_hdmi_gpios[] = {
696 { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" },
697 { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
698};
699
Mythri P K0425b482011-03-08 18:50:09 +0530700static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
701{
702 int status;
703
Igor Grinbergbc593f52011-05-03 18:22:09 +0300704 status = gpio_request_array(sdp4430_hdmi_gpios,
705 ARRAY_SIZE(sdp4430_hdmi_gpios));
706 if (status)
707 pr_err("%s: Cannot request HDMI GPIOs\n", __func__);
Mythri P K0425b482011-03-08 18:50:09 +0530708
709 return status;
710}
711
712static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
713{
714 gpio_free(HDMI_GPIO_LS_OE);
715 gpio_free(HDMI_GPIO_HPD);
716}
717
718static struct omap_dss_device sdp4430_hdmi_device = {
719 .name = "hdmi",
720 .driver_name = "hdmi_panel",
721 .type = OMAP_DISPLAY_TYPE_HDMI,
Archit Taneja6cb07b22011-04-12 13:52:25 +0530722 .clocks = {
723 .dispc = {
724 .dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK,
725 },
726 .hdmi = {
727 .regn = 15,
728 .regm2 = 1,
729 },
730 },
Mythri P K0425b482011-03-08 18:50:09 +0530731 .platform_enable = sdp4430_panel_enable_hdmi,
732 .platform_disable = sdp4430_panel_disable_hdmi,
733 .channel = OMAP_DSS_CHANNEL_DIGIT,
734};
735
736static struct omap_dss_device *sdp4430_dss_devices[] = {
737 &sdp4430_hdmi_device,
738};
739
740static struct omap_dss_board_info sdp4430_dss_data = {
741 .num_devices = ARRAY_SIZE(sdp4430_dss_devices),
742 .devices = sdp4430_dss_devices,
743 .default_device = &sdp4430_hdmi_device,
744};
745
746void omap_4430sdp_display_init(void)
747{
748 sdp4430_hdmi_mux_init();
749 omap_display_init(&sdp4430_dss_data);
750}
751
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200752#ifdef CONFIG_OMAP_MUX
753static struct omap_board_mux board_mux[] __initdata = {
Tony Lindgren7d4ca852011-01-11 15:31:45 -0800754 OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200755 { .reg_offset = OMAP_MUX_TERMINATOR },
756};
R Sricharandae33522011-03-11 06:04:44 +0000757
758static struct omap_device_pad serial2_pads[] __initdata = {
759 OMAP_MUX_STATIC("uart2_cts.uart2_cts",
760 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
761 OMAP_MUX_STATIC("uart2_rts.uart2_rts",
762 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
763 OMAP_MUX_STATIC("uart2_rx.uart2_rx",
764 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
765 OMAP_MUX_STATIC("uart2_tx.uart2_tx",
766 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
767};
768
769static struct omap_device_pad serial3_pads[] __initdata = {
770 OMAP_MUX_STATIC("uart3_cts_rctx.uart3_cts_rctx",
771 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
772 OMAP_MUX_STATIC("uart3_rts_sd.uart3_rts_sd",
773 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
774 OMAP_MUX_STATIC("uart3_rx_irrx.uart3_rx_irrx",
775 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
776 OMAP_MUX_STATIC("uart3_tx_irtx.uart3_tx_irtx",
777 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
778};
779
780static struct omap_device_pad serial4_pads[] __initdata = {
781 OMAP_MUX_STATIC("uart4_rx.uart4_rx",
782 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
783 OMAP_MUX_STATIC("uart4_tx.uart4_tx",
784 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
785};
786
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700787static struct omap_board_data serial2_data __initdata = {
R Sricharandae33522011-03-11 06:04:44 +0000788 .id = 1,
789 .pads = serial2_pads,
790 .pads_cnt = ARRAY_SIZE(serial2_pads),
791};
792
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700793static struct omap_board_data serial3_data __initdata = {
R Sricharandae33522011-03-11 06:04:44 +0000794 .id = 2,
795 .pads = serial3_pads,
796 .pads_cnt = ARRAY_SIZE(serial3_pads),
797};
798
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700799static struct omap_board_data serial4_data __initdata = {
R Sricharandae33522011-03-11 06:04:44 +0000800 .id = 3,
801 .pads = serial4_pads,
802 .pads_cnt = ARRAY_SIZE(serial4_pads),
803};
804
805static inline void board_serial_init(void)
806{
807 struct omap_board_data bdata;
808 bdata.flags = 0;
809 bdata.pads = NULL;
810 bdata.pads_cnt = 0;
811 bdata.id = 0;
812 /* pass dummy data for UART1 */
813 omap_serial_init_port(&bdata);
814
815 omap_serial_init_port(&serial2_data);
816 omap_serial_init_port(&serial3_data);
817 omap_serial_init_port(&serial4_data);
818}
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200819#else
820#define board_mux NULL
R Sricharandae33522011-03-11 06:04:44 +0000821
822static inline void board_serial_init(void)
823{
824 omap_serial_init();
825}
826 #endif
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200827
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -0700828static void omap4_sdp4430_wifi_mux_init(void)
829{
830 omap_mux_init_gpio(GPIO_WIFI_IRQ, OMAP_PIN_INPUT |
831 OMAP_PIN_OFF_WAKEUPENABLE);
832 omap_mux_init_gpio(GPIO_WIFI_PMENA, OMAP_PIN_OUTPUT);
833
834 omap_mux_init_signal("sdmmc5_cmd.sdmmc5_cmd",
835 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
836 omap_mux_init_signal("sdmmc5_clk.sdmmc5_clk",
837 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
838 omap_mux_init_signal("sdmmc5_dat0.sdmmc5_dat0",
839 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
840 omap_mux_init_signal("sdmmc5_dat1.sdmmc5_dat1",
841 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
842 omap_mux_init_signal("sdmmc5_dat2.sdmmc5_dat2",
843 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
844 omap_mux_init_signal("sdmmc5_dat3.sdmmc5_dat3",
845 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
846
847}
848
849static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
850 .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ),
851 .board_ref_clock = WL12XX_REFCLOCK_26,
852 .board_tcxo_clock = WL12XX_TCXOCLOCK_26,
853};
854
855static void omap4_sdp4430_wifi_init(void)
856{
857 omap4_sdp4430_wifi_mux_init();
858 if (wl12xx_set_platform_data(&omap4_sdp4430_wlan_data))
859 pr_err("Error setting wl12xx data\n");
860 platform_device_register(&omap_vwlan_device);
861}
862
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700863static void __init omap_4430sdp_init(void)
864{
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700865 int status;
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200866 int package = OMAP_PACKAGE_CBS;
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700867
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200868 if (omap_rev() == OMAP4430_REV_ES1_0)
869 package = OMAP_PACKAGE_CBL;
Colin Cross21a42c92011-05-04 14:57:57 -0700870 omap4_mux_init(board_mux, NULL, package);
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200871
Tony Lindgrene41cccf2011-02-24 14:36:03 -0800872 omap_board_config = sdp4430_config;
873 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
874
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000875 omap4_i2c_init();
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700876 omap_sfh7741prox_init();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700877 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
R Sricharandae33522011-03-11 06:04:44 +0000878 board_serial_init();
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -0700879 omap4_sdp4430_wifi_init();
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000880 omap4_twl6030_hsmmc_init(mmc);
Keshava Munegowda6aa85a52010-11-21 23:23:42 +0530881
Felipe Balbi46960842010-12-07 09:57:59 +0200882 usb_musb_init(&musb_board_data);
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700883
884 status = omap_ethernet_init();
885 if (status) {
886 pr_err("Ethernet initialization failed: %d\n", status);
887 } else {
888 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
889 spi_register_board_info(sdp4430_spi_board_info,
890 ARRAY_SIZE(sdp4430_spi_board_info));
891 }
Syed Rafiuddin59556762010-12-27 05:51:45 +0000892
Shubhrajyoti Dattaf67df6c2011-07-05 03:38:24 -0700893 status = omap4_keyboard_init(&sdp4430_keypad_data, &keypad_data);
Syed Rafiuddin59556762010-12-27 05:51:45 +0000894 if (status)
895 pr_err("Keypad initialization failed: %d\n", status);
Mythri P K0425b482011-03-08 18:50:09 +0530896
897 omap_4430sdp_display_init();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700898}
899
900static void __init omap_4430sdp_map_io(void)
901{
902 omap2_set_globals_443x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800903 omap44xx_map_common_io();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700904}
905
906MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
907 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700908 .boot_params = 0x80000100,
Russell King71ee7da2010-05-23 10:18:16 +0100909 .reserve = omap_reserve,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800910 .map_io = omap_4430sdp_map_io,
911 .init_early = omap_4430sdp_init_early,
912 .init_irq = gic_init_irq,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700913 .init_machine = omap_4430sdp_init,
Tony Lindgrene74984e2011-03-29 15:54:48 -0700914 .timer = &omap4_timer,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700915MACHINE_END