aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2100.c77
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2100.h1
2 files changed, 39 insertions, 39 deletions
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index f0551f807f6..33529936698 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -343,38 +343,50 @@ static struct iw_handler_def ipw2100_wx_handler_def;
343 343
344static inline void read_register(struct net_device *dev, u32 reg, u32 * val) 344static inline void read_register(struct net_device *dev, u32 reg, u32 * val)
345{ 345{
346 *val = readl((void __iomem *)(dev->base_addr + reg)); 346 struct ipw2100_priv *priv = libipw_priv(dev);
347
348 *val = ioread32(priv->ioaddr + reg);
347 IPW_DEBUG_IO("r: 0x%08X => 0x%08X\n", reg, *val); 349 IPW_DEBUG_IO("r: 0x%08X => 0x%08X\n", reg, *val);
348} 350}
349 351
350static inline void write_register(struct net_device *dev, u32 reg, u32 val) 352static inline void write_register(struct net_device *dev, u32 reg, u32 val)
351{ 353{
352 writel(val, (void __iomem *)(dev->base_addr + reg)); 354 struct ipw2100_priv *priv = libipw_priv(dev);
355
356 iowrite32(val, priv->ioaddr + reg);
353 IPW_DEBUG_IO("w: 0x%08X <= 0x%08X\n", reg, val); 357 IPW_DEBUG_IO("w: 0x%08X <= 0x%08X\n", reg, val);
354} 358}
355 359
356static inline void read_register_word(struct net_device *dev, u32 reg, 360static inline void read_register_word(struct net_device *dev, u32 reg,
357 u16 * val) 361 u16 * val)
358{ 362{
359 *val = readw((void __iomem *)(dev->base_addr + reg)); 363 struct ipw2100_priv *priv = libipw_priv(dev);
364
365 *val = ioread16(priv->ioaddr + reg);
360 IPW_DEBUG_IO("r: 0x%08X => %04X\n", reg, *val); 366 IPW_DEBUG_IO("r: 0x%08X => %04X\n", reg, *val);
361} 367}
362 368
363static inline void read_register_byte(struct net_device *dev, u32 reg, u8 * val) 369static inline void read_register_byte(struct net_device *dev, u32 reg, u8 * val)
364{ 370{
365 *val = readb((void __iomem *)(dev->base_addr + reg)); 371 struct ipw2100_priv *priv = libipw_priv(dev);
372
373 *val = ioread8(priv->ioaddr + reg);
366 IPW_DEBUG_IO("r: 0x%08X => %02X\n", reg, *val); 374 IPW_DEBUG_IO("r: 0x%08X => %02X\n", reg, *val);
367} 375}
368 376
369static inline void write_register_word(struct net_device *dev, u32 reg, u16 val) 377static inline void write_register_word(struct net_device *dev, u32 reg, u16 val)
370{ 378{
371 writew(val, (void __iomem *)(dev->base_addr + reg)); 379 struct ipw2100_priv *priv = libipw_priv(dev);
380
381 iowrite16(val, priv->ioaddr + reg);
372 IPW_DEBUG_IO("w: 0x%08X <= %04X\n", reg, val); 382 IPW_DEBUG_IO("w: 0x%08X <= %04X\n", reg, val);
373} 383}
374 384
375static inline void write_register_byte(struct net_device *dev, u32 reg, u8 val) 385static inline void write_register_byte(struct net_device *dev, u32 reg, u8 val)
376{ 386{
377 writeb(val, (void __iomem *)(dev->base_addr + reg)); 387 struct ipw2100_priv *priv = libipw_priv(dev);
388
389 iowrite8(val, priv->ioaddr + reg);
378 IPW_DEBUG_IO("w: 0x%08X =< %02X\n", reg, val); 390 IPW_DEBUG_IO("w: 0x%08X =< %02X\n", reg, val);
379} 391}
380 392
@@ -506,13 +518,13 @@ static void read_nic_memory(struct net_device *dev, u32 addr, u32 len,
506 read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, buf); 518 read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, buf);
507} 519}
508 520
509static inline int ipw2100_hw_is_adapter_in_system(struct net_device *dev) 521static bool ipw2100_hw_is_adapter_in_system(struct net_device *dev)
510{ 522{
511 return (dev->base_addr && 523 u32 dbg;
512 (readl 524
513 ((void __iomem *)(dev->base_addr + 525 read_register(dev, IPW_REG_DOA_DEBUG_AREA_START, &dbg);
514 IPW_REG_DOA_DEBUG_AREA_START)) 526
515 == IPW_DATA_DOA_DEBUG_VALUE)); 527 return dbg == IPW_DATA_DOA_DEBUG_VALUE;
516} 528}
517 529
518static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, 530static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
@@ -6082,9 +6094,7 @@ static const struct net_device_ops ipw2100_netdev_ops = {
6082/* Look into using netdev destructor to shutdown libipw? */ 6094/* Look into using netdev destructor to shutdown libipw? */
6083 6095
6084static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, 6096static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev,
6085 void __iomem * base_addr, 6097 void __iomem * ioaddr)
6086 unsigned long mem_start,
6087 unsigned long mem_len)
6088{ 6098{
6089 struct ipw2100_priv *priv; 6099 struct ipw2100_priv *priv;
6090 struct net_device *dev; 6100 struct net_device *dev;
@@ -6096,6 +6106,7 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev,
6096 priv->ieee = netdev_priv(dev); 6106 priv->ieee = netdev_priv(dev);
6097 priv->pci_dev = pci_dev; 6107 priv->pci_dev = pci_dev;
6098 priv->net_dev = dev; 6108 priv->net_dev = dev;
6109 priv->ioaddr = ioaddr;
6099 6110
6100 priv->ieee->hard_start_xmit = ipw2100_tx; 6111 priv->ieee->hard_start_xmit = ipw2100_tx;
6101 priv->ieee->set_security = shim__set_security; 6112 priv->ieee->set_security = shim__set_security;
@@ -6111,10 +6122,6 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev,
6111 dev->watchdog_timeo = 3 * HZ; 6122 dev->watchdog_timeo = 3 * HZ;
6112 dev->irq = 0; 6123 dev->irq = 0;
6113 6124
6114 dev->base_addr = (unsigned long)base_addr;
6115 dev->mem_start = mem_start;
6116 dev->mem_end = dev->mem_start + mem_len - 1;
6117
6118 /* NOTE: We don't use the wireless_handlers hook 6125 /* NOTE: We don't use the wireless_handlers hook
6119 * in dev as the system will start throwing WX requests 6126 * in dev as the system will start throwing WX requests
6120 * to us before we're actually initialized and it just 6127 * to us before we're actually initialized and it just
@@ -6215,8 +6222,7 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev,
6215static int ipw2100_pci_init_one(struct pci_dev *pci_dev, 6222static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
6216 const struct pci_device_id *ent) 6223 const struct pci_device_id *ent)
6217{ 6224{
6218 unsigned long mem_start, mem_len, mem_flags; 6225 void __iomem *ioaddr;
6219 void __iomem *base_addr = NULL;
6220 struct net_device *dev = NULL; 6226 struct net_device *dev = NULL;
6221 struct ipw2100_priv *priv = NULL; 6227 struct ipw2100_priv *priv = NULL;
6222 int err = 0; 6228 int err = 0;
@@ -6225,18 +6231,14 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
6225 6231
6226 IPW_DEBUG_INFO("enter\n"); 6232 IPW_DEBUG_INFO("enter\n");
6227 6233
6228 mem_start = pci_resource_start(pci_dev, 0); 6234 if (!(pci_resource_flags(pci_dev, 0) & IORESOURCE_MEM)) {
6229 mem_len = pci_resource_len(pci_dev, 0);
6230 mem_flags = pci_resource_flags(pci_dev, 0);
6231
6232 if ((mem_flags & IORESOURCE_MEM) != IORESOURCE_MEM) {
6233 IPW_DEBUG_INFO("weird - resource type is not memory\n"); 6235 IPW_DEBUG_INFO("weird - resource type is not memory\n");
6234 err = -ENODEV; 6236 err = -ENODEV;
6235 goto fail; 6237 goto out;
6236 } 6238 }
6237 6239
6238 base_addr = ioremap_nocache(mem_start, mem_len); 6240 ioaddr = pci_iomap(pci_dev, 0, 0);
6239 if (!base_addr) { 6241 if (!ioaddr) {
6240 printk(KERN_WARNING DRV_NAME 6242 printk(KERN_WARNING DRV_NAME
6241 "Error calling ioremap_nocache.\n"); 6243 "Error calling ioremap_nocache.\n");
6242 err = -EIO; 6244 err = -EIO;
@@ -6244,7 +6246,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
6244 } 6246 }
6245 6247
6246 /* allocate and initialize our net_device */ 6248 /* allocate and initialize our net_device */
6247 dev = ipw2100_alloc_device(pci_dev, base_addr, mem_start, mem_len); 6249 dev = ipw2100_alloc_device(pci_dev, ioaddr);
6248 if (!dev) { 6250 if (!dev) {
6249 printk(KERN_WARNING DRV_NAME 6251 printk(KERN_WARNING DRV_NAME
6250 "Error calling ipw2100_alloc_device.\n"); 6252 "Error calling ipw2100_alloc_device.\n");
@@ -6379,8 +6381,8 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
6379 priv->status |= STATUS_INITIALIZED; 6381 priv->status |= STATUS_INITIALIZED;
6380 6382
6381 mutex_unlock(&priv->action_mutex); 6383 mutex_unlock(&priv->action_mutex);
6382 6384out:
6383 return 0; 6385 return err;
6384 6386
6385 fail_unlock: 6387 fail_unlock:
6386 mutex_unlock(&priv->action_mutex); 6388 mutex_unlock(&priv->action_mutex);
@@ -6409,13 +6411,11 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
6409 pci_set_drvdata(pci_dev, NULL); 6411 pci_set_drvdata(pci_dev, NULL);
6410 } 6412 }
6411 6413
6412 if (base_addr) 6414 pci_iounmap(pci_dev, ioaddr);
6413 iounmap(base_addr);
6414 6415
6415 pci_release_regions(pci_dev); 6416 pci_release_regions(pci_dev);
6416 pci_disable_device(pci_dev); 6417 pci_disable_device(pci_dev);
6417 6418 goto out;
6418 return err;
6419} 6419}
6420 6420
6421static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev) 6421static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev)
@@ -6458,8 +6458,7 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev)
6458 if (dev->irq) 6458 if (dev->irq)
6459 free_irq(dev->irq, priv); 6459 free_irq(dev->irq, priv);
6460 6460
6461 if (dev->base_addr) 6461 pci_iounmap(pci_dev, priv->ioaddr);
6462 iounmap((void __iomem *)dev->base_addr);
6463 6462
6464 /* wiphy_unregister needs to be here, before free_libipw */ 6463 /* wiphy_unregister needs to be here, before free_libipw */
6465 wiphy_unregister(priv->ieee->wdev.wiphy); 6464 wiphy_unregister(priv->ieee->wdev.wiphy);
@@ -8609,7 +8608,7 @@ static int ipw2100_ucode_download(struct ipw2100_priv *priv,
8609 struct net_device *dev = priv->net_dev; 8608 struct net_device *dev = priv->net_dev;
8610 const unsigned char *microcode_data = fw->uc.data; 8609 const unsigned char *microcode_data = fw->uc.data;
8611 unsigned int microcode_data_left = fw->uc.size; 8610 unsigned int microcode_data_left = fw->uc.size;
8612 void __iomem *reg = (void __iomem *)dev->base_addr; 8611 void __iomem *reg = priv->ioaddr;
8613 8612
8614 struct symbol_alive_response response; 8613 struct symbol_alive_response response;
8615 int i, j; 8614 int i, j;
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.h b/drivers/net/wireless/ipw2x00/ipw2100.h
index 99cba968aa5..e5b1c77ae0e 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.h
+++ b/drivers/net/wireless/ipw2x00/ipw2100.h
@@ -488,6 +488,7 @@ enum {
488#define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ 488#define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */
489 489
490struct ipw2100_priv { 490struct ipw2100_priv {
491 void __iomem *ioaddr;
491 492
492 int stop_hang_check; /* Set 1 when shutting down to kill hang_check */ 493 int stop_hang_check; /* Set 1 when shutting down to kill hang_check */
493 int stop_rf_kill; /* Set 1 when shutting down to kill rf_kill */ 494 int stop_rf_kill; /* Set 1 when shutting down to kill rf_kill */