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

TOMOYO Linux Cross Reference
Linux/arch/mips/ralink/cevt-rt3352.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/mips/ralink/cevt-rt3352.c (Version linux-6.12-rc7) and /arch/sparc64/ralink/cevt-rt3352.c (Version linux-6.7.12)


  1 /*                                                  1 
  2  * This file is subject to the terms and condi    
  3  * License.  See the file "COPYING" in the mai    
  4  * for more details.                              
  5  *                                                
  6  * Copyright (C) 2013 by John Crispin <john@ph    
  7  */                                               
  8                                                   
  9 #include <linux/clockchips.h>                     
 10 #include <linux/clocksource.h>                    
 11 #include <linux/interrupt.h>                      
 12 #include <linux/reset.h>                          
 13 #include <linux/init.h>                           
 14 #include <linux/time.h>                           
 15 #include <linux/of.h>                             
 16 #include <linux/of_irq.h>                         
 17 #include <linux/of_address.h>                     
 18                                                   
 19 #include <asm/mach-ralink/ralink_regs.h>          
 20                                                   
 21 #define SYSTICK_FREQ            (50 * 1000)       
 22                                                   
 23 #define SYSTICK_CONFIG          0x00              
 24 #define SYSTICK_COMPARE         0x04              
 25 #define SYSTICK_COUNT           0x08              
 26                                                   
 27 /* route systick irq to mips irq 7 instead of     
 28 #define CFG_EXT_STK_EN          0x2               
 29 /* enable the counter */                          
 30 #define CFG_CNT_EN              0x1               
 31                                                   
 32 struct systick_device {                           
 33         void __iomem *membase;                    
 34         struct clock_event_device dev;            
 35         int irq_requested;                        
 36         int freq_scale;                           
 37 };                                                
 38                                                   
 39 static int systick_set_oneshot(struct clock_ev    
 40 static int systick_shutdown(struct clock_event    
 41                                                   
 42 static int systick_next_event(unsigned long de    
 43                                 struct clock_e    
 44 {                                                 
 45         struct systick_device *sdev;              
 46         u32 count;                                
 47                                                   
 48         sdev = container_of(evt, struct systic    
 49         count = ioread32(sdev->membase + SYSTI    
 50         count = (count + delta) % SYSTICK_FREQ    
 51         iowrite32(count, sdev->membase + SYSTI    
 52                                                   
 53         return 0;                                 
 54 }                                                 
 55                                                   
 56 static void systick_event_handler(struct clock    
 57 {                                                 
 58         /* noting to do here */                   
 59 }                                                 
 60                                                   
 61 static irqreturn_t systick_interrupt(int irq,     
 62 {                                                 
 63         struct clock_event_device *dev = (stru    
 64                                                   
 65         dev->event_handler(dev);                  
 66                                                   
 67         return IRQ_HANDLED;                       
 68 }                                                 
 69                                                   
 70 static struct systick_device systick = {          
 71         .dev = {                                  
 72                 /*                                
 73                  * cevt-r4k uses 300, make sur    
 74                  * gets used if available         
 75                  */                               
 76                 .rating                 = 310,    
 77                 .features               = CLOC    
 78                 .set_next_event         = syst    
 79                 .set_state_shutdown     = syst    
 80                 .set_state_oneshot      = syst    
 81                 .event_handler          = syst    
 82         },                                        
 83 };                                                
 84                                                   
 85 static int systick_shutdown(struct clock_event    
 86 {                                                 
 87         struct systick_device *sdev;              
 88                                                   
 89         sdev = container_of(evt, struct systic    
 90                                                   
 91         if (sdev->irq_requested)                  
 92                 free_irq(systick.dev.irq, &sys    
 93         sdev->irq_requested = 0;                  
 94         iowrite32(0, systick.membase + SYSTICK    
 95                                                   
 96         return 0;                                 
 97 }                                                 
 98                                                   
 99 static int systick_set_oneshot(struct clock_ev    
100 {                                                 
101         const char *name = systick.dev.name;      
102         struct systick_device *sdev;              
103         int irq = systick.dev.irq;                
104                                                   
105         sdev = container_of(evt, struct systic    
106                                                   
107         if (!sdev->irq_requested) {               
108                 if (request_irq(irq, systick_i    
109                                 IRQF_PERCPU |     
110                         pr_err("Failed to requ    
111         }                                         
112         sdev->irq_requested = 1;                  
113         iowrite32(CFG_EXT_STK_EN | CFG_CNT_EN,    
114                   systick.membase + SYSTICK_CO    
115                                                   
116         return 0;                                 
117 }                                                 
118                                                   
119 static int __init ralink_systick_init(struct d    
120 {                                                 
121         int ret;                                  
122                                                   
123         systick.membase = of_iomap(np, 0);        
124         if (!systick.membase)                     
125                 return -ENXIO;                    
126                                                   
127         systick.dev.name = np->name;              
128         clockevents_calc_mult_shift(&systick.d    
129         systick.dev.max_delta_ns = clockevent_    
130         systick.dev.max_delta_ticks = 0x7fff;     
131         systick.dev.min_delta_ns = clockevent_    
132         systick.dev.min_delta_ticks = 0x3;        
133         systick.dev.irq = irq_of_parse_and_map    
134         if (!systick.dev.irq) {                   
135                 pr_err("%pOFn: request_irq fai    
136                 return -EINVAL;                   
137         }                                         
138                                                   
139         ret = clocksource_mmio_init(systick.me    
140                                     SYSTICK_FR    
141                                     clocksourc    
142         if (ret)                                  
143                 return ret;                       
144                                                   
145         clockevents_register_device(&systick.d    
146                                                   
147         pr_info("%pOFn: running - mult: %d, sh    
148                         np, systick.dev.mult,     
149                                                   
150         return 0;                                 
151 }                                                 
152                                                   
153 TIMER_OF_DECLARE(systick, "ralink,cevt-systick    
154                                                   

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