From b3781c74373489fa325ce64efdf72f6c8567b783 Mon Sep 17 00:00:00 2001 From: Andrey Yurovsky Date: Fri, 12 Jun 2009 12:45:36 -0700 Subject: libertas: fix IEEE PS mode in GSPI driver 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 Signed-off-by: Javier Cardona Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_spi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/libertas/if_spi.c') 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. -- cgit v1.1 From 87e501b351ed9d837e63f6506b7e66331a69ed58 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Fri, 12 Jun 2009 21:37:31 +0200 Subject: net/libertas: don't recursive spin lock in if_spi_e2h() |BUG: spinlock recursion on CPU#0, lbs_spi_thread/1030 | lock: dee9a1bc, .magic: dead4ead, .owner: lbs_spi_thread/1030, .owner_cpu: 0 |Call Trace: |[deec3eb0] [c0007220] show_stack+0x4c/0x15c (unreliable) |[deec3ef0] [c0187720] spin_bug+0x9c/0xb0 |[deec3f10] [c0187890] _raw_spin_lock+0x54/0x148 |[deec3f40] [c02d260c] _spin_lock_irqsave+0x2c/0x44 |[deec3f60] [e8671800] lbs_queue_event+0x7c/0x130 [libertas] |[deec3f80] [e8725f04] lbs_spi_thread+0x538/0x58c [libertas_spi] |[deec3fe0] [c004f270] kthread+0x4c/0x88 |[deec3ff0] [c000f33c] kernel_thread+0x4c/0x68 if_spi_e2h() is grabbing ->driver_lock just while calling lbs_queue_event() which is grabbing the same lock. Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_spi.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/net/wireless/libertas/if_spi.c') diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c index dc2a1f6..923ed58 100644 --- a/drivers/net/wireless/libertas/if_spi.c +++ b/drivers/net/wireless/libertas/if_spi.c @@ -812,7 +812,6 @@ out: static void if_spi_e2h(struct if_spi_card *card) { int err = 0; - unsigned long flags; u32 cause; struct lbs_private *priv = card->priv; @@ -827,10 +826,7 @@ static void if_spi_e2h(struct if_spi_card *card) /* generate a card interrupt */ spu_write_u16(card, IF_SPI_CARD_INT_CAUSE_REG, IF_SPI_CIC_HOST_EVENT); - spin_lock_irqsave(&priv->driver_lock, flags); lbs_queue_event(priv, cause & 0xff); - spin_unlock_irqrestore(&priv->driver_lock, flags); - out: if (err) lbs_pr_err("%s: error %d\n", __func__, err); -- cgit v1.1