Merge branch 'linus' into x86/urgent
[deliverable/linux.git] / arch / arm / mach-mx1 / mx1ads.c
CommitLineData
cfca8b53
PZ
1/*
2 * arch/arm/mach-imx/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/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/mtd/physmap.h>
b8b19b0d
SH
19#include <linux/i2c.h>
20#include <linux/i2c/pcf857x.h>
cfca8b53
PZ
21
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24#include <asm/mach/time.h>
25
20214fcd 26#include <mach/irqs.h>
cfca8b53
PZ
27#include <mach/hardware.h>
28#include <mach/common.h>
29#include <mach/imx-uart.h>
b8b19b0d
SH
30#include <mach/irqs.h>
31#ifdef CONFIG_I2C_IMX
32#include <mach/i2c.h>
33#endif
ccfe30a7 34#include <mach/iomux.h>
cfca8b53
PZ
35#include "devices.h"
36
37/*
38 * UARTs platform data
39 */
40static int mxc_uart1_pins[] = {
41 PC9_PF_UART1_CTS,
42 PC10_PF_UART1_RTS,
43 PC11_PF_UART1_TXD,
44 PC12_PF_UART1_RXD,
45};
46
47static int uart1_mxc_init(struct platform_device *pdev)
48{
49 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
50 ARRAY_SIZE(mxc_uart1_pins), "UART1");
51}
52
53static int uart1_mxc_exit(struct platform_device *pdev)
54{
55 mxc_gpio_release_multiple_pins(mxc_uart1_pins,
56 ARRAY_SIZE(mxc_uart1_pins));
57 return 0;
58}
59
60static int mxc_uart2_pins[] = {
61 PB28_PF_UART2_CTS,
62 PB29_PF_UART2_RTS,
63 PB30_PF_UART2_TXD,
64 PB31_PF_UART2_RXD,
65};
66
67static int uart2_mxc_init(struct platform_device *pdev)
68{
69 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
70 ARRAY_SIZE(mxc_uart2_pins), "UART2");
71}
72
73static int uart2_mxc_exit(struct platform_device *pdev)
74{
75 mxc_gpio_release_multiple_pins(mxc_uart2_pins,
76 ARRAY_SIZE(mxc_uart2_pins));
77 return 0;
78}
79
80static struct imxuart_platform_data uart_pdata[] = {
81 {
82 .init = uart1_mxc_init,
83 .exit = uart1_mxc_exit,
84 .flags = IMXUART_HAVE_RTSCTS,
85 }, {
86 .init = uart2_mxc_init,
87 .exit = uart2_mxc_exit,
88 .flags = IMXUART_HAVE_RTSCTS,
89 },
90};
91
92/*
93 * Physmap flash
94 */
95
96static struct physmap_flash_data mx1ads_flash_data = {
97 .width = 4, /* bankwidth in bytes */
98};
99
100static struct resource flash_resource = {
101 .start = IMX_CS0_PHYS,
102 .end = IMX_CS0_PHYS + SZ_32M - 1,
103 .flags = IORESOURCE_MEM,
104};
105
106static struct platform_device flash_device = {
107 .name = "physmap-flash",
108 .id = 0,
109 .resource = &flash_resource,
110 .num_resources = 1,
111};
112
b8b19b0d
SH
113/*
114 * I2C
115 */
116
117#ifdef CONFIG_I2C_IMX
118static int i2c_pins[] = {
119 PA15_PF_I2C_SDA,
120 PA16_PF_I2C_SCL,
121};
122
123static int i2c_init(struct device *dev)
124{
125 return mxc_gpio_setup_multiple_pins(i2c_pins,
126 ARRAY_SIZE(i2c_pins), "I2C");
127}
128
129static void i2c_exit(struct device *dev)
130{
131 mxc_gpio_release_multiple_pins(i2c_pins,
132 ARRAY_SIZE(i2c_pins));
133}
134
135static struct pcf857x_platform_data pcf857x_data[] = {
136 {
137 .gpio_base = 4 * 32,
138 }, {
139 .gpio_base = 4 * 32 + 16,
140 }
141};
142
143static struct imxi2c_platform_data mx1ads_i2c_data = {
144 .bitrate = 100000,
145 .init = i2c_init,
146 .exit = i2c_exit,
147};
148
149static struct i2c_board_info mx1ads_i2c_devices[] = {
150 {
151 I2C_BOARD_INFO("pcf857x", 0x22),
152 .type = "pcf8575",
153 .platform_data = &pcf857x_data[0],
154 }, {
155 I2C_BOARD_INFO("pcf857x", 0x24),
156 .type = "pcf8575",
157 .platform_data = &pcf857x_data[1],
158 },
159};
160#endif
161
cfca8b53
PZ
162/*
163 * Board init
164 */
165static void __init mx1ads_init(void)
166{
167 /* UART */
168 mxc_register_device(&imx_uart1_device, &uart_pdata[0]);
169 mxc_register_device(&imx_uart2_device, &uart_pdata[1]);
170
171 /* Physmap flash */
172 mxc_register_device(&flash_device, &mx1ads_flash_data);
b8b19b0d
SH
173
174 /* I2C */
175#ifdef CONFIG_I2C_IMX
176 i2c_register_board_info(0, mx1ads_i2c_devices,
177 ARRAY_SIZE(mx1ads_i2c_devices));
178
179 mxc_register_device(&imx_i2c_device, &mx1ads_i2c_data);
180#endif
cfca8b53
PZ
181}
182
183static void __init mx1ads_timer_init(void)
184{
30c730f8 185 mx1_clocks_init(32000);
cfca8b53
PZ
186}
187
188struct sys_timer mx1ads_timer = {
189 .init = mx1ads_timer_init,
190};
191
192MACHINE_START(MX1ADS, "Freescale MX1ADS")
193 /* Maintainer: Sascha Hauer, Pengutronix */
194 .phys_io = IMX_IO_PHYS,
195 .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
196 .boot_params = PHYS_OFFSET + 0x100,
197 .map_io = mxc_map_io,
198 .init_irq = mxc_init_irq,
199 .timer = &mx1ads_timer,
200 .init_machine = mx1ads_init,
201MACHINE_END
202
203MACHINE_START(MXLADS, "Freescale MXLADS")
204 .phys_io = IMX_IO_PHYS,
205 .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
206 .boot_params = PHYS_OFFSET + 0x100,
207 .map_io = mxc_map_io,
208 .init_irq = mxc_init_irq,
209 .timer = &mx1ads_timer,
210 .init_machine = mx1ads_init,
211MACHINE_END
This page took 0.199239 seconds and 5 git commands to generate.