summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/board-cardhu-kbc.c
diff options
context:
space:
mode:
authorKirubakaran Sampath <ksampath@nvidia.com>2011-01-17 16:45:03 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:45:28 -0800
commit5c542560946e5fc91e456917f54b4a077d252287 (patch)
tree79ef99d33aeac8078035ac3d89758c9272f42175 /arch/arm/mach-tegra/board-cardhu-kbc.c
parent507e1c1a99cb7c3d8c220bc9fce4797afe71e805 (diff)
[ARM]:tegra:cardhu:Fixing misc kernel crash on FPGA
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
Diffstat (limited to 'arch/arm/mach-tegra/board-cardhu-kbc.c')
-rw-r--r--arch/arm/mach-tegra/board-cardhu-kbc.c105
1 files changed, 105 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu-kbc.c b/arch/arm/mach-tegra/board-cardhu-kbc.c
new file mode 100644
index 000000000000..cb798e951c17
--- /dev/null
+++ b/arch/arm/mach-tegra/board-cardhu-kbc.c
@@ -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;
+}