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/types.h>
23 #include <linux/init.h>
25 #include <linux/gpio.h>
26 #include <linux/interrupt.h>
27 #include <linux/leds.h>
28 #include <linux/platform_device.h>
29 #include <linux/gpio_keys.h>
30 #include <linux/input.h>
31 #include <video/platform_lcd.h>
32 #include <linux/i2c.h>
34 #include <asm/mach-types.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/time.h>
37 #include <asm/mach/map.h>
39 #include <mach/hardware.h>
40 #include <mach/common.h>
41 #include <mach/imx-uart.h>
42 #include <mach/iomux-mx35.h>
44 #include <mach/mx3fb.h>
45 #include <mach/audmux.h>
48 #include "devices-imx35.h"
51 static const struct fb_videomode fb_modedb[] = {
57 .pixclock = KHZ2PICOS(6500),
65 .vmode = FB_VMODE_NONINTERLACED,
70 static struct ipu_platform_data mx3_ipu_data = {
71 .irq_base = MXC_IPU_IRQ_START,
74 static struct mx3fb_platform_data mx3fb_pdata = {
75 .dma_dev = &mx3_ipu.dev,
78 .num_modes = ARRAY_SIZE(fb_modedb),
81 static struct pad_desc eukrea_mbimxsd_pads[] = {
83 MX35_PAD_LD0__IPU_DISPB_DAT_0,
84 MX35_PAD_LD1__IPU_DISPB_DAT_1,
85 MX35_PAD_LD2__IPU_DISPB_DAT_2,
86 MX35_PAD_LD3__IPU_DISPB_DAT_3,
87 MX35_PAD_LD4__IPU_DISPB_DAT_4,
88 MX35_PAD_LD5__IPU_DISPB_DAT_5,
89 MX35_PAD_LD6__IPU_DISPB_DAT_6,
90 MX35_PAD_LD7__IPU_DISPB_DAT_7,
91 MX35_PAD_LD8__IPU_DISPB_DAT_8,
92 MX35_PAD_LD9__IPU_DISPB_DAT_9,
93 MX35_PAD_LD10__IPU_DISPB_DAT_10,
94 MX35_PAD_LD11__IPU_DISPB_DAT_11,
95 MX35_PAD_LD12__IPU_DISPB_DAT_12,
96 MX35_PAD_LD13__IPU_DISPB_DAT_13,
97 MX35_PAD_LD14__IPU_DISPB_DAT_14,
98 MX35_PAD_LD15__IPU_DISPB_DAT_15,
99 MX35_PAD_LD16__IPU_DISPB_DAT_16,
100 MX35_PAD_LD17__IPU_DISPB_DAT_17,
101 MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC,
102 MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK,
103 MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY,
104 MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC,
106 MX35_PAD_CONTRAST__IPU_DISPB_CONTR,
108 MX35_PAD_D3_CLS__GPIO1_4,
110 MX35_PAD_LD23__GPIO3_29,
112 MX35_PAD_LD19__GPIO3_25,
114 MX35_PAD_CTS2__UART2_CTS,
115 MX35_PAD_RTS2__UART2_RTS,
116 MX35_PAD_TXD2__UART2_TXD_MUX,
117 MX35_PAD_RXD2__UART2_RXD_MUX,
119 MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS,
120 MX35_PAD_STXD4__AUDMUX_AUD4_TXD,
121 MX35_PAD_SRXD4__AUDMUX_AUD4_RXD,
122 MX35_PAD_SCK4__AUDMUX_AUD4_TXC,
125 #define GPIO_LED1 (2 * 32 + 29)
126 #define GPIO_SWITCH1 (2 * 32 + 25)
127 #define GPIO_LCDPWR (4)
129 static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd,
133 gpio_direction_output(GPIO_LCDPWR, 1);
135 gpio_direction_output(GPIO_LCDPWR, 0);
138 static struct plat_lcd_data eukrea_mbimxsd_lcd_power_data = {
139 .set_power = eukrea_mbimxsd_lcd_power_set,
142 static struct platform_device eukrea_mbimxsd_lcd_powerdev = {
143 .name = "platform-lcd",
144 .dev.platform_data = &eukrea_mbimxsd_lcd_power_data,
147 static struct gpio_led eukrea_mbimxsd_leds[] = {
150 .default_trigger = "heartbeat",
156 static struct gpio_led_platform_data eukrea_mbimxsd_led_info = {
157 .leds = eukrea_mbimxsd_leds,
158 .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds),
161 static struct platform_device eukrea_mbimxsd_leds_gpio = {
165 .platform_data = &eukrea_mbimxsd_led_info,
169 static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = {
171 .gpio = GPIO_SWITCH1,
179 static struct gpio_keys_platform_data eukrea_mbimxsd_button_data = {
180 .buttons = eukrea_mbimxsd_gpio_buttons,
181 .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons),
184 static struct platform_device eukrea_mbimxsd_button_device = {
189 .platform_data = &eukrea_mbimxsd_button_data,
193 static struct platform_device *platform_devices[] __initdata = {
194 &eukrea_mbimxsd_leds_gpio,
195 &eukrea_mbimxsd_button_device,
196 &eukrea_mbimxsd_lcd_powerdev,
199 static const struct imxuart_platform_data uart_pdata __initconst = {
200 .flags = IMXUART_HAVE_RTSCTS,
203 static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
205 I2C_BOARD_INFO("tlv320aic23", 0x1a),
209 struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata = {
210 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
214 * system init for baseboard usage. Will be called by cpuimx35 init.
216 * Add platform devices present on this baseboard and init
217 * them from CPU side as far as required to use them later on
219 void __init eukrea_mbimxsd35_baseboard_init(void)
221 if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads,
222 ARRAY_SIZE(eukrea_mbimxsd_pads)))
223 printk(KERN_ERR "error setting mbimxsd pads !\n");
225 #if defined(CONFIG_SND_SOC_EUKREA_TLV320)
226 /* SSI unit master I2S codec connected to SSI_AUD4 */
227 mxc_audmux_v2_configure_port(0,
228 MXC_AUDMUX_V2_PTCR_SYN |
229 MXC_AUDMUX_V2_PTCR_TFSDIR |
230 MXC_AUDMUX_V2_PTCR_TFSEL(3) |
231 MXC_AUDMUX_V2_PTCR_TCLKDIR |
232 MXC_AUDMUX_V2_PTCR_TCSEL(3),
233 MXC_AUDMUX_V2_PDCR_RXDSEL(3)
235 mxc_audmux_v2_configure_port(3,
236 MXC_AUDMUX_V2_PTCR_SYN,
237 MXC_AUDMUX_V2_PDCR_RXDSEL(0)
241 imx35_add_imx_uart1(&uart_pdata);
242 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
243 mxc_register_device(&mx3_fb, &mx3fb_pdata);
245 mxc_register_device(&imx_ssi_device0, &eukrea_mbimxsd_ssi_pdata);
247 gpio_request(GPIO_LED1, "LED1");
248 gpio_direction_output(GPIO_LED1, 1);
249 gpio_free(GPIO_LED1);
251 gpio_request(GPIO_SWITCH1, "SWITCH1");
252 gpio_direction_input(GPIO_SWITCH1);
253 gpio_free(GPIO_SWITCH1);
255 gpio_request(GPIO_LCDPWR, "LCDPWR");
256 gpio_direction_output(GPIO_LCDPWR, 1);
257 gpio_free(GPIO_SWITCH1);
259 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
260 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
262 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));