aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/airo_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/airo_cs.c')
-rw-r--r--drivers/net/wireless/airo_cs.c74
1 files changed, 16 insertions, 58 deletions
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index 33bdc6a84e81..9a121a5b787c 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -32,7 +32,6 @@
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/netdevice.h> 33#include <linux/netdevice.h>
34 34
35#include <pcmcia/cs_types.h>
36#include <pcmcia/cs.h> 35#include <pcmcia/cs.h>
37#include <pcmcia/cistpl.h> 36#include <pcmcia/cistpl.h>
38#include <pcmcia/cisreg.h> 37#include <pcmcia/cisreg.h>
@@ -155,8 +154,6 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
155 unsigned int vcc, 154 unsigned int vcc,
156 void *priv_data) 155 void *priv_data)
157{ 156{
158 win_req_t *req = priv_data;
159
160 if (cfg->index == 0) 157 if (cfg->index == 0)
161 return -ENODEV; 158 return -ENODEV;
162 159
@@ -176,52 +173,25 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
176 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 173 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
177 174
178 /* IO window settings */ 175 /* IO window settings */
179 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 176 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
180 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 177 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
181 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 178 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
182 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 179 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
183 if (!(io->flags & CISTPL_IO_8BIT)) 180 p_dev->resource[0]->flags |=
184 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 181 pcmcia_io_cfg_data_width(io->flags);
185 if (!(io->flags & CISTPL_IO_16BIT)) 182 p_dev->resource[0]->start = io->win[0].base;
186 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 183 p_dev->resource[0]->end = io->win[0].len;
187 p_dev->io.BasePort1 = io->win[0].base;
188 p_dev->io.NumPorts1 = io->win[0].len;
189 if (io->nwin > 1) { 184 if (io->nwin > 1) {
190 p_dev->io.Attributes2 = p_dev->io.Attributes1; 185 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
191 p_dev->io.BasePort2 = io->win[1].base; 186 p_dev->resource[1]->start = io->win[1].base;
192 p_dev->io.NumPorts2 = io->win[1].len; 187 p_dev->resource[1]->end = io->win[1].len;
193 } 188 }
194 } 189 }
195 190
196 /* This reserves IO space but doesn't actually enable it */ 191 /* This reserves IO space but doesn't actually enable it */
197 if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 192 if (pcmcia_request_io(p_dev) != 0)
198 return -ENODEV; 193 return -ENODEV;
199 194
200 /*
201 Now set up a common memory window, if needed. There is room
202 in the struct pcmcia_device structure for one memory window handle,
203 but if the base addresses need to be saved, or if multiple
204 windows are needed, the info should go in the private data
205 structure for this device.
206
207 Note that the memory window base is a physical address, and
208 needs to be mapped to virtual space with ioremap() before it
209 is used.
210 */
211 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
212 cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
213 memreq_t map;
214 req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
215 req->Base = mem->win[0].host_addr;
216 req->Size = mem->win[0].len;
217 req->AccessSpeed = 0;
218 if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0)
219 return -ENODEV;
220 map.Page = 0;
221 map.CardOffset = mem->win[0].card_addr;
222 if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0)
223 return -ENODEV;
224 }
225 /* If we got this far, we're cool! */ 195 /* If we got this far, we're cool! */
226 return 0; 196 return 0;
227} 197}
@@ -230,17 +200,12 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
230static int airo_config(struct pcmcia_device *link) 200static int airo_config(struct pcmcia_device *link)
231{ 201{
232 local_info_t *dev; 202 local_info_t *dev;
233 win_req_t *req;
234 int ret; 203 int ret;
235 204
236 dev = link->priv; 205 dev = link->priv;
237 206
238 dev_dbg(&link->dev, "airo_config\n"); 207 dev_dbg(&link->dev, "airo_config\n");
239 208
240 req = kzalloc(sizeof(win_req_t), GFP_KERNEL);
241 if (!req)
242 return -ENOMEM;
243
244 /* 209 /*
245 * In this loop, we scan the CIS for configuration table 210 * In this loop, we scan the CIS for configuration table
246 * entries, each of which describes a valid card 211 * entries, each of which describes a valid card
@@ -255,7 +220,7 @@ static int airo_config(struct pcmcia_device *link)
255 * and most client drivers will only use the CIS to fill in 220 * and most client drivers will only use the CIS to fill in
256 * implementation-defined details. 221 * implementation-defined details.
257 */ 222 */
258 ret = pcmcia_loop_config(link, airo_cs_config_check, req); 223 ret = pcmcia_loop_config(link, airo_cs_config_check, NULL);
259 if (ret) 224 if (ret)
260 goto failed; 225 goto failed;
261 226
@@ -272,7 +237,7 @@ static int airo_config(struct pcmcia_device *link)
272 goto failed; 237 goto failed;
273 ((local_info_t *)link->priv)->eth_dev = 238 ((local_info_t *)link->priv)->eth_dev =
274 init_airo_card(link->irq, 239 init_airo_card(link->irq,
275 link->io.BasePort1, 1, &link->dev); 240 link->resource[0]->start, 1, &link->dev);
276 if (!((local_info_t *)link->priv)->eth_dev) 241 if (!((local_info_t *)link->priv)->eth_dev)
277 goto failed; 242 goto failed;
278 243
@@ -282,22 +247,15 @@ static int airo_config(struct pcmcia_device *link)
282 if (link->conf.Vpp) 247 if (link->conf.Vpp)
283 printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); 248 printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10);
284 printk(", irq %d", link->irq); 249 printk(", irq %d", link->irq);
285 if (link->io.NumPorts1) 250 if (link->resource[0])
286 printk(", io 0x%04x-0x%04x", link->io.BasePort1, 251 printk(" & %pR", link->resource[0]);
287 link->io.BasePort1+link->io.NumPorts1-1); 252 if (link->resource[1])
288 if (link->io.NumPorts2) 253 printk(" & %pR", link->resource[1]);
289 printk(" & 0x%04x-0x%04x", link->io.BasePort2,
290 link->io.BasePort2+link->io.NumPorts2-1);
291 if (link->win)
292 printk(", mem 0x%06lx-0x%06lx", req->Base,
293 req->Base+req->Size-1);
294 printk("\n"); 254 printk("\n");
295 kfree(req);
296 return 0; 255 return 0;
297 256
298 failed: 257 failed:
299 airo_release(link); 258 airo_release(link);
300 kfree(req);
301 return -ENODEV; 259 return -ENODEV;
302} /* airo_config */ 260} /* airo_config */
303 261