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

TOMOYO Linux Cross Reference
Linux/arch/mips/bcm47xx/board.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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/bcm47xx/board.c (Version linux-6.11.5) and /arch/m68k/bcm47xx/board.c (Version linux-6.1.104)


** Warning: Cannot open xref database.

  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 #include <linux/errno.h>                          
  3 #include <linux/export.h>                         
  4 #include <linux/string.h>                         
  5 #include <bcm47xx.h>                              
  6 #include <bcm47xx_board.h>                        
  7                                                   
  8 struct bcm47xx_board_type {                       
  9         const enum bcm47xx_board board;           
 10         const char *name;                         
 11 };                                                
 12                                                   
 13 struct bcm47xx_board_type_list1 {                 
 14         struct bcm47xx_board_type board;          
 15         const char *value1;                       
 16 };                                                
 17                                                   
 18 struct bcm47xx_board_type_list2 {                 
 19         struct bcm47xx_board_type board;          
 20         const char *value1;                       
 21         const char *value2;                       
 22 };                                                
 23                                                   
 24 struct bcm47xx_board_type_list3 {                 
 25         struct bcm47xx_board_type board;          
 26         const char *value1;                       
 27         const char *value2;                       
 28         const char *value3;                       
 29 };                                                
 30                                                   
 31 struct bcm47xx_board_store {                      
 32         enum bcm47xx_board board;                 
 33         char name[BCM47XX_BOARD_MAX_NAME];        
 34 };                                                
 35                                                   
 36 /* model_name */                                  
 37 static const                                      
 38 struct bcm47xx_board_type_list1 bcm47xx_board_    
 39         {{BCM47XX_BOARD_DLINK_DIR130, "D-Link     
 40         {{BCM47XX_BOARD_DLINK_DIR330, "D-Link     
 41         { {0}, NULL},                             
 42 };                                                
 43                                                   
 44 /* hardware_version */                            
 45 static const                                      
 46 struct bcm47xx_board_type_list1 bcm47xx_board_    
 47         {{BCM47XX_BOARD_ASUS_RTN10U, "Asus RT-    
 48         {{BCM47XX_BOARD_ASUS_RTN10D, "Asus RT-    
 49         {{BCM47XX_BOARD_ASUS_RTN12, "Asus RT-N    
 50         {{BCM47XX_BOARD_ASUS_RTN12B1, "Asus RT    
 51         {{BCM47XX_BOARD_ASUS_RTN12C1, "Asus RT    
 52         {{BCM47XX_BOARD_ASUS_RTN12D1, "Asus RT    
 53         {{BCM47XX_BOARD_ASUS_RTN12HP, "Asus RT    
 54         {{BCM47XX_BOARD_ASUS_RTN16, "Asus RT-N    
 55         {{BCM47XX_BOARD_ASUS_WL320GE, "Asus WL    
 56         {{BCM47XX_BOARD_ASUS_WL330GE, "Asus WL    
 57         {{BCM47XX_BOARD_ASUS_WL500GD, "Asus WL    
 58         {{BCM47XX_BOARD_ASUS_WL500GPV1, "Asus     
 59         {{BCM47XX_BOARD_ASUS_WL500GPV2, "Asus     
 60         {{BCM47XX_BOARD_ASUS_WL500W, "Asus WL5    
 61         {{BCM47XX_BOARD_ASUS_WL520GC, "Asus WL    
 62         {{BCM47XX_BOARD_ASUS_WL520GU, "Asus WL    
 63         {{BCM47XX_BOARD_BELKIN_F7D3301, "Belki    
 64         {{BCM47XX_BOARD_BELKIN_F7D3302, "Belki    
 65         {{BCM47XX_BOARD_BELKIN_F7D4301, "Belki    
 66         {{BCM47XX_BOARD_BELKIN_F7D4302, "Belki    
 67         {{BCM47XX_BOARD_BELKIN_F7D4401, "Belki    
 68         { {0}, NULL},                             
 69 };                                                
 70                                                   
 71 /* hardware_version, boardnum */                  
 72 static const                                      
 73 struct bcm47xx_board_type_list2 bcm47xx_board_    
 74         {{BCM47XX_BOARD_MICROSOFT_MN700, "Micr    
 75         {{BCM47XX_BOARD_ASUS_WL500G, "Asus WL5    
 76         { {0}, NULL},                             
 77 };                                                
 78                                                   
 79 /* productid */                                   
 80 static const                                      
 81 struct bcm47xx_board_type_list1 bcm47xx_board_    
 82         {{BCM47XX_BOARD_ASUS_RTAC66U, "Asus RT    
 83         {{BCM47XX_BOARD_ASUS_RTN10, "Asus RT-N    
 84         {{BCM47XX_BOARD_ASUS_RTN10D, "Asus RT-    
 85         {{BCM47XX_BOARD_ASUS_RTN15U, "Asus RT-    
 86         {{BCM47XX_BOARD_ASUS_RTN16, "Asus RT-N    
 87         {{BCM47XX_BOARD_ASUS_RTN53, "Asus RT-N    
 88         {{BCM47XX_BOARD_ASUS_RTN66U, "Asus RT-    
 89         {{BCM47XX_BOARD_ASUS_WL300G, "Asus WL3    
 90         {{BCM47XX_BOARD_ASUS_WLHDD, "Asus WLHD    
 91         { {0}, NULL},                             
 92 };                                                
 93                                                   
 94 /* ModelId */                                     
 95 static const                                      
 96 struct bcm47xx_board_type_list1 bcm47xx_board_    
 97         {{BCM47XX_BOARD_DELL_TM2300, "Dell Tru    
 98         {{BCM47XX_BOARD_MOTOROLA_WE800G, "Moto    
 99         {{BCM47XX_BOARD_MOTOROLA_WR850GP, "Mot    
100         {{BCM47XX_BOARD_MOTOROLA_WR850GV2V3, "    
101         { {0}, NULL},                             
102 };                                                
103                                                   
104 /* melco_id or buf1falo_id */                     
105 static const                                      
106 struct bcm47xx_board_type_list1 bcm47xx_board_    
107         {{BCM47XX_BOARD_BUFFALO_WBR2_G54, "Buf    
108         {{BCM47XX_BOARD_BUFFALO_WHR2_A54G54, "    
109         {{BCM47XX_BOARD_BUFFALO_WHR_G125, "Buf    
110         {{BCM47XX_BOARD_BUFFALO_WHR_G54S, "Buf    
111         {{BCM47XX_BOARD_BUFFALO_WHR_HP_G54, "B    
112         {{BCM47XX_BOARD_BUFFALO_WLA2_G54L, "Bu    
113         {{BCM47XX_BOARD_BUFFALO_WZR_G300N, "Bu    
114         {{BCM47XX_BOARD_BUFFALO_WZR_RS_G54, "B    
115         {{BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP,     
116         { {0}, NULL},                             
117 };                                                
118                                                   
119 /* boot_hw_model, boot_hw_ver */                  
120 static const                                      
121 struct bcm47xx_board_type_list2 bcm47xx_board_    
122         /* like WRT160N v3.0 */                   
123         {{BCM47XX_BOARD_CISCO_M10V1, "Cisco M1    
124         /* like WRT310N v2.0 */                   
125         {{BCM47XX_BOARD_CISCO_M20V1, "Cisco M2    
126         {{BCM47XX_BOARD_LINKSYS_E900V1, "Links    
127         /* like WRT160N v3.0 */                   
128         {{BCM47XX_BOARD_LINKSYS_E1000V1, "Link    
129         {{BCM47XX_BOARD_LINKSYS_E1000V2, "Link    
130         {{BCM47XX_BOARD_LINKSYS_E1000V21, "Lin    
131         {{BCM47XX_BOARD_LINKSYS_E1200V2, "Link    
132         {{BCM47XX_BOARD_LINKSYS_E2000V1, "Link    
133         {{BCM47XX_BOARD_LINKSYS_E2500V3, "Link    
134         /* like WRT610N v2.0 */                   
135         {{BCM47XX_BOARD_LINKSYS_E3000V1, "Link    
136         {{BCM47XX_BOARD_LINKSYS_E3200V1, "Link    
137         {{BCM47XX_BOARD_LINKSYS_E4200V1, "Link    
138         {{BCM47XX_BOARD_LINKSYS_WRT150NV11, "L    
139         {{BCM47XX_BOARD_LINKSYS_WRT150NV1, "Li    
140         {{BCM47XX_BOARD_LINKSYS_WRT160NV1, "Li    
141         {{BCM47XX_BOARD_LINKSYS_WRT160NV3, "Li    
142         {{BCM47XX_BOARD_LINKSYS_WRT300NV11, "L    
143         {{BCM47XX_BOARD_LINKSYS_WRT310NV1, "Li    
144         {{BCM47XX_BOARD_LINKSYS_WRT310NV2, "Li    
145         {{BCM47XX_BOARD_LINKSYS_WRT320N_V1, "L    
146         {{BCM47XX_BOARD_LINKSYS_WRT54G3GV2, "L    
147         {{BCM47XX_BOARD_LINKSYS_WRT610NV1, "Li    
148         {{BCM47XX_BOARD_LINKSYS_WRT610NV2, "Li    
149         { {0}, NULL},                             
150 };                                                
151                                                   
152 /* board_id */                                    
153 static const                                      
154 struct bcm47xx_board_type_list1 bcm47xx_board_    
155         {{BCM47XX_BOARD_LUXUL_ABR_4400_V1, "Lu    
156         {{BCM47XX_BOARD_LUXUL_XAP_310_V1, "Lux    
157         {{BCM47XX_BOARD_LUXUL_XAP_1210_V1, "Lu    
158         {{BCM47XX_BOARD_LUXUL_XAP_1230_V1, "Lu    
159         {{BCM47XX_BOARD_LUXUL_XAP_1240_V1, "Lu    
160         {{BCM47XX_BOARD_LUXUL_XAP_1500_V1, "Lu    
161         {{BCM47XX_BOARD_LUXUL_XBR_4400_V1, "Lu    
162         {{BCM47XX_BOARD_LUXUL_XVW_P30_V1, "Lux    
163         {{BCM47XX_BOARD_LUXUL_XWR_600_V1, "Lux    
164         {{BCM47XX_BOARD_LUXUL_XWR_1750_V1, "Lu    
165         {{BCM47XX_BOARD_NETGEAR_R6200_V1, "Net    
166         {{BCM47XX_BOARD_NETGEAR_R6300_V1, "Net    
167         {{BCM47XX_BOARD_NETGEAR_WGR614V8, "Net    
168         {{BCM47XX_BOARD_NETGEAR_WGR614V9, "Net    
169         {{BCM47XX_BOARD_NETGEAR_WGR614_V10, "N    
170         {{BCM47XX_BOARD_NETGEAR_WN2500RP_V1, "    
171         {{BCM47XX_BOARD_NETGEAR_WN2500RP_V2, "    
172         {{BCM47XX_BOARD_NETGEAR_WNDR3300, "Net    
173         {{BCM47XX_BOARD_NETGEAR_WNDR3400V1, "N    
174         {{BCM47XX_BOARD_NETGEAR_WNDR3400V2, "N    
175         {{BCM47XX_BOARD_NETGEAR_WNDR3400_V3, "    
176         {{BCM47XX_BOARD_NETGEAR_WNDR3400VCNA,     
177         {{BCM47XX_BOARD_NETGEAR_WNDR3700V3, "N    
178         {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Net    
179         {{BCM47XX_BOARD_NETGEAR_WNDR4500V1, "N    
180         {{BCM47XX_BOARD_NETGEAR_WNDR4500V2, "N    
181         {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "N    
182         {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "N    
183         {{BCM47XX_BOARD_NETGEAR_WNR2000, "Netg    
184         {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Net    
185         {{BCM47XX_BOARD_NETGEAR_WNR3500L_V2, "    
186         {{BCM47XX_BOARD_NETGEAR_WNR3500U, "Net    
187         {{BCM47XX_BOARD_NETGEAR_WNR3500V2, "Ne    
188         {{BCM47XX_BOARD_NETGEAR_WNR3500V2VC, "    
189         {{BCM47XX_BOARD_NETGEAR_WNR834BV2, "Ne    
190         { {0}, NULL},                             
191 };                                                
192                                                   
193 /* boardtype, boardnum, boardrev */               
194 static const                                      
195 struct bcm47xx_board_type_list3 bcm47xx_board_    
196         {{BCM47XX_BOARD_HUAWEI_B593U_12, "Huaw    
197         {{BCM47XX_BOARD_HUAWEI_E970, "Huawei E    
198         {{BCM47XX_BOARD_PHICOMM_M1, "Phicomm M    
199         {{BCM47XX_BOARD_ZTE_H218N, "ZTE H218N"    
200         {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Net    
201         {{BCM47XX_BOARD_NETGEAR_WNR3500L_V2, "    
202         {{BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_01    
203         {{BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_04    
204         {{BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_07    
205         { {0}, NULL},                             
206 };                                                
207                                                   
208 /* boardtype, boardrev */                         
209 static const                                      
210 struct bcm47xx_board_type_list2 bcm47xx_board_    
211         {{BCM47XX_BOARD_SIEMENS_SE505V2, "Siem    
212         { {0}, NULL},                             
213 };                                                
214                                                   
215 /*                                                
216  * Some devices don't use any common NVRAM ent    
217  * have only one model specific variable.         
218  * They don't deserve own arrays, let's group     
219  */                                               
220 static const                                      
221 struct bcm47xx_board_type_list2 bcm47xx_board_    
222         {{BCM47XX_BOARD_ASUS_WL700GE, "Asus WL    
223         {{BCM47XX_BOARD_LINKSYS_WRT300N_V1, "L    
224         {{BCM47XX_BOARD_LINKSYS_WRT600N_V11, "    
225         {{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Li    
226         { {0}, NULL},                             
227 };                                                
228                                                   
229 static const                                      
230 struct bcm47xx_board_type bcm47xx_board_unknow    
231         {BCM47XX_BOARD_UNKNOWN, "Unknown Board    
232 };                                                
233                                                   
234 static struct bcm47xx_board_store bcm47xx_boar    
235                                                   
236 static __init const struct bcm47xx_board_type     
237 {                                                 
238         char buf1[30];                            
239         char buf2[30];                            
240         char buf3[30];                            
241         const struct bcm47xx_board_type_list1     
242         const struct bcm47xx_board_type_list2     
243         const struct bcm47xx_board_type_list3     
244                                                   
245         if (bcm47xx_nvram_getenv("model_name",    
246                 for (e1 = bcm47xx_board_list_m    
247                         if (!strcmp(buf1, e1->    
248                                 return &e1->bo    
249                 }                                 
250         }                                         
251                                                   
252         if (bcm47xx_nvram_getenv("hardware_ver    
253                 for (e1 = bcm47xx_board_list_h    
254                         if (strstarts(buf1, e1    
255                                 return &e1->bo    
256                 }                                 
257         }                                         
258                                                   
259         if (bcm47xx_nvram_getenv("hardware_ver    
260             bcm47xx_nvram_getenv("boardnum", b    
261                 for (e2 = bcm47xx_board_list_h    
262                         if (!strstarts(buf1, e    
263                             !strcmp(buf2, e2->    
264                                 return &e2->bo    
265                 }                                 
266         }                                         
267                                                   
268         if (bcm47xx_nvram_getenv("productid",     
269                 for (e1 = bcm47xx_board_list_p    
270                         if (!strcmp(buf1, e1->    
271                                 return &e1->bo    
272                 }                                 
273         }                                         
274                                                   
275         if (bcm47xx_nvram_getenv("ModelId", bu    
276                 for (e1 = bcm47xx_board_list_M    
277                         if (!strcmp(buf1, e1->    
278                                 return &e1->bo    
279                 }                                 
280         }                                         
281                                                   
282         if (bcm47xx_nvram_getenv("melco_id", b    
283             bcm47xx_nvram_getenv("buf1falo_id"    
284                 /* buffalo hardware, check id     
285                 for (e1 = bcm47xx_board_list_m    
286                         if (!strcmp(buf1, e1->    
287                                 return &e1->bo    
288                 }                                 
289         }                                         
290                                                   
291         if (bcm47xx_nvram_getenv("boot_hw_mode    
292             bcm47xx_nvram_getenv("boot_hw_ver"    
293                 for (e2 = bcm47xx_board_list_b    
294                         if (!strcmp(buf1, e2->    
295                             !strcmp(buf2, e2->    
296                                 return &e2->bo    
297                 }                                 
298         }                                         
299                                                   
300         if (bcm47xx_nvram_getenv("board_id", b    
301                 for (e1 = bcm47xx_board_list_b    
302                         if (!strcmp(buf1, e1->    
303                                 return &e1->bo    
304                 }                                 
305         }                                         
306                                                   
307         if (bcm47xx_nvram_getenv("boardtype",     
308             bcm47xx_nvram_getenv("boardnum", b    
309             bcm47xx_nvram_getenv("boardrev", b    
310                 for (e3 = bcm47xx_board_list_b    
311                         if (!strcmp(buf1, e3->    
312                             !strcmp(buf2, e3->    
313                             !strcmp(buf3, e3->    
314                                 return &e3->bo    
315                 }                                 
316         }                                         
317                                                   
318         if (bcm47xx_nvram_getenv("boardtype",     
319             bcm47xx_nvram_getenv("boardrev", b    
320             bcm47xx_nvram_getenv("boardnum", b    
321                 for (e2 = bcm47xx_board_list_b    
322                         if (!strcmp(buf1, e2->    
323                             !strcmp(buf2, e2->    
324                                 return &e2->bo    
325                 }                                 
326         }                                         
327                                                   
328         for (e2 = bcm47xx_board_list_key_value    
329                 if (bcm47xx_nvram_getenv(e2->v    
330                         if (!strcmp(buf1, e2->    
331                                 return &e2->bo    
332                 }                                 
333         }                                         
334                                                   
335         return bcm47xx_board_unknown;             
336 }                                                 
337                                                   
338 void __init bcm47xx_board_detect(void)            
339 {                                                 
340         int err;                                  
341         char buf[10];                             
342         const struct bcm47xx_board_type *board    
343                                                   
344         if (bcm47xx_board.board != BCM47XX_BOA    
345                 return;                           
346                                                   
347         /* check if the nvram is available */     
348         err = bcm47xx_nvram_getenv("boardtype"    
349                                                   
350         /* init of nvram failed, probably too     
351         if (err == -ENXIO)                        
352                 return;                           
353                                                   
354         board_detected = bcm47xx_board_get_nvr    
355         bcm47xx_board.board = board_detected->    
356         strscpy(bcm47xx_board.name, board_dete    
357                 BCM47XX_BOARD_MAX_NAME);          
358 }                                                 
359                                                   
360 enum bcm47xx_board bcm47xx_board_get(void)        
361 {                                                 
362         return bcm47xx_board.board;               
363 }                                                 
364 EXPORT_SYMBOL(bcm47xx_board_get);                 
365                                                   
366 const char *bcm47xx_board_get_name(void)          
367 {                                                 
368         return bcm47xx_board.name;                
369 }                                                 
370 EXPORT_SYMBOL(bcm47xx_board_get_name);            
371                                                   

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