blob: 7274e7928136a67d366175329830d4146fb7d08b [file] [log] [blame]
Paulius Zaleckascfca8b52008-11-14 11:01:38 +01001/*
Uwe Kleine-König95c00462009-12-09 20:12:07 +01002 * arch/arm/mach-imx/mach-mx1ads.c
Paulius Zaleckascfca8b52008-11-14 11:01:38 +01003 *
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>
Uwe Kleine-Könige835d882010-02-16 11:07:49 +010028#include <mach/iomux-mx1.h>
Sascha Hauer5b684212009-04-29 13:14:19 +020029#include <mach/irqs.h>
30
Uwe Kleine-König6348e6b2010-06-16 15:26:07 +020031#include "devices-imx1.h"
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010032
Uwe Kleine-König6c80ee52010-09-28 21:53:31 +020033static const int mx1ads_pins[] __initconst = {
Sascha Hauer5ae07da2009-04-29 13:17:21 +020034 /* UART1 */
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010035 PC9_PF_UART1_CTS,
36 PC10_PF_UART1_RTS,
37 PC11_PF_UART1_TXD,
38 PC12_PF_UART1_RXD,
Sascha Hauer5ae07da2009-04-29 13:17:21 +020039 /* UART2 */
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010040 PB28_PF_UART2_CTS,
41 PB29_PF_UART2_RTS,
42 PB30_PF_UART2_TXD,
43 PB31_PF_UART2_RXD,
Sascha Hauer5ae07da2009-04-29 13:17:21 +020044 /* 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,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010053};
54
Sascha Hauer5ae07da2009-04-29 13:17:21 +020055/*
56 * UARTs platform data
57 */
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010058
Uwe Kleine-Königd112f4e2010-06-22 14:50:59 +020059static const struct imxuart_platform_data uart0_pdata __initconst = {
60 .flags = IMXUART_HAVE_RTSCTS,
61};
62
63static const struct imxuart_platform_data uart1_pdata __initconst = {
64 .flags = IMXUART_HAVE_RTSCTS,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010065};
66
67/*
68 * Physmap flash
69 */
70
Uwe Kleine-Königf2f07be2011-07-31 00:19:55 +020071static const struct physmap_flash_data mx1ads_flash_data __initconst = {
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010072 .width = 4, /* bankwidth in bytes */
73};
74
Uwe Kleine-Königf2f07be2011-07-31 00:19:55 +020075static const struct resource flash_resource __initconst = {
Uwe Kleine-König05a31852010-03-04 21:02:41 +010076 .start = MX1_CS0_PHYS,
77 .end = MX1_CS0_PHYS + SZ_32M - 1,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010078 .flags = IORESOURCE_MEM,
79};
80
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010081/*
Sascha Hauerb8b19b02009-01-28 14:06:20 +010082 * I2C
83 */
Sascha Hauerb8b19b02009-01-28 14:06:20 +010084static struct pcf857x_platform_data pcf857x_data[] = {
85 {
86 .gpio_base = 4 * 32,
87 }, {
88 .gpio_base = 4 * 32 + 16,
89 }
90};
91
Uwe Kleine-König6348e6b2010-06-16 15:26:07 +020092static const struct imxi2c_platform_data mx1ads_i2c_data __initconst = {
Sascha Hauerb8b19b02009-01-28 14:06:20 +010093 .bitrate = 100000,
Sascha Hauerb8b19b02009-01-28 14:06:20 +010094};
95
96static struct i2c_board_info mx1ads_i2c_devices[] = {
97 {
Sascha Hauercf87a6e2009-07-20 08:18:47 +020098 I2C_BOARD_INFO("pcf8575", 0x22),
Sascha Hauerb8b19b02009-01-28 14:06:20 +010099 .platform_data = &pcf857x_data[0],
100 }, {
Sascha Hauercf87a6e2009-07-20 08:18:47 +0200101 I2C_BOARD_INFO("pcf8575", 0x24),
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100102 .platform_data = &pcf857x_data[1],
103 },
104};
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100105
106/*
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100107 * Board init
108 */
109static void __init mx1ads_init(void)
110{
Shawn Guob78d8e52011-06-06 00:07:55 +0800111 imx1_soc_init();
112
Sascha Hauer5ae07da2009-04-29 13:17:21 +0200113 mxc_gpio_setup_multiple_pins(mx1ads_pins,
114 ARRAY_SIZE(mx1ads_pins), "mx1ads");
115
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100116 /* UART */
Uwe Kleine-Königd112f4e2010-06-22 14:50:59 +0200117 imx1_add_imx_uart0(&uart0_pdata);
118 imx1_add_imx_uart1(&uart1_pdata);
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100119
120 /* Physmap flash */
Uwe Kleine-Königf2f07be2011-07-31 00:19:55 +0200121 platform_device_register_resndata(NULL, "physmap-flash", 0,
122 &flash_resource, 1,
123 &mx1ads_flash_data, sizeof(mx1ads_flash_data));
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100124
125 /* I2C */
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100126 i2c_register_board_info(0, mx1ads_i2c_devices,
127 ARRAY_SIZE(mx1ads_i2c_devices));
128
Uwe Kleine-König77a406d2010-08-25 12:19:50 +0200129 imx1_add_imx_i2c(&mx1ads_i2c_data);
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100130}
131
132static void __init mx1ads_timer_init(void)
133{
Sascha Hauer30c730f2009-02-16 14:36:49 +0100134 mx1_clocks_init(32000);
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100135}
136
Marc Kleine-Budde7bf1c872012-04-24 17:48:17 +0200137static struct sys_timer mx1ads_timer = {
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100138 .init = mx1ads_timer_init,
139};
140
141MACHINE_START(MX1ADS, "Freescale MX1ADS")
142 /* Maintainer: Sascha Hauer, Pengutronix */
Nicolas Pitredc8f1902011-07-05 22:38:12 -0400143 .atag_offset = 0x100,
Uwe Kleine-König3dac2192011-02-07 16:35:19 +0100144 .map_io = mx1_map_io,
145 .init_early = imx1_init_early,
146 .init_irq = mx1_init_irq,
Sascha Hauerffa2ea32011-09-20 14:31:24 +0200147 .handle_irq = imx1_handle_irq,
Uwe Kleine-König3dac2192011-02-07 16:35:19 +0100148 .timer = &mx1ads_timer,
149 .init_machine = mx1ads_init,
Russell King65ea7882011-11-06 17:12:08 +0000150 .restart = mxc_restart,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100151MACHINE_END
152
153MACHINE_START(MXLADS, "Freescale MXLADS")
Nicolas Pitredc8f1902011-07-05 22:38:12 -0400154 .atag_offset = 0x100,
Uwe Kleine-König3dac2192011-02-07 16:35:19 +0100155 .map_io = mx1_map_io,
156 .init_early = imx1_init_early,
157 .init_irq = mx1_init_irq,
Sascha Hauerffa2ea32011-09-20 14:31:24 +0200158 .handle_irq = imx1_handle_irq,
Uwe Kleine-König3dac2192011-02-07 16:35:19 +0100159 .timer = &mx1ads_timer,
160 .init_machine = mx1ads_init,
Russell King65ea7882011-11-06 17:12:08 +0000161 .restart = mxc_restart,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100162MACHINE_END