forked from mirrors/linux
		
	mmc: tmio: add CMD23 support
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
		
							parent
							
								
									f5fdcd1d55
								
							
						
					
					
						commit
						8b22c3c18b
					
				
					 1 changed files with 28 additions and 13 deletions
				
			
		| 
						 | 
					@ -368,11 +368,11 @@ static int tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command
 | 
				
			||||||
			c |= TRANSFER_MULTI;
 | 
								c |= TRANSFER_MULTI;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/*
 | 
								/*
 | 
				
			||||||
			 * Disable auto CMD12 at IO_RW_EXTENDED when
 | 
								 * Disable auto CMD12 at IO_RW_EXTENDED and SET_BLOCK_COUNT
 | 
				
			||||||
			 * multiple block transfer
 | 
								 * when doing multiple block transfer
 | 
				
			||||||
			 */
 | 
								 */
 | 
				
			||||||
			if ((host->pdata->flags & TMIO_MMC_HAVE_CMD12_CTRL) &&
 | 
								if ((host->pdata->flags & TMIO_MMC_HAVE_CMD12_CTRL) &&
 | 
				
			||||||
			    (cmd->opcode == SD_IO_RW_EXTENDED))
 | 
								    (cmd->opcode == SD_IO_RW_EXTENDED || host->mrq->sbc))
 | 
				
			||||||
				c |= NO_CMD12_ISSUE;
 | 
									c |= NO_CMD12_ISSUE;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (data->flags & MMC_DATA_READ)
 | 
							if (data->flags & MMC_DATA_READ)
 | 
				
			||||||
| 
						 | 
					@ -549,7 +549,7 @@ void tmio_mmc_do_data_irq(struct tmio_mmc_host *host)
 | 
				
			||||||
			host->mrq);
 | 
								host->mrq);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (stop) {
 | 
						if (stop && !host->mrq->sbc) {
 | 
				
			||||||
		if (stop->opcode != MMC_STOP_TRANSMISSION || stop->arg)
 | 
							if (stop->opcode != MMC_STOP_TRANSMISSION || stop->arg)
 | 
				
			||||||
			dev_err(&host->pdev->dev, "unsupported stop: CMD%u,0x%x. We did CMD12,0\n",
 | 
								dev_err(&host->pdev->dev, "unsupported stop: CMD%u,0x%x. We did CMD12,0\n",
 | 
				
			||||||
				stop->opcode, stop->arg);
 | 
									stop->opcode, stop->arg);
 | 
				
			||||||
| 
						 | 
					@ -857,15 +857,21 @@ static int tmio_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void tmio_process_mrq(struct tmio_mmc_host *host, struct mmc_request *mrq)
 | 
					static void tmio_process_mrq(struct tmio_mmc_host *host, struct mmc_request *mrq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct mmc_command *cmd;
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (mrq->data) {
 | 
						if (mrq->sbc && host->cmd != mrq->sbc) {
 | 
				
			||||||
		ret = tmio_mmc_start_data(host, mrq->data);
 | 
							cmd = mrq->sbc;
 | 
				
			||||||
		if (ret)
 | 
						} else {
 | 
				
			||||||
			goto fail;
 | 
							cmd = mrq->cmd;
 | 
				
			||||||
 | 
							if (mrq->data) {
 | 
				
			||||||
 | 
								ret = tmio_mmc_start_data(host, mrq->data);
 | 
				
			||||||
 | 
								if (ret)
 | 
				
			||||||
 | 
									goto fail;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = tmio_mmc_start_command(host, mrq->cmd);
 | 
						ret = tmio_mmc_start_command(host, cmd);
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
		goto fail;
 | 
							goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -920,13 +926,16 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	host->cmd = NULL;
 | 
						/* If not SET_BLOCK_COUNT, clear old data */
 | 
				
			||||||
	host->data = NULL;
 | 
						if (host->cmd != mrq->sbc) {
 | 
				
			||||||
	host->force_pio = false;
 | 
							host->cmd = NULL;
 | 
				
			||||||
 | 
							host->data = NULL;
 | 
				
			||||||
 | 
							host->force_pio = false;
 | 
				
			||||||
 | 
							host->mrq = NULL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cancel_delayed_work(&host->delayed_reset_work);
 | 
						cancel_delayed_work(&host->delayed_reset_work);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	host->mrq = NULL;
 | 
					 | 
				
			||||||
	spin_unlock_irqrestore(&host->lock, flags);
 | 
						spin_unlock_irqrestore(&host->lock, flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (mrq->cmd->error || (mrq->data && mrq->data->error))
 | 
						if (mrq->cmd->error || (mrq->data && mrq->data->error))
 | 
				
			||||||
| 
						 | 
					@ -935,6 +944,12 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
 | 
				
			||||||
	if (host->check_scc_error)
 | 
						if (host->check_scc_error)
 | 
				
			||||||
		host->check_scc_error(host);
 | 
							host->check_scc_error(host);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* If SET_BLOCK_COUNT, continue with main command */
 | 
				
			||||||
 | 
						if (host->mrq) {
 | 
				
			||||||
 | 
							tmio_process_mrq(host, mrq);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mmc_request_done(host->mmc, mrq);
 | 
						mmc_request_done(host->mmc, mrq);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue