blob: bf131457c0e51f713044db84fdcd71d514ed4266 [file] [log] [blame]
Juergen Beisert80eedae2008-07-05 10:03:00 +02001/*
2 * Copyright (C) 2000 Deep Blue Solutions Ltd
3 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
4 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/platform_device.h>
22#include <linux/mtd/mtd.h>
23#include <linux/mtd/map.h>
24#include <linux/mtd/partitions.h>
25#include <linux/mtd/physmap.h>
Vladimir Barinovc9812142009-04-29 04:00:50 +040026#include <linux/i2c.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010027#include <mach/common.h>
28#include <mach/hardware.h>
Juergen Beisert80eedae2008-07-05 10:03:00 +020029#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31#include <asm/mach/time.h>
32#include <asm/mach/map.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010033#include <mach/gpio.h>
34#include <mach/imx-uart.h>
Holger Schurigccfe30a2009-01-29 10:07:50 +010035#include <mach/iomux.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010036#include <mach/board-mx27ads.h>
Vladimir Barinov8d4fd252009-04-29 04:00:49 +040037#include <mach/mxc_nand.h>
Vladimir Barinovc9812142009-04-29 04:00:50 +040038#include <mach/i2c.h>
Juergen Beisert80eedae2008-07-05 10:03:00 +020039
Sascha Hauer7e905342008-09-09 10:19:41 +020040#include "devices.h"
41
Vladimir Barinovc1a6f122009-04-29 04:00:48 +040042static unsigned int mx27ads_pins[] = {
43 /* UART0 */
44 PE12_PF_UART1_TXD,
45 PE13_PF_UART1_RXD,
46 PE14_PF_UART1_CTS,
47 PE15_PF_UART1_RTS,
48 /* UART1 */
49 PE3_PF_UART2_CTS,
50 PE4_PF_UART2_RTS,
51 PE6_PF_UART2_TXD,
52 PE7_PF_UART2_RXD,
53 /* UART2 */
54 PE8_PF_UART3_TXD,
55 PE9_PF_UART3_RXD,
56 PE10_PF_UART3_CTS,
57 PE11_PF_UART3_RTS,
58 /* UART3 */
59 PB26_AF_UART4_RTS,
60 PB28_AF_UART4_TXD,
61 PB29_AF_UART4_CTS,
62 PB31_AF_UART4_RXD,
63 /* UART4 */
64 PB18_AF_UART5_TXD,
65 PB19_AF_UART5_RXD,
66 PB20_AF_UART5_CTS,
67 PB21_AF_UART5_RTS,
68 /* UART5 */
69 PB10_AF_UART6_TXD,
70 PB12_AF_UART6_CTS,
71 PB11_AF_UART6_RXD,
72 PB13_AF_UART6_RTS,
73 /* FEC */
74 PD0_AIN_FEC_TXD0,
75 PD1_AIN_FEC_TXD1,
76 PD2_AIN_FEC_TXD2,
77 PD3_AIN_FEC_TXD3,
78 PD4_AOUT_FEC_RX_ER,
79 PD5_AOUT_FEC_RXD1,
80 PD6_AOUT_FEC_RXD2,
81 PD7_AOUT_FEC_RXD3,
82 PD8_AF_FEC_MDIO,
83 PD9_AIN_FEC_MDC,
84 PD10_AOUT_FEC_CRS,
85 PD11_AOUT_FEC_TX_CLK,
86 PD12_AOUT_FEC_RXD0,
87 PD13_AOUT_FEC_RX_DV,
88 PD14_AOUT_FEC_RX_CLK,
89 PD15_AOUT_FEC_COL,
90 PD16_AIN_FEC_TX_ER,
91 PF23_AIN_FEC_TX_EN,
Vladimir Barinovc9812142009-04-29 04:00:50 +040092 /* I2C2 */
93 PC5_PF_I2C2_SDA,
94 PC6_PF_I2C2_SCL,
Vladimir Barinovc1a6f122009-04-29 04:00:48 +040095};
96
Vladimir Barinov8d4fd252009-04-29 04:00:49 +040097static struct mxc_nand_platform_data mx27ads_nand_board_info = {
98 .width = 1,
99 .hw_ecc = 1,
100};
101
Juergen Beisert80eedae2008-07-05 10:03:00 +0200102/* ADS's NOR flash */
103static struct physmap_flash_data mx27ads_flash_data = {
104 .width = 2,
105};
106
107static struct resource mx27ads_flash_resource = {
108 .start = 0xc0000000,
109 .end = 0xc0000000 + 0x02000000 - 1,
110 .flags = IORESOURCE_MEM,
111
112};
113
114static struct platform_device mx27ads_nor_mtd_device = {
115 .name = "physmap-flash",
116 .id = 0,
117 .dev = {
118 .platform_data = &mx27ads_flash_data,
119 },
120 .num_resources = 1,
121 .resource = &mx27ads_flash_resource,
122};
123
Vladimir Barinovc9812142009-04-29 04:00:50 +0400124static struct imxi2c_platform_data mx27ads_i2c_data = {
125 .bitrate = 100000,
126};
127
128static struct i2c_board_info mx27ads_i2c_devices[] = {
129};
130
Juergen Beisert80eedae2008-07-05 10:03:00 +0200131static struct platform_device *platform_devices[] __initdata = {
132 &mx27ads_nor_mtd_device,
Sascha Hauer879fea12009-01-26 17:26:02 +0100133 &mxc_fec_device,
Juergen Beisert80eedae2008-07-05 10:03:00 +0200134};
135
Juergen Beisert80eedae2008-07-05 10:03:00 +0200136static struct imxuart_platform_data uart_pdata[] = {
137 {
Juergen Beisert80eedae2008-07-05 10:03:00 +0200138 .flags = IMXUART_HAVE_RTSCTS,
139 }, {
Juergen Beisert80eedae2008-07-05 10:03:00 +0200140 .flags = IMXUART_HAVE_RTSCTS,
141 }, {
Juergen Beisert80eedae2008-07-05 10:03:00 +0200142 .flags = IMXUART_HAVE_RTSCTS,
143 }, {
Juergen Beisert80eedae2008-07-05 10:03:00 +0200144 .flags = IMXUART_HAVE_RTSCTS,
145 }, {
Juergen Beisert80eedae2008-07-05 10:03:00 +0200146 .flags = IMXUART_HAVE_RTSCTS,
147 }, {
Juergen Beisert80eedae2008-07-05 10:03:00 +0200148 .flags = IMXUART_HAVE_RTSCTS,
149 },
150};
151
152static void __init mx27ads_board_init(void)
153{
Vladimir Barinovc1a6f122009-04-29 04:00:48 +0400154 mxc_gpio_setup_multiple_pins(mx27ads_pins, ARRAY_SIZE(mx27ads_pins),
155 "mx27ads");
Juergen Beisert80eedae2008-07-05 10:03:00 +0200156
Sascha Hauer7e905342008-09-09 10:19:41 +0200157 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
158 mxc_register_device(&mxc_uart_device1, &uart_pdata[1]);
159 mxc_register_device(&mxc_uart_device2, &uart_pdata[2]);
160 mxc_register_device(&mxc_uart_device3, &uart_pdata[3]);
161 mxc_register_device(&mxc_uart_device4, &uart_pdata[4]);
162 mxc_register_device(&mxc_uart_device5, &uart_pdata[5]);
Vladimir Barinov8d4fd252009-04-29 04:00:49 +0400163 mxc_register_device(&mxc_nand_device, &mx27ads_nand_board_info);
Juergen Beisert80eedae2008-07-05 10:03:00 +0200164
Vladimir Barinovc9812142009-04-29 04:00:50 +0400165 /* only the i2c master 1 is used on this CPU card */
166 i2c_register_board_info(1, mx27ads_i2c_devices,
167 ARRAY_SIZE(mx27ads_i2c_devices));
168 mxc_register_device(&mxc_i2c_device1, &mx27ads_i2c_data);
169
Juergen Beisert80eedae2008-07-05 10:03:00 +0200170 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
171}
172
173static void __init mx27ads_timer_init(void)
174{
175 unsigned long fref = 26000000;
176
177 if ((__raw_readw(PBC_VERSION_REG) & CKIH_27MHZ_BIT_SET) == 0)
178 fref = 27000000;
179
Sascha Hauer30c730f2009-02-16 14:36:49 +0100180 mx27_clocks_init(fref);
Juergen Beisert80eedae2008-07-05 10:03:00 +0200181}
182
Holger Schurig058b7a62009-01-26 16:34:51 +0100183static struct sys_timer mx27ads_timer = {
Juergen Beisert80eedae2008-07-05 10:03:00 +0200184 .init = mx27ads_timer_init,
185};
186
187static struct map_desc mx27ads_io_desc[] __initdata = {
188 {
189 .virtual = PBC_BASE_ADDRESS,
190 .pfn = __phys_to_pfn(CS4_BASE_ADDR),
191 .length = SZ_1M,
192 .type = MT_DEVICE,
193 },
194};
195
Holger Schurig058b7a62009-01-26 16:34:51 +0100196static void __init mx27ads_map_io(void)
Juergen Beisert80eedae2008-07-05 10:03:00 +0200197{
Sascha Hauercd4a05f2009-04-02 22:32:10 +0200198 mx27_map_io();
Juergen Beisert80eedae2008-07-05 10:03:00 +0200199 iotable_init(mx27ads_io_desc, ARRAY_SIZE(mx27ads_io_desc));
200}
201
202MACHINE_START(MX27ADS, "Freescale i.MX27ADS")
203 /* maintainer: Freescale Semiconductor, Inc. */
204 .phys_io = AIPI_BASE_ADDR,
205 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
206 .boot_params = PHYS_OFFSET + 0x100,
207 .map_io = mx27ads_map_io,
208 .init_irq = mxc_init_irq,
209 .init_machine = mx27ads_board_init,
210 .timer = &mx27ads_timer,
211MACHINE_END
212