wcte12xp: Abort driver bind if read/write test fails.

When the driver begins to initialize a device it conducts a read/write
test on one of the framer registers. The driver ignores the result of
that test and results in much output spammed to the kernel logs for a
failed card since the driver doesn't then try to unbind from the device.

What was getting spammed:
     wcte12xp 0000:03:01.0: Timeout in t1_getreg
     wcte12xp 0000:03:01.0: Wrote '0' but read 'fffffffb'

Now abort the bind if the read / write test fails.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10155 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell 2011-08-25 18:28:53 +00:00
parent cdeaafb910
commit 77ec2dce9f

View File

@ -1856,7 +1856,7 @@ static inline unsigned char t1_vpm_out(struct t1 *wc, int unit, const unsigned i
static int t1_hardware_post_init(struct t1 *wc)
{
int res;
unsigned int reg;
int reg;
int x;
/* T1 or E1 */
@ -1878,14 +1878,25 @@ static int t1_hardware_post_init(struct t1 *wc)
/* what version of the FALC are we using? */
reg = t1_setreg(wc, 0x4a, 0xaa);
reg = t1_getreg(wc, 0x4a);
if (reg < 0) {
t1_info(wc, "Failed to read FALC version (%d)\n", reg);
return -EIO;
}
debug_printk(wc, 1, "FALC version: %08x\n", reg);
/* make sure reads and writes work */
for (x = 0; x < 256; x++) {
t1_setreg(wc, 0x14, x);
reg = t1_getreg(wc, 0x14);
if (reg != x)
t1_info(wc, "Wrote '%x' but read '%x'\n", x, reg);
if (reg < 0) {
t1_info(wc, "Failed register read (%d)\n", reg);
return -EIO;
}
if (reg != x) {
t1_info(wc, "Register test failed. "
"Wrote '%x' but read '%x'\n", x, reg);
return -EIO;
}
}
t1_setleds(wc, wc->ledstate);