blob: 5addbb7f711c63ea076027094b6aa023e1afab4e [file] [log] [blame]
Quinn Jensen52c543f2007-07-09 22:06:53 +01001/*
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/clk.h>
24#include <linux/serial_8250.h>
25
26#include <asm/hardware.h>
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/memory.h>
30#include <asm/mach/map.h>
31#include <asm/arch/common.h>
Sascha Hauer63dd1082008-07-05 10:02:43 +020032#include <asm/arch/board-mx31ads.h>
Quinn Jensen52c543f2007-07-09 22:06:53 +010033
34/*!
35 * @file mx31ads.c
36 *
37 * @brief This file contains the board-specific initialization routines.
38 *
39 * @ingroup System
40 */
41
42#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
43/*!
44 * The serial port definition structure.
45 */
46static struct plat_serial8250_port serial_platform_data[] = {
47 {
48 .membase = (void *)(PBC_BASE_ADDRESS + PBC_SC16C652_UARTA),
49 .mapbase = (unsigned long)(CS4_BASE_ADDR + PBC_SC16C652_UARTA),
50 .irq = EXPIO_INT_XUART_INTA,
51 .uartclk = 14745600,
52 .regshift = 0,
53 .iotype = UPIO_MEM,
54 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ,
55 }, {
56 .membase = (void *)(PBC_BASE_ADDRESS + PBC_SC16C652_UARTB),
57 .mapbase = (unsigned long)(CS4_BASE_ADDR + PBC_SC16C652_UARTB),
58 .irq = EXPIO_INT_XUART_INTB,
59 .uartclk = 14745600,
60 .regshift = 0,
61 .iotype = UPIO_MEM,
62 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ,
63 },
64 {},
65};
66
67static struct platform_device serial_device = {
68 .name = "serial8250",
69 .id = 0,
70 .dev = {
71 .platform_data = serial_platform_data,
72 },
73};
74
75static int __init mxc_init_extuart(void)
76{
77 return platform_device_register(&serial_device);
78}
79#else
80static inline int mxc_init_extuart(void)
81{
82 return 0;
83}
84#endif
85
86/*!
87 * This structure defines static mappings for the i.MX31ADS board.
88 */
89static struct map_desc mx31ads_io_desc[] __initdata = {
90 {
91 .virtual = AIPS1_BASE_ADDR_VIRT,
92 .pfn = __phys_to_pfn(AIPS1_BASE_ADDR),
93 .length = AIPS1_SIZE,
94 .type = MT_NONSHARED_DEVICE
95 }, {
96 .virtual = SPBA0_BASE_ADDR_VIRT,
97 .pfn = __phys_to_pfn(SPBA0_BASE_ADDR),
98 .length = SPBA0_SIZE,
99 .type = MT_NONSHARED_DEVICE
100 }, {
101 .virtual = AIPS2_BASE_ADDR_VIRT,
102 .pfn = __phys_to_pfn(AIPS2_BASE_ADDR),
103 .length = AIPS2_SIZE,
104 .type = MT_NONSHARED_DEVICE
105 }, {
106 .virtual = CS4_BASE_ADDR_VIRT,
107 .pfn = __phys_to_pfn(CS4_BASE_ADDR),
108 .length = CS4_SIZE / 2,
109 .type = MT_DEVICE
110 },
111};
112
113/*!
114 * Set up static virtual mappings.
115 */
116void __init mx31ads_map_io(void)
117{
118 mxc_map_io();
119 iotable_init(mx31ads_io_desc, ARRAY_SIZE(mx31ads_io_desc));
120}
121
122/*!
123 * Board specific initialization.
124 */
125static void __init mxc_board_init(void)
126{
127 mxc_init_extuart();
128}
129
130/*
131 * The following uses standard kernel macros defined in arch.h in order to
132 * initialize __mach_desc_MX31ADS data structure.
133 */
134MACHINE_START(MX31ADS, "Freescale MX31ADS")
135 /* Maintainer: Freescale Semiconductor, Inc. */
136 .phys_io = AIPS1_BASE_ADDR,
137 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
138 .boot_params = PHYS_OFFSET + 0x100,
139 .map_io = mx31ads_map_io,
140 .init_irq = mxc_init_irq,
141 .init_machine = mxc_board_init,
142 .timer = &mxc_timer,
143MACHINE_END