blob: 4241f6e10411dc82326d4e04753833876f40a299 [file] [log] [blame]
Graeme Russc620c012008-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
Graeme Russ420c7c02011-02-12 15:11:45 +110030#include "config.h"
Graeme Russc620c012008-12-07 10:28:57 +110031#include "hardware.h"
Graeme Russ3c7db1b2011-08-04 22:05:09 +100032#include <asm/arch/sc520.h>
Graeme Russc620c012008-12-07 10:28:57 +110033
34.text
35.section .start16, "ax"
36.code16
37.globl board_init16
38board_init16:
39 /* Alias MMCR to 0xdf000 */
40 movw $0xfffc, %dx
41 movl $0x800df0cb, %eax
42 outl %eax, %dx
43
44 /* Set ds to point to MMCR alias */
45 movw $0xdf00, %ax
46 movw %ax, %ds
47
48 /* Map PAR for Boot Flash (BOOTCS, 512kB @ 0x380000000) */
Graeme Russc2cbbaf2011-02-12 15:11:36 +110049 movl $(SC520_PAR14 - SC520_MMCR_BASE), %edi
Graeme Russ420c7c02011-02-12 15:11:45 +110050 movl $CONFIG_SYS_SC520_BOOTCS_PAR, %eax
Graeme Russc620c012008-12-07 10:28:57 +110051 movl %eax, (%di)
52
53 /* Map PAR for LED, Hex Switches (GPCS6, 20 Bytes @ 0x1000) */
Graeme Russc2cbbaf2011-02-12 15:11:36 +110054 movl $(SC520_PAR15 - SC520_MMCR_BASE), %edi
Graeme Russ420c7c02011-02-12 15:11:45 +110055 movl $CONFIG_SYS_SC520_LLIO_PAR, %eax
Graeme Russc620c012008-12-07 10:28:57 +110056 movl %eax, (%di)
57
Graeme Russc620c012008-12-07 10:28:57 +110058 /* Disabe MMCR alias */
59 movw $0xfffc, %dx
60 movl $0x000000cb, %eax
61 outl %eax, %dx
62
Graeme Russ88fa0a62010-10-07 20:03:27 +110063 jmp board_init16_ret
Graeme Russc620c012008-12-07 10:28:57 +110064
65.section .bios, "ax"
66.code16
67.globl realmode_reset
Graeme Russ0fc1b492009-11-24 20:04:19 +110068.hidden realmode_reset
69.type realmode_reset, @function
Graeme Russc620c012008-12-07 10:28:57 +110070realmode_reset:
71 /* Alias MMCR to 0xdf000 */
72 movw $0xfffc, %dx
73 movl $0x800df0cb, %eax
74 outl %eax, %dx
75
76 /* Set ds to point to MMCR alias */
77 movw $0xdf00, %ax
78 movw %ax, %ds
79
80 /* issue software reset thorugh MMCR */
81 movl $0xd72, %edi
82 movb $0x01, %al
83 movb %al, (%di)
84
851: hlt
86 jmp 1