~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/net/wireless/wl12xx/sdio.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include <linux/mmc/sdio_func.h>
29
29
#include <linux/mmc/sdio_ids.h>
30
30
#include <linux/mmc/card.h>
 
31
#include <linux/mmc/host.h>
31
32
#include <linux/gpio.h>
32
33
#include <linux/wl12xx.h>
33
34
#include <linux/pm_runtime.h>
60
61
        return &(wl_to_func(wl)->dev);
61
62
}
62
63
 
63
 
static irqreturn_t wl1271_irq(int irq, void *cookie)
 
64
static irqreturn_t wl1271_hardirq(int irq, void *cookie)
64
65
{
65
66
        struct wl1271 *wl = cookie;
66
67
        unsigned long flags;
69
70
 
70
71
        /* complete the ELP completion */
71
72
        spin_lock_irqsave(&wl->wl_lock, flags);
 
73
        set_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags);
72
74
        if (wl->elp_compl) {
73
75
                complete(wl->elp_compl);
74
76
                wl->elp_compl = NULL;
75
77
        }
76
 
 
77
 
        if (!test_and_set_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags))
78
 
                ieee80211_queue_work(wl->hw, &wl->irq_work);
79
 
        set_bit(WL1271_FLAG_IRQ_PENDING, &wl->flags);
80
78
        spin_unlock_irqrestore(&wl->wl_lock, flags);
81
79
 
82
 
        return IRQ_HANDLED;
 
80
        return IRQ_WAKE_THREAD;
83
81
}
84
82
 
85
83
static void wl1271_sdio_disable_interrupts(struct wl1271 *wl)
106
104
        int ret;
107
105
        struct sdio_func *func = wl_to_func(wl);
108
106
 
109
 
        sdio_claim_host(func);
110
 
 
111
107
        if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
112
108
                ((u8 *)buf)[0] = sdio_f0_readb(func, addr, &ret);
113
109
                wl1271_debug(DEBUG_SDIO, "sdio read 52 addr 0x%x, byte 0x%02x",
123
119
                wl1271_dump_ascii(DEBUG_SDIO, "data: ", buf, len);
124
120
        }
125
121
 
126
 
        sdio_release_host(func);
127
 
 
128
122
        if (ret)
129
123
                wl1271_error("sdio read failed (%d)", ret);
130
124
}
135
129
        int ret;
136
130
        struct sdio_func *func = wl_to_func(wl);
137
131
 
138
 
        sdio_claim_host(func);
139
 
 
140
132
        if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
141
133
                sdio_f0_writeb(func, ((u8 *)buf)[0], addr, &ret);
142
134
                wl1271_debug(DEBUG_SDIO, "sdio write 52 addr 0x%x, byte 0x%02x",
152
144
                        ret = sdio_memcpy_toio(func, addr, buf, len);
153
145
        }
154
146
 
155
 
        sdio_release_host(func);
156
 
 
157
147
        if (ret)
158
148
                wl1271_error("sdio write failed (%d)", ret);
159
149
}
163
153
        struct sdio_func *func = wl_to_func(wl);
164
154
        int ret;
165
155
 
166
 
        /* Power up the card */
 
156
        /* Make sure the card will not be powered off by runtime PM */
167
157
        ret = pm_runtime_get_sync(&func->dev);
168
158
        if (ret < 0)
169
159
                goto out;
170
160
 
 
161
        /* Runtime PM might be disabled, so power up the card manually */
 
162
        ret = mmc_power_restore_host(func->card->host);
 
163
        if (ret < 0)
 
164
                goto out;
 
165
 
171
166
        sdio_claim_host(func);
172
167
        sdio_enable_func(func);
173
 
        sdio_release_host(func);
174
168
 
175
169
out:
176
170
        return ret;
179
173
static int wl1271_sdio_power_off(struct wl1271 *wl)
180
174
{
181
175
        struct sdio_func *func = wl_to_func(wl);
 
176
        int ret;
182
177
 
183
 
        sdio_claim_host(func);
184
178
        sdio_disable_func(func);
185
179
        sdio_release_host(func);
186
180
 
187
 
        /* Power down the card */
 
181
        /* Runtime PM might be disabled, so power off the card manually */
 
182
        ret = mmc_power_save_host(func->card->host);
 
183
        if (ret < 0)
 
184
                return ret;
 
185
 
 
186
        /* Let runtime PM know the card is powered off */
188
187
        return pm_runtime_put_sync(&func->dev);
189
188
}
190
189
 
241
240
        wl->irq = wlan_data->irq;
242
241
        wl->ref_clock = wlan_data->board_ref_clock;
243
242
 
244
 
        ret = request_irq(wl->irq, wl1271_irq, 0, DRIVER_NAME, wl);
 
243
        ret = request_threaded_irq(wl->irq, wl1271_hardirq, wl1271_irq,
 
244
                                   IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
 
245
                                   DRIVER_NAME, wl);
245
246
        if (ret < 0) {
246
247
                wl1271_error("request_irq() failed: %d", ret);
247
248
                goto out_free;
248
249
        }
249
250
 
250
 
        set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING);
251
 
 
252
251
        disable_irq(wl->irq);
253
252
 
254
253
        ret = wl1271_init_ieee80211(wl);
271
270
 out_irq:
272
271
        free_irq(wl->irq, wl);
273
272
 
274
 
 
275
273
 out_free:
276
274
        wl1271_free_hw(wl);
277
275
 
342
340
module_exit(wl1271_exit);
343
341
 
344
342
MODULE_LICENSE("GPL");
345
 
MODULE_AUTHOR("Luciano Coelho <luciano.coelho@nokia.com>");
 
343
MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
346
344
MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>");
347
345
MODULE_FIRMWARE(WL1271_FW_NAME);
 
346
MODULE_FIRMWARE(WL1271_AP_FW_NAME);