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/input.h>
26 #include <video/platform_lcd.h>
28 #include <mach/hardware.h>
29 #include <mach/iomux-mx25.h>
30 #include <mach/common.h>
31 #include <asm/mach-types.h>
32 #include <asm/mach/arch.h>
33 #include <mach/mx25.h>
34 #include <mach/audmux.h>
36 #include "devices-imx25.h"
38 static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {
56 MX25_PAD_GPIO_E__LD16,
57 MX25_PAD_GPIO_F__LD17,
58 MX25_PAD_HSYNC__HSYNC,
59 MX25_PAD_VSYNC__VSYNC,
60 MX25_PAD_LSCLK__LSCLK,
61 MX25_PAD_OE_ACD__OE_ACD,
62 MX25_PAD_CONTRAST__CONTRAST,
64 MX25_PAD_PWM__GPIO_1_26,
66 MX25_PAD_POWER_FAIL__GPIO_3_19,
68 MX25_PAD_VSTBY_ACK__GPIO_3_18,
70 MX25_PAD_UART2_RTS__UART2_RTS,
71 MX25_PAD_UART2_CTS__UART2_CTS,
72 MX25_PAD_UART2_TXD__UART2_TXD,
73 MX25_PAD_UART2_RXD__UART2_RXD,
75 MX25_PAD_SD1_CMD__SD1_CMD,
76 MX25_PAD_SD1_CLK__SD1_CLK,
77 MX25_PAD_SD1_DATA0__SD1_DATA0,
78 MX25_PAD_SD1_DATA1__SD1_DATA1,
79 MX25_PAD_SD1_DATA2__SD1_DATA2,
80 MX25_PAD_SD1_DATA3__SD1_DATA3,
82 MX25_PAD_DE_B__GPIO_2_20,
84 MX25_PAD_KPP_COL3__AUD5_TXFS,
85 MX25_PAD_KPP_COL2__AUD5_TXC,
86 MX25_PAD_KPP_COL1__AUD5_RXD,
87 MX25_PAD_KPP_COL0__AUD5_TXD,
89 MX25_PAD_GPIO_D__CAN2_RX,
90 MX25_PAD_GPIO_C__CAN2_TX,
94 #define GPIO_SWITCH1 82
96 #define GPIO_LCDPWR 26
98 static struct imx_fb_videomode eukrea_mximxsd_modes[] = {
105 .pixclock = KHZ2PICOS(6500),
150 static const struct imx_fb_platform_data eukrea_mximxsd_fb_pdata __initconst = {
151 .mode = eukrea_mximxsd_modes,
152 .num_modes = ARRAY_SIZE(eukrea_mximxsd_modes),
158 static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd,
162 gpio_direction_output(GPIO_LCDPWR, 1);
164 gpio_direction_output(GPIO_LCDPWR, 0);
167 static struct plat_lcd_data eukrea_mbimxsd_lcd_power_data = {
168 .set_power = eukrea_mbimxsd_lcd_power_set,
171 static struct platform_device eukrea_mbimxsd_lcd_powerdev = {
172 .name = "platform-lcd",
173 .dev.platform_data = &eukrea_mbimxsd_lcd_power_data,
176 static const struct gpio_led eukrea_mbimxsd_leds[] __initconst = {
179 .default_trigger = "heartbeat",
185 static const struct gpio_led_platform_data
186 eukrea_mbimxsd_led_info __initconst = {
187 .leds = eukrea_mbimxsd_leds,
188 .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds),
191 static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = {
193 .gpio = GPIO_SWITCH1,
201 static const struct gpio_keys_platform_data
202 eukrea_mbimxsd_button_data __initconst = {
203 .buttons = eukrea_mbimxsd_gpio_buttons,
204 .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons),
207 static struct platform_device *platform_devices[] __initdata = {
208 &eukrea_mbimxsd_lcd_powerdev,
211 static const struct imxuart_platform_data uart_pdata __initconst = {
212 .flags = IMXUART_HAVE_RTSCTS,
215 static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
217 I2C_BOARD_INFO("tlv320aic23", 0x1a),
222 struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = {
223 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
226 static struct esdhc_platform_data sd1_pdata = {
227 .cd_gpio = GPIO_SD1CD,
232 * system init for baseboard usage. Will be called by cpuimx25 init.
234 * Add platform devices present on this baseboard and init
235 * them from CPU side as far as required to use them later on
237 void __init eukrea_mbimxsd25_baseboard_init(void)
239 if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads,
240 ARRAY_SIZE(eukrea_mbimxsd_pads)))
241 printk(KERN_ERR "error setting mbimxsd pads !\n");
243 #if defined(CONFIG_SND_SOC_EUKREA_TLV320)
244 /* SSI unit master I2S codec connected to SSI_AUD5*/
245 mxc_audmux_v2_configure_port(0,
246 MXC_AUDMUX_V2_PTCR_SYN |
247 MXC_AUDMUX_V2_PTCR_TFSDIR |
248 MXC_AUDMUX_V2_PTCR_TFSEL(4) |
249 MXC_AUDMUX_V2_PTCR_TCLKDIR |
250 MXC_AUDMUX_V2_PTCR_TCSEL(4),
251 MXC_AUDMUX_V2_PDCR_RXDSEL(4)
253 mxc_audmux_v2_configure_port(4,
254 MXC_AUDMUX_V2_PTCR_SYN,
255 MXC_AUDMUX_V2_PDCR_RXDSEL(0)
259 imx25_add_imx_uart1(&uart_pdata);
260 imx25_add_imx_fb(&eukrea_mximxsd_fb_pdata);
261 imx25_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata);
263 imx25_add_flexcan1(NULL);
264 imx25_add_sdhci_esdhc_imx(0, &sd1_pdata);
266 gpio_request(GPIO_LED1, "LED1");
267 gpio_direction_output(GPIO_LED1, 1);
268 gpio_free(GPIO_LED1);
270 gpio_request(GPIO_SWITCH1, "SWITCH1");
271 gpio_direction_input(GPIO_SWITCH1);
272 gpio_free(GPIO_SWITCH1);
274 gpio_request(GPIO_LCDPWR, "LCDPWR");
275 gpio_direction_output(GPIO_LCDPWR, 1);
276 gpio_free(GPIO_SWITCH1);
278 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
279 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
281 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
282 gpio_led_register_device(-1, &eukrea_mbimxsd_led_info);
283 imx_add_gpio_keys(&eukrea_mbimxsd_button_data);