diff options
-rw-r--r-- | drivers/net/wireless/wl12xx/io.c | 11 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/io.h | 14 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/main.c | 110 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/sdio.c | 174 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/spi.c | 161 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl12xx.h | 17 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl12xx_platform_data.c | 4 | ||||
-rw-r--r-- | include/linux/wl12xx.h | 5 |
8 files changed, 184 insertions, 312 deletions
diff --git a/drivers/net/wireless/wl12xx/io.c b/drivers/net/wireless/wl12xx/io.c index c2da66f4504..1a7df8a7ed2 100644 --- a/drivers/net/wireless/wl12xx/io.c +++ b/drivers/net/wireless/wl12xx/io.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/spi/spi.h> | 26 | #include <linux/spi/spi.h> |
27 | #include <linux/interrupt.h> | ||
27 | 28 | ||
28 | #include "wl12xx.h" | 29 | #include "wl12xx.h" |
29 | #include "wl12xx_80211.h" | 30 | #include "wl12xx_80211.h" |
@@ -46,7 +47,7 @@ | |||
46 | bool wl1271_set_block_size(struct wl1271 *wl) | 47 | bool wl1271_set_block_size(struct wl1271 *wl) |
47 | { | 48 | { |
48 | if (wl->if_ops->set_block_size) { | 49 | if (wl->if_ops->set_block_size) { |
49 | wl->if_ops->set_block_size(wl, WL12XX_BUS_BLOCK_SIZE); | 50 | wl->if_ops->set_block_size(wl->dev, WL12XX_BUS_BLOCK_SIZE); |
50 | return true; | 51 | return true; |
51 | } | 52 | } |
52 | 53 | ||
@@ -55,12 +56,12 @@ bool wl1271_set_block_size(struct wl1271 *wl) | |||
55 | 56 | ||
56 | void wl1271_disable_interrupts(struct wl1271 *wl) | 57 | void wl1271_disable_interrupts(struct wl1271 *wl) |
57 | { | 58 | { |
58 | wl->if_ops->disable_irq(wl); | 59 | disable_irq(wl->irq); |
59 | } | 60 | } |
60 | 61 | ||
61 | void wl1271_enable_interrupts(struct wl1271 *wl) | 62 | void wl1271_enable_interrupts(struct wl1271 *wl) |
62 | { | 63 | { |
63 | wl->if_ops->enable_irq(wl); | 64 | enable_irq(wl->irq); |
64 | } | 65 | } |
65 | 66 | ||
66 | /* Set the SPI partitions to access the chip addresses | 67 | /* Set the SPI partitions to access the chip addresses |
@@ -128,13 +129,13 @@ EXPORT_SYMBOL_GPL(wl1271_set_partition); | |||
128 | void wl1271_io_reset(struct wl1271 *wl) | 129 | void wl1271_io_reset(struct wl1271 *wl) |
129 | { | 130 | { |
130 | if (wl->if_ops->reset) | 131 | if (wl->if_ops->reset) |
131 | wl->if_ops->reset(wl); | 132 | wl->if_ops->reset(wl->dev); |
132 | } | 133 | } |
133 | 134 | ||
134 | void wl1271_io_init(struct wl1271 *wl) | 135 | void wl1271_io_init(struct wl1271 *wl) |
135 | { | 136 | { |
136 | if (wl->if_ops->init) | 137 | if (wl->if_ops->init) |
137 | wl->if_ops->init(wl); | 138 | wl->if_ops->init(wl->dev); |
138 | } | 139 | } |
139 | 140 | ||
140 | void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val) | 141 | void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val) |
diff --git a/drivers/net/wireless/wl12xx/io.h b/drivers/net/wireless/wl12xx/io.h index e839341dfaf..e82dad19aa3 100644 --- a/drivers/net/wireless/wl12xx/io.h +++ b/drivers/net/wireless/wl12xx/io.h | |||
@@ -51,23 +51,17 @@ void wl1271_enable_interrupts(struct wl1271 *wl); | |||
51 | void wl1271_io_reset(struct wl1271 *wl); | 51 | void wl1271_io_reset(struct wl1271 *wl); |
52 | void wl1271_io_init(struct wl1271 *wl); | 52 | void wl1271_io_init(struct wl1271 *wl); |
53 | 53 | ||
54 | static inline struct device *wl1271_wl_to_dev(struct wl1271 *wl) | ||
55 | { | ||
56 | return wl->if_ops->dev(wl); | ||
57 | } | ||
58 | |||
59 | |||
60 | /* Raw target IO, address is not translated */ | 54 | /* Raw target IO, address is not translated */ |
61 | static inline void wl1271_raw_write(struct wl1271 *wl, int addr, void *buf, | 55 | static inline void wl1271_raw_write(struct wl1271 *wl, int addr, void *buf, |
62 | size_t len, bool fixed) | 56 | size_t len, bool fixed) |
63 | { | 57 | { |
64 | wl->if_ops->write(wl, addr, buf, len, fixed); | 58 | wl->if_ops->write(wl->dev, addr, buf, len, fixed); |
65 | } | 59 | } |
66 | 60 | ||
67 | static inline void wl1271_raw_read(struct wl1271 *wl, int addr, void *buf, | 61 | static inline void wl1271_raw_read(struct wl1271 *wl, int addr, void *buf, |
68 | size_t len, bool fixed) | 62 | size_t len, bool fixed) |
69 | { | 63 | { |
70 | wl->if_ops->read(wl, addr, buf, len, fixed); | 64 | wl->if_ops->read(wl->dev, addr, buf, len, fixed); |
71 | } | 65 | } |
72 | 66 | ||
73 | static inline u32 wl1271_raw_read32(struct wl1271 *wl, int addr) | 67 | static inline u32 wl1271_raw_read32(struct wl1271 *wl, int addr) |
@@ -155,13 +149,13 @@ static inline void wl1271_write32(struct wl1271 *wl, int addr, u32 val) | |||
155 | 149 | ||
156 | static inline void wl1271_power_off(struct wl1271 *wl) | 150 | static inline void wl1271_power_off(struct wl1271 *wl) |
157 | { | 151 | { |
158 | wl->if_ops->power(wl, false); | 152 | wl->if_ops->power(wl->dev, false); |
159 | clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); | 153 | clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); |
160 | } | 154 | } |
161 | 155 | ||
162 | static inline int wl1271_power_on(struct wl1271 *wl) | 156 | static inline int wl1271_power_on(struct wl1271 *wl) |
163 | { | 157 | { |
164 | int ret = wl->if_ops->power(wl, true); | 158 | int ret = wl->if_ops->power(wl->dev, true); |
165 | if (ret == 0) | 159 | if (ret == 0) |
166 | set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); | 160 | set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); |
167 | 161 | ||
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index 3262e8a6c47..1cf98778505 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/wl12xx.h> | 33 | #include <linux/wl12xx.h> |
34 | #include <linux/sched.h> | 34 | #include <linux/sched.h> |
35 | #include <linux/interrupt.h> | ||
35 | 36 | ||
36 | #include "wl12xx.h" | 37 | #include "wl12xx.h" |
37 | #include "wl12xx_80211.h" | 38 | #include "wl12xx_80211.h" |
@@ -1067,7 +1068,7 @@ static int wl1271_fetch_firmware(struct wl1271 *wl) | |||
1067 | 1068 | ||
1068 | wl1271_debug(DEBUG_BOOT, "booting firmware %s", fw_name); | 1069 | wl1271_debug(DEBUG_BOOT, "booting firmware %s", fw_name); |
1069 | 1070 | ||
1070 | ret = request_firmware(&fw, fw_name, wl1271_wl_to_dev(wl)); | 1071 | ret = request_firmware(&fw, fw_name, wl->dev); |
1071 | 1072 | ||
1072 | if (ret < 0) { | 1073 | if (ret < 0) { |
1073 | wl1271_error("could not get firmware: %d", ret); | 1074 | wl1271_error("could not get firmware: %d", ret); |
@@ -1105,7 +1106,7 @@ static int wl1271_fetch_nvs(struct wl1271 *wl) | |||
1105 | const struct firmware *fw; | 1106 | const struct firmware *fw; |
1106 | int ret; | 1107 | int ret; |
1107 | 1108 | ||
1108 | ret = request_firmware(&fw, WL12XX_NVS_NAME, wl1271_wl_to_dev(wl)); | 1109 | ret = request_firmware(&fw, WL12XX_NVS_NAME, wl->dev); |
1109 | 1110 | ||
1110 | if (ret < 0) { | 1111 | if (ret < 0) { |
1111 | wl1271_error("could not get nvs file: %d", ret); | 1112 | wl1271_error("could not get nvs file: %d", ret); |
@@ -4979,7 +4980,7 @@ int wl1271_init_ieee80211(struct wl1271 *wl) | |||
4979 | 4980 | ||
4980 | wl->hw->wiphy->reg_notifier = wl1271_reg_notify; | 4981 | wl->hw->wiphy->reg_notifier = wl1271_reg_notify; |
4981 | 4982 | ||
4982 | SET_IEEE80211_DEV(wl->hw, wl1271_wl_to_dev(wl)); | 4983 | SET_IEEE80211_DEV(wl->hw, wl->dev); |
4983 | 4984 | ||
4984 | wl->hw->sta_data_size = sizeof(struct wl1271_station); | 4985 | wl->hw->sta_data_size = sizeof(struct wl1271_station); |
4985 | wl->hw->vif_data_size = sizeof(struct wl12xx_vif); | 4986 | wl->hw->vif_data_size = sizeof(struct wl12xx_vif); |
@@ -5200,13 +5201,116 @@ int wl1271_free_hw(struct wl1271 *wl) | |||
5200 | } | 5201 | } |
5201 | EXPORT_SYMBOL_GPL(wl1271_free_hw); | 5202 | EXPORT_SYMBOL_GPL(wl1271_free_hw); |
5202 | 5203 | ||
5204 | static irqreturn_t wl12xx_hardirq(int irq, void *cookie) | ||
5205 | { | ||
5206 | struct wl1271 *wl = cookie; | ||
5207 | unsigned long flags; | ||
5208 | |||
5209 | wl1271_debug(DEBUG_IRQ, "IRQ"); | ||
5210 | |||
5211 | /* complete the ELP completion */ | ||
5212 | spin_lock_irqsave(&wl->wl_lock, flags); | ||
5213 | set_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags); | ||
5214 | if (wl->elp_compl) { | ||
5215 | complete(wl->elp_compl); | ||
5216 | wl->elp_compl = NULL; | ||
5217 | } | ||
5218 | |||
5219 | if (test_bit(WL1271_FLAG_SUSPENDED, &wl->flags)) { | ||
5220 | /* don't enqueue a work right now. mark it as pending */ | ||
5221 | set_bit(WL1271_FLAG_PENDING_WORK, &wl->flags); | ||
5222 | wl1271_debug(DEBUG_IRQ, "should not enqueue work"); | ||
5223 | disable_irq_nosync(wl->irq); | ||
5224 | pm_wakeup_event(wl->dev, 0); | ||
5225 | spin_unlock_irqrestore(&wl->wl_lock, flags); | ||
5226 | return IRQ_HANDLED; | ||
5227 | } | ||
5228 | spin_unlock_irqrestore(&wl->wl_lock, flags); | ||
5229 | |||
5230 | return IRQ_WAKE_THREAD; | ||
5231 | } | ||
5232 | |||
5203 | static int __devinit wl12xx_probe(struct platform_device *pdev) | 5233 | static int __devinit wl12xx_probe(struct platform_device *pdev) |
5204 | { | 5234 | { |
5235 | struct wl12xx_platform_data *pdata = pdev->dev.platform_data; | ||
5236 | struct ieee80211_hw *hw; | ||
5237 | struct wl1271 *wl; | ||
5238 | unsigned long irqflags; | ||
5239 | int ret = -ENODEV; | ||
5240 | |||
5241 | hw = wl1271_alloc_hw(); | ||
5242 | if (IS_ERR(hw)) { | ||
5243 | wl1271_error("can't allocate hw"); | ||
5244 | ret = PTR_ERR(hw); | ||
5245 | goto out; | ||
5246 | } | ||
5247 | |||
5248 | wl = hw->priv; | ||
5249 | wl->irq = platform_get_irq(pdev, 0); | ||
5250 | wl->ref_clock = pdata->board_ref_clock; | ||
5251 | wl->tcxo_clock = pdata->board_tcxo_clock; | ||
5252 | wl->platform_quirks = pdata->platform_quirks; | ||
5253 | wl->set_power = pdata->set_power; | ||
5254 | wl->dev = &pdev->dev; | ||
5255 | wl->if_ops = pdata->ops; | ||
5256 | |||
5257 | platform_set_drvdata(pdev, wl); | ||
5258 | |||
5259 | if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) | ||
5260 | irqflags = IRQF_TRIGGER_RISING; | ||
5261 | else | ||
5262 | irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT; | ||
5263 | |||
5264 | ret = request_threaded_irq(wl->irq, wl12xx_hardirq, wl1271_irq, | ||
5265 | irqflags, | ||
5266 | pdev->name, wl); | ||
5267 | if (ret < 0) { | ||
5268 | wl1271_error("request_irq() failed: %d", ret); | ||
5269 | goto out_free_hw; | ||
5270 | } | ||
5271 | |||
5272 | ret = enable_irq_wake(wl->irq); | ||
5273 | if (!ret) { | ||
5274 | wl->irq_wake_enabled = true; | ||
5275 | device_init_wakeup(wl->dev, 1); | ||
5276 | if (pdata->pwr_in_suspend) | ||
5277 | hw->wiphy->wowlan.flags = WIPHY_WOWLAN_ANY; | ||
5278 | |||
5279 | } | ||
5280 | disable_irq(wl->irq); | ||
5281 | |||
5282 | ret = wl1271_init_ieee80211(wl); | ||
5283 | if (ret) | ||
5284 | goto out_irq; | ||
5285 | |||
5286 | ret = wl1271_register_hw(wl); | ||
5287 | if (ret) | ||
5288 | goto out_irq; | ||
5289 | |||
5205 | return 0; | 5290 | return 0; |
5291 | |||
5292 | out_irq: | ||
5293 | free_irq(wl->irq, wl); | ||
5294 | |||
5295 | out_free_hw: | ||
5296 | wl1271_free_hw(wl); | ||
5297 | |||
5298 | out: | ||
5299 | return ret; | ||
5206 | } | 5300 | } |
5207 | 5301 | ||
5208 | static int __devexit wl12xx_remove(struct platform_device *pdev) | 5302 | static int __devexit wl12xx_remove(struct platform_device *pdev) |
5209 | { | 5303 | { |
5304 | struct wl1271 *wl = platform_get_drvdata(pdev); | ||
5305 | |||
5306 | if (wl->irq_wake_enabled) { | ||
5307 | device_init_wakeup(wl->dev, 0); | ||
5308 | disable_irq_wake(wl->irq); | ||
5309 | } | ||
5310 | wl1271_unregister_hw(wl); | ||
5311 | free_irq(wl->irq, wl); | ||
5312 | wl1271_free_hw(wl); | ||
5313 | |||
5210 | return 0; | 5314 | return 0; |
5211 | } | 5315 | } |
5212 | 5316 | ||
diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c index e7ee5d155d3..78e5352c403 100644 --- a/drivers/net/wireless/wl12xx/sdio.c +++ b/drivers/net/wireless/wl12xx/sdio.c | |||
@@ -47,7 +47,6 @@ | |||
47 | 47 | ||
48 | struct wl12xx_sdio_glue { | 48 | struct wl12xx_sdio_glue { |
49 | struct device *dev; | 49 | struct device *dev; |
50 | struct wl1271 *wl; | ||
51 | struct platform_device *core; | 50 | struct platform_device *core; |
52 | }; | 51 | }; |
53 | 52 | ||
@@ -57,67 +56,22 @@ static const struct sdio_device_id wl1271_devices[] __devinitconst = { | |||
57 | }; | 56 | }; |
58 | MODULE_DEVICE_TABLE(sdio, wl1271_devices); | 57 | MODULE_DEVICE_TABLE(sdio, wl1271_devices); |
59 | 58 | ||
60 | static void wl1271_sdio_set_block_size(struct wl1271 *wl, unsigned int blksz) | 59 | static void wl1271_sdio_set_block_size(struct device *child, |
60 | unsigned int blksz) | ||
61 | { | 61 | { |
62 | sdio_claim_host(wl->if_priv); | 62 | struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); |
63 | sdio_set_block_size(wl->if_priv, blksz); | 63 | struct sdio_func *func = dev_to_sdio_func(glue->dev); |
64 | sdio_release_host(wl->if_priv); | ||
65 | } | ||
66 | |||
67 | static inline struct wl12xx_sdio_glue *wl_to_glue(struct wl1271 *wl) | ||
68 | { | ||
69 | return wl->if_priv; | ||
70 | } | ||
71 | |||
72 | static struct device *wl1271_sdio_wl_to_dev(struct wl1271 *wl) | ||
73 | { | ||
74 | return wl_to_glue(wl)->dev; | ||
75 | } | ||
76 | |||
77 | static irqreturn_t wl1271_hardirq(int irq, void *cookie) | ||
78 | { | ||
79 | struct wl1271 *wl = cookie; | ||
80 | unsigned long flags; | ||
81 | |||
82 | wl1271_debug(DEBUG_IRQ, "IRQ"); | ||
83 | |||
84 | /* complete the ELP completion */ | ||
85 | spin_lock_irqsave(&wl->wl_lock, flags); | ||
86 | set_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags); | ||
87 | if (wl->elp_compl) { | ||
88 | complete(wl->elp_compl); | ||
89 | wl->elp_compl = NULL; | ||
90 | } | ||
91 | |||
92 | if (test_bit(WL1271_FLAG_SUSPENDED, &wl->flags)) { | ||
93 | /* don't enqueue a work right now. mark it as pending */ | ||
94 | set_bit(WL1271_FLAG_PENDING_WORK, &wl->flags); | ||
95 | wl1271_debug(DEBUG_IRQ, "should not enqueue work"); | ||
96 | disable_irq_nosync(wl->irq); | ||
97 | pm_wakeup_event(wl1271_sdio_wl_to_dev(wl), 0); | ||
98 | spin_unlock_irqrestore(&wl->wl_lock, flags); | ||
99 | return IRQ_HANDLED; | ||
100 | } | ||
101 | spin_unlock_irqrestore(&wl->wl_lock, flags); | ||
102 | |||
103 | return IRQ_WAKE_THREAD; | ||
104 | } | ||
105 | |||
106 | static void wl1271_sdio_disable_interrupts(struct wl1271 *wl) | ||
107 | { | ||
108 | disable_irq(wl->irq); | ||
109 | } | ||
110 | 64 | ||
111 | static void wl1271_sdio_enable_interrupts(struct wl1271 *wl) | 65 | sdio_claim_host(func); |
112 | { | 66 | sdio_set_block_size(func, blksz); |
113 | enable_irq(wl->irq); | 67 | sdio_release_host(func); |
114 | } | 68 | } |
115 | 69 | ||
116 | static void wl1271_sdio_raw_read(struct wl1271 *wl, int addr, void *buf, | 70 | static void wl12xx_sdio_raw_read(struct device *child, int addr, void *buf, |
117 | size_t len, bool fixed) | 71 | size_t len, bool fixed) |
118 | { | 72 | { |
119 | int ret; | 73 | int ret; |
120 | struct wl12xx_sdio_glue *glue = wl_to_glue(wl); | 74 | struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); |
121 | struct sdio_func *func = dev_to_sdio_func(glue->dev); | 75 | struct sdio_func *func = dev_to_sdio_func(glue->dev); |
122 | 76 | ||
123 | if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) { | 77 | if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) { |
@@ -139,11 +93,11 @@ static void wl1271_sdio_raw_read(struct wl1271 *wl, int addr, void *buf, | |||
139 | wl1271_error("sdio read failed (%d)", ret); | 93 | wl1271_error("sdio read failed (%d)", ret); |
140 | } | 94 | } |
141 | 95 | ||
142 | static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf, | 96 | static void wl12xx_sdio_raw_write(struct device *child, int addr, void *buf, |
143 | size_t len, bool fixed) | 97 | size_t len, bool fixed) |
144 | { | 98 | { |
145 | int ret; | 99 | int ret; |
146 | struct wl12xx_sdio_glue *glue = wl_to_glue(wl); | 100 | struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); |
147 | struct sdio_func *func = dev_to_sdio_func(glue->dev); | 101 | struct sdio_func *func = dev_to_sdio_func(glue->dev); |
148 | 102 | ||
149 | if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) { | 103 | if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) { |
@@ -165,10 +119,9 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf, | |||
165 | wl1271_error("sdio write failed (%d)", ret); | 119 | wl1271_error("sdio write failed (%d)", ret); |
166 | } | 120 | } |
167 | 121 | ||
168 | static int wl1271_sdio_power_on(struct wl1271 *wl) | 122 | static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue) |
169 | { | 123 | { |
170 | int ret; | 124 | int ret; |
171 | struct wl12xx_sdio_glue *glue = wl_to_glue(wl); | ||
172 | struct sdio_func *func = dev_to_sdio_func(glue->dev); | 125 | struct sdio_func *func = dev_to_sdio_func(glue->dev); |
173 | 126 | ||
174 | /* If enabled, tell runtime PM not to power off the card */ | 127 | /* If enabled, tell runtime PM not to power off the card */ |
@@ -190,10 +143,9 @@ out: | |||
190 | return ret; | 143 | return ret; |
191 | } | 144 | } |
192 | 145 | ||
193 | static int wl1271_sdio_power_off(struct wl1271 *wl) | 146 | static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue) |
194 | { | 147 | { |
195 | int ret; | 148 | int ret; |
196 | struct wl12xx_sdio_glue *glue = wl_to_glue(wl); | ||
197 | struct sdio_func *func = dev_to_sdio_func(glue->dev); | 149 | struct sdio_func *func = dev_to_sdio_func(glue->dev); |
198 | 150 | ||
199 | sdio_disable_func(func); | 151 | sdio_disable_func(func); |
@@ -211,33 +163,29 @@ static int wl1271_sdio_power_off(struct wl1271 *wl) | |||
211 | return ret; | 163 | return ret; |
212 | } | 164 | } |
213 | 165 | ||
214 | static int wl1271_sdio_set_power(struct wl1271 *wl, bool enable) | 166 | static int wl12xx_sdio_set_power(struct device *child, bool enable) |
215 | { | 167 | { |
168 | struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); | ||
169 | |||
216 | if (enable) | 170 | if (enable) |
217 | return wl1271_sdio_power_on(wl); | 171 | return wl12xx_sdio_power_on(glue); |
218 | else | 172 | else |
219 | return wl1271_sdio_power_off(wl); | 173 | return wl12xx_sdio_power_off(glue); |
220 | } | 174 | } |
221 | 175 | ||
222 | static struct wl1271_if_operations sdio_ops = { | 176 | static struct wl1271_if_operations sdio_ops = { |
223 | .read = wl1271_sdio_raw_read, | 177 | .read = wl12xx_sdio_raw_read, |
224 | .write = wl1271_sdio_raw_write, | 178 | .write = wl12xx_sdio_raw_write, |
225 | .power = wl1271_sdio_set_power, | 179 | .power = wl12xx_sdio_set_power, |
226 | .dev = wl1271_sdio_wl_to_dev, | ||
227 | .enable_irq = wl1271_sdio_enable_interrupts, | ||
228 | .disable_irq = wl1271_sdio_disable_interrupts, | ||
229 | .set_block_size = wl1271_sdio_set_block_size, | 180 | .set_block_size = wl1271_sdio_set_block_size, |
230 | }; | 181 | }; |
231 | 182 | ||
232 | static int __devinit wl1271_probe(struct sdio_func *func, | 183 | static int __devinit wl1271_probe(struct sdio_func *func, |
233 | const struct sdio_device_id *id) | 184 | const struct sdio_device_id *id) |
234 | { | 185 | { |
235 | struct ieee80211_hw *hw; | 186 | struct wl12xx_platform_data *wlan_data; |
236 | const struct wl12xx_platform_data *wlan_data; | ||
237 | struct wl1271 *wl; | ||
238 | struct wl12xx_sdio_glue *glue; | 187 | struct wl12xx_sdio_glue *glue; |
239 | struct resource res[1]; | 188 | struct resource res[1]; |
240 | unsigned long irqflags; | ||
241 | mmc_pm_flag_t mmcflags; | 189 | mmc_pm_flag_t mmcflags; |
242 | int ret = -ENOMEM; | 190 | int ret = -ENOMEM; |
243 | 191 | ||
@@ -251,20 +199,7 @@ static int __devinit wl1271_probe(struct sdio_func *func, | |||
251 | goto out; | 199 | goto out; |
252 | } | 200 | } |
253 | 201 | ||
254 | hw = wl1271_alloc_hw(); | ||
255 | if (IS_ERR(hw)) { | ||
256 | wl1271_error("can't allocate hw"); | ||
257 | ret = PTR_ERR(hw); | ||
258 | goto out_free_glue; | ||
259 | } | ||
260 | |||
261 | wl = hw->priv; | ||
262 | |||
263 | glue->dev = &func->dev; | 202 | glue->dev = &func->dev; |
264 | glue->wl = wl; | ||
265 | |||
266 | wl->if_priv = glue; | ||
267 | wl->if_ops = &sdio_ops; | ||
268 | 203 | ||
269 | /* Grab access to FN0 for ELP reg. */ | 204 | /* Grab access to FN0 for ELP reg. */ |
270 | func->card->quirks |= MMC_QUIRK_LENIENT_FN0; | 205 | func->card->quirks |= MMC_QUIRK_LENIENT_FN0; |
@@ -276,48 +211,17 @@ static int __devinit wl1271_probe(struct sdio_func *func, | |||
276 | if (IS_ERR(wlan_data)) { | 211 | if (IS_ERR(wlan_data)) { |
277 | ret = PTR_ERR(wlan_data); | 212 | ret = PTR_ERR(wlan_data); |
278 | wl1271_error("missing wlan platform data: %d", ret); | 213 | wl1271_error("missing wlan platform data: %d", ret); |
279 | goto out_free_hw; | 214 | goto out_free_glue; |
280 | } | ||
281 | |||
282 | wl->irq = wlan_data->irq; | ||
283 | wl->ref_clock = wlan_data->board_ref_clock; | ||
284 | wl->tcxo_clock = wlan_data->board_tcxo_clock; | ||
285 | wl->platform_quirks = wlan_data->platform_quirks; | ||
286 | |||
287 | if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) | ||
288 | irqflags = IRQF_TRIGGER_RISING; | ||
289 | else | ||
290 | irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT; | ||
291 | |||
292 | ret = request_threaded_irq(wl->irq, wl1271_hardirq, wl1271_irq, | ||
293 | irqflags, | ||
294 | DRIVER_NAME, wl); | ||
295 | if (ret < 0) { | ||
296 | wl1271_error("request_irq() failed: %d", ret); | ||
297 | goto out_free_hw; | ||
298 | } | 215 | } |
299 | 216 | ||
300 | ret = enable_irq_wake(wl->irq); | 217 | /* if sdio can keep power while host is suspended, enable wow */ |
301 | if (!ret) { | 218 | mmcflags = sdio_get_host_pm_caps(func); |
302 | wl->irq_wake_enabled = true; | 219 | wl1271_debug(DEBUG_SDIO, "sdio PM caps = 0x%x", mmcflags); |
303 | device_init_wakeup(wl1271_sdio_wl_to_dev(wl), 1); | ||
304 | 220 | ||
305 | /* if sdio can keep power while host is suspended, enable wow */ | 221 | if (mmcflags & MMC_PM_KEEP_POWER) |
306 | mmcflags = sdio_get_host_pm_caps(func); | 222 | wlan_data->pwr_in_suspend = true; |
307 | wl1271_debug(DEBUG_SDIO, "sdio PM caps = 0x%x", mmcflags); | ||
308 | 223 | ||
309 | if (mmcflags & MMC_PM_KEEP_POWER) | 224 | wlan_data->ops = &sdio_ops; |
310 | hw->wiphy->wowlan.flags = WIPHY_WOWLAN_ANY; | ||
311 | } | ||
312 | disable_irq(wl->irq); | ||
313 | |||
314 | ret = wl1271_init_ieee80211(wl); | ||
315 | if (ret) | ||
316 | goto out_irq; | ||
317 | |||
318 | ret = wl1271_register_hw(wl); | ||
319 | if (ret) | ||
320 | goto out_irq; | ||
321 | 225 | ||
322 | sdio_set_drvdata(func, glue); | 226 | sdio_set_drvdata(func, glue); |
323 | 227 | ||
@@ -328,7 +232,7 @@ static int __devinit wl1271_probe(struct sdio_func *func, | |||
328 | if (!glue->core) { | 232 | if (!glue->core) { |
329 | wl1271_error("can't allocate platform_device"); | 233 | wl1271_error("can't allocate platform_device"); |
330 | ret = -ENOMEM; | 234 | ret = -ENOMEM; |
331 | goto out_unreg_hw; | 235 | goto out_free_glue; |
332 | } | 236 | } |
333 | 237 | ||
334 | glue->core->dev.parent = &func->dev; | 238 | glue->core->dev.parent = &func->dev; |
@@ -362,17 +266,9 @@ static int __devinit wl1271_probe(struct sdio_func *func, | |||
362 | out_dev_put: | 266 | out_dev_put: |
363 | platform_device_put(glue->core); | 267 | platform_device_put(glue->core); |
364 | 268 | ||
365 | out_unreg_hw: | ||
366 | wl1271_unregister_hw(wl); | ||
367 | |||
368 | out_irq: | ||
369 | free_irq(wl->irq, wl); | ||
370 | |||
371 | out_free_hw: | ||
372 | wl1271_free_hw(wl); | ||
373 | |||
374 | out_free_glue: | 269 | out_free_glue: |
375 | kfree(glue); | 270 | kfree(glue); |
271 | |||
376 | out: | 272 | out: |
377 | return ret; | 273 | return ret; |
378 | } | 274 | } |
@@ -380,18 +276,10 @@ out: | |||
380 | static void __devexit wl1271_remove(struct sdio_func *func) | 276 | static void __devexit wl1271_remove(struct sdio_func *func) |
381 | { | 277 | { |
382 | struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func); | 278 | struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func); |
383 | struct wl1271 *wl = glue->wl; | ||
384 | 279 | ||
385 | /* Undo decrement done above in wl1271_probe */ | 280 | /* Undo decrement done above in wl1271_probe */ |
386 | pm_runtime_get_noresume(&func->dev); | 281 | pm_runtime_get_noresume(&func->dev); |
387 | 282 | ||
388 | wl1271_unregister_hw(wl); | ||
389 | if (wl->irq_wake_enabled) { | ||
390 | device_init_wakeup(wl1271_sdio_wl_to_dev(wl), 0); | ||
391 | disable_irq_wake(wl->irq); | ||
392 | } | ||
393 | free_irq(wl->irq, wl); | ||
394 | wl1271_free_hw(wl); | ||
395 | platform_device_del(glue->core); | 283 | platform_device_del(glue->core); |
396 | platform_device_put(glue->core); | 284 | platform_device_put(glue->core); |
397 | kfree(glue); | 285 | kfree(glue); |
diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c index 2dd659886a0..22c1337ba88 100644 --- a/drivers/net/wireless/wl12xx/spi.c +++ b/drivers/net/wireless/wl12xx/spi.c | |||
@@ -72,33 +72,12 @@ | |||
72 | 72 | ||
73 | struct wl12xx_spi_glue { | 73 | struct wl12xx_spi_glue { |
74 | struct device *dev; | 74 | struct device *dev; |
75 | struct wl1271 *wl; | ||
76 | struct platform_device *core; | 75 | struct platform_device *core; |
77 | }; | 76 | }; |
78 | 77 | ||
79 | static inline struct wl12xx_spi_glue *wl_to_glue(struct wl1271 *wl) | 78 | static void wl12xx_spi_reset(struct device *child) |
80 | { | 79 | { |
81 | return wl->if_priv; | 80 | struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); |
82 | } | ||
83 | |||
84 | static struct device *wl1271_spi_wl_to_dev(struct wl1271 *wl) | ||
85 | { | ||
86 | return wl_to_glue(wl)->dev; | ||
87 | } | ||
88 | |||
89 | static void wl1271_spi_disable_interrupts(struct wl1271 *wl) | ||
90 | { | ||
91 | disable_irq(wl->irq); | ||
92 | } | ||
93 | |||
94 | static void wl1271_spi_enable_interrupts(struct wl1271 *wl) | ||
95 | { | ||
96 | enable_irq(wl->irq); | ||
97 | } | ||
98 | |||
99 | static void wl1271_spi_reset(struct wl1271 *wl) | ||
100 | { | ||
101 | struct wl12xx_spi_glue *glue = wl_to_glue(wl); | ||
102 | u8 *cmd; | 81 | u8 *cmd; |
103 | struct spi_transfer t; | 82 | struct spi_transfer t; |
104 | struct spi_message m; | 83 | struct spi_message m; |
@@ -124,9 +103,9 @@ static void wl1271_spi_reset(struct wl1271 *wl) | |||
124 | kfree(cmd); | 103 | kfree(cmd); |
125 | } | 104 | } |
126 | 105 | ||
127 | static void wl1271_spi_init(struct wl1271 *wl) | 106 | static void wl12xx_spi_init(struct device *child) |
128 | { | 107 | { |
129 | struct wl12xx_spi_glue *glue = wl_to_glue(wl); | 108 | struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); |
130 | u8 crc[WSPI_INIT_CMD_CRC_LEN], *cmd; | 109 | u8 crc[WSPI_INIT_CMD_CRC_LEN], *cmd; |
131 | struct spi_transfer t; | 110 | struct spi_transfer t; |
132 | struct spi_message m; | 111 | struct spi_message m; |
@@ -181,9 +160,10 @@ static void wl1271_spi_init(struct wl1271 *wl) | |||
181 | 160 | ||
182 | #define WL1271_BUSY_WORD_TIMEOUT 1000 | 161 | #define WL1271_BUSY_WORD_TIMEOUT 1000 |
183 | 162 | ||
184 | static int wl1271_spi_read_busy(struct wl1271 *wl) | 163 | static int wl12xx_spi_read_busy(struct device *child) |
185 | { | 164 | { |
186 | struct wl12xx_spi_glue *glue = wl_to_glue(wl); | 165 | struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); |
166 | struct wl1271 *wl = dev_get_drvdata(child); | ||
187 | struct spi_transfer t[1]; | 167 | struct spi_transfer t[1]; |
188 | struct spi_message m; | 168 | struct spi_message m; |
189 | u32 *busy_buf; | 169 | u32 *busy_buf; |
@@ -215,10 +195,11 @@ static int wl1271_spi_read_busy(struct wl1271 *wl) | |||
215 | return -ETIMEDOUT; | 195 | return -ETIMEDOUT; |
216 | } | 196 | } |
217 | 197 | ||
218 | static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf, | 198 | static void wl12xx_spi_raw_read(struct device *child, int addr, void *buf, |
219 | size_t len, bool fixed) | 199 | size_t len, bool fixed) |
220 | { | 200 | { |
221 | struct wl12xx_spi_glue *glue = wl_to_glue(wl); | 201 | struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); |
202 | struct wl1271 *wl = dev_get_drvdata(child); | ||
222 | struct spi_transfer t[2]; | 203 | struct spi_transfer t[2]; |
223 | struct spi_message m; | 204 | struct spi_message m; |
224 | u32 *busy_buf; | 205 | u32 *busy_buf; |
@@ -257,7 +238,7 @@ static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf, | |||
257 | spi_sync(to_spi_device(glue->dev), &m); | 238 | spi_sync(to_spi_device(glue->dev), &m); |
258 | 239 | ||
259 | if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1) && | 240 | if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1) && |
260 | wl1271_spi_read_busy(wl)) { | 241 | wl12xx_spi_read_busy(child)) { |
261 | memset(buf, 0, chunk_len); | 242 | memset(buf, 0, chunk_len); |
262 | return; | 243 | return; |
263 | } | 244 | } |
@@ -282,10 +263,10 @@ static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf, | |||
282 | } | 263 | } |
283 | } | 264 | } |
284 | 265 | ||
285 | static void wl1271_spi_raw_write(struct wl1271 *wl, int addr, void *buf, | 266 | static void wl12xx_spi_raw_write(struct device *child, int addr, void *buf, |
286 | size_t len, bool fixed) | 267 | size_t len, bool fixed) |
287 | { | 268 | { |
288 | struct wl12xx_spi_glue *glue = wl_to_glue(wl); | 269 | struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); |
289 | struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS]; | 270 | struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS]; |
290 | struct spi_message m; | 271 | struct spi_message m; |
291 | u32 commands[WSPI_MAX_NUM_OF_CHUNKS]; | 272 | u32 commands[WSPI_MAX_NUM_OF_CHUNKS]; |
@@ -333,42 +314,11 @@ static void wl1271_spi_raw_write(struct wl1271 *wl, int addr, void *buf, | |||
333 | spi_sync(to_spi_device(glue->dev), &m); | 314 | spi_sync(to_spi_device(glue->dev), &m); |
334 | } | 315 | } |
335 | 316 | ||
336 | static irqreturn_t wl1271_hardirq(int irq, void *cookie) | ||
337 | { | ||
338 | struct wl1271 *wl = cookie; | ||
339 | unsigned long flags; | ||
340 | |||
341 | wl1271_debug(DEBUG_IRQ, "IRQ"); | ||
342 | |||
343 | /* complete the ELP completion */ | ||
344 | spin_lock_irqsave(&wl->wl_lock, flags); | ||
345 | set_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags); | ||
346 | if (wl->elp_compl) { | ||
347 | complete(wl->elp_compl); | ||
348 | wl->elp_compl = NULL; | ||
349 | } | ||
350 | spin_unlock_irqrestore(&wl->wl_lock, flags); | ||
351 | |||
352 | return IRQ_WAKE_THREAD; | ||
353 | } | ||
354 | |||
355 | static int wl1271_spi_set_power(struct wl1271 *wl, bool enable) | ||
356 | { | ||
357 | if (wl->set_power) | ||
358 | wl->set_power(enable); | ||
359 | |||
360 | return 0; | ||
361 | } | ||
362 | |||
363 | static struct wl1271_if_operations spi_ops = { | 317 | static struct wl1271_if_operations spi_ops = { |
364 | .read = wl1271_spi_raw_read, | 318 | .read = wl12xx_spi_raw_read, |
365 | .write = wl1271_spi_raw_write, | 319 | .write = wl12xx_spi_raw_write, |
366 | .reset = wl1271_spi_reset, | 320 | .reset = wl12xx_spi_reset, |
367 | .init = wl1271_spi_init, | 321 | .init = wl12xx_spi_init, |
368 | .power = wl1271_spi_set_power, | ||
369 | .dev = wl1271_spi_wl_to_dev, | ||
370 | .enable_irq = wl1271_spi_enable_interrupts, | ||
371 | .disable_irq = wl1271_spi_disable_interrupts, | ||
372 | .set_block_size = NULL, | 322 | .set_block_size = NULL, |
373 | }; | 323 | }; |
374 | 324 | ||
@@ -376,10 +326,7 @@ static int __devinit wl1271_probe(struct spi_device *spi) | |||
376 | { | 326 | { |
377 | struct wl12xx_spi_glue *glue; | 327 | struct wl12xx_spi_glue *glue; |
378 | struct wl12xx_platform_data *pdata; | 328 | struct wl12xx_platform_data *pdata; |
379 | struct ieee80211_hw *hw; | ||
380 | struct wl1271 *wl; | ||
381 | struct resource res[1]; | 329 | struct resource res[1]; |
382 | unsigned long irqflags; | ||
383 | int ret = -ENOMEM; | 330 | int ret = -ENOMEM; |
384 | 331 | ||
385 | pdata = spi->dev.platform_data; | 332 | pdata = spi->dev.platform_data; |
@@ -388,27 +335,17 @@ static int __devinit wl1271_probe(struct spi_device *spi) | |||
388 | return -ENODEV; | 335 | return -ENODEV; |
389 | } | 336 | } |
390 | 337 | ||
338 | pdata->ops = &spi_ops; | ||
339 | |||
391 | glue = kzalloc(sizeof(*glue), GFP_KERNEL); | 340 | glue = kzalloc(sizeof(*glue), GFP_KERNEL); |
392 | if (!glue) { | 341 | if (!glue) { |
393 | wl1271_error("can't allocate glue"); | 342 | wl1271_error("can't allocate glue"); |
394 | goto out; | 343 | goto out; |
395 | } | 344 | } |
396 | 345 | ||
397 | hw = wl1271_alloc_hw(); | ||
398 | if (IS_ERR(hw)) { | ||
399 | ret = PTR_ERR(hw); | ||
400 | goto out_free_glue; | ||
401 | } | ||
402 | |||
403 | wl = hw->priv; | ||
404 | |||
405 | glue->dev = &spi->dev; | 346 | glue->dev = &spi->dev; |
406 | glue->wl = wl; | ||
407 | 347 | ||
408 | spi_set_drvdata(spi, glue); | 348 | spi_set_drvdata(spi, glue); |
409 | wl->if_priv = glue; | ||
410 | |||
411 | wl->if_ops = &spi_ops; | ||
412 | 349 | ||
413 | /* This is the only SPI value that we need to set here, the rest | 350 | /* This is the only SPI value that we need to set here, the rest |
414 | * comes from the board-peripherals file */ | 351 | * comes from the board-peripherals file */ |
@@ -417,55 +354,14 @@ static int __devinit wl1271_probe(struct spi_device *spi) | |||
417 | ret = spi_setup(spi); | 354 | ret = spi_setup(spi); |
418 | if (ret < 0) { | 355 | if (ret < 0) { |
419 | wl1271_error("spi_setup failed"); | 356 | wl1271_error("spi_setup failed"); |
420 | goto out_free_hw; | 357 | goto out_free_glue; |
421 | } | ||
422 | |||
423 | wl->set_power = pdata->set_power; | ||
424 | if (!wl->set_power) { | ||
425 | wl1271_error("set power function missing in platform data"); | ||
426 | ret = -ENODEV; | ||
427 | goto out_free_hw; | ||
428 | } | ||
429 | |||
430 | wl->ref_clock = pdata->board_ref_clock; | ||
431 | wl->tcxo_clock = pdata->board_tcxo_clock; | ||
432 | wl->platform_quirks = pdata->platform_quirks; | ||
433 | |||
434 | if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) | ||
435 | irqflags = IRQF_TRIGGER_RISING; | ||
436 | else | ||
437 | irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT; | ||
438 | |||
439 | wl->irq = spi->irq; | ||
440 | if (wl->irq < 0) { | ||
441 | wl1271_error("irq missing in platform data"); | ||
442 | ret = -ENODEV; | ||
443 | goto out_free_hw; | ||
444 | } | ||
445 | |||
446 | ret = request_threaded_irq(wl->irq, wl1271_hardirq, wl1271_irq, | ||
447 | irqflags, | ||
448 | DRIVER_NAME, wl); | ||
449 | if (ret < 0) { | ||
450 | wl1271_error("request_irq() failed: %d", ret); | ||
451 | goto out_free_hw; | ||
452 | } | 358 | } |
453 | 359 | ||
454 | disable_irq(wl->irq); | ||
455 | |||
456 | ret = wl1271_init_ieee80211(wl); | ||
457 | if (ret) | ||
458 | goto out_irq; | ||
459 | |||
460 | ret = wl1271_register_hw(wl); | ||
461 | if (ret) | ||
462 | goto out_irq; | ||
463 | |||
464 | glue->core = platform_device_alloc("wl12xx-spi", -1); | 360 | glue->core = platform_device_alloc("wl12xx-spi", -1); |
465 | if (!glue->core) { | 361 | if (!glue->core) { |
466 | wl1271_error("can't allocate platform_device"); | 362 | wl1271_error("can't allocate platform_device"); |
467 | ret = -ENOMEM; | 363 | ret = -ENOMEM; |
468 | goto out_unreg_hw; | 364 | goto out_free_glue; |
469 | } | 365 | } |
470 | 366 | ||
471 | glue->core->dev.parent = &spi->dev; | 367 | glue->core->dev.parent = &spi->dev; |
@@ -499,15 +395,6 @@ static int __devinit wl1271_probe(struct spi_device *spi) | |||
499 | out_dev_put: | 395 | out_dev_put: |
500 | platform_device_put(glue->core); | 396 | platform_device_put(glue->core); |
501 | 397 | ||
502 | out_unreg_hw: | ||
503 | wl1271_unregister_hw(wl); | ||
504 | |||
505 | out_irq: | ||
506 | free_irq(wl->irq, wl); | ||
507 | |||
508 | out_free_hw: | ||
509 | wl1271_free_hw(wl); | ||
510 | |||
511 | out_free_glue: | 398 | out_free_glue: |
512 | kfree(glue); | 399 | kfree(glue); |
513 | out: | 400 | out: |
@@ -517,11 +404,7 @@ out: | |||
517 | static int __devexit wl1271_remove(struct spi_device *spi) | 404 | static int __devexit wl1271_remove(struct spi_device *spi) |
518 | { | 405 | { |
519 | struct wl12xx_spi_glue *glue = spi_get_drvdata(spi); | 406 | struct wl12xx_spi_glue *glue = spi_get_drvdata(spi); |
520 | struct wl1271 *wl = glue->wl; | ||
521 | 407 | ||
522 | wl1271_unregister_hw(wl); | ||
523 | free_irq(wl->irq, wl); | ||
524 | wl1271_free_hw(wl); | ||
525 | platform_device_del(glue->core); | 408 | platform_device_del(glue->core); |
526 | platform_device_put(glue->core); | 409 | platform_device_put(glue->core); |
527 | kfree(glue); | 410 | kfree(glue); |
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h index 8815fd9a0f4..d2028939eee 100644 --- a/drivers/net/wireless/wl12xx/wl12xx.h +++ b/drivers/net/wireless/wl12xx/wl12xx.h | |||
@@ -288,17 +288,14 @@ struct wl1271_scan { | |||
288 | }; | 288 | }; |
289 | 289 | ||
290 | struct wl1271_if_operations { | 290 | struct wl1271_if_operations { |
291 | void (*read)(struct wl1271 *wl, int addr, void *buf, size_t len, | 291 | void (*read)(struct device *child, int addr, void *buf, size_t len, |
292 | bool fixed); | 292 | bool fixed); |
293 | void (*write)(struct wl1271 *wl, int addr, void *buf, size_t len, | 293 | void (*write)(struct device *child, int addr, void *buf, size_t len, |
294 | bool fixed); | 294 | bool fixed); |
295 | void (*reset)(struct wl1271 *wl); | 295 | void (*reset)(struct device *child); |
296 | void (*init)(struct wl1271 *wl); | 296 | void (*init)(struct device *child); |
297 | int (*power)(struct wl1271 *wl, bool enable); | 297 | int (*power)(struct device *child, bool enable); |
298 | struct device* (*dev)(struct wl1271 *wl); | 298 | void (*set_block_size) (struct device *child, unsigned int blksz); |
299 | void (*enable_irq)(struct wl1271 *wl); | ||
300 | void (*disable_irq)(struct wl1271 *wl); | ||
301 | void (*set_block_size) (struct wl1271 *wl, unsigned int blksz); | ||
302 | }; | 299 | }; |
303 | 300 | ||
304 | #define MAX_NUM_KEYS 14 | 301 | #define MAX_NUM_KEYS 14 |
@@ -362,6 +359,8 @@ struct wl1271 { | |||
362 | struct ieee80211_hw *hw; | 359 | struct ieee80211_hw *hw; |
363 | bool mac80211_registered; | 360 | bool mac80211_registered; |
364 | 361 | ||
362 | struct device *dev; | ||
363 | |||
365 | void *if_priv; | 364 | void *if_priv; |
366 | 365 | ||
367 | struct wl1271_if_operations *if_ops; | 366 | struct wl1271_if_operations *if_ops; |
diff --git a/drivers/net/wireless/wl12xx/wl12xx_platform_data.c b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c index 973b11060a8..3c96b332184 100644 --- a/drivers/net/wireless/wl12xx/wl12xx_platform_data.c +++ b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c | |||
@@ -2,7 +2,7 @@ | |||
2 | #include <linux/err.h> | 2 | #include <linux/err.h> |
3 | #include <linux/wl12xx.h> | 3 | #include <linux/wl12xx.h> |
4 | 4 | ||
5 | static const struct wl12xx_platform_data *platform_data; | 5 | static struct wl12xx_platform_data *platform_data; |
6 | 6 | ||
7 | int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data) | 7 | int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data) |
8 | { | 8 | { |
@@ -18,7 +18,7 @@ int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data) | |||
18 | return 0; | 18 | return 0; |
19 | } | 19 | } |
20 | 20 | ||
21 | const struct wl12xx_platform_data *wl12xx_get_platform_data(void) | 21 | struct wl12xx_platform_data *wl12xx_get_platform_data(void) |
22 | { | 22 | { |
23 | if (!platform_data) | 23 | if (!platform_data) |
24 | return ERR_PTR(-ENODEV); | 24 | return ERR_PTR(-ENODEV); |
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h index 4b697395326..0d6373195d3 100644 --- a/include/linux/wl12xx.h +++ b/include/linux/wl12xx.h | |||
@@ -54,6 +54,9 @@ struct wl12xx_platform_data { | |||
54 | int board_ref_clock; | 54 | int board_ref_clock; |
55 | int board_tcxo_clock; | 55 | int board_tcxo_clock; |
56 | unsigned long platform_quirks; | 56 | unsigned long platform_quirks; |
57 | bool pwr_in_suspend; | ||
58 | |||
59 | struct wl1271_if_operations *ops; | ||
57 | }; | 60 | }; |
58 | 61 | ||
59 | /* Platform does not support level trigger interrupts */ | 62 | /* Platform does not support level trigger interrupts */ |
@@ -73,6 +76,6 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data) | |||
73 | 76 | ||
74 | #endif | 77 | #endif |
75 | 78 | ||
76 | const struct wl12xx_platform_data *wl12xx_get_platform_data(void); | 79 | struct wl12xx_platform_data *wl12xx_get_platform_data(void); |
77 | 80 | ||
78 | #endif | 81 | #endif |