blob: e5339341c0ba0125e411d74cecd3f1d3ec941a31 [file] [log] [blame]
Daniel Mack65b1aa12009-05-20 19:54:33 +02001/*
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>
Daniel Mackcbaa6ca2009-05-20 19:54:35 +020030#include <linux/platform_device.h>
31#include <linux/interrupt.h>
32#include <linux/smsc911x.h>
Daniel Mack65b1aa12009-05-20 19:54:33 +020033
34#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36#include <asm/mach/time.h>
37#include <asm/mach/map.h>
38
39#include <mach/hardware.h>
40#include <mach/common.h>
41#include <mach/iomux-mx3.h>
42#include <mach/board-mx31lilly.h>
43
44#include "devices.h"
45
46/*
47 * This file contains module-specific initialization routines for LILLY-1131.
48 * Initialization of peripherals found on the baseboard is implemented in the
49 * appropriate baseboard support code.
50 */
51
Daniel Mackcbaa6ca2009-05-20 19:54:35 +020052/* SMSC ethernet support */
53
54static struct resource smsc91x_resources[] = {
55 {
56 .start = CS4_BASE_ADDR,
57 .end = CS4_BASE_ADDR + 0xffff,
58 .flags = IORESOURCE_MEM,
59 },
60 {
61 .start = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0),
62 .end = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0),
63 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
64 }
65};
66
67static struct smsc911x_platform_config smsc911x_config = {
68 .phy_interface = PHY_INTERFACE_MODE_MII,
69 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
70 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
71 .flags = SMSC911X_USE_32BIT |
72 SMSC911X_SAVE_MAC_ADDRESS |
73 SMSC911X_FORCE_INTERNAL_PHY,
74};
75
76static struct platform_device smsc91x_device = {
77 .name = "smsc911x",
78 .id = -1,
79 .num_resources = ARRAY_SIZE(smsc91x_resources),
80 .resource = smsc91x_resources,
81 .dev = {
82 .platform_data = &smsc911x_config,
83 }
84};
85
86static struct platform_device *devices[] __initdata = {
87 &smsc91x_device,
88};
89
Daniel Mack65b1aa12009-05-20 19:54:33 +020090static int mx31lilly_baseboard;
91core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444);
92
93static void __init mx31lilly_board_init(void)
94{
95 switch (mx31lilly_baseboard) {
96 case MX31LILLY_NOBOARD:
97 break;
Daniel Mack1bc34f72009-05-20 19:54:34 +020098 case MX31LILLY_DB:
99 mx31lilly_db_init();
100 break;
Daniel Mack65b1aa12009-05-20 19:54:33 +0200101 default:
102 printk(KERN_ERR "Illegal mx31lilly_baseboard type %d\n",
103 mx31lilly_baseboard);
104 }
Daniel Mackcbaa6ca2009-05-20 19:54:35 +0200105
106 mxc_iomux_alloc_pin(MX31_PIN_CS4__CS4, "Ethernet CS");
107
108 platform_add_devices(devices, ARRAY_SIZE(devices));
Daniel Mack65b1aa12009-05-20 19:54:33 +0200109}
110
111static void __init mx31lilly_timer_init(void)
112{
113 mx31_clocks_init(26000000);
114}
115
116static struct sys_timer mx31lilly_timer = {
117 .init = mx31lilly_timer_init,
118};
119
120MACHINE_START(LILLY1131, "INCO startec LILLY-1131")
121 .phys_io = AIPS1_BASE_ADDR,
122 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
123 .boot_params = PHYS_OFFSET + 0x100,
124 .map_io = mx31_map_io,
125 .init_irq = mxc_init_irq,
126 .init_machine = mx31lilly_board_init,
127 .timer = &mx31lilly_timer,
128MACHINE_END
129