aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ux500
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-ux500')
-rw-r--r--arch/arm/mach-ux500/board-mop500.c129
-rw-r--r--arch/arm/mach-ux500/clock.c1
-rw-r--r--arch/arm/mach-ux500/devices-db8500.c20
-rw-r--r--arch/arm/mach-ux500/include/mach/devices.h1
-rw-r--r--arch/arm/mach-ux500/pins-db8500.h32
5 files changed, 167 insertions, 16 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 0e8fd135a57d..5265fb9835cc 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -18,12 +18,14 @@
18#include <linux/amba/pl022.h> 18#include <linux/amba/pl022.h>
19#include <linux/spi/spi.h> 19#include <linux/spi/spi.h>
20#include <linux/mfd/ab8500.h> 20#include <linux/mfd/ab8500.h>
21#include <linux/input/matrix_keypad.h>
21 22
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24 25
25#include <plat/pincfg.h> 26#include <plat/pincfg.h>
26#include <plat/i2c.h> 27#include <plat/i2c.h>
28#include <plat/ske.h>
27 29
28#include <mach/hardware.h> 30#include <mach/hardware.h>
29#include <mach/setup.h> 31#include <mach/setup.h>
@@ -47,6 +49,24 @@ static pin_cfg_t mop500_pins[] = {
47 GPIO11_I2C2_SCL, 49 GPIO11_I2C2_SCL,
48 GPIO229_I2C3_SDA, 50 GPIO229_I2C3_SDA,
49 GPIO230_I2C3_SCL, 51 GPIO230_I2C3_SCL,
52
53 /* SKE keypad */
54 GPIO153_KP_I7,
55 GPIO154_KP_I6,
56 GPIO155_KP_I5,
57 GPIO156_KP_I4,
58 GPIO157_KP_O7,
59 GPIO158_KP_O6,
60 GPIO159_KP_O5,
61 GPIO160_KP_O4,
62 GPIO161_KP_I3,
63 GPIO162_KP_I2,
64 GPIO163_KP_I1,
65 GPIO164_KP_I0,
66 GPIO165_KP_O3,
67 GPIO166_KP_O2,
68 GPIO167_KP_O1,
69 GPIO168_KP_O0,
50}; 70};
51 71
52static void ab4500_spi_cs_control(u32 command) 72static void ab4500_spi_cs_control(u32 command)
@@ -134,12 +154,120 @@ static struct amba_device *amba_devs[] __initdata = {
134 &u8500_ssp0_device, 154 &u8500_ssp0_device,
135}; 155};
136 156
157static const unsigned int ux500_keymap[] = {
158 KEY(2, 5, KEY_END),
159 KEY(4, 1, KEY_POWER),
160 KEY(3, 5, KEY_VOLUMEDOWN),
161 KEY(1, 3, KEY_3),
162 KEY(5, 2, KEY_RIGHT),
163 KEY(5, 0, KEY_9),
164
165 KEY(0, 5, KEY_MENU),
166 KEY(7, 6, KEY_ENTER),
167 KEY(4, 5, KEY_0),
168 KEY(6, 7, KEY_2),
169 KEY(3, 4, KEY_UP),
170 KEY(3, 3, KEY_DOWN),
171
172 KEY(6, 4, KEY_SEND),
173 KEY(6, 2, KEY_BACK),
174 KEY(4, 2, KEY_VOLUMEUP),
175 KEY(5, 5, KEY_1),
176 KEY(4, 3, KEY_LEFT),
177 KEY(3, 2, KEY_7),
178};
179
180static const struct matrix_keymap_data ux500_keymap_data = {
181 .keymap = ux500_keymap,
182 .keymap_size = ARRAY_SIZE(ux500_keymap),
183};
184
185/*
186 * Nomadik SKE keypad
187 */
188#define ROW_PIN_I0 164
189#define ROW_PIN_I1 163
190#define ROW_PIN_I2 162
191#define ROW_PIN_I3 161
192#define ROW_PIN_I4 156
193#define ROW_PIN_I5 155
194#define ROW_PIN_I6 154
195#define ROW_PIN_I7 153
196#define COL_PIN_O0 168
197#define COL_PIN_O1 167
198#define COL_PIN_O2 166
199#define COL_PIN_O3 165
200#define COL_PIN_O4 160
201#define COL_PIN_O5 159
202#define COL_PIN_O6 158
203#define COL_PIN_O7 157
204
205#define SKE_KPD_MAX_ROWS 8
206#define SKE_KPD_MAX_COLS 8
207
208static int ske_kp_rows[] = {
209 ROW_PIN_I0, ROW_PIN_I1, ROW_PIN_I2, ROW_PIN_I3,
210 ROW_PIN_I4, ROW_PIN_I5, ROW_PIN_I6, ROW_PIN_I7,
211};
212
213/*
214 * ske_set_gpio_row: request and set gpio rows
215 */
216static int ske_set_gpio_row(int gpio)
217{
218 int ret;
219
220 ret = gpio_request(gpio, "ske-kp");
221 if (ret < 0) {
222 pr_err("ske_set_gpio_row: gpio request failed\n");
223 return ret;
224 }
225
226 ret = gpio_direction_output(gpio, 1);
227 if (ret < 0) {
228 pr_err("ske_set_gpio_row: gpio direction failed\n");
229 gpio_free(gpio);
230 }
231
232 return ret;
233}
234
235/*
236 * ske_kp_init - enable the gpio configuration
237 */
238static int ske_kp_init(void)
239{
240 int ret, i;
241
242 for (i = 0; i < SKE_KPD_MAX_ROWS; i++) {
243 ret = ske_set_gpio_row(ske_kp_rows[i]);
244 if (ret < 0) {
245 pr_err("ske_kp_init: failed init\n");
246 return ret;
247 }
248 }
249
250 return 0;
251}
252
253static struct ske_keypad_platform_data ske_keypad_board = {
254 .init = ske_kp_init,
255 .keymap_data = &ux500_keymap_data,
256 .no_autorepeat = true,
257 .krow = SKE_KPD_MAX_ROWS, /* 8x8 matrix */
258 .kcol = SKE_KPD_MAX_COLS,
259 .debounce_ms = 40, /* in millsecs */
260};
261
262
263
137/* add any platform devices here - TODO */ 264/* add any platform devices here - TODO */
138static struct platform_device *platform_devs[] __initdata = { 265static struct platform_device *platform_devs[] __initdata = {
139 &u8500_i2c0_device, 266 &u8500_i2c0_device,
140 &ux500_i2c1_device, 267 &ux500_i2c1_device,
141 &ux500_i2c2_device, 268 &ux500_i2c2_device,
142 &ux500_i2c3_device, 269 &ux500_i2c3_device,
270 &ux500_ske_keypad_device,
143}; 271};
144 272
145static void __init u8500_init_machine(void) 273static void __init u8500_init_machine(void)
@@ -154,6 +282,7 @@ static void __init u8500_init_machine(void)
154 ux500_i2c1_device.dev.platform_data = &u8500_i2c1_data; 282 ux500_i2c1_device.dev.platform_data = &u8500_i2c1_data;
155 ux500_i2c2_device.dev.platform_data = &u8500_i2c2_data; 283 ux500_i2c2_device.dev.platform_data = &u8500_i2c2_data;
156 ux500_i2c3_device.dev.platform_data = &u8500_i2c3_data; 284 ux500_i2c3_device.dev.platform_data = &u8500_i2c3_data;
285 ux500_ske_keypad_device.dev.platform_data = &ske_keypad_board;
157 286
158 u8500_ssp0_device.dev.platform_data = &ssp0_platform_data; 287 u8500_ssp0_device.dev.platform_data = &ssp0_platform_data;
159 288
diff --git a/arch/arm/mach-ux500/clock.c b/arch/arm/mach-ux500/clock.c
index d8ab7f184fe4..1675047daf20 100644
--- a/arch/arm/mach-ux500/clock.c
+++ b/arch/arm/mach-ux500/clock.c
@@ -477,6 +477,7 @@ static struct clk_lookup u8500_common_clks[] = {
477 CLK(sdi5, "sdi5", NULL), 477 CLK(sdi5, "sdi5", NULL),
478 CLK(uart2, "uart2", NULL), 478 CLK(uart2, "uart2", NULL),
479 CLK(ske, "ske", NULL), 479 CLK(ske, "ske", NULL),
480 CLK(ske, "nmk-ske-keypad", NULL),
480 CLK(sdi2, "sdi2", NULL), 481 CLK(sdi2, "sdi2", NULL),
481 CLK(i2c0, "nmk-i2c.0", NULL), 482 CLK(i2c0, "nmk-i2c.0", NULL),
482 CLK(fsmc, "fsmc", NULL), 483 CLK(fsmc, "fsmc", NULL),
diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c
index 9280d2561111..735aaeec2c19 100644
--- a/arch/arm/mach-ux500/devices-db8500.c
+++ b/arch/arm/mach-ux500/devices-db8500.c
@@ -216,3 +216,23 @@ void dma40_u8500ed_fixup(void)
216 dma40_resources[1].start = U8500_DMA_LCPA_BASE_ED; 216 dma40_resources[1].start = U8500_DMA_LCPA_BASE_ED;
217 dma40_resources[1].end = U8500_DMA_LCPA_BASE_ED + 2 * SZ_1K - 1; 217 dma40_resources[1].end = U8500_DMA_LCPA_BASE_ED + 2 * SZ_1K - 1;
218} 218}
219
220struct resource keypad_resources[] = {
221 [0] = {
222 .start = U8500_SKE_BASE,
223 .end = U8500_SKE_BASE + SZ_4K - 1,
224 .flags = IORESOURCE_MEM,
225 },
226 [1] = {
227 .start = IRQ_DB8500_KB,
228 .end = IRQ_DB8500_KB,
229 .flags = IORESOURCE_IRQ,
230 },
231};
232
233struct platform_device ux500_ske_keypad_device = {
234 .name = "nmk-ske-keypad",
235 .id = -1,
236 .num_resources = ARRAY_SIZE(keypad_resources),
237 .resource = keypad_resources,
238};
diff --git a/arch/arm/mach-ux500/include/mach/devices.h b/arch/arm/mach-ux500/include/mach/devices.h
index c2b2f2574947..12e6606e34b1 100644
--- a/arch/arm/mach-ux500/include/mach/devices.h
+++ b/arch/arm/mach-ux500/include/mach/devices.h
@@ -26,6 +26,7 @@ extern struct platform_device ux500_i2c3_device;
26extern struct platform_device u8500_i2c0_device; 26extern struct platform_device u8500_i2c0_device;
27extern struct platform_device u8500_i2c4_device; 27extern struct platform_device u8500_i2c4_device;
28extern struct platform_device u8500_dma40_device; 28extern struct platform_device u8500_dma40_device;
29extern struct platform_device ux500_ske_keypad_device;
29 30
30void dma40_u8500ed_fixup(void); 31void dma40_u8500ed_fixup(void);
31 32
diff --git a/arch/arm/mach-ux500/pins-db8500.h b/arch/arm/mach-ux500/pins-db8500.h
index 9055d5d3233c..8cf06494e8c6 100644
--- a/arch/arm/mach-ux500/pins-db8500.h
+++ b/arch/arm/mach-ux500/pins-db8500.h
@@ -459,82 +459,82 @@
459#define GPIO152_KP_O9 PIN_CFG(152, ALT_C) 459#define GPIO152_KP_O9 PIN_CFG(152, ALT_C)
460 460
461#define GPIO153_GPIO PIN_CFG(153, GPIO) 461#define GPIO153_GPIO PIN_CFG(153, GPIO)
462#define GPIO153_KP_I7 PIN_CFG(153, ALT_A) 462#define GPIO153_KP_I7 PIN_CFG_PULL(153, ALT_A, DOWN)
463#define GPIO153_LCD_D24 PIN_CFG(153, ALT_B) 463#define GPIO153_LCD_D24 PIN_CFG(153, ALT_B)
464#define GPIO153_U2_RXD PIN_CFG(153, ALT_C) 464#define GPIO153_U2_RXD PIN_CFG(153, ALT_C)
465 465
466#define GPIO154_GPIO PIN_CFG(154, GPIO) 466#define GPIO154_GPIO PIN_CFG(154, GPIO)
467#define GPIO154_KP_I6 PIN_CFG(154, ALT_A) 467#define GPIO154_KP_I6 PIN_CFG_PULL(154, ALT_A, DOWN)
468#define GPIO154_LCD_D25 PIN_CFG(154, ALT_B) 468#define GPIO154_LCD_D25 PIN_CFG(154, ALT_B)
469#define GPIO154_U2_TXD PIN_CFG(154, ALT_C) 469#define GPIO154_U2_TXD PIN_CFG(154, ALT_C)
470 470
471#define GPIO155_GPIO PIN_CFG(155, GPIO) 471#define GPIO155_GPIO PIN_CFG(155, GPIO)
472#define GPIO155_KP_I5 PIN_CFG(155, ALT_A) 472#define GPIO155_KP_I5 PIN_CFG_PULL(155, ALT_A, DOWN)
473#define GPIO155_LCD_D26 PIN_CFG(155, ALT_B) 473#define GPIO155_LCD_D26 PIN_CFG(155, ALT_B)
474#define GPIO155_STMAPE_CLK PIN_CFG(155, ALT_C) 474#define GPIO155_STMAPE_CLK PIN_CFG(155, ALT_C)
475 475
476#define GPIO156_GPIO PIN_CFG(156, GPIO) 476#define GPIO156_GPIO PIN_CFG(156, GPIO)
477#define GPIO156_KP_I4 PIN_CFG(156, ALT_A) 477#define GPIO156_KP_I4 PIN_CFG_PULL(156, ALT_A, DOWN)
478#define GPIO156_LCD_D27 PIN_CFG(156, ALT_B) 478#define GPIO156_LCD_D27 PIN_CFG(156, ALT_B)
479#define GPIO156_STMAPE_DAT3 PIN_CFG(156, ALT_C) 479#define GPIO156_STMAPE_DAT3 PIN_CFG(156, ALT_C)
480 480
481#define GPIO157_GPIO PIN_CFG(157, GPIO) 481#define GPIO157_GPIO PIN_CFG(157, GPIO)
482#define GPIO157_KP_O7 PIN_CFG(157, ALT_A) 482#define GPIO157_KP_O7 PIN_CFG_PULL(157, ALT_A, UP)
483#define GPIO157_LCD_D28 PIN_CFG(157, ALT_B) 483#define GPIO157_LCD_D28 PIN_CFG(157, ALT_B)
484#define GPIO157_STMAPE_DAT2 PIN_CFG(157, ALT_C) 484#define GPIO157_STMAPE_DAT2 PIN_CFG(157, ALT_C)
485 485
486#define GPIO158_GPIO PIN_CFG(158, GPIO) 486#define GPIO158_GPIO PIN_CFG(158, GPIO)
487#define GPIO158_KP_O6 PIN_CFG(158, ALT_A) 487#define GPIO158_KP_O6 PIN_CFG_PULL(158, ALT_A, UP)
488#define GPIO158_LCD_D29 PIN_CFG(158, ALT_B) 488#define GPIO158_LCD_D29 PIN_CFG(158, ALT_B)
489#define GPIO158_STMAPE_DAT1 PIN_CFG(158, ALT_C) 489#define GPIO158_STMAPE_DAT1 PIN_CFG(158, ALT_C)
490 490
491#define GPIO159_GPIO PIN_CFG(159, GPIO) 491#define GPIO159_GPIO PIN_CFG(159, GPIO)
492#define GPIO159_KP_O5 PIN_CFG(159, ALT_A) 492#define GPIO159_KP_O5 PIN_CFG_PULL(159, ALT_A, UP)
493#define GPIO159_LCD_D30 PIN_CFG(159, ALT_B) 493#define GPIO159_LCD_D30 PIN_CFG(159, ALT_B)
494#define GPIO159_STMAPE_DAT0 PIN_CFG(159, ALT_C) 494#define GPIO159_STMAPE_DAT0 PIN_CFG(159, ALT_C)
495 495
496#define GPIO160_GPIO PIN_CFG(160, GPIO) 496#define GPIO160_GPIO PIN_CFG(160, GPIO)
497#define GPIO160_KP_O4 PIN_CFG(160, ALT_A) 497#define GPIO160_KP_O4 PIN_CFG_PULL(160, ALT_A, UP)
498#define GPIO160_LCD_D31 PIN_CFG(160, ALT_B) 498#define GPIO160_LCD_D31 PIN_CFG(160, ALT_B)
499#define GPIO160_NONE PIN_CFG(160, ALT_C) 499#define GPIO160_NONE PIN_CFG(160, ALT_C)
500 500
501#define GPIO161_GPIO PIN_CFG(161, GPIO) 501#define GPIO161_GPIO PIN_CFG(161, GPIO)
502#define GPIO161_KP_I3 PIN_CFG(161, ALT_A) 502#define GPIO161_KP_I3 PIN_CFG_PULL(161, ALT_A, DOWN)
503#define GPIO161_LCD_D32 PIN_CFG(161, ALT_B) 503#define GPIO161_LCD_D32 PIN_CFG(161, ALT_B)
504#define GPIO161_UARTMOD_RXD PIN_CFG(161, ALT_C) 504#define GPIO161_UARTMOD_RXD PIN_CFG(161, ALT_C)
505 505
506#define GPIO162_GPIO PIN_CFG(162, GPIO) 506#define GPIO162_GPIO PIN_CFG(162, GPIO)
507#define GPIO162_KP_I2 PIN_CFG(162, ALT_A) 507#define GPIO162_KP_I2 PIN_CFG_PULL(162, ALT_A, DOWN)
508#define GPIO162_LCD_D33 PIN_CFG(162, ALT_B) 508#define GPIO162_LCD_D33 PIN_CFG(162, ALT_B)
509#define GPIO162_UARTMOD_TXD PIN_CFG(162, ALT_C) 509#define GPIO162_UARTMOD_TXD PIN_CFG(162, ALT_C)
510 510
511#define GPIO163_GPIO PIN_CFG(163, GPIO) 511#define GPIO163_GPIO PIN_CFG(163, GPIO)
512#define GPIO163_KP_I1 PIN_CFG(163, ALT_A) 512#define GPIO163_KP_I1 PIN_CFG_PULL(163, ALT_A, DOWN)
513#define GPIO163_LCD_D34 PIN_CFG(163, ALT_B) 513#define GPIO163_LCD_D34 PIN_CFG(163, ALT_B)
514#define GPIO163_STMMOD_CLK PIN_CFG(163, ALT_C) 514#define GPIO163_STMMOD_CLK PIN_CFG(163, ALT_C)
515 515
516#define GPIO164_GPIO PIN_CFG(164, GPIO) 516#define GPIO164_GPIO PIN_CFG(164, GPIO)
517#define GPIO164_KP_I0 PIN_CFG(164, ALT_A) 517#define GPIO164_KP_I0 PIN_CFG_PULL(164, ALT_A, UP)
518#define GPIO164_LCD_D35 PIN_CFG(164, ALT_B) 518#define GPIO164_LCD_D35 PIN_CFG(164, ALT_B)
519#define GPIO164_STMMOD_DAT3 PIN_CFG(164, ALT_C) 519#define GPIO164_STMMOD_DAT3 PIN_CFG(164, ALT_C)
520 520
521#define GPIO165_GPIO PIN_CFG(165, GPIO) 521#define GPIO165_GPIO PIN_CFG(165, GPIO)
522#define GPIO165_KP_O3 PIN_CFG(165, ALT_A) 522#define GPIO165_KP_O3 PIN_CFG_PULL(165, ALT_A, UP)
523#define GPIO165_LCD_D36 PIN_CFG(165, ALT_B) 523#define GPIO165_LCD_D36 PIN_CFG(165, ALT_B)
524#define GPIO165_STMMOD_DAT2 PIN_CFG(165, ALT_C) 524#define GPIO165_STMMOD_DAT2 PIN_CFG(165, ALT_C)
525 525
526#define GPIO166_GPIO PIN_CFG(166, GPIO) 526#define GPIO166_GPIO PIN_CFG(166, GPIO)
527#define GPIO166_KP_O2 PIN_CFG(166, ALT_A) 527#define GPIO166_KP_O2 PIN_CFG_PULL(166, ALT_A, UP)
528#define GPIO166_LCD_D37 PIN_CFG(166, ALT_B) 528#define GPIO166_LCD_D37 PIN_CFG(166, ALT_B)
529#define GPIO166_STMMOD_DAT1 PIN_CFG(166, ALT_C) 529#define GPIO166_STMMOD_DAT1 PIN_CFG(166, ALT_C)
530 530
531#define GPIO167_GPIO PIN_CFG(167, GPIO) 531#define GPIO167_GPIO PIN_CFG(167, GPIO)
532#define GPIO167_KP_O1 PIN_CFG(167, ALT_A) 532#define GPIO167_KP_O1 PIN_CFG_PULL(167, ALT_A, UP)
533#define GPIO167_LCD_D38 PIN_CFG(167, ALT_B) 533#define GPIO167_LCD_D38 PIN_CFG(167, ALT_B)
534#define GPIO167_STMMOD_DAT0 PIN_CFG(167, ALT_C) 534#define GPIO167_STMMOD_DAT0 PIN_CFG(167, ALT_C)
535 535
536#define GPIO168_GPIO PIN_CFG(168, GPIO) 536#define GPIO168_GPIO PIN_CFG(168, GPIO)
537#define GPIO168_KP_O0 PIN_CFG(168, ALT_A) 537#define GPIO168_KP_O0 PIN_CFG_PULL(168, ALT_A, UP)
538#define GPIO168_LCD_D39 PIN_CFG(168, ALT_B) 538#define GPIO168_LCD_D39 PIN_CFG(168, ALT_B)
539#define GPIO168_NONE PIN_CFG(168, ALT_C) 539#define GPIO168_NONE PIN_CFG(168, ALT_C)
540 540