aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/if_usb.c
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@queued.net>2011-09-08 20:35:17 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-09-14 13:57:00 -0400
commit55768fa6d9462c18c1ce3c862db3bf55bac3b1c7 (patch)
tree6019a6189cc30d8d02f54506dc0071a57e9c4285 /drivers/net/wireless/libertas/if_usb.c
parentfd235913f9d86fde954f7e1215bd0921ee70cb19 (diff)
libertas: prioritize usb8388_olpc.bin firmware on OLPC machines
Normally, the v9 firmware will be loaded if it's available. However, on OLPC XO-1 machines, the olpc-specific firmware supports extra functionality. This makes the libertas driver attempt to load the custom firmware first if the machine is an OLPC machine; if that fails (or it's not an OLPC machine), fall back to attempting to load the other firmwares. usb8388_olpc.bin is currently found in the linux-firmware repository. Signed-off-by: Andres Salomon <dilinger@queued.net> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/if_usb.c')
-rw-r--r--drivers/net/wireless/libertas/if_usb.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 0c846f5a646a..8147f1e2a0b0 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -973,6 +973,23 @@ static const struct {
973 { MODEL_8682, "libertas/usb8682.bin" } 973 { MODEL_8682, "libertas/usb8682.bin" }
974}; 974};
975 975
976#ifdef CONFIG_OLPC
977
978static int try_olpc_fw(struct if_usb_card *cardp)
979{
980 int retval = -ENOENT;
981
982 /* try the OLPC firmware first; fall back to fw_table list */
983 if (machine_is_olpc() && cardp->model == MODEL_8388)
984 retval = request_firmware(&cardp->fw,
985 "libertas/usb8388_olpc.bin", &cardp->udev->dev);
986 return retval;
987}
988
989#else
990static int try_olpc_fw(struct if_usb_card *cardp) { return -ENOENT; }
991#endif /* !CONFIG_OLPC */
992
976static int get_fw(struct if_usb_card *cardp, const char *fwname) 993static int get_fw(struct if_usb_card *cardp, const char *fwname)
977{ 994{
978 int i; 995 int i;
@@ -981,6 +998,10 @@ static int get_fw(struct if_usb_card *cardp, const char *fwname)
981 if (fwname) 998 if (fwname)
982 return request_firmware(&cardp->fw, fwname, &cardp->udev->dev); 999 return request_firmware(&cardp->fw, fwname, &cardp->udev->dev);
983 1000
1001 /* Handle OLPC firmware */
1002 if (try_olpc_fw(cardp) == 0)
1003 return 0;
1004
984 /* Otherwise search for firmware to use */ 1005 /* Otherwise search for firmware to use */
985 for (i = 0; i < ARRAY_SIZE(fw_table); i++) { 1006 for (i = 0; i < ARRAY_SIZE(fw_table); i++) {
986 if (fw_table[i].model != cardp->model) 1007 if (fw_table[i].model != cardp->model)