blob: 4835936477f29f77931ebfe930f95a09d5abf564 [file] [log] [blame]
Graeme Russe56d3972008-12-07 10:28:57 +11001/*
2 * (C) Copyright 2008
3 * Graeme Russ, graeme.russ@gmail.com.
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/* #include <asm/ic/sc520_defs.h> */
31
Graeme Russdeac7402011-02-12 15:11:45 +110032#include "config.h"
Graeme Russe56d3972008-12-07 10:28:57 +110033#include "hardware.h"
Graeme Russb112bca2011-02-12 15:11:36 +110034#include <asm/ic/sc520.h>
Graeme Russe56d3972008-12-07 10:28:57 +110035
36.text
37.section .start16, "ax"
38.code16
39.globl board_init16
40board_init16:
41 /* Alias MMCR to 0xdf000 */
42 movw $0xfffc, %dx
43 movl $0x800df0cb, %eax
44 outl %eax, %dx
45
46 /* Set ds to point to MMCR alias */
47 movw $0xdf00, %ax
48 movw %ax, %ds
49
50 /* Map PAR for Boot Flash (BOOTCS, 512kB @ 0x380000000) */
Graeme Russb112bca2011-02-12 15:11:36 +110051 movl $(SC520_PAR14 - SC520_MMCR_BASE), %edi
Graeme Russdeac7402011-02-12 15:11:45 +110052 movl $CONFIG_SYS_SC520_BOOTCS_PAR, %eax
Graeme Russe56d3972008-12-07 10:28:57 +110053 movl %eax, (%di)
54
55 /* Map PAR for LED, Hex Switches (GPCS6, 20 Bytes @ 0x1000) */
Graeme Russb112bca2011-02-12 15:11:36 +110056 movl $(SC520_PAR15 - SC520_MMCR_BASE), %edi
Graeme Russdeac7402011-02-12 15:11:45 +110057 movl $CONFIG_SYS_SC520_LLIO_PAR, %eax
Graeme Russe56d3972008-12-07 10:28:57 +110058 movl %eax, (%di)
59
60 /* Disable SDRAM write buffer */
Graeme Russb112bca2011-02-12 15:11:36 +110061 movw $(SC520_DBCTL - SC520_MMCR_BASE), %di
Graeme Russe56d3972008-12-07 10:28:57 +110062 xorw %ax, %ax
63 movb %al, (%di)
64
65 /* Disabe MMCR alias */
66 movw $0xfffc, %dx
67 movl $0x000000cb, %eax
68 outl %eax, %dx
69
Graeme Russ157b0e92010-10-07 20:03:27 +110070 jmp board_init16_ret
Graeme Russe56d3972008-12-07 10:28:57 +110071
72.section .bios, "ax"
73.code16
74.globl realmode_reset
Graeme Russ1aafcc92009-11-24 20:04:19 +110075.hidden realmode_reset
76.type realmode_reset, @function
Graeme Russe56d3972008-12-07 10:28:57 +110077realmode_reset:
78 /* Alias MMCR to 0xdf000 */
79 movw $0xfffc, %dx
80 movl $0x800df0cb, %eax
81 outl %eax, %dx
82
83 /* Set ds to point to MMCR alias */
84 movw $0xdf00, %ax
85 movw %ax, %ds
86
87 /* issue software reset thorugh MMCR */
88 movl $0xd72, %edi
89 movb $0x01, %al
90 movb %al, (%di)
91
921: hlt
93 jmp 1