diff options
Diffstat (limited to 'drivers/mtd/maps/pcmciamtd.c')
-rw-r--r-- | drivers/mtd/maps/pcmciamtd.c | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 8259dca97e20..e9086f0cb2fa 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
@@ -122,7 +122,7 @@ static caddr_t remap_window(struct map_info *map, unsigned long to) | |||
122 | dev->offset, mrq.CardOffset); | 122 | dev->offset, mrq.CardOffset); |
123 | mrq.Page = 0; | 123 | mrq.Page = 0; |
124 | if( (ret = pcmcia_map_mem_page(win, &mrq)) != CS_SUCCESS) { | 124 | if( (ret = pcmcia_map_mem_page(win, &mrq)) != CS_SUCCESS) { |
125 | cs_error(dev->p_dev->handle, MapMemPage, ret); | 125 | cs_error(dev->p_dev, MapMemPage, ret); |
126 | return NULL; | 126 | return NULL; |
127 | } | 127 | } |
128 | dev->offset = mrq.CardOffset; | 128 | dev->offset = mrq.CardOffset; |
@@ -319,7 +319,7 @@ static void pcmcia_copy_to(struct map_info *map, unsigned long to, const void *f | |||
319 | static void pcmciamtd_set_vpp(struct map_info *map, int on) | 319 | static void pcmciamtd_set_vpp(struct map_info *map, int on) |
320 | { | 320 | { |
321 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; | 321 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; |
322 | dev_link_t *link = dev->p_dev; | 322 | struct pcmcia_device *link = dev->p_dev; |
323 | modconf_t mod; | 323 | modconf_t mod; |
324 | int ret; | 324 | int ret; |
325 | 325 | ||
@@ -328,9 +328,9 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) | |||
328 | mod.Vpp1 = mod.Vpp2 = on ? dev->vpp : 0; | 328 | mod.Vpp1 = mod.Vpp2 = on ? dev->vpp : 0; |
329 | 329 | ||
330 | DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); | 330 | DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); |
331 | ret = pcmcia_modify_configuration(link->handle, &mod); | 331 | ret = pcmcia_modify_configuration(link, &mod); |
332 | if(ret != CS_SUCCESS) { | 332 | if(ret != CS_SUCCESS) { |
333 | cs_error(link->handle, ModifyConfiguration, ret); | 333 | cs_error(link, ModifyConfiguration, ret); |
334 | } | 334 | } |
335 | } | 335 | } |
336 | 336 | ||
@@ -340,7 +340,7 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) | |||
340 | * still open, this will be postponed until it is closed. | 340 | * still open, this will be postponed until it is closed. |
341 | */ | 341 | */ |
342 | 342 | ||
343 | static void pcmciamtd_release(dev_link_t *link) | 343 | static void pcmciamtd_release(struct pcmcia_device *link) |
344 | { | 344 | { |
345 | struct pcmciamtd_dev *dev = link->priv; | 345 | struct pcmciamtd_dev *dev = link->priv; |
346 | 346 | ||
@@ -353,11 +353,11 @@ static void pcmciamtd_release(dev_link_t *link) | |||
353 | } | 353 | } |
354 | pcmcia_release_window(link->win); | 354 | pcmcia_release_window(link->win); |
355 | } | 355 | } |
356 | pcmcia_disable_device(link->handle); | 356 | pcmcia_disable_device(link); |
357 | } | 357 | } |
358 | 358 | ||
359 | 359 | ||
360 | static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_name) | 360 | static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, int *new_name) |
361 | { | 361 | { |
362 | int rc; | 362 | int rc; |
363 | tuple_t tuple; | 363 | tuple_t tuple; |
@@ -370,16 +370,16 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_ | |||
370 | tuple.TupleOffset = 0; | 370 | tuple.TupleOffset = 0; |
371 | tuple.DesiredTuple = RETURN_FIRST_TUPLE; | 371 | tuple.DesiredTuple = RETURN_FIRST_TUPLE; |
372 | 372 | ||
373 | rc = pcmcia_get_first_tuple(link->handle, &tuple); | 373 | rc = pcmcia_get_first_tuple(link, &tuple); |
374 | while(rc == CS_SUCCESS) { | 374 | while(rc == CS_SUCCESS) { |
375 | rc = pcmcia_get_tuple_data(link->handle, &tuple); | 375 | rc = pcmcia_get_tuple_data(link, &tuple); |
376 | if(rc != CS_SUCCESS) { | 376 | if(rc != CS_SUCCESS) { |
377 | cs_error(link->handle, GetTupleData, rc); | 377 | cs_error(link, GetTupleData, rc); |
378 | break; | 378 | break; |
379 | } | 379 | } |
380 | rc = pcmcia_parse_tuple(link->handle, &tuple, &parse); | 380 | rc = pcmcia_parse_tuple(link, &tuple, &parse); |
381 | if(rc != CS_SUCCESS) { | 381 | if(rc != CS_SUCCESS) { |
382 | cs_error(link->handle, ParseTuple, rc); | 382 | cs_error(link, ParseTuple, rc); |
383 | break; | 383 | break; |
384 | } | 384 | } |
385 | 385 | ||
@@ -450,7 +450,7 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_ | |||
450 | DEBUG(2, "Unknown tuple code %d", tuple.TupleCode); | 450 | DEBUG(2, "Unknown tuple code %d", tuple.TupleCode); |
451 | } | 451 | } |
452 | 452 | ||
453 | rc = pcmcia_get_next_tuple(link->handle, &tuple); | 453 | rc = pcmcia_get_next_tuple(link, &tuple); |
454 | } | 454 | } |
455 | if(!dev->pcmcia_map.size) | 455 | if(!dev->pcmcia_map.size) |
456 | dev->pcmcia_map.size = MAX_PCMCIA_ADDR; | 456 | dev->pcmcia_map.size = MAX_PCMCIA_ADDR; |
@@ -487,7 +487,7 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_ | |||
487 | #define CS_CHECK(fn, ret) \ | 487 | #define CS_CHECK(fn, ret) \ |
488 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 488 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
489 | 489 | ||
490 | static void pcmciamtd_config(dev_link_t *link) | 490 | static void pcmciamtd_config(struct pcmcia_device *link) |
491 | { | 491 | { |
492 | struct pcmciamtd_dev *dev = link->priv; | 492 | struct pcmciamtd_dev *dev = link->priv; |
493 | struct mtd_info *mtd = NULL; | 493 | struct mtd_info *mtd = NULL; |
@@ -507,9 +507,9 @@ static void pcmciamtd_config(dev_link_t *link) | |||
507 | link->state |= DEV_CONFIG; | 507 | link->state |= DEV_CONFIG; |
508 | 508 | ||
509 | DEBUG(2, "Validating CIS"); | 509 | DEBUG(2, "Validating CIS"); |
510 | ret = pcmcia_validate_cis(link->handle, &cisinfo); | 510 | ret = pcmcia_validate_cis(link, &cisinfo); |
511 | if(ret != CS_SUCCESS) { | 511 | if(ret != CS_SUCCESS) { |
512 | cs_error(link->handle, GetTupleData, ret); | 512 | cs_error(link, GetTupleData, ret); |
513 | } else { | 513 | } else { |
514 | DEBUG(2, "ValidateCIS found %d chains", cisinfo.Chains); | 514 | DEBUG(2, "ValidateCIS found %d chains", cisinfo.Chains); |
515 | } | 515 | } |
@@ -537,7 +537,7 @@ static void pcmciamtd_config(dev_link_t *link) | |||
537 | req.Attributes |= (dev->pcmcia_map.bankwidth == 1) ? WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; | 537 | req.Attributes |= (dev->pcmcia_map.bankwidth == 1) ? WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; |
538 | req.Base = 0; | 538 | req.Base = 0; |
539 | req.AccessSpeed = mem_speed; | 539 | req.AccessSpeed = mem_speed; |
540 | link->win = (window_handle_t)link->handle; | 540 | link->win = (window_handle_t)link; |
541 | req.Size = (force_size) ? force_size << 20 : MAX_PCMCIA_ADDR; | 541 | req.Size = (force_size) ? force_size << 20 : MAX_PCMCIA_ADDR; |
542 | dev->win_size = 0; | 542 | dev->win_size = 0; |
543 | 543 | ||
@@ -545,7 +545,7 @@ static void pcmciamtd_config(dev_link_t *link) | |||
545 | int ret; | 545 | int ret; |
546 | DEBUG(2, "requesting window with size = %dKiB memspeed = %d", | 546 | DEBUG(2, "requesting window with size = %dKiB memspeed = %d", |
547 | req.Size >> 10, req.AccessSpeed); | 547 | req.Size >> 10, req.AccessSpeed); |
548 | ret = pcmcia_request_window(&link->handle, &req, &link->win); | 548 | ret = pcmcia_request_window(&link, &req, &link->win); |
549 | DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); | 549 | DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); |
550 | if(ret) { | 550 | if(ret) { |
551 | req.Size >>= 1; | 551 | req.Size >>= 1; |
@@ -566,7 +566,7 @@ static void pcmciamtd_config(dev_link_t *link) | |||
566 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); | 566 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); |
567 | 567 | ||
568 | /* Get write protect status */ | 568 | /* Get write protect status */ |
569 | CS_CHECK(GetStatus, pcmcia_get_status(link->handle, &status)); | 569 | CS_CHECK(GetStatus, pcmcia_get_status(link, &status)); |
570 | DEBUG(2, "status value: 0x%x window handle = 0x%8.8lx", | 570 | DEBUG(2, "status value: 0x%x window handle = 0x%8.8lx", |
571 | status.CardState, (unsigned long)link->win); | 571 | status.CardState, (unsigned long)link->win); |
572 | dev->win_base = ioremap(req.Base, req.Size); | 572 | dev->win_base = ioremap(req.Base, req.Size); |
@@ -583,7 +583,7 @@ static void pcmciamtd_config(dev_link_t *link) | |||
583 | dev->pcmcia_map.map_priv_2 = (unsigned long)link->win; | 583 | dev->pcmcia_map.map_priv_2 = (unsigned long)link->win; |
584 | 584 | ||
585 | DEBUG(2, "Getting configuration"); | 585 | DEBUG(2, "Getting configuration"); |
586 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link->handle, &t)); | 586 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &t)); |
587 | DEBUG(2, "Vcc = %d Vpp1 = %d Vpp2 = %d", t.Vcc, t.Vpp1, t.Vpp2); | 587 | DEBUG(2, "Vcc = %d Vpp1 = %d Vpp2 = %d", t.Vcc, t.Vpp1, t.Vpp2); |
588 | dev->vpp = (vpp) ? vpp : t.Vpp1; | 588 | dev->vpp = (vpp) ? vpp : t.Vpp1; |
589 | link->conf.Attributes = 0; | 589 | link->conf.Attributes = 0; |
@@ -602,9 +602,9 @@ static void pcmciamtd_config(dev_link_t *link) | |||
602 | link->conf.ConfigIndex = 0; | 602 | link->conf.ConfigIndex = 0; |
603 | link->conf.Present = t.Present; | 603 | link->conf.Present = t.Present; |
604 | DEBUG(2, "Setting Configuration"); | 604 | DEBUG(2, "Setting Configuration"); |
605 | ret = pcmcia_request_configuration(link->handle, &link->conf); | 605 | ret = pcmcia_request_configuration(link, &link->conf); |
606 | if(ret != CS_SUCCESS) { | 606 | if(ret != CS_SUCCESS) { |
607 | cs_error(link->handle, RequestConfiguration, ret); | 607 | cs_error(link, RequestConfiguration, ret); |
608 | } | 608 | } |
609 | 609 | ||
610 | if(mem_type == 1) { | 610 | if(mem_type == 1) { |
@@ -677,7 +677,7 @@ static void pcmciamtd_config(dev_link_t *link) | |||
677 | return; | 677 | return; |
678 | 678 | ||
679 | cs_failed: | 679 | cs_failed: |
680 | cs_error(link->handle, last_fn, last_ret); | 680 | cs_error(link, last_fn, last_ret); |
681 | err("CS Error, exiting"); | 681 | err("CS Error, exiting"); |
682 | pcmciamtd_release(link); | 682 | pcmciamtd_release(link); |
683 | return; | 683 | return; |
@@ -709,10 +709,8 @@ static int pcmciamtd_resume(struct pcmcia_device *dev) | |||
709 | * when the device is released. | 709 | * when the device is released. |
710 | */ | 710 | */ |
711 | 711 | ||
712 | static void pcmciamtd_detach(struct pcmcia_device *p_dev) | 712 | static void pcmciamtd_detach(struct pcmcia_device *link) |
713 | { | 713 | { |
714 | dev_link_t *link = dev_to_instance(p_dev); | ||
715 | |||
716 | DEBUG(3, "link=0x%p", link); | 714 | DEBUG(3, "link=0x%p", link); |
717 | 715 | ||
718 | if(link->state & DEV_CONFIG) { | 716 | if(link->state & DEV_CONFIG) { |
@@ -732,10 +730,9 @@ static void pcmciamtd_detach(struct pcmcia_device *p_dev) | |||
732 | * with Card Services. | 730 | * with Card Services. |
733 | */ | 731 | */ |
734 | 732 | ||
735 | static int pcmciamtd_attach(struct pcmcia_device *p_dev) | 733 | static int pcmciamtd_attach(struct pcmcia_device *link) |
736 | { | 734 | { |
737 | struct pcmciamtd_dev *dev; | 735 | struct pcmciamtd_dev *dev; |
738 | dev_link_t *link = dev_to_instance(p_dev); | ||
739 | 736 | ||
740 | /* Create new memory card device */ | 737 | /* Create new memory card device */ |
741 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); | 738 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); |
@@ -743,7 +740,7 @@ static int pcmciamtd_attach(struct pcmcia_device *p_dev) | |||
743 | DEBUG(1, "dev=0x%p", dev); | 740 | DEBUG(1, "dev=0x%p", dev); |
744 | 741 | ||
745 | memset(dev, 0, sizeof(*dev)); | 742 | memset(dev, 0, sizeof(*dev)); |
746 | dev->p_dev = p_dev; | 743 | dev->p_dev = link; |
747 | link->priv = dev; | 744 | link->priv = dev; |
748 | 745 | ||
749 | link->conf.Attributes = 0; | 746 | link->conf.Attributes = 0; |