]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/arm/mach-mx3/mx31lilly.c
imx/mach-mx2: use constants namespaced by the corresponding SOC (easy part)
[net-next-2.6.git] / arch / arm / mach-mx3 / mx31lilly.c
CommitLineData
65b1aa13
DM
1/*
2 * LILLY-1131 module support
3 *
4 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
5 *
6 * based on code for other MX31 boards,
7 *
8 * Copyright 2005-2007 Freescale Semiconductor
9 * Copyright (c) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
10 * Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26
27#include <linux/types.h>
28#include <linux/init.h>
29#include <linux/clk.h>
cbaa6ca1
DM
30#include <linux/platform_device.h>
31#include <linux/interrupt.h>
32#include <linux/smsc911x.h>
38160e0b 33#include <linux/mtd/physmap.h>
2cc32683
DM
34#include <linux/spi/spi.h>
35#include <linux/mfd/mc13783.h>
65b1aa13
DM
36
37#include <asm/mach-types.h>
38#include <asm/mach/arch.h>
39#include <asm/mach/time.h>
40#include <asm/mach/map.h>
41
42#include <mach/hardware.h>
43#include <mach/common.h>
44#include <mach/iomux-mx3.h>
45#include <mach/board-mx31lilly.h>
3ea2e1a4 46#include <mach/spi.h>
65b1aa13
DM
47
48#include "devices.h"
49
50/*
51 * This file contains module-specific initialization routines for LILLY-1131.
52 * Initialization of peripherals found on the baseboard is implemented in the
53 * appropriate baseboard support code.
54 */
55
cbaa6ca1
DM
56/* SMSC ethernet support */
57
58static struct resource smsc91x_resources[] = {
59 {
60 .start = CS4_BASE_ADDR,
61 .end = CS4_BASE_ADDR + 0xffff,
62 .flags = IORESOURCE_MEM,
63 },
64 {
65 .start = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0),
66 .end = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0),
67 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
68 }
69};
70
71static struct smsc911x_platform_config smsc911x_config = {
72 .phy_interface = PHY_INTERFACE_MODE_MII,
73 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
74 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
75 .flags = SMSC911X_USE_32BIT |
76 SMSC911X_SAVE_MAC_ADDRESS |
77 SMSC911X_FORCE_INTERNAL_PHY,
78};
79
80static struct platform_device smsc91x_device = {
81 .name = "smsc911x",
82 .id = -1,
83 .num_resources = ARRAY_SIZE(smsc91x_resources),
84 .resource = smsc91x_resources,
85 .dev = {
86 .platform_data = &smsc911x_config,
87 }
88};
89
38160e0b
DM
90/* NOR flash */
91static struct physmap_flash_data nor_flash_data = {
92 .width = 2,
93};
94
95static struct resource nor_flash_resource = {
96 .start = 0xa0000000,
97 .end = 0xa1ffffff,
98 .flags = IORESOURCE_MEM,
99};
100
101static struct platform_device physmap_flash_device = {
102 .name = "physmap-flash",
103 .id = 0,
104 .dev = {
105 .platform_data = &nor_flash_data,
106 },
107 .resource = &nor_flash_resource,
108 .num_resources = 1,
109};
110
cbaa6ca1
DM
111static struct platform_device *devices[] __initdata = {
112 &smsc91x_device,
38160e0b 113 &physmap_flash_device,
cbaa6ca1
DM
114};
115
2cc32683
DM
116/* SPI */
117
3ea2e1a4
DM
118static int spi_internal_chipselect[] = {
119 MXC_SPI_CS(0),
120 MXC_SPI_CS(1),
121 MXC_SPI_CS(2),
122};
123
124static struct spi_imx_master spi0_pdata = {
125 .chipselect = spi_internal_chipselect,
126 .num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
127};
128
129static struct spi_imx_master spi1_pdata = {
130 .chipselect = spi_internal_chipselect,
131 .num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
132};
133
2cc32683
DM
134static struct mc13783_platform_data mc13783_pdata __initdata = {
135 .flags = MC13783_USE_RTC | MC13783_USE_TOUCHSCREEN,
136};
137
138static struct spi_board_info mc13783_dev __initdata = {
139 .modalias = "mc13783",
140 .max_speed_hz = 1000000,
141 .bus_num = 1,
142 .chip_select = 0,
143 .platform_data = &mc13783_pdata,
144};
145
65b1aa13
DM
146static int mx31lilly_baseboard;
147core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444);
148
149static void __init mx31lilly_board_init(void)
150{
151 switch (mx31lilly_baseboard) {
152 case MX31LILLY_NOBOARD:
153 break;
1bc34f79
DM
154 case MX31LILLY_DB:
155 mx31lilly_db_init();
156 break;
65b1aa13
DM
157 default:
158 printk(KERN_ERR "Illegal mx31lilly_baseboard type %d\n",
159 mx31lilly_baseboard);
160 }
cbaa6ca1
DM
161
162 mxc_iomux_alloc_pin(MX31_PIN_CS4__CS4, "Ethernet CS");
163
3ea2e1a4
DM
164 /* SPI */
165 mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SCLK__SCLK, "SPI1_CLK");
166 mxc_iomux_alloc_pin(MX31_PIN_CSPI1_MOSI__MOSI, "SPI1_TX");
167 mxc_iomux_alloc_pin(MX31_PIN_CSPI1_MISO__MISO, "SPI1_RX");
168 mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SPI_RDY__SPI_RDY, "SPI1_RDY");
169 mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS0__SS0, "SPI1_SS0");
170 mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS1__SS1, "SPI1_SS1");
171 mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS2__SS2, "SPI1_SS2");
172
173 mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SCLK__SCLK, "SPI2_CLK");
174 mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MOSI__MOSI, "SPI2_TX");
175 mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MISO__MISO, "SPI2_RX");
176 mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SPI_RDY__SPI_RDY, "SPI2_RDY");
177 mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS0__SS0, "SPI2_SS0");
178 mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS1__SS1, "SPI2_SS1");
179 mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS2__SS2, "SPI2_SS2");
180
181 mxc_register_device(&mxc_spi_device0, &spi0_pdata);
182 mxc_register_device(&mxc_spi_device1, &spi1_pdata);
2cc32683 183 spi_register_board_info(&mc13783_dev, 1);
3ea2e1a4 184
cbaa6ca1 185 platform_add_devices(devices, ARRAY_SIZE(devices));
65b1aa13
DM
186}
187
188static void __init mx31lilly_timer_init(void)
189{
190 mx31_clocks_init(26000000);
191}
192
193static struct sys_timer mx31lilly_timer = {
194 .init = mx31lilly_timer_init,
195};
196
197MACHINE_START(LILLY1131, "INCO startec LILLY-1131")
198 .phys_io = AIPS1_BASE_ADDR,
199 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
200 .boot_params = PHYS_OFFSET + 0x100,
201 .map_io = mx31_map_io,
c5aa0ad0 202 .init_irq = mx31_init_irq,
65b1aa13
DM
203 .init_machine = mx31lilly_board_init,
204 .timer = &mx31lilly_timer,
205MACHINE_END
206