/************************************************************************** * int fdc_setup * setup the fdc according the datasheet * assuming in PS2 Mode */ int fdc_setup(int drive, FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG) { int i; #ifdef CONFIG_AMIGAONEG3SE irq_install_handler(6, (interrupt_handler_t *)fdc_interrupt, NULL); i8259_unmask_irq(6); #endif #ifdef CFG_FDC_HW_INIT fdc_hw_init (); #endif /* first, we reset the FDC via the DOR */ write_fdc_reg(FDC_DOR,0x00); for(i=0; i<255; i++) /* then we wait some time */ udelay(500); /* then, we clear the reset in the DOR */ pCMD->drive=drive; select_fdc_drive(pCMD); /* initialize the CCR */ write_fdc_reg(FDC_CCR,pFG->rate); /* then initialize the DSR */ write_fdc_reg(FDC_DSR,pFG->rate); if(wait_for_fdc_int()==FALSE) { PRINTF("Time Out after writing CCR\n"); return FALSE; } /* now issue sense Interrupt and status command * assuming only one drive present (drive 0) */ pCMD->dma=0; /* we don't use any dma at all */ for(i=0;i<4;i++) { /* issue sense interrupt for all 4 possible drives */ pCMD->cmd[COMMAND]=FDC_CMD_SENSE_INT; if(fdc_issue_cmd(pCMD,pFG)==FALSE) { PRINTF("Sense Interrupt for drive %d failed\n",i); } } /* issue the configure command */ pCMD->drive=drive; select_fdc_drive(pCMD); pCMD->cmd[COMMAND]=FDC_CMD_CONFIGURE; if(fdc_issue_cmd(pCMD,pFG)==FALSE) { PRINTF(" configure timeout\n"); stop_fdc_drive(pCMD); return FALSE; } /* issue specify command */ pCMD->cmd[COMMAND]=FDC_CMD_SPECIFY; if(fdc_issue_cmd(pCMD,pFG)==FALSE) { PRINTF(" specify timeout\n"); stop_fdc_drive(pCMD); return FALSE; } /* then, we clear the reset in the DOR */ /* fdc_check_drive(pCMD,pFG); */ /* write_fdc_reg(FDC_DOR,0x04); */ return TRUE; }
static void i8259_end_irq(unsigned int irq) { if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) i8259_unmask_irq(irq); }