The card firmware does not set the Command Download Ready interrupt bit when
IEEE PS mode is enabled, preventing the driver from sending commands (such as
the command to exit IEEE PS mode) since there is no indication that the card is
ready to accept commands.
This patch changes the driver to use the TX Download Ready bit, which is
normally set along with Command Download Ready and does get set in IEEE PS
mode. It also moves the card event interrupt acknowledgement to the
interrupt handler and acknowledges all interrupts that we handle as well.
Signed-off-by: Andrey Yurovsky <[email protected]>
Signed-off-by: Javier Cardona <[email protected]>
---
drivers/net/wireless/libertas/if_spi.c | 48 ++++++++++++++++++--------------
1 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index f8c2898..c32c08d 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -820,10 +820,6 @@ static void if_spi_e2h(struct if_spi_card *card)
if (err)
goto out;
- /* re-enable the card event interrupt */
- spu_write_u16(card, IF_SPI_HOST_INT_STATUS_REG,
- ~IF_SPI_HICU_CARD_EVENT);
-
/* generate a card interrupt */
spu_write_u16(card, IF_SPI_CARD_INT_CAUSE_REG, IF_SPI_CIC_HOST_EVENT);
@@ -867,23 +863,23 @@ static int lbs_spi_thread(void *data)
goto err;
}
- if (hiStatus & IF_SPI_HIST_CMD_UPLOAD_RDY)
+ if (hiStatus & IF_SPI_HIST_CMD_UPLOAD_RDY) {
+ spu_write_u16(card, IF_SPI_HOST_INT_STATUS_REG,
+ ~(IF_SPI_HIST_CMD_UPLOAD_RDY));
err = if_spi_c2h_cmd(card);
if (err)
goto err;
- if (hiStatus & IF_SPI_HIST_RX_UPLOAD_RDY)
+ }
+ if (hiStatus & IF_SPI_HIST_RX_UPLOAD_RDY) {
+ spu_write_u16(card, IF_SPI_HOST_INT_STATUS_REG,
+ ~(IF_SPI_HIST_RX_UPLOAD_RDY));
err = if_spi_c2h_data(card);
if (err)
goto err;
- if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY) {
- /* This means two things. First of all,
- * if there was a previous command sent, the card has
- * successfully received it.
- * Secondly, it is now ready to download another
- * command.
- */
- lbs_host_to_card_done(card->priv);
+ }
+ if (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY ||
+ hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY) {
/* Do we have any command packets from the host to
* send? */
packet = NULL;
@@ -895,10 +891,12 @@ static int lbs_spi_thread(void *data)
}
spin_unlock_irqrestore(&card->buffer_lock, flags);
- if (packet)
- if_spi_h2c(card, packet, MVMS_CMD);
- }
- if (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY) {
+ if (packet) {
+ spu_write_u16(card, IF_SPI_HOST_INT_STATUS_REG,
+ ~(IF_SPI_HIST_CMD_DOWNLOAD_RDY));
+ if_spi_h2c(card, packet, MVMS_CMD);
+ }
+
/* Do we have any data packets from the host to
* send? */
packet = NULL;
@@ -910,12 +908,20 @@ static int lbs_spi_thread(void *data)
}
spin_unlock_irqrestore(&card->buffer_lock, flags);
- if (packet)
+ if (packet) {
+ spu_write_u16(card, IF_SPI_HOST_INT_STATUS_REG,
+ ~(IF_SPI_HIST_TX_DOWNLOAD_RDY));
if_spi_h2c(card, packet, MVMS_DAT);
+ }
+
+ lbs_host_to_card_done(card->priv);
}
- if (hiStatus & IF_SPI_HIST_CARD_EVENT)
- if_spi_e2h(card);
+ if (hiStatus & IF_SPI_HIST_CARD_EVENT) {
+ spu_write_u16(card, IF_SPI_HOST_INT_STATUS_REG,
+ ~(IF_SPI_HIST_CARD_EVENT));
+ if_spi_e2h(card);
+ }
err:
if (err)
lbs_pr_err("%s: got error %d\n", __func__, err);
--
1.5.6.3
The card firmware does not set the Command Download Ready interrupt bit
when IEEE PS mode is enabled, preventing the driver from sending
commands (such as the command to exit IEEE PS mode) since there is no
indication that the card is ready to accept commands.
This patch works around the problem by using the the TX Download Ready
bit in place of the Command Download Ready Bit while in IEEE PS mode.
TX Download Ready is set in IEEE PS mode.
Signed-off-by: Andrey Yurovsky <[email protected]>
Signed-off-by: Javier Cardona <[email protected]>
---
drivers/net/wireless/libertas/if_spi.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index f8c2898..dc2a1f6 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -875,7 +875,12 @@ static int lbs_spi_thread(void *data)
err = if_spi_c2h_data(card);
if (err)
goto err;
- if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY) {
+
+ /* workaround: in PS mode, the card does not set the Command
+ * Download Ready bit, but it sets TX Download Ready. */
+ if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY ||
+ (card->priv->psstate != PS_STATE_FULL_POWER &&
+ (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY))) {
/* This means two things. First of all,
* if there was a previous command sent, the card has
* successfully received it.
--
1.5.6.3
On Fri, 2009-06-12 at 12:45 -0700, Andrey Yurovsky wrote:
> The card firmware does not set the Command Download Ready interrupt bit
> when IEEE PS mode is enabled, preventing the driver from sending
> commands (such as the command to exit IEEE PS mode) since there is no
> indication that the card is ready to accept commands.
>
> This patch works around the problem by using the the TX Download Ready
> bit in place of the Command Download Ready Bit while in IEEE PS mode.
> TX Download Ready is set in IEEE PS mode.
>
> Signed-off-by: Andrey Yurovsky <[email protected]>
> Signed-off-by: Javier Cardona <[email protected]>
Acked-by: Dan Williams <[email protected]>
> ---
> drivers/net/wireless/libertas/if_spi.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
> index f8c2898..dc2a1f6 100644
> --- a/drivers/net/wireless/libertas/if_spi.c
> +++ b/drivers/net/wireless/libertas/if_spi.c
> @@ -875,7 +875,12 @@ static int lbs_spi_thread(void *data)
> err = if_spi_c2h_data(card);
> if (err)
> goto err;
> - if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY) {
> +
> + /* workaround: in PS mode, the card does not set the Command
> + * Download Ready bit, but it sets TX Download Ready. */
> + if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY ||
> + (card->priv->psstate != PS_STATE_FULL_POWER &&
> + (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY))) {
> /* This means two things. First of all,
> * if there was a previous command sent, the card has
> * successfully received it.