diff options
Diffstat (limited to 'drivers/dahdi/voicebus')
-rw-r--r-- | drivers/dahdi/voicebus/GpakCust.c | 57 | ||||
-rw-r--r-- | drivers/dahdi/voicebus/GpakCust.h | 1 | ||||
-rw-r--r-- | drivers/dahdi/voicebus/voicebus.c | 2 |
3 files changed, 52 insertions, 8 deletions
diff --git a/drivers/dahdi/voicebus/GpakCust.c b/drivers/dahdi/voicebus/GpakCust.c index 06e73be..991e02b 100644 --- a/drivers/dahdi/voicebus/GpakCust.c +++ b/drivers/dahdi/voicebus/GpakCust.c @@ -560,6 +560,47 @@ vpmadt032_alloc(struct vpmadt032_options *options, const char *board_name) } EXPORT_SYMBOL(vpmadt032_alloc); +int vpmadt032_reset(struct vpmadt032 *vpm) +{ + int res; + gpakPingDspStat_t pingstatus; + u16 version; + + might_sleep(); + + set_bit(VPM150M_HPIRESET, &vpm->control); + msleep(2000); + while (test_bit(VPM150M_HPIRESET, &vpm->control)) + msleep(1); + + /* Set us up to page 0 */ + vpmadt032_setpage(vpm, 0); + + res = vpmadtreg_loadfirmware(vpm->vb); + if (res) { + dev_info(&vpm->vb->pdev->dev, "Failed to load the firmware.\n"); + return res; + } + vpm->curpage = -1; + + set_bit(VPM150M_SWRESET, &vpm->control); + while (test_bit(VPM150M_SWRESET, &vpm->control)) + msleep(1); + + /* Set us up to page 0 */ + pingstatus = gpakPingDsp(vpm->dspid, &version); + if (!pingstatus) { + vpm_info(vpm, "VPM present and operational " + "(Firmware version %x)\n", version); + vpm->version = version; + res = 0; + } else { + res = -EIO; + } + return res; +} +EXPORT_SYMBOL(vpmadt032_reset); + int vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb) { @@ -597,9 +638,9 @@ vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb) dev_info(&vpm->vb->pdev->dev, "Passed\n"); set_bit(VPM150M_HPIRESET, &vpm->control); - msleep(2000); while (test_bit(VPM150M_HPIRESET, &vpm->control)) msleep(1); + msleep(250); /* Set us up to page 0 */ vpmadt032_setpage(vpm, 0); @@ -613,9 +654,8 @@ vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb) vpmadt032_getreg(vpm, 0x1000, ®); if (reg != i) { printk(KERN_CONT "VPMADT032 Failed address test\n"); - goto failed_exit; + res = -EIO; } - } } @@ -641,11 +681,11 @@ vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb) pingstatus = gpakPingDsp(vpm->dspid, &vpm->version); if (!pingstatus) { - dev_info(&vpm->vb->pdev->dev, - "Version of DSP is %x\n", vpm->version); + dev_info(&vb->pdev->dev, "VPM present and operational " + "(Firmware version %x)\n", vpm->version); } else { dev_notice(&vpm->vb->pdev->dev, "VPMADT032 Failed! Unable to ping the DSP (%d)!\n", pingstatus); - res = -1; + res = -EIO; goto failed_exit; } @@ -662,6 +702,7 @@ failed_exit: } EXPORT_SYMBOL(vpmadt032_init); + void vpmadt032_get_default_parameters(struct GpakEcanParms *p) { memset(p, 0, sizeof(*p)); @@ -694,7 +735,9 @@ void vpmadt032_free(struct vpmadt032 *vpm) struct change_order *order; LIST_HEAD(local_list); - BUG_ON(!vpm); + if (!vpm) + return; + BUG_ON(!vpm->wq); destroy_workqueue(vpm->wq); diff --git a/drivers/dahdi/voicebus/GpakCust.h b/drivers/dahdi/voicebus/GpakCust.h index 27499bd..915a642 100644 --- a/drivers/dahdi/voicebus/GpakCust.h +++ b/drivers/dahdi/voicebus/GpakCust.h @@ -136,6 +136,7 @@ struct dahdi_echocan_state; char vpmadt032tone_to_zaptone(GpakToneCodes_t tone); int vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb); +int vpmadt032_reset(struct vpmadt032 *vpm); struct vpmadt032 *vpmadt032_alloc(struct vpmadt032_options *options, const char *board_name); void vpmadt032_free(struct vpmadt032 *vpm); diff --git a/drivers/dahdi/voicebus/voicebus.c b/drivers/dahdi/voicebus/voicebus.c index 9ae2155..a3fb42e 100644 --- a/drivers/dahdi/voicebus/voicebus.c +++ b/drivers/dahdi/voicebus/voicebus.c @@ -1757,7 +1757,7 @@ int vpmadtreg_loadfirmware(struct voicebus *vb) spin_unlock(&loader_list_lock); dev_info(&vb->pdev->dev, "Failed to find a registered " "loader after loading module.\n"); - ret = -1; + ret = -ENODEV; } return ret; } |