2 * Copyright (C) 2010 Eric Benard - eric@eukrea.com
4 * Based on pcm970-baseboard.c which is :
5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 #include <linux/gpio.h>
23 #include <linux/leds.h>
24 #include <linux/platform_device.h>
25 #include <linux/gpio_keys.h>
26 #include <linux/input.h>
27 #include <video/platform_lcd.h>
29 #include <mach/hardware.h>
30 #include <mach/iomux-mx25.h>
31 #include <mach/common.h>
32 #include <asm/mach-types.h>
33 #include <asm/mach/arch.h>
34 #include <mach/mx25.h>
35 #include <mach/imx-uart.h>
36 #include <mach/imxfb.h>
38 #include <mach/audmux.h>
40 #include "devices-imx25.h"
43 static struct pad_desc eukrea_mbimxsd_pads[] = {
61 MX25_PAD_GPIO_E__LD16,
62 MX25_PAD_GPIO_F__LD17,
63 MX25_PAD_HSYNC__HSYNC,
64 MX25_PAD_VSYNC__VSYNC,
65 MX25_PAD_LSCLK__LSCLK,
66 MX25_PAD_OE_ACD__OE_ACD,
67 MX25_PAD_CONTRAST__CONTRAST,
69 MX25_PAD_PWM__GPIO_1_26,
71 MX25_PAD_POWER_FAIL__GPIO_3_19,
73 MX25_PAD_VSTBY_ACK__GPIO_3_18,
75 MX25_PAD_UART2_RTS__UART2_RTS,
76 MX25_PAD_UART2_CTS__UART2_CTS,
77 MX25_PAD_UART2_TXD__UART2_TXD,
78 MX25_PAD_UART2_RXD__UART2_RXD,
80 MX25_PAD_SD1_CMD__SD1_CMD,
81 MX25_PAD_SD1_CLK__SD1_CLK,
82 MX25_PAD_SD1_DATA0__SD1_DATA0,
83 MX25_PAD_SD1_DATA1__SD1_DATA1,
84 MX25_PAD_SD1_DATA2__SD1_DATA2,
85 MX25_PAD_SD1_DATA3__SD1_DATA3,
87 MX25_PAD_DE_B__GPIO_2_20,
89 MX25_PAD_KPP_COL3__AUD5_TXFS,
90 MX25_PAD_KPP_COL2__AUD5_TXC,
91 MX25_PAD_KPP_COL1__AUD5_RXD,
92 MX25_PAD_KPP_COL0__AUD5_TXD,
96 #define GPIO_SWITCH1 82
98 #define GPIO_LCDPWR 26
100 static struct imx_fb_videomode eukrea_mximxsd_modes[] = {
107 .pixclock = KHZ2PICOS(6500),
120 static struct imx_fb_platform_data eukrea_mximxsd_fb_pdata = {
121 .mode = eukrea_mximxsd_modes,
122 .num_modes = ARRAY_SIZE(eukrea_mximxsd_modes),
128 static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd,
132 gpio_direction_output(GPIO_LCDPWR, 1);
134 gpio_direction_output(GPIO_LCDPWR, 0);
137 static struct plat_lcd_data eukrea_mbimxsd_lcd_power_data = {
138 .set_power = eukrea_mbimxsd_lcd_power_set,
141 static struct platform_device eukrea_mbimxsd_lcd_powerdev = {
142 .name = "platform-lcd",
143 .dev.platform_data = &eukrea_mbimxsd_lcd_power_data,
146 static struct gpio_led eukrea_mbimxsd_leds[] = {
149 .default_trigger = "heartbeat",
155 static struct gpio_led_platform_data eukrea_mbimxsd_led_info = {
156 .leds = eukrea_mbimxsd_leds,
157 .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds),
160 static struct platform_device eukrea_mbimxsd_leds_gpio = {
164 .platform_data = &eukrea_mbimxsd_led_info,
168 static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = {
170 .gpio = GPIO_SWITCH1,
178 static struct gpio_keys_platform_data eukrea_mbimxsd_button_data = {
179 .buttons = eukrea_mbimxsd_gpio_buttons,
180 .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons),
183 static struct platform_device eukrea_mbimxsd_button_device = {
188 .platform_data = &eukrea_mbimxsd_button_data,
192 static struct platform_device *platform_devices[] __initdata = {
193 &eukrea_mbimxsd_leds_gpio,
194 &eukrea_mbimxsd_button_device,
195 &eukrea_mbimxsd_lcd_powerdev,
198 static const struct imxuart_platform_data uart_pdata __initconst = {
199 .flags = IMXUART_HAVE_RTSCTS,
202 static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
204 I2C_BOARD_INFO("tlv320aic23", 0x1a),
208 struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata = {
209 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
213 * system init for baseboard usage. Will be called by cpuimx25 init.
215 * Add platform devices present on this baseboard and init
216 * them from CPU side as far as required to use them later on
218 void __init eukrea_mbimxsd25_baseboard_init(void)
220 if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads,
221 ARRAY_SIZE(eukrea_mbimxsd_pads)))
222 printk(KERN_ERR "error setting mbimxsd pads !\n");
224 #if defined(CONFIG_SND_SOC_EUKREA_TLV320)
225 /* SSI unit master I2S codec connected to SSI_AUD5*/
226 mxc_audmux_v2_configure_port(0,
227 MXC_AUDMUX_V2_PTCR_SYN |
228 MXC_AUDMUX_V2_PTCR_TFSDIR |
229 MXC_AUDMUX_V2_PTCR_TFSEL(4) |
230 MXC_AUDMUX_V2_PTCR_TCLKDIR |
231 MXC_AUDMUX_V2_PTCR_TCSEL(4),
232 MXC_AUDMUX_V2_PDCR_RXDSEL(4)
234 mxc_audmux_v2_configure_port(4,
235 MXC_AUDMUX_V2_PTCR_SYN,
236 MXC_AUDMUX_V2_PDCR_RXDSEL(0)
240 imx25_add_imx_uart1(&uart_pdata);
241 mxc_register_device(&mx25_fb_device, &eukrea_mximxsd_fb_pdata);
242 mxc_register_device(&imx_ssi_device0, &eukrea_mbimxsd_ssi_pdata);
244 gpio_request(GPIO_LED1, "LED1");
245 gpio_direction_output(GPIO_LED1, 1);
246 gpio_free(GPIO_LED1);
248 gpio_request(GPIO_SWITCH1, "SWITCH1");
249 gpio_direction_input(GPIO_SWITCH1);
250 gpio_free(GPIO_SWITCH1);
252 gpio_request(GPIO_LCDPWR, "LCDPWR");
253 gpio_direction_output(GPIO_LCDPWR, 1);
254 gpio_free(GPIO_SWITCH1);
256 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
257 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
259 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));