2 * Copyright 2007 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
3 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 #include <linux/i2c.h>
21 #include <linux/i2c/at24.h>
23 #include <linux/mtd/plat-ram.h>
24 #include <linux/mtd/physmap.h>
25 #include <linux/platform_device.h>
27 #include <asm/mach-types.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/time.h>
31 #include <mach/board-pcm038.h>
32 #include <mach/common.h>
33 #include <mach/hardware.h>
35 #include <mach/iomux.h>
36 #include <mach/imx-uart.h>
37 #include <mach/mxc_nand.h>
41 static int pcm038_pins[] = {
99 * Phytec's PCM038 comes with 2MiB battery buffered SRAM,
103 static struct platdata_mtd_ram pcm038_sram_data = {
107 static struct resource pcm038_sram_resource = {
108 .start = CS1_BASE_ADDR,
109 .end = CS1_BASE_ADDR + 512 * 1024 - 1,
110 .flags = IORESOURCE_MEM,
113 static struct platform_device pcm038_sram_mtd_device = {
117 .platform_data = &pcm038_sram_data,
120 .resource = &pcm038_sram_resource,
124 * Phytec's phyCORE-i.MX27 comes with 32MiB flash,
127 static struct physmap_flash_data pcm038_flash_data = {
131 static struct resource pcm038_flash_resource = {
134 .flags = IORESOURCE_MEM,
137 static struct platform_device pcm038_nor_mtd_device = {
138 .name = "physmap-flash",
141 .platform_data = &pcm038_flash_data,
144 .resource = &pcm038_flash_resource,
147 static struct imxuart_platform_data uart_pdata[] = {
149 .flags = IMXUART_HAVE_RTSCTS,
151 .flags = IMXUART_HAVE_RTSCTS,
153 .flags = IMXUART_HAVE_RTSCTS,
157 static struct mxc_nand_platform_data pcm038_nand_board_info = {
162 static struct platform_device *platform_devices[] __initdata = {
163 &pcm038_nor_mtd_device,
164 &mxc_w1_master_device,
166 &pcm038_sram_mtd_device,
169 /* On pcm038 there's a sram attached to CS1, we enable the chipselect here and
170 * setup other stuffs to access the sram. */
171 static void __init pcm038_init_sram(void)
173 __raw_writel(0x0000d843, CSCR_U(1));
174 __raw_writel(0x22252521, CSCR_L(1));
175 __raw_writel(0x22220a00, CSCR_A(1));
178 static struct imxi2c_platform_data pcm038_i2c_1_data = {
182 static struct at24_platform_data board_eeprom = {
185 .flags = AT24_FLAG_ADDR16,
188 static struct i2c_board_info pcm038_i2c_devices[] = {
190 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
191 .platform_data = &board_eeprom,
194 I2C_BOARD_INFO("rtc-pcf8563", 0x51),
198 I2C_BOARD_INFO("lm75", 0x4a),
203 static void __init pcm038_init(void)
205 mxc_gpio_setup_multiple_pins(pcm038_pins, ARRAY_SIZE(pcm038_pins),
210 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
211 mxc_register_device(&mxc_uart_device1, &uart_pdata[1]);
212 mxc_register_device(&mxc_uart_device2, &uart_pdata[2]);
214 mxc_gpio_mode(PE16_AF_OWIRE);
215 mxc_register_device(&mxc_nand_device, &pcm038_nand_board_info);
217 /* only the i2c master 1 is used on this CPU card */
218 i2c_register_board_info(1, pcm038_i2c_devices,
219 ARRAY_SIZE(pcm038_i2c_devices));
221 mxc_register_device(&mxc_i2c_device1, &pcm038_i2c_1_data);
223 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
225 #ifdef CONFIG_MACH_PCM970_BASEBOARD
226 pcm970_baseboard_init();
230 static void __init pcm038_timer_init(void)
232 mx27_clocks_init(26000000);
235 static struct sys_timer pcm038_timer = {
236 .init = pcm038_timer_init,
239 MACHINE_START(PCM038, "phyCORE-i.MX27")
240 .phys_io = AIPI_BASE_ADDR,
241 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
242 .boot_params = PHYS_OFFSET + 0x100,
243 .map_io = mx27_map_io,
244 .init_irq = mxc_init_irq,
245 .init_machine = pcm038_init,
246 .timer = &pcm038_timer,