aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ray_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ray_cs.c')
-rw-r--r--drivers/net/wireless/ray_cs.c93
1 files changed, 28 insertions, 65 deletions
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 5ca624a64c42..97007d9e2c1f 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -45,7 +45,6 @@
45#include <linux/skbuff.h> 45#include <linux/skbuff.h>
46#include <linux/ieee80211.h> 46#include <linux/ieee80211.h>
47 47
48#include <pcmcia/cs.h>
49#include <pcmcia/cistpl.h> 48#include <pcmcia/cistpl.h>
50#include <pcmcia/cisreg.h> 49#include <pcmcia/cisreg.h>
51#include <pcmcia/ds.h> 50#include <pcmcia/ds.h>
@@ -166,13 +165,6 @@ static int bc;
166 */ 165 */
167static char *phy_addr = NULL; 166static char *phy_addr = NULL;
168 167
169
170/* A struct pcmcia_device structure has fields for most things that are needed
171 to keep track of a socket, but there will usually be some device
172 specific information that also needs to be kept track of. The
173 'priv' pointer in a struct pcmcia_device structure can be used to point to
174 a device-specific private data structure, like this.
175*/
176static unsigned int ray_mem_speed = 500; 168static unsigned int ray_mem_speed = 500;
177 169
178/* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */ 170/* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */
@@ -287,14 +279,6 @@ static const struct net_device_ops ray_netdev_ops = {
287 .ndo_validate_addr = eth_validate_addr, 279 .ndo_validate_addr = eth_validate_addr,
288}; 280};
289 281
290/*=============================================================================
291 ray_attach() creates an "instance" of the driver, allocating
292 local data structures for one device. The device is registered
293 with Card Services.
294 The dev_link structure is initialized, but we don't actually
295 configure the card at this point -- we wait until we receive a
296 card insertion event.
297=============================================================================*/
298static int ray_probe(struct pcmcia_device *p_dev) 282static int ray_probe(struct pcmcia_device *p_dev)
299{ 283{
300 ray_dev_t *local; 284 ray_dev_t *local;
@@ -315,9 +299,8 @@ static int ray_probe(struct pcmcia_device *p_dev)
315 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 299 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
316 300
317 /* General socket configuration */ 301 /* General socket configuration */
318 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 302 p_dev->config_flags |= CONF_ENABLE_IRQ;
319 p_dev->conf.IntType = INT_MEMORY_AND_IO; 303 p_dev->config_index = 1;
320 p_dev->conf.ConfigIndex = 1;
321 304
322 p_dev->priv = dev; 305 p_dev->priv = dev;
323 306
@@ -349,12 +332,6 @@ fail_alloc_dev:
349 return -ENOMEM; 332 return -ENOMEM;
350} /* ray_attach */ 333} /* ray_attach */
351 334
352/*=============================================================================
353 This deletes a driver "instance". The device is de-registered
354 with Card Services. If it has been released, all local data
355 structures are freed. Otherwise, the structures will be freed
356 when the device is released.
357=============================================================================*/
358static void ray_detach(struct pcmcia_device *link) 335static void ray_detach(struct pcmcia_device *link)
359{ 336{
360 struct net_device *dev; 337 struct net_device *dev;
@@ -377,17 +354,11 @@ static void ray_detach(struct pcmcia_device *link)
377 dev_dbg(&link->dev, "ray_cs ray_detach ending\n"); 354 dev_dbg(&link->dev, "ray_cs ray_detach ending\n");
378} /* ray_detach */ 355} /* ray_detach */
379 356
380/*=============================================================================
381 ray_config() is run after a CARD_INSERTION event
382 is received, to configure the PCMCIA socket, and to make the
383 ethernet device available to the system.
384=============================================================================*/
385#define MAX_TUPLE_SIZE 128 357#define MAX_TUPLE_SIZE 128
386static int ray_config(struct pcmcia_device *link) 358static int ray_config(struct pcmcia_device *link)
387{ 359{
388 int ret = 0; 360 int ret = 0;
389 int i; 361 int i;
390 win_req_t req;
391 struct net_device *dev = (struct net_device *)link->priv; 362 struct net_device *dev = (struct net_device *)link->priv;
392 ray_dev_t *local = netdev_priv(dev); 363 ray_dev_t *local = netdev_priv(dev);
393 364
@@ -408,54 +379,50 @@ static int ray_config(struct pcmcia_device *link)
408 goto failed; 379 goto failed;
409 dev->irq = link->irq; 380 dev->irq = link->irq;
410 381
411 /* This actually configures the PCMCIA socket -- setting up 382 ret = pcmcia_enable_device(link);
412 the I/O windows and the interrupt mapping.
413 */
414 ret = pcmcia_request_configuration(link, &link->conf);
415 if (ret) 383 if (ret)
416 goto failed; 384 goto failed;
417 385
418/*** Set up 32k window for shared memory (transmit and control) ************/ 386/*** Set up 32k window for shared memory (transmit and control) ************/
419 req.Attributes = 387 link->resource[2]->flags |= WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
420 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; 388 link->resource[2]->start = 0;
421 req.Base = 0; 389 link->resource[2]->end = 0x8000;
422 req.Size = 0x8000; 390 ret = pcmcia_request_window(link, link->resource[2], ray_mem_speed);
423 req.AccessSpeed = ray_mem_speed;
424 ret = pcmcia_request_window(link, &req, &link->win);
425 if (ret) 391 if (ret)
426 goto failed; 392 goto failed;
427 ret = pcmcia_map_mem_page(link, link->win, 0); 393 ret = pcmcia_map_mem_page(link, link->resource[2], 0);
428 if (ret) 394 if (ret)
429 goto failed; 395 goto failed;
430 local->sram = ioremap(req.Base, req.Size); 396 local->sram = ioremap(link->resource[2]->start,
397 resource_size(link->resource[2]));
431 398
432/*** Set up 16k window for shared memory (receive buffer) ***************/ 399/*** Set up 16k window for shared memory (receive buffer) ***************/
433 req.Attributes = 400 link->resource[3]->flags |=
434 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; 401 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
435 req.Base = 0; 402 link->resource[3]->start = 0;
436 req.Size = 0x4000; 403 link->resource[3]->end = 0x4000;
437 req.AccessSpeed = ray_mem_speed; 404 ret = pcmcia_request_window(link, link->resource[3], ray_mem_speed);
438 ret = pcmcia_request_window(link, &req, &local->rmem_handle);
439 if (ret) 405 if (ret)
440 goto failed; 406 goto failed;
441 ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000); 407 ret = pcmcia_map_mem_page(link, link->resource[3], 0x8000);
442 if (ret) 408 if (ret)
443 goto failed; 409 goto failed;
444 local->rmem = ioremap(req.Base, req.Size); 410 local->rmem = ioremap(link->resource[3]->start,
411 resource_size(link->resource[3]));
445 412
446/*** Set up window for attribute memory ***********************************/ 413/*** Set up window for attribute memory ***********************************/
447 req.Attributes = 414 link->resource[4]->flags |=
448 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT; 415 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT;
449 req.Base = 0; 416 link->resource[4]->start = 0;
450 req.Size = 0x1000; 417 link->resource[4]->end = 0x1000;
451 req.AccessSpeed = ray_mem_speed; 418 ret = pcmcia_request_window(link, link->resource[4], ray_mem_speed);
452 ret = pcmcia_request_window(link, &req, &local->amem_handle);
453 if (ret) 419 if (ret)
454 goto failed; 420 goto failed;
455 ret = pcmcia_map_mem_page(link, local->amem_handle, 0); 421 ret = pcmcia_map_mem_page(link, link->resource[4], 0);
456 if (ret) 422 if (ret)
457 goto failed; 423 goto failed;
458 local->amem = ioremap(req.Base, req.Size); 424 local->amem = ioremap(link->resource[4]->start,
425 resource_size(link->resource[4]));
459 426
460 dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); 427 dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram);
461 dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); 428 dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem);
@@ -771,11 +738,7 @@ static void join_net(u_long data)
771 local->card_status = CARD_DOING_ACQ; 738 local->card_status = CARD_DOING_ACQ;
772} 739}
773 740
774/*============================================================================ 741
775 After a card is removed, ray_release() will unregister the net
776 device, and release the PCMCIA configuration. If the device is
777 still open, this will be postponed until it is closed.
778=============================================================================*/
779static void ray_release(struct pcmcia_device *link) 742static void ray_release(struct pcmcia_device *link)
780{ 743{
781 struct net_device *dev = link->priv; 744 struct net_device *dev = link->priv;
@@ -2786,6 +2749,7 @@ static ssize_t ray_cs_essid_proc_write(struct file *file,
2786static const struct file_operations ray_cs_essid_proc_fops = { 2749static const struct file_operations ray_cs_essid_proc_fops = {
2787 .owner = THIS_MODULE, 2750 .owner = THIS_MODULE,
2788 .write = ray_cs_essid_proc_write, 2751 .write = ray_cs_essid_proc_write,
2752 .llseek = noop_llseek,
2789}; 2753};
2790 2754
2791static ssize_t int_proc_write(struct file *file, const char __user *buffer, 2755static ssize_t int_proc_write(struct file *file, const char __user *buffer,
@@ -2819,6 +2783,7 @@ static ssize_t int_proc_write(struct file *file, const char __user *buffer,
2819static const struct file_operations int_proc_fops = { 2783static const struct file_operations int_proc_fops = {
2820 .owner = THIS_MODULE, 2784 .owner = THIS_MODULE,
2821 .write = int_proc_write, 2785 .write = int_proc_write,
2786 .llseek = noop_llseek,
2822}; 2787};
2823#endif 2788#endif
2824 2789
@@ -2831,9 +2796,7 @@ MODULE_DEVICE_TABLE(pcmcia, ray_ids);
2831 2796
2832static struct pcmcia_driver ray_driver = { 2797static struct pcmcia_driver ray_driver = {
2833 .owner = THIS_MODULE, 2798 .owner = THIS_MODULE,
2834 .drv = { 2799 .name = "ray_cs",
2835 .name = "ray_cs",
2836 },
2837 .probe = ray_probe, 2800 .probe = ray_probe,
2838 .remove = ray_detach, 2801 .remove = ray_detach,
2839 .id_table = ray_ids, 2802 .id_table = ray_ids,