linux/arch/arm/mach-omap2/board-4430sdp.c
<<
>>
Prefs
   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/mfd/twl6040.h>
  24#include <linux/gpio_keys.h>
  25#include <linux/regulator/machine.h>
  26#include <linux/regulator/fixed.h>
  27#include <linux/pwm.h>
  28#include <linux/leds.h>
  29#include <linux/leds_pwm.h>
  30#include <linux/pwm_backlight.h>
  31#include <linux/irqchip/arm-gic.h>
  32#include <linux/platform_data/omap4-keypad.h>
  33#include <linux/usb/musb.h>
  34#include <linux/usb/phy.h>
  35
  36#include <asm/mach-types.h>
  37#include <asm/mach/arch.h>
  38#include <asm/mach/map.h>
  39
  40#include "common.h"
  41#include "omap4-keypad.h"
  42#include <linux/wl12xx.h>
  43#include <linux/platform_data/omap-abe-twl6040.h>
  44
  45#include "soc.h"
  46#include "mux.h"
  47#include "mmc.h"
  48#include "hsmmc.h"
  49#include "control.h"
  50#include "common-board-devices.h"
  51#include "dss-common.h"
  52
  53#define ETH_KS8851_IRQ                  34
  54#define ETH_KS8851_POWER_ON             48
  55#define ETH_KS8851_QUART                138
  56#define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO        184
  57#define OMAP4_SFH7741_ENABLE_GPIO               188
  58
  59#define GPIO_WIFI_PMENA         54
  60#define GPIO_WIFI_IRQ           53
  61
  62static const int sdp4430_keymap[] = {
  63        KEY(0, 0, KEY_E),
  64        KEY(0, 1, KEY_R),
  65        KEY(0, 2, KEY_T),
  66        KEY(0, 3, KEY_HOME),
  67        KEY(0, 4, KEY_F5),
  68        KEY(0, 5, KEY_UNKNOWN),
  69        KEY(0, 6, KEY_I),
  70        KEY(0, 7, KEY_LEFTSHIFT),
  71
  72        KEY(1, 0, KEY_D),
  73        KEY(1, 1, KEY_F),
  74        KEY(1, 2, KEY_G),
  75        KEY(1, 3, KEY_SEND),
  76        KEY(1, 4, KEY_F6),
  77        KEY(1, 5, KEY_UNKNOWN),
  78        KEY(1, 6, KEY_K),
  79        KEY(1, 7, KEY_ENTER),
  80
  81        KEY(2, 0, KEY_X),
  82        KEY(2, 1, KEY_C),
  83        KEY(2, 2, KEY_V),
  84        KEY(2, 3, KEY_END),
  85        KEY(2, 4, KEY_F7),
  86        KEY(2, 5, KEY_UNKNOWN),
  87        KEY(2, 6, KEY_DOT),
  88        KEY(2, 7, KEY_CAPSLOCK),
  89
  90        KEY(3, 0, KEY_Z),
  91        KEY(3, 1, KEY_KPPLUS),
  92        KEY(3, 2, KEY_B),
  93        KEY(3, 3, KEY_F1),
  94        KEY(3, 4, KEY_F8),
  95        KEY(3, 5, KEY_UNKNOWN),
  96        KEY(3, 6, KEY_O),
  97        KEY(3, 7, KEY_SPACE),
  98
  99        KEY(4, 0, KEY_W),
 100        KEY(4, 1, KEY_Y),
 101        KEY(4, 2, KEY_U),
 102        KEY(4, 3, KEY_F2),
 103        KEY(4, 4, KEY_VOLUMEUP),
 104        KEY(4, 5, KEY_UNKNOWN),
 105        KEY(4, 6, KEY_L),
 106        KEY(4, 7, KEY_LEFT),
 107
 108        KEY(5, 0, KEY_S),
 109        KEY(5, 1, KEY_H),
 110        KEY(5, 2, KEY_J),
 111        KEY(5, 3, KEY_F3),
 112        KEY(5, 4, KEY_F9),
 113        KEY(5, 5, KEY_VOLUMEDOWN),
 114        KEY(5, 6, KEY_M),
 115        KEY(5, 7, KEY_RIGHT),
 116
 117        KEY(6, 0, KEY_Q),
 118        KEY(6, 1, KEY_A),
 119        KEY(6, 2, KEY_N),
 120        KEY(6, 3, KEY_BACK),
 121        KEY(6, 4, KEY_BACKSPACE),
 122        KEY(6, 5, KEY_UNKNOWN),
 123        KEY(6, 6, KEY_P),
 124        KEY(6, 7, KEY_UP),
 125
 126        KEY(7, 0, KEY_PROG1),
 127        KEY(7, 1, KEY_PROG2),
 128        KEY(7, 2, KEY_PROG3),
 129        KEY(7, 3, KEY_PROG4),
 130        KEY(7, 4, KEY_F4),
 131        KEY(7, 5, KEY_UNKNOWN),
 132        KEY(7, 6, KEY_OK),
 133        KEY(7, 7, KEY_DOWN),
 134};
 135static struct omap_device_pad keypad_pads[] = {
 136        {       .name   = "kpd_col1.kpd_col1",
 137                .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
 138        },
 139        {       .name   = "kpd_col1.kpd_col1",
 140                .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
 141        },
 142        {       .name   = "kpd_col2.kpd_col2",
 143                .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
 144        },
 145        {       .name   = "kpd_col3.kpd_col3",
 146                .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
 147        },
 148        {       .name   = "kpd_col4.kpd_col4",
 149                .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
 150        },
 151        {       .name   = "kpd_col5.kpd_col5",
 152                .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
 153        },
 154        {       .name   = "gpmc_a23.kpd_col7",
 155                .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
 156        },
 157        {       .name   = "gpmc_a22.kpd_col6",
 158                .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
 159        },
 160        {       .name   = "kpd_row0.kpd_row0",
 161                .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
 162                        OMAP_MUX_MODE1 | OMAP_INPUT_EN,
 163        },
 164        {       .name   = "kpd_row1.kpd_row1",
 165                .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
 166                        OMAP_MUX_MODE1 | OMAP_INPUT_EN,
 167        },
 168        {       .name   = "kpd_row2.kpd_row2",
 169                .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
 170                        OMAP_MUX_MODE1 | OMAP_INPUT_EN,
 171        },
 172        {       .name   = "kpd_row3.kpd_row3",
 173                .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
 174                        OMAP_MUX_MODE1 | OMAP_INPUT_EN,
 175        },
 176        {       .name   = "kpd_row4.kpd_row4",
 177                .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
 178                        OMAP_MUX_MODE1 | OMAP_INPUT_EN,
 179        },
 180        {       .name   = "kpd_row5.kpd_row5",
 181                .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
 182                        OMAP_MUX_MODE1 | OMAP_INPUT_EN,
 183        },
 184        {       .name   = "gpmc_a18.kpd_row6",
 185                .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
 186                        OMAP_MUX_MODE1 | OMAP_INPUT_EN,
 187        },
 188        {       .name   = "gpmc_a19.kpd_row7",
 189                .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
 190                        OMAP_MUX_MODE1 | OMAP_INPUT_EN,
 191        },
 192};
 193
 194static struct matrix_keymap_data sdp4430_keymap_data = {
 195        .keymap                 = sdp4430_keymap,
 196        .keymap_size            = ARRAY_SIZE(sdp4430_keymap),
 197};
 198
 199static struct omap4_keypad_platform_data sdp4430_keypad_data = {
 200        .keymap_data            = &sdp4430_keymap_data,
 201        .rows                   = 8,
 202        .cols                   = 8,
 203};
 204
 205static struct omap_board_data keypad_data = {
 206        .id                     = 1,
 207        .pads                   = keypad_pads,
 208        .pads_cnt               = ARRAY_SIZE(keypad_pads),
 209};
 210
 211static struct gpio_led sdp4430_gpio_leds[] = {
 212        {
 213                .name   = "omap4:green:debug0",
 214                .gpio   = 61,
 215        },
 216        {
 217                .name   = "omap4:green:debug1",
 218                .gpio   = 30,
 219        },
 220        {
 221                .name   = "omap4:green:debug2",
 222                .gpio   = 7,
 223        },
 224        {
 225                .name   = "omap4:green:debug3",
 226                .gpio   = 8,
 227        },
 228        {
 229                .name   = "omap4:green:debug4",
 230                .gpio   = 50,
 231        },
 232        {
 233                .name   = "omap4:blue:user",
 234                .gpio   = 169,
 235        },
 236        {
 237                .name   = "omap4:red:user",
 238                .gpio   = 170,
 239        },
 240        {
 241                .name   = "omap4:green:user",
 242                .gpio   = 139,
 243        },
 244
 245};
 246
 247static struct gpio_keys_button sdp4430_gpio_keys[] = {
 248        {
 249                .desc                   = "Proximity Sensor",
 250                .type                   = EV_SW,
 251                .code                   = SW_FRONT_PROXIMITY,
 252                .gpio                   = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
 253                .active_low             = 0,
 254        }
 255};
 256
 257static struct gpio_led_platform_data sdp4430_led_data = {
 258        .leds   = sdp4430_gpio_leds,
 259        .num_leds       = ARRAY_SIZE(sdp4430_gpio_leds),
 260};
 261
 262static struct pwm_lookup sdp4430_pwm_lookup[] = {
 263        PWM_LOOKUP("twl-pwm", 0, "leds_pwm", "omap4::keypad"),
 264        PWM_LOOKUP("twl-pwm", 1, "pwm-backlight", NULL),
 265        PWM_LOOKUP("twl-pwmled", 0, "leds_pwm", "omap4:green:chrg"),
 266};
 267
 268static struct led_pwm sdp4430_pwm_leds[] = {
 269        {
 270                .name           = "omap4::keypad",
 271                .max_brightness = 127,
 272                .pwm_period_ns  = 7812500,
 273        },
 274        {
 275                .name           = "omap4:green:chrg",
 276                .max_brightness = 255,
 277                .pwm_period_ns  = 7812500,
 278        },
 279};
 280
 281static struct led_pwm_platform_data sdp4430_pwm_data = {
 282        .num_leds       = ARRAY_SIZE(sdp4430_pwm_leds),
 283        .leds           = sdp4430_pwm_leds,
 284};
 285
 286static struct platform_device sdp4430_leds_pwm = {
 287        .name   = "leds_pwm",
 288        .id     = -1,
 289        .dev    = {
 290                .platform_data = &sdp4430_pwm_data,
 291        },
 292};
 293
 294/* Dummy regulator for pwm-backlight driver */
 295static struct regulator_consumer_supply backlight_supply =
 296        REGULATOR_SUPPLY("enable", "pwm-backlight");
 297
 298static struct platform_pwm_backlight_data sdp4430_backlight_data = {
 299        .max_brightness = 127,
 300        .dft_brightness = 127,
 301        .pwm_period_ns = 7812500,
 302};
 303
 304static struct platform_device sdp4430_backlight_pwm = {
 305        .name   = "pwm-backlight",
 306        .id     = -1,
 307        .dev    = {
 308                .platform_data = &sdp4430_backlight_data,
 309        },
 310};
 311
 312static int omap_prox_activate(struct device *dev)
 313{
 314        gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
 315        return 0;
 316}
 317
 318static void omap_prox_deactivate(struct device *dev)
 319{
 320        gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
 321}
 322
 323static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
 324        .buttons        = sdp4430_gpio_keys,
 325        .nbuttons       = ARRAY_SIZE(sdp4430_gpio_keys),
 326        .enable         = omap_prox_activate,
 327        .disable        = omap_prox_deactivate,
 328};
 329
 330static struct platform_device sdp4430_gpio_keys_device = {
 331        .name   = "gpio-keys",
 332        .id     = -1,
 333        .dev    = {
 334                .platform_data  = &sdp4430_gpio_keys_data,
 335        },
 336};
 337
 338static struct platform_device sdp4430_leds_gpio = {
 339        .name   = "leds-gpio",
 340        .id     = -1,
 341        .dev    = {
 342                .platform_data = &sdp4430_led_data,
 343        },
 344};
 345static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
 346        {
 347                .modalias               = "ks8851",
 348                .bus_num                = 1,
 349                .chip_select            = 0,
 350                .max_speed_hz           = 24000000,
 351                /*
 352                 * .irq is set to gpio_to_irq(ETH_KS8851_IRQ)
 353                 * in omap_4430sdp_init
 354                 */
 355        },
 356};
 357
 358static struct gpio sdp4430_eth_gpios[] __initdata = {
 359        { ETH_KS8851_POWER_ON,  GPIOF_OUT_INIT_HIGH,    "eth_power"     },
 360        { ETH_KS8851_QUART,     GPIOF_OUT_INIT_HIGH,    "quart"         },
 361        { ETH_KS8851_IRQ,       GPIOF_IN,               "eth_irq"       },
 362};
 363
 364static int __init omap_ethernet_init(void)
 365{
 366        int status;
 367
 368        /* Request of GPIO lines */
 369        status = gpio_request_array(sdp4430_eth_gpios,
 370                                    ARRAY_SIZE(sdp4430_eth_gpios));
 371        if (status)
 372                pr_err("Cannot request ETH GPIOs\n");
 373
 374        return status;
 375}
 376
 377static struct regulator_consumer_supply sdp4430_vbat_supply[] = {
 378        REGULATOR_SUPPLY("vddvibl", "twl6040-vibra"),
 379        REGULATOR_SUPPLY("vddvibr", "twl6040-vibra"),
 380};
 381
 382static struct regulator_init_data sdp4430_vbat_data = {
 383        .constraints = {
 384                .always_on      = 1,
 385        },
 386        .num_consumer_supplies  = ARRAY_SIZE(sdp4430_vbat_supply),
 387        .consumer_supplies      = sdp4430_vbat_supply,
 388};
 389
 390static struct fixed_voltage_config sdp4430_vbat_pdata = {
 391        .supply_name    = "VBAT",
 392        .microvolts     = 3750000,
 393        .init_data      = &sdp4430_vbat_data,
 394        .gpio           = -EINVAL,
 395};
 396
 397static struct platform_device sdp4430_vbat = {
 398        .name           = "reg-fixed-voltage",
 399        .id             = -1,
 400        .dev = {
 401                .platform_data = &sdp4430_vbat_pdata,
 402        },
 403};
 404
 405static struct platform_device sdp4430_dmic_codec = {
 406        .name   = "dmic-codec",
 407        .id     = -1,
 408};
 409
 410static struct platform_device sdp4430_hdmi_audio_codec = {
 411        .name   = "hdmi-audio-codec",
 412        .id     = -1,
 413};
 414
 415static struct omap_abe_twl6040_data sdp4430_abe_audio_data = {
 416        .card_name = "SDP4430",
 417        .has_hs         = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
 418        .has_hf         = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
 419        .has_ep         = 1,
 420        .has_aux        = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
 421        .has_vibra      = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
 422
 423        .has_dmic       = 1,
 424        .has_hsmic      = 1,
 425        .has_mainmic    = 1,
 426        .has_submic     = 1,
 427        .has_afm        = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
 428
 429        .jack_detection = 1,
 430        /* MCLK input is 38.4MHz */
 431        .mclk_freq      = 38400000,
 432};
 433
 434static struct platform_device sdp4430_abe_audio = {
 435        .name           = "omap-abe-twl6040",
 436        .id             = -1,
 437        .dev = {
 438                .platform_data = &sdp4430_abe_audio_data,
 439        },
 440};
 441
 442static struct platform_device *sdp4430_devices[] __initdata = {
 443        &sdp4430_gpio_keys_device,
 444        &sdp4430_leds_gpio,
 445        &sdp4430_leds_pwm,
 446        &sdp4430_backlight_pwm,
 447        &sdp4430_vbat,
 448        &sdp4430_dmic_codec,
 449        &sdp4430_abe_audio,
 450        &sdp4430_hdmi_audio_codec,
 451};
 452
 453static struct omap_musb_board_data musb_board_data = {
 454        .interface_type         = MUSB_INTERFACE_UTMI,
 455        .mode                   = MUSB_OTG,
 456        .power                  = 100,
 457};
 458
 459static struct omap2_hsmmc_info mmc[] = {
 460        {
 461                .mmc            = 2,
 462                .caps           =  MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
 463                .gpio_cd        = -EINVAL,
 464                .gpio_wp        = -EINVAL,
 465                .nonremovable   = true,
 466                .ocr_mask       = MMC_VDD_29_30,
 467                .no_off_init    = true,
 468        },
 469        {
 470                .mmc            = 1,
 471                .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
 472                .gpio_cd        = -EINVAL,
 473                .gpio_wp        = -EINVAL,
 474        },
 475        {
 476                .mmc            = 5,
 477                .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
 478                .pm_caps        = MMC_PM_KEEP_POWER,
 479                .gpio_cd        = -EINVAL,
 480                .gpio_wp        = -EINVAL,
 481                .ocr_mask       = MMC_VDD_165_195,
 482                .nonremovable   = true,
 483        },
 484        {}      /* Terminator */
 485};
 486
 487static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
 488        REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
 489};
 490
 491static struct regulator_consumer_supply omap4_sdp4430_vmmc5_supply = {
 492        .supply = "vmmc",
 493        .dev_name = "omap_hsmmc.4",
 494};
 495
 496static struct regulator_init_data sdp4430_vmmc5 = {
 497        .constraints = {
 498                .valid_ops_mask = REGULATOR_CHANGE_STATUS,
 499        },
 500        .num_consumer_supplies = 1,
 501        .consumer_supplies = &omap4_sdp4430_vmmc5_supply,
 502};
 503
 504static struct fixed_voltage_config sdp4430_vwlan = {
 505        .supply_name            = "vwl1271",
 506        .microvolts             = 1800000, /* 1.8V */
 507        .gpio                   = GPIO_WIFI_PMENA,
 508        .startup_delay          = 70000, /* 70msec */
 509        .enable_high            = 1,
 510        .enabled_at_boot        = 0,
 511        .init_data              = &sdp4430_vmmc5,
 512};
 513
 514static struct platform_device omap_vwlan_device = {
 515        .name           = "reg-fixed-voltage",
 516        .id             = 1,
 517        .dev = {
 518                .platform_data = &sdp4430_vwlan,
 519        },
 520};
 521
 522static struct regulator_init_data sdp4430_vaux1 = {
 523        .constraints = {
 524                .min_uV                 = 1000000,
 525                .max_uV                 = 3000000,
 526                .apply_uV               = true,
 527                .valid_modes_mask       = REGULATOR_MODE_NORMAL
 528                                        | REGULATOR_MODE_STANDBY,
 529                .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
 530                                        | REGULATOR_CHANGE_MODE
 531                                        | REGULATOR_CHANGE_STATUS,
 532        },
 533        .num_consumer_supplies  = ARRAY_SIZE(sdp4430_vaux_supply),
 534        .consumer_supplies      = sdp4430_vaux_supply,
 535};
 536
 537static struct regulator_init_data sdp4430_vusim = {
 538        .constraints = {
 539                .min_uV                 = 1200000,
 540                .max_uV                 = 2900000,
 541                .apply_uV               = true,
 542                .valid_modes_mask       = REGULATOR_MODE_NORMAL
 543                                        | REGULATOR_MODE_STANDBY,
 544                .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
 545                                        | REGULATOR_CHANGE_MODE
 546                                        | REGULATOR_CHANGE_STATUS,
 547        },
 548};
 549
 550static struct twl6040_codec_data twl6040_codec = {
 551        /* single-step ramp for headset and handsfree */
 552        .hs_left_step   = 0x0f,
 553        .hs_right_step  = 0x0f,
 554        .hf_left_step   = 0x1d,
 555        .hf_right_step  = 0x1d,
 556};
 557
 558static struct twl6040_vibra_data twl6040_vibra = {
 559        .vibldrv_res = 8,
 560        .vibrdrv_res = 3,
 561        .viblmotor_res = 10,
 562        .vibrmotor_res = 10,
 563        .vddvibl_uV = 0,        /* fixed volt supply - VBAT */
 564        .vddvibr_uV = 0,        /* fixed volt supply - VBAT */
 565};
 566
 567static struct twl6040_platform_data twl6040_data = {
 568        .codec          = &twl6040_codec,
 569        .vibra          = &twl6040_vibra,
 570        .audpwron_gpio  = 127,
 571};
 572
 573static struct i2c_board_info __initdata sdp4430_i2c_1_boardinfo[] = {
 574        {
 575                I2C_BOARD_INFO("twl6040", 0x4b),
 576                .irq = 119 + OMAP44XX_IRQ_GIC_START,
 577                .platform_data = &twl6040_data,
 578        },
 579};
 580
 581static struct twl4030_platform_data sdp4430_twldata = {
 582        /* Regulators */
 583        .vusim          = &sdp4430_vusim,
 584        .vaux1          = &sdp4430_vaux1,
 585};
 586
 587static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
 588        {
 589                I2C_BOARD_INFO("tmp105", 0x48),
 590        },
 591        {
 592                I2C_BOARD_INFO("bh1780", 0x29),
 593        },
 594};
 595static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
 596        {
 597                I2C_BOARD_INFO("hmc5843", 0x1e),
 598        },
 599};
 600static int __init omap4_i2c_init(void)
 601{
 602        omap4_pmic_get_config(&sdp4430_twldata, TWL_COMMON_PDATA_USB,
 603                        TWL_COMMON_REGULATOR_VDAC |
 604                        TWL_COMMON_REGULATOR_VAUX2 |
 605                        TWL_COMMON_REGULATOR_VAUX3 |
 606                        TWL_COMMON_REGULATOR_VMMC |
 607                        TWL_COMMON_REGULATOR_VPP |
 608                        TWL_COMMON_REGULATOR_VANA |
 609                        TWL_COMMON_REGULATOR_VCXIO |
 610                        TWL_COMMON_REGULATOR_VUSB |
 611                        TWL_COMMON_REGULATOR_CLK32KG |
 612                        TWL_COMMON_REGULATOR_V1V8 |
 613                        TWL_COMMON_REGULATOR_V2V1);
 614        omap4_pmic_init("twl6030", &sdp4430_twldata, sdp4430_i2c_1_boardinfo,
 615                        ARRAY_SIZE(sdp4430_i2c_1_boardinfo));
 616        omap_register_i2c_bus(2, 400, NULL, 0);
 617        omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
 618                                ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
 619        omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
 620                                ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
 621        return 0;
 622}
 623
 624static void __init omap_sfh7741prox_init(void)
 625{
 626        int error;
 627
 628        error = gpio_request_one(OMAP4_SFH7741_ENABLE_GPIO,
 629                                 GPIOF_OUT_INIT_LOW, "sfh7741");
 630        if (error < 0)
 631                pr_err("%s:failed to request GPIO %d, error %d\n",
 632                        __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
 633}
 634
 635#ifdef CONFIG_OMAP_MUX
 636static struct omap_board_mux board_mux[] __initdata = {
 637        OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
 638        /* NIRQ2 for twl6040 */
 639        OMAP4_MUX(SYS_NIRQ2, OMAP_MUX_MODE0 |
 640                  OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE),
 641        /* GPIO_127 for twl6040 */
 642        OMAP4_MUX(HDQ_SIO, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT),
 643        /* McPDM */
 644        OMAP4_MUX(ABE_PDM_UL_DATA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
 645        OMAP4_MUX(ABE_PDM_DL_DATA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
 646        OMAP4_MUX(ABE_PDM_FRAME, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
 647        OMAP4_MUX(ABE_PDM_LB_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
 648        OMAP4_MUX(ABE_CLKS, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
 649        /* DMIC */
 650        OMAP4_MUX(ABE_DMIC_CLK1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
 651        OMAP4_MUX(ABE_DMIC_DIN1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
 652        OMAP4_MUX(ABE_DMIC_DIN2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
 653        OMAP4_MUX(ABE_DMIC_DIN3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
 654        /* McBSP1 */
 655        OMAP4_MUX(ABE_MCBSP1_CLKX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
 656        OMAP4_MUX(ABE_MCBSP1_DR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
 657        OMAP4_MUX(ABE_MCBSP1_DX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT |
 658                  OMAP_PULL_ENA),
 659        OMAP4_MUX(ABE_MCBSP1_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
 660        /* McBSP2 */
 661        OMAP4_MUX(ABE_MCBSP2_CLKX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
 662        OMAP4_MUX(ABE_MCBSP2_DR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
 663        OMAP4_MUX(ABE_MCBSP2_DX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT |
 664                  OMAP_PULL_ENA),
 665        OMAP4_MUX(ABE_MCBSP2_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
 666
 667        { .reg_offset = OMAP_MUX_TERMINATOR },
 668};
 669
 670#else
 671#define board_mux       NULL
 672 #endif
 673
 674static void __init omap4_sdp4430_wifi_mux_init(void)
 675{
 676        omap_mux_init_gpio(GPIO_WIFI_IRQ, OMAP_PIN_INPUT |
 677                                OMAP_PIN_OFF_WAKEUPENABLE);
 678        omap_mux_init_gpio(GPIO_WIFI_PMENA, OMAP_PIN_OUTPUT);
 679
 680        omap_mux_init_signal("sdmmc5_cmd.sdmmc5_cmd",
 681                                OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
 682        omap_mux_init_signal("sdmmc5_clk.sdmmc5_clk",
 683                                OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
 684        omap_mux_init_signal("sdmmc5_dat0.sdmmc5_dat0",
 685                                OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
 686        omap_mux_init_signal("sdmmc5_dat1.sdmmc5_dat1",
 687                                OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
 688        omap_mux_init_signal("sdmmc5_dat2.sdmmc5_dat2",
 689                                OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
 690        omap_mux_init_signal("sdmmc5_dat3.sdmmc5_dat3",
 691                                OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
 692
 693}
 694
 695static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
 696        .board_ref_clock = WL12XX_REFCLOCK_26,
 697        .board_tcxo_clock = WL12XX_TCXOCLOCK_26,
 698};
 699
 700static void __init omap4_sdp4430_wifi_init(void)
 701{
 702        int ret;
 703
 704        omap4_sdp4430_wifi_mux_init();
 705        omap4_sdp4430_wlan_data.irq = gpio_to_irq(GPIO_WIFI_IRQ);
 706        ret = wl12xx_set_platform_data(&omap4_sdp4430_wlan_data);
 707        if (ret)
 708                pr_err("Error setting wl12xx data: %d\n", ret);
 709        ret = platform_device_register(&omap_vwlan_device);
 710        if (ret)
 711                pr_err("Error registering wl12xx device: %d\n", ret);
 712}
 713
 714static void __init omap_4430sdp_init(void)
 715{
 716        int status;
 717        int package = OMAP_PACKAGE_CBS;
 718
 719        if (omap_rev() == OMAP4430_REV_ES1_0)
 720                package = OMAP_PACKAGE_CBL;
 721        omap4_mux_init(board_mux, NULL, package);
 722
 723        omap4_i2c_init();
 724        omap_sfh7741prox_init();
 725        regulator_register_always_on(0, "backlight-enable",
 726                                     &backlight_supply, 1, 0);
 727        platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
 728        omap_serial_init();
 729        omap_sdrc_init(NULL, NULL);
 730        omap4_sdp4430_wifi_init();
 731        omap4_twl6030_hsmmc_init(mmc);
 732
 733        usb_bind_phy("musb-hdrc.2.auto", 0, "omap-usb2.3.auto");
 734        usb_musb_init(&musb_board_data);
 735
 736        status = omap_ethernet_init();
 737        if (status) {
 738                pr_err("Ethernet initialization failed: %d\n", status);
 739        } else {
 740                sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
 741                spi_register_board_info(sdp4430_spi_board_info,
 742                                ARRAY_SIZE(sdp4430_spi_board_info));
 743        }
 744
 745        pwm_add_table(sdp4430_pwm_lookup, ARRAY_SIZE(sdp4430_pwm_lookup));
 746        status = omap4_keyboard_init(&sdp4430_keypad_data, &keypad_data);
 747        if (status)
 748                pr_err("Keypad initialization failed: %d\n", status);
 749
 750        omap_4430sdp_display_init();
 751}
 752
 753MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
 754        /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
 755        .atag_offset    = 0x100,
 756        .smp            = smp_ops(omap4_smp_ops),
 757        .reserve        = omap_reserve,
 758        .map_io         = omap4_map_io,
 759        .init_early     = omap4430_init_early,
 760        .init_irq       = gic_init_irq,
 761        .init_machine   = omap_4430sdp_init,
 762        .init_late      = omap4430_init_late,
 763        .init_time      = omap4_local_timer_init,
 764        .restart        = omap44xx_restart,
 765MACHINE_END
 766