diff options
Diffstat (limited to 'arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c')
-rw-r--r-- | arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c | 303 |
1 files changed, 303 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c new file mode 100644 index 000000000000..4909ea05855a --- /dev/null +++ b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c | |||
@@ -0,0 +1,303 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Eric Benard - eric@eukrea.com | ||
3 | * | ||
4 | * Based on pcm970-baseboard.c which is : | ||
5 | * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) | ||
6 | * | ||
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. | ||
15 | * | ||
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, | ||
19 | * MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | #include <linux/types.h> | ||
23 | #include <linux/init.h> | ||
24 | |||
25 | #include <linux/gpio.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/leds.h> | ||
28 | #include <linux/platform_device.h> | ||
29 | #include <linux/input.h> | ||
30 | #include <video/platform_lcd.h> | ||
31 | #include <linux/i2c.h> | ||
32 | |||
33 | #include <asm/mach-types.h> | ||
34 | #include <asm/mach/arch.h> | ||
35 | #include <asm/mach/time.h> | ||
36 | #include <asm/mach/map.h> | ||
37 | |||
38 | #include <mach/hardware.h> | ||
39 | #include <mach/common.h> | ||
40 | #include <mach/iomux-mx35.h> | ||
41 | #include <mach/audmux.h> | ||
42 | |||
43 | #include "devices-imx35.h" | ||
44 | |||
45 | static const struct fb_videomode fb_modedb[] = { | ||
46 | { | ||
47 | .name = "CMO-QVGA", | ||
48 | .refresh = 60, | ||
49 | .xres = 320, | ||
50 | .yres = 240, | ||
51 | .pixclock = KHZ2PICOS(6500), | ||
52 | .left_margin = 68, | ||
53 | .right_margin = 20, | ||
54 | .upper_margin = 15, | ||
55 | .lower_margin = 4, | ||
56 | .hsync_len = 30, | ||
57 | .vsync_len = 3, | ||
58 | .sync = 0, | ||
59 | .vmode = FB_VMODE_NONINTERLACED, | ||
60 | .flag = 0, | ||
61 | }, | ||
62 | { | ||
63 | .name = "DVI-VGA", | ||
64 | .refresh = 60, | ||
65 | .xres = 640, | ||
66 | .yres = 480, | ||
67 | .pixclock = 32000, | ||
68 | .left_margin = 100, | ||
69 | .right_margin = 100, | ||
70 | .upper_margin = 7, | ||
71 | .lower_margin = 100, | ||
72 | .hsync_len = 7, | ||
73 | .vsync_len = 7, | ||
74 | .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT | | ||
75 | FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT, | ||
76 | .vmode = FB_VMODE_NONINTERLACED, | ||
77 | .flag = 0, | ||
78 | }, | ||
79 | { | ||
80 | .name = "DVI-SVGA", | ||
81 | .refresh = 60, | ||
82 | .xres = 800, | ||
83 | .yres = 600, | ||
84 | .pixclock = 25000, | ||
85 | .left_margin = 75, | ||
86 | .right_margin = 75, | ||
87 | .upper_margin = 7, | ||
88 | .lower_margin = 75, | ||
89 | .hsync_len = 7, | ||
90 | .vsync_len = 7, | ||
91 | .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT | | ||
92 | FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT, | ||
93 | .vmode = FB_VMODE_NONINTERLACED, | ||
94 | .flag = 0, | ||
95 | }, | ||
96 | }; | ||
97 | |||
98 | static const struct ipu_platform_data mx3_ipu_data __initconst = { | ||
99 | .irq_base = MXC_IPU_IRQ_START, | ||
100 | }; | ||
101 | |||
102 | static struct mx3fb_platform_data mx3fb_pdata __initdata = { | ||
103 | .name = "CMO-QVGA", | ||
104 | .mode = fb_modedb, | ||
105 | .num_modes = ARRAY_SIZE(fb_modedb), | ||
106 | }; | ||
107 | |||
108 | static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = { | ||
109 | /* LCD */ | ||
110 | MX35_PAD_LD0__IPU_DISPB_DAT_0, | ||
111 | MX35_PAD_LD1__IPU_DISPB_DAT_1, | ||
112 | MX35_PAD_LD2__IPU_DISPB_DAT_2, | ||
113 | MX35_PAD_LD3__IPU_DISPB_DAT_3, | ||
114 | MX35_PAD_LD4__IPU_DISPB_DAT_4, | ||
115 | MX35_PAD_LD5__IPU_DISPB_DAT_5, | ||
116 | MX35_PAD_LD6__IPU_DISPB_DAT_6, | ||
117 | MX35_PAD_LD7__IPU_DISPB_DAT_7, | ||
118 | MX35_PAD_LD8__IPU_DISPB_DAT_8, | ||
119 | MX35_PAD_LD9__IPU_DISPB_DAT_9, | ||
120 | MX35_PAD_LD10__IPU_DISPB_DAT_10, | ||
121 | MX35_PAD_LD11__IPU_DISPB_DAT_11, | ||
122 | MX35_PAD_LD12__IPU_DISPB_DAT_12, | ||
123 | MX35_PAD_LD13__IPU_DISPB_DAT_13, | ||
124 | MX35_PAD_LD14__IPU_DISPB_DAT_14, | ||
125 | MX35_PAD_LD15__IPU_DISPB_DAT_15, | ||
126 | MX35_PAD_LD16__IPU_DISPB_DAT_16, | ||
127 | MX35_PAD_LD17__IPU_DISPB_DAT_17, | ||
128 | MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC, | ||
129 | MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK, | ||
130 | MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY, | ||
131 | MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC, | ||
132 | /* Backlight */ | ||
133 | MX35_PAD_CONTRAST__IPU_DISPB_CONTR, | ||
134 | /* LCD_PWR */ | ||
135 | MX35_PAD_D3_CLS__GPIO1_4, | ||
136 | /* LED */ | ||
137 | MX35_PAD_LD23__GPIO3_29, | ||
138 | /* SWITCH */ | ||
139 | MX35_PAD_LD19__GPIO3_25, | ||
140 | /* UART2 */ | ||
141 | MX35_PAD_CTS2__UART2_CTS, | ||
142 | MX35_PAD_RTS2__UART2_RTS, | ||
143 | MX35_PAD_TXD2__UART2_TXD_MUX, | ||
144 | MX35_PAD_RXD2__UART2_RXD_MUX, | ||
145 | /* I2S */ | ||
146 | MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS, | ||
147 | MX35_PAD_STXD4__AUDMUX_AUD4_TXD, | ||
148 | MX35_PAD_SRXD4__AUDMUX_AUD4_RXD, | ||
149 | MX35_PAD_SCK4__AUDMUX_AUD4_TXC, | ||
150 | /* CAN2 */ | ||
151 | MX35_PAD_TX5_RX0__CAN2_TXCAN, | ||
152 | MX35_PAD_TX4_RX1__CAN2_RXCAN, | ||
153 | /* SDCARD */ | ||
154 | MX35_PAD_SD1_CMD__ESDHC1_CMD, | ||
155 | MX35_PAD_SD1_CLK__ESDHC1_CLK, | ||
156 | MX35_PAD_SD1_DATA0__ESDHC1_DAT0, | ||
157 | MX35_PAD_SD1_DATA1__ESDHC1_DAT1, | ||
158 | MX35_PAD_SD1_DATA2__ESDHC1_DAT2, | ||
159 | MX35_PAD_SD1_DATA3__ESDHC1_DAT3, | ||
160 | /* SD1 CD */ | ||
161 | MX35_PAD_LD18__GPIO3_24, | ||
162 | }; | ||
163 | |||
164 | #define GPIO_LED1 IMX_GPIO_NR(3, 29) | ||
165 | #define GPIO_SWITCH1 IMX_GPIO_NR(3, 25) | ||
166 | #define GPIO_LCDPWR IMX_GPIO_NR(1, 4) | ||
167 | #define GPIO_SD1CD IMX_GPIO_NR(3, 24) | ||
168 | |||
169 | static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd, | ||
170 | unsigned int power) | ||
171 | { | ||
172 | if (power) | ||
173 | gpio_direction_output(GPIO_LCDPWR, 1); | ||
174 | else | ||
175 | gpio_direction_output(GPIO_LCDPWR, 0); | ||
176 | } | ||
177 | |||
178 | static struct plat_lcd_data eukrea_mbimxsd_lcd_power_data = { | ||
179 | .set_power = eukrea_mbimxsd_lcd_power_set, | ||
180 | }; | ||
181 | |||
182 | static struct platform_device eukrea_mbimxsd_lcd_powerdev = { | ||
183 | .name = "platform-lcd", | ||
184 | .dev.platform_data = &eukrea_mbimxsd_lcd_power_data, | ||
185 | }; | ||
186 | |||
187 | static struct gpio_led eukrea_mbimxsd_leds[] = { | ||
188 | { | ||
189 | .name = "led1", | ||
190 | .default_trigger = "heartbeat", | ||
191 | .active_low = 1, | ||
192 | .gpio = GPIO_LED1, | ||
193 | }, | ||
194 | }; | ||
195 | |||
196 | static struct gpio_led_platform_data eukrea_mbimxsd_led_info = { | ||
197 | .leds = eukrea_mbimxsd_leds, | ||
198 | .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds), | ||
199 | }; | ||
200 | |||
201 | static struct platform_device eukrea_mbimxsd_leds_gpio = { | ||
202 | .name = "leds-gpio", | ||
203 | .id = -1, | ||
204 | .dev = { | ||
205 | .platform_data = &eukrea_mbimxsd_led_info, | ||
206 | }, | ||
207 | }; | ||
208 | |||
209 | static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = { | ||
210 | { | ||
211 | .gpio = GPIO_SWITCH1, | ||
212 | .code = BTN_0, | ||
213 | .desc = "BP1", | ||
214 | .active_low = 1, | ||
215 | .wakeup = 1, | ||
216 | }, | ||
217 | }; | ||
218 | |||
219 | static const struct gpio_keys_platform_data | ||
220 | eukrea_mbimxsd_button_data __initconst = { | ||
221 | .buttons = eukrea_mbimxsd_gpio_buttons, | ||
222 | .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons), | ||
223 | }; | ||
224 | |||
225 | static struct platform_device *platform_devices[] __initdata = { | ||
226 | &eukrea_mbimxsd_leds_gpio, | ||
227 | &eukrea_mbimxsd_lcd_powerdev, | ||
228 | }; | ||
229 | |||
230 | static const struct imxuart_platform_data uart_pdata __initconst = { | ||
231 | .flags = IMXUART_HAVE_RTSCTS, | ||
232 | }; | ||
233 | |||
234 | static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = { | ||
235 | { | ||
236 | I2C_BOARD_INFO("tlv320aic23", 0x1a), | ||
237 | }, | ||
238 | }; | ||
239 | |||
240 | static const | ||
241 | struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = { | ||
242 | .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE, | ||
243 | }; | ||
244 | |||
245 | static struct esdhc_platform_data sd1_pdata = { | ||
246 | .cd_gpio = GPIO_SD1CD, | ||
247 | .wp_gpio = -EINVAL, | ||
248 | }; | ||
249 | |||
250 | /* | ||
251 | * system init for baseboard usage. Will be called by cpuimx35 init. | ||
252 | * | ||
253 | * Add platform devices present on this baseboard and init | ||
254 | * them from CPU side as far as required to use them later on | ||
255 | */ | ||
256 | void __init eukrea_mbimxsd35_baseboard_init(void) | ||
257 | { | ||
258 | if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads, | ||
259 | ARRAY_SIZE(eukrea_mbimxsd_pads))) | ||
260 | printk(KERN_ERR "error setting mbimxsd pads !\n"); | ||
261 | |||
262 | #if defined(CONFIG_SND_SOC_EUKREA_TLV320) | ||
263 | /* SSI unit master I2S codec connected to SSI_AUD4 */ | ||
264 | mxc_audmux_v2_configure_port(0, | ||
265 | MXC_AUDMUX_V2_PTCR_SYN | | ||
266 | MXC_AUDMUX_V2_PTCR_TFSDIR | | ||
267 | MXC_AUDMUX_V2_PTCR_TFSEL(3) | | ||
268 | MXC_AUDMUX_V2_PTCR_TCLKDIR | | ||
269 | MXC_AUDMUX_V2_PTCR_TCSEL(3), | ||
270 | MXC_AUDMUX_V2_PDCR_RXDSEL(3) | ||
271 | ); | ||
272 | mxc_audmux_v2_configure_port(3, | ||
273 | MXC_AUDMUX_V2_PTCR_SYN, | ||
274 | MXC_AUDMUX_V2_PDCR_RXDSEL(0) | ||
275 | ); | ||
276 | #endif | ||
277 | |||
278 | imx35_add_imx_uart1(&uart_pdata); | ||
279 | imx35_add_ipu_core(&mx3_ipu_data); | ||
280 | imx35_add_mx3_sdc_fb(&mx3fb_pdata); | ||
281 | |||
282 | imx35_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata); | ||
283 | |||
284 | imx35_add_flexcan1(NULL); | ||
285 | imx35_add_sdhci_esdhc_imx(0, &sd1_pdata); | ||
286 | |||
287 | gpio_request(GPIO_LED1, "LED1"); | ||
288 | gpio_direction_output(GPIO_LED1, 1); | ||
289 | gpio_free(GPIO_LED1); | ||
290 | |||
291 | gpio_request(GPIO_SWITCH1, "SWITCH1"); | ||
292 | gpio_direction_input(GPIO_SWITCH1); | ||
293 | gpio_free(GPIO_SWITCH1); | ||
294 | |||
295 | gpio_request(GPIO_LCDPWR, "LCDPWR"); | ||
296 | gpio_direction_output(GPIO_LCDPWR, 1); | ||
297 | |||
298 | i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, | ||
299 | ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); | ||
300 | |||
301 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | ||
302 | imx_add_gpio_keys(&eukrea_mbimxsd_button_data); | ||
303 | } | ||