From patchwork Tue Nov 22 20:56:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 83505 Delivered-To: patches@linaro.org Received: by 10.140.97.165 with SMTP id m34csp2310962qge; Tue, 22 Nov 2016 12:56:32 -0800 (PST) X-Received: by 10.28.26.80 with SMTP id a77mr123743wma.31.1479848192720; Tue, 22 Nov 2016 12:56:32 -0800 (PST) Return-Path: Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com. [2a00:1450:400c:c09::22a]) by mx.google.com with ESMTPS id jo3si27575678wjc.34.2016.11.22.12.56.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 12:56:32 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c09::22a as permitted sender) client-ip=2a00:1450:400c:c09::22a; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c09::22a as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-wm0-x22a.google.com with SMTP id a197so46222757wmd.0 for ; Tue, 22 Nov 2016 12:56:32 -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=2nsnSX0fVfqkd1RgLh6oWN0LZeVX087MUuLqhBMve6Y=; b=MlBVwIteGPk1oVzpVETiFp7WwpNjnnfsujhasWsLWIoHVql91OccwJ3DiCU9oOcI3E Jo9ALiFfpkJZal5o4XuN+ZuOqwX3UdAOwAG2v1EAnf+XbOyx4AT2Cryd0kqqfG52Ftm8 GQobyBQ+PugJX6zvGZmZTr37VDOWla9IHN3FA= 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=2nsnSX0fVfqkd1RgLh6oWN0LZeVX087MUuLqhBMve6Y=; b=JWAoxbvOY51L2Rnfj42dB/k2Zn9e29UpZpKDlq5yauKa8QHJL02A+m9uT3BAWC8K5v S1eCuElT/J5iyxtpHtMGWhT9AFkBId8drzDZOs3Nrn/7o8t5CJ6RCQYJAXAxfw7oqVoS BwCnyu59YDnHH371W7HidKcXmIQmdHcg5ZAURBheyff41WkpO/mgwS3pDKYaD9I2XKvo izTOejJN4Jl2hBuDUpgdBq8QXoscb6gK1Nsi+zF4qCqHJC7WaA6pvrtCpD2rNTcg2Okh Kcz/xR/qg1B15SDTRXHy+sZnAxK71U4CyebKIgVFa5prY2mt06KqDSk5XEUcTI9jq2id B4SQ== X-Gm-Message-State: AKaTC01XNeR3jo/tm34UtN/ts+oFCNdJnEP2nyxny84t8guQf38r6rT55C1u3eraYfvT48TIcgY= X-Received: by 10.46.0.229 with SMTP id e98mr12611354lji.33.1479848192311; Tue, 22 Nov 2016 12:56:32 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-155-4-221-67.na.cust.bahnhof.se. [155.4.221.67]) by smtp.gmail.com with ESMTPSA id 196sm6619988lff.3.2016.11.22.12.56.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Nov 2016 12:56:31 -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 v2 7/7] mmc: core: Update CMD13 polling policy when switch to HS DDR mode Date: Tue, 22 Nov 2016 21:56:13 +0100 Message-Id: <1479848173-20881-8-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1479848173-20881-1-git-send-email-ulf.hansson@linaro.org> References: <1479848173-20881-1-git-send-email-ulf.hansson@linaro.org> According to the JEDEC specification, during bus timing change operations for mmc, sending a CMD13 could trigger CRC errors. As switching to HS DDR mode indeed causes a bus timing change, polling with CMD13 to detect card busy, may thus potentially trigger CRC errors. Currently these errors are treated as the switch to HS DDR mode failed. To improve this behaviour, let's instead tell __mmc_switch() to retry when it encounters CRC errors during polling. Moreover, when switching to HS DDR mode, let's make sure the CMD13 polling is done by having the mmc host and the mmc card, being configured to operate at the same selected bus speed timing. Fix this by providing MMC_TIMING_MMC_DDR52 as the timing parameter to __mmc_switch(). Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) -- 1.9.1 diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 15dd51c..3268fcd 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1040,10 +1040,12 @@ static int mmc_select_hs_ddr(struct mmc_card *card) ext_csd_bits = (bus_width == MMC_BUS_WIDTH_8) ? EXT_CSD_DDR_BUS_WIDTH_8 : EXT_CSD_DDR_BUS_WIDTH_4; - err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_BUS_WIDTH, - ext_csd_bits, - card->ext_csd.generic_cmd6_time); + err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_BUS_WIDTH, + ext_csd_bits, + card->ext_csd.generic_cmd6_time, + MMC_TIMING_MMC_DDR52, + true, true, true); if (err) { pr_err("%s: switch to bus width %d ddr failed\n", mmc_hostname(host), 1 << bus_width); @@ -1086,9 +1088,6 @@ static int mmc_select_hs_ddr(struct mmc_card *card) if (err) err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330); - if (!err) - mmc_set_timing(host, MMC_TIMING_MMC_DDR52); - return err; }