blob: e709229131643528f6476475f180ac5bbadf466f [file] [log] [blame]
Daniel Mack9a4cd7a2008-07-05 10:02:53 +02001/*
2 * Copyright (C) 2000 Deep Blue Solutions Ltd
3 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
4 * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/types.h>
22#include <linux/init.h>
23#include <linux/kernel.h>
24#include <linux/memory.h>
Magnus Lilja32117052009-04-14 22:00:07 +020025#include <linux/platform_device.h>
26#include <linux/gpio.h>
27#include <linux/smsc911x.h>
Daniel Mack9a4cd7a2008-07-05 10:02:53 +020028
Russell Kinga09e64f2008-08-05 16:14:15 +010029#include <mach/hardware.h>
Daniel Mack9a4cd7a2008-07-05 10:02:53 +020030#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
Juergen Beisert9e8a30d2008-07-05 10:02:53 +020032#include <asm/mach/time.h>
Daniel Mack9a4cd7a2008-07-05 10:02:53 +020033#include <asm/mach/map.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010034#include <mach/common.h>
Daniel Mack9a4cd7a2008-07-05 10:02:53 +020035#include <asm/page.h>
36#include <asm/setup.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010037#include <mach/board-mx31lite.h>
Magnus Liljaa854b8a2009-04-14 22:00:03 +020038#include <mach/imx-uart.h>
39#include <mach/iomux-mx3.h>
Magnus Lilja32117052009-04-14 22:00:07 +020040#include <mach/irqs.h>
Magnus Liljaa854b8a2009-04-14 22:00:03 +020041#include "devices.h"
Daniel Mack9a4cd7a2008-07-05 10:02:53 +020042
43/*
44 * This file contains the board-specific initialization routines.
45 */
46
Magnus Liljaa854b8a2009-04-14 22:00:03 +020047static unsigned int mx31lite_pins[] = {
48 /* UART1 */
49 MX31_PIN_CTS1__CTS1,
50 MX31_PIN_RTS1__RTS1,
51 MX31_PIN_TXD1__TXD1,
52 MX31_PIN_RXD1__RXD1,
Magnus Lilja32117052009-04-14 22:00:07 +020053 /* LAN9117 IRQ pin */
54 IOMUX_MODE(MX31_PIN_SFS6, IOMUX_CONFIG_GPIO),
Magnus Liljaa854b8a2009-04-14 22:00:03 +020055};
56
57static struct imxuart_platform_data uart_pdata = {
58 .flags = IMXUART_HAVE_RTSCTS,
59};
60
Magnus Lilja32117052009-04-14 22:00:07 +020061static struct smsc911x_platform_config smsc911x_config = {
62 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
63 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
64 .flags = SMSC911X_USE_16BIT,
65};
66
67static struct resource smsc911x_resources[] = {
68 [0] = {
69 .start = CS4_BASE_ADDR,
70 .end = CS4_BASE_ADDR + 0x100,
71 .flags = IORESOURCE_MEM,
72 },
73 [1] = {
74 .start = IOMUX_TO_IRQ(MX31_PIN_SFS6),
75 .end = IOMUX_TO_IRQ(MX31_PIN_SFS6),
76 .flags = IORESOURCE_IRQ,
77 },
78};
79
80static struct platform_device smsc911x_device = {
81 .name = "smsc911x",
82 .id = -1,
83 .num_resources = ARRAY_SIZE(smsc911x_resources),
84 .resource = smsc911x_resources,
85 .dev = {
86 .platform_data = &smsc911x_config,
87 },
88};
89
Daniel Mack9a4cd7a2008-07-05 10:02:53 +020090/*
91 * This structure defines the MX31 memory map.
92 */
93static struct map_desc mx31lite_io_desc[] __initdata = {
94 {
Daniel Mack9a4cd7a2008-07-05 10:02:53 +020095 .virtual = SPBA0_BASE_ADDR_VIRT,
96 .pfn = __phys_to_pfn(SPBA0_BASE_ADDR),
97 .length = SPBA0_SIZE,
Russell King9b727ab2008-09-07 12:45:01 +010098 .type = MT_DEVICE_NONSHARED
Daniel Mack9a4cd7a2008-07-05 10:02:53 +020099 }, {
Daniel Mack9a4cd7a2008-07-05 10:02:53 +0200100 .virtual = CS4_BASE_ADDR_VIRT,
101 .pfn = __phys_to_pfn(CS4_BASE_ADDR),
102 .length = CS4_SIZE,
103 .type = MT_DEVICE
104 }
105};
106
107/*
108 * Set up static virtual mappings.
109 */
110void __init mx31lite_map_io(void)
111{
Sascha Hauercd4a05f2009-04-02 22:32:10 +0200112 mx31_map_io();
Daniel Mack9a4cd7a2008-07-05 10:02:53 +0200113 iotable_init(mx31lite_io_desc, ARRAY_SIZE(mx31lite_io_desc));
114}
115
116/*
117 * Board specific initialization.
118 */
119static void __init mxc_board_init(void)
120{
Sascha Hauer4f163eb2009-05-06 12:55:50 +0200121 int ret;
122
Magnus Liljaa854b8a2009-04-14 22:00:03 +0200123 mxc_iomux_setup_multiple_pins(mx31lite_pins, ARRAY_SIZE(mx31lite_pins),
124 "mx31lite");
125
126 mxc_register_device(&mxc_uart_device0, &uart_pdata);
Magnus Lilja32117052009-04-14 22:00:07 +0200127
128 /* SMSC9117 IRQ pin */
Sascha Hauer4f163eb2009-05-06 12:55:50 +0200129 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq");
130 if (ret)
131 pr_warning("could not get LAN irq gpio\n");
132 else {
133 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_SFS6));
134 platform_device_register(&smsc911x_device);
135 }
Daniel Mack9a4cd7a2008-07-05 10:02:53 +0200136}
137
Juergen Beisert9e8a30d2008-07-05 10:02:53 +0200138static void __init mx31lite_timer_init(void)
139{
Sascha Hauer30c730f2009-02-16 14:36:49 +0100140 mx31_clocks_init(26000000);
Juergen Beisert9e8a30d2008-07-05 10:02:53 +0200141}
142
143struct sys_timer mx31lite_timer = {
144 .init = mx31lite_timer_init,
145};
146
Daniel Mack9a4cd7a2008-07-05 10:02:53 +0200147/*
148 * The following uses standard kernel macros defined in arch.h in order to
149 * initialize __mach_desc_MX31LITE data structure.
150 */
151
152MACHINE_START(MX31LITE, "LogicPD MX31 LITEKIT")
153 /* Maintainer: Freescale Semiconductor, Inc. */
154 .phys_io = AIPS1_BASE_ADDR,
155 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
156 .boot_params = PHYS_OFFSET + 0x100,
157 .map_io = mx31lite_map_io,
158 .init_irq = mxc_init_irq,
159 .init_machine = mxc_board_init,
Juergen Beisert9e8a30d2008-07-05 10:02:53 +0200160 .timer = &mx31lite_timer,
Daniel Mack9a4cd7a2008-07-05 10:02:53 +0200161MACHINE_END