blob: 1d28598bcc370b2c3c832b8ce37d52a8359966c8 [file] [log] [blame]
Paulius Zaleckascfca8b52008-11-14 11:01:38 +01001/*
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
Sascha Hauerb8b19b02009-01-28 14:06:20 +010015#include <linux/i2c.h>
16#include <linux/i2c/pcf857x.h>
Sascha Hauer5b684212009-04-29 13:14:19 +020017#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/platform_device.h>
20#include <linux/mtd/physmap.h>
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010021
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24#include <asm/mach/time.h>
25
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010026#include <mach/common.h>
Sascha Hauer5b684212009-04-29 13:14:19 +020027#include <mach/hardware.h>
Sascha Hauerb8b19b02009-01-28 14:06:20 +010028#include <mach/i2c.h>
Sascha Hauer5b684212009-04-29 13:14:19 +020029#include <mach/imx-uart.h>
Holger Schurigccfe30a2009-01-29 10:07:50 +010030#include <mach/iomux.h>
Sascha Hauer5b684212009-04-29 13:14:19 +020031#include <mach/irqs.h>
32
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010033#include "devices.h"
34
35/*
36 * UARTs platform data
37 */
38static int mxc_uart1_pins[] = {
39 PC9_PF_UART1_CTS,
40 PC10_PF_UART1_RTS,
41 PC11_PF_UART1_TXD,
42 PC12_PF_UART1_RXD,
43};
44
45static int uart1_mxc_init(struct platform_device *pdev)
46{
47 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
48 ARRAY_SIZE(mxc_uart1_pins), "UART1");
49}
50
51static int uart1_mxc_exit(struct platform_device *pdev)
52{
53 mxc_gpio_release_multiple_pins(mxc_uart1_pins,
54 ARRAY_SIZE(mxc_uart1_pins));
55 return 0;
56}
57
58static int mxc_uart2_pins[] = {
59 PB28_PF_UART2_CTS,
60 PB29_PF_UART2_RTS,
61 PB30_PF_UART2_TXD,
62 PB31_PF_UART2_RXD,
63};
64
65static int uart2_mxc_init(struct platform_device *pdev)
66{
67 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
68 ARRAY_SIZE(mxc_uart2_pins), "UART2");
69}
70
71static int uart2_mxc_exit(struct platform_device *pdev)
72{
73 mxc_gpio_release_multiple_pins(mxc_uart2_pins,
74 ARRAY_SIZE(mxc_uart2_pins));
75 return 0;
76}
77
78static struct imxuart_platform_data uart_pdata[] = {
79 {
80 .init = uart1_mxc_init,
81 .exit = uart1_mxc_exit,
82 .flags = IMXUART_HAVE_RTSCTS,
83 }, {
84 .init = uart2_mxc_init,
85 .exit = uart2_mxc_exit,
86 .flags = IMXUART_HAVE_RTSCTS,
87 },
88};
89
90/*
91 * Physmap flash
92 */
93
94static struct physmap_flash_data mx1ads_flash_data = {
95 .width = 4, /* bankwidth in bytes */
96};
97
98static struct resource flash_resource = {
99 .start = IMX_CS0_PHYS,
100 .end = IMX_CS0_PHYS + SZ_32M - 1,
101 .flags = IORESOURCE_MEM,
102};
103
104static struct platform_device flash_device = {
105 .name = "physmap-flash",
106 .id = 0,
107 .resource = &flash_resource,
108 .num_resources = 1,
109};
110
111/*
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100112 * I2C
113 */
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100114static int i2c_pins[] = {
115 PA15_PF_I2C_SDA,
116 PA16_PF_I2C_SCL,
117};
118
119static int i2c_init(struct device *dev)
120{
121 return mxc_gpio_setup_multiple_pins(i2c_pins,
122 ARRAY_SIZE(i2c_pins), "I2C");
123}
124
125static void i2c_exit(struct device *dev)
126{
127 mxc_gpio_release_multiple_pins(i2c_pins,
128 ARRAY_SIZE(i2c_pins));
129}
130
131static struct pcf857x_platform_data pcf857x_data[] = {
132 {
133 .gpio_base = 4 * 32,
134 }, {
135 .gpio_base = 4 * 32 + 16,
136 }
137};
138
139static struct imxi2c_platform_data mx1ads_i2c_data = {
140 .bitrate = 100000,
141 .init = i2c_init,
142 .exit = i2c_exit,
143};
144
145static struct i2c_board_info mx1ads_i2c_devices[] = {
146 {
147 I2C_BOARD_INFO("pcf857x", 0x22),
148 .type = "pcf8575",
149 .platform_data = &pcf857x_data[0],
150 }, {
151 I2C_BOARD_INFO("pcf857x", 0x24),
152 .type = "pcf8575",
153 .platform_data = &pcf857x_data[1],
154 },
155};
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100156
157/*
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100158 * Board init
159 */
160static void __init mx1ads_init(void)
161{
162 /* UART */
163 mxc_register_device(&imx_uart1_device, &uart_pdata[0]);
164 mxc_register_device(&imx_uart2_device, &uart_pdata[1]);
165
166 /* Physmap flash */
167 mxc_register_device(&flash_device, &mx1ads_flash_data);
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100168
169 /* I2C */
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100170 i2c_register_board_info(0, mx1ads_i2c_devices,
171 ARRAY_SIZE(mx1ads_i2c_devices));
172
173 mxc_register_device(&imx_i2c_device, &mx1ads_i2c_data);
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100174}
175
176static void __init mx1ads_timer_init(void)
177{
Sascha Hauer30c730f2009-02-16 14:36:49 +0100178 mx1_clocks_init(32000);
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100179}
180
181struct sys_timer mx1ads_timer = {
182 .init = mx1ads_timer_init,
183};
184
185MACHINE_START(MX1ADS, "Freescale MX1ADS")
186 /* Maintainer: Sascha Hauer, Pengutronix */
187 .phys_io = IMX_IO_PHYS,
188 .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
189 .boot_params = PHYS_OFFSET + 0x100,
190 .map_io = mxc_map_io,
191 .init_irq = mxc_init_irq,
192 .timer = &mx1ads_timer,
193 .init_machine = mx1ads_init,
194MACHINE_END
195
196MACHINE_START(MXLADS, "Freescale MXLADS")
197 .phys_io = IMX_IO_PHYS,
198 .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
199 .boot_params = PHYS_OFFSET + 0x100,
Sascha Hauercd4a05f2009-04-02 22:32:10 +0200200 .map_io = mx1_map_io,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100201 .init_irq = mxc_init_irq,
202 .timer = &mx1ads_timer,
203 .init_machine = mx1ads_init,
204MACHINE_END