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.
23 #include <linux/kernel.h>
24 #include <linux/types.h>
25 #include <linux/init.h>
26 #include <linux/gpio.h>
27 #include <linux/platform_device.h>
29 #include <asm/mach-types.h>
30 #include <asm/mach/arch.h>
31 #include <asm/mach/map.h>
33 #include "board-mx31lilly.h"
35 #include "devices-imx31.h"
37 #include "iomux-mx3.h"
40 * This file contains board-specific initialization routines for the
41 * LILLY-1131 development board. If you design an own baseboard for the
42 * module, use this file as base for support code.
45 static unsigned int lilly_db_board_pins
[] __initdata
= {
54 MX31_PIN_CSPI3_MOSI__RXD3
,
55 MX31_PIN_CSPI3_MISO__TXD3
,
56 MX31_PIN_CSPI3_SCLK__RTS3
,
57 MX31_PIN_CSPI3_SPI_RDY__CTS3
,
58 MX31_PIN_SD1_DATA3__SD1_DATA3
,
59 MX31_PIN_SD1_DATA2__SD1_DATA2
,
60 MX31_PIN_SD1_DATA1__SD1_DATA1
,
61 MX31_PIN_SD1_DATA0__SD1_DATA0
,
62 MX31_PIN_SD1_CLK__SD1_CLK
,
63 MX31_PIN_SD1_CMD__SD1_CMD
,
82 MX31_PIN_VSYNC3__VSYNC3
,
83 MX31_PIN_HSYNC__HSYNC
,
84 MX31_PIN_FPSHIFT__FPSHIFT
,
85 MX31_PIN_DRDY0__DRDY0
,
86 MX31_PIN_CONTRAST__CONTRAST
,
90 static const struct imxuart_platform_data uart_pdata __initconst
= {
91 .flags
= IMXUART_HAVE_RTSCTS
,
96 static int mxc_mmc1_get_ro(struct device
*dev
)
98 return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_LCS0
));
101 static int gpio_det
, gpio_wp
;
103 #define MMC_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
104 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
106 static int mxc_mmc1_init(struct device
*dev
,
107 irq_handler_t detect_irq
, void *data
)
111 gpio_det
= IOMUX_TO_GPIO(MX31_PIN_GPIO1_1
);
112 gpio_wp
= IOMUX_TO_GPIO(MX31_PIN_LCS0
);
114 mxc_iomux_set_pad(MX31_PIN_SD1_DATA0
, MMC_PAD_CFG
);
115 mxc_iomux_set_pad(MX31_PIN_SD1_DATA1
, MMC_PAD_CFG
);
116 mxc_iomux_set_pad(MX31_PIN_SD1_DATA2
, MMC_PAD_CFG
);
117 mxc_iomux_set_pad(MX31_PIN_SD1_DATA3
, MMC_PAD_CFG
);
118 mxc_iomux_set_pad(MX31_PIN_SD1_CLK
, MMC_PAD_CFG
);
119 mxc_iomux_set_pad(MX31_PIN_SD1_CMD
, MMC_PAD_CFG
);
121 ret
= gpio_request(gpio_det
, "MMC detect");
125 ret
= gpio_request(gpio_wp
, "MMC w/p");
129 gpio_direction_input(gpio_det
);
130 gpio_direction_input(gpio_wp
);
132 ret
= request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1
)),
134 IRQF_DISABLED
| IRQF_TRIGGER_FALLING
,
150 static void mxc_mmc1_exit(struct device
*dev
, void *data
)
154 free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1
)), data
);
157 static const struct imxmmc_platform_data mmc_pdata __initconst
= {
158 .get_ro
= mxc_mmc1_get_ro
,
159 .init
= mxc_mmc1_init
,
160 .exit
= mxc_mmc1_exit
,
163 /* Framebuffer support */
164 static const struct fb_videomode fb_modedb
= {
165 /* 640x480 TFT panel (IPS-056T) */
177 .sync
= FB_SYNC_VERT_HIGH_ACT
| FB_SYNC_OE_ACT_HIGH
,
178 .vmode
= FB_VMODE_NONINTERLACED
,
182 static struct mx3fb_platform_data fb_pdata __initdata
= {
188 #define LCD_VCC_EN_GPIO (7)
190 static void __init
mx31lilly_init_fb(void)
192 if (gpio_request(LCD_VCC_EN_GPIO
, "LCD enable") != 0) {
193 printk(KERN_WARNING
"unable to request LCD_VCC_EN pin.\n");
197 imx31_add_ipu_core();
198 imx31_add_mx3_sdc_fb(&fb_pdata
);
199 gpio_direction_output(LCD_VCC_EN_GPIO
, 1);
202 void __init
mx31lilly_db_init(void)
204 mxc_iomux_setup_multiple_pins(lilly_db_board_pins
,
205 ARRAY_SIZE(lilly_db_board_pins
),
206 "development board pins");
207 imx31_add_imx_uart0(&uart_pdata
);
208 imx31_add_imx_uart1(&uart_pdata
);
209 imx31_add_imx_uart2(&uart_pdata
);
210 imx31_add_mxc_mmc(0, &mmc_pdata
);