2 * LILLY-1131 development board support
4 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
6 * based on code for other MX31 boards,
8 * Copyright 2005-2007 Freescale Semiconductor
9 * Copyright (c) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
10 * Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <linux/kernel.h>
28 #include <linux/types.h>
29 #include <linux/init.h>
30 #include <linux/gpio.h>
31 #include <linux/platform_device.h>
32 #include <linux/spi/spi.h>
33 #include <linux/mfd/mc13783.h>
35 #include <asm/mach-types.h>
36 #include <asm/mach/arch.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-mx3.h>
43 #include <mach/board-mx31lilly.h>
45 #include <mach/mx3fb.h>
51 * This file contains board-specific initialization routines for the
52 * LILLY-1131 development board. If you design an own baseboard for the
53 * module, use this file as base for support code.
56 static unsigned int lilly_db_board_pins[] __initdata = {
65 MX31_PIN_CSPI3_MOSI__RXD3,
66 MX31_PIN_CSPI3_MISO__TXD3,
67 MX31_PIN_CSPI3_SCLK__RTS3,
68 MX31_PIN_CSPI3_SPI_RDY__CTS3,
69 MX31_PIN_SD1_DATA3__SD1_DATA3,
70 MX31_PIN_SD1_DATA2__SD1_DATA2,
71 MX31_PIN_SD1_DATA1__SD1_DATA1,
72 MX31_PIN_SD1_DATA0__SD1_DATA0,
73 MX31_PIN_SD1_CLK__SD1_CLK,
74 MX31_PIN_SD1_CMD__SD1_CMD,
93 MX31_PIN_VSYNC3__VSYNC3,
94 MX31_PIN_HSYNC__HSYNC,
95 MX31_PIN_FPSHIFT__FPSHIFT,
96 MX31_PIN_DRDY0__DRDY0,
97 MX31_PIN_CONTRAST__CONTRAST,
101 static struct imxuart_platform_data uart_pdata __initdata = {
102 .flags = IMXUART_HAVE_RTSCTS,
107 static int mxc_mmc1_get_ro(struct device *dev)
109 return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_LCS0));
112 static int gpio_det, gpio_wp;
114 static int mxc_mmc1_init(struct device *dev,
115 irq_handler_t detect_irq, void *data)
119 gpio_det = IOMUX_TO_GPIO(MX31_PIN_GPIO1_1);
120 gpio_wp = IOMUX_TO_GPIO(MX31_PIN_LCS0);
122 ret = gpio_request(gpio_det, "MMC detect");
126 ret = gpio_request(gpio_wp, "MMC w/p");
130 gpio_direction_input(gpio_det);
131 gpio_direction_input(gpio_wp);
133 ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_GPIO1_1), detect_irq,
134 IRQF_DISABLED | IRQF_TRIGGER_FALLING,
150 static void mxc_mmc1_exit(struct device *dev, void *data)
154 free_irq(IOMUX_TO_IRQ(MX31_PIN_GPIO1_1), data);
157 static struct imxmmc_platform_data mmc_pdata = {
158 .get_ro = mxc_mmc1_get_ro,
159 .init = mxc_mmc1_init,
160 .exit = mxc_mmc1_exit,
163 /* Framebuffer support */
164 static struct ipu_platform_data ipu_data __initdata = {
165 .irq_base = MXC_IPU_IRQ_START,
168 static const struct fb_videomode fb_modedb = {
169 /* 640x480 TFT panel (IPS-056T) */
181 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_OE_ACT_HIGH,
182 .vmode = FB_VMODE_NONINTERLACED,
186 static struct mx3fb_platform_data fb_pdata __initdata = {
187 .dma_dev = &mx3_ipu.dev,
193 #define LCD_VCC_EN_GPIO (7)
195 static void __init mx31lilly_init_fb(void)
197 if (gpio_request(LCD_VCC_EN_GPIO, "LCD enable") != 0) {
198 printk(KERN_WARNING "unable to request LCD_VCC_EN pin.\n");
202 mxc_register_device(&mx3_ipu, &ipu_data);
203 mxc_register_device(&mx3_fb, &fb_pdata);
204 gpio_direction_output(LCD_VCC_EN_GPIO, 1);
209 static struct mc13783_platform_data mc13783_pdata __initdata = {
210 .flags = MC13783_USE_RTC | MC13783_USE_TOUCHSCREEN,
213 static struct spi_board_info lilly_spi_devs[] __initdata = {
215 .modalias = "mc13783",
216 .max_speed_hz = 1000000,
219 .platform_data = &mc13783_pdata,
223 void __init mx31lilly_db_init(void)
225 mxc_iomux_setup_multiple_pins(lilly_db_board_pins,
226 ARRAY_SIZE(lilly_db_board_pins),
227 "development board pins");
228 mxc_register_device(&mxc_uart_device0, &uart_pdata);
229 mxc_register_device(&mxc_uart_device1, &uart_pdata);
230 mxc_register_device(&mxc_uart_device2, &uart_pdata);
231 mxc_register_device(&mxcsdhc_device0, &mmc_pdata);
233 spi_register_board_info(lilly_spi_devs, ARRAY_SIZE(lilly_spi_devs));