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