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: 9190581 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DE41260756 for ; Tue, 21 Jun 2016 13:37:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D145927FAC for ; Tue, 21 Jun 2016 13:37:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C62FE28179; Tue, 21 Jun 2016 13:37:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 716A227FAC for ; Tue, 21 Jun 2016 13:37:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751347AbcFUNhj (ORCPT ); Tue, 21 Jun 2016 09:37:39 -0400 Received: from mail-lf0-f41.google.com ([209.85.215.41]:32931 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751357AbcFUNhh (ORCPT ); Tue, 21 Jun 2016 09:37:37 -0400 Received: by mail-lf0-f41.google.com with SMTP id f6so24264704lfg.0 for ; Tue, 21 Jun 2016 06:37:29 -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=H9rwP4INhdS87JKRZFCU9bfBBNqdvIpwOiWx8JWoDpBolXQjpbccO9pKs91Fuil4iH BDQXMfCIj9VoDxPjvDW1TPTKDI+qWdaDUA3l9gZP8C8Q5+AvE6D2oUNOdsUm77wVNw4Y OxYfyOWd98QXW/B0xnYl2WN+FU1C1oWqEW6KMRIB06QEuMLkXIlqYppCLF9rDT8pTKeD gNLHiC9MBnXoUNjYBcp8+RSkgDwjXFHiVAtXS9QUZm/VPWLn88hW0ZBfTk6mdpc/27GX sIkDs8GxgKNzx7lRAPMsTNsSil7xJIKQbSI4GxnPLM20QMMGIPA9kHmL9M2U9emwbVOL djoA== X-Gm-Message-State: ALyK8tIB9at7w8RnX4waVKIAKJy96ODumW8Ic03XJX2puZOSZTNivJ4OeuS33GMx83U+46y8 X-Received: by 10.25.134.196 with SMTP id i187mr5358059lfd.157.1466514793302; Tue, 21 Jun 2016 06:13:13 -0700 (PDT) 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> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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;