From 53667a96e70f37627b3a7aaefd5cb393dc79b38a Mon Sep 17 00:00:00 2001 From: Frank Li Date: Wed, 13 Oct 2010 19:12:50 +0800 Subject: ENGR00132582 MX50: Add keypad for RD board Need E-Book ADD On Board. Boot Config (SW5) uses EIM_DA0~7, which are multiplexed with Keypad module. Set SW5 to 'on' to avoid the interference (it appears that some keys are always pressed) after system boot. Signed-off-by: Frank Li --- arch/arm/mach-mx5/mx50_rdp.c | 38 +++++++++++++++++++++++++---- arch/arm/plat-mxc/include/mach/iomux-mx50.h | 26 +++++++++++++++++--- 2 files changed, 55 insertions(+), 9 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-mx5/mx50_rdp.c b/arch/arm/mach-mx5/mx50_rdp.c index 135388900675..31b0f824a29f 100644 --- a/arch/arm/mach-mx5/mx50_rdp.c +++ b/arch/arm/mach-mx5/mx50_rdp.c @@ -271,6 +271,16 @@ static struct pad_desc mx50_rdp[] = { MX50_PAD_KEY_ROW1__KEY_ROW1, MX50_PAD_KEY_COL2__KEY_COL2, MX50_PAD_KEY_ROW2__KEY_ROW2, + MX50_PAD_KEY_COL3__KEY_COL3, + MX50_PAD_KEY_ROW3__KEY_ROW3, + MX50_PAD_EIM_DA0__KEY_COL4, + MX50_PAD_EIM_DA1__KEY_ROW4, + MX50_PAD_EIM_DA2__KEY_COL5, + MX50_PAD_EIM_DA3__KEY_ROW5, + MX50_PAD_EIM_DA4__KEY_COL6, + MX50_PAD_EIM_DA5__KEY_ROW6, + MX50_PAD_EIM_DA6__KEY_COL7, + MX50_PAD_EIM_DA7__KEY_ROW7, }; @@ -363,14 +373,20 @@ static struct fec_platform_data fec_data = { .phy = PHY_INTERFACE_MODE_RMII, }; -static u16 keymapping[8] = { - KEY_F1, KEY_UP, KEY_SELECT, KEY_LEFT, - KEY_ENTER, KEY_RIGHT, KEY_MENU, KEY_DOWN, +static u16 keymapping[] = { + KEY_9, KEY_0, KEY_O, KEY_P, KEY_L, KEY_DELETE, KEY_SLASH, KEY_ENTER, + KEY_F4, KEY_F1, KEY_F6, KEY_F9, KEY_F5, KEY_BACKSPACE, KEY_MENU, 0, + KEY_PREVIOUS, KEY_NEXT, KEY_HOME, KEY_NEXT, KEY_F2, KEY_F3, KEY_F8, KEY_F7, + KEY_F11, KEY_CAPSLOCK, KEY_SPACE, KEY_SPACE, KEY_LEFTALT, KEY_LEFTSHIFT, 0, 0, + KEY_COMMA, KEY_M, KEY_N, KEY_B, KEY_V, KEY_C, KEY_X, KEY_Z, + KEY_K, KEY_J, KEY_H, KEY_G, KEY_F, KEY_D, KEY_S, KEY_A, + KEY_I, KEY_U, KEY_Y, KEY_T, KEY_R, KEY_E, KEY_W, KEY_Q, + KEY_8, KEY_7, KEY_6, KEY_5, KEY_4, KEY_3, KEY_2, KEY_1 }; static struct keypad_data keypad_plat_data = { - .rowmax = 3, - .colmax = 3, + .rowmax = 8, + .colmax = 8, .irq = MXC_INT_KPP, .learning = 0, .delay = 2, @@ -983,6 +999,15 @@ static int __init w1_setup(char *__unused) __setup("w1", w1_setup); +static int __initdata enable_keypad = {0}; +static int __init keypad_setup(char *__unused) +{ + enable_keypad = 1; + return cpu_is_mx50(); +} + +__setup("keypad", keypad_setup); + static struct mxs_dma_plat_data dma_apbh_data = { .chan_base = MXS_DMA_CHANNEL_AHB_APBH, .chan_num = MXS_MAX_DMA_CHANNELS, @@ -1133,6 +1158,9 @@ static void __init mxc_board_init(void) mxc_register_device(&busfreq_device, NULL); mxc_register_device(&mxc_dvfs_core_device, &dvfs_core_data); + if (enable_keypad) + mxc_register_device(&mxc_keypad_device, &keypad_plat_data); + mxc_register_device(&mxcsdhc1_device, &mmc1_data); mxc_register_device(&mxcsdhc2_device, &mmc2_data); mxc_register_device(&mxcsdhc3_device, &mmc3_data); diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx50.h b/arch/arm/plat-mxc/include/mach/iomux-mx50.h index e53e7b4a10b9..9fd073d8599f 100644 --- a/arch/arm/plat-mxc/include/mach/iomux-mx50.h +++ b/arch/arm/plat-mxc/include/mach/iomux-mx50.h @@ -557,22 +557,40 @@ typedef enum iomux_config { PAD_CTL_DSE_HIGH) /* Keypad */ +#define MX50_KEYPAD_CTRL (PAD_CTL_HYS | PAD_CTL_PKE | PAD_CTL_PUE | \ + PAD_CTL_PUS_100K_UP | PAD_CTL_DSE_HIGH) + #define MX50_PAD_KEY_COL0__KEY_COL0 IOMUX_PAD(0x2CC, 0x20, 0, 0x0, 0, \ NO_PAD_CTRL) #define MX50_PAD_KEY_ROW0__KEY_ROW0 IOMUX_PAD(0x2D0, 0x24, 0, 0x0, 0, \ - NO_PAD_CTRL) + MX50_KEYPAD_CTRL) #define MX50_PAD_KEY_COL1__KEY_COL1 IOMUX_PAD(0x2D4, 0x28, 0, 0x0, 0, \ NO_PAD_CTRL) #define MX50_PAD_KEY_ROW1__KEY_ROW1 IOMUX_PAD(0x2D8, 0x2C, 0, 0x0, 0, \ - NO_PAD_CTRL) + MX50_KEYPAD_CTRL) #define MX50_PAD_KEY_COL2__KEY_COL2 IOMUX_PAD(0x2DC, 0x30, 0, 0x0, 0, \ MX50_SD_PAD_CTRL) #define MX50_PAD_KEY_ROW2__KEY_ROW2 IOMUX_PAD(0x2E0, 0x34, 0, 0x0, 0, \ - NO_PAD_CTRL) + MX50_KEYPAD_CTRL) #define MX50_PAD_KEY_COL3__KEY_COL3 IOMUX_PAD(0x2E4, 0x38, 0, 0x0, 0, \ NO_PAD_CTRL) #define MX50_PAD_KEY_ROW3__KEY_ROW3 IOMUX_PAD(0x2E8, 0x3C, 0, 0x0, 0, \ + MX50_KEYPAD_CTRL) +#define MX50_PAD_EIM_DA0__KEY_COL4 IOMUX_PAD(0x5f8, 0x25C, 3, 0x790, 2, \ NO_PAD_CTRL) - +#define MX50_PAD_EIM_DA1__KEY_ROW4 IOMUX_PAD(0x5fc, 0x260, 3, 0x7a0, 2, \ + MX50_KEYPAD_CTRL) +#define MX50_PAD_EIM_DA2__KEY_COL5 IOMUX_PAD(0x600, 0x264, 3, 0x794, 2, \ + NO_PAD_CTRL) +#define MX50_PAD_EIM_DA3__KEY_ROW5 IOMUX_PAD(0x604, 0x268, 3, 0x7a4, 2, \ + MX50_KEYPAD_CTRL) +#define MX50_PAD_EIM_DA4__KEY_COL6 IOMUX_PAD(0x608, 0x26C, 3, 0x798, 2, \ + NO_PAD_CTRL) +#define MX50_PAD_EIM_DA5__KEY_ROW6 IOMUX_PAD(0x60C, 0x270, 3, 0x7a8, 2, \ + MX50_KEYPAD_CTRL) +#define MX50_PAD_EIM_DA6__KEY_COL7 IOMUX_PAD(0x610, 0x274, 3, 0x79c, 2, \ + NO_PAD_CTRL) +#define MX50_PAD_EIM_DA7__KEY_ROW7 IOMUX_PAD(0x614, 0x278, 3, 0x7ac, 2, \ + MX50_KEYPAD_CTRL) #endif /* __MACH_IOMUX_MX53_H__ */ -- cgit v1.2.3