[svn-commits] sruffell: branch linux/sruffell/dahdi-linux-parallelload r7366 - /linux/team/...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Oct 9 10:31:46 CDT 2009


Author: sruffell
Date: Fri Oct  9 10:31:36 2009
New Revision: 7366

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7366
Log:
wip: Parallel load the modules on an individual card.

Modified:
    linux/team/sruffell/dahdi-linux-parallelload/drivers/dahdi/wctdm24xxp/base.c
    linux/team/sruffell/dahdi-linux-parallelload/drivers/dahdi/wctdm24xxp/wctdm24xxp.h

Modified: linux/team/sruffell/dahdi-linux-parallelload/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-parallelload/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=7366&r1=7365&r2=7366
==============================================================================
--- linux/team/sruffell/dahdi-linux-parallelload/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-parallelload/drivers/dahdi/wctdm24xxp/base.c Fri Oct  9 10:31:36 2009
@@ -56,6 +56,7 @@
 #include <linux/async.h>
 #else
 #undef USE_ASYNC_INIT
+typedef u64 async_cookie_t;
 #endif
 
 #include <dahdi/kernel.h>
@@ -3555,6 +3556,122 @@
 	portconfig->EightSlotMask3 = 0x0000;
 }
 
+#ifdef USE_ASYNC_INIT
+static void wctdm_synchronize_cookie(struct wctdm *wc, async_cookie_t cookie)
+{
+	async_synchronize_cookie_domain(cookie, &wc->async_domain);
+}
+#else
+static void wctdm_synchronize_cookie(struct wctdm *wc, async_cookie_t cookie)
+{
+	wc; cookie;
+	return;
+}
+#endif
+
+static void __wctdm_locate_module(struct wctdm *wc, int x, async_cookie_t cookie)
+{
+	unsigned long flags;
+	int sane=0,ret=0,readi=0;
+
+retry:
+	/* Init with Auto Calibration */
+	if (!(ret = wctdm_init_proslic(wc, x, 0, 0, sane))) {
+		wc->cardflag |= (1 << x);
+		if (debug & DEBUG_CARD) {
+			readi = wctdm_getreg(wc,x,LOOP_I_LIMIT);
+			printk(KERN_DEBUG "Proslic module %d loop current is %dmA\n",x,
+				((readi*3)+20));
+		}
+		wctdm_synchronize_cookie(wc, cookie);
+		printk(KERN_INFO "Port %d: Installed -- AUTO FXS/DPO\n", x + 1);
+	} else {
+		if(ret!=-2) {
+			sane=1;
+			/* Init with Manual Calibration */
+			if (!wctdm_init_proslic(wc, x, 0, 1, sane)) {
+				wc->cardflag |= (1 << x);
+			if (debug & DEBUG_CARD) {
+				readi = wctdm_getreg(wc,x,LOOP_I_LIMIT);
+				printk(KERN_DEBUG "Proslic module %d loop current is %dmA\n",x,
+				       ((readi*3)+20));
+			}
+				wctdm_synchronize_cookie(wc, cookie);
+				printk(KERN_INFO "Port %d: Installed -- MANUAL FXS\n",x + 1);
+			} else {
+				printk(KERN_NOTICE "Port %d: FAILED FXS (%s)\n", x + 1, fxshonormode ? fxo_modes[_opermode].name : "FCC");
+				wc->chans[x]->sigcap = DAHDI_SIG_BROKEN | __DAHDI_SIG_FXO;
+			} 
+		} else if (!(ret = wctdm_init_voicedaa(wc, x, 0, 0, sane))) {
+			wc->cardflag |= (1 << x);
+			wctdm_synchronize_cookie(wc, cookie);
+			printk(KERN_INFO "Port %d: Installed -- AUTO FXO (%s mode)\n",x + 1, fxo_modes[_opermode].name);
+		} else if (!wctdm_init_qrvdri(wc,x)) {
+			wc->cardflag |= 1 << x;
+			wctdm_synchronize_cookie(wc, cookie);
+			printk(KERN_INFO "Port %d: Installed -- QRV DRI card\n",x + 1);
+		} else {
+			if ((wc->desc->ports != 24) &&
+			    ((x & 0x3) == 1) && !wc->altcs[x]) {
+				spin_lock_irqsave(&wc->reglock, flags);
+				wc->altcs[x] = 2;
+				if (wc->desc->ports == 4) {
+					wc->altcs[x+1] = 3;
+					wc->altcs[x+2] = 3;
+				}
+				wc->modtype[x] = MOD_TYPE_FXSINIT;
+				spin_unlock_irqrestore(&wc->reglock, flags);
+			
+				schluffen(&wc->regq);
+				schluffen(&wc->regq);
+				spin_lock_irqsave(&wc->reglock, flags);
+				wc->modtype[x] = MOD_TYPE_FXS;
+				spin_unlock_irqrestore(&wc->reglock, flags);
+				if (debug & DEBUG_CARD)
+					printk(KERN_DEBUG "Trying port %d with alternate chip select\n", x + 1);
+				goto retry;
+			} else {
+				wctdm_synchronize_cookie(wc, cookie);
+				printk(KERN_NOTICE "Port %d: Not installed\n", x + 1);
+				wc->modtype[x] = MOD_TYPE_NONE;
+				wc->cardflag |= (1 << x);
+			}
+		}
+	}
+}
+
+#ifdef USE_ASYNC_INIT
+struct locate_module_data {
+	struct wctdm *wc;
+	int module;
+};
+
+static void wctdm_locate_module_async(void *data, async_cookie_t cookie)
+{
+	struct locate_module_data *d = data;
+	__wctdm_locate_module(d->wc, d->module, cookie);
+	kfree(d);
+}
+
+static void wctdm_locate_module(struct wctdm *wc, int module)
+{
+	struct locate_module_data *dat = kmalloc(sizeof(*dat), GFP_KERNEL);
+	if (!dat) {
+		WARN_ON(1);
+		return;
+	}
+	dat->wc = wc;
+	dat->module = module;
+	async_schedule_domain(wctdm_locate_module_async, dat,
+			      &wc->async_domain);
+}
+#else
+static void wctdm_locate_module(struct wctdm *wc, int module)
+{
+	__wctdm_locate_module(wc, module, 0);
+}
+#endif
+
 static int wctdm_locate_modules(struct wctdm *wc)
 {
 	int x;
@@ -3589,71 +3706,8 @@
 	spin_unlock_irqrestore(&wc->reglock, flags);
 
 	/* Reset modules */
-	for (x=0;x<wc->cards;x++) {
-		int sane=0,ret=0,readi=0;
-retry:
-		if (voicebus_current_latency(wc->vb) > startinglatency) {
-			return -EAGAIN;
-		}
-		/* Init with Auto Calibration */
-		if (!(ret = wctdm_init_proslic(wc, x, 0, 0, sane))) {
-			wc->cardflag |= (1 << x);
-			if (debug & DEBUG_CARD) {
-				readi = wctdm_getreg(wc,x,LOOP_I_LIMIT);
-				printk(KERN_DEBUG "Proslic module %d loop current is %dmA\n",x,
-					((readi*3)+20));
-			}
-			printk(KERN_INFO "Port %d: Installed -- AUTO FXS/DPO\n", x + 1);
-		} else {
-			if(ret!=-2) {
-				sane=1;
-				/* Init with Manual Calibration */
-				if (!wctdm_init_proslic(wc, x, 0, 1, sane)) {
-					wc->cardflag |= (1 << x);
-                                if (debug & DEBUG_CARD) {
-                                        readi = wctdm_getreg(wc,x,LOOP_I_LIMIT);
-                                        printk(KERN_DEBUG "Proslic module %d loop current is %dmA\n",x,
-                                 	       ((readi*3)+20));
-                                }
-					printk(KERN_INFO "Port %d: Installed -- MANUAL FXS\n",x + 1);
-				} else {
-					printk(KERN_NOTICE "Port %d: FAILED FXS (%s)\n", x + 1, fxshonormode ? fxo_modes[_opermode].name : "FCC");
-					wc->chans[x]->sigcap = DAHDI_SIG_BROKEN | __DAHDI_SIG_FXO;
-				} 
-			} else if (!(ret = wctdm_init_voicedaa(wc, x, 0, 0, sane))) {
-				wc->cardflag |= (1 << x);
-				printk(KERN_INFO "Port %d: Installed -- AUTO FXO (%s mode)\n",x + 1, fxo_modes[_opermode].name);
- 			} else if (!wctdm_init_qrvdri(wc,x)) {
- 				wc->cardflag |= 1 << x;
- 				printk(KERN_INFO "Port %d: Installed -- QRV DRI card\n",x + 1);
-			} else {
-				if ((wc->desc->ports != 24) &&
-				    ((x & 0x3) == 1) && !wc->altcs[x]) {
-					spin_lock_irqsave(&wc->reglock, flags);
-					wc->altcs[x] = 2;
-					if (wc->desc->ports == 4) {
-						wc->altcs[x+1] = 3;
-						wc->altcs[x+2] = 3;
-					}
- 					wc->modtype[x] = MOD_TYPE_FXSINIT;
- 					spin_unlock_irqrestore(&wc->reglock, flags);
-				
- 					schluffen(&wc->regq);
- 					schluffen(&wc->regq);
- 					spin_lock_irqsave(&wc->reglock, flags);
- 					wc->modtype[x] = MOD_TYPE_FXS;
- 					spin_unlock_irqrestore(&wc->reglock, flags);
- 					if (debug & DEBUG_CARD)
- 						printk(KERN_DEBUG "Trying port %d with alternate chip select\n", x + 1);
- 					goto retry;
-				} else {
- 					printk(KERN_NOTICE "Port %d: Not installed\n", x + 1);
- 					wc->modtype[x] = MOD_TYPE_NONE;
- 					wc->cardflag |= (1 << x);
- 				}
-			}
-		}
-	}
+	for (x=0;x<wc->cards;x++)
+		wctdm_locate_module(wc, x);
 
 	if (!vpmsupport) {
 		printk(KERN_NOTICE "VPM: Support Disabled\n");
@@ -3753,6 +3807,7 @@
 
 	memset(wc, 0, sizeof(*wc));
 	wc->desc = (struct wctdm_desc *)ent->driver_data;
+	INIT_LIST_HEAD(&wc->async_domain);
 	spin_lock(&ifacelock);	
 	/* \todo this is a candidate for removal... */
 	for (i = 0; i < WC_MAX_IFACES; ++i) {

Modified: linux/team/sruffell/dahdi-linux-parallelload/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-parallelload/drivers/dahdi/wctdm24xxp/wctdm24xxp.h?view=diff&rev=7366&r1=7365&r2=7366
==============================================================================
--- linux/team/sruffell/dahdi-linux-parallelload/drivers/dahdi/wctdm24xxp/wctdm24xxp.h (original)
+++ linux/team/sruffell/dahdi-linux-parallelload/drivers/dahdi/wctdm24xxp/wctdm24xxp.h Fri Oct  9 10:31:36 2009
@@ -231,6 +231,7 @@
 	struct dahdi_chan *chans[NUM_CARDS];
 	struct dahdi_echocan_state *ec[NUM_CARDS];
 	int initialized;
+	struct list_head async_domain;
 };
 
 




More information about the svn-commits mailing list