2 * Copyright (C) 2000 Deep Blue Solutions Ltd
3 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
4 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <linux/platform_device.h>
22 #include <linux/mtd/mtd.h>
23 #include <linux/mtd/map.h>
24 #include <linux/mtd/partitions.h>
25 #include <linux/mtd/physmap.h>
26 #include <linux/i2c.h>
27 #include <linux/irq.h>
28 #include <mach/common.h>
29 #include <mach/hardware.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/time.h>
33 #include <asm/mach/map.h>
34 #include <linux/gpio.h>
35 #include <mach/imx-uart.h>
36 #include <mach/iomux.h>
37 #include <mach/mxc_nand.h>
39 #include <linux/i2c/pca953x.h>
40 #include <mach/imxfb.h>
45 static unsigned int mxt_td60_pins[] __initdata = {
146 static struct mxc_nand_platform_data mxt_td60_nand_board_info = {
151 static struct imxi2c_platform_data mxt_td60_i2c_data = {
156 static int mxt_td60_pca9557_setup(struct i2c_client *client,
157 unsigned gpio_base, unsigned ngpio,
160 static int mxt_td60_gpio_value[] = {
161 -1, -1, -1, -1, -1, -1, -1, 1
165 for (n = 0; n < ARRAY_SIZE(mxt_td60_gpio_value); ++n) {
166 gpio_request(gpio_base + n, "MXT_TD60 GPIO Exp");
167 if (mxt_td60_gpio_value[n] < 0)
168 gpio_direction_input(gpio_base + n);
170 gpio_direction_output(gpio_base + n,
171 mxt_td60_gpio_value[n]);
172 gpio_export(gpio_base + n, 0);
178 static struct pca953x_platform_data mxt_td60_pca9557_pdata = {
179 .gpio_base = 240, /* place PCA9557 after all MX27 gpio pins */
180 .invert = 0, /* Do not invert */
181 .setup = mxt_td60_pca9557_setup,
184 static struct i2c_board_info mxt_td60_i2c_devices[] = {
186 I2C_BOARD_INFO("pca9557", 0x18),
187 .platform_data = &mxt_td60_pca9557_pdata,
191 static struct imxi2c_platform_data mxt_td60_i2c2_data = {
195 static struct i2c_board_info mxt_td60_i2c2_devices[] = {
198 static struct imx_fb_videomode mxt_td60_modes[] = {
201 .name = "Chimei LW700AT9003",
208 .right_margin = 0x68,
210 .upper_margin = 0x0f,
211 .lower_margin = 0x0f,
218 static struct imx_fb_platform_data mxt_td60_fb_data = {
219 .mode = mxt_td60_modes,
220 .num_modes = ARRAY_SIZE(mxt_td60_modes),
223 * - HSYNC active high
224 * - VSYNC active high
225 * - clk notenabled while idle
227 * - data not inverted
228 * - data enable low active
229 * - enable sharp mode
236 static int mxt_td60_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
239 return request_irq(IRQ_GPIOF(8), detect_irq, IRQF_TRIGGER_FALLING,
240 "sdhc1-card-detect", data);
243 static void mxt_td60_sdhc1_exit(struct device *dev, void *data)
245 free_irq(IRQ_GPIOF(8), data);
248 static struct imxmmc_platform_data sdhc1_pdata = {
249 .init = mxt_td60_sdhc1_init,
250 .exit = mxt_td60_sdhc1_exit,
253 static struct platform_device *platform_devices[] __initdata = {
257 static struct imxuart_platform_data uart_pdata[] = {
259 .flags = IMXUART_HAVE_RTSCTS,
261 .flags = IMXUART_HAVE_RTSCTS,
263 .flags = IMXUART_HAVE_RTSCTS,
265 .flags = IMXUART_HAVE_RTSCTS,
267 .flags = IMXUART_HAVE_RTSCTS,
269 .flags = IMXUART_HAVE_RTSCTS,
273 static void __init mxt_td60_board_init(void)
275 mxc_gpio_setup_multiple_pins(mxt_td60_pins, ARRAY_SIZE(mxt_td60_pins),
278 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
279 mxc_register_device(&mxc_uart_device1, &uart_pdata[1]);
280 mxc_register_device(&mxc_uart_device2, &uart_pdata[2]);
281 mxc_register_device(&mxc_uart_device3, &uart_pdata[3]);
282 mxc_register_device(&mxc_uart_device4, &uart_pdata[4]);
283 mxc_register_device(&mxc_uart_device5, &uart_pdata[5]);
284 mxc_register_device(&mxc_nand_device, &mxt_td60_nand_board_info);
286 i2c_register_board_info(0, mxt_td60_i2c_devices,
287 ARRAY_SIZE(mxt_td60_i2c_devices));
289 i2c_register_board_info(1, mxt_td60_i2c2_devices,
290 ARRAY_SIZE(mxt_td60_i2c2_devices));
292 mxc_register_device(&mxc_i2c_device0, &mxt_td60_i2c_data);
293 mxc_register_device(&mxc_i2c_device1, &mxt_td60_i2c2_data);
294 mxc_register_device(&mxc_fb_device, &mxt_td60_fb_data);
295 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
297 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
300 static void __init mxt_td60_timer_init(void)
302 mx27_clocks_init(26000000);
305 static struct sys_timer mxt_td60_timer = {
306 .init = mxt_td60_timer_init,
309 MACHINE_START(MXT_TD60, "Maxtrack i-MXT TD60")
310 /* maintainer: Maxtrack Industrial */
311 .phys_io = AIPI_BASE_ADDR,
312 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
313 .boot_params = PHYS_OFFSET + 0x100,
314 .map_io = mx27_map_io,
315 .init_irq = mx27_init_irq,
316 .init_machine = mxt_td60_board_init,
317 .timer = &mxt_td60_timer,