sleep.S 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* linux/arch/arm/plat-s3c64xx/sleep.S
  2. *
  3. * Copyright 2008 Openmoko, Inc.
  4. * Copyright 2008 Simtec Electronics
  5. * Ben Dooks <ben@simtec.co.uk>
  6. * http://armlinux.simtec.co.uk/
  7. *
  8. * S3C64XX CPU sleep code
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/linkage.h>
  15. #include <asm/assembler.h>
  16. #include <mach/map.h>
  17. #undef S3C64XX_VA_GPIO
  18. #define S3C64XX_VA_GPIO (0x0)
  19. #include <mach/regs-gpio.h>
  20. #define LL_UART (S3C_PA_UART + (0x400 * CONFIG_S3C_LOWLEVEL_UART_PORT))
  21. .text
  22. /* s3c_cpu_save
  23. *
  24. * Save enough processor state to allow the restart of the pm.c
  25. * code after resume.
  26. *
  27. * entry:
  28. * r1 = v:p offset
  29. */
  30. ENTRY(s3c_cpu_save)
  31. adr r3, BSYM(s3c64xx_finish_suspend)
  32. b cpu_suspend
  33. s3c64xx_finish_suspend:
  34. @@ call final suspend code
  35. ldr r0, =pm_cpu_sleep
  36. ldr pc, [r0]
  37. /* Sleep magic, the word before the resume entry point so that the
  38. * bootloader can check for a resumeable image. */
  39. .word 0x2bedf00d
  40. /* s3c_cpu_reusme
  41. *
  42. * This is the entry point, stored by whatever method the bootloader
  43. * requires to get the kernel runnign again. This code expects to be
  44. * entered with no caches live and the MMU disabled. It will then
  45. * restore the MMU and other basic CP registers saved and restart
  46. * the kernel C code to finish the resume code.
  47. */
  48. ENTRY(s3c_cpu_resume)
  49. msr cpsr_c, #PSR_I_BIT | PSR_F_BIT | SVC_MODE
  50. ldr r2, =LL_UART /* for debug */
  51. #ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
  52. #define S3C64XX_GPNCON (S3C64XX_GPN_BASE + 0x00)
  53. #define S3C64XX_GPNDAT (S3C64XX_GPN_BASE + 0x04)
  54. #define S3C64XX_GPN_CONMASK(__gpio) (0x3 << ((__gpio) * 2))
  55. #define S3C64XX_GPN_OUTPUT(__gpio) (0x1 << ((__gpio) * 2))
  56. /* Initialise the GPIO state if we are debugging via the SMDK LEDs,
  57. * as the uboot version supplied resets these to inputs during the
  58. * resume checks.
  59. */
  60. ldr r3, =S3C64XX_PA_GPIO
  61. ldr r0, [ r3, #S3C64XX_GPNCON ]
  62. bic r0, r0, #(S3C64XX_GPN_CONMASK(12) | S3C64XX_GPN_CONMASK(13) | \
  63. S3C64XX_GPN_CONMASK(14) | S3C64XX_GPN_CONMASK(15))
  64. orr r0, r0, #(S3C64XX_GPN_OUTPUT(12) | S3C64XX_GPN_OUTPUT(13) | \
  65. S3C64XX_GPN_OUTPUT(14) | S3C64XX_GPN_OUTPUT(15))
  66. str r0, [ r3, #S3C64XX_GPNCON ]
  67. ldr r0, [ r3, #S3C64XX_GPNDAT ]
  68. bic r0, r0, #0xf << 12 @ GPN12..15
  69. orr r0, r0, #1 << 15 @ GPN15
  70. str r0, [ r3, #S3C64XX_GPNDAT ]
  71. #endif
  72. b cpu_resume