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

TOMOYO Linux Cross Reference
Linux/arch/mips/pci/pci-rc32434.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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/mips/pci/pci-rc32434.c (Version linux-6.12-rc7) and /arch/sparc/pci/pci-rc32434.c (Version linux-5.15.164)


** Warning: Cannot open xref database.

  1 /*                                                  1 
  2  *  BRIEF MODULE DESCRIPTION                      
  3  *     PCI initialization for IDT EB434 board     
  4  *                                                
  5  *  Copyright 2004 IDT Inc. (rischelp@idt.com)    
  6  *                                                
  7  *  This program is free software; you can red    
  8  *  under  the terms of  the GNU General  Publ    
  9  *  Free Software Foundation;  either version     
 10  *  option) any later version.                    
 11  *                                                
 12  *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' A    
 13  *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED     
 14  *  MERCHANTABILITY AND FITNESS FOR A PARTICUL    
 15  *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABL    
 16  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQU    
 17  *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITU    
 18  *  USE, DATA,  OR PROFITS; OR  BUSINESS INTER    
 19  *  ANY THEORY OF LIABILITY, WHETHER IN  CONTR    
 20  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISIN    
 21  *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSS    
 22  *                                                
 23  *  You should have received a copy of the  GN    
 24  *  with this program; if not, write  to the F    
 25  *  675 Mass Ave, Cambridge, MA 02139, USA.       
 26  */                                               
 27                                                   
 28 #include <linux/types.h>                          
 29 #include <linux/pci.h>                            
 30 #include <linux/kernel.h>                         
 31 #include <linux/init.h>                           
 32                                                   
 33 #include <asm/mach-rc32434/rc32434.h>             
 34 #include <asm/mach-rc32434/pci.h>                 
 35                                                   
 36 #define PCI_ACCESS_READ  0                        
 37 #define PCI_ACCESS_WRITE 1                        
 38                                                   
 39 /* define an unsigned array for the PCI regist    
 40 static unsigned int korina_cnfg_regs[25] = {      
 41         KORINA_CNFG1, KORINA_CNFG2, KORINA_CNF    
 42         KORINA_CNFG5, KORINA_CNFG6, KORINA_CNF    
 43         KORINA_CNFG9, KORINA_CNFG10, KORINA_CN    
 44         KORINA_CNFG13, KORINA_CNFG14, KORINA_C    
 45         KORINA_CNFG17, KORINA_CNFG18, KORINA_C    
 46         KORINA_CNFG21, KORINA_CNFG22, KORINA_C    
 47 };                                                
 48 static struct resource rc32434_res_pci_mem1;      
 49 static struct resource rc32434_res_pci_mem2;      
 50                                                   
 51 static struct resource rc32434_res_pci_mem1 =     
 52         .name = "PCI MEM1",                       
 53         .start = 0x50000000,                      
 54         .end = 0x5FFFFFFF,                        
 55         .flags = IORESOURCE_MEM,                  
 56         .sibling = NULL,                          
 57         .child = &rc32434_res_pci_mem2            
 58 };                                                
 59                                                   
 60 static struct resource rc32434_res_pci_mem2 =     
 61         .name = "PCI Mem2",                       
 62         .start = 0x60000000,                      
 63         .end = 0x6FFFFFFF,                        
 64         .flags = IORESOURCE_MEM,                  
 65         .parent = &rc32434_res_pci_mem1,          
 66         .sibling = NULL,                          
 67         .child = NULL                             
 68 };                                                
 69                                                   
 70 static struct resource rc32434_res_pci_io1 = {    
 71         .name = "PCI I/O1",                       
 72         .start = 0x18800000,                      
 73         .end = 0x188FFFFF,                        
 74         .flags = IORESOURCE_IO,                   
 75 };                                                
 76                                                   
 77 extern struct pci_ops rc32434_pci_ops;            
 78                                                   
 79 #define PCI_MEM1_START  PCI_ADDR_START            
 80 #define PCI_MEM1_END    (PCI_ADDR_START + CPUT    
 81 #define PCI_MEM2_START  (PCI_ADDR_START + CPUT    
 82 #define PCI_MEM2_END    (PCI_ADDR_START + (2 *    
 83 #define PCI_IO1_START   (PCI_ADDR_START + (2 *    
 84 #define PCI_IO1_END                               
 85         (PCI_ADDR_START + (2 * CPUTOPCI_MEM_WI    
 86 #define PCI_IO2_START                             
 87         (PCI_ADDR_START + (2 * CPUTOPCI_MEM_WI    
 88 #define PCI_IO2_END                               
 89         (PCI_ADDR_START + (2 * CPUTOPCI_MEM_WI    
 90                                                   
 91 struct pci_controller rc32434_controller2;        
 92                                                   
 93 struct pci_controller rc32434_controller = {      
 94         .pci_ops = &rc32434_pci_ops,              
 95         .mem_resource = &rc32434_res_pci_mem1,    
 96         .io_resource = &rc32434_res_pci_io1,      
 97         .mem_offset = 0,                          
 98         .io_offset = 0,                           
 99                                                   
100 };                                                
101                                                   
102 #ifdef __MIPSEB__                                 
103 #define PCI_ENDIAN_FLAG PCILBAC_sb_m              
104 #else                                             
105 #define PCI_ENDIAN_FLAG 0                         
106 #endif                                            
107                                                   
108 static int __init rc32434_pcibridge_init(void)    
109 {                                                 
110         unsigned int pcicvalue, pcicdata = 0;     
111         unsigned int dummyread, pcicntlval;       
112         int loopCount;                            
113         unsigned int pci_config_addr;             
114                                                   
115         pcicvalue = rc32434_pci->pcic;            
116         pcicvalue = (pcicvalue >> PCIM_SHFT) &    
117         if (!((pcicvalue == PCIM_H_EA) ||         
118               (pcicvalue == PCIM_H_IA_FIX) ||     
119               (pcicvalue == PCIM_H_IA_RR))) {     
120                 pr_err("PCI init error!!!\n");    
121                 /* Not in Host Mode, return ER    
122                 return -1;                        
123         }                                         
124         /* Enables the Idle Grant mode, Arbite    
125         pcicdata |= (PCI_CTL_IGM | PCI_CTL_EAP    
126         rc32434_pci->pcic = pcicdata;   /* Ena    
127         /* Zero out the PCI status & PCI Statu    
128         for (;;) {                                
129                 pcicdata = rc32434_pci->pcis;     
130                 if (!(pcicdata & PCI_STAT_RIP)    
131                         break;                    
132         }                                         
133                                                   
134         rc32434_pci->pcis = 0;                    
135         rc32434_pci->pcism = 0xFFFFFFFF;          
136         /* Zero out the PCI decoupled register    
137         rc32434_pci->pcidac = 0;        /*        
138                                          * dis    
139                                          * ini    
140                                          */       
141         rc32434_pci->pcidas = 0;        /* cle    
142         rc32434_pci->pcidasm = 0x0000007F;        
143         /* Mask PCI Messaging Interrupts */       
144         rc32434_pci_msg->pciiic = 0;              
145         rc32434_pci_msg->pciiim = 0xFFFFFFFF;     
146         rc32434_pci_msg->pciioic = 0;             
147         rc32434_pci_msg->pciioim = 0;             
148                                                   
149                                                   
150         /* Setup PCILB0 as Memory Window */       
151         rc32434_pci->pcilba[0].address = (unsi    
152                                                   
153         /* setup the PCI map address as same a    
154                                                   
155         rc32434_pci->pcilba[0].mapping = (unsi    
156                                                   
157                                                   
158         /* Setup PCILBA1 as MEM */                
159         rc32434_pci->pcilba[0].control =          
160             (((SIZE_256MB & 0x1f) << PCI_LBAC_    
161         dummyread = rc32434_pci->pcilba[0].con    
162         rc32434_pci->pcilba[1].address = 0x600    
163         rc32434_pci->pcilba[1].mapping = 0x600    
164                                                   
165         /* setup PCILBA2 as IO Window */          
166         rc32434_pci->pcilba[1].control =          
167             (((SIZE_256MB & 0x1f) << PCI_LBAC_    
168         dummyread = rc32434_pci->pcilba[1].con    
169         rc32434_pci->pcilba[2].address = 0x18C    
170         rc32434_pci->pcilba[2].mapping = 0x18F    
171                                                   
172         /* setup PCILBA2 as IO Window */          
173         rc32434_pci->pcilba[2].control =          
174             (((SIZE_4MB & 0x1f) << PCI_LBAC_SI    
175         dummyread = rc32434_pci->pcilba[2].con    
176                                                   
177         /* Setup PCILBA3 as IO Window */          
178         rc32434_pci->pcilba[3].address = 0x188    
179         rc32434_pci->pcilba[3].mapping = 0x188    
180         rc32434_pci->pcilba[3].control =          
181             ((((SIZE_1MB & 0x1ff) << PCI_LBAC_    
182              PCI_ENDIAN_FLAG);                    
183         dummyread = rc32434_pci->pcilba[3].con    
184                                                   
185         pci_config_addr = (unsigned int) (0x80    
186         for (loopCount = 0; loopCount < 24; lo    
187                 rc32434_pci->pcicfga = pci_con    
188                 dummyread = rc32434_pci->pcicf    
189                 rc32434_pci->pcicfgd = korina_    
190                 dummyread = rc32434_pci->pcicf    
191                 pci_config_addr += 4;             
192         }                                         
193         rc32434_pci->pcitc =                      
194             (unsigned int) ((PCITC_RTIMER_VAL     
195             ((PCITC_DTIMER_VAL & 0xff) << PCI_    
196                                                   
197         pcicntlval = rc32434_pci->pcic;           
198         pcicntlval &= ~PCI_CTL_TNR;               
199         rc32434_pci->pcic = pcicntlval;           
200         pcicntlval = rc32434_pci->pcic;           
201                                                   
202         return 0;                                 
203 }                                                 
204                                                   
205 static int __init rc32434_pci_init(void)          
206 {                                                 
207         void __iomem *io_map_base;                
208                                                   
209         pr_info("PCI: Initializing PCI\n");       
210                                                   
211         ioport_resource.start = rc32434_res_pc    
212         ioport_resource.end = rc32434_res_pci_    
213                                                   
214         rc32434_pcibridge_init();                 
215                                                   
216         io_map_base = ioremap(rc32434_res_pci_    
217                               resource_size(&r    
218                                                   
219         if (!io_map_base)                         
220                 return -ENOMEM;                   
221                                                   
222         rc32434_controller.io_map_base =          
223                 (unsigned long)io_map_base - r    
224                                                   
225         register_pci_controller(&rc32434_contr    
226         rc32434_sync();                           
227                                                   
228         return 0;                                 
229 }                                                 
230                                                   
231 arch_initcall(rc32434_pci_init);                  
232                                                   

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