diff mbox series

[4/5] mmc: omap_hsmmc: Enable Auto command (CMD12) enable

Message ID 1499790014-29964-5-git-send-email-jjhiblot@ti.com
State Superseded
Headers show
Series None | expand

Commit Message

Jean-Jacques Hiblot July 11, 2017, 4:20 p.m. UTC
From: Kishon Vijay Abraham I <kishon@ti.com>

Instead of sending STOP TRANSMISSION command from MMC core, enable
the auto command feature so that the Host Controller issues CMD12
automatically when last block transfer is completed.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
---
 drivers/mmc/omap_hsmmc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Jaehoon Chung July 28, 2017, 12:49 p.m. UTC | #1
Hi,

On 07/12/2017 01:20 AM, Jean-Jacques Hiblot wrote:
> From: Kishon Vijay Abraham I <kishon@ti.com>
> 
> Instead of sending STOP TRANSMISSION command from MMC core, enable
> the auto command feature so that the Host Controller issues CMD12
> automatically when last block transfer is completed.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> ---
>  drivers/mmc/omap_hsmmc.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
> index 3419dc5..3ee81bb 100644
> --- a/drivers/mmc/omap_hsmmc.c
> +++ b/drivers/mmc/omap_hsmmc.c
> @@ -490,6 +490,10 @@ static int omap_hsmmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
>  	ulong start;
>  
>  	mmc_base = priv->base_addr;
> +
> +	if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
> +		return 0;

Just i wonder that there is no side-effect..I'm not sure that all omap SoCs can be supported Auto command12.

Best Regards,
Jaehoon Chung

> +
>  	start = get_timer(0);
>  	while ((readl(&mmc_base->pstate) & (DATI_MASK | CMDI_MASK)) != 0) {
>  		if (get_timer(0) - start > MAX_RETRY_MS) {
> @@ -546,7 +550,7 @@ static int omap_hsmmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
>  	if (data) {
>  		if ((cmd->cmdidx == MMC_CMD_READ_MULTIPLE_BLOCK) ||
>  			 (cmd->cmdidx == MMC_CMD_WRITE_MULTIPLE_BLOCK)) {
> -			flags |= (MSBS_MULTIBLK | BCE_ENABLE);
> +			flags |= (MSBS_MULTIBLK | BCE_ENABLE | ACEN_ENABLE);
>  			data->blocksize = 512;
>  			writel(data->blocksize | (data->blocks << 16),
>  							&mmc_base->blk);
>
Jean-Jacques Hiblot July 28, 2017, 3:35 p.m. UTC | #2
On 28/07/2017 14:49, Jaehoon Chung wrote:
> Hi,
>
> On 07/12/2017 01:20 AM, Jean-Jacques Hiblot wrote:
>> From: Kishon Vijay Abraham I <kishon@ti.com>
>>
>> Instead of sending STOP TRANSMISSION command from MMC core, enable
>> the auto command feature so that the Host Controller issues CMD12
>> automatically when last block transfer is completed.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
>> ---
>>   drivers/mmc/omap_hsmmc.c | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
>> index 3419dc5..3ee81bb 100644
>> --- a/drivers/mmc/omap_hsmmc.c
>> +++ b/drivers/mmc/omap_hsmmc.c
>> @@ -490,6 +490,10 @@ static int omap_hsmmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
>>   	ulong start;
>>   
>>   	mmc_base = priv->base_addr;
>> +
>> +	if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
>> +		return 0;
> Just i wonder that there is no side-effect..I'm not sure that all omap SoCs can be supported Auto command12.
AFAIK it's supported.

Kishon,

can you confirm ?

JJ

>
> Best Regards,
> Jaehoon Chung
>
>> +
>>   	start = get_timer(0);
>>   	while ((readl(&mmc_base->pstate) & (DATI_MASK | CMDI_MASK)) != 0) {
>>   		if (get_timer(0) - start > MAX_RETRY_MS) {
>> @@ -546,7 +550,7 @@ static int omap_hsmmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
>>   	if (data) {
>>   		if ((cmd->cmdidx == MMC_CMD_READ_MULTIPLE_BLOCK) ||
>>   			 (cmd->cmdidx == MMC_CMD_WRITE_MULTIPLE_BLOCK)) {
>> -			flags |= (MSBS_MULTIBLK | BCE_ENABLE);
>> +			flags |= (MSBS_MULTIBLK | BCE_ENABLE | ACEN_ENABLE);
>>   			data->blocksize = 512;
>>   			writel(data->blocksize | (data->blocks << 16),
>>   							&mmc_base->blk);
>>
>
diff mbox series

Patch

diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index 3419dc5..3ee81bb 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -490,6 +490,10 @@  static int omap_hsmmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
 	ulong start;
 
 	mmc_base = priv->base_addr;
+
+	if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
+		return 0;
+
 	start = get_timer(0);
 	while ((readl(&mmc_base->pstate) & (DATI_MASK | CMDI_MASK)) != 0) {
 		if (get_timer(0) - start > MAX_RETRY_MS) {
@@ -546,7 +550,7 @@  static int omap_hsmmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
 	if (data) {
 		if ((cmd->cmdidx == MMC_CMD_READ_MULTIPLE_BLOCK) ||
 			 (cmd->cmdidx == MMC_CMD_WRITE_MULTIPLE_BLOCK)) {
-			flags |= (MSBS_MULTIBLK | BCE_ENABLE);
+			flags |= (MSBS_MULTIBLK | BCE_ENABLE | ACEN_ENABLE);
 			data->blocksize = 512;
 			writel(data->blocksize | (data->blocks << 16),
 							&mmc_base->blk);