From 0903748420aa0d560485d8a8fd2aa3ce8900628b Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Wed, 24 Feb 2010 19:13:05 +0000 Subject: wctdm24xxp, wcte12xp: Abort attach if interface fails to come out of reset. If the reset bit never clears, then just assume we cannot talk to the board and error on the attach. DAHDI-515. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8080 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/voicebus/voicebus.c | 29 ++++++++++++++++++----------- drivers/dahdi/wcte12xp/base.c | 1 - 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/dahdi/voicebus/voicebus.c b/drivers/dahdi/voicebus/voicebus.c index 8853093..064e664 100644 --- a/drivers/dahdi/voicebus/voicebus.c +++ b/drivers/dahdi/voicebus/voicebus.c @@ -617,8 +617,8 @@ vb_reset_interface(struct voicebus *vb) } while ((reg & 0x00000001) && time_before(jiffies, timeout)); if (reg & 0x00000001) { - dev_warn(&vb->pdev->dev, "Hardware did not come out of reset " - "within 100ms!"); + dev_warn(&vb->pdev->dev, "Did not come out of reset " + "within 100ms\n"); return -EIO; } @@ -1577,14 +1577,6 @@ voicebus_init(struct voicebus *vb, const char *board_name) vb->idle_vbb = dma_alloc_coherent(&vb->pdev->dev, VOICEBUS_SFRAME_SIZE, &vb->idle_vbb_dma_addr, GFP_KERNEL); - retval = vb_initialize_tx_descriptors(vb); - if (retval) - goto cleanup; - - retval = vb_initialize_rx_descriptors(vb); - if (retval) - goto cleanup; - /* ---------------------------------------------------------------- Configure the hardware interface. ---------------------------------------------------------------- */ @@ -1597,6 +1589,20 @@ voicebus_init(struct voicebus *vb, const char *board_name) pci_set_master(vb->pdev); vb_enable_io_access(vb); + if (vb_reset_interface(vb)) { + retval = -EIO; + dev_warn(&vb->pdev->dev, "Failed reset.\n"); + goto cleanup; + } + + retval = vb_initialize_tx_descriptors(vb); + if (retval) + goto cleanup; + + retval = vb_initialize_rx_descriptors(vb); + if (retval) + goto cleanup; + #if VOICEBUS_DEFERRED != TIMER retval = request_irq(vb->pdev->irq, vb_isr, DAHDI_IRQ_SHARED, board_name, vb); @@ -1632,7 +1638,8 @@ cleanup: if (vb->pdev) pci_disable_device(vb->pdev); - WARN_ON(0 == retval); + if (0 == retval) + retval = -EIO; return retval; } EXPORT_SYMBOL(voicebus_init); diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c index dfba2dd..9f6352f 100644 --- a/drivers/dahdi/wcte12xp/base.c +++ b/drivers/dahdi/wcte12xp/base.c @@ -1846,7 +1846,6 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi wc->vb.debug = &debug; res = voicebus_init(&wc->vb, wc->name); if (res) { - WARN_ON(1); free_wc(wc); ifaces[index] = NULL; return res; -- cgit v1.2.3