aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/elsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/hisax/elsa.c')
-rw-r--r--drivers/isdn/hisax/elsa.c494
1 files changed, 278 insertions, 216 deletions
diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c
index fab3e4ea059..0c1351b2384 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}