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

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-socfpga/self-refresh.S

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-socfpga/self-refresh.S (Architecture ppc) and /arch/i386/mach-socfpga/self-refresh.S (Architecture i386)


  1 /* SPDX-License-Identifier: GPL-2.0-only */       
  2 /*                                                
  3  * Copyright (C) 2014-2015 Altera Corporation.    
  4  */                                               
  5 #include <linux/linkage.h>                        
  6 #include <asm/assembler.h>                        
  7                                                   
  8 #define MAX_LOOP_COUNT          1000              
  9                                                   
 10 /* Register offset */                             
 11 #define SDR_CTRLGRP_LOWPWREQ_ADDR       0x54      
 12 #define SDR_CTRLGRP_LOWPWRACK_ADDR      0x58      
 13                                                   
 14 /* Bitfield positions */                          
 15 #define SELFRSHREQ_POS                  3         
 16 #define SELFRSHREQ_MASK                 0x8       
 17                                                   
 18 #define SELFRFSHACK_POS                 1         
 19 #define SELFRFSHACK_MASK                0x2       
 20                                                   
 21         /*                                        
 22          * This code assumes that when the boo    
 23          * the sdram controller for the DDR on    
 24          * configured the following fields dep    
 25          * vendor/configuration:                  
 26          *                                        
 27          * sdr.ctrlcfg.lowpwreq.selfrfshmask      
 28          * sdr.ctrlcfg.lowpwrtiming.clkdisable    
 29          * sdr.ctrlcfg.dramtiming4.selfrfshexi    
 30          */                                       
 31                                                   
 32         .arch   armv7-a                           
 33         .text                                     
 34         .align 3                                  
 35                                                   
 36         /*                                        
 37          * socfpga_sdram_self_refresh             
 38          *                                        
 39          *  r0 : sdr_ctl_base_addr                
 40          *  r1 : temp storage of return value     
 41          *  r2 : temp storage of register valu    
 42          *  r3 : loop counter                     
 43          *                                        
 44          *  return value: lower 16 bits: loop     
 45          *                upper 16 bits: loop     
 46          */                                       
 47 ENTRY(socfpga_sdram_self_refresh)                 
 48         /* Enable dynamic clock gating in the     
 49         mrc     p15, 0, r2, c15, c0, 0            
 50         orr     r2, r2, #1                        
 51         mcr     p15, 0, r2, c15, c0, 0            
 52                                                   
 53         /* Enable self refresh: set sdr.ctrlgr    
 54         ldr     r2, [r0, #SDR_CTRLGRP_LOWPWREQ    
 55         orr     r2, r2, #SELFRSHREQ_MASK          
 56         str     r2, [r0, #SDR_CTRLGRP_LOWPWREQ    
 57                                                   
 58         /* Poll until sdr.ctrlgrp.lowpwrack.se    
 59         mov     r3, #0                            
 60 while_ack_0:                                      
 61         ldr     r2, [r0, #SDR_CTRLGRP_LOWPWRAC    
 62         and     r2, r2, #SELFRFSHACK_MASK         
 63         cmp     r2, #SELFRFSHACK_MASK             
 64         beq     ack_1                             
 65                                                   
 66         add     r3, #1                            
 67         cmp     r3, #MAX_LOOP_COUNT               
 68         bne     while_ack_0                       
 69                                                   
 70 ack_1:                                            
 71         mov     r1, r3                            
 72                                                   
 73         /*                                        
 74          * Execute an ISB instruction to ensur    
 75          * CP15 register changes have been com    
 76          */                                       
 77         isb                                       
 78                                                   
 79         /*                                        
 80          * Execute a barrier instruction to en    
 81          * TLB and branch predictor maintenanc    
 82          * by any CPU in the cluster have comp    
 83          */                                       
 84         dsb                                       
 85         dmb                                       
 86                                                   
 87         wfi                                       
 88                                                   
 89         /* Disable self-refresh: set sdr.ctrlg    
 90         ldr     r2, [r0, #SDR_CTRLGRP_LOWPWREQ    
 91         bic     r2, r2, #SELFRSHREQ_MASK          
 92         str     r2, [r0, #SDR_CTRLGRP_LOWPWREQ    
 93                                                   
 94         /* Poll until sdr.ctrlgrp.lowpwrack.se    
 95         mov     r3, #0                            
 96 while_ack_1:                                      
 97         ldr     r2, [r0, #SDR_CTRLGRP_LOWPWRAC    
 98         and     r2, r2, #SELFRFSHACK_MASK         
 99         cmp     r2, #SELFRFSHACK_MASK             
100         bne     ack_0                             
101                                                   
102         add     r3, #1                            
103         cmp     r3, #MAX_LOOP_COUNT               
104         bne     while_ack_1                       
105                                                   
106 ack_0:                                            
107         /*                                        
108          * Prepare return value:                  
109          * Shift loop count for exiting self r    
110          * Leave loop count for requesting sel    
111          */                                       
112         mov     r3, r3, lsl #16                   
113         add     r1, r1, r3                        
114                                                   
115         /* Disable dynamic clock gating in the    
116         mrc     p15, 0, r2, c15, c0, 0            
117         bic     r2, r2, #1                        
118         mcr     p15, 0, r2, c15, c0, 0            
119                                                   
120         mov     r0, r1                  @ retu    
121         bx      lr                      @ retu    
122                                                   
123 ENDPROC(socfpga_sdram_self_refresh)               
124 ENTRY(socfpga_sdram_self_refresh_sz)              
125         .word   . - socfpga_sdram_self_refresh    
                                                      

~ [ 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