From patchwork Tue Jun 21 13:12:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 70556 Delivered-To: patches@linaro.org Received: by 10.140.28.4 with SMTP id 4csp2011183qgy; Tue, 21 Jun 2016 06:13:14 -0700 (PDT) X-Received: by 10.25.160.205 with SMTP id j196mr6890284lfe.47.1466514793752; Tue, 21 Jun 2016 06:13:13 -0700 (PDT) Return-Path: Received: from mail-lf0-x236.google.com (mail-lf0-x236.google.com. [2a00:1450:4010:c07::236]) by mx.google.com with ESMTPS id k3si2214732lbd.96.2016.06.21.06.13.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Jun 2016 06:13:13 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::236 as permitted sender) client-ip=2a00:1450:4010:c07::236; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::236 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x236.google.com with SMTP id q132so23292767lfe.3 for ; Tue, 21 Jun 2016 06:13:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=86vCzYb1TStgo558Pk8qV3e+E33Onhx1SlpS3kfz5Wg=; b=Br+xCkx65UsKwO71C/S7xNvfNAOZy7DHq0nYkpUmPdRqSDSpumWvo6BtW+kyJxjqjs BrCUYREBp9oodhm4kxyKRVRDQx22/VbB6vspvtaj1F3at0ZqVMnMTZvKXWdRakohYrIR 0Pyxii3LwL6uQvAV8iMOHvKUhWQQKPtJeTRiY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=86vCzYb1TStgo558Pk8qV3e+E33Onhx1SlpS3kfz5Wg=; b=lAY/xyBuUgWRhiqjcO4zZ6Y19RMSm0TnTBPvqvbyQubd1v2PBTl0NCfrgiITBNy5if WWEAJtkcKrn67fxRBFmeEIXngWppacA5rqMwRAY3+2IAkYqUg991VFhdB5ZfGOtXLbXE e01/BY2IQ5krzYdE4aWsl7+q0CcjpAfoYybbOjLPzhfmQNEGeWwEIAHHg7ctxJTrpqCg /ZA75Au9m1IrNt0dQmgJGNXrbUnTppl1NvhZk2WLZ53POnpDeJ2G3pTajsinwmGFrx01 /9iDc9nCEoCDk981KK7uHgY0zkAKozrk76z+xpEuzZbzJGGx9wT2zCMFCrrGBwHYMuWk F9fQ== X-Gm-Message-State: ALyK8tKfWWlC1kT+KKv5XTVvMU3vSwCJeT5lse9jaYCQgJ+YL0z6GnHhuqoB1n9ukx3N7I5tM+c= X-Received: by 10.25.134.196 with SMTP id i187mr5358059lfd.157.1466514793302; Tue, 21 Jun 2016 06:13:13 -0700 (PDT) Return-Path: Received: from uffe-Latitude-E6430s.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id ze5sm4978244lbb.8.2016.06.21.06.13.11 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Jun 2016 06:13:11 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Kuninori Morimoto , Geert Uytterhoeven , Nguyen Viet Dung , Magnus Damm , Simon Horman , Baolin Wang Subject: [PATCH 3/5] mmc: sh_mmcif: Use response type to know when to enable busy detection Date: Tue, 21 Jun 2016 15:12:48 +0200 Message-Id: <1466514770-9462-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466514770-9462-1-git-send-email-ulf.hansson@linaro.org> References: <1466514770-9462-1-git-send-email-ulf.hansson@linaro.org> The sh_mmcif explicity checks for certain commands to decide when to enable HW busy detection. Instead, it should only check the response type as it tells if busy detection is needed. In this way, the mmc core also gets full control whether it thinks busy detection should be done or not. In some specific scenarios, like for ERASE and STOP commands it may decide to fall back to use a CMD13 to poll the card status instead. Signed-off-by: Ulf Hansson --- drivers/mmc/host/sh_mmcif.c | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) -- 1.9.1 diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 4d6c59f..96a45d8 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c @@ -819,10 +819,12 @@ static u32 sh_mmcif_set_cmd(struct sh_mmcif_host *host, tmp |= CMD_SET_RTYP_NO; break; case MMC_RSP_R1: - case MMC_RSP_R1B: case MMC_RSP_R3: tmp |= CMD_SET_RTYP_6B; break; + case MMC_RSP_R1B: + tmp |= CMD_SET_RBSY | CMD_SET_RTYP_6B; + break; case MMC_RSP_R2: tmp |= CMD_SET_RTYP_17B; break; @@ -830,17 +832,7 @@ static u32 sh_mmcif_set_cmd(struct sh_mmcif_host *host, dev_err(dev, "Unsupported response type.\n"); break; } - switch (opc) { - /* RBSY */ - case MMC_SLEEP_AWAKE: - case MMC_SWITCH: - case MMC_STOP_TRANSMISSION: - case MMC_SET_WRITE_PROT: - case MMC_CLR_WRITE_PROT: - case MMC_ERASE: - tmp |= CMD_SET_RBSY; - break; - } + /* WDAT / DATW */ if (data) { tmp |= CMD_SET_WDAT; @@ -925,23 +917,13 @@ static void sh_mmcif_start_cmd(struct sh_mmcif_host *host, { struct mmc_command *cmd = mrq->cmd; u32 opc = cmd->opcode; - u32 mask; + u32 mask = 0; unsigned long flags; - switch (opc) { - /* response busy check */ - case MMC_SLEEP_AWAKE: - case MMC_SWITCH: - case MMC_STOP_TRANSMISSION: - case MMC_SET_WRITE_PROT: - case MMC_CLR_WRITE_PROT: - case MMC_ERASE: + if (cmd->flags & MMC_RSP_BUSY) mask = MASK_START_CMD | MASK_MRBSYE; - break; - default: + else mask = MASK_START_CMD | MASK_MCRSPE; - break; - } if (host->ccs_enable) mask |= MASK_MCCSTO;