aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-12 18:03:35 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-12 18:03:35 -0400
commit42f04b6d4c8c69ccffc10863418c5b5f100a8554 (patch)
tree5c5ee032aa5a88f212fcd2a7c1a5cbccc858cb3b
parent71a380d668189778416d37cde5521575a45c5a17 (diff)
parent4b5a9b3d8e857249f2670f4419ce764be02e11db (diff)
Merge branch 'isdn-cleanups' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/misc-2.6
* 'isdn-cleanups' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/misc-2.6: [ISDN] HiSax diva: split setup into three smaller functions [ISDN] HiSax sedlbauer: move ISAPNP and PCI code into functions of their own [ISDN] HiSax elsa: split huge setup function into four smaller functions [ISDN] HiSax avm_pci: split setup into three smaller functions [ISDN] Remove CONFIG_PCI ifdefs from 100% PCI source code
-rw-r--r--drivers/isdn/hisax/avm_pci.c224
-rw-r--r--drivers/isdn/hisax/bkm_a8.c8
-rw-r--r--drivers/isdn/hisax/diva.c513
-rw-r--r--drivers/isdn/hisax/elsa.c494
-rw-r--r--drivers/isdn/hisax/sedlbauer.c276
-rw-r--r--drivers/isdn/hisax/telespci.c8
-rw-r--r--drivers/isdn/hisax/w6692.c7
7 files changed, 868 insertions, 662 deletions
diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c
index b04a178e5021..f8b79783c8b3 100644
--- a/drivers/isdn/hisax/avm_pci.c
+++ b/drivers/isdn/hisax/avm_pci.c
@@ -20,7 +20,6 @@
20#include <linux/isapnp.h> 20#include <linux/isapnp.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22 22
23extern const char *CardType[];
24static const char *avm_pci_rev = "$Revision: 1.29.2.4 $"; 23static const char *avm_pci_rev = "$Revision: 1.29.2.4 $";
25 24
26#define AVM_FRITZ_PCI 1 25#define AVM_FRITZ_PCI 1
@@ -726,100 +725,15 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
726 return(0); 725 return(0);
727} 726}
728 727
729#ifdef CONFIG_PCI 728static int __devinit avm_setup_rest(struct IsdnCardState *cs)
730static struct pci_dev *dev_avm __devinitdata = NULL;
731#endif
732#ifdef __ISAPNP__
733static struct pnp_card *pnp_avm_c __devinitdata = NULL;
734#endif
735
736int __devinit
737setup_avm_pcipnp(struct IsdnCard *card)
738{ 729{
739 u_int val, ver; 730 u_int val, ver;
740 struct IsdnCardState *cs = card->cs;
741 char tmp[64];
742 731
743 strcpy(tmp, avm_pci_rev);
744 printk(KERN_INFO "HiSax: AVM PCI driver Rev. %s\n", HiSax_getrev(tmp));
745 if (cs->typ != ISDN_CTYPE_FRITZPCI)
746 return (0);
747 if (card->para[1]) {
748 /* old manual method */
749 cs->hw.avm.cfg_reg = card->para[1];
750 cs->irq = card->para[0];
751 cs->subtyp = AVM_FRITZ_PNP;
752 goto ready;
753 }
754#ifdef __ISAPNP__
755 if (isapnp_present()) {
756 struct pnp_dev *pnp_avm_d = NULL;
757 if ((pnp_avm_c = pnp_find_card(
758 ISAPNP_VENDOR('A', 'V', 'M'),
759 ISAPNP_FUNCTION(0x0900), pnp_avm_c))) {
760 if ((pnp_avm_d = pnp_find_dev(pnp_avm_c,
761 ISAPNP_VENDOR('A', 'V', 'M'),
762 ISAPNP_FUNCTION(0x0900), pnp_avm_d))) {
763 int err;
764
765 pnp_disable_dev(pnp_avm_d);
766 err = pnp_activate_dev(pnp_avm_d);
767 if (err<0) {
768 printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
769 __FUNCTION__, err);
770 return(0);
771 }
772 cs->hw.avm.cfg_reg =
773 pnp_port_start(pnp_avm_d, 0);
774 cs->irq = pnp_irq(pnp_avm_d, 0);
775 if (!cs->irq) {
776 printk(KERN_ERR "FritzPnP:No IRQ\n");
777 return(0);
778 }
779 if (!cs->hw.avm.cfg_reg) {
780 printk(KERN_ERR "FritzPnP:No IO address\n");
781 return(0);
782 }
783 cs->subtyp = AVM_FRITZ_PNP;
784 goto ready;
785 }
786 }
787 } else {
788 printk(KERN_INFO "FritzPnP: no ISA PnP present\n");
789 }
790#endif
791#ifdef CONFIG_PCI
792 if ((dev_avm = pci_find_device(PCI_VENDOR_ID_AVM,
793 PCI_DEVICE_ID_AVM_A1, dev_avm))) {
794 if (pci_enable_device(dev_avm))
795 return(0);
796 cs->irq = dev_avm->irq;
797 if (!cs->irq) {
798 printk(KERN_ERR "FritzPCI: No IRQ for PCI card found\n");
799 return(0);
800 }
801 cs->hw.avm.cfg_reg = pci_resource_start(dev_avm, 1);
802 if (!cs->hw.avm.cfg_reg) {
803 printk(KERN_ERR "FritzPCI: No IO-Adr for PCI card found\n");
804 return(0);
805 }
806 cs->subtyp = AVM_FRITZ_PCI;
807 } else {
808 printk(KERN_WARNING "FritzPCI: No PCI card found\n");
809 return(0);
810 }
811 cs->irq_flags |= IRQF_SHARED;
812#else
813 printk(KERN_WARNING "FritzPCI: NO_PCI_BIOS\n");
814 return (0);
815#endif /* CONFIG_PCI */
816ready:
817 cs->hw.avm.isac = cs->hw.avm.cfg_reg + 0x10; 732 cs->hw.avm.isac = cs->hw.avm.cfg_reg + 0x10;
818 if (!request_region(cs->hw.avm.cfg_reg, 32, 733 if (!request_region(cs->hw.avm.cfg_reg, 32,
819 (cs->subtyp == AVM_FRITZ_PCI) ? "avm PCI" : "avm PnP")) { 734 (cs->subtyp == AVM_FRITZ_PCI) ? "avm PCI" : "avm PnP")) {
820 printk(KERN_WARNING 735 printk(KERN_WARNING
821 "HiSax: %s config port %x-%x already in use\n", 736 "HiSax: Fritz!PCI/PNP config port %x-%x already in use\n",
822 CardType[card->typ],
823 cs->hw.avm.cfg_reg, 737 cs->hw.avm.cfg_reg,
824 cs->hw.avm.cfg_reg + 31); 738 cs->hw.avm.cfg_reg + 31);
825 return (0); 739 return (0);
@@ -860,3 +774,137 @@ ready:
860 ISACVersion(cs, (cs->subtyp == AVM_FRITZ_PCI) ? "AVM PCI:" : "AVM PnP:"); 774 ISACVersion(cs, (cs->subtyp == AVM_FRITZ_PCI) ? "AVM PCI:" : "AVM PnP:");
861 return (1); 775 return (1);
862} 776}
777
778#ifndef __ISAPNP__
779
780static int __devinit avm_pnp_setup(struct IsdnCardState *cs)
781{
782 return(1); /* no-op: success */
783}
784
785#else
786
787static struct pnp_card *pnp_avm_c __devinitdata = NULL;
788
789static int __devinit avm_pnp_setup(struct IsdnCardState *cs)
790{
791 struct pnp_dev *pnp_avm_d = NULL;
792
793 if (!isapnp_present())
794 return(1); /* no-op: success */
795
796 if ((pnp_avm_c = pnp_find_card(
797 ISAPNP_VENDOR('A', 'V', 'M'),
798 ISAPNP_FUNCTION(0x0900), pnp_avm_c))) {
799 if ((pnp_avm_d = pnp_find_dev(pnp_avm_c,
800 ISAPNP_VENDOR('A', 'V', 'M'),
801 ISAPNP_FUNCTION(0x0900), pnp_avm_d))) {
802 int err;
803
804 pnp_disable_dev(pnp_avm_d);
805 err = pnp_activate_dev(pnp_avm_d);
806 if (err<0) {
807 printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
808 __FUNCTION__, err);
809 return(0);
810 }
811 cs->hw.avm.cfg_reg =
812 pnp_port_start(pnp_avm_d, 0);
813 cs->irq = pnp_irq(pnp_avm_d, 0);
814 if (!cs->irq) {
815 printk(KERN_ERR "FritzPnP:No IRQ\n");
816 return(0);
817 }
818 if (!cs->hw.avm.cfg_reg) {
819 printk(KERN_ERR "FritzPnP:No IO address\n");
820 return(0);
821 }
822 cs->subtyp = AVM_FRITZ_PNP;
823
824 return (2); /* goto 'ready' label */
825 }
826 }
827
828 return (1);
829}
830
831#endif /* __ISAPNP__ */
832
833#ifndef CONFIG_PCI
834
835static int __devinit avm_pci_setup(struct IsdnCardState *cs)
836{
837 return(1); /* no-op: success */
838}
839
840#else
841
842static struct pci_dev *dev_avm __devinitdata = NULL;
843
844static int __devinit avm_pci_setup(struct IsdnCardState *cs)
845{
846 if ((dev_avm = pci_find_device(PCI_VENDOR_ID_AVM,
847 PCI_DEVICE_ID_AVM_A1, dev_avm))) {
848
849 if (pci_enable_device(dev_avm))
850 return(0);
851
852 cs->irq = dev_avm->irq;
853 if (!cs->irq) {
854 printk(KERN_ERR "FritzPCI: No IRQ for PCI card found\n");
855 return(0);
856 }
857
858 cs->hw.avm.cfg_reg = pci_resource_start(dev_avm, 1);
859 if (!cs->hw.avm.cfg_reg) {
860 printk(KERN_ERR "FritzPCI: No IO-Adr for PCI card found\n");
861 return(0);
862 }
863
864 cs->subtyp = AVM_FRITZ_PCI;
865 } else {
866 printk(KERN_WARNING "FritzPCI: No PCI card found\n");
867 return(0);
868 }
869
870 cs->irq_flags |= IRQF_SHARED;
871
872 return (1);
873}
874
875#endif /* CONFIG_PCI */
876
877int __devinit
878setup_avm_pcipnp(struct IsdnCard *card)
879{
880 struct IsdnCardState *cs = card->cs;
881 char tmp[64];
882 int rc;
883
884 strcpy(tmp, avm_pci_rev);
885 printk(KERN_INFO "HiSax: AVM PCI driver Rev. %s\n", HiSax_getrev(tmp));
886
887 if (cs->typ != ISDN_CTYPE_FRITZPCI)
888 return (0);
889
890 if (card->para[1]) {
891 /* old manual method */
892 cs->hw.avm.cfg_reg = card->para[1];
893 cs->irq = card->para[0];
894 cs->subtyp = AVM_FRITZ_PNP;
895 goto ready;
896 }
897
898 rc = avm_pnp_setup(cs);
899 if (rc < 1)
900 return (0);
901 if (rc == 2)
902 goto ready;
903
904 rc = avm_pci_setup(cs);
905 if (rc < 1)
906 return (0);
907
908ready:
909 return avm_setup_rest(cs);
910}
diff --git a/drivers/isdn/hisax/bkm_a8.c b/drivers/isdn/hisax/bkm_a8.c
index 6339bb443f62..99ef3b43fcd7 100644
--- a/drivers/isdn/hisax/bkm_a8.c
+++ b/drivers/isdn/hisax/bkm_a8.c
@@ -20,8 +20,6 @@
20#include <linux/pci.h> 20#include <linux/pci.h>
21#include "bkm_ax.h" 21#include "bkm_ax.h"
22 22
23#ifdef CONFIG_PCI
24
25#define ATTEMPT_PCI_REMAPPING /* Required for PLX rev 1 */ 23#define ATTEMPT_PCI_REMAPPING /* Required for PLX rev 1 */
26 24
27extern const char *CardType[]; 25extern const char *CardType[];
@@ -279,12 +277,9 @@ static u_char pci_bus __devinitdata = 0;
279static u_char pci_device_fn __devinitdata = 0; 277static u_char pci_device_fn __devinitdata = 0;
280static u_char pci_irq __devinitdata = 0; 278static u_char pci_irq __devinitdata = 0;
281 279
282#endif /* CONFIG_PCI */
283
284int __devinit 280int __devinit
285setup_sct_quadro(struct IsdnCard *card) 281setup_sct_quadro(struct IsdnCard *card)
286{ 282{
287#ifdef CONFIG_PCI
288 struct IsdnCardState *cs = card->cs; 283 struct IsdnCardState *cs = card->cs;
289 char tmp[64]; 284 char tmp[64];
290 u_int found = 0; 285 u_int found = 0;
@@ -442,7 +437,4 @@ setup_sct_quadro(struct IsdnCard *card)
442 sct_quadro_subtypes[cs->subtyp], 437 sct_quadro_subtypes[cs->subtyp],
443 readreg(cs->hw.ax.base, cs->hw.ax.data_adr, IPAC_ID)); 438 readreg(cs->hw.ax.base, cs->hw.ax.data_adr, IPAC_ID));
444 return (1); 439 return (1);
445#else
446 printk(KERN_ERR "HiSax: bkm_a8 only supported on PCI Systems\n");
447#endif /* CONFIG_PCI */
448} 440}
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c
index 6eebeb441bfd..826745078746 100644
--- a/drivers/isdn/hisax/diva.c
+++ b/drivers/isdn/hisax/diva.c
@@ -25,8 +25,6 @@
25#include <linux/pci.h> 25#include <linux/pci.h>
26#include <linux/isapnp.h> 26#include <linux/isapnp.h>
27 27
28extern const char *CardType[];
29
30static const char *Diva_revision = "$Revision: 1.33.2.6 $"; 28static const char *Diva_revision = "$Revision: 1.33.2.6 $";
31 29
32#define byteout(addr,val) outb(val,addr) 30#define byteout(addr,val) outb(val,addr)
@@ -906,225 +904,15 @@ Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg)
906 return(0); 904 return(0);
907} 905}
908 906
909static struct pci_dev *dev_diva __devinitdata = NULL; 907static int __devinit setup_diva_common(struct IsdnCardState *cs)
910static struct pci_dev *dev_diva_u __devinitdata = NULL;
911static struct pci_dev *dev_diva201 __devinitdata = NULL;
912static struct pci_dev *dev_diva202 __devinitdata = NULL;
913
914#ifdef __ISAPNP__
915static struct isapnp_device_id diva_ids[] __devinitdata = {
916 { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
917 ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
918 (unsigned long) "Diva picola" },
919 { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
920 ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0x51),
921 (unsigned long) "Diva picola" },
922 { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71),
923 ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71),
924 (unsigned long) "Diva 2.0" },
925 { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71),
926 ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0x71),
927 (unsigned long) "Diva 2.0" },
928 { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1),
929 ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1),
930 (unsigned long) "Diva 2.01" },
931 { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1),
932 ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0xA1),
933 (unsigned long) "Diva 2.01" },
934 { 0, }
935};
936
937static struct isapnp_device_id *ipid __devinitdata = &diva_ids[0];
938static struct pnp_card *pnp_c __devinitdata = NULL;
939#endif
940
941
942int __devinit
943setup_diva(struct IsdnCard *card)
944{ 908{
945 int bytecnt = 8; 909 int bytecnt;
946 u_char val; 910 u_char val;
947 struct IsdnCardState *cs = card->cs;
948 char tmp[64];
949
950 strcpy(tmp, Diva_revision);
951 printk(KERN_INFO "HiSax: Eicon.Diehl Diva driver Rev. %s\n", HiSax_getrev(tmp));
952 if (cs->typ != ISDN_CTYPE_DIEHLDIVA)
953 return(0);
954 cs->hw.diva.status = 0;
955 if (card->para[1]) {
956 cs->hw.diva.ctrl_reg = 0;
957 cs->hw.diva.cfg_reg = card->para[1];
958 val = readreg(cs->hw.diva.cfg_reg + DIVA_IPAC_ADR,
959 cs->hw.diva.cfg_reg + DIVA_IPAC_DATA, IPAC_ID);
960 printk(KERN_INFO "Diva: IPAC version %x\n", val);
961 if ((val == 1) || (val==2)) {
962 cs->subtyp = DIVA_IPAC_ISA;
963 cs->hw.diva.ctrl = 0;
964 cs->hw.diva.isac = card->para[1] + DIVA_IPAC_DATA;
965 cs->hw.diva.hscx = card->para[1] + DIVA_IPAC_DATA;
966 cs->hw.diva.isac_adr = card->para[1] + DIVA_IPAC_ADR;
967 cs->hw.diva.hscx_adr = card->para[1] + DIVA_IPAC_ADR;
968 test_and_set_bit(HW_IPAC, &cs->HW_Flags);
969 } else {
970 cs->subtyp = DIVA_ISA;
971 cs->hw.diva.ctrl = card->para[1] + DIVA_ISA_CTRL;
972 cs->hw.diva.isac = card->para[1] + DIVA_ISA_ISAC_DATA;
973 cs->hw.diva.hscx = card->para[1] + DIVA_HSCX_DATA;
974 cs->hw.diva.isac_adr = card->para[1] + DIVA_ISA_ISAC_ADR;
975 cs->hw.diva.hscx_adr = card->para[1] + DIVA_HSCX_ADR;
976 }
977 cs->irq = card->para[0];
978 } else {
979#ifdef __ISAPNP__
980 if (isapnp_present()) {
981 struct pnp_dev *pnp_d;
982 while(ipid->card_vendor) {
983 if ((pnp_c = pnp_find_card(ipid->card_vendor,
984 ipid->card_device, pnp_c))) {
985 pnp_d = NULL;
986 if ((pnp_d = pnp_find_dev(pnp_c,
987 ipid->vendor, ipid->function, pnp_d))) {
988 int err;
989
990 printk(KERN_INFO "HiSax: %s detected\n",
991 (char *)ipid->driver_data);
992 pnp_disable_dev(pnp_d);
993 err = pnp_activate_dev(pnp_d);
994 if (err<0) {
995 printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
996 __FUNCTION__, err);
997 return(0);
998 }
999 card->para[1] = pnp_port_start(pnp_d, 0);
1000 card->para[0] = pnp_irq(pnp_d, 0);
1001 if (!card->para[0] || !card->para[1]) {
1002 printk(KERN_ERR "Diva PnP:some resources are missing %ld/%lx\n",
1003 card->para[0], card->para[1]);
1004 pnp_disable_dev(pnp_d);
1005 return(0);
1006 }
1007 cs->hw.diva.cfg_reg = card->para[1];
1008 cs->irq = card->para[0];
1009 if (ipid->function == ISAPNP_FUNCTION(0xA1)) {
1010 cs->subtyp = DIVA_IPAC_ISA;
1011 cs->hw.diva.ctrl = 0;
1012 cs->hw.diva.isac =
1013 card->para[1] + DIVA_IPAC_DATA;
1014 cs->hw.diva.hscx =
1015 card->para[1] + DIVA_IPAC_DATA;
1016 cs->hw.diva.isac_adr =
1017 card->para[1] + DIVA_IPAC_ADR;
1018 cs->hw.diva.hscx_adr =
1019 card->para[1] + DIVA_IPAC_ADR;
1020 test_and_set_bit(HW_IPAC, &cs->HW_Flags);
1021 } else {
1022 cs->subtyp = DIVA_ISA;
1023 cs->hw.diva.ctrl =
1024 card->para[1] + DIVA_ISA_CTRL;
1025 cs->hw.diva.isac =
1026 card->para[1] + DIVA_ISA_ISAC_DATA;
1027 cs->hw.diva.hscx =
1028 card->para[1] + DIVA_HSCX_DATA;
1029 cs->hw.diva.isac_adr =
1030 card->para[1] + DIVA_ISA_ISAC_ADR;
1031 cs->hw.diva.hscx_adr =
1032 card->para[1] + DIVA_HSCX_ADR;
1033 }
1034 goto ready;
1035 } else {
1036 printk(KERN_ERR "Diva PnP: PnP error card found, no device\n");
1037 return(0);
1038 }
1039 }
1040 ipid++;
1041 pnp_c=NULL;
1042 }
1043 if (!ipid->card_vendor) {
1044 printk(KERN_INFO "Diva PnP: no ISAPnP card found\n");
1045 }
1046 }
1047#endif
1048#ifdef CONFIG_PCI
1049 cs->subtyp = 0;
1050 if ((dev_diva = pci_find_device(PCI_VENDOR_ID_EICON,
1051 PCI_DEVICE_ID_EICON_DIVA20, dev_diva))) {
1052 if (pci_enable_device(dev_diva))
1053 return(0);
1054 cs->subtyp = DIVA_PCI;
1055 cs->irq = dev_diva->irq;
1056 cs->hw.diva.cfg_reg = pci_resource_start(dev_diva, 2);
1057 } else if ((dev_diva_u = pci_find_device(PCI_VENDOR_ID_EICON,
1058 PCI_DEVICE_ID_EICON_DIVA20_U, dev_diva_u))) {
1059 if (pci_enable_device(dev_diva_u))
1060 return(0);
1061 cs->subtyp = DIVA_PCI;
1062 cs->irq = dev_diva_u->irq;
1063 cs->hw.diva.cfg_reg = pci_resource_start(dev_diva_u, 2);
1064 } else if ((dev_diva201 = pci_find_device(PCI_VENDOR_ID_EICON,
1065 PCI_DEVICE_ID_EICON_DIVA201, dev_diva201))) {
1066 if (pci_enable_device(dev_diva201))
1067 return(0);
1068 cs->subtyp = DIVA_IPAC_PCI;
1069 cs->irq = dev_diva201->irq;
1070 cs->hw.diva.pci_cfg =
1071 (ulong) ioremap(pci_resource_start(dev_diva201, 0), 4096);
1072 cs->hw.diva.cfg_reg =
1073 (ulong) ioremap(pci_resource_start(dev_diva201, 1), 4096);
1074 } else if ((dev_diva202 = pci_find_device(PCI_VENDOR_ID_EICON,
1075 PCI_DEVICE_ID_EICON_DIVA202, dev_diva202))) {
1076 if (pci_enable_device(dev_diva202))
1077 return(0);
1078 cs->subtyp = DIVA_IPACX_PCI;
1079 cs->irq = dev_diva202->irq;
1080 cs->hw.diva.pci_cfg =
1081 (ulong) ioremap(pci_resource_start(dev_diva202, 0), 4096);
1082 cs->hw.diva.cfg_reg =
1083 (ulong) ioremap(pci_resource_start(dev_diva202, 1), 4096);
1084 } else {
1085 printk(KERN_WARNING "Diva: No PCI card found\n");
1086 return(0);
1087 }
1088
1089 if (!cs->irq) {
1090 printk(KERN_WARNING "Diva: No IRQ for PCI card found\n");
1091 iounmap_diva(cs);
1092 return(0);
1093 }
1094
1095 if (!cs->hw.diva.cfg_reg) {
1096 printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n");
1097 iounmap_diva(cs);
1098 return(0);
1099 }
1100 cs->irq_flags |= IRQF_SHARED;
1101#else
1102 printk(KERN_WARNING "Diva: cfgreg 0 and NO_PCI_BIOS\n");
1103 printk(KERN_WARNING "Diva: unable to config DIVA PCI\n");
1104 return (0);
1105#endif /* CONFIG_PCI */
1106 if ((cs->subtyp == DIVA_IPAC_PCI) ||
1107 (cs->subtyp == DIVA_IPACX_PCI) ) {
1108 cs->hw.diva.ctrl = 0;
1109 cs->hw.diva.isac = 0;
1110 cs->hw.diva.hscx = 0;
1111 cs->hw.diva.isac_adr = 0;
1112 cs->hw.diva.hscx_adr = 0;
1113 test_and_set_bit(HW_IPAC, &cs->HW_Flags);
1114 bytecnt = 0;
1115 } else {
1116 cs->hw.diva.ctrl = cs->hw.diva.cfg_reg + DIVA_PCI_CTRL;
1117 cs->hw.diva.isac = cs->hw.diva.cfg_reg + DIVA_PCI_ISAC_DATA;
1118 cs->hw.diva.hscx = cs->hw.diva.cfg_reg + DIVA_HSCX_DATA;
1119 cs->hw.diva.isac_adr = cs->hw.diva.cfg_reg + DIVA_PCI_ISAC_ADR;
1120 cs->hw.diva.hscx_adr = cs->hw.diva.cfg_reg + DIVA_HSCX_ADR;
1121 bytecnt = 32;
1122 }
1123 }
1124 911
1125#ifdef __ISAPNP__ 912 if ((cs->subtyp == DIVA_ISA) || (cs->subtyp == DIVA_IPAC_ISA))
1126ready: 913 bytecnt = 8;
1127#endif 914 else
915 bytecnt = 32;
1128 916
1129 printk(KERN_INFO 917 printk(KERN_INFO
1130 "Diva: %s card configured at %#lx IRQ %d\n", 918 "Diva: %s card configured at %#lx IRQ %d\n",
@@ -1145,7 +933,7 @@ ready:
1145 if (!request_region(cs->hw.diva.cfg_reg, bytecnt, "diva isdn")) { 933 if (!request_region(cs->hw.diva.cfg_reg, bytecnt, "diva isdn")) {
1146 printk(KERN_WARNING 934 printk(KERN_WARNING
1147 "HiSax: %s config port %lx-%lx already in use\n", 935 "HiSax: %s config port %lx-%lx already in use\n",
1148 CardType[card->typ], 936 "diva",
1149 cs->hw.diva.cfg_reg, 937 cs->hw.diva.cfg_reg,
1150 cs->hw.diva.cfg_reg + bytecnt); 938 cs->hw.diva.cfg_reg + bytecnt);
1151 iounmap_diva(cs); 939 iounmap_diva(cs);
@@ -1206,3 +994,290 @@ ready:
1206 } 994 }
1207 return (1); 995 return (1);
1208} 996}
997
998#ifdef CONFIG_ISA
999
1000static int __devinit setup_diva_isa(struct IsdnCard *card)
1001{
1002 struct IsdnCardState *cs = card->cs;
1003 u_char val;
1004
1005 if (!card->para[1])
1006 return (-1); /* card not found; continue search */
1007
1008 cs->hw.diva.ctrl_reg = 0;
1009 cs->hw.diva.cfg_reg = card->para[1];
1010 val = readreg(cs->hw.diva.cfg_reg + DIVA_IPAC_ADR,
1011 cs->hw.diva.cfg_reg + DIVA_IPAC_DATA, IPAC_ID);
1012 printk(KERN_INFO "Diva: IPAC version %x\n", val);
1013 if ((val == 1) || (val==2)) {
1014 cs->subtyp = DIVA_IPAC_ISA;
1015 cs->hw.diva.ctrl = 0;
1016 cs->hw.diva.isac = card->para[1] + DIVA_IPAC_DATA;
1017 cs->hw.diva.hscx = card->para[1] + DIVA_IPAC_DATA;
1018 cs->hw.diva.isac_adr = card->para[1] + DIVA_IPAC_ADR;
1019 cs->hw.diva.hscx_adr = card->para[1] + DIVA_IPAC_ADR;
1020 test_and_set_bit(HW_IPAC, &cs->HW_Flags);
1021 } else {
1022 cs->subtyp = DIVA_ISA;
1023 cs->hw.diva.ctrl = card->para[1] + DIVA_ISA_CTRL;
1024 cs->hw.diva.isac = card->para[1] + DIVA_ISA_ISAC_DATA;
1025 cs->hw.diva.hscx = card->para[1] + DIVA_HSCX_DATA;
1026 cs->hw.diva.isac_adr = card->para[1] + DIVA_ISA_ISAC_ADR;
1027 cs->hw.diva.hscx_adr = card->para[1] + DIVA_HSCX_ADR;
1028 }
1029 cs->irq = card->para[0];
1030
1031 return (1); /* card found */
1032}
1033
1034#else /* if !CONFIG_ISA */
1035
1036static int __devinit setup_diva_isa(struct IsdnCard *card)
1037{
1038 return (-1); /* card not found; continue search */
1039}
1040
1041#endif /* CONFIG_ISA */
1042
1043#ifdef __ISAPNP__
1044static struct isapnp_device_id diva_ids[] __devinitdata = {
1045 { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
1046 ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
1047 (unsigned long) "Diva picola" },
1048 { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
1049 ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0x51),
1050 (unsigned long) "Diva picola" },
1051 { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71),
1052 ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71),
1053 (unsigned long) "Diva 2.0" },
1054 { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71),
1055 ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0x71),
1056 (unsigned long) "Diva 2.0" },
1057 { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1),
1058 ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1),
1059 (unsigned long) "Diva 2.01" },
1060 { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1),
1061 ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0xA1),
1062 (unsigned long) "Diva 2.01" },
1063 { 0, }
1064};
1065
1066static struct isapnp_device_id *ipid __devinitdata = &diva_ids[0];
1067static struct pnp_card *pnp_c __devinitdata = NULL;
1068
1069static int __devinit setup_diva_isapnp(struct IsdnCard *card)
1070{
1071 struct IsdnCardState *cs = card->cs;
1072 struct pnp_dev *pnp_d;
1073
1074 if (!isapnp_present())
1075 return (-1); /* card not found; continue search */
1076
1077 while(ipid->card_vendor) {
1078 if ((pnp_c = pnp_find_card(ipid->card_vendor,
1079 ipid->card_device, pnp_c))) {
1080 pnp_d = NULL;
1081 if ((pnp_d = pnp_find_dev(pnp_c,
1082 ipid->vendor, ipid->function, pnp_d))) {
1083 int err;
1084
1085 printk(KERN_INFO "HiSax: %s detected\n",
1086 (char *)ipid->driver_data);
1087 pnp_disable_dev(pnp_d);
1088 err = pnp_activate_dev(pnp_d);
1089 if (err<0) {
1090 printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
1091 __FUNCTION__, err);
1092 return(0);
1093 }
1094 card->para[1] = pnp_port_start(pnp_d, 0);
1095 card->para[0] = pnp_irq(pnp_d, 0);
1096 if (!card->para[0] || !card->para[1]) {
1097 printk(KERN_ERR "Diva PnP:some resources are missing %ld/%lx\n",
1098 card->para[0], card->para[1]);
1099 pnp_disable_dev(pnp_d);
1100 return(0);
1101 }
1102 cs->hw.diva.cfg_reg = card->para[1];
1103 cs->irq = card->para[0];
1104 if (ipid->function == ISAPNP_FUNCTION(0xA1)) {
1105 cs->subtyp = DIVA_IPAC_ISA;
1106 cs->hw.diva.ctrl = 0;
1107 cs->hw.diva.isac =
1108 card->para[1] + DIVA_IPAC_DATA;
1109 cs->hw.diva.hscx =
1110 card->para[1] + DIVA_IPAC_DATA;
1111 cs->hw.diva.isac_adr =
1112 card->para[1] + DIVA_IPAC_ADR;
1113 cs->hw.diva.hscx_adr =
1114 card->para[1] + DIVA_IPAC_ADR;
1115 test_and_set_bit(HW_IPAC, &cs->HW_Flags);
1116 } else {
1117 cs->subtyp = DIVA_ISA;
1118 cs->hw.diva.ctrl =
1119 card->para[1] + DIVA_ISA_CTRL;
1120 cs->hw.diva.isac =
1121 card->para[1] + DIVA_ISA_ISAC_DATA;
1122 cs->hw.diva.hscx =
1123 card->para[1] + DIVA_HSCX_DATA;
1124 cs->hw.diva.isac_adr =
1125 card->para[1] + DIVA_ISA_ISAC_ADR;
1126 cs->hw.diva.hscx_adr =
1127 card->para[1] + DIVA_HSCX_ADR;
1128 }
1129 return (1); /* card found */
1130 } else {
1131 printk(KERN_ERR "Diva PnP: PnP error card found, no device\n");
1132 return(0);
1133 }
1134 }
1135 ipid++;
1136 pnp_c=NULL;
1137 }
1138
1139 return (-1); /* card not found; continue search */
1140}
1141
1142#else /* if !ISAPNP */
1143
1144static int __devinit setup_diva_isapnp(struct IsdnCard *card)
1145{
1146 return (-1); /* card not found; continue search */
1147}
1148
1149#endif /* ISAPNP */
1150
1151#ifdef CONFIG_PCI
1152static struct pci_dev *dev_diva __devinitdata = NULL;
1153static struct pci_dev *dev_diva_u __devinitdata = NULL;
1154static struct pci_dev *dev_diva201 __devinitdata = NULL;
1155static struct pci_dev *dev_diva202 __devinitdata = NULL;
1156
1157static int __devinit setup_diva_pci(struct IsdnCard *card)
1158{
1159 struct IsdnCardState *cs = card->cs;
1160
1161 cs->subtyp = 0;
1162 if ((dev_diva = pci_find_device(PCI_VENDOR_ID_EICON,
1163 PCI_DEVICE_ID_EICON_DIVA20, dev_diva))) {
1164 if (pci_enable_device(dev_diva))
1165 return(0);
1166 cs->subtyp = DIVA_PCI;
1167 cs->irq = dev_diva->irq;
1168 cs->hw.diva.cfg_reg = pci_resource_start(dev_diva, 2);
1169 } else if ((dev_diva_u = pci_find_device(PCI_VENDOR_ID_EICON,
1170 PCI_DEVICE_ID_EICON_DIVA20_U, dev_diva_u))) {
1171 if (pci_enable_device(dev_diva_u))
1172 return(0);
1173 cs->subtyp = DIVA_PCI;
1174 cs->irq = dev_diva_u->irq;
1175 cs->hw.diva.cfg_reg = pci_resource_start(dev_diva_u, 2);
1176 } else if ((dev_diva201 = pci_find_device(PCI_VENDOR_ID_EICON,
1177 PCI_DEVICE_ID_EICON_DIVA201, dev_diva201))) {
1178 if (pci_enable_device(dev_diva201))
1179 return(0);
1180 cs->subtyp = DIVA_IPAC_PCI;
1181 cs->irq = dev_diva201->irq;
1182 cs->hw.diva.pci_cfg =
1183 (ulong) ioremap(pci_resource_start(dev_diva201, 0), 4096);
1184 cs->hw.diva.cfg_reg =
1185 (ulong) ioremap(pci_resource_start(dev_diva201, 1), 4096);
1186 } else if ((dev_diva202 = pci_find_device(PCI_VENDOR_ID_EICON,
1187 PCI_DEVICE_ID_EICON_DIVA202, dev_diva202))) {
1188 if (pci_enable_device(dev_diva202))
1189 return(0);
1190 cs->subtyp = DIVA_IPACX_PCI;
1191 cs->irq = dev_diva202->irq;
1192 cs->hw.diva.pci_cfg =
1193 (ulong) ioremap(pci_resource_start(dev_diva202, 0), 4096);
1194 cs->hw.diva.cfg_reg =
1195 (ulong) ioremap(pci_resource_start(dev_diva202, 1), 4096);
1196 } else {
1197 return (-1); /* card not found; continue search */
1198 }
1199
1200 if (!cs->irq) {
1201 printk(KERN_WARNING "Diva: No IRQ for PCI card found\n");
1202 iounmap_diva(cs);
1203 return(0);
1204 }
1205
1206 if (!cs->hw.diva.cfg_reg) {
1207 printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n");
1208 iounmap_diva(cs);
1209 return(0);
1210 }
1211 cs->irq_flags |= IRQF_SHARED;
1212
1213 if ((cs->subtyp == DIVA_IPAC_PCI) ||
1214 (cs->subtyp == DIVA_IPACX_PCI) ) {
1215 cs->hw.diva.ctrl = 0;
1216 cs->hw.diva.isac = 0;
1217 cs->hw.diva.hscx = 0;
1218 cs->hw.diva.isac_adr = 0;
1219 cs->hw.diva.hscx_adr = 0;
1220 test_and_set_bit(HW_IPAC, &cs->HW_Flags);
1221 } else {
1222 cs->hw.diva.ctrl = cs->hw.diva.cfg_reg + DIVA_PCI_CTRL;
1223 cs->hw.diva.isac = cs->hw.diva.cfg_reg + DIVA_PCI_ISAC_DATA;
1224 cs->hw.diva.hscx = cs->hw.diva.cfg_reg + DIVA_HSCX_DATA;
1225 cs->hw.diva.isac_adr = cs->hw.diva.cfg_reg + DIVA_PCI_ISAC_ADR;
1226 cs->hw.diva.hscx_adr = cs->hw.diva.cfg_reg + DIVA_HSCX_ADR;
1227 }
1228
1229 return (1); /* card found */
1230}
1231
1232#else /* if !CONFIG_PCI */
1233
1234static int __devinit setup_diva_pci(struct IsdnCard *card)
1235{
1236 return (-1); /* card not found; continue search */
1237}
1238
1239#endif /* CONFIG_PCI */
1240
1241int __devinit
1242setup_diva(struct IsdnCard *card)
1243{
1244 int rc, have_card = 0;
1245 struct IsdnCardState *cs = card->cs;
1246 char tmp[64];
1247
1248 strcpy(tmp, Diva_revision);
1249 printk(KERN_INFO "HiSax: Eicon.Diehl Diva driver Rev. %s\n", HiSax_getrev(tmp));
1250 if (cs->typ != ISDN_CTYPE_DIEHLDIVA)
1251 return(0);
1252 cs->hw.diva.status = 0;
1253
1254 rc = setup_diva_isa(card);
1255 if (!rc)
1256 return rc;
1257 if (rc > 0) {
1258 have_card = 1;
1259 goto ready;
1260 }
1261
1262 rc = setup_diva_isapnp(card);
1263 if (!rc)
1264 return rc;
1265 if (rc > 0) {
1266 have_card = 1;
1267 goto ready;
1268 }
1269
1270 rc = setup_diva_pci(card);
1271 if (!rc)
1272 return rc;
1273 if (rc > 0)
1274 have_card = 1;
1275
1276ready:
1277 if (!have_card) {
1278 printk(KERN_WARNING "Diva: No ISA, ISAPNP or PCI card found\n");
1279 return(0);
1280 }
1281
1282 return setup_diva_common(card->cs);
1283}
diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c
index fab3e4ea0595..0c1351b23840 100644
--- a/drivers/isdn/hisax/elsa.c
+++ b/drivers/isdn/hisax/elsa.c
@@ -30,8 +30,6 @@
30#include <linux/serial.h> 30#include <linux/serial.h>
31#include <linux/serial_reg.h> 31#include <linux/serial_reg.h>
32 32
33extern const char *CardType[];
34
35static const char *Elsa_revision = "$Revision: 2.32.2.4 $"; 33static const char *Elsa_revision = "$Revision: 2.32.2.4 $";
36static const char *Elsa_Types[] = 34static const char *Elsa_Types[] =
37{"None", "PC", "PCC-8", "PCC-16", "PCF", "PCF-Pro", 35{"None", "PC", "PCC-8", "PCC-16", "PCF", "PCF-Pro",
@@ -832,8 +830,75 @@ probe_elsa(struct IsdnCardState *cs)
832 return (CARD_portlist[i]); 830 return (CARD_portlist[i]);
833} 831}
834 832
835static struct pci_dev *dev_qs1000 __devinitdata = NULL; 833static int __devinit
836static struct pci_dev *dev_qs3000 __devinitdata = NULL; 834setup_elsa_isa(struct IsdnCard *card)
835{
836 struct IsdnCardState *cs = card->cs;
837 u_char val;
838
839 cs->hw.elsa.base = card->para[0];
840 printk(KERN_INFO "Elsa: Microlink IO probing\n");
841 if (cs->hw.elsa.base) {
842 if (!(cs->subtyp = probe_elsa_adr(cs->hw.elsa.base,
843 cs->typ))) {
844 printk(KERN_WARNING
845 "Elsa: no Elsa Microlink at %#lx\n",
846 cs->hw.elsa.base);
847 return (0);
848 }
849 } else
850 cs->hw.elsa.base = probe_elsa(cs);
851
852 if (!cs->hw.elsa.base) {
853 printk(KERN_WARNING
854 "No Elsa Microlink found\n");
855 return (0);
856 }
857
858 cs->hw.elsa.cfg = cs->hw.elsa.base + ELSA_CONFIG;
859 cs->hw.elsa.ctrl = cs->hw.elsa.base + ELSA_CONTROL;
860 cs->hw.elsa.ale = cs->hw.elsa.base + ELSA_ALE;
861 cs->hw.elsa.isac = cs->hw.elsa.base + ELSA_ISAC;
862 cs->hw.elsa.itac = cs->hw.elsa.base + ELSA_ITAC;
863 cs->hw.elsa.hscx = cs->hw.elsa.base + ELSA_HSCX;
864 cs->hw.elsa.trig = cs->hw.elsa.base + ELSA_TRIG_IRQ;
865 cs->hw.elsa.timer = cs->hw.elsa.base + ELSA_START_TIMER;
866 val = bytein(cs->hw.elsa.cfg);
867 if (cs->subtyp == ELSA_PC) {
868 const u_char CARD_IrqTab[8] =
869 {7, 3, 5, 9, 0, 0, 0, 0};
870 cs->irq = CARD_IrqTab[(val & ELSA_IRQ_IDX_PC) >> 2];
871 } else if (cs->subtyp == ELSA_PCC8) {
872 const u_char CARD_IrqTab[8] =
873 {7, 3, 5, 9, 0, 0, 0, 0};
874 cs->irq = CARD_IrqTab[(val & ELSA_IRQ_IDX_PCC8) >> 4];
875 } else {
876 const u_char CARD_IrqTab[8] =
877 {15, 10, 15, 3, 11, 5, 11, 9};
878 cs->irq = CARD_IrqTab[(val & ELSA_IRQ_IDX) >> 3];
879 }
880 val = bytein(cs->hw.elsa.ale) & ELSA_HW_RELEASE;
881 if (val < 3)
882 val |= 8;
883 val += 'A' - 3;
884 if (val == 'B' || val == 'C')
885 val ^= 1;
886 if ((cs->subtyp == ELSA_PCFPRO) && (val = 'G'))
887 val = 'C';
888 printk(KERN_INFO
889 "Elsa: %s found at %#lx Rev.:%c IRQ %d\n",
890 Elsa_Types[cs->subtyp],
891 cs->hw.elsa.base,
892 val, cs->irq);
893 val = bytein(cs->hw.elsa.ale) & ELSA_S0_POWER_BAD;
894 if (val) {
895 printk(KERN_WARNING
896 "Elsa: Microlink S0 bus power bad\n");
897 cs->hw.elsa.status |= ELSA_BAD_PWR;
898 }
899
900 return (1);
901}
837 902
838#ifdef __ISAPNP__ 903#ifdef __ISAPNP__
839static struct isapnp_device_id elsa_ids[] __devinitdata = { 904static struct isapnp_device_id elsa_ids[] __devinitdata = {
@@ -848,233 +913,194 @@ static struct isapnp_device_id elsa_ids[] __devinitdata = {
848 913
849static struct isapnp_device_id *ipid __devinitdata = &elsa_ids[0]; 914static struct isapnp_device_id *ipid __devinitdata = &elsa_ids[0];
850static struct pnp_card *pnp_c __devinitdata = NULL; 915static struct pnp_card *pnp_c __devinitdata = NULL;
851#endif 916#endif /* __ISAPNP__ */
852 917
853int __devinit 918static int __devinit
854setup_elsa(struct IsdnCard *card) 919setup_elsa_isapnp(struct IsdnCard *card)
855{ 920{
856 int bytecnt;
857 u_char val;
858 struct IsdnCardState *cs = card->cs; 921 struct IsdnCardState *cs = card->cs;
859 char tmp[64];
860 922
861 strcpy(tmp, Elsa_revision);
862 printk(KERN_INFO "HiSax: Elsa driver Rev. %s\n", HiSax_getrev(tmp));
863 cs->hw.elsa.ctrl_reg = 0;
864 cs->hw.elsa.status = 0;
865 cs->hw.elsa.MFlag = 0;
866 cs->subtyp = 0;
867 if (cs->typ == ISDN_CTYPE_ELSA) {
868 cs->hw.elsa.base = card->para[0];
869 printk(KERN_INFO "Elsa: Microlink IO probing\n");
870 if (cs->hw.elsa.base) {
871 if (!(cs->subtyp = probe_elsa_adr(cs->hw.elsa.base,
872 cs->typ))) {
873 printk(KERN_WARNING
874 "Elsa: no Elsa Microlink at %#lx\n",
875 cs->hw.elsa.base);
876 return (0);
877 }
878 } else
879 cs->hw.elsa.base = probe_elsa(cs);
880 if (cs->hw.elsa.base) {
881 cs->hw.elsa.cfg = cs->hw.elsa.base + ELSA_CONFIG;
882 cs->hw.elsa.ctrl = cs->hw.elsa.base + ELSA_CONTROL;
883 cs->hw.elsa.ale = cs->hw.elsa.base + ELSA_ALE;
884 cs->hw.elsa.isac = cs->hw.elsa.base + ELSA_ISAC;
885 cs->hw.elsa.itac = cs->hw.elsa.base + ELSA_ITAC;
886 cs->hw.elsa.hscx = cs->hw.elsa.base + ELSA_HSCX;
887 cs->hw.elsa.trig = cs->hw.elsa.base + ELSA_TRIG_IRQ;
888 cs->hw.elsa.timer = cs->hw.elsa.base + ELSA_START_TIMER;
889 val = bytein(cs->hw.elsa.cfg);
890 if (cs->subtyp == ELSA_PC) {
891 const u_char CARD_IrqTab[8] =
892 {7, 3, 5, 9, 0, 0, 0, 0};
893 cs->irq = CARD_IrqTab[(val & ELSA_IRQ_IDX_PC) >> 2];
894 } else if (cs->subtyp == ELSA_PCC8) {
895 const u_char CARD_IrqTab[8] =
896 {7, 3, 5, 9, 0, 0, 0, 0};
897 cs->irq = CARD_IrqTab[(val & ELSA_IRQ_IDX_PCC8) >> 4];
898 } else {
899 const u_char CARD_IrqTab[8] =
900 {15, 10, 15, 3, 11, 5, 11, 9};
901 cs->irq = CARD_IrqTab[(val & ELSA_IRQ_IDX) >> 3];
902 }
903 val = bytein(cs->hw.elsa.ale) & ELSA_HW_RELEASE;
904 if (val < 3)
905 val |= 8;
906 val += 'A' - 3;
907 if (val == 'B' || val == 'C')
908 val ^= 1;
909 if ((cs->subtyp == ELSA_PCFPRO) && (val = 'G'))
910 val = 'C';
911 printk(KERN_INFO
912 "Elsa: %s found at %#lx Rev.:%c IRQ %d\n",
913 Elsa_Types[cs->subtyp],
914 cs->hw.elsa.base,
915 val, cs->irq);
916 val = bytein(cs->hw.elsa.ale) & ELSA_S0_POWER_BAD;
917 if (val) {
918 printk(KERN_WARNING
919 "Elsa: Microlink S0 bus power bad\n");
920 cs->hw.elsa.status |= ELSA_BAD_PWR;
921 }
922 } else {
923 printk(KERN_WARNING
924 "No Elsa Microlink found\n");
925 return (0);
926 }
927 } else if (cs->typ == ISDN_CTYPE_ELSA_PNP) {
928#ifdef __ISAPNP__ 923#ifdef __ISAPNP__
929 if (!card->para[1] && isapnp_present()) { 924 if (!card->para[1] && isapnp_present()) {
930 struct pnp_dev *pnp_d; 925 struct pnp_dev *pnp_d;
931 while(ipid->card_vendor) { 926 while(ipid->card_vendor) {
932 if ((pnp_c = pnp_find_card(ipid->card_vendor, 927 if ((pnp_c = pnp_find_card(ipid->card_vendor,
933 ipid->card_device, pnp_c))) { 928 ipid->card_device, pnp_c))) {
934 pnp_d = NULL; 929 pnp_d = NULL;
935 if ((pnp_d = pnp_find_dev(pnp_c, 930 if ((pnp_d = pnp_find_dev(pnp_c,
936 ipid->vendor, ipid->function, pnp_d))) { 931 ipid->vendor, ipid->function, pnp_d))) {
937 int err; 932 int err;
938 933
939 printk(KERN_INFO "HiSax: %s detected\n", 934 printk(KERN_INFO "HiSax: %s detected\n",
940 (char *)ipid->driver_data); 935 (char *)ipid->driver_data);
936 pnp_disable_dev(pnp_d);
937 err = pnp_activate_dev(pnp_d);
938 if (err<0) {
939 printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
940 __FUNCTION__, err);
941 return(0);
942 }
943 card->para[1] = pnp_port_start(pnp_d, 0);
944 card->para[0] = pnp_irq(pnp_d, 0);
945
946 if (!card->para[0] || !card->para[1]) {
947 printk(KERN_ERR "Elsa PnP:some resources are missing %ld/%lx\n",
948 card->para[0], card->para[1]);
941 pnp_disable_dev(pnp_d); 949 pnp_disable_dev(pnp_d);
942 err = pnp_activate_dev(pnp_d);
943 if (err<0) {
944 printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
945 __FUNCTION__, err);
946 return(0);
947 }
948 card->para[1] = pnp_port_start(pnp_d, 0);
949 card->para[0] = pnp_irq(pnp_d, 0);
950
951 if (!card->para[0] || !card->para[1]) {
952 printk(KERN_ERR "Elsa PnP:some resources are missing %ld/%lx\n",
953 card->para[0], card->para[1]);
954 pnp_disable_dev(pnp_d);
955 return(0);
956 }
957 if (ipid->function == ISAPNP_FUNCTION(0x133))
958 cs->subtyp = ELSA_QS1000;
959 else
960 cs->subtyp = ELSA_QS3000;
961 break;
962 } else {
963 printk(KERN_ERR "Elsa PnP: PnP error card found, no device\n");
964 return(0); 950 return(0);
965 } 951 }
952 if (ipid->function == ISAPNP_FUNCTION(0x133))
953 cs->subtyp = ELSA_QS1000;
954 else
955 cs->subtyp = ELSA_QS3000;
956 break;
957 } else {
958 printk(KERN_ERR "Elsa PnP: PnP error card found, no device\n");
959 return(0);
966 } 960 }
967 ipid++;
968 pnp_c=NULL;
969 }
970 if (!ipid->card_vendor) {
971 printk(KERN_INFO "Elsa PnP: no ISAPnP card found\n");
972 return(0);
973 } 961 }
962 ipid++;
963 pnp_c=NULL;
964 }
965 if (!ipid->card_vendor) {
966 printk(KERN_INFO "Elsa PnP: no ISAPnP card found\n");
967 return(0);
974 } 968 }
975#endif 969 }
976 if (card->para[1] && card->para[0]) { 970#endif /* __ISAPNP__ */
977 cs->hw.elsa.base = card->para[1]; 971
978 cs->irq = card->para[0]; 972 if (card->para[1] && card->para[0]) {
979 if (!cs->subtyp)
980 cs->subtyp = ELSA_QS1000;
981 } else {
982 printk(KERN_ERR "Elsa PnP: no parameter\n");
983 }
984 cs->hw.elsa.cfg = cs->hw.elsa.base + ELSA_CONFIG;
985 cs->hw.elsa.ale = cs->hw.elsa.base + ELSA_ALE;
986 cs->hw.elsa.isac = cs->hw.elsa.base + ELSA_ISAC;
987 cs->hw.elsa.hscx = cs->hw.elsa.base + ELSA_HSCX;
988 cs->hw.elsa.trig = cs->hw.elsa.base + ELSA_TRIG_IRQ;
989 cs->hw.elsa.timer = cs->hw.elsa.base + ELSA_START_TIMER;
990 cs->hw.elsa.ctrl = cs->hw.elsa.base + ELSA_CONTROL;
991 printk(KERN_INFO
992 "Elsa: %s defined at %#lx IRQ %d\n",
993 Elsa_Types[cs->subtyp],
994 cs->hw.elsa.base,
995 cs->irq);
996 } else if (cs->typ == ISDN_CTYPE_ELSA_PCMCIA) {
997 cs->hw.elsa.base = card->para[1]; 973 cs->hw.elsa.base = card->para[1];
998 cs->irq = card->para[0]; 974 cs->irq = card->para[0];
999 val = readreg(cs->hw.elsa.base + 0, cs->hw.elsa.base + 2, IPAC_ID); 975 if (!cs->subtyp)
1000 if ((val == 1) || (val == 2)) { /* IPAC version 1.1/1.2 */ 976 cs->subtyp = ELSA_QS1000;
1001 cs->subtyp = ELSA_PCMCIA_IPAC; 977 } else {
1002 cs->hw.elsa.ale = cs->hw.elsa.base + 0; 978 printk(KERN_ERR "Elsa PnP: no parameter\n");
1003 cs->hw.elsa.isac = cs->hw.elsa.base + 2; 979 }
1004 cs->hw.elsa.hscx = cs->hw.elsa.base + 2; 980 cs->hw.elsa.cfg = cs->hw.elsa.base + ELSA_CONFIG;
1005 test_and_set_bit(HW_IPAC, &cs->HW_Flags); 981 cs->hw.elsa.ale = cs->hw.elsa.base + ELSA_ALE;
1006 } else { 982 cs->hw.elsa.isac = cs->hw.elsa.base + ELSA_ISAC;
1007 cs->subtyp = ELSA_PCMCIA; 983 cs->hw.elsa.hscx = cs->hw.elsa.base + ELSA_HSCX;
1008 cs->hw.elsa.ale = cs->hw.elsa.base + ELSA_ALE_PCM; 984 cs->hw.elsa.trig = cs->hw.elsa.base + ELSA_TRIG_IRQ;
1009 cs->hw.elsa.isac = cs->hw.elsa.base + ELSA_ISAC_PCM; 985 cs->hw.elsa.timer = cs->hw.elsa.base + ELSA_START_TIMER;
1010 cs->hw.elsa.hscx = cs->hw.elsa.base + ELSA_HSCX; 986 cs->hw.elsa.ctrl = cs->hw.elsa.base + ELSA_CONTROL;
1011 } 987 printk(KERN_INFO
1012 cs->hw.elsa.timer = 0; 988 "Elsa: %s defined at %#lx IRQ %d\n",
1013 cs->hw.elsa.trig = 0; 989 Elsa_Types[cs->subtyp],
1014 cs->hw.elsa.ctrl = 0; 990 cs->hw.elsa.base,
1015 cs->irq_flags |= IRQF_SHARED; 991 cs->irq);
1016 printk(KERN_INFO 992
1017 "Elsa: %s defined at %#lx IRQ %d\n", 993 return (1);
1018 Elsa_Types[cs->subtyp], 994}
1019 cs->hw.elsa.base, 995
1020 cs->irq); 996static void __devinit
1021 } else if (cs->typ == ISDN_CTYPE_ELSA_PCI) { 997setup_elsa_pcmcia(struct IsdnCard *card)
998{
999 struct IsdnCardState *cs = card->cs;
1000 u_char val;
1001
1002 cs->hw.elsa.base = card->para[1];
1003 cs->irq = card->para[0];
1004 val = readreg(cs->hw.elsa.base + 0, cs->hw.elsa.base + 2, IPAC_ID);
1005 if ((val == 1) || (val == 2)) { /* IPAC version 1.1/1.2 */
1006 cs->subtyp = ELSA_PCMCIA_IPAC;
1007 cs->hw.elsa.ale = cs->hw.elsa.base + 0;
1008 cs->hw.elsa.isac = cs->hw.elsa.base + 2;
1009 cs->hw.elsa.hscx = cs->hw.elsa.base + 2;
1010 test_and_set_bit(HW_IPAC, &cs->HW_Flags);
1011 } else {
1012 cs->subtyp = ELSA_PCMCIA;
1013 cs->hw.elsa.ale = cs->hw.elsa.base + ELSA_ALE_PCM;
1014 cs->hw.elsa.isac = cs->hw.elsa.base + ELSA_ISAC_PCM;
1015 cs->hw.elsa.hscx = cs->hw.elsa.base + ELSA_HSCX;
1016 }
1017 cs->hw.elsa.timer = 0;
1018 cs->hw.elsa.trig = 0;
1019 cs->hw.elsa.ctrl = 0;
1020 cs->irq_flags |= IRQF_SHARED;
1021 printk(KERN_INFO
1022 "Elsa: %s defined at %#lx IRQ %d\n",
1023 Elsa_Types[cs->subtyp],
1024 cs->hw.elsa.base,
1025 cs->irq);
1026}
1027
1022#ifdef CONFIG_PCI 1028#ifdef CONFIG_PCI
1023 cs->subtyp = 0; 1029static struct pci_dev *dev_qs1000 __devinitdata = NULL;
1024 if ((dev_qs1000 = pci_find_device(PCI_VENDOR_ID_ELSA, 1030static struct pci_dev *dev_qs3000 __devinitdata = NULL;
1025 PCI_DEVICE_ID_ELSA_MICROLINK, dev_qs1000))) { 1031
1026 if (pci_enable_device(dev_qs1000)) 1032static int __devinit
1027 return(0); 1033setup_elsa_pci(struct IsdnCard *card)
1028 cs->subtyp = ELSA_QS1000PCI; 1034{
1029 cs->irq = dev_qs1000->irq; 1035 struct IsdnCardState *cs = card->cs;
1030 cs->hw.elsa.cfg = pci_resource_start(dev_qs1000, 1); 1036
1031 cs->hw.elsa.base = pci_resource_start(dev_qs1000, 3); 1037 cs->subtyp = 0;
1032 } else if ((dev_qs3000 = pci_find_device(PCI_VENDOR_ID_ELSA, 1038 if ((dev_qs1000 = pci_find_device(PCI_VENDOR_ID_ELSA,
1033 PCI_DEVICE_ID_ELSA_QS3000, dev_qs3000))) { 1039 PCI_DEVICE_ID_ELSA_MICROLINK, dev_qs1000))) {
1034 if (pci_enable_device(dev_qs3000)) 1040 if (pci_enable_device(dev_qs1000))
1035 return(0);
1036 cs->subtyp = ELSA_QS3000PCI;
1037 cs->irq = dev_qs3000->irq;
1038 cs->hw.elsa.cfg = pci_resource_start(dev_qs3000, 1);
1039 cs->hw.elsa.base = pci_resource_start(dev_qs3000, 3);
1040 } else {
1041 printk(KERN_WARNING "Elsa: No PCI card found\n");
1042 return(0); 1041 return(0);
1043 } 1042 cs->subtyp = ELSA_QS1000PCI;
1044 if (!cs->irq) { 1043 cs->irq = dev_qs1000->irq;
1045 printk(KERN_WARNING "Elsa: No IRQ for PCI card found\n"); 1044 cs->hw.elsa.cfg = pci_resource_start(dev_qs1000, 1);
1045 cs->hw.elsa.base = pci_resource_start(dev_qs1000, 3);
1046 } else if ((dev_qs3000 = pci_find_device(PCI_VENDOR_ID_ELSA,
1047 PCI_DEVICE_ID_ELSA_QS3000, dev_qs3000))) {
1048 if (pci_enable_device(dev_qs3000))
1046 return(0); 1049 return(0);
1047 } 1050 cs->subtyp = ELSA_QS3000PCI;
1051 cs->irq = dev_qs3000->irq;
1052 cs->hw.elsa.cfg = pci_resource_start(dev_qs3000, 1);
1053 cs->hw.elsa.base = pci_resource_start(dev_qs3000, 3);
1054 } else {
1055 printk(KERN_WARNING "Elsa: No PCI card found\n");
1056 return(0);
1057 }
1058 if (!cs->irq) {
1059 printk(KERN_WARNING "Elsa: No IRQ for PCI card found\n");
1060 return(0);
1061 }
1062
1063 if (!(cs->hw.elsa.base && cs->hw.elsa.cfg)) {
1064 printk(KERN_WARNING "Elsa: No IO-Adr for PCI card found\n");
1065 return(0);
1066 }
1067 if ((cs->hw.elsa.cfg & 0xff) || (cs->hw.elsa.base & 0xf)) {
1068 printk(KERN_WARNING "Elsa: You may have a wrong PCI bios\n");
1069 printk(KERN_WARNING "Elsa: If your system hangs now, read\n");
1070 printk(KERN_WARNING "Elsa: Documentation/isdn/README.HiSax\n");
1071 }
1072 cs->hw.elsa.ale = cs->hw.elsa.base;
1073 cs->hw.elsa.isac = cs->hw.elsa.base +1;
1074 cs->hw.elsa.hscx = cs->hw.elsa.base +1;
1075 test_and_set_bit(HW_IPAC, &cs->HW_Flags);
1076 cs->hw.elsa.timer = 0;
1077 cs->hw.elsa.trig = 0;
1078 cs->irq_flags |= IRQF_SHARED;
1079 printk(KERN_INFO
1080 "Elsa: %s defined at %#lx/0x%x IRQ %d\n",
1081 Elsa_Types[cs->subtyp],
1082 cs->hw.elsa.base,
1083 cs->hw.elsa.cfg,
1084 cs->irq);
1085
1086 return (1);
1087}
1048 1088
1049 if (!(cs->hw.elsa.base && cs->hw.elsa.cfg)) {
1050 printk(KERN_WARNING "Elsa: No IO-Adr for PCI card found\n");
1051 return(0);
1052 }
1053 if ((cs->hw.elsa.cfg & 0xff) || (cs->hw.elsa.base & 0xf)) {
1054 printk(KERN_WARNING "Elsa: You may have a wrong PCI bios\n");
1055 printk(KERN_WARNING "Elsa: If your system hangs now, read\n");
1056 printk(KERN_WARNING "Elsa: Documentation/isdn/README.HiSax\n");
1057 }
1058 cs->hw.elsa.ale = cs->hw.elsa.base;
1059 cs->hw.elsa.isac = cs->hw.elsa.base +1;
1060 cs->hw.elsa.hscx = cs->hw.elsa.base +1;
1061 test_and_set_bit(HW_IPAC, &cs->HW_Flags);
1062 cs->hw.elsa.timer = 0;
1063 cs->hw.elsa.trig = 0;
1064 cs->irq_flags |= IRQF_SHARED;
1065 printk(KERN_INFO
1066 "Elsa: %s defined at %#lx/0x%x IRQ %d\n",
1067 Elsa_Types[cs->subtyp],
1068 cs->hw.elsa.base,
1069 cs->hw.elsa.cfg,
1070 cs->irq);
1071#else 1089#else
1072 printk(KERN_WARNING "Elsa: Elsa PCI and NO_PCI_BIOS\n"); 1090
1073 printk(KERN_WARNING "Elsa: unable to config Elsa PCI\n"); 1091static void __devinit
1074 return (0); 1092setup_elsa_pci(struct IsdnCard *card)
1093{
1094 return (1);
1095}
1075#endif /* CONFIG_PCI */ 1096#endif /* CONFIG_PCI */
1076 } else 1097
1077 return (0); 1098static int __devinit
1099setup_elsa_common(struct IsdnCard *card)
1100{
1101 struct IsdnCardState *cs = card->cs;
1102 u_char val;
1103 int bytecnt;
1078 1104
1079 switch (cs->subtyp) { 1105 switch (cs->subtyp) {
1080 case ELSA_PC: 1106 case ELSA_PC:
@@ -1104,8 +1130,7 @@ setup_elsa(struct IsdnCard *card)
1104 here, it would fail. */ 1130 here, it would fail. */
1105 if (cs->typ != ISDN_CTYPE_ELSA_PCMCIA && !request_region(cs->hw.elsa.base, bytecnt, "elsa isdn")) { 1131 if (cs->typ != ISDN_CTYPE_ELSA_PCMCIA && !request_region(cs->hw.elsa.base, bytecnt, "elsa isdn")) {
1106 printk(KERN_WARNING 1132 printk(KERN_WARNING
1107 "HiSax: %s config port %#lx-%#lx already in use\n", 1133 "HiSax: ELSA config port %#lx-%#lx already in use\n",
1108 CardType[card->typ],
1109 cs->hw.elsa.base, 1134 cs->hw.elsa.base,
1110 cs->hw.elsa.base + bytecnt); 1135 cs->hw.elsa.base + bytecnt);
1111 return (0); 1136 return (0);
@@ -1113,8 +1138,7 @@ setup_elsa(struct IsdnCard *card)
1113 if ((cs->subtyp == ELSA_QS1000PCI) || (cs->subtyp == ELSA_QS3000PCI)) { 1138 if ((cs->subtyp == ELSA_QS1000PCI) || (cs->subtyp == ELSA_QS3000PCI)) {
1114 if (!request_region(cs->hw.elsa.cfg, 0x80, "elsa isdn pci")) { 1139 if (!request_region(cs->hw.elsa.cfg, 0x80, "elsa isdn pci")) {
1115 printk(KERN_WARNING 1140 printk(KERN_WARNING
1116 "HiSax: %s pci port %x-%x already in use\n", 1141 "HiSax: ELSA pci port %x-%x already in use\n",
1117 CardType[card->typ],
1118 cs->hw.elsa.cfg, 1142 cs->hw.elsa.cfg,
1119 cs->hw.elsa.cfg + 0x80); 1143 cs->hw.elsa.cfg + 0x80);
1120 release_region(cs->hw.elsa.base, bytecnt); 1144 release_region(cs->hw.elsa.base, bytecnt);
@@ -1186,3 +1210,41 @@ setup_elsa(struct IsdnCard *card)
1186 } 1210 }
1187 return (1); 1211 return (1);
1188} 1212}
1213
1214int __devinit
1215setup_elsa(struct IsdnCard *card)
1216{
1217 int rc;
1218 struct IsdnCardState *cs = card->cs;
1219 char tmp[64];
1220
1221 strcpy(tmp, Elsa_revision);
1222 printk(KERN_INFO "HiSax: Elsa driver Rev. %s\n", HiSax_getrev(tmp));
1223 cs->hw.elsa.ctrl_reg = 0;
1224 cs->hw.elsa.status = 0;
1225 cs->hw.elsa.MFlag = 0;
1226 cs->subtyp = 0;
1227
1228 if (cs->typ == ISDN_CTYPE_ELSA) {
1229 rc = setup_elsa_isa(card);
1230 if (!rc)
1231 return (0);
1232
1233 } else if (cs->typ == ISDN_CTYPE_ELSA_PNP) {
1234 rc = setup_elsa_isapnp(card);
1235 if (!rc)
1236 return (0);
1237
1238 } else if (cs->typ == ISDN_CTYPE_ELSA_PCMCIA)
1239 setup_elsa_pcmcia(card);
1240
1241 else if (cs->typ == ISDN_CTYPE_ELSA_PCI) {
1242 rc = setup_elsa_pci(card);
1243 if (!rc)
1244 return (0);
1245
1246 } else
1247 return (0);
1248
1249 return setup_elsa_common(card);
1250}
diff --git a/drivers/isdn/hisax/sedlbauer.c b/drivers/isdn/hisax/sedlbauer.c
index ad06f3cc60fb..03dfc32166a0 100644
--- a/drivers/isdn/hisax/sedlbauer.c
+++ b/drivers/isdn/hisax/sedlbauer.c
@@ -518,8 +518,6 @@ Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg)
518 return(0); 518 return(0);
519} 519}
520 520
521static struct pci_dev *dev_sedl __devinitdata = NULL;
522
523#ifdef __ISAPNP__ 521#ifdef __ISAPNP__
524static struct isapnp_device_id sedl_ids[] __devinitdata = { 522static struct isapnp_device_id sedl_ids[] __devinitdata = {
525 { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01), 523 { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01),
@@ -533,15 +531,158 @@ static struct isapnp_device_id sedl_ids[] __devinitdata = {
533 531
534static struct isapnp_device_id *ipid __devinitdata = &sedl_ids[0]; 532static struct isapnp_device_id *ipid __devinitdata = &sedl_ids[0];
535static struct pnp_card *pnp_c __devinitdata = NULL; 533static struct pnp_card *pnp_c __devinitdata = NULL;
536#endif 534
535static int __devinit
536setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt)
537{
538 struct IsdnCardState *cs = card->cs;
539 struct pnp_dev *pnp_d;
540
541 if (!isapnp_present())
542 return -1;
543
544 while(ipid->card_vendor) {
545 if ((pnp_c = pnp_find_card(ipid->card_vendor,
546 ipid->card_device, pnp_c))) {
547 pnp_d = NULL;
548 if ((pnp_d = pnp_find_dev(pnp_c,
549 ipid->vendor, ipid->function, pnp_d))) {
550 int err;
551
552 printk(KERN_INFO "HiSax: %s detected\n",
553 (char *)ipid->driver_data);
554 pnp_disable_dev(pnp_d);
555 err = pnp_activate_dev(pnp_d);
556 if (err<0) {
557 printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
558 __FUNCTION__, err);
559 return(0);
560 }
561 card->para[1] = pnp_port_start(pnp_d, 0);
562 card->para[0] = pnp_irq(pnp_d, 0);
563
564 if (!card->para[0] || !card->para[1]) {
565 printk(KERN_ERR "Sedlbauer PnP:some resources are missing %ld/%lx\n",
566 card->para[0], card->para[1]);
567 pnp_disable_dev(pnp_d);
568 return(0);
569 }
570 cs->hw.sedl.cfg_reg = card->para[1];
571 cs->irq = card->para[0];
572 if (ipid->function == ISAPNP_FUNCTION(0x2)) {
573 cs->subtyp = SEDL_SPEED_FAX;
574 cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
575 *bytecnt = 16;
576 } else {
577 cs->subtyp = SEDL_SPEED_CARD_WIN;
578 cs->hw.sedl.chip = SEDL_CHIP_TEST;
579 }
580
581 return (1);
582 } else {
583 printk(KERN_ERR "Sedlbauer PnP: PnP error card found, no device\n");
584 return(0);
585 }
586 }
587 ipid++;
588 pnp_c = NULL;
589 }
590
591 printk(KERN_INFO "Sedlbauer PnP: no ISAPnP card found\n");
592 return -1;
593}
594#else
595
596static int __devinit
597setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt)
598{
599 return -1;
600}
601#endif /* __ISAPNP__ */
602
603#ifdef CONFIG_PCI
604static struct pci_dev *dev_sedl __devinitdata = NULL;
605
606static int __devinit
607setup_sedlbauer_pci(struct IsdnCard *card)
608{
609 struct IsdnCardState *cs = card->cs;
610 u16 sub_vendor_id, sub_id;
611
612 if ((dev_sedl = pci_find_device(PCI_VENDOR_ID_TIGERJET,
613 PCI_DEVICE_ID_TIGERJET_100, dev_sedl))) {
614 if (pci_enable_device(dev_sedl))
615 return(0);
616 cs->irq = dev_sedl->irq;
617 if (!cs->irq) {
618 printk(KERN_WARNING "Sedlbauer: No IRQ for PCI card found\n");
619 return(0);
620 }
621 cs->hw.sedl.cfg_reg = pci_resource_start(dev_sedl, 0);
622 } else {
623 printk(KERN_WARNING "Sedlbauer: No PCI card found\n");
624 return(0);
625 }
626 cs->irq_flags |= IRQF_SHARED;
627 cs->hw.sedl.bus = SEDL_BUS_PCI;
628 sub_vendor_id = dev_sedl->subsystem_vendor;
629 sub_id = dev_sedl->subsystem_device;
630 printk(KERN_INFO "Sedlbauer: PCI subvendor:%x subid %x\n",
631 sub_vendor_id, sub_id);
632 printk(KERN_INFO "Sedlbauer: PCI base adr %#x\n",
633 cs->hw.sedl.cfg_reg);
634 if (sub_id != PCI_SUB_ID_SEDLBAUER) {
635 printk(KERN_ERR "Sedlbauer: unknown sub id %#x\n", sub_id);
636 return(0);
637 }
638 if (sub_vendor_id == PCI_SUBVENDOR_SPEEDFAX_PYRAMID) {
639 cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
640 cs->subtyp = SEDL_SPEEDFAX_PYRAMID;
641 } else if (sub_vendor_id == PCI_SUBVENDOR_SPEEDFAX_PCI) {
642 cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
643 cs->subtyp = SEDL_SPEEDFAX_PCI;
644 } else if (sub_vendor_id == PCI_SUBVENDOR_HST_SAPHIR3) {
645 cs->hw.sedl.chip = SEDL_CHIP_IPAC;
646 cs->subtyp = HST_SAPHIR3;
647 } else if (sub_vendor_id == PCI_SUBVENDOR_SEDLBAUER_PCI) {
648 cs->hw.sedl.chip = SEDL_CHIP_IPAC;
649 cs->subtyp = SEDL_SPEED_PCI;
650 } else {
651 printk(KERN_ERR "Sedlbauer: unknown sub vendor id %#x\n",
652 sub_vendor_id);
653 return(0);
654 }
655
656 cs->hw.sedl.reset_on = SEDL_ISAR_PCI_ISAR_RESET_ON;
657 cs->hw.sedl.reset_off = SEDL_ISAR_PCI_ISAR_RESET_OFF;
658 byteout(cs->hw.sedl.cfg_reg, 0xff);
659 byteout(cs->hw.sedl.cfg_reg, 0x00);
660 byteout(cs->hw.sedl.cfg_reg+ 2, 0xdd);
661 byteout(cs->hw.sedl.cfg_reg+ 5, 0); /* disable all IRQ */
662 byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_on);
663 mdelay(2);
664 byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off);
665 mdelay(10);
666
667 return (1);
668}
669
670#else
671
672static int __devinit
673setup_sedlbauer_pci(struct IsdnCard *card)
674{
675 return (1);
676}
677
678#endif /* CONFIG_PCI */
537 679
538int __devinit 680int __devinit
539setup_sedlbauer(struct IsdnCard *card) 681setup_sedlbauer(struct IsdnCard *card)
540{ 682{
541 int bytecnt, ver, val; 683 int bytecnt = 8, ver, val, rc;
542 struct IsdnCardState *cs = card->cs; 684 struct IsdnCardState *cs = card->cs;
543 char tmp[64]; 685 char tmp[64];
544 u16 sub_vendor_id, sub_id;
545 686
546 strcpy(tmp, Sedlbauer_revision); 687 strcpy(tmp, Sedlbauer_revision);
547 printk(KERN_INFO "HiSax: Sedlbauer driver Rev. %s\n", HiSax_getrev(tmp)); 688 printk(KERN_INFO "HiSax: Sedlbauer driver Rev. %s\n", HiSax_getrev(tmp));
@@ -569,124 +710,21 @@ setup_sedlbauer(struct IsdnCard *card)
569 bytecnt = 16; 710 bytecnt = 16;
570 } 711 }
571 } else { 712 } else {
572#ifdef __ISAPNP__ 713 rc = setup_sedlbauer_isapnp(card, &bytecnt);
573 if (isapnp_present()) { 714 if (!rc)
574 struct pnp_dev *pnp_d; 715 return (0);
575 while(ipid->card_vendor) { 716 if (rc > 0)
576 if ((pnp_c = pnp_find_card(ipid->card_vendor, 717 goto ready;
577 ipid->card_device, pnp_c))) { 718
578 pnp_d = NULL; 719 /* Probe for Sedlbauer speed pci */
579 if ((pnp_d = pnp_find_dev(pnp_c, 720 rc = setup_sedlbauer_pci(card);
580 ipid->vendor, ipid->function, pnp_d))) { 721 if (!rc)
581 int err; 722 return (0);
582 723
583 printk(KERN_INFO "HiSax: %s detected\n",
584 (char *)ipid->driver_data);
585 pnp_disable_dev(pnp_d);
586 err = pnp_activate_dev(pnp_d);
587 if (err<0) {
588 printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
589 __FUNCTION__, err);
590 return(0);
591 }
592 card->para[1] = pnp_port_start(pnp_d, 0);
593 card->para[0] = pnp_irq(pnp_d, 0);
594
595 if (!card->para[0] || !card->para[1]) {
596 printk(KERN_ERR "Sedlbauer PnP:some resources are missing %ld/%lx\n",
597 card->para[0], card->para[1]);
598 pnp_disable_dev(pnp_d);
599 return(0);
600 }
601 cs->hw.sedl.cfg_reg = card->para[1];
602 cs->irq = card->para[0];
603 if (ipid->function == ISAPNP_FUNCTION(0x2)) {
604 cs->subtyp = SEDL_SPEED_FAX;
605 cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
606 bytecnt = 16;
607 } else {
608 cs->subtyp = SEDL_SPEED_CARD_WIN;
609 cs->hw.sedl.chip = SEDL_CHIP_TEST;
610 }
611 goto ready;
612 } else {
613 printk(KERN_ERR "Sedlbauer PnP: PnP error card found, no device\n");
614 return(0);
615 }
616 }
617 ipid++;
618 pnp_c = NULL;
619 }
620 if (!ipid->card_vendor) {
621 printk(KERN_INFO "Sedlbauer PnP: no ISAPnP card found\n");
622 }
623 }
624#endif
625/* Probe for Sedlbauer speed pci */
626#ifdef CONFIG_PCI
627 if ((dev_sedl = pci_find_device(PCI_VENDOR_ID_TIGERJET,
628 PCI_DEVICE_ID_TIGERJET_100, dev_sedl))) {
629 if (pci_enable_device(dev_sedl))
630 return(0);
631 cs->irq = dev_sedl->irq;
632 if (!cs->irq) {
633 printk(KERN_WARNING "Sedlbauer: No IRQ for PCI card found\n");
634 return(0);
635 }
636 cs->hw.sedl.cfg_reg = pci_resource_start(dev_sedl, 0);
637 } else {
638 printk(KERN_WARNING "Sedlbauer: No PCI card found\n");
639 return(0);
640 }
641 cs->irq_flags |= IRQF_SHARED;
642 cs->hw.sedl.bus = SEDL_BUS_PCI;
643 sub_vendor_id = dev_sedl->subsystem_vendor;
644 sub_id = dev_sedl->subsystem_device;
645 printk(KERN_INFO "Sedlbauer: PCI subvendor:%x subid %x\n",
646 sub_vendor_id, sub_id);
647 printk(KERN_INFO "Sedlbauer: PCI base adr %#x\n",
648 cs->hw.sedl.cfg_reg);
649 if (sub_id != PCI_SUB_ID_SEDLBAUER) {
650 printk(KERN_ERR "Sedlbauer: unknown sub id %#x\n", sub_id);
651 return(0);
652 }
653 if (sub_vendor_id == PCI_SUBVENDOR_SPEEDFAX_PYRAMID) {
654 cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
655 cs->subtyp = SEDL_SPEEDFAX_PYRAMID;
656 } else if (sub_vendor_id == PCI_SUBVENDOR_SPEEDFAX_PCI) {
657 cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
658 cs->subtyp = SEDL_SPEEDFAX_PCI;
659 } else if (sub_vendor_id == PCI_SUBVENDOR_HST_SAPHIR3) {
660 cs->hw.sedl.chip = SEDL_CHIP_IPAC;
661 cs->subtyp = HST_SAPHIR3;
662 } else if (sub_vendor_id == PCI_SUBVENDOR_SEDLBAUER_PCI) {
663 cs->hw.sedl.chip = SEDL_CHIP_IPAC;
664 cs->subtyp = SEDL_SPEED_PCI;
665 } else {
666 printk(KERN_ERR "Sedlbauer: unknown sub vendor id %#x\n",
667 sub_vendor_id);
668 return(0);
669 }
670 bytecnt = 256; 724 bytecnt = 256;
671 cs->hw.sedl.reset_on = SEDL_ISAR_PCI_ISAR_RESET_ON;
672 cs->hw.sedl.reset_off = SEDL_ISAR_PCI_ISAR_RESET_OFF;
673 byteout(cs->hw.sedl.cfg_reg, 0xff);
674 byteout(cs->hw.sedl.cfg_reg, 0x00);
675 byteout(cs->hw.sedl.cfg_reg+ 2, 0xdd);
676 byteout(cs->hw.sedl.cfg_reg+ 5, 0); /* disable all IRQ */
677 byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_on);
678 mdelay(2);
679 byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off);
680 mdelay(10);
681#else
682 printk(KERN_WARNING "Sedlbauer: NO_PCI_BIOS\n");
683 return (0);
684#endif /* CONFIG_PCI */
685 } 725 }
686 726
687#ifdef __ISAPNP__
688ready: 727ready:
689#endif
690 728
691 /* In case of the sedlbauer pcmcia card, this region is in use, 729 /* In case of the sedlbauer pcmcia card, this region is in use,
692 * reserved for us by the card manager. So we do not check it 730 * reserved for us by the card manager. So we do not check it
diff --git a/drivers/isdn/hisax/telespci.c b/drivers/isdn/hisax/telespci.c
index d09f6d033f15..4393003ae162 100644
--- a/drivers/isdn/hisax/telespci.c
+++ b/drivers/isdn/hisax/telespci.c
@@ -295,11 +295,12 @@ setup_telespci(struct IsdnCard *card)
295#ifdef __BIG_ENDIAN 295#ifdef __BIG_ENDIAN
296#error "not running on big endian machines now" 296#error "not running on big endian machines now"
297#endif 297#endif
298
298 strcpy(tmp, telespci_revision); 299 strcpy(tmp, telespci_revision);
299 printk(KERN_INFO "HiSax: Teles/PCI driver Rev. %s\n", HiSax_getrev(tmp)); 300 printk(KERN_INFO "HiSax: Teles/PCI driver Rev. %s\n", HiSax_getrev(tmp));
300 if (cs->typ != ISDN_CTYPE_TELESPCI) 301 if (cs->typ != ISDN_CTYPE_TELESPCI)
301 return (0); 302 return (0);
302#ifdef CONFIG_PCI 303
303 if ((dev_tel = pci_find_device (PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36120, dev_tel))) { 304 if ((dev_tel = pci_find_device (PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36120, dev_tel))) {
304 if (pci_enable_device(dev_tel)) 305 if (pci_enable_device(dev_tel))
305 return(0); 306 return(0);
@@ -317,11 +318,6 @@ setup_telespci(struct IsdnCard *card)
317 printk(KERN_WARNING "TelesPCI: No PCI card found\n"); 318 printk(KERN_WARNING "TelesPCI: No PCI card found\n");
318 return(0); 319 return(0);
319 } 320 }
320#else
321 printk(KERN_WARNING "HiSax: Teles/PCI and NO_PCI_BIOS\n");
322 printk(KERN_WARNING "HiSax: Teles/PCI unable to config\n");
323 return (0);
324#endif /* CONFIG_PCI */
325 321
326 /* Initialize Zoran PCI controller */ 322 /* Initialize Zoran PCI controller */
327 writel(0x00000000, cs->hw.teles0.membase + 0x28); 323 writel(0x00000000, cs->hw.teles0.membase + 0x28);
diff --git a/drivers/isdn/hisax/w6692.c b/drivers/isdn/hisax/w6692.c
index 3aeceaf9769e..39129b94f8be 100644
--- a/drivers/isdn/hisax/w6692.c
+++ b/drivers/isdn/hisax/w6692.c
@@ -1009,7 +1009,7 @@ setup_w6692(struct IsdnCard *card)
1009 printk(KERN_INFO "HiSax: W6692 driver Rev. %s\n", HiSax_getrev(tmp)); 1009 printk(KERN_INFO "HiSax: W6692 driver Rev. %s\n", HiSax_getrev(tmp));
1010 if (cs->typ != ISDN_CTYPE_W6692) 1010 if (cs->typ != ISDN_CTYPE_W6692)
1011 return (0); 1011 return (0);
1012#ifdef CONFIG_PCI 1012
1013 while (id_list[id_idx].vendor_id) { 1013 while (id_list[id_idx].vendor_id) {
1014 dev_w6692 = pci_find_device(id_list[id_idx].vendor_id, 1014 dev_w6692 = pci_find_device(id_list[id_idx].vendor_id,
1015 id_list[id_idx].device_id, 1015 id_list[id_idx].device_id,
@@ -1061,11 +1061,6 @@ setup_w6692(struct IsdnCard *card)
1061 cs->hw.w6692.iobase + 255); 1061 cs->hw.w6692.iobase + 255);
1062 return (0); 1062 return (0);
1063 } 1063 }
1064#else
1065 printk(KERN_WARNING "HiSax: W6692 and NO_PCI_BIOS\n");
1066 printk(KERN_WARNING "HiSax: W6692 unable to config\n");
1067 return (0);
1068#endif /* CONFIG_PCI */
1069 1064
1070 printk(KERN_INFO 1065 printk(KERN_INFO
1071 "HiSax: %s config irq:%d I/O:%x\n", 1066 "HiSax: %s config irq:%d I/O:%x\n",