diff options
author | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-05 18:52:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-05 18:52:06 -0500 |
commit | bf83c2a315637dee8a8b5c2221ce5030cc38c6db (patch) | |
tree | fb477f3affea75fcc79fa9d7006415576f79aadb /drivers | |
parent | e62438630ca37539c8cc1553710bbfaa3cf960a7 (diff) | |
parent | 40a0017eb89c4c5a4bf81523edd867d730c9f143 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6:
[PATCH] pcmcia: at91_cf update
[PATCH] pcmcia: fix m32r_cfc.c compilation
[PATCH] pcmcia: ds.c debug enhancements
[PATCH] pcmcia: at91_cf update
[PATCH] pcmcia: conf.ConfigBase and conf.Present consolidation
[PATCH] pcmcia: remove prod_id indirection
[PATCH] pcmcia: remove manf_id and card_id indirection
[PATCH] pcmcia: IDs for Elan serial PCMCIA devcies
[PATCH] pcmcia: allow for four multifunction subdevices
[PATCH] pcmcia: handle __copy_from_user() return value in ioctl
[PATCH] pcmcia: multifunction card handling fixes
[PATCH] pcmcia: allow shared IRQs on pd6729 sockets
[PATCH] pcmcia: start over after CIS override
[PATCH] cm4000_cs: fix return value check
[PATCH] pcmcia: yet another IDE ID
[PATCH] pcmcia: Add an id to ide-cs.c
Diffstat (limited to 'drivers')
49 files changed, 376 insertions, 885 deletions
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 4ca6fa5dcb42..9ed7f58424a3 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c | |||
@@ -154,19 +154,12 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) | |||
154 | tuple.TupleOffset = 0; | 154 | tuple.TupleOffset = 0; |
155 | tuple.TupleDataMax = 255; | 155 | tuple.TupleDataMax = 255; |
156 | tuple.Attributes = 0; | 156 | tuple.Attributes = 0; |
157 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
158 | |||
159 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(pdev, &tuple)); | ||
160 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(pdev, &tuple)); | ||
161 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(pdev, &tuple, &stk->parse)); | ||
162 | pdev->conf.ConfigBase = stk->parse.config.base; | ||
163 | pdev->conf.Present = stk->parse.config.rmask[0]; | ||
164 | 157 | ||
165 | /* See if we have a manufacturer identifier. Use it to set is_kme for | 158 | /* See if we have a manufacturer identifier. Use it to set is_kme for |
166 | vendor quirks */ | 159 | vendor quirks */ |
167 | tuple.DesiredTuple = CISTPL_MANFID; | 160 | is_kme = ((pdev->manf_id == MANFID_KME) && |
168 | if (!pcmcia_get_first_tuple(pdev, &tuple) && !pcmcia_get_tuple_data(pdev, &tuple) && !pcmcia_parse_tuple(pdev, &tuple, &stk->parse)) | 161 | ((pdev->card_id == PRODID_KME_KXLC005_A) || |
169 | is_kme = ((stk->parse.manfid.manf == MANFID_KME) && ((stk->parse.manfid.card == PRODID_KME_KXLC005_A) || (stk->parse.manfid.card == PRODID_KME_KXLC005_B))); | 162 | (pdev->card_id == PRODID_KME_KXLC005_B))); |
170 | 163 | ||
171 | /* Not sure if this is right... look up the current Vcc */ | 164 | /* Not sure if this is right... look up the current Vcc */ |
172 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(pdev, &stk->conf)); | 165 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(pdev, &stk->conf)); |
@@ -356,8 +349,10 @@ static struct pcmcia_device_id pcmcia_devices[] = { | |||
356 | PCMCIA_DEVICE_PROD_ID12("SMI VENDOR", "SMI PRODUCT", 0x30896c92, 0x703cc5f6), | 349 | PCMCIA_DEVICE_PROD_ID12("SMI VENDOR", "SMI PRODUCT", 0x30896c92, 0x703cc5f6), |
357 | PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003), | 350 | PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003), |
358 | PCMCIA_DEVICE_PROD_ID1("TRANSCEND 512M ", 0xd0909443), | 351 | PCMCIA_DEVICE_PROD_ID1("TRANSCEND 512M ", 0xd0909443), |
352 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1), | ||
359 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8), | 353 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8), |
360 | PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), | 354 | PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), |
355 | PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918), | ||
361 | PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), | 356 | PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), |
362 | PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e), | 357 | PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e), |
363 | PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6), | 358 | PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6), |
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index cbc07250b898..acfb6a430dcc 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c | |||
@@ -892,43 +892,10 @@ static void bluecard_detach(struct pcmcia_device *link) | |||
892 | } | 892 | } |
893 | 893 | ||
894 | 894 | ||
895 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | ||
896 | { | ||
897 | int i; | ||
898 | |||
899 | i = pcmcia_get_first_tuple(handle, tuple); | ||
900 | if (i != CS_SUCCESS) | ||
901 | return CS_NO_MORE_ITEMS; | ||
902 | |||
903 | i = pcmcia_get_tuple_data(handle, tuple); | ||
904 | if (i != CS_SUCCESS) | ||
905 | return i; | ||
906 | |||
907 | return pcmcia_parse_tuple(handle, tuple, parse); | ||
908 | } | ||
909 | |||
910 | static int bluecard_config(struct pcmcia_device *link) | 895 | static int bluecard_config(struct pcmcia_device *link) |
911 | { | 896 | { |
912 | bluecard_info_t *info = link->priv; | 897 | bluecard_info_t *info = link->priv; |
913 | tuple_t tuple; | 898 | int i, n; |
914 | u_short buf[256]; | ||
915 | cisparse_t parse; | ||
916 | int i, n, last_ret, last_fn; | ||
917 | |||
918 | tuple.TupleData = (cisdata_t *)buf; | ||
919 | tuple.TupleOffset = 0; | ||
920 | tuple.TupleDataMax = 255; | ||
921 | tuple.Attributes = 0; | ||
922 | |||
923 | /* Get configuration register information */ | ||
924 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
925 | last_ret = first_tuple(link, &tuple, &parse); | ||
926 | if (last_ret != CS_SUCCESS) { | ||
927 | last_fn = ParseTuple; | ||
928 | goto cs_failed; | ||
929 | } | ||
930 | link->conf.ConfigBase = parse.config.base; | ||
931 | link->conf.Present = parse.config.rmask[0]; | ||
932 | 899 | ||
933 | link->conf.ConfigIndex = 0x20; | 900 | link->conf.ConfigIndex = 0x20; |
934 | link->io.NumPorts1 = 64; | 901 | link->io.NumPorts1 = 64; |
@@ -966,9 +933,6 @@ static int bluecard_config(struct pcmcia_device *link) | |||
966 | 933 | ||
967 | return 0; | 934 | return 0; |
968 | 935 | ||
969 | cs_failed: | ||
970 | cs_error(link, last_fn, last_ret); | ||
971 | |||
972 | failed: | 936 | failed: |
973 | bluecard_release(link); | 937 | bluecard_release(link); |
974 | return -ENODEV; | 938 | return -ENODEV; |
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 3a96a0babc6a..aae3abace586 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
@@ -713,22 +713,7 @@ static int bt3c_config(struct pcmcia_device *link) | |||
713 | u_short buf[256]; | 713 | u_short buf[256]; |
714 | cisparse_t parse; | 714 | cisparse_t parse; |
715 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; | 715 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; |
716 | int i, j, try, last_ret, last_fn; | 716 | int i, j, try; |
717 | |||
718 | tuple.TupleData = (cisdata_t *)buf; | ||
719 | tuple.TupleOffset = 0; | ||
720 | tuple.TupleDataMax = 255; | ||
721 | tuple.Attributes = 0; | ||
722 | |||
723 | /* Get configuration register information */ | ||
724 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
725 | last_ret = first_tuple(link, &tuple, &parse); | ||
726 | if (last_ret != CS_SUCCESS) { | ||
727 | last_fn = ParseTuple; | ||
728 | goto cs_failed; | ||
729 | } | ||
730 | link->conf.ConfigBase = parse.config.base; | ||
731 | link->conf.Present = parse.config.rmask[0]; | ||
732 | 717 | ||
733 | /* First pass: look for a config entry that looks normal. */ | 718 | /* First pass: look for a config entry that looks normal. */ |
734 | tuple.TupleData = (cisdata_t *)buf; | 719 | tuple.TupleData = (cisdata_t *)buf; |
@@ -802,9 +787,6 @@ found_port: | |||
802 | 787 | ||
803 | return 0; | 788 | return 0; |
804 | 789 | ||
805 | cs_failed: | ||
806 | cs_error(link, last_fn, last_ret); | ||
807 | |||
808 | failed: | 790 | failed: |
809 | bt3c_release(link); | 791 | bt3c_release(link); |
810 | return -ENODEV; | 792 | return -ENODEV; |
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 3b29086b7c3f..92648ef2f5d0 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c | |||
@@ -644,22 +644,7 @@ static int btuart_config(struct pcmcia_device *link) | |||
644 | u_short buf[256]; | 644 | u_short buf[256]; |
645 | cisparse_t parse; | 645 | cisparse_t parse; |
646 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; | 646 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; |
647 | int i, j, try, last_ret, last_fn; | 647 | int i, j, try; |
648 | |||
649 | tuple.TupleData = (cisdata_t *)buf; | ||
650 | tuple.TupleOffset = 0; | ||
651 | tuple.TupleDataMax = 255; | ||
652 | tuple.Attributes = 0; | ||
653 | |||
654 | /* Get configuration register information */ | ||
655 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
656 | last_ret = first_tuple(link, &tuple, &parse); | ||
657 | if (last_ret != CS_SUCCESS) { | ||
658 | last_fn = ParseTuple; | ||
659 | goto cs_failed; | ||
660 | } | ||
661 | link->conf.ConfigBase = parse.config.base; | ||
662 | link->conf.Present = parse.config.rmask[0]; | ||
663 | 648 | ||
664 | /* First pass: look for a config entry that looks normal. */ | 649 | /* First pass: look for a config entry that looks normal. */ |
665 | tuple.TupleData = (cisdata_t *) buf; | 650 | tuple.TupleData = (cisdata_t *) buf; |
@@ -734,9 +719,6 @@ found_port: | |||
734 | 719 | ||
735 | return 0; | 720 | return 0; |
736 | 721 | ||
737 | cs_failed: | ||
738 | cs_error(link, last_fn, last_ret); | ||
739 | |||
740 | failed: | 722 | failed: |
741 | btuart_release(link); | 723 | btuart_release(link); |
742 | return -ENODEV; | 724 | return -ENODEV; |
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index 07eafbc5dc3a..77b99eecbc49 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c | |||
@@ -626,22 +626,7 @@ static int dtl1_config(struct pcmcia_device *link) | |||
626 | u_short buf[256]; | 626 | u_short buf[256]; |
627 | cisparse_t parse; | 627 | cisparse_t parse; |
628 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; | 628 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; |
629 | int i, last_ret, last_fn; | 629 | int i; |
630 | |||
631 | tuple.TupleData = (cisdata_t *)buf; | ||
632 | tuple.TupleOffset = 0; | ||
633 | tuple.TupleDataMax = 255; | ||
634 | tuple.Attributes = 0; | ||
635 | |||
636 | /* Get configuration register information */ | ||
637 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
638 | last_ret = first_tuple(link, &tuple, &parse); | ||
639 | if (last_ret != CS_SUCCESS) { | ||
640 | last_fn = ParseTuple; | ||
641 | goto cs_failed; | ||
642 | } | ||
643 | link->conf.ConfigBase = parse.config.base; | ||
644 | link->conf.Present = parse.config.rmask[0]; | ||
645 | 630 | ||
646 | tuple.TupleData = (cisdata_t *)buf; | 631 | tuple.TupleData = (cisdata_t *)buf; |
647 | tuple.TupleOffset = 0; | 632 | tuple.TupleOffset = 0; |
@@ -690,9 +675,6 @@ static int dtl1_config(struct pcmcia_device *link) | |||
690 | 675 | ||
691 | return 0; | 676 | return 0; |
692 | 677 | ||
693 | cs_failed: | ||
694 | cs_error(link, last_fn, last_ret); | ||
695 | |||
696 | failed: | 678 | failed: |
697 | dtl1_release(link); | 679 | dtl1_release(link); |
698 | return -ENODEV; | 680 | return -ENODEV; |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 50d20aafeb18..211c93fda6fc 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -1764,29 +1764,11 @@ static int cm4000_config(struct pcmcia_device * link, int devno) | |||
1764 | int rc; | 1764 | int rc; |
1765 | 1765 | ||
1766 | /* read the config-tuples */ | 1766 | /* read the config-tuples */ |
1767 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
1768 | tuple.Attributes = 0; | 1767 | tuple.Attributes = 0; |
1769 | tuple.TupleData = buf; | 1768 | tuple.TupleData = buf; |
1770 | tuple.TupleDataMax = sizeof(buf); | 1769 | tuple.TupleDataMax = sizeof(buf); |
1771 | tuple.TupleOffset = 0; | 1770 | tuple.TupleOffset = 0; |
1772 | 1771 | ||
1773 | if ((fail_rc = pcmcia_get_first_tuple(link, &tuple)) != CS_SUCCESS) { | ||
1774 | fail_fn = GetFirstTuple; | ||
1775 | goto cs_failed; | ||
1776 | } | ||
1777 | if ((fail_rc = pcmcia_get_tuple_data(link, &tuple)) != CS_SUCCESS) { | ||
1778 | fail_fn = GetTupleData; | ||
1779 | goto cs_failed; | ||
1780 | } | ||
1781 | if ((fail_rc = | ||
1782 | pcmcia_parse_tuple(link, &tuple, &parse)) != CS_SUCCESS) { | ||
1783 | fail_fn = ParseTuple; | ||
1784 | goto cs_failed; | ||
1785 | } | ||
1786 | |||
1787 | link->conf.ConfigBase = parse.config.base; | ||
1788 | link->conf.Present = parse.config.rmask[0]; | ||
1789 | |||
1790 | link->io.BasePort2 = 0; | 1772 | link->io.BasePort2 = 0; |
1791 | link->io.NumPorts2 = 0; | 1773 | link->io.NumPorts2 = 0; |
1792 | link->io.Attributes2 = 0; | 1774 | link->io.Attributes2 = 0; |
@@ -1841,8 +1823,6 @@ static int cm4000_config(struct pcmcia_device * link, int devno) | |||
1841 | 1823 | ||
1842 | return 0; | 1824 | return 0; |
1843 | 1825 | ||
1844 | cs_failed: | ||
1845 | cs_error(link, fail_fn, fail_rc); | ||
1846 | cs_release: | 1826 | cs_release: |
1847 | cm4000_release(link); | 1827 | cm4000_release(link); |
1848 | return -ENODEV; | 1828 | return -ENODEV; |
@@ -1973,14 +1953,14 @@ static int __init cmm_init(void) | |||
1973 | printk(KERN_INFO "%s\n", version); | 1953 | printk(KERN_INFO "%s\n", version); |
1974 | 1954 | ||
1975 | cmm_class = class_create(THIS_MODULE, "cardman_4000"); | 1955 | cmm_class = class_create(THIS_MODULE, "cardman_4000"); |
1976 | if (!cmm_class) | 1956 | if (IS_ERR(cmm_class)) |
1977 | return -1; | 1957 | return PTR_ERR(cmm_class); |
1978 | 1958 | ||
1979 | major = register_chrdev(0, DEVICE_NAME, &cm4000_fops); | 1959 | major = register_chrdev(0, DEVICE_NAME, &cm4000_fops); |
1980 | if (major < 0) { | 1960 | if (major < 0) { |
1981 | printk(KERN_WARNING MODULE_NAME | 1961 | printk(KERN_WARNING MODULE_NAME |
1982 | ": could not get major number\n"); | 1962 | ": could not get major number\n"); |
1983 | return -1; | 1963 | return major; |
1984 | } | 1964 | } |
1985 | 1965 | ||
1986 | rc = pcmcia_register_driver(&cm4000_driver); | 1966 | rc = pcmcia_register_driver(&cm4000_driver); |
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 55cf4be42976..9b1ff7e8f896 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -523,29 +523,11 @@ static int reader_config(struct pcmcia_device *link, int devno) | |||
523 | int fail_fn, fail_rc; | 523 | int fail_fn, fail_rc; |
524 | int rc; | 524 | int rc; |
525 | 525 | ||
526 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
527 | tuple.Attributes = 0; | 526 | tuple.Attributes = 0; |
528 | tuple.TupleData = buf; | 527 | tuple.TupleData = buf; |
529 | tuple.TupleDataMax = sizeof(buf); | 528 | tuple.TupleDataMax = sizeof(buf); |
530 | tuple.TupleOffset = 0; | 529 | tuple.TupleOffset = 0; |
531 | 530 | ||
532 | if ((fail_rc = pcmcia_get_first_tuple(link, &tuple)) != CS_SUCCESS) { | ||
533 | fail_fn = GetFirstTuple; | ||
534 | goto cs_failed; | ||
535 | } | ||
536 | if ((fail_rc = pcmcia_get_tuple_data(link, &tuple)) != CS_SUCCESS) { | ||
537 | fail_fn = GetTupleData; | ||
538 | goto cs_failed; | ||
539 | } | ||
540 | if ((fail_rc = pcmcia_parse_tuple(link, &tuple, &parse)) | ||
541 | != CS_SUCCESS) { | ||
542 | fail_fn = ParseTuple; | ||
543 | goto cs_failed; | ||
544 | } | ||
545 | |||
546 | link->conf.ConfigBase = parse.config.base; | ||
547 | link->conf.Present = parse.config.rmask[0]; | ||
548 | |||
549 | link->io.BasePort2 = 0; | 531 | link->io.BasePort2 = 0; |
550 | link->io.NumPorts2 = 0; | 532 | link->io.NumPorts2 = 0; |
551 | link->io.Attributes2 = 0; | 533 | link->io.Attributes2 = 0; |
@@ -609,8 +591,6 @@ static int reader_config(struct pcmcia_device *link, int devno) | |||
609 | 591 | ||
610 | return 0; | 592 | return 0; |
611 | 593 | ||
612 | cs_failed: | ||
613 | cs_error(link, fail_fn, fail_rc); | ||
614 | cs_release: | 594 | cs_release: |
615 | reader_release(link); | 595 | reader_release(link); |
616 | return -ENODEV; | 596 | return -ENODEV; |
@@ -721,14 +701,14 @@ static int __init cm4040_init(void) | |||
721 | 701 | ||
722 | printk(KERN_INFO "%s\n", version); | 702 | printk(KERN_INFO "%s\n", version); |
723 | cmx_class = class_create(THIS_MODULE, "cardman_4040"); | 703 | cmx_class = class_create(THIS_MODULE, "cardman_4040"); |
724 | if (!cmx_class) | 704 | if (IS_ERR(cmx_class)) |
725 | return -1; | 705 | return PTR_ERR(cmx_class); |
726 | 706 | ||
727 | major = register_chrdev(0, DEVICE_NAME, &reader_fops); | 707 | major = register_chrdev(0, DEVICE_NAME, &reader_fops); |
728 | if (major < 0) { | 708 | if (major < 0) { |
729 | printk(KERN_WARNING MODULE_NAME | 709 | printk(KERN_WARNING MODULE_NAME |
730 | ": could not get major number\n"); | 710 | ": could not get major number\n"); |
731 | return -1; | 711 | return major; |
732 | } | 712 | } |
733 | 713 | ||
734 | rc = pcmcia_register_driver(&reader_driver); | 714 | rc = pcmcia_register_driver(&reader_driver); |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 1a0bc30b79d1..f9f72500ea5d 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -604,17 +604,10 @@ static int mgslpc_config(struct pcmcia_device *link) | |||
604 | if (debug_level >= DEBUG_LEVEL_INFO) | 604 | if (debug_level >= DEBUG_LEVEL_INFO) |
605 | printk("mgslpc_config(0x%p)\n", link); | 605 | printk("mgslpc_config(0x%p)\n", link); |
606 | 606 | ||
607 | /* read CONFIG tuple to find its configuration registers */ | ||
608 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
609 | tuple.Attributes = 0; | 607 | tuple.Attributes = 0; |
610 | tuple.TupleData = buf; | 608 | tuple.TupleData = buf; |
611 | tuple.TupleDataMax = sizeof(buf); | 609 | tuple.TupleDataMax = sizeof(buf); |
612 | tuple.TupleOffset = 0; | 610 | tuple.TupleOffset = 0; |
613 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
614 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
615 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
616 | link->conf.ConfigBase = parse.config.base; | ||
617 | link->conf.Present = parse.config.rmask[0]; | ||
618 | 611 | ||
619 | /* get CIS configuration entry */ | 612 | /* get CIS configuration entry */ |
620 | 613 | ||
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index bef4759f70e5..7efd28ac21ed 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -192,20 +192,10 @@ static int ide_config(struct pcmcia_device *link) | |||
192 | tuple.TupleOffset = 0; | 192 | tuple.TupleOffset = 0; |
193 | tuple.TupleDataMax = 255; | 193 | tuple.TupleDataMax = 255; |
194 | tuple.Attributes = 0; | 194 | tuple.Attributes = 0; |
195 | tuple.DesiredTuple = CISTPL_CONFIG; | 195 | |
196 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 196 | is_kme = ((link->manf_id == MANFID_KME) && |
197 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | 197 | ((link->card_id == PRODID_KME_KXLC005_A) || |
198 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &stk->parse)); | 198 | (link->card_id == PRODID_KME_KXLC005_B))); |
199 | link->conf.ConfigBase = stk->parse.config.base; | ||
200 | link->conf.Present = stk->parse.config.rmask[0]; | ||
201 | |||
202 | tuple.DesiredTuple = CISTPL_MANFID; | ||
203 | if (!pcmcia_get_first_tuple(link, &tuple) && | ||
204 | !pcmcia_get_tuple_data(link, &tuple) && | ||
205 | !pcmcia_parse_tuple(link, &tuple, &stk->parse)) | ||
206 | is_kme = ((stk->parse.manfid.manf == MANFID_KME) && | ||
207 | ((stk->parse.manfid.card == PRODID_KME_KXLC005_A) || | ||
208 | (stk->parse.manfid.card == PRODID_KME_KXLC005_B))); | ||
209 | 199 | ||
210 | /* Not sure if this is right... look up the current Vcc */ | 200 | /* Not sure if this is right... look up the current Vcc */ |
211 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf)); | 201 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf)); |
@@ -408,8 +398,10 @@ static struct pcmcia_device_id ide_ids[] = { | |||
408 | PCMCIA_DEVICE_PROD_ID12("SMI VENDOR", "SMI PRODUCT", 0x30896c92, 0x703cc5f6), | 398 | PCMCIA_DEVICE_PROD_ID12("SMI VENDOR", "SMI PRODUCT", 0x30896c92, 0x703cc5f6), |
409 | PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003), | 399 | PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003), |
410 | PCMCIA_DEVICE_PROD_ID1("TRANSCEND 512M ", 0xd0909443), | 400 | PCMCIA_DEVICE_PROD_ID1("TRANSCEND 512M ", 0xd0909443), |
401 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1), | ||
411 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8), | 402 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8), |
412 | PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), | 403 | PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), |
404 | PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918), | ||
413 | PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), | 405 | PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), |
414 | PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e), | 406 | PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e), |
415 | PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6), | 407 | PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6), |
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 7bbfd85ab793..fd5d7364a487 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c | |||
@@ -194,41 +194,11 @@ static int avmcs_config(struct pcmcia_device *link) | |||
194 | 194 | ||
195 | dev = link->priv; | 195 | dev = link->priv; |
196 | 196 | ||
197 | /* | ||
198 | This reads the card's CONFIG tuple to find its configuration | ||
199 | registers. | ||
200 | */ | ||
201 | do { | 197 | do { |
202 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
203 | i = pcmcia_get_first_tuple(link, &tuple); | ||
204 | if (i != CS_SUCCESS) break; | ||
205 | tuple.TupleData = buf; | ||
206 | tuple.TupleDataMax = 64; | ||
207 | tuple.TupleOffset = 0; | ||
208 | i = pcmcia_get_tuple_data(link, &tuple); | ||
209 | if (i != CS_SUCCESS) break; | ||
210 | i = pcmcia_parse_tuple(link, &tuple, &parse); | ||
211 | if (i != CS_SUCCESS) break; | ||
212 | link->conf.ConfigBase = parse.config.base; | ||
213 | } while (0); | ||
214 | if (i != CS_SUCCESS) { | ||
215 | cs_error(link, ParseTuple, i); | ||
216 | return -ENODEV; | ||
217 | } | ||
218 | |||
219 | do { | ||
220 | |||
221 | tuple.Attributes = 0; | ||
222 | tuple.TupleData = buf; | ||
223 | tuple.TupleDataMax = 254; | ||
224 | tuple.TupleOffset = 0; | ||
225 | tuple.DesiredTuple = CISTPL_VERS_1; | ||
226 | |||
227 | devname[0] = 0; | 198 | devname[0] = 0; |
228 | if( !first_tuple(link, &tuple, &parse) && parse.version_1.ns > 1 ) { | 199 | if (link->prod_id[1]) |
229 | strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1], | 200 | strlcpy(devname, link->prod_id[1], sizeof(devname)); |
230 | sizeof(devname)); | 201 | |
231 | } | ||
232 | /* | 202 | /* |
233 | * find IO port | 203 | * find IO port |
234 | */ | 204 | */ |
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index ac28e3278ad9..876fec6c6be8 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c | |||
@@ -216,41 +216,11 @@ static int avma1cs_config(struct pcmcia_device *link) | |||
216 | 216 | ||
217 | DEBUG(0, "avma1cs_config(0x%p)\n", link); | 217 | DEBUG(0, "avma1cs_config(0x%p)\n", link); |
218 | 218 | ||
219 | /* | ||
220 | This reads the card's CONFIG tuple to find its configuration | ||
221 | registers. | ||
222 | */ | ||
223 | do { | 219 | do { |
224 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
225 | i = pcmcia_get_first_tuple(link, &tuple); | ||
226 | if (i != CS_SUCCESS) break; | ||
227 | tuple.TupleData = buf; | ||
228 | tuple.TupleDataMax = 64; | ||
229 | tuple.TupleOffset = 0; | ||
230 | i = pcmcia_get_tuple_data(link, &tuple); | ||
231 | if (i != CS_SUCCESS) break; | ||
232 | i = pcmcia_parse_tuple(link, &tuple, &parse); | ||
233 | if (i != CS_SUCCESS) break; | ||
234 | link->conf.ConfigBase = parse.config.base; | ||
235 | } while (0); | ||
236 | if (i != CS_SUCCESS) { | ||
237 | cs_error(link, ParseTuple, i); | ||
238 | return -ENODEV; | ||
239 | } | ||
240 | |||
241 | do { | ||
242 | |||
243 | tuple.Attributes = 0; | ||
244 | tuple.TupleData = buf; | ||
245 | tuple.TupleDataMax = 254; | ||
246 | tuple.TupleOffset = 0; | ||
247 | tuple.DesiredTuple = CISTPL_VERS_1; | ||
248 | |||
249 | devname[0] = 0; | 220 | devname[0] = 0; |
250 | if( !first_tuple(link, &tuple, &parse) && parse.version_1.ns > 1 ) { | 221 | if (link->prod_id[1]) |
251 | strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1], | 222 | strlcpy(devname, link->prod_id[1], sizeof(devname)); |
252 | sizeof(devname)); | 223 | |
253 | } | ||
254 | /* | 224 | /* |
255 | * find IO port | 225 | * find IO port |
256 | */ | 226 | */ |
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index e18e75be8ed3..4e180d210faa 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c | |||
@@ -242,23 +242,6 @@ static int elsa_cs_config(struct pcmcia_device *link) | |||
242 | DEBUG(0, "elsa_config(0x%p)\n", link); | 242 | DEBUG(0, "elsa_config(0x%p)\n", link); |
243 | dev = link->priv; | 243 | dev = link->priv; |
244 | 244 | ||
245 | /* | ||
246 | This reads the card's CONFIG tuple to find its configuration | ||
247 | registers. | ||
248 | */ | ||
249 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
250 | tuple.TupleData = (cisdata_t *)buf; | ||
251 | tuple.TupleDataMax = 255; | ||
252 | tuple.TupleOffset = 0; | ||
253 | tuple.Attributes = 0; | ||
254 | i = first_tuple(link, &tuple, &parse); | ||
255 | if (i != CS_SUCCESS) { | ||
256 | last_fn = ParseTuple; | ||
257 | goto cs_failed; | ||
258 | } | ||
259 | link->conf.ConfigBase = parse.config.base; | ||
260 | link->conf.Present = parse.config.rmask[0]; | ||
261 | |||
262 | tuple.TupleData = (cisdata_t *)buf; | 245 | tuple.TupleData = (cisdata_t *)buf; |
263 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; | 246 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; |
264 | tuple.Attributes = 0; | 247 | tuple.Attributes = 0; |
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index f9c14a2970bc..46ed65334c51 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c | |||
@@ -233,20 +233,10 @@ static int sedlbauer_config(struct pcmcia_device *link) | |||
233 | 233 | ||
234 | DEBUG(0, "sedlbauer_config(0x%p)\n", link); | 234 | DEBUG(0, "sedlbauer_config(0x%p)\n", link); |
235 | 235 | ||
236 | /* | ||
237 | This reads the card's CONFIG tuple to find its configuration | ||
238 | registers. | ||
239 | */ | ||
240 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
241 | tuple.Attributes = 0; | 236 | tuple.Attributes = 0; |
242 | tuple.TupleData = buf; | 237 | tuple.TupleData = buf; |
243 | tuple.TupleDataMax = sizeof(buf); | 238 | tuple.TupleDataMax = sizeof(buf); |
244 | tuple.TupleOffset = 0; | 239 | tuple.TupleOffset = 0; |
245 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
246 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
247 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
248 | link->conf.ConfigBase = parse.config.base; | ||
249 | link->conf.Present = parse.config.rmask[0]; | ||
250 | 240 | ||
251 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf)); | 241 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf)); |
252 | 242 | ||
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index afcc2aeadb34..6b754f183796 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c | |||
@@ -232,23 +232,6 @@ static int teles_cs_config(struct pcmcia_device *link) | |||
232 | DEBUG(0, "teles_config(0x%p)\n", link); | 232 | DEBUG(0, "teles_config(0x%p)\n", link); |
233 | dev = link->priv; | 233 | dev = link->priv; |
234 | 234 | ||
235 | /* | ||
236 | This reads the card's CONFIG tuple to find its configuration | ||
237 | registers. | ||
238 | */ | ||
239 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
240 | tuple.TupleData = (cisdata_t *)buf; | ||
241 | tuple.TupleDataMax = 255; | ||
242 | tuple.TupleOffset = 0; | ||
243 | tuple.Attributes = 0; | ||
244 | i = first_tuple(link, &tuple, &parse); | ||
245 | if (i != CS_SUCCESS) { | ||
246 | last_fn = ParseTuple; | ||
247 | goto cs_failed; | ||
248 | } | ||
249 | link->conf.ConfigBase = parse.config.base; | ||
250 | link->conf.Present = parse.config.rmask[0]; | ||
251 | |||
252 | tuple.TupleData = (cisdata_t *)buf; | 235 | tuple.TupleData = (cisdata_t *)buf; |
253 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; | 236 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; |
254 | tuple.Attributes = 0; | 237 | tuple.Attributes = 0; |
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 046009928526..794cc61819dd 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
@@ -338,7 +338,6 @@ static int tc574_config(struct pcmcia_device *link) | |||
338 | struct net_device *dev = link->priv; | 338 | struct net_device *dev = link->priv; |
339 | struct el3_private *lp = netdev_priv(dev); | 339 | struct el3_private *lp = netdev_priv(dev); |
340 | tuple_t tuple; | 340 | tuple_t tuple; |
341 | cisparse_t parse; | ||
342 | unsigned short buf[32]; | 341 | unsigned short buf[32]; |
343 | int last_fn, last_ret, i, j; | 342 | int last_fn, last_ret, i, j; |
344 | kio_addr_t ioaddr; | 343 | kio_addr_t ioaddr; |
@@ -350,17 +349,6 @@ static int tc574_config(struct pcmcia_device *link) | |||
350 | 349 | ||
351 | DEBUG(0, "3c574_config(0x%p)\n", link); | 350 | DEBUG(0, "3c574_config(0x%p)\n", link); |
352 | 351 | ||
353 | tuple.Attributes = 0; | ||
354 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
355 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
356 | tuple.TupleData = (cisdata_t *)buf; | ||
357 | tuple.TupleDataMax = 64; | ||
358 | tuple.TupleOffset = 0; | ||
359 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
360 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
361 | link->conf.ConfigBase = parse.config.base; | ||
362 | link->conf.Present = parse.config.rmask[0]; | ||
363 | |||
364 | link->io.IOAddrLines = 16; | 352 | link->io.IOAddrLines = 16; |
365 | for (i = j = 0; j < 0x400; j += 0x20) { | 353 | for (i = j = 0; j < 0x400; j += 0x20) { |
366 | link->io.BasePort1 = j ^ 0x300; | 354 | link->io.BasePort1 = j ^ 0x300; |
@@ -382,6 +370,10 @@ static int tc574_config(struct pcmcia_device *link) | |||
382 | /* The 3c574 normally uses an EEPROM for configuration info, including | 370 | /* The 3c574 normally uses an EEPROM for configuration info, including |
383 | the hardware address. The future products may include a modem chip | 371 | the hardware address. The future products may include a modem chip |
384 | and put the address in the CIS. */ | 372 | and put the address in the CIS. */ |
373 | tuple.Attributes = 0; | ||
374 | tuple.TupleData = (cisdata_t *)buf; | ||
375 | tuple.TupleDataMax = 64; | ||
376 | tuple.TupleOffset = 0; | ||
385 | tuple.DesiredTuple = 0x88; | 377 | tuple.DesiredTuple = 0x88; |
386 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { | 378 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { |
387 | pcmcia_get_tuple_data(link, &tuple); | 379 | pcmcia_get_tuple_data(link, &tuple); |
@@ -397,12 +389,9 @@ static int tc574_config(struct pcmcia_device *link) | |||
397 | goto failed; | 389 | goto failed; |
398 | } | 390 | } |
399 | } | 391 | } |
400 | tuple.DesiredTuple = CISTPL_VERS_1; | 392 | if (link->prod_id[1]) |
401 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS && | 393 | cardname = link->prod_id[1]; |
402 | pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS && | 394 | else |
403 | pcmcia_parse_tuple(link, &tuple, &parse) == CS_SUCCESS) { | ||
404 | cardname = parse.version_1.str + parse.version_1.ofs[1]; | ||
405 | } else | ||
406 | cardname = "3Com 3c574"; | 395 | cardname = "3Com 3c574"; |
407 | 396 | ||
408 | { | 397 | { |
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 231fa2c9ec6c..1e73ff7d5d8e 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -253,7 +253,6 @@ static int tc589_config(struct pcmcia_device *link) | |||
253 | struct net_device *dev = link->priv; | 253 | struct net_device *dev = link->priv; |
254 | struct el3_private *lp = netdev_priv(dev); | 254 | struct el3_private *lp = netdev_priv(dev); |
255 | tuple_t tuple; | 255 | tuple_t tuple; |
256 | cisparse_t parse; | ||
257 | u16 buf[32], *phys_addr; | 256 | u16 buf[32], *phys_addr; |
258 | int last_fn, last_ret, i, j, multi = 0, fifo; | 257 | int last_fn, last_ret, i, j, multi = 0, fifo; |
259 | kio_addr_t ioaddr; | 258 | kio_addr_t ioaddr; |
@@ -263,26 +262,16 @@ static int tc589_config(struct pcmcia_device *link) | |||
263 | 262 | ||
264 | phys_addr = (u16 *)dev->dev_addr; | 263 | phys_addr = (u16 *)dev->dev_addr; |
265 | tuple.Attributes = 0; | 264 | tuple.Attributes = 0; |
266 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
267 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
268 | tuple.TupleData = (cisdata_t *)buf; | 265 | tuple.TupleData = (cisdata_t *)buf; |
269 | tuple.TupleDataMax = sizeof(buf); | 266 | tuple.TupleDataMax = sizeof(buf); |
270 | tuple.TupleOffset = 0; | 267 | tuple.TupleOffset = 0; |
271 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
272 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
273 | link->conf.ConfigBase = parse.config.base; | ||
274 | link->conf.Present = parse.config.rmask[0]; | ||
275 | |||
276 | /* Is this a 3c562? */ | ||
277 | tuple.DesiredTuple = CISTPL_MANFID; | ||
278 | tuple.Attributes = TUPLE_RETURN_COMMON; | 268 | tuple.Attributes = TUPLE_RETURN_COMMON; |
279 | if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && | 269 | |
280 | (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) { | 270 | /* Is this a 3c562? */ |
281 | if (le16_to_cpu(buf[0]) != MANFID_3COM) | 271 | if (link->manf_id != MANFID_3COM) |
282 | printk(KERN_INFO "3c589_cs: hmmm, is this really a " | 272 | printk(KERN_INFO "3c589_cs: hmmm, is this really a " |
283 | "3Com card??\n"); | 273 | "3Com card??\n"); |
284 | multi = (le16_to_cpu(buf[1]) == PRODID_3COM_3C562); | 274 | multi = (link->card_id == PRODID_3COM_3C562); |
285 | } | ||
286 | 275 | ||
287 | /* For the 3c562, the base address must be xx00-xx7f */ | 276 | /* For the 3c562, the base address must be xx00-xx7f */ |
288 | link->io.IOAddrLines = 16; | 277 | link->io.IOAddrLines = 16; |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 5ddd5742f779..6139048f8117 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -299,11 +299,7 @@ static int axnet_config(struct pcmcia_device *link) | |||
299 | tuple.TupleData = (cisdata_t *)buf; | 299 | tuple.TupleData = (cisdata_t *)buf; |
300 | tuple.TupleDataMax = sizeof(buf); | 300 | tuple.TupleDataMax = sizeof(buf); |
301 | tuple.TupleOffset = 0; | 301 | tuple.TupleOffset = 0; |
302 | tuple.DesiredTuple = CISTPL_CONFIG; | 302 | |
303 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
304 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
305 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
306 | link->conf.ConfigBase = parse.config.base; | ||
307 | /* don't trust the CIS on this; Linksys got it wrong */ | 303 | /* don't trust the CIS on this; Linksys got it wrong */ |
308 | link->conf.Present = 0x63; | 304 | link->conf.Present = 0x63; |
309 | 305 | ||
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index 48434d7924eb..91f65e91cd5f 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c | |||
@@ -249,12 +249,9 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
249 | static int com20020_config(struct pcmcia_device *link) | 249 | static int com20020_config(struct pcmcia_device *link) |
250 | { | 250 | { |
251 | struct arcnet_local *lp; | 251 | struct arcnet_local *lp; |
252 | tuple_t tuple; | ||
253 | cisparse_t parse; | ||
254 | com20020_dev_t *info; | 252 | com20020_dev_t *info; |
255 | struct net_device *dev; | 253 | struct net_device *dev; |
256 | int i, last_ret, last_fn; | 254 | int i, last_ret, last_fn; |
257 | u_char buf[64]; | ||
258 | int ioaddr; | 255 | int ioaddr; |
259 | 256 | ||
260 | info = link->priv; | 257 | info = link->priv; |
@@ -264,16 +261,6 @@ static int com20020_config(struct pcmcia_device *link) | |||
264 | 261 | ||
265 | DEBUG(0, "com20020_config(0x%p)\n", link); | 262 | DEBUG(0, "com20020_config(0x%p)\n", link); |
266 | 263 | ||
267 | tuple.Attributes = 0; | ||
268 | tuple.TupleData = buf; | ||
269 | tuple.TupleDataMax = 64; | ||
270 | tuple.TupleOffset = 0; | ||
271 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
272 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
273 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
274 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
275 | link->conf.ConfigBase = parse.config.base; | ||
276 | |||
277 | DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); | 264 | DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); |
278 | i = !CS_SUCCESS; | 265 | i = !CS_SUCCESS; |
279 | if (!link->io.BasePort1) | 266 | if (!link->io.BasePort1) |
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 65f6fdf43725..0d7de617e535 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -342,7 +342,7 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
342 | tuple_t tuple; | 342 | tuple_t tuple; |
343 | cisparse_t parse; | 343 | cisparse_t parse; |
344 | u_short buf[32]; | 344 | u_short buf[32]; |
345 | int i, last_fn, last_ret, ret; | 345 | int i, last_fn = 0, last_ret = 0, ret; |
346 | kio_addr_t ioaddr; | 346 | kio_addr_t ioaddr; |
347 | cardtype_t cardtype; | 347 | cardtype_t cardtype; |
348 | char *card_name = "unknown"; | 348 | char *card_name = "unknown"; |
@@ -350,21 +350,9 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
350 | 350 | ||
351 | DEBUG(0, "fmvj18x_config(0x%p)\n", link); | 351 | DEBUG(0, "fmvj18x_config(0x%p)\n", link); |
352 | 352 | ||
353 | /* | ||
354 | This reads the card's CONFIG tuple to find its configuration | ||
355 | registers. | ||
356 | */ | ||
357 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
358 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
359 | tuple.TupleData = (u_char *)buf; | 353 | tuple.TupleData = (u_char *)buf; |
360 | tuple.TupleDataMax = 64; | 354 | tuple.TupleDataMax = 64; |
361 | tuple.TupleOffset = 0; | 355 | tuple.TupleOffset = 0; |
362 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
363 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
364 | |||
365 | link->conf.ConfigBase = parse.config.base; | ||
366 | link->conf.Present = parse.config.rmask[0]; | ||
367 | |||
368 | tuple.DesiredTuple = CISTPL_FUNCE; | 356 | tuple.DesiredTuple = CISTPL_FUNCE; |
369 | tuple.TupleOffset = 0; | 357 | tuple.TupleOffset = 0; |
370 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { | 358 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { |
@@ -374,17 +362,12 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
374 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | 362 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
375 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 363 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
376 | link->conf.ConfigIndex = parse.cftable_entry.index; | 364 | link->conf.ConfigIndex = parse.cftable_entry.index; |
377 | tuple.DesiredTuple = CISTPL_MANFID; | 365 | switch (link->manf_id) { |
378 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) | ||
379 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
380 | else | ||
381 | buf[0] = 0xffff; | ||
382 | switch (le16_to_cpu(buf[0])) { | ||
383 | case MANFID_TDK: | 366 | case MANFID_TDK: |
384 | cardtype = TDK; | 367 | cardtype = TDK; |
385 | if (le16_to_cpu(buf[1]) == PRODID_TDK_GN3410 | 368 | if (link->card_id == PRODID_TDK_GN3410 |
386 | || le16_to_cpu(buf[1]) == PRODID_TDK_NP9610 | 369 | || link->card_id == PRODID_TDK_NP9610 |
387 | || le16_to_cpu(buf[1]) == PRODID_TDK_MN3200) { | 370 | || link->card_id == PRODID_TDK_MN3200) { |
388 | /* MultiFunction Card */ | 371 | /* MultiFunction Card */ |
389 | link->conf.ConfigBase = 0x800; | 372 | link->conf.ConfigBase = 0x800; |
390 | link->conf.ConfigIndex = 0x47; | 373 | link->conf.ConfigIndex = 0x47; |
@@ -395,11 +378,11 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
395 | cardtype = CONTEC; | 378 | cardtype = CONTEC; |
396 | break; | 379 | break; |
397 | case MANFID_FUJITSU: | 380 | case MANFID_FUJITSU: |
398 | if (le16_to_cpu(buf[1]) == PRODID_FUJITSU_MBH10302) | 381 | if (link->card_id == PRODID_FUJITSU_MBH10302) |
399 | /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), | 382 | /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), |
400 | but these are MBH10304 based card. */ | 383 | but these are MBH10304 based card. */ |
401 | cardtype = MBH10304; | 384 | cardtype = MBH10304; |
402 | else if (le16_to_cpu(buf[1]) == PRODID_FUJITSU_MBH10304) | 385 | else if (link->card_id == PRODID_FUJITSU_MBH10304) |
403 | cardtype = MBH10304; | 386 | cardtype = MBH10304; |
404 | else | 387 | else |
405 | cardtype = LA501; | 388 | cardtype = LA501; |
@@ -409,14 +392,9 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
409 | } | 392 | } |
410 | } else { | 393 | } else { |
411 | /* old type card */ | 394 | /* old type card */ |
412 | tuple.DesiredTuple = CISTPL_MANFID; | 395 | switch (link->manf_id) { |
413 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) | ||
414 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
415 | else | ||
416 | buf[0] = 0xffff; | ||
417 | switch (le16_to_cpu(buf[0])) { | ||
418 | case MANFID_FUJITSU: | 396 | case MANFID_FUJITSU: |
419 | if (le16_to_cpu(buf[1]) == PRODID_FUJITSU_MBH10304) { | 397 | if (link->card_id == PRODID_FUJITSU_MBH10304) { |
420 | cardtype = XXX10304; /* MBH10304 with buggy CIS */ | 398 | cardtype = XXX10304; /* MBH10304 with buggy CIS */ |
421 | link->conf.ConfigIndex = 0x20; | 399 | link->conf.ConfigIndex = 0x20; |
422 | } else { | 400 | } else { |
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index bc0ca41a0542..a956a51d284f 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c | |||
@@ -222,24 +222,12 @@ static int ibmtr_config(struct pcmcia_device *link) | |||
222 | ibmtr_dev_t *info = link->priv; | 222 | ibmtr_dev_t *info = link->priv; |
223 | struct net_device *dev = info->dev; | 223 | struct net_device *dev = info->dev; |
224 | struct tok_info *ti = netdev_priv(dev); | 224 | struct tok_info *ti = netdev_priv(dev); |
225 | tuple_t tuple; | ||
226 | cisparse_t parse; | ||
227 | win_req_t req; | 225 | win_req_t req; |
228 | memreq_t mem; | 226 | memreq_t mem; |
229 | int i, last_ret, last_fn; | 227 | int i, last_ret, last_fn; |
230 | u_char buf[64]; | ||
231 | 228 | ||
232 | DEBUG(0, "ibmtr_config(0x%p)\n", link); | 229 | DEBUG(0, "ibmtr_config(0x%p)\n", link); |
233 | 230 | ||
234 | tuple.Attributes = 0; | ||
235 | tuple.TupleData = buf; | ||
236 | tuple.TupleDataMax = 64; | ||
237 | tuple.TupleOffset = 0; | ||
238 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
239 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
240 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
241 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
242 | link->conf.ConfigBase = parse.config.base; | ||
243 | link->conf.ConfigIndex = 0x61; | 231 | link->conf.ConfigIndex = 0x61; |
244 | 232 | ||
245 | /* Determine if this is PRIMARY or ALTERNATE. */ | 233 | /* Determine if this is PRIMARY or ALTERNATE. */ |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index e77110e4c288..3b707747a811 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -656,23 +656,12 @@ static int nmclan_config(struct pcmcia_device *link) | |||
656 | struct net_device *dev = link->priv; | 656 | struct net_device *dev = link->priv; |
657 | mace_private *lp = netdev_priv(dev); | 657 | mace_private *lp = netdev_priv(dev); |
658 | tuple_t tuple; | 658 | tuple_t tuple; |
659 | cisparse_t parse; | ||
660 | u_char buf[64]; | 659 | u_char buf[64]; |
661 | int i, last_ret, last_fn; | 660 | int i, last_ret, last_fn; |
662 | kio_addr_t ioaddr; | 661 | kio_addr_t ioaddr; |
663 | 662 | ||
664 | DEBUG(0, "nmclan_config(0x%p)\n", link); | 663 | DEBUG(0, "nmclan_config(0x%p)\n", link); |
665 | 664 | ||
666 | tuple.Attributes = 0; | ||
667 | tuple.TupleData = buf; | ||
668 | tuple.TupleDataMax = 64; | ||
669 | tuple.TupleOffset = 0; | ||
670 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
671 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
672 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
673 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
674 | link->conf.ConfigBase = parse.config.base; | ||
675 | |||
676 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); | 665 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); |
677 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 666 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
678 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 667 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
@@ -686,6 +675,7 @@ static int nmclan_config(struct pcmcia_device *link) | |||
686 | tuple.TupleData = buf; | 675 | tuple.TupleData = buf; |
687 | tuple.TupleDataMax = 64; | 676 | tuple.TupleDataMax = 64; |
688 | tuple.TupleOffset = 0; | 677 | tuple.TupleOffset = 0; |
678 | tuple.Attributes = 0; | ||
689 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 679 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
690 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | 680 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
691 | memcpy(dev->dev_addr, tuple.TupleData, ETHER_ADDR_LEN); | 681 | memcpy(dev->dev_addr, tuple.TupleData, ETHER_ADDR_LEN); |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index c51cc5d8789a..2b1238e2dbdb 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -519,31 +519,15 @@ static int pcnet_config(struct pcmcia_device *link) | |||
519 | tuple_t tuple; | 519 | tuple_t tuple; |
520 | cisparse_t parse; | 520 | cisparse_t parse; |
521 | int i, last_ret, last_fn, start_pg, stop_pg, cm_offset; | 521 | int i, last_ret, last_fn, start_pg, stop_pg, cm_offset; |
522 | int manfid = 0, prodid = 0, has_shmem = 0; | 522 | int has_shmem = 0; |
523 | u_short buf[64]; | 523 | u_short buf[64]; |
524 | hw_info_t *hw_info; | 524 | hw_info_t *hw_info; |
525 | 525 | ||
526 | DEBUG(0, "pcnet_config(0x%p)\n", link); | 526 | DEBUG(0, "pcnet_config(0x%p)\n", link); |
527 | 527 | ||
528 | tuple.Attributes = 0; | ||
529 | tuple.TupleData = (cisdata_t *)buf; | 528 | tuple.TupleData = (cisdata_t *)buf; |
530 | tuple.TupleDataMax = sizeof(buf); | 529 | tuple.TupleDataMax = sizeof(buf); |
531 | tuple.TupleOffset = 0; | 530 | tuple.TupleOffset = 0; |
532 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
533 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
534 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
535 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
536 | link->conf.ConfigBase = parse.config.base; | ||
537 | link->conf.Present = parse.config.rmask[0]; | ||
538 | |||
539 | tuple.DesiredTuple = CISTPL_MANFID; | ||
540 | tuple.Attributes = TUPLE_RETURN_COMMON; | ||
541 | if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && | ||
542 | (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) { | ||
543 | manfid = le16_to_cpu(buf[0]); | ||
544 | prodid = le16_to_cpu(buf[1]); | ||
545 | } | ||
546 | |||
547 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 531 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
548 | tuple.Attributes = 0; | 532 | tuple.Attributes = 0; |
549 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 533 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
@@ -589,8 +573,8 @@ static int pcnet_config(struct pcmcia_device *link) | |||
589 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 573 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
590 | link->conf.Status = CCSR_AUDIO_ENA; | 574 | link->conf.Status = CCSR_AUDIO_ENA; |
591 | } | 575 | } |
592 | if ((manfid == MANFID_IBM) && | 576 | if ((link->manf_id == MANFID_IBM) && |
593 | (prodid == PRODID_IBM_HOME_AND_AWAY)) | 577 | (link->card_id == PRODID_IBM_HOME_AND_AWAY)) |
594 | link->conf.ConfigIndex |= 0x10; | 578 | link->conf.ConfigIndex |= 0x10; |
595 | 579 | ||
596 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 580 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
@@ -624,10 +608,10 @@ static int pcnet_config(struct pcmcia_device *link) | |||
624 | info->flags = hw_info->flags; | 608 | info->flags = hw_info->flags; |
625 | /* Check for user overrides */ | 609 | /* Check for user overrides */ |
626 | info->flags |= (delay_output) ? DELAY_OUTPUT : 0; | 610 | info->flags |= (delay_output) ? DELAY_OUTPUT : 0; |
627 | if ((manfid == MANFID_SOCKET) && | 611 | if ((link->manf_id == MANFID_SOCKET) && |
628 | ((prodid == PRODID_SOCKET_LPE) || | 612 | ((link->card_id == PRODID_SOCKET_LPE) || |
629 | (prodid == PRODID_SOCKET_LPE_CF) || | 613 | (link->card_id == PRODID_SOCKET_LPE_CF) || |
630 | (prodid == PRODID_SOCKET_EIO))) | 614 | (link->card_id == PRODID_SOCKET_EIO))) |
631 | info->flags &= ~USE_BIG_BUF; | 615 | info->flags &= ~USE_BIG_BUF; |
632 | if (!use_big_buf) | 616 | if (!use_big_buf) |
633 | info->flags &= ~USE_BIG_BUF; | 617 | info->flags &= ~USE_BIG_BUF; |
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 20fcc3576202..530df8883fe5 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -560,16 +560,8 @@ static int mhz_setup(struct pcmcia_device *link) | |||
560 | 560 | ||
561 | /* Read the station address from the CIS. It is stored as the last | 561 | /* Read the station address from the CIS. It is stored as the last |
562 | (fourth) string in the Version 1 Version/ID tuple. */ | 562 | (fourth) string in the Version 1 Version/ID tuple. */ |
563 | tuple->DesiredTuple = CISTPL_VERS_1; | 563 | if (link->prod_id[3]) { |
564 | if (first_tuple(link, tuple, parse) != CS_SUCCESS) { | 564 | station_addr = link->prod_id[3]; |
565 | rc = -1; | ||
566 | goto free_cfg_mem; | ||
567 | } | ||
568 | /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */ | ||
569 | if (next_tuple(link, tuple, parse) != CS_SUCCESS) | ||
570 | first_tuple(link, tuple, parse); | ||
571 | if (parse->version_1.ns > 3) { | ||
572 | station_addr = parse->version_1.str + parse->version_1.ofs[3]; | ||
573 | if (cvt_ascii_address(dev, station_addr) == 0) { | 565 | if (cvt_ascii_address(dev, station_addr) == 0) { |
574 | rc = 0; | 566 | rc = 0; |
575 | goto free_cfg_mem; | 567 | goto free_cfg_mem; |
@@ -744,15 +736,12 @@ static int smc_setup(struct pcmcia_device *link) | |||
744 | } | 736 | } |
745 | } | 737 | } |
746 | /* Try the third string in the Version 1 Version/ID tuple. */ | 738 | /* Try the third string in the Version 1 Version/ID tuple. */ |
747 | tuple->DesiredTuple = CISTPL_VERS_1; | 739 | if (link->prod_id[2]) { |
748 | if (first_tuple(link, tuple, parse) != CS_SUCCESS) { | 740 | station_addr = link->prod_id[2]; |
749 | rc = -1; | 741 | if (cvt_ascii_address(dev, station_addr) == 0) { |
750 | goto free_cfg_mem; | 742 | rc = 0; |
751 | } | 743 | goto free_cfg_mem; |
752 | station_addr = parse->version_1.str + parse->version_1.ofs[2]; | 744 | } |
753 | if (cvt_ascii_address(dev, station_addr) == 0) { | ||
754 | rc = 0; | ||
755 | goto free_cfg_mem; | ||
756 | } | 745 | } |
757 | 746 | ||
758 | rc = -1; | 747 | rc = -1; |
@@ -970,10 +959,6 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
970 | { | 959 | { |
971 | struct net_device *dev = link->priv; | 960 | struct net_device *dev = link->priv; |
972 | struct smc_private *smc = netdev_priv(dev); | 961 | struct smc_private *smc = netdev_priv(dev); |
973 | struct smc_cfg_mem *cfg_mem; | ||
974 | tuple_t *tuple; | ||
975 | cisparse_t *parse; | ||
976 | u_char *buf; | ||
977 | char *name; | 962 | char *name; |
978 | int i, j, rev; | 963 | int i, j, rev; |
979 | kio_addr_t ioaddr; | 964 | kio_addr_t ioaddr; |
@@ -981,30 +966,8 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
981 | 966 | ||
982 | DEBUG(0, "smc91c92_config(0x%p)\n", link); | 967 | DEBUG(0, "smc91c92_config(0x%p)\n", link); |
983 | 968 | ||
984 | cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); | 969 | smc->manfid = link->manf_id; |
985 | if (!cfg_mem) | 970 | smc->cardid = link->card_id; |
986 | goto config_failed; | ||
987 | |||
988 | tuple = &cfg_mem->tuple; | ||
989 | parse = &cfg_mem->parse; | ||
990 | buf = cfg_mem->buf; | ||
991 | |||
992 | tuple->Attributes = tuple->TupleOffset = 0; | ||
993 | tuple->TupleData = (cisdata_t *)buf; | ||
994 | tuple->TupleDataMax = 64; | ||
995 | |||
996 | tuple->DesiredTuple = CISTPL_CONFIG; | ||
997 | i = first_tuple(link, tuple, parse); | ||
998 | CS_EXIT_TEST(i, ParseTuple, config_failed); | ||
999 | link->conf.ConfigBase = parse->config.base; | ||
1000 | link->conf.Present = parse->config.rmask[0]; | ||
1001 | |||
1002 | tuple->DesiredTuple = CISTPL_MANFID; | ||
1003 | tuple->Attributes = TUPLE_RETURN_COMMON; | ||
1004 | if (first_tuple(link, tuple, parse) == CS_SUCCESS) { | ||
1005 | smc->manfid = parse->manfid.manf; | ||
1006 | smc->cardid = parse->manfid.card; | ||
1007 | } | ||
1008 | 971 | ||
1009 | if ((smc->manfid == MANFID_OSITECH) && | 972 | if ((smc->manfid == MANFID_OSITECH) && |
1010 | (smc->cardid != PRODID_OSITECH_SEVEN)) { | 973 | (smc->cardid != PRODID_OSITECH_SEVEN)) { |
@@ -1134,14 +1097,12 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
1134 | printk(KERN_NOTICE " No MII transceivers found!\n"); | 1097 | printk(KERN_NOTICE " No MII transceivers found!\n"); |
1135 | } | 1098 | } |
1136 | } | 1099 | } |
1137 | kfree(cfg_mem); | ||
1138 | return 0; | 1100 | return 0; |
1139 | 1101 | ||
1140 | config_undo: | 1102 | config_undo: |
1141 | unregister_netdev(dev); | 1103 | unregister_netdev(dev); |
1142 | config_failed: /* CS_EXIT_TEST() calls jump to here... */ | 1104 | config_failed: /* CS_EXIT_TEST() calls jump to here... */ |
1143 | smc91c92_release(link); | 1105 | smc91c92_release(link); |
1144 | kfree(cfg_mem); | ||
1145 | return -ENODEV; | 1106 | return -ENODEV; |
1146 | } /* smc91c92_config */ | 1107 | } /* smc91c92_config */ |
1147 | 1108 | ||
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index f3914f58d67f..69813406782d 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -707,22 +707,11 @@ set_card_type(struct pcmcia_device *link, const void *s) | |||
707 | * Returns: true if this is a CE2 | 707 | * Returns: true if this is a CE2 |
708 | */ | 708 | */ |
709 | static int | 709 | static int |
710 | has_ce2_string(struct pcmcia_device * link) | 710 | has_ce2_string(struct pcmcia_device * p_dev) |
711 | { | 711 | { |
712 | tuple_t tuple; | 712 | if (p_dev->prod_id[2] && strstr(p_dev->prod_id[2], "CE2")) |
713 | cisparse_t parse; | 713 | return 1; |
714 | u_char buf[256]; | 714 | return 0; |
715 | |||
716 | tuple.Attributes = 0; | ||
717 | tuple.TupleData = buf; | ||
718 | tuple.TupleDataMax = 254; | ||
719 | tuple.TupleOffset = 0; | ||
720 | tuple.DesiredTuple = CISTPL_VERS_1; | ||
721 | if (!first_tuple(link, &tuple, &parse) && parse.version_1.ns > 2) { | ||
722 | if (strstr(parse.version_1.str + parse.version_1.ofs[2], "CE2")) | ||
723 | return 1; | ||
724 | } | ||
725 | return 0; | ||
726 | } | 715 | } |
727 | 716 | ||
728 | /**************** | 717 | /**************** |
@@ -792,13 +781,6 @@ xirc2ps_config(struct pcmcia_device * link) | |||
792 | goto failure; | 781 | goto failure; |
793 | } | 782 | } |
794 | 783 | ||
795 | /* get configuration stuff */ | ||
796 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
797 | if ((err=first_tuple(link, &tuple, &parse))) | ||
798 | goto cis_error; | ||
799 | link->conf.ConfigBase = parse.config.base; | ||
800 | link->conf.Present = parse.config.rmask[0]; | ||
801 | |||
802 | /* get the ethernet address from the CIS */ | 784 | /* get the ethernet address from the CIS */ |
803 | tuple.DesiredTuple = CISTPL_FUNCE; | 785 | tuple.DesiredTuple = CISTPL_FUNCE; |
804 | for (err = first_tuple(link, &tuple, &parse); !err; | 786 | for (err = first_tuple(link, &tuple, &parse); !err; |
@@ -1062,8 +1044,6 @@ xirc2ps_config(struct pcmcia_device * link) | |||
1062 | xirc2ps_release(link); | 1044 | xirc2ps_release(link); |
1063 | return -ENODEV; | 1045 | return -ENODEV; |
1064 | 1046 | ||
1065 | cis_error: | ||
1066 | printk(KNOT_XIRC "unable to parse CIS\n"); | ||
1067 | failure: | 1047 | failure: |
1068 | return -ENODEV; | 1048 | return -ENODEV; |
1069 | } /* xirc2ps_config */ | 1049 | } /* xirc2ps_config */ |
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index ac9437d497f0..f12355398fe7 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -219,21 +219,6 @@ static int airo_config(struct pcmcia_device *link) | |||
219 | dev = link->priv; | 219 | dev = link->priv; |
220 | 220 | ||
221 | DEBUG(0, "airo_config(0x%p)\n", link); | 221 | DEBUG(0, "airo_config(0x%p)\n", link); |
222 | |||
223 | /* | ||
224 | This reads the card's CONFIG tuple to find its configuration | ||
225 | registers. | ||
226 | */ | ||
227 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
228 | tuple.Attributes = 0; | ||
229 | tuple.TupleData = buf; | ||
230 | tuple.TupleDataMax = sizeof(buf); | ||
231 | tuple.TupleOffset = 0; | ||
232 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
233 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
234 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
235 | link->conf.ConfigBase = parse.config.base; | ||
236 | link->conf.Present = parse.config.rmask[0]; | ||
237 | 222 | ||
238 | /* | 223 | /* |
239 | In this loop, we scan the CIS for configuration table entries, | 224 | In this loop, we scan the CIS for configuration table entries, |
@@ -247,6 +232,10 @@ static int airo_config(struct pcmcia_device *link) | |||
247 | these things without consulting the CIS, and most client drivers | 232 | these things without consulting the CIS, and most client drivers |
248 | will only use the CIS to fill in implementation-defined details. | 233 | will only use the CIS to fill in implementation-defined details. |
249 | */ | 234 | */ |
235 | tuple.Attributes = 0; | ||
236 | tuple.TupleData = buf; | ||
237 | tuple.TupleDataMax = sizeof(buf); | ||
238 | tuple.TupleOffset = 0; | ||
250 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 239 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
251 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 240 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
252 | while (1) { | 241 | while (1) { |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 5c410989c4d7..12617cd0b78e 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -244,17 +244,6 @@ static int atmel_config(struct pcmcia_device *link) | |||
244 | tuple.TupleOffset = 0; | 244 | tuple.TupleOffset = 0; |
245 | 245 | ||
246 | /* | 246 | /* |
247 | This reads the card's CONFIG tuple to find its configuration | ||
248 | registers. | ||
249 | */ | ||
250 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
251 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
252 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
253 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
254 | link->conf.ConfigBase = parse.config.base; | ||
255 | link->conf.Present = parse.config.rmask[0]; | ||
256 | |||
257 | /* | ||
258 | In this loop, we scan the CIS for configuration table entries, | 247 | In this loop, we scan the CIS for configuration table entries, |
259 | each of which describes a valid card configuration, including | 248 | each of which describes a valid card configuration, including |
260 | voltage, IO window, memory window, and interrupt settings. | 249 | voltage, IO window, memory window, and interrupt settings. |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index f63909e4bc32..ee542ec6d6a8 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -293,15 +293,12 @@ static int sandisk_enable_wireless(struct net_device *dev) | |||
293 | goto done; | 293 | goto done; |
294 | } | 294 | } |
295 | 295 | ||
296 | tuple.DesiredTuple = CISTPL_MANFID; | ||
297 | tuple.Attributes = TUPLE_RETURN_COMMON; | 296 | tuple.Attributes = TUPLE_RETURN_COMMON; |
298 | tuple.TupleData = buf; | 297 | tuple.TupleData = buf; |
299 | tuple.TupleDataMax = sizeof(buf); | 298 | tuple.TupleDataMax = sizeof(buf); |
300 | tuple.TupleOffset = 0; | 299 | tuple.TupleOffset = 0; |
301 | if (pcmcia_get_first_tuple(hw_priv->link, &tuple) || | 300 | |
302 | pcmcia_get_tuple_data(hw_priv->link, &tuple) || | 301 | if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) { |
303 | pcmcia_parse_tuple(hw_priv->link, &tuple, parse) || | ||
304 | parse->manfid.manf != 0xd601 || parse->manfid.card != 0x0101) { | ||
305 | /* No SanDisk manfid found */ | 302 | /* No SanDisk manfid found */ |
306 | ret = -ENODEV; | 303 | ret = -ENODEV; |
307 | goto done; | 304 | goto done; |
@@ -573,16 +570,10 @@ static int prism2_config(struct pcmcia_device *link) | |||
573 | } | 570 | } |
574 | memset(hw_priv, 0, sizeof(*hw_priv)); | 571 | memset(hw_priv, 0, sizeof(*hw_priv)); |
575 | 572 | ||
576 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
577 | tuple.Attributes = 0; | 573 | tuple.Attributes = 0; |
578 | tuple.TupleData = buf; | 574 | tuple.TupleData = buf; |
579 | tuple.TupleDataMax = sizeof(buf); | 575 | tuple.TupleDataMax = sizeof(buf); |
580 | tuple.TupleOffset = 0; | 576 | tuple.TupleOffset = 0; |
581 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
582 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
583 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse)); | ||
584 | link->conf.ConfigBase = parse->config.base; | ||
585 | link->conf.Present = parse->config.rmask[0]; | ||
586 | 577 | ||
587 | CS_CHECK(GetConfigurationInfo, | 578 | CS_CHECK(GetConfigurationInfo, |
588 | pcmcia_get_configuration_info(link, &conf)); | 579 | pcmcia_get_configuration_info(link, &conf)); |
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index 6714e0dfa8d6..644b4741ef74 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -735,10 +735,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
735 | static int netwave_pcmcia_config(struct pcmcia_device *link) { | 735 | static int netwave_pcmcia_config(struct pcmcia_device *link) { |
736 | struct net_device *dev = link->priv; | 736 | struct net_device *dev = link->priv; |
737 | netwave_private *priv = netdev_priv(dev); | 737 | netwave_private *priv = netdev_priv(dev); |
738 | tuple_t tuple; | ||
739 | cisparse_t parse; | ||
740 | int i, j, last_ret, last_fn; | 738 | int i, j, last_ret, last_fn; |
741 | u_char buf[64]; | ||
742 | win_req_t req; | 739 | win_req_t req; |
743 | memreq_t mem; | 740 | memreq_t mem; |
744 | u_char __iomem *ramBase = NULL; | 741 | u_char __iomem *ramBase = NULL; |
@@ -746,21 +743,6 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { | |||
746 | DEBUG(0, "netwave_pcmcia_config(0x%p)\n", link); | 743 | DEBUG(0, "netwave_pcmcia_config(0x%p)\n", link); |
747 | 744 | ||
748 | /* | 745 | /* |
749 | This reads the card's CONFIG tuple to find its configuration | ||
750 | registers. | ||
751 | */ | ||
752 | tuple.Attributes = 0; | ||
753 | tuple.TupleData = (cisdata_t *) buf; | ||
754 | tuple.TupleDataMax = 64; | ||
755 | tuple.TupleOffset = 0; | ||
756 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
757 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
758 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
759 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
760 | link->conf.ConfigBase = parse.config.base; | ||
761 | link->conf.Present = parse.config.rmask[0]; | ||
762 | |||
763 | /* | ||
764 | * Try allocating IO ports. This tries a few fixed addresses. | 746 | * Try allocating IO ports. This tries a few fixed addresses. |
765 | * If you want, you can also read the card's config table to | 747 | * If you want, you can also read the card's config table to |
766 | * pick addresses -- see the serial driver for an example. | 748 | * pick addresses -- see the serial driver for an example. |
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index bc14689cbf24..d08ae8d2726c 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -178,21 +178,6 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
178 | cisparse_t parse; | 178 | cisparse_t parse; |
179 | void __iomem *mem; | 179 | void __iomem *mem; |
180 | 180 | ||
181 | /* | ||
182 | * This reads the card's CONFIG tuple to find its | ||
183 | * configuration registers. | ||
184 | */ | ||
185 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
186 | tuple.Attributes = 0; | ||
187 | tuple.TupleData = buf; | ||
188 | tuple.TupleDataMax = sizeof(buf); | ||
189 | tuple.TupleOffset = 0; | ||
190 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
191 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
192 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
193 | link->conf.ConfigBase = parse.config.base; | ||
194 | link->conf.Present = parse.config.rmask[0]; | ||
195 | |||
196 | /* Look up the current Vcc */ | 181 | /* Look up the current Vcc */ |
197 | CS_CHECK(GetConfigurationInfo, | 182 | CS_CHECK(GetConfigurationInfo, |
198 | pcmcia_get_configuration_info(link, &conf)); | 183 | pcmcia_get_configuration_info(link, &conf)); |
@@ -211,6 +196,10 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
211 | * and most client drivers will only use the CIS to fill in | 196 | * and most client drivers will only use the CIS to fill in |
212 | * implementation-defined details. | 197 | * implementation-defined details. |
213 | */ | 198 | */ |
199 | tuple.Attributes = 0; | ||
200 | tuple.TupleData = buf; | ||
201 | tuple.TupleDataMax = sizeof(buf); | ||
202 | tuple.TupleOffset = 0; | ||
214 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 203 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
215 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 204 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
216 | while (1) { | 205 | while (1) { |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 7fbfc9e41d07..88e10c9bc4ac 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -408,11 +408,8 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
408 | #define MAX_TUPLE_SIZE 128 | 408 | #define MAX_TUPLE_SIZE 128 |
409 | static int ray_config(struct pcmcia_device *link) | 409 | static int ray_config(struct pcmcia_device *link) |
410 | { | 410 | { |
411 | tuple_t tuple; | ||
412 | cisparse_t parse; | ||
413 | int last_fn = 0, last_ret = 0; | 411 | int last_fn = 0, last_ret = 0; |
414 | int i; | 412 | int i; |
415 | u_char buf[MAX_TUPLE_SIZE]; | ||
416 | win_req_t req; | 413 | win_req_t req; |
417 | memreq_t mem; | 414 | memreq_t mem; |
418 | struct net_device *dev = (struct net_device *)link->priv; | 415 | struct net_device *dev = (struct net_device *)link->priv; |
@@ -420,29 +417,12 @@ static int ray_config(struct pcmcia_device *link) | |||
420 | 417 | ||
421 | DEBUG(1, "ray_config(0x%p)\n", link); | 418 | DEBUG(1, "ray_config(0x%p)\n", link); |
422 | 419 | ||
423 | /* This reads the card's CONFIG tuple to find its configuration regs */ | ||
424 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
425 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
426 | tuple.TupleData = buf; | ||
427 | tuple.TupleDataMax = MAX_TUPLE_SIZE; | ||
428 | tuple.TupleOffset = 0; | ||
429 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
430 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
431 | link->conf.ConfigBase = parse.config.base; | ||
432 | link->conf.Present = parse.config.rmask[0]; | ||
433 | |||
434 | /* Determine card type and firmware version */ | 420 | /* Determine card type and firmware version */ |
435 | buf[0] = buf[MAX_TUPLE_SIZE - 1] = 0; | 421 | printk(KERN_INFO "ray_cs Detected: %s%s%s%s\n", |
436 | tuple.DesiredTuple = CISTPL_VERS_1; | 422 | link->prod_id[0] ? link->prod_id[0] : " ", |
437 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 423 | link->prod_id[1] ? link->prod_id[1] : " ", |
438 | tuple.TupleData = buf; | 424 | link->prod_id[2] ? link->prod_id[2] : " ", |
439 | tuple.TupleDataMax = MAX_TUPLE_SIZE; | 425 | link->prod_id[3] ? link->prod_id[3] : " "); |
440 | tuple.TupleOffset = 2; | ||
441 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
442 | |||
443 | for (i=0; i<tuple.TupleDataLen - 4; i++) | ||
444 | if (buf[i] == 0) buf[i] = ' '; | ||
445 | printk(KERN_INFO "ray_cs Detected: %s\n",buf); | ||
446 | 426 | ||
447 | /* Now allocate an interrupt line. Note that this does not | 427 | /* Now allocate an interrupt line. Note that this does not |
448 | actually assign a handler to the interrupt. | 428 | actually assign a handler to the interrupt. |
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index bcc7038130f6..cf2d1486b01d 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -647,21 +647,6 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
647 | cisparse_t parse; | 647 | cisparse_t parse; |
648 | void __iomem *mem; | 648 | void __iomem *mem; |
649 | 649 | ||
650 | /* | ||
651 | * This reads the card's CONFIG tuple to find its | ||
652 | * configuration registers. | ||
653 | */ | ||
654 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
655 | tuple.Attributes = 0; | ||
656 | tuple.TupleData = buf; | ||
657 | tuple.TupleDataMax = sizeof(buf); | ||
658 | tuple.TupleOffset = 0; | ||
659 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
660 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
661 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
662 | link->conf.ConfigBase = parse.config.base; | ||
663 | link->conf.Present = parse.config.rmask[0]; | ||
664 | |||
665 | /* Look up the current Vcc */ | 650 | /* Look up the current Vcc */ |
666 | CS_CHECK(GetConfigurationInfo, | 651 | CS_CHECK(GetConfigurationInfo, |
667 | pcmcia_get_configuration_info(link, &conf)); | 652 | pcmcia_get_configuration_info(link, &conf)); |
@@ -681,6 +666,10 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
681 | * implementation-defined details. | 666 | * implementation-defined details. |
682 | */ | 667 | */ |
683 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 668 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
669 | tuple.Attributes = 0; | ||
670 | tuple.TupleData = buf; | ||
671 | tuple.TupleDataMax = sizeof(buf); | ||
672 | tuple.TupleOffset = 0; | ||
684 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 673 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
685 | while (1) { | 674 | while (1) { |
686 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | 675 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index aafb301041b1..233d906c08f0 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -3939,11 +3939,8 @@ wv_hw_reset(struct net_device * dev) | |||
3939 | static inline int | 3939 | static inline int |
3940 | wv_pcmcia_config(struct pcmcia_device * link) | 3940 | wv_pcmcia_config(struct pcmcia_device * link) |
3941 | { | 3941 | { |
3942 | tuple_t tuple; | ||
3943 | cisparse_t parse; | ||
3944 | struct net_device * dev = (struct net_device *) link->priv; | 3942 | struct net_device * dev = (struct net_device *) link->priv; |
3945 | int i; | 3943 | int i; |
3946 | u_char buf[64]; | ||
3947 | win_req_t req; | 3944 | win_req_t req; |
3948 | memreq_t mem; | 3945 | memreq_t mem; |
3949 | net_local * lp = netdev_priv(dev); | 3946 | net_local * lp = netdev_priv(dev); |
@@ -3953,36 +3950,6 @@ wv_pcmcia_config(struct pcmcia_device * link) | |||
3953 | printk(KERN_DEBUG "->wv_pcmcia_config(0x%p)\n", link); | 3950 | printk(KERN_DEBUG "->wv_pcmcia_config(0x%p)\n", link); |
3954 | #endif | 3951 | #endif |
3955 | 3952 | ||
3956 | /* | ||
3957 | * This reads the card's CONFIG tuple to find its configuration | ||
3958 | * registers. | ||
3959 | */ | ||
3960 | do | ||
3961 | { | ||
3962 | tuple.Attributes = 0; | ||
3963 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
3964 | i = pcmcia_get_first_tuple(link, &tuple); | ||
3965 | if(i != CS_SUCCESS) | ||
3966 | break; | ||
3967 | tuple.TupleData = (cisdata_t *)buf; | ||
3968 | tuple.TupleDataMax = 64; | ||
3969 | tuple.TupleOffset = 0; | ||
3970 | i = pcmcia_get_tuple_data(link, &tuple); | ||
3971 | if(i != CS_SUCCESS) | ||
3972 | break; | ||
3973 | i = pcmcia_parse_tuple(link, &tuple, &parse); | ||
3974 | if(i != CS_SUCCESS) | ||
3975 | break; | ||
3976 | link->conf.ConfigBase = parse.config.base; | ||
3977 | link->conf.Present = parse.config.rmask[0]; | ||
3978 | } | ||
3979 | while(0); | ||
3980 | if(i != CS_SUCCESS) | ||
3981 | { | ||
3982 | cs_error(link, ParseTuple, i); | ||
3983 | return FALSE; | ||
3984 | } | ||
3985 | |||
3986 | do | 3953 | do |
3987 | { | 3954 | { |
3988 | i = pcmcia_request_io(link, &link->io); | 3955 | i = pcmcia_request_io(link, &link->io); |
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 5b98a7876982..583e0d655a98 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
@@ -1966,25 +1966,10 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
1966 | */ | 1966 | */ |
1967 | static int wl3501_config(struct pcmcia_device *link) | 1967 | static int wl3501_config(struct pcmcia_device *link) |
1968 | { | 1968 | { |
1969 | tuple_t tuple; | ||
1970 | cisparse_t parse; | ||
1971 | struct net_device *dev = link->priv; | 1969 | struct net_device *dev = link->priv; |
1972 | int i = 0, j, last_fn, last_ret; | 1970 | int i = 0, j, last_fn, last_ret; |
1973 | unsigned char bf[64]; | ||
1974 | struct wl3501_card *this; | 1971 | struct wl3501_card *this; |
1975 | 1972 | ||
1976 | /* This reads the card's CONFIG tuple to find its config registers. */ | ||
1977 | tuple.Attributes = 0; | ||
1978 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
1979 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
1980 | tuple.TupleData = bf; | ||
1981 | tuple.TupleDataMax = sizeof(bf); | ||
1982 | tuple.TupleOffset = 0; | ||
1983 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
1984 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
1985 | link->conf.ConfigBase = parse.config.base; | ||
1986 | link->conf.Present = parse.config.rmask[0]; | ||
1987 | |||
1988 | /* Try allocating IO ports. This tries a few fixed addresses. If you | 1973 | /* Try allocating IO ports. This tries a few fixed addresses. If you |
1989 | * want, you can also read the card's config table to pick addresses -- | 1974 | * want, you can also read the card's config table to pick addresses -- |
1990 | * see the serial driver for an example. */ | 1975 | * see the serial driver for an example. */ |
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index b953d5907c05..e60b4bf6bae8 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c | |||
@@ -166,14 +166,6 @@ static int parport_config(struct pcmcia_device *link) | |||
166 | 166 | ||
167 | tuple.TupleData = (cisdata_t *)buf; | 167 | tuple.TupleData = (cisdata_t *)buf; |
168 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; | 168 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; |
169 | tuple.Attributes = 0; | ||
170 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
171 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
172 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
173 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
174 | link->conf.ConfigBase = parse.config.base; | ||
175 | link->conf.Present = parse.config.rmask[0]; | ||
176 | |||
177 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 169 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
178 | tuple.Attributes = 0; | 170 | tuple.Attributes = 0; |
179 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 171 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
@@ -263,6 +255,7 @@ void parport_cs_release(struct pcmcia_device *link) | |||
263 | 255 | ||
264 | static struct pcmcia_device_id parport_ids[] = { | 256 | static struct pcmcia_device_id parport_ids[] = { |
265 | PCMCIA_DEVICE_FUNC_ID(3), | 257 | PCMCIA_DEVICE_FUNC_ID(3), |
258 | PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial+Parallel Port: SP230",0x3beb8cf2,0xdb9e58bc), | ||
266 | PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0003), | 259 | PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0003), |
267 | PCMCIA_DEVICE_NULL | 260 | PCMCIA_DEVICE_NULL |
268 | }; | 261 | }; |
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c index 3bcb7dc32995..b6746301d9a9 100644 --- a/drivers/pcmcia/at91_cf.c +++ b/drivers/pcmcia/at91_cf.c | |||
@@ -32,10 +32,11 @@ | |||
32 | * A0..A10 work in each range; A23 indicates I/O space; A25 is CFRNW; | 32 | * A0..A10 work in each range; A23 indicates I/O space; A25 is CFRNW; |
33 | * some other bit in {A24,A22..A11} is nREG to flag memory access | 33 | * some other bit in {A24,A22..A11} is nREG to flag memory access |
34 | * (vs attributes). So more than 2KB/region would just be waste. | 34 | * (vs attributes). So more than 2KB/region would just be waste. |
35 | * Note: These are offsets from the physical base address. | ||
35 | */ | 36 | */ |
36 | #define CF_ATTR_PHYS (AT91_CF_BASE) | 37 | #define CF_ATTR_PHYS (0) |
37 | #define CF_IO_PHYS (AT91_CF_BASE + (1 << 23)) | 38 | #define CF_IO_PHYS (1 << 23) |
38 | #define CF_MEM_PHYS (AT91_CF_BASE + 0x017ff800) | 39 | #define CF_MEM_PHYS (0x017ff800) |
39 | 40 | ||
40 | /*--------------------------------------------------------------------------*/ | 41 | /*--------------------------------------------------------------------------*/ |
41 | 42 | ||
@@ -48,6 +49,8 @@ struct at91_cf_socket { | |||
48 | 49 | ||
49 | struct platform_device *pdev; | 50 | struct platform_device *pdev; |
50 | struct at91_cf_data *board; | 51 | struct at91_cf_data *board; |
52 | |||
53 | unsigned long phys_baseaddr; | ||
51 | }; | 54 | }; |
52 | 55 | ||
53 | #define SZ_2K (2 * SZ_1K) | 56 | #define SZ_2K (2 * SZ_1K) |
@@ -154,9 +157,8 @@ static int at91_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) | |||
154 | 157 | ||
155 | /* | 158 | /* |
156 | * Use 16 bit accesses unless/until we need 8-bit i/o space. | 159 | * Use 16 bit accesses unless/until we need 8-bit i/o space. |
157 | * Always set CSR4 ... PCMCIA won't always unmap things. | ||
158 | */ | 160 | */ |
159 | csr = at91_sys_read(AT91_SMC_CSR(4)) & ~AT91_SMC_DBW; | 161 | csr = at91_sys_read(AT91_SMC_CSR(cf->board->chipselect)) & ~AT91_SMC_DBW; |
160 | 162 | ||
161 | /* | 163 | /* |
162 | * NOTE: this CF controller ignores IOIS16, so we can't really do | 164 | * NOTE: this CF controller ignores IOIS16, so we can't really do |
@@ -168,14 +170,14 @@ static int at91_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) | |||
168 | * some cards only like that way to get at the odd byte, despite | 170 | * some cards only like that way to get at the odd byte, despite |
169 | * CF 3.0 spec table 35 also giving the D8-D15 option. | 171 | * CF 3.0 spec table 35 also giving the D8-D15 option. |
170 | */ | 172 | */ |
171 | if (!(io->flags & (MAP_16BIT|MAP_AUTOSZ))) { | 173 | if (!(io->flags & (MAP_16BIT | MAP_AUTOSZ))) { |
172 | csr |= AT91_SMC_DBW_8; | 174 | csr |= AT91_SMC_DBW_8; |
173 | pr_debug("%s: 8bit i/o bus\n", driver_name); | 175 | pr_debug("%s: 8bit i/o bus\n", driver_name); |
174 | } else { | 176 | } else { |
175 | csr |= AT91_SMC_DBW_16; | 177 | csr |= AT91_SMC_DBW_16; |
176 | pr_debug("%s: 16bit i/o bus\n", driver_name); | 178 | pr_debug("%s: 16bit i/o bus\n", driver_name); |
177 | } | 179 | } |
178 | at91_sys_write(AT91_SMC_CSR(4), csr); | 180 | at91_sys_write(AT91_SMC_CSR(cf->board->chipselect), csr); |
179 | 181 | ||
180 | io->start = cf->socket.io_offset; | 182 | io->start = cf->socket.io_offset; |
181 | io->stop = io->start + SZ_2K - 1; | 183 | io->stop = io->start + SZ_2K - 1; |
@@ -194,11 +196,11 @@ at91_cf_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *map) | |||
194 | 196 | ||
195 | cf = container_of(s, struct at91_cf_socket, socket); | 197 | cf = container_of(s, struct at91_cf_socket, socket); |
196 | 198 | ||
197 | map->flags &= MAP_ACTIVE|MAP_ATTRIB|MAP_16BIT; | 199 | map->flags &= (MAP_ACTIVE | MAP_ATTRIB | MAP_16BIT); |
198 | if (map->flags & MAP_ATTRIB) | 200 | if (map->flags & MAP_ATTRIB) |
199 | map->static_start = CF_ATTR_PHYS; | 201 | map->static_start = cf->phys_baseaddr + CF_ATTR_PHYS; |
200 | else | 202 | else |
201 | map->static_start = CF_MEM_PHYS; | 203 | map->static_start = cf->phys_baseaddr + CF_MEM_PHYS; |
202 | 204 | ||
203 | return 0; | 205 | return 0; |
204 | } | 206 | } |
@@ -219,7 +221,6 @@ static int __init at91_cf_probe(struct platform_device *pdev) | |||
219 | struct at91_cf_socket *cf; | 221 | struct at91_cf_socket *cf; |
220 | struct at91_cf_data *board = pdev->dev.platform_data; | 222 | struct at91_cf_data *board = pdev->dev.platform_data; |
221 | struct resource *io; | 223 | struct resource *io; |
222 | unsigned int csa; | ||
223 | int status; | 224 | int status; |
224 | 225 | ||
225 | if (!board || !board->det_pin || !board->rst_pin) | 226 | if (!board || !board->det_pin || !board->rst_pin) |
@@ -235,33 +236,11 @@ static int __init at91_cf_probe(struct platform_device *pdev) | |||
235 | 236 | ||
236 | cf->board = board; | 237 | cf->board = board; |
237 | cf->pdev = pdev; | 238 | cf->pdev = pdev; |
239 | cf->phys_baseaddr = io->start; | ||
238 | platform_set_drvdata(pdev, cf); | 240 | platform_set_drvdata(pdev, cf); |
239 | 241 | ||
240 | /* CF takes over CS4, CS5, CS6 */ | ||
241 | csa = at91_sys_read(AT91_EBI_CSA); | ||
242 | at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH); | ||
243 | |||
244 | /* nWAIT is _not_ a default setting */ | ||
245 | (void) at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */ | ||
246 | |||
247 | /* | ||
248 | * Static memory controller timing adjustments. | ||
249 | * REVISIT: these timings are in terms of MCK cycles, so | ||
250 | * when MCK changes (cpufreq etc) so must these values... | ||
251 | */ | ||
252 | at91_sys_write(AT91_SMC_CSR(4), | ||
253 | AT91_SMC_ACSS_STD | ||
254 | | AT91_SMC_DBW_16 | ||
255 | | AT91_SMC_BAT | ||
256 | | AT91_SMC_WSEN | ||
257 | | AT91_SMC_NWS_(32) /* wait states */ | ||
258 | | AT91_SMC_RWSETUP_(6) /* setup time */ | ||
259 | | AT91_SMC_RWHOLD_(4) /* hold time */ | ||
260 | ); | ||
261 | |||
262 | /* must be a GPIO; ergo must trigger on both edges */ | 242 | /* must be a GPIO; ergo must trigger on both edges */ |
263 | status = request_irq(board->det_pin, at91_cf_irq, | 243 | status = request_irq(board->det_pin, at91_cf_irq, 0, driver_name, cf); |
264 | IRQF_SAMPLE_RANDOM, driver_name, cf); | ||
265 | if (status < 0) | 244 | if (status < 0) |
266 | goto fail0; | 245 | goto fail0; |
267 | device_init_wakeup(&pdev->dev, 1); | 246 | device_init_wakeup(&pdev->dev, 1); |
@@ -282,14 +261,18 @@ static int __init at91_cf_probe(struct platform_device *pdev) | |||
282 | cf->socket.pci_irq = NR_IRQS + 1; | 261 | cf->socket.pci_irq = NR_IRQS + 1; |
283 | 262 | ||
284 | /* pcmcia layer only remaps "real" memory not iospace */ | 263 | /* pcmcia layer only remaps "real" memory not iospace */ |
285 | cf->socket.io_offset = (unsigned long) ioremap(CF_IO_PHYS, SZ_2K); | 264 | cf->socket.io_offset = (unsigned long) ioremap(cf->phys_baseaddr + CF_IO_PHYS, SZ_2K); |
286 | if (!cf->socket.io_offset) | 265 | if (!cf->socket.io_offset) { |
266 | status = -ENXIO; | ||
287 | goto fail1; | 267 | goto fail1; |
268 | } | ||
288 | 269 | ||
289 | /* reserve CS4, CS5, and CS6 regions; but use just CS4 */ | 270 | /* reserve chip-select regions */ |
290 | if (!request_mem_region(io->start, io->end + 1 - io->start, | 271 | if (!request_mem_region(io->start, io->end + 1 - io->start, |
291 | driver_name)) | 272 | driver_name)) { |
273 | status = -ENXIO; | ||
292 | goto fail1; | 274 | goto fail1; |
275 | } | ||
293 | 276 | ||
294 | pr_info("%s: irqs det #%d, io #%d\n", driver_name, | 277 | pr_info("%s: irqs det #%d, io #%d\n", driver_name, |
295 | board->det_pin, board->irq_pin); | 278 | board->det_pin, board->irq_pin); |
@@ -319,9 +302,7 @@ fail1: | |||
319 | fail0a: | 302 | fail0a: |
320 | device_init_wakeup(&pdev->dev, 0); | 303 | device_init_wakeup(&pdev->dev, 0); |
321 | free_irq(board->det_pin, cf); | 304 | free_irq(board->det_pin, cf); |
322 | device_init_wakeup(&pdev->dev, 0); | ||
323 | fail0: | 305 | fail0: |
324 | at91_sys_write(AT91_EBI_CSA, csa); | ||
325 | kfree(cf); | 306 | kfree(cf); |
326 | return status; | 307 | return status; |
327 | } | 308 | } |
@@ -331,19 +312,15 @@ static int __exit at91_cf_remove(struct platform_device *pdev) | |||
331 | struct at91_cf_socket *cf = platform_get_drvdata(pdev); | 312 | struct at91_cf_socket *cf = platform_get_drvdata(pdev); |
332 | struct at91_cf_data *board = cf->board; | 313 | struct at91_cf_data *board = cf->board; |
333 | struct resource *io = cf->socket.io[0].res; | 314 | struct resource *io = cf->socket.io[0].res; |
334 | unsigned int csa; | ||
335 | 315 | ||
336 | pcmcia_unregister_socket(&cf->socket); | 316 | pcmcia_unregister_socket(&cf->socket); |
337 | if (board->irq_pin) | 317 | if (board->irq_pin) |
338 | free_irq(board->irq_pin, cf); | 318 | free_irq(board->irq_pin, cf); |
339 | free_irq(board->det_pin, cf); | ||
340 | device_init_wakeup(&pdev->dev, 0); | 319 | device_init_wakeup(&pdev->dev, 0); |
320 | free_irq(board->det_pin, cf); | ||
341 | iounmap((void __iomem *) cf->socket.io_offset); | 321 | iounmap((void __iomem *) cf->socket.io_offset); |
342 | release_mem_region(io->start, io->end + 1 - io->start); | 322 | release_mem_region(io->start, io->end + 1 - io->start); |
343 | 323 | ||
344 | csa = at91_sys_read(AT91_EBI_CSA); | ||
345 | at91_sys_write(AT91_EBI_CSA, csa & ~AT91_EBI_CS4A); | ||
346 | |||
347 | kfree(cf); | 324 | kfree(cf); |
348 | return 0; | 325 | return 0; |
349 | } | 326 | } |
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index d6164cd583fd..f573ea04db6f 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -135,7 +135,7 @@ int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev, cs_s | |||
135 | struct pcmcia_callback{ | 135 | struct pcmcia_callback{ |
136 | struct module *owner; | 136 | struct module *owner; |
137 | int (*event) (struct pcmcia_socket *s, event_t event, int priority); | 137 | int (*event) (struct pcmcia_socket *s, event_t event, int priority); |
138 | void (*requery) (struct pcmcia_socket *s); | 138 | void (*requery) (struct pcmcia_socket *s, int new_cis); |
139 | int (*suspend) (struct pcmcia_socket *s); | 139 | int (*suspend) (struct pcmcia_socket *s); |
140 | int (*resume) (struct pcmcia_socket *s); | 140 | int (*resume) (struct pcmcia_socket *s); |
141 | }; | 141 | }; |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 21d83a895b21..45df12eda3c5 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -231,65 +231,6 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv) | |||
231 | } | 231 | } |
232 | 232 | ||
233 | 233 | ||
234 | #ifdef CONFIG_PCMCIA_LOAD_CIS | ||
235 | |||
236 | /** | ||
237 | * pcmcia_load_firmware - load CIS from userspace if device-provided is broken | ||
238 | * @dev - the pcmcia device which needs a CIS override | ||
239 | * @filename - requested filename in /lib/firmware/ | ||
240 | * | ||
241 | * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if | ||
242 | * the one provided by the card is broken. The firmware files reside in | ||
243 | * /lib/firmware/ in userspace. | ||
244 | */ | ||
245 | static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | ||
246 | { | ||
247 | struct pcmcia_socket *s = dev->socket; | ||
248 | const struct firmware *fw; | ||
249 | char path[20]; | ||
250 | int ret=-ENOMEM; | ||
251 | cisdump_t *cis; | ||
252 | |||
253 | if (!filename) | ||
254 | return -EINVAL; | ||
255 | |||
256 | ds_dbg(1, "trying to load firmware %s\n", filename); | ||
257 | |||
258 | if (strlen(filename) > 14) | ||
259 | return -EINVAL; | ||
260 | |||
261 | snprintf(path, 20, "%s", filename); | ||
262 | |||
263 | if (request_firmware(&fw, path, &dev->dev) == 0) { | ||
264 | if (fw->size >= CISTPL_MAX_CIS_SIZE) | ||
265 | goto release; | ||
266 | |||
267 | cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL); | ||
268 | if (!cis) | ||
269 | goto release; | ||
270 | |||
271 | cis->Length = fw->size + 1; | ||
272 | memcpy(cis->Data, fw->data, fw->size); | ||
273 | |||
274 | if (!pcmcia_replace_cis(s, cis)) | ||
275 | ret = 0; | ||
276 | } | ||
277 | release: | ||
278 | release_firmware(fw); | ||
279 | |||
280 | return (ret); | ||
281 | } | ||
282 | |||
283 | #else /* !CONFIG_PCMCIA_LOAD_CIS */ | ||
284 | |||
285 | static inline int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | ||
286 | { | ||
287 | return -ENODEV; | ||
288 | } | ||
289 | |||
290 | #endif | ||
291 | |||
292 | |||
293 | /*======================================================================*/ | 234 | /*======================================================================*/ |
294 | 235 | ||
295 | 236 | ||
@@ -309,6 +250,8 @@ int pcmcia_register_driver(struct pcmcia_driver *driver) | |||
309 | driver->drv.bus = &pcmcia_bus_type; | 250 | driver->drv.bus = &pcmcia_bus_type; |
310 | driver->drv.owner = driver->owner; | 251 | driver->drv.owner = driver->owner; |
311 | 252 | ||
253 | ds_dbg(3, "registering driver %s\n", driver->drv.name); | ||
254 | |||
312 | return driver_register(&driver->drv); | 255 | return driver_register(&driver->drv); |
313 | } | 256 | } |
314 | EXPORT_SYMBOL(pcmcia_register_driver); | 257 | EXPORT_SYMBOL(pcmcia_register_driver); |
@@ -318,6 +261,7 @@ EXPORT_SYMBOL(pcmcia_register_driver); | |||
318 | */ | 261 | */ |
319 | void pcmcia_unregister_driver(struct pcmcia_driver *driver) | 262 | void pcmcia_unregister_driver(struct pcmcia_driver *driver) |
320 | { | 263 | { |
264 | ds_dbg(3, "unregistering driver %s\n", driver->drv.name); | ||
321 | driver_unregister(&driver->drv); | 265 | driver_unregister(&driver->drv); |
322 | } | 266 | } |
323 | EXPORT_SYMBOL(pcmcia_unregister_driver); | 267 | EXPORT_SYMBOL(pcmcia_unregister_driver); |
@@ -343,23 +287,27 @@ void pcmcia_put_dev(struct pcmcia_device *p_dev) | |||
343 | static void pcmcia_release_function(struct kref *ref) | 287 | static void pcmcia_release_function(struct kref *ref) |
344 | { | 288 | { |
345 | struct config_t *c = container_of(ref, struct config_t, ref); | 289 | struct config_t *c = container_of(ref, struct config_t, ref); |
290 | ds_dbg(1, "releasing config_t\n"); | ||
346 | kfree(c); | 291 | kfree(c); |
347 | } | 292 | } |
348 | 293 | ||
349 | static void pcmcia_release_dev(struct device *dev) | 294 | static void pcmcia_release_dev(struct device *dev) |
350 | { | 295 | { |
351 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 296 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
352 | ds_dbg(1, "releasing dev %p\n", p_dev); | 297 | ds_dbg(1, "releasing device %s\n", p_dev->dev.bus_id); |
353 | pcmcia_put_socket(p_dev->socket); | 298 | pcmcia_put_socket(p_dev->socket); |
354 | kfree(p_dev->devname); | 299 | kfree(p_dev->devname); |
355 | kref_put(&p_dev->function_config->ref, pcmcia_release_function); | 300 | kref_put(&p_dev->function_config->ref, pcmcia_release_function); |
356 | kfree(p_dev); | 301 | kfree(p_dev); |
357 | } | 302 | } |
358 | 303 | ||
359 | static void pcmcia_add_pseudo_device(struct pcmcia_socket *s) | 304 | static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc) |
360 | { | 305 | { |
361 | if (!s->pcmcia_state.device_add_pending) { | 306 | if (!s->pcmcia_state.device_add_pending) { |
307 | ds_dbg(1, "scheduling to add %s secondary" | ||
308 | " device to %d\n", mfc ? "mfc" : "pfc", s->sock); | ||
362 | s->pcmcia_state.device_add_pending = 1; | 309 | s->pcmcia_state.device_add_pending = 1; |
310 | s->pcmcia_state.mfc_pfc = mfc; | ||
363 | schedule_work(&s->device_add); | 311 | schedule_work(&s->device_add); |
364 | } | 312 | } |
365 | return; | 313 | return; |
@@ -371,6 +319,7 @@ static int pcmcia_device_probe(struct device * dev) | |||
371 | struct pcmcia_driver *p_drv; | 319 | struct pcmcia_driver *p_drv; |
372 | struct pcmcia_device_id *did; | 320 | struct pcmcia_device_id *did; |
373 | struct pcmcia_socket *s; | 321 | struct pcmcia_socket *s; |
322 | cistpl_config_t cis_config; | ||
374 | int ret = 0; | 323 | int ret = 0; |
375 | 324 | ||
376 | dev = get_device(dev); | 325 | dev = get_device(dev); |
@@ -381,15 +330,33 @@ static int pcmcia_device_probe(struct device * dev) | |||
381 | p_drv = to_pcmcia_drv(dev->driver); | 330 | p_drv = to_pcmcia_drv(dev->driver); |
382 | s = p_dev->socket; | 331 | s = p_dev->socket; |
383 | 332 | ||
333 | ds_dbg(1, "trying to bind %s to %s\n", p_dev->dev.bus_id, | ||
334 | p_drv->drv.name); | ||
335 | |||
384 | if ((!p_drv->probe) || (!p_dev->function_config) || | 336 | if ((!p_drv->probe) || (!p_dev->function_config) || |
385 | (!try_module_get(p_drv->owner))) { | 337 | (!try_module_get(p_drv->owner))) { |
386 | ret = -EINVAL; | 338 | ret = -EINVAL; |
387 | goto put_dev; | 339 | goto put_dev; |
388 | } | 340 | } |
389 | 341 | ||
342 | /* set up some more device information */ | ||
343 | ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG, | ||
344 | &cis_config); | ||
345 | if (!ret) { | ||
346 | p_dev->conf.ConfigBase = cis_config.base; | ||
347 | p_dev->conf.Present = cis_config.rmask[0]; | ||
348 | } else { | ||
349 | printk(KERN_INFO "pcmcia: could not parse base and rmask0 of CIS\n"); | ||
350 | p_dev->conf.ConfigBase = 0; | ||
351 | p_dev->conf.Present = 0; | ||
352 | } | ||
353 | |||
390 | ret = p_drv->probe(p_dev); | 354 | ret = p_drv->probe(p_dev); |
391 | if (ret) | 355 | if (ret) { |
356 | ds_dbg(1, "binding %s to %s failed with %d\n", | ||
357 | p_dev->dev.bus_id, p_drv->drv.name, ret); | ||
392 | goto put_module; | 358 | goto put_module; |
359 | } | ||
393 | 360 | ||
394 | /* handle pseudo multifunction devices: | 361 | /* handle pseudo multifunction devices: |
395 | * there are at most two pseudo multifunction devices. | 362 | * there are at most two pseudo multifunction devices. |
@@ -400,7 +367,7 @@ static int pcmcia_device_probe(struct device * dev) | |||
400 | did = p_dev->dev.driver_data; | 367 | did = p_dev->dev.driver_data; |
401 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && | 368 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && |
402 | (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) | 369 | (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) |
403 | pcmcia_add_pseudo_device(p_dev->socket); | 370 | pcmcia_add_device_later(p_dev->socket, 0); |
404 | 371 | ||
405 | put_module: | 372 | put_module: |
406 | if (ret) | 373 | if (ret) |
@@ -421,8 +388,8 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le | |||
421 | struct pcmcia_device *tmp; | 388 | struct pcmcia_device *tmp; |
422 | unsigned long flags; | 389 | unsigned long flags; |
423 | 390 | ||
424 | ds_dbg(2, "unbind_request(%d)\n", s->sock); | 391 | ds_dbg(2, "pcmcia_card_remove(%d) %s\n", s->sock, |
425 | 392 | leftover ? leftover->devname : ""); | |
426 | 393 | ||
427 | if (!leftover) | 394 | if (!leftover) |
428 | s->device_count = 0; | 395 | s->device_count = 0; |
@@ -439,6 +406,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le | |||
439 | p_dev->_removed=1; | 406 | p_dev->_removed=1; |
440 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 407 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
441 | 408 | ||
409 | ds_dbg(2, "unregistering device %s\n", p_dev->dev.bus_id); | ||
442 | device_unregister(&p_dev->dev); | 410 | device_unregister(&p_dev->dev); |
443 | } | 411 | } |
444 | 412 | ||
@@ -455,6 +423,8 @@ static int pcmcia_device_remove(struct device * dev) | |||
455 | p_dev = to_pcmcia_dev(dev); | 423 | p_dev = to_pcmcia_dev(dev); |
456 | p_drv = to_pcmcia_drv(dev->driver); | 424 | p_drv = to_pcmcia_drv(dev->driver); |
457 | 425 | ||
426 | ds_dbg(1, "removing device %s\n", p_dev->dev.bus_id); | ||
427 | |||
458 | /* If we're removing the primary module driving a | 428 | /* If we're removing the primary module driving a |
459 | * pseudo multi-function card, we need to unbind | 429 | * pseudo multi-function card, we need to unbind |
460 | * all devices | 430 | * all devices |
@@ -587,8 +557,10 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
587 | 557 | ||
588 | mutex_lock(&device_add_lock); | 558 | mutex_lock(&device_add_lock); |
589 | 559 | ||
590 | /* max of 2 devices per card */ | 560 | ds_dbg(3, "adding device to %d, function %d\n", s->sock, function); |
591 | if (s->device_count == 2) | 561 | |
562 | /* max of 4 devices per card */ | ||
563 | if (s->device_count == 4) | ||
592 | goto err_put; | 564 | goto err_put; |
593 | 565 | ||
594 | p_dev = kzalloc(sizeof(struct pcmcia_device), GFP_KERNEL); | 566 | p_dev = kzalloc(sizeof(struct pcmcia_device), GFP_KERNEL); |
@@ -598,8 +570,6 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
598 | p_dev->socket = s; | 570 | p_dev->socket = s; |
599 | p_dev->device_no = (s->device_count++); | 571 | p_dev->device_no = (s->device_count++); |
600 | p_dev->func = function; | 572 | p_dev->func = function; |
601 | if (s->functions <= function) | ||
602 | s->functions = function + 1; | ||
603 | 573 | ||
604 | p_dev->dev.bus = &pcmcia_bus_type; | 574 | p_dev->dev.bus = &pcmcia_bus_type; |
605 | p_dev->dev.parent = s->dev.dev; | 575 | p_dev->dev.parent = s->dev.dev; |
@@ -610,8 +580,8 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
610 | if (!p_dev->devname) | 580 | if (!p_dev->devname) |
611 | goto err_free; | 581 | goto err_free; |
612 | sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id); | 582 | sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id); |
583 | ds_dbg(3, "devname is %s\n", p_dev->devname); | ||
613 | 584 | ||
614 | /* compat */ | ||
615 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | 585 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); |
616 | 586 | ||
617 | /* | 587 | /* |
@@ -631,6 +601,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
631 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 601 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
632 | 602 | ||
633 | if (!p_dev->function_config) { | 603 | if (!p_dev->function_config) { |
604 | ds_dbg(3, "creating config_t for %s\n", p_dev->dev.bus_id); | ||
634 | p_dev->function_config = kzalloc(sizeof(struct config_t), | 605 | p_dev->function_config = kzalloc(sizeof(struct config_t), |
635 | GFP_KERNEL); | 606 | GFP_KERNEL); |
636 | if (!p_dev->function_config) | 607 | if (!p_dev->function_config) |
@@ -674,11 +645,16 @@ static int pcmcia_card_add(struct pcmcia_socket *s) | |||
674 | unsigned int no_funcs, i; | 645 | unsigned int no_funcs, i; |
675 | int ret = 0; | 646 | int ret = 0; |
676 | 647 | ||
677 | if (!(s->resource_setup_done)) | 648 | if (!(s->resource_setup_done)) { |
649 | ds_dbg(3, "no resources available, delaying card_add\n"); | ||
678 | return -EAGAIN; /* try again, but later... */ | 650 | return -EAGAIN; /* try again, but later... */ |
651 | } | ||
679 | 652 | ||
680 | if (pcmcia_validate_mem(s)) | 653 | if (pcmcia_validate_mem(s)) { |
654 | ds_dbg(3, "validating mem resources failed, " | ||
655 | "delaying card_add\n"); | ||
681 | return -EAGAIN; /* try again, but later... */ | 656 | return -EAGAIN; /* try again, but later... */ |
657 | } | ||
682 | 658 | ||
683 | ret = pccard_validate_cis(s, BIND_FN_ALL, &cisinfo); | 659 | ret = pccard_validate_cis(s, BIND_FN_ALL, &cisinfo); |
684 | if (ret || !cisinfo.Chains) { | 660 | if (ret || !cisinfo.Chains) { |
@@ -690,6 +666,7 @@ static int pcmcia_card_add(struct pcmcia_socket *s) | |||
690 | no_funcs = mfc.nfn; | 666 | no_funcs = mfc.nfn; |
691 | else | 667 | else |
692 | no_funcs = 1; | 668 | no_funcs = 1; |
669 | s->functions = no_funcs; | ||
693 | 670 | ||
694 | for (i=0; i < no_funcs; i++) | 671 | for (i=0; i < no_funcs; i++) |
695 | pcmcia_device_add(s, i); | 672 | pcmcia_device_add(s, i); |
@@ -698,38 +675,49 @@ static int pcmcia_card_add(struct pcmcia_socket *s) | |||
698 | } | 675 | } |
699 | 676 | ||
700 | 677 | ||
701 | static void pcmcia_delayed_add_pseudo_device(void *data) | 678 | static void pcmcia_delayed_add_device(void *data) |
702 | { | 679 | { |
703 | struct pcmcia_socket *s = data; | 680 | struct pcmcia_socket *s = data; |
704 | pcmcia_device_add(s, 0); | 681 | ds_dbg(1, "adding additional device to %d\n", s->sock); |
682 | pcmcia_device_add(s, s->pcmcia_state.mfc_pfc); | ||
705 | s->pcmcia_state.device_add_pending = 0; | 683 | s->pcmcia_state.device_add_pending = 0; |
684 | s->pcmcia_state.mfc_pfc = 0; | ||
706 | } | 685 | } |
707 | 686 | ||
708 | static int pcmcia_requery(struct device *dev, void * _data) | 687 | static int pcmcia_requery(struct device *dev, void * _data) |
709 | { | 688 | { |
710 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 689 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
711 | if (!p_dev->dev.driver) | 690 | if (!p_dev->dev.driver) { |
691 | ds_dbg(1, "update device information for %s\n", | ||
692 | p_dev->dev.bus_id); | ||
712 | pcmcia_device_query(p_dev); | 693 | pcmcia_device_query(p_dev); |
694 | } | ||
713 | 695 | ||
714 | return 0; | 696 | return 0; |
715 | } | 697 | } |
716 | 698 | ||
717 | static void pcmcia_bus_rescan(struct pcmcia_socket *skt) | 699 | static void pcmcia_bus_rescan(struct pcmcia_socket *skt, int new_cis) |
718 | { | 700 | { |
719 | int no_devices=0; | 701 | int no_devices = 0; |
720 | int ret = 0; | 702 | int ret = 0; |
721 | unsigned long flags; | 703 | unsigned long flags; |
722 | 704 | ||
723 | /* must be called with skt_mutex held */ | 705 | /* must be called with skt_mutex held */ |
706 | ds_dbg(0, "re-scanning socket %d\n", skt->sock); | ||
707 | |||
724 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | 708 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); |
725 | if (list_empty(&skt->devices_list)) | 709 | if (list_empty(&skt->devices_list)) |
726 | no_devices=1; | 710 | no_devices = 1; |
727 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 711 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
728 | 712 | ||
713 | /* If this is because of a CIS override, start over */ | ||
714 | if (new_cis && !no_devices) | ||
715 | pcmcia_card_remove(skt, NULL); | ||
716 | |||
729 | /* if no devices were added for this socket yet because of | 717 | /* if no devices were added for this socket yet because of |
730 | * missing resource information or other trouble, we need to | 718 | * missing resource information or other trouble, we need to |
731 | * do this now. */ | 719 | * do this now. */ |
732 | if (no_devices) { | 720 | if (no_devices || new_cis) { |
733 | ret = pcmcia_card_add(skt); | 721 | ret = pcmcia_card_add(skt); |
734 | if (ret) | 722 | if (ret) |
735 | return; | 723 | return; |
@@ -747,6 +735,97 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt) | |||
747 | printk(KERN_INFO "pcmcia: bus_rescan_devices failed\n"); | 735 | printk(KERN_INFO "pcmcia: bus_rescan_devices failed\n"); |
748 | } | 736 | } |
749 | 737 | ||
738 | #ifdef CONFIG_PCMCIA_LOAD_CIS | ||
739 | |||
740 | /** | ||
741 | * pcmcia_load_firmware - load CIS from userspace if device-provided is broken | ||
742 | * @dev - the pcmcia device which needs a CIS override | ||
743 | * @filename - requested filename in /lib/firmware/ | ||
744 | * | ||
745 | * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if | ||
746 | * the one provided by the card is broken. The firmware files reside in | ||
747 | * /lib/firmware/ in userspace. | ||
748 | */ | ||
749 | static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | ||
750 | { | ||
751 | struct pcmcia_socket *s = dev->socket; | ||
752 | const struct firmware *fw; | ||
753 | char path[20]; | ||
754 | int ret = -ENOMEM; | ||
755 | int no_funcs; | ||
756 | int old_funcs; | ||
757 | cisdump_t *cis; | ||
758 | cistpl_longlink_mfc_t mfc; | ||
759 | |||
760 | if (!filename) | ||
761 | return -EINVAL; | ||
762 | |||
763 | ds_dbg(1, "trying to load CIS file %s\n", filename); | ||
764 | |||
765 | if (strlen(filename) > 14) { | ||
766 | printk(KERN_WARNING "pcmcia: CIS filename is too long\n"); | ||
767 | return -EINVAL; | ||
768 | } | ||
769 | |||
770 | snprintf(path, 20, "%s", filename); | ||
771 | |||
772 | if (request_firmware(&fw, path, &dev->dev) == 0) { | ||
773 | if (fw->size >= CISTPL_MAX_CIS_SIZE) { | ||
774 | ret = -EINVAL; | ||
775 | printk(KERN_ERR "pcmcia: CIS override is too big\n"); | ||
776 | goto release; | ||
777 | } | ||
778 | |||
779 | cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL); | ||
780 | if (!cis) { | ||
781 | ret = -ENOMEM; | ||
782 | goto release; | ||
783 | } | ||
784 | |||
785 | cis->Length = fw->size + 1; | ||
786 | memcpy(cis->Data, fw->data, fw->size); | ||
787 | |||
788 | if (!pcmcia_replace_cis(s, cis)) | ||
789 | ret = 0; | ||
790 | else { | ||
791 | printk(KERN_ERR "pcmcia: CIS override failed\n"); | ||
792 | goto release; | ||
793 | } | ||
794 | |||
795 | |||
796 | /* update information */ | ||
797 | pcmcia_device_query(dev); | ||
798 | |||
799 | /* does this cis override add or remove functions? */ | ||
800 | old_funcs = s->functions; | ||
801 | |||
802 | if (!pccard_read_tuple(s, BIND_FN_ALL, CISTPL_LONGLINK_MFC, &mfc)) | ||
803 | no_funcs = mfc.nfn; | ||
804 | else | ||
805 | no_funcs = 1; | ||
806 | s->functions = no_funcs; | ||
807 | |||
808 | if (old_funcs > no_funcs) | ||
809 | pcmcia_card_remove(s, dev); | ||
810 | else if (no_funcs > old_funcs) | ||
811 | pcmcia_add_device_later(s, 1); | ||
812 | } | ||
813 | release: | ||
814 | release_firmware(fw); | ||
815 | |||
816 | return (ret); | ||
817 | } | ||
818 | |||
819 | #else /* !CONFIG_PCMCIA_LOAD_CIS */ | ||
820 | |||
821 | static inline int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | ||
822 | { | ||
823 | return -ENODEV; | ||
824 | } | ||
825 | |||
826 | #endif | ||
827 | |||
828 | |||
750 | static inline int pcmcia_devmatch(struct pcmcia_device *dev, | 829 | static inline int pcmcia_devmatch(struct pcmcia_device *dev, |
751 | struct pcmcia_device_id *did) | 830 | struct pcmcia_device_id *did) |
752 | { | 831 | { |
@@ -813,11 +892,14 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev, | |||
813 | * after it has re-checked that there is no possible module | 892 | * after it has re-checked that there is no possible module |
814 | * with a prod_id/manf_id/card_id match. | 893 | * with a prod_id/manf_id/card_id match. |
815 | */ | 894 | */ |
895 | ds_dbg(0, "skipping FUNC_ID match for %s until userspace " | ||
896 | "interaction\n", dev->dev.bus_id); | ||
816 | if (!dev->allow_func_id_match) | 897 | if (!dev->allow_func_id_match) |
817 | return 0; | 898 | return 0; |
818 | } | 899 | } |
819 | 900 | ||
820 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { | 901 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { |
902 | ds_dbg(0, "device %s needs a fake CIS\n", dev->dev.bus_id); | ||
821 | if (!dev->socket->fake_cis) | 903 | if (!dev->socket->fake_cis) |
822 | pcmcia_load_firmware(dev, did->cisfile); | 904 | pcmcia_load_firmware(dev, did->cisfile); |
823 | 905 | ||
@@ -847,13 +929,21 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { | |||
847 | 929 | ||
848 | #ifdef CONFIG_PCMCIA_IOCTL | 930 | #ifdef CONFIG_PCMCIA_IOCTL |
849 | /* matching by cardmgr */ | 931 | /* matching by cardmgr */ |
850 | if (p_dev->cardmgr == p_drv) | 932 | if (p_dev->cardmgr == p_drv) { |
933 | ds_dbg(0, "cardmgr matched %s to %s\n", dev->bus_id, | ||
934 | drv->name); | ||
851 | return 1; | 935 | return 1; |
936 | } | ||
852 | #endif | 937 | #endif |
853 | 938 | ||
854 | while (did && did->match_flags) { | 939 | while (did && did->match_flags) { |
855 | if (pcmcia_devmatch(p_dev, did)) | 940 | ds_dbg(3, "trying to match %s to %s\n", dev->bus_id, |
941 | drv->name); | ||
942 | if (pcmcia_devmatch(p_dev, did)) { | ||
943 | ds_dbg(0, "matched %s to %s\n", dev->bus_id, | ||
944 | drv->name); | ||
856 | return 1; | 945 | return 1; |
946 | } | ||
857 | did++; | 947 | did++; |
858 | } | 948 | } |
859 | 949 | ||
@@ -1044,6 +1134,8 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) | |||
1044 | struct pcmcia_driver *p_drv = NULL; | 1134 | struct pcmcia_driver *p_drv = NULL; |
1045 | int ret = 0; | 1135 | int ret = 0; |
1046 | 1136 | ||
1137 | ds_dbg(2, "suspending %s\n", dev->bus_id); | ||
1138 | |||
1047 | if (dev->driver) | 1139 | if (dev->driver) |
1048 | p_drv = to_pcmcia_drv(dev->driver); | 1140 | p_drv = to_pcmcia_drv(dev->driver); |
1049 | 1141 | ||
@@ -1052,12 +1144,18 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) | |||
1052 | 1144 | ||
1053 | if (p_drv->suspend) { | 1145 | if (p_drv->suspend) { |
1054 | ret = p_drv->suspend(p_dev); | 1146 | ret = p_drv->suspend(p_dev); |
1055 | if (ret) | 1147 | if (ret) { |
1148 | printk(KERN_ERR "pcmcia: device %s (driver %s) did " | ||
1149 | "not want to go to sleep (%d)\n", | ||
1150 | p_dev->devname, p_drv->drv.name, ret); | ||
1056 | goto out; | 1151 | goto out; |
1152 | } | ||
1057 | } | 1153 | } |
1058 | 1154 | ||
1059 | if (p_dev->device_no == p_dev->func) | 1155 | if (p_dev->device_no == p_dev->func) { |
1156 | ds_dbg(2, "releasing configuration for %s\n", dev->bus_id); | ||
1060 | pcmcia_release_configuration(p_dev); | 1157 | pcmcia_release_configuration(p_dev); |
1158 | } | ||
1061 | 1159 | ||
1062 | out: | 1160 | out: |
1063 | if (!ret) | 1161 | if (!ret) |
@@ -1072,6 +1170,8 @@ static int pcmcia_dev_resume(struct device * dev) | |||
1072 | struct pcmcia_driver *p_drv = NULL; | 1170 | struct pcmcia_driver *p_drv = NULL; |
1073 | int ret = 0; | 1171 | int ret = 0; |
1074 | 1172 | ||
1173 | ds_dbg(2, "resuming %s\n", dev->bus_id); | ||
1174 | |||
1075 | if (dev->driver) | 1175 | if (dev->driver) |
1076 | p_drv = to_pcmcia_drv(dev->driver); | 1176 | p_drv = to_pcmcia_drv(dev->driver); |
1077 | 1177 | ||
@@ -1079,6 +1179,7 @@ static int pcmcia_dev_resume(struct device * dev) | |||
1079 | goto out; | 1179 | goto out; |
1080 | 1180 | ||
1081 | if (p_dev->device_no == p_dev->func) { | 1181 | if (p_dev->device_no == p_dev->func) { |
1182 | ds_dbg(2, "requesting configuration for %s\n", dev->bus_id); | ||
1082 | ret = pcmcia_request_configuration(p_dev, &p_dev->conf); | 1183 | ret = pcmcia_request_configuration(p_dev, &p_dev->conf); |
1083 | if (ret) | 1184 | if (ret) |
1084 | goto out; | 1185 | goto out; |
@@ -1120,12 +1221,14 @@ static int pcmcia_bus_resume_callback(struct device *dev, void * _data) | |||
1120 | 1221 | ||
1121 | static int pcmcia_bus_resume(struct pcmcia_socket *skt) | 1222 | static int pcmcia_bus_resume(struct pcmcia_socket *skt) |
1122 | { | 1223 | { |
1224 | ds_dbg(2, "resuming socket %d\n", skt->sock); | ||
1123 | bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback); | 1225 | bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback); |
1124 | return 0; | 1226 | return 0; |
1125 | } | 1227 | } |
1126 | 1228 | ||
1127 | static int pcmcia_bus_suspend(struct pcmcia_socket *skt) | 1229 | static int pcmcia_bus_suspend(struct pcmcia_socket *skt) |
1128 | { | 1230 | { |
1231 | ds_dbg(2, "suspending socket %d\n", skt->sock); | ||
1129 | if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, | 1232 | if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, |
1130 | pcmcia_bus_suspend_callback)) { | 1233 | pcmcia_bus_suspend_callback)) { |
1131 | pcmcia_bus_resume(skt); | 1234 | pcmcia_bus_resume(skt); |
@@ -1246,7 +1349,7 @@ static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev, | |||
1246 | init_waitqueue_head(&socket->queue); | 1349 | init_waitqueue_head(&socket->queue); |
1247 | #endif | 1350 | #endif |
1248 | INIT_LIST_HEAD(&socket->devices_list); | 1351 | INIT_LIST_HEAD(&socket->devices_list); |
1249 | INIT_WORK(&socket->device_add, pcmcia_delayed_add_pseudo_device, socket); | 1352 | INIT_WORK(&socket->device_add, pcmcia_delayed_add_device, socket); |
1250 | memset(&socket->pcmcia_state, 0, sizeof(u8)); | 1353 | memset(&socket->pcmcia_state, 0, sizeof(u8)); |
1251 | socket->device_count = 0; | 1354 | socket->device_count = 0; |
1252 | 1355 | ||
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c index 36fdaa58458c..3c22ac4625c2 100644 --- a/drivers/pcmcia/m32r_cfc.c +++ b/drivers/pcmcia/m32r_cfc.c | |||
@@ -398,7 +398,7 @@ static irqreturn_t pcc_interrupt(int irq, void *dev) | |||
398 | static void pcc_interrupt_wrapper(u_long data) | 398 | static void pcc_interrupt_wrapper(u_long data) |
399 | { | 399 | { |
400 | debug(3, "m32r_cfc: pcc_interrupt_wrapper:\n"); | 400 | debug(3, "m32r_cfc: pcc_interrupt_wrapper:\n"); |
401 | pcc_interrupt(0, NULL, NULL); | 401 | pcc_interrupt(0, NULL); |
402 | init_timer(&poll_timer); | 402 | init_timer(&poll_timer); |
403 | poll_timer.expires = jiffies + poll_interval; | 403 | poll_timer.expires = jiffies + poll_interval; |
404 | add_timer(&poll_timer); | 404 | add_timer(&poll_timer); |
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 310ede575caa..d077870c6731 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -594,7 +594,12 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
594 | 594 | ||
595 | err = ret = 0; | 595 | err = ret = 0; |
596 | 596 | ||
597 | if (cmd & IOC_IN) __copy_from_user((char *)buf, uarg, size); | 597 | if (cmd & IOC_IN) { |
598 | if (__copy_from_user((char *)buf, uarg, size)) { | ||
599 | err = -EFAULT; | ||
600 | goto free_out; | ||
601 | } | ||
602 | } | ||
598 | 603 | ||
599 | switch (cmd) { | 604 | switch (cmd) { |
600 | case DS_ADJUST_RESOURCE_INFO: | 605 | case DS_ADJUST_RESOURCE_INFO: |
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index a70f97fdbbdd..360c24896548 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c | |||
@@ -581,10 +581,10 @@ static irqreturn_t pd6729_test(int irq, void *dev) | |||
581 | return IRQ_HANDLED; | 581 | return IRQ_HANDLED; |
582 | } | 582 | } |
583 | 583 | ||
584 | static int pd6729_check_irq(int irq, int flags) | 584 | static int pd6729_check_irq(int irq) |
585 | { | 585 | { |
586 | if (request_irq(irq, pd6729_test, flags, "x", pd6729_test) != 0) | 586 | if (request_irq(irq, pd6729_test, IRQF_PROBE_SHARED, "x", pd6729_test) |
587 | return -1; | 587 | != 0) return -1; |
588 | free_irq(irq, pd6729_test); | 588 | free_irq(irq, pd6729_test); |
589 | return 0; | 589 | return 0; |
590 | } | 590 | } |
@@ -610,7 +610,7 @@ static u_int __devinit pd6729_isa_scan(void) | |||
610 | 610 | ||
611 | /* just find interrupts that aren't in use */ | 611 | /* just find interrupts that aren't in use */ |
612 | for (i = 0; i < 16; i++) | 612 | for (i = 0; i < 16; i++) |
613 | if ((mask0 & (1 << i)) && (pd6729_check_irq(i, 0) == 0)) | 613 | if ((mask0 & (1 << i)) && (pd6729_check_irq(i) == 0)) |
614 | mask |= (1 << i); | 614 | mask |= (1 << i); |
615 | 615 | ||
616 | printk(KERN_INFO "pd6729: ISA irqs = "); | 616 | printk(KERN_INFO "pd6729: ISA irqs = "); |
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index 933cd864a5c9..b005602d6b53 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
@@ -188,7 +188,7 @@ static ssize_t pccard_store_resource(struct class_device *dev, const char *buf, | |||
188 | (s->state & SOCKET_PRESENT) && | 188 | (s->state & SOCKET_PRESENT) && |
189 | !(s->state & SOCKET_CARDBUS)) { | 189 | !(s->state & SOCKET_CARDBUS)) { |
190 | if (try_module_get(s->callback->owner)) { | 190 | if (try_module_get(s->callback->owner)) { |
191 | s->callback->requery(s); | 191 | s->callback->requery(s, 0); |
192 | module_put(s->callback->owner); | 192 | module_put(s->callback->owner); |
193 | } | 193 | } |
194 | } | 194 | } |
@@ -325,7 +325,7 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz | |||
325 | if ((s->callback) && (s->state & SOCKET_PRESENT) && | 325 | if ((s->callback) && (s->state & SOCKET_PRESENT) && |
326 | !(s->state & SOCKET_CARDBUS)) { | 326 | !(s->state & SOCKET_CARDBUS)) { |
327 | if (try_module_get(s->callback->owner)) { | 327 | if (try_module_get(s->callback->owner)) { |
328 | s->callback->requery(s); | 328 | s->callback->requery(s, 1); |
329 | module_put(s->callback->owner); | 329 | module_put(s->callback->owner); |
330 | } | 330 | } |
331 | } | 331 | } |
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index ee449b29fc82..aad362ba02e0 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c | |||
@@ -154,16 +154,11 @@ static int aha152x_config_cs(struct pcmcia_device *link) | |||
154 | 154 | ||
155 | DEBUG(0, "aha152x_config(0x%p)\n", link); | 155 | DEBUG(0, "aha152x_config(0x%p)\n", link); |
156 | 156 | ||
157 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
158 | tuple.TupleData = tuple_data; | 157 | tuple.TupleData = tuple_data; |
159 | tuple.TupleDataMax = 64; | 158 | tuple.TupleDataMax = 64; |
160 | tuple.TupleOffset = 0; | 159 | tuple.TupleOffset = 0; |
161 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
162 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
163 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
164 | link->conf.ConfigBase = parse.config.base; | ||
165 | |||
166 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 160 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
161 | tuple.Attributes = 0; | ||
167 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 162 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
168 | while (1) { | 163 | while (1) { |
169 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || | 164 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || |
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index 85f7ffac19a0..a1c5f265069f 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c | |||
@@ -136,14 +136,9 @@ static int fdomain_config(struct pcmcia_device *link) | |||
136 | 136 | ||
137 | DEBUG(0, "fdomain_config(0x%p)\n", link); | 137 | DEBUG(0, "fdomain_config(0x%p)\n", link); |
138 | 138 | ||
139 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
140 | tuple.TupleData = tuple_data; | 139 | tuple.TupleData = tuple_data; |
141 | tuple.TupleDataMax = 64; | 140 | tuple.TupleDataMax = 64; |
142 | tuple.TupleOffset = 0; | 141 | tuple.TupleOffset = 0; |
143 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
144 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
145 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
146 | link->conf.ConfigBase = parse.config.base; | ||
147 | 142 | ||
148 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 143 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
149 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 144 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index f2d79c3f0b8e..d72df5dae4ee 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -1685,16 +1685,10 @@ static int nsp_cs_config(struct pcmcia_device *link) | |||
1685 | 1685 | ||
1686 | nsp_dbg(NSP_DEBUG_INIT, "in"); | 1686 | nsp_dbg(NSP_DEBUG_INIT, "in"); |
1687 | 1687 | ||
1688 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
1689 | tuple.Attributes = 0; | 1688 | tuple.Attributes = 0; |
1690 | tuple.TupleData = tuple_data; | 1689 | tuple.TupleData = tuple_data; |
1691 | tuple.TupleDataMax = sizeof(tuple_data); | 1690 | tuple.TupleDataMax = sizeof(tuple_data); |
1692 | tuple.TupleOffset = 0; | 1691 | tuple.TupleOffset = 0; |
1693 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
1694 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
1695 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
1696 | link->conf.ConfigBase = parse.config.base; | ||
1697 | link->conf.Present = parse.config.rmask[0]; | ||
1698 | 1692 | ||
1699 | /* Look up the current Vcc */ | 1693 | /* Look up the current Vcc */ |
1700 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf)); | 1694 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf)); |
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index 86c2ac6ae623..9d431fe7f47f 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c | |||
@@ -208,18 +208,11 @@ static int qlogic_config(struct pcmcia_device * link) | |||
208 | 208 | ||
209 | DEBUG(0, "qlogic_config(0x%p)\n", link); | 209 | DEBUG(0, "qlogic_config(0x%p)\n", link); |
210 | 210 | ||
211 | info->manf_id = link->manf_id; | ||
212 | |||
211 | tuple.TupleData = (cisdata_t *) tuple_data; | 213 | tuple.TupleData = (cisdata_t *) tuple_data; |
212 | tuple.TupleDataMax = 64; | 214 | tuple.TupleDataMax = 64; |
213 | tuple.TupleOffset = 0; | 215 | tuple.TupleOffset = 0; |
214 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
215 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
216 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
217 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
218 | link->conf.ConfigBase = parse.config.base; | ||
219 | |||
220 | tuple.DesiredTuple = CISTPL_MANFID; | ||
221 | if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) | ||
222 | info->manf_id = le16_to_cpu(tuple.TupleData[0]); | ||
223 | 216 | ||
224 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 217 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
225 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 218 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 72fe5d055de1..fb7acea60286 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c | |||
@@ -722,19 +722,11 @@ SYM53C500_config(struct pcmcia_device *link) | |||
722 | 722 | ||
723 | DEBUG(0, "SYM53C500_config(0x%p)\n", link); | 723 | DEBUG(0, "SYM53C500_config(0x%p)\n", link); |
724 | 724 | ||
725 | info->manf_id = link->manf_id; | ||
726 | |||
725 | tuple.TupleData = (cisdata_t *)tuple_data; | 727 | tuple.TupleData = (cisdata_t *)tuple_data; |
726 | tuple.TupleDataMax = 64; | 728 | tuple.TupleDataMax = 64; |
727 | tuple.TupleOffset = 0; | 729 | tuple.TupleOffset = 0; |
728 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
729 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
730 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
731 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
732 | link->conf.ConfigBase = parse.config.base; | ||
733 | |||
734 | tuple.DesiredTuple = CISTPL_MANFID; | ||
735 | if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && | ||
736 | (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) | ||
737 | info->manf_id = le16_to_cpu(tuple.TupleData[0]); | ||
738 | 730 | ||
739 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 731 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
740 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 732 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 00f9ffd69489..431433f4dd6d 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -723,7 +723,7 @@ static int serial_config(struct pcmcia_device * link) | |||
723 | u_char *buf; | 723 | u_char *buf; |
724 | cisparse_t *parse; | 724 | cisparse_t *parse; |
725 | cistpl_cftable_entry_t *cf; | 725 | cistpl_cftable_entry_t *cf; |
726 | int i, last_ret, last_fn; | 726 | int i; |
727 | 727 | ||
728 | DEBUG(0, "serial_config(0x%p)\n", link); | 728 | DEBUG(0, "serial_config(0x%p)\n", link); |
729 | 729 | ||
@@ -740,15 +740,6 @@ static int serial_config(struct pcmcia_device * link) | |||
740 | tuple->TupleOffset = 0; | 740 | tuple->TupleOffset = 0; |
741 | tuple->TupleDataMax = 255; | 741 | tuple->TupleDataMax = 255; |
742 | tuple->Attributes = 0; | 742 | tuple->Attributes = 0; |
743 | /* Get configuration register information */ | ||
744 | tuple->DesiredTuple = CISTPL_CONFIG; | ||
745 | last_ret = first_tuple(link, tuple, parse); | ||
746 | if (last_ret != CS_SUCCESS) { | ||
747 | last_fn = ParseTuple; | ||
748 | goto cs_failed; | ||
749 | } | ||
750 | link->conf.ConfigBase = parse->config.base; | ||
751 | link->conf.Present = parse->config.rmask[0]; | ||
752 | 743 | ||
753 | /* Is this a compliant multifunction card? */ | 744 | /* Is this a compliant multifunction card? */ |
754 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; | 745 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; |
@@ -757,27 +748,25 @@ static int serial_config(struct pcmcia_device * link) | |||
757 | 748 | ||
758 | /* Is this a multiport card? */ | 749 | /* Is this a multiport card? */ |
759 | tuple->DesiredTuple = CISTPL_MANFID; | 750 | tuple->DesiredTuple = CISTPL_MANFID; |
760 | if (first_tuple(link, tuple, parse) == CS_SUCCESS) { | 751 | info->manfid = link->manf_id; |
761 | info->manfid = parse->manfid.manf; | 752 | info->prodid = link->card_id; |
762 | info->prodid = parse->manfid.card; | 753 | |
763 | 754 | for (i = 0; i < ARRAY_SIZE(quirks); i++) | |
764 | for (i = 0; i < ARRAY_SIZE(quirks); i++) | 755 | if ((quirks[i].manfid == ~0 || |
765 | if ((quirks[i].manfid == ~0 || | 756 | quirks[i].manfid == info->manfid) && |
766 | quirks[i].manfid == info->manfid) && | 757 | (quirks[i].prodid == ~0 || |
767 | (quirks[i].prodid == ~0 || | 758 | quirks[i].prodid == info->prodid)) { |
768 | quirks[i].prodid == info->prodid)) { | 759 | info->quirk = &quirks[i]; |
769 | info->quirk = &quirks[i]; | 760 | break; |
770 | break; | 761 | } |
771 | } | ||
772 | } | ||
773 | 762 | ||
774 | /* Another check for dual-serial cards: look for either serial or | 763 | /* Another check for dual-serial cards: look for either serial or |
775 | multifunction cards that ask for appropriate IO port ranges */ | 764 | multifunction cards that ask for appropriate IO port ranges */ |
776 | tuple->DesiredTuple = CISTPL_FUNCID; | 765 | tuple->DesiredTuple = CISTPL_FUNCID; |
777 | if ((info->multi == 0) && | 766 | if ((info->multi == 0) && |
778 | ((first_tuple(link, tuple, parse) != CS_SUCCESS) || | 767 | (link->has_func_id) && |
779 | (parse->funcid.func == CISTPL_FUNCID_MULTI) || | 768 | ((link->func_id == CISTPL_FUNCID_MULTI) || |
780 | (parse->funcid.func == CISTPL_FUNCID_SERIAL))) { | 769 | (link->func_id == CISTPL_FUNCID_SERIAL))) { |
781 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; | 770 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; |
782 | if (first_tuple(link, tuple, parse) == CS_SUCCESS) { | 771 | if (first_tuple(link, tuple, parse) == CS_SUCCESS) { |
783 | if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) | 772 | if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) |
@@ -814,8 +803,6 @@ static int serial_config(struct pcmcia_device * link) | |||
814 | kfree(cfg_mem); | 803 | kfree(cfg_mem); |
815 | return 0; | 804 | return 0; |
816 | 805 | ||
817 | cs_failed: | ||
818 | cs_error(link, last_fn, last_ret); | ||
819 | failed: | 806 | failed: |
820 | serial_remove(link); | 807 | serial_remove(link); |
821 | kfree(cfg_mem); | 808 | kfree(cfg_mem); |
@@ -925,6 +912,30 @@ static struct pcmcia_device_id serial_ids[] = { | |||
925 | PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "COMpad2.cis"), | 912 | PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "COMpad2.cis"), |
926 | PCMCIA_DEVICE_CIS_PROD_ID2("RS-COM 2P", 0xad20b156, "RS-COM-2P.cis"), | 913 | PCMCIA_DEVICE_CIS_PROD_ID2("RS-COM 2P", 0xad20b156, "RS-COM-2P.cis"), |
927 | PCMCIA_DEVICE_CIS_MANF_CARD(0x0013, 0x0000, "GLOBETROTTER.cis"), | 914 | PCMCIA_DEVICE_CIS_MANF_CARD(0x0013, 0x0000, "GLOBETROTTER.cis"), |
915 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL100 1.00.",0x19ca78af,0xf964f42b), | ||
916 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL100",0x19ca78af,0x71d98e83), | ||
917 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL232 1.00.",0x19ca78af,0x69fb7490), | ||
918 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL232",0x19ca78af,0xb6bc0235), | ||
919 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c2000.","SERIAL CARD: CF232",0x63f2e0bd,0xb9e175d3), | ||
920 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c2000.","SERIAL CARD: CF232-5",0x63f2e0bd,0xfce33442), | ||
921 | PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: CF232",0x3beb8cf2,0x171e7190), | ||
922 | PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: CF232-5",0x3beb8cf2,0x20da4262), | ||
923 | PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: CF428",0x3beb8cf2,0xea5dd57d), | ||
924 | PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: CF500",0x3beb8cf2,0xd77255fa), | ||
925 | PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: IC232",0x3beb8cf2,0x6a709903), | ||
926 | PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: SL232",0x3beb8cf2,0x18430676), | ||
927 | PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: XL232",0x3beb8cf2,0x6f933767), | ||
928 | PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial Port: CF332",0x3beb8cf2,0x16dc1ba7), | ||
929 | PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial Port: SL332",0x3beb8cf2,0x19816c41), | ||
930 | PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial Port: SL385",0x3beb8cf2,0x64112029), | ||
931 | PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4), | ||
932 | PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial+Parallel Port: SP230",0x3beb8cf2,0xdb9e58bc), | ||
933 | PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial Port: CF332",0x3beb8cf2,0x16dc1ba7), | ||
934 | PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial Port: SL332",0x3beb8cf2,0x19816c41), | ||
935 | PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial Port: SL385",0x3beb8cf2,0x64112029), | ||
936 | PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4), | ||
937 | PCMCIA_MFC_DEVICE_PROD_ID12(2,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4), | ||
938 | PCMCIA_MFC_DEVICE_PROD_ID12(3,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4), | ||
928 | /* too generic */ | 939 | /* too generic */ |
929 | /* PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0160, 0x0002), */ | 940 | /* PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0160, 0x0002), */ |
930 | /* PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0160, 0x0002), */ | 941 | /* PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0160, 0x0002), */ |
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index dda0ca45d904..164a5dcf1f1e 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c | |||
@@ -69,25 +69,21 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
69 | 69 | ||
70 | static void ixj_get_serial(struct pcmcia_device * link, IXJ * j) | 70 | static void ixj_get_serial(struct pcmcia_device * link, IXJ * j) |
71 | { | 71 | { |
72 | tuple_t tuple; | ||
73 | u_short buf[128]; | ||
74 | char *str; | 72 | char *str; |
75 | int last_ret, last_fn, i, place; | 73 | int i, place; |
76 | DEBUG(0, "ixj_get_serial(0x%p)\n", link); | 74 | DEBUG(0, "ixj_get_serial(0x%p)\n", link); |
77 | tuple.TupleData = (cisdata_t *) buf; | 75 | |
78 | tuple.TupleOffset = 0; | 76 | str = link->prod_id[0]; |
79 | tuple.TupleDataMax = 80; | 77 | if (!str) |
80 | tuple.Attributes = 0; | 78 | goto cs_failed; |
81 | tuple.DesiredTuple = CISTPL_VERS_1; | ||
82 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
83 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
84 | str = (char *) buf; | ||
85 | printk("PCMCIA Version %d.%d\n", str[0], str[1]); | ||
86 | str += 2; | ||
87 | printk("%s", str); | 79 | printk("%s", str); |
88 | str = str + strlen(str) + 1; | 80 | str = link->prod_id[1]; |
81 | if (!str) | ||
82 | goto cs_failed; | ||
89 | printk(" %s", str); | 83 | printk(" %s", str); |
90 | str = str + strlen(str) + 1; | 84 | str = link->prod_id[2]; |
85 | if (!str) | ||
86 | goto cs_failed; | ||
91 | place = 1; | 87 | place = 1; |
92 | for (i = strlen(str) - 1; i >= 0; i--) { | 88 | for (i = strlen(str) - 1; i >= 0; i--) { |
93 | switch (str[i]) { | 89 | switch (str[i]) { |
@@ -122,7 +118,9 @@ static void ixj_get_serial(struct pcmcia_device * link, IXJ * j) | |||
122 | } | 118 | } |
123 | place = place * 0x10; | 119 | place = place * 0x10; |
124 | } | 120 | } |
125 | str = str + strlen(str) + 1; | 121 | str = link->prod_id[3]; |
122 | if (!str) | ||
123 | goto cs_failed; | ||
126 | printk(" version %s\n", str); | 124 | printk(" version %s\n", str); |
127 | cs_failed: | 125 | cs_failed: |
128 | return; | 126 | return; |
@@ -146,13 +144,6 @@ static int ixj_config(struct pcmcia_device * link) | |||
146 | tuple.TupleData = (cisdata_t *) buf; | 144 | tuple.TupleData = (cisdata_t *) buf; |
147 | tuple.TupleOffset = 0; | 145 | tuple.TupleOffset = 0; |
148 | tuple.TupleDataMax = 255; | 146 | tuple.TupleDataMax = 255; |
149 | tuple.Attributes = 0; | ||
150 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
151 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
152 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
153 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
154 | link->conf.ConfigBase = parse.config.base; | ||
155 | link->conf.Present = parse.config.rmask[0]; | ||
156 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 147 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
157 | tuple.Attributes = 0; | 148 | tuple.Attributes = 0; |
158 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 149 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 54f554e0f0ad..ac9f11d19817 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c | |||
@@ -169,21 +169,14 @@ static int sl811_cs_config(struct pcmcia_device *link) | |||
169 | 169 | ||
170 | DBG(0, "sl811_cs_config(0x%p)\n", link); | 170 | DBG(0, "sl811_cs_config(0x%p)\n", link); |
171 | 171 | ||
172 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
173 | tuple.Attributes = 0; | ||
174 | tuple.TupleData = buf; | ||
175 | tuple.TupleDataMax = sizeof(buf); | ||
176 | tuple.TupleOffset = 0; | ||
177 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
178 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
179 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | ||
180 | link->conf.ConfigBase = parse.config.base; | ||
181 | link->conf.Present = parse.config.rmask[0]; | ||
182 | |||
183 | /* Look up the current Vcc */ | 172 | /* Look up the current Vcc */ |
184 | CS_CHECK(GetConfigurationInfo, | 173 | CS_CHECK(GetConfigurationInfo, |
185 | pcmcia_get_configuration_info(link, &conf)); | 174 | pcmcia_get_configuration_info(link, &conf)); |
186 | 175 | ||
176 | tuple.Attributes = 0; | ||
177 | tuple.TupleData = buf; | ||
178 | tuple.TupleDataMax = sizeof(buf); | ||
179 | tuple.TupleOffset = 0; | ||
187 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 180 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
188 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 181 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
189 | while (1) { | 182 | while (1) { |