diff options
author | Ziyann <jaraidaniel@gmail.com> | 2014-08-17 15:34:40 +0200 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-10-03 01:17:45 +0200 |
commit | 3d77a06d0eb227426f136a6ecea65c995ca9fb1d (patch) | |
tree | 9e8a64b57cf3f7d56b27c66d9d5ba6e30e9badd9 | |
parent | 2bf6b4f83867b16238c1bc4c98020c1ed5d60c9e (diff) | |
download | kernel_samsung_tuna-3d77a06d0eb227426f136a6ecea65c995ca9fb1d.zip kernel_samsung_tuna-3d77a06d0eb227426f136a6ecea65c995ca9fb1d.tar.gz kernel_samsung_tuna-3d77a06d0eb227426f136a6ecea65c995ca9fb1d.tar.bz2 |
Add boards from p-android-omap-3.0
Just to keep up with omapzoom.
21 files changed, 6229 insertions, 32 deletions
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index eac7063..cf61e6d 100755..100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig @@ -307,6 +307,70 @@ config MACH_TI8168EVM depends on SOC_OMAPTI816X default y +config MACH_OMAP_4430SDP + bool "OMAP 4430 SDP board" + default y + depends on ARCH_OMAP4 + select LEDS_OMAP4430_SDP_DISPLAY + select LEDS_OMAP4430_SDP_KEYPAD + select SENSORS_LM75 + select INPUT_BH1780 + select INPUT_BMP085 + select INPUT_HMC5843 + select INPUT_SFH7741 + select INPUT_MISC + select HWMON + select INPUT_CMA3000 + select INPUT_CMA3000_I2C + select OMAP_PACKAGE_CBL + select OMAP_PACKAGE_CBS + select REGULATOR_FIXED_VOLTAGE + select OMAP_TPS6236X + select TOUCHSCREEN_SYNTM12XX + select TWL6030_POWEROFF + select INPUT_TWL6030_PWRBUTTON + select TWL6040_VIB + select TWL6030_BCI_BATTERY + select CHARGER_BQ2415x + select TWL6030_GPADC + select OMAP_REBOOT_REASON + select OMAP_RAM_CONSOLE + select CDC_TCXO + select OMAP_RFKILL_STE_MODEM + +config MACH_OMAP_BLAZE + bool "OMAP 44xx Tablet2 Board" + default y + depends on ARCH_OMAP4 + select OMAP_PACKAGE_CBL + select OMAP_PACKAGE_CBS + select TOUCHSCREEN_QUANTUM_OBP + select TOUCHSCREEN_CYPRESS_TTSP + select LEDS_OMAP4430_SDP_DISPLAY + select LEDS_OMAP4430_SDP_KEYPAD + select INPUT_TSL2771 + select INPUT_BMP085 + select INPUT_HMC5843 + select INPUT_MPU3050 + select INPUT_BMA180 + select PANEL_TC358765 + select KEYBOARD_GPIO + select TWL6040_VIB + select OMAP_REBOOT_REASON + select OMAP_RAM_CONSOLE + select CDC_TCXO + +config MACH_OMAP4_PANDA + bool "OMAP4 Panda Board" + default y + depends on ARCH_OMAP4 + select OMAP_PACKAGE_CBL + select OMAP_PACKAGE_CBS + select REGULATOR_FIXED_VOLTAGE + select OMAP_TPS6236X + select OMAP_REBOOT_REASON + select OMAP_RAM_CONSOLE + config MACH_TUNA bool "Tuna Board" default y @@ -356,39 +420,22 @@ config OMAP_FIQ_DEBUGGER help Enables the serial FIQ debugger on OMAP" -config OMAP4_PPA_CPU1_ONLINE_BUG - bool "Enable Support for CPU1 ONLINE WA for OSWR/OFF" - depends on ARCH_OMAP4 - depends on OMAP_ALLOW_OSWR - default y - help - If an non GP OMAP4 device is used and PPA revision is < v1.7.3, - the device does not perform the memory maintenance and TLB sync - operations required before releasing CPU1 to HLOS. This results - in crash while resuming from OFF mode. - - Disable this option *ONLY IF* you meet the minimum PPA version - requirement. - - If, on the other hand, you do not understand the change, leave the - default as enabled. - config OMAP_REBOOT_REASON depends on ARCH_OMAP4 bool - + config OMAP4_DPLL_CASCADING - bool "Enable DPLL Cascading for OMAP4" - depends on ARCH_OMAP4 - depends on PM - depends on HAS_EARLYSUSPEND - default y - help - Select this option to enable DPLL Cascading during Low power mp3 - playback. It will enter DPLL cascade when : - - Head set is inserted. - - Display is Off. - - No USB. + bool "Enable DPLL Cascading for OMAP4" + depends on ARCH_OMAP4 + depends on PM + depends on HAS_EARLYSUSPEND + default y + help + Select this option to enable DPLL Cascading during Low power mp3 + playback. It will enter DPLL cascade when : + - Head set is inserted. + - Display is Off. + - No USB. config OMAP4_ONLY_OMAP4430_DPLL_CASCADING bool "Enable DPLL Cascading for OMAP4430 only" @@ -400,7 +447,6 @@ config OMAP4_ONLY_OMAP4430_DPLL_CASCADING only on OMAP4430, where it provides significant power savings. Keeps DPLL cascading disabled for other OMAPs. - config OMAP_RAM_CONSOLE bool "Enable OMAP support for Android RAM console" depends on ANDROID_RAM_CONSOLE @@ -411,8 +457,26 @@ config OMAP_RAM_CONSOLE invocation, by accessing /proc/last_kmsg NOTE: Board file needs to invoke relevant api to enable the support +config OMAP4_PPA_CPU1_ONLINE_BUG + bool "Enable Support for CPU1 ONLINE WA for OSWR/OFF" + depends on ARCH_OMAP4 + depends on OMAP_ALLOW_OSWR + default y + help + If an non GP OMAP4 device is used and PPA revision is < v1.7.3, + the device does not perform the memory maintenance and TLB sync + operations required before releasing CPU1 to HLOS. This results + in crash while resuming from OFF mode. + + Disable this option *ONLY IF* you meet the minimum PPA version + requirement. + + If, on the other hand, you do not understand the change, leave the + default as enabled. + config OMAP4_ARM_ERRATA_742230 bool "Enables the workaround for ARM errata 742230 on GP devices" + help Enables the ARM errata 742230 on OMAP443x and OMAP446x (GP) devices. This involves setting bit 4 of the CP15 diagnostic control register. diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 5e6b972..4929969 100755..100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -266,6 +266,33 @@ obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \ hsmmc.o obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \ hsmmc.o +obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o \ + board-blaze-touch.o \ + board-blaze-panel.o \ + board-blaze-keypad.o \ + board-blaze-sensors.o \ + board-blaze-modem.o \ + board-44xx-identity.o \ + board-44xx-power.o \ + board-44xx-serial.o \ + hsmmc.o \ + omap_phy_internal.o \ + omap4_apps_brd_id.o +obj-$(CONFIG_MACH_OMAP_BLAZE) += board-44xx-tablet.o \ + board-44xx-identity.o \ + board-44xx-power.o \ + board-44xx-serial.o \ + board-44xx-tablet-touch.o \ + board-44xx-tablet-sensors.o \ + board-44xx-tablet-panel.o \ + board-44xx-tablet-buttons.o \ + omap4_apps_brd_id.o +obj-$(CONFIG_TOUCHSCREEN_CYPRESS_TTSP) += board-touch-cyttsp4_core.o +obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o \ + hsmmc.o \ + board-44xx-identity.o \ + omap4_apps_brd_id.o \ + omap_phy_internal.o obj-$(CONFIG_MACH_TUNA) += board-tuna.o \ hsmmc.o \ omap_phy_internal.o @@ -321,6 +348,7 @@ obj-y += common-board-devices.o obj-$(CONFIG_OMAP_REMOTE_PROC) += remoteproc.o obj-$(CONFIG_OMAP_HSI_DEVICE) += omap_hsi.o +obj-$(CONFIG_ION_OMAP) += omap4_ion.o obj-$(CONFIG_SEC_MODEM) += board-tuna-modems.o obj-$(CONFIG_ARCH_OMAP4) += omap_dmm.o obj-$(CONFIG_OMAP_FIQ_DEBUGGER) += omap_fiq_debugger.o @@ -330,5 +358,4 @@ obj-$(CONFIG_ARCH_OMAP4) += omap4-reboot-reason.o endif obj-$(CONFIG_OMAP_RAM_CONSOLE) += omap_ram_console.o - -obj-$(CONFIG_ION_OMAP) += omap4_ion.o +obj-$(CONFIG_ARCH_OMAP4) += omap_gcxxx.o diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c new file mode 100755 index 0000000..d0ffd65 --- /dev/null +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -0,0 +1,1277 @@ +/* + * Board support file for OMAP4430 SDP. + * + * Copyright (C) 2009 Texas Instruments + * + * Author: Santosh Shilimkar <santosh.shilimkar@ti.com> + * + * Based on mach-omap2/board-3430sdp.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/gpio.h> +#include <linux/spi/spi.h> +#include <linux/i2c/twl.h> +#include <linux/i2c/bq2415x.h> +#include <linux/gpio_keys.h> +#include <linux/regulator/machine.h> +#include <linux/regulator/fixed.h> +#include <linux/regulator/tps6130x.h> +#include <linux/leds.h> +#include <linux/leds_pwm.h> +#include <linux/omapfb.h> +#include <linux/wl12xx.h> +#include <linux/memblock.h> +#include <linux/cdc_tcxo.h> +#include <linux/mfd/twl6040-codec.h> + +#include <mach/omap4-common.h> +#include <mach/emif.h> +#include <mach/lpddr2-elpida.h> +#include <mach/dmm.h> +#include <mach/omap4_ion.h> + +#include <asm/mach-types.h> +#include <asm/mach/arch.h> + +#include <plat/android-display.h> +#include <plat/common.h> +#include <plat/usb.h> +#include <plat/mmc.h> +#include <plat/omap4-keypad.h> +#include <plat/omap_apps_brd_id.h> +#include <plat/remoteproc.h> +#include <video/omapdss.h> +#include <video/omap-panel-nokia-dsi.h> +#include <plat/vram.h> +#include <plat/omap-pm.h> +#include "board-blaze.h" +#include "omap_ram_console.h" +#include "mux.h" +#include "hsmmc.h" +#include "timer-gp.h" +#include "control.h" +#include "pm.h" +/* for TI WiLink devices */ +#include <linux/skbuff.h> +#include <linux/ti_wilink_st.h> +#include <plat/omap-serial.h> +#include <linux/omap4_duty_cycle_governor.h> + +#define WILINK_UART_DEV_NAME "/dev/ttyO1" + +#define ETH_KS8851_IRQ 34 +#define ETH_KS8851_POWER_ON 48 +#define ETH_KS8851_QUART 138 +#define OMAP4_TOUCH_IRQ_1 35 +#define OMAP4_TOUCH_IRQ_2 36 +#define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */ +#define HDMI_GPIO_HPD 63 /* Hot plug pin for HDMI */ +#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ +#define LCD_BL_GPIO 27 /* LCD Backlight GPIO */ +/* PWM2 and TOGGLE3 register offsets */ +#define LED_PWM2ON 0x03 +#define LED_PWM2OFF 0x04 +#define TWL6030_TOGGLE3 0x92 + +#define TPS62361_GPIO 7 + +#define GPIO_WIFI_PMENA 54 +#define GPIO_WIFI_IRQ 53 +#define OMAP_HDMI_HPD_ADDR 0x4A100098 +#define OMAP_HDMI_PULLTYPE_MASK 0x00000010 + +#define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184 +#define OMAP4_SFH7741_ENABLE_GPIO 188 + +static const int sdp4430_keymap[] = { + KEY(0, 0, KEY_E), + KEY(0, 1, KEY_R), + KEY(0, 2, KEY_T), + KEY(0, 3, KEY_HOME), + KEY(0, 4, KEY_F5), + KEY(0, 5, KEY_UNKNOWN), + KEY(0, 6, KEY_I), + KEY(0, 7, KEY_LEFTSHIFT), + + KEY(1, 0, KEY_D), + KEY(1, 1, KEY_F), + KEY(1, 2, KEY_G), + KEY(1, 3, KEY_SEND), + KEY(1, 4, KEY_F6), + KEY(1, 5, KEY_UNKNOWN), + KEY(1, 6, KEY_K), + KEY(1, 7, KEY_ENTER), + + KEY(2, 0, KEY_X), + KEY(2, 1, KEY_C), + KEY(2, 2, KEY_V), + KEY(2, 3, KEY_END), + KEY(2, 4, KEY_F7), + KEY(2, 5, KEY_UNKNOWN), + KEY(2, 6, KEY_DOT), + KEY(2, 7, KEY_CAPSLOCK), + + KEY(3, 0, KEY_Z), + KEY(3, 1, KEY_KPPLUS), + KEY(3, 2, KEY_B), + KEY(3, 3, KEY_F1), + KEY(3, 4, KEY_F8), + KEY(3, 5, KEY_UNKNOWN), + KEY(3, 6, KEY_O), + KEY(3, 7, KEY_SPACE), + + KEY(4, 0, KEY_W), + KEY(4, 1, KEY_Y), + KEY(4, 2, KEY_U), + KEY(4, 3, KEY_F2), + KEY(4, 4, KEY_VOLUMEUP), + KEY(4, 5, KEY_UNKNOWN), + KEY(4, 6, KEY_L), + KEY(4, 7, KEY_LEFT), + + KEY(5, 0, KEY_S), + KEY(5, 1, KEY_H), + KEY(5, 2, KEY_J), + KEY(5, 3, KEY_F3), + KEY(5, 4, KEY_F9), + KEY(5, 5, KEY_VOLUMEDOWN), + KEY(5, 6, KEY_M), + KEY(5, 7, KEY_RIGHT), + + KEY(6, 0, KEY_Q), + KEY(6, 1, KEY_A), + KEY(6, 2, KEY_N), + KEY(6, 3, KEY_BACK), + KEY(6, 4, KEY_BACKSPACE), + KEY(6, 5, KEY_UNKNOWN), + KEY(6, 6, KEY_P), + KEY(6, 7, KEY_UP), + + KEY(7, 0, KEY_PROG1), + KEY(7, 1, KEY_PROG2), + KEY(7, 2, KEY_PROG3), + KEY(7, 3, KEY_PROG4), + KEY(7, 4, KEY_F4), + KEY(7, 5, KEY_UNKNOWN), + KEY(7, 6, KEY_OK), + KEY(7, 7, KEY_DOWN), +}; + +static struct matrix_keymap_data sdp4430_keymap_data = { + .keymap = sdp4430_keymap, + .keymap_size = ARRAY_SIZE(sdp4430_keymap), +}; + +void keypad_pad_wkup(int enable) +{ + int (*set_wkup_fcn)(const char *muxname); + + /* PAD wakup for keyboard is needed for off mode + * due to IO isolation. + */ + if (!off_mode_enabled) + return; + + if (enable) + set_wkup_fcn = omap_mux_enable_wkup; + else + set_wkup_fcn = omap_mux_disable_wkup; + + set_wkup_fcn("kpd_col0.kpd_col0"); + set_wkup_fcn("kpd_col1.kpd_col1"); + set_wkup_fcn("kpd_col2.kpd_col2"); + set_wkup_fcn("kpd_col0.kpd_col0"); + set_wkup_fcn("kpd_col1.kpd_col1"); + set_wkup_fcn("kpd_col2.kpd_col2"); + set_wkup_fcn("kpd_col3.kpd_col3"); + set_wkup_fcn("kpd_col4.kpd_col4"); + set_wkup_fcn("kpd_col5.kpd_col5"); + set_wkup_fcn("gpmc_a23.kpd_col7"); + set_wkup_fcn("gpmc_a22.kpd_col6"); + set_wkup_fcn("kpd_row0.kpd_row0"); + set_wkup_fcn("kpd_row1.kpd_row1"); + set_wkup_fcn("kpd_row2.kpd_row2"); + set_wkup_fcn("kpd_row3.kpd_row3"); + set_wkup_fcn("kpd_row4.kpd_row4"); + set_wkup_fcn("kpd_row5.kpd_row5"); + set_wkup_fcn("gpmc_a18.kpd_row6"); + set_wkup_fcn("gpmc_a19.kpd_row7"); + +} + +#ifdef CONFIG_OMAP4_DUTY_CYCLE_GOVERNOR + +static struct pcb_section omap4_duty_governor_pcb_sections[] = { + { + .pcb_temp_level = 65, + .max_opp = 1200000, + .duty_cycle_enabled = false, + .tduty_params = { + .nitro_rate = 0, + .cooling_rate = 0, + .nitro_interval = 0, + .nitro_percentage = 0, + }, + }, + { + .pcb_temp_level = 70, + .max_opp = 1200000, + .duty_cycle_enabled = true, + .tduty_params = { + .nitro_rate = 1200000, + .cooling_rate = 1008000, + .nitro_interval = 20000, + .nitro_percentage = 37, + }, + }, + { + .pcb_temp_level = 75, + .max_opp = 1200000, + .duty_cycle_enabled = true, + .tduty_params = { + .nitro_rate = 1200000, + .cooling_rate = 1008000, + .nitro_interval = 20000, + .nitro_percentage = 24, + }, + }, + { + .pcb_temp_level = 80, + .max_opp = 1200000, + .duty_cycle_enabled = true, + .tduty_params = { + .nitro_rate = 1200000, + .cooling_rate = 1008000, + .nitro_interval = 20000, + .nitro_percentage = 19, + }, + }, + { + .pcb_temp_level = 90, + .max_opp = 1200000, + .duty_cycle_enabled = true, + .tduty_params = { + .nitro_rate = 1200000, + .cooling_rate = 1008000, + .nitro_interval = 20000, + .nitro_percentage = 14, + }, + }, + { + .pcb_temp_level = 110, + .max_opp = 1008000, + .duty_cycle_enabled = true, + .tduty_params = { + .nitro_rate = 1008000, + .cooling_rate = 800000, + .nitro_interval = 20000, + .nitro_percentage = 1, + }, + }, +}; + +void init_duty_governor(void) +{ + omap4_duty_pcb_section_reg(omap4_duty_governor_pcb_sections, + ARRAY_SIZE(omap4_duty_governor_pcb_sections)); +} +#else +void init_duty_governor(void){} +#endif /*CONFIG_OMAP4_DUTY_CYCLE*/ + + +static struct omap4_keypad_platform_data sdp4430_keypad_data = { + .keymap_data = &sdp4430_keymap_data, + .rows = 8, + .cols = 8, + .keypad_pad_wkup = keypad_pad_wkup, +}; +static struct gpio_led sdp4430_gpio_leds[] = { + { + .name = "omap4:green:debug0", + .gpio = 61, + }, + { + .name = "omap4:green:debug1", + .gpio = 30, + }, + { + .name = "omap4:green:debug2", + .gpio = 7, + }, + { + .name = "omap4:green:debug3", + .gpio = 8, + }, + { + .name = "omap4:green:debug4", + .gpio = 50, + }, + { + .name = "omap4:blue:user", + .gpio = 169, + }, + { + .name = "omap4:red:user", + .gpio = 170, + }, + { + .name = "omap4:green:user", + .gpio = 139, + }, + +}; + +static struct gpio_led_platform_data sdp4430_led_data = { + .leds = sdp4430_gpio_leds, + .num_leds = ARRAY_SIZE(sdp4430_gpio_leds), +}; + +static struct led_pwm sdp4430_pwm_leds[] = { + { + .name = "omap4:green:chrg", + .pwm_id = 1, + .max_brightness = 255, + .pwm_period_ns = 7812500, + }, +}; + +static struct led_pwm_platform_data sdp4430_pwm_data = { + .num_leds = ARRAY_SIZE(sdp4430_pwm_leds), + .leds = sdp4430_pwm_leds, +}; + +static struct platform_device sdp4430_leds_pwm = { + .name = "leds_pwm", + .id = -1, + .dev = { + .platform_data = &sdp4430_pwm_data, + }, +}; + +static struct platform_device sdp4430_leds_gpio = { + .name = "leds-gpio", + .id = -1, + .dev = { + .platform_data = &sdp4430_led_data, + }, +}; +static struct spi_board_info sdp4430_spi_board_info[] __initdata = { + { + .modalias = "ks8851", + .bus_num = 1, + .chip_select = 0, + .max_speed_hz = 24000000, + .irq = ETH_KS8851_IRQ, + }, +}; + +static struct gpio sdp4430_eth_gpios[] __initdata = { + { ETH_KS8851_POWER_ON, GPIOF_OUT_INIT_HIGH, "eth_power" }, + { ETH_KS8851_QUART, GPIOF_OUT_INIT_HIGH, "quart" }, + { ETH_KS8851_IRQ, GPIOF_IN, "eth_irq" }, +}; + +static int __init omap_ethernet_init(void) +{ + int status; + + /* Request of GPIO lines */ + status = gpio_request_array(sdp4430_eth_gpios, + ARRAY_SIZE(sdp4430_eth_gpios)); + if (status) + pr_err("Cannot request ETH GPIOs\n"); + + return status; +} + +/* TODO: handle suspend/resume here. + * Upon every suspend, make sure the wilink chip is capable enough to wake-up the + * OMAP host. + */ +static int plat_wlink_kim_suspend(struct platform_device *pdev, pm_message_t + state) +{ + return 0; +} + +static int plat_wlink_kim_resume(struct platform_device *pdev) +{ + return 0; +} + +static bool uart_req; +static struct wake_lock st_wk_lock; +/* Call the uart disable of serial driver */ +static int plat_uart_disable(void) +{ + int port_id = 0; + int err = 0; + if (uart_req) { + sscanf(WILINK_UART_DEV_NAME, "/dev/ttyO%d", &port_id); + err = omap_serial_ext_uart_disable(port_id); + if (!err) + uart_req = false; + } + wake_unlock(&st_wk_lock); + return err; +} + +/* Call the uart enable of serial driver */ +static int plat_uart_enable(void) +{ + int port_id = 0; + int err = 0; + if (!uart_req) { + sscanf(WILINK_UART_DEV_NAME, "/dev/ttyO%d", &port_id); + err = omap_serial_ext_uart_enable(port_id); + if (!err) + uart_req = true; + } + wake_lock(&st_wk_lock); + return err; +} + +/* wl128x BT, FM, GPS connectivity chip */ +static struct ti_st_plat_data wilink_pdata = { + .nshutdown_gpio = 55, + .dev_name = WILINK_UART_DEV_NAME, + .flow_cntrl = 1, + .baud_rate = 3686400, + .suspend = plat_wlink_kim_suspend, + .resume = plat_wlink_kim_resume, + .chip_asleep = plat_uart_disable, + .chip_awake = plat_uart_enable, + .chip_enable = plat_uart_enable, + .chip_disable = plat_uart_disable, +}; + +static struct platform_device wl128x_device = { + .name = "kim", + .id = -1, + .dev.platform_data = &wilink_pdata, +}; + +static struct platform_device btwilink_device = { + .name = "btwilink", + .id = -1, +}; + +static struct platform_device *sdp4430_devices[] __initdata = { + &sdp4430_leds_gpio, + &sdp4430_leds_pwm, + &wl128x_device, + &btwilink_device, +}; + +static struct omap_board_config_kernel sdp4430_config[] __initdata = { +}; + +static void __init omap_4430sdp_init_early(void) +{ + omap2_init_common_infrastructure(); + omap2_init_common_devices(NULL, NULL); +#ifdef CONFIG_OMAP_32K_TIMER + omap2_gp_clockevent_set_gptimer(1); +#endif +} + +static struct omap_musb_board_data musb_board_data = { + .interface_type = MUSB_INTERFACE_UTMI, +#ifdef CONFIG_USB_MUSB_OTG + .mode = MUSB_OTG, +#else + .mode = MUSB_PERIPHERAL, +#endif + .power = 200, +}; + +static struct omap2_hsmmc_info mmc[] = { + { + .mmc = 2, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA | + MMC_CAP_1_8V_DDR, + .gpio_cd = -EINVAL, + .gpio_wp = -EINVAL, + .nonremovable = true, + .ocr_mask = MMC_VDD_29_30, + .no_off_init = true, + }, + { + .mmc = 1, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA | + MMC_CAP_1_8V_DDR, + .gpio_wp = -EINVAL, + }, + { + .mmc = 5, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD, + .gpio_cd = -EINVAL, + .gpio_wp = -EINVAL, + .ocr_mask = MMC_VDD_165_195, + .nonremovable = true, + }, + {} /* Terminator */ +}; + +static struct regulator_consumer_supply omap4_sdp4430_vmmc5_supply = { + .supply = "vmmc", + .dev_name = "omap_hsmmc.4", +}; +static struct regulator_init_data sdp4430_vmmc5 = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = 1, + .consumer_supplies = &omap4_sdp4430_vmmc5_supply, +}; +static struct fixed_voltage_config sdp4430_vwlan = { + .supply_name = "vwl1271", + .microvolts = 1800000, /* 1.8V */ + .gpio = GPIO_WIFI_PMENA, + .startup_delay = 70000, /* 70msec */ + .enable_high = 1, + .enabled_at_boot = 0, + .init_data = &sdp4430_vmmc5, +}; +static struct platform_device omap_vwlan_device = { + .name = "reg-fixed-voltage", + .id = 1, + .dev = { + .platform_data = &sdp4430_vwlan, + } +}; + +static int omap4_twl6030_hsmmc_late_init(struct device *dev) +{ + int ret = 0; + struct platform_device *pdev = container_of(dev, + struct platform_device, dev); + struct omap_mmc_platform_data *pdata = dev->platform_data; + + /* Setting MMC1 Card detect Irq */ + if (pdev->id == 0) { + ret = twl6030_mmc_card_detect_config(); + if (ret) + pr_err("Failed configuring MMC1 card detect\n"); + pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE + + MMCDETECT_INTR_OFFSET; + pdata->slots[0].card_detect = twl6030_mmc_card_detect; + } + /* Setting MMC5 SDIO card .built-in variable + * This is to make sure that if WiFi driver is not loaded + * at all, then the MMC/SD/SDIO driver does not keep + * turning on/off the voltage to the SDIO card + */ + if (pdev->id == 4) { + ret = 0; + pdata->slots[0].mmc_data.built_in = 1; + } + return ret; +} + +static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) +{ + struct omap_mmc_platform_data *pdata; + + /* dev can be null if CONFIG_MMC_OMAP_HS is not set */ + if (!dev) { + pr_err("Failed %s\n", __func__); + return; + } + pdata = dev->platform_data; + pdata->init = omap4_twl6030_hsmmc_late_init; +} + +static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers) +{ + struct omap2_hsmmc_info *c; + + omap2_hsmmc_init(controllers); + for (c = controllers; c->mmc; c++) + omap4_twl6030_hsmmc_set_late_init(c->dev); + + return 0; +} + +static void omap4_audio_conf(void) +{ + /* twl6040 naudint */ + omap_mux_init_signal("sys_nirq2.sys_nirq2", \ + OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE); +} + +static int tps6130x_enable(int on) +{ + u8 rev, gpo, val = 0; + int ret; + + ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &rev, + TWL6040_REG_ASICREV); + if (ret < 0) { + pr_err("%s: failed to read ASICREV %d\n", __func__, ret); + return ret; + } + + /* + * tps6130x NRESET driven by: + * - GPO2 in TWL6040 + * - GPO in TWL6041 (only one GPO supported) + */ + if (rev >= TWL6041_REV_2_0) + gpo = TWL6040_GPO1; + else + gpo = TWL6040_GPO2; + + ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, TWL6040_REG_GPOCTL); + if (ret < 0) { + pr_err("%s: failed to read GPOCTL %d\n", __func__, ret); + return ret; + } + + if (on) + val |= gpo; + else + val &= ~gpo; + + ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, TWL6040_REG_GPOCTL); + if (ret < 0) + pr_err("%s: failed to write GPOCTL %d\n", __func__, ret); + + return ret; +} + +static struct tps6130x_platform_data tps6130x_pdata = { + .chip_enable = tps6130x_enable, +}; + +static struct regulator_consumer_supply twl6040_vddhf_supply[] = { + REGULATOR_SUPPLY("vddhf", "twl6040-codec"), +}; + +static struct regulator_init_data twl6040_vddhf = { + .constraints = { + .min_uV = 4075000, + .max_uV = 4950000, + .apply_uV = true, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE + | REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = ARRAY_SIZE(twl6040_vddhf_supply), + .consumer_supplies = twl6040_vddhf_supply, + .driver_data = &tps6130x_pdata, +}; + +static struct bq2415x_platform_data sdp4430_bqdata = { + .max_charger_voltagemV = 4200, + .max_charger_currentmA = 1550, +}; + +/* + * The Clock Driver Chip (TCXO) on OMAP4 based SDP needs to + * be programmed to output CLK1 based on REQ1 from OMAP. + * By default CLK1 is driven based on an internal REQ1INT signal + * which is always set to 1. + * Doing this helps gate sysclk (from CLK1) to OMAP while OMAP + * is in sleep states. + */ +static struct cdc_tcxo_platform_data sdp4430_cdc_data = { + .buf = { + CDC_TCXO_REQ4INT | CDC_TCXO_REQ1INT | + CDC_TCXO_REQ4POL | CDC_TCXO_REQ3POL | + CDC_TCXO_REQ2POL | CDC_TCXO_REQ1POL, + CDC_TCXO_MREQ4 | CDC_TCXO_MREQ3 | + CDC_TCXO_MREQ2 | CDC_TCXO_MREQ1, + CDC_TCXO_LDOEN1, + 0, + }, +}; + +static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = { + { + I2C_BOARD_INFO("bq24156", 0x6a), + .platform_data = &sdp4430_bqdata, + }, + { + I2C_BOARD_INFO("tps6130x", 0x33), + .platform_data = &twl6040_vddhf, + }, + { + I2C_BOARD_INFO("cdc_tcxo_driver", 0x6c), + .platform_data = &sdp4430_cdc_data, + }, +}; + +static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = { + +}; + +static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = { + +}; + +static void __init blaze_pmic_mux_init(void) +{ + + omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | + OMAP_WAKEUP_EN); +} + +static void __init omap_i2c_hwspinlock_init(int bus_id, int spinlock_id, + struct omap_i2c_bus_board_data *pdata) +{ + /* spinlock_id should be -1 for a generic lock request */ + if (spinlock_id < 0) + pdata->handle = hwspin_lock_request(); + else + pdata->handle = hwspin_lock_request_specific(spinlock_id); + + if (pdata->handle != NULL) { + pdata->hwspin_lock_timeout = hwspin_lock_timeout; + pdata->hwspin_unlock = hwspin_unlock; + } else { + pr_err("I2C hwspinlock request failed for bus %d\n", \ + bus_id); + } +} + +static struct omap_i2c_bus_board_data __initdata sdp4430_i2c_1_bus_pdata; +static struct omap_i2c_bus_board_data __initdata sdp4430_i2c_2_bus_pdata; +static struct omap_i2c_bus_board_data __initdata sdp4430_i2c_3_bus_pdata; +static struct omap_i2c_bus_board_data __initdata sdp4430_i2c_4_bus_pdata; + +static int __init omap4_i2c_init(void) +{ + + omap_i2c_hwspinlock_init(1, 0, &sdp4430_i2c_1_bus_pdata); + omap_i2c_hwspinlock_init(2, 1, &sdp4430_i2c_2_bus_pdata); + omap_i2c_hwspinlock_init(3, 2, &sdp4430_i2c_3_bus_pdata); + omap_i2c_hwspinlock_init(4, 3, &sdp4430_i2c_4_bus_pdata); + + omap_register_i2c_bus_board_data(1, &sdp4430_i2c_1_bus_pdata); + omap_register_i2c_bus_board_data(2, &sdp4430_i2c_2_bus_pdata); + omap_register_i2c_bus_board_data(3, &sdp4430_i2c_3_bus_pdata); + omap_register_i2c_bus_board_data(4, &sdp4430_i2c_4_bus_pdata); + + omap4_power_init(); + i2c_register_board_info(1, sdp4430_i2c_boardinfo, + ARRAY_SIZE(sdp4430_i2c_boardinfo)); + omap_register_i2c_bus(2, 400, NULL, 0); + omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, + ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); + omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo, + ARRAY_SIZE(sdp4430_i2c_4_boardinfo)); + + /* + * This will allow unused regulator to be shutdown. This flag + * should be set in the board file. Before regulators are registered. + */ + regulator_has_full_constraints(); + + /* + * Drive MSECURE high for TWL6030/6032 write access. + */ + omap_mux_init_signal("fref_clk0_out.gpio_wk6", OMAP_PIN_OUTPUT); + gpio_request(6, "msecure"); + gpio_direction_output(6, 1); + + return 0; +} + +static bool enable_suspend_off = true; +module_param(enable_suspend_off, bool, S_IRUSR | S_IRGRP | S_IROTH); + +static int dsi1_panel_set_backlight(struct omap_dss_device *dssdev, int level) +{ + int r; + + r = twl_i2c_write_u8(TWL_MODULE_PWM, 0x7F, LED_PWM2OFF); + if (r) + return r; + + if (level > 1) { + if (level == 255) + level = 0x7F; + else + level = (~(level/2)) & 0x7F; + + r = twl_i2c_write_u8(TWL_MODULE_PWM, level, LED_PWM2ON); + if (r) + return r; + r = twl_i2c_write_u8(TWL6030_MODULE_ID1, 0x30, TWL6030_TOGGLE3); + if (r) + return r; + } else if (level <= 1) { + r = twl_i2c_write_u8(TWL6030_MODULE_ID1, 0x08, TWL6030_TOGGLE3); + if (r) + return r; + r = twl_i2c_write_u8(TWL6030_MODULE_ID1, 0x28, TWL6030_TOGGLE3); + if (r) + return r; + r = twl_i2c_write_u8(TWL6030_MODULE_ID1, 0x00, TWL6030_TOGGLE3); + if (r) + return r; + } + + return 0; +} + +static struct nokia_dsi_panel_data dsi1_panel; + +static void sdp4430_lcd_init(void) +{ + u32 reg; + int status; + + /* Enable 3 lanes in DSI1 module, disable pull down */ + reg = omap4_ctrl_pad_readl(OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_DSIPHY); + reg &= ~OMAP4_DSI1_LANEENABLE_MASK; + reg |= 0x7 << OMAP4_DSI1_LANEENABLE_SHIFT; + reg &= ~OMAP4_DSI1_PIPD_MASK; + reg |= 0x7 << OMAP4_DSI1_PIPD_SHIFT; + omap4_ctrl_pad_writel(reg, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_DSIPHY); + + /* Panel Taal reset and backlight GPIO init */ + status = gpio_request_one(dsi1_panel.reset_gpio, GPIOF_DIR_OUT, + "lcd_reset_gpio"); + if (status) + pr_err("%s: Could not get lcd_reset_gpio\n", __func__); + + if (dsi1_panel.use_ext_te) { + status = omap_mux_init_signal("gpmc_ncs4.gpio_101", + OMAP_PIN_INPUT_PULLUP); + if (status) + pr_err("%s: Could not get ext_te gpio\n", __func__); + } + + status = gpio_request_one(LCD_BL_GPIO, GPIOF_DIR_OUT, "lcd_bl_gpio"); + if (status) + pr_err("%s: Could not get lcd_bl_gpio\n", __func__); + + gpio_set_value(LCD_BL_GPIO, 0); +} + +static struct gpio sdp4430_hdmi_gpios[] = { + {HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" }, + {HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, +}; + + +static void sdp4430_hdmi_mux_init(void) +{ + u32 r; + int status; + /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */ + omap_mux_init_signal("hdmi_hpd.hdmi_hpd", + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal("gpmc_wait2.gpio_100", + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal("hdmi_cec.hdmi_cec", + OMAP_PIN_INPUT_PULLUP); + /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */ + omap_mux_init_signal("hdmi_ddc_scl.hdmi_ddc_scl", + OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("hdmi_ddc_sda.hdmi_ddc_sda", + OMAP_PIN_INPUT_PULLUP); + + /* strong pullup on DDC lines using unpublished register */ + r = ((1 << 24) | (1 << 28)) ; + omap4_ctrl_pad_writel(r, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1); + + gpio_request(HDMI_GPIO_HPD, NULL); + omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT | OMAP_PULL_ENA); + gpio_direction_input(HDMI_GPIO_HPD); + + status = gpio_request_array(sdp4430_hdmi_gpios, + ARRAY_SIZE(sdp4430_hdmi_gpios)); + if (status) + pr_err("%s:Cannot request HDMI GPIOs %x \n", __func__, status); +} + + + +static struct nokia_dsi_panel_data dsi1_panel = { + .name = "taal", + .reset_gpio = 102, + .use_ext_te = false, + .ext_te_gpio = 101, + .esd_interval = 0, + .set_backlight = dsi1_panel_set_backlight, +}; + +static struct omap_dss_device sdp4430_lcd_device = { + .name = "lcd", + .driver_name = "taal", + .type = OMAP_DISPLAY_TYPE_DSI, + .data = &dsi1_panel, + .phy.dsi = { + .clk_lane = 1, + .clk_pol = 0, + .data1_lane = 2, + .data1_pol = 0, + .data2_lane = 3, + .data2_pol = 0, + }, + + .panel = { + .timings = { + .x_res = 864, + .y_res = 480, + }, + .width_in_um = 84400, + .height_in_um = 47000, + }, + + .clocks = { + .dispc = { + .channel = { + .lck_div = 1, /* Logic Clock = 172.8 MHz */ + .pck_div = 5, /* Pixel Clock = 34.56 MHz */ + .lcd_clk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, + }, + .dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK, + }, + + .dsi = { + .regn = 16, /* Fint = 2.4 MHz */ + .regm = 180, /* DDR Clock = 216 MHz */ + .regm_dispc = 5, /* PLL1_CLK1 = 172.8 MHz */ + .regm_dsi = 5, /* PLL1_CLK2 = 172.8 MHz */ + + .lp_clk_div = 10, /* LP Clock = 8.64 MHz */ + .dsi_fclk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI, + .tlpx = 12, + .tclk = { + .zero = 57, + .prepare = 15, + .trail = 15, + }, + .ths = { + .zero = 22, + .prepare = 18, + .exit = 32, + .trail = 18, + }, + }, + }, + .channel = OMAP_DSS_CHANNEL_LCD, + .skip_init = false, +}; + +static struct omap_dss_device sdp4430_hdmi_device = { + .name = "hdmi", + .driver_name = "hdmi_panel", + .type = OMAP_DISPLAY_TYPE_HDMI, + .clocks = { + .dispc = { + .dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK, + }, + .hdmi = { + .regn = 15, + .regm2 = 1, + }, + }, + .hpd_gpio = HDMI_GPIO_HPD, + .channel = OMAP_DSS_CHANNEL_DIGIT, +}; + +static struct omap_dss_device *sdp4430_dss_devices[] = { + &sdp4430_lcd_device, + &sdp4430_hdmi_device, +}; + +static struct omap_dss_board_info sdp4430_dss_data = { + .num_devices = ARRAY_SIZE(sdp4430_dss_devices), + .devices = sdp4430_dss_devices, + .default_device = &sdp4430_lcd_device, +}; + +#define BLAZE_FB_RAM_SIZE SZ_16M /* 1920×1080*4 * 2 */ +static struct omapfb_platform_data blaze_fb_pdata = { + .mem_desc = { + .region_cnt = 1, + .region = { + [0] = { + .size = BLAZE_FB_RAM_SIZE, + }, + }, + }, +}; + +static void omap_4430sdp_display_init(void) +{ + sdp4430_lcd_init(); + sdp4430_hdmi_mux_init(); + omapfb_set_platform_data(&blaze_fb_pdata); + omap_display_init(&sdp4430_dss_data); + + omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT); + omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT); + omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN); +} + +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[] __initdata = { + OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT), + { .reg_offset = OMAP_MUX_TERMINATOR }, +}; + +#else +#define board_mux NULL +#define board_wkup_mux NULL +#endif + +/* + * LPDDR2 Configuration Data for 4430/4460 SOMs: + * The memory organization is as below : + * EMIF1 - CS0 - 2 Gb + * CS1 - 2 Gb + * EMIF2 - CS0 - 2 Gb + * CS1 - 2 Gb + * -------------------- + * TOTAL - 8 Gb + * + * Same devices installed on EMIF1 and EMIF2 + */ +static __initdata struct emif_device_details emif_devices = { + .cs0_device = &lpddr2_elpida_2G_S4_dev, + .cs1_device = &lpddr2_elpida_2G_S4_dev +}; + +/* + * LPDDR2 Configuration Data for 4470 SOMs: + * The memory organization is as below : + * EMIF1 - CS0 - 4 Gb + * EMIF2 - CS0 - 4 Gb + * -------------------- + * TOTAL - 8 Gb + * + * Same devices installed on EMIF1 and EMIF2 + */ +static __initdata struct emif_device_details emif_devices_4470 = { + .cs0_device = &lpddr2_elpida_4G_S4_dev, +}; + +static void omap4_sdp4430_wifi_mux_init(void) +{ + omap_mux_init_gpio(GPIO_WIFI_IRQ, OMAP_PIN_INPUT | + OMAP_PIN_OFF_WAKEUPENABLE); + omap_mux_init_gpio(GPIO_WIFI_PMENA, OMAP_PIN_OUTPUT); + + omap_mux_init_signal("sdmmc5_cmd.sdmmc5_cmd", + OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("sdmmc5_clk.sdmmc5_clk", + OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("sdmmc5_dat0.sdmmc5_dat0", + OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("sdmmc5_dat1.sdmmc5_dat1", + OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("sdmmc5_dat2.sdmmc5_dat2", + OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("sdmmc5_dat3.sdmmc5_dat3", + OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP); +} + +static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = { + .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ), + .board_ref_clock = WL12XX_REFCLOCK_26, + .board_tcxo_clock = WL12XX_TCXOCLOCK_26, +}; + +static void omap4_sdp4430_wifi_init(void) +{ + omap4_sdp4430_wifi_mux_init(); + if (wl12xx_set_platform_data(&omap4_sdp4430_wlan_data)) + pr_err("Error setting wl12xx data\n"); + platform_device_register(&omap_vwlan_device); +} + +#if defined(CONFIG_USB_EHCI_HCD_OMAP) || defined(CONFIG_USB_OHCI_HCD_OMAP3) +struct usbhs_omap_board_data usbhs_bdata __initdata = { + .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, + .port_mode[1] = OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0, + .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, + .phy_reset = false, + .reset_gpio_port[0] = -EINVAL, + .reset_gpio_port[1] = -EINVAL, + .reset_gpio_port[2] = -EINVAL +}; + +static void __init omap4_ehci_ohci_init(void) +{ + + omap_mux_init_signal("usbb2_ulpitll_clk.gpio_157", \ + OMAP_PIN_OUTPUT | \ + OMAP_PIN_OFF_NONE); + + /* Power on the ULPI PHY */ + if (gpio_is_valid(BLAZE_MDM_PWR_EN_GPIO)) { + gpio_request(BLAZE_MDM_PWR_EN_GPIO, "USBB1 PHY VMDM_3V3"); + gpio_direction_output(BLAZE_MDM_PWR_EN_GPIO, 1); + } + + usbhs_init(&usbhs_bdata); + + return; + +} +#else +static void __init omap4_ehci_ohci_init(void){} +#endif + +static void blaze_set_osc_timings(void) +{ + /* Device Oscilator + * tstart = 2ms + 2ms = 4ms. + * tshut = Not defined in oscillator data sheet so setting to 1us + */ + omap_pm_set_osc_lp_time(4000, 1); +} + + +/* + * As OMAP4430 mux HSI and USB signals, when HSI is used (for instance HSI + * modem is plugged) we should configure HSI pad conf and disable some USB + * configurations. + * HSI usage is declared using bootargs variable: + * board-4430sdp.modem_ipc=hsi + * Any other or missing value will not setup HSI pad conf, and port_mode[0] + * will be used by USB. + * Variable modem_ipc is used to catch bootargs parameter value. + */ +static char *modem_ipc = "n/a"; +module_param(modem_ipc, charp, 0); +MODULE_PARM_DESC(modem_ipc, "Modem IPC setting"); + +static void __init omap_4430sdp_init(void) +{ + int status; + int package = OMAP_PACKAGE_CBS; + + if (omap_rev() == OMAP4430_REV_ES1_0) + package = OMAP_PACKAGE_CBL; + omap4_mux_init(board_mux, NULL, package); + + if (cpu_is_omap447x()) + omap_emif_setup_device_details(&emif_devices_4470, + &emif_devices_4470); + else + omap_emif_setup_device_details(&emif_devices, &emif_devices); + + omap_board_config = sdp4430_config; + omap_board_config_size = ARRAY_SIZE(sdp4430_config); + + omap_init_board_version(0); + + omap4_audio_conf(); + omap4_create_board_props(); + blaze_pmic_mux_init(); + blaze_set_osc_timings(); + omap4_i2c_init(); + blaze_sensor_init(); + blaze_touch_init(); + omap4_register_ion(); + platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); + wake_lock_init(&st_wk_lock, WAKE_LOCK_SUSPEND, "st_wake_lock"); + board_serial_init(); + omap4_sdp4430_wifi_init(); + omap4_twl6030_hsmmc_init(mmc); + + /* blaze_modem_init shall be called before omap4_ehci_ohci_init */ + if (!strcmp(modem_ipc, "hsi")) + blaze_modem_init(true); + else + blaze_modem_init(false); + + omap4_ehci_ohci_init(); + + usb_musb_init(&musb_board_data); + + status = omap_ethernet_init(); + if (status) { + pr_err("Ethernet initialization failed: %d\n", status); + } else { + sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ); + spi_register_board_info(sdp4430_spi_board_info, + ARRAY_SIZE(sdp4430_spi_board_info)); + } + + status = omap4_keyboard_init(&sdp4430_keypad_data); + if (status) + pr_err("Keypad initialization failed: %d\n", status); + + omap_dmm_init(); + omap_4430sdp_display_init(); + blaze_panel_init(); + blaze_keypad_init(); + init_duty_governor(); + if (cpu_is_omap446x()) { + /* Vsel0 = gpio, vsel1 = gnd */ + status = omap_tps6236x_board_setup(true, TPS62361_GPIO, -1, + OMAP_PIN_OFF_OUTPUT_HIGH, -1); + if (status) + pr_err("TPS62361 initialization failed: %d\n", status); + } + + omap_enable_smartreflex_on_init(); + if (enable_suspend_off) + omap_pm_enable_off_mode(); + +} + +static void __init omap_4430sdp_map_io(void) +{ + omap2_set_globals_443x(); + omap44xx_map_common_io(); +} +static void __init omap_4430sdp_reserve(void) +{ + omap_init_ram_size(); + +#ifdef CONFIG_ION_OMAP + omap_android_display_setup(&sdp4430_dss_data, + NULL, + NULL, + &blaze_fb_pdata, + get_omap_ion_platform_data()); + omap_ion_init(); +#else + omap_android_display_setup(&sdp4430_dss_data, + NULL, + NULL, + &blaze_fb_pdata, + NULL); +#endif + + omap_ram_console_init(OMAP_RAM_CONSOLE_START_DEFAULT, + OMAP_RAM_CONSOLE_SIZE_DEFAULT); + + /* do the static reservations first */ + memblock_remove(PHYS_ADDR_SMC_MEM, PHYS_ADDR_SMC_SIZE); + memblock_remove(PHYS_ADDR_DUCATI_MEM, PHYS_ADDR_DUCATI_SIZE); + /* ipu needs to recognize secure input buffer area as well */ + omap_ipu_set_static_mempool(PHYS_ADDR_DUCATI_MEM, + PHYS_ADDR_DUCATI_SIZE + + OMAP4_ION_HEAP_SECURE_INPUT_SIZE + + OMAP4_ION_HEAP_SECURE_OUTPUT_WFDHDCP_SIZE); + + omap_reserve(); +} + +MACHINE_START(OMAP_4430SDP, "OMAP4 blaze board") + /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */ + .boot_params = 0x80000100, + .reserve = omap_4430sdp_reserve, + .map_io = omap_4430sdp_map_io, + .init_early = omap_4430sdp_init_early, + .init_irq = gic_init_irq, + .init_machine = omap_4430sdp_init, + .timer = &omap_timer, +MACHINE_END diff --git a/arch/arm/mach-omap2/board-44xx-identity.c b/arch/arm/mach-omap2/board-44xx-identity.c new file mode 100755 index 0000000..27c1594 --- /dev/null +++ b/arch/arm/mach-omap2/board-44xx-identity.c @@ -0,0 +1,244 @@ +/* OMAP Identity file for OMAP4 boards. + * + * Copyright (C) 2011 Google, Inc. + * Copyright (C) 2010 Texas Instruments + * + * Based on mach-omap2/board-omap4panda.c + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/io.h> +#include <linux/platform_device.h> + +#include <mach/hardware.h> +#include <mach/omap4-common.h> +#include <mach/id.h> + +#include <plat/omap_apps_brd_id.h> + +#include <asm/mach-types.h> +#include <asm/mach/arch.h> + +#include "control.h" + +static ssize_t omap4_soc_family_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "OMAP%04x\n", GET_OMAP_TYPE); +} + +static ssize_t omap4_soc_revision_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "ES%d.%d\n", (GET_OMAP_REVISION() >> 4) & 0xf, + GET_OMAP_REVISION() & 0xf); +} + +static const char *omap_types[] = { + [OMAP2_DEVICE_TYPE_TEST] = "TST", + [OMAP2_DEVICE_TYPE_EMU] = "EMU", + [OMAP2_DEVICE_TYPE_SEC] = "HS", + [OMAP2_DEVICE_TYPE_GP] = "GP", + [OMAP2_DEVICE_TYPE_BAD] = "BAD", +}; + +static ssize_t omap4_soc_type_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "%s\n", omap_types[omap_type()]); +} + +static const char *app_board_rev_types[] = { + [OMAP4_TABLET_1_0_ID] = "Tablet 1.0", + [OMAP4_TABLET_1_1_ID] = "Tablet 1.1", + [OMAP4_TABLET_1_2_ID] = "Tablet 1.2", + [OMAP4_TABLET_2_0_ID] = "Tablet 2.0", + [OMAP4_TABLET_2_1_ID] = "Tablet 2.1", + [OMAP4_TABLET_2_1_1_ID] = "Tablet 2.1.1", + [OMAP4_TABLET_2_1_2_ID] = "Tablet 2.1.2", + [OMAP4_BLAZE_ID] = "Blaze/SDP", + [OMAP4_PANDA_ID] = "Panda", + [OMAP4_MAX_ID] = "Unknown", +}; + +static ssize_t omap4_prod_id_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct omap_die_id opi; + omap_get_production_id(&opi); + return sprintf(buf, "%08X-%08X\n", opi.id_1, opi.id_0); +} + +static ssize_t omap4_die_id_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct omap_die_id opi; + omap_get_die_id(&opi); + return sprintf(buf, "%08X-%08X-%08X-%08X\n", opi.id_3, + opi.id_2, opi.id_1, opi.id_0); +} + +static ssize_t omap4_board_rev_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + int apps_brd_rev = 0; + + apps_brd_rev = omap_get_board_id(); + + if (apps_brd_rev < 0) + return -EINVAL; + + if (apps_brd_rev > OMAP4_MAX_ID) + apps_brd_rev = OMAP4_MAX_ID; + + return sprintf(buf, "%s\n", app_board_rev_types[apps_brd_rev]); +} + +static ssize_t omap4_soc_type_max_freq(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + char *max_freq = "unknown"; + + if (omap4_has_mpu_1_5ghz()) + max_freq = "1.5Ghz"; + else if (omap4_has_mpu_1_3ghz()) + max_freq = "1.3Ghz"; + else if (omap4_has_mpu_1_2ghz()) + max_freq = "1.2Ghz"; + else + max_freq = "1.0Ghz"; + + return sprintf(buf, "%s\n", max_freq); +} + +static ssize_t omap4_soc_dpll_trimmed(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + int trimmed; + char *trim_freq = "2.0GhZ"; + + trimmed = omap_readl(0x4a002268) & ((1 << 18) | (1 << 19)); + + if ((trimmed & (1 << 18)) && (trimmed & (1 << 19))) + trim_freq = "3.0GHz"; + else if (trimmed & (1 << 18)) + trim_freq = "2.4GHz"; + + pr_info("%s:DPLL is trimmed to %s\n", __func__, trim_freq); + + return sprintf(buf, "%s\n", trim_freq); +} + +static ssize_t omap4_soc_rbb_trimmed(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + int trimmed = 1; + int reg = 0; + + if (cpu_is_omap446x()) { + /* read eFuse register here */ + reg = omap_ctrl_readl(OMAP4_CTRL_MODULE_CORE_STD_FUSE_OPP_DPLL_1); + trimmed = reg & (1 << 20); + pr_info("%s:RBB is %s set\n", __func__, trimmed ? "" : "not"); + + return sprintf(buf, "%s\n", trimmed ? "true" : "false"); + } + + return sprintf(buf, "%s\n", "Not Available"); +} + +#define OMAP4_SOC_ATTR_RO(_name, _show) \ + struct kobj_attribute omap4_soc_prop_attr_##_name = \ + __ATTR(_name, S_IRUGO, _show, NULL) + +#define OMAP4_BOARD_ATTR_RO(_name, _show) \ + struct kobj_attribute omap4_board_prop_attr_##_name = \ + __ATTR(_name, S_IRUGO, _show, NULL) + +static OMAP4_SOC_ATTR_RO(family, omap4_soc_family_show); +static OMAP4_SOC_ATTR_RO(revision, omap4_soc_revision_show); +static OMAP4_SOC_ATTR_RO(type, omap4_soc_type_show); +static OMAP4_SOC_ATTR_RO(max_freq, omap4_soc_type_max_freq); +static OMAP4_SOC_ATTR_RO(dpll_trimmed, omap4_soc_dpll_trimmed); +static OMAP4_SOC_ATTR_RO(rbb_trimmed, omap4_soc_rbb_trimmed); +static OMAP4_SOC_ATTR_RO(production_id, omap4_prod_id_show); +static OMAP4_SOC_ATTR_RO(die_id, omap4_die_id_show); + +static OMAP4_BOARD_ATTR_RO(board_rev, omap4_board_rev_show); + +static struct attribute *omap4_soc_prop_attrs[] = { + &omap4_soc_prop_attr_family.attr, + &omap4_soc_prop_attr_revision.attr, + &omap4_soc_prop_attr_type.attr, + &omap4_soc_prop_attr_max_freq.attr, + &omap4_soc_prop_attr_dpll_trimmed.attr, + &omap4_soc_prop_attr_rbb_trimmed.attr, + &omap4_soc_prop_attr_production_id.attr, + &omap4_soc_prop_attr_die_id.attr, + NULL, +}; + +static struct attribute *omap4_board_prop_attrs[] = { + &omap4_board_prop_attr_board_rev.attr, + NULL, +}; + +static struct attribute_group omap4_soc_prop_attr_group = { + .attrs = omap4_soc_prop_attrs, +}; + +static struct attribute_group omap4_board_prop_attr_group = { + .attrs = omap4_board_prop_attrs, +}; + +void __init omap4_create_board_props(void) +{ + struct kobject *board_props_kobj; + struct kobject *soc_kobj = NULL; + struct kobject *board_kobj = NULL; + int ret = 0; + + board_props_kobj = kobject_create_and_add("board_properties", NULL); + if (!board_props_kobj) + goto err_board_obj; + + soc_kobj = kobject_create_and_add("soc", board_props_kobj); + if (!soc_kobj) + goto err_soc_obj; + + board_kobj = kobject_create_and_add("board", board_props_kobj); + if (!board_kobj) + goto err_app_board_obj; + + ret = sysfs_create_group(soc_kobj, &omap4_soc_prop_attr_group); + if (ret) + goto err_soc_sysfs_create; + + ret = sysfs_create_group(board_kobj, &omap4_board_prop_attr_group); + if (ret) + goto err_board_sysfs_create; + + return; + +err_board_sysfs_create: + sysfs_remove_group(soc_kobj, &omap4_soc_prop_attr_group); +err_soc_sysfs_create: + kobject_put(board_kobj); +err_app_board_obj: + kobject_put(soc_kobj); +err_soc_obj: + kobject_put(board_props_kobj); +err_board_obj: + if (!board_props_kobj || !soc_kobj || ret) + pr_err("failed to create board_properties\n"); +} diff --git a/arch/arm/mach-omap2/board-44xx-power.c b/arch/arm/mach-omap2/board-44xx-power.c new file mode 100755 index 0000000..ea17689 --- /dev/null +++ b/arch/arm/mach-omap2/board-44xx-power.c @@ -0,0 +1,557 @@ +/* OMAP Identity file for OMAP4 boards. + * + * Copyright (C) 2012 Texas Instruments + * + * Based on + * mach-omap2/board-44xx-tablet.c + * mach-omap2/board-4430sdp.c + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <linux/regulator/machine.h> +#include <linux/regulator/fixed.h> +#include <linux/regulator/tps6130x.h> +#include "mux.h" +#include <linux/i2c/twl.h> +#include <plat/common.h> +#include <plat/usb.h> +#include <plat/omap-serial.h> +#include <linux/mfd/twl6040-codec.h> +#include "common-board-devices.h" +#include <linux/power/ti-fg.h> + +/* EDV Configuration */ +static struct edv_config edv_cfg = { + .averaging = true, + .seq_edv = 5, + .filter_light = 155, + .filter_heavy = 199, + .overload_current = 1000, + .edv = { + {3150, 0}, + {3450, 4}, + {3600, 10}, + }, +}; + +/* OCV Configuration */ +static struct ocv_config ocv_cfg = { + .voltage_diff = 75, + .current_diff = 30, + + .sleep_enter_current = 60, + .sleep_enter_samples = 3, + + .sleep_exit_current = 100, + .sleep_exit_samples = 3, + + .long_sleep_current = 500, + .ocv_period = 300, + .relax_period = 600, + + .flat_zone_low = 35, + .flat_zone_high = 65, + + .max_ocv_discharge = 1300, + + .table = { + 3300, 3603, 3650, 3662, 3700, + 3723, 3734, 3746, 3756, 3769, + 3786, 3807, 3850, 3884, 3916, + 3949, 3990, 4033, 4077, 4129, + 4193 + }, +}; + +/* General Battery Cell Configuration */ +static struct cell_config cell_cfg = { + .cc_voltage = 4175, + .cc_current = 250, + .cc_capacity = 15, + .seq_cc = 5, + + .cc_polarity = true, + .cc_out = true, + .ocv_below_edv1 = false, + + .design_capacity = 4000, + .design_qmax = 4100, + .r_sense = 10, + + .qmax_adjust = 1, + .fcc_adjust = 2, + + .max_overcharge = 100, + .electronics_load = 200, /* *10 uAh */ + + .max_increment = 150, + .max_decrement = 150, + .low_temp = 119, + .deep_dsg_voltage = 30, + .max_dsg_estimate = 300, + .light_load = 100, + .near_full = 500, + .cycle_threshold = 3500, + .recharge = 300, + + .mode_switch_capacity = 5, + + .call_period = 2, + + .ocv = &ocv_cfg, + .edv = &edv_cfg, +}; + +static struct regulator_consumer_supply vmmc_supply[] = { + REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), +}; + +/* VMMC1 for MMC1 card */ +static struct regulator_init_data vmmc = { + .constraints = { + .min_uV = 1200000, + .max_uV = 3000000, + .apply_uV = true, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE + | REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = true, + } + }, + .num_consumer_supplies = 1, + .consumer_supplies = vmmc_supply, +}; + +static struct regulator_init_data vpp = { + .constraints = { + .min_uV = 1800000, + .max_uV = 2500000, + .apply_uV = true, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE + | REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = true, + }, + .initial_state = PM_SUSPEND_MEM, + }, +}; + +static struct regulator_init_data vusim = { + .constraints = { + .min_uV = 1200000, + .max_uV = 2900000, + .apply_uV = true, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE + | REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = true, + }, + .initial_state = PM_SUSPEND_MEM, + }, +}; + +static struct regulator_init_data vana = { + .constraints = { + .min_uV = 2100000, + .max_uV = 2100000, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + .always_on = true, + .state_mem = { + .disabled = true, + }, + .initial_state = PM_SUSPEND_MEM, + }, +}; + +static struct regulator_consumer_supply vcxio_supply[] = { + REGULATOR_SUPPLY("vdds_dsi", "omapdss_dss"), + REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"), +}; + +static struct regulator_init_data vcxio = { + .constraints = { + .min_uV = 1800000, + .max_uV = 1800000, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + .always_on = true, + .state_mem = { + .disabled = true, + }, + .initial_state = PM_SUSPEND_MEM, + }, + .num_consumer_supplies = ARRAY_SIZE(vcxio_supply), + .consumer_supplies = vcxio_supply, +}; + +static struct regulator_consumer_supply vdac_supply[] = { + { + .supply = "hdmi_vref", + }, +}; + +static struct regulator_init_data vdac = { + .constraints = { + .min_uV = 1800000, + .max_uV = 1800000, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + .always_on = true, + .state_mem = { + .disabled = true, + }, + .initial_state = PM_SUSPEND_MEM, + }, + .num_consumer_supplies = ARRAY_SIZE(vdac_supply), + .consumer_supplies = vdac_supply, +}; + +static struct regulator_consumer_supply vusb_supply[] = { + REGULATOR_SUPPLY("vusb", "twl6030_usb"), +}; + +static struct regulator_init_data vusb = { + .constraints = { + .min_uV = 3300000, + .max_uV = 3300000, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = true, + }, + .initial_state = PM_SUSPEND_MEM, + }, + .num_consumer_supplies = ARRAY_SIZE(vusb_supply), + .consumer_supplies = vusb_supply, +}; + +static struct regulator_consumer_supply vaux_supply[] = { + REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"), +}; + +static struct regulator_init_data vaux1 = { + .constraints = { + .min_uV = 1000000, + .max_uV = 3000000, + .apply_uV = true, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE + | REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = true, + }, + }, + .num_consumer_supplies = 1, + .consumer_supplies = vaux_supply, +}; + +static struct regulator_consumer_supply vaux2_supply[] = { + REGULATOR_SUPPLY("av-switch", "soc-audio"), +}; + +static struct regulator_init_data vaux2 = { + .constraints = { + .min_uV = 1200000, + .max_uV = 2800000, + .apply_uV = true, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE + | REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = true, + } + }, + .num_consumer_supplies = 1, + .consumer_supplies = vaux2_supply, +}; + +static struct regulator_consumer_supply cam2_supply[] = { + { + .supply = "cam2pwr", + }, +}; + +static struct regulator_init_data vaux3 = { + .constraints = { + .min_uV = 1000000, + .max_uV = 3000000, + .apply_uV = true, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE + | REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = true, + }, + .initial_state = PM_SUSPEND_MEM, + }, + .num_consumer_supplies = 1, + .consumer_supplies = cam2_supply, +}; + +static struct regulator_init_data clk32kg = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .always_on = true, + }, +}; + +static struct regulator_init_data clk32kaudio = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .always_on = true, + }, +}; + +static struct regulator_init_data v2v1 = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .always_on = true, + .state_mem = { + .disabled = true, + }, + .initial_state = PM_SUSPEND_MEM, + }, +}; + +static struct regulator_init_data sysen = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .always_on = true, + .state_mem = { + .disabled = true, + }, + .initial_state = PM_SUSPEND_MEM, + }, +}; + +static struct regulator_init_data regen1 = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .always_on = true, + .state_mem = { + .disabled = true, + }, + .initial_state = PM_SUSPEND_MEM, + }, +}; + +static struct regulator_init_data vcore1 = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .always_on = true, + .state_mem = { + .disabled = true, + }, + .initial_state = PM_SUSPEND_MEM, + }, +}; + +static struct regulator_init_data vcore2 = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .always_on = true, + .state_mem = { + .disabled = true, + }, + .initial_state = PM_SUSPEND_MEM, + }, +}; + +static struct regulator_init_data vcore3 = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = true, + }, + .initial_state = PM_SUSPEND_MEM, + }, +}; + +static struct regulator_init_data vmem = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = true, + }, + .initial_state = PM_SUSPEND_MEM, + }, +}; + +static int batt_table[] = { + /* adc code for temperature in degree C */ + 929, 925, /* -2 ,-1 */ + 920, 917, 912, 908, 904, 899, 895, 890, 885, 880, /* 00 - 09 */ + 875, 869, 864, 858, 853, 847, 841, 835, 829, 823, /* 10 - 19 */ + 816, 810, 804, 797, 790, 783, 776, 769, 762, 755, /* 20 - 29 */ + 748, 740, 732, 725, 718, 710, 703, 695, 687, 679, /* 30 - 39 */ + 671, 663, 655, 647, 639, 631, 623, 615, 607, 599, /* 40 - 49 */ + 591, 583, 575, 567, 559, 551, 543, 535, 527, 519, /* 50 - 59 */ + 511, 504, 496 /* 60 - 62 */ +}; + +static struct twl4030_bci_platform_data bci_data = { + .monitoring_interval = 10, + .max_charger_currentmA = 1500, + .max_charger_voltagemV = 4560, + .max_bat_voltagemV = 4200, + .low_bat_voltagemV = 3300, + .battery_tmp_tbl = batt_table, + .tblsize = ARRAY_SIZE(batt_table), + .cell_cfg = &cell_cfg, +}; + +static struct twl4030_usb_data omap4_usbphy_data = { + .phy_init = omap4430_phy_init, + .phy_exit = omap4430_phy_exit, + .phy_power = omap4430_phy_power, + .phy_suspend = omap4430_phy_suspend, +}; + +static struct twl4030_codec_audio_data twl6040_audio = { + /* single-step ramp for headset and handsfree */ + .hs_left_step = 0x0f, + .hs_right_step = 0x0f, + .hf_left_step = 0x1d, + .hf_right_step = 0x1d, + .vddhf_uV = 4075000, +}; + +static struct twl4030_codec_vibra_data twl6040_vibra = { + .max_timeout = 15000, + .initial_vibrate = 0, + .voltage_raise_speed = 0x26, +}; + +static int twl6040_init(void) +{ + u8 rev = 0; + int ret; + + ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, + &rev, TWL6040_REG_ASICREV); + if (ret) + return ret; + + /* + * ERRATA: Reset value of PDM_UL buffer logic is 1 (VDDVIO) + * when AUDPWRON = 0, which causes current drain on this pin's + * pull-down on OMAP side. The workaround consists of disabling + * pull-down resistor of ABE_PDM_UL_DATA pin + * Impacted revisions: ES1.1, ES1.2 (both share same ASICREV value), + * ES1.3, ES2.0 and ES2.2 + */ + if ((rev == TWL6040_REV_1_1) || + (rev == TWL6040_REV_1_3) || + (rev == TWL6041_REV_2_0) || + (rev == TWL6041_REV_2_2)) { + omap_mux_init_signal("abe_pdm_ul_data.abe_pdm_ul_data", + OMAP_PIN_INPUT); + } + + return 0; +} + +static struct twl4030_codec_data twl6040_codec = { + .audio = &twl6040_audio, + .vibra = &twl6040_vibra, + .audpwron_gpio = 127, + .naudint_irq = OMAP44XX_IRQ_SYS_2N, + .irq_base = TWL6040_CODEC_IRQ_BASE, + .init = twl6040_init, +}; + +static struct twl4030_madc_platform_data twl6030_gpadc = { + .irq_line = -1, +}; + +static struct twl4030_platform_data twldata = { + .irq_base = TWL6030_IRQ_BASE, + .irq_end = TWL6030_IRQ_END, + + /* TWL6030 regulators at OMAP443X/4460 based SOMs */ + .vmmc = &vmmc, + .vpp = &vpp, + .vusim = &vusim, + .vana = &vana, + .vcxio = &vcxio, + .vdac = &vdac, + .vusb = &vusb, + .vaux1 = &vaux1, + .vaux2 = &vaux2, + .vaux3 = &vaux3, + + /* TWL6032 regulators at OMAP447X based SOMs */ + .ldo1 = &vpp, + .ldo2 = &vaux1, + .ldo3 = &vaux3, + .ldo4 = &vaux2, + .ldo5 = &vmmc, + .ldo6 = &vcxio, + .ldo7 = &vusim, + .ldoln = &vdac, + .ldousb = &vusb, + + /* TWL6030/6032 common resources */ + .clk32kg = &clk32kg, + .clk32kaudio = &clk32kaudio, + + /* SMPS */ + .vdd1 = &vcore1, + .vdd2 = &vcore2, + .v2v1 = &v2v1, + + /* children */ + .bci = &bci_data, + .usb = &omap4_usbphy_data, + .codec = &twl6040_codec, + .madc = &twl6030_gpadc, + + /* External control pins */ + .sysen = &sysen, + .regen1 = ®en1, +}; + +void __init omap4_power_init(void) +{ + /* + * VCORE3 & VMEM are not used in 4460. By register it to regulator + * framework will ensures that resources are disabled. + */ + if (cpu_is_omap446x()) { + twldata.vdd3 = &vcore3; + twldata.vmem = &vmem; + } + + omap4_pmic_init("twl6030", &twldata); +} diff --git a/arch/arm/mach-omap2/board-44xx-serial.c b/arch/arm/mach-omap2/board-44xx-serial.c new file mode 100755 index 0000000..230feb8 --- /dev/null +++ b/arch/arm/mach-omap2/board-44xx-serial.c @@ -0,0 +1,139 @@ +/* OMAP Identity file for OMAP4 boards. + * + * Copyright (C) 2012 Texas Instruments + * + * Based on + * mach-omap2/board-44xx-tablet.c + * mach-omap2/board-4430sdp.c + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <plat/omap-serial.h> +#include "mux.h" + +static struct omap_device_pad tablet_uart1_pads[] __initdata = { + { + .name = "uart1_cts.uart1_cts", + .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, + }, + { + .name = "uart1_rts.uart1_rts", + .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, + }, + { + .name = "uart1_tx.uart1_tx", + .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, + }, + { + .name = "uart1_rx.uart1_rx", + .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, + .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, + .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, + }, +}; + +static struct omap_device_pad tablet_uart2_pads[] __initdata = { + { + .name = "uart2_cts.uart2_cts", + .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, + .flags = OMAP_DEVICE_PAD_REMUX, + .idle = OMAP_WAKEUP_EN | OMAP_PIN_OFF_INPUT_PULLUP | + OMAP_MUX_MODE0, + }, + { + .name = "uart2_rts.uart2_rts", + .flags = OMAP_DEVICE_PAD_REMUX, + .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, + .idle = OMAP_PIN_OFF_INPUT_PULLUP | OMAP_MUX_MODE7, + }, + { + .name = "uart2_tx.uart2_tx", + .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, + }, + { + .name = "uart2_rx.uart2_rx", + .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, + }, +}; + +static struct omap_device_pad tablet_uart3_pads[] __initdata = { + { + .name = "uart3_cts_rctx.uart3_cts_rctx", + .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, + }, + { + .name = "uart3_rts_sd.uart3_rts_sd", + .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, + }, + { + .name = "uart3_tx_irtx.uart3_tx_irtx", + .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, + }, + { + .name = "uart3_rx_irrx.uart3_rx_irrx", + .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, + .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, + .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, + }, +}; + +static struct omap_device_pad tablet_uart4_pads[] __initdata = { + { + .name = "uart4_tx.uart4_tx", + .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, + }, + { + .name = "uart4_rx.uart4_rx", + .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, + .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, + .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, + }, +}; + +static struct omap_uart_port_info tablet_uart_info_uncon __initdata = { + .use_dma = 0, + .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT, + .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE, + .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE, + .auto_sus_timeout = DEFAULT_AUTOSUSPEND_DELAY, + .wer = 0, +}; + +static struct omap_uart_port_info tablet_uart_info __initdata = { + .use_dma = 0, + .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT, + .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE, + .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE, + .auto_sus_timeout = DEFAULT_AUTOSUSPEND_DELAY, + .wer = (OMAP_UART_WER_TX | OMAP_UART_WER_RX | OMAP_UART_WER_CTS), +}; + +static struct omap_uart_port_info tablet_wilink_uart_info __initdata = { + .use_dma = 0, + .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT, + .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE, + .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE, + .auto_sus_timeout = DEFAULT_AUTOSUSPEND_DELAY, + .wer = (OMAP_UART_WER_TX | OMAP_UART_WER_RX | OMAP_UART_WER_CTS), + .rts_mux_driver_control = 1, +}; + +void __init board_serial_init(void) +{ + omap_serial_init_port_pads(0, tablet_uart1_pads, + ARRAY_SIZE(tablet_uart1_pads), &tablet_uart_info_uncon); + omap_serial_init_port_pads(1, tablet_uart2_pads, + ARRAY_SIZE(tablet_uart2_pads), &tablet_wilink_uart_info); + omap_serial_init_port_pads(2, tablet_uart3_pads, + ARRAY_SIZE(tablet_uart3_pads), &tablet_uart_info); + omap_serial_init_port_pads(3, tablet_uart4_pads, + ARRAY_SIZE(tablet_uart4_pads), &tablet_uart_info_uncon); +} + diff --git a/arch/arm/mach-omap2/board-44xx-tablet-buttons.c b/arch/arm/mach-omap2/board-44xx-tablet-buttons.c new file mode 100755 index 0000000..5fbbc6b --- /dev/null +++ b/arch/arm/mach-omap2/board-44xx-tablet-buttons.c @@ -0,0 +1,157 @@ +/* + * Button and Button LED support OMAP44xx tablet. + * + * Copyright (C) 2011 Texas Instruments + * + * Author: Dan Murphy <dmurphy@ti.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/gpio_keys.h> +#include <linux/input.h> +#include <linux/leds.h> +#include <linux/leds_pwm.h> + +#include <plat/omap_apps_brd_id.h> + +#include "mux.h" +#include "board-44xx-tablet.h" + +#define TABLET2_GREEN_LED_GPIO 174 +#define TABLET2_GREEN_DBG2_LED_GPIO 173 + +static struct gpio_led tablet_gpio_leds[] = { + { + .name = "omap4:green:debug2", + .gpio = 7, + }, + { + .name = "omap4:green:debug4", + .gpio = 50, + }, + { + .name = "blue", + .default_trigger = "timer", + .gpio = 169, + }, + { + .name = "red", + .default_trigger = "timer", + .gpio = 170, + }, + { + .name = "green", + .default_trigger = "timer", + .gpio = 139, + }, + +}; + +static struct gpio_led_platform_data tablet_led_data = { + .leds = tablet_gpio_leds, + .num_leds = ARRAY_SIZE(tablet_gpio_leds), +}; + +static struct led_pwm tablet_pwm_leds[] = { + { + .name = "omap4:green:chrg", + .pwm_id = 1, + .max_brightness = 255, + .pwm_period_ns = 7812500, + }, +}; + +static struct led_pwm_platform_data tablet_pwm_data = { + .num_leds = ARRAY_SIZE(tablet_pwm_leds), + .leds = tablet_pwm_leds, +}; + +static struct platform_device tablet_leds_pwm = { + .name = "leds_pwm", + .id = -1, + .dev = { + .platform_data = &tablet_pwm_data, + }, +}; + +static struct platform_device tablet_leds_gpio = { + .name = "leds-gpio", + .id = -1, + .dev = { + .platform_data = &tablet_led_data, + }, +}; + +/* GPIO_KEY for Tablet */ +static struct gpio_keys_button tablet_gpio_keys_buttons[] = { + [0] = { + .code = KEY_VOLUMEUP, + .gpio = 43, + .desc = "SW1", + .active_low = 1, + }, + [1] = { + .code = KEY_HOME, + .gpio = 46, + .desc = "SW2", + .active_low = 1, + .wakeup = 1, + }, + [2] = { + .code = KEY_VOLUMEDOWN, + .gpio = 47, + .desc = "SW3", + .active_low = 1, + }, + }; + +static struct gpio_keys_platform_data tablet_gpio_keys = { + .buttons = tablet_gpio_keys_buttons, + .nbuttons = ARRAY_SIZE(tablet_gpio_keys_buttons), + .rep = 0, +}; + +static struct platform_device tablet_gpio_keys_device = { + .name = "gpio-keys", + .id = -1, + .dev = { + .platform_data = &tablet_gpio_keys, + }, +}; + +static struct platform_device *tablet_devices[] __initdata = { + &tablet_leds_gpio, + &tablet_leds_pwm, + &tablet_gpio_keys_device, +}; + +int __init tablet_button_init(void) +{ + if (omap_is_board_version(OMAP4_TABLET_2_0) || + omap_is_board_version(OMAP4_TABLET_2_1) || + omap_is_board_version(OMAP4_TABLET_2_1_1) || + omap_is_board_version(OMAP4_TABLET_2_1_2)) { + + omap_mux_init_gpio(TABLET2_GREEN_DBG2_LED_GPIO, + OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT); + omap_mux_init_gpio(TABLET2_GREEN_LED_GPIO, + OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT); + tablet_gpio_leds[0].gpio = TABLET2_GREEN_DBG2_LED_GPIO; + tablet_gpio_leds[4].gpio = TABLET2_GREEN_LED_GPIO; + } + + if (omap_board_uses_hsic()) { + tablet_gpio_leds[2].gpio = 104; + tablet_gpio_leds[3].gpio = 36; + } + + platform_add_devices(tablet_devices, ARRAY_SIZE(tablet_devices)); + return 0; + +} diff --git a/arch/arm/mach-omap2/board-44xx-tablet-panel.c b/arch/arm/mach-omap2/board-44xx-tablet-panel.c new file mode 100755 index 0000000..f1cdc62 --- /dev/null +++ b/arch/arm/mach-omap2/board-44xx-tablet-panel.c @@ -0,0 +1,788 @@ +/* + * arch/arm/mach-omap2/board-44xx-tablet-panel.c + * + * Copyright (C) 2011 Texas Instruments + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <linux/delay.h> +#include <linux/kernel.h> +#include <linux/gpio.h> +#include <linux/i2c.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/leds-omap4430sdp-display.h> +#include <linux/platform_device.h> +#include <linux/omapfb.h> +#include <video/omapdss.h> +#include <video/omap-panel-tc358765.h> + +#include <linux/i2c/twl.h> + +#include <plat/android-display.h> +#include <plat/vram.h> +#include <plat/omap_apps_brd_id.h> + +#include "board-44xx-tablet.h" +#include "control.h" +#include "mux.h" + +#define DP_4430_GPIO_59 59 +#define DSI2_GPIO_59 59 + +#define HDMI_GPIO_CT_CP_HPD 60 +#define HDMI_GPIO_HPD 63 /* Hot plug pin for HDMI */ + +#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ +#define LCD_BL_GPIO 59 /*27*/ /* LCD Backlight GPIO */ +/* PWM2 and TOGGLE3 register offsets */ +#define LED_PWM2ON 0x03 +#define LED_PWM2OFF 0x04 +#define TWL6030_TOGGLE3 0x92 + +#define OMAP_HDMI_HPD_ADDR 0x4A100098 +#define OMAP_HDMI_PULLTYPE_MASK 0x00000010 + +static enum omap_44xx_tablet_panel_type { + LCD_DEFAULT, + TC35876x_SHARP_LQ101K1LYxx_WXGA,/* TC35876x + Sharp LCD */ + TC35876x_SAMSUNG_HYDIS_WUXGA, /* TC35876x + Samsung or HYDIS */ + LD089WU1_LG_WUXGA, +} tablet_panel_type = LCD_DEFAULT; + +struct omap_tablet_panel_data { + struct omap_dss_board_info *board_info; + struct dsscomp_platform_data *dsscomp_data; + struct sgx_omaplfb_platform_data *omaplfb_data; +}; + +static void omap4_tablet_init_display_led(void) +{ + twl_i2c_write_u8(TWL_MODULE_PWM, 0xFF, LED_PWM2ON); + twl_i2c_write_u8(TWL_MODULE_PWM, 0x7F, LED_PWM2OFF); + twl_i2c_write_u8(TWL6030_MODULE_ID1, 0x30, TWL6030_TOGGLE3); +} + +static void omap4_tablet_set_primary_brightness(u8 brightness) +{ + if (brightness > 1) { + if (brightness == 255) + brightness = 0x7f; + else + brightness = (~(brightness/2)) & 0x7f; + + twl_i2c_write_u8(TWL6030_MODULE_ID1, 0x30, TWL6030_TOGGLE3); + twl_i2c_write_u8(TWL_MODULE_PWM, brightness, LED_PWM2ON); + } else if (brightness <= 1) { + twl_i2c_write_u8(TWL6030_MODULE_ID1, 0x08, TWL6030_TOGGLE3); + twl_i2c_write_u8(TWL6030_MODULE_ID1, 0x38, TWL6030_TOGGLE3); + } +} + +static struct omap4430_sdp_disp_led_platform_data sdp4430_disp_led_data = { + .flags = LEDS_CTRL_AS_ONE_DISPLAY, + .display_led_init = omap4_tablet_init_display_led, + .primary_display_set = omap4_tablet_set_primary_brightness, + .secondary_display_set = NULL, +}; + +static struct platform_device omap4_tablet_disp_led = { + .name = "display_led", + .id = -1, + .dev = { + .platform_data = &sdp4430_disp_led_data, + }, +}; + +static struct gpio tablet_hdmi_gpios[] = { + {HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" }, + {HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, +}; + +static void tablet_hdmi_mux_init(void) +{ + u32 r; + int status; + /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */ + omap_mux_init_signal("hdmi_hpd.hdmi_hpd", + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal("gpmc_wait2.gpio_100", + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal("hdmi_cec.hdmi_cec", + OMAP_PIN_INPUT_PULLUP); + /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */ + omap_mux_init_signal("hdmi_ddc_scl.hdmi_ddc_scl", + OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("hdmi_ddc_sda.hdmi_ddc_sda", + OMAP_PIN_INPUT_PULLUP); + + /* strong pullup on DDC lines using unpublished register */ + r = ((1 << 24) | (1 << 28)) ; + omap4_ctrl_pad_writel(r, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1); + + gpio_request(HDMI_GPIO_HPD, NULL); + omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT | OMAP_PULL_ENA); + gpio_direction_input(HDMI_GPIO_HPD); + + status = gpio_request_array(tablet_hdmi_gpios, + ARRAY_SIZE(tablet_hdmi_gpios)); + if (status) + pr_err("%s: Cannot request HDMI GPIOs %x\n", __func__, status); +} + +static struct tc358765_board_data dsi_data_tc35876x_sharp_lq101k1lyxx = { + .lp_time = 0x4, + .clrsipo = 0x3, + .lv_is = 0x1, + .lv_nd = 0x6, + .vtgen = 0x0, + .vsdelay = 0xf02, + .pclkdiv = 0x0, + .pclksel = 0x0, + .lvdlink = 0x0, + .msf = 0x0, + .evtmode = 0x1, +}; + +static struct tc358765_board_data dsi_data_tc35876x_samhyd_wuxga = { + .lp_time = 0x7, + .clrsipo = 0x7, + .lv_is = 0x2, + .lv_nd = 0x6, + .vtgen = 0x0, + .vsdelay = 0x0, + .pclkdiv = 0x1, + .pclksel = 0x0, + .lvdlink = 0x1, + .msf = 0x1, + .evtmode = 0x1, +}; + +static struct omap_dsi_timings dsi_timings_tc35876x_samhyd_wuxga = { + .hbp = 0, + .hfp = 24, + .hsa = 0, + .vbp = 9, + .vfp = 10, + .vsa = 1, + .vact = 1200, + .tl = 1107, + .hsa_hs_int = 0, + .hfp_hs_int = 0, + .hbp_hs_int = 0, + .hsa_lp_int = 130, + .hfp_lp_int = 223, + .hbp_lp_int = 59, + .bl_lp_int = 0, + .bl_hs_int = 1038, + .exit_lat = 20, + .enter_lat = 23, +}; + +static struct omap_video_timings dispc_timings_tc35876x_samhyd_wuxga = { + .x_res = 1920, + .y_res = 1200, + .hfp = 4, + .hsw = 5, + .hbp = 39, + .vfp = 9, + .vsw = 1, + .vbp = 10, +}; + +static struct omap_dsi_timings dsi_timings_ld089wu1_lg_wuxga = { + .hbp = 10, + .hfp = 35, + .hsa = 0, + .vbp = 9, + .vfp = 10, + .vsa = 1, + .vact = 1200, + .tl = 1488, + .hsa_hs_int = 0, + .hfp_hs_int = 0, + .hbp_hs_int = 0, + .hsa_lp_int = 0, + .hfp_lp_int = 0, + .hbp_lp_int = 0, + .bl_lp_int = 12, + .bl_hs_int = 1402, + .exit_lat = 25, + .enter_lat = 29, +}; + +static struct omap_dsi_timings dsi_timings_tc35876x = { + .hbp = 3, + .hfp = 4, + .hsa = 0, + .vbp = 4, + .vfp = 6, + .vsa = 2, + .vact = 800, + .tl = 970, + .hsa_hs_int = 72, + .hfp_hs_int = 114, + .hbp_hs_int = 150, + .hsa_lp_int = 130, + .hfp_lp_int = 223, + .hbp_lp_int = 59, + .bl_lp_int = 0x31d1, + .bl_hs_int = 0x7a67, + .exit_lat = 15, + .enter_lat = 18, +}; + +static struct omap_video_timings dispc_timings_ld089wu1_lg_wuxga = { + .x_res = 1920, + .y_res = 1200, + .hfp = 8, + .hsw = 5, + .hbp = 51, + .vfp = 9, + .vsw = 2, + .vbp = 9, +}; + +static struct omap_video_timings dispc_timings_tc35876x = { + .x_res = 1280, + .y_res = 800, + .hfp = 243, + .hsw = 9, + .hbp = 20, + .vfp = 6, + .vsw = 2, + .vbp = 4, + +}; + +static struct omap_dss_device lcd_tc35876x_sharp_lq101k1lyxx = { + .name = "lcd", + .driver_name = "tc358765", + .type = OMAP_DISPLAY_TYPE_DSI, + .data = &dsi_data_tc35876x_sharp_lq101k1lyxx, + .phy.dsi = { + .clk_lane = 1, + .clk_pol = 0, + .data1_lane = 2, + .data1_pol = 0, + .data2_lane = 3, + .data2_pol = 0, + .data3_lane = 4, + .data3_pol = 0, + .data4_lane = 5, + .data4_pol = 0, + + .type = OMAP_DSS_DSI_TYPE_VIDEO_MODE, + .line_bufs = 2, + }, + + .clocks = { + .dispc = { + .channel = { + .lck_div = 1, + .pck_div = 2, + .lcd_clk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, + }, + .dispc_fclk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, + }, + + .dsi = { + .regn = 38, + .regm = 441, + .regm_dispc = 6, + .regm_dsi = 9, + .lp_clk_div = 5, + .offset_ddr_clk = 0, + .dsi_fclk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI, + .tlpx = 12, + .tclk = { + .zero = 58, + .prepare = 15, + .trail = 16, + }, + .ths = { + .zero = 23, + .prepare = 18, + .exit = 33, + .trail = 19, + }, + }, + }, + + .panel = { + .timings = { + .x_res = 1280, + .y_res = 800, + .pixel_clock = 63530, + .hfp = 6, + .hsw = 12, + .hbp = 6, + .vfp = 4, + .vsw = 4, + .vbp = 4, + }, + .width_in_um = 217000, + .height_in_um = 135600, + }, + + .ctrl = { + .pixel_size = 24, + }, + + .reset_gpio = 102, + .channel = OMAP_DSS_CHANNEL_LCD, + .skip_init = false, + + .platform_enable = NULL, + .platform_disable = NULL, + .dispc_timings = &dispc_timings_tc35876x, + .dsi_timings = &dsi_timings_tc35876x, +}; + +static struct omap_dss_device lcd_tc35876x_samhyd_wuxga = { + .name = "lcd", + .driver_name = "tc358765", + .type = OMAP_DISPLAY_TYPE_DSI, + .data = &dsi_data_tc35876x_samhyd_wuxga, + .phy.dsi = { + .clk_lane = 1, + .clk_pol = 0, + .data1_lane = 2, + .data1_pol = 0, + .data2_lane = 3, + .data2_pol = 0, + .data3_lane = 4, + .data3_pol = 0, + .data4_lane = 5, + .data4_pol = 0, + + .type = OMAP_DSS_DSI_TYPE_VIDEO_MODE, + .line_bufs = 0, + }, + + .clocks = { + .dispc = { + .channel = { + .lck_div = 1, + .pck_div = 1, + .lcd_clk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, + }, + .dispc_fclk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, + }, + + .dsi = { + .regn = 17, + .regm = 287, + .regm_dispc = 9, + .regm_dsi = 7, + .lp_clk_div = 19, + .offset_ddr_clk = 0, + .dsi_fclk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI, + .tlpx = 18, + .tclk = { + .zero = 86, + .prepare = 22, + .trail = 22, + }, + .ths = { + .zero = 34, + .prepare = 25, + .exit = 47, + .trail = 25, + }, + }, + }, + + .panel = { + .timings = { + .x_res = 1920, + .y_res = 1200, + .pixel_clock = 162071, + .hfp = 40, + .hsw = 6, + .hbp = 248, + .vfp = 8, + .vsw = 6, + .vbp = 6, + }, + .width_in_um = 191520, + .height_in_um = 119700, + }, + + .ctrl = { + .pixel_size = 18, + }, + + .reset_gpio = 102, + .channel = OMAP_DSS_CHANNEL_LCD, + .skip_init = false, + + .platform_enable = NULL, + .platform_disable = NULL, + + .dispc_timings = &dispc_timings_tc35876x_samhyd_wuxga, + .dsi_timings = &dsi_timings_tc35876x_samhyd_wuxga, +}; + +static struct omap_dss_device lcd_ld089wu1_lg_wuxga = { + .name = "lcd", + .driver_name = "ld089wu1", + .type = OMAP_DISPLAY_TYPE_DSI, + .phy.dsi = { + .clk_lane = 3, + .clk_pol = 0, + .data1_lane = 1, + .data1_pol = 0, + .data2_lane = 2, + .data2_pol = 0, + .data3_lane = 4, + .data3_pol = 0, + .data4_lane = 5, + .data4_pol = 0, + + .type = OMAP_DSS_DSI_TYPE_VIDEO_MODE, + .line_bufs = 0, + }, + + .clocks = { + .dispc = { + .channel = { + .lck_div = 1, + .pck_div = 1, + .lcd_clk_src = + OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, + }, + .dispc_fclk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, + }, + + .dsi = { + .regn = 16, + .regm = 363, + .regm_dispc = 12, + .regm_dsi = 10, + .lp_clk_div = 18, + .offset_ddr_clk = 0, + .dsi_fclk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI, + .tlpx = 24, + .tclk = { + .zero = 116, + .prepare = 29, + .trail = 29, + }, + .ths = { + .zero = 46, + .prepare = 33, + .exit = 64, + .trail = 32, + }, + }, + }, + + .panel = { + .timings = { + .x_res = 1920, + .y_res = 1200, + .pixel_clock = 162071, + .hfp = 40, + .hsw = 6, + .hbp = 248, + .vfp = 8, + .vsw = 6, + .vbp = 6, + }, + .width_in_um = 191520, + .height_in_um = 119700, + }, + + .ctrl = { + .pixel_size = 24, + }, + + .reset_gpio = 102, + .channel = OMAP_DSS_CHANNEL_LCD, + .skip_init = false, + + .platform_enable = NULL, + .platform_disable = NULL, + + .dispc_timings = &dispc_timings_ld089wu1_lg_wuxga, + .dsi_timings = &dsi_timings_ld089wu1_lg_wuxga, +}; + +static struct omap_dss_device tablet_hdmi_device = { + .name = "hdmi", + .driver_name = "hdmi_panel", + .type = OMAP_DISPLAY_TYPE_HDMI, + .panel = { + .hdmi_default_cea_code = 34, + .timings = { + .x_res = 1920, + .y_res = 1080, + .pixel_clock = 74250, + .hsw = 44, + .hfp = 88, + .hbp = 148, + .vsw = 5, + .vfp = 4, + .vbp = 36, + }, + }, + .clocks = { + .dispc = { + .dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK, + }, + .hdmi = { + .regn = 15, + .regm2 = 1, + .max_pixclk_khz = 148500, + }, + }, + .reset_gpio = -EINVAL, + .hpd_gpio = HDMI_GPIO_HPD, + .channel = OMAP_DSS_CHANNEL_DIGIT, +}; + +static struct omap_dss_device *dss_devices_tc35876x_samhyd_wuxga[] = { + &lcd_tc35876x_samhyd_wuxga, /* LCD device has to be first */ + &tablet_hdmi_device, +}; + +static struct omap_dss_device *dss_devices_tc35876x_sharp_lq101k1lyxx[] = { + &lcd_tc35876x_sharp_lq101k1lyxx, /* LCD device has to be first */ + &tablet_hdmi_device, +}; + +static struct omap_dss_device *dss_devices_ld089wu1_lg_wuxga[] = { + &lcd_ld089wu1_lg_wuxga, /* LCD device has to be first */ + &tablet_hdmi_device, +}; + +static struct omap_dss_device *dss_devices_hdmi_default_display[] = { + &tablet_hdmi_device, +}; + +static struct omap_dss_board_info tablet_dss_data_tc35876x_samhyd_wuxga = { + .num_devices = ARRAY_SIZE(dss_devices_tc35876x_samhyd_wuxga), + .devices = dss_devices_tc35876x_samhyd_wuxga, + .default_device = &lcd_tc35876x_samhyd_wuxga, +}; + +static struct omap_dss_board_info tablet_dss_data_tc35876x_sharp_lq101k1lyxx = { + .num_devices = ARRAY_SIZE(dss_devices_tc35876x_sharp_lq101k1lyxx), + .devices = dss_devices_tc35876x_sharp_lq101k1lyxx, + .default_device = &lcd_tc35876x_sharp_lq101k1lyxx, +}; + +static struct omap_dss_board_info tablet_dss_data_ld089wu1_lg_wuxga = { + .num_devices = ARRAY_SIZE(dss_devices_ld089wu1_lg_wuxga), + .devices = dss_devices_ld089wu1_lg_wuxga, + .default_device = &lcd_ld089wu1_lg_wuxga, +}; + +static struct omap_dss_board_info tablet_dss_data_hdmi_default_display = { + .num_devices = ARRAY_SIZE(dss_devices_hdmi_default_display), + .devices = dss_devices_hdmi_default_display, + .default_device = &tablet_hdmi_device, +}; +/* Allocate ( 18 + 9 ) MB for TILER1D slot size for WUXGA panel, total of + * 54 MB of TILER1D + */ +static struct dsscomp_platform_data dsscomp_config_tc35876x_samhyd_wuxga = { + .tiler1d_slotsz = (SZ_16M + SZ_2M + SZ_8M + SZ_1M), +}; + +static struct dsscomp_platform_data dsscomp_config_ld089wu1_lg_wuxga = { + .tiler1d_slotsz = (SZ_16M + SZ_2M + SZ_8M + SZ_1M), +}; + +static struct dsscomp_platform_data dsscomp_config_hdmi_display = { + .tiler1d_slotsz = (SZ_16M + SZ_2M + SZ_8M + SZ_1M), +}; + +#ifdef CONFIG_FB_OMAP2_NUM_FBS +#define OMAPLFB_NUM_DEV CONFIG_FB_OMAP2_NUM_FBS +#else +#define OMAPLFB_NUM_DEV 1 +#endif + +static struct sgx_omaplfb_config omaplfb_config_tc35876x_samhyd_wuxga[OMAPLFB_NUM_DEV] = { + { + .vram_buffers = 2, + .swap_chain_length = 2, + } +}; + +static struct sgx_omaplfb_config + omaplfb_config_ld089wu1_lg_wuxga[OMAPLFB_NUM_DEV] = { + { + .vram_buffers = 2, + .swap_chain_length = 2, + } +}; + +static struct sgx_omaplfb_config omaplfb_config_hdmi_default_display[OMAPLFB_NUM_DEV] = { + { + .vram_buffers = 2, + .swap_chain_length = 2, + } +}; + +static struct sgx_omaplfb_platform_data omaplfb_plat_data_tc35876x_samhyd_wuxga = { + .num_configs = OMAPLFB_NUM_DEV, + .configs = omaplfb_config_tc35876x_samhyd_wuxga, +}; + +static struct sgx_omaplfb_platform_data omaplfb_plat_data_ld089wu1_lg_wuxga = { + .num_configs = OMAPLFB_NUM_DEV, + .configs = omaplfb_config_ld089wu1_lg_wuxga, +}; + +static struct sgx_omaplfb_platform_data omaplfb_plat_data_hdmi_default_display = { + .num_configs = OMAPLFB_NUM_DEV, + .configs = omaplfb_config_hdmi_default_display, +}; + +static struct omap_tablet_panel_data panel_data_tc35876x_samhyd_wuxga = { + .board_info = &tablet_dss_data_tc35876x_samhyd_wuxga, + .dsscomp_data = &dsscomp_config_tc35876x_samhyd_wuxga, + .omaplfb_data = &omaplfb_plat_data_tc35876x_samhyd_wuxga, +}; + +static struct omap_tablet_panel_data panel_data_ld089wu1_lg_wuxga = { + .board_info = &tablet_dss_data_ld089wu1_lg_wuxga, + .dsscomp_data = &dsscomp_config_ld089wu1_lg_wuxga, + .omaplfb_data = &omaplfb_plat_data_ld089wu1_lg_wuxga, +}; + +static struct omap_tablet_panel_data panel_data_tc35876x_sharp_lq101k1lyxx = { + .board_info = &tablet_dss_data_tc35876x_sharp_lq101k1lyxx, + .dsscomp_data = NULL, + .omaplfb_data = NULL, +}; + +static struct omap_tablet_panel_data panel_data_hdmi_default_display = { + .board_info = &tablet_dss_data_hdmi_default_display, + .dsscomp_data = &dsscomp_config_hdmi_display, + .omaplfb_data = &omaplfb_plat_data_hdmi_default_display, +}; + +static struct omap_tablet_panel_data *get_panel_data(enum omap_44xx_tablet_panel_type panel_type) +{ + + if (omap_android_display_is_default(&tablet_hdmi_device)) { + return &panel_data_hdmi_default_display; + } + + switch (panel_type) { + case TC35876x_SAMSUNG_HYDIS_WUXGA: /* HYDIS & Samsung equivalent */ + return &panel_data_tc35876x_samhyd_wuxga; + break; + case LD089WU1_LG_WUXGA: + return &panel_data_ld089wu1_lg_wuxga; + break; + case TC35876x_SHARP_LQ101K1LYxx_WXGA: + default: + if (omap_is_board_version(OMAP4_TABLET_1_0) || + omap_is_board_version(OMAP4_TABLET_1_1) || + omap_is_board_version(OMAP4_TABLET_1_2)) { + /* keep compatibility with old Tablet1 devices */ + lcd_tc35876x_sharp_lq101k1lyxx.panel.timings.x_res = 1024; + lcd_tc35876x_sharp_lq101k1lyxx.panel.timings.y_res = 768; + lcd_tc35876x_sharp_lq101k1lyxx.panel.timings.pixel_clock = 65183; + lcd_tc35876x_sharp_lq101k1lyxx.panel.timings.hfp = 10; + lcd_tc35876x_sharp_lq101k1lyxx.panel.timings.hsw = 20; + lcd_tc35876x_sharp_lq101k1lyxx.panel.timings.hbp = 10; + lcd_tc35876x_sharp_lq101k1lyxx.dsi_timings = NULL; + lcd_tc35876x_sharp_lq101k1lyxx.dispc_timings = NULL; + } + return &panel_data_tc35876x_sharp_lq101k1lyxx; + } +} + +static void tablet_lcd_init(void) +{ + u32 reg; + int status; + + /* Enable 3 lanes in DSI1 module, disable pull down */ + reg = omap4_ctrl_pad_readl(OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_DSIPHY); + reg &= ~OMAP4_DSI1_LANEENABLE_MASK; + reg |= 0x1f << OMAP4_DSI1_LANEENABLE_SHIFT; + reg &= ~OMAP4_DSI1_PIPD_MASK; + reg |= 0x1f << OMAP4_DSI1_PIPD_SHIFT; + omap4_ctrl_pad_writel(reg, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_DSIPHY); + + status = gpio_request_one(get_panel_data(tablet_panel_type)->board_info->devices[0]->reset_gpio, + GPIOF_OUT_INIT_LOW, "lcd_reset_gpio"); + if (status) + pr_err("%s: Could not get lcd_reset_gpio\n", __func__); +} + +static struct omapfb_platform_data tablet_fb_pdata = { + .mem_desc = { + .region_cnt = 1, + }, +}; + +static struct i2c_board_info __initdata omap4xx_i2c_bus2_d2l_info[] = { + { + I2C_BOARD_INFO("tc358765_i2c_driver", 0x0f), + }, +}; + +static int __init set_tablet_panel_type(char *str) +{ + int retval = 0; + if (!strncmp("2202-002", str, 8) || + !strncmp("2102-002", str, 8)) + tablet_panel_type = TC35876x_SAMSUNG_HYDIS_WUXGA; + else if (!strncmp("2202-003", str, 8)) + tablet_panel_type = LD089WU1_LG_WUXGA; + else if (!strncmp("2156-003", str, 8)) + tablet_panel_type = TC35876x_SHARP_LQ101K1LYxx_WXGA; + else { + pr_err("%s: No valid omapdss.board_id sent from bootloader, " + "will default to TC35876x_SHARP_LQ101K1LYxx_WXGA\n", + __func__); + retval = 1; + } + return retval; +} + +early_param("omapdss.board_id", set_tablet_panel_type); + +void tablet_android_display_setup(struct omap_ion_platform_data *ion) +{ + struct omap_tablet_panel_data *panel_data = get_panel_data(tablet_panel_type); + omap_android_display_setup(panel_data->board_info, + panel_data->dsscomp_data, + panel_data->omaplfb_data, + &tablet_fb_pdata, + ion); +} + +int __init tablet_panel_init(void) +{ + tablet_lcd_init(); + tablet_hdmi_mux_init(); + + omapfb_set_platform_data(&tablet_fb_pdata); + + omap_display_init(get_panel_data(tablet_panel_type)->board_info); + platform_device_register(&omap4_tablet_disp_led); + + i2c_register_board_info(2, omap4xx_i2c_bus2_d2l_info, + ARRAY_SIZE(omap4xx_i2c_bus2_d2l_info)); + + return 0; +} diff --git a/arch/arm/mach-omap2/board-44xx-tablet-sensors.c b/arch/arm/mach-omap2/board-44xx-tablet-sensors.c new file mode 100755 index 0000000..34f058e --- /dev/null +++ b/arch/arm/mach-omap2/board-44xx-tablet-sensors.c @@ -0,0 +1,170 @@ +/* + * arch/arm/mach-omap2/board-44xx-tablet-sensors.c + * + * Copyright (C) 2011 Texas Instruments + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/i2c.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/gpio.h> + +#include <linux/i2c/bma180.h> +#include <linux/i2c/tsl2771.h> +#include <linux/i2c/mpu3050.h> + +#include <plat/i2c.h> + +#include "board-44xx-tablet.h" +#include "mux.h" + +#define OMAP4_BMA180ACCL_GPIO 178 +#define OMAP4_TSL2771_INT_GPIO 184 +#define OMAP4_TSL2771_PWR_GPIO 188 +#define OMAP4_MPU3050GYRO_GPIO 2 + +/* BMA180 Accelerometer Begin */ +static struct bma180accel_platform_data bma180accel_platform_data = { + .ctrl_reg0 = 0x11, + .g_range = BMA_GRANGE_2G, + .bandwidth = BMA_BW_10HZ, + .mode = BMA_MODE_LOW_NOISE, + .bit_mode = BMA_BITMODE_14BITS, + .smp_skip = 1, + .def_poll_rate = 200, + .fuzz_x = 25, + .fuzz_y = 25, + .fuzz_z = 25, +}; + +static void blaze_tablet_bma180accl_init(void) +{ + if (gpio_request(OMAP4_BMA180ACCL_GPIO, "Accelerometer") < 0) { + pr_err("Accelerometer GPIO request failed\n"); + return; + } + gpio_direction_input(OMAP4_BMA180ACCL_GPIO); +} +/* BMA180 Accelerometer End */ + +/* TSL2771 ALS/Prox Begin */ +static void omap_tsl2771_power(int state) +{ + gpio_set_value(OMAP4_TSL2771_PWR_GPIO, state); +} + +static void blaze_tablet_tsl2771_init(void) +{ + /* TO DO: Not sure what the use case of the proximity is on a tablet + * but the interrupt may need to be wakeable if and only if proximity + * is enabled but for now leave it alone */ + gpio_request(OMAP4_TSL2771_PWR_GPIO, "tsl2771_power"); + gpio_direction_output(OMAP4_TSL2771_PWR_GPIO, 0); + + gpio_request(OMAP4_TSL2771_INT_GPIO, "tsl2771_interrupt"); + gpio_direction_input(OMAP4_TSL2771_INT_GPIO); +} + +/* TO DO: Need to create a interrupt threshold table here */ + +struct tsl2771_platform_data tsl2771_data = { + .irq_flags = (IRQF_TRIGGER_LOW | IRQF_ONESHOT), + .flags = (TSL2771_USE_ALS | TSL2771_USE_PROX), + .def_enable = 0x0, + .als_adc_time = 0xdb, + .prox_adc_time = 0xff, + .wait_time = 0x00, + .als_low_thresh_low_byte = 0x0, + .als_low_thresh_high_byte = 0x0, + .als_high_thresh_low_byte = 0x0, + .als_high_thresh_high_byte = 0x0, + .prox_low_thresh_low_byte = 0x0, + .prox_low_thresh_high_byte = 0x0, + .prox_high_thresh_low_byte = 0x0, + .prox_high_thresh_high_byte = 0x0, + .interrupt_persistence = 0xf6, + .config = 0x00, + .prox_pulse_count = 0x03, + .gain_control = 0xE0, + .glass_attn = 0x01, + .device_factor = 0x34, + .tsl2771_pwr_control = omap_tsl2771_power, +}; +/* TSL2771 ALS/Prox End */ + +/* MPU3050 Gyro Begin */ +static void blaze_tablet_mpu3050_init(void) +{ + if (gpio_request(OMAP4_MPU3050GYRO_GPIO, "mpu3050") < 0) { + pr_err("%s: MPU3050 GPIO request failed\n", __func__); + return; + } + gpio_direction_input(OMAP4_MPU3050GYRO_GPIO); +} + +static struct mpu3050gyro_platform_data mpu3050_platform_data = { + .irq_flags = (IRQF_TRIGGER_HIGH | IRQF_ONESHOT), + .default_poll_rate = 200, + .slave_i2c_addr = 0x40, + .sample_rate_div = 0x00, + .dlpf_fs_sync = 0x10, + .interrupt_cfg = (MPU3050_INT_CFG_OPEN | MPU3050_INT_CFG_LATCH_INT_EN | + MPU3050_INT_CFG_MPU_RDY_EN | MPU3050_INT_CFG_RAW_RDY_EN), +}; +/* MPU3050 Gyro End */ + +static struct i2c_board_info __initdata blaze_tablet_i2c_bus3_sensor_info[] = { + { + I2C_BOARD_INFO("tmp105", 0x48), + }, +}; + +static struct i2c_board_info __initdata blaze_tablet_i2c_bus4_sensor_info[] = { + { + I2C_BOARD_INFO("bmp085", 0x77), + }, + { + I2C_BOARD_INFO("hmc5843", 0x1e), + }, + { + I2C_BOARD_INFO("bma180_accel", 0x40), + .platform_data = &bma180accel_platform_data, + }, + { + I2C_BOARD_INFO("mpu3050_gyro", 0x68), + .platform_data = &mpu3050_platform_data, + }, + { + I2C_BOARD_INFO(TSL2771_NAME, 0x39), + .platform_data = &tsl2771_data, + .irq = OMAP_GPIO_IRQ(OMAP4_TSL2771_INT_GPIO), + }, +}; + +int __init tablet_sensor_init(void) +{ + blaze_tablet_tsl2771_init(); + blaze_tablet_mpu3050_init(); + blaze_tablet_bma180accl_init(); + + i2c_register_board_info(3, blaze_tablet_i2c_bus3_sensor_info, + ARRAY_SIZE(blaze_tablet_i2c_bus3_sensor_info)); + i2c_register_board_info(4, blaze_tablet_i2c_bus4_sensor_info, + ARRAY_SIZE(blaze_tablet_i2c_bus4_sensor_info)); + + return 0; +} + diff --git a/arch/arm/mach-omap2/board-44xx-tablet-touch.c b/arch/arm/mach-omap2/board-44xx-tablet-touch.c new file mode 100755 index 0000000..620b402 --- /dev/null +++ b/arch/arm/mach-omap2/board-44xx-tablet-touch.c @@ -0,0 +1,183 @@ +/* + * arch/arm/mach-omap2/board-44xx-tablet2-touch.c + * + * Copyright (C) 2011 Texas Instruments + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/i2c.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/gpio.h> +#include <linux/qtouch_obp_ts.h> +#include <linux/input/touch_platform.h> + +#include <plat/i2c.h> + +#include "board-44xx-tablet.h" +#include "mux.h" + +extern struct touch_platform_data cyttsp4_i2c_touch_platform_data; + +#define OMAP4_TOUCH_IRQ_1 35 + +static struct qtm_touch_keyarray_cfg blaze_tablet_key_array_data[] = { + { + .ctrl = 0, + .x_origin = 0, + .y_origin = 0, + .x_size = 0, + .y_size = 0, + .aks_cfg = 0, + .burst_len = 0, + .tch_det_thr = 0, + .tch_det_int = 0, + .rsvd1 = 0, + }, +}; + +static struct qtouch_ts_platform_data atmel_mxt224_ts_platform_data = { + .irqflags = (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW), + .flags = (QTOUCH_USE_MULTITOUCH | QTOUCH_FLIP_Y | + QTOUCH_CFG_BACKUPNV), + .abs_min_x = 0, + .abs_max_x = 768, + .abs_min_y = 0, + .abs_max_y = 1024, + .abs_min_p = 0, + .abs_max_p = 255, + .abs_min_w = 0, + .abs_max_w = 15, + .x_delta = 1024, + .y_delta = 768, + .nv_checksum = 0x187a, + .fuzz_x = 5, + .fuzz_y = 5, + .fuzz_p = 2, + .fuzz_w = 2, + .hw_reset = NULL, + .power_cfg = { + .idle_acq_int = 0x58, + .active_acq_int = 0xff, + .active_idle_to = 0x0a, + }, + .acquire_cfg = { + .charge_time = 0x20, + .atouch_drift = 0x05, + .touch_drift = 0x14, + .drift_susp = 0x14, + .touch_autocal = 0x4b, + .sync = 0, + .cal_suspend_time = 0x09, + .cal_suspend_thresh = 0x23, + }, + .multi_touch_cfg = { + .ctrl = 0x83, + .x_origin = 0, + .y_origin = 0, + .x_size = 0x11, + .y_size = 0x0d, + .aks_cfg = 0x0, + .burst_len = 0x01, + .tch_det_thr = 0x30, + .tch_det_int = 0x2, + .mov_hyst_init = 0x0, + .mov_hyst_next = 0x0, + .mov_filter = 0x30, + .num_touch = 10, + .orient = 0x00, + .mrg_timeout = 0x01, + .merge_hyst = 0x0a, + .merge_thresh = 0x0a, + .amp_hyst = 0x0a, + .x_res = 0x02ff, + .y_res = 0x03ff, + .x_low_clip = 0x00, + .x_high_clip = 0x00, + .y_low_clip = 0x00, + .y_high_clip = 0x00, + }, + .key_array = { + .cfg = blaze_tablet_key_array_data, + .num_keys = ARRAY_SIZE(blaze_tablet_key_array_data), + }, + .grip_suppression_cfg = { + .ctrl = 0x01, + .xlogrip = 0x00, + .xhigrip = 0x00, + .ylogrip = 0x00, + .yhigrip = 0x00, + .maxtchs = 0x00, + .reserve0 = 0x00, + .szthr1 = 0x50, + .szthr2 = 0x28, + .shpthr1 = 0x04, + .shpthr2 = 0x0f, + .supextto = 0x0a, + }, + .noise0_suppression_cfg = { + .ctrl = 0x05, + .reserved = 0x0000, + .gcaf_upper_limit = 0x000a, + .gcaf_lower_limit = 0xfff6, + .gcaf_valid = 0x04, + .noise_thresh = 0x20, + .reserved1 = 0x00, + .freq_hop_scale = 0x01, + .burst_freq_0 = 0x0a, + .burst_freq_1 = 0x0f, + .burst_freq_2 = 0x14, + .burst_freq_3 = 0x19, + .burst_freq_4 = 0x1e, + .num_of_gcaf_samples = 0x04, + }, + .spt_cte_cfg = { + .ctrl = 0x00, + .command = 0x00, + .mode = 0x01, + .gcaf_idle_mode = 0x04, + .gcaf_actv_mode = 0x08, + }, +}; + + +static struct i2c_board_info __initdata omap4xx_i2c_bus4_touch_info[] = { + { + I2C_BOARD_INFO(QTOUCH_TS_NAME, 0x4b), + .platform_data = &atmel_mxt224_ts_platform_data, + .irq = OMAP_GPIO_IRQ(OMAP4_TOUCH_IRQ_1), + }, +#ifdef CONFIG_TOUCHSCREEN_CYPRESS_TTSP + { + I2C_BOARD_INFO(CY_I2C_NAME, CY_I2C_TCH_ADR), + .platform_data = &cyttsp4_i2c_touch_platform_data, + .irq = OMAP_GPIO_IRQ(OMAP4_TOUCH_IRQ_1), + }, +#endif +}; + +int __init tablet_touch_init(void) +{ + gpio_request(OMAP4_TOUCH_IRQ_1, "atmel touch irq"); + gpio_direction_input(OMAP4_TOUCH_IRQ_1); + omap_mux_init_signal("gpmc_ad11.gpio_35", + OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_MUX_MODE3 | + OMAP_INPUT_EN | OMAP_PIN_OFF_INPUT_PULLUP); + + i2c_register_board_info(4, omap4xx_i2c_bus4_touch_info, + ARRAY_SIZE(omap4xx_i2c_bus4_touch_info)); + + return 0; +} diff --git a/arch/arm/mach-omap2/board-44xx-tablet.c b/arch/arm/mach-omap2/board-44xx-tablet.c new file mode 100755 index 0000000..e65943e --- /dev/null +++ b/arch/arm/mach-omap2/board-44xx-tablet.c @@ -0,0 +1,777 @@ +/* + * Board support file for OMAP44xx tablet. + * + * Copyright (C) 2009 Texas Instruments + * + * Author: Dan Murphy <dmurphy@ti.com> + * + * Based on mach-omap2/board-4430sdp.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/gpio.h> +#include <linux/memblock.h> +#include <linux/spi/spi.h> +#include <linux/i2c/twl.h> +#include <linux/i2c/bq2415x.h> +#include <linux/regulator/machine.h> +#include <linux/regulator/fixed.h> +#include <linux/regulator/tps6130x.h> +#include <linux/wl12xx.h> +#include <linux/skbuff.h> +#include <linux/ti_wilink_st.h> +#include <linux/cdc_tcxo.h> +#include <plat/omap-serial.h> +#include <linux/mfd/twl6040-codec.h> + +#include <mach/dmm.h> +#include <mach/omap4-common.h> +#include <mach/emif.h> +#include <mach/lpddr2-elpida.h> +#include <mach/omap4_ion.h> + +#include <asm/mach-types.h> +#include <asm/mach/arch.h> + +#include <plat/common.h> +#include <plat/usb.h> +#include <plat/mmc.h> +#include <plat/omap_apps_brd_id.h> +#include <plat/remoteproc.h> +#include <plat/omap-pm.h> +#include "mux.h" +#include "hsmmc.h" +#include "timer-gp.h" +#include "control.h" +#include "pm.h" +#include "board-44xx-tablet.h" +#include "omap_ram_console.h" + +#define WILINK_UART_DEV_NAME "/dev/ttyO1" +#define ETH_KS8851_IRQ 34 +#define ETH_KS8851_POWER_ON 48 +#define ETH_KS8851_QUART 138 + +#define GPIO_WIFI_PMENA 54 +#define GPIO_WIFI_IRQ 53 + +#define TPS62361_GPIO 7 + +#define OMAP4_MDM_PWR_EN_GPIO 157 +#define GPIO_USB3320_PHY_RESETB 171 +#define GPIO_WK30 30 +#define OMAP4_HSIC_AUX_GPIO 42 + +static struct spi_board_info tablet_spi_board_info[] __initdata = { + { + .modalias = "ks8851", + .bus_num = 1, + .chip_select = 0, + .max_speed_hz = 24000000, + .irq = ETH_KS8851_IRQ, + }, +}; + +static struct gpio tablet_eth_gpios[] __initdata = { + { ETH_KS8851_POWER_ON, GPIOF_OUT_INIT_HIGH, "eth_power" }, + { ETH_KS8851_QUART, GPIOF_OUT_INIT_HIGH, "quart" }, + { ETH_KS8851_IRQ, GPIOF_IN, "eth_irq" }, +}; + +static int __init omap_ethernet_init(void) +{ + int status; + + /* Request of GPIO lines */ + status = gpio_request_array(tablet_eth_gpios, + ARRAY_SIZE(tablet_eth_gpios)); + if (status) + pr_err("Cannot request ETH GPIOs\n"); + + return status; +} + +/* TODO: handle suspend/resume here. + * Upon every suspend, make sure the wilink chip is + * capable enough to wake-up the OMAP host. + */ +static int plat_wlink_kim_suspend(struct platform_device *pdev, pm_message_t + state) +{ + return 0; +} + +static int plat_wlink_kim_resume(struct platform_device *pdev) +{ + return 0; +} + +static bool uart_req; +static struct wake_lock st_wk_lock; +/* Call the uart disable of serial driver */ +static int plat_uart_disable(void) +{ + int port_id = 0; + int err = 0; + if (uart_req) { + sscanf(WILINK_UART_DEV_NAME, "/dev/ttyO%d", &port_id); + err = omap_serial_ext_uart_disable(port_id); + if (!err) + uart_req = false; + } + wake_unlock(&st_wk_lock); + return err; +} + +/* Call the uart enable of serial driver */ +static int plat_uart_enable(void) +{ + int port_id = 0; + int err = 0; + if (!uart_req) { + sscanf(WILINK_UART_DEV_NAME, "/dev/ttyO%d", &port_id); + err = omap_serial_ext_uart_enable(port_id); + if (!err) + uart_req = true; + } + wake_lock(&st_wk_lock); + return err; +} + +/* wl128x BT, FM, GPS connectivity chip */ +static struct ti_st_plat_data wilink_pdata = { + .nshutdown_gpio = 55, + .dev_name = WILINK_UART_DEV_NAME, + .flow_cntrl = 1, + .baud_rate = 3686400, + .suspend = plat_wlink_kim_suspend, + .resume = plat_wlink_kim_resume, + .chip_asleep = plat_uart_disable, + .chip_awake = plat_uart_enable, + .chip_enable = plat_uart_enable, + .chip_disable = plat_uart_disable, +}; + +static struct platform_device wl128x_device = { + .name = "kim", + .id = -1, + .dev.platform_data = &wilink_pdata, +}; + +static struct platform_device btwilink_device = { + .name = "btwilink", + .id = -1, +}; + +static struct omap_board_config_kernel tablet_config[] __initdata = { +}; + +static void __init omap_tablet_init_early(void) +{ + omap2_init_common_infrastructure(); + omap2_init_common_devices(NULL, NULL); +#ifdef CONFIG_OMAP_32K_TIMER + omap2_gp_clockevent_set_gptimer(1); +#endif +} + +static struct omap_musb_board_data musb_board_data = { + .interface_type = MUSB_INTERFACE_UTMI, +#ifdef CONFIG_USB_MUSB_OTG + .mode = MUSB_OTG, +#else + .mode = MUSB_PERIPHERAL, +#endif + .power = 200, +}; + +static struct omap2_hsmmc_info mmc[] = { + { + .mmc = 2, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA | + MMC_CAP_1_8V_DDR, + .gpio_cd = -EINVAL, + .gpio_wp = -EINVAL, + .nonremovable = true, + .ocr_mask = MMC_VDD_29_30, + .no_off_init = true, + }, + { + .mmc = 1, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA | + MMC_CAP_1_8V_DDR, + .gpio_wp = -EINVAL, + }, + { + .mmc = 5, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD, + .gpio_cd = -EINVAL, + .gpio_wp = -EINVAL, + .ocr_mask = MMC_VDD_165_195, + .nonremovable = true, + }, + {} /* Terminator */ +}; + +static struct regulator_consumer_supply omap4_tablet_vmmc5_supply = { + .supply = "vmmc", + .dev_name = "omap_hsmmc.4", +}; + +static struct regulator_init_data tablet_vmmc5 = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = 1, + .consumer_supplies = &omap4_tablet_vmmc5_supply, +}; + +static struct fixed_voltage_config tablet_vwlan = { + .supply_name = "vwl1271", + .microvolts = 1800000, /* 1.8V */ + .gpio = GPIO_WIFI_PMENA, + .startup_delay = 70000, /* 70msec */ + .enable_high = 1, + .enabled_at_boot = 0, + .init_data = &tablet_vmmc5, +}; + +static struct platform_device omap_vwlan_device = { + .name = "reg-fixed-voltage", + .id = 1, + .dev = { + .platform_data = &tablet_vwlan, + }, +}; + +static int omap4_twl6030_hsmmc_late_init(struct device *dev) +{ + int ret = 0; + struct platform_device *pdev = container_of(dev, + struct platform_device, dev); + struct omap_mmc_platform_data *pdata = dev->platform_data; + + /* Setting MMC1 Card detect Irq */ + if (pdev->id == 0) { + ret = twl6030_mmc_card_detect_config(); + if (ret) + pr_err("Failed configuring MMC1 card detect\n"); + pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE + + MMCDETECT_INTR_OFFSET; + pdata->slots[0].card_detect = twl6030_mmc_card_detect; + } + /* Setting MMC5 SDIO card .built-in variable + * This is to make sure that if WiFi driver is not loaded + * at all, then the MMC/SD/SDIO driver does not keep + * turning on/off the voltage to the SDIO card + */ + if (pdev->id == 4) { + ret = 0; + pdata->slots[0].mmc_data.built_in = 1; + } + return ret; +} + +static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) +{ + struct omap_mmc_platform_data *pdata; + + /* dev can be null if CONFIG_MMC_OMAP_HS is not set */ + if (!dev) { + pr_err("Failed %s\n", __func__); + return; + } + pdata = dev->platform_data; + pdata->init = omap4_twl6030_hsmmc_late_init; +} + +static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers) +{ + struct omap2_hsmmc_info *c; + + omap2_hsmmc_init(controllers); + for (c = controllers; c->mmc; c++) + omap4_twl6030_hsmmc_set_late_init(c->dev); + + return 0; +} + +static void omap4_audio_conf(void) +{ + /* twl6040 naudint */ + omap_mux_init_signal("sys_nirq2.sys_nirq2", \ + OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE); +} + +static int tps6130x_enable(int on) +{ + u8 rev, gpo, val = 0; + int ret; + + ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &rev, + TWL6040_REG_ASICREV); + if (ret < 0) { + pr_err("%s: failed to read ASICREV %d\n", __func__, ret); + return ret; + } + + /* + * tps6130x NRESET driven by: + * - GPO2 in TWL6040 + * - GPO in TWL6041 (only one GPO supported) + */ + if (rev >= TWL6041_REV_2_0) + gpo = TWL6040_GPO1; + else + gpo = TWL6040_GPO2; + + ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, TWL6040_REG_GPOCTL); + if (ret < 0) { + pr_err("%s: failed to read GPOCTL %d\n", __func__, ret); + return ret; + } + + if (on) + val |= gpo; + else + val &= ~gpo; + + ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, TWL6040_REG_GPOCTL); + if (ret < 0) + pr_err("%s: failed to write GPOCTL %d\n", __func__, ret); + + return ret; +} + +static struct tps6130x_platform_data tps6130x_pdata = { + .chip_enable = tps6130x_enable, +}; + +static struct regulator_consumer_supply twl6040_vddhf_supply[] = { + REGULATOR_SUPPLY("vddhf", "twl6040-codec"), +}; + +static struct regulator_init_data twl6040_vddhf = { + .constraints = { + .min_uV = 4075000, + .max_uV = 4950000, + .apply_uV = true, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE + | REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = ARRAY_SIZE(twl6040_vddhf_supply), + .consumer_supplies = twl6040_vddhf_supply, + .driver_data = &tps6130x_pdata, +}; + +static struct bq2415x_platform_data sdp4430_bqdata = { + .max_charger_voltagemV = 4200, + .max_charger_currentmA = 1550, +}; + +/* + * The Clock Driver Chip (TCXO) on OMAP4 based SDP needs to + * be programmed to output CLK1 based on REQ1 from OMAP. + * By default CLK1 is driven based on an internal REQ1INT signal + * which is always set to 1. + * Doing this helps gate sysclk (from CLK1) to OMAP while OMAP + * is in sleep states. + */ +static struct cdc_tcxo_platform_data sdp4430_cdc_data = { + .buf = { + CDC_TCXO_REQ4INT | CDC_TCXO_REQ1INT | + CDC_TCXO_REQ4POL | CDC_TCXO_REQ3POL | + CDC_TCXO_REQ2POL | CDC_TCXO_REQ1POL, + CDC_TCXO_MREQ4 | CDC_TCXO_MREQ3 | + CDC_TCXO_MREQ2 | CDC_TCXO_MREQ1, + CDC_TCXO_LDOEN1, + 0, + }, +}; + +static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = { + { + I2C_BOARD_INFO("bq24156", 0x6a), + .platform_data = &sdp4430_bqdata, + }, + { + I2C_BOARD_INFO("tps6130x", 0x33), + .platform_data = &twl6040_vddhf, + }, + { + I2C_BOARD_INFO("cdc_tcxo_driver", 0x6c), + .platform_data = &sdp4430_cdc_data, + }, +}; + +static void __init tablet_pmic_mux_init(void) +{ + + omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | + OMAP_WAKEUP_EN); +} + +static void __init omap_i2c_hwspinlock_init(int bus_id, int spinlock_id, + struct omap_i2c_bus_board_data *pdata) +{ + /* spinlock_id should be -1 for a generic lock request */ + if (spinlock_id < 0) + pdata->handle = hwspin_lock_request(); + else + pdata->handle = hwspin_lock_request_specific(spinlock_id); + + if (pdata->handle != NULL) { + pdata->hwspin_lock_timeout = hwspin_lock_timeout; + pdata->hwspin_unlock = hwspin_unlock; + } else { + pr_err("I2C hwspinlock request failed for bus %d\n", \ + bus_id); + } +} + +static struct omap_i2c_bus_board_data __initdata sdp4430_i2c_1_bus_pdata; +static struct omap_i2c_bus_board_data __initdata sdp4430_i2c_2_bus_pdata; +static struct omap_i2c_bus_board_data __initdata sdp4430_i2c_3_bus_pdata; +static struct omap_i2c_bus_board_data __initdata sdp4430_i2c_4_bus_pdata; + +static int __init omap4_i2c_init(void) +{ + omap_i2c_hwspinlock_init(1, 0, &sdp4430_i2c_1_bus_pdata); + omap_i2c_hwspinlock_init(2, 1, &sdp4430_i2c_2_bus_pdata); + omap_i2c_hwspinlock_init(3, 2, &sdp4430_i2c_3_bus_pdata); + omap_i2c_hwspinlock_init(4, 3, &sdp4430_i2c_4_bus_pdata); + + omap_register_i2c_bus_board_data(1, &sdp4430_i2c_1_bus_pdata); + omap_register_i2c_bus_board_data(2, &sdp4430_i2c_2_bus_pdata); + omap_register_i2c_bus_board_data(3, &sdp4430_i2c_3_bus_pdata); + omap_register_i2c_bus_board_data(4, &sdp4430_i2c_4_bus_pdata); + + omap4_power_init(); + i2c_register_board_info(1, sdp4430_i2c_boardinfo, + ARRAY_SIZE(sdp4430_i2c_boardinfo)); + omap_register_i2c_bus(2, 400, NULL, 0); + omap_register_i2c_bus(3, 400, NULL, 0); + omap_register_i2c_bus(4, 400, NULL, 0); + + omap2_i2c_pullup(3, I2C_PULLUP_STD_860_OM_FAST_500_OM); + + /* + * This will allow unused regulator to be shutdown. This flag + * should be set in the board file. Before regulators are registered. + */ + regulator_has_full_constraints(); + + /* + * Drive MSECURE high for TWL6030/6032 write access. + */ + omap_mux_init_signal("fref_clk0_out.gpio_wk6", OMAP_PIN_OUTPUT); + gpio_request(6, "msecure"); + gpio_direction_output(6, 1); + + return 0; +} + + +static bool enable_suspend_off = true; +module_param(enable_suspend_off, bool, S_IRUSR | S_IRGRP | S_IROTH); + +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[] __initdata = { + OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT + | OMAP_PULL_ENA), + + /* IO optimization pdpu and offmode settings to reduce leakage */ + OMAP4_MUX(GPMC_A17, OMAP_MUX_MODE3 | OMAP_INPUT_EN), + OMAP4_MUX(GPMC_NCS4, OMAP_MUX_MODE3 | OMAP_INPUT_EN), + OMAP4_MUX(GPMC_NCS5, OMAP_MUX_MODE3 | OMAP_PULL_ENA | OMAP_PULL_UP + | OMAP_OFF_EN | OMAP_OFF_PULL_EN), + OMAP4_MUX(GPMC_NCS7, OMAP_MUX_MODE3 | OMAP_INPUT_EN), + OMAP4_MUX(GPMC_NBE1, OMAP_MUX_MODE3 | OMAP_PULL_ENA | OMAP_PULL_UP + | OMAP_OFF_EN | OMAP_OFF_PULL_EN), + OMAP4_MUX(GPMC_WAIT0, OMAP_MUX_MODE3 | OMAP_INPUT_EN), + OMAP4_MUX(GPMC_NOE, OMAP_MUX_MODE1 | OMAP_INPUT_EN), + OMAP4_MUX(MCSPI1_CS1, OMAP_MUX_MODE3 | OMAP_PULL_ENA | OMAP_PULL_UP + | OMAP_OFF_EN | OMAP_OFF_PULL_EN), + OMAP4_MUX(MCSPI1_CS2, OMAP_MUX_MODE3 | OMAP_PULL_ENA | OMAP_PULL_UP + | OMAP_OFF_EN | OMAP_OFF_PULL_EN), + OMAP4_MUX(SDMMC5_CLK, OMAP_MUX_MODE0 | OMAP_INPUT_EN | OMAP_OFF_EN + | OMAP_OFF_PULL_EN), + OMAP4_MUX(GPMC_NCS1, OMAP_MUX_MODE3 | OMAP_INPUT_EN | OMAP_WAKEUP_EN), + OMAP4_MUX(GPMC_A24, OMAP_MUX_MODE3 | OMAP_INPUT_EN | OMAP_WAKEUP_EN), + { .reg_offset = OMAP_MUX_TERMINATOR }, +}; + +#else +#define board_mux NULL +#define board_wkup_mux NULL +#endif + +/* + * LPDDR2 Configuration Data for 4430/4460 SOMs: + * The memory organization is as below : + * EMIF1 - CS0 - 2 Gb + * CS1 - 2 Gb + * EMIF2 - CS0 - 2 Gb + * CS1 - 2 Gb + * -------------------- + * TOTAL - 8 Gb + * + * Same devices installed on EMIF1 and EMIF2 + */ +static __initdata struct emif_device_details emif_devices = { + .cs0_device = &lpddr2_elpida_2G_S4_dev, + .cs1_device = &lpddr2_elpida_2G_S4_dev +}; + +/* + * LPDDR2 Configuration Data for 4470 SOMs: + * The memory organization is as below : + * EMIF1 - CS0 - 4 Gb + * EMIF2 - CS0 - 4 Gb + * -------------------- + * TOTAL - 8 Gb + * + * Same devices installed on EMIF1 and EMIF2 + */ +static __initdata struct emif_device_details emif_devices_4470 = { + .cs0_device = &lpddr2_elpida_4G_S4_dev, +}; + +static void omap4_tablet_wifi_mux_init(void) +{ + omap_mux_init_gpio(GPIO_WIFI_IRQ, OMAP_PIN_INPUT | + OMAP_PIN_OFF_WAKEUPENABLE); + omap_mux_init_gpio(GPIO_WIFI_PMENA, OMAP_PIN_OUTPUT); + + omap_mux_init_signal("sdmmc5_cmd.sdmmc5_cmd", + OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("sdmmc5_clk.sdmmc5_clk", + OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("sdmmc5_dat0.sdmmc5_dat0", + OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("sdmmc5_dat1.sdmmc5_dat1", + OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("sdmmc5_dat2.sdmmc5_dat2", + OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("sdmmc5_dat3.sdmmc5_dat3", + OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP); +} + +static struct wl12xx_platform_data omap4_tablet_wlan_data __initdata = { + .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ), + .board_ref_clock = WL12XX_REFCLOCK_26, + .board_tcxo_clock = WL12XX_TCXOCLOCK_26, +}; + +static void omap4_tablet_wifi_init(void) +{ + omap4_tablet_wifi_mux_init(); + if (wl12xx_set_platform_data(&omap4_tablet_wlan_data)) + pr_err("Error setting wl12xx data\n"); + platform_device_register(&omap_vwlan_device); +} + +#if defined(CONFIG_USB_EHCI_HCD_OMAP) || defined(CONFIG_USB_OHCI_HCD_OMAP3) +static struct usbhs_omap_board_data usbhs_bdata __initdata = { + .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, + .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, + .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, + .phy_reset = false, + .reset_gpio_port[0] = -EINVAL, + .reset_gpio_port[1] = -EINVAL, + .reset_gpio_port[2] = -EINVAL, + .hsic_aux_port[0] = -EINVAL, + .hsic_aux_port[1] = OMAP4_HSIC_AUX_GPIO, + .hsic_aux_port[2] = -EINVAL +}; + +static int __init setup_usb_hsic(char *buf) +{ + extern bool omap4_tablet_uses_hsic; + + omap4_tablet_uses_hsic = true; + usbhs_bdata.port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED; + usbhs_bdata.port_mode[1] = OMAP_EHCI_PORT_MODE_HSIC; + return 0; +} + +early_param("omap4_tablet_uses_hsic", setup_usb_hsic); + +static void __init omap4_ehci_ohci_init(void) +{ + omap_mux_init_signal("fref_clk3_req.gpio_wk30", \ + OMAP_PIN_OUTPUT | \ + OMAP_PIN_OFF_NONE | OMAP_PULL_ENA); + + /* Enable 5V,1A USB power on external HS-USB ports */ + if (gpio_is_valid(GPIO_WK30)) { + gpio_request(GPIO_WK30, "USB POWER GPIO"); + gpio_direction_output(GPIO_WK30, 1); + gpio_set_value(GPIO_WK30, 0); + } + + omap_mux_init_signal("usbb2_ulpitll_clk.gpio_157", \ + OMAP_PIN_OUTPUT | \ + OMAP_PIN_OFF_NONE); + + /* Power on the ULPI PHY */ + if ((usbhs_bdata.port_mode[0] == OMAP_EHCI_PORT_MODE_PHY) && + gpio_is_valid(OMAP4_MDM_PWR_EN_GPIO)) { + gpio_request(OMAP4_MDM_PWR_EN_GPIO, "USBB1 PHY VMDM_3V3"); + gpio_direction_output(OMAP4_MDM_PWR_EN_GPIO, 1); + } + + omap_mux_init_signal("gpmc_a18.gpio_42", + OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_INPUT_PULLUP); + + usbhs_init(&usbhs_bdata); + + return; + +} +#else +static void __init omap4_ehci_ohci_init(void){} +#endif + +static struct platform_device *tablet4430_devices[] __initdata = { + &wl128x_device, + &btwilink_device, +}; + +static void __init tablet_camera_mux_init(void) +{ + u32 r = 0; + + /* Enable CSI22 pads for 4460 and 4470*/ + if ((cpu_is_omap446x() || cpu_is_omap447x()) && + (omap_get_board_version() >= OMAP4_TABLET_2_0)) { + r = omap4_ctrl_pad_readl(OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_CAMERA_RX); + r |= (0x7 << OMAP4_CAMERARX_CSI22_LANEENABLE_SHIFT); + omap4_ctrl_pad_writel(r, + OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_CAMERA_RX); + + omap_mux_init_signal("csi22_dx2.csi22_dx2", + OMAP_PIN_INPUT | OMAP_MUX_MODE0); + omap_mux_init_signal("csi22_dy2.csi22_dy2", + OMAP_PIN_INPUT | OMAP_MUX_MODE0); + } +} + +static void tablet_set_osc_timings(void) +{ + /* Device Oscilator + * tstart = 2ms + 2ms = 4ms. + * tshut = Not defined in oscillator data sheet so setting to 1us + */ + omap_pm_set_osc_lp_time(4000, 1); +} + +static void __init omap_tablet_init(void) +{ + int status; + int package = OMAP_PACKAGE_CBS; + int tablet_rev = 0; + + if (omap_rev() == OMAP4430_REV_ES1_0) + package = OMAP_PACKAGE_CBL; + omap4_mux_init(board_mux, NULL, package); + + if (cpu_is_omap447x()) + omap_emif_setup_device_details(&emif_devices_4470, + &emif_devices_4470); + else + omap_emif_setup_device_details(&emif_devices, &emif_devices); + + omap_board_config = tablet_config; + omap_board_config_size = ARRAY_SIZE(tablet_config); + tablet_rev = omap_init_board_version(0); + omap4_create_board_props(); + omap4_audio_conf(); + omap4_i2c_init(); + tablet_touch_init(); + tablet_camera_mux_init(); + omap_dmm_init(); + tablet_panel_init(); + tablet_pmic_mux_init(); + tablet_set_osc_timings(); + tablet_button_init(); + omap4_register_ion(); + board_serial_init(); + omap4_tablet_wifi_init(); + omap4_twl6030_hsmmc_init(mmc); + tablet_sensor_init(); + platform_add_devices(tablet4430_devices, + ARRAY_SIZE(tablet4430_devices)); + wake_lock_init(&st_wk_lock, WAKE_LOCK_SUSPEND, "st_wake_lock"); + omap4_ehci_ohci_init(); + usb_musb_init(&musb_board_data); + + status = omap_ethernet_init(); + if (status) { + pr_err("Ethernet initialization failed: %d\n", status); + } else { + tablet_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ); + spi_register_board_info(tablet_spi_board_info, + ARRAY_SIZE(tablet_spi_board_info)); + } + + if (cpu_is_omap446x()) { + /* Vsel0 = gpio, vsel1 = gnd */ + status = omap_tps6236x_board_setup(true, TPS62361_GPIO, -1, + OMAP_PIN_OFF_OUTPUT_HIGH, -1); + if (status) + pr_err("TPS62361 initialization failed: %d\n", status); + } + + omap_enable_smartreflex_on_init(); + if (enable_suspend_off) + omap_pm_enable_off_mode(); + +} + +static void __init omap_tablet_map_io(void) +{ + omap2_set_globals_443x(); + omap44xx_map_common_io(); +} + +static void __init omap_tablet_reserve(void) +{ + + omap_init_ram_size(); +#ifdef CONFIG_ION_OMAP + tablet_android_display_setup(get_omap_ion_platform_data()); + omap_ion_init(); +#else + tablet_android_display_setup(NULL); +#endif + omap_ram_console_init(OMAP_RAM_CONSOLE_START_DEFAULT, + OMAP_RAM_CONSOLE_SIZE_DEFAULT); + + /* do the static reservations first */ + memblock_remove(PHYS_ADDR_SMC_MEM, PHYS_ADDR_SMC_SIZE); + memblock_remove(PHYS_ADDR_DUCATI_MEM, PHYS_ADDR_DUCATI_SIZE); + /* ipu needs to recognize secure input buffer area as well */ + omap_ipu_set_static_mempool(PHYS_ADDR_DUCATI_MEM, PHYS_ADDR_DUCATI_SIZE + + OMAP4_ION_HEAP_SECURE_INPUT_SIZE + + OMAP4_ION_HEAP_SECURE_OUTPUT_WFDHDCP_SIZE); + omap_reserve(); +} + + +MACHINE_START(OMAP_BLAZE, "OMAP4 blaze board") + /* Maintainer: Dan Murphy - Texas Instruments Inc */ + .boot_params = 0x80000100, + .reserve = omap_tablet_reserve, + .map_io = omap_tablet_map_io, + .init_early = omap_tablet_init_early, + .init_irq = gic_init_irq, + .init_machine = omap_tablet_init, + .timer = &omap_timer, +MACHINE_END diff --git a/arch/arm/mach-omap2/board-44xx-tablet.h b/arch/arm/mach-omap2/board-44xx-tablet.h new file mode 100755 index 0000000..ff4efc2 --- /dev/null +++ b/arch/arm/mach-omap2/board-44xx-tablet.h @@ -0,0 +1,30 @@ +/* + * arch/arm/mach-omap2/board-44xx-tablet.h + * + * Copyright (C) 2011 Texas Instruments + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _MACH_OMAP_BOARD_44XX_TABLET2_H +#define _MACH_OMAP_BOARD_44XX_TABLET2_H + +int tablet_touch_init(void); +int tablet_sensor_init(void); +void omap4_create_board_props(void); +int tablet_panel_init(void); +int tablet_button_init(void); +void omap4_power_init(void); +void board_serial_init(void); +struct omap_ion_platform_data; +void tablet_android_display_setup(struct omap_ion_platform_data *ion); + +#endif diff --git a/arch/arm/mach-omap2/board-blaze-keypad.c b/arch/arm/mach-omap2/board-blaze-keypad.c new file mode 100755 index 0000000..9af4e6f --- /dev/null +++ b/arch/arm/mach-omap2/board-blaze-keypad.c @@ -0,0 +1,47 @@ +/* + * arch/arm/mach-omap2/board-blaze-keypad.c + * + * Copyright (C) 2011 Texas Instruments + * + * Author: Dan Murphy <DMurphy@TI.com> + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <linux/gpio.h> +#include <linux/gpio_keys.h> +#include <linux/input.h> +#include <linux/leds.h> +#include <linux/platform_device.h> + +#include <plat/omap4-keypad.h> + +#include "board-blaze.h" +#include "mux.h" + +static struct platform_device blaze_keypad_led = { + .name = "keypad_led", + .id = -1, + .dev = { + .platform_data = NULL, + }, +}; + +static struct platform_device *blaze_led_devices[] __initdata = { + &blaze_keypad_led, +}; + +int __init blaze_keypad_init(void) +{ + platform_add_devices(blaze_led_devices, ARRAY_SIZE(blaze_led_devices)); + + return 0; +} diff --git a/arch/arm/mach-omap2/board-blaze-modem.c b/arch/arm/mach-omap2/board-blaze-modem.c new file mode 100755 index 0000000..176782b --- /dev/null +++ b/arch/arm/mach-omap2/board-blaze-modem.c @@ -0,0 +1,254 @@ +/* + * arch/arm/mach-omap2/board-blaze-modem.c + * + * Copyright (C) 2011 Texas Instruments + * + * Author: Patrick Combes <p-combes@ti.com> + * Based on a patch from Cedric Baudelet + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <linux/gpio.h> +#include <linux/delay.h> +#include "board-blaze.h" +#include "mux.h" +#include <plat/omap_hsi.h> + +#if defined(CONFIG_USB_EHCI_HCD_OMAP) || defined(CONFIG_USB_OHCI_HCD_OMAP3) +#include <plat/usb.h> +#endif + +#define BLAZE_MDM_ONSW 187 +#define BLAZE_MDM_PWRSTATE 189 +#define MODEM_PWRSTATE_POLLING_MS 10 +#define MODEM_PWRSTATE_TIMEOUT (100 / MODEM_PWRSTATE_POLLING_MS) + +static int modem_detected; + +/* + * Switch-on or switch-off the modem and return modem status + * Pre-requisites: + * - Modem Vbat supplied with + * - BLAZE_MDM_ONSW and BLAZE_MDM_PWRSTATE gpio reserved and PAD configured + */ +static int blaze_modem_switch(int new_state) +{ + int modem_pwrrst_ca; + int state; + int i; + + /* Control Modem power switch */ + gpio_direction_output(BLAZE_MDM_ONSW, new_state); + state = new_state ? 1 : 0; + + /* Monitor Modem power state */ + i = 0; + while (i < MODEM_PWRSTATE_TIMEOUT) { + modem_pwrrst_ca = gpio_get_value(BLAZE_MDM_PWRSTATE); + if (unlikely(new_state == modem_pwrrst_ca)) { + pr_info("Modem state properly updated to state %d\n", + state); + break; + } + msleep(MODEM_PWRSTATE_POLLING_MS); + i++; + } + return modem_pwrrst_ca; +} + +static void blaze_hsi_pad_conf(void) +{ + /* + * HSI pad conf: hsi1_ca/ac_wake/flag/data/ready + */ + + /* hsi1_cawake */ + omap_mux_init_signal("usbb1_ulpitll_clk.hsi1_cawake", \ + OMAP_PIN_INPUT_PULLDOWN | \ + OMAP_PIN_OFF_NONE | \ + OMAP_PIN_OFF_WAKEUPENABLE); + /* hsi1_caflag */ + omap_mux_init_signal("usbb1_ulpitll_dir.hsi1_caflag", \ + OMAP_PIN_INPUT | \ + OMAP_PIN_OFF_NONE); + /* hsi1_cadata */ + omap_mux_init_signal("usbb1_ulpitll_stp.hsi1_cadata", \ + OMAP_PIN_INPUT | \ + OMAP_PIN_OFF_NONE); + /* hsi1_acready */ + omap_mux_init_signal("usbb1_ulpitll_nxt.hsi1_acready", \ + OMAP_PIN_OUTPUT | \ + OMAP_PIN_OFF_OUTPUT_LOW); + /* hsi1_acwake */ + omap_mux_init_signal("usbb1_ulpitll_dat0.hsi1_acwake", \ + OMAP_PIN_OUTPUT | \ + OMAP_PIN_OFF_NONE); + /* hsi1_acdata */ + omap_mux_init_signal("usbb1_ulpitll_dat1.hsi1_acdata", \ + OMAP_PIN_OUTPUT | \ + OMAP_PIN_OFF_NONE); + /* hsi1_acflag */ + omap_mux_init_signal("usbb1_ulpitll_dat2.hsi1_acflag", \ + OMAP_PIN_OUTPUT | \ + OMAP_PIN_OFF_NONE); + /* hsi1_caready */ + omap_mux_init_signal("usbb1_ulpitll_dat3.hsi1_caready", \ + OMAP_PIN_INPUT_PULLDOWN | \ + OMAP_PIN_OFF_NONE); +} + +static void blaze_modem_pad_conf(void) +{ + pr_info("Update PAD for modem connection\n"); + + /* Configure PADconf for HSI */ + blaze_hsi_pad_conf(); + + /* gpio_95 */ + omap_mux_init_signal("usbb1_ulpitll_dat7.gpio_95", \ + OMAP_PIN_INPUT_PULLDOWN | \ + OMAP_PIN_OFF_NONE | \ + OMAP_PIN_OFF_WAKEUPENABLE); + + /* Ensure UART3 Tx will not drive until Modem is up and running */ + omap_mux_init_signal("uart3_tx_irtx.uart3_tx_irtx", OMAP_MUX_MODE7); + + /*mcbsp2_fsx*/ + omap_mux_init_signal("abe_mcbsp2_fsx.abe_mcbsp2_fsx", \ + OMAP_PIN_INPUT_PULLDOWN | \ + OMAP_PIN_OFF_INPUT_PULLDOWN | \ + OMAP_MUX_MODE0); + /*mcbsp2_clkx*/ + omap_mux_init_signal("abe_mcbcp2_clkx.abe_mcbsp2_clkx", \ + OMAP_PIN_INPUT_PULLDOWN | \ + OMAP_PIN_OFF_INPUT_PULLDOWN | \ + OMAP_MUX_MODE0); + /*mcbsp2_dr*/ + omap_mux_init_signal("abe_mcbsp2_dr.abe_mcbsp2_dr", \ + OMAP_PIN_INPUT_PULLDOWN | \ + OMAP_PIN_OFF_OUTPUT_LOW | \ + OMAP_MUX_MODE0); +} + +/* + * Modem is tentatively switched ON to detect it then switched back to OFF + * + * As OMAP4 muxes HSI and USB signals, when HSI is used (for instance HSI + * modem is plugged) HSI pad conf is configured and some USB + * configurations are disabled. + */ +void __init blaze_modem_init(bool force_mux) +{ + int modem_enabled; + + /* Prepare MDM VBAT */ + omap_mux_init_signal("usbb2_ulpitll_clk.gpio_157", \ + OMAP_PIN_OUTPUT | \ + OMAP_PIN_OFF_NONE); + + /* Power on 3V3 Buck/Boost Power Supply for Modem */ + if (unlikely(!gpio_is_valid(BLAZE_MDM_PWR_EN_GPIO) || + gpio_request(BLAZE_MDM_PWR_EN_GPIO, "MODEM VBAT") < 0)) { + pr_err("Cannot control gpio %d\n", BLAZE_MDM_PWR_EN_GPIO); + goto err_pwr; + } + gpio_direction_output(BLAZE_MDM_PWR_EN_GPIO, 1); + + /* Prepare MDM_STATE to get modem status */ + omap_mux_init_signal("sys_boot5.gpio_189", \ + OMAP_PIN_INPUT_PULLDOWN | \ + OMAP_PIN_OFF_NONE); + + if (unlikely(!gpio_is_valid(BLAZE_MDM_PWRSTATE) || + gpio_request(BLAZE_MDM_PWRSTATE, "MODEM POWER STATE") < 0)) { + pr_err("Cannot control gpio %d\n", BLAZE_MDM_PWRSTATE); + goto err_pwrstate1; + } + gpio_direction_input(BLAZE_MDM_PWRSTATE); + + if (unlikely(gpio_get_value(BLAZE_MDM_PWRSTATE))) { + pr_err("Invalid modem state\n"); + goto err_pwrstate2; + } + + /* Prepare MDM_ONSW to control modem state */ + omap_mux_init_signal("sys_boot3.gpio_187", \ + OMAP_PIN_OUTPUT | \ + OMAP_PIN_OFF_NONE); + + /* Enable Modem ONSW */ + if (unlikely(!gpio_is_valid(BLAZE_MDM_ONSW) || + gpio_request(BLAZE_MDM_ONSW, "MODEM SWITCH ON") < 0)) { + pr_err("Cannot control gpio %d\n", BLAZE_MDM_ONSW); + goto err_onsw; + } + + modem_detected = blaze_modem_switch(1); + pr_info("Modem %sdetected\n", modem_detected ? "" : "NOT "); + + /* Disable Modem ONSW */ + modem_enabled = blaze_modem_switch(0); + if (unlikely(modem_detected && modem_enabled)) + pr_err("Modem cannot be switched-off\n"); + + /* Release PWRSTATE and ONSW */ + gpio_free(BLAZE_MDM_ONSW); +err_onsw: +err_pwrstate2: + gpio_free(BLAZE_MDM_PWRSTATE); +err_pwrstate1: + /* Configure omap4 pad for HSI if modem detected */ + if (modem_detected || force_mux) { +#if defined(CONFIG_USB_EHCI_HCD_OMAP) || defined(CONFIG_USB_OHCI_HCD_OMAP3) + /* USBB1 I/O pads conflict with HSI1 port */ + usbhs_bdata.port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED; + /* USBB2 I/O pads conflict with McBSP2 port */ + usbhs_bdata.port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED; +#endif + /* Setup modem pad conf for blaze platform */ + blaze_modem_pad_conf(); + /* Allow HSI omap_device to be registered later */ + omap_hsi_allow_registration(); + + } else { + gpio_direction_output(BLAZE_MDM_PWR_EN_GPIO, 0); + gpio_free(BLAZE_MDM_PWR_EN_GPIO); + } +err_pwr: + return; +} + + +#include "omap-rfkill-ste.h" + +static struct omap_rfkill_ste_platform_data ste_pdata; + +static struct platform_device modem_dev = { + .name = "ste-p5780", + .id = -1, + .dev.platform_data = &ste_pdata +}; + +static int late_blaze_modem_init(void) +{ + int ret; + + if (modem_detected) { + ret = platform_device_register(&modem_dev); + if (ret) + pr_err("Error registering modem dev: %d\n", ret); + } + + return 0; +} + +late_initcall(late_blaze_modem_init); diff --git a/arch/arm/mach-omap2/board-blaze-panel.c b/arch/arm/mach-omap2/board-blaze-panel.c new file mode 100755 index 0000000..784a17b --- /dev/null +++ b/arch/arm/mach-omap2/board-blaze-panel.c @@ -0,0 +1,111 @@ +/* + * arch/arm/mach-omap2/board-blaze-panel.c + * + * Copyright (C) 2011 Texas Instruments + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <linux/delay.h> +#include <linux/kernel.h> +#include <linux/gpio.h> +#include <linux/i2c.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/leds-omap4430sdp-display.h> +#include <linux/platform_device.h> + +#include <linux/i2c/twl.h> +#include <plat/i2c.h> + +#include "board-blaze.h" +#include "mux.h" + +#define DP_4430_GPIO_59 59 +#define LED_SEC_DISP_GPIO 27 +#define DSI2_GPIO_59 59 + +#define LED_PWM2ON 0x03 +#define LED_PWM2OFF 0x04 +#define LED_TOGGLE3 0x92 + +static void blaze_init_display_led(void) +{ + twl_i2c_write_u8(TWL_MODULE_PWM, 0xFF, LED_PWM2ON); + twl_i2c_write_u8(TWL_MODULE_PWM, 0x7F, LED_PWM2OFF); + twl_i2c_write_u8(TWL6030_MODULE_ID1, 0x30, LED_TOGGLE3); +} + +static void blaze_set_primary_brightness(u8 brightness) +{ + if (brightness > 1) { + if (brightness == 255) + brightness = 0x7f; + else + brightness = (~(brightness/2)) & 0x7f; + + twl_i2c_write_u8(TWL6030_MODULE_ID1, 0x30, LED_TOGGLE3); + twl_i2c_write_u8(TWL_MODULE_PWM, brightness, LED_PWM2ON); + } else if (brightness <= 1) { + twl_i2c_write_u8(TWL6030_MODULE_ID1, 0x08, LED_TOGGLE3); + twl_i2c_write_u8(TWL6030_MODULE_ID1, 0x38, LED_TOGGLE3); + } +} + +static void blaze_set_secondary_brightness(u8 brightness) +{ + if (brightness > 0) + brightness = 1; + + gpio_set_value(LED_SEC_DISP_GPIO, brightness); +} + +static struct omap4430_sdp_disp_led_platform_data blaze_disp_led_data = { + .flags = LEDS_CTRL_AS_ONE_DISPLAY, + .display_led_init = blaze_init_display_led, + .primary_display_set = blaze_set_primary_brightness, + .secondary_display_set = blaze_set_secondary_brightness, +}; + +static void __init omap_disp_led_init(void) +{ + /* Seconday backlight control */ + gpio_request(DSI2_GPIO_59, "dsi2_bl_gpio"); + gpio_direction_output(DSI2_GPIO_59, 0); + + if (blaze_disp_led_data.flags & LEDS_CTRL_AS_ONE_DISPLAY) { + pr_info("%s: Configuring as one display LED\n", __func__); + gpio_set_value(DSI2_GPIO_59, 1); + } + + gpio_request(LED_SEC_DISP_GPIO, "dsi1_bl_gpio"); + gpio_direction_output(LED_SEC_DISP_GPIO, 1); + mdelay(120); + gpio_set_value(LED_SEC_DISP_GPIO, 0); + +} + +static struct platform_device blaze_disp_led = { + .name = "display_led", + .id = -1, + .dev = { + .platform_data = &blaze_disp_led_data, + }, +}; + +int __init blaze_panel_init(void) +{ + omap_disp_led_init(); + platform_device_register(&blaze_disp_led); + + return 0; +} diff --git a/arch/arm/mach-omap2/board-blaze-sensors.c b/arch/arm/mach-omap2/board-blaze-sensors.c new file mode 100755 index 0000000..087ab49 --- /dev/null +++ b/arch/arm/mach-omap2/board-blaze-sensors.c @@ -0,0 +1,177 @@ +/* + * arch/arm/mach-omap2/board-blaze-sensors.c + * + * Copyright (C) 2011 Texas Instruments + * + * Author: Dan Murphy <DMurphy@TI.com> + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/i2c.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/gpio.h> + +#include <linux/input/sfh7741.h> +#include <linux/i2c/cma3000.h> + +#include <plat/i2c.h> + +#include "board-blaze.h" +#include "mux.h" + +#define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184 +#define OMAP4_SFH7741_ENABLE_GPIO 188 +#define OMAP4_CMA3000ACCL_GPIO 186 + +static void omap_prox_activate(int state) +{ + gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , state); +} + +static int omap_prox_read(void) +{ + int proximity; + proximity = gpio_get_value(OMAP4_SFH7741_SENSOR_OUTPUT_GPIO); +#ifdef CONFIG_ANDROID + /* Invert the output from the prox sensor for Android as 0 should + be near and 1 should be far */ + return !proximity; +#else + return proximity; +#endif +} + +static void omap_sfh7741prox_init(void) +{ + int error; + struct omap_mux *prox_gpio_mux; + bool wake_enable; + + error = gpio_request(OMAP4_SFH7741_SENSOR_OUTPUT_GPIO, "sfh7741"); + if (error < 0) { + pr_err("%s: GPIO configuration failed: GPIO %d, error %d\n" + , __func__, OMAP4_SFH7741_SENSOR_OUTPUT_GPIO, error); + return ; + } + + error = gpio_direction_input(OMAP4_SFH7741_SENSOR_OUTPUT_GPIO); + if (error < 0) { + pr_err("Proximity GPIO input configuration failed\n"); + goto fail1; + } + + error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741"); + if (error < 0) { + pr_err("failed to request GPIO %d, error %d\n", + OMAP4_SFH7741_ENABLE_GPIO, error); + goto fail1; + } + + error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0); + if (error < 0) { + pr_err("%s: GPIO configuration failed: GPIO %d, error %d\n", + __func__, OMAP4_SFH7741_ENABLE_GPIO, error); + goto fail3; + } + + prox_gpio_mux = omap_mux_get_gpio(OMAP4_SFH7741_SENSOR_OUTPUT_GPIO); + wake_enable = omap_mux_get_wakeupenable(prox_gpio_mux); + if (!wake_enable) + omap_mux_set_wakeupenable(prox_gpio_mux); + + return; + +fail3: + gpio_free(OMAP4_SFH7741_ENABLE_GPIO); +fail1: + gpio_free(OMAP4_SFH7741_SENSOR_OUTPUT_GPIO); +} + +static struct sfh7741_platform_data omap_sfh7741_data = { + .flags = SFH7741_WAKEABLE_INT, + .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, + .prox_enable = 0, + .activate_func = omap_prox_activate, + .read_prox = omap_prox_read, +}; + +static struct platform_device blaze_proximity_device = { + .name = SFH7741_NAME, + .id = 1, + .dev = { + .platform_data = &omap_sfh7741_data, + }, +}; + +static struct cma3000_platform_data cma3000_platform_data = { + .def_poll_rate = 200, + .fuzz_x = 25, + .fuzz_y = 25, + .fuzz_z = 25, + .g_range = CMARANGE_8G, + .mode = CMAMODE_MEAS400, + .mdthr = 0x8, + .mdfftmr = 0x33, + .ffthr = 0x8, + .irqflags = IRQF_TRIGGER_HIGH, +}; + +static void omap_cma3000accl_init(void) +{ + if (gpio_request(OMAP4_CMA3000ACCL_GPIO, "Accelerometer") < 0) { + pr_err("Accelerometer GPIO request failed\n"); + return; + } + gpio_direction_input(OMAP4_CMA3000ACCL_GPIO); +} + +static struct i2c_board_info __initdata blaze_bus3_sensor_boardinfo[] = { + { + I2C_BOARD_INFO("tmp105", 0x48), + }, + { + I2C_BOARD_INFO("bh1780", 0x29), + }, +}; + +static struct i2c_board_info __initdata blaze_bus4_sensor_boardinfo[] = { + { + I2C_BOARD_INFO("bmp085", 0x77), + }, + { + I2C_BOARD_INFO("hmc5843", 0x1e), + }, + { + I2C_BOARD_INFO("cma3000_accl", 0x1c), + .platform_data = &cma3000_platform_data, + }, +}; + +int __init blaze_sensor_init(void) +{ + omap_sfh7741prox_init(); + omap_cma3000accl_init(); + + i2c_register_board_info(3, blaze_bus3_sensor_boardinfo, + ARRAY_SIZE(blaze_bus3_sensor_boardinfo)); + + i2c_register_board_info(4, blaze_bus4_sensor_boardinfo, + ARRAY_SIZE(blaze_bus4_sensor_boardinfo)); + + platform_device_register(&blaze_proximity_device); + + return 0; +} diff --git a/arch/arm/mach-omap2/board-blaze-touch.c b/arch/arm/mach-omap2/board-blaze-touch.c new file mode 100755 index 0000000..bdbdbb4 --- /dev/null +++ b/arch/arm/mach-omap2/board-blaze-touch.c @@ -0,0 +1,107 @@ +/* + * arch/arm/mach-omap2/board-blaze-touch.c + * + * Copyright (C) 2011 Texas Instruments + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <linux/gpio.h> +#include <linux/i2c.h> +#include <linux/init.h> +#include <linux/input.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/kernel.h> +#include <linux/platform_device.h> + +#include "board-blaze.h" +#include <plat/i2c.h> +#include <plat/syntm12xx.h> + +#include "mux.h" + +#define OMAP4_TOUCH_IRQ_1 35 +#define OMAP4_TOUCH_IRQ_2 36 + +static char *tm12xx_idev_names[] = { + "syn_tm12xx_ts_1", + "syn_tm12xx_ts_2", + "syn_tm12xx_ts_3", + "syn_tm12xx_ts_4", + "syn_tm12xx_ts_5", + "syn_tm12xx_ts_6", + NULL, +}; + +static u8 tm12xx_button_map[] = { + KEY_F1, + KEY_F2, +}; + +static struct tm12xx_ts_platform_data tm12xx_platform_data[] = { + { /* Primary Controller */ + .gpio_intr = OMAP4_TOUCH_IRQ_1, + .idev_name = tm12xx_idev_names, + .button_map = tm12xx_button_map, + .num_buttons = ARRAY_SIZE(tm12xx_button_map), + .repeat = 0, + .swap_xy = 1, + .controller_num = 0, + /* Android does not have touchscreen as wakeup source */ +#if !defined(CONFIG_ANDROID) + .suspend_state = SYNTM12XX_ON_ON_SUSPEND, +#else + .suspend_state = SYNTM12XX_SLEEP_ON_SUSPEND, +#endif + }, + { /* Secondary Controller */ + .gpio_intr = OMAP4_TOUCH_IRQ_2, + .idev_name = tm12xx_idev_names, + .button_map = tm12xx_button_map, + .num_buttons = ARRAY_SIZE(tm12xx_button_map), + .repeat = 0, + .swap_xy = 1, + .controller_num = 1, + /* Android does not have touchscreen as wakeup source */ +#if !defined(CONFIG_ANDROID) + .suspend_state = SYNTM12XX_ON_ON_SUSPEND, +#else + .suspend_state = SYNTM12XX_SLEEP_ON_SUSPEND, +#endif + }, +}; + +static struct i2c_board_info __initdata blaze_i2c_2_touch_boardinfo[] = { + { + I2C_BOARD_INFO("tm12xx_ts_primary", 0x4b), + .platform_data = &tm12xx_platform_data[0], + }, +}; + +static struct i2c_board_info __initdata blaze_i2c_3_touch_boardinfo[] = { + { + I2C_BOARD_INFO("tm12xx_ts_secondary", 0x4b), + .platform_data = &tm12xx_platform_data[1], + }, +}; + +int __init blaze_touch_init(void) +{ + + i2c_register_board_info(2, blaze_i2c_2_touch_boardinfo, + ARRAY_SIZE(blaze_i2c_2_touch_boardinfo)); + + i2c_register_board_info(3, blaze_i2c_3_touch_boardinfo, + ARRAY_SIZE(blaze_i2c_3_touch_boardinfo)); + + return 0; +} diff --git a/arch/arm/mach-omap2/board-blaze.h b/arch/arm/mach-omap2/board-blaze.h new file mode 100755 index 0000000..0c78b2f5 --- /dev/null +++ b/arch/arm/mach-omap2/board-blaze.h @@ -0,0 +1,34 @@ +/* + * arch/arm/mach-omap2/board-blaze.h + * + * Copyright (C) 2011 Texas Instruments + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _MACH_OMAP_BOARD_44XX_SDP_H +#define _MACH_OMAP_BOARD_44XX_SDP_H + +int blaze_touch_init(void); +int blaze_sensor_init(void); +int blaze_panel_init(void); +int blaze_keypad_init(void); +void blaze_modem_init(bool force_mux); +void omap4_create_board_props(void); +void omap4_power_init(void); +void board_serial_init(void); + +#define BLAZE_MDM_PWR_EN_GPIO 157 + +#if defined(CONFIG_USB_EHCI_HCD_OMAP) || defined(CONFIG_USB_OHCI_HCD_OMAP3) +extern struct usbhs_omap_board_data usbhs_bdata; +#endif +#endif diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c new file mode 100755 index 0000000..9b78cc5 --- /dev/null +++ b/arch/arm/mach-omap2/board-omap4panda.c @@ -0,0 +1,847 @@ +/* + * Board support file for OMAP4430 based PandaBoard. + * + * Copyright (C) 2010 Texas Instruments + * + * Author: David Anders <x0132446@ti.com> + * + * Based on mach-omap2/board-4430sdp.c + * + * Author: Santosh Shilimkar <santosh.shilimkar@ti.com> + * + * Based on mach-omap2/board-3430sdp.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/leds.h> +#include <linux/gpio.h> +#include <linux/omapfb.h> +#include <linux/usb/otg.h> +#include <linux/hwspinlock.h> +#include <linux/i2c/twl.h> +#include <linux/reboot.h> +#include <linux/regulator/machine.h> +#include <linux/regulator/fixed.h> +#include <linux/wl12xx.h> +#include <linux/memblock.h> + +#include <mach/hardware.h> +#include <mach/omap4-common.h> +#include <mach/emif.h> +#include <mach/lpddr2-elpida.h> +#include <mach/dmm.h> +#include <mach/omap4_ion.h> + +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <video/omapdss.h> + +#include <plat/board.h> +#include <plat/common.h> +#include <plat/usb.h> +#include <plat/mmc.h> +#include <plat/omap_apps_brd_id.h> +#include <plat/remoteproc.h> +#include <plat/vram.h> +#include <video/omap-panel-generic-dpi.h> +#include "timer-gp.h" + +#include "board-panda.h" +#include "omap_ram_console.h" +#include "hsmmc.h" +#include "control.h" +#include "mux.h" +#include "pm.h" +#include "common-board-devices.h" +#include "prm-regbits-44xx.h" +#include "prm44xx.h" + +#define GPIO_HUB_POWER 1 +#define GPIO_HUB_NRESET 62 +#define GPIO_WIFI_PMENA 43 +#define GPIO_WIFI_IRQ 53 +#define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */ +#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ +#define HDMI_GPIO_HPD 63 /* Hotplug detect */ +#define TPS62361_GPIO 7 /* VCORE1 power control */ + +/* wl127x BT, FM, GPS connectivity chip */ +static int wl1271_gpios[] = {46, -1, -1}; +static struct platform_device wl1271_device = { + .name = "kim", + .id = -1, + .dev = { + .platform_data = &wl1271_gpios, + }, +}; + +static struct gpio_led gpio_leds[] = { + { + .name = "pandaboard::status1", + .default_trigger = "heartbeat", + .gpio = 7, + }, + { + .name = "pandaboard::status2", + .default_trigger = "mmc0", + .gpio = 8, + }, +}; + +static struct gpio_led_platform_data gpio_led_info = { + .leds = gpio_leds, + .num_leds = ARRAY_SIZE(gpio_leds), +}; + +static struct platform_device leds_gpio = { + .name = "leds-gpio", + .id = -1, + .dev = { + .platform_data = &gpio_led_info, + }, +}; + +static struct platform_device *panda_devices[] __initdata = { + &leds_gpio, + &wl1271_device, +}; + +static void __init omap4_panda_init_early(void) +{ + omap2_init_common_infrastructure(); + omap2_init_common_devices(NULL, NULL); +} + +static const struct usbhs_omap_board_data usbhs_bdata __initconst = { + .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, + .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, + .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, + .phy_reset = false, + .reset_gpio_port[0] = -EINVAL, + .reset_gpio_port[1] = -EINVAL, + .reset_gpio_port[2] = -EINVAL +}; + +static struct gpio panda_ehci_gpios[] __initdata = { + { GPIO_HUB_POWER, GPIOF_OUT_INIT_LOW, "hub_power" }, + { GPIO_HUB_NRESET, GPIOF_OUT_INIT_LOW, "hub_nreset" }, +}; + +static void __init omap4_ehci_init(void) +{ + int ret; + struct clk *phy_ref_clk; + + /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */ + phy_ref_clk = clk_get(NULL, "auxclk3_ck"); + if (IS_ERR(phy_ref_clk)) { + pr_err("Cannot request auxclk3\n"); + return; + } + clk_set_rate(phy_ref_clk, 19200000); + clk_enable(phy_ref_clk); + + /* disable the power to the usb hub prior to init and reset phy+hub */ + ret = gpio_request_array(panda_ehci_gpios, + ARRAY_SIZE(panda_ehci_gpios)); + if (ret) { + pr_err("Unable to initialize EHCI power/reset\n"); + return; + } + + gpio_export(GPIO_HUB_POWER, 0); + gpio_export(GPIO_HUB_NRESET, 0); + gpio_set_value(GPIO_HUB_NRESET, 1); + + usbhs_init(&usbhs_bdata); + + /* enable power to hub */ + gpio_set_value(GPIO_HUB_POWER, 1); +} + +static struct omap_musb_board_data musb_board_data = { + .interface_type = MUSB_INTERFACE_UTMI, +#ifdef CONFIG_USB_GADGET_MUSB_HDRC + .mode = MUSB_PERIPHERAL, +#else + .mode = MUSB_OTG, +#endif + .power = 100, +}; + +static struct twl4030_usb_data omap4_usbphy_data = { + .phy_init = omap4430_phy_init, + .phy_exit = omap4430_phy_exit, + .phy_power = omap4430_phy_power, + .phy_suspend = omap4430_phy_suspend, +}; + +static struct omap2_hsmmc_info mmc[] = { + { + .mmc = 1, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, + .gpio_wp = -EINVAL, + .gpio_cd = -EINVAL, + }, + { + .name = "wl1271", + .mmc = 5, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD, + .gpio_wp = -EINVAL, + .gpio_cd = -EINVAL, + .ocr_mask = MMC_VDD_165_195, + .nonremovable = true, + }, + {} /* Terminator */ +}; + +static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = { + { + .supply = "vmmc", + .dev_name = "omap_hsmmc.0", + }, +}; + +static struct regulator_consumer_supply omap4_panda_vmmc5_supply = { + .supply = "vmmc", + .dev_name = "omap_hsmmc.4", +}; + +static struct regulator_init_data panda_vmmc5 = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = 1, + .consumer_supplies = &omap4_panda_vmmc5_supply, +}; + +static struct fixed_voltage_config panda_vwlan = { + .supply_name = "vwl1271", + .microvolts = 1800000, /* 1.8V */ + .gpio = GPIO_WIFI_PMENA, + .startup_delay = 70000, /* 70msec */ + .enable_high = 1, + .enabled_at_boot = 0, + .init_data = &panda_vmmc5, +}; + +static struct platform_device omap_vwlan_device = { + .name = "reg-fixed-voltage", + .id = 1, + .dev = { + .platform_data = &panda_vwlan, + }, +}; + +struct wl12xx_platform_data omap_panda_wlan_data __initdata = { + .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ), + /* PANDA ref clock is 38.4 MHz */ + .board_ref_clock = 2, +}; + +static int omap4_twl6030_hsmmc_late_init(struct device *dev) +{ + int ret = 0; + struct platform_device *pdev = container_of(dev, + struct platform_device, dev); + struct omap_mmc_platform_data *pdata = dev->platform_data; + + if (!pdata) { + dev_err(dev, "%s: NULL platform data\n", __func__); + return -EINVAL; + } + /* Setting MMC1 Card detect Irq */ + if (pdev->id == 0) { + ret = twl6030_mmc_card_detect_config(); + if (ret) + dev_err(dev, "%s: Error card detect config(%d)\n", + __func__, ret); + else + pdata->slots[0].card_detect = twl6030_mmc_card_detect; + } + return ret; +} + +static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) +{ + struct omap_mmc_platform_data *pdata; + + /* dev can be null if CONFIG_MMC_OMAP_HS is not set */ + if (!dev) { + pr_err("Failed omap4_twl6030_hsmmc_set_late_init\n"); + return; + } + pdata = dev->platform_data; + + pdata->init = omap4_twl6030_hsmmc_late_init; +} + +static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers) +{ + struct omap2_hsmmc_info *c; + + omap2_hsmmc_init(controllers); + for (c = controllers; c->mmc; c++) + omap4_twl6030_hsmmc_set_late_init(c->dev); + + return 0; +} + +static struct regulator_consumer_supply sdp4430_vaux2_supply[] = { + REGULATOR_SUPPLY("av-switch", "soc-audio"), +}; + +static struct regulator_init_data omap4_panda_vaux2 = { + .constraints = { + .min_uV = 1200000, + .max_uV = 2800000, + .apply_uV = true, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE + | REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = 1, + .consumer_supplies = sdp4430_vaux2_supply, +}; + +static struct regulator_init_data omap4_panda_vaux3 = { + .constraints = { + .min_uV = 1000000, + .max_uV = 3000000, + .apply_uV = true, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE + | REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + }, +}; + +/* VMMC1 for MMC1 card */ +static struct regulator_init_data omap4_panda_vmmc = { + .constraints = { + .min_uV = 1200000, + .max_uV = 3000000, + .apply_uV = true, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE + | REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = 1, + .consumer_supplies = omap4_panda_vmmc_supply, +}; + +static struct regulator_init_data omap4_panda_vpp = { + .constraints = { + .min_uV = 1800000, + .max_uV = 2500000, + .apply_uV = true, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE + | REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + }, +}; + +static struct regulator_init_data omap4_panda_vana = { + .constraints = { + .min_uV = 2100000, + .max_uV = 2100000, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + }, +}; + +static struct regulator_init_data omap4_panda_vcxio = { + .constraints = { + .min_uV = 1800000, + .max_uV = 1800000, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + }, +}; + +static struct regulator_consumer_supply panda_vdac_supply[] = { + { + .supply = "hdmi_vref", + }, +}; + +static struct regulator_init_data omap4_panda_vdac = { + .constraints = { + .min_uV = 1800000, + .max_uV = 1800000, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = ARRAY_SIZE(panda_vdac_supply), + .consumer_supplies = panda_vdac_supply, +}; + +static struct regulator_init_data omap4_panda_vusb = { + .constraints = { + .min_uV = 3300000, + .max_uV = 3300000, + .apply_uV = true, + .valid_modes_mask = REGULATOR_MODE_NORMAL + | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + }, +}; + +static struct regulator_init_data omap4_panda_clk32kg = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .always_on = true, + }, +}; + +static void omap4_audio_conf(void) +{ + /* twl6040 naudint */ + omap_mux_init_signal("sys_nirq2.sys_nirq2", \ + OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE); +} + +static struct twl4030_codec_audio_data twl6040_audio = { + /* single-step ramp for headset and handsfree */ + .hs_left_step = 0x0f, + .hs_right_step = 0x0f, + .hf_left_step = 0x1d, + .hf_right_step = 0x1d, +}; + +static struct twl4030_codec_data twl6040_codec = { + .audio = &twl6040_audio, + .audpwron_gpio = 127, + .naudint_irq = OMAP44XX_IRQ_SYS_2N, + .irq_base = TWL6040_CODEC_IRQ_BASE, +}; + +static struct twl4030_platform_data omap4_panda_twldata = { + .irq_base = TWL6030_IRQ_BASE, + .irq_end = TWL6030_IRQ_END, + + /* Regulators */ + .vmmc = &omap4_panda_vmmc, + .vpp = &omap4_panda_vpp, + .vana = &omap4_panda_vana, + .vcxio = &omap4_panda_vcxio, + .vdac = &omap4_panda_vdac, + .vusb = &omap4_panda_vusb, + .vaux2 = &omap4_panda_vaux2, + .vaux3 = &omap4_panda_vaux3, + .clk32kg = &omap4_panda_clk32kg, + .usb = &omap4_usbphy_data, + + /* children */ + .codec = &twl6040_codec, +}; + +/* + * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM + * is connected as I2C slave device, and can be accessed at address 0x50 + */ +static struct i2c_board_info __initdata panda_i2c_eeprom[] = { + { + I2C_BOARD_INFO("eeprom", 0x50), + }, +}; + +static void __init omap_i2c_hwspinlock_init(int bus_id, int spinlock_id, + struct omap_i2c_bus_board_data *pdata) +{ + /* spinlock_id should be -1 for a generic lock request */ + if (spinlock_id < 0) + pdata->handle = hwspin_lock_request(); + else + pdata->handle = hwspin_lock_request_specific(spinlock_id); + + if (pdata->handle != NULL) { + pdata->hwspin_lock_timeout = hwspin_lock_timeout; + pdata->hwspin_unlock = hwspin_unlock; + } else { + pr_err("I2C hwspinlock request failed for bus %d\n", \ + bus_id); + } +} + +static struct omap_i2c_bus_board_data __initdata panda_i2c_1_bus_pdata; +static struct omap_i2c_bus_board_data __initdata panda_i2c_2_bus_pdata; +static struct omap_i2c_bus_board_data __initdata panda_i2c_3_bus_pdata; +static struct omap_i2c_bus_board_data __initdata panda_i2c_4_bus_pdata; + + +static int __init omap4_panda_i2c_init(void) +{ + omap_i2c_hwspinlock_init(1, 0, &panda_i2c_1_bus_pdata); + omap_i2c_hwspinlock_init(2, 1, &panda_i2c_2_bus_pdata); + omap_i2c_hwspinlock_init(3, 2, &panda_i2c_3_bus_pdata); + omap_i2c_hwspinlock_init(4, 3, &panda_i2c_4_bus_pdata); + + omap_register_i2c_bus_board_data(1, &panda_i2c_1_bus_pdata); + omap_register_i2c_bus_board_data(2, &panda_i2c_2_bus_pdata); + omap_register_i2c_bus_board_data(3, &panda_i2c_3_bus_pdata); + omap_register_i2c_bus_board_data(4, &panda_i2c_4_bus_pdata); + + + omap4_pmic_init("twl6030", &omap4_panda_twldata); + omap_register_i2c_bus(2, 400, NULL, 0); + /* + * Bus 3 is attached to the DVI port where devices like the pico DLP + * projector don't work reliably with 400kHz + */ + omap_register_i2c_bus(3, 100, panda_i2c_eeprom, + ARRAY_SIZE(panda_i2c_eeprom)); + omap_register_i2c_bus(4, 400, NULL, 0); + return 0; +} + +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[] __initdata = { + /* WLAN IRQ - GPIO 53 */ + OMAP4_MUX(GPMC_NCS3, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), + /* WLAN POWER ENABLE - GPIO 43 */ + OMAP4_MUX(GPMC_A19, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT), + /* WLAN SDIO: MMC5 CMD */ + OMAP4_MUX(SDMMC5_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), + /* WLAN SDIO: MMC5 CLK */ + OMAP4_MUX(SDMMC5_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), + /* WLAN SDIO: MMC5 DAT[0-3] */ + OMAP4_MUX(SDMMC5_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), + OMAP4_MUX(SDMMC5_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), + OMAP4_MUX(SDMMC5_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), + OMAP4_MUX(SDMMC5_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), + /* gpio 0 - TFP410 PD */ + OMAP4_MUX(KPD_COL1, OMAP_PIN_OUTPUT | OMAP_MUX_MODE3), + /* dispc2_data23 */ + OMAP4_MUX(USBB2_ULPITLL_STP, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data22 */ + OMAP4_MUX(USBB2_ULPITLL_DIR, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data21 */ + OMAP4_MUX(USBB2_ULPITLL_NXT, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data20 */ + OMAP4_MUX(USBB2_ULPITLL_DAT0, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data19 */ + OMAP4_MUX(USBB2_ULPITLL_DAT1, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data18 */ + OMAP4_MUX(USBB2_ULPITLL_DAT2, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data15 */ + OMAP4_MUX(USBB2_ULPITLL_DAT3, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data14 */ + OMAP4_MUX(USBB2_ULPITLL_DAT4, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data13 */ + OMAP4_MUX(USBB2_ULPITLL_DAT5, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data12 */ + OMAP4_MUX(USBB2_ULPITLL_DAT6, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data11 */ + OMAP4_MUX(USBB2_ULPITLL_DAT7, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data10 */ + OMAP4_MUX(DPM_EMU3, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data9 */ + OMAP4_MUX(DPM_EMU4, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data16 */ + OMAP4_MUX(DPM_EMU5, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data17 */ + OMAP4_MUX(DPM_EMU6, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_hsync */ + OMAP4_MUX(DPM_EMU7, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_pclk */ + OMAP4_MUX(DPM_EMU8, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_vsync */ + OMAP4_MUX(DPM_EMU9, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_de */ + OMAP4_MUX(DPM_EMU10, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data8 */ + OMAP4_MUX(DPM_EMU11, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data7 */ + OMAP4_MUX(DPM_EMU12, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data6 */ + OMAP4_MUX(DPM_EMU13, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data5 */ + OMAP4_MUX(DPM_EMU14, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data4 */ + OMAP4_MUX(DPM_EMU15, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data3 */ + OMAP4_MUX(DPM_EMU16, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data2 */ + OMAP4_MUX(DPM_EMU17, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data1 */ + OMAP4_MUX(DPM_EMU18, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + /* dispc2_data0 */ + OMAP4_MUX(DPM_EMU19, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), + { .reg_offset = OMAP_MUX_TERMINATOR }, +}; + +static inline void __init board_serial_init(void) +{ + omap_serial_init(); +} +#else +#define board_mux NULL + +static inline void __init board_serial_init(void) +{ + omap_serial_init(); +} +#endif + +/* Display DVI */ +#define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0 + +static int omap4_panda_enable_dvi(struct omap_dss_device *dssdev) +{ + gpio_set_value(dssdev->reset_gpio, 1); + return 0; +} + +static void omap4_panda_disable_dvi(struct omap_dss_device *dssdev) +{ + gpio_set_value(dssdev->reset_gpio, 0); +} + +/* Using generic display panel */ +static struct panel_generic_dpi_data omap4_dvi_panel = { + .name = "generic_720p", + .platform_enable = omap4_panda_enable_dvi, + .platform_disable = omap4_panda_disable_dvi, +}; + +struct omap_dss_device omap4_panda_dvi_device = { + .type = OMAP_DISPLAY_TYPE_DPI, + .name = "dvi", + .driver_name = "generic_dpi_panel", + .data = &omap4_dvi_panel, + .phy.dpi.data_lines = 24, + .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, + .channel = OMAP_DSS_CHANNEL_LCD2, +}; + +int __init omap4_panda_dvi_init(void) +{ + int r; + + /* Requesting TFP410 DVI GPIO and disabling it, at bootup */ + r = gpio_request_one(omap4_panda_dvi_device.reset_gpio, + GPIOF_OUT_INIT_LOW, "DVI PD"); + if (r) + pr_err("Failed to get DVI powerdown GPIO\n"); + + return r; +} + +static struct gpio panda_hdmi_gpios[] = { + { HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" }, + { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, +}; + +static void omap4_panda_hdmi_mux_init(void) +{ + u32 r; + int status; + /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */ + omap_mux_init_signal("hdmi_hpd.hdmi_hpd", + OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("gpmc_wait2.gpio_100", + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal("hdmi_cec.hdmi_cec", + OMAP_PIN_INPUT_PULLUP); + /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */ + omap_mux_init_signal("hdmi_ddc_scl.hdmi_ddc_scl", + OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("hdmi_ddc_sda.hdmi_ddc_sda", + OMAP_PIN_INPUT_PULLUP); + + /* strong pullup on DDC lines using unpublished register */ + r = ((1 << 24) | (1 << 28)) ; + omap4_ctrl_pad_writel(r, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1); + + gpio_request(HDMI_GPIO_HPD, NULL); + omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT | OMAP_PULL_ENA); + gpio_direction_input(HDMI_GPIO_HPD); + + status = gpio_request_array(panda_hdmi_gpios, + ARRAY_SIZE(panda_hdmi_gpios)); + if (status) + pr_err("%s: Cannot request HDMI GPIOs %x \n", __func__, status); +} + +static struct omap_dss_device omap4_panda_hdmi_device = { + .name = "hdmi", + .driver_name = "hdmi_panel", + .type = OMAP_DISPLAY_TYPE_HDMI, + .clocks = { + .dispc = { + .dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK, + }, + .hdmi = { + .regn = 15, + .regm2 = 1, + }, + }, + .hpd_gpio = HDMI_GPIO_HPD, + .channel = OMAP_DSS_CHANNEL_DIGIT, +}; + +static struct omap_dss_device *omap4_panda_dss_devices[] = { + &omap4_panda_dvi_device, + &omap4_panda_hdmi_device, +}; + +static struct omap_dss_board_info omap4_panda_dss_data = { + .num_devices = ARRAY_SIZE(omap4_panda_dss_devices), + .devices = omap4_panda_dss_devices, + .default_device = &omap4_panda_dvi_device, +}; + +/* + * LPDDR2 Configeration Data: + * The memory organisation is as below : + * EMIF1 - CS0 - 2 Gb + * CS1 - 2 Gb + * EMIF2 - CS0 - 2 Gb + * CS1 - 2 Gb + * -------------------- + * TOTAL - 8 Gb + * + * Same devices installed on EMIF1 and EMIF2 + */ +static __initdata struct emif_device_details emif_devices = { + .cs0_device = &lpddr2_elpida_2G_S4_dev, + .cs1_device = &lpddr2_elpida_2G_S4_dev +}; + +void omap4_panda_display_init(void) +{ + int r; + + r = omap4_panda_dvi_init(); + if (r) + pr_err("error initializing panda DVI\n"); + + omap4_panda_hdmi_mux_init(); + omap_display_init(&omap4_panda_dss_data); +} + + +#define PANDA_FB_RAM_SIZE SZ_16M /* 1920×1080*4 * 2 */ +static struct omapfb_platform_data panda_fb_pdata = { + .mem_desc = { + .region_cnt = 1, + .region = { + [0] = { + .size = PANDA_FB_RAM_SIZE, + }, + }, + }, +}; + +extern void __init omap4_panda_android_init(void); + +static void __init omap4_panda_init(void) +{ + int status; + int package = OMAP_PACKAGE_CBS; + + omap_emif_setup_device_details(&emif_devices, &emif_devices); + + if (omap_rev() == OMAP4430_REV_ES1_0) + package = OMAP_PACKAGE_CBL; + omap4_mux_init(board_mux, NULL, package); + + omap_init_board_version(OMAP4_PANDA); + omap4_create_board_props(); + + if (wl12xx_set_platform_data(&omap_panda_wlan_data)) + pr_err("error setting wl12xx data\n"); + + omap4_panda_i2c_init(); + omap4_register_ion(); + omap4_audio_conf(); + platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); + platform_device_register(&omap_vwlan_device); + board_serial_init(); + omap4_twl6030_hsmmc_init(mmc); + omap4_ehci_init(); + usb_musb_init(&musb_board_data); + + omap_dmm_init(); + omap_vram_set_sdram_vram(PANDA_FB_RAM_SIZE, 0); + omapfb_set_platform_data(&panda_fb_pdata); + omap4_panda_display_init(); + + if (cpu_is_omap446x()) { + /* Vsel0 = gpio, vsel1 = gnd */ + status = omap_tps6236x_board_setup(true, TPS62361_GPIO, -1, + OMAP_PIN_OFF_OUTPUT_HIGH, -1); + if (status) + pr_err("TPS62361 initialization failed: %d\n", status); + } + omap_enable_smartreflex_on_init(); + /* + * 7X-38.400MBB-T oscillator uses: + * Up time = startup time(max 10ms) + enable time (max 100ns: round 1us) + * Down time = disable time (max 100ns: round 1us) + */ + omap_pm_set_osc_lp_time(11000, 1); +} + +static void __init omap4_panda_map_io(void) +{ + omap2_set_globals_443x(); + omap44xx_map_common_io(); +} + +static void __init omap4_panda_reserve(void) +{ + omap_init_ram_size(); + +#ifdef CONFIG_ION_OMAP + omap_ion_init(); +#endif + + omap_ram_console_init(OMAP_RAM_CONSOLE_START_DEFAULT, + OMAP_RAM_CONSOLE_SIZE_DEFAULT); + + /* do the static reservations first */ + memblock_remove(PHYS_ADDR_SMC_MEM, PHYS_ADDR_SMC_SIZE); + memblock_remove(PHYS_ADDR_DUCATI_MEM, PHYS_ADDR_DUCATI_SIZE); + /* ipu needs to recognize secure input buffer area as well */ + omap_ipu_set_static_mempool(PHYS_ADDR_DUCATI_MEM, PHYS_ADDR_DUCATI_SIZE + + OMAP4_ION_HEAP_SECURE_INPUT_SIZE + + OMAP4_ION_HEAP_SECURE_OUTPUT_WFDHDCP_SIZE); + + omap_reserve(); +} + +MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board") + /* Maintainer: David Anders - Texas Instruments Inc */ + .boot_params = 0x80000100, + .reserve = omap4_panda_reserve, + .map_io = omap4_panda_map_io, + .init_early = omap4_panda_init_early, + .init_irq = gic_init_irq, + .init_machine = omap4_panda_init, + .timer = &omap_timer, +MACHINE_END diff --git a/arch/arm/mach-omap2/board-panda.h b/arch/arm/mach-omap2/board-panda.h new file mode 100755 index 0000000..755275d --- /dev/null +++ b/arch/arm/mach-omap2/board-panda.h @@ -0,0 +1,22 @@ +/* + * arch/arm/mach-omap2/board-panda.h + * + * Copyright (C) 2011 Texas Instruments + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _MACH_OMAP_BOARD_PANDA_H +#define _MACH_OMAP_BOARD_PANDA_H + +void omap4_create_board_props(void); + +#endif diff --git a/arch/arm/mach-omap2/board-touch-cyttsp4_core.c b/arch/arm/mach-omap2/board-touch-cyttsp4_core.c new file mode 100755 index 0000000..e6ab64d --- /dev/null +++ b/arch/arm/mach-omap2/board-touch-cyttsp4_core.c @@ -0,0 +1,185 @@ +/* + * arch/arm/mach-omap2/board-touch-cyttsp4_core.c + * + * Copyright (c) 2010, NVIDIA Corporation. + * Modified by: Cypress Semiconductor - 2011 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include <linux/kernel.h> +#include <linux/delay.h> +#include <linux/gpio.h> +#include <linux/input/touch_platform.h> +#include <linux/input.h> +#include <linux/input/cyttsp4_params.h> + + +/* duplicate the defines here, should move to a header file */ +#define GPIO_TOUCH_RESET 23 +#define GPIO_TOUCH_IRQ 35 + + +#define TOUCH_GPIO_RST_CYTTSP GPIO_TOUCH_RESET +#define TOUCH_GPIO_IRQ_CYTTSP GPIO_TOUCH_IRQ + +static int cyttsp4_hw_reset(void) +{ + int ret = 0; + return 0; + + gpio_set_value(TOUCH_GPIO_RST_CYTTSP, 1); + pr_info("%s: gpio_set_value(step%d)=%d\n", __func__, 1, 1); + msleep(20); + gpio_set_value(TOUCH_GPIO_RST_CYTTSP, 0); + pr_info("%s: gpio_set_value(step%d)=%d\n", __func__, 2, 0); + msleep(40); + gpio_set_value(TOUCH_GPIO_RST_CYTTSP, 1); + msleep(20); + pr_info("%s: gpio_set_value(step%d)=%d\n", __func__, 3, 1); + + return ret; +} + +static int cyttsp4_hw_recov(int on) +{ + int retval = 0; + + pr_info("%s: on=%d\n", __func__, on); + if (on == 0) { + cyttsp4_hw_reset(); + retval = 0; + } else + retval = -EINVAL; + return 0; +} + +static int cyttsp4_irq_stat(void) +{ + return gpio_get_value(TOUCH_GPIO_IRQ_CYTTSP); +} + +#define CY_ABS_MIN_X 0 +#define CY_ABS_MIN_Y 0 +#define CY_ABS_MIN_P 0 +#define CY_ABS_MIN_W 0 +#define CY_ABS_MIN_T 0 /* //1 */ +#define CY_ABS_MAX_X CY_MAXX +#define CY_ABS_MAX_Y CY_MAXY +#define CY_ABS_MAX_P 255 +#define CY_ABS_MAX_W 255 +#define CY_ABS_MAX_T 9 /* //10 */ +#define CY_IGNORE_VALUE 0xFFFF + + +static struct touch_settings cyttsp4_sett_param_regs = { + .data = (uint8_t *)&cyttsp4_param_regs[0], + .size = sizeof(cyttsp4_param_regs), + .tag = 0, +}; + +static struct touch_settings cyttsp4_sett_param_size = { + .data = (uint8_t *)&cyttsp4_param_size[0], + .size = sizeof(cyttsp4_param_size), + .tag = 0, +}; + +/* Design Data Table */ +static u8 cyttsp4_ddata[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24 /* test padding, 25, 26, 27, 28, 29, 30, 31 */ +}; + +static struct touch_settings cyttsp4_sett_ddata = { + .data = (uint8_t *)&cyttsp4_ddata[0], + .size = sizeof(cyttsp4_ddata), + .tag = 0, +}; + +/* Manufacturing Data Table */ +static u8 cyttsp4_mdata[] = { + 65, 64, /* test truncation */63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, + 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, + 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, + 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 +}; + +static struct touch_settings cyttsp4_sett_mdata = { + .data = (uint8_t *)&cyttsp4_mdata[0], + .size = sizeof(cyttsp4_mdata), + .tag = 0, +}; + + + +#define CY_USE_INCLUDE_FBL +#ifdef CY_USE_INCLUDE_FBL +#include "linux/input/cyttsp4_img.h" +static struct touch_firmware cyttsp4_firmware = { + .img = cyttsp4_img, + .size = sizeof(cyttsp4_img), + .ver = cyttsp4_ver, + .vsize = sizeof(cyttsp4_ver), +}; +#else +static u8 test_img[] = {0, 1, 2, 4, 8, 16, 32, 64, 128}; +static u8 test_ver[] = {0, 0, 0, 0, 0x10, 0x20, 0, 0, 0}; +static struct touch_firmware cyttsp4_firmware = { + .img = test_img, + .size = sizeof(test_img), + .ver = test_ver, + .vsize = sizeof(test_ver), +}; +#endif + +static const uint16_t cyttsp4_abs[] = { + ABS_MT_POSITION_X, CY_ABS_MIN_X, CY_ABS_MAX_X, 0, 0, + ABS_MT_POSITION_Y, CY_ABS_MIN_Y, CY_ABS_MAX_Y, 0, 0, + ABS_MT_PRESSURE, CY_ABS_MIN_P, CY_ABS_MAX_P, 0, 0, + ABS_MT_TOUCH_MAJOR, CY_ABS_MIN_W, CY_ABS_MAX_W, 0, 0, + ABS_MT_TRACKING_ID, CY_ABS_MIN_T, CY_ABS_MAX_T, 0, 0, +}; + +struct touch_framework cyttsp4_framework = { + .abs = (uint16_t *)&cyttsp4_abs[0], + .size = sizeof(cyttsp4_abs)/sizeof(uint16_t), + .enable_vkeys = 1, +}; + +struct touch_platform_data cyttsp4_i2c_touch_platform_data = { + .sett = { + NULL, /* Reserved */ + NULL, /* Command Registers */ + NULL, /* Touch Report */ + NULL, /* Cypress Data Record */ + NULL, /* Test Record */ + NULL, /* Panel Configuration Record */ + &cyttsp4_sett_param_regs, + &cyttsp4_sett_param_size, + NULL, /* Reserved */ + NULL, /* Reserved */ + NULL, /* Operational Configuration Record */ + &cyttsp4_sett_ddata, /* Design Data Record */ + &cyttsp4_sett_mdata, /* Manufacturing Data Record */ + }, + .fw = &cyttsp4_firmware, + .frmwrk = &cyttsp4_framework, + .addr = {CY_I2C_TCH_ADR, CY_I2C_LDR_ADR}, + .flags = /*0x01 | 0x02 | */0x20 | 0x40, + .hw_reset = cyttsp4_hw_reset, + .hw_recov = cyttsp4_hw_recov, + .irq_stat = cyttsp4_irq_stat, +}; + |