aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-17 18:23:37 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-17 18:23:37 -0400
commit96a6099d2fb448cc06401386c7703a6ca015ac3d (patch)
treed44911dcfa789b3bd21c0b48ea423edc68398feb /drivers
parente779220ec3d70843cef5e9f410d7a0c287f46718 (diff)
parent98fc4839aa00a02da83625e9fedad7a348c0af91 (diff)
Merge branch 'isdn-cleanup' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/misc-2.6
* 'isdn-cleanup' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/misc-2.6: [ISDN] HiSax hfc_pci: minor cleanups [ISDN] HiSax bkm_a4t: split setup into two smaller functions [ISDN] HiSax enternow: split setup into 3 smaller functions [ISDN] HiSax netjet_u: split setup into 3 smaller functions [ISDN] HiSax netjet_s: code movement, prep for hotplug [ISDN] HiSax: move card state alloc/setup code into separate functions [ISDN] HiSax: move card setup into separate function
Diffstat (limited to 'drivers')
-rw-r--r--drivers/isdn/hisax/bkm_a4t.c108
-rw-r--r--drivers/isdn/hisax/config.c233
-rw-r--r--drivers/isdn/hisax/enternow_pci.c165
-rw-r--r--drivers/isdn/hisax/hfc_pci.c191
-rw-r--r--drivers/isdn/hisax/nj_s.c194
-rw-r--r--drivers/isdn/hisax/nj_u.c167
6 files changed, 586 insertions, 472 deletions
diff --git a/drivers/isdn/hisax/bkm_a4t.c b/drivers/isdn/hisax/bkm_a4t.c
index 871310d56a6e..3d1bdc8431ad 100644
--- a/drivers/isdn/hisax/bkm_a4t.c
+++ b/drivers/isdn/hisax/bkm_a4t.c
@@ -255,54 +255,38 @@ BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
255 return (0); 255 return (0);
256} 256}
257 257
258static struct pci_dev *dev_a4t __devinitdata = NULL; 258static int __devinit a4t_pci_probe(struct pci_dev *dev_a4t,
259 struct IsdnCardState *cs,
260 u_int *found,
261 u_int *pci_memaddr)
262{
263 u16 sub_sys;
264 u16 sub_vendor;
265
266 sub_vendor = dev_a4t->subsystem_vendor;
267 sub_sys = dev_a4t->subsystem_device;
268 if ((sub_sys == PCI_DEVICE_ID_BERKOM_A4T) && (sub_vendor == PCI_VENDOR_ID_BERKOM)) {
269 if (pci_enable_device(dev_a4t))
270 return (0); /* end loop & function */
271 *found = 1;
272 *pci_memaddr = pci_resource_start(dev_a4t, 0);
273 cs->irq = dev_a4t->irq;
274 return (1); /* end loop */
275 }
259 276
260int __devinit 277 return (-1); /* continue looping */
261setup_bkm_a4t(struct IsdnCard *card) 278}
279
280static int __devinit a4t_cs_init(struct IsdnCard *card,
281 struct IsdnCardState *cs,
282 u_int pci_memaddr)
262{ 283{
263 struct IsdnCardState *cs = card->cs;
264 char tmp[64];
265 u_int pci_memaddr = 0, found = 0;
266 I20_REGISTER_FILE *pI20_Regs; 284 I20_REGISTER_FILE *pI20_Regs;
267#ifdef CONFIG_PCI
268#endif
269
270 strcpy(tmp, bkm_a4t_revision);
271 printk(KERN_INFO "HiSax: T-Berkom driver Rev. %s\n", HiSax_getrev(tmp));
272 if (cs->typ == ISDN_CTYPE_BKM_A4T) {
273 cs->subtyp = BKM_A4T;
274 } else
275 return (0);
276 285
277#ifdef CONFIG_PCI
278 while ((dev_a4t = pci_find_device(PCI_VENDOR_ID_ZORAN,
279 PCI_DEVICE_ID_ZORAN_36120, dev_a4t))) {
280 u16 sub_sys;
281 u16 sub_vendor;
282
283 sub_vendor = dev_a4t->subsystem_vendor;
284 sub_sys = dev_a4t->subsystem_device;
285 if ((sub_sys == PCI_DEVICE_ID_BERKOM_A4T) && (sub_vendor == PCI_VENDOR_ID_BERKOM)) {
286 if (pci_enable_device(dev_a4t))
287 return(0);
288 found = 1;
289 pci_memaddr = pci_resource_start(dev_a4t, 0);
290 cs->irq = dev_a4t->irq;
291 break;
292 }
293 }
294 if (!found) {
295 printk(KERN_WARNING "HiSax: %s: Card not found\n", CardType[card->typ]);
296 return (0);
297 }
298 if (!cs->irq) { /* IRQ range check ?? */ 286 if (!cs->irq) { /* IRQ range check ?? */
299 printk(KERN_WARNING "HiSax: %s: No IRQ\n", CardType[card->typ]); 287 printk(KERN_WARNING "HiSax: %s: No IRQ\n", CardType[card->typ]);
300 return (0); 288 return (0);
301 } 289 }
302 if (!pci_memaddr) {
303 printk(KERN_WARNING "HiSax: %s: No Memory base address\n", CardType[card->typ]);
304 return (0);
305 }
306 cs->hw.ax.base = (long) ioremap(pci_memaddr, 4096); 290 cs->hw.ax.base = (long) ioremap(pci_memaddr, 4096);
307 /* Check suspecious address */ 291 /* Check suspecious address */
308 pI20_Regs = (I20_REGISTER_FILE *) (cs->hw.ax.base); 292 pI20_Regs = (I20_REGISTER_FILE *) (cs->hw.ax.base);
@@ -317,11 +301,7 @@ setup_bkm_a4t(struct IsdnCard *card)
317 cs->hw.ax.jade_adr = cs->hw.ax.base + PO_OFFSET; 301 cs->hw.ax.jade_adr = cs->hw.ax.base + PO_OFFSET;
318 cs->hw.ax.isac_ale = GCS_1; 302 cs->hw.ax.isac_ale = GCS_1;
319 cs->hw.ax.jade_ale = GCS_3; 303 cs->hw.ax.jade_ale = GCS_3;
320#else 304
321 printk(KERN_WARNING "HiSax: %s: NO_PCI_BIOS\n", CardType[card->typ]);
322 printk(KERN_WARNING "HiSax: %s: unable to configure\n", CardType[card->typ]);
323 return (0);
324#endif /* CONFIG_PCI */
325 printk(KERN_INFO "HiSax: %s: Card configured at 0x%lX IRQ %d\n", 305 printk(KERN_INFO "HiSax: %s: Card configured at 0x%lX IRQ %d\n",
326 CardType[card->typ], cs->hw.ax.base, cs->irq); 306 CardType[card->typ], cs->hw.ax.base, cs->irq);
327 307
@@ -339,5 +319,43 @@ setup_bkm_a4t(struct IsdnCard *card)
339 ISACVersion(cs, "Telekom A4T:"); 319 ISACVersion(cs, "Telekom A4T:");
340 /* Jade version */ 320 /* Jade version */
341 JadeVersion(cs, "Telekom A4T:"); 321 JadeVersion(cs, "Telekom A4T:");
322
342 return (1); 323 return (1);
343} 324}
325
326static struct pci_dev *dev_a4t __devinitdata = NULL;
327
328int __devinit
329setup_bkm_a4t(struct IsdnCard *card)
330{
331 struct IsdnCardState *cs = card->cs;
332 char tmp[64];
333 u_int pci_memaddr = 0, found = 0;
334 int ret;
335
336 strcpy(tmp, bkm_a4t_revision);
337 printk(KERN_INFO "HiSax: T-Berkom driver Rev. %s\n", HiSax_getrev(tmp));
338 if (cs->typ == ISDN_CTYPE_BKM_A4T) {
339 cs->subtyp = BKM_A4T;
340 } else
341 return (0);
342
343 while ((dev_a4t = pci_find_device(PCI_VENDOR_ID_ZORAN,
344 PCI_DEVICE_ID_ZORAN_36120, dev_a4t))) {
345 ret = a4t_pci_probe(dev_a4t, cs, &found, &pci_memaddr);
346 if (!ret)
347 return (0);
348 if (ret > 0)
349 break;
350 }
351 if (!found) {
352 printk(KERN_WARNING "HiSax: %s: Card not found\n", CardType[card->typ]);
353 return (0);
354 }
355 if (!pci_memaddr) {
356 printk(KERN_WARNING "HiSax: %s: No Memory base address\n", CardType[card->typ]);
357 return (0);
358 }
359
360 return a4t_cs_init(card, cs, pci_memaddr);
361}
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index a43162c2ef15..5f7907e57090 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -847,95 +847,10 @@ static int init_card(struct IsdnCardState *cs)
847 return 3; 847 return 3;
848} 848}
849 849
850static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockowner) 850static int hisax_cs_setup_card(struct IsdnCard *card)
851{ 851{
852 int ret = 0; 852 int ret;
853 struct IsdnCard *card = cards + cardnr;
854 struct IsdnCardState *cs;
855 853
856 cs = kzalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
857 if (!cs) {
858 printk(KERN_WARNING
859 "HiSax: No memory for IsdnCardState(card %d)\n",
860 cardnr + 1);
861 goto out;
862 }
863 card->cs = cs;
864 spin_lock_init(&cs->statlock);
865 spin_lock_init(&cs->lock);
866 cs->chanlimit = 2; /* maximum B-channel number */
867 cs->logecho = 0; /* No echo logging */
868 cs->cardnr = cardnr;
869 cs->debug = L1_DEB_WARN;
870 cs->HW_Flags = 0;
871 cs->busy_flag = busy_flag;
872 cs->irq_flags = I4L_IRQ_FLAG;
873#if TEI_PER_CARD
874 if (card->protocol == ISDN_PTYPE_NI1)
875 test_and_set_bit(FLG_TWO_DCHAN, &cs->HW_Flags);
876#else
877 test_and_set_bit(FLG_TWO_DCHAN, &cs->HW_Flags);
878#endif
879 cs->protocol = card->protocol;
880
881 if (card->typ <= 0 || card->typ > ISDN_CTYPE_COUNT) {
882 printk(KERN_WARNING
883 "HiSax: Card Type %d out of range\n", card->typ);
884 goto outf_cs;
885 }
886 if (!(cs->dlog = kmalloc(MAX_DLOG_SPACE, GFP_ATOMIC))) {
887 printk(KERN_WARNING
888 "HiSax: No memory for dlog(card %d)\n", cardnr + 1);
889 goto outf_cs;
890 }
891 if (!(cs->status_buf = kmalloc(HISAX_STATUS_BUFSIZE, GFP_ATOMIC))) {
892 printk(KERN_WARNING
893 "HiSax: No memory for status_buf(card %d)\n",
894 cardnr + 1);
895 goto outf_dlog;
896 }
897 cs->stlist = NULL;
898 cs->status_read = cs->status_buf;
899 cs->status_write = cs->status_buf;
900 cs->status_end = cs->status_buf + HISAX_STATUS_BUFSIZE - 1;
901 cs->typ = card->typ;
902#ifdef MODULE
903 cs->iif.owner = lockowner;
904#endif
905 strcpy(cs->iif.id, id);
906 cs->iif.channels = 2;
907 cs->iif.maxbufsize = MAX_DATA_SIZE;
908 cs->iif.hl_hdrlen = MAX_HEADER_LEN;
909 cs->iif.features =
910 ISDN_FEATURE_L2_X75I |
911 ISDN_FEATURE_L2_HDLC |
912 ISDN_FEATURE_L2_HDLC_56K |
913 ISDN_FEATURE_L2_TRANS |
914 ISDN_FEATURE_L3_TRANS |
915#ifdef CONFIG_HISAX_1TR6
916 ISDN_FEATURE_P_1TR6 |
917#endif
918#ifdef CONFIG_HISAX_EURO
919 ISDN_FEATURE_P_EURO |
920#endif
921#ifdef CONFIG_HISAX_NI1
922 ISDN_FEATURE_P_NI1 |
923#endif
924 0;
925
926 cs->iif.command = HiSax_command;
927 cs->iif.writecmd = NULL;
928 cs->iif.writebuf_skb = HiSax_writebuf_skb;
929 cs->iif.readstat = HiSax_readstatus;
930 register_isdn(&cs->iif);
931 cs->myid = cs->iif.channels;
932 printk(KERN_INFO
933 "HiSax: Card %d Protocol %s Id=%s (%d)\n", cardnr + 1,
934 (card->protocol == ISDN_PTYPE_1TR6) ? "1TR6" :
935 (card->protocol == ISDN_PTYPE_EURO) ? "EDSS1" :
936 (card->protocol == ISDN_PTYPE_LEASED) ? "LEASED" :
937 (card->protocol == ISDN_PTYPE_NI1) ? "NI1" :
938 "NONE", cs->iif.id, cs->myid);
939 switch (card->typ) { 854 switch (card->typ) {
940#if CARD_TELES0 855#if CARD_TELES0
941 case ISDN_CTYPE_16_0: 856 case ISDN_CTYPE_16_0:
@@ -1094,13 +1009,115 @@ static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockow
1094 printk(KERN_WARNING 1009 printk(KERN_WARNING
1095 "HiSax: Support for %s Card not selected\n", 1010 "HiSax: Support for %s Card not selected\n",
1096 CardType[card->typ]); 1011 CardType[card->typ]);
1097 ll_unload(cs); 1012 ret = 0;
1013 break;
1014 }
1015
1016 return ret;
1017}
1018
1019static int hisax_cs_new(int cardnr, char *id, struct IsdnCard *card,
1020 struct IsdnCardState **cs_out, int *busy_flag,
1021 struct module *lockowner)
1022{
1023 struct IsdnCardState *cs;
1024
1025 *cs_out = NULL;
1026
1027 cs = kzalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
1028 if (!cs) {
1029 printk(KERN_WARNING
1030 "HiSax: No memory for IsdnCardState(card %d)\n",
1031 cardnr + 1);
1032 goto out;
1033 }
1034 card->cs = cs;
1035 spin_lock_init(&cs->statlock);
1036 spin_lock_init(&cs->lock);
1037 cs->chanlimit = 2; /* maximum B-channel number */
1038 cs->logecho = 0; /* No echo logging */
1039 cs->cardnr = cardnr;
1040 cs->debug = L1_DEB_WARN;
1041 cs->HW_Flags = 0;
1042 cs->busy_flag = busy_flag;
1043 cs->irq_flags = I4L_IRQ_FLAG;
1044#if TEI_PER_CARD
1045 if (card->protocol == ISDN_PTYPE_NI1)
1046 test_and_set_bit(FLG_TWO_DCHAN, &cs->HW_Flags);
1047#else
1048 test_and_set_bit(FLG_TWO_DCHAN, &cs->HW_Flags);
1049#endif
1050 cs->protocol = card->protocol;
1051
1052 if (card->typ <= 0 || card->typ > ISDN_CTYPE_COUNT) {
1053 printk(KERN_WARNING
1054 "HiSax: Card Type %d out of range\n", card->typ);
1098 goto outf_cs; 1055 goto outf_cs;
1099 } 1056 }
1100 if (!ret) { 1057 if (!(cs->dlog = kmalloc(MAX_DLOG_SPACE, GFP_ATOMIC))) {
1101 ll_unload(cs); 1058 printk(KERN_WARNING
1059 "HiSax: No memory for dlog(card %d)\n", cardnr + 1);
1102 goto outf_cs; 1060 goto outf_cs;
1103 } 1061 }
1062 if (!(cs->status_buf = kmalloc(HISAX_STATUS_BUFSIZE, GFP_ATOMIC))) {
1063 printk(KERN_WARNING
1064 "HiSax: No memory for status_buf(card %d)\n",
1065 cardnr + 1);
1066 goto outf_dlog;
1067 }
1068 cs->stlist = NULL;
1069 cs->status_read = cs->status_buf;
1070 cs->status_write = cs->status_buf;
1071 cs->status_end = cs->status_buf + HISAX_STATUS_BUFSIZE - 1;
1072 cs->typ = card->typ;
1073#ifdef MODULE
1074 cs->iif.owner = lockowner;
1075#endif
1076 strcpy(cs->iif.id, id);
1077 cs->iif.channels = 2;
1078 cs->iif.maxbufsize = MAX_DATA_SIZE;
1079 cs->iif.hl_hdrlen = MAX_HEADER_LEN;
1080 cs->iif.features =
1081 ISDN_FEATURE_L2_X75I |
1082 ISDN_FEATURE_L2_HDLC |
1083 ISDN_FEATURE_L2_HDLC_56K |
1084 ISDN_FEATURE_L2_TRANS |
1085 ISDN_FEATURE_L3_TRANS |
1086#ifdef CONFIG_HISAX_1TR6
1087 ISDN_FEATURE_P_1TR6 |
1088#endif
1089#ifdef CONFIG_HISAX_EURO
1090 ISDN_FEATURE_P_EURO |
1091#endif
1092#ifdef CONFIG_HISAX_NI1
1093 ISDN_FEATURE_P_NI1 |
1094#endif
1095 0;
1096
1097 cs->iif.command = HiSax_command;
1098 cs->iif.writecmd = NULL;
1099 cs->iif.writebuf_skb = HiSax_writebuf_skb;
1100 cs->iif.readstat = HiSax_readstatus;
1101 register_isdn(&cs->iif);
1102 cs->myid = cs->iif.channels;
1103
1104 *cs_out = cs;
1105 return 1; /* success */
1106
1107outf_dlog:
1108 kfree(cs->dlog);
1109outf_cs:
1110 kfree(cs);
1111 card->cs = NULL;
1112out:
1113 return 0; /* error */
1114}
1115
1116static int hisax_cs_setup(int cardnr, struct IsdnCard *card,
1117 struct IsdnCardState *cs)
1118{
1119 int ret;
1120
1104 if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_ATOMIC))) { 1121 if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_ATOMIC))) {
1105 printk(KERN_WARNING "HiSax: No memory for isac rcvbuf\n"); 1122 printk(KERN_WARNING "HiSax: No memory for isac rcvbuf\n");
1106 ll_unload(cs); 1123 ll_unload(cs);
@@ -1143,11 +1160,41 @@ static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockow
1143 if (!test_bit(HW_ISAR, &cs->HW_Flags)) 1160 if (!test_bit(HW_ISAR, &cs->HW_Flags))
1144 ll_run(cs, 0); 1161 ll_run(cs, 0);
1145 1162
1146 ret = 1; 1163 return 1;
1164
1165outf_cs:
1166 kfree(cs);
1167 card->cs = NULL;
1168 return ret;
1169}
1170
1171static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockowner)
1172{
1173 int ret;
1174 struct IsdnCard *card = cards + cardnr;
1175 struct IsdnCardState *cs;
1176
1177 ret = hisax_cs_new(cardnr, id, card, &cs, busy_flag, lockowner);
1178 if (!ret)
1179 return 0;
1180
1181 printk(KERN_INFO
1182 "HiSax: Card %d Protocol %s Id=%s (%d)\n", cardnr + 1,
1183 (card->protocol == ISDN_PTYPE_1TR6) ? "1TR6" :
1184 (card->protocol == ISDN_PTYPE_EURO) ? "EDSS1" :
1185 (card->protocol == ISDN_PTYPE_LEASED) ? "LEASED" :
1186 (card->protocol == ISDN_PTYPE_NI1) ? "NI1" :
1187 "NONE", cs->iif.id, cs->myid);
1188
1189 ret = hisax_cs_setup_card(card);
1190 if (!ret) {
1191 ll_unload(cs);
1192 goto outf_cs;
1193 }
1194
1195 ret = hisax_cs_setup(cardnr, card, cs);
1147 goto out; 1196 goto out;
1148 1197
1149 outf_dlog:
1150 kfree(cs->dlog);
1151 outf_cs: 1198 outf_cs:
1152 kfree(cs); 1199 kfree(cs);
1153 card->cs = NULL; 1200 card->cs = NULL;
diff --git a/drivers/isdn/hisax/enternow_pci.c b/drivers/isdn/hisax/enternow_pci.c
index b45de9d408d1..b73027ff50e8 100644
--- a/drivers/isdn/hisax/enternow_pci.c
+++ b/drivers/isdn/hisax/enternow_pci.c
@@ -300,98 +300,72 @@ enpci_interrupt(int intno, void *dev_id)
300 return IRQ_HANDLED; 300 return IRQ_HANDLED;
301} 301}
302 302
303 303static int __devinit en_pci_probe(struct pci_dev *dev_netjet,
304static struct pci_dev *dev_netjet __devinitdata = NULL; 304 struct IsdnCardState *cs)
305
306/* called by config.c */
307int __devinit
308setup_enternow_pci(struct IsdnCard *card)
309{ 305{
310 int bytecnt; 306 if (pci_enable_device(dev_netjet))
311 struct IsdnCardState *cs = card->cs;
312 char tmp[64];
313
314#ifdef CONFIG_PCI
315#ifdef __BIG_ENDIAN
316#error "not running on big endian machines now"
317#endif
318 strcpy(tmp, enternow_pci_rev);
319 printk(KERN_INFO "HiSax: Formula-n Europe AG enter:now ISDN PCI driver Rev. %s\n", HiSax_getrev(tmp));
320 if (cs->typ != ISDN_CTYPE_ENTERNOW)
321 return(0); 307 return(0);
322 test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags); 308 cs->irq = dev_netjet->irq;
323 309 if (!cs->irq) {
324 for ( ;; ) 310 printk(KERN_WARNING "enter:now PCI: No IRQ for PCI card found\n");
325 { 311 return(0);
326 if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET, 312 }
327 PCI_DEVICE_ID_TIGERJET_300, dev_netjet))) { 313 cs->hw.njet.base = pci_resource_start(dev_netjet, 0);
328 if (pci_enable_device(dev_netjet)) 314 if (!cs->hw.njet.base) {
329 return(0); 315 printk(KERN_WARNING "enter:now PCI: No IO-Adr for PCI card found\n");
330 cs->irq = dev_netjet->irq; 316 return(0);
331 if (!cs->irq) { 317 }
332 printk(KERN_WARNING "enter:now PCI: No IRQ for PCI card found\n"); 318 /* checks Sub-Vendor ID because system crashes with Traverse-Card */
333 return(0); 319 if ((dev_netjet->subsystem_vendor != 0x55) ||
334 } 320 (dev_netjet->subsystem_device != 0x02)) {
335 cs->hw.njet.base = pci_resource_start(dev_netjet, 0); 321 printk(KERN_WARNING "enter:now: You tried to load this driver with an incompatible TigerJet-card\n");
336 if (!cs->hw.njet.base) { 322 printk(KERN_WARNING "Use type=20 for Traverse NetJet PCI Card.\n");
337 printk(KERN_WARNING "enter:now PCI: No IO-Adr for PCI card found\n"); 323 return(0);
338 return(0); 324 }
339 }
340 /* checks Sub-Vendor ID because system crashes with Traverse-Card */
341 if ((dev_netjet->subsystem_vendor != 0x55) ||
342 (dev_netjet->subsystem_device != 0x02)) {
343 printk(KERN_WARNING "enter:now: You tried to load this driver with an incompatible TigerJet-card\n");
344 printk(KERN_WARNING "Use type=20 for Traverse NetJet PCI Card.\n");
345 return(0);
346 }
347 } else {
348 printk(KERN_WARNING "enter:now PCI: No PCI card found\n");
349 return(0);
350 }
351
352 cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA;
353 cs->hw.njet.isac = cs->hw.njet.base + 0xC0; // Fenster zum AMD
354
355 /* Reset an */
356 cs->hw.njet.ctrl_reg = 0x07; // geändert von 0xff
357 outb(cs->hw.njet.ctrl_reg, cs->hw.njet.base + NETJET_CTRL);
358 /* 20 ms Pause */
359 mdelay(20);
360 325
361 cs->hw.njet.ctrl_reg = 0x30; /* Reset Off and status read clear */ 326 return(1);
362 outb(cs->hw.njet.ctrl_reg, cs->hw.njet.base + NETJET_CTRL); 327}
363 mdelay(10);
364 328
365 cs->hw.njet.auxd = 0x00; // war 0xc0 329static void __devinit en_cs_init(struct IsdnCard *card,
366 cs->hw.njet.dmactrl = 0; 330 struct IsdnCardState *cs)
331{
332 cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA;
333 cs->hw.njet.isac = cs->hw.njet.base + 0xC0; // Fenster zum AMD
367 334
368 outb(~TJ_AMD_IRQ, cs->hw.njet.base + NETJET_AUXCTRL); 335 /* Reset an */
369 outb(TJ_AMD_IRQ, cs->hw.njet.base + NETJET_IRQMASK1); 336 cs->hw.njet.ctrl_reg = 0x07; // geändert von 0xff
370 outb(cs->hw.njet.auxd, cs->hw.njet.auxa); 337 outb(cs->hw.njet.ctrl_reg, cs->hw.njet.base + NETJET_CTRL);
338 /* 20 ms Pause */
339 mdelay(20);
371 340
372 break; 341 cs->hw.njet.ctrl_reg = 0x30; /* Reset Off and status read clear */
373 } 342 outb(cs->hw.njet.ctrl_reg, cs->hw.njet.base + NETJET_CTRL);
374#else 343 mdelay(10);
375 344
376 printk(KERN_WARNING "enter:now PCI: NO_PCI_BIOS\n"); 345 cs->hw.njet.auxd = 0x00; // war 0xc0
377 printk(KERN_WARNING "enter:now PCI: unable to config Formula-n enter:now ISDN PCI ab\n"); 346 cs->hw.njet.dmactrl = 0;
378 return (0);
379 347
380#endif /* CONFIG_PCI */ 348 outb(~TJ_AMD_IRQ, cs->hw.njet.base + NETJET_AUXCTRL);
349 outb(TJ_AMD_IRQ, cs->hw.njet.base + NETJET_IRQMASK1);
350 outb(cs->hw.njet.auxd, cs->hw.njet.auxa);
351}
381 352
382 bytecnt = 256; 353static int __devinit en_cs_init_rest(struct IsdnCard *card,
354 struct IsdnCardState *cs)
355{
356 const int bytecnt = 256;
383 357
384 printk(KERN_INFO 358 printk(KERN_INFO
385 "enter:now PCI: PCI card configured at 0x%lx IRQ %d\n", 359 "enter:now PCI: PCI card configured at 0x%lx IRQ %d\n",
386 cs->hw.njet.base, cs->irq); 360 cs->hw.njet.base, cs->irq);
387 if (!request_region(cs->hw.njet.base, bytecnt, "Fn_ISDN")) { 361 if (!request_region(cs->hw.njet.base, bytecnt, "Fn_ISDN")) {
388 printk(KERN_WARNING 362 printk(KERN_WARNING
389 "HiSax: %s config port %lx-%lx already in use\n", 363 "HiSax: enter:now config port %lx-%lx already in use\n",
390 CardType[card->typ], 364 cs->hw.njet.base,
391 cs->hw.njet.base, 365 cs->hw.njet.base + bytecnt);
392 cs->hw.njet.base + bytecnt);
393 return (0); 366 return (0);
394 } 367 }
368
395 setup_Amd7930(cs); 369 setup_Amd7930(cs);
396 cs->hw.njet.last_is0 = 0; 370 cs->hw.njet.last_is0 = 0;
397 /* macro rByteAMD */ 371 /* macro rByteAMD */
@@ -407,5 +381,44 @@ setup_enternow_pci(struct IsdnCard *card)
407 cs->irq_func = &enpci_interrupt; 381 cs->irq_func = &enpci_interrupt;
408 cs->irq_flags |= IRQF_SHARED; 382 cs->irq_flags |= IRQF_SHARED;
409 383
410 return (1); 384 return (1);
385}
386
387static struct pci_dev *dev_netjet __devinitdata = NULL;
388
389/* called by config.c */
390int __devinit
391setup_enternow_pci(struct IsdnCard *card)
392{
393 int ret;
394 struct IsdnCardState *cs = card->cs;
395 char tmp[64];
396
397#ifdef __BIG_ENDIAN
398#error "not running on big endian machines now"
399#endif
400
401 strcpy(tmp, enternow_pci_rev);
402 printk(KERN_INFO "HiSax: Formula-n Europe AG enter:now ISDN PCI driver Rev. %s\n", HiSax_getrev(tmp));
403 if (cs->typ != ISDN_CTYPE_ENTERNOW)
404 return(0);
405 test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
406
407 for ( ;; )
408 {
409 if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
410 PCI_DEVICE_ID_TIGERJET_300, dev_netjet))) {
411 ret = en_pci_probe(dev_netjet, cs);
412 if (!ret)
413 return(0);
414 } else {
415 printk(KERN_WARNING "enter:now PCI: No PCI card found\n");
416 return(0);
417 }
418
419 en_cs_init(card, cs);
420 break;
421 }
422
423 return en_cs_init_rest(card, cs);
411} 424}
diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
index 8a48a3ce0a55..077080aca799 100644
--- a/drivers/isdn/hisax/hfc_pci.c
+++ b/drivers/isdn/hisax/hfc_pci.c
@@ -6,7 +6,7 @@
6 * based on existing driver for CCD hfc ISA cards 6 * based on existing driver for CCD hfc ISA cards
7 * Copyright by Werner Cornelius <werner@isdn4linux.de> 7 * Copyright by Werner Cornelius <werner@isdn4linux.de>
8 * by Karsten Keil <keil@isdn4linux.de> 8 * by Karsten Keil <keil@isdn4linux.de>
9 * 9 *
10 * This software may be used and distributed according to the terms 10 * This software may be used and distributed according to the terms
11 * of the GNU General Public License, incorporated herein by reference. 11 * of the GNU General Public License, incorporated herein by reference.
12 * 12 *
@@ -67,8 +67,6 @@ static const PCI_ENTRY id_list[] =
67}; 67};
68 68
69 69
70#ifdef CONFIG_PCI
71
72/******************************************/ 70/******************************************/
73/* free hardware resources used by driver */ 71/* free hardware resources used by driver */
74/******************************************/ 72/******************************************/
@@ -237,7 +235,7 @@ static void hfcpci_clear_fifo_rx(struct IsdnCardState *cs, int fifo)
237 if (fifo_state) 235 if (fifo_state)
238 cs->hw.hfcpci.fifo_en |= fifo_state; 236 cs->hw.hfcpci.fifo_en |= fifo_state;
239 Write_hfc(cs, HFCPCI_FIFO_EN, cs->hw.hfcpci.fifo_en); 237 Write_hfc(cs, HFCPCI_FIFO_EN, cs->hw.hfcpci.fifo_en);
240} 238}
241 239
242/***************************************/ 240/***************************************/
243/* clear the desired B-channel tx fifo */ 241/* clear the desired B-channel tx fifo */
@@ -263,7 +261,7 @@ static void hfcpci_clear_fifo_tx(struct IsdnCardState *cs, int fifo)
263 if (fifo_state) 261 if (fifo_state)
264 cs->hw.hfcpci.fifo_en |= fifo_state; 262 cs->hw.hfcpci.fifo_en |= fifo_state;
265 Write_hfc(cs, HFCPCI_FIFO_EN, cs->hw.hfcpci.fifo_en); 263 Write_hfc(cs, HFCPCI_FIFO_EN, cs->hw.hfcpci.fifo_en);
266} 264}
267 265
268/*********************************************/ 266/*********************************************/
269/* read a complete B-frame out of the buffer */ 267/* read a complete B-frame out of the buffer */
@@ -511,7 +509,6 @@ main_rec_hfcpci(struct BCState *bcs)
511 test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags); 509 test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
512 if (count && receive) 510 if (count && receive)
513 goto Begin; 511 goto Begin;
514 return;
515} 512}
516 513
517/**************************/ 514/**************************/
@@ -582,7 +579,6 @@ hfcpci_fill_dfifo(struct IsdnCardState *cs)
582 579
583 dev_kfree_skb_any(cs->tx_skb); 580 dev_kfree_skb_any(cs->tx_skb);
584 cs->tx_skb = NULL; 581 cs->tx_skb = NULL;
585 return;
586} 582}
587 583
588/**************************/ 584/**************************/
@@ -729,7 +725,6 @@ hfcpci_fill_fifo(struct BCState *bcs)
729 dev_kfree_skb_any(bcs->tx_skb); 725 dev_kfree_skb_any(bcs->tx_skb);
730 bcs->tx_skb = NULL; 726 bcs->tx_skb = NULL;
731 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); 727 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
732 return;
733} 728}
734 729
735/**********************************************/ 730/**********************************************/
@@ -924,7 +919,6 @@ receive_emsg(struct IsdnCardState *cs)
924 test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags); 919 test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
925 if (count && receive) 920 if (count && receive)
926 goto Begin; 921 goto Begin;
927 return;
928} /* receive_emsg */ 922} /* receive_emsg */
929 923
930/*********************/ 924/*********************/
@@ -1350,13 +1344,13 @@ mode_hfcpci(struct BCState *bcs, int mode, int bc)
1350 cs->hw.hfcpci.sctrl_r |= SCTRL_B1_ENA; 1344 cs->hw.hfcpci.sctrl_r |= SCTRL_B1_ENA;
1351 } 1345 }
1352 if (fifo2) { 1346 if (fifo2) {
1353 cs->hw.hfcpci.last_bfifo_cnt[1] = 0; 1347 cs->hw.hfcpci.last_bfifo_cnt[1] = 0;
1354 cs->hw.hfcpci.fifo_en |= HFCPCI_FIFOEN_B2; 1348 cs->hw.hfcpci.fifo_en |= HFCPCI_FIFOEN_B2;
1355 cs->hw.hfcpci.int_m1 |= (HFCPCI_INTS_B2TRANS + HFCPCI_INTS_B2REC); 1349 cs->hw.hfcpci.int_m1 |= (HFCPCI_INTS_B2TRANS + HFCPCI_INTS_B2REC);
1356 cs->hw.hfcpci.ctmt &= ~2; 1350 cs->hw.hfcpci.ctmt &= ~2;
1357 cs->hw.hfcpci.conn &= ~0x18; 1351 cs->hw.hfcpci.conn &= ~0x18;
1358 } else { 1352 } else {
1359 cs->hw.hfcpci.last_bfifo_cnt[0] = 0; 1353 cs->hw.hfcpci.last_bfifo_cnt[0] = 0;
1360 cs->hw.hfcpci.fifo_en |= HFCPCI_FIFOEN_B1; 1354 cs->hw.hfcpci.fifo_en |= HFCPCI_FIFOEN_B1;
1361 cs->hw.hfcpci.int_m1 |= (HFCPCI_INTS_B1TRANS + HFCPCI_INTS_B1REC); 1355 cs->hw.hfcpci.int_m1 |= (HFCPCI_INTS_B1TRANS + HFCPCI_INTS_B1REC);
1362 cs->hw.hfcpci.ctmt &= ~1; 1356 cs->hw.hfcpci.ctmt &= ~1;
@@ -1642,8 +1636,6 @@ hfcpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
1642/* this variable is used as card index when more than one cards are present */ 1636/* this variable is used as card index when more than one cards are present */
1643static struct pci_dev *dev_hfcpci __devinitdata = NULL; 1637static struct pci_dev *dev_hfcpci __devinitdata = NULL;
1644 1638
1645#endif /* CONFIG_PCI */
1646
1647int __devinit 1639int __devinit
1648setup_hfcpci(struct IsdnCard *card) 1640setup_hfcpci(struct IsdnCard *card)
1649{ 1641{
@@ -1656,96 +1648,99 @@ setup_hfcpci(struct IsdnCard *card)
1656#ifdef __BIG_ENDIAN 1648#ifdef __BIG_ENDIAN
1657#error "not running on big endian machines now" 1649#error "not running on big endian machines now"
1658#endif 1650#endif
1651
1659 strcpy(tmp, hfcpci_revision); 1652 strcpy(tmp, hfcpci_revision);
1660 printk(KERN_INFO "HiSax: HFC-PCI driver Rev. %s\n", HiSax_getrev(tmp)); 1653 printk(KERN_INFO "HiSax: HFC-PCI driver Rev. %s\n", HiSax_getrev(tmp));
1661#ifdef CONFIG_PCI 1654
1662 cs->hw.hfcpci.int_s1 = 0; 1655 cs->hw.hfcpci.int_s1 = 0;
1663 cs->dc.hfcpci.ph_state = 0; 1656 cs->dc.hfcpci.ph_state = 0;
1664 cs->hw.hfcpci.fifo = 255; 1657 cs->hw.hfcpci.fifo = 255;
1665 if (cs->typ == ISDN_CTYPE_HFC_PCI) { 1658 if (cs->typ != ISDN_CTYPE_HFC_PCI)
1666 i = 0; 1659 return(0);
1667 while (id_list[i].vendor_id) { 1660
1668 tmp_hfcpci = pci_find_device(id_list[i].vendor_id, 1661 i = 0;
1669 id_list[i].device_id, 1662 while (id_list[i].vendor_id) {
1670 dev_hfcpci); 1663 tmp_hfcpci = pci_find_device(id_list[i].vendor_id,
1671 i++; 1664 id_list[i].device_id,
1672 if (tmp_hfcpci) { 1665 dev_hfcpci);
1673 if (pci_enable_device(tmp_hfcpci)) 1666 i++;
1674 continue;
1675 pci_set_master(tmp_hfcpci);
1676 if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK)))
1677 continue;
1678 else
1679 break;
1680 }
1681 }
1682
1683 if (tmp_hfcpci) { 1667 if (tmp_hfcpci) {
1684 i--; 1668 if (pci_enable_device(tmp_hfcpci))
1685 dev_hfcpci = tmp_hfcpci; /* old device */ 1669 continue;
1686 cs->hw.hfcpci.dev = dev_hfcpci; 1670 pci_set_master(tmp_hfcpci);
1687 cs->irq = dev_hfcpci->irq; 1671 if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK)))
1688 if (!cs->irq) { 1672 continue;
1689 printk(KERN_WARNING "HFC-PCI: No IRQ for PCI card found\n"); 1673 else
1690 return (0); 1674 break;
1691 }
1692 cs->hw.hfcpci.pci_io = (char *)(unsigned long)dev_hfcpci->resource[1].start;
1693 printk(KERN_INFO "HiSax: HFC-PCI card manufacturer: %s card name: %s\n", id_list[i].vendor_name, id_list[i].card_name);
1694 } else {
1695 printk(KERN_WARNING "HFC-PCI: No PCI card found\n");
1696 return (0);
1697 }
1698 if (!cs->hw.hfcpci.pci_io) {
1699 printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n");
1700 return (0);
1701 }
1702 /* Allocate memory for FIFOS */
1703 /* Because the HFC-PCI needs a 32K physical alignment, we */
1704 /* need to allocate the double mem and align the address */
1705 if (!(cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) {
1706 printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n");
1707 return 0;
1708 } 1675 }
1709 cs->hw.hfcpci.fifos = (void *) 1676 }
1710 (((ulong) cs->hw.hfcpci.share_start) & ~0x7FFF) + 0x8000; 1677
1711 pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u_int) virt_to_bus(cs->hw.hfcpci.fifos)); 1678 if (!tmp_hfcpci) {
1712 cs->hw.hfcpci.pci_io = ioremap((ulong) cs->hw.hfcpci.pci_io, 256); 1679 printk(KERN_WARNING "HFC-PCI: No PCI card found\n");
1713 printk(KERN_INFO 1680 return (0);
1714 "HFC-PCI: defined at mem %p fifo %p(%#x) IRQ %d HZ %d\n", 1681 }
1715 cs->hw.hfcpci.pci_io, 1682
1716 cs->hw.hfcpci.fifos, 1683 i--;
1717 (u_int) virt_to_bus(cs->hw.hfcpci.fifos), 1684 dev_hfcpci = tmp_hfcpci; /* old device */
1718 cs->irq, HZ); 1685 cs->hw.hfcpci.dev = dev_hfcpci;
1719 spin_lock_irqsave(&cs->lock, flags); 1686 cs->irq = dev_hfcpci->irq;
1720 pci_write_config_word(cs->hw.hfcpci.dev, PCI_COMMAND, PCI_ENA_MEMIO); /* enable memory mapped ports, disable busmaster */ 1687 if (!cs->irq) {
1721 cs->hw.hfcpci.int_m2 = 0; /* disable alle interrupts */ 1688 printk(KERN_WARNING "HFC-PCI: No IRQ for PCI card found\n");
1722 cs->hw.hfcpci.int_m1 = 0; 1689 return (0);
1723 Write_hfc(cs, HFCPCI_INT_M1, cs->hw.hfcpci.int_m1); 1690 }
1724 Write_hfc(cs, HFCPCI_INT_M2, cs->hw.hfcpci.int_m2); 1691 cs->hw.hfcpci.pci_io = (char *)(unsigned long)dev_hfcpci->resource[1].start;
1725 /* At this point the needed PCI config is done */ 1692 printk(KERN_INFO "HiSax: HFC-PCI card manufacturer: %s card name: %s\n", id_list[i].vendor_name, id_list[i].card_name);
1726 /* fifos are still not enabled */ 1693
1727 INIT_WORK(&cs->tqueue, hfcpci_bh); 1694 if (!cs->hw.hfcpci.pci_io) {
1728 cs->setstack_d = setstack_hfcpci; 1695 printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n");
1729 cs->BC_Send_Data = &hfcpci_send_data; 1696 return (0);
1730 cs->readisac = NULL; 1697 }
1731 cs->writeisac = NULL; 1698 /* Allocate memory for FIFOS */
1732 cs->readisacfifo = NULL; 1699 /* Because the HFC-PCI needs a 32K physical alignment, we */
1733 cs->writeisacfifo = NULL; 1700 /* need to allocate the double mem and align the address */
1734 cs->BC_Read_Reg = NULL; 1701 if (!(cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) {
1735 cs->BC_Write_Reg = NULL; 1702 printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n");
1736 cs->irq_func = &hfcpci_interrupt; 1703 return 0;
1737 cs->irq_flags |= IRQF_SHARED; 1704 }
1738 cs->hw.hfcpci.timer.function = (void *) hfcpci_Timer; 1705 cs->hw.hfcpci.fifos = (void *)
1739 cs->hw.hfcpci.timer.data = (long) cs; 1706 (((ulong) cs->hw.hfcpci.share_start) & ~0x7FFF) + 0x8000;
1740 init_timer(&cs->hw.hfcpci.timer); 1707 pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u_int) virt_to_bus(cs->hw.hfcpci.fifos));
1741 cs->cardmsg = &hfcpci_card_msg; 1708 cs->hw.hfcpci.pci_io = ioremap((ulong) cs->hw.hfcpci.pci_io, 256);
1742 cs->auxcmd = &hfcpci_auxcmd; 1709 printk(KERN_INFO
1743 spin_unlock_irqrestore(&cs->lock, flags); 1710 "HFC-PCI: defined at mem %p fifo %p(%#x) IRQ %d HZ %d\n",
1744 return (1); 1711 cs->hw.hfcpci.pci_io,
1745 } else 1712 cs->hw.hfcpci.fifos,
1746 return (0); /* no valid card type */ 1713 (u_int) virt_to_bus(cs->hw.hfcpci.fifos),
1747#else 1714 cs->irq, HZ);
1748 printk(KERN_WARNING "HFC-PCI: NO_PCI_BIOS\n"); 1715
1749 return (0); 1716 spin_lock_irqsave(&cs->lock, flags);
1750#endif /* CONFIG_PCI */ 1717
1718 pci_write_config_word(cs->hw.hfcpci.dev, PCI_COMMAND, PCI_ENA_MEMIO); /* enable memory mapped ports, disable busmaster */
1719 cs->hw.hfcpci.int_m2 = 0; /* disable alle interrupts */
1720 cs->hw.hfcpci.int_m1 = 0;
1721 Write_hfc(cs, HFCPCI_INT_M1, cs->hw.hfcpci.int_m1);
1722 Write_hfc(cs, HFCPCI_INT_M2, cs->hw.hfcpci.int_m2);
1723 /* At this point the needed PCI config is done */
1724 /* fifos are still not enabled */
1725
1726 INIT_WORK(&cs->tqueue, hfcpci_bh);
1727 cs->setstack_d = setstack_hfcpci;
1728 cs->BC_Send_Data = &hfcpci_send_data;
1729 cs->readisac = NULL;
1730 cs->writeisac = NULL;
1731 cs->readisacfifo = NULL;
1732 cs->writeisacfifo = NULL;
1733 cs->BC_Read_Reg = NULL;
1734 cs->BC_Write_Reg = NULL;
1735 cs->irq_func = &hfcpci_interrupt;
1736 cs->irq_flags |= IRQF_SHARED;
1737 cs->hw.hfcpci.timer.function = (void *) hfcpci_Timer;
1738 cs->hw.hfcpci.timer.data = (long) cs;
1739 init_timer(&cs->hw.hfcpci.timer);
1740 cs->cardmsg = &hfcpci_card_msg;
1741 cs->auxcmd = &hfcpci_auxcmd;
1742
1743 spin_unlock_irqrestore(&cs->lock, flags);
1744
1745 return (1);
1751} 1746}
diff --git a/drivers/isdn/hisax/nj_s.c b/drivers/isdn/hisax/nj_s.c
index c09ffb135330..fa2db87667c8 100644
--- a/drivers/isdn/hisax/nj_s.c
+++ b/drivers/isdn/hisax/nj_s.c
@@ -148,107 +148,87 @@ NETjet_S_card_msg(struct IsdnCardState *cs, int mt, void *arg)
148 return(0); 148 return(0);
149} 149}
150 150
151static struct pci_dev *dev_netjet __devinitdata = NULL; 151static int __devinit njs_pci_probe(struct pci_dev *dev_netjet,
152 152 struct IsdnCardState *cs)
153int __devinit
154setup_netjet_s(struct IsdnCard *card)
155{ 153{
156 int bytecnt,cfg; 154 int cfg;
157 struct IsdnCardState *cs = card->cs;
158 char tmp[64];
159 155
160#ifdef __BIG_ENDIAN 156 if (pci_enable_device(dev_netjet))
161#error "not running on big endian machines now"
162#endif
163 strcpy(tmp, NETjet_S_revision);
164 printk(KERN_INFO "HiSax: Traverse Tech. NETjet-S driver Rev. %s\n", HiSax_getrev(tmp));
165 if (cs->typ != ISDN_CTYPE_NETJET_S)
166 return(0); 157 return(0);
167 test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags); 158 pci_set_master(dev_netjet);
159 cs->irq = dev_netjet->irq;
160 if (!cs->irq) {
161 printk(KERN_WARNING "NETjet-S: No IRQ for PCI card found\n");
162 return(0);
163 }
164 cs->hw.njet.base = pci_resource_start(dev_netjet, 0);
165 if (!cs->hw.njet.base) {
166 printk(KERN_WARNING "NETjet-S: No IO-Adr for PCI card found\n");
167 return(0);
168 }
169 /* the TJ300 and TJ320 must be detected, the IRQ handling is different
170 * unfortunatly the chips use the same device ID, but the TJ320 has
171 * the bit20 in status PCI cfg register set
172 */
173 pci_read_config_dword(dev_netjet, 0x04, &cfg);
174 if (cfg & 0x00100000)
175 cs->subtyp = 1; /* TJ320 */
176 else
177 cs->subtyp = 0; /* TJ300 */
178 /* 2001/10/04 Christoph Ersfeld, Formula-n Europe AG www.formula-n.com */
179 if ((dev_netjet->subsystem_vendor == 0x55) &&
180 (dev_netjet->subsystem_device == 0x02)) {
181 printk(KERN_WARNING "Netjet: You tried to load this driver with an incompatible TigerJet-card\n");
182 printk(KERN_WARNING "Use type=41 for Formula-n enter:now ISDN PCI and compatible\n");
183 return(0);
184 }
185 /* end new code */
168 186
169#ifdef CONFIG_PCI 187 return(1);
188}
170 189
171 for ( ;; ) 190static int __devinit njs_cs_init(struct IsdnCard *card,
172 { 191 struct IsdnCardState *cs)
173 if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET, 192{
174 PCI_DEVICE_ID_TIGERJET_300, dev_netjet))) {
175 if (pci_enable_device(dev_netjet))
176 return(0);
177 pci_set_master(dev_netjet);
178 cs->irq = dev_netjet->irq;
179 if (!cs->irq) {
180 printk(KERN_WARNING "NETjet-S: No IRQ for PCI card found\n");
181 return(0);
182 }
183 cs->hw.njet.base = pci_resource_start(dev_netjet, 0);
184 if (!cs->hw.njet.base) {
185 printk(KERN_WARNING "NETjet-S: No IO-Adr for PCI card found\n");
186 return(0);
187 }
188 /* the TJ300 and TJ320 must be detected, the IRQ handling is different
189 * unfortunatly the chips use the same device ID, but the TJ320 has
190 * the bit20 in status PCI cfg register set
191 */
192 pci_read_config_dword(dev_netjet, 0x04, &cfg);
193 if (cfg & 0x00100000)
194 cs->subtyp = 1; /* TJ320 */
195 else
196 cs->subtyp = 0; /* TJ300 */
197 /* 2001/10/04 Christoph Ersfeld, Formula-n Europe AG www.formula-n.com */
198 if ((dev_netjet->subsystem_vendor == 0x55) &&
199 (dev_netjet->subsystem_device == 0x02)) {
200 printk(KERN_WARNING "Netjet: You tried to load this driver with an incompatible TigerJet-card\n");
201 printk(KERN_WARNING "Use type=41 for Formula-n enter:now ISDN PCI and compatible\n");
202 return(0);
203 }
204 /* end new code */
205 } else {
206 printk(KERN_WARNING "NETjet-S: No PCI card found\n");
207 return(0);
208 }
209 193
210 cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA; 194 cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA;
211 cs->hw.njet.isac = cs->hw.njet.base | NETJET_ISAC_OFF; 195 cs->hw.njet.isac = cs->hw.njet.base | NETJET_ISAC_OFF;
212 196
213 cs->hw.njet.ctrl_reg = 0xff; /* Reset On */ 197 cs->hw.njet.ctrl_reg = 0xff; /* Reset On */
214 byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); 198 byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
215 mdelay(10); 199 mdelay(10);
216 200
217 cs->hw.njet.ctrl_reg = 0x00; /* Reset Off and status read clear */ 201 cs->hw.njet.ctrl_reg = 0x00; /* Reset Off and status read clear */
218 byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); 202 byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
219 mdelay(10); 203 mdelay(10);
220 204
221 cs->hw.njet.auxd = 0xC0; 205 cs->hw.njet.auxd = 0xC0;
222 cs->hw.njet.dmactrl = 0; 206 cs->hw.njet.dmactrl = 0;
223 207
224 byteout(cs->hw.njet.base + NETJET_AUXCTRL, ~NETJET_ISACIRQ); 208 byteout(cs->hw.njet.base + NETJET_AUXCTRL, ~NETJET_ISACIRQ);
225 byteout(cs->hw.njet.base + NETJET_IRQMASK1, NETJET_ISACIRQ); 209 byteout(cs->hw.njet.base + NETJET_IRQMASK1, NETJET_ISACIRQ);
226 byteout(cs->hw.njet.auxa, cs->hw.njet.auxd); 210 byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
227 211
228 switch ( ( ( NETjet_ReadIC( cs, ISAC_RBCH ) >> 5 ) & 3 ) ) 212 switch ( ( ( NETjet_ReadIC( cs, ISAC_RBCH ) >> 5 ) & 3 ) )
229 { 213 {
230 case 0 : 214 case 0 :
231 break; 215 return 1; /* end loop */
232 216
233 case 3 : 217 case 3 :
234 printk( KERN_WARNING "NETjet-S: NETspider-U PCI card found\n" ); 218 printk( KERN_WARNING "NETjet-S: NETspider-U PCI card found\n" );
235 continue; 219 return -1; /* continue looping */
236 220
237 default : 221 default :
238 printk( KERN_WARNING "NETjet-S: No PCI card found\n" ); 222 printk( KERN_WARNING "NETjet-S: No PCI card found\n" );
239 return 0; 223 return 0; /* end loop & function */
240 }
241 break;
242 } 224 }
243#else 225 return 1; /* end loop */
244 226}
245 printk(KERN_WARNING "NETjet-S: NO_PCI_BIOS\n");
246 printk(KERN_WARNING "NETjet-S: unable to config NETJET-S PCI\n");
247 return (0);
248
249#endif /* CONFIG_PCI */
250 227
251 bytecnt = 256; 228static int __devinit njs_cs_init_rest(struct IsdnCard *card,
229 struct IsdnCardState *cs)
230{
231 const int bytecnt = 256;
252 232
253 printk(KERN_INFO 233 printk(KERN_INFO
254 "NETjet-S: %s card configured at %#lx IRQ %d\n", 234 "NETjet-S: %s card configured at %#lx IRQ %d\n",
@@ -273,5 +253,47 @@ setup_netjet_s(struct IsdnCard *card)
273 cs->irq_func = &netjet_s_interrupt; 253 cs->irq_func = &netjet_s_interrupt;
274 cs->irq_flags |= IRQF_SHARED; 254 cs->irq_flags |= IRQF_SHARED;
275 ISACVersion(cs, "NETjet-S:"); 255 ISACVersion(cs, "NETjet-S:");
256
276 return (1); 257 return (1);
277} 258}
259
260static struct pci_dev *dev_netjet __devinitdata = NULL;
261
262int __devinit
263setup_netjet_s(struct IsdnCard *card)
264{
265 int ret;
266 struct IsdnCardState *cs = card->cs;
267 char tmp[64];
268
269#ifdef __BIG_ENDIAN
270#error "not running on big endian machines now"
271#endif
272 strcpy(tmp, NETjet_S_revision);
273 printk(KERN_INFO "HiSax: Traverse Tech. NETjet-S driver Rev. %s\n", HiSax_getrev(tmp));
274 if (cs->typ != ISDN_CTYPE_NETJET_S)
275 return(0);
276 test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
277
278 for ( ;; )
279 {
280 if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
281 PCI_DEVICE_ID_TIGERJET_300, dev_netjet))) {
282 ret = njs_pci_probe(dev_netjet, cs);
283 if (!ret)
284 return(0);
285 } else {
286 printk(KERN_WARNING "NETjet-S: No PCI card found\n");
287 return(0);
288 }
289
290 ret = njs_cs_init(card, cs);
291 if (!ret)
292 return(0);
293 if (ret > 0)
294 break;
295 /* otherwise, ret < 0, continue looping */
296 }
297
298 return njs_cs_init_rest(card, cs);
299}
diff --git a/drivers/isdn/hisax/nj_u.c b/drivers/isdn/hisax/nj_u.c
index 8202cf34ecae..f017d3816b1d 100644
--- a/drivers/isdn/hisax/nj_u.c
+++ b/drivers/isdn/hisax/nj_u.c
@@ -128,93 +128,69 @@ NETjet_U_card_msg(struct IsdnCardState *cs, int mt, void *arg)
128 return(0); 128 return(0);
129} 129}
130 130
131static struct pci_dev *dev_netjet __devinitdata = NULL; 131static int __devinit nju_pci_probe(struct pci_dev *dev_netjet,
132 132 struct IsdnCardState *cs)
133int __devinit
134setup_netjet_u(struct IsdnCard *card)
135{ 133{
136 int bytecnt; 134 if (pci_enable_device(dev_netjet))
137 struct IsdnCardState *cs = card->cs;
138 char tmp[64];
139#ifdef CONFIG_PCI
140#endif
141#ifdef __BIG_ENDIAN
142#error "not running on big endian machines now"
143#endif
144 strcpy(tmp, NETjet_U_revision);
145 printk(KERN_INFO "HiSax: Traverse Tech. NETspider-U driver Rev. %s\n", HiSax_getrev(tmp));
146 if (cs->typ != ISDN_CTYPE_NETJET_U)
147 return(0); 135 return(0);
148 test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags); 136 pci_set_master(dev_netjet);
149 137 cs->irq = dev_netjet->irq;
150#ifdef CONFIG_PCI 138 if (!cs->irq) {
139 printk(KERN_WARNING "NETspider-U: No IRQ for PCI card found\n");
140 return(0);
141 }
142 cs->hw.njet.base = pci_resource_start(dev_netjet, 0);
143 if (!cs->hw.njet.base) {
144 printk(KERN_WARNING "NETspider-U: No IO-Adr for PCI card found\n");
145 return(0);
146 }
151 147
152 for ( ;; ) 148 return (1);
153 { 149}
154 if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
155 PCI_DEVICE_ID_TIGERJET_300, dev_netjet))) {
156 if (pci_enable_device(dev_netjet))
157 return(0);
158 pci_set_master(dev_netjet);
159 cs->irq = dev_netjet->irq;
160 if (!cs->irq) {
161 printk(KERN_WARNING "NETspider-U: No IRQ for PCI card found\n");
162 return(0);
163 }
164 cs->hw.njet.base = pci_resource_start(dev_netjet, 0);
165 if (!cs->hw.njet.base) {
166 printk(KERN_WARNING "NETspider-U: No IO-Adr for PCI card found\n");
167 return(0);
168 }
169 } else {
170 printk(KERN_WARNING "NETspider-U: No PCI card found\n");
171 return(0);
172 }
173 150
174 cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA; 151static int __devinit nju_cs_init(struct IsdnCard *card,
175 cs->hw.njet.isac = cs->hw.njet.base | NETJET_ISAC_OFF; 152 struct IsdnCardState *cs)
176 mdelay(10); 153{
154 cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA;
155 cs->hw.njet.isac = cs->hw.njet.base | NETJET_ISAC_OFF;
156 mdelay(10);
177 157
178 cs->hw.njet.ctrl_reg = 0xff; /* Reset On */ 158 cs->hw.njet.ctrl_reg = 0xff; /* Reset On */
179 byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); 159 byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
180 mdelay(10); 160 mdelay(10);
181 161
182 cs->hw.njet.ctrl_reg = 0x00; /* Reset Off and status read clear */ 162 cs->hw.njet.ctrl_reg = 0x00; /* Reset Off and status read clear */
183 byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); 163 byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
184 mdelay(10); 164 mdelay(10);
185 165
186 cs->hw.njet.auxd = 0xC0; 166 cs->hw.njet.auxd = 0xC0;
187 cs->hw.njet.dmactrl = 0; 167 cs->hw.njet.dmactrl = 0;
188 168
189 byteout(cs->hw.njet.auxa, 0); 169 byteout(cs->hw.njet.auxa, 0);
190 byteout(cs->hw.njet.base + NETJET_AUXCTRL, ~NETJET_ISACIRQ); 170 byteout(cs->hw.njet.base + NETJET_AUXCTRL, ~NETJET_ISACIRQ);
191 byteout(cs->hw.njet.base + NETJET_IRQMASK1, NETJET_ISACIRQ); 171 byteout(cs->hw.njet.base + NETJET_IRQMASK1, NETJET_ISACIRQ);
192 byteout(cs->hw.njet.auxa, cs->hw.njet.auxd); 172 byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
193 173
194 switch ( ( ( NETjet_ReadIC( cs, ICC_RBCH ) >> 5 ) & 3 ) ) 174 switch ( ( ( NETjet_ReadIC( cs, ICC_RBCH ) >> 5 ) & 3 ) )
195 { 175 {
196 case 3 : 176 case 3 :
197 break; 177 return 1; /* end loop */
198 178
199 case 0 : 179 case 0 :
200 printk( KERN_WARNING "NETspider-U: NETjet-S PCI card found\n" ); 180 printk( KERN_WARNING "NETspider-U: NETjet-S PCI card found\n" );
201 continue; 181 return -1; /* continue looping */
202 182
203 default : 183 default :
204 printk( KERN_WARNING "NETspider-U: No PCI card found\n" ); 184 printk( KERN_WARNING "NETspider-U: No PCI card found\n" );
205 return 0; 185 return 0; /* end loop & function */
206 }
207 break;
208 } 186 }
209#else 187 return 1; /* end loop */
210 188}
211 printk(KERN_WARNING "NETspider-U: NO_PCI_BIOS\n");
212 printk(KERN_WARNING "NETspider-U: unable to config NETspider-U PCI\n");
213 return (0);
214
215#endif /* CONFIG_PCI */
216 189
217 bytecnt = 256; 190static int __devinit nju_cs_init_rest(struct IsdnCard *card,
191 struct IsdnCardState *cs)
192{
193 const int bytecnt = 256;
218 194
219 printk(KERN_INFO 195 printk(KERN_INFO
220 "NETspider-U: PCI card configured at %#lx IRQ %d\n", 196 "NETspider-U: PCI card configured at %#lx IRQ %d\n",
@@ -239,5 +215,48 @@ setup_netjet_u(struct IsdnCard *card)
239 cs->irq_func = &netjet_u_interrupt; 215 cs->irq_func = &netjet_u_interrupt;
240 cs->irq_flags |= IRQF_SHARED; 216 cs->irq_flags |= IRQF_SHARED;
241 ICCVersion(cs, "NETspider-U:"); 217 ICCVersion(cs, "NETspider-U:");
218
242 return (1); 219 return (1);
243} 220}
221
222static struct pci_dev *dev_netjet __devinitdata = NULL;
223
224int __devinit
225setup_netjet_u(struct IsdnCard *card)
226{
227 int ret;
228 struct IsdnCardState *cs = card->cs;
229 char tmp[64];
230
231#ifdef __BIG_ENDIAN
232#error "not running on big endian machines now"
233#endif
234
235 strcpy(tmp, NETjet_U_revision);
236 printk(KERN_INFO "HiSax: Traverse Tech. NETspider-U driver Rev. %s\n", HiSax_getrev(tmp));
237 if (cs->typ != ISDN_CTYPE_NETJET_U)
238 return(0);
239 test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
240
241 for ( ;; )
242 {
243 if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
244 PCI_DEVICE_ID_TIGERJET_300, dev_netjet))) {
245 ret = nju_pci_probe(dev_netjet, cs);
246 if (!ret)
247 return(0);
248 } else {
249 printk(KERN_WARNING "NETspider-U: No PCI card found\n");
250 return(0);
251 }
252
253 ret = nju_cs_init(card, cs);
254 if (!ret)
255 return (0);
256 if (ret > 0)
257 break;
258 /* ret < 0 == continue looping */
259 }
260
261 return nju_cs_init_rest(card, cs);
262}