sdram.S 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* SPDX-License-Identifier: GPL-2.0
  2. *
  3. * KFR2R09 sdram self/auto-refresh setup code
  4. *
  5. * Copyright (C) 2009 Magnus Damm
  6. */
  7. #include <linux/sys.h>
  8. #include <linux/errno.h>
  9. #include <linux/linkage.h>
  10. #include <asm/asm-offsets.h>
  11. #include <asm/suspend.h>
  12. #include <asm/romimage-macros.h>
  13. /* code to enter and leave self-refresh. must be self-contained.
  14. * this code will be copied to on-chip memory and executed from there.
  15. */
  16. .balign 4
  17. ENTRY(kfr2r09_sdram_enter_start)
  18. /* DBSC: put memory in self-refresh mode */
  19. ED 0xFD000010, 0x00000000 /* DBEN */
  20. ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
  21. ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
  22. ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
  23. ED 0xFD000040, 0x00000001 /* DBRFPDN0 */
  24. rts
  25. nop
  26. ENTRY(kfr2r09_sdram_enter_end)
  27. .balign 4
  28. ENTRY(kfr2r09_sdram_leave_start)
  29. /* DBSC: put memory in auto-refresh mode */
  30. mov.l @(SH_SLEEP_MODE, r5), r0
  31. tst #SUSP_SH_RSTANDBY, r0
  32. bf resume_rstandby
  33. ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
  34. WAIT 1
  35. ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
  36. ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
  37. ED 0xFD000010, 0x00000001 /* DBEN */
  38. ED 0xFD000040, 0x00010000 /* DBRFPDN0 */
  39. rts
  40. nop
  41. resume_rstandby:
  42. /* DBSC: re-initialize and put in auto-refresh */
  43. ED 0xFD000108, 0x40000301 /* DBPDCNT0 */
  44. ED 0xFD000020, 0x011B0002 /* DBCONF */
  45. ED 0xFD000030, 0x03060E02 /* DBTR0 */
  46. ED 0xFD000034, 0x01020102 /* DBTR1 */
  47. ED 0xFD000038, 0x01090406 /* DBTR2 */
  48. ED 0xFD000008, 0x00000004 /* DBKIND */
  49. ED 0xFD000040, 0x00000001 /* DBRFPDN0 */
  50. ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
  51. ED 0xFD000018, 0x00000001 /* DBCKECNT */
  52. WAIT 1
  53. ED 0xFD000010, 0x00000001 /* DBEN */
  54. ED 0xFD000044, 0x000004AF /* DBRFPDN1 */
  55. ED 0xFD000048, 0x20CF0037 /* DBRFPDN2 */
  56. ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
  57. ED 0xFD000108, 0x40000300 /* DBPDCNT0 */
  58. ED 0xFD000040, 0x00010000 /* DBRFPDN0 */
  59. rts
  60. nop
  61. ENTRY(kfr2r09_sdram_leave_end)