Graeme Russ | e56d397 | 2008-12-07 10:28:57 +1100 | [diff] [blame] | 1 | /* |
| 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 Russ | deac740 | 2011-02-12 15:11:45 +1100 | [diff] [blame] | 30 | #include "config.h" |
Graeme Russ | e56d397 | 2008-12-07 10:28:57 +1100 | [diff] [blame] | 31 | #include "hardware.h" |
Graeme Russ | 0d992d0 | 2011-08-04 22:05:09 +1000 | [diff] [blame] | 32 | #include <asm/arch/sc520.h> |
Graeme Russ | c6512ca | 2011-11-08 02:33:18 +0000 | [diff] [blame] | 33 | #include <generated/asm-offsets.h> |
Graeme Russ | e56d397 | 2008-12-07 10:28:57 +1100 | [diff] [blame] | 34 | |
| 35 | .text |
| 36 | .section .start16, "ax" |
| 37 | .code16 |
| 38 | .globl board_init16 |
| 39 | board_init16: |
| 40 | /* Alias MMCR to 0xdf000 */ |
| 41 | movw $0xfffc, %dx |
| 42 | movl $0x800df0cb, %eax |
| 43 | outl %eax, %dx |
| 44 | |
| 45 | /* Set ds to point to MMCR alias */ |
| 46 | movw $0xdf00, %ax |
| 47 | movw %ax, %ds |
| 48 | |
| 49 | /* Map PAR for Boot Flash (BOOTCS, 512kB @ 0x380000000) */ |
Graeme Russ | c6512ca | 2011-11-08 02:33:18 +0000 | [diff] [blame] | 50 | movl $GENERATED_SC520_PAR14, %edi |
Graeme Russ | deac740 | 2011-02-12 15:11:45 +1100 | [diff] [blame] | 51 | movl $CONFIG_SYS_SC520_BOOTCS_PAR, %eax |
Graeme Russ | e56d397 | 2008-12-07 10:28:57 +1100 | [diff] [blame] | 52 | movl %eax, (%di) |
| 53 | |
| 54 | /* Map PAR for LED, Hex Switches (GPCS6, 20 Bytes @ 0x1000) */ |
Graeme Russ | c6512ca | 2011-11-08 02:33:18 +0000 | [diff] [blame] | 55 | movl $GENERATED_SC520_PAR15, %edi |
Graeme Russ | deac740 | 2011-02-12 15:11:45 +1100 | [diff] [blame] | 56 | movl $CONFIG_SYS_SC520_LLIO_PAR, %eax |
Graeme Russ | e56d397 | 2008-12-07 10:28:57 +1100 | [diff] [blame] | 57 | movl %eax, (%di) |
| 58 | |
Graeme Russ | e56d397 | 2008-12-07 10:28:57 +1100 | [diff] [blame] | 59 | /* Disabe MMCR alias */ |
| 60 | movw $0xfffc, %dx |
| 61 | movl $0x000000cb, %eax |
| 62 | outl %eax, %dx |
| 63 | |
Graeme Russ | 157b0e9 | 2010-10-07 20:03:27 +1100 | [diff] [blame] | 64 | jmp board_init16_ret |
Graeme Russ | e56d397 | 2008-12-07 10:28:57 +1100 | [diff] [blame] | 65 | |
| 66 | .section .bios, "ax" |
| 67 | .code16 |
| 68 | .globl realmode_reset |
Graeme Russ | 1aafcc9 | 2009-11-24 20:04:19 +1100 | [diff] [blame] | 69 | .hidden realmode_reset |
| 70 | .type realmode_reset, @function |
Graeme Russ | e56d397 | 2008-12-07 10:28:57 +1100 | [diff] [blame] | 71 | realmode_reset: |
| 72 | /* Alias MMCR to 0xdf000 */ |
| 73 | movw $0xfffc, %dx |
| 74 | movl $0x800df0cb, %eax |
| 75 | outl %eax, %dx |
| 76 | |
| 77 | /* Set ds to point to MMCR alias */ |
| 78 | movw $0xdf00, %ax |
| 79 | movw %ax, %ds |
| 80 | |
| 81 | /* issue software reset thorugh MMCR */ |
| 82 | movl $0xd72, %edi |
| 83 | movb $0x01, %al |
| 84 | movb %al, (%di) |
| 85 | |
| 86 | 1: hlt |
| 87 | jmp 1 |