3 * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 #include <linux/gpio.h>
10 #include <linux/gpio_keys.h>
11 #include <linux/input.h>
12 #include <linux/platform_device.h>
13 #include <linux/spi/spi.h>
15 #include <mach/common.h>
16 #if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
19 #include <mach/iomux-mx3.h>
21 #include <asm/mach-types.h>
26 static unsigned int pcm037_eet_pins
[] = {
28 MX31_PIN_CSPI1_MISO__MISO
,
29 MX31_PIN_CSPI1_MOSI__MOSI
,
30 MX31_PIN_CSPI1_SCLK__SCLK
,
31 MX31_PIN_CSPI1_SPI_RDY__SPI_RDY
,
32 MX31_PIN_CSPI1_SS0__SS0
,
33 MX31_PIN_CSPI1_SS1__SS1
,
34 MX31_PIN_CSPI1_SS2__SS2
,
36 /* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */
37 IOMUX_MODE(MX31_PIN_KEY_COL7
, IOMUX_CONFIG_GPIO
),
39 IOMUX_MODE(MX31_PIN_GPIO1_0
, IOMUX_CONFIG_GPIO
), /* 0 */
40 IOMUX_MODE(MX31_PIN_GPIO1_1
, IOMUX_CONFIG_GPIO
), /* 1 */
41 IOMUX_MODE(MX31_PIN_GPIO1_2
, IOMUX_CONFIG_GPIO
), /* 2 */
42 IOMUX_MODE(MX31_PIN_GPIO1_3
, IOMUX_CONFIG_GPIO
), /* 3 */
43 IOMUX_MODE(MX31_PIN_SVEN0
, IOMUX_CONFIG_GPIO
), /* 32 */
44 IOMUX_MODE(MX31_PIN_STX0
, IOMUX_CONFIG_GPIO
), /* 33 */
45 IOMUX_MODE(MX31_PIN_SRX0
, IOMUX_CONFIG_GPIO
), /* 34 */
46 IOMUX_MODE(MX31_PIN_SIMPD0
, IOMUX_CONFIG_GPIO
), /* 35 */
47 IOMUX_MODE(MX31_PIN_RTS1
, IOMUX_CONFIG_GPIO
), /* 38 */
48 IOMUX_MODE(MX31_PIN_CTS1
, IOMUX_CONFIG_GPIO
), /* 39 */
49 IOMUX_MODE(MX31_PIN_KEY_ROW4
, IOMUX_CONFIG_GPIO
), /* 50 */
50 IOMUX_MODE(MX31_PIN_KEY_ROW5
, IOMUX_CONFIG_GPIO
), /* 51 */
51 IOMUX_MODE(MX31_PIN_KEY_ROW6
, IOMUX_CONFIG_GPIO
), /* 52 */
52 IOMUX_MODE(MX31_PIN_KEY_ROW7
, IOMUX_CONFIG_GPIO
), /* 53 */
55 IOMUX_MODE(MX31_PIN_DTR_DTE1
, IOMUX_CONFIG_GPIO
), /* 44 */
56 IOMUX_MODE(MX31_PIN_DSR_DTE1
, IOMUX_CONFIG_GPIO
), /* 45 */
57 IOMUX_MODE(MX31_PIN_KEY_COL5
, IOMUX_CONFIG_GPIO
), /* 55 */
58 IOMUX_MODE(MX31_PIN_KEY_COL6
, IOMUX_CONFIG_GPIO
), /* 56 */
62 static struct spi_board_info pcm037_spi_dev
[] = {
64 .modalias
= "dac124s085",
65 .max_speed_hz
= 400000,
67 .chip_select
= 0, /* Index in pcm037_spi1_cs[] */
72 /* Platform Data for MXC CSPI */
73 #if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
74 static int pcm037_spi1_cs
[] = {MXC_SPI_CS(1), IOMUX_TO_GPIO(MX31_PIN_KEY_COL7
)};
76 struct spi_imx_master pcm037_spi1_master
= {
77 .chipselect
= pcm037_spi1_cs
,
78 .num_chipselect
= ARRAY_SIZE(pcm037_spi1_cs
),
82 /* GPIO-keys input device */
83 static struct gpio_keys_button pcm037_gpio_keys
[] = {
88 .desc
= "Wheel Manual",
100 .desc
= "Wheel View",
106 .desc
= "Wheel Menu",
112 .desc
= "Nav Pad Up",
118 .desc
= "Nav Pad Right",
124 .desc
= "Nav Pad Down",
130 .desc
= "Nav Pad Left",
136 .desc
= "Nav Pad Ok",
148 .desc
= "Focus Forward",
154 .desc
= "Focus Backward",
160 .desc
= "Release Half",
166 .desc
= "Release Full",
171 static struct gpio_keys_platform_data pcm037_gpio_keys_platform_data
= {
172 .buttons
= pcm037_gpio_keys
,
173 .nbuttons
= ARRAY_SIZE(pcm037_gpio_keys
),
174 .rep
= 0, /* No auto-repeat */
177 static struct platform_device pcm037_gpio_keys_device
= {
181 .platform_data
= &pcm037_gpio_keys_platform_data
,
185 static int eet_init_devices(void)
187 if (!machine_is_pcm037() || pcm037_variant() != PCM037_EET
)
190 mxc_iomux_setup_multiple_pins(pcm037_eet_pins
,
191 ARRAY_SIZE(pcm037_eet_pins
), "pcm037_eet");
194 spi_register_board_info(pcm037_spi_dev
, ARRAY_SIZE(pcm037_spi_dev
));
195 #if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
196 mxc_register_device(&mxc_spi_device0
, &pcm037_spi1_master
);
199 platform_device_register(&pcm037_gpio_keys_device
);
204 late_initcall(eet_init_devices
);