Пример #1
0
int sdxc_send_manual_stop(struct awsmc_host* smc_host, struct mmc_request* request)
{
	struct mmc_data* data = request->data;
	u32 cmd_val = SDXC_Start | SDXC_RspExp | SDXC_CheckRspCRC | MMC_STOP_TRANSMISSION;
	u32 iflags = 0;
	int ret = 0;
	
	if (!data || !data->stop)
	{
		awsmc_dbg_err("no stop cmd request\n");
		return -1;
	}

	sdxc_int_disable(smc_host);
	
	sdc_write(SDXC_REG_CARG, 0);
	sdc_write(SDXC_REG_CMDR, cmd_val);
	do {
		iflags = sdc_read(SDXC_REG_RINTR);
	} while(!(iflags & (SDXC_CmdDone | SDXC_IntErrBit)));
	
	if (iflags & SDXC_IntErrBit)
	{
		awsmc_dbg_err("sdc %d send stop command failed\n", smc_host->pdev->id);
		data->stop->error = ETIMEDOUT;
		ret = -1;
	}

	sdc_write(SDXC_REG_RINTR, iflags);
    data->stop->resp[0] = sdc_read(SDXC_REG_RESP0);
	
	sdxc_int_enable(smc_host);

	return ret;
}
Пример #2
0
static void sunximmc_tasklet(unsigned long data)
{
    struct sunxi_mmc_host *smc_host = (struct sunxi_mmc_host *) data;

	sdxc_int_disable(smc_host);

	if (smc_host->pio_active == XFER_WRITE)
		sdxc_do_pio_write(smc_host);

	if (smc_host->pio_active == XFER_READ)
		sdxc_do_pio_read(smc_host);

    if (smc_host->wait == SDC_WAIT_FINALIZE)
    {
        sdxc_int_enable(smc_host);
        sunximmc_finalize_request(smc_host);
    }
    else
        sdxc_int_enable(smc_host);
}
Пример #3
0
/*********************************************************************
* Method	 :  
* Description:  
* Parameters :  
*	            
* Returns    :  
* Note       :
*********************************************************************/
void sdxc_check_status(struct awsmc_host* smc_host)
{
    u32 raw_int;
    u32 msk_int;
	u32 idma_inte;
    u32 idma_int;
    
    sdxc_int_disable(smc_host);
    
    idma_int = sdc_read(SDXC_REG_IDST);
    idma_inte = sdc_read(SDXC_REG_IDIE);
    raw_int = sdc_read(SDXC_REG_RINTR);
    msk_int = sdc_read(SDXC_REG_MISTA);
    
    smc_host->int_sum |= raw_int;
    awsmc_info("smc %d int, ri %08x(%08x) mi %08x ie %08x idi %08x\n", smc_host->pdev->id, raw_int, smc_host->int_sum, msk_int, idma_inte, idma_int);
    
	if (msk_int & SDXC_SDIOInt) 
	{
		smc_host->sdio_int = 1;
    	sdc_write(SDXC_REG_RINTR, SDXC_SDIOInt);
	}
	
	if (smc_host->cd_gpio == CARD_DETECT_BY_DATA3)
    {
        if (msk_int&SDXC_CardInsert) 
        {
    	    awsmc_dbg("card detect insert\n");
    	    smc_host->present = 1;
    	    smc_host->change = 1;
    	    sdc_write(SDXC_REG_RINTR, SDXC_CardInsert);
    		goto irq_out;
    	}
    	if (msk_int&SDXC_CardRemove) 
    	{
    	    awsmc_dbg("card detect remove\n");
    	    smc_host->present = 0;
    	    smc_host->change = 1;
    	    sdc_write(SDXC_REG_RINTR, SDXC_CardRemove);
    		goto irq_out;
    	}
    }
    
    if (smc_host->wait == SDC_WAIT_NONE && !smc_host->sdio_int)
    {
    	awsmc_dbg_err("smc %x, nothing to complete, raw_int = %08x, mask_int = %08x\n", smc_host->pdev->id, raw_int, msk_int);
    	sdxc_clear_imask(smc_host);
		goto irq_normal_out;
    }
    
    if ((raw_int & SDXC_IntErrBit) || (idma_int & SDXC_IDMA_ERR))
    {
        smc_host->error = raw_int & SDXC_IntErrBit;
        smc_host->wait = SDC_WAIT_FINALIZE;
        goto irq_normal_out;
    }
    
	if (smc_host->wait == SDC_WAIT_AUTOCMD_DONE && (msk_int&SDXC_AutoCMDDone))
	{
	    smc_host->wait = SDC_WAIT_FINALIZE;
	}
	else if (smc_host->wait == SDC_WAIT_DATA_OVER && (msk_int&SDXC_DataOver))
	{
	    smc_host->wait = SDC_WAIT_FINALIZE;
	}
	else if (smc_host->wait == SDC_WAIT_CMD_DONE && (msk_int&SDXC_CmdDone) && !(smc_host->int_sum&SDXC_IntErrBit))
	{
	    smc_host->wait = SDC_WAIT_FINALIZE;
	}
    
//    if (idma_int & (SDXC_IDMACTransmitInt | SDXC_IDMACReceiveInt))
//    {
//    }
irq_normal_out:
    sdc_write(SDXC_REG_RINTR, (~SDXC_SDIOInt) & msk_int);
	sdc_write(SDXC_REG_IDST, idma_int);
	
irq_out:
    
    sdxc_int_enable(smc_host);
}