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

TOMOYO Linux Cross Reference
Linux/arch/sparc/kernel/auxio_32.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/sparc/kernel/auxio_32.c (Architecture ppc) and /arch/m68k/kernel/auxio_32.c (Architecture m68k)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 /* auxio.c: Probing for the Sparc AUXIO regist    
  3  *                                                
  4  * Copyright (C) 1996 David S. Miller (davem@c    
  5  */                                               
  6                                                   
  7 #include <linux/stddef.h>                         
  8 #include <linux/init.h>                           
  9 #include <linux/spinlock.h>                       
 10 #include <linux/of.h>                             
 11 #include <linux/export.h>                         
 12                                                   
 13 #include <asm/oplib.h>                            
 14 #include <asm/io.h>                               
 15 #include <asm/auxio.h>                            
 16 #include <asm/string.h>         /* memset(), L    
 17 #include <asm/cpu_type.h>                         
 18                                                   
 19 #include "kernel.h"                               
 20                                                   
 21 /* Probe and map in the Auxiliary I/O register    
 22                                                   
 23 /* auxio_register is not static because it is     
 24  * in entry.S::floppy_tdone                       
 25  */                                               
 26 void __iomem *auxio_register = NULL;              
 27 static DEFINE_SPINLOCK(auxio_lock);               
 28                                                   
 29 void __init auxio_probe(void)                     
 30 {                                                 
 31         phandle node, auxio_nd;                   
 32         struct linux_prom_registers auxregs[1]    
 33         struct resource r;                        
 34                                                   
 35         switch (sparc_cpu_model) {                
 36         case sparc_leon:                          
 37         case sun4d:                               
 38                 return;                           
 39         default:                                  
 40                 break;                            
 41         }                                         
 42         node = prom_getchild(prom_root_node);     
 43         auxio_nd = prom_searchsiblings(node, "    
 44         if(!auxio_nd) {                           
 45                 node = prom_searchsiblings(nod    
 46                 node = prom_getchild(node);       
 47                 auxio_nd = prom_searchsiblings    
 48                 if(!auxio_nd) {                   
 49 #ifdef CONFIG_PCI                                 
 50                         /* There may be auxio     
 51                         return;                   
 52 #else                                             
 53                         if(prom_searchsiblings    
 54                                 /* VME chassis    
 55                                 return;           
 56                         }                         
 57                         prom_printf("Cannot fi    
 58                         prom_halt();              
 59 #endif                                            
 60                 }                                 
 61         }                                         
 62         if(prom_getproperty(auxio_nd, "reg", (    
 63                 return;                           
 64         prom_apply_obio_ranges(auxregs, 0x1);     
 65         /* Map the register both read and writ    
 66         r.flags = auxregs[0].which_io & 0xF;      
 67         r.start = auxregs[0].phys_addr;           
 68         r.end = auxregs[0].phys_addr + auxregs    
 69         auxio_register = of_ioremap(&r, 0, aux    
 70         /* Fix the address on sun4m. */           
 71         if ((((unsigned long) auxregs[0].phys_    
 72                 auxio_register += (3 - ((unsig    
 73                                                   
 74         set_auxio(AUXIO_LED, 0);                  
 75 }                                                 
 76                                                   
 77 unsigned char get_auxio(void)                     
 78 {                                                 
 79         if(auxio_register)                        
 80                 return sbus_readb(auxio_regist    
 81         return 0;                                 
 82 }                                                 
 83 EXPORT_SYMBOL(get_auxio);                         
 84                                                   
 85 void set_auxio(unsigned char bits_on, unsigned    
 86 {                                                 
 87         unsigned char regval;                     
 88         unsigned long flags;                      
 89         spin_lock_irqsave(&auxio_lock, flags);    
 90         switch (sparc_cpu_model) {                
 91         case sun4m:                               
 92                 if(!auxio_register)               
 93                         break;     /* VME chas    
 94                 regval = sbus_readb(auxio_regi    
 95                 sbus_writeb(((regval | bits_on    
 96                         auxio_register);          
 97                 break;                            
 98         case sun4d:                               
 99                 break;                            
100         default:                                  
101                 panic("Can't set AUXIO registe    
102         }                                         
103         spin_unlock_irqrestore(&auxio_lock, fl    
104 }                                                 
105 EXPORT_SYMBOL(set_auxio);                         
106                                                   
107 /* sun4m power control register (AUXIO2) */       
108                                                   
109 volatile u8 __iomem *auxio_power_register = NU    
110                                                   
111 void __init auxio_power_probe(void)               
112 {                                                 
113         struct linux_prom_registers regs;         
114         phandle node;                             
115         struct resource r;                        
116                                                   
117         /* Attempt to find the sun4m power con    
118         node = prom_getchild(prom_root_node);     
119         node = prom_searchsiblings(node, "obio    
120         node = prom_getchild(node);               
121         node = prom_searchsiblings(node, "powe    
122         if (node == 0 || (s32)node == -1)         
123                 return;                           
124                                                   
125         /* Map the power control register. */     
126         if (prom_getproperty(node, "reg", (cha    
127                 return;                           
128         prom_apply_obio_ranges(&regs, 1);         
129         memset(&r, 0, sizeof(r));                 
130         r.flags = regs.which_io & 0xF;            
131         r.start = regs.phys_addr;                 
132         r.end = regs.phys_addr + regs.reg_size    
133         auxio_power_register =                    
134                 (u8 __iomem *)of_ioremap(&r, 0    
135                                                   
136         /* Display a quick message on the cons    
137         if (auxio_power_register)                 
138                 printk(KERN_INFO "Power off co    
139 }                                                 
140                                                   

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