Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  *  linux/arch/arm/mach-mmp/teton_bga.c
0004  *
0005  *  Support for the Marvell PXA168 Teton BGA Development Platform.
0006  *
0007  *  Author: Mark F. Brown <mark.brown314@gmail.com>
0008  *
0009  *  This code is based on aspenite.c
0010  */
0011 
0012 #include <linux/init.h>
0013 #include <linux/kernel.h>
0014 #include <linux/platform_device.h>
0015 #include <linux/gpio.h>
0016 #include <linux/gpio-pxa.h>
0017 #include <linux/input.h>
0018 #include <linux/platform_data/keypad-pxa27x.h>
0019 #include <linux/i2c.h>
0020 
0021 #include <asm/mach-types.h>
0022 #include <asm/mach/arch.h>
0023 #include "addr-map.h"
0024 #include "mfp-pxa168.h"
0025 #include "pxa168.h"
0026 #include "teton_bga.h"
0027 #include "irqs.h"
0028 
0029 #include "common.h"
0030 
0031 static unsigned long teton_bga_pin_config[] __initdata = {
0032     /* UART1 */
0033     GPIO107_UART1_TXD,
0034     GPIO108_UART1_RXD,
0035 
0036     /* Keypad */
0037     GPIO109_KP_MKIN1,
0038     GPIO110_KP_MKIN0,
0039     GPIO111_KP_MKOUT7,
0040     GPIO112_KP_MKOUT6,
0041 
0042     /* I2C Bus */
0043     GPIO105_CI2C_SDA,
0044     GPIO106_CI2C_SCL,
0045 
0046     /* RTC */
0047     GPIO78_GPIO,
0048 };
0049 
0050 static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
0051     .irq_base   = MMP_GPIO_TO_IRQ(0),
0052 };
0053 
0054 static unsigned int teton_bga_matrix_key_map[] = {
0055     KEY(0, 6, KEY_ESC),
0056     KEY(0, 7, KEY_ENTER),
0057     KEY(1, 6, KEY_LEFT),
0058     KEY(1, 7, KEY_RIGHT),
0059 };
0060 
0061 static struct matrix_keymap_data teton_bga_matrix_keymap_data = {
0062     .keymap         = teton_bga_matrix_key_map,
0063     .keymap_size        = ARRAY_SIZE(teton_bga_matrix_key_map),
0064 };
0065 
0066 static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = {
0067     .matrix_key_rows        = 2,
0068     .matrix_key_cols        = 8,
0069     .matrix_keymap_data = &teton_bga_matrix_keymap_data,
0070     .debounce_interval      = 30,
0071 };
0072 
0073 static struct i2c_board_info teton_bga_i2c_info[] __initdata = {
0074     {
0075         I2C_BOARD_INFO("ds1337", 0x68),
0076         .irq = MMP_GPIO_TO_IRQ(RTC_INT_GPIO)
0077     },
0078 };
0079 
0080 static void __init teton_bga_init(void)
0081 {
0082     mfp_config(ARRAY_AND_SIZE(teton_bga_pin_config));
0083 
0084     /* on-chip devices */
0085     pxa168_add_uart(1);
0086     pxa168_add_keypad(&teton_bga_keypad_info);
0087     pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info));
0088     platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
0089                  sizeof(struct pxa_gpio_platform_data));
0090     platform_device_register(&pxa168_device_gpio);
0091 }
0092 
0093 MACHINE_START(TETON_BGA, "PXA168-based Teton BGA Development Platform")
0094     .map_io     = mmp_map_io,
0095     .nr_irqs    = MMP_NR_IRQS,
0096     .init_irq       = pxa168_init_irq,
0097     .init_time  = pxa168_timer_init,
0098     .init_machine   = teton_bga_init,
0099     .restart    = pxa168_restart,
0100 MACHINE_END