[svn-commits] sruffell: linux/trunk r10234 - /linux/trunk/drivers/dahdi/wct4xxp/base.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Oct 20 15:52:21 CDT 2011


Author: sruffell
Date: Thu Oct 20 15:52:18 2011
New Revision: 10234

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10234
Log:
wct4xxp: __t4_framer_in and __t4_framer_out speedups.

Speeds up these calls primarily by eliminating unnecessary flushes
of writes to the PCI bus.

Before:

 7.095 us    |  __t4_framer_in();
 5.835 us    |  __t4_framer_out();
 7.122 us    |  __t4_framer_in();
 7.071 us    |  __t4_framer_in();
 7.059 us    |  __t4_framer_in();
 5.859 us    |  __t4_framer_out();
 7.076 us    |  __t4_framer_in();
 5.852 us    |  __t4_framer_out();
 7.124 us    |  __t4_framer_in();
 7.080 us    |  __t4_framer_in();

After:

 1.694 us    |  __t4_framer_out();
 1.686 us    |  __t4_framer_out();
 1.695 us    |  __t4_framer_out();
 3.182 us    |  __t4_framer_in();
 3.283 us    |  __t4_framer_in();
 2.889 us    |  __t4_framer_in();
 2.942 us    |  __t4_framer_in();
 2.951 us    |  __t4_framer_in();
 2.906 us    |  __t4_framer_in();

Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Acked-by: Michael Spiceland <mspiceland at digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks at digium.com>

Modified:
    linux/trunk/drivers/dahdi/wct4xxp/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=10234&r1=10233&r2=10234
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/base.c Thu Oct 20 15:52:18 2011
@@ -541,12 +541,18 @@
 
 static inline void __t4_pci_out(struct t4 *wc, const unsigned int addr, const unsigned int value)
 {
+#ifdef DEBUG
 	unsigned int tmp;
+#endif
 	writel(value, wc->membase + (addr * sizeof(u32)));
+#ifdef DEBUG
 	tmp = __t4_pci_in(wc, WC_VERSION);
 	if ((tmp & 0xffff0000) != 0xc01a0000)
 		dev_notice(&wc->dev->dev,
 				"Version Synchronization Error!\n");
+#else
+	__t4_pci_in(wc, WC_VERSION);
+#endif
 }
 
 static inline void __t4_gpio_set(struct t4 *wc, unsigned bits, unsigned int val)
@@ -621,22 +627,24 @@
 	return ret;
 }
 
-static unsigned int __t4_framer_in(struct t4 *wc, int unit,
+static unsigned int __t4_framer_in(const struct t4 *wc, int unit,
 				   const unsigned int addr)
 {
 	unsigned int ret;
+	register u32 val;
+	void __iomem *const wc_laddr = wc->membase + (WC_LADDR*sizeof(u32));
+	void __iomem *const wc_version = wc->membase + (WC_VERSION*sizeof(u32));
+	void __iomem *const wc_ldata = wc->membase + (WC_LDATA*sizeof(u32));
 	unit &= 0x3;
-	__t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff));
-	__t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff) | WC_LFRMR_CS | WC_LREAD);
-	__t4_pci_out(wc, WC_VERSION, 0);
-	ret = __t4_pci_in(wc, WC_LDATA);
- 	__t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff));
-
-	if (unlikely(debug & DEBUG_REGS))
-		dev_info(&wc->dev->dev, "Reading unit %d address %02x is "
-				"%02x\n", unit, addr, ret & 0xff);
-
-	return ret & 0xff;
+
+	val = ((unit & 0x3) << 8) | (addr & 0xff);
+	writel(val, wc_laddr);
+	/* readl(wc_version); */
+	writel(val | WC_LFRMR_CS | WC_LREAD, wc_laddr);
+	readl(wc_version);
+	ret = readb(wc_ldata);
+	writel(val, wc_laddr);
+	return ret;
 }
 
 static unsigned int
@@ -648,25 +656,27 @@
 	ret = __t4_framer_in(wc, unit, addr);
 	spin_unlock_irqrestore(&wc->reglock, flags);
 	return ret;
-
-}
-
-static void __t4_framer_out(struct t4 *wc, int unit, const unsigned int addr,
+}
+
+static void __t4_framer_out(const struct t4 *wc, int unit, const u8 addr,
 			    const unsigned int value)
 {
-	unit &= 0x3;
-	if (unlikely(debug & DEBUG_REGS))
-		dev_info(&wc->dev->dev, "Writing %02x to address %02x of "
-				"unit %d\n", value, addr, unit);
-	__t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff));
-	__t4_pci_out(wc, WC_LDATA, value);
-	__t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff) | WC_LFRMR_CS | WC_LWRITE);
-	__t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff));	
-	if (unlikely(debug & DEBUG_REGS))
-		dev_info(&wc->dev->dev, "Write complete\n");
-}
-
-static void t4_framer_out(struct t4 *wc, int unit, const unsigned int addr,
+	register u32 val;
+	void __iomem *const wc_laddr = wc->membase + (WC_LADDR*sizeof(u32));
+	void __iomem *const wc_version = wc->membase + (WC_VERSION*sizeof(u32));
+	void __iomem *const wc_ldata = wc->membase + (WC_LDATA*sizeof(u32));
+
+	val = ((unit & 0x3) << 8) | (addr & 0xff);
+	writel(val, wc_laddr);
+	writel(value, wc_ldata);
+	readl(wc_version);
+	writel(val | WC_LFRMR_CS | WC_LWRITE, wc_laddr);
+	/* readl(wc_version); */
+	writel(val, wc_laddr);
+}
+
+static void t4_framer_out(struct t4 *wc, int unit,
+			  const unsigned int addr,
 			  const unsigned int value)
 {
 	unsigned long flags;




More information about the svn-commits mailing list