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 = {
131 static struct mxc_nand_platform_data mxt_td60_nand_board_info = {
136 static struct imxi2c_platform_data mxt_td60_i2c_data = {
141 static int mxt_td60_pca9557_setup(struct i2c_client *client,
142 unsigned gpio_base, unsigned ngpio,
145 static int mxt_td60_gpio_value[] = {
146 -1, -1, -1, -1, -1, -1, -1, 1
150 for (n = 0; n < ARRAY_SIZE(mxt_td60_gpio_value); ++n) {
151 gpio_request(gpio_base + n, "MXT_TD60 GPIO Exp");
152 if (mxt_td60_gpio_value[n] < 0)
153 gpio_direction_input(gpio_base + n);
155 gpio_direction_output(gpio_base + n,
156 mxt_td60_gpio_value[n]);
157 gpio_export(gpio_base + n, 0);
163 static struct pca953x_platform_data mxt_td60_pca9557_pdata = {
164 .gpio_base = 240, /* place PCA9557 after all MX27 gpio pins */
165 .invert = 0, /* Do not invert */
166 .setup = mxt_td60_pca9557_setup,
169 static struct i2c_board_info mxt_td60_i2c_devices[] = {
171 I2C_BOARD_INFO("pca9557", 0x18),
172 .platform_data = &mxt_td60_pca9557_pdata,
176 static struct imxi2c_platform_data mxt_td60_i2c2_data = {
180 static struct i2c_board_info mxt_td60_i2c2_devices[] = {
183 static struct imx_fb_videomode mxt_td60_modes[] = {
186 .name = "Chimei LW700AT9003",
193 .right_margin = 0x68,
195 .upper_margin = 0x0f,
196 .lower_margin = 0x0f,
203 static struct imx_fb_platform_data mxt_td60_fb_data = {
204 .mode = mxt_td60_modes,
205 .num_modes = ARRAY_SIZE(mxt_td60_modes),
208 * - HSYNC active high
209 * - VSYNC active high
210 * - clk notenabled while idle
212 * - data not inverted
213 * - data enable low active
214 * - enable sharp mode
221 static int mxt_td60_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
224 return request_irq(IRQ_GPIOF(8), detect_irq, IRQF_TRIGGER_FALLING,
225 "sdhc1-card-detect", data);
228 static void mxt_td60_sdhc1_exit(struct device *dev, void *data)
230 free_irq(IRQ_GPIOF(8), data);
233 static struct imxmmc_platform_data sdhc1_pdata = {
234 .init = mxt_td60_sdhc1_init,
235 .exit = mxt_td60_sdhc1_exit,
238 static struct platform_device *platform_devices[] __initdata = {
242 static struct imxuart_platform_data uart_pdata[] = {
244 .flags = IMXUART_HAVE_RTSCTS,
246 .flags = IMXUART_HAVE_RTSCTS,
248 .flags = IMXUART_HAVE_RTSCTS,
252 static void __init mxt_td60_board_init(void)
254 mxc_gpio_setup_multiple_pins(mxt_td60_pins, ARRAY_SIZE(mxt_td60_pins),
257 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
258 mxc_register_device(&mxc_uart_device1, &uart_pdata[1]);
259 mxc_register_device(&mxc_uart_device2, &uart_pdata[2]);
260 mxc_register_device(&mxc_nand_device, &mxt_td60_nand_board_info);
262 i2c_register_board_info(0, mxt_td60_i2c_devices,
263 ARRAY_SIZE(mxt_td60_i2c_devices));
265 i2c_register_board_info(1, mxt_td60_i2c2_devices,
266 ARRAY_SIZE(mxt_td60_i2c2_devices));
268 mxc_register_device(&mxc_i2c_device0, &mxt_td60_i2c_data);
269 mxc_register_device(&mxc_i2c_device1, &mxt_td60_i2c2_data);
270 mxc_register_device(&mxc_fb_device, &mxt_td60_fb_data);
271 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
273 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
276 static void __init mxt_td60_timer_init(void)
278 mx27_clocks_init(26000000);
281 static struct sys_timer mxt_td60_timer = {
282 .init = mxt_td60_timer_init,
285 MACHINE_START(MXT_TD60, "Maxtrack i-MXT TD60")
286 /* maintainer: Maxtrack Industrial */
287 .phys_io = AIPI_BASE_ADDR,
288 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
289 .boot_params = PHYS_OFFSET + 0x100,
290 .map_io = mx27_map_io,
291 .init_irq = mx27_init_irq,
292 .init_machine = mxt_td60_board_init,
293 .timer = &mxt_td60_timer,