]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - arch/arm/mach-mx3/pcm037.c
[ARM] MX3: add NAND support
[mirror_ubuntu-zesty-kernel.git] / arch / arm / mach-mx3 / pcm037.c
CommitLineData
ce8ffef0
SH
1/*
2 * Copyright (C) 2008 Sascha Hauer, Pengutronix
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
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.
13 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#include <linux/types.h>
20#include <linux/init.h>
21
22#include <linux/platform_device.h>
23#include <linux/mtd/physmap.h>
3dad21a9 24#include <linux/mtd/plat-ram.h>
ce8ffef0 25#include <linux/memory.h>
ba54b958
GL
26#include <linux/gpio.h>
27#include <linux/smc911x.h>
28#include <linux/interrupt.h>
ce8ffef0 29
a09e64fb 30#include <mach/hardware.h>
ce8ffef0
SH
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/time.h>
34#include <asm/mach/map.h>
a09e64fb
RK
35#include <mach/common.h>
36#include <mach/imx-uart.h>
37#include <mach/iomux-mx3.h>
38#include <mach/board-pcm037.h>
ce8ffef0 39
5cf09421
SH
40#include "devices.h"
41
ce8ffef0
SH
42static struct physmap_flash_data pcm037_flash_data = {
43 .width = 2,
44};
45
46static struct resource pcm037_flash_resource = {
47 .start = 0xa0000000,
48 .end = 0xa1ffffff,
49 .flags = IORESOURCE_MEM,
50};
51
52static struct platform_device pcm037_flash = {
53 .name = "physmap-flash",
54 .id = 0,
55 .dev = {
56 .platform_data = &pcm037_flash_data,
57 },
58 .resource = &pcm037_flash_resource,
59 .num_resources = 1,
60};
61
62static struct imxuart_platform_data uart_pdata = {
a9b06233 63 .flags = IMXUART_HAVE_RTSCTS,
ce8ffef0
SH
64};
65
ba54b958
GL
66static struct resource smc911x_resources[] = {
67 [0] = {
68 .start = CS1_BASE_ADDR + 0x300,
69 .end = CS1_BASE_ADDR + 0x300 + SZ_64K - 1,
70 .flags = IORESOURCE_MEM,
71 },
72 [1] = {
73 .start = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
74 .end = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
75 .flags = IORESOURCE_IRQ,
76 },
77};
78
79static struct smc911x_platdata smc911x_info = {
80 .flags = SMC911X_USE_32BIT,
81 .irq_flags = IRQF_SHARED | IRQF_TRIGGER_LOW,
82};
83
84static struct platform_device pcm037_eth = {
85 .name = "smc911x",
86 .id = -1,
87 .num_resources = ARRAY_SIZE(smc911x_resources),
88 .resource = smc911x_resources,
89 .dev = {
90 .platform_data = &smc911x_info,
91 },
92};
93
3dad21a9
SH
94static struct platdata_mtd_ram pcm038_sram_data = {
95 .bankwidth = 2,
96};
97
98static struct resource pcm038_sram_resource = {
99 .start = CS4_BASE_ADDR,
100 .end = CS4_BASE_ADDR + 512 * 1024 - 1,
101 .flags = IORESOURCE_MEM,
102};
103
104static struct platform_device pcm037_sram_device = {
105 .name = "mtd-ram",
106 .id = 0,
107 .dev = {
108 .platform_data = &pcm038_sram_data,
109 },
110 .num_resources = 1,
111 .resource = &pcm038_sram_resource,
112};
113
ce8ffef0
SH
114static struct platform_device *devices[] __initdata = {
115 &pcm037_flash,
ba54b958 116 &pcm037_eth,
3dad21a9 117 &pcm037_sram_device,
ce8ffef0
SH
118};
119
120/*
121 * Board specific initialization.
122 */
123static void __init mxc_board_init(void)
124{
125 platform_add_devices(devices, ARRAY_SIZE(devices));
126
127 mxc_iomux_mode(MX31_PIN_CTS1__CTS1);
128 mxc_iomux_mode(MX31_PIN_RTS1__RTS1);
129 mxc_iomux_mode(MX31_PIN_TXD1__TXD1);
130 mxc_iomux_mode(MX31_PIN_RXD1__RXD1);
131
5cf09421 132 mxc_register_device(&mxc_uart_device0, &uart_pdata);
ce8ffef0
SH
133
134 mxc_iomux_mode(MX31_PIN_CSPI3_MOSI__RXD3);
135 mxc_iomux_mode(MX31_PIN_CSPI3_MISO__TXD3);
136
5cf09421 137 mxc_register_device(&mxc_uart_device2, &uart_pdata);
d517cab1
SH
138
139 mxc_iomux_mode(MX31_PIN_BATT_LINE__OWIRE);
140 mxc_register_device(&mxc_w1_master_device, NULL);
ba54b958
GL
141
142 /* SMSC9215 IRQ pin */
143 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO));
144 if (!gpio_request(MX31_PIN_GPIO3_1, "pcm037-eth"))
145 gpio_direction_input(MX31_PIN_GPIO3_1);
ce8ffef0
SH
146}
147
148/*
149 * This structure defines static mappings for the pcm037 board.
150 */
151static struct map_desc pcm037_io_desc[] __initdata = {
152 {
153 .virtual = AIPS1_BASE_ADDR_VIRT,
154 .pfn = __phys_to_pfn(AIPS1_BASE_ADDR),
155 .length = AIPS1_SIZE,
6c1249e5 156 .type = MT_DEVICE_NONSHARED
ce8ffef0
SH
157 }, {
158 .virtual = AIPS2_BASE_ADDR_VIRT,
159 .pfn = __phys_to_pfn(AIPS2_BASE_ADDR),
160 .length = AIPS2_SIZE,
6c1249e5 161 .type = MT_DEVICE_NONSHARED
ce8ffef0
SH
162 },
163};
164
165/*
166 * Set up static virtual mappings.
167 */
168void __init pcm037_map_io(void)
169{
170 mxc_map_io();
171 iotable_init(pcm037_io_desc, ARRAY_SIZE(pcm037_io_desc));
172}
173
174static void __init pcm037_timer_init(void)
175{
176 mxc_clocks_init(26000000);
177 mxc_timer_init("ipg_clk.0");
178}
179
180struct sys_timer pcm037_timer = {
181 .init = pcm037_timer_init,
182};
183
184MACHINE_START(PCM037, "Phytec Phycore pcm037")
185 /* Maintainer: Pengutronix */
186 .phys_io = AIPS1_BASE_ADDR,
187 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
188 .boot_params = PHYS_OFFSET + 0x100,
189 .map_io = pcm037_map_io,
190 .init_irq = mxc_init_irq,
191 .init_machine = mxc_board_init,
192 .timer = &pcm037_timer,
193MACHINE_END
194