Ejemplo n.º 1
0
static void s3cmci_send_request(struct mmc_host *mmc)
{
	struct s3cmci_host *host = mmc_priv(mmc);
	struct mmc_request *mrq = host->mrq;
	struct mmc_command *cmd = host->cmd_is_stop?mrq->stop:mrq->cmd;

	host->ccnt++;
#ifdef CONFIG_MMC_DEBUG
	prepare_dbgmsg(host, cmd, host->cmd_is_stop);
#endif
	//Clear command, data and fifo status registers
	//Fifo clear only necessary on 2440, but doesn't hurt on 2410
	writel(0xFFFFFFFF, host->base + S3C2410_SDICMDSTAT);
	writel(0xFFFFFFFF, host->base + S3C2410_SDIDSTA);
	writel(0xFFFFFFFF, host->base + S3C2410_SDIFSTA);

	if (cmd->data) {
		int res;
		res = s3cmci_setup_data(host, cmd->data);

		host->dcnt++;

		if (res) {
//			cmd->error = MMC_ERR_DMA;
//			cmd->data->error = MMC_ERR_DMA;
			cmd->error = -EIO;
			cmd->data->error = -EIO;

			mmc_request_done(mmc, mrq);
			return;
		}


		if (host->dodma) {
			res = s3cmci_prepare_dma(host, cmd->data);
		} else {
			res = s3cmci_prepare_pio(host, cmd->data);
		}

		if (res) {
//			cmd->error = MMC_ERR_DMA;
//			cmd->data->error = MMC_ERR_DMA;
			cmd->error = -EIO;
			cmd->data->error = -EIO;

			mmc_request_done(mmc, mrq);
			return;
		}

	}

	// Send command
	s3cmci_send_command(host, cmd);

	// Enable Interrupt
	enable_irq(host->irq);
}
Ejemplo n.º 2
0
static void s3cmci_send_request(struct mmc_host *mmc)
{
	struct s3cmci_host *host = mmc_priv(mmc);
	struct mmc_request *mrq = host->mrq;
	struct mmc_command *cmd = host->cmd_is_stop ? mrq->stop : mrq->cmd;

	host->ccnt++;
	prepare_dbgmsg(host, cmd, host->cmd_is_stop);

	/* Clear command, data and fifo status registers
	   Fifo clear only necessary on 2440, but doesn't hurt on 2410
	*/
	writel(0xFFFFFFFF, host->base + S3C2410_SDICMDSTAT);
	writel(0xFFFFFFFF, host->base + S3C2410_SDIDSTA);
	writel(0xFFFFFFFF, host->base + S3C2410_SDIFSTA);

	if (cmd->data) {
		int res = s3cmci_setup_data(host, cmd->data);

		host->dcnt++;

		if (res) {
			dbg(host, dbg_err, "setup data error %d\n", res);
			cmd->error = res;
			cmd->data->error = res;

			mmc_request_done(mmc, mrq);
			return;
		}

		if (host->dodma)
			res = s3cmci_prepare_dma(host, cmd->data);
		else
			res = s3cmci_prepare_pio(host, cmd->data);

		if (res) {
			dbg(host, dbg_err, "data prepare error %d\n", res);
			cmd->error = res;
			cmd->data->error = res;

			mmc_request_done(mmc, mrq);
			return;
		}
	}

	/* Send command */
	s3cmci_send_command(host, cmd);

	/* Enable Interrupt */
	enable_irq(host->irq);
}