From: Dan Williams <dcbw@redhat.com>
To: Daniel Drake <dsd@laptop.org>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
libertas-dev@lists.infradead.org, pgf@laptop.org
Subject: Re: [PATCH v2] libertas: Fix sd8686 firmware reload
Date: Thu, 28 Oct 2010 08:50:07 -0500 [thread overview]
Message-ID: <1288273807.2364.3.camel@dcbw.foobar.com> (raw)
In-Reply-To: <20101027142052.9607A9D401B@zog.reactivated.net>
On Wed, 2010-10-27 at 15:20 +0100, Daniel Drake wrote:
> From: Paul Fox <pgf@laptop.org>
>
> For the SD8686, we cannot rely on the scratch register to read the firmware
> load status, because the same register is used for storing RX packet length.
> Broaden the check to account for this.
>
> The module can now be unloaded/reloaded successfully.
>
> Based on the implementation from libertas_tf.
>
> Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Dan Williams <dcbw@redhat.com>
> ---
> drivers/net/wireless/libertas/if_sdio.c | 32 ++++++++++++++++++++++++++++--
> 1 files changed, 29 insertions(+), 3 deletions(-)
>
> v2: rebase on latest pull to overcome a trivial conflict generated by another
> recent change
>
> diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
> index 296fd00..f41a5ab 100644
> --- a/drivers/net/wireless/libertas/if_sdio.c
> +++ b/drivers/net/wireless/libertas/if_sdio.c
> @@ -684,18 +684,40 @@ static int if_sdio_prog_firmware(struct if_sdio_card *card)
>
> lbs_deb_enter(LBS_DEB_SDIO);
>
> + /*
> + * Disable interrupts
> + */
> + sdio_claim_host(card->func);
> + sdio_writeb(card->func, 0x00, IF_SDIO_H_INT_MASK, &ret);
> + sdio_release_host(card->func);
> +
> sdio_claim_host(card->func);
> scratch = if_sdio_read_scratch(card, &ret);
> sdio_release_host(card->func);
>
> + lbs_deb_sdio("firmware status = %#x\n", scratch);
> + lbs_deb_sdio("scratch ret = %d\n", ret);
> +
> if (ret)
> goto out;
>
> - lbs_deb_sdio("firmware status = %#x\n", scratch);
>
> + /*
> + * The manual clearly describes that FEDC is the right code to use
> + * to detect firmware presence, but for SD8686 it is not that simple.
> + * Scratch is also used to store the RX packet length, so we lose
> + * the FEDC value early on. So we use a non-zero check in order
> + * to validate firmware presence.
> + * Additionally, the SD8686 in the Gumstix always has the high scratch
> + * bit set, even when the firmware is not loaded. So we have to
> + * exclude that from the test.
> + */
> if (scratch == IF_SDIO_FIRMWARE_OK) {
> lbs_deb_sdio("firmware already loaded\n");
> goto success;
> + } else if ((card->model == IF_SDIO_MODEL_8686) && (scratch & 0x7fff)) {
> + lbs_deb_sdio("firmware may be running\n");
> + goto success;
> }
>
> ret = lbs_get_firmware(&card->func->dev, lbs_helper_name, lbs_fw_name,
> @@ -709,10 +731,14 @@ static int if_sdio_prog_firmware(struct if_sdio_card *card)
> if (ret)
> goto out;
>
> + lbs_deb_sdio("Helper firmware loaded\n");
> +
> ret = if_sdio_prog_real(card, mainfw);
> if (ret)
> goto out;
>
> + lbs_deb_sdio("Firmware loaded\n");
> +
> success:
> sdio_claim_host(card->func);
> sdio_set_block_size(card->func, IF_SDIO_BLOCK_SIZE);
> @@ -1042,8 +1068,6 @@ static int if_sdio_probe(struct sdio_func *func,
> priv->exit_deep_sleep = if_sdio_exit_deep_sleep;
> priv->reset_deep_sleep_wakeup = if_sdio_reset_deep_sleep_wakeup;
>
> - priv->fw_ready = 1;
> -
> sdio_claim_host(func);
>
> /*
> @@ -1064,6 +1088,8 @@ static int if_sdio_probe(struct sdio_func *func,
> if (ret)
> goto reclaim;
>
> + priv->fw_ready = 1;
> +
> /*
> * FUNC_INIT is required for SD8688 WLAN/BT multiple functions
> */
next prev parent reply other threads:[~2010-10-28 13:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 14:20 [PATCH v2] libertas: Fix sd8686 firmware reload Daniel Drake
2010-10-27 19:54 ` John W. Linville
2010-10-28 5:57 ` Chris Ball
2010-10-28 14:08 ` John W. Linville
2010-10-28 13:50 ` Dan Williams [this message]
2010-10-28 13:57 ` Steve deRosier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1288273807.2364.3.camel@dcbw.foobar.com \
--to=dcbw@redhat.com \
--cc=dsd@laptop.org \
--cc=libertas-dev@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=pgf@laptop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).