eNET_start16.S 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. * 16bit initialization code.
  25. * This code have to map the area of the boot flash
  26. * that is used by U-boot to its final destination.
  27. */
  28. /* #include <asm/ic/sc520_defs.h> */
  29. #include "hardware.h"
  30. .text
  31. .section .start16, "ax"
  32. .code16
  33. .globl board_init16
  34. board_init16:
  35. /* Alias MMCR to 0xdf000 */
  36. movw $0xfffc, %dx
  37. movl $0x800df0cb, %eax
  38. outl %eax, %dx
  39. /* Set ds to point to MMCR alias */
  40. movw $0xdf00, %ax
  41. movw %ax, %ds
  42. /* Map PAR for Boot Flash (BOOTCS, 512kB @ 0x380000000) */
  43. movl $0x00c0, %edi /* SC520_PAR14 */
  44. movl $0x8bfff800, %eax /* TODO: Check this */
  45. movl %eax, (%di)
  46. /* Map PAR for LED, Hex Switches (GPCS6, 20 Bytes @ 0x1000) */
  47. movl $0x00c4, %edi /* SC520_PAR15 */
  48. movl $0x38201000, %eax
  49. movl %eax, (%di)
  50. /* Disable SDRAM write buffer */
  51. movw $0x0040, %di /* SC520_DBCTL */
  52. xorw %ax, %ax
  53. movb %al, (%di)
  54. /* Disabe MMCR alias */
  55. movw $0xfffc, %dx
  56. movl $0x000000cb, %eax
  57. outl %eax, %dx
  58. /* the return address is stored in bp */
  59. jmp *%bp
  60. .section .bios, "ax"
  61. .code16
  62. .globl realmode_reset
  63. realmode_reset:
  64. /* Alias MMCR to 0xdf000 */
  65. movw $0xfffc, %dx
  66. movl $0x800df0cb, %eax
  67. outl %eax, %dx
  68. /* Set ds to point to MMCR alias */
  69. movw $0xdf00, %ax
  70. movw %ax, %ds
  71. /* issue software reset thorugh MMCR */
  72. movl $0xd72, %edi
  73. movb $0x01, %al
  74. movb %al, (%di)
  75. 1: hlt
  76. jmp 1