1 /*
2  * arch/arm/mach-imx/mach-mx1ads.c
3  *
4  * Initially based on:
5  *	linux-2.6.7-imx/arch/arm/mach-imx/scb9328.c
6  *	Copyright (c) 2004 Sascha Hauer <sascha@saschahauer.de>
7  *
8  * 2004 (c) MontaVista Software, Inc.
9  *
10  * This file is licensed under the terms of the GNU General Public
11  * License version 2. This program is licensed "as is" without any
12  * warranty of any kind, whether express or implied.
13  */
14 
15 #include <linux/i2c.h>
16 #include <linux/i2c/pcf857x.h>
17 #include <linux/init.h>
18 #include <linux/kernel.h>
19 #include <linux/platform_device.h>
20 #include <linux/mtd/physmap.h>
21 
22 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/time.h>
25 
26 #include <mach/common.h>
27 #include <mach/hardware.h>
28 #include <mach/iomux-mx1.h>
29 #include <mach/irqs.h>
30 
31 #include "devices-imx1.h"
32 
33 static const int mx1ads_pins[] __initconst = {
34 	/* UART1 */
35 	PC9_PF_UART1_CTS,
36 	PC10_PF_UART1_RTS,
37 	PC11_PF_UART1_TXD,
38 	PC12_PF_UART1_RXD,
39 	/* UART2 */
40 	PB28_PF_UART2_CTS,
41 	PB29_PF_UART2_RTS,
42 	PB30_PF_UART2_TXD,
43 	PB31_PF_UART2_RXD,
44 	/* I2C */
45 	PA15_PF_I2C_SDA,
46 	PA16_PF_I2C_SCL,
47 	/* SPI */
48 	PC13_PF_SPI1_SPI_RDY,
49 	PC14_PF_SPI1_SCLK,
50 	PC15_PF_SPI1_SS,
51 	PC16_PF_SPI1_MISO,
52 	PC17_PF_SPI1_MOSI,
53 };
54 
55 /*
56  * UARTs platform data
57  */
58 
59 static const struct imxuart_platform_data uart0_pdata __initconst = {
60 	.flags = IMXUART_HAVE_RTSCTS,
61 };
62 
63 static const struct imxuart_platform_data uart1_pdata __initconst = {
64 	.flags = IMXUART_HAVE_RTSCTS,
65 };
66 
67 /*
68  * Physmap flash
69  */
70 
71 static const struct physmap_flash_data mx1ads_flash_data __initconst = {
72 	.width		= 4,		/* bankwidth in bytes */
73 };
74 
75 static const struct resource flash_resource __initconst = {
76 	.start	= MX1_CS0_PHYS,
77 	.end	= MX1_CS0_PHYS + SZ_32M - 1,
78 	.flags	= IORESOURCE_MEM,
79 };
80 
81 /*
82  * I2C
83  */
84 static struct pcf857x_platform_data pcf857x_data[] = {
85 	{
86 		.gpio_base = 4 * 32,
87 	}, {
88 		.gpio_base = 4 * 32 + 16,
89 	}
90 };
91 
92 static const struct imxi2c_platform_data mx1ads_i2c_data __initconst = {
93 	.bitrate = 100000,
94 };
95 
96 static struct i2c_board_info mx1ads_i2c_devices[] = {
97 	{
98 		I2C_BOARD_INFO("pcf8575", 0x22),
99 		.platform_data = &pcf857x_data[0],
100 	}, {
101 		I2C_BOARD_INFO("pcf8575", 0x24),
102 		.platform_data = &pcf857x_data[1],
103 	},
104 };
105 
106 /*
107  * Board init
108  */
mx1ads_init(void)109 static void __init mx1ads_init(void)
110 {
111 	imx1_soc_init();
112 
113 	mxc_gpio_setup_multiple_pins(mx1ads_pins,
114 		ARRAY_SIZE(mx1ads_pins), "mx1ads");
115 
116 	/* UART */
117 	imx1_add_imx_uart0(&uart0_pdata);
118 	imx1_add_imx_uart1(&uart1_pdata);
119 
120 	/* Physmap flash */
121 	platform_device_register_resndata(NULL, "physmap-flash", 0,
122 			&flash_resource, 1,
123 			&mx1ads_flash_data, sizeof(mx1ads_flash_data));
124 
125 	/* I2C */
126 	i2c_register_board_info(0, mx1ads_i2c_devices,
127 				ARRAY_SIZE(mx1ads_i2c_devices));
128 
129 	imx1_add_imx_i2c(&mx1ads_i2c_data);
130 }
131 
mx1ads_timer_init(void)132 static void __init mx1ads_timer_init(void)
133 {
134 	mx1_clocks_init(32000);
135 }
136 
137 struct sys_timer mx1ads_timer = {
138 	.init	= mx1ads_timer_init,
139 };
140 
141 MACHINE_START(MX1ADS, "Freescale MX1ADS")
142 	/* Maintainer: Sascha Hauer, Pengutronix */
143 	.atag_offset = 0x100,
144 	.map_io = mx1_map_io,
145 	.init_early = imx1_init_early,
146 	.init_irq = mx1_init_irq,
147 	.handle_irq = imx1_handle_irq,
148 	.timer = &mx1ads_timer,
149 	.init_machine = mx1ads_init,
150 	.restart	= mxc_restart,
151 MACHINE_END
152 
153 MACHINE_START(MXLADS, "Freescale MXLADS")
154 	.atag_offset = 0x100,
155 	.map_io = mx1_map_io,
156 	.init_early = imx1_init_early,
157 	.init_irq = mx1_init_irq,
158 	.handle_irq = imx1_handle_irq,
159 	.timer = &mx1ads_timer,
160 	.init_machine = mx1ads_init,
161 	.restart	= mxc_restart,
162 MACHINE_END
163