aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorMiguel Aguilar <miguel.aguilar@ridgerun.com>2009-10-13 15:57:07 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-11-25 13:21:32 -0500
commit990c09d5f5b2079e8bf3c6615c78fa5ed2b97147 (patch)
tree3f1bd62c06d7cdf354a6e0ea34325e8f60853c06 /arch/arm
parent1ce52121c415457e92c281aaec4b38a864278fa2 (diff)
Davinci: DM365: Enable DaVinci Key Scan support for DM365 EVM
The general structures are defined at DM365 SoC file and the specific platform data structure for the EVM is defined at board file. Signed-off-by: Miguel Aguilar <miguel.aguilar@ridgerun.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-davinci/board-dm365-evm.c38
-rw-r--r--arch/arm/mach-davinci/dm365.c32
-rw-r--r--arch/arm/mach-davinci/include/mach/dm365.h5
-rw-r--r--arch/arm/mach-davinci/include/mach/mux.h4
4 files changed, 76 insertions, 3 deletions
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index 3d7b5bbeb97d..19678dc91b09 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -23,6 +23,7 @@
23#include <linux/mtd/mtd.h> 23#include <linux/mtd/mtd.h>
24#include <linux/mtd/partitions.h> 24#include <linux/mtd/partitions.h>
25#include <linux/mtd/nand.h> 25#include <linux/mtd/nand.h>
26#include <linux/input.h>
26 27
27#include <asm/mach-types.h> 28#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
@@ -34,6 +35,7 @@
34#include <mach/serial.h> 35#include <mach/serial.h>
35#include <mach/mmc.h> 36#include <mach/mmc.h>
36#include <mach/nand.h> 37#include <mach/nand.h>
38#include <mach/keyscan.h>
37 39
38static inline int have_imager(void) 40static inline int have_imager(void)
39{ 41{
@@ -190,6 +192,38 @@ static struct davinci_i2c_platform_data i2c_pdata = {
190 .bus_delay = 0 /* usec */, 192 .bus_delay = 0 /* usec */,
191}; 193};
192 194
195#ifdef CONFIG_KEYBOARD_DAVINCI
196static unsigned short dm365evm_keymap[] = {
197 KEY_KP2,
198 KEY_LEFT,
199 KEY_EXIT,
200 KEY_DOWN,
201 KEY_ENTER,
202 KEY_UP,
203 KEY_KP1,
204 KEY_RIGHT,
205 KEY_MENU,
206 KEY_RECORD,
207 KEY_REWIND,
208 KEY_KPMINUS,
209 KEY_STOP,
210 KEY_FASTFORWARD,
211 KEY_KPPLUS,
212 KEY_PLAYPAUSE,
213 0
214};
215
216static struct davinci_ks_platform_data dm365evm_ks_data = {
217 .keymap = dm365evm_keymap,
218 .keymapsize = ARRAY_SIZE(dm365evm_keymap),
219 .rep = 1,
220 /* Scan period = strobe + interval */
221 .strobe = 0x5,
222 .interval = 0x2,
223 .matrix_type = DAVINCI_KEYSCAN_MATRIX_4X4,
224};
225#endif
226
193static int cpld_mmc_get_cd(int module) 227static int cpld_mmc_get_cd(int module)
194{ 228{
195 if (!cpld) 229 if (!cpld)
@@ -476,6 +510,10 @@ static __init void dm365_evm_init(void)
476 evm_init_cpld(); 510 evm_init_cpld();
477 511
478 dm365_init_asp(&dm365_evm_snd_data); 512 dm365_init_asp(&dm365_evm_snd_data);
513
514#ifdef CONFIG_KEYBOARD_DAVINCI
515 dm365_init_ks(&dm365evm_ks_data);
516#endif
479} 517}
480 518
481static __init void dm365_evm_irq_init(void) 519static __init void dm365_evm_irq_init(void)
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 0fbc2f261ee3..c12bb005b90d 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -31,6 +31,7 @@
31#include <mach/serial.h> 31#include <mach/serial.h>
32#include <mach/common.h> 32#include <mach/common.h>
33#include <mach/asp.h> 33#include <mach/asp.h>
34#include <mach/keyscan.h>
34 35
35#include "clock.h" 36#include "clock.h"
36#include "mux.h" 37#include "mux.h"
@@ -530,7 +531,7 @@ MUX_CFG(DM365, EMAC_CRS, 3, 2, 1, 1, false)
530MUX_CFG(DM365, EMAC_MDIO, 3, 1, 1, 1, false) 531MUX_CFG(DM365, EMAC_MDIO, 3, 1, 1, 1, false)
531MUX_CFG(DM365, EMAC_MDCLK, 3, 0, 1, 1, false) 532MUX_CFG(DM365, EMAC_MDCLK, 3, 0, 1, 1, false)
532 533
533MUX_CFG(DM365, KEYPAD, 2, 0, 0x3f, 0x3f, false) 534MUX_CFG(DM365, KEYSCAN, 2, 0, 0x3f, 0x3f, false)
534 535
535MUX_CFG(DM365, PWM0, 1, 0, 3, 2, false) 536MUX_CFG(DM365, PWM0, 1, 0, 3, 2, false)
536MUX_CFG(DM365, PWM0_G23, 3, 26, 3, 3, false) 537MUX_CFG(DM365, PWM0_G23, 3, 26, 3, 3, false)
@@ -849,6 +850,28 @@ static struct map_desc dm365_io_desc[] = {
849 }, 850 },
850}; 851};
851 852
853static struct resource dm365_ks_resources[] = {
854 {
855 /* registers */
856 .start = DM365_KEYSCAN_BASE,
857 .end = DM365_KEYSCAN_BASE + SZ_1K - 1,
858 .flags = IORESOURCE_MEM,
859 },
860 {
861 /* interrupt */
862 .start = IRQ_DM365_KEYINT,
863 .end = IRQ_DM365_KEYINT,
864 .flags = IORESOURCE_IRQ,
865 },
866};
867
868static struct platform_device dm365_ks_device = {
869 .name = "davinci_keyscan",
870 .id = 0,
871 .num_resources = ARRAY_SIZE(dm365_ks_resources),
872 .resource = dm365_ks_resources,
873};
874
852/* Contents of JTAG ID register used to identify exact cpu type */ 875/* Contents of JTAG ID register used to identify exact cpu type */
853static struct davinci_id dm365_ids[] = { 876static struct davinci_id dm365_ids[] = {
854 { 877 {
@@ -948,6 +971,13 @@ void __init dm365_init_asp(struct snd_platform_data *pdata)
948 platform_device_register(&dm365_asp_device); 971 platform_device_register(&dm365_asp_device);
949} 972}
950 973
974void __init dm365_init_ks(struct davinci_ks_platform_data *pdata)
975{
976 davinci_cfg_reg(DM365_KEYSCAN);
977 dm365_ks_device.dev.platform_data = pdata;
978 platform_device_register(&dm365_ks_device);
979}
980
951void __init dm365_init(void) 981void __init dm365_init(void)
952{ 982{
953 davinci_common_init(&davinci_soc_info_dm365); 983 davinci_common_init(&davinci_soc_info_dm365);
diff --git a/arch/arm/mach-davinci/include/mach/dm365.h b/arch/arm/mach-davinci/include/mach/dm365.h
index 2291c0d2c2a0..d8d988a0b58b 100644
--- a/arch/arm/mach-davinci/include/mach/dm365.h
+++ b/arch/arm/mach-davinci/include/mach/dm365.h
@@ -17,6 +17,7 @@
17#include <mach/hardware.h> 17#include <mach/hardware.h>
18#include <mach/emac.h> 18#include <mach/emac.h>
19#include <mach/asp.h> 19#include <mach/asp.h>
20#include <mach/keyscan.h>
20 21
21#define DM365_EMAC_BASE (0x01D07000) 22#define DM365_EMAC_BASE (0x01D07000)
22#define DM365_EMAC_CNTRL_OFFSET (0x0000) 23#define DM365_EMAC_CNTRL_OFFSET (0x0000)
@@ -25,7 +26,11 @@
25#define DM365_EMAC_MDIO_OFFSET (0x4000) 26#define DM365_EMAC_MDIO_OFFSET (0x4000)
26#define DM365_EMAC_CNTRL_RAM_SIZE (0x2000) 27#define DM365_EMAC_CNTRL_RAM_SIZE (0x2000)
27 28
29/* Base of key scan register bank */
30#define DM365_KEYSCAN_BASE (0x01C69400)
31
28void __init dm365_init(void); 32void __init dm365_init(void);
29void __init dm365_init_asp(struct snd_platform_data *pdata); 33void __init dm365_init_asp(struct snd_platform_data *pdata);
34void __init dm365_init_ks(struct davinci_ks_platform_data *pdata);
30 35
31#endif /* __ASM_ARCH_DM365_H */ 36#endif /* __ASM_ARCH_DM365_H */
diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h
index 16b8a7fc39bd..d41ad16966b7 100644
--- a/arch/arm/mach-davinci/include/mach/mux.h
+++ b/arch/arm/mach-davinci/include/mach/mux.h
@@ -237,8 +237,8 @@ enum davinci_dm365_index {
237 DM365_EMAC_MDIO, 237 DM365_EMAC_MDIO,
238 DM365_EMAC_MDCLK, 238 DM365_EMAC_MDCLK,
239 239
240 /* Keypad */ 240 /* Key Scan */
241 DM365_KEYPAD, 241 DM365_KEYSCAN,
242 242
243 /* PWM */ 243 /* PWM */
244 DM365_PWM0, 244 DM365_PWM0,