1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/*++
linux/arch/arm/mach-wmt/board.c
Copyright (c) 2012 WonderMedia Technologies, Inc.
This program is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software Foundation,
either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
WonderMedia Technologies, Inc.
10F, 529, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C.
--*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/cpufreq.h>
#include <linux/ioport.h>
#include <linux/tty.h>
#include <linux/mm.h>
#include <linux/errno.h>
#include <linux/serial_core.h>
#include <linux/delay.h>
#include <mach/hardware.h>
#include <asm/system.h>
#include <asm/mach-types.h>
#include <asm/irq.h>
#include <asm/setup.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/tlbflush.h>
#include <asm/sizes.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/hardware/gic.h>
#include "generic.h"
static void __init
wmt_fixup(struct tag *tags,
char **cmdline, struct meminfo *mi)
{
#ifdef CONFIG_WMT_FIXUP_ATAG
struct tag *t = tags;
/*FIXME, remove following while ATAG passing from bootloader is ok.*/
t->hdr.tag = ATAG_CORE;
t->hdr.size = tag_size(tag_core);
t->u.core.flags = 0;
t->u.core.pagesize = PAGE_SIZE;
t->u.core.rootdev = (RAMDISK_MAJOR << 8) | 0;
t = tag_next(t);
t->hdr.tag = ATAG_MEM;
t->hdr.size = tag_size(tag_mem32);
t->u.mem.start = 0x00000000;
t->u.mem.size = 64 * 1024 * 1024;
t = tag_next(t);
/**/
/* ramdisk.size = decompressed ramdisk size in _kilo_ bytes.*/
/**/
t->hdr.tag = ATAG_RAMDISK;
t->hdr.size = tag_size(tag_ramdisk);
t->u.ramdisk.flags = 1;
t->u.ramdisk.size = 8 * 1024;
t->u.ramdisk.start = 0;
t = tag_next(t);
/**/
/* initrd.size = size of compressed ramdisk image in bytes.*/
/**/
t->hdr.tag = ATAG_INITRD2;
t->hdr.size = tag_size(tag_initrd);
t->u.initrd.start = 0x01000000; /* physical*/
/*t->u.initrd.size = 3 * 1024 * 1024;*/
t->u.initrd.size = 8 * 1024 * 1024; /* depend on the size of ramdisk.gz*/
t = tag_next(t);
t->hdr.tag = ATAG_NONE;
t->hdr.size = 0;
#endif
}
/* map wmt physical io address to virtual address */
static struct map_desc wmt_io_desc[] __initdata = {
{
.virtual = 0xFE000000,
.length = SZ_16M,
.pfn = __phys_to_pfn(0xD8000000),
.type = MT_DEVICE
}
};
static void __init wmt_map_io(void)
{
iotable_init(wmt_io_desc, ARRAY_SIZE(wmt_io_desc));
wmt_register_uart(0, 0); /* mount ttyS0 (or ttyVT0) to UART0*/
wmt_register_uart(1, 1); /* mount ttyS1 to UART1*/
#ifdef CONFIG_UART_2_3_ENABLE
wmt_register_uart(2, 2); /* mount ttyS2 to UART2*/
wmt_register_uart(3, 3); /* mount ttyS3 to UART3*/
#endif
}
extern struct sys_timer wmt_timer;
MACHINE_START(WMT, "WMT")
#ifdef CONFIG_WMT_USE_BOOTLOADER_ATAG
.boot_params = 0x00000100,
#endif
.fixup = &wmt_fixup,
.map_io = &wmt_map_io,
.init_irq = wmt_init_irq,
.handle_irq = gic_handle_irq,
.timer = &wmt_timer,
MACHINE_END
|