Refactor init into two stages, in support of future EEH recovery / reinitialization efforts

parent 259cd07b
......@@ -2187,6 +2187,53 @@ static int a24xx_init_spans(struct a24xx *wc)
return 0;
}
static int a24xx_secondary_init(struct pci_dev *pdev)
{
int x;
unsigned int fwbuild;
int cardcount = 0;
/* get control structures */
struct a24xx *wc = pci_get_drvdata(pdev);
struct a24xx_dev *wc_dev = &wc->dev;
/* set channel sigcap */
a24xx_post_initialize(wc);
init_busydetect(wc, opermode);
init_callerid(wc);
/* Enable interrupts */
__opvx_a24xx_enable_interrupts(wc_dev);
/* Initialize Write/Buffers to all blank data */
memset((void *)wc_dev->writechunk,0, ms_per_irq * DAHDI_MAX_CHUNKSIZE * MAX_NUM_CARDS * 2 * 2);
/*set irq frequence*/
if(wc_dev->fwversion >= ((1 << 16)|1) )
__opvx_a24xx_set_irq_frq(wc_dev,ms_per_irq);
if(wc_dev->fwversion > ((1 << 16)|2)){
__opvx_a24xx_set_master(wc_dev,wc_dev->master^0x01);
}
/* Start DMA */
__opvx_a24xx_start_dma(wc_dev, wc_dev->writedma);
/* module count */
for (x = 0; x < wc_dev->max_cards/*MAX_NUM_CARDS*/; x++) {
if (wc_dev->cardflag & (1 << x)) {
cardcount++;
}
}
fwbuild = __opvx_a24xx_getcreg(wc_dev, 0x0, 0xe);
printk(KERN_NOTICE "Found an OpenVox %s: Version %x.%x (%d modules),Build 0x%08x\n", wc_dev->card_name, wc_dev->fwversion>>16, wc_dev->fwversion&0xffff, cardcount,fwbuild );
if(debug) {
printk(KERN_DEBUG "OpenVox %s debug On\n", wc_dev->card_name);
}
return cardcount;
}
static int __devinit a24xx_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
int res,rc;
......@@ -2195,7 +2242,6 @@ static int __devinit a24xx_init_one(struct pci_dev *pdev, const struct pci_devic
struct a24xx *wc;
struct a24xx_desc *d = (struct a24xx_desc *)ent->driver_data;
struct a24xx_dev *wc_dev;
unsigned int fwbuild;
char span_flags[MAX_NUM_CARDS] = { 0, };
int z,index;
static int initd_ifaces=0;
......@@ -2308,6 +2354,7 @@ static int __devinit a24xx_init_one(struct pci_dev *pdev, const struct pci_devic
wc_dev->master = 0;
wc->index = index;
/* Allocate enough memory for two dahdi chunks, receive and transmit. Each sample uses
8 bits. */
......@@ -2448,50 +2495,15 @@ static int __devinit a24xx_init_one(struct pci_dev *pdev, const struct pci_devic
}
}
/* set channel sigcap */
a24xx_post_initialize(wc);
cardcount += a24xx_secondary_init(pdev);
init_busydetect(wc, opermode);
init_callerid(wc);
/* Enable interrupts */
__opvx_a24xx_enable_interrupts(wc_dev);
/* Initialize Write/Buffers to all blank data */
memset((void *)wc_dev->writechunk,0, ms_per_irq * DAHDI_MAX_CHUNKSIZE * MAX_NUM_CARDS * 2 * 2);
/*set irq frequence*/
if(wc_dev->fwversion >= ((1 << 16)|1) )
__opvx_a24xx_set_irq_frq(wc_dev,ms_per_irq);
if(wc_dev->fwversion > ((1 << 16)|2)){
__opvx_a24xx_set_master(wc_dev,wc_dev->master^0x01);
}
/* Start DMA */
__opvx_a24xx_start_dma(wc_dev, wc_dev->writedma);
/* module count */
for (x = 0; x < wc_dev->max_cards/*MAX_NUM_CARDS*/; x++) {
if (wc_dev->cardflag & (1 << x)) {
cardcount++;
}
}
fwbuild = __opvx_a24xx_getcreg(wc_dev, 0x0, 0xe);
printk(KERN_NOTICE "Found an OpenVox %s: Version %x.%x (%d modules),Build 0x%08x\n", wc_dev->card_name, wc_dev->fwversion>>16, wc_dev->fwversion&0xffff, cardcount,fwbuild );
if(debug) {
printk(KERN_DEBUG "OpenVox %s debug On\n", wc_dev->card_name);
}
ifaces[index] = wc;
max_iface_index++;
res = 0;
}
return res;
}
static void a24xx_release(struct a24xx *wc)
{
#ifdef TEST_LOG_INCOME_VOICE
......@@ -2712,7 +2724,7 @@ static pci_ers_result_t a24xx_pci_slot_reset(struct pci_dev *pdev)
// Ideally we'd completely reinitialize the card here,
// but that will require more invasive changes to the driver.
//
// For now, assume that bad card-side firwmare has merely caused
// For now, assume that bad card-side firwmare has "merely" caused
// an invalid DMA operation, and that we can safely resume without
// re-initializing anything...
//a24xx_init_one(pdev, wc_dev->device_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment