All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] libertas: prioritize usb8388_olpc.bin firmware on OLPC machines
@ 2011-08-04 23:06 Andres Salomon
  2011-08-15 22:51 ` Dan Williams
  0 siblings, 1 reply; 2+ messages in thread
From: Andres Salomon @ 2011-08-04 23:06 UTC (permalink / raw)
  To: dcbw; +Cc: David Woodhouse, libertas-dev, dsd, cjb, linux-kernel

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.

Signed-off-by: Andres Salomon <dilinger@queued.net>
---
 drivers/net/wireless/libertas/if_usb.c |   21 +++++++++++++++++++++
 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 b5acc39..527cb11 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -973,6 +973,23 @@ static const struct {
 	{ MODEL_8682, "libertas/usb8682.bin" }
 };
 
+#ifdef CONFIG_OLPC
+
+static int try_olpc_fw(struct if_usb_card *cardp)
+{
+	int retval = -ENOENT;
+
+	/* try the OLPC firmware first; fall back to fw_table list */
+	if (machine_is_olpc() && cardp->model == MODEL_8388)
+		retval = request_firmware(&cardp->fw, "usb8388_olpc.bin",
+				&cardp->udev->dev);
+	return retval;
+}
+
+#else
+static int try_olpc_fw(struct if_usb_card *cardp) { return -ENOENT; }
+#endif /* !CONFIG_OLPC */
+
 static int get_fw(struct if_usb_card *cardp, const char *fwname)
 {
 	int i;
@@ -981,6 +998,10 @@ static int get_fw(struct if_usb_card *cardp, const char *fwname)
 	if (fwname)
 		return request_firmware(&cardp->fw, fwname, &cardp->udev->dev);
 
+	/* Handle OLPC firmware */
+	if (try_olpc_fw(cardp) == 0)
+		return 0;
+
 	/* Otherwise search for firmware to use */
 	for (i = 0; i < ARRAY_SIZE(fw_table); i++) {
 		if (fw_table[i].model != cardp->model)
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] libertas: prioritize usb8388_olpc.bin firmware on OLPC machines
  2011-08-04 23:06 [PATCH v2] libertas: prioritize usb8388_olpc.bin firmware on OLPC machines Andres Salomon
@ 2011-08-15 22:51 ` Dan Williams
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2011-08-15 22:51 UTC (permalink / raw)
  To: Andres Salomon; +Cc: David Woodhouse, libertas-dev, dsd, cjb, linux-kernel

On Thu, 2011-08-04 at 16:06 -0700, Andres Salomon wrote:
> 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.
> 
> Signed-off-by: Andres Salomon <dilinger@queued.net>

Signed-off-by: Dan Williams <dcbw@redhat.com>

works for me...

> ---
>  drivers/net/wireless/libertas/if_usb.c |   21 +++++++++++++++++++++
>  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 b5acc39..527cb11 100644
> --- a/drivers/net/wireless/libertas/if_usb.c
> +++ b/drivers/net/wireless/libertas/if_usb.c
> @@ -973,6 +973,23 @@ static const struct {
>  	{ MODEL_8682, "libertas/usb8682.bin" }
>  };
>  
> +#ifdef CONFIG_OLPC
> +
> +static int try_olpc_fw(struct if_usb_card *cardp)
> +{
> +	int retval = -ENOENT;
> +
> +	/* try the OLPC firmware first; fall back to fw_table list */
> +	if (machine_is_olpc() && cardp->model == MODEL_8388)
> +		retval = request_firmware(&cardp->fw, "usb8388_olpc.bin",
> +				&cardp->udev->dev);
> +	return retval;
> +}
> +
> +#else
> +static int try_olpc_fw(struct if_usb_card *cardp) { return -ENOENT; }
> +#endif /* !CONFIG_OLPC */
> +
>  static int get_fw(struct if_usb_card *cardp, const char *fwname)
>  {
>  	int i;
> @@ -981,6 +998,10 @@ static int get_fw(struct if_usb_card *cardp, const char *fwname)
>  	if (fwname)
>  		return request_firmware(&cardp->fw, fwname, &cardp->udev->dev);
>  
> +	/* Handle OLPC firmware */
> +	if (try_olpc_fw(cardp) == 0)
> +		return 0;
> +
>  	/* Otherwise search for firmware to use */
>  	for (i = 0; i < ARRAY_SIZE(fw_table); i++) {
>  		if (fw_table[i].model != cardp->model)



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-15 22:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-04 23:06 [PATCH v2] libertas: prioritize usb8388_olpc.bin firmware on OLPC machines Andres Salomon
2011-08-15 22:51 ` Dan Williams

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.