[svn-commits] rmeyerriecks: linux/trunk r8274 - in /linux/trunk/drivers/dahdi: wct4xxp/ wct...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Mar 8 10:49:54 CST 2010


Author: rmeyerriecks
Date: Mon Mar  8 10:49:50 2010
New Revision: 8274

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8274
Log:
wct4xxp: wcte12xp: Revised maint clearing

Looping modes are now mutually exclusive. If two looping modes are enabled
simultaneously it tends to hose up our framer chip. Now, all looping modes are
cleared in the driver before any are set.

Modified:
    linux/trunk/drivers/dahdi/wct4xxp/base.c
    linux/trunk/drivers/dahdi/wcte12xp/base.c

Modified: linux/trunk/drivers/dahdi/wct4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wct4xxp/base.c?view=diff&rev=8274&r1=8273&r2=8274
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/base.c Mon Mar  8 10:49:50 2010
@@ -412,6 +412,7 @@
 static int t4_shutdown(struct dahdi_span *span);
 static int t4_rbsbits(struct dahdi_chan *chan, int bits);
 static int t4_maint(struct dahdi_span *span, int cmd);
+static int t4_clear_maint(struct dahdi_span *span);
 static int t4_reset_counters(struct dahdi_span *span);
 #ifdef SUPPORT_GEN1
 static int t4_reset_dma(struct t4 *wc);
@@ -1435,78 +1436,61 @@
 	if (ts->spantype == TYPE_E1) {
 		switch(cmd) {
 		case DAHDI_MAINT_NONE:
-			printk(KERN_INFO "XXX Turn off local and remote loops E1 XXX\n");
+			dev_info(&wc->dev->dev, "Clearing all maint modes\n");
 			break;
 		case DAHDI_MAINT_LOCALLOOP:
-			printk(KERN_INFO "XXX Turn on local loopback E1 XXX\n");
-			break;
 		case DAHDI_MAINT_REMOTELOOP:
-			printk(KERN_INFO "XXX Turn on remote loopback E1 XXX\n");
-			break;
 		case DAHDI_MAINT_LOOPUP:
-			printk(KERN_INFO "XXX Send loopup code E1 XXX\n");
-			break;
 		case DAHDI_MAINT_LOOPDOWN:
-			printk(KERN_INFO "XXX Send loopdown code E1 XXX\n");
-			break;
 		case DAHDI_MAINT_LOOPSTOP:
-			printk(KERN_INFO "XXX Stop sending loop codes E1 XXX\n");
+			dev_info(&wc->dev->dev,
+					"Looping not supported in E1 mode\n");
 			break;
 		default:
-			printk(KERN_NOTICE "TE%dXXP: Unknown E1 maint command: %d\n", wc->numspans, cmd);
+			dev_info(&wc->dev->dev,
+					"Unknown E1 maint command: %d\n", cmd);
 			break;
 		}
 	} else {
 		switch(cmd) {
 		case DAHDI_MAINT_NONE:
-			dev_info(&wc->dev->dev, "Turning off all looping\n");
-
-			reg = t4_framer_in(wc, span->offset, LIM0_T);
-			t4_framer_out(wc, span->offset,
-				      LIM0_T, (reg & ~LIM0_LL));
-
-			reg = t4_framer_in(wc, span->offset, LIM1_T);
-			t4_framer_out(wc, span->offset, LIM1_T,
-				      (reg & ~LIM1_RL));
-
-			reg = t4_framer_in(wc, span->offset, LCR1_T);
-			t4_framer_out(wc, span->offset, LCR1_T,
-					(reg & ~(XPRBS | EPRM)));
-
-			reg = t4_framer_in(wc, span->offset, FMR2_T);
-			t4_framer_out(wc, span->offset, FMR2_T,
-					(reg & ~FMR2_PLB));
-
-			span->mainttimer = 0;
+			dev_info(&wc->dev->dev, "Clearing all maint modes\n");
+			t4_clear_maint(span);
 			break;
 		case DAHDI_MAINT_LOCALLOOP:
 			dev_info(&wc->dev->dev,
 				 "Turning on local loopback\n");
+			t4_clear_maint(span);
 			reg = t4_framer_in(wc, span->offset, LIM0_T);
 			t4_framer_out(wc, span->offset, LIM0_T, (reg|LIM0_LL));
 			break;
 		case DAHDI_MAINT_NETWORKLINELOOP:
 			dev_info(&wc->dev->dev,
 				 "Turning on network line loopback\n");
+			t4_clear_maint(span);
 			reg = t4_framer_in(wc, span->offset, LIM1_T);
 			t4_framer_out(wc, span->offset, LIM1_T, (reg|LIM1_RL));
 			break;
 		case DAHDI_MAINT_NETWORKPAYLOADLOOP:
 			dev_info(&wc->dev->dev,
 				 "Turning on network payload loopback\n");
+			t4_clear_maint(span);
 			reg = t4_framer_in(wc, span->offset, FMR2_T);
 			t4_framer_out(wc, span->offset, FMR2_T, (reg|FMR2_PLB));
 			break;
 		case DAHDI_MAINT_LOOPUP:
 			dev_info(&wc->dev->dev, "Transmitting loopup code\n");
+			t4_clear_maint(span);
 			t4_framer_out(wc, span->offset, 0x21, 0x50);
 			break;
 		case DAHDI_MAINT_LOOPDOWN:
 			dev_info(&wc->dev->dev, "Transmitting loopdown code\n");
+			t4_clear_maint(span);
 			t4_framer_out(wc, span->offset, 0x21, 0x60);
 			break;
 		case DAHDI_MAINT_LOOPSTOP:
 			dev_info(&wc->dev->dev, "Transmitting loopstop code\n");
+			t4_clear_maint(span);
 			t4_framer_out(wc, span->offset, 0x21, 0x40);
 			break;
 		case DAHDI_MAINT_FAS_DEFECT:
@@ -1555,6 +1539,33 @@
 			break;
 	   }
     }
+	return 0;
+}
+
+static int t4_clear_maint(struct dahdi_span *span)
+{
+	struct t4_span *ts = span->pvt;
+	struct t4 *wc = ts->owner;
+	unsigned int reg;
+
+	/* Clear local loop */
+	reg = t4_framer_in(wc, span->offset, LIM0_T);
+	t4_framer_out(wc, span->offset, LIM0_T, (reg & ~LIM0_LL));
+
+	/* Clear Remote Loop */
+	reg = t4_framer_in(wc, span->offset, LIM1_T);
+	t4_framer_out(wc, span->offset, LIM1_T, (reg & ~LIM1_RL));
+
+	/* Clear Remote Payload Loop */
+	reg = t4_framer_in(wc, span->offset, FMR2_T);
+	t4_framer_out(wc, span->offset, FMR2_T, (reg & ~FMR2_PLB));
+
+	/* Clear PRBS */
+	reg = t4_framer_in(wc, span->offset, LCR1_T);
+	t4_framer_out(wc, span->offset, LCR1_T, (reg & ~(XPRBS | EPRM)));
+
+	span->mainttimer = 0;
+
 	return 0;
 }
 

Modified: linux/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=8274&r1=8273&r2=8274
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Mon Mar  8 10:49:50 2010
@@ -76,6 +76,7 @@
 static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
 			   struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
 static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
+static int t1xxp_clear_maint(struct dahdi_span *span);
 
 static const struct dahdi_echocan_features vpm150m_ec_features = {
 	.NLP_automatic = 1,
@@ -1109,23 +1110,14 @@
 	if (wc->spantype == TYPE_E1) {
 		switch (cmd) {
 		case DAHDI_MAINT_NONE:
-			t1_info(wc, "XXX Turn off local and remote "
-				"loops E1 XXX\n");
+			t1_info(wc, "Clearing all maint modes\n");
 			break;
 		case DAHDI_MAINT_LOCALLOOP:
-			t1_info(wc, "XXX Turn on local loopback E1 XXX\n");
-			break;
 		case DAHDI_MAINT_REMOTELOOP:
-			t1_info(wc, "XXX Turn on remote loopback E1 XXX\n");
-			break;
 		case DAHDI_MAINT_LOOPUP:
-			t1_info(wc, "XXX Send loopup code E1 XXX\n");
-			break;
 		case DAHDI_MAINT_LOOPDOWN:
-			t1_info(wc, "XXX Send loopdown code E1 XXX\n");
-			break;
 		case DAHDI_MAINT_LOOPSTOP:
-			t1_info(wc, "XXX Stop sending loop codes E1 XXX\n");
+			t1_info(wc, "Looping not supported in E1 mode\n");
 			break;
 		default:
 			t1_info(wc, "Unknown E1 maint command: %d\n", cmd);
@@ -1134,33 +1126,33 @@
 	} else {
 		switch (cmd) {
 		case DAHDI_MAINT_NONE:
- 			/* Turn off local loop */
- 			reg = t1_getreg(wc, LIM0);
- 			t1_setreg(wc, LIM0, reg & ~LIM0_LL);
- 
- 			/* Turn off remote loop & jitter attenuator */
- 			reg = t1_getreg(wc, LIM1);
- 			t1_setreg(wc, LIM1, reg & ~(LIM1_RL | LIM1_JATT));
+			t1xxp_clear_maint(span);
 			break;
 		case DAHDI_MAINT_LOCALLOOP:
+			t1xxp_clear_maint(span);
  			reg = t1_getreg(wc, LIM0);
  			t1_setreg(wc, LIM0, reg | LIM0_LL);
 			break;
  		case DAHDI_MAINT_NETWORKLINELOOP:
+			t1xxp_clear_maint(span);
  			reg = t1_getreg(wc, LIM1);
  			t1_setreg(wc, LIM1, reg | LIM1_RL);
  			break;
  		case DAHDI_MAINT_NETWORKPAYLOADLOOP:
+			t1xxp_clear_maint(span);
  			reg = t1_getreg(wc, LIM1);
  			t1_setreg(wc, LIM1, reg | (LIM1_RL | LIM1_JATT));
 			break;
 		case DAHDI_MAINT_LOOPUP:
+			t1xxp_clear_maint(span);
 			t1_setreg(wc, 0x21, 0x50);
 			break;
 		case DAHDI_MAINT_LOOPDOWN:
+			t1xxp_clear_maint(span);
 			t1_setreg(wc, 0x21, 0x60);
 			break;
 		case DAHDI_MAINT_LOOPSTOP:
+			t1xxp_clear_maint(span);
 			t1_setreg(wc, 0x21, 0x40);
 			break;
 		default:
@@ -1171,6 +1163,22 @@
 
 	return 0;
 }
+
+static int t1xxp_clear_maint(struct dahdi_span *span)
+{
+	struct t1 *wc = span->pvt;
+	int reg = 0;
+
+	/* Turn off local loop */
+	reg = t1_getreg(wc, LIM0);
+	t1_setreg(wc, LIM0, reg & ~LIM0_LL);
+
+	/* Turn off remote loop & jitter attenuator */
+	reg = t1_getreg(wc, LIM1);
+	t1_setreg(wc, LIM1, reg & ~(LIM1_RL | LIM1_JATT));
+	return 0;
+}
+
 
 static int t1xxp_open(struct dahdi_chan *chan)
 {




More information about the svn-commits mailing list