diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2010-10-30 07:35:11 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-10-30 07:35:11 -0400 |
commit | 67577927e8d7a1f4b09b4992df640eadc6aacb36 (patch) | |
tree | 2e9efe6b5745965faf0dcc084d4613d9356263f9 /drivers/mtd/maps | |
parent | 6fe4c590313133ebd5dadb769031489ff178ece1 (diff) | |
parent | 51f00a471ce8f359627dd99aeac322947a0e491b (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Conflicts:
drivers/mtd/mtd_blkdevs.c
Merge Grant's device-tree bits so that we can apply the subsequent fixes.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r-- | drivers/mtd/maps/Kconfig | 4 | ||||
-rw-r--r-- | drivers/mtd/maps/pcmciamtd.c | 102 |
2 files changed, 37 insertions, 69 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index e5eb65cfb3eb..a0dd7bba9481 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
@@ -172,7 +172,7 @@ config MTD_OCTAGON | |||
172 | This provides a 'mapping' driver which supports the way in which | 172 | This provides a 'mapping' driver which supports the way in which |
173 | the flash chips are connected in the Octagon-5066 Single Board | 173 | the flash chips are connected in the Octagon-5066 Single Board |
174 | Computer. More information on the board is available at | 174 | Computer. More information on the board is available at |
175 | <http://www.octagonsystems.com/CPUpages/5066.html>. | 175 | <http://www.octagonsystems.com/products/5066.aspx>. |
176 | 176 | ||
177 | config MTD_VMAX | 177 | config MTD_VMAX |
178 | tristate "JEDEC Flash device mapped on Tempustech VMAX SBC301" | 178 | tristate "JEDEC Flash device mapped on Tempustech VMAX SBC301" |
@@ -293,7 +293,7 @@ config MTD_TQM8XXL | |||
293 | chips, currently uses AMD one. This 'mapping' driver supports | 293 | chips, currently uses AMD one. This 'mapping' driver supports |
294 | that arrangement, allowing the CFI probe and command set driver | 294 | that arrangement, allowing the CFI probe and command set driver |
295 | code to communicate with the chips on the TQM8xxL board. More at | 295 | code to communicate with the chips on the TQM8xxL board. More at |
296 | <http://www.denx.de/embedded-ppc-en.html>. | 296 | <http://www.denx.de/wiki/PPCEmbedded/>. |
297 | 297 | ||
298 | config MTD_RPXLITE | 298 | config MTD_RPXLITE |
299 | tristate "CFI Flash device mapped on RPX Lite or CLLF" | 299 | tristate "CFI Flash device mapped on RPX Lite or CLLF" |
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 86c74685eb7b..917022948399 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <asm/io.h> | 16 | #include <asm/io.h> |
17 | #include <asm/system.h> | 17 | #include <asm/system.h> |
18 | 18 | ||
19 | #include <pcmcia/cs.h> | ||
20 | #include <pcmcia/cistpl.h> | 19 | #include <pcmcia/cistpl.h> |
21 | #include <pcmcia/ds.h> | 20 | #include <pcmcia/ds.h> |
22 | 21 | ||
@@ -101,7 +100,7 @@ MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)") | |||
101 | static caddr_t remap_window(struct map_info *map, unsigned long to) | 100 | static caddr_t remap_window(struct map_info *map, unsigned long to) |
102 | { | 101 | { |
103 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; | 102 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; |
104 | window_handle_t win = (window_handle_t)map->map_priv_2; | 103 | struct resource *win = (struct resource *) map->map_priv_2; |
105 | unsigned int offset; | 104 | unsigned int offset; |
106 | int ret; | 105 | int ret; |
107 | 106 | ||
@@ -316,30 +315,19 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) | |||
316 | { | 315 | { |
317 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; | 316 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; |
318 | struct pcmcia_device *link = dev->p_dev; | 317 | struct pcmcia_device *link = dev->p_dev; |
319 | modconf_t mod; | ||
320 | int ret; | ||
321 | |||
322 | mod.Attributes = CONF_VPP1_CHANGE_VALID | CONF_VPP2_CHANGE_VALID; | ||
323 | mod.Vcc = 0; | ||
324 | mod.Vpp1 = mod.Vpp2 = on ? dev->vpp : 0; | ||
325 | 318 | ||
326 | DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); | 319 | DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); |
327 | ret = pcmcia_modify_configuration(link, &mod); | 320 | pcmcia_fixup_vpp(link, on ? dev->vpp : 0); |
328 | } | 321 | } |
329 | 322 | ||
330 | 323 | ||
331 | /* After a card is removed, pcmciamtd_release() will unregister the | ||
332 | * device, and release the PCMCIA configuration. If the device is | ||
333 | * still open, this will be postponed until it is closed. | ||
334 | */ | ||
335 | |||
336 | static void pcmciamtd_release(struct pcmcia_device *link) | 324 | static void pcmciamtd_release(struct pcmcia_device *link) |
337 | { | 325 | { |
338 | struct pcmciamtd_dev *dev = link->priv; | 326 | struct pcmciamtd_dev *dev = link->priv; |
339 | 327 | ||
340 | DEBUG(3, "link = 0x%p", link); | 328 | DEBUG(3, "link = 0x%p", link); |
341 | 329 | ||
342 | if (link->win) { | 330 | if (link->resource[2]->end) { |
343 | if(dev->win_base) { | 331 | if(dev->win_base) { |
344 | iounmap(dev->win_base); | 332 | iounmap(dev->win_base); |
345 | dev->win_base = NULL; | 333 | dev->win_base = NULL; |
@@ -482,18 +470,12 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *p_dev | |||
482 | } | 470 | } |
483 | 471 | ||
484 | 472 | ||
485 | /* pcmciamtd_config() is scheduled to run after a CARD_INSERTION event | ||
486 | * is received, to configure the PCMCIA socket, and to make the | ||
487 | * MTD device available to the system. | ||
488 | */ | ||
489 | |||
490 | static int pcmciamtd_config(struct pcmcia_device *link) | 473 | static int pcmciamtd_config(struct pcmcia_device *link) |
491 | { | 474 | { |
492 | struct pcmciamtd_dev *dev = link->priv; | 475 | struct pcmciamtd_dev *dev = link->priv; |
493 | struct mtd_info *mtd = NULL; | 476 | struct mtd_info *mtd = NULL; |
494 | win_req_t req; | ||
495 | int ret; | 477 | int ret; |
496 | int i; | 478 | int i, j = 0; |
497 | static char *probes[] = { "jedec_probe", "cfi_probe" }; | 479 | static char *probes[] = { "jedec_probe", "cfi_probe" }; |
498 | int new_name = 0; | 480 | int new_name = 0; |
499 | 481 | ||
@@ -520,28 +502,34 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
520 | * smaller windows until we succeed | 502 | * smaller windows until we succeed |
521 | */ | 503 | */ |
522 | 504 | ||
523 | req.Attributes = WIN_MEMORY_TYPE_CM | WIN_ENABLE; | 505 | link->resource[2]->flags |= WIN_MEMORY_TYPE_CM | WIN_ENABLE; |
524 | req.Attributes |= (dev->pcmcia_map.bankwidth == 1) ? WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; | 506 | link->resource[2]->flags |= (dev->pcmcia_map.bankwidth == 1) ? |
525 | req.Base = 0; | 507 | WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; |
526 | req.AccessSpeed = mem_speed; | 508 | link->resource[2]->start = 0; |
527 | link->win = (window_handle_t)link; | 509 | link->resource[2]->end = (force_size) ? force_size << 20 : |
528 | req.Size = (force_size) ? force_size << 20 : MAX_PCMCIA_ADDR; | 510 | MAX_PCMCIA_ADDR; |
529 | dev->win_size = 0; | 511 | dev->win_size = 0; |
530 | 512 | ||
531 | do { | 513 | do { |
532 | int ret; | 514 | int ret; |
533 | DEBUG(2, "requesting window with size = %dKiB memspeed = %d", | 515 | DEBUG(2, "requesting window with size = %luKiB memspeed = %d", |
534 | req.Size >> 10, req.AccessSpeed); | 516 | (unsigned long) resource_size(link->resource[2]) >> 10, |
535 | ret = pcmcia_request_window(link, &req, &link->win); | 517 | mem_speed); |
518 | ret = pcmcia_request_window(link, link->resource[2], mem_speed); | ||
536 | DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); | 519 | DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); |
537 | if(ret) { | 520 | if(ret) { |
538 | req.Size >>= 1; | 521 | j++; |
522 | link->resource[2]->start = 0; | ||
523 | link->resource[2]->end = (force_size) ? | ||
524 | force_size << 20 : MAX_PCMCIA_ADDR; | ||
525 | link->resource[2]->end >>= j; | ||
539 | } else { | 526 | } else { |
540 | DEBUG(2, "Got window of size %dKiB", req.Size >> 10); | 527 | DEBUG(2, "Got window of size %luKiB", (unsigned long) |
541 | dev->win_size = req.Size; | 528 | resource_size(link->resource[2]) >> 10); |
529 | dev->win_size = resource_size(link->resource[2]); | ||
542 | break; | 530 | break; |
543 | } | 531 | } |
544 | } while(req.Size >= 0x1000); | 532 | } while (link->resource[2]->end >= 0x1000); |
545 | 533 | ||
546 | DEBUG(2, "dev->win_size = %d", dev->win_size); | 534 | DEBUG(2, "dev->win_size = %d", dev->win_size); |
547 | 535 | ||
@@ -553,33 +541,31 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
553 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); | 541 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); |
554 | 542 | ||
555 | /* Get write protect status */ | 543 | /* Get write protect status */ |
556 | DEBUG(2, "window handle = 0x%8.8lx", (unsigned long)link->win); | 544 | dev->win_base = ioremap(link->resource[2]->start, |
557 | dev->win_base = ioremap(req.Base, req.Size); | 545 | resource_size(link->resource[2])); |
558 | if(!dev->win_base) { | 546 | if(!dev->win_base) { |
559 | dev_err(&dev->p_dev->dev, "ioremap(%lu, %u) failed\n", | 547 | dev_err(&dev->p_dev->dev, "ioremap(%pR) failed\n", |
560 | req.Base, req.Size); | 548 | link->resource[2]); |
561 | pcmciamtd_release(link); | 549 | pcmciamtd_release(link); |
562 | return -ENODEV; | 550 | return -ENODEV; |
563 | } | 551 | } |
564 | DEBUG(1, "mapped window dev = %p req.base = 0x%lx base = %p size = 0x%x", | 552 | DEBUG(1, "mapped window dev = %p @ %pR, base = %p", |
565 | dev, req.Base, dev->win_base, req.Size); | 553 | dev, link->resource[2], dev->win_base); |
566 | 554 | ||
567 | dev->offset = 0; | 555 | dev->offset = 0; |
568 | dev->pcmcia_map.map_priv_1 = (unsigned long)dev; | 556 | dev->pcmcia_map.map_priv_1 = (unsigned long)dev; |
569 | dev->pcmcia_map.map_priv_2 = (unsigned long)link->win; | 557 | dev->pcmcia_map.map_priv_2 = (unsigned long)link->resource[2]; |
570 | 558 | ||
571 | dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp; | 559 | dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp; |
572 | link->conf.Attributes = 0; | ||
573 | if(setvpp == 2) { | 560 | if(setvpp == 2) { |
574 | link->conf.Vpp = dev->vpp; | 561 | link->vpp = dev->vpp; |
575 | } else { | 562 | } else { |
576 | link->conf.Vpp = 0; | 563 | link->vpp = 0; |
577 | } | 564 | } |
578 | 565 | ||
579 | link->conf.IntType = INT_MEMORY; | 566 | link->config_index = 0; |
580 | link->conf.ConfigIndex = 0; | ||
581 | DEBUG(2, "Setting Configuration"); | 567 | DEBUG(2, "Setting Configuration"); |
582 | ret = pcmcia_request_configuration(link, &link->conf); | 568 | ret = pcmcia_enable_device(link); |
583 | if (ret != 0) { | 569 | if (ret != 0) { |
584 | if (dev->win_base) { | 570 | if (dev->win_base) { |
585 | iounmap(dev->win_base); | 571 | iounmap(dev->win_base); |
@@ -676,12 +662,6 @@ static int pcmciamtd_resume(struct pcmcia_device *dev) | |||
676 | } | 662 | } |
677 | 663 | ||
678 | 664 | ||
679 | /* This deletes a driver "instance". The device is de-registered | ||
680 | * with Card Services. If it has been released, all local data | ||
681 | * structures are freed. Otherwise, the structures will be freed | ||
682 | * when the device is released. | ||
683 | */ | ||
684 | |||
685 | static void pcmciamtd_detach(struct pcmcia_device *link) | 665 | static void pcmciamtd_detach(struct pcmcia_device *link) |
686 | { | 666 | { |
687 | struct pcmciamtd_dev *dev = link->priv; | 667 | struct pcmciamtd_dev *dev = link->priv; |
@@ -699,11 +679,6 @@ static void pcmciamtd_detach(struct pcmcia_device *link) | |||
699 | } | 679 | } |
700 | 680 | ||
701 | 681 | ||
702 | /* pcmciamtd_attach() creates an "instance" of the driver, allocating | ||
703 | * local data structures for one device. The device is registered | ||
704 | * with Card Services. | ||
705 | */ | ||
706 | |||
707 | static int pcmciamtd_probe(struct pcmcia_device *link) | 682 | static int pcmciamtd_probe(struct pcmcia_device *link) |
708 | { | 683 | { |
709 | struct pcmciamtd_dev *dev; | 684 | struct pcmciamtd_dev *dev; |
@@ -716,9 +691,6 @@ static int pcmciamtd_probe(struct pcmcia_device *link) | |||
716 | dev->p_dev = link; | 691 | dev->p_dev = link; |
717 | link->priv = dev; | 692 | link->priv = dev; |
718 | 693 | ||
719 | link->conf.Attributes = 0; | ||
720 | link->conf.IntType = INT_MEMORY; | ||
721 | |||
722 | return pcmciamtd_config(link); | 694 | return pcmciamtd_config(link); |
723 | } | 695 | } |
724 | 696 | ||
@@ -753,9 +725,7 @@ static struct pcmcia_device_id pcmciamtd_ids[] = { | |||
753 | MODULE_DEVICE_TABLE(pcmcia, pcmciamtd_ids); | 725 | MODULE_DEVICE_TABLE(pcmcia, pcmciamtd_ids); |
754 | 726 | ||
755 | static struct pcmcia_driver pcmciamtd_driver = { | 727 | static struct pcmcia_driver pcmciamtd_driver = { |
756 | .drv = { | 728 | .name = "pcmciamtd", |
757 | .name = "pcmciamtd" | ||
758 | }, | ||
759 | .probe = pcmciamtd_probe, | 729 | .probe = pcmciamtd_probe, |
760 | .remove = pcmciamtd_detach, | 730 | .remove = pcmciamtd_detach, |
761 | .owner = THIS_MODULE, | 731 | .owner = THIS_MODULE, |
@@ -767,8 +737,6 @@ static struct pcmcia_driver pcmciamtd_driver = { | |||
767 | 737 | ||
768 | static int __init init_pcmciamtd(void) | 738 | static int __init init_pcmciamtd(void) |
769 | { | 739 | { |
770 | info(DRIVER_DESC); | ||
771 | |||
772 | if(bankwidth && bankwidth != 1 && bankwidth != 2) { | 740 | if(bankwidth && bankwidth != 1 && bankwidth != 2) { |
773 | info("bad bankwidth (%d), using default", bankwidth); | 741 | info("bad bankwidth (%d), using default", bankwidth); |
774 | bankwidth = 2; | 742 | bankwidth = 2; |