/* Send ATA DMA command */
/*这里要注意,虽然是发送DMA命令,但是真正的DMA操作还没开始;
*该函数中有设置各种ATA设备寄存器,并等待设置结束后返回
*/
bfin_exec_command(ap, &qc->tf);
//根据初始化时设置的IO操作方向,确定DMA方向,对应步骤(2)
if (qc->tf.flags &ATA_TFLAG_WRITE) {
/*set ATA DMA write direction */
ATAPI_SET_CONTROL(base,(ATAPI_GET_CONTROL(base)
| XFER_DIR));
} else {
/* set ATA DMA read direction*/
ATAPI_SET_CONTROL(base,(ATAPI_GET_CONTROL(base)
& ~XFER_DIR));
}
/* Reset all transfer count */
ATAPI_SET_CONTROL(base,ATAPI_GET_CONTROL(base) | TFRCNT_RST);
/* Set ATAPI state machine contorl interminate sequence */
ATAPI_SET_CONTROL(base,ATAPI_GET_CONTROL(base) | END_ON_TERM);
/* Set transfer length to the totalsize of sg buffers */
ATAPI_SET_XFER_LEN(base, size >>1);
/**
* bfin_bmdma_start- Start an IDE DMA transaction
* @qc:Info associated with this ATA transaction.
*
* Note:Original code is ata_bmdma_start().
*/ static void bfin_bmdma_start(structata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
void __iomem *base = (void __iomem*)ap->ioaddr.ctl_addr;