From patchwork Wed Jan 29 22:37:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 23901 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A161A20300 for ; Wed, 29 Jan 2014 22:38:20 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id m1sf9062410oag.5 for ; Wed, 29 Jan 2014 14:38:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=hkCWP2NGND8R+DmIp3NX24k/5kWI2voaMOleG7AiWhE=; b=e+oH0JwlQ7dLkPDkI7zvewJyra8v+x6Pz3Cs2gdy6SLpONXPYnsGD5GuUTraQMKBik 0LABCUfFdLfR1B/OWJtNNjwqJz2tcoP3MvWtzU4qqAPNJ1z1stmIKCmSSedxPggWJG/X 95ec0duIzSg2+u2DgYIZZ+K8OcuoG38JohgDDkqs8QRgYBwG8zFUBx1YU8P0d5/TzDgS rN49ANo8Vp1H37DzZ3LKEC9O+xhvoo7PiZC6ziNN9/kkRZ9uu8ckQsYPf0rAGCOqrt6H 2qRMQVDSxlH33ouL9znmQeML55DVILgjuk3h2pVjhuvOiz/Oj5B8g0hSHUnFNb4ktgId QBNg== X-Gm-Message-State: ALoCoQn/wRkw0abaL7nHpfPAxOYMv73ZeivGy3UM7TpAc+qEv0a7WquUiULEUXzVxt005HViTvic X-Received: by 10.50.18.49 with SMTP id t17mr13158470igd.3.1391035099787; Wed, 29 Jan 2014 14:38:19 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.21.136 with SMTP id 8ls272420qgl.27.gmail; Wed, 29 Jan 2014 14:38:19 -0800 (PST) X-Received: by 10.58.4.138 with SMTP id k10mr8828675vek.8.1391035099600; Wed, 29 Jan 2014 14:38:19 -0800 (PST) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id yv5si1253435veb.26.2014.01.29.14.38.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 14:38:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id cz12so1623972veb.26 for ; Wed, 29 Jan 2014 14:38:19 -0800 (PST) X-Received: by 10.52.248.10 with SMTP id yi10mr1697059vdc.39.1391035099505; Wed, 29 Jan 2014 14:38:19 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp152456vcz; Wed, 29 Jan 2014 14:38:18 -0800 (PST) X-Received: by 10.152.234.202 with SMTP id ug10mr529408lac.28.1391035097797; Wed, 29 Jan 2014 14:38:17 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com [209.85.215.44]) by mx.google.com with ESMTPS id oq4si1977203lbb.57.2014.01.29.14.38.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 14:38:17 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.44 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id hm7so2003102lab.3 for ; Wed, 29 Jan 2014 14:38:17 -0800 (PST) X-Received: by 10.112.157.234 with SMTP id wp10mr660lbb.50.1391035097203; Wed, 29 Jan 2014 14:38:17 -0800 (PST) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id wt2sm3998221lbb.2.2014.01.29.14.38.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 14:38:16 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Dong Aisheng , Stephen Warren , Vladimir Zapolskiy , Adrian Hunter , Ulf Hansson Subject: [PATCH 03/13] mmc: core: Add ignore_crc flag to __mmc_switch Date: Wed, 29 Jan 2014 23:37:55 +0100 Message-Id: <1391035085-2747-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1391035085-2747-1-git-send-email-ulf.hansson@linaro.org> References: <1391035085-2747-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Instead of handle specific adaptations, releated to certain switch operations, inside __mmc_switch, push this to be handled by the caller instead. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 3 ++- drivers/mmc/core/mmc.c | 13 +++++++------ drivers/mmc/core/mmc_ops.c | 19 ++++++++++--------- include/linux/mmc/core.h | 2 +- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 90de094..75ce01d 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -302,7 +302,8 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception) } err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_BKOPS_START, 1, timeout, use_busy_signal, true); + EXT_CSD_BKOPS_START, 1, timeout, + use_busy_signal, true, false); if (err) { pr_warn("%s: Error %d starting bkops\n", mmc_hostname(card->host), err); diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 98e9eb0..ae3489a 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -856,8 +856,8 @@ static int mmc_select_hs200(struct mmc_card *card) /* switch to HS200 mode if bus width set successfully */ if (!err) - err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_HS_TIMING, 2, 0); + err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_HS_TIMING, 2, 0, true, true, true); err: return err; } @@ -1074,9 +1074,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, host->caps2 & MMC_CAP2_HS200) err = mmc_select_hs200(card); else if (host->caps & MMC_CAP_MMC_HIGHSPEED) - err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_HS_TIMING, 1, - card->ext_csd.generic_cmd6_time); + err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_HS_TIMING, 1, + card->ext_csd.generic_cmd6_time, + true, true, true); if (err && err != -EBADMSG) goto free_card; @@ -1404,7 +1405,7 @@ static int mmc_poweroff_notify(struct mmc_card *card, unsigned int notify_type) err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_POWER_OFF_NOTIFICATION, - notify_type, timeout, true, false); + notify_type, timeout, true, false, false); if (err) pr_err("%s: Power Off Notification timed out, %u\n", mmc_hostname(card->host), timeout); diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 3377bbf..5e1a2cb 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -405,17 +405,18 @@ int mmc_spi_set_crc(struct mmc_host *host, int use_crc) * timeout of zero implies maximum possible timeout * @use_busy_signal: use the busy signal as response type * @send_status: send status cmd to poll for busy + * @ignore_crc: ignore CRC errors when sending status cmd to poll for busy * * Modifies the EXT_CSD register for selected card. */ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, - unsigned int timeout_ms, bool use_busy_signal, bool send_status) + unsigned int timeout_ms, bool use_busy_signal, bool send_status, + bool ignore_crc) { int err; struct mmc_command cmd = {0}; unsigned long timeout; u32 status = 0; - bool ignore_crc = false; BUG_ON(!card); BUG_ON(!card->host); @@ -445,14 +446,13 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, return 0; /* - * Must check status to be sure of no errors - * If CMD13 is to check the busy completion of the timing change, - * disable the check of CRC error. + * CRC errors shall only be ignored in cases were CMD13 is used to poll + * to detect busy completion. */ - if (index == EXT_CSD_HS_TIMING && - !(card->host->caps & MMC_CAP_WAIT_WHILE_BUSY)) - ignore_crc = true; + if (card->host->caps & MMC_CAP_WAIT_WHILE_BUSY) + ignore_crc = false; + /* Must check status to be sure of no errors. */ timeout = jiffies + msecs_to_jiffies(MMC_OPS_TIMEOUT_MS); do { if (send_status) { @@ -501,7 +501,8 @@ EXPORT_SYMBOL_GPL(__mmc_switch); int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, unsigned int timeout_ms) { - return __mmc_switch(card, set, index, value, timeout_ms, true, true); + return __mmc_switch(card, set, index, value, timeout_ms, true, true, + false); } EXPORT_SYMBOL_GPL(mmc_switch); diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index b276996..f206e29 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -152,7 +152,7 @@ extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, struct mmc_command *, int); extern void mmc_start_bkops(struct mmc_card *card, bool from_exception); extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool, - bool); + bool, bool); extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd);