aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/brcm80211/util/bcmsrom.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/brcm80211/util/bcmsrom.c')
-rw-r--r--drivers/staging/brcm80211/util/bcmsrom.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/staging/brcm80211/util/bcmsrom.c b/drivers/staging/brcm80211/util/bcmsrom.c
index 842b70ac411..73e48a650d8 100644
--- a/drivers/staging/brcm80211/util/bcmsrom.c
+++ b/drivers/staging/brcm80211/util/bcmsrom.c
@@ -70,7 +70,7 @@ extern uint _varsz;
70 70
71static int initvars_srom_si(si_t *sih, osl_t *osh, void *curmap, char **vars, 71static int initvars_srom_si(si_t *sih, osl_t *osh, void *curmap, char **vars,
72 uint *count); 72 uint *count);
73static void _initvars_srom_pci(u8 sromrev, uint16 *srom, uint off, 73static void _initvars_srom_pci(u8 sromrev, u16 *srom, uint off,
74 varbuf_t *b); 74 varbuf_t *b);
75static int initvars_srom_pci(si_t *sih, void *curmap, char **vars, 75static int initvars_srom_pci(si_t *sih, void *curmap, char **vars,
76 uint *count); 76 uint *count);
@@ -78,15 +78,15 @@ static int initvars_flash_si(si_t *sih, char **vars, uint *count);
78#ifdef BCMSDIO 78#ifdef BCMSDIO
79static int initvars_cis_sdio(osl_t *osh, char **vars, uint *count); 79static int initvars_cis_sdio(osl_t *osh, char **vars, uint *count);
80static int sprom_cmd_sdio(osl_t *osh, u8 cmd); 80static int sprom_cmd_sdio(osl_t *osh, u8 cmd);
81static int sprom_read_sdio(osl_t *osh, uint16 addr, uint16 *data); 81static int sprom_read_sdio(osl_t *osh, u16 addr, u16 *data);
82#endif /* BCMSDIO */ 82#endif /* BCMSDIO */
83static int sprom_read_pci(osl_t *osh, si_t *sih, uint16 *sprom, uint wordoff, 83static int sprom_read_pci(osl_t *osh, si_t *sih, u16 *sprom, uint wordoff,
84 uint16 *buf, uint nwords, bool check_crc); 84 u16 *buf, uint nwords, bool check_crc);
85#if defined(BCMNVRAMR) 85#if defined(BCMNVRAMR)
86static int otp_read_pci(osl_t *osh, si_t *sih, uint16 *buf, uint bufsz); 86static int otp_read_pci(osl_t *osh, si_t *sih, u16 *buf, uint bufsz);
87#endif 87#endif
88static uint16 srom_cc_cmd(si_t *sih, osl_t *osh, void *ccregs, uint32 cmd, 88static u16 srom_cc_cmd(si_t *sih, osl_t *osh, void *ccregs, uint32 cmd,
89 uint wordoff, uint16 data); 89 uint wordoff, u16 data);
90 90
91static int initvars_table(osl_t *osh, char *start, char *end, char **vars, 91static int initvars_table(osl_t *osh, char *start, char *end, char **vars,
92 uint *count); 92 uint *count);
@@ -197,7 +197,7 @@ BCMATTACHFN(srom_var_init) (si_t *sih, uint bustype, void *curmap, osl_t *osh,
197/* support only 16-bit word read from srom */ 197/* support only 16-bit word read from srom */
198int 198int
199srom_read(si_t *sih, uint bustype, void *curmap, osl_t *osh, 199srom_read(si_t *sih, uint bustype, void *curmap, osl_t *osh,
200 uint byteoff, uint nbytes, uint16 *buf, bool check_crc) 200 uint byteoff, uint nbytes, u16 *buf, bool check_crc)
201{ 201{
202 uint off, nw; 202 uint off, nw;
203#ifdef BCMSDIO 203#ifdef BCMSDIO
@@ -218,9 +218,9 @@ srom_read(si_t *sih, uint bustype, void *curmap, osl_t *osh,
218 return 1; 218 return 1;
219 219
220 if (si_is_sprom_available(sih)) { 220 if (si_is_sprom_available(sih)) {
221 uint16 *srom; 221 u16 *srom;
222 222
223 srom = (uint16 *) SROM_OFFSET(sih); 223 srom = (u16 *) SROM_OFFSET(sih);
224 if (srom == NULL) 224 if (srom == NULL)
225 return 1; 225 return 1;
226 226
@@ -240,7 +240,7 @@ srom_read(si_t *sih, uint bustype, void *curmap, osl_t *osh,
240 nw = nbytes / 2; 240 nw = nbytes / 2;
241 for (i = 0; i < nw; i++) { 241 for (i = 0; i < nw; i++) {
242 if (sprom_read_sdio 242 if (sprom_read_sdio
243 (osh, (uint16) (off + i), (uint16 *) (buf + i))) 243 (osh, (u16) (off + i), (u16 *) (buf + i)))
244 return 1; 244 return 1;
245 } 245 }
246#endif /* BCMSDIO */ 246#endif /* BCMSDIO */
@@ -1014,7 +1014,7 @@ BCMATTACHFN(srom_parsecis) (osl_t *osh, u8 *pcis[], uint ciscnt,
1014 break; 1014 break;
1015 1015
1016 case HNBU_FEM:{ 1016 case HNBU_FEM:{
1017 uint16 fem = 1017 u16 fem =
1018 (cis[i + 2] << 8) + cis[i + 1018 (cis[i + 2] << 8) + cis[i +
1019 1]; 1019 1];
1020 varbuf_append(&b, 1020 varbuf_append(&b,
@@ -1336,7 +1336,7 @@ BCMATTACHFN(srom_parsecis) (osl_t *osh, u8 *pcis[], uint ciscnt,
1336#if defined(BCMSDIO) 1336#if defined(BCMSDIO)
1337 case HNBU_SROM3SWRGN: 1337 case HNBU_SROM3SWRGN:
1338 if (tlen >= 73) { 1338 if (tlen >= 73) {
1339 uint16 srom[35]; 1339 u16 srom[35];
1340 u8 srev = cis[i + 1 + 70]; 1340 u8 srev = cis[i + 1 + 70];
1341 ASSERT(srev == 3); 1341 ASSERT(srev == 3);
1342 /* make tuple value 16-bit aligned and parse it */ 1342 /* make tuple value 16-bit aligned and parse it */
@@ -1412,9 +1412,9 @@ BCMATTACHFN(srom_parsecis) (osl_t *osh, u8 *pcis[], uint ciscnt,
1412/* In chips with chipcommon rev 32 and later, the srom is in chipcommon, 1412/* In chips with chipcommon rev 32 and later, the srom is in chipcommon,
1413 * not in the bus cores. 1413 * not in the bus cores.
1414 */ 1414 */
1415static uint16 1415static u16
1416srom_cc_cmd(si_t *sih, osl_t *osh, void *ccregs, uint32 cmd, uint wordoff, 1416srom_cc_cmd(si_t *sih, osl_t *osh, void *ccregs, uint32 cmd, uint wordoff,
1417 uint16 data) 1417 u16 data)
1418{ 1418{
1419 chipcregs_t *cc = (chipcregs_t *) ccregs; 1419 chipcregs_t *cc = (chipcregs_t *) ccregs;
1420 uint wait_cnt = 1000; 1420 uint wait_cnt = 1000;
@@ -1437,7 +1437,7 @@ srom_cc_cmd(si_t *sih, osl_t *osh, void *ccregs, uint32 cmd, uint wordoff,
1437 return 0xffff; 1437 return 0xffff;
1438 } 1438 }
1439 if (cmd == SRC_OP_READ) 1439 if (cmd == SRC_OP_READ)
1440 return (uint16) R_REG(osh, &cc->sromdata); 1440 return (u16) R_REG(osh, &cc->sromdata);
1441 else 1441 else
1442 return 0xffff; 1442 return 0xffff;
1443} 1443}
@@ -1447,8 +1447,8 @@ srom_cc_cmd(si_t *sih, osl_t *osh, void *ccregs, uint32 cmd, uint wordoff,
1447 * Return 0 on success, nonzero on error. 1447 * Return 0 on success, nonzero on error.
1448 */ 1448 */
1449static int 1449static int
1450sprom_read_pci(osl_t *osh, si_t *sih, uint16 *sprom, uint wordoff, 1450sprom_read_pci(osl_t *osh, si_t *sih, u16 *sprom, uint wordoff,
1451 uint16 *buf, uint nwords, bool check_crc) 1451 u16 *buf, uint nwords, bool check_crc)
1452{ 1452{
1453 int err = 0; 1453 int err = 0;
1454 uint i; 1454 uint i;
@@ -1507,7 +1507,7 @@ sprom_read_pci(osl_t *osh, si_t *sih, uint16 *sprom, uint wordoff,
1507} 1507}
1508 1508
1509#if defined(BCMNVRAMR) 1509#if defined(BCMNVRAMR)
1510static int otp_read_pci(osl_t *osh, si_t *sih, uint16 *buf, uint bufsz) 1510static int otp_read_pci(osl_t *osh, si_t *sih, u16 *buf, uint bufsz)
1511{ 1511{
1512 u8 *otp; 1512 u8 *otp;
1513 uint sz = OTP_SZ_MAX / 2; /* size in words */ 1513 uint sz = OTP_SZ_MAX / 2; /* size in words */
@@ -1522,7 +1522,7 @@ static int otp_read_pci(osl_t *osh, si_t *sih, uint16 *buf, uint bufsz)
1522 1522
1523 bzero(otp, OTP_SZ_MAX); 1523 bzero(otp, OTP_SZ_MAX);
1524 1524
1525 err = otp_read_region(sih, OTP_HW_RGN, (uint16 *) otp, &sz); 1525 err = otp_read_region(sih, OTP_HW_RGN, (u16 *) otp, &sz);
1526 1526
1527 bcopy(otp, buf, bufsz); 1527 bcopy(otp, buf, bufsz);
1528 1528
@@ -1673,7 +1673,7 @@ BCMATTACHFN(initvars_flash_si) (si_t *sih, char **vars, uint *count)
1673 * SROM3_SWRG_OFF (full SROM or software region). 1673 * SROM3_SWRG_OFF (full SROM or software region).
1674 */ 1674 */
1675 1675
1676static uint mask_shift(uint16 mask) 1676static uint mask_shift(u16 mask)
1677{ 1677{
1678 uint i; 1678 uint i;
1679 for (i = 0; i < (sizeof(mask) << 3); i++) { 1679 for (i = 0; i < (sizeof(mask) << 3); i++) {
@@ -1684,7 +1684,7 @@ static uint mask_shift(uint16 mask)
1684 return 0; 1684 return 0;
1685} 1685}
1686 1686
1687static uint mask_width(uint16 mask) 1687static uint mask_width(u16 mask)
1688{ 1688{
1689 int i; 1689 int i;
1690 for (i = (sizeof(mask) << 3) - 1; i >= 0; i--) { 1690 for (i = (sizeof(mask) << 3) - 1; i >= 0; i--) {
@@ -1696,7 +1696,7 @@ static uint mask_width(uint16 mask)
1696} 1696}
1697 1697
1698#if defined(BCMDBG) 1698#if defined(BCMDBG)
1699static bool mask_valid(uint16 mask) 1699static bool mask_valid(u16 mask)
1700{ 1700{
1701 uint shift = mask_shift(mask); 1701 uint shift = mask_shift(mask);
1702 uint width = mask_width(mask); 1702 uint width = mask_width(mask);
@@ -1705,9 +1705,9 @@ static bool mask_valid(uint16 mask)
1705#endif /* BCMDBG */ 1705#endif /* BCMDBG */
1706 1706
1707static void 1707static void
1708BCMATTACHFN(_initvars_srom_pci) (u8 sromrev, uint16 *srom, uint off, 1708BCMATTACHFN(_initvars_srom_pci) (u8 sromrev, u16 *srom, uint off,
1709 varbuf_t *b) { 1709 varbuf_t *b) {
1710 uint16 w; 1710 u16 w;
1711 uint32 val; 1711 uint32 val;
1712 const sromvar_t *srv; 1712 const sromvar_t *srv;
1713 uint width; 1713 uint width;
@@ -1856,7 +1856,7 @@ BCMATTACHFN(_initvars_srom_pci) (u8 sromrev, uint16 *srom, uint off,
1856static int 1856static int
1857BCMATTACHFN(initvars_srom_pci) (si_t *sih, void *curmap, char **vars, 1857BCMATTACHFN(initvars_srom_pci) (si_t *sih, void *curmap, char **vars,
1858 uint *count) { 1858 uint *count) {
1859 uint16 *srom, *sromwindow; 1859 u16 *srom, *sromwindow;
1860 u8 sromrev = 0; 1860 u8 sromrev = 0;
1861 uint32 sr; 1861 uint32 sr;
1862 varbuf_t b; 1862 varbuf_t b;
@@ -1876,7 +1876,7 @@ BCMATTACHFN(initvars_srom_pci) (si_t *sih, void *curmap, char **vars,
1876 if (!srom) 1876 if (!srom)
1877 return -2; 1877 return -2;
1878 1878
1879 sromwindow = (uint16 *) SROM_OFFSET(sih); 1879 sromwindow = (u16 *) SROM_OFFSET(sih);
1880 if (si_is_sprom_available(sih)) { 1880 if (si_is_sprom_available(sih)) {
1881 err = 1881 err =
1882 sprom_read_pci(osh, sih, sromwindow, 0, srom, SROM_WORDS, 1882 sprom_read_pci(osh, sih, sromwindow, 0, srom, SROM_WORDS,
@@ -2059,7 +2059,7 @@ static int BCMATTACHFN(sprom_cmd_sdio) (osl_t *osh, u8 cmd)
2059} 2059}
2060 2060
2061/* read a word from the SDIO srom */ 2061/* read a word from the SDIO srom */
2062static int sprom_read_sdio(osl_t *osh, uint16 addr, uint16 *data) 2062static int sprom_read_sdio(osl_t *osh, u16 addr, u16 *data)
2063{ 2063{
2064 u8 addr_l, addr_h, data_l, data_h; 2064 u8 addr_l, addr_h, data_l, data_h;
2065 2065