KVM: SVM: Add clean-bit for LBR state
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-omap2 / board-4430sdp.c
blobdf5a425a49d18e33290598e6efc3fd00a1cd00b4
1 /*
2 * Board support file for OMAP4430 SDP.
4 * Copyright (C) 2009 Texas Instruments
6 * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
8 * Based on mach-omap2/board-3430sdp.c
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.
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/leds.h>
27 #include <mach/hardware.h>
28 #include <mach/omap4-common.h>
29 #include <asm/mach-types.h>
30 #include <asm/mach/arch.h>
31 #include <asm/mach/map.h>
33 #include <plat/board.h>
34 #include <plat/common.h>
35 #include <plat/usb.h>
36 #include <plat/mmc.h>
38 #include "hsmmc.h"
39 #include "timer-gp.h"
40 #include "control.h"
42 #define ETH_KS8851_IRQ 34
43 #define ETH_KS8851_POWER_ON 48
44 #define ETH_KS8851_QUART 138
45 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
46 #define OMAP4_SFH7741_ENABLE_GPIO 188
48 static struct gpio_led sdp4430_gpio_leds[] = {
50 .name = "omap4:green:debug0",
51 .gpio = 61,
54 .name = "omap4:green:debug1",
55 .gpio = 30,
58 .name = "omap4:green:debug2",
59 .gpio = 7,
62 .name = "omap4:green:debug3",
63 .gpio = 8,
66 .name = "omap4:green:debug4",
67 .gpio = 50,
70 .name = "omap4:blue:user",
71 .gpio = 169,
74 .name = "omap4:red:user",
75 .gpio = 170,
78 .name = "omap4:green:user",
79 .gpio = 139,
84 static struct gpio_keys_button sdp4430_gpio_keys[] = {
86 .desc = "Proximity Sensor",
87 .type = EV_SW,
88 .code = SW_FRONT_PROXIMITY,
89 .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
90 .active_low = 0,
94 static struct gpio_led_platform_data sdp4430_led_data = {
95 .leds = sdp4430_gpio_leds,
96 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
99 static int omap_prox_activate(struct device *dev)
101 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
102 return 0;
105 static void omap_prox_deactivate(struct device *dev)
107 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
110 static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
111 .buttons = sdp4430_gpio_keys,
112 .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
113 .enable = omap_prox_activate,
114 .disable = omap_prox_deactivate,
117 static struct platform_device sdp4430_gpio_keys_device = {
118 .name = "gpio-keys",
119 .id = -1,
120 .dev = {
121 .platform_data = &sdp4430_gpio_keys_data,
125 static struct platform_device sdp4430_leds_gpio = {
126 .name = "leds-gpio",
127 .id = -1,
128 .dev = {
129 .platform_data = &sdp4430_led_data,
132 static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
134 .modalias = "ks8851",
135 .bus_num = 1,
136 .chip_select = 0,
137 .max_speed_hz = 24000000,
138 .irq = ETH_KS8851_IRQ,
142 static int omap_ethernet_init(void)
144 int status;
146 /* Request of GPIO lines */
148 status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
149 if (status) {
150 pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
151 return status;
154 status = gpio_request(ETH_KS8851_QUART, "quart");
155 if (status) {
156 pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
157 goto error1;
160 status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
161 if (status) {
162 pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
163 goto error2;
166 /* Configuration of requested GPIO lines */
168 status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
169 if (status) {
170 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
171 goto error3;
174 status = gpio_direction_output(ETH_KS8851_QUART, 1);
175 if (status) {
176 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
177 goto error3;
180 status = gpio_direction_input(ETH_KS8851_IRQ);
181 if (status) {
182 pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
183 goto error3;
186 return 0;
188 error3:
189 gpio_free(ETH_KS8851_IRQ);
190 error2:
191 gpio_free(ETH_KS8851_QUART);
192 error1:
193 gpio_free(ETH_KS8851_POWER_ON);
194 return status;
197 static struct platform_device sdp4430_lcd_device = {
198 .name = "sdp4430_lcd",
199 .id = -1,
202 static struct platform_device *sdp4430_devices[] __initdata = {
203 &sdp4430_lcd_device,
204 &sdp4430_gpio_keys_device,
205 &sdp4430_leds_gpio,
208 static struct omap_lcd_config sdp4430_lcd_config __initdata = {
209 .ctrl_name = "internal",
212 static struct omap_board_config_kernel sdp4430_config[] __initdata = {
213 { OMAP_TAG_LCD, &sdp4430_lcd_config },
216 static void __init omap_4430sdp_init_irq(void)
218 omap_board_config = sdp4430_config;
219 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
220 omap2_init_common_hw(NULL, NULL);
221 #ifdef CONFIG_OMAP_32K_TIMER
222 omap2_gp_clockevent_set_gptimer(1);
223 #endif
224 gic_init_irq();
225 omap_gpio_init();
228 static struct omap_musb_board_data musb_board_data = {
229 .interface_type = MUSB_INTERFACE_UTMI,
230 .mode = MUSB_PERIPHERAL,
231 .power = 100,
234 static struct omap2_hsmmc_info mmc[] = {
236 .mmc = 1,
237 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
238 .gpio_wp = -EINVAL,
241 .mmc = 2,
242 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
243 .gpio_cd = -EINVAL,
244 .gpio_wp = -EINVAL,
245 .nonremovable = true,
246 .ocr_mask = MMC_VDD_29_30,
248 {} /* Terminator */
251 static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
253 .supply = "vmmc",
254 .dev_name = "mmci-omap-hs.1",
257 static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
259 .supply = "vmmc",
260 .dev_name = "mmci-omap-hs.0",
264 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
266 int ret = 0;
267 struct platform_device *pdev = container_of(dev,
268 struct platform_device, dev);
269 struct omap_mmc_platform_data *pdata = dev->platform_data;
271 /* Setting MMC1 Card detect Irq */
272 if (pdev->id == 0) {
273 ret = twl6030_mmc_card_detect_config();
274 if (ret)
275 pr_err("Failed configuring MMC1 card detect\n");
276 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
277 MMCDETECT_INTR_OFFSET;
278 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
280 return ret;
283 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
285 struct omap_mmc_platform_data *pdata;
287 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
288 if (!dev) {
289 pr_err("Failed %s\n", __func__);
290 return;
292 pdata = dev->platform_data;
293 pdata->init = omap4_twl6030_hsmmc_late_init;
296 static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
298 struct omap2_hsmmc_info *c;
300 omap2_hsmmc_init(controllers);
301 for (c = controllers; c->mmc; c++)
302 omap4_twl6030_hsmmc_set_late_init(c->dev);
304 return 0;
307 static struct regulator_init_data sdp4430_vaux1 = {
308 .constraints = {
309 .min_uV = 1000000,
310 .max_uV = 3000000,
311 .apply_uV = true,
312 .valid_modes_mask = REGULATOR_MODE_NORMAL
313 | REGULATOR_MODE_STANDBY,
314 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
315 | REGULATOR_CHANGE_MODE
316 | REGULATOR_CHANGE_STATUS,
318 .num_consumer_supplies = 1,
319 .consumer_supplies = sdp4430_vaux_supply,
322 static struct regulator_init_data sdp4430_vaux2 = {
323 .constraints = {
324 .min_uV = 1200000,
325 .max_uV = 2800000,
326 .apply_uV = true,
327 .valid_modes_mask = REGULATOR_MODE_NORMAL
328 | REGULATOR_MODE_STANDBY,
329 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
330 | REGULATOR_CHANGE_MODE
331 | REGULATOR_CHANGE_STATUS,
335 static struct regulator_init_data sdp4430_vaux3 = {
336 .constraints = {
337 .min_uV = 1000000,
338 .max_uV = 3000000,
339 .apply_uV = true,
340 .valid_modes_mask = REGULATOR_MODE_NORMAL
341 | REGULATOR_MODE_STANDBY,
342 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
343 | REGULATOR_CHANGE_MODE
344 | REGULATOR_CHANGE_STATUS,
348 /* VMMC1 for MMC1 card */
349 static struct regulator_init_data sdp4430_vmmc = {
350 .constraints = {
351 .min_uV = 1200000,
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,
360 .num_consumer_supplies = 1,
361 .consumer_supplies = sdp4430_vmmc_supply,
364 static struct regulator_init_data sdp4430_vpp = {
365 .constraints = {
366 .min_uV = 1800000,
367 .max_uV = 2500000,
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,
377 static struct regulator_init_data sdp4430_vusim = {
378 .constraints = {
379 .min_uV = 1200000,
380 .max_uV = 2900000,
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,
390 static struct regulator_init_data sdp4430_vana = {
391 .constraints = {
392 .min_uV = 2100000,
393 .max_uV = 2100000,
394 .apply_uV = true,
395 .valid_modes_mask = REGULATOR_MODE_NORMAL
396 | REGULATOR_MODE_STANDBY,
397 .valid_ops_mask = REGULATOR_CHANGE_MODE
398 | REGULATOR_CHANGE_STATUS,
402 static struct regulator_init_data sdp4430_vcxio = {
403 .constraints = {
404 .min_uV = 1800000,
405 .max_uV = 1800000,
406 .apply_uV = true,
407 .valid_modes_mask = REGULATOR_MODE_NORMAL
408 | REGULATOR_MODE_STANDBY,
409 .valid_ops_mask = REGULATOR_CHANGE_MODE
410 | REGULATOR_CHANGE_STATUS,
414 static struct regulator_init_data sdp4430_vdac = {
415 .constraints = {
416 .min_uV = 1800000,
417 .max_uV = 1800000,
418 .apply_uV = true,
419 .valid_modes_mask = REGULATOR_MODE_NORMAL
420 | REGULATOR_MODE_STANDBY,
421 .valid_ops_mask = REGULATOR_CHANGE_MODE
422 | REGULATOR_CHANGE_STATUS,
426 static struct regulator_init_data sdp4430_vusb = {
427 .constraints = {
428 .min_uV = 3300000,
429 .max_uV = 3300000,
430 .apply_uV = true,
431 .valid_modes_mask = REGULATOR_MODE_NORMAL
432 | REGULATOR_MODE_STANDBY,
433 .valid_ops_mask = REGULATOR_CHANGE_MODE
434 | REGULATOR_CHANGE_STATUS,
438 static struct twl4030_platform_data sdp4430_twldata = {
439 .irq_base = TWL6030_IRQ_BASE,
440 .irq_end = TWL6030_IRQ_END,
442 /* Regulators */
443 .vmmc = &sdp4430_vmmc,
444 .vpp = &sdp4430_vpp,
445 .vusim = &sdp4430_vusim,
446 .vana = &sdp4430_vana,
447 .vcxio = &sdp4430_vcxio,
448 .vdac = &sdp4430_vdac,
449 .vusb = &sdp4430_vusb,
450 .vaux1 = &sdp4430_vaux1,
451 .vaux2 = &sdp4430_vaux2,
452 .vaux3 = &sdp4430_vaux3,
455 static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
457 I2C_BOARD_INFO("twl6030", 0x48),
458 .flags = I2C_CLIENT_WAKE,
459 .irq = OMAP44XX_IRQ_SYS_1N,
460 .platform_data = &sdp4430_twldata,
463 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
465 I2C_BOARD_INFO("tmp105", 0x48),
468 static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
470 I2C_BOARD_INFO("hmc5843", 0x1e),
473 static int __init omap4_i2c_init(void)
476 * Phoenix Audio IC needs I2C1 to
477 * start with 400 KHz or less
479 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
480 ARRAY_SIZE(sdp4430_i2c_boardinfo));
481 omap_register_i2c_bus(2, 400, NULL, 0);
482 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
483 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
484 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
485 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
486 return 0;
489 static void __init omap_sfh7741prox_init(void)
491 int error;
493 error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741");
494 if (error < 0) {
495 pr_err("%s:failed to request GPIO %d, error %d\n",
496 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
497 return;
500 error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
501 if (error < 0) {
502 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
503 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
504 gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
508 static void __init omap_4430sdp_init(void)
510 int status;
512 omap4_i2c_init();
513 omap_sfh7741prox_init();
514 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
515 omap_serial_init();
516 omap4_twl6030_hsmmc_init(mmc);
517 /* OMAP4 SDP uses internal transceiver so register nop transceiver */
518 usb_nop_xceiv_register();
519 /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
520 if (!cpu_is_omap44xx())
521 usb_musb_init(&musb_board_data);
523 status = omap_ethernet_init();
524 if (status) {
525 pr_err("Ethernet initialization failed: %d\n", status);
526 } else {
527 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
528 spi_register_board_info(sdp4430_spi_board_info,
529 ARRAY_SIZE(sdp4430_spi_board_info));
533 static void __init omap_4430sdp_map_io(void)
535 omap2_set_globals_443x();
536 omap44xx_map_common_io();
539 MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
540 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
541 .boot_params = 0x80000100,
542 .map_io = omap_4430sdp_map_io,
543 .reserve = omap_reserve,
544 .init_irq = omap_4430sdp_init_irq,
545 .init_machine = omap_4430sdp_init,
546 .timer = &omap_timer,
547 MACHINE_END