blob: 12d99e582cd651864b289ed70df1131191f5a488 [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>
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070038
Benoit Coussonfb6bf632010-08-10 17:43:15 +020039#include "mux.h"
kishore kadiyala717c1fb2010-05-15 18:21:06 +000040#include "hsmmc.h"
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070041#include "timer-gp.h"
Paul Walmsley4814ced2010-10-08 11:40:20 -060042#include "control.h"
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070043
Abraham Arceb2aa5e52010-05-14 12:05:26 -070044#define ETH_KS8851_IRQ 34
45#define ETH_KS8851_POWER_ON 48
46#define ETH_KS8851_QUART 138
Keshava Munegowda6aa85a52010-11-21 23:23:42 +053047#define OMAP4SDP_MDM_PWR_EN_GPIO 157
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
Hemanth V509b6d92010-08-02 13:18:04 +030051static struct gpio_led sdp4430_gpio_leds[] = {
52 {
53 .name = "omap4:green:debug0",
54 .gpio = 61,
55 },
56 {
57 .name = "omap4:green:debug1",
58 .gpio = 30,
59 },
60 {
61 .name = "omap4:green:debug2",
62 .gpio = 7,
63 },
64 {
65 .name = "omap4:green:debug3",
66 .gpio = 8,
67 },
68 {
69 .name = "omap4:green:debug4",
70 .gpio = 50,
71 },
72 {
73 .name = "omap4:blue:user",
74 .gpio = 169,
75 },
76 {
77 .name = "omap4:red:user",
78 .gpio = 170,
79 },
80 {
81 .name = "omap4:green:user",
82 .gpio = 139,
83 },
84
85};
86
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -070087static struct gpio_keys_button sdp4430_gpio_keys[] = {
88 {
89 .desc = "Proximity Sensor",
90 .type = EV_SW,
91 .code = SW_FRONT_PROXIMITY,
92 .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
93 .active_low = 0,
94 }
95};
96
Hemanth V509b6d92010-08-02 13:18:04 +030097static struct gpio_led_platform_data sdp4430_led_data = {
98 .leds = sdp4430_gpio_leds,
99 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
100};
101
Hemanth Vf389f4c2010-12-17 18:15:08 -0800102static struct led_pwm sdp4430_pwm_leds[] = {
103 {
104 .name = "omap4:green:chrg",
105 .pwm_id = 1,
106 .max_brightness = 255,
107 .pwm_period_ns = 7812500,
108 },
109};
110
111static struct led_pwm_platform_data sdp4430_pwm_data = {
112 .num_leds = ARRAY_SIZE(sdp4430_pwm_leds),
113 .leds = sdp4430_pwm_leds,
114};
115
116static struct platform_device sdp4430_leds_pwm = {
117 .name = "leds_pwm",
118 .id = -1,
119 .dev = {
120 .platform_data = &sdp4430_pwm_data,
121 },
122};
123
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700124static int omap_prox_activate(struct device *dev)
125{
126 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
127 return 0;
128}
129
130static void omap_prox_deactivate(struct device *dev)
131{
132 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
133}
134
135static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
136 .buttons = sdp4430_gpio_keys,
137 .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
138 .enable = omap_prox_activate,
139 .disable = omap_prox_deactivate,
140};
141
142static struct platform_device sdp4430_gpio_keys_device = {
143 .name = "gpio-keys",
144 .id = -1,
145 .dev = {
146 .platform_data = &sdp4430_gpio_keys_data,
147 },
148};
149
Hemanth V509b6d92010-08-02 13:18:04 +0300150static struct platform_device sdp4430_leds_gpio = {
151 .name = "leds-gpio",
152 .id = -1,
153 .dev = {
154 .platform_data = &sdp4430_led_data,
155 },
156};
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700157static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
158 {
159 .modalias = "ks8851",
160 .bus_num = 1,
161 .chip_select = 0,
162 .max_speed_hz = 24000000,
163 .irq = ETH_KS8851_IRQ,
164 },
165};
166
167static int omap_ethernet_init(void)
168{
169 int status;
170
171 /* Request of GPIO lines */
172
173 status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
174 if (status) {
175 pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
176 return status;
177 }
178
179 status = gpio_request(ETH_KS8851_QUART, "quart");
180 if (status) {
181 pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
182 goto error1;
183 }
184
185 status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
186 if (status) {
187 pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
188 goto error2;
189 }
190
191 /* Configuration of requested GPIO lines */
192
193 status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
194 if (status) {
195 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
196 goto error3;
197 }
198
199 status = gpio_direction_output(ETH_KS8851_QUART, 1);
200 if (status) {
201 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
202 goto error3;
203 }
204
205 status = gpio_direction_input(ETH_KS8851_IRQ);
206 if (status) {
207 pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
208 goto error3;
209 }
210
211 return 0;
212
213error3:
214 gpio_free(ETH_KS8851_IRQ);
215error2:
216 gpio_free(ETH_KS8851_QUART);
217error1:
218 gpio_free(ETH_KS8851_POWER_ON);
219 return status;
220}
221
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700222static struct platform_device sdp4430_lcd_device = {
223 .name = "sdp4430_lcd",
224 .id = -1,
225};
226
227static struct platform_device *sdp4430_devices[] __initdata = {
228 &sdp4430_lcd_device,
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700229 &sdp4430_gpio_keys_device,
Hemanth V509b6d92010-08-02 13:18:04 +0300230 &sdp4430_leds_gpio,
Hemanth Vf389f4c2010-12-17 18:15:08 -0800231 &sdp4430_leds_pwm,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700232};
233
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700234static struct omap_lcd_config sdp4430_lcd_config __initdata = {
235 .ctrl_name = "internal",
236};
237
238static struct omap_board_config_kernel sdp4430_config[] __initdata = {
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700239 { OMAP_TAG_LCD, &sdp4430_lcd_config },
240};
241
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800242static void __init omap_4430sdp_init_early(void)
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700243{
Santosh Shilimkar5b7815b2009-10-22 14:48:14 -0700244 omap_board_config = sdp4430_config;
245 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
Paul Walmsley48057342010-12-21 15:25:10 -0700246 omap2_init_common_infrastructure();
247 omap2_init_common_devices(NULL, NULL);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700248#ifdef CONFIG_OMAP_32K_TIMER
249 omap2_gp_clockevent_set_gptimer(1);
250#endif
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700251}
252
Keshava Munegowda6aa85a52010-11-21 23:23:42 +0530253static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
254 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
255 .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
256 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
257 .phy_reset = false,
258 .reset_gpio_port[0] = -EINVAL,
259 .reset_gpio_port[1] = -EINVAL,
260 .reset_gpio_port[2] = -EINVAL,
261};
262
Maulik Mankadbce06682010-02-17 14:09:32 -0800263static struct omap_musb_board_data musb_board_data = {
264 .interface_type = MUSB_INTERFACE_UTMI,
Hema HK09e72002010-12-10 18:11:42 +0530265 .mode = MUSB_OTG,
Maulik Mankadbce06682010-02-17 14:09:32 -0800266 .power = 100,
267};
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000268
Hema HKe70357e2010-12-10 18:09:52 +0530269static struct twl4030_usb_data omap4_usbphy_data = {
270 .phy_init = omap4430_phy_init,
271 .phy_exit = omap4430_phy_exit,
272 .phy_power = omap4430_phy_power,
273 .phy_set_clock = omap4430_phy_set_clk,
274};
275
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000276static struct omap2_hsmmc_info mmc[] = {
277 {
278 .mmc = 1,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000279 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000280 .gpio_wp = -EINVAL,
281 },
282 {
283 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000284 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000285 .gpio_cd = -EINVAL,
286 .gpio_wp = -EINVAL,
287 .nonremovable = true,
kishore kadiyala64be9782010-10-01 16:35:28 -0700288 .ocr_mask = MMC_VDD_29_30,
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000289 },
290 {} /* Terminator */
291};
292
Santosh Shilimkar50263912010-08-02 13:18:03 +0300293static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
294 {
295 .supply = "vmmc",
296 .dev_name = "mmci-omap-hs.1",
297 },
298};
Balaji T K6e30a7d2010-05-12 08:27:30 +0000299static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
300 {
301 .supply = "vmmc",
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000302 .dev_name = "mmci-omap-hs.0",
Balaji T K6e30a7d2010-05-12 08:27:30 +0000303 },
Balaji T K6e30a7d2010-05-12 08:27:30 +0000304};
305
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000306static int omap4_twl6030_hsmmc_late_init(struct device *dev)
307{
308 int ret = 0;
309 struct platform_device *pdev = container_of(dev,
310 struct platform_device, dev);
311 struct omap_mmc_platform_data *pdata = dev->platform_data;
312
313 /* Setting MMC1 Card detect Irq */
kishore kadiyala72f2e2c2010-09-24 17:13:20 +0000314 if (pdev->id == 0) {
315 ret = twl6030_mmc_card_detect_config();
316 if (ret)
317 pr_err("Failed configuring MMC1 card detect\n");
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000318 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
319 MMCDETECT_INTR_OFFSET;
kishore kadiyala72f2e2c2010-09-24 17:13:20 +0000320 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
321 }
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000322 return ret;
323}
324
325static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
326{
Benoit Cousson531c21b2010-10-01 16:35:26 -0700327 struct omap_mmc_platform_data *pdata;
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000328
Benoit Cousson531c21b2010-10-01 16:35:26 -0700329 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
330 if (!dev) {
331 pr_err("Failed %s\n", __func__);
332 return;
333 }
334 pdata = dev->platform_data;
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000335 pdata->init = omap4_twl6030_hsmmc_late_init;
336}
337
338static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
339{
340 struct omap2_hsmmc_info *c;
341
342 omap2_hsmmc_init(controllers);
343 for (c = controllers; c->mmc; c++)
344 omap4_twl6030_hsmmc_set_late_init(c->dev);
345
346 return 0;
347}
348
Balaji T K6e30a7d2010-05-12 08:27:30 +0000349static struct regulator_init_data sdp4430_vaux1 = {
350 .constraints = {
351 .min_uV = 1000000,
352 .max_uV = 3000000,
353 .apply_uV = true,
354 .valid_modes_mask = REGULATOR_MODE_NORMAL
355 | REGULATOR_MODE_STANDBY,
356 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
357 | REGULATOR_CHANGE_MODE
358 | REGULATOR_CHANGE_STATUS,
359 },
Santosh Shilimkar50263912010-08-02 13:18:03 +0300360 .num_consumer_supplies = 1,
361 .consumer_supplies = sdp4430_vaux_supply,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000362};
363
364static struct regulator_init_data sdp4430_vaux2 = {
365 .constraints = {
366 .min_uV = 1200000,
367 .max_uV = 2800000,
368 .apply_uV = true,
369 .valid_modes_mask = REGULATOR_MODE_NORMAL
370 | REGULATOR_MODE_STANDBY,
371 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
372 | REGULATOR_CHANGE_MODE
373 | REGULATOR_CHANGE_STATUS,
374 },
375};
376
377static struct regulator_init_data sdp4430_vaux3 = {
378 .constraints = {
379 .min_uV = 1000000,
380 .max_uV = 3000000,
381 .apply_uV = true,
382 .valid_modes_mask = REGULATOR_MODE_NORMAL
383 | REGULATOR_MODE_STANDBY,
384 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
385 | REGULATOR_CHANGE_MODE
386 | REGULATOR_CHANGE_STATUS,
387 },
388};
389
390/* VMMC1 for MMC1 card */
391static struct regulator_init_data sdp4430_vmmc = {
392 .constraints = {
393 .min_uV = 1200000,
394 .max_uV = 3000000,
395 .apply_uV = true,
396 .valid_modes_mask = REGULATOR_MODE_NORMAL
397 | REGULATOR_MODE_STANDBY,
398 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
399 | REGULATOR_CHANGE_MODE
400 | REGULATOR_CHANGE_STATUS,
401 },
Santosh Shilimkar50263912010-08-02 13:18:03 +0300402 .num_consumer_supplies = 1,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000403 .consumer_supplies = sdp4430_vmmc_supply,
404};
405
406static struct regulator_init_data sdp4430_vpp = {
407 .constraints = {
408 .min_uV = 1800000,
409 .max_uV = 2500000,
410 .apply_uV = true,
411 .valid_modes_mask = REGULATOR_MODE_NORMAL
412 | REGULATOR_MODE_STANDBY,
413 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
414 | REGULATOR_CHANGE_MODE
415 | REGULATOR_CHANGE_STATUS,
416 },
417};
418
419static struct regulator_init_data sdp4430_vusim = {
420 .constraints = {
421 .min_uV = 1200000,
422 .max_uV = 2900000,
423 .apply_uV = true,
424 .valid_modes_mask = REGULATOR_MODE_NORMAL
425 | REGULATOR_MODE_STANDBY,
426 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
427 | REGULATOR_CHANGE_MODE
428 | REGULATOR_CHANGE_STATUS,
429 },
430};
431
432static struct regulator_init_data sdp4430_vana = {
433 .constraints = {
434 .min_uV = 2100000,
435 .max_uV = 2100000,
436 .apply_uV = true,
437 .valid_modes_mask = REGULATOR_MODE_NORMAL
438 | REGULATOR_MODE_STANDBY,
439 .valid_ops_mask = REGULATOR_CHANGE_MODE
440 | REGULATOR_CHANGE_STATUS,
441 },
442};
443
444static struct regulator_init_data sdp4430_vcxio = {
445 .constraints = {
446 .min_uV = 1800000,
447 .max_uV = 1800000,
448 .apply_uV = true,
449 .valid_modes_mask = REGULATOR_MODE_NORMAL
450 | REGULATOR_MODE_STANDBY,
451 .valid_ops_mask = REGULATOR_CHANGE_MODE
452 | REGULATOR_CHANGE_STATUS,
453 },
454};
455
456static struct regulator_init_data sdp4430_vdac = {
457 .constraints = {
458 .min_uV = 1800000,
459 .max_uV = 1800000,
460 .apply_uV = true,
461 .valid_modes_mask = REGULATOR_MODE_NORMAL
462 | REGULATOR_MODE_STANDBY,
463 .valid_ops_mask = REGULATOR_CHANGE_MODE
464 | REGULATOR_CHANGE_STATUS,
465 },
466};
467
468static struct regulator_init_data sdp4430_vusb = {
469 .constraints = {
470 .min_uV = 3300000,
471 .max_uV = 3300000,
472 .apply_uV = true,
473 .valid_modes_mask = REGULATOR_MODE_NORMAL
474 | REGULATOR_MODE_STANDBY,
475 .valid_ops_mask = REGULATOR_CHANGE_MODE
476 | REGULATOR_CHANGE_STATUS,
477 },
478};
479
480static struct twl4030_platform_data sdp4430_twldata = {
481 .irq_base = TWL6030_IRQ_BASE,
482 .irq_end = TWL6030_IRQ_END,
483
484 /* Regulators */
485 .vmmc = &sdp4430_vmmc,
486 .vpp = &sdp4430_vpp,
487 .vusim = &sdp4430_vusim,
488 .vana = &sdp4430_vana,
489 .vcxio = &sdp4430_vcxio,
490 .vdac = &sdp4430_vdac,
491 .vusb = &sdp4430_vusb,
492 .vaux1 = &sdp4430_vaux1,
493 .vaux2 = &sdp4430_vaux2,
494 .vaux3 = &sdp4430_vaux3,
Hema HKe70357e2010-12-10 18:09:52 +0530495 .usb = &omap4_usbphy_data
Balaji T K6e30a7d2010-05-12 08:27:30 +0000496};
497
498static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
499 {
500 I2C_BOARD_INFO("twl6030", 0x48),
501 .flags = I2C_CLIENT_WAKE,
502 .irq = OMAP44XX_IRQ_SYS_1N,
503 .platform_data = &sdp4430_twldata,
504 },
505};
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300506static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
507 {
508 I2C_BOARD_INFO("tmp105", 0x48),
509 },
Hemanth Vd048aca2010-12-17 18:15:08 -0800510 {
511 I2C_BOARD_INFO("bh1780", 0x29),
512 },
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300513};
Shubhrajyoti Datta0df891b2010-09-23 18:22:47 -0700514static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
515 {
516 I2C_BOARD_INFO("hmc5843", 0x1e),
517 },
518};
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000519static int __init omap4_i2c_init(void)
520{
521 /*
522 * Phoenix Audio IC needs I2C1 to
523 * start with 400 KHz or less
524 */
Balaji T K6e30a7d2010-05-12 08:27:30 +0000525 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
526 ARRAY_SIZE(sdp4430_i2c_boardinfo));
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000527 omap_register_i2c_bus(2, 400, NULL, 0);
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300528 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
529 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
Shubhrajyoti Datta0df891b2010-09-23 18:22:47 -0700530 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
531 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000532 return 0;
533}
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700534
535static void __init omap_sfh7741prox_init(void)
536{
537 int error;
538
539 error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741");
540 if (error < 0) {
541 pr_err("%s:failed to request GPIO %d, error %d\n",
542 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
543 return;
544 }
545
546 error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
547 if (error < 0) {
548 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
549 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
550 gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
551 }
552}
553
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200554#ifdef CONFIG_OMAP_MUX
555static struct omap_board_mux board_mux[] __initdata = {
Tony Lindgren7d4ca852011-01-11 15:31:45 -0800556 OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200557 { .reg_offset = OMAP_MUX_TERMINATOR },
558};
559#else
560#define board_mux NULL
561#endif
562
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700563static void __init omap_4430sdp_init(void)
564{
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700565 int status;
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200566 int package = OMAP_PACKAGE_CBS;
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700567
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200568 if (omap_rev() == OMAP4430_REV_ES1_0)
569 package = OMAP_PACKAGE_CBL;
570 omap4_mux_init(board_mux, package);
571
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000572 omap4_i2c_init();
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700573 omap_sfh7741prox_init();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700574 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700575 omap_serial_init();
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000576 omap4_twl6030_hsmmc_init(mmc);
Keshava Munegowda6aa85a52010-11-21 23:23:42 +0530577
578 /* Power on the ULPI PHY */
Tony Lindgren7d4ca852011-01-11 15:31:45 -0800579 status = gpio_request(OMAP4SDP_MDM_PWR_EN_GPIO, "USBB1 PHY VMDM_3V3");
580 if (status)
581 pr_err("%s: Could not get USBB1 PHY GPIO\n", __func__);
582 else
Keshava Munegowda6aa85a52010-11-21 23:23:42 +0530583 gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO, 1);
Tony Lindgren7d4ca852011-01-11 15:31:45 -0800584
Keshava Munegowda6aa85a52010-11-21 23:23:42 +0530585 usb_ehci_init(&ehci_pdata);
Felipe Balbi46960842010-12-07 09:57:59 +0200586 usb_musb_init(&musb_board_data);
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700587
588 status = omap_ethernet_init();
589 if (status) {
590 pr_err("Ethernet initialization failed: %d\n", status);
591 } else {
592 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
593 spi_register_board_info(sdp4430_spi_board_info,
594 ARRAY_SIZE(sdp4430_spi_board_info));
595 }
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700596}
597
598static void __init omap_4430sdp_map_io(void)
599{
600 omap2_set_globals_443x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800601 omap44xx_map_common_io();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700602}
603
604MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
605 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700606 .boot_params = 0x80000100,
Russell King71ee7da2010-05-23 10:18:16 +0100607 .reserve = omap_reserve,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800608 .map_io = omap_4430sdp_map_io,
609 .init_early = omap_4430sdp_init_early,
610 .init_irq = gic_init_irq,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700611 .init_machine = omap_4430sdp_init,
612 .timer = &omap_timer,
613MACHINE_END