wdenk | 7a8e9bed | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 1 | /* |
| 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 |
| 34 | board_init16: |
| 35 | /* Alias MMCR to 0xdf000 */ |
| 36 | movw $0xfffc, %dx |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 37 | movl $0x800df0cb, %eax |
| 38 | outl %eax, %dx |
| 39 | |
wdenk | 7a8e9bed | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 40 | /* Set ds to point to MMCR alias */ |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 41 | movw $0xdf00, %ax |
| 42 | movw %ax, %ds |
| 43 | |
| 44 | /* Map the entire flash at 0x38000000 |
wdenk | 7a8e9bed | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 45 | * (with BOOTCS and PAR14, use 0xabfff800 for ROMCS1) */ |
| 46 | movl $0xc0, %edi |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 47 | movl $0x8bfff800, %eax |
| 48 | movl %eax, (%di) |
wdenk | 7a8e9bed | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 49 | |
| 50 | /* Disable SDRAM write buffer */ |
| 51 | movw $0x40,%di |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 52 | xorw %ax,%ax |
| 53 | movb %al, (%di) |
wdenk | 7a8e9bed | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 54 | |
| 55 | /* Disabe MMCR alias */ |
| 56 | movw $0xfffc, %dx |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 57 | movl $0x000000cb, %eax |
| 58 | outl %eax, %dx |
| 59 | |
wdenk | 7a8e9bed | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 60 | /* the return address is stored in bp */ |
| 61 | jmp *%bp |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 62 | |
wdenk | 7a8e9bed | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 63 | |
| 64 | .section .bios, "ax" |
| 65 | .code16 |
| 66 | .globl realmode_reset |
| 67 | realmode_reset: |
| 68 | /* Alias MMCR to 0xdf000 */ |
| 69 | movw $0xfffc, %dx |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 70 | movl $0x800df0cb, %eax |
| 71 | outl %eax, %dx |
| 72 | |
wdenk | 7a8e9bed | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 73 | /* Set ds to point to MMCR alias */ |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 74 | movw $0xdf00, %ax |
| 75 | movw %ax, %ds |
| 76 | |
wdenk | 7a8e9bed | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 77 | /* issue software reset thorugh MMCR */ |
| 78 | movl $0xd72, %edi |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 79 | movb $0x01, %al |
| 80 | movb %al, (%di) |
wdenk | 7a8e9bed | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 81 | |
| 82 | 1: hlt |
| 83 | jmp 1 |