suspend.rst 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. =======================
  2. S3C24XX Suspend Support
  3. =======================
  4. Introduction
  5. ------------
  6. The S3C24XX supports a low-power suspend mode, where the SDRAM is kept
  7. in Self-Refresh mode, and all but the essential peripheral blocks are
  8. powered down. For more information on how this works, please look
  9. at the relevant CPU datasheet from Samsung.
  10. Requirements
  11. ------------
  12. 1) A bootloader that can support the necessary resume operation
  13. 2) Support for at least 1 source for resume
  14. 3) CONFIG_PM enabled in the kernel
  15. 4) Any peripherals that are going to be powered down at the same
  16. time require suspend/resume support.
  17. Resuming
  18. --------
  19. The S3C2410 user manual defines the process of sending the CPU to
  20. sleep and how it resumes. The default behaviour of the Linux code
  21. is to set the GSTATUS3 register to the physical address of the
  22. code to resume Linux operation.
  23. GSTATUS4 is currently left alone by the sleep code, and is free to
  24. use for any other purposes (for example, the EB2410ITX uses this to
  25. save memory configuration in).
  26. Machine Support
  27. ---------------
  28. The machine specific functions must call the s3c_pm_init() function
  29. to say that its bootloader is capable of resuming. This can be as
  30. simple as adding the following to the machine's definition:
  31. INITMACHINE(s3c_pm_init)
  32. A board can do its own setup before calling s3c_pm_init, if it
  33. needs to setup anything else for power management support.
  34. There is currently no support for over-riding the default method of
  35. saving the resume address, if your board requires it, then contact
  36. the maintainer and discuss what is required.
  37. Note, the original method of adding an late_initcall() is wrong,
  38. and will end up initialising all compiled machines' pm init!
  39. The following is an example of code used for testing wakeup from
  40. an falling edge on IRQ_EINT0::
  41. static irqreturn_t button_irq(int irq, void *pw)
  42. {
  43. return IRQ_HANDLED;
  44. }
  45. statuc void __init machine_init(void)
  46. {
  47. ...
  48. request_irq(IRQ_EINT0, button_irq, IRQF_TRIGGER_FALLING,
  49. "button-irq-eint0", NULL);
  50. enable_irq_wake(IRQ_EINT0);
  51. s3c_pm_init();
  52. }
  53. Debugging
  54. ---------
  55. There are several important things to remember when using PM suspend:
  56. 1) The uart drivers will disable the clocks to the UART blocks when
  57. suspending, which means that use of printascii() or similar direct
  58. access to the UARTs will cause the debug to stop.
  59. 2) While the pm code itself will attempt to re-enable the UART clocks,
  60. care should be taken that any external clock sources that the UARTs
  61. rely on are still enabled at that point.
  62. 3) If any debugging is placed in the resume path, then it must have the
  63. relevant clocks and peripherals setup before use (ie, bootloader).
  64. For example, if you transmit a character from the UART, the baud
  65. rate and uart controls must be setup beforehand.
  66. Configuration
  67. -------------
  68. The S3C2410 specific configuration in `System Type` defines various
  69. aspects of how the S3C2410 suspend and resume support is configured
  70. `S3C2410 PM Suspend debug`
  71. This option prints messages to the serial console before and after
  72. the actual suspend, giving detailed information on what is
  73. happening
  74. `S3C2410 PM Suspend Memory CRC`
  75. Allows the entire memory to be checksummed before and after the
  76. suspend to see if there has been any corruption of the contents.
  77. Note, the time to calculate the CRC is dependent on the CPU speed
  78. and the size of memory. For an 64Mbyte RAM area on an 200MHz
  79. S3C2410, this can take approximately 4 seconds to complete.
  80. This support requires the CRC32 function to be enabled.
  81. `S3C2410 PM Suspend CRC Chunksize (KiB)`
  82. Defines the size of memory each CRC chunk covers. A smaller value
  83. will mean that the CRC data block will take more memory, but will
  84. identify any faults with better precision
  85. Document Author
  86. ---------------
  87. Ben Dooks, Copyright 2004 Simtec Electronics