blob: e5b0c0a83c3bfe5150a78d840f208a5e793b9d61 [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
Sascha Hauer5ae07da2009-04-29 13:17:21 +020035static int mx1ads_pins[] = {
36 /* UART1 */
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010037 PC9_PF_UART1_CTS,
38 PC10_PF_UART1_RTS,
39 PC11_PF_UART1_TXD,
40 PC12_PF_UART1_RXD,
Sascha Hauer5ae07da2009-04-29 13:17:21 +020041 /* UART2 */
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010042 PB28_PF_UART2_CTS,
43 PB29_PF_UART2_RTS,
44 PB30_PF_UART2_TXD,
45 PB31_PF_UART2_RXD,
Sascha Hauer5ae07da2009-04-29 13:17:21 +020046 /* I2C */
47 PA15_PF_I2C_SDA,
48 PA16_PF_I2C_SCL,
49 /* SPI */
50 PC13_PF_SPI1_SPI_RDY,
51 PC14_PF_SPI1_SCLK,
52 PC15_PF_SPI1_SS,
53 PC16_PF_SPI1_MISO,
54 PC17_PF_SPI1_MOSI,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010055};
56
Sascha Hauer5ae07da2009-04-29 13:17:21 +020057/*
58 * UARTs platform data
59 */
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010060
61static struct imxuart_platform_data uart_pdata[] = {
62 {
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010063 .flags = IMXUART_HAVE_RTSCTS,
64 }, {
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010065 .flags = IMXUART_HAVE_RTSCTS,
66 },
67};
68
69/*
70 * Physmap flash
71 */
72
73static struct physmap_flash_data mx1ads_flash_data = {
74 .width = 4, /* bankwidth in bytes */
75};
76
77static struct resource flash_resource = {
78 .start = IMX_CS0_PHYS,
79 .end = IMX_CS0_PHYS + SZ_32M - 1,
80 .flags = IORESOURCE_MEM,
81};
82
83static struct platform_device flash_device = {
84 .name = "physmap-flash",
85 .id = 0,
86 .resource = &flash_resource,
87 .num_resources = 1,
88};
89
90/*
Sascha Hauerb8b19b02009-01-28 14:06:20 +010091 * I2C
92 */
Sascha Hauerb8b19b02009-01-28 14:06:20 +010093static struct pcf857x_platform_data pcf857x_data[] = {
94 {
95 .gpio_base = 4 * 32,
96 }, {
97 .gpio_base = 4 * 32 + 16,
98 }
99};
100
101static struct imxi2c_platform_data mx1ads_i2c_data = {
102 .bitrate = 100000,
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100103};
104
105static struct i2c_board_info mx1ads_i2c_devices[] = {
106 {
107 I2C_BOARD_INFO("pcf857x", 0x22),
108 .type = "pcf8575",
109 .platform_data = &pcf857x_data[0],
110 }, {
111 I2C_BOARD_INFO("pcf857x", 0x24),
112 .type = "pcf8575",
113 .platform_data = &pcf857x_data[1],
114 },
115};
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100116
117/*
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100118 * Board init
119 */
120static void __init mx1ads_init(void)
121{
Sascha Hauer5ae07da2009-04-29 13:17:21 +0200122 mxc_gpio_setup_multiple_pins(mx1ads_pins,
123 ARRAY_SIZE(mx1ads_pins), "mx1ads");
124
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100125 /* UART */
126 mxc_register_device(&imx_uart1_device, &uart_pdata[0]);
127 mxc_register_device(&imx_uart2_device, &uart_pdata[1]);
128
129 /* Physmap flash */
130 mxc_register_device(&flash_device, &mx1ads_flash_data);
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100131
132 /* I2C */
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100133 i2c_register_board_info(0, mx1ads_i2c_devices,
134 ARRAY_SIZE(mx1ads_i2c_devices));
135
136 mxc_register_device(&imx_i2c_device, &mx1ads_i2c_data);
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100137}
138
139static void __init mx1ads_timer_init(void)
140{
Sascha Hauer30c730f2009-02-16 14:36:49 +0100141 mx1_clocks_init(32000);
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100142}
143
144struct sys_timer mx1ads_timer = {
145 .init = mx1ads_timer_init,
146};
147
148MACHINE_START(MX1ADS, "Freescale MX1ADS")
149 /* Maintainer: Sascha Hauer, Pengutronix */
150 .phys_io = IMX_IO_PHYS,
151 .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
152 .boot_params = PHYS_OFFSET + 0x100,
Sascha Hauer74fe030e2009-04-29 13:41:40 +0200153 .map_io = mx1_map_io,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100154 .init_irq = mxc_init_irq,
155 .timer = &mx1ads_timer,
156 .init_machine = mx1ads_init,
157MACHINE_END
158
159MACHINE_START(MXLADS, "Freescale MXLADS")
160 .phys_io = IMX_IO_PHYS,
161 .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
162 .boot_params = PHYS_OFFSET + 0x100,
Sascha Hauercd4a05f2009-04-02 22:32:10 +0200163 .map_io = mx1_map_io,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100164 .init_irq = mxc_init_irq,
165 .timer = &mx1ads_timer,
166 .init_machine = mx1ads_init,
167MACHINE_END