From patchwork Fri Apr 16 10:22:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grazvydas Ignotas X-Patchwork-Id: 93096 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3GAMKcU008993 for ; Fri, 16 Apr 2010 10:22:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756076Ab0DPKWT (ORCPT ); Fri, 16 Apr 2010 06:22:19 -0400 Received: from mail-bw0-f225.google.com ([209.85.218.225]:60727 "EHLO mail-bw0-f225.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753226Ab0DPKWS (ORCPT ); Fri, 16 Apr 2010 06:22:18 -0400 Received: by bwz25 with SMTP id 25so2861104bwz.28 for ; Fri, 16 Apr 2010 03:22:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=2dddmQ6/IC2jVO6yQIwsghpvZn564FVNKxYzvnqrtoY=; b=rf2Zo0NdqQBXBkvb/D1Xii9Ym1biVn9/dsiUhl/aeYQf1B0ULAArhSwaiv2B0gQyYh thfKrH1d229JpyKAhHjwtsMzCx6uyqdZQu8k7rbCsmDCHv4HsFMmW9VYITJ/suzCB7Eg lsExuCFT4blX3xMMiieP2Lgy/7cI10pX31X+s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=NNySIzwsH7Z1q7f2j3I2IsX9sP5N1Tkxb2lGx8nOr1W8v9W9P284FWgZ0my+wkXz5S feoymMX0Iek/dkBxYkplf9XjLuXPut3pncyyNVvD5CHrJS4n7LaR0iH+g51GmfXrZ1w5 SWLKbfc+e57Aq4BgBndIuaA2acuPKMDRvjxLA= Received: by 10.204.3.137 with SMTP id 9mr1630303bkn.6.1271413336527; Fri, 16 Apr 2010 03:22:16 -0700 (PDT) Received: from localhost.localdomain (ip-88-119-226-136.static.b4net.lt [88.119.226.136]) by mx.google.com with ESMTPS id 15sm1773690bwz.8.2010.04.16.03.22.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 16 Apr 2010 03:22:15 -0700 (PDT) From: Grazvydas Ignotas To: "John W. Linville" Cc: linux-wireless@vger.kernel.org, Kalle Valo , Bob Copeland , Grazvydas Ignotas Subject: [PATCH] wl1251: add support for dedicated IRQ line Date: Fri, 16 Apr 2010 13:22:12 +0300 Message-Id: <1271413332-2979-1-git-send-email-notasas@gmail.com> X-Mailer: git-send-email 1.6.3.3 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 16 Apr 2010 10:22:22 +0000 (UTC) diff --git a/drivers/net/wireless/wl12xx/wl1251_sdio.c b/drivers/net/wireless/wl12xx/wl1251_sdio.c index 7409c34..d234285 100644 --- a/drivers/net/wireless/wl12xx/wl1251_sdio.c +++ b/drivers/net/wireless/wl12xx/wl1251_sdio.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "wl1251.h" @@ -134,18 +135,36 @@ static void wl1251_sdio_disable_irq(struct wl1251 *wl) sdio_release_host(func); } +/* Interrupts when using dedicated WLAN_IRQ pin */ +static irqreturn_t wl1251_line_irq(int irq, void *cookie) +{ + struct wl1251 *wl = cookie; + + ieee80211_queue_work(wl->hw, &wl->irq_work); + + return IRQ_HANDLED; +} + +static void wl1251_enable_line_irq(struct wl1251 *wl) +{ + return enable_irq(wl->irq); +} + +static void wl1251_disable_line_irq(struct wl1251 *wl) +{ + return disable_irq(wl->irq); +} + static void wl1251_sdio_set_power(bool enable) { } -static const struct wl1251_if_operations wl1251_sdio_ops = { +static struct wl1251_if_operations wl1251_sdio_ops = { .read = wl1251_sdio_read, .write = wl1251_sdio_write, .write_elp = wl1251_sdio_write_elp, .read_elp = wl1251_sdio_read_elp, .reset = wl1251_sdio_reset, - .enable_irq = wl1251_sdio_enable_irq, - .disable_irq = wl1251_sdio_disable_irq, }; static int wl1251_platform_probe(struct platform_device *pdev) @@ -191,6 +210,7 @@ static int wl1251_sdio_probe(struct sdio_func *func, goto release; sdio_set_block_size(func, 512); + sdio_release_host(func); SET_IEEE80211_DEV(hw, &func->dev); wl->if_priv = func; @@ -199,17 +219,41 @@ static int wl1251_sdio_probe(struct sdio_func *func, if (wl12xx_board_data != NULL) { wl->set_power = wl12xx_board_data->set_power; + wl->irq = wl12xx_board_data->irq; wl->use_eeprom = wl12xx_board_data->use_eeprom; } - sdio_release_host(func); + if (wl->irq) { + ret = request_irq(wl->irq, wl1251_line_irq, 0, "wl1251", wl); + if (ret < 0) { + wl1251_error("request_irq() failed: %d", ret); + goto disable; + } + + set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING); + disable_irq(wl->irq); + + wl1251_sdio_ops.enable_irq = wl1251_enable_line_irq; + wl1251_sdio_ops.disable_irq = wl1251_disable_line_irq; + + wl1251_info("using dedicated interrupt line"); + } else { + wl1251_sdio_ops.enable_irq = wl1251_sdio_enable_irq; + wl1251_sdio_ops.disable_irq = wl1251_sdio_disable_irq; + + wl1251_info("using SDIO interrupt"); + } + ret = wl1251_init_ieee80211(wl); if (ret) - goto disable; + goto out_free_irq; sdio_set_drvdata(func, wl); return ret; +out_free_irq: + if (wl->irq) + free_irq(wl->irq, wl); disable: sdio_claim_host(func); sdio_disable_func(func); @@ -222,6 +266,8 @@ static void __devexit wl1251_sdio_remove(struct sdio_func *func) { struct wl1251 *wl = sdio_get_drvdata(func); + if (wl->irq) + free_irq(wl->irq, wl); wl1251_free_hw(wl); sdio_claim_host(func); diff --git a/include/linux/spi/wl12xx.h b/include/linux/spi/wl12xx.h index aed64ed..a223ecb 100644 --- a/include/linux/spi/wl12xx.h +++ b/include/linux/spi/wl12xx.h @@ -26,6 +26,8 @@ struct wl12xx_platform_data { void (*set_power)(bool enable); + /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ + int irq; bool use_eeprom; };