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