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

TOMOYO Linux Cross Reference
Linux/arch/powerpc/sysdev/tsi108_dev.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/sysdev/tsi108_dev.c (Architecture ppc) and /arch/sparc/sysdev/tsi108_dev.c (Architecture sparc)


  1 // SPDX-License-Identifier: GPL-2.0-or-later        1 
  2 /*                                                
  3  * tsi108/109 device setup code                   
  4  *                                                
  5  * Maintained by Roy Zang < tie-fei.zang@frees    
  6  */                                               
  7                                                   
  8 #include <linux/stddef.h>                         
  9 #include <linux/kernel.h>                         
 10 #include <linux/init.h>                           
 11 #include <linux/errno.h>                          
 12 #include <linux/major.h>                          
 13 #include <linux/delay.h>                          
 14 #include <linux/irq.h>                            
 15 #include <linux/export.h>                         
 16 #include <linux/device.h>                         
 17 #include <linux/etherdevice.h>                    
 18 #include <linux/platform_device.h>                
 19 #include <linux/of_address.h>                     
 20 #include <linux/of_irq.h>                         
 21 #include <linux/of_net.h>                         
 22 #include <asm/tsi108.h>                           
 23                                                   
 24 #include <linux/atomic.h>                         
 25 #include <asm/io.h>                               
 26 #include <asm/irq.h>                              
 27 #include <mm/mmu_decl.h>                          
 28                                                   
 29 #undef DEBUG                                      
 30                                                   
 31 #ifdef DEBUG                                      
 32 #define DBG(fmt...) do { printk(fmt); } while(    
 33 #else                                             
 34 #define DBG(fmt...) do { } while(0)               
 35 #endif                                            
 36                                                   
 37 static phys_addr_t tsi108_csr_base = -1;          
 38                                                   
 39 phys_addr_t get_csrbase(void)                     
 40 {                                                 
 41         struct device_node *tsi;                  
 42                                                   
 43         if (tsi108_csr_base != -1)                
 44                 return tsi108_csr_base;           
 45                                                   
 46         tsi = of_find_node_by_type(NULL, "tsi-    
 47         if (tsi) {                                
 48                 struct resource res;              
 49                 of_address_to_resource(tsi, 0,    
 50                 tsi108_csr_base = res.start;      
 51                 of_node_put(tsi);                 
 52         }                                         
 53         return tsi108_csr_base;                   
 54 }                                                 
 55 EXPORT_SYMBOL(get_csrbase);                       
 56                                                   
 57 u32 get_vir_csrbase(void)                         
 58 {                                                 
 59         return (u32) (ioremap(get_csrbase(), 0    
 60 }                                                 
 61 EXPORT_SYMBOL(get_vir_csrbase);                   
 62                                                   
 63 static int __init tsi108_eth_of_init(void)        
 64 {                                                 
 65         struct device_node *np;                   
 66         unsigned int i = 0;                       
 67         struct platform_device *tsi_eth_dev;      
 68         struct resource res;                      
 69         int ret;                                  
 70                                                   
 71         for_each_compatible_node(np, "network"    
 72                 struct resource r[2];             
 73                 struct device_node *phy, *mdio    
 74                 hw_info tsi_eth_data;             
 75                 const unsigned int *phy_id;       
 76                 const phandle *ph;                
 77                                                   
 78                 memset(r, 0, sizeof(r));          
 79                 memset(&tsi_eth_data, 0, sizeo    
 80                                                   
 81                 ret = of_address_to_resource(n    
 82                 DBG("%s: name:start->end = %s:    
 83                     __func__, r[0].name, &r[0]    
 84                 if (ret)                          
 85                         goto err;                 
 86                                                   
 87                 r[1].name = "tx";                 
 88                 r[1].start = irq_of_parse_and_    
 89                 r[1].end = irq_of_parse_and_ma    
 90                 r[1].flags = IORESOURCE_IRQ;      
 91                 DBG("%s: name:start->end = %s:    
 92                         __func__, r[1].name, &    
 93                                                   
 94                 tsi_eth_dev =                     
 95                     platform_device_register_s    
 96                                                   
 97                                                   
 98                 if (IS_ERR(tsi_eth_dev)) {        
 99                         ret = PTR_ERR(tsi_eth_    
100                         goto err;                 
101                 }                                 
102                                                   
103                 of_get_mac_address(np, tsi_eth    
104                                                   
105                 ph = of_get_property(np, "mdio    
106                 mdio = of_find_node_by_phandle    
107                 ret = of_address_to_resource(m    
108                 of_node_put(mdio);                
109                 if (ret)                          
110                         goto unreg;               
111                                                   
112                 ph = of_get_property(np, "phy-    
113                 phy = of_find_node_by_phandle(    
114                                                   
115                 if (phy == NULL) {                
116                         ret = -ENODEV;            
117                         goto unreg;               
118                 }                                 
119                                                   
120                 phy_id = of_get_property(phy,     
121                                                   
122                 tsi_eth_data.regs = r[0].start    
123                 tsi_eth_data.phyregs = res.sta    
124                 tsi_eth_data.phy = *phy_id;       
125                 tsi_eth_data.irq_num = irq_of_    
126                                                   
127                 /* Some boards with the TSI108    
128                  * have a miswiring of the eth    
129                  * requires a workaround.  The    
130                  * "txc-rxc-delay-disable" pro    
131                  * workaround.  FIXME: Need to    
132                  * driver itself to phylib and    
133                  * name for the workaround fla    
134                  * do with the model of PHY in    
135                 if (of_property_read_bool(phy,    
136                         tsi_eth_data.phy_type     
137                 of_node_put(phy);                 
138                                                   
139                 ret =                             
140                     platform_device_add_data(t    
141                                              s    
142                 if (ret)                          
143                         goto unreg;               
144         }                                         
145         return 0;                                 
146 unreg:                                            
147         platform_device_unregister(tsi_eth_dev    
148 err:                                              
149         of_node_put(np);                          
150         return ret;                               
151 }                                                 
152                                                   
153 arch_initcall(tsi108_eth_of_init);                
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