diff options
author | wmeadows <wmeadows@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2003-09-25 02:01:46 +0000 |
---|---|---|
committer | wmeadows <wmeadows@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2003-09-25 02:01:46 +0000 |
commit | 6e1cf4b8c302368831c356e188cdac5e345cb2fb (patch) | |
tree | 5064f354d45251656da5497f07427e91c01aa6f8 /wctdm.c | |
parent | 34d15e679fa190aa11ad038db032f42f0918c9fc (diff) |
Try Both Auto and Manual Calibration
Add sane and manual flag to init_proslic
Set RESET to low if module fails to load
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@246 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wctdm.c')
-rwxr-xr-x | wctdm.c | 74 |
1 files changed, 55 insertions, 19 deletions
@@ -179,7 +179,7 @@ struct wcfxs_desc { }; static struct wcfxs_desc wcfxs = { "Wildcard S400P Prototype", 0 }; -static struct wcfxs_desc wcfxse = { "Wildcard TDM400P REV E", 0 }; +static struct wcfxs_desc wcfxse = { "Wildcard TDM400P REV E/F", 0 }; static struct wcfxs *ifaces[WC_MAX_IFACES]; @@ -187,7 +187,7 @@ static void wcfxs_release(struct wcfxs *wc); static int debug = 0; -static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast); +static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast , int manual, int sane); static inline void wcfxs_transmitprep(struct wcfxs *wc, unsigned char ints) { @@ -512,7 +512,8 @@ static int wcfxs_verify_indirect_regs(struct wcfxs *wc, int card) static int wcfxs_proslic_insane(struct wcfxs *wc, int card) { - int blah; + int blah,insane_report; + insane_report=0; blah = wcfxs_getreg(wc, card, 0); if (debug) @@ -537,19 +538,22 @@ static int wcfxs_proslic_insane(struct wcfxs *wc, int card) if (blah != 0x2) { printk("ProSLIC on module %d insane (1) %d should be 2\n", card, blah); return -1; - } + } else if ( insane_report) + printk("ProSLIC on module %d Reg 8 Reads %d Expected is 0x2\n",card,blah); blah = wcfxs_getreg(wc, card, 64); if (blah != 0x0) { printk("ProSLIC on module %d insane (2)\n", card); return -1; - } + } else if ( insane_report) + printk("ProSLIC on module %d Reg 64 Reads %d Expected is 0x0\n",card,blah); blah = wcfxs_getreg(wc, card, 11); if (blah != 0x33) { printk("ProSLIC on module %d insane (3)\n", card); return -1; - } + } else if ( insane_report) + printk("ProSLIC on module %d Reg 11 Reads %d Expected is 0x33\n",card,blah); /* Just be sure it's setup right. */ wcfxs_setreg(wc, card, 30, 0); @@ -724,7 +728,7 @@ static int wcfxs_manual_calibrate(struct wcfxs *wc, int card){ return(0); } -#if 0 +#if 1 static int wcfxs_calibrate(struct wcfxs *wc, int card) { unsigned long origjiffies; @@ -754,7 +758,7 @@ static int wcfxs_calibrate(struct wcfxs *wc, int card) return 0; } #endif -static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast) +static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast, int manual, int sane) { unsigned short tmp[5]; @@ -764,8 +768,8 @@ static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast) wc->idletxhookstate [card] = 1; /* Sanity check the ProSLIC */ - if (wcfxs_proslic_insane(wc, card)) - return -1; + if (!sane && wcfxs_proslic_insane(wc, card)) + return -2; if (wcfxs_init_indirect_regs(wc, card)) { printk(KERN_INFO "Indirect Registers failed to initialize on module %d.\n", card); @@ -814,9 +818,25 @@ static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast) } #ifndef NO_CALIBRATION /* Perform calibration */ - if (wcfxs_manual_calibrate(wc, card)) { - printk("ProSlic died on Calibration (try -DNO_CALIBRATION in Makefile).\n"); - return -1; + if(manual) { + if (wcfxs_manual_calibrate(wc, card)) { + //printk("Proslic failed on Manual Calibration\n"); + if (wcfxs_manual_calibrate(wc, card)) { + printk("Proslic Failed on Second Attempt to Calibrate Manually. (Try -DNO_CALIBRATION in Makefile)\n"); + return -1; + } + printk("Proslic Passed Manual Calibration on Second Attempt\n"); + } + } + else { + if(wcfxs_calibrate(wc, card)) { + //printk("ProSlic died on Auto Calibration.\n"); + if (wcfxs_calibrate(wc, card)) { + printk("Proslic Failed on Second Attempt to Auto Calibrate\n"); + return -1; + } + printk("Proslic Passed Auto Calibration on Second Attempt\n"); + } } #endif @@ -891,7 +911,7 @@ static inline void wcfxs_check_hook(struct wcfxs *wc, int card) res = wcfxs_getreg(wc, card, 8); if (res) { printk("Ouch, part reset, quickly restoring reality (%d)\n", card); - wcfxs_init_proslic(wc, card, 1); + wcfxs_init_proslic(wc, card, 1, 0, 1); } else { res = wcfxs_getreg(wc, card, 64); if (!res && (res != wc->lasttxhook[card])) { @@ -1105,8 +1125,10 @@ static int wcfxs_hardware_init(struct wcfxs *wc) unsigned char x,y; int failed; - /* Check Freshmaker chip */ + /* Signal Reset */ outb(0x01, wc->ioaddr + WC_CNTL); + + /* Check Freshmaker chip */ x=inb(wc->ioaddr + WC_CNTL); ver = wcfxs_getcreg(wc, WC_VER); failed = 0; @@ -1177,11 +1199,20 @@ static int wcfxs_hardware_init(struct wcfxs *wc) while(jiffies - oldjiffies < (HZ / 4) + 1); for (x=0;x<wc->cards;x++) { - if (!wcfxs_init_proslic(wc, x, 0)) { - printk("Module %d: Initialized\n", x); + int sane=0,ret=0; + /* Init with Auto Calibration */ + if (!(ret=wcfxs_init_proslic(wc, x, 0, 0, sane))) { wc->cardflag |= (1 << x); - } else - printk("Module %d: Not installed\n", x); + printk("Module %d: Installed -- AUTO\n",x); + } else { + if(ret!=-2) sane=1; + /* Init with Manual Calibration */ + if (!wcfxs_init_proslic(wc, x, 0, 1, sane)) { + wc->cardflag |= (1 << x); + printk("Module %d: Installed -- MANUAL\n",x); + } else + printk("Module %d: Not installed\n", x); + } } /* Return error if nothing initialized okay. */ @@ -1311,6 +1342,11 @@ static int __devinit wcfxs_init_one(struct pci_dev *pdev, const struct pci_devic if (wcfxs_hardware_init(wc)) { + unsigned char x; + /* Set Reset Low */ + x=inb(wc->ioaddr + WC_CNTL); + outb((~0x1)&x, wc->ioaddr + WC_CNTL); + /* Free Resources */ free_irq(pdev->irq, wc); zt_unregister(&wc->span); if (wc->freeregion) |