sc520_spunk_asm.S 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. /* now setup the General purpose bus to give us access to the LEDs.
  24. * We can then use the leds to display status information.
  25. */
  26. sc520_cdp_registers:
  27. /* size offset value */
  28. .word 1 ; .word 0x040 ; .long 0x00 /* SDRAM buffer control */
  29. .word 2 ; .word 0xc08 ; .long 0x0001 /* GP CS offset */
  30. .word 2 ; .word 0xc09 ; .long 0x0003 /* GP CS width */
  31. .word 2 ; .word 0xc0a ; .long 0x0001 /* GP CS width */
  32. .word 2 ; .word 0xc0b ; .long 0x0003 /* GP RD pulse width */
  33. .word 2 ; .word 0xc0c ; .long 0x0001 /* GP RD offse */
  34. .word 2 ; .word 0xc0d ; .long 0x0003 /* GP WR pulse width */
  35. .word 2 ; .word 0xc0e ; .long 0x0001 /* GP WR offset */
  36. .word 2 ; .word 0xc2c ; .long 0x003f /* GPIO directionreg 31-16 */
  37. .word 2 ; .word 0xc2a ; .long 0xe000 /* GPIO directionreg 15-0 */
  38. .word 2 ; .word 0xc22 ; .long 0xffc0 /* GPIO pin function 31-16 reg */
  39. .word 2 ; .word 0xc20 ; .long 0x1fff /* GPIO pin function 15-0 reg */
  40. .word 0 ; .word 0x000 ; .long 0x00
  41. /* board early intialization */
  42. .globl early_board_init
  43. early_board_init:
  44. movl $sc520_cdp_registers,%esi
  45. init_loop:
  46. movl $0xfffef000,%edi /* MMCR base to edi */
  47. movw (%esi), %bx /* load size to bx */
  48. cmpw $0, %bx /* if size is 0 we're done */
  49. je done
  50. xorl %edx,%edx
  51. movw 2(%esi), %dx /* load MMCR offset to dx */
  52. addl %edx, %edi /* add offset to base in edi */
  53. movl 4(%esi), %eax /* load value in eax */
  54. cmpw $1, %bx
  55. je byte /* byte op? */
  56. cmpw $2, %bx
  57. je word /* word op? */
  58. movl %eax, (%edi) /* must be long, then */
  59. jmp next
  60. byte: movb %al,(%edi)
  61. jmp next
  62. word: movw %ax,(%edi)
  63. next: addl $8, %esi /* advance esi */
  64. jmp init_loop
  65. /* light all leds */
  66. done: movl $0xfffefc32,%edx
  67. movw $0000,(%edx)
  68. jmp *%ebp /* return to caller */
  69. .globl show_boot_progress_asm
  70. show_boot_progress_asm:
  71. movl $0xfffefc32,%edx
  72. xorw $0xffff, %ax
  73. movw %ax,(%edx)
  74. jmp *%ebp