~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-lpc32xx/pm.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/arm/mach-lpc32xx/pm.c (Version linux-6.12-rc7) and /arch/i386/mach-lpc32xx/pm.c (Version linux-4.14.336)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /*                                                
  3  * arch/arm/mach-lpc32xx/pm.c                     
  4  *                                                
  5  * Original authors: Vitaly Wool, Dmitry Chigi    
  6  * Modified by Kevin Wells <kevin.wells@nxp.co    
  7  *                                                
  8  * 2005 (c) MontaVista Software, Inc.             
  9  */                                               
 10                                                   
 11 /*                                                
 12  * LPC32XX CPU and system power management        
 13  *                                                
 14  * The LPC32XX has three CPU modes for control    
 15  * direct-run, and halt modes. When switching     
 16  * the CPU transistions through direct-run mod    
 17  * mode is not used in normal operation. Halt     
 18  * system is fully suspended.                     
 19  *                                                
 20  * Run mode:                                      
 21  * The ARM CPU clock (HCLK_PLL), HCLK bus cloc    
 22  * derived from the HCLK PLL. The HCLK and PCL    
 23  * the HCLK_PLL rate. Linux runs in this mode.    
 24  *                                                
 25  * Direct-run mode:                               
 26  * The ARM CPU clock, HCLK bus clock, and PCLK    
 27  * SYSCLK. SYSCLK is usually around 13MHz, but    
 28  * source or the frequency of the main oscilla    
 29  * HCLK_PLL can be safely enabled, changed, or    
 30  *                                                
 31  * Halt mode:                                     
 32  * SYSCLK is gated off and the CPU and system     
 33  * Peripherals based on the 32KHz oscillator c    
 34  * key scanner, etc.) still operate if enabled    
 35  * system event (ie, GPIO state change, RTC ma    
 36  * wake the system up back into direct-run mod    
 37  *                                                
 38  * DRAM refresh                                   
 39  * DRAM clocking and refresh are slightly diff    
 40  * DRAM or regular SDRAM devices. If SDRAM is     
 41  * SDRAM will still be accessible in direct-ru    
 42  * a transition to direct-run mode will stop a    
 43  * Because of this, the code to switch power m    
 44  * and exit DRAM self-refresh modes must not b    
 45  * section of IRAM is used instead for this.      
 46  *                                                
 47  * Suspend is handled with the following logic    
 48  *  Backup a small area of IRAM used for the s    
 49  *  Copy suspend code to IRAM                     
 50  *  Transfer control to code in IRAM              
 51  *  Places DRAMs in self-refresh mode             
 52  *  Enter direct-run mode                         
 53  *  Save state of HCLK_PLL PLL                    
 54  *  Disable HCLK_PLL PLL                          
 55  *  Enter halt mode - CPU and buses will stop     
 56  *  System enters direct-run mode when an enab    
 57  *  HCLK PLL state is restored                    
 58  *  Run mode is entered                           
 59  *  DRAMS are placed back into normal mode        
 60  *  Code execution returns from IRAM              
 61  *  IRAM code are used for suspend is restored    
 62  *  Suspend mode is exited                        
 63  */                                               
 64                                                   
 65 #include <linux/suspend.h>                        
 66 #include <linux/io.h>                             
 67 #include <linux/slab.h>                           
 68                                                   
 69 #include <asm/cacheflush.h>                       
 70                                                   
 71 #include "lpc32xx.h"                              
 72 #include "common.h"                               
 73                                                   
 74 #define TEMP_IRAM_AREA  IO_ADDRESS(LPC32XX_IRA    
 75                                                   
 76 /*                                                
 77  * Both STANDBY and MEM suspend states are han    
 78  * loss of CPU or memory state                    
 79  */                                               
 80 static int lpc32xx_pm_enter(suspend_state_t st    
 81 {                                                 
 82         int (*lpc32xx_suspend_ptr) (void);        
 83         void *iram_swap_area;                     
 84                                                   
 85         /* Allocate some space for temporary I    
 86         iram_swap_area = kmemdup((void *)TEMP_    
 87                                  lpc32xx_sys_s    
 88         if (!iram_swap_area)                      
 89                 return -ENOMEM;                   
 90                                                   
 91         /*                                        
 92          * Copy code to suspend system into IR    
 93          * needs to run from IRAM as DRAM may     
 94          * when the PLL is stopped.               
 95          */                                       
 96         memcpy((void *) TEMP_IRAM_AREA, &lpc32    
 97                 lpc32xx_sys_suspend_sz);          
 98         flush_icache_range((unsigned long)TEMP    
 99                 (unsigned long)(TEMP_IRAM_AREA    
100                                                   
101         /* Transfer to suspend code in IRAM */    
102         lpc32xx_suspend_ptr = (void *) TEMP_IR    
103         flush_cache_all();                        
104         (void) lpc32xx_suspend_ptr();             
105                                                   
106         /* Restore original IRAM contents */      
107         memcpy((void *) TEMP_IRAM_AREA, iram_s    
108                 lpc32xx_sys_suspend_sz);          
109                                                   
110         kfree(iram_swap_area);                    
111                                                   
112         return 0;                                 
113 }                                                 
114                                                   
115 static const struct platform_suspend_ops lpc32    
116         .valid  = suspend_valid_only_mem,         
117         .enter  = lpc32xx_pm_enter,               
118 };                                                
119                                                   
120 #define EMC_DYN_MEM_CTRL_OFS 0x20                 
121 #define EMC_SRMMC           (1 << 3)              
122 #define EMC_CTRL_REG io_p2v(LPC32XX_EMC_BASE +    
123 static int __init lpc32xx_pm_init(void)           
124 {                                                 
125         /*                                        
126          * Setup SDRAM self-refresh clock to a    
127          * start of self-refresh. This only ne    
128          */                                       
129         __raw_writel(__raw_readl(EMC_CTRL_REG)    
130                                                   
131         suspend_set_ops(&lpc32xx_pm_ops);         
132                                                   
133         return 0;                                 
134 }                                                 
135 arch_initcall(lpc32xx_pm_init);                   
136                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php