diff options
-rwxr-xr-x | wct4xxp.c | 42 |
1 files changed, 24 insertions, 18 deletions
@@ -637,28 +637,32 @@ static void t4_set_timing_source(struct t4 *wc, int unit) int x; timing = 0x34; /* CMR1: RCLK unit, 8.192 Mhz TCLK, RCLK is 8.192 Mhz */ spin_lock_irqsave(&synclock, flags); - if ((unit > -1) && (unit < 4)) { - timing |= (unit << 6); - } else { - timing |= 0x1; /* Use TCLK timing */ - } - for (x=0;x<4;x++) - t4_framer_out(wc, x, 0x44, timing); - if ((unit > -1) && (unit < 4)) { - t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29)); - /* GPC1: Multiplex mode enabled, FSC is output, active low, RCLK from proper channel, */ - t4_framer_out(wc, 0, 0x85, 0xe0 | (unit << 2) | (unit)); - } else - t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); if (unit != wc->syncsrc) { + if ((unit > -1) && (unit < 4)) { + timing |= (unit << 6); + } else { + timing |= 0x1; /* Use TCLK timing */ + } + for (x=0;x<4;x++) + t4_framer_out(wc, x, 0x44, timing); + if ((unit > -1) && (unit < 4)) { + t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29)); + /* GPC1: Multiplex mode enabled, FSC is output, active low, RCLK from proper channel, */ + t4_framer_out(wc, 0, 0x85, 0xe0 | (unit << 2) | (unit)); + } else + t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); if ((unit > -1) && (unit < 4)) printk("TE410P: Timing from source %d\n", unit); else printk("TE410P: Timing from internal timer\n"); - } - wc->syncsrc = unit; - for (x=0;x<4;x++) - wc->spans[x].syncsrc = unit; + wc->syncsrc = unit; + if ((unit < 0) || (unit > 3)) + unit = 0; + else + unit++; + for (x=0;x<4;x++) + wc->spans[x].syncsrc = unit; + } spin_unlock_irqrestore(&synclock, flags); } @@ -873,6 +877,7 @@ static int t4_startup(struct zt_span *span) if (wc->syncs[1] == span->spanno) printk("SPAN %d: Secondary Sync Source\n",span->spanno); if (wc->syncs[2] == span->spanno) printk("SPAN %d: Tertiary Sync Source\n",span->spanno); if (wc->syncs[3] == span->spanno) printk("SPAN %d: Quaternary Sync Source\n",span->spanno); + t4_set_timing_source_auto(wc); return 0; } @@ -1187,6 +1192,8 @@ static void __t4_check_alarms(struct t4 *wc, int span) /* Assume no alarms */ alarms = 0; + + oldalarms = wc->spans[span].alarms; /* And consider only carrier alarms */ wc->spans[span].alarms &= (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_NOTOPEN); @@ -1291,7 +1298,6 @@ static void __t4_check_alarms(struct t4 *wc, int span) if (wc->spans[span].mainttimer || wc->spans[span].maintstat) alarms |= ZT_ALARM_LOOPBACK; - oldalarms = wc->spans[span].alarms; wc->spans[span].alarms = alarms; /* Re-check the timing source when we enter alarm */ if (!oldalarms && alarms) |