wct4xxp: Remove 'pedanticpci' module parameter.

The 'pedanticpci' module parameter, which is always on by default,
inserts extra reads from the card in order to ensure that all writes are
properly flushed through any PCI bridges which may post the writes.  The
side effect is that this takes more CPU time for registers reads and
writes, especially to the framer registers.

It is never recommended to run with pedanticpci set to 0, so I'm
removing it as a module parameter so that the default case does not take
a performance hit checking for whether the parameter is set or not.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10233 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell 2011-10-20 20:52:14 +00:00
parent 2c4dad3c58
commit fbc506c865

View File

@ -182,7 +182,6 @@ static inline int t4_queue_work(struct workqueue_struct *wq, struct work_struct
"CONFIG_NOEXTENDED_RESET." "CONFIG_NOEXTENDED_RESET."
#endif #endif
static int pedanticpci = 1;
static int debug=0; static int debug=0;
static int timingcable = 0; static int timingcable = 0;
static int t1e1override = -1; /* 0xff for E1, 0x00 for T1 */ static int t1e1override = -1; /* 0xff for E1, 0x00 for T1 */
@ -544,19 +543,10 @@ static inline void __t4_pci_out(struct t4 *wc, const unsigned int addr, const un
{ {
unsigned int tmp; unsigned int tmp;
writel(value, wc->membase + (addr * sizeof(u32))); writel(value, wc->membase + (addr * sizeof(u32)));
if (pedanticpci) { tmp = __t4_pci_in(wc, WC_VERSION);
tmp = __t4_pci_in(wc, WC_VERSION); if ((tmp & 0xffff0000) != 0xc01a0000)
if ((tmp & 0xffff0000) != 0xc01a0000) dev_notice(&wc->dev->dev,
dev_notice(&wc->dev->dev, "Version Synchronization Error!\n");
"Version Synchronization Error!\n");
}
#if 0
tmp = __t4_pci_in(wc, addr);
if ((value != tmp) && (addr != WC_LEDS) && (addr != WC_LDATA) &&
(addr != WC_GPIO) && (addr != WC_INTR))
dev_info(&wc->dev->dev, "Tried to load %08x into %08x, "
"but got %08x instead\n", value, addr, tmp);
#endif
} }
static inline void __t4_gpio_set(struct t4 *wc, unsigned bits, unsigned int val) static inline void __t4_gpio_set(struct t4 *wc, unsigned bits, unsigned int val)
@ -637,14 +627,8 @@ static unsigned int __t4_framer_in(struct t4 *wc, int unit,
unsigned int ret; unsigned int ret;
unit &= 0x3; unit &= 0x3;
__t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff)); __t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff));
if (!pedanticpci)
__t4_pci_in(wc, WC_VERSION);
__t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff) | WC_LFRMR_CS | WC_LREAD); __t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff) | WC_LFRMR_CS | WC_LREAD);
if (!pedanticpci) { __t4_pci_out(wc, WC_VERSION, 0);
__t4_pci_in(wc, WC_VERSION);
} else {
__t4_pci_out(wc, WC_VERSION, 0);
}
ret = __t4_pci_in(wc, WC_LDATA); ret = __t4_pci_in(wc, WC_LDATA);
__t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff)); __t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff));
@ -652,9 +636,6 @@ static unsigned int __t4_framer_in(struct t4 *wc, int unit,
dev_info(&wc->dev->dev, "Reading unit %d address %02x is " dev_info(&wc->dev->dev, "Reading unit %d address %02x is "
"%02x\n", unit, addr, ret & 0xff); "%02x\n", unit, addr, ret & 0xff);
if (!pedanticpci)
__t4_pci_in(wc, WC_VERSION);
return ret & 0xff; return ret & 0xff;
} }
@ -679,26 +660,10 @@ static void __t4_framer_out(struct t4 *wc, int unit, const unsigned int addr,
"unit %d\n", value, addr, unit); "unit %d\n", value, addr, unit);
__t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff)); __t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff));
__t4_pci_out(wc, WC_LDATA, value); __t4_pci_out(wc, WC_LDATA, value);
if (!pedanticpci)
__t4_pci_in(wc, WC_VERSION);
__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) | WC_LFRMR_CS | WC_LWRITE);
if (!pedanticpci)
__t4_pci_in(wc, WC_VERSION);
__t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff)); __t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff));
if (!pedanticpci)
__t4_pci_in(wc, WC_VERSION);
if (unlikely(debug & DEBUG_REGS)) if (unlikely(debug & DEBUG_REGS))
dev_info(&wc->dev->dev, "Write complete\n"); dev_info(&wc->dev->dev, "Write complete\n");
#if 0
if ((addr != FRMR_TXFIFO) && (addr != FRMR_CMDR) && (addr != 0xbc))
{ unsigned int tmp;
tmp = __t4_framer_in(wc, unit, addr);
if (tmp != value) {
dev_notice(&wc->dev->dev, "Expected %d from unit %d "
"register %d but got %d instead\n",
value, unit, addr, tmp);
} }
#endif
} }
static void t4_framer_out(struct t4 *wc, int unit, const unsigned int addr, static void t4_framer_out(struct t4 *wc, int unit, const unsigned int addr,
@ -738,17 +703,11 @@ static inline void __t4_raw_oct_out(struct t4 *wc, const unsigned int addr, cons
if (!octopt) if (!octopt)
__t4_pci_out(wc, WC_LADDR, (WC_LWRITE)); __t4_pci_out(wc, WC_LADDR, (WC_LWRITE));
__t4_pci_out(wc, WC_LADDR, (WC_LWRITE | WC_LALE)); __t4_pci_out(wc, WC_LADDR, (WC_LWRITE | WC_LALE));
if (!pedanticpci)
__t4_pci_in(wc, WC_VERSION);
if (!octopt) if (!octopt)
__t4_gpio_set(wc, 0xff, (value >> 8)); __t4_gpio_set(wc, 0xff, (value >> 8));
__t4_pci_out(wc, WC_LDATA, (value & 0xffff)); __t4_pci_out(wc, WC_LDATA, (value & 0xffff));
__t4_pci_out(wc, WC_LADDR, (WC_LWRITE | WC_LALE | WC_LCS)); __t4_pci_out(wc, WC_LADDR, (WC_LWRITE | WC_LALE | WC_LCS));
if (!pedanticpci)
__t4_pci_in(wc, WC_VERSION);
__t4_pci_out(wc, WC_LADDR, (0)); __t4_pci_out(wc, WC_LADDR, (0));
if (!pedanticpci)
__t4_pci_in(wc, WC_VERSION);
} }
static inline unsigned int __t4_raw_oct_in(struct t4 *wc, const unsigned int addr) static inline unsigned int __t4_raw_oct_in(struct t4 *wc, const unsigned int addr)
@ -760,21 +719,13 @@ static inline unsigned int __t4_raw_oct_in(struct t4 *wc, const unsigned int add
__t4_pci_out(wc, WC_LDATA, 0x10000 | (addr & 0xffff)); __t4_pci_out(wc, WC_LDATA, 0x10000 | (addr & 0xffff));
if (!octopt) if (!octopt)
__t4_pci_out(wc, WC_LADDR, (WC_LWRITE)); __t4_pci_out(wc, WC_LADDR, (WC_LWRITE));
if (!pedanticpci)
__t4_pci_in(wc, WC_VERSION);
__t4_pci_out(wc, WC_LADDR, (WC_LWRITE | WC_LALE)); __t4_pci_out(wc, WC_LADDR, (WC_LWRITE | WC_LALE));
if (!pedanticpci)
__t4_pci_in(wc, WC_VERSION);
__t4_pci_out(wc, WC_LADDR, (WC_LALE)); __t4_pci_out(wc, WC_LADDR, (WC_LALE));
if (!pedanticpci)
__t4_pci_in(wc, WC_VERSION);
if (!octopt) { if (!octopt) {
__t4_gpio_setdir(wc, 0xff, 0x00); __t4_gpio_setdir(wc, 0xff, 0x00);
__t4_gpio_set(wc, 0xff, 0x00); __t4_gpio_set(wc, 0xff, 0x00);
} }
__t4_pci_out(wc, WC_LADDR, (WC_LREAD | WC_LALE | WC_LCS)); __t4_pci_out(wc, WC_LADDR, (WC_LREAD | WC_LALE | WC_LCS));
if (!pedanticpci)
__t4_pci_in(wc, WC_VERSION);
if (octopt) { if (octopt) {
ret = __t4_pci_in(wc, WC_LDATA) & 0xffff; ret = __t4_pci_in(wc, WC_LDATA) & 0xffff;
} else { } else {
@ -782,8 +733,6 @@ static inline unsigned int __t4_raw_oct_in(struct t4 *wc, const unsigned int add
ret |= (__t4_pci_in(wc, WC_GPIO) & 0xff) << 8; ret |= (__t4_pci_in(wc, WC_GPIO) & 0xff) << 8;
} }
__t4_pci_out(wc, WC_LADDR, (0)); __t4_pci_out(wc, WC_LADDR, (0));
if (!pedanticpci)
__t4_pci_in(wc, WC_VERSION);
if (!octopt) if (!octopt)
__t4_gpio_setdir(wc, 0xff, 0xff); __t4_gpio_setdir(wc, 0xff, 0xff);
return ret & 0xffff; return ret & 0xffff;
@ -5090,7 +5039,6 @@ MODULE_DESCRIPTION("Wildcard Dual-/Quad-port Digital Card Driver");
MODULE_ALIAS("wct2xxp"); MODULE_ALIAS("wct2xxp");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
module_param(pedanticpci, int, 0600);
module_param(debug, int, 0600); module_param(debug, int, 0600);
module_param(noburst, int, 0600); module_param(noburst, int, 0600);
module_param(timingcable, int, 0600); module_param(timingcable, int, 0600);