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

TOMOYO Linux Cross Reference
Linux/arch/mips/kernel/irq_txx9.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/kernel/irq_txx9.c (Architecture mips) and /arch/i386/kernel/irq_txx9.c (Architecture i386)


  1 /*                                                  1 
  2  * Based on linux/arch/mips/jmr3927/rbhma3100/    
  3  *          linux/arch/mips/tx4927/common/tx49    
  4  *          linux/arch/mips/tx4938/common/irq.    
  5  *                                                
  6  * Copyright 2001, 2003-2005 MontaVista Softwa    
  7  * Author: MontaVista Software, Inc.              
  8  *         ahennessy@mvista.com                   
  9  *         source@mvista.com                      
 10  * Copyright (C) 2000-2001 Toshiba Corporation    
 11  *                                                
 12  * This file is subject to the terms and condi    
 13  * License.  See the file "COPYING" in the mai    
 14  * for more details.                              
 15  */                                               
 16 #include <linux/init.h>                           
 17 #include <linux/interrupt.h>                      
 18 #include <linux/types.h>                          
 19 #include <linux/irq.h>                            
 20 #include <asm/txx9irq.h>                          
 21                                                   
 22 struct txx9_irc_reg {                             
 23         u32 cer;                                  
 24         u32 cr[2];                                
 25         u32 unused0;                              
 26         u32 ilr[8];                               
 27         u32 unused1[4];                           
 28         u32 imr;                                  
 29         u32 unused2[7];                           
 30         u32 scr;                                  
 31         u32 unused3[7];                           
 32         u32 ssr;                                  
 33         u32 unused4[7];                           
 34         u32 csr;                                  
 35 };                                                
 36                                                   
 37 /* IRCER : Int. Control Enable */                 
 38 #define TXx9_IRCER_ICE  0x00000001                
 39                                                   
 40 /* IRCR : Int. Control */                         
 41 #define TXx9_IRCR_LOW   0x00000000                
 42 #define TXx9_IRCR_HIGH  0x00000001                
 43 #define TXx9_IRCR_DOWN  0x00000002                
 44 #define TXx9_IRCR_UP    0x00000003                
 45 #define TXx9_IRCR_EDGE(cr)      ((cr) & 0x0000    
 46                                                   
 47 /* IRSCR : Int. Status Control */                 
 48 #define TXx9_IRSCR_EIClrE       0x00000100        
 49 #define TXx9_IRSCR_EIClr_MASK   0x0000000f        
 50                                                   
 51 /* IRCSR : Int. Current Status */                 
 52 #define TXx9_IRCSR_IF   0x00010000                
 53 #define TXx9_IRCSR_ILV_MASK     0x00000700        
 54 #define TXx9_IRCSR_IVL_MASK     0x0000001f        
 55                                                   
 56 #define irc_dlevel      0                         
 57 #define irc_elevel      1                         
 58                                                   
 59 static struct txx9_irc_reg __iomem *txx9_ircpt    
 60                                                   
 61 static struct {                                   
 62         unsigned char level;                      
 63         unsigned char mode;                       
 64 } txx9irq[TXx9_MAX_IR] __read_mostly;             
 65                                                   
 66 static void txx9_irq_unmask(struct irq_data *d    
 67 {                                                 
 68         unsigned int irq_nr = d->irq - TXX9_IR    
 69         u32 __iomem *ilrp = &txx9_ircptr->ilr[    
 70         int ofs = irq_nr / 16 * 16 + (irq_nr &    
 71                                                   
 72         __raw_writel((__raw_readl(ilrp) & ~(0x    
 73                      | (txx9irq[irq_nr].level     
 74                      ilrp);                       
 75 }                                                 
 76                                                   
 77 static inline void txx9_irq_mask(struct irq_da    
 78 {                                                 
 79         unsigned int irq_nr = d->irq - TXX9_IR    
 80         u32 __iomem *ilrp = &txx9_ircptr->ilr[    
 81         int ofs = irq_nr / 16 * 16 + (irq_nr &    
 82                                                   
 83         __raw_writel((__raw_readl(ilrp) & ~(0x    
 84                      | (irc_dlevel << ofs),       
 85                      ilrp);                       
 86         mmiowb();                                 
 87 }                                                 
 88                                                   
 89 static void txx9_irq_mask_ack(struct irq_data     
 90 {                                                 
 91         unsigned int irq_nr = d->irq - TXX9_IR    
 92                                                   
 93         txx9_irq_mask(d);                         
 94         /* clear edge detection */                
 95         if (unlikely(TXx9_IRCR_EDGE(txx9irq[ir    
 96                 __raw_writel(TXx9_IRSCR_EIClrE    
 97 }                                                 
 98                                                   
 99 static int txx9_irq_set_type(struct irq_data *    
100 {                                                 
101         unsigned int irq_nr = d->irq - TXX9_IR    
102         u32 cr;                                   
103         u32 __iomem *crp;                         
104         int ofs;                                  
105         int mode;                                 
106                                                   
107         if (flow_type & IRQF_TRIGGER_PROBE)       
108                 return 0;                         
109         switch (flow_type & IRQF_TRIGGER_MASK)    
110         case IRQF_TRIGGER_RISING:       mode =    
111         case IRQF_TRIGGER_FALLING:      mode =    
112         case IRQF_TRIGGER_HIGH: mode = TXx9_IR    
113         case IRQF_TRIGGER_LOW:  mode = TXx9_IR    
114         default:                                  
115                 return -EINVAL;                   
116         }                                         
117         crp = &txx9_ircptr->cr[(unsigned int)i    
118         cr = __raw_readl(crp);                    
119         ofs = (irq_nr & (8 - 1)) * 2;             
120         cr &= ~(0x3 << ofs);                      
121         cr |= (mode & 0x3) << ofs;                
122         __raw_writel(cr, crp);                    
123         txx9irq[irq_nr].mode = mode;              
124         return 0;                                 
125 }                                                 
126                                                   
127 static struct irq_chip txx9_irq_chip = {          
128         .name           = "TXX9",                 
129         .irq_ack        = txx9_irq_mask_ack,      
130         .irq_mask       = txx9_irq_mask,          
131         .irq_mask_ack   = txx9_irq_mask_ack,      
132         .irq_unmask     = txx9_irq_unmask,        
133         .irq_set_type   = txx9_irq_set_type,      
134 };                                                
135                                                   
136 void __init txx9_irq_init(unsigned long basead    
137 {                                                 
138         int i;                                    
139                                                   
140         txx9_ircptr = ioremap(baseaddr, sizeof    
141         for (i = 0; i < TXx9_MAX_IR; i++) {       
142                 txx9irq[i].level = 4; /* middl    
143                 txx9irq[i].mode = TXx9_IRCR_LO    
144                 irq_set_chip_and_handler(TXX9_    
145                                          handl    
146         }                                         
147                                                   
148         /* mask all IRC interrupts */             
149         __raw_writel(0, &txx9_ircptr->imr);       
150         for (i = 0; i < 8; i++)                   
151                 __raw_writel(0, &txx9_ircptr->    
152         /* setup IRC interrupt mode (Low Activ    
153         for (i = 0; i < 2; i++)                   
154                 __raw_writel(0, &txx9_ircptr->    
155         /* enable interrupt control */            
156         __raw_writel(TXx9_IRCER_ICE, &txx9_irc    
157         __raw_writel(irc_elevel, &txx9_ircptr-    
158 }                                                 
159                                                   
160 int __init txx9_irq_set_pri(int irc_irq, int n    
161 {                                                 
162         int old_pri;                              
163                                                   
164         if ((unsigned int)irc_irq >= TXx9_MAX_    
165                 return 0;                         
166         old_pri = txx9irq[irc_irq].level;         
167         txx9irq[irc_irq].level = new_pri;         
168         return old_pri;                           
169 }                                                 
170                                                   
171 int txx9_irq(void)                                
172 {                                                 
173         u32 csr = __raw_readl(&txx9_ircptr->cs    
174                                                   
175         if (likely(!(csr & TXx9_IRCSR_IF)))       
176                 return TXX9_IRQ_BASE + (csr &     
177         return -1;                                
178 }                                                 
179                                                   

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