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

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

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/arm/mach-ux500/pm.c (Version linux-6.11-rc3) and /arch/ppc/mach-ux500/pm.c (Version linux-6.8.12)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /*                                                
  3  * Copyright (C) ST-Ericsson SA 2010-2013         
  4  * Author: Rickard Andersson <rickard.andersso    
  5  *         ST-Ericsson.                           
  6  * Author: Daniel Lezcano <daniel.lezcano@lina    
  7  * Author: Ulf Hansson <ulf.hansson@linaro.org    
  8  */                                               
  9                                                   
 10 #include <linux/kernel.h>                         
 11 #include <linux/irqchip/arm-gic.h>                
 12 #include <linux/delay.h>                          
 13 #include <linux/io.h>                             
 14 #include <linux/suspend.h>                        
 15 #include <linux/platform_data/arm-ux500-pm.h>     
 16 #include <linux/of.h>                             
 17 #include <linux/of_address.h>                     
 18                                                   
 19 /* ARM WFI Standby signal register */             
 20 #define PRCM_ARM_WFI_STANDBY    (prcmu_base +     
 21 #define PRCM_ARM_WFI_STANDBY_WFI0                 
 22 #define PRCM_ARM_WFI_STANDBY_WFI1                 
 23 #define PRCM_IOCR               (prcmu_base +     
 24 #define PRCM_IOCR_IOFORCE                         
 25                                                   
 26 /* Dual A9 core interrupt management unit regi    
 27 #define PRCM_A9_MASK_REQ        (prcmu_base +     
 28 #define PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ         
 29                                                   
 30 #define PRCM_A9_MASK_ACK        (prcmu_base +     
 31 #define PRCM_ARMITMSK31TO0      (prcmu_base +     
 32 #define PRCM_ARMITMSK63TO32     (prcmu_base +     
 33 #define PRCM_ARMITMSK95TO64     (prcmu_base +     
 34 #define PRCM_ARMITMSK127TO96    (prcmu_base +     
 35 #define PRCM_POWER_STATE_VAL    (prcmu_base +     
 36 #define PRCM_ARMITVAL31TO0      (prcmu_base +     
 37 #define PRCM_ARMITVAL63TO32     (prcmu_base +     
 38 #define PRCM_ARMITVAL95TO64     (prcmu_base +     
 39 #define PRCM_ARMITVAL127TO96    (prcmu_base +     
 40                                                   
 41 static void __iomem *prcmu_base;                  
 42 static void __iomem *dist_base;                   
 43                                                   
 44 /* This function decouple the gic from the prc    
 45 int prcmu_gic_decouple(void)                      
 46 {                                                 
 47         u32 val = readl(PRCM_A9_MASK_REQ);        
 48                                                   
 49         /* Set bit 0 register value to 1 */       
 50         writel(val | PRCM_A9_MASK_REQ_PRCM_A9_    
 51                PRCM_A9_MASK_REQ);                 
 52                                                   
 53         /* Make sure the register is updated *    
 54         readl(PRCM_A9_MASK_REQ);                  
 55                                                   
 56         /* Wait a few cycles for the gic mask     
 57         udelay(1);                                
 58                                                   
 59         return 0;                                 
 60 }                                                 
 61                                                   
 62 /* This function recouple the gic with the prc    
 63 int prcmu_gic_recouple(void)                      
 64 {                                                 
 65         u32 val = readl(PRCM_A9_MASK_REQ);        
 66                                                   
 67         /* Set bit 0 register value to 0 */       
 68         writel(val & ~PRCM_A9_MASK_REQ_PRCM_A9    
 69                                                   
 70         return 0;                                 
 71 }                                                 
 72                                                   
 73 #define PRCMU_GIC_NUMBER_REGS 5                   
 74                                                   
 75 /*                                                
 76  * This function checks if there are pending i    
 77  * makes sense if the gic has been decoupled b    
 78  * db8500_prcmu_gic_decouple function. Disabli    
 79  * disables the forwarding of the interrupt to    
 80  * does not prevent the interrupt from changin    
 81  * becoming pending, or active and pending if     
 82  * active. Hence, we have to check the interru    
 83  * active.                                        
 84  */                                               
 85 bool prcmu_gic_pending_irq(void)                  
 86 {                                                 
 87         u32 pr; /* Pending register */            
 88         u32 er; /* Enable register */             
 89         int i;                                    
 90                                                   
 91         /* 5 registers. STI & PPI not skipped     
 92         for (i = 0; i < PRCMU_GIC_NUMBER_REGS;    
 93                                                   
 94                 pr = readl_relaxed(dist_base +    
 95                 er = readl_relaxed(dist_base +    
 96                                                   
 97                 if (pr & er)                      
 98                         return true; /* There     
 99         }                                         
100                                                   
101         return false;                             
102 }                                                 
103                                                   
104 /*                                                
105  * This function checks if there are pending i    
106  * prcmu which has been delegated to monitor t    
107  * db8500_prcmu_copy_gic_settings function.       
108  */                                               
109 bool prcmu_pending_irq(void)                      
110 {                                                 
111         u32 it, im;                               
112         int i;                                    
113                                                   
114         for (i = 0; i < PRCMU_GIC_NUMBER_REGS     
115                 it = readl(PRCM_ARMITVAL31TO0     
116                 im = readl(PRCM_ARMITMSK31TO0     
117                 if (it & im)                      
118                         return true; /* There     
119         }                                         
120                                                   
121         return false;                             
122 }                                                 
123                                                   
124 /*                                                
125  * This function checks if the specified cpu i    
126  * makes sense only if the gic is decoupled wi    
127  * function. Of course passing smp_processor_i    
128  * always return false...                         
129  */                                               
130 bool prcmu_is_cpu_in_wfi(int cpu)                 
131 {                                                 
132         return readl(PRCM_ARM_WFI_STANDBY) &      
133                 (cpu ? PRCM_ARM_WFI_STANDBY_WF    
134 }                                                 
135                                                   
136 /*                                                
137  * This function copies the gic SPI settings t    
138  * monitor them and abort/finish the retention    
139  */                                               
140 int prcmu_copy_gic_settings(void)                 
141 {                                                 
142         u32 er; /* Enable register */             
143         int i;                                    
144                                                   
145         /* We skip the STI and PPI */             
146         for (i = 0; i < PRCMU_GIC_NUMBER_REGS     
147                 er = readl_relaxed(dist_base +    
148                                    GIC_DIST_EN    
149                 writel(er, PRCM_ARMITMSK31TO0     
150         }                                         
151                                                   
152         return 0;                                 
153 }                                                 
154                                                   
155 #ifdef CONFIG_SUSPEND                             
156 static int ux500_suspend_enter(suspend_state_t    
157 {                                                 
158         cpu_do_idle();                            
159         return 0;                                 
160 }                                                 
161                                                   
162 static int ux500_suspend_valid(suspend_state_t    
163 {                                                 
164         return state == PM_SUSPEND_MEM || stat    
165 }                                                 
166                                                   
167 static const struct platform_suspend_ops ux500    
168         .enter        = ux500_suspend_enter,      
169         .valid        = ux500_suspend_valid,      
170 };                                                
171 #define UX500_SUSPEND_OPS       (&ux500_suspen    
172 #else                                             
173 #define UX500_SUSPEND_OPS       NULL              
174 #endif                                            
175                                                   
176 void __init ux500_pm_init(u32 phy_base, u32 si    
177 {                                                 
178         struct device_node *np;                   
179                                                   
180         prcmu_base = ioremap(phy_base, size);     
181         if (!prcmu_base) {                        
182                 pr_err("could not remap PRCMU     
183                 return;                           
184         }                                         
185         np = of_find_compatible_node(NULL, NUL    
186         dist_base = of_iomap(np, 0);              
187         of_node_put(np);                          
188         if (!dist_base) {                         
189                 pr_err("could not remap GIC di    
190                 return;                           
191         }                                         
192                                                   
193         /*                                        
194          * On watchdog reboot the GIC is in so    
195          * This will make sure that the GIC is    
196          */                                       
197         prcmu_gic_recouple();                     
198                                                   
199         /* Set up ux500 suspend callbacks. */     
200         suspend_set_ops(UX500_SUSPEND_OPS);       
201 }                                                 
202                                                   

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