2 * LILLY-1131 module support
4 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
6 * based on code for other MX31 boards,
8 * Copyright 2005-2007 Freescale Semiconductor
9 * Copyright (c) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
10 * Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
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.
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.
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
27 #include <linux/types.h>
28 #include <linux/init.h>
29 #include <linux/clk.h>
30 #include <linux/platform_device.h>
31 #include <linux/interrupt.h>
32 #include <linux/smsc911x.h>
33 #include <linux/mtd/physmap.h>
34 #include <linux/spi/spi.h>
35 #include <linux/mfd/mc13783.h>
37 #include <asm/mach-types.h>
38 #include <asm/mach/arch.h>
39 #include <asm/mach/time.h>
40 #include <asm/mach/map.h>
42 #include <mach/hardware.h>
43 #include <mach/common.h>
44 #include <mach/iomux-mx3.h>
45 #include <mach/board-mx31lilly.h>
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.
56 /* SMSC ethernet support */
58 static struct resource smsc91x_resources
[] = {
60 .start
= CS4_BASE_ADDR
,
61 .end
= CS4_BASE_ADDR
+ 0xffff,
62 .flags
= IORESOURCE_MEM
,
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
,
71 static 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
,
80 static struct platform_device smsc91x_device
= {
83 .num_resources
= ARRAY_SIZE(smsc91x_resources
),
84 .resource
= smsc91x_resources
,
86 .platform_data
= &smsc911x_config
,
91 static struct physmap_flash_data nor_flash_data
= {
95 static struct resource nor_flash_resource
= {
98 .flags
= IORESOURCE_MEM
,
101 static struct platform_device physmap_flash_device
= {
102 .name
= "physmap-flash",
105 .platform_data
= &nor_flash_data
,
107 .resource
= &nor_flash_resource
,
111 static struct platform_device
*devices
[] __initdata
= {
113 &physmap_flash_device
,
118 static int spi_internal_chipselect
[] = {
124 static struct spi_imx_master spi0_pdata
= {
125 .chipselect
= spi_internal_chipselect
,
126 .num_chipselect
= ARRAY_SIZE(spi_internal_chipselect
),
129 static struct spi_imx_master spi1_pdata
= {
130 .chipselect
= spi_internal_chipselect
,
131 .num_chipselect
= ARRAY_SIZE(spi_internal_chipselect
),
134 static struct mc13783_platform_data mc13783_pdata __initdata
= {
135 .flags
= MC13783_USE_RTC
| MC13783_USE_TOUCHSCREEN
,
138 static struct spi_board_info mc13783_dev __initdata
= {
139 .modalias
= "mc13783",
140 .max_speed_hz
= 1000000,
143 .platform_data
= &mc13783_pdata
,
146 static int mx31lilly_baseboard
;
147 core_param(mx31lilly_baseboard
, mx31lilly_baseboard
, int, 0444);
149 static void __init
mx31lilly_board_init(void)
151 switch (mx31lilly_baseboard
) {
152 case MX31LILLY_NOBOARD
:
158 printk(KERN_ERR
"Illegal mx31lilly_baseboard type %d\n",
159 mx31lilly_baseboard
);
162 mxc_iomux_alloc_pin(MX31_PIN_CS4__CS4
, "Ethernet CS");
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");
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");
181 mxc_register_device(&mxc_spi_device0
, &spi0_pdata
);
182 mxc_register_device(&mxc_spi_device1
, &spi1_pdata
);
183 spi_register_board_info(&mc13783_dev
, 1);
185 platform_add_devices(devices
, ARRAY_SIZE(devices
));
188 static void __init
mx31lilly_timer_init(void)
190 mx31_clocks_init(26000000);
193 static struct sys_timer mx31lilly_timer
= {
194 .init
= mx31lilly_timer_init
,
197 MACHINE_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
,
202 .init_irq
= mx31_init_irq
,
203 .init_machine
= mx31lilly_board_init
,
204 .timer
= &mx31lilly_timer
,