910-fallback-sprom.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. --- a/driver/bcmsrom.c
  2. +++ b/driver/bcmsrom.c
  3. @@ -39,6 +39,11 @@
  4. #include <sbsdpcmdev.h>
  5. #endif
  6. +#if defined(CONFIG_SSB_PCIHOST) && defined(CONFIG_BOARD_BCM963XX)
  7. +#include <linux/ssb/ssb.h>
  8. +extern int bcm63xx_get_fallback_sprom(uint pci_bus, uint pci_slot, struct ssb_sprom *out);
  9. +#endif
  10. +
  11. #ifdef WLTEST
  12. #include <sbsprom.h>
  13. #endif /* WLTEST */
  14. @@ -2120,6 +2125,63 @@ BCMATTACHFN(initvars_srom_pci)(si_t *sih
  15. goto varscont;
  16. }
  17. +#if defined(CONFIG_SSB_PCIHOST) && defined(CONFIG_BOARD_BCM963XX)
  18. + base = vp = MALLOC(osh, MAXSZ_NVRAM_VARS);
  19. +
  20. + if( base != NULL )
  21. + {
  22. + char eabuf[18];
  23. + struct ssb_sprom bcm63xx_sprom;
  24. + uint pci_bus = osl_pci_bus(osh), pci_slot = osl_pci_slot(osh);
  25. +
  26. + bcm63xx_get_fallback_sprom(pci_bus, pci_slot, &bcm63xx_sprom);
  27. + printk("BCM%X(%02x:%02x) using sprom version %i\n", sih->chip, pci_bus, pci_slot, bcm63xx_sprom.revision);
  28. +
  29. + varbuf_init(&b, base, MAXSZ_NVRAM_VARS);
  30. +
  31. + varbuf_append(&b, vstr_sromrev, bcm63xx_sprom.revision);
  32. + varbuf_append(&b, vstr_boardrev, bcm63xx_sprom.board_rev);
  33. +
  34. + /* ToDo: map bcm63xx_sprom.country_code */
  35. + varbuf_append(&b, vstr_noccode);
  36. +
  37. + varbuf_append(&b, vstr_aa2g, bcm63xx_sprom.ant_available_bg);
  38. +
  39. + varbuf_append(&b, vstr_pa0b[0], bcm63xx_sprom.pa0b0);
  40. + varbuf_append(&b, vstr_pa1b[0], bcm63xx_sprom.pa1b0);
  41. + varbuf_append(&b, vstr_pa0b[1], bcm63xx_sprom.pa0b1);
  42. + varbuf_append(&b, vstr_pa1b[1], bcm63xx_sprom.pa1b1);
  43. + varbuf_append(&b, vstr_pa0b[2], bcm63xx_sprom.pa0b2);
  44. + varbuf_append(&b, vstr_pa1b[2], bcm63xx_sprom.pa1b2);
  45. +
  46. + varbuf_append(&b, vstr_pa0maxpwr, bcm63xx_sprom.maxpwr_bg);
  47. + varbuf_append(&b, vstr_pa0itssit, bcm63xx_sprom.itssi_bg);
  48. +
  49. + varbuf_append(&b, vstr_boardflags, (bcm63xx_sprom.boardflags_hi << 16) | bcm63xx_sprom.boardflags_lo);
  50. + varbuf_append(&b, vstr_boardflags2, (bcm63xx_sprom.boardflags2_hi << 16) | bcm63xx_sprom.boardflags2_lo);
  51. +
  52. + snprintf(eabuf, sizeof(eabuf), "%02x:%02x:%02x:%02x:%02x:%02x",
  53. + bcm63xx_sprom.il0mac[0], bcm63xx_sprom.il0mac[1], bcm63xx_sprom.il0mac[2],
  54. + bcm63xx_sprom.il0mac[3], bcm63xx_sprom.il0mac[4], bcm63xx_sprom.il0mac[5]
  55. + );
  56. +
  57. + varbuf_append(&b, vstr_macaddr, eabuf);
  58. +
  59. + /* final nullbyte terminator */
  60. + ASSERT(b.size >= 1);
  61. + vp = b.buf;
  62. + *vp++ = '\0';
  63. +
  64. + ASSERT((vp - base) <= MAXSZ_NVRAM_VARS);
  65. + goto varsdone;
  66. + }
  67. + else
  68. + {
  69. + err = -2;
  70. + goto errout;
  71. + }
  72. +#endif
  73. +
  74. BS_ERROR(("SROM CRC Error\n"));
  75. #if defined(WLTEST)