blob: 6aa53fb29d2663c58add1cf9139dd65ed6642eb9 [file] [log] [blame]
Mark F. Brown1bbd7082010-09-12 23:51:34 -04001/*
2 * linux/arch/arm/mach-mmp/teton_bga.c
3 *
4 * Support for the Marvell PXA168 Teton BGA Development Platform.
5 *
6 * Author: Mark F. Brown <mark.brown314@gmail.com>
7 *
8 * This code is based on aspenite.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * publishhed by the Free Software Foundation.
13 */
14
15#include <linux/init.h>
16#include <linux/kernel.h>
17#include <linux/platform_device.h>
18#include <linux/gpio.h>
Haojian Zhuangb8f649f2013-04-09 18:12:04 +080019#include <linux/gpio-pxa.h>
Mark F. Brownd2ce6972010-09-12 23:51:35 -040020#include <linux/input.h>
Arnd Bergmann293b2da2012-08-24 15:16:48 +020021#include <linux/platform_data/keypad-pxa27x.h>
Mark F. Brown759305c2010-09-12 23:51:36 -040022#include <linux/i2c.h>
Mark F. Brown1bbd7082010-09-12 23:51:34 -040023
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26#include <mach/addr-map.h>
27#include <mach/mfp-pxa168.h>
28#include <mach/pxa168.h>
29#include <mach/teton_bga.h>
Rob Herring8661fb92012-01-03 16:50:40 -060030#include <mach/irqs.h>
Mark F. Brown1bbd7082010-09-12 23:51:34 -040031
32#include "common.h"
33
34static unsigned long teton_bga_pin_config[] __initdata = {
35 /* UART1 */
36 GPIO107_UART1_TXD,
37 GPIO108_UART1_RXD,
Mark F. Brownd2ce6972010-09-12 23:51:35 -040038
39 /* Keypad */
40 GPIO109_KP_MKIN1,
41 GPIO110_KP_MKIN0,
42 GPIO111_KP_MKOUT7,
43 GPIO112_KP_MKOUT6,
Mark F. Brown759305c2010-09-12 23:51:36 -040044
45 /* I2C Bus */
46 GPIO105_CI2C_SDA,
47 GPIO106_CI2C_SCL,
48
49 /* RTC */
50 GPIO78_GPIO,
Mark F. Brownd2ce6972010-09-12 23:51:35 -040051};
52
Haojian Zhuangb8f649f2013-04-09 18:12:04 +080053static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
54 .irq_base = MMP_GPIO_TO_IRQ(0),
55};
56
Mark F. Brownd2ce6972010-09-12 23:51:35 -040057static unsigned int teton_bga_matrix_key_map[] = {
58 KEY(0, 6, KEY_ESC),
59 KEY(0, 7, KEY_ENTER),
60 KEY(1, 6, KEY_LEFT),
61 KEY(1, 7, KEY_RIGHT),
62};
63
Chao Xie0a085a92013-05-05 20:24:58 -070064static struct matrix_keymap_data teton_bga_matrix_keymap_data = {
65 .keymap = teton_bga_matrix_key_map,
66 .keymap_size = ARRAY_SIZE(teton_bga_matrix_key_map),
67};
68
Mark F. Brownd2ce6972010-09-12 23:51:35 -040069static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = {
70 .matrix_key_rows = 2,
71 .matrix_key_cols = 8,
Chao Xie0a085a92013-05-05 20:24:58 -070072 .matrix_keymap_data = &teton_bga_matrix_keymap_data,
Mark F. Brownd2ce6972010-09-12 23:51:35 -040073 .debounce_interval = 30,
Mark F. Brown1bbd7082010-09-12 23:51:34 -040074};
75
Mark F. Brown759305c2010-09-12 23:51:36 -040076static struct i2c_board_info teton_bga_i2c_info[] __initdata = {
77 {
78 I2C_BOARD_INFO("ds1337", 0x68),
Haojian Zhuang4929f5a2011-10-10 16:03:51 +080079 .irq = MMP_GPIO_TO_IRQ(RTC_INT_GPIO)
Mark F. Brown759305c2010-09-12 23:51:36 -040080 },
81};
82
Mark F. Brown1bbd7082010-09-12 23:51:34 -040083static void __init teton_bga_init(void)
84{
85 mfp_config(ARRAY_AND_SIZE(teton_bga_pin_config));
86
87 /* on-chip devices */
88 pxa168_add_uart(1);
Mark F. Brownd2ce6972010-09-12 23:51:35 -040089 pxa168_add_keypad(&teton_bga_keypad_info);
Mark F. Brown759305c2010-09-12 23:51:36 -040090 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info));
Haojian Zhuangb8f649f2013-04-09 18:12:04 +080091 platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
92 sizeof(struct pxa_gpio_platform_data));
Haojian Zhuang157d2642011-10-17 20:37:52 +080093 platform_device_register(&pxa168_device_gpio);
Mark F. Brown1bbd7082010-09-12 23:51:34 -040094}
95
96MACHINE_START(TETON_BGA, "PXA168-based Teton BGA Development Platform")
Mark F. Brown1bbd7082010-09-12 23:51:34 -040097 .map_io = mmp_map_io,
Rob Herring8661fb92012-01-03 16:50:40 -060098 .nr_irqs = MMP_NR_IRQS,
Mark F. Brown1bbd7082010-09-12 23:51:34 -040099 .init_irq = pxa168_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700100 .init_time = pxa168_timer_init,
Mark F. Brown1bbd7082010-09-12 23:51:34 -0400101 .init_machine = teton_bga_init,
Russell King9854a382011-11-05 15:40:09 +0000102 .restart = pxa168_restart,
Mark F. Brown1bbd7082010-09-12 23:51:34 -0400103MACHINE_END