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.
17 #include <linux/platform_device.h>
18 #include <linux/mtd/mtd.h>
19 #include <linux/mtd/map.h>
20 #include <linux/mtd/partitions.h>
21 #include <linux/mtd/physmap.h>
22 #include <linux/i2c.h>
23 #include <linux/irq.h>
24 #include <mach/common.h>
25 #include <mach/hardware.h>
26 #include <asm/mach-types.h>
27 #include <asm/mach/arch.h>
28 #include <asm/mach/time.h>
29 #include <asm/mach/map.h>
30 #include <linux/gpio.h>
31 #include <mach/iomux-mx27.h>
32 #include <linux/i2c/pca953x.h>
34 #include "devices-imx27.h"
36 static const int mxt_td60_pins
[] __initconst
= {
122 static const struct mxc_nand_platform_data
123 mxt_td60_nand_board_info __initconst
= {
128 static const struct imxi2c_platform_data mxt_td60_i2c0_data __initconst
= {
133 static int mxt_td60_pca9557_setup(struct i2c_client
*client
,
134 unsigned gpio_base
, unsigned ngpio
,
137 static int mxt_td60_gpio_value
[] = {
138 -1, -1, -1, -1, -1, -1, -1, 1
142 for (n
= 0; n
< ARRAY_SIZE(mxt_td60_gpio_value
); ++n
) {
143 gpio_request(gpio_base
+ n
, "MXT_TD60 GPIO Exp");
144 if (mxt_td60_gpio_value
[n
] < 0)
145 gpio_direction_input(gpio_base
+ n
);
147 gpio_direction_output(gpio_base
+ n
,
148 mxt_td60_gpio_value
[n
]);
149 gpio_export(gpio_base
+ n
, 0);
155 static struct pca953x_platform_data mxt_td60_pca9557_pdata
= {
156 .gpio_base
= 240, /* place PCA9557 after all MX27 gpio pins */
157 .invert
= 0, /* Do not invert */
158 .setup
= mxt_td60_pca9557_setup
,
161 static struct i2c_board_info mxt_td60_i2c_devices
[] = {
163 I2C_BOARD_INFO("pca9557", 0x18),
164 .platform_data
= &mxt_td60_pca9557_pdata
,
168 static const struct imxi2c_platform_data mxt_td60_i2c1_data __initconst
= {
172 static struct i2c_board_info mxt_td60_i2c2_devices
[] = {
175 static struct imx_fb_videomode mxt_td60_modes
[] = {
178 .name
= "Chimei LW700AT9003",
185 .right_margin
= 0x68,
187 .upper_margin
= 0x0f,
188 .lower_margin
= 0x0f,
195 static const struct imx_fb_platform_data mxt_td60_fb_data __initconst
= {
196 .mode
= mxt_td60_modes
,
197 .num_modes
= ARRAY_SIZE(mxt_td60_modes
),
200 * - HSYNC active high
201 * - VSYNC active high
202 * - clk notenabled while idle
204 * - data not inverted
205 * - data enable low active
206 * - enable sharp mode
213 static int mxt_td60_sdhc1_init(struct device
*dev
, irq_handler_t detect_irq
,
216 return request_irq(IRQ_GPIOF(8), detect_irq
, IRQF_TRIGGER_FALLING
,
217 "sdhc1-card-detect", data
);
220 static void mxt_td60_sdhc1_exit(struct device
*dev
, void *data
)
222 free_irq(IRQ_GPIOF(8), data
);
225 static const struct imxmmc_platform_data sdhc1_pdata __initconst
= {
226 .init
= mxt_td60_sdhc1_init
,
227 .exit
= mxt_td60_sdhc1_exit
,
230 static const struct imxuart_platform_data uart_pdata __initconst
= {
231 .flags
= IMXUART_HAVE_RTSCTS
,
234 static void __init
mxt_td60_board_init(void)
238 mxc_gpio_setup_multiple_pins(mxt_td60_pins
, ARRAY_SIZE(mxt_td60_pins
),
241 imx27_add_imx_uart0(&uart_pdata
);
242 imx27_add_imx_uart1(&uart_pdata
);
243 imx27_add_imx_uart2(&uart_pdata
);
244 imx27_add_mxc_nand(&mxt_td60_nand_board_info
);
246 i2c_register_board_info(0, mxt_td60_i2c_devices
,
247 ARRAY_SIZE(mxt_td60_i2c_devices
));
249 i2c_register_board_info(1, mxt_td60_i2c2_devices
,
250 ARRAY_SIZE(mxt_td60_i2c2_devices
));
252 imx27_add_imx_i2c(0, &mxt_td60_i2c0_data
);
253 imx27_add_imx_i2c(1, &mxt_td60_i2c1_data
);
254 imx27_add_imx_fb(&mxt_td60_fb_data
);
255 imx27_add_mxc_mmc(0, &sdhc1_pdata
);
259 static void __init
mxt_td60_timer_init(void)
261 mx27_clocks_init(26000000);
264 static struct sys_timer mxt_td60_timer
= {
265 .init
= mxt_td60_timer_init
,
268 MACHINE_START(MXT_TD60
, "Maxtrack i-MXT TD60")
269 /* maintainer: Maxtrack Industrial */
270 .atag_offset
= 0x100,
271 .map_io
= mx27_map_io
,
272 .init_early
= imx27_init_early
,
273 .init_irq
= mx27_init_irq
,
274 .handle_irq
= imx27_handle_irq
,
275 .timer
= &mxt_td60_timer
,
276 .init_machine
= mxt_td60_board_init
,
277 .restart
= mxc_restart
,