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

TOMOYO Linux Cross Reference
Linux/arch/powerpc/boot/ugecon.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/powerpc/boot/ugecon.c (Version linux-6.12-rc7) and /arch/m68k/boot/ugecon.c (Version linux-6.1.116)


  1 // SPDX-License-Identifier: GPL-2.0-or-later        1 
  2 /*                                                
  3  * arch/powerpc/boot/ugecon.c                     
  4  *                                                
  5  * USB Gecko bootwrapper console.                 
  6  * Copyright (C) 2008-2009 The GameCube Linux     
  7  * Copyright (C) 2008,2009 Albert Herranz         
  8  */                                               
  9                                                   
 10 #include <stddef.h>                               
 11 #include "stdio.h"                                
 12 #include "types.h"                                
 13 #include "io.h"                                   
 14 #include "ops.h"                                  
 15                                                   
 16                                                   
 17 #define EXI_CLK_32MHZ           5                 
 18                                                   
 19 #define EXI_CSR                 0x00              
 20 #define   EXI_CSR_CLKMASK       (0x7<<4)          
 21 #define     EXI_CSR_CLK_32MHZ   (EXI_CLK_32MHZ    
 22 #define   EXI_CSR_CSMASK        (0x7<<7)          
 23 #define     EXI_CSR_CS_0        (0x1<<7)  /* C    
 24                                                   
 25 #define EXI_CR                  0x0c              
 26 #define   EXI_CR_TSTART         (1<<0)            
 27 #define   EXI_CR_WRITE          (1<<2)            
 28 #define   EXI_CR_READ_WRITE     (2<<2)            
 29 #define   EXI_CR_TLEN(len)      (((len)-1)<<4)    
 30                                                   
 31 #define EXI_DATA                0x10              
 32                                                   
 33                                                   
 34 /* virtual address base for input/output, retr    
 35 static void *ug_io_base;                          
 36                                                   
 37                                                   
 38 static u32 ug_io_transaction(u32 in)              
 39 {                                                 
 40         u32 *csr_reg = ug_io_base + EXI_CSR;      
 41         u32 *data_reg = ug_io_base + EXI_DATA;    
 42         u32 *cr_reg = ug_io_base + EXI_CR;        
 43         u32 csr, data, cr;                        
 44                                                   
 45         /* select */                              
 46         csr = EXI_CSR_CLK_32MHZ | EXI_CSR_CS_0    
 47         out_be32(csr_reg, csr);                   
 48                                                   
 49         /* read/write */                          
 50         data = in;                                
 51         out_be32(data_reg, data);                 
 52         cr = EXI_CR_TLEN(2) | EXI_CR_READ_WRIT    
 53         out_be32(cr_reg, cr);                     
 54                                                   
 55         while (in_be32(cr_reg) & EXI_CR_TSTART    
 56                 barrier();                        
 57                                                   
 58         /* deselect */                            
 59         out_be32(csr_reg, 0);                     
 60                                                   
 61         data = in_be32(data_reg);                 
 62         return data;                              
 63 }                                                 
 64                                                   
 65 static int ug_is_txfifo_ready(void)               
 66 {                                                 
 67         return ug_io_transaction(0xc0000000) &    
 68 }                                                 
 69                                                   
 70 static void ug_raw_putc(char ch)                  
 71 {                                                 
 72         ug_io_transaction(0xb0000000 | (ch <<     
 73 }                                                 
 74                                                   
 75 static void ug_putc(char ch)                      
 76 {                                                 
 77         int count = 16;                           
 78                                                   
 79         if (!ug_io_base)                          
 80                 return;                           
 81                                                   
 82         while (!ug_is_txfifo_ready() && count-    
 83                 barrier();                        
 84         if (count >= 0)                           
 85                 ug_raw_putc(ch);                  
 86 }                                                 
 87                                                   
 88 void ug_console_write(const char *buf, int len    
 89 {                                                 
 90         char *b = (char *)buf;                    
 91                                                   
 92         while (len--) {                           
 93                 if (*b == '\n')                   
 94                         ug_putc('\r');            
 95                 ug_putc(*b++);                    
 96         }                                         
 97 }                                                 
 98                                                   
 99 static int ug_is_adapter_present(void)            
100 {                                                 
101         if (!ug_io_base)                          
102                 return 0;                         
103         return ug_io_transaction(0x90000000) =    
104 }                                                 
105                                                   
106 static void *ug_grab_exi_io_base(void)            
107 {                                                 
108         u32 v;                                    
109         void *devp;                               
110                                                   
111         devp = find_node_by_compatible(NULL, "    
112         if (devp == NULL)                         
113                 goto err_out;                     
114         if (getprop(devp, "virtual-reg", &v, s    
115                 goto err_out;                     
116                                                   
117         return (void *)v;                         
118                                                   
119 err_out:                                          
120         return NULL;                              
121 }                                                 
122                                                   
123 void *ug_probe(void)                              
124 {                                                 
125         void *exi_io_base;                        
126         int i;                                    
127                                                   
128         exi_io_base = ug_grab_exi_io_base();      
129         if (!exi_io_base)                         
130                 return NULL;                      
131                                                   
132         /* look for a usbgecko on memcard slot    
133         for (i = 0; i < 2; i++) {                 
134                 ug_io_base = exi_io_base + 0x1    
135                 if (ug_is_adapter_present())      
136                         break;                    
137         }                                         
138         if (i == 2)                               
139                 ug_io_base = NULL;                
140         return ug_io_base;                        
141 }                                                 
142                                                   
143                                                   

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