diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/isdn/hisax/enternow_pci.c | 165 |
1 files changed, 89 insertions, 76 deletions
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 | 303 | static int __devinit en_pci_probe(struct pci_dev *dev_netjet, | |
304 | static struct pci_dev *dev_netjet __devinitdata = NULL; | 304 | struct IsdnCardState *cs) |
305 | |||
306 | /* called by config.c */ | ||
307 | int __devinit | ||
308 | setup_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 | 329 | static 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; | 353 | static 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 | |||
387 | static struct pci_dev *dev_netjet __devinitdata = NULL; | ||
388 | |||
389 | /* called by config.c */ | ||
390 | int __devinit | ||
391 | setup_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 | } |