From patchwork Wed Nov 16 10:51:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 82475 Delivered-To: patches@linaro.org Received: by 10.140.97.165 with SMTP id m34csp82427qge; Wed, 16 Nov 2016 02:51:45 -0800 (PST) X-Received: by 10.237.36.17 with SMTP id r17mr1202522qtc.216.1479293505069; Wed, 16 Nov 2016 02:51:45 -0800 (PST) Return-Path: Received: from mail-qt0-x232.google.com (mail-qt0-x232.google.com. [2607:f8b0:400d:c0d::232]) by mx.google.com with ESMTPS id t51si6664179qte.228.2016.11.16.02.51.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Nov 2016 02:51:45 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2607:f8b0:400d:c0d::232 as permitted sender) client-ip=2607:f8b0:400d:c0d::232; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2607:f8b0:400d:c0d::232 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-qt0-x232.google.com with SMTP id w33so95827198qtc.3 for ; Wed, 16 Nov 2016 02:51:45 -0800 (PST) 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=iMKtfi64g94YDztgOWJzuIe3FcmkCE4ZRew0bIsv9YU=; b=YiIzFrodzzHjhVi66HM1ewg8sSWHYo9Lf1wJgngsvLxpY4TW7NR6FcdXrIbey/eIGf wbr0mG8rhx5NFpQxA8lwWV/9HERJU7hkZDnCFlOgHXL4SiGzJ9ojCdm7QeOOBpRHidZw F50bcx742JTLOJPdMHc5HxPceslQh5GOD/bcU= 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=iMKtfi64g94YDztgOWJzuIe3FcmkCE4ZRew0bIsv9YU=; b=gFTmmxotsFsIt+c8pE5rsCjPcg6/mE3RAUShZNoI8ldcMYmRzV7QZypFEFwubUn3w/ CMnMIau+S4PP+DP9JxJ7+xFTHEna0Ju4kYCVFxMilQ8Nq1OO3WbPwFug5QmMYPsZ8X3b G3VpjribjvuP5ovK7w3fWXCM2kuQA2WbbwymrWDB8icuapy+JdQz6bI0FM5llmFvjOaN wNv8oV6s8Hv5a1EW2aOYCmGk53iKdM3nowtRW+WQxg4Hb1XZjfI1yR0RfuuYhjbF8ty3 IQRtSR2rcrHcBFrl4YJnhQu9PN5G5peNZuOjQMudbSb0P1HE5syPZi4TYgCGmfQSQgz2 XiZQ== X-Gm-Message-State: ABUngvekkUmtErL+kxleUC99XU/eHpmt8VnGuno2JMmmXqnP7lVJorgP1mC8LOAL2Q1ITjoUfCg= X-Received: by 10.25.166.207 with SMTP id p198mr912081lfe.83.1479293504706; Wed, 16 Nov 2016 02:51:44 -0800 (PST) Return-Path: Received: from uffe-Latitude-E6430s.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 34sm7711369lja.25.2016.11.16.02.51.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Nov 2016 02:51:43 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij , Chaotian Jing , Stephen Boyd , Michael Walle , Yong Mao , Shawn Lin Subject: [PATCH 7/9] mmc: core: Allow CMD13 polling when switch to HS200 mode Date: Wed, 16 Nov 2016 11:51:19 +0100 Message-Id: <1479293481-20186-8-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1479293481-20186-1-git-send-email-ulf.hansson@linaro.org> References: <1479293481-20186-1-git-send-email-ulf.hansson@linaro.org> In cases when the mmc host doesn't support HW busy detection, polling for busy by using CMD13 is beneficial. The reasons have already been explained in earlier change logs. To allow polling with CMD13, let's provide MMC_TIMING_MMC_HS200 as the timing parameter to __mmc_switch(), which makes sure the mmc host and the mmc card operates at the same bus timing during the polling. Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) -- 1.9.1 diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 3268fcd..0b26383 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1351,7 +1351,7 @@ static void mmc_select_driver_type(struct mmc_card *card) static int mmc_select_hs200(struct mmc_card *card) { struct mmc_host *host = card->host; - unsigned int old_timing, old_signal_voltage; + unsigned int old_signal_voltage; int err = -EINVAL; u8 val; @@ -1378,22 +1378,11 @@ static int mmc_select_hs200(struct mmc_card *card) card->drive_strength << EXT_CSD_DRV_STR_SHIFT; err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, val, - card->ext_csd.generic_cmd6_time, 0, - true, false, true); - if (err) - goto err; - old_timing = host->ios.timing; - mmc_set_timing(host, MMC_TIMING_MMC_HS200); - - err = mmc_switch_status(card); - /* - * mmc_select_timing() assumes timing has not changed if - * it is a switch error. - */ - if (err == -EBADMSG) - mmc_set_timing(host, old_timing); + card->ext_csd.generic_cmd6_time, + MMC_TIMING_MMC_HS200, + true, true, true); } -err: + if (err) { /* fall back to the old signal voltage, if fails report error */ if (__mmc_set_signal_voltage(host, old_signal_voltage))