[U-Boot] [PATCH v2 1/4] PXA: PXA27x Matrix keypad driver
From: Marek Vasut marek.va...@gmail.com Signed-off-by: Marek Vasut marek.va...@gmail.com Signed-off-by: Vasily Khoruzhick anars...@gmail.com [vasily: adapted Marek's old version for newer u-boot] --- v2: use struct-based access to regs, minor cleanup arch/arm/include/asm/arch-pxa/pxa-regs.h| 52 -- arch/arm/include/asm/arch-pxa/regs-keypad.h | 84 + drivers/input/Makefile |2 + drivers/input/pxa27x-mkp.c | 245 +++ 4 files changed, 331 insertions(+), 52 deletions(-) create mode 100644 arch/arm/include/asm/arch-pxa/regs-keypad.h create mode 100644 drivers/input/pxa27x-mkp.c diff --git a/arch/arm/include/asm/arch-pxa/pxa-regs.h b/arch/arm/include/asm/arch-pxa/pxa-regs.h index b81b42c..d562658 100644 --- a/arch/arm/include/asm/arch-pxa/pxa-regs.h +++ b/arch/arm/include/asm/arch-pxa/pxa-regs.h @@ -2567,58 +2567,6 @@ typedef void (*ExcpHndlr) (void) ; #define OVL2C1_O2EN(131) /* Enable bit for Overlay 2 */ #define CCR_CEN(131) /* Enable bit for Cursor */ -/* Keypad controller */ - -#define KPC0x4150 /* Keypad Interface Control register */ -#define KPDK 0x4158 /* Keypad Interface Direct Key register */ -#define KPREC 0x41500010 /* Keypad Intefcace Rotary Encoder register */ -#define KPMK 0x41500018 /* Keypad Intefcace Matrix Key register */ -#define KPAS 0x41500020 /* Keypad Interface Automatic Scan register */ -#define KPASMKP0 0x41500028 /* Keypad Interface Automatic Scan Multiple Key Presser register 0 */ -#define KPASMKP1 0x41500030 /* Keypad Interface Automatic Scan Multiple Key Presser register 1 */ -#define KPASMKP2 0x41500038 /* Keypad Interface Automatic Scan Multiple Key Presser register 2 */ -#define KPASMKP3 0x41500040 /* Keypad Interface Automatic Scan Multiple Key Presser register 3 */ -#define KPKDI 0x41500048 /* Keypad Interface Key Debounce Interval register */ - -#define KPC_AS (0x1 30) /* Automatic Scan bit */ -#define KPC_ASACT (0x1 29) /* Automatic Scan on Activity */ -#define KPC_MI (0x1 22) /* Matrix interrupt bit */ -#define KPC_IMKP (0x1 21) /* Ignore Multiple Key Press */ -#define KPC_MS7(0x1 20) /* Matrix scan line 7 */ -#define KPC_MS6(0x1 19) /* Matrix scan line 6 */ -#define KPC_MS5(0x1 18) /* Matrix scan line 5 */ -#define KPC_MS4(0x1 17) /* Matrix scan line 4 */ -#define KPC_MS3(0x1 16) /* Matrix scan line 3 */ -#define KPC_MS2(0x1 15) /* Matrix scan line 2 */ -#define KPC_MS1(0x1 14) /* Matrix scan line 1 */ -#define KPC_MS0(0x1 13) /* Matrix scan line 0 */ -#define KPC_ME (0x1 12) /* Matrix Keypad Enable */ -#define KPC_MIE(0x1 11) /* Matrix Interrupt Enable */ -#define KPC_DK_DEB_SEL (0x1 9) /* Direct Key Debounce select */ -#define KPC_DI (0x1 5) /* Direct key interrupt bit */ -#define KPC_DEE0 (0x1 2) /* Rotary Encoder 0 Enable */ -#define KPC_DE (0x1 1) /* Direct Keypad Enable */ -#define KPC_DIE(0x1 0) /* Direct Keypad interrupt Enable */ - -#define KPDK_DKP (0x1 31) -#define KPDK_DK7 (0x1 7) -#define KPDK_DK6 (0x1 6) -#define KPDK_DK5 (0x1 5) -#define KPDK_DK4 (0x1 4) -#define KPDK_DK3 (0x1 3) -#define KPDK_DK2 (0x1 2) -#define KPDK_DK1 (0x1 1) -#define KPDK_DK0 (0x1 0) - -#define KPREC_OF1 (0x1 31) -#define kPREC_UF1 (0x1 30) -#define KPREC_OF0 (0x1 15) -#define KPREC_UF0 (0x1 14) - -#define KPMK_MKP (0x1 31) -#define KPAS_SO(0x1 31) -#define KPASMKPx_SO(0x1 31) - #define GPIO113_BIT(1 17)/* GPIO113 in GPSR, GPCR, bit 17 */ #define PSLR 0x40F00034 #define PSTR 0x40F00038 /* Power Manager Standby Configuration Reg */ diff --git a/arch/arm/include/asm/arch-pxa/regs-keypad.h b/arch/arm/include/asm/arch-pxa/regs-keypad.h new file mode 100644 index 000..f13da56 --- /dev/null +++ b/arch/arm/include/asm/arch-pxa/regs-keypad.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2012 Vasily Khoruzhick anars...@gmail.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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
Re: [U-Boot] [PATCH v2 1/4] PXA: PXA27x Matrix keypad driver
From: Marek Vasut marek.va...@gmail.com Signed-off-by: Marek Vasut marek.va...@gmail.com Signed-off-by: Vasily Khoruzhick anars...@gmail.com [vasily: adapted Marek's old version for newer u-boot] --- v2: use struct-based access to regs, minor cleanup arch/arm/include/asm/arch-pxa/pxa-regs.h| 52 -- arch/arm/include/asm/arch-pxa/regs-keypad.h | 84 + drivers/input/Makefile |2 + drivers/input/pxa27x-mkp.c | 245 +++ 4 files changed, 331 insertions(+), 52 deletions(-) create mode 100644 arch/arm/include/asm/arch-pxa/regs-keypad.h create mode 100644 drivers/input/pxa27x-mkp.c diff --git a/arch/arm/include/asm/arch-pxa/pxa-regs.h b/arch/arm/include/asm/arch-pxa/pxa-regs.h index b81b42c..d562658 100644 --- a/arch/arm/include/asm/arch-pxa/pxa-regs.h +++ b/arch/arm/include/asm/arch-pxa/pxa-regs.h @@ -2567,58 +2567,6 @@ typedef void (*ExcpHndlr) (void) ; #define OVL2C1_O2EN (131) /* Enable bit for Overlay 2 */ #define CCR_CEN (131) /* Enable bit for Cursor */ -/* Keypad controller */ - -#define KPC 0x4150 /* Keypad Interface Control register */ -#define KPDK 0x4158 /* Keypad Interface Direct Key register */ -#define KPREC0x41500010 /* Keypad Intefcace Rotary Encoder register */ -#define KPMK 0x41500018 /* Keypad Intefcace Matrix Key register */ -#define KPAS 0x41500020 /* Keypad Interface Automatic Scan register */ -#define KPASMKP0 0x41500028 /* Keypad Interface Automatic Scan Multiple Key Presser register 0 */ -#define KPASMKP1 0x41500030 /* Keypad Interface Automatic Scan Multiple Key Presser register 1 */ -#define KPASMKP2 0x41500038 /* Keypad Interface Automatic Scan Multiple Key Presser register 2 */ -#define KPASMKP3 0x41500040 /* Keypad Interface Automatic Scan Multiple Key Presser register 3 */ -#define KPKDI 0x41500048 /* Keypad Interface Key Debounce Interval register */ - -#define KPC_AS (0x1 30) /* Automatic Scan bit */ -#define KPC_ASACT(0x1 29) /* Automatic Scan on Activity */ -#define KPC_MI (0x1 22) /* Matrix interrupt bit */ -#define KPC_IMKP (0x1 21) /* Ignore Multiple Key Press */ -#define KPC_MS7 (0x1 20) /* Matrix scan line 7 */ -#define KPC_MS6 (0x1 19) /* Matrix scan line 6 */ -#define KPC_MS5 (0x1 18) /* Matrix scan line 5 */ -#define KPC_MS4 (0x1 17) /* Matrix scan line 4 */ -#define KPC_MS3 (0x1 16) /* Matrix scan line 3 */ -#define KPC_MS2 (0x1 15) /* Matrix scan line 2 */ -#define KPC_MS1 (0x1 14) /* Matrix scan line 1 */ -#define KPC_MS0 (0x1 13) /* Matrix scan line 0 */ -#define KPC_ME (0x1 12) /* Matrix Keypad Enable */ -#define KPC_MIE (0x1 11) /* Matrix Interrupt Enable */ -#define KPC_DK_DEB_SEL (0x1 9) /* Direct Key Debounce select */ -#define KPC_DI (0x1 5) /* Direct key interrupt bit */ -#define KPC_DEE0 (0x1 2) /* Rotary Encoder 0 Enable */ -#define KPC_DE (0x1 1) /* Direct Keypad Enable */ -#define KPC_DIE (0x1 0) /* Direct Keypad interrupt Enable */ - -#define KPDK_DKP (0x1 31) -#define KPDK_DK7 (0x1 7) -#define KPDK_DK6 (0x1 6) -#define KPDK_DK5 (0x1 5) -#define KPDK_DK4 (0x1 4) -#define KPDK_DK3 (0x1 3) -#define KPDK_DK2 (0x1 2) -#define KPDK_DK1 (0x1 1) -#define KPDK_DK0 (0x1 0) - -#define KPREC_OF1(0x1 31) -#define kPREC_UF1(0x1 30) -#define KPREC_OF0(0x1 15) -#define KPREC_UF0(0x1 14) - -#define KPMK_MKP (0x1 31) -#define KPAS_SO (0x1 31) -#define KPASMKPx_SO (0x1 31) - #define GPIO113_BIT (1 17)/* GPIO113 in GPSR, GPCR, bit 17 */ #define PSLR 0x40F00034 #define PSTR 0x40F00038 /* Power Manager Standby Configuration Reg */ diff --git a/arch/arm/include/asm/arch-pxa/regs-keypad.h b/arch/arm/include/asm/arch-pxa/regs-keypad.h new file mode 100644 index 000..f13da56 --- /dev/null +++ b/arch/arm/include/asm/arch-pxa/regs-keypad.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2012 Vasily Khoruzhick anars...@gmail.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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