Advertisement
Guest User

datenritter

a guest
May 3rd, 2010
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 13.64 KB | None | 0 0
  1. Index: linux-2.6.32.12/arch/mips/bcm47xx/setup.c                                                      
  2. ===================================================================                                  
  3. --- linux-2.6.32.12.orig/arch/mips/bcm47xx/setup.c      2010-05-03 16:40:46.000000000 +0200          
  4. +++ linux-2.6.32.12/arch/mips/bcm47xx/setup.c   2010-05-03 19:49:50.000000000 +0200                  
  5. @@ -45,6 +45,8 @@                                                                                    
  6.  struct ssb_bus ssb_bcm47xx;                                                                          
  7.  EXPORT_SYMBOL(ssb_bcm47xx);                                                                          
  8.                                                                                                      
  9. +static struct ssb_sprom fallback_sprom;                                                              
  10. +                                                                                                    
  11.  extern void bcm47xx_pci_init(void);                                                                  
  12.                                                                                                      
  13.  static void bcm47xx_machine_restart(char *command)                                                  
  14. @@ -83,60 +85,86 @@                                                                                  
  15.         }                                                                                            
  16.  }                                                                                                    
  17.                                                                                                      
  18. -static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)                                              
  19. +static char *nvram_get_prefix(const char *entry, const char *prefix)                                
  20. +{                                                                                                    
  21. +       char key[51];                                                                                
  22. +                                                                                                    
  23. +       if (prefix) {                                                                                
  24. +               snprintf(key, sizeof(key), "%s%s", prefix, entry);                                    
  25. +                                                                                                    
  26. +               entry = key;                                                                          
  27. +       }                                                                                            
  28. +                                                                                                    
  29. +       return nvram_get(entry);                                                                      
  30. +}                                                                                                    
  31. +                                                                                                    
  32. +static void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)                          
  33.  {                                                                                                    
  34.         char *s;                                                                                      
  35.                                                                                                      
  36.         memset(sprom, 0xFF, sizeof(struct ssb_sprom));                                                
  37.                                                                                                      
  38. -       sprom->revision = 1;                                                                          
  39. -       if ((s = nvram_get("il0macaddr")))                                                            
  40. +       if ((s = nvram_get_prefix("sromrev", prefix)))                                                
  41. +               sprom->revision = simple_strtoul(s, NULL, 0);                                        
  42. +       else                                                                                          
  43. +               sprom->revision = 1;                                                                  
  44. +       if ((s = nvram_get_prefix("il0macaddr", prefix)))                                            
  45.                 e_aton(s, sprom->il0mac);                                                            
  46. -       if ((s = nvram_get("et0macaddr")))                                                            
  47. +       if ((s = nvram_get_prefix("et0macaddr", prefix)))                                            
  48.                 e_aton(s, sprom->et0mac);                                                            
  49. -       if ((s = nvram_get("et1macaddr")))                                                            
  50. +       if ((s = nvram_get_prefix("et1macaddr", prefix)))                                            
  51.                 e_aton(s, sprom->et1mac);                                                            
  52. -       if ((s = nvram_get("et0phyaddr")))                                                            
  53. +       if ((s = nvram_get_prefix("et0phyaddr", prefix)))                                            
  54.                 sprom->et0phyaddr = simple_strtoul(s, NULL, 0);                                      
  55. -       if ((s = nvram_get("et1phyaddr")))                                                            
  56. +       if ((s = nvram_get_prefix("et1phyaddr", prefix)))                                            
  57.                 sprom->et1phyaddr = simple_strtoul(s, NULL, 0);                                      
  58. -       if ((s = nvram_get("et0mdcport")))                                                            
  59. +       if ((s = nvram_get_prefix("et0mdcport", prefix)))                                            
  60.                 sprom->et0mdcport = !!simple_strtoul(s, NULL, 10);                                    
  61. -       if ((s = nvram_get("et1mdcport")))                                                            
  62. +       if ((s = nvram_get_prefix("et1mdcport", prefix)))                                            
  63.                 sprom->et1mdcport = !!simple_strtoul(s, NULL, 10);                                    
  64. -       if ((s = nvram_get("pa0b0")))                                                                
  65. +       if ((s = nvram_get_prefix("pa0b0", prefix)))                                                  
  66.                 sprom->pa0b0 = simple_strtoul(s, NULL, 0);                                            
  67. -       if ((s = nvram_get("pa0b1")))                                                                
  68. +       if ((s = nvram_get_prefix("pa0b1", prefix)))                                                  
  69.                 sprom->pa0b1 = simple_strtoul(s, NULL, 0);                                            
  70. -       if ((s = nvram_get("pa0b2")))                                                                
  71. +       if ((s = nvram_get_prefix("pa0b2", prefix)))                                                  
  72.                 sprom->pa0b2 = simple_strtoul(s, NULL, 0);                                            
  73. -       if ((s = nvram_get("pa1b0")))                                                                
  74. +       if ((s = nvram_get_prefix("pa1b0", prefix)))                                                  
  75.                 sprom->pa1b0 = simple_strtoul(s, NULL, 0);                                            
  76. -       if ((s = nvram_get("pa1b1")))                                                                
  77. +       if ((s = nvram_get_prefix("pa1b1", prefix)))                                                  
  78.                 sprom->pa1b1 = simple_strtoul(s, NULL, 0);                                            
  79. -       if ((s = nvram_get("pa1b2")))                                                                
  80. +       if ((s = nvram_get_prefix("pa1b2", prefix)))                                                  
  81.                 sprom->pa1b2 = simple_strtoul(s, NULL, 0);                                            
  82. -       if ((s = nvram_get("wl0gpio0")))                                                              
  83. +       if ((s = nvram_get_prefix("wl0gpio0", prefix)))                                              
  84.                 sprom->gpio0 = simple_strtoul(s, NULL, 0);                                            
  85. -       if ((s = nvram_get("wl0gpio1")))                                                              
  86. +       if ((s = nvram_get_prefix("wl0gpio1", prefix)))                                              
  87.                 sprom->gpio1 = simple_strtoul(s, NULL, 0);                                            
  88. -       if ((s = nvram_get("wl0gpio2")))                                                              
  89. +       if ((s = nvram_get_prefix("wl0gpio2", prefix)))                                              
  90.                 sprom->gpio2 = simple_strtoul(s, NULL, 0);                                            
  91. -       if ((s = nvram_get("wl0gpio3")))                                                              
  92. +       if ((s = nvram_get_prefix("wl0gpio3", prefix)))                                              
  93.                 sprom->gpio3 = simple_strtoul(s, NULL, 0);                                            
  94. -       if ((s = nvram_get("pa0maxpwr")))                                                            
  95. +       if ((s = nvram_get_prefix("pa0maxpwr", prefix)))                                              
  96.                 sprom->maxpwr_bg = simple_strtoul(s, NULL, 0);                                        
  97. -       if ((s = nvram_get("pa1maxpwr")))                                                            
  98. +       if ((s = nvram_get_prefix("pa1maxpwr", prefix)))                                              
  99.                 sprom->maxpwr_a = simple_strtoul(s, NULL, 0);                                        
  100. -       if ((s = nvram_get("pa0itssit")))                                                            
  101. +       if ((s = nvram_get_prefix("pa0itssit", prefix)))                                              
  102.                 sprom->itssi_bg = simple_strtoul(s, NULL, 0);                                        
  103. -       if ((s = nvram_get("pa1itssit")))                                                            
  104. +       if ((s = nvram_get_prefix("pa1itssit", prefix)))                                              
  105.                 sprom->itssi_a = simple_strtoul(s, NULL, 0);                                          
  106. +       if ((s = nvram_get_prefix("ccode", prefix)))                                                  
  107. +               sprom->country_code = simple_strtoul(s, NULL, 0);                                    
  108. +       if ((s = nvram_get_prefix("aa0", prefix)))                                                    
  109. +               sprom->ant_available_bg = simple_strtoul(s, NULL, 0);                                
  110. +       if ((s = nvram_get_prefix("aa1", prefix)))                                                    
  111. +               sprom->ant_available_a = simple_strtoul(s, NULL, 0);                                  
  112. +       if ((s = nvram_get_prefix("ag0", prefix)))                                                    
  113. +               sprom->antenna_gain.ghz24.a0 = simple_strtoul(s, NULL, 0);                            
  114. +       if ((s = nvram_get_prefix("ag1", prefix)))                                                    
  115. +               sprom->antenna_gain.ghz5.a0 = simple_strtoul(s, NULL, 0);                            
  116.         sprom->boardflags_lo = 0;                                                                    
  117. -       if ((s = nvram_get("boardflags")))                                                            
  118. +       if ((s = nvram_get_prefix("boardflags", prefix)))                                            
  119.                 sprom->boardflags_lo = simple_strtoul(s, NULL, 0);                                    
  120.         sprom->boardflags_hi = 0;                                                                    
  121. -       if ((s = nvram_get("boardflags2")))
  122. +       if ((s = nvram_get_prefix("boardflags2", prefix)))
  123.                 sprom->boardflags_hi = simple_strtoul(s, NULL, 0);
  124.  }
  125.  
  126. @@ -150,7 +178,7 @@
  127.         if ((s = nvram_get("boardrev")))
  128.                 iv->boardinfo.rev = (u16)simple_strtoul(s, NULL, 0);
  129.  
  130. -       bcm47xx_fill_sprom(&iv->sprom);
  131. +       bcm47xx_fill_sprom(&iv->sprom, NULL);
  132.  
  133.         if ((s = nvram_get("cardbus")))
  134.                 iv->has_cardbus_slot = !!simple_strtoul(s, NULL, 10);
  135. @@ -164,6 +192,10 @@
  136.         char *s;
  137.         struct ssb_mipscore *mcore;
  138.  
  139. +#ifdef CONFIG_SSB_PCIHOST
  140. +       const char *prefix;
  141. +#endif
  142. +
  143.         err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE, bcm47xx_get_invariants);
  144.         if (err) {
  145.                 const char *msg = "Failed to initialize SSB bus (err %d)\n";
  146. @@ -172,6 +204,18 @@
  147.         }
  148.         mcore = &ssb_bcm47xx.mipscore;
  149.  
  150. +#ifdef CONFIG_SSB_PCIHOST
  151. +       printk(KERN_INFO "Using fallback SPROM.\n");
  152. +
  153. +       prefix = "pci/1/1/";
  154. +       if (nvram_get_prefix("il0macaddr", prefix)) {
  155. +               bcm47xx_fill_sprom(&fallback_sprom, prefix);
  156. +
  157. +               if (ssb_arch_set_fallback_sprom(&fallback_sprom) < 0)
  158. +                               printk(KERN_ERR "failed to register fallback SPROM\n");
  159. +       }
  160. +#endif
  161. +
  162.         s = nvram_get("kernel_args");
  163.         if (s && !strncmp(s, "console=ttyS1", 13)) {
  164.                 struct ssb_serial_port port;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement