[ARM]:tegra:cardhu:Fixing misc kernel crash on FPGA
Kirubakaran Sampath [Mon, 17 Jan 2011 11:15:03 +0000 (16:15 +0530)]
Fixing kernel crashes which occurs during boot of cardhu
on FPGA with NO_ROOT_DEVICE option.

Original-Change-Id: I0bb935c4654058de759627e54684ceab549195ec
Reviewed-on: http://git-master/r/16053
Reviewed-by: Alok Chauhan <alokc@nvidia.com>
Tested-by: Alok Chauhan <alokc@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Kirubakaran Sampath <ksampath@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Original-Change-Id: I1d0b68b604fe07dc33255b6b949187b74dff885f

Rebase-Id: R3ceb29e0cd0ffdf99981609afb58941b142ab516

arch/arm/mach-tegra/Makefile
arch/arm/mach-tegra/board-cardhu-kbc.c [new file with mode: 0644]
arch/arm/mach-tegra/board-cardhu-pinmux.c
arch/arm/mach-tegra/board-cardhu-power.c
arch/arm/mach-tegra/board-cardhu.c
arch/arm/mach-tegra/board-cardhu.h

index 617a32c..a2d9a6c 100644 (file)
@@ -133,6 +133,7 @@ obj-$(CONFIG_MACH_VENTANA)              += board-ventana-panel.o
 
 # Cardhu
 obj-${CONFIG_MACH_CARDHU}               += board-cardhu.o
+obj-${CONFIG_MACH_CARDHU}               += board-cardhu-kbc.o
 obj-${CONFIG_MACH_CARDHU}               += board-cardhu-panel.o
 obj-${CONFIG_MACH_CARDHU}               += board-cardhu-pinmux.o
 obj-${CONFIG_MACH_CARDHU}               += board-cardhu-power.o
diff --git a/arch/arm/mach-tegra/board-cardhu-kbc.c b/arch/arm/mach-tegra/board-cardhu-kbc.c
new file mode 100644 (file)
index 0000000..cb798e9
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * arch/arm/mach-tegra/board-cardhu-kbc.c
+ * KBC configuration for Nvidia tegra3 cardhu platform.
+ *
+ * Copyright (C) 2011 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 <mach/irqs.h>
+#include <mach/io.h>
+#include <mach/iomap.h>
+#include <mach/kbc.h>
+
+#define CARDHU_ROW_COUNT       2
+#define CARDHU_COL_COUNT       4
+
+static int plain_kbd_keycode[] = {
+       KEY_WAKEUP, KEY_RESERVED, KEY_VOLUMEDOWN, KEY_VOLUMEUP,
+       KEY_HOME,   KEY_MENU,     KEY_BACK,       KEY_SEARCH};
+
+static struct tegra_kbc_wake_key cardhu_wake_cfg[] = {
+       [0] = {
+               .row = 0,
+               .col = 0,
+       },
+};
+
+static struct tegra_kbc_platform_data cardhu_kbc_platform_data = {
+       .debounce_cnt = 20,
+       .repeat_cnt = 50 * 32,
+       .scan_timeout_cnt = 3000 * 32,
+       .plain_keycode = plain_kbd_keycode,
+       .fn_keycode = NULL,
+       .is_filter_keys = false,
+       .is_wake_on_any_key = false,
+       .wake_key_cnt = 1,
+       .wake_cfg = &cardhu_wake_cfg[0],
+};
+
+static struct resource cardhu_kbc_resources[] = {
+       [0] = {
+               .start = TEGRA_KBC_BASE,
+               .end   = TEGRA_KBC_BASE + TEGRA_KBC_SIZE - 1,
+               .flags = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start = INT_KBC,
+               .end   = INT_KBC,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+
+struct platform_device cardhu_kbc_device = {
+       .name = "tegra-kbc",
+       .id = -1,
+       .dev = {
+               .platform_data = &cardhu_kbc_platform_data,
+       },
+       .resource = cardhu_kbc_resources,
+       .num_resources = ARRAY_SIZE(cardhu_kbc_resources),
+};
+
+int __init cardhu_kbc_init(void)
+{
+       struct tegra_kbc_platform_data *data = &cardhu_kbc_platform_data;
+       int i;
+
+       pr_info("KBC: cardhu_kbc_init\n");
+
+        /* Setup the pin configuration information. */
+       for (i = 0; i < KBC_MAX_GPIO; i++) {
+               data->pin_cfg[i].num = 0;
+               data->pin_cfg[i].pin_type = kbc_pin_unused;
+       }
+       for (i = 0; i < CARDHU_ROW_COUNT; i++) {
+               data->pin_cfg[i].num = i;
+               data->pin_cfg[i].pin_type = kbc_pin_row;
+       }
+
+       for (i = 0; i < CARDHU_COL_COUNT; i++) {
+               data->pin_cfg[i + CARDHU_ROW_COUNT].num = i;
+               data->pin_cfg[i + CARDHU_ROW_COUNT].pin_type = kbc_pin_col;
+       }
+       platform_device_register(&cardhu_kbc_device);
+       return 0;
+}
index 72bd514..f98a0df 100644 (file)
@@ -247,30 +247,15 @@ static __initdata struct tegra_pingroup_config cardhu_pinmux[] = {
        DEFAULT_PINMUX(JTAG_RTCK,       RTCK,            NORMAL,    NORMAL,     OUTPUT),
        DEFAULT_PINMUX(PWR_I2C_SCL,     I2CPWR,          NORMAL,    NORMAL,     INPUT),
        DEFAULT_PINMUX(PWR_I2C_SDA,     I2CPWR,          NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW0,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW1,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW2,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW3,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW4,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW5,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW6,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW7,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW8,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW9,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW10,        KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW11,        KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW12,        KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW13,        KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW14,        KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_ROW15,        KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_COL0,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_COL1,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_COL2,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_COL3,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_COL4,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_COL5,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_COL6,         KBC,             NORMAL,    NORMAL,     INPUT),
-       DEFAULT_PINMUX(KB_COL7,         KBC,             NORMAL,    NORMAL,     INPUT),
+
+       /*  KBC keys */
+       DEFAULT_PINMUX(KB_ROW0,         KBC,             PULL_UP,    NORMAL,     INPUT),
+       DEFAULT_PINMUX(KB_ROW1,         KBC,             PULL_UP,    NORMAL,     INPUT),
+       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(CLK_32K_OUT,     BLINK,           NORMAL,    NORMAL,     OUTPUT),
        DEFAULT_PINMUX(SYS_CLK_REQ,     SYSCLK,          NORMAL,    NORMAL,     OUTPUT),
        DEFAULT_PINMUX(OWR,             OWR,             NORMAL,    NORMAL,     INPUT),
index ecee28c..be425bb 100644 (file)
  * 02111-1307, USA
  */
 #include <linux/platform_device.h>
+#include <mach/suspend.h>
 #include <linux/io.h>
+#include <mach/iomap.h>
+
+#include "power.h"
+#include "wakeups-t3.h"
+
+static struct tegra_suspend_platform_data cardhu_suspend_data = {
+       .cpu_timer      = 2000,
+       .cpu_off_timer  = 0,
+       .suspend_mode   = TEGRA_SUSPEND_NONE,
+       .core_timer     = 0x7e7e,
+       .core_off_timer = 0,
+       .separate_req   = true,
+       .corereq_high   = false,
+       .sysclkreq_high = true,
+       .wake_enb       = 0,
+       .wake_high      = 0,
+       .wake_low       = 0,
+       .wake_any       = 0,
+};
+
 int __init cardhu_regulator_init(void)
 {
+       tegra_init_suspend(&cardhu_suspend_data);
        return 0;
 }
index 7bf79fb..21f2bbb 100644 (file)
@@ -31,7 +31,6 @@
 #include <linux/delay.h>
 #include <linux/i2c-tegra.h>
 #include <linux/gpio.h>
-#include <linux/gpio_keys.h>
 #include <linux/input.h>
 #include <linux/platform_data/tegra_usb.h>
 #include <mach/clk.h>
@@ -53,6 +52,8 @@
 #include "gpio-names.h"
 #include "fuse.h"
 
+#define ENABLE_USB_HOST 0
+
 static struct plat_serial8250_port debug_uart_platform_data[] = {
        {
                .membase        = IO_ADDRESS(TEGRA_UARTA_BASE),
@@ -149,7 +150,7 @@ static __initdata struct tegra_clk_init_table cardhu_clk_init_table[] = {
        { "uartc",      "clk_m",        13000000,       true},
        { "uartd",      "clk_m",        13000000,       true},
        { "uarte",      "clk_m",        13000000,       true},
-       { "pll_m",      NULL,           600000000,      true},
+       { "pll_m",      NULL,           0,              true},
        { "blink",      "clk_32k",      32768,          false},
        { "pll_p_out4", "pll_p",        24000000,       true },
        { "pwm",        "clk_32k",      32768,          false},
@@ -221,40 +222,6 @@ static void cardhu_i2c_init(void)
        platform_device_register(&tegra_i2c_device1);
 }
 
-#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,        \
-       }
-
-/* !!!TODO!!! Change for cardhu */
-static struct gpio_keys_button cardhu_keys[] = {
-       [0] = GPIO_KEY(KEY_MENU, PQ0, 0),
-       [1] = GPIO_KEY(KEY_HOME, PQ1, 0),
-       [2] = GPIO_KEY(KEY_BACK, PQ2, 0),
-       [3] = GPIO_KEY(KEY_VOLUMEUP, PQ3, 0),
-       [4] = GPIO_KEY(KEY_VOLUMEDOWN, PQ4, 0),
-       [5] = GPIO_KEY(KEY_POWER, PV2, 1),
-};
-
-static struct gpio_keys_platform_data cardhu_keys_platform_data = {
-       .buttons        = cardhu_keys,
-       .nbuttons       = ARRAY_SIZE(cardhu_keys),
-};
-
-static struct platform_device cardhu_keys_device = {
-       .name   = "gpio-keys",
-       .id     = 0,
-       .dev    = {
-               .platform_data  = &cardhu_keys_platform_data,
-       },
-};
-
 static struct resource tegra_rtc_resources[] = {
        [0] = {
                .start = TEGRA_RTC_BASE,
@@ -276,7 +243,9 @@ static struct platform_device tegra_rtc_device = {
 };
 
 static struct platform_device *cardhu_devices[] __initdata = {
+#if ENABLE_USB_HOST
        &tegra_otg_device,
+#endif
        &debug_uart,
        &tegra_uartb_device,
        &tegra_uartc_device,
@@ -285,11 +254,12 @@ static struct platform_device *cardhu_devices[] __initdata = {
        &pmu_device,
        &tegra_rtc_device,
        &tegra_udc_device,
+#if ENABLE_USB_HOST
        &tegra_ehci2_device,
+#endif
 #if defined(CONFIG_TEGRA_IOVMM_SMMU)
        &tegra_smmu_device,
 #endif
-       &cardhu_keys_device,
        &tegra_wdt_device,
        &tegra_avp_device,
 };
@@ -318,11 +288,13 @@ static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
        },
 };
 
+#if ENABLE_USB_HOST
 static void cardhu_usb_init(void)
 {
        tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata[2];
        platform_device_register(&tegra_ehci3_device);
 }
+#endif
 
 struct platform_device *tegra_usb_otg_host_register(void)
 {
@@ -385,7 +357,13 @@ static void __init tegra_cardhu_init(void)
        cardhu_i2c_init();
        cardhu_regulator_init();
        cardhu_touch_init();
+#if ENABLE_USB_HOST
        cardhu_usb_init();
+#endif
+
+#ifdef CONFIG_KEYBOARD_TEGRA
+       cardhu_kbc_init();
+#endif
        cardhu_panel_init();
        cardhu_sensors_init();
        cardhu_bt_rfkill();
@@ -393,7 +371,7 @@ static void __init tegra_cardhu_init(void)
 
 static void __init tegra_cardhu_reserve(void)
 {
-       tegra_reserve(SZ_128M, SZ_8M, SZ_16M);
+       tegra_reserve(SZ_32M, SZ_4M, 0);
 }
 
 MACHINE_START(CARDHU, "cardhu")
index e62a363..09aea5c 100644 (file)
@@ -23,5 +23,6 @@ int cardhu_sdhci_init(void);
 int cardhu_pinmux_init(void);
 int cardhu_panel_init(void);
 int cardhu_sensors_init(void);
+int cardhu_kbc_init(void);
 
 #endif