blob: 1f446e5eb6367f135d618332883ff94b7796d907 [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>
Sascha Hauerb8b19b02009-01-28 14:06:20 +010028#include <mach/i2c.h>
Uwe Kleine-Könige835d882010-02-16 11:07:49 +010029#include <mach/iomux-mx1.h>
Sascha Hauer5b684212009-04-29 13:14:19 +020030#include <mach/irqs.h>
31
Uwe Kleine-König6348e6b2010-06-16 15:26:07 +020032#include "devices-imx1.h"
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010033
Uwe Kleine-König6c80ee52010-09-28 21:53:31 +020034static const int mx1ads_pins[] __initconst = {
Sascha Hauer5ae07da2009-04-29 13:17:21 +020035 /* UART1 */
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010036 PC9_PF_UART1_CTS,
37 PC10_PF_UART1_RTS,
38 PC11_PF_UART1_TXD,
39 PC12_PF_UART1_RXD,
Sascha Hauer5ae07da2009-04-29 13:17:21 +020040 /* UART2 */
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010041 PB28_PF_UART2_CTS,
42 PB29_PF_UART2_RTS,
43 PB30_PF_UART2_TXD,
44 PB31_PF_UART2_RXD,
Sascha Hauer5ae07da2009-04-29 13:17:21 +020045 /* I2C */
46 PA15_PF_I2C_SDA,
47 PA16_PF_I2C_SCL,
48 /* SPI */
49 PC13_PF_SPI1_SPI_RDY,
50 PC14_PF_SPI1_SCLK,
51 PC15_PF_SPI1_SS,
52 PC16_PF_SPI1_MISO,
53 PC17_PF_SPI1_MOSI,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010054};
55
Sascha Hauer5ae07da2009-04-29 13:17:21 +020056/*
57 * UARTs platform data
58 */
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010059
Uwe Kleine-Königd112f4e2010-06-22 14:50:59 +020060static const struct imxuart_platform_data uart0_pdata __initconst = {
61 .flags = IMXUART_HAVE_RTSCTS,
62};
63
64static const struct imxuart_platform_data uart1_pdata __initconst = {
65 .flags = IMXUART_HAVE_RTSCTS,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010066};
67
68/*
69 * Physmap flash
70 */
71
72static struct physmap_flash_data mx1ads_flash_data = {
73 .width = 4, /* bankwidth in bytes */
74};
75
76static struct resource flash_resource = {
Uwe Kleine-König05a31852010-03-04 21:02:41 +010077 .start = MX1_CS0_PHYS,
78 .end = MX1_CS0_PHYS + SZ_32M - 1,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010079 .flags = IORESOURCE_MEM,
80};
81
82static struct platform_device flash_device = {
83 .name = "physmap-flash",
84 .id = 0,
85 .resource = &flash_resource,
86 .num_resources = 1,
87};
88
89/*
Sascha Hauerb8b19b02009-01-28 14:06:20 +010090 * I2C
91 */
Sascha Hauerb8b19b02009-01-28 14:06:20 +010092static struct pcf857x_platform_data pcf857x_data[] = {
93 {
94 .gpio_base = 4 * 32,
95 }, {
96 .gpio_base = 4 * 32 + 16,
97 }
98};
99
Uwe Kleine-König6348e6b2010-06-16 15:26:07 +0200100static const struct imxi2c_platform_data mx1ads_i2c_data __initconst = {
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100101 .bitrate = 100000,
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100102};
103
104static struct i2c_board_info mx1ads_i2c_devices[] = {
105 {
Sascha Hauercf87a6e2009-07-20 08:18:47 +0200106 I2C_BOARD_INFO("pcf8575", 0x22),
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100107 .platform_data = &pcf857x_data[0],
108 }, {
Sascha Hauercf87a6e2009-07-20 08:18:47 +0200109 I2C_BOARD_INFO("pcf8575", 0x24),
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100110 .platform_data = &pcf857x_data[1],
111 },
112};
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100113
114/*
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100115 * Board init
116 */
117static void __init mx1ads_init(void)
118{
Sascha Hauer5ae07da2009-04-29 13:17:21 +0200119 mxc_gpio_setup_multiple_pins(mx1ads_pins,
120 ARRAY_SIZE(mx1ads_pins), "mx1ads");
121
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100122 /* UART */
Uwe Kleine-Königd112f4e2010-06-22 14:50:59 +0200123 imx1_add_imx_uart0(&uart0_pdata);
124 imx1_add_imx_uart1(&uart1_pdata);
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100125
126 /* Physmap flash */
127 mxc_register_device(&flash_device, &mx1ads_flash_data);
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100128
129 /* I2C */
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100130 i2c_register_board_info(0, mx1ads_i2c_devices,
131 ARRAY_SIZE(mx1ads_i2c_devices));
132
Uwe Kleine-König77a406d2010-08-25 12:19:50 +0200133 imx1_add_imx_i2c(&mx1ads_i2c_data);
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100134}
135
136static void __init mx1ads_timer_init(void)
137{
Sascha Hauer30c730f2009-02-16 14:36:49 +0100138 mx1_clocks_init(32000);
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100139}
140
141struct sys_timer mx1ads_timer = {
142 .init = mx1ads_timer_init,
143};
144
145MACHINE_START(MX1ADS, "Freescale MX1ADS")
146 /* Maintainer: Sascha Hauer, Pengutronix */
Uwe Kleine-König34101232010-01-29 17:36:05 +0100147 .boot_params = MX1_PHYS_OFFSET + 0x100,
Sascha Hauer74fe030e2009-04-29 13:41:40 +0200148 .map_io = mx1_map_io,
Sascha Hauerc5aa0ad2009-05-25 17:36:19 +0200149 .init_irq = mx1_init_irq,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100150 .timer = &mx1ads_timer,
151 .init_machine = mx1ads_init,
152MACHINE_END
153
154MACHINE_START(MXLADS, "Freescale MXLADS")
Uwe Kleine-König34101232010-01-29 17:36:05 +0100155 .boot_params = MX1_PHYS_OFFSET + 0x100,
Sascha Hauercd4a05f2009-04-02 22:32:10 +0200156 .map_io = mx1_map_io,
Sascha Hauerc5aa0ad2009-05-25 17:36:19 +0200157 .init_irq = mx1_init_irq,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100158 .timer = &mx1ads_timer,
159 .init_machine = mx1ads_init,
160MACHINE_END