blob: a3e700a6263c2214b6b3e35a935a8dc49fdfc758 [file] [log] [blame]
wdenk2262cfe2002-11-18 00:14:45 +00001/*
2 * (C) Copyright 2002
3 * Daniel Engström, Omicron Ceti AB <daniel@omicron.se>.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24/*
25 * 16bit initialization code.
26 * This code have to map the area of the boot flash
27 * that is used by U-boot to its final destination.
28 */
29
30.text
31.section .start16, "ax"
32.code16
33.globl board_init16
34board_init16:
35 /* Alias MMCR to 0xdf000 */
36 movw $0xfffc, %dx
wdenk8bde7f72003-06-27 21:31:46 +000037 movl $0x800df0cb, %eax
38 outl %eax, %dx
39
wdenk2262cfe2002-11-18 00:14:45 +000040 /* Set ds to point to MMCR alias */
wdenk8bde7f72003-06-27 21:31:46 +000041 movw $0xdf00, %ax
42 movw %ax, %ds
43
44 /* Map the entire flash at 0x38000000
wdenk2262cfe2002-11-18 00:14:45 +000045 * (with BOOTCS and PAR14, use 0xabfff800 for ROMCS1) */
46 movl $0xc0, %edi
wdenk8bde7f72003-06-27 21:31:46 +000047 movl $0x8bfff800, %eax
48 movl %eax, (%di)
wdenk2262cfe2002-11-18 00:14:45 +000049
50 /* Disable SDRAM write buffer */
51 movw $0x40,%di
wdenk8bde7f72003-06-27 21:31:46 +000052 xorw %ax,%ax
53 movb %al, (%di)
wdenk2262cfe2002-11-18 00:14:45 +000054
55 /* Disabe MMCR alias */
56 movw $0xfffc, %dx
wdenk8bde7f72003-06-27 21:31:46 +000057 movl $0x000000cb, %eax
58 outl %eax, %dx
59
wdenk2262cfe2002-11-18 00:14:45 +000060 /* the return address is tored in bp */
61 jmp *%bp
wdenk8bde7f72003-06-27 21:31:46 +000062
wdenk7a8e9bed2003-05-31 18:35:21 +000063
64.section .bios, "ax"
65.code16
66.globl realmode_reset
67realmode_reset:
68 /* Alias MMCR to 0xdf000 */
69 movw $0xfffc, %dx
wdenk8bde7f72003-06-27 21:31:46 +000070 movl $0x800df0cb, %eax
71 outl %eax, %dx
72
wdenk7a8e9bed2003-05-31 18:35:21 +000073 /* Set ds to point to MMCR alias */
wdenk8bde7f72003-06-27 21:31:46 +000074 movw $0xdf00, %ax
75 movw %ax, %ds
76
wdenk7a8e9bed2003-05-31 18:35:21 +000077 /* issue software reset thorugh MMCR */
78 movl $0xd72, %edi
wdenk8bde7f72003-06-27 21:31:46 +000079 movb $0x01, %al
80 movb %al, (%di)
wdenk7a8e9bed2003-05-31 18:35:21 +000081
821: hlt
83 jmp 1