b43: update list and code making a selection of firmware files

Clean ucode selection, fix choice of firmware for LCN, drop some goto-s,
add new devices.
Tested on 14e4:4312, 14e4:4315, 14e4:4328, 14e4:432b, 14e4:4353.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Rafał Miłecki 2014-06-24 10:50:41 +02:00 committed by John W. Linville
parent e5c3ef3652
commit a60f99f75d
1 changed files with 125 additions and 99 deletions

View File

@ -2201,52 +2201,78 @@ err_format:
return -EPROTO; return -EPROTO;
} }
/* http://bcm-v4.sipsolutions.net/802.11/Init/Firmware */
static int b43_try_request_fw(struct b43_request_fw_context *ctx) static int b43_try_request_fw(struct b43_request_fw_context *ctx)
{ {
struct b43_wldev *dev = ctx->dev; struct b43_wldev *dev = ctx->dev;
struct b43_firmware *fw = &ctx->dev->fw; struct b43_firmware *fw = &ctx->dev->fw;
struct b43_phy *phy = &dev->phy;
const u8 rev = ctx->dev->dev->core_rev; const u8 rev = ctx->dev->dev->core_rev;
const char *filename; const char *filename;
u32 tmshigh;
int err; int err;
/* Files for HT and LCN were found by trying one by one */
/* Get microcode */ /* Get microcode */
if ((rev >= 5) && (rev <= 10)) { filename = NULL;
filename = "ucode5"; switch (rev) {
} else if ((rev >= 11) && (rev <= 12)) { case 42:
filename = "ucode11"; if (phy->type == B43_PHYTYPE_AC)
} else if (rev == 13) { filename = "ucode42";
filename = "ucode13"; break;
} else if (rev == 14) { case 33:
filename = "ucode14"; if (phy->type == B43_PHYTYPE_LCN40)
} else if (rev == 15) { filename = "ucode33_lcn40";
break;
case 30:
if (phy->type == B43_PHYTYPE_N)
filename = "ucode30_mimo";
break;
case 29:
if (phy->type == B43_PHYTYPE_HT)
filename = "ucode29_mimo";
break;
case 26:
if (phy->type == B43_PHYTYPE_HT)
filename = "ucode26_mimo";
break;
case 28:
case 25:
if (phy->type == B43_PHYTYPE_N)
filename = "ucode25_mimo";
else if (phy->type == B43_PHYTYPE_LCN)
filename = "ucode25_lcn";
break;
case 24:
if (phy->type == B43_PHYTYPE_LCN)
filename = "ucode24_lcn";
break;
case 23:
if (phy->type == B43_PHYTYPE_N)
filename = "ucode16_mimo";
break;
case 16 ... 19:
if (phy->type == B43_PHYTYPE_N)
filename = "ucode16_mimo";
else if (phy->type == B43_PHYTYPE_LP)
filename = "ucode16_lp";
break;
case 15:
filename = "ucode15"; filename = "ucode15";
} else { break;
switch (dev->phy.type) { case 14:
case B43_PHYTYPE_N: filename = "ucode14";
if (rev >= 16) break;
filename = "ucode16_mimo"; case 13:
else filename = "ucode13";
goto err_no_ucode; break;
break; case 11 ... 12:
case B43_PHYTYPE_HT: filename = "ucode11";
if (rev == 29) break;
filename = "ucode29_mimo"; case 5 ... 10:
else filename = "ucode5";
goto err_no_ucode; break;
break;
case B43_PHYTYPE_LCN:
if (rev == 24)
filename = "ucode24_mimo";
else
goto err_no_ucode;
break;
default:
goto err_no_ucode;
}
} }
if (!filename)
goto err_no_ucode;
err = b43_do_request_fw(ctx, filename, &fw->ucode, true); err = b43_do_request_fw(ctx, filename, &fw->ucode, true);
if (err) if (err)
goto err_load; goto err_load;
@ -2268,117 +2294,117 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
goto err_load; goto err_load;
/* Get initvals */ /* Get initvals */
filename = NULL;
switch (dev->phy.type) { switch (dev->phy.type) {
case B43_PHYTYPE_A:
if ((rev >= 5) && (rev <= 10)) {
tmshigh = ssb_read32(dev->dev->sdev, SSB_TMSHIGH);
if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY)
filename = "a0g1initvals5";
else
filename = "a0g0initvals5";
} else
goto err_no_initvals;
break;
case B43_PHYTYPE_G: case B43_PHYTYPE_G:
if ((rev >= 5) && (rev <= 10)) if (rev == 13)
filename = "b0g0initvals5";
else if (rev >= 13)
filename = "b0g0initvals13"; filename = "b0g0initvals13";
else else if (rev >= 5 && rev <= 10)
goto err_no_initvals; filename = "b0g0initvals5";
break; break;
case B43_PHYTYPE_N: case B43_PHYTYPE_N:
if (rev >= 16) if (rev == 30)
filename = "n16initvals30";
else if (rev == 28 || rev == 25)
filename = "n0initvals25";
else if (rev == 24)
filename = "n0initvals24";
else if (rev == 23)
filename = "n0initvals16"; /* What about n0initvals22? */
else if (rev >= 16 && rev <= 18)
filename = "n0initvals16"; filename = "n0initvals16";
else if ((rev >= 11) && (rev <= 12)) else if (rev >= 11 && rev <= 12)
filename = "n0initvals11"; filename = "n0initvals11";
else
goto err_no_initvals;
break; break;
case B43_PHYTYPE_LP: case B43_PHYTYPE_LP:
if (rev == 13) if (rev >= 16 && rev <= 18)
filename = "lp0initvals13"; filename = "lp0initvals16";
else if (rev == 15)
filename = "lp0initvals15";
else if (rev == 14) else if (rev == 14)
filename = "lp0initvals14"; filename = "lp0initvals14";
else if (rev >= 15) else if (rev == 13)
filename = "lp0initvals15"; filename = "lp0initvals13";
else
goto err_no_initvals;
break; break;
case B43_PHYTYPE_HT: case B43_PHYTYPE_HT:
if (rev == 29) if (rev == 29)
filename = "ht0initvals29"; filename = "ht0initvals29";
else else if (rev == 26)
goto err_no_initvals; filename = "ht0initvals26";
break; break;
case B43_PHYTYPE_LCN: case B43_PHYTYPE_LCN:
if (rev == 24) if (rev == 24)
filename = "lcn0initvals24"; filename = "lcn0initvals24";
else
goto err_no_initvals;
break; break;
default: case B43_PHYTYPE_LCN40:
goto err_no_initvals; if (rev == 33)
filename = "lcn400initvals33";
break;
case B43_PHYTYPE_AC:
if (rev == 42)
filename = "ac1initvals42";
break;
} }
if (!filename)
goto err_no_initvals;
err = b43_do_request_fw(ctx, filename, &fw->initvals, false); err = b43_do_request_fw(ctx, filename, &fw->initvals, false);
if (err) if (err)
goto err_load; goto err_load;
/* Get bandswitch initvals */ /* Get bandswitch initvals */
filename = NULL;
switch (dev->phy.type) { switch (dev->phy.type) {
case B43_PHYTYPE_A:
if ((rev >= 5) && (rev <= 10)) {
tmshigh = ssb_read32(dev->dev->sdev, SSB_TMSHIGH);
if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY)
filename = "a0g1bsinitvals5";
else
filename = "a0g0bsinitvals5";
} else if (rev >= 11)
filename = NULL;
else
goto err_no_initvals;
break;
case B43_PHYTYPE_G: case B43_PHYTYPE_G:
if ((rev >= 5) && (rev <= 10)) if (rev == 13)
filename = "b0g0bsinitvals13";
else if (rev >= 5 && rev <= 10)
filename = "b0g0bsinitvals5"; filename = "b0g0bsinitvals5";
else if (rev >= 11)
filename = NULL;
else
goto err_no_initvals;
break; break;
case B43_PHYTYPE_N: case B43_PHYTYPE_N:
if (rev >= 16) if (rev == 30)
filename = "n16bsinitvals30";
else if (rev == 28 || rev == 25)
filename = "n0bsinitvals25";
else if (rev == 24)
filename = "n0bsinitvals24";
else if (rev == 23)
filename = "n0bsinitvals16"; /* What about n0bsinitvals22? */
else if (rev >= 16 && rev <= 18)
filename = "n0bsinitvals16"; filename = "n0bsinitvals16";
else if ((rev >= 11) && (rev <= 12)) else if (rev >= 11 && rev <= 12)
filename = "n0bsinitvals11"; filename = "n0bsinitvals11";
else
goto err_no_initvals;
break; break;
case B43_PHYTYPE_LP: case B43_PHYTYPE_LP:
if (rev == 13) if (rev >= 16 && rev <= 18)
filename = "lp0bsinitvals13"; filename = "lp0bsinitvals16";
else if (rev == 15)
filename = "lp0bsinitvals15";
else if (rev == 14) else if (rev == 14)
filename = "lp0bsinitvals14"; filename = "lp0bsinitvals14";
else if (rev >= 15) else if (rev == 13)
filename = "lp0bsinitvals15"; filename = "lp0bsinitvals13";
else
goto err_no_initvals;
break; break;
case B43_PHYTYPE_HT: case B43_PHYTYPE_HT:
if (rev == 29) if (rev == 29)
filename = "ht0bsinitvals29"; filename = "ht0bsinitvals29";
else else if (rev == 26)
goto err_no_initvals; filename = "ht0bsinitvals26";
break; break;
case B43_PHYTYPE_LCN: case B43_PHYTYPE_LCN:
if (rev == 24) if (rev == 24)
filename = "lcn0bsinitvals24"; filename = "lcn0bsinitvals24";
else
goto err_no_initvals;
break; break;
default: case B43_PHYTYPE_LCN40:
goto err_no_initvals; if (rev == 33)
filename = "lcn400bsinitvals33";
break;
case B43_PHYTYPE_AC:
if (rev == 42)
filename = "ac1bsinitvals42";
break;
} }
if (!filename)
goto err_no_initvals;
err = b43_do_request_fw(ctx, filename, &fw->initvals_band, false); err = b43_do_request_fw(ctx, filename, &fw->initvals_band, false);
if (err) if (err)
goto err_load; goto err_load;