tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-sc8800g / sc8800g_keypad.h
1 #ifndef _SC8800G_KEYPAD_H_
2 #define _SC8800G_KEYPAD_H_
3
4 #include "sc8800g_reg_base.h"
5 #include "kpd_reg_v0.h"
6 #include "sc8800g_reg_global.h"
7 #include "bits.h"
8
9 #define REG_GR_GEN0 (*((volatile unsigned int *)(GR_GEN0)))
10
11 #define KPD_ROW_MIN_NUM         4  /* when config keypad type, the value of */
12 #define KPD_COL_MIN_NUM         3  /* when config keypad type, the value of */
13
14 #define KPDCTL_ROW              (0xf << 16)  /* enable bit for rows(row4 --- row7) */
15 #define KPDCTL_COL              (0x1f << 20)  /* enable bit for cols(col3 --- col4) */
16
17 #define KPD_REG_BASE                    KPD_BASE
18
19 #define KPD_CTRL                        (KPD_REG_BASE + 0x0000)
20 #define KPD_INT_EN                      (KPD_REG_BASE + 0x0004)
21 #define KPD_INT_RAW_STATUS              (KPD_REG_BASE + 0x0008)
22 #define KPD_INT_MASK_STATUS             (KPD_REG_BASE + 0x000C)
23
24 #define KPD_INT_CLR                     (KPD_REG_BASE + 0x0010)
25 #define KPD_POLARITY                    (KPD_REG_BASE + 0x0018)
26 #define KPD_DEBOUNCE_CNT                (KPD_REG_BASE + 0x001C)
27 #define KPD_LONG_KEY_CNT                (KPD_REG_BASE + 0x0020)
28
29 #define KPD_SLEEP_CNT                   (KPD_REG_BASE + 0x0024)
30 #define KPD_CLK_DIV_CNT                 (KPD_REG_BASE + 0x0028)
31 #define KPD_KEY_STATUS                  (KPD_REG_BASE + 0x002C)
32 #define KPD_SLEEP_STATUS                (KPD_REG_BASE + 0x0030)
33
34 #define REG_KPD_CTRL                    (*((volatile unsigned int *)(KPD_CTRL)))
35 #define REG_KPD_INT_EN                  (*((volatile unsigned int *)(KPD_INT_EN)))
36 #define REG_KPD_INT_RAW_STATUS          (*((volatile unsigned int *)(KPD_INT_RAW_STATUS)))
37 #define REG_KPD_INT_MASK_STATUS         (*((volatile unsigned int *)(KPD_INT_MASK_STATUS)))
38
39 #define REG_KPD_INT_CLR             (*((volatile unsigned int *)(KPD_INT_CLR)))
40 #define REG_KPD_POLARITY            (*((volatile unsigned int *)(KPD_POLARITY)))
41 #define REG_KPD_DEBOUNCE_CNT            (*((volatile unsigned int *)(KPD_DEBOUNCE_CNT)))
42 #define REG_KPD_LONG_KEY_CNT            (*((volatile unsigned int *)(KPD_LONG_KEY_CNT)))
43
44 #define REG_KPD_SLEEP_CNT           (*((volatile unsigned int *)(KPD_SLEEP_CNT)))
45 #define REG_KPD_CLK_DIV_CNT             (*((volatile unsigned int *)(KPD_CLK_DIV_CNT)))
46 #define REG_KPD_KEY_STATUS          (*((volatile unsigned int *)(KPD_KEY_STATUS)))
47 #define REG_KPD_SLEEP_STATUS            (*((volatile unsigned int *)(KPD_SLEEP_STATUS)))
48
49 //The corresponding bit of KPD_POLARITY register.
50 #define KPDPOLARITY_ROW                 (0x00FF)    // Internal row output xor with this 
51 // value to generate row output.
52 #define KPDPOLARITY_COL                 (0xFF00)    // Column input xor with this value to
53 #define KPDCLK0_CLK_DIV0                0xFFFF      //Clock dividor [15:0]
54 #define KPDCLK1_TIME_CNT                0xFFB0      //Time out counter value
55
56 #define CFG_ROW_POLARITY    (0x00FF & KPDPOLARITY_ROW)
57 #define CFG_COL_POLARITY    (0xFF00 & KPDPOLARITY_COL)
58 #define CFG_CLK_DIV         1
59
60 #define IRQ_KPD_INT 10
61
62 #define INT_DIS (INTC_BASE + 0xc)
63 #define REG_INT_DIS (*((volatile unsigned int *)(INT_DIS)))
64 #endif //_SC8800G_KEYPAD_H_