blob: 339d41ad19d502a36870d707d30942e3a726150a [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>
Sascha Hauer5b684212009-04-29 13:14:19 +020029#include <mach/imx-uart.h>
Uwe Kleine-Könige835d882010-02-16 11:07:49 +010030#include <mach/iomux-mx1.h>
Sascha Hauer5b684212009-04-29 13:14:19 +020031#include <mach/irqs.h>
32
Uwe Kleine-König6348e6b2010-06-16 15:26:07 +020033#include "devices-imx1.h"
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010034#include "devices.h"
35
Sascha Hauer5ae07da2009-04-29 13:17:21 +020036static int mx1ads_pins[] = {
37 /* UART1 */
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010038 PC9_PF_UART1_CTS,
39 PC10_PF_UART1_RTS,
40 PC11_PF_UART1_TXD,
41 PC12_PF_UART1_RXD,
Sascha Hauer5ae07da2009-04-29 13:17:21 +020042 /* UART2 */
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010043 PB28_PF_UART2_CTS,
44 PB29_PF_UART2_RTS,
45 PB30_PF_UART2_TXD,
46 PB31_PF_UART2_RXD,
Sascha Hauer5ae07da2009-04-29 13:17:21 +020047 /* I2C */
48 PA15_PF_I2C_SDA,
49 PA16_PF_I2C_SCL,
50 /* SPI */
51 PC13_PF_SPI1_SPI_RDY,
52 PC14_PF_SPI1_SCLK,
53 PC15_PF_SPI1_SS,
54 PC16_PF_SPI1_MISO,
55 PC17_PF_SPI1_MOSI,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010056};
57
Sascha Hauer5ae07da2009-04-29 13:17:21 +020058/*
59 * UARTs platform data
60 */
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010061
62static struct imxuart_platform_data uart_pdata[] = {
63 {
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010064 .flags = IMXUART_HAVE_RTSCTS,
65 }, {
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010066 .flags = IMXUART_HAVE_RTSCTS,
67 },
68};
69
70/*
71 * Physmap flash
72 */
73
74static struct physmap_flash_data mx1ads_flash_data = {
75 .width = 4, /* bankwidth in bytes */
76};
77
78static struct resource flash_resource = {
Uwe Kleine-König05a31852010-03-04 21:02:41 +010079 .start = MX1_CS0_PHYS,
80 .end = MX1_CS0_PHYS + SZ_32M - 1,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +010081 .flags = IORESOURCE_MEM,
82};
83
84static struct platform_device flash_device = {
85 .name = "physmap-flash",
86 .id = 0,
87 .resource = &flash_resource,
88 .num_resources = 1,
89};
90
91/*
Sascha Hauerb8b19b02009-01-28 14:06:20 +010092 * I2C
93 */
Sascha Hauerb8b19b02009-01-28 14:06:20 +010094static struct pcf857x_platform_data pcf857x_data[] = {
95 {
96 .gpio_base = 4 * 32,
97 }, {
98 .gpio_base = 4 * 32 + 16,
99 }
100};
101
Uwe Kleine-König6348e6b2010-06-16 15:26:07 +0200102static const struct imxi2c_platform_data mx1ads_i2c_data __initconst = {
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100103 .bitrate = 100000,
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100104};
105
106static struct i2c_board_info mx1ads_i2c_devices[] = {
107 {
Sascha Hauercf87a6e2009-07-20 08:18:47 +0200108 I2C_BOARD_INFO("pcf8575", 0x22),
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100109 .platform_data = &pcf857x_data[0],
110 }, {
Sascha Hauercf87a6e2009-07-20 08:18:47 +0200111 I2C_BOARD_INFO("pcf8575", 0x24),
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100112 .platform_data = &pcf857x_data[1],
113 },
114};
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100115
116/*
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100117 * Board init
118 */
119static void __init mx1ads_init(void)
120{
Sascha Hauer5ae07da2009-04-29 13:17:21 +0200121 mxc_gpio_setup_multiple_pins(mx1ads_pins,
122 ARRAY_SIZE(mx1ads_pins), "mx1ads");
123
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100124 /* UART */
Uwe Kleine-König3e876932010-06-10 18:02:25 +0200125 mxc_register_device(&imx1_uart_device0, &uart_pdata[0]);
126 mxc_register_device(&imx1_uart_device1, &uart_pdata[1]);
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100127
128 /* Physmap flash */
129 mxc_register_device(&flash_device, &mx1ads_flash_data);
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100130
131 /* I2C */
Sascha Hauerb8b19b02009-01-28 14:06:20 +0100132 i2c_register_board_info(0, mx1ads_i2c_devices,
133 ARRAY_SIZE(mx1ads_i2c_devices));
134
Uwe Kleine-König6348e6b2010-06-16 15:26:07 +0200135 imx1_add_i2c_imx(&mx1ads_i2c_data);
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100136}
137
138static void __init mx1ads_timer_init(void)
139{
Sascha Hauer30c730f2009-02-16 14:36:49 +0100140 mx1_clocks_init(32000);
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100141}
142
143struct sys_timer mx1ads_timer = {
144 .init = mx1ads_timer_init,
145};
146
147MACHINE_START(MX1ADS, "Freescale MX1ADS")
148 /* Maintainer: Sascha Hauer, Pengutronix */
Uwe Kleine-König05a31852010-03-04 21:02:41 +0100149 .phys_io = MX1_IO_BASE_ADDR,
150 .io_pg_offst = (MX1_IO_BASE_ADDR_VIRT >> 18) & 0xfffc,
Uwe Kleine-König34101232010-01-29 17:36:05 +0100151 .boot_params = MX1_PHYS_OFFSET + 0x100,
Sascha Hauer74fe030e2009-04-29 13:41:40 +0200152 .map_io = mx1_map_io,
Sascha Hauerc5aa0ad2009-05-25 17:36:19 +0200153 .init_irq = mx1_init_irq,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100154 .timer = &mx1ads_timer,
155 .init_machine = mx1ads_init,
156MACHINE_END
157
158MACHINE_START(MXLADS, "Freescale MXLADS")
Uwe Kleine-König05a31852010-03-04 21:02:41 +0100159 .phys_io = MX1_IO_BASE_ADDR,
160 .io_pg_offst = (MX1_IO_BASE_ADDR_VIRT >> 18) & 0xfffc,
Uwe Kleine-König34101232010-01-29 17:36:05 +0100161 .boot_params = MX1_PHYS_OFFSET + 0x100,
Sascha Hauercd4a05f2009-04-02 22:32:10 +0200162 .map_io = mx1_map_io,
Sascha Hauerc5aa0ad2009-05-25 17:36:19 +0200163 .init_irq = mx1_init_irq,
Paulius Zaleckascfca8b52008-11-14 11:01:38 +0100164 .timer = &mx1ads_timer,
165 .init_machine = mx1ads_init,
166MACHINE_END