1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 *  linux/arch/arm/mach-mmp/teton_bga.c
4 *
5 *  Support for the Marvell PXA168 Teton BGA Development Platform.
6 *
7 *  Author: Mark F. Brown <mark.brown314@gmail.com>
8 *
9 *  This code is based on aspenite.c
10 */
11
12#include <linux/init.h>
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/gpio.h>
16#include <linux/gpio-pxa.h>
17#include <linux/input.h>
18#include <linux/platform_data/keypad-pxa27x.h>
19#include <linux/i2c.h>
20
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23#include "addr-map.h"
24#include "mfp-pxa168.h"
25#include "pxa168.h"
26#include "teton_bga.h"
27#include "irqs.h"
28
29#include "common.h"
30
31static unsigned long teton_bga_pin_config[] __initdata = {
32	/* UART1 */
33	GPIO107_UART1_TXD,
34	GPIO108_UART1_RXD,
35
36	/* Keypad */
37	GPIO109_KP_MKIN1,
38	GPIO110_KP_MKIN0,
39	GPIO111_KP_MKOUT7,
40	GPIO112_KP_MKOUT6,
41
42	/* I2C Bus */
43	GPIO105_CI2C_SDA,
44	GPIO106_CI2C_SCL,
45
46	/* RTC */
47	GPIO78_GPIO,
48};
49
50static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
51	.irq_base	= MMP_GPIO_TO_IRQ(0),
52};
53
54static unsigned int teton_bga_matrix_key_map[] = {
55	KEY(0, 6, KEY_ESC),
56	KEY(0, 7, KEY_ENTER),
57	KEY(1, 6, KEY_LEFT),
58	KEY(1, 7, KEY_RIGHT),
59};
60
61static struct matrix_keymap_data teton_bga_matrix_keymap_data = {
62	.keymap			= teton_bga_matrix_key_map,
63	.keymap_size		= ARRAY_SIZE(teton_bga_matrix_key_map),
64};
65
66static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = {
67	.matrix_key_rows        = 2,
68	.matrix_key_cols        = 8,
69	.matrix_keymap_data	= &teton_bga_matrix_keymap_data,
70	.debounce_interval      = 30,
71};
72
73static struct i2c_board_info teton_bga_i2c_info[] __initdata = {
74	{
75		I2C_BOARD_INFO("ds1337", 0x68),
76		.irq = MMP_GPIO_TO_IRQ(RTC_INT_GPIO)
77	},
78};
79
80static void __init teton_bga_init(void)
81{
82	mfp_config(ARRAY_AND_SIZE(teton_bga_pin_config));
83
84	/* on-chip devices */
85	pxa168_add_uart(1);
86	pxa168_add_keypad(&teton_bga_keypad_info);
87	pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info));
88	platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
89				 sizeof(struct pxa_gpio_platform_data));
90	platform_device_register(&pxa168_device_gpio);
91}
92
93MACHINE_START(TETON_BGA, "PXA168-based Teton BGA Development Platform")
94	.map_io		= mmp_map_io,
95	.nr_irqs	= MMP_NR_IRQS,
96	.init_irq       = pxa168_init_irq,
97	.init_time	= pxa168_timer_init,
98	.init_machine   = teton_bga_init,
99	.restart	= pxa168_restart,
100MACHINE_END
101