diff options
author | Johnny Qiu <joqiu@nvidia.com> | 2012-01-10 12:40:05 -0800 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2012-01-30 11:46:19 -0800 |
commit | 00ce1168fe25fa398a758c1b05dc3fc40d4fb497 (patch) | |
tree | 3e3d34c276d5e177016956bef18c1e0af7e16b16 /arch/arm/mach-tegra | |
parent | e818b6ec2c0ab3bf142291983eb0f2840f62570c (diff) |
arm: tegra: kai: create board files
Create initial board files and config files for Kai.
Reviewed-on: http://git-master/r/74441
Change-Id: I4b07607da85fe4bcb00e5fce2ddbc2a83471b1de
Signed-off-by: Johnny Qiu <joqiu@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/77296
Reviewed-by: Automatic_Commit_Validation_User
Diffstat (limited to 'arch/arm/mach-tegra')
-rw-r--r-- | arch/arm/mach-tegra/Kconfig | 7 | ||||
-rw-r--r-- | arch/arm/mach-tegra/Makefile | 7 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-kai-kbc.c | 115 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-kai-panel.c | 703 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-kai-pinmux.c | 550 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-kai-power.c | 137 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-kai-sdhci.c | 163 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-kai.c | 537 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-kai.h | 51 |
9 files changed, 2270 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index 54df114bc8a9..0d2b3b0919cb 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig @@ -151,6 +151,13 @@ config MACH_TEGRA_ENTERPRISE help Support for NVIDIA Enterprise development platform +config MACH_KAI + bool "Kai board" + depends on ARCH_TEGRA_3x_SOC + select MACH_HAS_SND_SOC_TEGRA_RT5640 if SND_SOC + help + Support for NVIDIA KAI development platform + choice prompt "Tegra platform type" default TEGRA_SILICON_PLATFORM diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index d28a72c08f8f..d9d8802f7260 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -168,6 +168,13 @@ obj-${CONFIG_MACH_TEGRA_ENTERPRISE} += board-enterprise-baseband.o obj-${CONFIG_MACH_TEGRA_ENTERPRISE} += board-enterprise-kbc.o obj-${CONFIG_MACH_TEGRA_ENTERPRISE} += board-enterprise-sensors.o +obj-${CONFIG_MACH_KAI} += board-kai.o +obj-${CONFIG_MACH_KAI} += board-kai-kbc.o +obj-${CONFIG_MACH_KAI} += board-kai-panel.o +obj-${CONFIG_MACH_KAI} += board-kai-pinmux.o +obj-${CONFIG_MACH_KAI} += board-kai-power.o +obj-${CONFIG_MACH_KAI} += board-kai-sdhci.o + obj-${CONFIG_TEGRA_BB_XMM_POWER} += baseband-xmm-power.o obj-${CONFIG_TEGRA_BB_XMM_POWER2} += baseband-xmm-power2.o diff --git a/arch/arm/mach-tegra/board-kai-kbc.c b/arch/arm/mach-tegra/board-kai-kbc.c new file mode 100644 index 000000000000..704789debf3d --- /dev/null +++ b/arch/arm/mach-tegra/board-kai-kbc.c @@ -0,0 +1,115 @@ +/* + * arch/arm/mach-tegra/board-kai-kbc.c + * Keys configuration for Nvidia tegra3 kai platform. + * + * Copyright (C) 2012 NVIDIA, Inc. + * + * 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. + * + * 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., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA + */ + +#include <linux/kernel.h> +#include <linux/platform_device.h> +#include <linux/input.h> +#include <linux/device.h> +#include <linux/gpio.h> +#include <linux/gpio_keys.h> +#include <linux/interrupt_keys.h> +#include <linux/gpio_scrollwheel.h> + +#include <mach/irqs.h> +#include <mach/io.h> +#include <mach/iomap.h> +#include <mach/kbc.h> +#include "board.h" +#include "board-kai.h" + +#include "gpio-names.h" +#include "devices.h" + +#define GPIO_KEY(_id, _gpio, _iswake) \ + { \ + .code = _id, \ + .gpio = TEGRA_GPIO_##_gpio, \ + .active_low = 1, \ + .desc = #_id, \ + .type = EV_KEY, \ + .wakeup = _iswake, \ + .debounce_interval = 10, \ + } + +static struct gpio_keys_button kai_keys[] = { + [0] = GPIO_KEY(KEY_MENU, PR2, 0), + [1] = GPIO_KEY(KEY_BACK, PQ1, 0), + [2] = GPIO_KEY(KEY_HOME, PQ0, 0), + [3] = GPIO_KEY(KEY_SEARCH, PQ3, 0), + [4] = GPIO_KEY(KEY_VOLUMEUP, PR1, 0), + [5] = GPIO_KEY(KEY_VOLUMEDOWN, PR0, 0), +}; + +static struct gpio_keys_platform_data kai_keys_platform_data = { + .buttons = kai_keys, + .nbuttons = ARRAY_SIZE(kai_keys), +}; + +static struct platform_device kai_keys_device = { + .name = "gpio-keys", + .id = 0, + .dev = { + .platform_data = &kai_keys_platform_data, + }, +}; + +#define INT_KEY(_id, _irq, _iswake, _deb_int) \ + { \ + .code = _id, \ + .irq = _irq, \ + .active_low = 1, \ + .desc = #_id, \ + .type = EV_KEY, \ + .wakeup = _iswake, \ + .debounce_interval = _deb_int, \ + } +static struct interrupt_keys_button kai_int_keys[] = { +}; + +static struct interrupt_keys_platform_data kai_int_keys_pdata = { + .int_buttons = kai_int_keys, + .nbuttons = ARRAY_SIZE(kai_int_keys), +}; + +static struct platform_device kai_int_keys_device = { + .name = "interrupt-keys", + .id = 0, + .dev = { + .platform_data = &kai_int_keys_pdata, + }, +}; + +int __init kai_keys_init(void) +{ + int i; + + pr_info("Registering gpio keys\n"); + + /* Enable gpio mode for other pins */ + for (i = 0; i < kai_keys_platform_data.nbuttons; i++) + tegra_gpio_enable(kai_keys_platform_data. + buttons[i].gpio); + + platform_device_register(&kai_keys_device); + platform_device_register(&kai_int_keys_device); + + return 0; +} diff --git a/arch/arm/mach-tegra/board-kai-panel.c b/arch/arm/mach-tegra/board-kai-panel.c new file mode 100644 index 000000000000..86a15557c3f2 --- /dev/null +++ b/arch/arm/mach-tegra/board-kai-panel.c @@ -0,0 +1,703 @@ +/* + * arch/arm/mach-tegra/board-kai-panel.c + * + * Copyright (c) 2012, NVIDIA Corporation. + * + * 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. + * + * 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/delay.h> +#include <linux/gpio.h> +#include <linux/regulator/consumer.h> +#include <linux/resource.h> +#include <asm/mach-types.h> +#include <linux/platform_device.h> +#include <linux/earlysuspend.h> +#include <linux/pwm_backlight.h> +#include <asm/atomic.h> +#include <linux/nvhost.h> +#include <mach/nvmap.h> +#include <mach/irqs.h> +#include <mach/iomap.h> +#include <mach/dc.h> +#include <mach/fb.h> + +#include "board.h" +#include "board-kai.h" +#include "devices.h" +#include "gpio-names.h" + +/* kai default display board pins */ +#define kai_lvds_avdd_en TEGRA_GPIO_PH6 +#define kai_lvds_stdby TEGRA_GPIO_PG5 +#define kai_lvds_rst TEGRA_GPIO_PG7 +#define kai_lvds_shutdown TEGRA_GPIO_PN6 +#define kai_lvds_rs TEGRA_GPIO_PH1 +#define kai_lvds_lr TEGRA_GPIO_PG1 + +/* common pins( backlight ) for all display boards */ +#define kai_bl_enb TEGRA_GPIO_PH3 +#define kai_bl_pwm TEGRA_GPIO_PH0 +#define kai_hdmi_hpd TEGRA_GPIO_PN7 + +#ifdef CONFIG_TEGRA_DC +static struct regulator *kai_hdmi_reg; +static struct regulator *kai_hdmi_pll; +static struct regulator *kai_hdmi_vddio; +#endif + +static atomic_t sd_brightness = ATOMIC_INIT(255); + +static struct regulator *kai_lvds_reg; +static struct regulator *kai_lvds_vdd_panel; + +static tegra_dc_bl_output kai_bl_output_measured = { + 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, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, + 70, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 133, + 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 148, + 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, + 165, 166, 167, 168, 169, 170, 171, 172, + 173, 174, 175, 176, 177, 179, 180, 181, + 182, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255 +}; + +static p_tegra_dc_bl_output bl_output; + +static int kai_backlight_init(struct device *dev) +{ + int ret; + + bl_output = kai_bl_output_measured; + + if (WARN_ON(ARRAY_SIZE(kai_bl_output_measured) != 256)) + pr_err("bl_output array does not have 256 elements\n"); + + tegra_gpio_disable(kai_bl_pwm); + + ret = gpio_request(kai_bl_enb, "backlight_enb"); + if (ret < 0) + return ret; + + ret = gpio_direction_output(kai_bl_enb, 1); + if (ret < 0) + gpio_free(kai_bl_enb); + else + tegra_gpio_enable(kai_bl_enb); + + return ret; +}; + +static void kai_backlight_exit(struct device *dev) +{ + /* int ret; */ + /*ret = gpio_request(kai_bl_enb, "backlight_enb");*/ + gpio_set_value(kai_bl_enb, 0); + gpio_free(kai_bl_enb); + tegra_gpio_disable(kai_bl_enb); + return; +} + +static int kai_backlight_notify(struct device *unused, int brightness) +{ + int cur_sd_brightness = atomic_read(&sd_brightness); + + /* Set the backlight GPIO pin mode to 'backlight_enable' */ + gpio_set_value(kai_bl_enb, !!brightness); + + /* SD brightness is a percentage, 8-bit value. */ + brightness = (brightness * cur_sd_brightness) / 255; + + /* Apply any backlight response curve */ + if (brightness > 255) + pr_info("Error: Brightness > 255!\n"); + else + brightness = bl_output[brightness]; + + return brightness; +} + +static int kai_disp1_check_fb(struct device *dev, struct fb_info *info); + +static struct platform_pwm_backlight_data kai_backlight_data = { + .pwm_id = 0, + .max_brightness = 255, + .dft_brightness = 224, + .pwm_period_ns = 100000, + .init = kai_backlight_init, + .exit = kai_backlight_exit, + .notify = kai_backlight_notify, + /* Only toggle backlight on fb blank notifications for disp1 */ + .check_fb = kai_disp1_check_fb, +}; + +static struct platform_device kai_backlight_device = { + .name = "pwm-backlight", + .id = -1, + .dev = { + .platform_data = &kai_backlight_data, + }, +}; + +static int kai_panel_enable(void) +{ + if (kai_lvds_reg == NULL) { + kai_lvds_reg = regulator_get(NULL, "vdd_lvds"); + if (WARN_ON(IS_ERR(kai_lvds_reg))) + pr_err("%s: couldn't get regulator vdd_lvds: %ld\n", + __func__, PTR_ERR(kai_lvds_reg)); + else + regulator_enable(kai_lvds_reg); + } + + if (kai_lvds_vdd_panel == NULL) { + kai_lvds_vdd_panel = regulator_get(NULL, "vdd_lcd_panel"); + if (WARN_ON(IS_ERR(kai_lvds_vdd_panel))) + pr_err("%s: couldn't get regulator vdd_lcd_panel: %ld\n", + __func__, PTR_ERR(kai_lvds_vdd_panel)); + else + regulator_enable(kai_lvds_vdd_panel); + } + + mdelay(5); + + gpio_set_value(kai_lvds_avdd_en, 1); + mdelay(5); + + gpio_set_value(kai_lvds_stdby, 1); + gpio_set_value(kai_lvds_rst, 1); + gpio_set_value(kai_lvds_shutdown, 1); + gpio_set_value(kai_lvds_lr, 1); + + mdelay(10); + + return 0; +} + +static int kai_panel_disable(void) +{ + gpio_set_value(kai_lvds_lr, 0); + gpio_set_value(kai_lvds_shutdown, 0); + gpio_set_value(kai_lvds_rst, 0); + gpio_set_value(kai_lvds_stdby, 0); + mdelay(5); + + gpio_set_value(kai_lvds_avdd_en, 0); + mdelay(5); + + regulator_disable(kai_lvds_reg); + regulator_put(kai_lvds_reg); + kai_lvds_reg = NULL; + + regulator_disable(kai_lvds_vdd_panel); + regulator_put(kai_lvds_vdd_panel); + kai_lvds_vdd_panel = NULL; + + return 0; +} + +#ifdef CONFIG_TEGRA_DC +static int kai_hdmi_vddio_enable(void) +{ + int ret; + if (!kai_hdmi_vddio) { + kai_hdmi_vddio = regulator_get(NULL, "vdd_hdmi_con"); + if (IS_ERR_OR_NULL(kai_hdmi_vddio)) { + ret = PTR_ERR(kai_hdmi_vddio); + pr_err("hdmi: couldn't get regulator vdd_hdmi_con\n"); + kai_hdmi_vddio = NULL; + return ret; + } + } + ret = regulator_enable(kai_hdmi_vddio); + if (ret < 0) { + pr_err("hdmi: couldn't enable regulator vdd_hdmi_con\n"); + regulator_put(kai_hdmi_vddio); + kai_hdmi_vddio = NULL; + return ret; + } + return ret; +} + +static int kai_hdmi_vddio_disable(void) +{ + if (kai_hdmi_vddio) { + regulator_disable(kai_hdmi_vddio); + regulator_put(kai_hdmi_vddio); + kai_hdmi_vddio = NULL; + } + return 0; +} + +static int kai_hdmi_enable(void) +{ + int ret; + if (!kai_hdmi_reg) { + kai_hdmi_reg = regulator_get(NULL, "avdd_hdmi"); + if (IS_ERR_OR_NULL(kai_hdmi_reg)) { + pr_err("hdmi: couldn't get regulator avdd_hdmi\n"); + kai_hdmi_reg = NULL; + return PTR_ERR(kai_hdmi_reg); + } + } + ret = regulator_enable(kai_hdmi_reg); + if (ret < 0) { + pr_err("hdmi: couldn't enable regulator avdd_hdmi\n"); + return ret; + } + if (!kai_hdmi_pll) { + kai_hdmi_pll = regulator_get(NULL, "avdd_hdmi_pll"); + if (IS_ERR_OR_NULL(kai_hdmi_pll)) { + pr_err("hdmi: couldn't get regulator avdd_hdmi_pll\n"); + kai_hdmi_pll = NULL; + regulator_put(kai_hdmi_reg); + kai_hdmi_reg = NULL; + return PTR_ERR(kai_hdmi_pll); + } + } + ret = regulator_enable(kai_hdmi_pll); + if (ret < 0) { + pr_err("hdmi: couldn't enable regulator avdd_hdmi_pll\n"); + return ret; + } + return 0; +} + +static int kai_hdmi_disable(void) +{ + regulator_disable(kai_hdmi_reg); + regulator_put(kai_hdmi_reg); + kai_hdmi_reg = NULL; + + regulator_disable(kai_hdmi_pll); + regulator_put(kai_hdmi_pll); + kai_hdmi_pll = NULL; + return 0; +} + +static struct resource kai_disp1_resources[] = { + { + .name = "irq", + .start = INT_DISPLAY_GENERAL, + .end = INT_DISPLAY_GENERAL, + .flags = IORESOURCE_IRQ, + }, + { + .name = "regs", + .start = TEGRA_DISPLAY_BASE, + .end = TEGRA_DISPLAY_BASE + TEGRA_DISPLAY_SIZE-1, + .flags = IORESOURCE_MEM, + }, + { + .name = "fbmem", + .start = 0, /* Filled in by kai_panel_init() */ + .end = 0, /* Filled in by kai_panel_init() */ + .flags = IORESOURCE_MEM, + }, +}; + +static struct resource kai_disp2_resources[] = { + { + .name = "irq", + .start = INT_DISPLAY_B_GENERAL, + .end = INT_DISPLAY_B_GENERAL, + .flags = IORESOURCE_IRQ, + }, + { + .name = "regs", + .start = TEGRA_DISPLAY2_BASE, + .end = TEGRA_DISPLAY2_BASE + TEGRA_DISPLAY2_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + { + .name = "fbmem", + .flags = IORESOURCE_MEM, + .start = 0, + .end = 0, + }, + { + .name = "hdmi_regs", + .start = TEGRA_HDMI_BASE, + .end = TEGRA_HDMI_BASE + TEGRA_HDMI_SIZE - 1, + .flags = IORESOURCE_MEM, + }, +}; +#endif + +static struct tegra_dc_mode kai_panel_modes[] = { + { + /* 1024x600@60Hz */ + .pclk = 51206000, + .h_ref_to_sync = 11, + .v_ref_to_sync = 1, + .h_sync_width = 10, + .v_sync_width = 5, + .h_back_porch = 10, + .v_back_porch = 15, + .h_active = 1024, + .v_active = 600, + .h_front_porch = 300, + .v_front_porch = 15, + }, +}; + +static struct tegra_dc_sd_settings kai_sd_settings = { + .enable = 1, /* enabled by default. */ + .use_auto_pwm = false, + .hw_update_delay = 0, + .bin_width = -1, + .aggressiveness = 1, + .phase_in_adjustments = true, + .use_vid_luma = false, + /* Default video coefficients */ + .coeff = {5, 9, 2}, + .fc = {0, 0}, + /* Immediate backlight changes */ + .blp = {1024, 255}, + /* Gammas: R: 2.2 G: 2.2 B: 2.2 */ + /* Default BL TF */ + .bltf = { + { + {57, 65, 74, 83}, + {93, 103, 114, 126}, + {138, 151, 165, 179}, + {194, 209, 225, 242}, + }, + { + {58, 66, 75, 84}, + {94, 105, 116, 127}, + {140, 153, 166, 181}, + {196, 211, 227, 244}, + }, + { + {60, 68, 77, 87}, + {97, 107, 119, 130}, + {143, 156, 170, 184}, + {199, 215, 231, 248}, + }, + { + {64, 73, 82, 91}, + {102, 113, 124, 137}, + {149, 163, 177, 192}, + {207, 223, 240, 255}, + }, + }, + /* Default LUT */ + .lut = { + { + {250, 250, 250}, + {194, 194, 194}, + {149, 149, 149}, + {113, 113, 113}, + {82, 82, 82}, + {56, 56, 56}, + {34, 34, 34}, + {15, 15, 15}, + {0, 0, 0}, + }, + { + {246, 246, 246}, + {191, 191, 191}, + {147, 147, 147}, + {111, 111, 111}, + {80, 80, 80}, + {55, 55, 55}, + {33, 33, 33}, + {14, 14, 14}, + {0, 0, 0}, + }, + { + {239, 239, 239}, + {185, 185, 185}, + {142, 142, 142}, + {107, 107, 107}, + {77, 77, 77}, + {52, 52, 52}, + {30, 30, 30}, + {12, 12, 12}, + {0, 0, 0}, + }, + { + {224, 224, 224}, + {173, 173, 173}, + {133, 133, 133}, + {99, 99, 99}, + {70, 70, 70}, + {46, 46, 46}, + {25, 25, 25}, + {7, 7, 7}, + {0, 0, 0}, + }, + }, + .sd_brightness = &sd_brightness, + .bl_device = &kai_backlight_device, +}; + +#ifdef CONFIG_TEGRA_DC +static struct tegra_fb_data kai_fb_data = { + .win = 0, + .xres = 1024, + .yres = 600, + .bits_per_pixel = 32, + .flags = TEGRA_FB_FLIP_ON_PROBE, +}; + +static struct tegra_fb_data kai_hdmi_fb_data = { + .win = 0, + .xres = 1024, + .yres = 600, + .bits_per_pixel = 32, + .flags = TEGRA_FB_FLIP_ON_PROBE, +}; + +static struct tegra_dc_out kai_disp2_out = { + .type = TEGRA_DC_OUT_HDMI, + .flags = TEGRA_DC_OUT_HOTPLUG_HIGH, + + .dcc_bus = 3, + .hotplug_gpio = kai_hdmi_hpd, + + .max_pixclock = KHZ2PICOS(148500), + + .align = TEGRA_DC_ALIGN_MSB, + .order = TEGRA_DC_ORDER_RED_BLUE, + + .enable = kai_hdmi_enable, + .disable = kai_hdmi_disable, + + .postsuspend = kai_hdmi_vddio_disable, + .hotplug_init = kai_hdmi_vddio_enable, +}; + +static struct tegra_dc_platform_data kai_disp2_pdata = { + .flags = 0, + .default_out = &kai_disp2_out, + .fb = &kai_hdmi_fb_data, + .emc_clk_rate = 300000000, +}; +#endif + +static struct tegra_dc_out kai_disp1_out = { + .align = TEGRA_DC_ALIGN_MSB, + .order = TEGRA_DC_ORDER_RED_BLUE, + .sd_settings = &kai_sd_settings, + .parent_clk = "pll_p", + + .type = TEGRA_DC_OUT_RGB, + .depth = 18, + .dither = TEGRA_DC_ORDERED_DITHER, + + .modes = kai_panel_modes, + .n_modes = ARRAY_SIZE(kai_panel_modes), + + .enable = kai_panel_enable, + .disable = kai_panel_disable, +}; + +#ifdef CONFIG_TEGRA_DC +static struct tegra_dc_platform_data kai_disp1_pdata = { + .flags = TEGRA_DC_FLAG_ENABLED, + .default_out = &kai_disp1_out, + .emc_clk_rate = 300000000, + .fb = &kai_fb_data, +}; + +static struct nvhost_device kai_disp1_device = { + .name = "tegradc", + .id = 0, + .resource = kai_disp1_resources, + .num_resources = ARRAY_SIZE(kai_disp1_resources), + .dev = { + .platform_data = &kai_disp1_pdata, + }, +}; + +static int kai_disp1_check_fb(struct device *dev, struct fb_info *info) +{ + return info->device == &kai_disp1_device.dev; +} + +static struct nvhost_device kai_disp2_device = { + .name = "tegradc", + .id = 1, + .resource = kai_disp2_resources, + .num_resources = ARRAY_SIZE(kai_disp2_resources), + .dev = { + .platform_data = &kai_disp2_pdata, + }, +}; +#else +static int kai_disp1_check_fb(struct device *dev, struct fb_info *info) +{ + return 0; +} +#endif + +static struct nvmap_platform_carveout kai_carveouts[] = { + [0] = NVMAP_HEAP_CARVEOUT_IRAM_INIT, + [1] = { + .name = "generic-0", + .usage_mask = NVMAP_HEAP_CARVEOUT_GENERIC, + .base = 0, /* Filled in by kai_panel_init() */ + .size = 0, /* Filled in by kai_panel_init() */ + .buddy_size = SZ_32K, + }, +}; + +static struct nvmap_platform_data kai_nvmap_data = { + .carveouts = kai_carveouts, + .nr_carveouts = ARRAY_SIZE(kai_carveouts), +}; + +static struct platform_device kai_nvmap_device = { + .name = "tegra-nvmap", + .id = -1, + .dev = { + .platform_data = &kai_nvmap_data, + }, +}; + + +static struct platform_device *kai_gfx_devices[] __initdata = { + &kai_nvmap_device, +#ifdef CONFIG_TEGRA_GRHOST + &tegra_grhost_device, +#endif + &tegra_pwfm0_device, + &kai_backlight_device, +}; + + +#ifdef CONFIG_HAS_EARLYSUSPEND +/* put early_suspend/late_resume handlers here for the display in order + * to keep the code out of the display driver, keeping it closer to upstream + */ +struct early_suspend kai_panel_early_suspender; + +static void kai_panel_early_suspend(struct early_suspend *h) +{ + /* power down LCD, add use a black screen for HDMI */ + if (num_registered_fb > 0) + fb_blank(registered_fb[0], FB_BLANK_POWERDOWN); + if (num_registered_fb > 1) + fb_blank(registered_fb[1], FB_BLANK_NORMAL); +} + +static void kai_panel_late_resume(struct early_suspend *h) +{ + unsigned i; + for (i = 0; i < num_registered_fb; i++) + fb_blank(registered_fb[i], FB_BLANK_UNBLANK); +} +#endif + +int __init kai_panel_init(void) +{ + int err; + struct resource __maybe_unused *res; + + kai_carveouts[1].base = tegra_carveout_start; + kai_carveouts[1].size = tegra_carveout_size; + + gpio_request(kai_lvds_avdd_en, "lvds_avdd_en"); + gpio_direction_output(kai_lvds_avdd_en, 1); + tegra_gpio_enable(kai_lvds_avdd_en); + + gpio_request(kai_lvds_stdby, "lvds_stdby"); + gpio_direction_output(kai_lvds_stdby, 1); + tegra_gpio_enable(kai_lvds_stdby); + + gpio_request(kai_lvds_rst, "lvds_rst"); + gpio_direction_output(kai_lvds_rst, 1); + tegra_gpio_enable(kai_lvds_rst); + + gpio_request(kai_lvds_rs, "lvds_rs"); + gpio_direction_output(kai_lvds_rs, 0); + tegra_gpio_enable(kai_lvds_rs); + + gpio_request(kai_lvds_lr, "lvds_lr"); + gpio_direction_output(kai_lvds_lr, 1); + tegra_gpio_enable(kai_lvds_lr); + + gpio_request(kai_lvds_shutdown, "lvds_shutdown"); + gpio_direction_output(kai_lvds_shutdown, 1); + tegra_gpio_enable(kai_lvds_shutdown); + + tegra_gpio_enable(kai_hdmi_hpd); + gpio_request(kai_hdmi_hpd, "hdmi_hpd"); + gpio_direction_input(kai_hdmi_hpd); + +#ifdef CONFIG_HAS_EARLYSUSPEND + kai_panel_early_suspender.suspend = kai_panel_early_suspend; + kai_panel_early_suspender.resume = kai_panel_late_resume; + kai_panel_early_suspender.level = EARLY_SUSPEND_LEVEL_DISABLE_FB; + register_early_suspend(&kai_panel_early_suspender); +#endif + + err = platform_add_devices(kai_gfx_devices, + ARRAY_SIZE(kai_gfx_devices)); + +#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC) + res = nvhost_get_resource_byname(&kai_disp1_device, + IORESOURCE_MEM, "fbmem"); + res->start = tegra_fb_start; + res->end = tegra_fb_start + tegra_fb_size - 1; +#endif + + /* Copy the bootloader fb to the fb. */ + tegra_move_framebuffer(tegra_fb_start, tegra_bootloader_fb_start, + min(tegra_fb_size, tegra_bootloader_fb_size)); + +#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC) + if (!err) + err = nvhost_device_register(&kai_disp1_device); + + res = nvhost_get_resource_byname(&kai_disp2_device, + IORESOURCE_MEM, "fbmem"); + res->start = tegra_fb2_start; + res->end = tegra_fb2_start + tegra_fb2_size - 1; + if (!err) + err = nvhost_device_register(&kai_disp2_device); +#endif + +#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_NVAVP) + if (!err) + err = nvhost_device_register(&nvavp_device); +#endif + return err; +} diff --git a/arch/arm/mach-tegra/board-kai-pinmux.c b/arch/arm/mach-tegra/board-kai-pinmux.c new file mode 100644 index 000000000000..2288003d26de --- /dev/null +++ b/arch/arm/mach-tegra/board-kai-pinmux.c @@ -0,0 +1,550 @@ +/* + * arch/arm/mach-tegra/board-kai-pinmux.c + * + * Copyright (C) 2012 NVIDIA Corporation + * + * 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 <mach/pinmux.h> +#include "board.h" +#include "board-kai.h" +#include "gpio-names.h" + +#define DEFAULT_DRIVE(_name) \ + { \ + .pingroup = TEGRA_DRIVE_PINGROUP_##_name, \ + .hsm = TEGRA_HSM_DISABLE, \ + .schmitt = TEGRA_SCHMITT_ENABLE, \ + .drive = TEGRA_DRIVE_DIV_1, \ + .pull_down = TEGRA_PULL_31, \ + .pull_up = TEGRA_PULL_31, \ + .slew_rising = TEGRA_SLEW_SLOWEST, \ + .slew_falling = TEGRA_SLEW_SLOWEST, \ + } +/* Setting the drive strength of pins + * hsm: Enable High speed mode (ENABLE/DISABLE) + * Schimit: Enable/disable schimit (ENABLE/DISABLE) + * drive: low power mode (DIV_1, DIV_2, DIV_4, DIV_8) + * pulldn_drive - drive down (falling edge) - Driver Output Pull-Down drive + * strength code. Value from 0 to 31. + * pullup_drive - drive up (rising edge) - Driver Output Pull-Up drive + * strength code. Value from 0 to 31. + * pulldn_slew - Driver Output Pull-Up slew control code - 2bit code + * code 11 is least slewing of signal. code 00 is highest + * slewing of the signal. + * Value - FASTEST, FAST, SLOW, SLOWEST + * pullup_slew - Driver Output Pull-Down slew control code - + * code 11 is least slewing of signal. code 00 is highest + * slewing of the signal. + * Value - FASTEST, FAST, SLOW, SLOWEST + */ +#define SET_DRIVE(_name, _hsm, _schmitt, _drive, _pulldn_drive, _pullup_drive, _pulldn_slew, _pullup_slew) \ + { \ + .pingroup = TEGRA_DRIVE_PINGROUP_##_name, \ + .hsm = TEGRA_HSM_##_hsm, \ + .schmitt = TEGRA_SCHMITT_##_schmitt, \ + .drive = TEGRA_DRIVE_##_drive, \ + .pull_down = TEGRA_PULL_##_pulldn_drive, \ + .pull_up = TEGRA_PULL_##_pullup_drive, \ + .slew_rising = TEGRA_SLEW_##_pulldn_slew, \ + .slew_falling = TEGRA_SLEW_##_pullup_slew, \ + } + +/* !!!FIXME!!!! POPULATE THIS TABLE */ +static __initdata struct tegra_drive_pingroup_config kai_drive_pinmux[] = { + /* DEFAULT_DRIVE(<pin_group>), */ + /* SET_DRIVE(ATA, DISABLE, DISABLE, DIV_1, 31, 31, FAST, FAST) */ + SET_DRIVE(DAP2, DISABLE, ENABLE, DIV_1, 31, 31, FASTEST, FASTEST), + + /* All I2C pins are driven to maximum drive strength */ + /* GEN1 I2C */ + SET_DRIVE(DBG, DISABLE, ENABLE, DIV_1, 31, 31, FASTEST, FASTEST), + + /* GEN2 I2C */ + SET_DRIVE(AT5, DISABLE, ENABLE, DIV_1, 31, 31, FASTEST, FASTEST), + + /* CAM I2C */ + SET_DRIVE(GME, DISABLE, ENABLE, DIV_1, 31, 31, FASTEST, FASTEST), + + /* DDC I2C */ + SET_DRIVE(DDC, DISABLE, ENABLE, DIV_1, 31, 31, FASTEST, FASTEST), + + /* PWR_I2C */ + SET_DRIVE(AO1, DISABLE, ENABLE, DIV_1, 31, 31, FASTEST, FASTEST), + + /* UART3 */ + SET_DRIVE(UART3, DISABLE, ENABLE, DIV_1, 31, 31, FASTEST, FASTEST), + + /* SDMMC1 */ + SET_DRIVE(SDIO1, DISABLE, DISABLE, DIV_1, 46, 42, FAST, FAST), + + /* SDMMC3 */ + SET_DRIVE(SDIO3, DISABLE, DISABLE, DIV_1, 46, 42, FAST, FAST), + + /* SDMMC4 */ + SET_DRIVE(GMA, DISABLE, DISABLE, DIV_1, 9, 9, SLOWEST, SLOWEST), + SET_DRIVE(GMB, DISABLE, DISABLE, DIV_1, 9, 9, SLOWEST, SLOWEST), + SET_DRIVE(GMC, DISABLE, DISABLE, DIV_1, 9, 9, SLOWEST, SLOWEST), + SET_DRIVE(GMD, DISABLE, DISABLE, DIV_1, 9, 9, SLOWEST, SLOWEST), + +}; + +#define DEFAULT_PINMUX(_pingroup, _mux, _pupd, _tri, _io) \ + { \ + .pingroup = TEGRA_PINGROUP_##_pingroup, \ + .func = TEGRA_MUX_##_mux, \ + .pupd = TEGRA_PUPD_##_pupd, \ + .tristate = TEGRA_TRI_##_tri, \ + .io = TEGRA_PIN_##_io, \ + .lock = TEGRA_PIN_LOCK_DEFAULT, \ + .od = TEGRA_PIN_OD_DEFAULT, \ + .ioreset = TEGRA_PIN_IO_RESET_DEFAULT, \ + } + +#define I2C_PINMUX(_pingroup, _mux, _pupd, _tri, _io, _lock, _od) \ + { \ + .pingroup = TEGRA_PINGROUP_##_pingroup, \ + .func = TEGRA_MUX_##_mux, \ + .pupd = TEGRA_PUPD_##_pupd, \ + .tristate = TEGRA_TRI_##_tri, \ + .io = TEGRA_PIN_##_io, \ + .lock = TEGRA_PIN_LOCK_##_lock, \ + .od = TEGRA_PIN_OD_##_od, \ + .ioreset = TEGRA_PIN_IO_RESET_DEFAULT, \ + } + +#define VI_PINMUX(_pingroup, _mux, _pupd, _tri, _io, _lock, _ioreset) \ + { \ + .pingroup = TEGRA_PINGROUP_##_pingroup, \ + .func = TEGRA_MUX_##_mux, \ + .pupd = TEGRA_PUPD_##_pupd, \ + .tristate = TEGRA_TRI_##_tri, \ + .io = TEGRA_PIN_##_io, \ + .lock = TEGRA_PIN_LOCK_##_lock, \ + .od = TEGRA_PIN_OD_DEFAULT, \ + .ioreset = TEGRA_PIN_IO_RESET_##_ioreset \ + } + +static __initdata struct tegra_pingroup_config kai_pinmux_common[] = { + /* SDMMC1 pinmux */ + DEFAULT_PINMUX(SDMMC1_CLK, SDMMC1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC1_CMD, SDMMC1, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC1_DAT3, SDMMC1, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC1_DAT2, SDMMC1, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC1_DAT1, SDMMC1, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC1_DAT0, SDMMC1, PULL_UP, NORMAL, INPUT), + + /* SDMMC3 pinmux */ + DEFAULT_PINMUX(SDMMC3_CLK, SDMMC3, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC3_CMD, SDMMC3, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC3_DAT0, SDMMC3, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC3_DAT1, SDMMC3, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC3_DAT2, SDMMC3, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC3_DAT3, SDMMC3, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC3_DAT6, SDMMC3, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC3_DAT7, SDMMC3, PULL_UP, NORMAL, INPUT), + + /* SDMMC4 pinmux */ + DEFAULT_PINMUX(SDMMC4_CLK, SDMMC4, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_CMD, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT0, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT1, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT2, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT3, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT4, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT5, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT6, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT7, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_RST_N, RSVD1, PULL_DOWN, NORMAL, INPUT), + + /* I2C1 pinmux */ + I2C_PINMUX(GEN1_I2C_SCL, I2C1, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + I2C_PINMUX(GEN1_I2C_SDA, I2C1, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + + /* I2C2 pinmux */ + I2C_PINMUX(GEN2_I2C_SCL, I2C2, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + I2C_PINMUX(GEN2_I2C_SDA, I2C2, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + + /* I2C3 pinmux */ + I2C_PINMUX(CAM_I2C_SCL, I2C3, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + I2C_PINMUX(CAM_I2C_SDA, I2C3, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + + /* I2C4 pinmux */ + I2C_PINMUX(DDC_SCL, I2C4, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + I2C_PINMUX(DDC_SDA, I2C4, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + + /* Power I2C pinmux */ + I2C_PINMUX(PWR_I2C_SCL, I2CPWR, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + I2C_PINMUX(PWR_I2C_SDA, I2CPWR, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + + /* LCD */ + DEFAULT_PINMUX(LCD_PCLK, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_DE, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_HSYNC, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_VSYNC, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D0, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D1, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D2, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D3, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D4, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D5, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D6, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D7, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D8, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D9, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D10, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D11, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D12, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D13, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D14, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D15, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D16, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D17, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D18, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D19, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D20, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D21, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D22, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D23, DISPLAYA, NORMAL, NORMAL, INPUT), + + /* UART B : GPS */ + DEFAULT_PINMUX(UART2_RXD, IRDA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(UART2_TXD, IRDA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(UART2_RTS_N, UARTB, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(UART2_CTS_N, UARTB, NORMAL, NORMAL, INPUT), + + /*UART C : BT */ + DEFAULT_PINMUX(UART3_TXD, UARTC, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(UART3_RXD, UARTC, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(UART3_CTS_N, UARTC, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(UART3_RTS_N, UARTC, NORMAL, NORMAL, OUTPUT), + + /* UART D : DEBUG */ + DEFAULT_PINMUX(GMI_A16, UARTD, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_A17, UARTD, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GMI_A18, UARTD, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GMI_A19, UARTD, NORMAL, NORMAL, OUTPUT), + + /* KBC keys */ + DEFAULT_PINMUX(KB_COL0, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_COL1, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_COL2, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_COL3, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_ROW0, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_ROW1, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_ROW2, KBC, PULL_UP, NORMAL, INPUT), + + /* I2S0 : for MODEM */ + DEFAULT_PINMUX(DAP1_FS, I2S0, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP1_DIN, I2S0, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP1_DOUT, I2S0, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP1_SCLK, I2S0, NORMAL, NORMAL, INPUT), + + /* I2S1 : for CODEC */ + DEFAULT_PINMUX(DAP2_FS, I2S1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP2_DIN, I2S1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP2_DOUT, I2S1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP2_SCLK, I2S1, NORMAL, NORMAL, INPUT), + + /* I2S3 : for BT */ + DEFAULT_PINMUX(DAP4_FS, I2S3, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP4_DIN, I2S3, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP4_DOUT, I2S3, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP4_SCLK, I2S3, NORMAL, NORMAL, INPUT), + + /* SPI1 : touch */ + DEFAULT_PINMUX(SPI1_MOSI, SPI1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(SPI1_SCK, SPI1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(SPI1_CS0_N, SPI1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(SPI1_MISO, SPI1, NORMAL, NORMAL, INPUT), + + /* SPIDIF */ + DEFAULT_PINMUX(SPDIF_IN, SPDIF, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(SPDIF_OUT, SPDIF, NORMAL, NORMAL, OUTPUT), + + /* FIXED FUNCTION AND CONFIGURATION */ + DEFAULT_PINMUX(CLK_32K_OUT, BLINK, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(SYS_CLK_REQ, SYSCLK, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(OWR, OWR, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GMI_AD4, RSVD1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(CLK1_OUT, EXTPERIPH1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(CLK2_OUT, EXTPERIPH2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(CLK3_OUT, EXTPERIPH3, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(CLK2_REQ, DAP, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(HDMI_INT, RSVD0, NORMAL, TRISTATE, INPUT), + + /* GPIO */ + /* POWER RAIL GPIO */ + DEFAULT_PINMUX(DAP3_FS, I2S2, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_AD14, RSVD1, PULL_DOWN, NORMAL, OUTPUT), + DEFAULT_PINMUX(SDMMC3_DAT5, SDMMC3, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(KB_ROW6, KBC, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(KB_ROW7, KBC, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(LCD_M1, DISPLAYA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(LCD_PWR0, DISPLAYA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(LCD_PWR1, DISPLAYA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(LCD_PWR2, DISPLAYA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(KB_ROW8, KBC, NORMAL, NORMAL, OUTPUT), + + /* CAMERA */ + DEFAULT_PINMUX(CAM_MCLK, VI_ALT2, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PCC1, RSVD1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PBB0, RSVD1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PBB3, VGP3, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PBB5, VGP5, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PBB6, VGP6, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PBB7, I2S4, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PCC2, I2S4, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(KB_ROW4, KBC, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(KB_ROW5, KBC, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(KB_ROW9, KBC, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(KB_ROW10, KBC, NORMAL, NORMAL, OUTPUT), + + /* MODEM */ + DEFAULT_PINMUX(GPIO_PV0, RSVD, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PV1, RSVD, NORMAL, NORMAL, INPUT), + + /* GPS and BT */ + DEFAULT_PINMUX(GPIO_PU0, RSVD1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PU1, RSVD1, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GPIO_PU2, RSVD1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PU3, RSVD1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PU4, PWM1, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GPIO_PU5, PWM2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PU6, RSVD1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(KB_ROW14, KBC, NORMAL, TRISTATE, OUTPUT), + + /* LCD GPIO */ + DEFAULT_PINMUX(GMI_AD0, RSVD1, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_AD1, RSVD1, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_AD2, RSVD1, PULL_DOWN, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_AD3, RSVD1, PULL_DOWN, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_AD5, RSVD1, PULL_DOWN, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_AD6, RSVD1, PULL_DOWN, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_AD7, RSVD1, PULL_DOWN, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_AD8, PWM0, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_AD9, RSVD2, PULL_DOWN, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_AD11, PWM3, NORMAL, NORMAL, OUTPUT), + + /* TOUCH */ + DEFAULT_PINMUX(GMI_WAIT, RSVD1, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(GMI_WP_N, RSVD1, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_SDOUT, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_DC1, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_WR_N, DISPLAYA, PULL_UP, NORMAL, INPUT), + + /* SDMMC */ + DEFAULT_PINMUX(GMI_IORDY, RSVD1, PULL_UP, NORMAL, INPUT), + + /* CODEC */ + DEFAULT_PINMUX(SPI2_SCK, SPI2, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(SPI2_CS1_N, SPI2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GMI_CS2_N, RSVD1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GMI_CS3_N, RSVD1, NORMAL, NORMAL, INPUT), + + /* OTHERS */ + DEFAULT_PINMUX(KB_ROW3, KBC, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_DQS, RSVD1, NORMAL, NORMAL, INPUT), + + DEFAULT_PINMUX(GMI_AD15, RSVD1, PULL_UP, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_CLK, RSVD1, PULL_UP, NORMAL, INPUT), + + DEFAULT_PINMUX(GMI_RST_N, NAND, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(LCD_DC0, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_CS0_N, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_CS1_N, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_SCK, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_SDIN, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(CRT_HSYNC, CRT, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(CRT_VSYNC, CRT, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(PEX_WAKE_N, PCIE, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(PEX_L2_PRSNT_N, PCIE, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(PEX_L2_RST_N, PCIE, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(PEX_L2_CLKREQ_N, PCIE, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(HDMI_CEC, CEC, NORMAL, NORMAL, INPUT), + + DEFAULT_PINMUX(KB_ROW15, KBC, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(SPI2_CS2_N, SPI2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(SPI2_MISO, SPI2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(SPI2_MOSI, SPI2, NORMAL, NORMAL, INPUT), + + DEFAULT_PINMUX(KB_ROW11, KBC, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(KB_ROW12, KBC, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(KB_ROW13, KBC, NORMAL, TRISTATE, OUTPUT), +}; + +/*Do not use for now*/ +static __initdata struct tegra_pingroup_config unused_pins_lowpower[] = { + DEFAULT_PINMUX(ULPI_CLK, ULPI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(ULPI_DATA0, ULPI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(ULPI_DATA1, ULPI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(ULPI_DATA2, ULPI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(ULPI_DATA3, ULPI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(ULPI_DATA4, ULPI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(ULPI_DATA5, ULPI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(ULPI_DATA6, ULPI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(ULPI_DATA7, ULPI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(ULPI_DIR, ULPI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(ULPI_NXT, ULPI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(ULPI_STP, ULPI, NORMAL, TRISTATE, OUTPUT), + + DEFAULT_PINMUX(GMI_AD10, PWM2, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_AD12, RSVD1, NORMAL, TRISTATE, INPUT), + DEFAULT_PINMUX(GMI_AD13, RSVD1, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(CLK1_REQ, DAP, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_ADV_N, RSVD1, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_CS0_N, RSVD1, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_CS1_N, RSVD1, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_CS4_N, RSVD1, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_CS6_N, NAND, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_CS7_N, NAND, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_OE_N, RSVD1, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_WR_N, RSVD1, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(PEX_L0_CLKREQ_N, PCIE, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(PEX_L0_PRSNT_N, PCIE, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(PEX_L0_RST_N, PCIE, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(PEX_L1_CLKREQ_N, PCIE, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(PEX_L1_PRSNT_N, PCIE, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(PEX_L1_RST_N, PCIE, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GPIO_PV2, OWR, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GPIO_PV3, RSVD1, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(HDMI_CEC, CEC, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(KB_COL4, KBC, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(KB_COL5, KBC, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(KB_COL6, KBC, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(KB_COL7, KBC, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(CLK3_REQ, DEV3, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_D0, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_D1, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_D10, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_D11, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_D2, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_D3, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_D4, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_D5, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_D6, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_D7, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_D8, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_D9, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_HSYNC, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_MCLK, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_PCLK, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(VI_VSYNC, VI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(DAP3_DIN, I2S2, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(DAP3_DOUT, I2S2, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(DAP3_SCLK, I2S2, NORMAL, TRISTATE, OUTPUT), + +}; + +/* We are disabling this code for now. */ +#define GPIO_INIT_PIN_MODE(_gpio, _is_input, _value) \ + { \ + .gpio_nr = _gpio, \ + .is_input = _is_input, \ + .value = _value, \ + } + +static struct gpio_init_pin_info init_gpio_mode_kai_common[] = { + GPIO_INIT_PIN_MODE(TEGRA_GPIO_PDD7, false, 0), + GPIO_INIT_PIN_MODE(TEGRA_GPIO_PCC6, false, 0), +}; + +static void __init kai_gpio_init_configure(void) +{ + int len; + int i; + struct gpio_init_pin_info *pins_info; + + len = ARRAY_SIZE(init_gpio_mode_kai_common); + pins_info = init_gpio_mode_kai_common; + + for (i = 0; i < len; ++i) { + tegra_gpio_init_configure(pins_info->gpio_nr, + pins_info->is_input, pins_info->value); + pins_info++; + } +} + +int __init kai_pinmux_init(void) +{ + kai_gpio_init_configure(); + + tegra_pinmux_config_table(kai_pinmux_common, ARRAY_SIZE(kai_pinmux_common)); + tegra_drive_pinmux_config_table(kai_drive_pinmux, + ARRAY_SIZE(kai_drive_pinmux)); + + tegra_pinmux_config_table(unused_pins_lowpower, + ARRAY_SIZE(unused_pins_lowpower)); + + return 0; +} + +#define PIN_GPIO_LPM(_name, _gpio, _is_input, _value) \ + { \ + .name = _name, \ + .gpio_nr = _gpio, \ + .is_gpio = true, \ + .is_input = _is_input, \ + .value = _value, \ + } + +struct gpio_init_pin_info pin_lpm_kai_common[] = { + PIN_GPIO_LPM("GMI_CS4_N", TEGRA_GPIO_PK2, 1, 0), + PIN_GPIO_LPM("GMI_CS7", TEGRA_GPIO_PI6, 1, 0), + PIN_GPIO_LPM("GMI_CS0", TEGRA_GPIO_PJ0, 1, 0), + PIN_GPIO_LPM("GMI_CS1", TEGRA_GPIO_PJ2, 1, 0), +}; + +static void set_unused_pin_gpio(struct gpio_init_pin_info *lpm_pin_info, + int list_count) +{ + int i; + struct gpio_init_pin_info *pin_info; + int ret; + + for (i = 0; i < list_count; ++i) { + pin_info = (struct gpio_init_pin_info *)(lpm_pin_info + i); + if (!pin_info->is_gpio) + continue; + + ret = gpio_request(pin_info->gpio_nr, pin_info->name); + if (ret < 0) { + pr_err("%s() Error in gpio_request() for gpio %d\n", + __func__, pin_info->gpio_nr); + continue; + } + if (pin_info->is_input) + ret = gpio_direction_input(pin_info->gpio_nr); + else + ret = gpio_direction_output(pin_info->gpio_nr, + pin_info->value); + if (ret < 0) { + pr_err("%s() Error in setting gpio %d to in/out\n", + __func__, pin_info->gpio_nr); + gpio_free(pin_info->gpio_nr); + continue; + } + tegra_gpio_enable(pin_info->gpio_nr); + } +} + +/* Initialize the pins to desired state as per power/asic/system-eng + * recomendation */ +int __init kai_pins_state_init(void) +{ + set_unused_pin_gpio(&pin_lpm_kai_common[0], + ARRAY_SIZE(pin_lpm_kai_common)); + + return 0; +} diff --git a/arch/arm/mach-tegra/board-kai-power.c b/arch/arm/mach-tegra/board-kai-power.c new file mode 100644 index 000000000000..43d7229100f0 --- /dev/null +++ b/arch/arm/mach-tegra/board-kai-power.c @@ -0,0 +1,137 @@ +/* + * arch/arm/mach-tegra/board-kai-power.c + * + * Copyright (C) 2012 NVIDIA, Inc. + * + * 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. + * + * 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., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA + */ +#include <linux/i2c.h> +#include <linux/pda_power.h> +#include <linux/platform_device.h> +#include <linux/resource.h> +#include <linux/regulator/machine.h> +#include <linux/gpio.h> +#include <linux/io.h> +#include <linux/regulator/gpio-switch-regulator.h> +#include <linux/power/gpio-charger.h> + +#include <asm/mach-types.h> + +#include <mach/iomap.h> +#include <mach/irqs.h> +#include <mach/pinmux.h> +#include <mach/edp.h> + +#include "gpio-names.h" +#include "board.h" +#include "board-kai.h" +#include "pm.h" +#include "wakeups-t3.h" +#include "tegra3_tsensor.h" + +#define PMC_CTRL 0x0 +#define PMC_CTRL_INTR_LOW (1 << 17) + +int __init kai_regulator_init(void) +{ + void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE); + u32 pmc_ctrl; + + /* configure the power management controller to trigger PMU + * interrupts when low */ + + pmc_ctrl = readl(pmc + PMC_CTRL); + writel(pmc_ctrl | PMC_CTRL_INTR_LOW, pmc + PMC_CTRL); + + return 0; +} + +static void kai_board_suspend(int lp_state, enum suspend_stage stg) +{ + if ((lp_state == TEGRA_SUSPEND_LP1) && (stg == TEGRA_SUSPEND_BEFORE_CPU)) + tegra_console_uart_suspend(); +} + +static void kai_board_resume(int lp_state, enum resume_stage stg) +{ + if ((lp_state == TEGRA_SUSPEND_LP1) && (stg == TEGRA_RESUME_AFTER_CPU)) + tegra_console_uart_resume(); +} + +static struct tegra_suspend_platform_data kai_suspend_data = { + .cpu_timer = 2000, + .cpu_off_timer = 200, + .suspend_mode = TEGRA_SUSPEND_LP0, + .core_timer = 0x7e7e, + .core_off_timer = 0, + .corereq_high = true, + .sysclkreq_high = true, + .cpu_lp2_min_residency = 2000, + .board_suspend = kai_board_suspend, + .board_resume = kai_board_resume, +}; + +int __init kai_suspend_init(void) +{ + tegra_init_suspend(&kai_suspend_data); + return 0; +} + +static void kai_power_off(void) +{ + pr_err("kai: Powering off the device\n"); + + while (1) + ; +} + +int __init kai_power_off_init(void) +{ + pm_power_off = kai_power_off; + + return 0; +} + +static struct tegra_tsensor_pmu_data tpdata = { + .poweroff_reg_addr = 0x3F, + .poweroff_reg_data = 0x80, + .reset_tegra = 1, + .controller_type = 0, + .i2c_controller_id = 4, + .pinmux = 0, + .pmu_16bit_ops = 0, + .pmu_i2c_addr = 0x2D, +}; + +void __init kai_tsensor_init(void) +{ + tegra3_tsensor_init(&tpdata); +} + +#ifdef CONFIG_TEGRA_EDP_LIMITS + +int __init kai_edp_init(void) +{ + unsigned int regulator_mA; + + regulator_mA = get_maximum_cpu_current_supported(); + if (!regulator_mA) + regulator_mA = 6000; /* regular T30/s */ + pr_info("%s: CPU regulator %d mA\n", __func__, regulator_mA); + + tegra_init_cpu_edp_limits(regulator_mA); + return 0; +} +#endif diff --git a/arch/arm/mach-tegra/board-kai-sdhci.c b/arch/arm/mach-tegra/board-kai-sdhci.c new file mode 100644 index 000000000000..99f7736b14e7 --- /dev/null +++ b/arch/arm/mach-tegra/board-kai-sdhci.c @@ -0,0 +1,163 @@ +/* + * arch/arm/mach-tegra/board-kai-sdhci.c + * + * Copyright (C) 2010 Google, Inc. + * Copyright (C) 2012 NVIDIA Corporation. + * + * 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/resource.h> +#include <linux/platform_device.h> +#include <linux/delay.h> +#include <linux/gpio.h> +#include <linux/clk.h> +#include <linux/err.h> +#include <linux/mmc/host.h> + +#include <asm/mach-types.h> +#include <mach/irqs.h> +#include <mach/iomap.h> +#include <mach/sdhci.h> + +#include "gpio-names.h" +#include "board.h" +#include "board-kai.h" + +#define KAI_SD_CD TEGRA_GPIO_PI5 + +static struct resource sdhci_resource0[] = { + [0] = { + .start = INT_SDMMC1, + .end = INT_SDMMC1, + .flags = IORESOURCE_IRQ, + }, + [1] = { + .start = TEGRA_SDMMC1_BASE, + .end = TEGRA_SDMMC1_BASE + TEGRA_SDMMC1_SIZE-1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct resource sdhci_resource2[] = { + [0] = { + .start = INT_SDMMC3, + .end = INT_SDMMC3, + .flags = IORESOURCE_IRQ, + }, + [1] = { + .start = TEGRA_SDMMC3_BASE, + .end = TEGRA_SDMMC3_BASE + TEGRA_SDMMC3_SIZE-1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct resource sdhci_resource3[] = { + [0] = { + .start = INT_SDMMC4, + .end = INT_SDMMC4, + .flags = IORESOURCE_IRQ, + }, + [1] = { + .start = TEGRA_SDMMC4_BASE, + .end = TEGRA_SDMMC4_BASE + TEGRA_SDMMC4_SIZE-1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct tegra_sdhci_platform_data tegra_sdhci_platform_data2 = { + .mmc_data = { + .built_in = 1, + }, + .cd_gpio = -1, + .wp_gpio = -1, + .power_gpio = -1, +/* .tap_delay = 6, + .is_voltage_switch_supported = false, + .vdd_rail_name = NULL, + .slot_rail_name = NULL, + .vdd_max_uv = -1, + .vdd_min_uv = -1, + .max_clk = 0, + .is_8bit_supported = false, */ +}; + +static struct tegra_sdhci_platform_data tegra_sdhci_platform_data0 = { + .cd_gpio = KAI_SD_CD, + .wp_gpio = -1, + .power_gpio = -1, +/* .tap_delay = 6, + .is_voltage_switch_supported = true, + .vdd_rail_name = "vddio_sdmmc1", + .slot_rail_name = "vddio_sd_slot", + .vdd_max_uv = 3320000, + .vdd_min_uv = 3280000, + .max_clk = 208000000, + .is_8bit_supported = false, */ +}; + +static struct tegra_sdhci_platform_data tegra_sdhci_platform_data3 = { + .cd_gpio = -1, + .wp_gpio = -1, + .power_gpio = -1, + .is_8bit = 1, + .tap_delay = 0x0F, + .mmc_data = { + .built_in = 1, + } +/* .tap_delay = 6, + .is_voltage_switch_supported = false, + .vdd_rail_name = NULL, + .slot_rail_name = NULL, + .vdd_max_uv = -1, + .vdd_min_uv = -1, + .max_clk = 48000000, + .is_8bit_supported = true, */ +}; + +static struct platform_device tegra_sdhci_device0 = { + .name = "sdhci-tegra", + .id = 0, + .resource = sdhci_resource0, + .num_resources = ARRAY_SIZE(sdhci_resource0), + .dev = { + .platform_data = &tegra_sdhci_platform_data0, + }, +}; + +static struct platform_device tegra_sdhci_device2 = { + .name = "sdhci-tegra", + .id = 2, + .resource = sdhci_resource2, + .num_resources = ARRAY_SIZE(sdhci_resource2), + .dev = { + .platform_data = &tegra_sdhci_platform_data2, + }, +}; + +static struct platform_device tegra_sdhci_device3 = { + .name = "sdhci-tegra", + .id = 3, + .resource = sdhci_resource3, + .num_resources = ARRAY_SIZE(sdhci_resource3), + .dev = { + .platform_data = &tegra_sdhci_platform_data3, + }, +}; + +int __init kai_sdhci_init(void) +{ + platform_device_register(&tegra_sdhci_device3); + platform_device_register(&tegra_sdhci_device2); + platform_device_register(&tegra_sdhci_device0); + + return 0; +} diff --git a/arch/arm/mach-tegra/board-kai.c b/arch/arm/mach-tegra/board-kai.c new file mode 100644 index 000000000000..2adb7eeb9d90 --- /dev/null +++ b/arch/arm/mach-tegra/board-kai.c @@ -0,0 +1,537 @@ +/* + * arch/arm/mach-tegra/board-kai.c + * + * Copyright (c) 2012, NVIDIA Corporation. + * + * 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. + * + * 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/init.h> +#include <linux/slab.h> +#include <linux/ctype.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <linux/serial_8250.h> +#include <linux/i2c.h> +#include <linux/dma-mapping.h> +#include <linux/delay.h> +#include <linux/i2c-tegra.h> +#include <linux/gpio.h> +#include <linux/input.h> +#include <linux/platform_data/tegra_usb.h> +#include <linux/spi/spi.h> +#include <linux/tegra_uart.h> +#include <linux/memblock.h> +#include <linux/spi-tegra.h> + +#include <mach/clk.h> +#include <mach/iomap.h> +#include <mach/irqs.h> +#include <mach/pinmux.h> +#include <mach/iomap.h> +#include <mach/io.h> +#include <mach/i2s.h> +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <mach/usb_phy.h> +#include <mach/thermal.h> + +#include "board.h" +#include "clock.h" +#include "board-kai.h" +#include "devices.h" +#include "gpio-names.h" +#include "fuse.h" +#include "pm.h" +#include "wdt-recovery.h" + +/* All units are in millicelsius */ +static struct tegra_thermal_data thermal_data = { + .temp_throttle = 85000, + .temp_shutdown = 90000, + .temp_offset = TDIODE_OFFSET, /* temps based on tdiode */ +#ifdef CONFIG_TEGRA_EDP_LIMITS + .edp_offset = TDIODE_OFFSET, /* edp based on tdiode */ + .hysteresis_edp = 3000, +#endif +#ifdef CONFIG_TEGRA_THERMAL_SYSFS + .tc1 = 0, + .tc2 = 1, + .passive_delay = 2000, +#else + .hysteresis_throttle = 1000, +#endif +}; + +/* !!!TODO: Change for kai (Taken from Ventana) */ +static struct tegra_utmip_config utmi_phy_config[] = { + [0] = { + .hssync_start_delay = 0, + .idle_wait_delay = 17, + .elastic_limit = 16, + .term_range_adj = 6, + .xcvr_setup = 15, + .xcvr_setup_offset = 0, + .xcvr_use_fuses = 1, + .xcvr_lsfslew = 2, + .xcvr_lsrslew = 2, + }, + [1] = { + .hssync_start_delay = 0, + .idle_wait_delay = 17, + .elastic_limit = 16, + .term_range_adj = 6, + .xcvr_setup = 15, + .xcvr_setup_offset = 0, + .xcvr_use_fuses = 1, + .xcvr_lsfslew = 2, + .xcvr_lsrslew = 2, + }, + [2] = { + .hssync_start_delay = 0, + .idle_wait_delay = 17, + .elastic_limit = 16, + .term_range_adj = 6, + .xcvr_setup = 8, + .xcvr_setup_offset = 0, + .xcvr_use_fuses = 1, + .xcvr_lsfslew = 2, + .xcvr_lsrslew = 2, + }, +}; + +static __initdata struct tegra_clk_init_table kai_clk_init_table[] = { + /* name parent rate enabled */ + { "pll_m", NULL, 0, false}, + { "hda", "pll_p", 108000000, false}, + { "hda2codec_2x", "pll_p", 48000000, false}, + { "pwm", "pll_p", 3187500, false}, + { "blink", "clk_32k", 32768, true}, + { "i2s1", "pll_a_out0", 0, false}, + { "i2s3", "pll_a_out0", 0, false}, + { "spdif_out", "pll_a_out0", 0, false}, + { "d_audio", "pll_a_out0", 0, false}, + { "dam0", "pll_a_out0", 0, false}, + { "dam1", "pll_a_out0", 0, false}, + { "dam2", "pll_a_out0", 0, false}, + { "audio1", "i2s1_sync", 0, false}, + { "audio3", "i2s3_sync", 0, false}, + { "vi_sensor", "pll_p", 150000000, false}, + { "i2c1", "pll_p", 3200000, false}, + { "i2c2", "pll_p", 3200000, false}, + { "i2c3", "pll_p", 3200000, false}, + { "i2c4", "pll_p", 3200000, false}, + { "i2c5", "pll_p", 3200000, false}, + { NULL, NULL, 0, 0}, +}; + +static struct tegra_i2c_platform_data kai_i2c1_platform_data = { + .adapter_nr = 0, + .bus_count = 1, + .bus_clk_rate = { 100000, 0 }, + .scl_gpio = {TEGRA_GPIO_PC4, 0}, + .sda_gpio = {TEGRA_GPIO_PC5, 0}, + .arb_recovery = arb_lost_recovery, +}; + +static struct tegra_i2c_platform_data kai_i2c2_platform_data = { + .adapter_nr = 1, + .bus_count = 1, + .bus_clk_rate = { 100000, 0 }, + .is_clkon_always = true, + .scl_gpio = {TEGRA_GPIO_PT5, 0}, + .sda_gpio = {TEGRA_GPIO_PT6, 0}, + .arb_recovery = arb_lost_recovery, +}; + +static struct tegra_i2c_platform_data kai_i2c3_platform_data = { + .adapter_nr = 2, + .bus_count = 1, + .bus_clk_rate = { 100000, 0 }, + .scl_gpio = {TEGRA_GPIO_PBB1, 0}, + .sda_gpio = {TEGRA_GPIO_PBB2, 0}, + .arb_recovery = arb_lost_recovery, +}; + +static struct tegra_i2c_platform_data kai_i2c4_platform_data = { + .adapter_nr = 3, + .bus_count = 1, + .bus_clk_rate = { 100000, 0 }, + .scl_gpio = {TEGRA_GPIO_PV4, 0}, + .sda_gpio = {TEGRA_GPIO_PV5, 0}, + .arb_recovery = arb_lost_recovery, +}; + +static struct tegra_i2c_platform_data kai_i2c5_platform_data = { + .adapter_nr = 4, + .bus_count = 1, + .bus_clk_rate = { 400000, 0 }, + .scl_gpio = {TEGRA_GPIO_PZ6, 0}, + .sda_gpio = {TEGRA_GPIO_PZ7, 0}, + .arb_recovery = arb_lost_recovery, +}; + +static void kai_i2c_init(void) +{ + tegra_i2c_device1.dev.platform_data = &kai_i2c1_platform_data; + tegra_i2c_device2.dev.platform_data = &kai_i2c2_platform_data; + tegra_i2c_device3.dev.platform_data = &kai_i2c3_platform_data; + tegra_i2c_device4.dev.platform_data = &kai_i2c4_platform_data; + tegra_i2c_device5.dev.platform_data = &kai_i2c5_platform_data; + + platform_device_register(&tegra_i2c_device5); + platform_device_register(&tegra_i2c_device4); + platform_device_register(&tegra_i2c_device3); + platform_device_register(&tegra_i2c_device2); + platform_device_register(&tegra_i2c_device1); +} + +static struct platform_device *kai_uart_devices[] __initdata = { + &tegra_uarta_device, + &tegra_uartb_device, + &tegra_uartc_device, + &tegra_uartd_device, + &tegra_uarte_device, +}; +static struct uart_clk_parent uart_parent_clk[] = { + [0] = {.name = "clk_m"}, + [1] = {.name = "pll_p"}, +#ifndef CONFIG_TEGRA_PLLM_RESTRICTED + [2] = {.name = "pll_m"}, +#endif +}; + +static struct tegra_uart_platform_data kai_uart_pdata; +static struct tegra_uart_platform_data kai_loopback_uart_pdata; + +static void __init uart_debug_init(void) +{ + int debug_port_id; + + debug_port_id = get_tegra_uart_debug_port_id(); + if (debug_port_id < 0) + debug_port_id = 3; + + switch (debug_port_id) { + case 0: + /* UARTA is the debug port. */ + pr_info("Selecting UARTA as the debug console\n"); + kai_uart_devices[0] = &debug_uarta_device; + debug_uart_clk = clk_get_sys("serial8250.0", "uarta"); + debug_uart_port_base = ((struct plat_serial8250_port *)( + debug_uarta_device.dev.platform_data))->mapbase; + break; + + case 1: + /* UARTB is the debug port. */ + pr_info("Selecting UARTB as the debug console\n"); + kai_uart_devices[1] = &debug_uartb_device; + debug_uart_clk = clk_get_sys("serial8250.0", "uartb"); + debug_uart_port_base = ((struct plat_serial8250_port *)( + debug_uartb_device.dev.platform_data))->mapbase; + break; + + case 2: + /* UARTC is the debug port. */ + pr_info("Selecting UARTC as the debug console\n"); + kai_uart_devices[2] = &debug_uartc_device; + debug_uart_clk = clk_get_sys("serial8250.0", "uartc"); + debug_uart_port_base = ((struct plat_serial8250_port *)( + debug_uartc_device.dev.platform_data))->mapbase; + break; + + case 3: + /* UARTD is the debug port. */ + pr_info("Selecting UARTD as the debug console\n"); + kai_uart_devices[3] = &debug_uartd_device; + debug_uart_clk = clk_get_sys("serial8250.0", "uartd"); + debug_uart_port_base = ((struct plat_serial8250_port *)( + debug_uartd_device.dev.platform_data))->mapbase; + break; + + case 4: + /* UARTE is the debug port. */ + pr_info("Selecting UARTE as the debug console\n"); + kai_uart_devices[4] = &debug_uarte_device; + debug_uart_clk = clk_get_sys("serial8250.0", "uarte"); + debug_uart_port_base = ((struct plat_serial8250_port *)( + debug_uarte_device.dev.platform_data))->mapbase; + break; + + default: + pr_info("The debug console id %d is invalid, Assuming UARTA", + debug_port_id); + kai_uart_devices[0] = &debug_uarta_device; + debug_uart_clk = clk_get_sys("serial8250.0", "uarta"); + debug_uart_port_base = ((struct plat_serial8250_port *)( + debug_uarta_device.dev.platform_data))->mapbase; + break; + } + return; +} + +static void __init kai_uart_init(void) +{ + struct clk *c; + int i; + + for (i = 0; i < ARRAY_SIZE(uart_parent_clk); ++i) { + c = tegra_get_clock_by_name(uart_parent_clk[i].name); + if (IS_ERR_OR_NULL(c)) { + pr_err("Not able to get the clock for %s\n", + uart_parent_clk[i].name); + continue; + } + uart_parent_clk[i].parent_clk = c; + uart_parent_clk[i].fixed_clk_rate = clk_get_rate(c); + } + kai_uart_pdata.parent_clk_list = uart_parent_clk; + kai_uart_pdata.parent_clk_count = ARRAY_SIZE(uart_parent_clk); + kai_loopback_uart_pdata.parent_clk_list = uart_parent_clk; + kai_loopback_uart_pdata.parent_clk_count = + ARRAY_SIZE(uart_parent_clk); + kai_loopback_uart_pdata.is_loopback = true; + tegra_uarta_device.dev.platform_data = &kai_uart_pdata; + tegra_uartb_device.dev.platform_data = &kai_uart_pdata; + tegra_uartc_device.dev.platform_data = &kai_uart_pdata; + tegra_uartd_device.dev.platform_data = &kai_uart_pdata; + /* UARTE is used for loopback test purpose */ + tegra_uarte_device.dev.platform_data = &kai_loopback_uart_pdata; + + /* Register low speed only if it is selected */ + if (!is_tegra_debug_uartport_hs()) { + uart_debug_init(); + /* Clock enable for the debug channel */ + if (!IS_ERR_OR_NULL(debug_uart_clk)) { + pr_info("The debug console clock name is %s\n", + debug_uart_clk->name); + c = tegra_get_clock_by_name("pll_p"); + if (IS_ERR_OR_NULL(c)) + pr_err("Not getting the parent clock pll_p\n"); + else + clk_set_parent(debug_uart_clk, c); + + clk_enable(debug_uart_clk); + clk_set_rate(debug_uart_clk, clk_get_rate(c)); + } else { + pr_err("Not getting the clock %s for debug console\n", + debug_uart_clk->name); + } + } + + platform_add_devices(kai_uart_devices, + ARRAY_SIZE(kai_uart_devices)); +} + +static struct platform_device tegra_camera = { + .name = "tegra_camera", + .id = -1, +}; + +static struct platform_device *kai_spi_devices[] __initdata = { + &tegra_spi_device4, + &tegra_spi_device1, +}; + +static struct spi_clk_parent spi_parent_clk[] = { + [0] = {.name = "pll_p"}, +#ifndef CONFIG_TEGRA_PLLM_RESTRICTED + [1] = {.name = "pll_m"}, + [2] = {.name = "clk_m"}, +#else + [1] = {.name = "clk_m"}, +#endif +}; + +static struct tegra_spi_platform_data kai_spi_pdata = { + .is_dma_based = true, + .max_dma_buffer = (16 * 1024), + .is_clkon_always = false, + .max_rate = 100000000, +}; + +static void __init kai_spi_init(void) +{ + int i; + struct clk *c; + + for (i = 0; i < ARRAY_SIZE(spi_parent_clk); ++i) { + c = tegra_get_clock_by_name(spi_parent_clk[i].name); + if (IS_ERR_OR_NULL(c)) { + pr_err("Not able to get the clock for %s\n", + spi_parent_clk[i].name); + continue; + } + spi_parent_clk[i].parent_clk = c; + spi_parent_clk[i].fixed_clk_rate = clk_get_rate(c); + } + kai_spi_pdata.parent_clk_list = spi_parent_clk; + kai_spi_pdata.parent_clk_count = ARRAY_SIZE(spi_parent_clk); + tegra_spi_device4.dev.platform_data = &kai_spi_pdata; + platform_add_devices(kai_spi_devices, + ARRAY_SIZE(kai_spi_devices)); + +} + +static struct resource tegra_rtc_resources[] = { + [0] = { + .start = TEGRA_RTC_BASE, + .end = TEGRA_RTC_BASE + TEGRA_RTC_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = INT_RTC, + .end = INT_RTC, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device tegra_rtc_device = { + .name = "tegra_rtc", + .id = -1, + .resource = tegra_rtc_resources, + .num_resources = ARRAY_SIZE(tegra_rtc_resources), +}; + +static struct platform_device *kai_devices[] __initdata = { + &tegra_pmu_device, + &tegra_rtc_device, + &tegra_udc_device, +#if defined(CONFIG_TEGRA_IOVMM_SMMU) + &tegra_smmu_device, +#endif + &tegra_wdt_device, +#if defined(CONFIG_TEGRA_AVP) + &tegra_avp_device, +#endif + &tegra_camera, +#if defined(CONFIG_CRYPTO_DEV_TEGRA_SE) + &tegra_se_device, +#endif + &tegra_ahub_device, + &tegra_dam_device0, + &tegra_dam_device1, + &tegra_dam_device2, + &tegra_i2s_device1, + &tegra_i2s_device3, + &tegra_spdif_device, + &spdif_dit_device, + &bluetooth_dit_device, + &tegra_pcm_device, + &tegra_hda_device, +#if defined(CONFIG_CRYPTO_DEV_TEGRA_AES) + &tegra_aes_device, +#endif +}; + +static struct tegra_ehci_platform_data tegra_ehci_pdata[] = { + [0] = { + .phy_config = &utmi_phy_config[0], + .operating_mode = TEGRA_USB_HOST, + .power_down_on_bus_suspend = 1, + }, + [1] = { + .phy_config = &utmi_phy_config[1], + .operating_mode = TEGRA_USB_HOST, + .power_down_on_bus_suspend = 1, + }, +}; + +static struct tegra_otg_platform_data tegra_otg_pdata = { + .ehci_device = &tegra_ehci1_device, + .ehci_pdata = &tegra_ehci_pdata[0], +}; + +#ifdef CONFIG_USB_SUPPORT +static struct usb_phy_plat_data tegra_usb_phy_pdata[] = { + [0] = { + .instance = 0, + .vbus_gpio = -1, + .vbus_reg_supply = "vdd_vbus_micro_usb", + }, + [1] = { + .instance = 1, + .vbus_gpio = -1, + }, +}; + +static void kai_usb_init(void) +{ + tegra_usb_phy_init(tegra_usb_phy_pdata, + ARRAY_SIZE(tegra_usb_phy_pdata)); + + tegra_otg_device.dev.platform_data = &tegra_otg_pdata; + platform_device_register(&tegra_otg_device); + + tegra_ehci2_device.dev.platform_data = &tegra_ehci_pdata[1]; + platform_device_register(&tegra_ehci2_device); +} +#else +static void kai_usb_init(void) { } +#endif + +static void __init tegra_kai_init(void) +{ + tegra_thermal_init(&thermal_data); + tegra_clk_init_from_table(kai_clk_init_table); + kai_pinmux_init(); + kai_i2c_init(); + kai_spi_init(); + kai_usb_init(); +#ifdef CONFIG_TEGRA_EDP_LIMITS + kai_edp_init(); +#endif + kai_uart_init(); + kai_tsensor_init(); + platform_add_devices(kai_devices, ARRAY_SIZE(kai_devices)); + tegra_ram_console_debug_init(); + kai_sdhci_init(); + kai_regulator_init(); + kai_suspend_init(); + kai_power_off_init(); + kai_keys_init(); + kai_panel_init(); + kai_pins_state_init(); + tegra_release_bootloader_fb(); +#ifdef CONFIG_TEGRA_WDT_RECOVERY + tegra_wdt_recovery_init(); +#endif +} + +static void __init kai_ramconsole_reserve(unsigned long size) +{ + tegra_ram_console_debug_reserve(SZ_1M); +} + +static void __init tegra_kai_reserve(void) +{ +#if defined(CONFIG_NVMAP_CONVERT_CARVEOUT_TO_IOVMM) + /* support 1920X1200 with 24bpp */ + tegra_reserve(0, SZ_8M + SZ_1M, SZ_8M + SZ_1M); +#else + tegra_reserve(SZ_128M, SZ_8M, SZ_8M); +#endif + kai_ramconsole_reserve(SZ_1M); +} + +MACHINE_START(KAI, "kai") + .boot_params = 0x80000100, + .map_io = tegra_map_common_io, + .reserve = tegra_kai_reserve, + .init_early = tegra_init_early, + .init_irq = tegra_init_irq, + .timer = &tegra_timer, + .init_machine = tegra_kai_init, +MACHINE_END diff --git a/arch/arm/mach-tegra/board-kai.h b/arch/arm/mach-tegra/board-kai.h new file mode 100644 index 000000000000..992cf0a8c014 --- /dev/null +++ b/arch/arm/mach-tegra/board-kai.h @@ -0,0 +1,51 @@ +/* + * arch/arm/mach-tegra/board-kai.h + * + * Copyright (c) 2012, NVIDIA Corporation. + * + * 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. + * + * 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. + */ + +#ifndef _MACH_TEGRA_BOARD_KAI_H +#define _MACH_TEGRA_BOARD_KAI_H + +#include <mach/gpio.h> +#include <mach/irqs.h> + +/* Processor Board ID */ +#define BOARD_E1565 0xF41 + +/* Board Fab version */ +#define BOARD_FAB_A00 0x0 +#define BOARD_FAB_A01 0x1 +#define BOARD_FAB_A02 0x2 +#define BOARD_FAB_A03 0x3 +#define BOARD_FAB_A04 0x4 +#define BOARD_FAB_A05 0x5 + +int kai_charge_init(void); +int kai_regulator_init(void); +int kai_suspend_init(void); +int kai_sdhci_init(void); +int kai_pinmux_init(void); +int kai_panel_init(void); +int kai_keys_init(void); +int kai_pins_state_init(void); +int kai_power_off_init(void); +int kai_edp_init(void); +void __init kai_tsensor_init(void); + +#define TDIODE_OFFSET (10000) /* in millicelsius */ + +#endif |