diff options
Diffstat (limited to 'wct4xxp.c')
-rwxr-xr-x | wct4xxp.c | 36 |
1 files changed, 22 insertions, 14 deletions
@@ -637,16 +637,28 @@ static void __t4_set_timing_source(struct t4 *wc, int unit) { unsigned int timing; int x; - timing = 0x34; /* CMR1: RCLK unit, 8.192 Mhz TCLK, RCLK is 8.192 Mhz */ - if ((unit > -1) && (unit < 4)) { - timing |= (unit << 6); - for (x=0;x<4;x++) /* set all 4 receive reference clocks to unit */ - __t4_framer_out(wc, x, 0x44, timing); - __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29)); + if (unit != wc->syncsrc) { + timing = 0x34; /* CMR1: RCLK unit, 8.192 Mhz TCLK, RCLK is 8.192 Mhz */ + if ((unit > -1) && (unit < 4)) { + timing |= (unit << 6); + for (x=0;x<4;x++) /* set all 4 receive reference clocks to unit */ + __t4_framer_out(wc, x, 0x44, timing); + __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29)); + } else { + for (x=0;x<4;x++) /* set each receive reference clock to itself */ + __t4_framer_out(wc, x, 0x44, timing | (x << 6)); + __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); + } + wc->syncsrc = unit; + if ((unit < 0) || (unit > 3)) + unit = 0; + else + unit++; + for (x=0;x<4;x++) + wc->spans[x].syncsrc = unit; } else { - for (x=0;x<4;x++) /* set each receive reference clock to itself */ - __t4_framer_out(wc, x, 0x44, timing | (x << 6)); - __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); + if (debug) + printk("TE410P: Timing source already set to %d\n", unit); } #if 0 printk("wct4xxp: Timing source set to %d\n",unit); @@ -660,7 +672,7 @@ static void __t4_set_timing_source_auto(struct t4 *wc) for (x=0;x<4;x++) { if (wc->syncs[x]) { if ((wc->spans[wc->syncs[x] - 1].flags & ZT_FLAG_RUNNING) && - !(wc->spans[wc->syncs[x] - 1].alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_NOTOPEN) )) { + !(wc->spans[wc->syncs[x] - 1].alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE) )) { /* Valid timing sourc e*/ __t4_set_timing_source(wc, wc->syncs[x] - 1); return; @@ -1455,10 +1467,6 @@ static int __devinit t4_launch(struct t4 *wc) zt_unregister(&wc->spans[2]); return -1; } - if (debug) - printk("Setting timing source\n"); - if (debug) - printk("Timing source selected\n"); wc->checktiming = 1; spin_lock_irqsave(&wc->reglock, flags); __t4_set_timing_source(wc,4); |