PageRenderTime 80ms CodeModel.GetById 14ms app.highlight 59ms RepoModel.GetById 2ms app.codeStats 0ms

/arch/arm/mach-omap2/board-4430sdp.c

https://github.com/AICP/kernel_asus_grouper
C | 848 lines | 726 code | 100 blank | 22 comment | 14 complexity | 2ec523c6d23abe88afe499cc5d2e35eb MD5 | raw file
  1/*
  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>
 20#include <linux/usb/otg.h>
 21#include <linux/spi/spi.h>
 22#include <linux/i2c/twl.h>
 23#include <linux/gpio_keys.h>
 24#include <linux/regulator/machine.h>
 25#include <linux/regulator/fixed.h>
 26#include <linux/leds.h>
 27#include <linux/leds_pwm.h>
 28
 29#include <mach/hardware.h>
 30#include <mach/omap4-common.h>
 31#include <asm/mach-types.h>
 32#include <asm/mach/arch.h>
 33#include <asm/mach/map.h>
 34
 35#include <plat/board.h>
 36#include <plat/common.h>
 37#include <plat/usb.h>
 38#include <plat/mmc.h>
 39#include <plat/omap4-keypad.h>
 40#include <video/omapdss.h>
 41#include <linux/wl12xx.h>
 42
 43#include "mux.h"
 44#include "hsmmc.h"
 45#include "control.h"
 46#include "common-board-devices.h"
 47
 48#define ETH_KS8851_IRQ			34
 49#define ETH_KS8851_POWER_ON		48
 50#define ETH_KS8851_QUART		138
 51#define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO	184
 52#define OMAP4_SFH7741_ENABLE_GPIO		188
 53#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
 54#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
 55
 56#define GPIO_WIFI_PMENA		54
 57#define GPIO_WIFI_IRQ		53
 58
 59static 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};
132static 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};
190
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};
201
202static struct omap_board_data keypad_data = {
203	.id	    		= 1,
204	.pads	 		= keypad_pads,
205	.pads_cnt       	= ARRAY_SIZE(keypad_pads),
206};
207
208static 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
244static 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
254static struct gpio_led_platform_data sdp4430_led_data = {
255	.leds	= sdp4430_gpio_leds,
256	.num_leds	= ARRAY_SIZE(sdp4430_gpio_leds),
257};
258
259static 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
281static 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
307static struct platform_device sdp4430_leds_gpio = {
308	.name	= "leds-gpio",
309	.id	= -1,
310	.dev	= {
311		.platform_data = &sdp4430_led_data,
312	},
313};
314static 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
324static 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
330static int __init omap_ethernet_init(void)
331{
332	int status;
333
334	/* Request of GPIO lines */
335	status = gpio_request_array(sdp4430_eth_gpios,
336				    ARRAY_SIZE(sdp4430_eth_gpios));
337	if (status)
338		pr_err("Cannot request ETH GPIOs\n");
339
340	return status;
341}
342
343static struct platform_device sdp4430_lcd_device = {
344	.name		= "sdp4430_lcd",
345	.id		= -1,
346};
347
348static struct regulator_consumer_supply sdp4430_vbat_supply[] = {
349	REGULATOR_SUPPLY("vddvibl", "twl6040-vibra"),
350	REGULATOR_SUPPLY("vddvibr", "twl6040-vibra"),
351};
352
353static struct regulator_init_data sdp4430_vbat_data = {
354	.constraints = {
355		.always_on	= 1,
356	},
357	.num_consumer_supplies	= ARRAY_SIZE(sdp4430_vbat_supply),
358	.consumer_supplies	= sdp4430_vbat_supply,
359};
360
361static struct fixed_voltage_config sdp4430_vbat_pdata = {
362	.supply_name	= "VBAT",
363	.microvolts	= 3750000,
364	.init_data	= &sdp4430_vbat_data,
365	.gpio		= -EINVAL,
366};
367
368static struct platform_device sdp4430_vbat = {
369	.name		= "reg-fixed-voltage",
370	.id		= -1,
371	.dev = {
372		.platform_data = &sdp4430_vbat_pdata,
373	},
374};
375
376static struct platform_device *sdp4430_devices[] __initdata = {
377	&sdp4430_lcd_device,
378	&sdp4430_gpio_keys_device,
379	&sdp4430_leds_gpio,
380	&sdp4430_leds_pwm,
381	&sdp4430_vbat,
382};
383
384static struct omap_lcd_config sdp4430_lcd_config __initdata = {
385	.ctrl_name	= "internal",
386};
387
388static struct omap_board_config_kernel sdp4430_config[] __initdata = {
389	{ OMAP_TAG_LCD,		&sdp4430_lcd_config },
390};
391
392static void __init omap_4430sdp_init_early(void)
393{
394	omap2_init_common_infrastructure();
395	omap2_init_common_devices(NULL, NULL);
396}
397
398static struct omap_musb_board_data musb_board_data = {
399	.interface_type		= MUSB_INTERFACE_UTMI,
400	.mode			= MUSB_OTG,
401	.power			= 100,
402};
403
404static struct omap2_hsmmc_info mmc[] = {
405	{
406		.mmc		= 2,
407		.caps		=  MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
408		.gpio_cd	= -EINVAL,
409		.gpio_wp	= -EINVAL,
410		.nonremovable   = true,
411		.ocr_mask	= MMC_VDD_29_30,
412		.no_off_init	= true,
413	},
414	{
415		.mmc		= 1,
416		.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
417		.gpio_cd	= -EINVAL,
418		.gpio_wp	= -EINVAL,
419	},
420	{
421		.mmc		= 5,
422		.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
423		.gpio_cd	= -EINVAL,
424		.gpio_wp	= -EINVAL,
425		.ocr_mask	= MMC_VDD_165_195,
426		.nonremovable	= true,
427	},
428	{}	/* Terminator */
429};
430
431static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
432	REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
433};
434
435static struct regulator_consumer_supply omap4_sdp4430_vmmc5_supply = {
436	.supply = "vmmc",
437	.dev_name = "omap_hsmmc.4",
438};
439
440static struct regulator_init_data sdp4430_vmmc5 = {
441	.constraints = {
442		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
443	},
444	.num_consumer_supplies = 1,
445	.consumer_supplies = &omap4_sdp4430_vmmc5_supply,
446};
447
448static struct fixed_voltage_config sdp4430_vwlan = {
449	.supply_name		= "vwl1271",
450	.microvolts		= 1800000, /* 1.8V */
451	.gpio			= GPIO_WIFI_PMENA,
452	.startup_delay		= 70000, /* 70msec */
453	.enable_high		= 1,
454	.enabled_at_boot	= 0,
455	.init_data		= &sdp4430_vmmc5,
456};
457
458static struct platform_device omap_vwlan_device = {
459	.name		= "reg-fixed-voltage",
460	.id		= 1,
461	.dev = {
462		.platform_data = &sdp4430_vwlan,
463	},
464};
465
466static int omap4_twl6030_hsmmc_late_init(struct device *dev)
467{
468	int ret = 0;
469	struct platform_device *pdev = container_of(dev,
470				struct platform_device, dev);
471	struct omap_mmc_platform_data *pdata = dev->platform_data;
472
473	/* Setting MMC1 Card detect Irq */
474	if (pdev->id == 0) {
475		ret = twl6030_mmc_card_detect_config();
476		if (ret)
477			pr_err("Failed configuring MMC1 card detect\n");
478		pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
479						MMCDETECT_INTR_OFFSET;
480		pdata->slots[0].card_detect = twl6030_mmc_card_detect;
481	}
482	return ret;
483}
484
485static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
486{
487	struct omap_mmc_platform_data *pdata;
488
489	/* dev can be null if CONFIG_MMC_OMAP_HS is not set */
490	if (!dev) {
491		pr_err("Failed %s\n", __func__);
492		return;
493	}
494	pdata = dev->platform_data;
495	pdata->init =	omap4_twl6030_hsmmc_late_init;
496}
497
498static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
499{
500	struct omap2_hsmmc_info *c;
501
502	omap2_hsmmc_init(controllers);
503	for (c = controllers; c->mmc; c++)
504		omap4_twl6030_hsmmc_set_late_init(c->dev);
505
506	return 0;
507}
508
509static struct regulator_init_data sdp4430_vaux1 = {
510	.constraints = {
511		.min_uV			= 1000000,
512		.max_uV			= 3000000,
513		.apply_uV		= true,
514		.valid_modes_mask	= REGULATOR_MODE_NORMAL
515					| REGULATOR_MODE_STANDBY,
516		.valid_ops_mask	 = REGULATOR_CHANGE_VOLTAGE
517					| REGULATOR_CHANGE_MODE
518					| REGULATOR_CHANGE_STATUS,
519	},
520	.num_consumer_supplies  = ARRAY_SIZE(sdp4430_vaux_supply),
521	.consumer_supplies      = sdp4430_vaux_supply,
522};
523
524static struct regulator_init_data sdp4430_vusim = {
525	.constraints = {
526		.min_uV			= 1200000,
527		.max_uV			= 2900000,
528		.apply_uV		= true,
529		.valid_modes_mask	= REGULATOR_MODE_NORMAL
530					| REGULATOR_MODE_STANDBY,
531		.valid_ops_mask	 = REGULATOR_CHANGE_VOLTAGE
532					| REGULATOR_CHANGE_MODE
533					| REGULATOR_CHANGE_STATUS,
534	},
535};
536
537static struct twl4030_codec_data twl6040_codec = {
538	/* single-step ramp for headset and handsfree */
539	.hs_left_step	= 0x0f,
540	.hs_right_step	= 0x0f,
541	.hf_left_step	= 0x1d,
542	.hf_right_step	= 0x1d,
543};
544
545static struct twl4030_vibra_data twl6040_vibra = {
546	.vibldrv_res = 8,
547	.vibrdrv_res = 3,
548	.viblmotor_res = 10,
549	.vibrmotor_res = 10,
550	.vddvibl_uV = 0,	/* fixed volt supply - VBAT */
551	.vddvibr_uV = 0,	/* fixed volt supply - VBAT */
552};
553
554static struct twl4030_audio_data twl6040_audio = {
555	.codec		= &twl6040_codec,
556	.vibra		= &twl6040_vibra,
557	.audpwron_gpio	= 127,
558	.naudint_irq	= OMAP44XX_IRQ_SYS_2N,
559	.irq_base	= TWL6040_CODEC_IRQ_BASE,
560};
561
562static struct twl4030_platform_data sdp4430_twldata = {
563	.audio		= &twl6040_audio,
564	/* Regulators */
565	.vusim		= &sdp4430_vusim,
566	.vaux1		= &sdp4430_vaux1,
567};
568
569static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
570	{
571		I2C_BOARD_INFO("tmp105", 0x48),
572	},
573	{
574		I2C_BOARD_INFO("bh1780", 0x29),
575	},
576};
577static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
578	{
579		I2C_BOARD_INFO("hmc5843", 0x1e),
580	},
581};
582static int __init omap4_i2c_init(void)
583{
584	omap4_pmic_get_config(&sdp4430_twldata, TWL_COMMON_PDATA_USB,
585			TWL_COMMON_REGULATOR_VDAC |
586			TWL_COMMON_REGULATOR_VAUX2 |
587			TWL_COMMON_REGULATOR_VAUX3 |
588			TWL_COMMON_REGULATOR_VMMC |
589			TWL_COMMON_REGULATOR_VPP |
590			TWL_COMMON_REGULATOR_VANA |
591			TWL_COMMON_REGULATOR_VCXIO |
592			TWL_COMMON_REGULATOR_VUSB |
593			TWL_COMMON_REGULATOR_CLK32KG);
594	omap4_pmic_init("twl6030", &sdp4430_twldata);
595	omap_register_i2c_bus(2, 400, NULL, 0);
596	omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
597				ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
598	omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
599				ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
600	return 0;
601}
602
603static void __init omap_sfh7741prox_init(void)
604{
605	int error;
606
607	error = gpio_request_one(OMAP4_SFH7741_ENABLE_GPIO,
608				 GPIOF_OUT_INIT_LOW, "sfh7741");
609	if (error < 0)
610		pr_err("%s:failed to request GPIO %d, error %d\n",
611			__func__, OMAP4_SFH7741_ENABLE_GPIO, error);
612}
613
614static void sdp4430_hdmi_mux_init(void)
615{
616	/* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
617	omap_mux_init_signal("hdmi_hpd",
618			OMAP_PIN_INPUT_PULLUP);
619	omap_mux_init_signal("hdmi_cec",
620			OMAP_PIN_INPUT_PULLUP);
621	/* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
622	omap_mux_init_signal("hdmi_ddc_scl",
623			OMAP_PIN_INPUT_PULLUP);
624	omap_mux_init_signal("hdmi_ddc_sda",
625			OMAP_PIN_INPUT_PULLUP);
626}
627
628static struct gpio sdp4430_hdmi_gpios[] = {
629	{ HDMI_GPIO_HPD,	GPIOF_OUT_INIT_HIGH,	"hdmi_gpio_hpd"   },
630	{ HDMI_GPIO_LS_OE,	GPIOF_OUT_INIT_HIGH,	"hdmi_gpio_ls_oe" },
631};
632
633static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
634{
635	int status;
636
637	status = gpio_request_array(sdp4430_hdmi_gpios,
638				    ARRAY_SIZE(sdp4430_hdmi_gpios));
639	if (status)
640		pr_err("%s: Cannot request HDMI GPIOs\n", __func__);
641
642	return status;
643}
644
645static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
646{
647	gpio_free(HDMI_GPIO_LS_OE);
648	gpio_free(HDMI_GPIO_HPD);
649}
650
651static struct omap_dss_device sdp4430_hdmi_device = {
652	.name = "hdmi",
653	.driver_name = "hdmi_panel",
654	.type = OMAP_DISPLAY_TYPE_HDMI,
655	.clocks	= {
656		.dispc	= {
657			.dispc_fclk_src	= OMAP_DSS_CLK_SRC_FCK,
658		},
659		.hdmi	= {
660			.regn	= 15,
661			.regm2	= 1,
662		},
663	},
664	.platform_enable = sdp4430_panel_enable_hdmi,
665	.platform_disable = sdp4430_panel_disable_hdmi,
666	.channel = OMAP_DSS_CHANNEL_DIGIT,
667};
668
669static struct omap_dss_device *sdp4430_dss_devices[] = {
670	&sdp4430_hdmi_device,
671};
672
673static struct omap_dss_board_info sdp4430_dss_data = {
674	.num_devices	= ARRAY_SIZE(sdp4430_dss_devices),
675	.devices	= sdp4430_dss_devices,
676	.default_device	= &sdp4430_hdmi_device,
677};
678
679void omap_4430sdp_display_init(void)
680{
681	sdp4430_hdmi_mux_init();
682	omap_display_init(&sdp4430_dss_data);
683}
684
685#ifdef CONFIG_OMAP_MUX
686static struct omap_board_mux board_mux[] __initdata = {
687	OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
688	{ .reg_offset = OMAP_MUX_TERMINATOR },
689};
690
691static struct omap_device_pad serial2_pads[] __initdata = {
692	OMAP_MUX_STATIC("uart2_cts.uart2_cts",
693			 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
694	OMAP_MUX_STATIC("uart2_rts.uart2_rts",
695			 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
696	OMAP_MUX_STATIC("uart2_rx.uart2_rx",
697			 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
698	OMAP_MUX_STATIC("uart2_tx.uart2_tx",
699			 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
700};
701
702static struct omap_device_pad serial3_pads[] __initdata = {
703	OMAP_MUX_STATIC("uart3_cts_rctx.uart3_cts_rctx",
704			 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
705	OMAP_MUX_STATIC("uart3_rts_sd.uart3_rts_sd",
706			 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
707	OMAP_MUX_STATIC("uart3_rx_irrx.uart3_rx_irrx",
708			 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
709	OMAP_MUX_STATIC("uart3_tx_irtx.uart3_tx_irtx",
710			 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
711};
712
713static struct omap_device_pad serial4_pads[] __initdata = {
714	OMAP_MUX_STATIC("uart4_rx.uart4_rx",
715			 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
716	OMAP_MUX_STATIC("uart4_tx.uart4_tx",
717			 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
718};
719
720static struct omap_board_data serial2_data __initdata = {
721	.id		= 1,
722	.pads		= serial2_pads,
723	.pads_cnt	= ARRAY_SIZE(serial2_pads),
724};
725
726static struct omap_board_data serial3_data __initdata = {
727	.id		= 2,
728	.pads		= serial3_pads,
729	.pads_cnt	= ARRAY_SIZE(serial3_pads),
730};
731
732static struct omap_board_data serial4_data __initdata = {
733	.id		= 3,
734	.pads		= serial4_pads,
735	.pads_cnt	= ARRAY_SIZE(serial4_pads),
736};
737
738static inline void board_serial_init(void)
739{
740	struct omap_board_data bdata;
741	bdata.flags	= 0;
742	bdata.pads	= NULL;
743	bdata.pads_cnt	= 0;
744	bdata.id	= 0;
745	/* pass dummy data for UART1 */
746	omap_serial_init_port(&bdata);
747
748	omap_serial_init_port(&serial2_data);
749	omap_serial_init_port(&serial3_data);
750	omap_serial_init_port(&serial4_data);
751}
752#else
753#define board_mux	NULL
754
755static inline void board_serial_init(void)
756{
757	omap_serial_init();
758}
759 #endif
760
761static void omap4_sdp4430_wifi_mux_init(void)
762{
763	omap_mux_init_gpio(GPIO_WIFI_IRQ, OMAP_PIN_INPUT |
764				OMAP_PIN_OFF_WAKEUPENABLE);
765	omap_mux_init_gpio(GPIO_WIFI_PMENA, OMAP_PIN_OUTPUT);
766
767	omap_mux_init_signal("sdmmc5_cmd.sdmmc5_cmd",
768				OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
769	omap_mux_init_signal("sdmmc5_clk.sdmmc5_clk",
770				OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
771	omap_mux_init_signal("sdmmc5_dat0.sdmmc5_dat0",
772				OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
773	omap_mux_init_signal("sdmmc5_dat1.sdmmc5_dat1",
774				OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
775	omap_mux_init_signal("sdmmc5_dat2.sdmmc5_dat2",
776				OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
777	omap_mux_init_signal("sdmmc5_dat3.sdmmc5_dat3",
778				OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
779
780}
781
782static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
783	.irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ),
784	.board_ref_clock = WL12XX_REFCLOCK_26,
785	.board_tcxo_clock = WL12XX_TCXOCLOCK_26,
786};
787
788static void omap4_sdp4430_wifi_init(void)
789{
790	omap4_sdp4430_wifi_mux_init();
791	if (wl12xx_set_platform_data(&omap4_sdp4430_wlan_data))
792		pr_err("Error setting wl12xx data\n");
793	platform_device_register(&omap_vwlan_device);
794}
795
796static void __init omap_4430sdp_init(void)
797{
798	int status;
799	int package = OMAP_PACKAGE_CBS;
800
801	if (omap_rev() == OMAP4430_REV_ES1_0)
802		package = OMAP_PACKAGE_CBL;
803	omap4_mux_init(board_mux, NULL, package);
804
805	omap_board_config = sdp4430_config;
806	omap_board_config_size = ARRAY_SIZE(sdp4430_config);
807
808	omap4_i2c_init();
809	omap_sfh7741prox_init();
810	platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
811	board_serial_init();
812	omap4_sdp4430_wifi_init();
813	omap4_twl6030_hsmmc_init(mmc);
814
815	usb_musb_init(&musb_board_data);
816
817	status = omap_ethernet_init();
818	if (status) {
819		pr_err("Ethernet initialization failed: %d\n", status);
820	} else {
821		sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
822		spi_register_board_info(sdp4430_spi_board_info,
823				ARRAY_SIZE(sdp4430_spi_board_info));
824	}
825
826	status = omap4_keyboard_init(&sdp4430_keypad_data, &keypad_data);
827	if (status)
828		pr_err("Keypad initialization failed: %d\n", status);
829
830	omap_4430sdp_display_init();
831}
832
833static void __init omap_4430sdp_map_io(void)
834{
835	omap2_set_globals_443x();
836	omap44xx_map_common_io();
837}
838
839MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
840	/* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
841	.boot_params	= 0x80000100,
842	.reserve	= omap_reserve,
843	.map_io		= omap_4430sdp_map_io,
844	.init_early	= omap_4430sdp_init_early,
845	.init_irq	= gic_init_irq,
846	.init_machine	= omap_4430sdp_init,
847	.timer		= &omap4_timer,
848MACHINE_END