sdram.S 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Migo-R sdram self/auto-refresh setup code
  3. *
  4. * Copyright (C) 2009 Magnus Damm
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/sys.h>
  11. #include <linux/errno.h>
  12. #include <linux/linkage.h>
  13. #include <asm/asm-offsets.h>
  14. #include <asm/suspend.h>
  15. #include <asm/romimage-macros.h>
  16. /* code to enter and leave self-refresh. must be self-contained.
  17. * this code will be copied to on-chip memory and executed from there.
  18. */
  19. .balign 4
  20. ENTRY(migor_sdram_enter_start)
  21. /* SBSC: disable power down and put in self-refresh mode */
  22. mov.l 1f, r4
  23. mov.l 2f, r1
  24. mov.l @r4, r2
  25. or r1, r2
  26. mov.l 3f, r3
  27. and r3, r2
  28. mov.l r2, @r4
  29. rts
  30. nop
  31. .balign 4
  32. 1: .long 0xfe400008 /* SDCR0 */
  33. 2: .long 0x00000400
  34. 3: .long 0xffff7fff
  35. ENTRY(migor_sdram_enter_end)
  36. .balign 4
  37. ENTRY(migor_sdram_leave_start)
  38. /* SBSC: set auto-refresh mode */
  39. mov.l 1f, r4
  40. mov.l @r4, r0
  41. mov.l 4f, r1
  42. and r1, r0
  43. mov.l r0, @r4
  44. mov.l 6f, r4
  45. mov.l 8f, r0
  46. mov.l @r4, r1
  47. mov #-1, r4
  48. add r4, r1
  49. or r1, r0
  50. mov.l 7f, r1
  51. mov.l r0, @r1
  52. rts
  53. nop
  54. .balign 4
  55. 1: .long 0xfe400008 /* SDCR0 */
  56. 4: .long 0xfffffbff
  57. 6: .long 0xfe40001c /* RTCOR */
  58. 7: .long 0xfe400018 /* RTCNT */
  59. 8: .long 0xa55a0000
  60. ENTRY(migor_sdram_leave_end)