aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/hostap')
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c136
1 files changed, 43 insertions, 93 deletions
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 29b31a694b59..ba54d1b04d22 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -12,7 +12,6 @@
12#include <linux/wireless.h> 12#include <linux/wireless.h>
13#include <net/iw_handler.h> 13#include <net/iw_handler.h>
14 14
15#include <pcmcia/cs_types.h>
16#include <pcmcia/cs.h> 15#include <pcmcia/cs.h>
17#include <pcmcia/cistpl.h> 16#include <pcmcia/cistpl.h>
18#include <pcmcia/cisreg.h> 17#include <pcmcia/cisreg.h>
@@ -23,7 +22,7 @@
23#include "hostap_wlan.h" 22#include "hostap_wlan.h"
24 23
25 24
26static dev_info_t dev_info = "hostap_cs"; 25static char *dev_info = "hostap_cs";
27 26
28MODULE_AUTHOR("Jouni Malinen"); 27MODULE_AUTHOR("Jouni Malinen");
29MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " 28MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN "
@@ -225,27 +224,18 @@ static int prism2_pccard_card_present(local_info_t *local)
225static void sandisk_set_iobase(local_info_t *local) 224static void sandisk_set_iobase(local_info_t *local)
226{ 225{
227 int res; 226 int res;
228 conf_reg_t reg;
229 struct hostap_cs_priv *hw_priv = local->hw_priv; 227 struct hostap_cs_priv *hw_priv = local->hw_priv;
230 228
231 reg.Function = 0; 229 res = pcmcia_write_config_byte(hw_priv->link, 0x10,
232 reg.Action = CS_WRITE; 230 hw_priv->link->resource[0]->start & 0x00ff);
233 reg.Offset = 0x10; /* 0x3f0 IO base 1 */
234 reg.Value = hw_priv->link->io.BasePort1 & 0x00ff;
235 res = pcmcia_access_configuration_register(hw_priv->link,
236 &reg);
237 if (res != 0) { 231 if (res != 0) {
238 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" 232 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -"
239 " res=%d\n", res); 233 " res=%d\n", res);
240 } 234 }
241 udelay(10); 235 udelay(10);
242 236
243 reg.Function = 0; 237 res = pcmcia_write_config_byte(hw_priv->link, 0x12,
244 reg.Action = CS_WRITE; 238 (hw_priv->link->resource[0]->start >> 8) & 0x00ff);
245 reg.Offset = 0x12; /* 0x3f2 IO base 2 */
246 reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8;
247 res = pcmcia_access_configuration_register(hw_priv->link,
248 &reg);
249 if (res != 0) { 239 if (res != 0) {
250 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" 240 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -"
251 " res=%d\n", res); 241 " res=%d\n", res);
@@ -271,12 +261,11 @@ static void sandisk_write_hcr(local_info_t *local, int hcr)
271static int sandisk_enable_wireless(struct net_device *dev) 261static int sandisk_enable_wireless(struct net_device *dev)
272{ 262{
273 int res, ret = 0; 263 int res, ret = 0;
274 conf_reg_t reg;
275 struct hostap_interface *iface = netdev_priv(dev); 264 struct hostap_interface *iface = netdev_priv(dev);
276 local_info_t *local = iface->local; 265 local_info_t *local = iface->local;
277 struct hostap_cs_priv *hw_priv = local->hw_priv; 266 struct hostap_cs_priv *hw_priv = local->hw_priv;
278 267
279 if (hw_priv->link->io.NumPorts1 < 0x42) { 268 if (resource_size(hw_priv->link->resource[0]) < 0x42) {
280 /* Not enough ports to be SanDisk multi-function card */ 269 /* Not enough ports to be SanDisk multi-function card */
281 ret = -ENODEV; 270 ret = -ENODEV;
282 goto done; 271 goto done;
@@ -298,12 +287,8 @@ static int sandisk_enable_wireless(struct net_device *dev)
298 " - using vendor-specific initialization\n", dev->name); 287 " - using vendor-specific initialization\n", dev->name);
299 hw_priv->sandisk_connectplus = 1; 288 hw_priv->sandisk_connectplus = 1;
300 289
301 reg.Function = 0; 290 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
302 reg.Action = CS_WRITE; 291 COR_SOFT_RESET);
303 reg.Offset = CISREG_COR;
304 reg.Value = COR_SOFT_RESET;
305 res = pcmcia_access_configuration_register(hw_priv->link,
306 &reg);
307 if (res != 0) { 292 if (res != 0) {
308 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", 293 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
309 dev->name, res); 294 dev->name, res);
@@ -311,16 +296,13 @@ static int sandisk_enable_wireless(struct net_device *dev)
311 } 296 }
312 mdelay(5); 297 mdelay(5);
313 298
314 reg.Function = 0;
315 reg.Action = CS_WRITE;
316 reg.Offset = CISREG_COR;
317 /* 299 /*
318 * Do not enable interrupts here to avoid some bogus events. Interrupts 300 * Do not enable interrupts here to avoid some bogus events. Interrupts
319 * will be enabled during the first cor_sreset call. 301 * will be enabled during the first cor_sreset call.
320 */ 302 */
321 reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA; 303 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
322 res = pcmcia_access_configuration_register(hw_priv->link, 304 (COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE |
323 &reg); 305 COR_FUNC_ENA));
324 if (res != 0) { 306 if (res != 0) {
325 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", 307 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
326 dev->name, res); 308 dev->name, res);
@@ -343,30 +325,23 @@ done:
343static void prism2_pccard_cor_sreset(local_info_t *local) 325static void prism2_pccard_cor_sreset(local_info_t *local)
344{ 326{
345 int res; 327 int res;
346 conf_reg_t reg; 328 u8 val;
347 struct hostap_cs_priv *hw_priv = local->hw_priv; 329 struct hostap_cs_priv *hw_priv = local->hw_priv;
348 330
349 if (!prism2_pccard_card_present(local)) 331 if (!prism2_pccard_card_present(local))
350 return; 332 return;
351 333
352 reg.Function = 0; 334 res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &val);
353 reg.Action = CS_READ;
354 reg.Offset = CISREG_COR;
355 reg.Value = 0;
356 res = pcmcia_access_configuration_register(hw_priv->link,
357 &reg);
358 if (res != 0) { 335 if (res != 0) {
359 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", 336 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n",
360 res); 337 res);
361 return; 338 return;
362 } 339 }
363 printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n", 340 printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n",
364 reg.Value); 341 val);
365 342
366 reg.Action = CS_WRITE; 343 val |= COR_SOFT_RESET;
367 reg.Value |= COR_SOFT_RESET; 344 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val);
368 res = pcmcia_access_configuration_register(hw_priv->link,
369 &reg);
370 if (res != 0) { 345 if (res != 0) {
371 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", 346 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n",
372 res); 347 res);
@@ -375,11 +350,10 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
375 350
376 mdelay(hw_priv->sandisk_connectplus ? 5 : 2); 351 mdelay(hw_priv->sandisk_connectplus ? 5 : 2);
377 352
378 reg.Value &= ~COR_SOFT_RESET; 353 val &= ~COR_SOFT_RESET;
379 if (hw_priv->sandisk_connectplus) 354 if (hw_priv->sandisk_connectplus)
380 reg.Value |= COR_IREQ_ENA; 355 val |= COR_IREQ_ENA;
381 res = pcmcia_access_configuration_register(hw_priv->link, 356 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val);
382 &reg);
383 if (res != 0) { 357 if (res != 0) {
384 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", 358 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n",
385 res); 359 res);
@@ -396,8 +370,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
396static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) 370static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
397{ 371{
398 int res; 372 int res;
399 conf_reg_t reg; 373 u8 old_cor;
400 int old_cor;
401 struct hostap_cs_priv *hw_priv = local->hw_priv; 374 struct hostap_cs_priv *hw_priv = local->hw_priv;
402 375
403 if (!prism2_pccard_card_present(local)) 376 if (!prism2_pccard_card_present(local))
@@ -408,25 +381,17 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
408 return; 381 return;
409 } 382 }
410 383
411 reg.Function = 0; 384 res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &old_cor);
412 reg.Action = CS_READ;
413 reg.Offset = CISREG_COR;
414 reg.Value = 0;
415 res = pcmcia_access_configuration_register(hw_priv->link,
416 &reg);
417 if (res != 0) { 385 if (res != 0) {
418 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " 386 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 "
419 "(%d)\n", res); 387 "(%d)\n", res);
420 return; 388 return;
421 } 389 }
422 printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n", 390 printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n",
423 reg.Value); 391 old_cor);
424 old_cor = reg.Value;
425 392
426 reg.Action = CS_WRITE; 393 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
427 reg.Value |= COR_SOFT_RESET; 394 old_cor | COR_SOFT_RESET);
428 res = pcmcia_access_configuration_register(hw_priv->link,
429 &reg);
430 if (res != 0) { 395 if (res != 0) {
431 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " 396 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 "
432 "(%d)\n", res); 397 "(%d)\n", res);
@@ -436,11 +401,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
436 mdelay(10); 401 mdelay(10);
437 402
438 /* Setup Genesis mode */ 403 /* Setup Genesis mode */
439 reg.Action = CS_WRITE; 404 res = pcmcia_write_config_byte(hw_priv->link, CISREG_CCSR, hcr);
440 reg.Value = hcr;
441 reg.Offset = CISREG_CCSR;
442 res = pcmcia_access_configuration_register(hw_priv->link,
443 &reg);
444 if (res != 0) { 405 if (res != 0) {
445 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " 406 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 "
446 "(%d)\n", res); 407 "(%d)\n", res);
@@ -448,11 +409,8 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
448 } 409 }
449 mdelay(10); 410 mdelay(10);
450 411
451 reg.Action = CS_WRITE; 412 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
452 reg.Offset = CISREG_COR; 413 old_cor & ~COR_SOFT_RESET);
453 reg.Value = old_cor & ~COR_SOFT_RESET;
454 res = pcmcia_access_configuration_register(hw_priv->link,
455 &reg);
456 if (res != 0) { 414 if (res != 0) {
457 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " 415 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 "
458 "(%d)\n", res); 416 "(%d)\n", res);
@@ -561,30 +519,24 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
561 PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " 519 PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d "
562 "dflt->io.nwin=%d\n", 520 "dflt->io.nwin=%d\n",
563 cfg->io.nwin, dflt->io.nwin); 521 cfg->io.nwin, dflt->io.nwin);
564 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 522 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
565 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 523 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
566 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 524 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
567 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 525 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
568 PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, " 526 p_dev->resource[0]->flags |=
569 "io.base=0x%04x, len=%d\n", io->flags, 527 pcmcia_io_cfg_data_width(io->flags);
570 io->win[0].base, io->win[0].len); 528 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
571 if (!(io->flags & CISTPL_IO_8BIT)) 529 p_dev->resource[0]->start = io->win[0].base;
572 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 530 p_dev->resource[0]->end = io->win[0].len;
573 if (!(io->flags & CISTPL_IO_16BIT))
574 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
575 p_dev->io.IOAddrLines = io->flags &
576 CISTPL_IO_LINES_MASK;
577 p_dev->io.BasePort1 = io->win[0].base;
578 p_dev->io.NumPorts1 = io->win[0].len;
579 if (io->nwin > 1) { 531 if (io->nwin > 1) {
580 p_dev->io.Attributes2 = p_dev->io.Attributes1; 532 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
581 p_dev->io.BasePort2 = io->win[1].base; 533 p_dev->resource[1]->start = io->win[1].base;
582 p_dev->io.NumPorts2 = io->win[1].len; 534 p_dev->resource[1]->end = io->win[1].len;
583 } 535 }
584 } 536 }
585 537
586 /* This reserves IO space but doesn't actually enable it */ 538 /* This reserves IO space but doesn't actually enable it */
587 return pcmcia_request_io(p_dev, &p_dev->io); 539 return pcmcia_request_io(p_dev);
588} 540}
589 541
590static int prism2_config(struct pcmcia_device *link) 542static int prism2_config(struct pcmcia_device *link)
@@ -646,7 +598,7 @@ static int prism2_config(struct pcmcia_device *link)
646 goto failed_unlock; 598 goto failed_unlock;
647 599
648 dev->irq = link->irq; 600 dev->irq = link->irq;
649 dev->base_addr = link->io.BasePort1; 601 dev->base_addr = link->resource[0]->start;
650 602
651 spin_unlock_irqrestore(&local->irq_init_lock, flags); 603 spin_unlock_irqrestore(&local->irq_init_lock, flags);
652 604
@@ -658,12 +610,10 @@ static int prism2_config(struct pcmcia_device *link)
658 link->conf.Vpp % 10); 610 link->conf.Vpp % 10);
659 if (link->conf.Attributes & CONF_ENABLE_IRQ) 611 if (link->conf.Attributes & CONF_ENABLE_IRQ)
660 printk(", irq %d", link->irq); 612 printk(", irq %d", link->irq);
661 if (link->io.NumPorts1) 613 if (link->resource[0])
662 printk(", io 0x%04x-0x%04x", link->io.BasePort1, 614 printk(" & %pR", link->resource[0]);
663 link->io.BasePort1+link->io.NumPorts1-1); 615 if (link->resource[1])
664 if (link->io.NumPorts2) 616 printk(" & %pR", link->resource[1]);
665 printk(" & 0x%04x-0x%04x", link->io.BasePort2,
666 link->io.BasePort2+link->io.NumPorts2-1);
667 printk("\n"); 617 printk("\n");
668 618
669 local->shutdown = 0; 619 local->shutdown = 0;