From patchwork Thu Jun 8 13:27:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 103386 Delivered-To: patches@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2439488qgd; Thu, 8 Jun 2017 06:27:52 -0700 (PDT) X-Received: by 10.25.99.21 with SMTP id x21mr8300213lfb.66.1496928472752; Thu, 08 Jun 2017 06:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496928472; cv=none; d=google.com; s=arc-20160816; b=G/omNv0pdgMB6K/J8A+LhA6/jY3VG82b/lwvQ2j2tGB/eDwFS2i84S8pMeoFupRJEL Vw0TdudpGqad9kZJB39M2JbHunj2DIog4j1z8SMgmcCWkYTHRR0uFh6Yj0+ZiusVZ5qi 4HKrmQYhQ0UboSjxPY6pC0nQhTsteOj3CsyXhjcMtrciP03QNguyMeME/9jGlIbUI4j2 vZDKRKrg+CSe5Itqkl9QK4aCsaSNqzIAqiDUV/Jrq0+nLhUe/j4I1U8EQXpiMYphY8aq bgWVEohhcmGW45uxAptUyiUKY/fM0DX1rz0FkGzMV0wlPNLKImHsVpOkOEoz9MUttwNa X7Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=7z2OTnMY2snlFgfVVM1YRNOb2WURM9yGBCrSTGfExzU=; b=o6t9wXAKotOLDaWlGxe727d0ll4qA9LMuupM7x3R6Raz/3j+UtSTJIiNyNUAOWmsnQ i6uUZuaORCdxFzrOsWn2A5AfQoOiRmzM4Jp01pYmbT0N0J9lg+cCRCQkmQ3WdsItvDW9 2bL8nG+vxgCyQV/99l7Y+bsArUEOf+/Is0A1Vf4EQOF8JNbVqn/+gDQ5x2+HNttHgFR9 sF1DTWsLNTuYAQGwPO14ZnDFQuN1nTBUHkwcvGZ5hRaYycgpwmr1cJWu1fvV9zKSWiEY zqpMpgOGT/1c0ccowsIsG6QoYwzJhDS0b8iPgCTkr/O5mmGgie+2McYb9vJPpRftiO3N GMpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::229 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-lf0-x229.google.com (mail-lf0-x229.google.com. [2a00:1450:4010:c07::229]) by mx.google.com with ESMTPS id b68si2420094lfg.114.2017.06.08.06.27.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 06:27:52 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::229 as permitted sender) client-ip=2a00:1450:4010:c07::229; 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::229 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x229.google.com with SMTP id o83so18027012lff.3 for ; Thu, 08 Jun 2017 06:27:52 -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=7z2OTnMY2snlFgfVVM1YRNOb2WURM9yGBCrSTGfExzU=; b=hVZeGLQ2P5zdD5Sdp10LHOU7MbfKggGErKNH8YMU5cHcTqK4pLrDyt5Y6w7ypUGCaN S3H+4h1W17WVyYklpRl2szmAlu9xUAVw7tGgYHBJrQc0Pb0pOUdO6JkjN5+EhC3n5aJL rFkjJ1Pq1I//8onD2be8HmubxL6CIFxPjaXto= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7z2OTnMY2snlFgfVVM1YRNOb2WURM9yGBCrSTGfExzU=; b=UL44s3Wq4l1r1Lxihv/cn8xtq2iPrnb0HQJZZBXLJZcCjspYlm3YnzgM6Joq5cBkTq m3FvyqTVCOkYtdNjg9TbTXDSPAJVhWGeAuEjbVwqs5/g9P04odD29tULR6YhC+yCHyHN /GXrxbkUZhiRlskedqVoVYS0/saBvQNv5vKiAeJdNS2SnQPg45IjyeDq5ib+acpwEt0q 49ryeN9VcJZ8ahNeAyMSgbaOl9DQqDDt4h+eFiJ1jXAXahbWjzwW61ONfIFuq9eJpGa9 MioAR+YgHTLCVHxn8iRbLT2WzsIMO+397a4qj2k8xS3ReUxGB+HaFebbwLw2chvjZAm7 mKnA== X-Gm-Message-State: AODbwcBFmZZnj7O2suCGKEkYIxGdqZpARFxGgHzmNTHiT25RLtZywGQX 8AARet6GHWQkfeNdhCjL2MO1 X-Received: by 10.46.13.1 with SMTP id 1mr11884355ljn.134.1496928472252; Thu, 08 Jun 2017 06:27:52 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i8sm1025178ljb.55.2017.06.08.06.27.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 06:27:51 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij Subject: [PATCH 1/9] mmc: core: Don't export some eMMC specific functions from core.c Date: Thu, 8 Jun 2017 15:27:37 +0200 Message-Id: <1496928465-25004-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> References: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> The mmc_start|stop_bkops(), mmc_read_bkops_status() and mmc_interrupt_hpi() functions are all used from within the mmc core module, thus there are no need to use EXPORT_SYMBOL() for them, so let's remove it. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 4 ---- 1 file changed, 4 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index ad8caf4..d48be0b 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -428,7 +428,6 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception) out: mmc_release_host(card->host); } -EXPORT_SYMBOL(mmc_start_bkops); /* * mmc_wait_data_done() - done callback for data request @@ -811,7 +810,6 @@ int mmc_interrupt_hpi(struct mmc_card *card) mmc_release_host(card->host); return err; } -EXPORT_SYMBOL(mmc_interrupt_hpi); /** * mmc_wait_for_cmd - start a command and wait for completion @@ -869,7 +867,6 @@ int mmc_stop_bkops(struct mmc_card *card) return err; } -EXPORT_SYMBOL(mmc_stop_bkops); int mmc_read_bkops_status(struct mmc_card *card) { @@ -887,7 +884,6 @@ int mmc_read_bkops_status(struct mmc_card *card) kfree(ext_csd); return 0; } -EXPORT_SYMBOL(mmc_read_bkops_status); /** * mmc_set_data_timeout - set the timeout for a data command From patchwork Thu Jun 8 13:27:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 103387 Delivered-To: patches@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2439500qgd; Thu, 8 Jun 2017 06:27:53 -0700 (PDT) X-Received: by 10.46.9.213 with SMTP id 204mr7693578ljj.120.1496928473801; Thu, 08 Jun 2017 06:27:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496928473; cv=none; d=google.com; s=arc-20160816; b=FPE7Byg6E88mJNlh424bCDAXX2nywGAANHC2xiUKJvUg3pjSnA/UH0IHnf1uKJLxtI oETRCwpXjSKi2TU/vgUJWWKcPepo1E6Lv0JcydFUihG7QwcYxeGyrMuSPdN4IxOzJ26T 3i+NQF+q1C2/HhAJxhb5SdxHKMumjcQIcSo2PtIpkJVrV+3B4RcSuGIOOrQGjI6phBS+ 98DcDvseRXsZ4tHSLckT9/1Qosj3T08ADqmJS9wJbm4jVUFviY0r2DpHTmcU1WBincc0 +zk9CYj00Yx6lTVQpPOcpbij46WWotjEmJzZ2a7opemf16xpHtieL/yzosGJJveAsPgi Y9Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=PZ3muIOnQn28AMZ2/pTLwJo3cbD5VMUBK2MN9yQ0dCU=; b=uUD+188TkEvj2jsHVTgk+Df+UtVsni3o06lhhQCqci+nWcVCA47uq9jw2xgZ9+CUSm f599yYiFmqIZekgHKW89PNJgpg0GvFj6jmZcJVBZCfhTt771Fdje3gzQ0eUawaayDdTg v+RHDeZ4HPWQBov7rHm2oAd41sLEvN+V60peC7WXADVVuRYxOgXwHFO0jwJviNdjuL0V KZW+3Ncd6b6j1DBQMFsZ23/jk0g1JAdPdYQ1gxDrid1CXKCuQOJf1vk/sw3huRzbTRuG gD8xb2UFAOcf3qSVEWqEYIgqSatxEKz9GYniOnn9MT2bNwbvEohonBaEwlXsbl7oqExn Bjvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::233 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-lf0-x233.google.com (mail-lf0-x233.google.com. [2a00:1450:4010:c07::233]) by mx.google.com with ESMTPS id c135si2545543lfe.407.2017.06.08.06.27.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 06:27:53 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::233 as permitted sender) client-ip=2a00:1450:4010:c07::233; 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::233 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x233.google.com with SMTP id a136so18051956lfa.0 for ; Thu, 08 Jun 2017 06:27:53 -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=PZ3muIOnQn28AMZ2/pTLwJo3cbD5VMUBK2MN9yQ0dCU=; b=TqHPDhDchN5Yc4mywRMTUl1FXWkNbxx/UHz+d88kEGMA9aOKPi6xvvrtOWU1zYhmty Dp8sveA+98ks0Oz9G45rVbvXcWvaAhttJigKSEDZr8fKFTfp5gAWUOGxD5zx4tSt+85W KgFzUtRWFOXXKLK15/dX4QpOKo+OF3qkJ5EHQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PZ3muIOnQn28AMZ2/pTLwJo3cbD5VMUBK2MN9yQ0dCU=; b=FChTrxZu7ESD0IQZyvC4bgp7ZcboxrZg/SDbOafoIRCVuIqBaz5omF6Qxh9E1WuLVB 6KlNW1zdQW7r6dnnWw4kLLFoRA2dD8kAQYg+f9b4mb36ZdDqlguvfaxv5neWV7FdUFiR HpZM+55S695N5XAKpABLn3C9GA4VZRXX/tb3o1gp+dYanEgPlKfC73Wp/Cj+7elUXAJ6 xwaJejil2CT6HCjIzO0uK59shUNEMvOBENXFpC8Abw4/1AO0bB15wWWCnoeD07MaaKUc 8y6NEFgZFCw5bPhJuVNagy0fxrR7w9ThDeaQabLpufYjXG8j9W3IN08v966iKiqpxTwl 9jag== X-Gm-Message-State: AODbwcCOenm1PJAylUPx7/y6SourhVWDFLPTWV6Io4blybCCjOn+IEYW jkduUVm9vhtlrUGvpHE= X-Received: by 10.25.35.81 with SMTP id j78mr4220352lfj.27.1496928473337; Thu, 08 Jun 2017 06:27:53 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i8sm1025178ljb.55.2017.06.08.06.27.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 06:27:52 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij Subject: [PATCH 2/9] mmc: core: Move mmc bkops functions from core.c to mmc_ops.c Date: Thu, 8 Jun 2017 15:27:38 +0200 Message-Id: <1496928465-25004-3-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> References: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> The mmc_start_bkops(), mmc_stop_bkops() and mmc_read_bkops_status() functions are all specific to eMMCs. To make this clear, let's move them from from core.c to mmc_ops.c. While moving them, get rid of MMC_BKOPS_MAX_TIMEOUT (4 min) and use the common default timeout MMC_OPS_TIMEOUT_MS (10 min) instead, as there is no need to have specific default timeout for bkops. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 118 --------------------------------------------- drivers/mmc/core/mmc_ops.c | 113 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 118 deletions(-) -- 2.7.4 Reviewed-by: Linus Walleij diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index d48be0b..d7c934c 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -53,12 +53,6 @@ /* If the device is not responding */ #define MMC_CORE_TIMEOUT_MS (10 * 60 * 1000) /* 10 minute timeout */ -/* - * Background operations can take a long time, depending on the housekeeping - * operations the card has to perform. - */ -#define MMC_BKOPS_MAX_TIMEOUT (4 * 60 * 1000) /* max time to wait in ms */ - /* The max erase timeout, used when host->max_busy_timeout isn't specified */ #define MMC_ERASE_TIMEOUT_MS (60 * 1000) /* 60 s */ @@ -362,73 +356,6 @@ static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) return 0; } -/** - * mmc_start_bkops - start BKOPS for supported cards - * @card: MMC card to start BKOPS - * @form_exception: A flag to indicate if this function was - * called due to an exception raised by the card - * - * Start background operations whenever requested. - * When the urgent BKOPS bit is set in a R1 command response - * then background operations should be started immediately. -*/ -void mmc_start_bkops(struct mmc_card *card, bool from_exception) -{ - int err; - int timeout; - bool use_busy_signal; - - if (!card->ext_csd.man_bkops_en || mmc_card_doing_bkops(card)) - return; - - err = mmc_read_bkops_status(card); - if (err) { - pr_err("%s: Failed to read bkops status: %d\n", - mmc_hostname(card->host), err); - return; - } - - if (!card->ext_csd.raw_bkops_status) - return; - - if (card->ext_csd.raw_bkops_status < EXT_CSD_BKOPS_LEVEL_2 && - from_exception) - return; - - mmc_claim_host(card->host); - if (card->ext_csd.raw_bkops_status >= EXT_CSD_BKOPS_LEVEL_2) { - timeout = MMC_BKOPS_MAX_TIMEOUT; - use_busy_signal = true; - } else { - timeout = 0; - use_busy_signal = false; - } - - mmc_retune_hold(card->host); - - err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_BKOPS_START, 1, timeout, 0, - use_busy_signal, true, false); - if (err) { - pr_warn("%s: Error %d starting bkops\n", - mmc_hostname(card->host), err); - mmc_retune_release(card->host); - goto out; - } - - /* - * For urgent bkops status (LEVEL_2 and more) - * bkops executed synchronously, otherwise - * the operation is in progress - */ - if (!use_busy_signal) - mmc_card_set_doing_bkops(card); - else - mmc_retune_release(card->host); -out: - mmc_release_host(card->host); -} - /* * mmc_wait_data_done() - done callback for data request * @mrq: done data request @@ -841,51 +768,6 @@ int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd, int retries EXPORT_SYMBOL(mmc_wait_for_cmd); /** - * mmc_stop_bkops - stop ongoing BKOPS - * @card: MMC card to check BKOPS - * - * Send HPI command to stop ongoing background operations to - * allow rapid servicing of foreground operations, e.g. read/ - * writes. Wait until the card comes out of the programming state - * to avoid errors in servicing read/write requests. - */ -int mmc_stop_bkops(struct mmc_card *card) -{ - int err = 0; - - err = mmc_interrupt_hpi(card); - - /* - * If err is EINVAL, we can't issue an HPI. - * It should complete the BKOPS. - */ - if (!err || (err == -EINVAL)) { - mmc_card_clr_doing_bkops(card); - mmc_retune_release(card->host); - err = 0; - } - - return err; -} - -int mmc_read_bkops_status(struct mmc_card *card) -{ - int err; - u8 *ext_csd; - - mmc_claim_host(card->host); - err = mmc_get_ext_csd(card, &ext_csd); - mmc_release_host(card->host); - if (err) - return err; - - card->ext_csd.raw_bkops_status = ext_csd[EXT_CSD_BKOPS_STATUS]; - card->ext_csd.raw_exception_status = ext_csd[EXT_CSD_EXP_EVENTS_STATUS]; - kfree(ext_csd); - return 0; -} - -/** * mmc_set_data_timeout - set the timeout for a data command * @data: data phase for command * @card: the MMC card associated with the data transfer diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index ae1fc48..0648fae 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -19,6 +19,7 @@ #include #include "core.h" +#include "card.h" #include "host.h" #include "mmc_ops.h" @@ -845,6 +846,118 @@ int mmc_can_ext_csd(struct mmc_card *card) return (card && card->csd.mmca_vsn > CSD_SPEC_VER_3); } +/** + * mmc_stop_bkops - stop ongoing BKOPS + * @card: MMC card to check BKOPS + * + * Send HPI command to stop ongoing background operations to + * allow rapid servicing of foreground operations, e.g. read/ + * writes. Wait until the card comes out of the programming state + * to avoid errors in servicing read/write requests. + */ +int mmc_stop_bkops(struct mmc_card *card) +{ + int err = 0; + + err = mmc_interrupt_hpi(card); + + /* + * If err is EINVAL, we can't issue an HPI. + * It should complete the BKOPS. + */ + if (!err || (err == -EINVAL)) { + mmc_card_clr_doing_bkops(card); + mmc_retune_release(card->host); + err = 0; + } + + return err; +} + +int mmc_read_bkops_status(struct mmc_card *card) +{ + int err; + u8 *ext_csd; + + mmc_claim_host(card->host); + err = mmc_get_ext_csd(card, &ext_csd); + mmc_release_host(card->host); + if (err) + return err; + + card->ext_csd.raw_bkops_status = ext_csd[EXT_CSD_BKOPS_STATUS]; + card->ext_csd.raw_exception_status = ext_csd[EXT_CSD_EXP_EVENTS_STATUS]; + kfree(ext_csd); + return 0; +} + +/** + * mmc_start_bkops - start BKOPS for supported cards + * @card: MMC card to start BKOPS + * @form_exception: A flag to indicate if this function was + * called due to an exception raised by the card + * + * Start background operations whenever requested. + * When the urgent BKOPS bit is set in a R1 command response + * then background operations should be started immediately. +*/ +void mmc_start_bkops(struct mmc_card *card, bool from_exception) +{ + int err; + int timeout; + bool use_busy_signal; + + if (!card->ext_csd.man_bkops_en || mmc_card_doing_bkops(card)) + return; + + err = mmc_read_bkops_status(card); + if (err) { + pr_err("%s: Failed to read bkops status: %d\n", + mmc_hostname(card->host), err); + return; + } + + if (!card->ext_csd.raw_bkops_status) + return; + + if (card->ext_csd.raw_bkops_status < EXT_CSD_BKOPS_LEVEL_2 && + from_exception) + return; + + mmc_claim_host(card->host); + if (card->ext_csd.raw_bkops_status >= EXT_CSD_BKOPS_LEVEL_2) { + timeout = MMC_OPS_TIMEOUT_MS; + use_busy_signal = true; + } else { + timeout = 0; + use_busy_signal = false; + } + + mmc_retune_hold(card->host); + + err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_BKOPS_START, 1, timeout, 0, + use_busy_signal, true, false); + if (err) { + pr_warn("%s: Error %d starting bkops\n", + mmc_hostname(card->host), err); + mmc_retune_release(card->host); + goto out; + } + + /* + * For urgent bkops status (LEVEL_2 and more) + * bkops executed synchronously, otherwise + * the operation is in progress + */ + if (!use_busy_signal) + mmc_card_set_doing_bkops(card); + else + mmc_retune_release(card->host); +out: + mmc_release_host(card->host); +} + static int mmc_cmdq_switch(struct mmc_card *card, bool enable) { u8 val = enable ? EXT_CSD_CMDQ_MODE_ENABLED : 0; From patchwork Thu Jun 8 13:27:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 103394 Delivered-To: patches@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2439515qgd; Thu, 8 Jun 2017 06:27:55 -0700 (PDT) X-Received: by 10.25.18.168 with SMTP id 40mr7364366lfs.26.1496928475077; Thu, 08 Jun 2017 06:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496928475; cv=none; d=google.com; s=arc-20160816; b=ST76kdwpAkIJVweIECfDCPt6WGmfnR9sXfy4wX+CSoBMMCTWH7vgBzhf80p276PU6Z 6x9yQfo/dIZO5w0nkVuklvWKvX2RcnxGys/no8tXfdKvIBjxGGjAtGUJuerpVWpqU6Gj JnQ2PQkLGaiMIFPCMPVSpP8Q3Z7L0mdIkn3WV572aasl8NIRNcuBc3GQkdoiB9jVREvi AIYfw3OiPnxIOCrpj2RP0P/rAT0uQW8gPoqoO/MLWD6DzzwWydqFwvvauNewIrLp1AdO 8EQjM7TCi4nl2KWj+dIHjyNQOzVOsKgtvIl8LOwfOaRy00zc1zIfZomqI8x9zoksXhsh Xyog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=pi0uGWY1EG1C1S4KEdyNrf/1J9zy8gEPM0ZzihNJFX8=; b=d0PCgXnsvM+d4tvcnxcqpKtRAKeQ7yr0tW+r9DF3Vcapw50iEh/kLdpuMNMCt2RBKx Ppmx/bqGOwX+GSJ/6GTXCF8P2E2znR/zUeKd7EGEd7XtKT3gAt7agRK1115IqNAy+e8I DVWGcsHl3I2FsLphI4wU1eSLfxHXzXT+VPtgD8Vn2kYQ7ja8jmuCHtKVwATG0hBLQ7lT q5gJNmz3bLs84ud370i9AYhkmvjnlRzpH/U3Eh1EGcLlvvKpwmw/M/0pWaT3gNAJFcoP G4hrq88fb+1Qkhr7KZ7ExFwydBX6mTMloV4j246/vLxyF5zjzIrQqPKhYO9UugVnhRO/ e2Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22e as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-lf0-x22e.google.com (mail-lf0-x22e.google.com. [2a00:1450:4010:c07::22e]) by mx.google.com with ESMTPS id b73si2570683lfb.87.2017.06.08.06.27.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 06:27:55 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22e as permitted sender) client-ip=2a00:1450:4010:c07::22e; 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::22e as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x22e.google.com with SMTP id a136so18052199lfa.0 for ; Thu, 08 Jun 2017 06:27:54 -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=pi0uGWY1EG1C1S4KEdyNrf/1J9zy8gEPM0ZzihNJFX8=; b=E5VP7XVEAxTTN8uDStnEuJ3RXseH2BBVC5QA6ESbtwumQsELLJ+k9MM1IvX2luTpsY uztcppZdBWDGs9y7c+DQdpc3EHpbyZKwPt7Mogz2cjNk+eOwS7lh6rmqlPNqpvCQr2Do Q934dY90DEiZMqetc3osgDm9mC2OMWmMpm7b4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pi0uGWY1EG1C1S4KEdyNrf/1J9zy8gEPM0ZzihNJFX8=; b=o9ZjrVJgvhvKdmJfAFeHTgqVldfjc7ERuP74gETyE5j9oINGTJ1JTtBBTfmQu5Ervw iRT/fe0ArcYomMbi/A8/6xVBa/iRGrxzfjyENX3lVu+ZnfxLZlMV2oElEJCJ6J05dk8b TEQyoFJeg64whvqjkd5qEVeKlORAwMReNYguDvmuqd1woYGDV/lsId6pq9b2UE9D+Ug0 EvX0/dJ7x/kcDTZ6Cra8OEci0d7m5C2/Nb9p17P3J+Kcpunx/GdvAikebAo97ZzhjH72 jo6n2FR+VpWuJp/HI1fo9qeoQAZ3/L650Q246SS7PqZl5x4s61kODeETIQwzkjekwJbi NKrw== X-Gm-Message-State: AODbwcBQdm/QMAnW6+jjPyN7lW2llr07bd/WCFOhsd4tEKw2TiSGl6RK yStG5VpeOgSMFvmlork= X-Received: by 10.25.210.6 with SMTP id j6mr10626911lfg.21.1496928474655; Thu, 08 Jun 2017 06:27:54 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i8sm1025178ljb.55.2017.06.08.06.27.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 06:27:53 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij Subject: [PATCH 3/9] mmc: core: Move mmc_interrupt_hpi() from core.c to mmc_ops.c Date: Thu, 8 Jun 2017 15:27:39 +0200 Message-Id: <1496928465-25004-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> References: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> The mmc_interrupt_hpi() is a eMMC specific function, let's move it to mmc_ops.c to make that clear. The move also enables us to make mmc_send_hpi_cmd() static, so let's do that change as well. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 64 -------------------------------------------- drivers/mmc/core/mmc_ops.c | 66 +++++++++++++++++++++++++++++++++++++++++++++- drivers/mmc/core/mmc_ops.h | 1 - 3 files changed, 65 insertions(+), 66 deletions(-) -- 2.7.4 Reviewed-by: Linus Walleij diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index d7c934c..de31f30 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -675,70 +675,6 @@ void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq) EXPORT_SYMBOL(mmc_wait_for_req); /** - * mmc_interrupt_hpi - Issue for High priority Interrupt - * @card: the MMC card associated with the HPI transfer - * - * Issued High Priority Interrupt, and check for card status - * until out-of prg-state. - */ -int mmc_interrupt_hpi(struct mmc_card *card) -{ - int err; - u32 status; - unsigned long prg_wait; - - if (!card->ext_csd.hpi_en) { - pr_info("%s: HPI enable bit unset\n", mmc_hostname(card->host)); - return 1; - } - - mmc_claim_host(card->host); - err = mmc_send_status(card, &status); - if (err) { - pr_err("%s: Get card status fail\n", mmc_hostname(card->host)); - goto out; - } - - switch (R1_CURRENT_STATE(status)) { - case R1_STATE_IDLE: - case R1_STATE_READY: - case R1_STATE_STBY: - case R1_STATE_TRAN: - /* - * In idle and transfer states, HPI is not needed and the caller - * can issue the next intended command immediately - */ - goto out; - case R1_STATE_PRG: - break; - default: - /* In all other states, it's illegal to issue HPI */ - pr_debug("%s: HPI cannot be sent. Card state=%d\n", - mmc_hostname(card->host), R1_CURRENT_STATE(status)); - err = -EINVAL; - goto out; - } - - err = mmc_send_hpi_cmd(card, &status); - if (err) - goto out; - - prg_wait = jiffies + msecs_to_jiffies(card->ext_csd.out_of_int_time); - do { - err = mmc_send_status(card, &status); - - if (!err && R1_CURRENT_STATE(status) == R1_STATE_TRAN) - break; - if (time_after(jiffies, prg_wait)) - err = -ETIMEDOUT; - } while (!err); - -out: - mmc_release_host(card->host); - return err; -} - -/** * mmc_wait_for_cmd - start a command and wait for completion * @host: MMC host to start command * @cmd: MMC command to start diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 0648fae..53e4da48 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -807,7 +807,7 @@ int mmc_bus_test(struct mmc_card *card, u8 bus_width) return mmc_send_bus_test(card, card->host, MMC_BUS_TEST_R, width); } -int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status) +static int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status) { struct mmc_command cmd = {}; unsigned int opcode; @@ -841,6 +841,70 @@ int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status) return 0; } +/** + * mmc_interrupt_hpi - Issue for High priority Interrupt + * @card: the MMC card associated with the HPI transfer + * + * Issued High Priority Interrupt, and check for card status + * until out-of prg-state. + */ +int mmc_interrupt_hpi(struct mmc_card *card) +{ + int err; + u32 status; + unsigned long prg_wait; + + if (!card->ext_csd.hpi_en) { + pr_info("%s: HPI enable bit unset\n", mmc_hostname(card->host)); + return 1; + } + + mmc_claim_host(card->host); + err = mmc_send_status(card, &status); + if (err) { + pr_err("%s: Get card status fail\n", mmc_hostname(card->host)); + goto out; + } + + switch (R1_CURRENT_STATE(status)) { + case R1_STATE_IDLE: + case R1_STATE_READY: + case R1_STATE_STBY: + case R1_STATE_TRAN: + /* + * In idle and transfer states, HPI is not needed and the caller + * can issue the next intended command immediately + */ + goto out; + case R1_STATE_PRG: + break; + default: + /* In all other states, it's illegal to issue HPI */ + pr_debug("%s: HPI cannot be sent. Card state=%d\n", + mmc_hostname(card->host), R1_CURRENT_STATE(status)); + err = -EINVAL; + goto out; + } + + err = mmc_send_hpi_cmd(card, &status); + if (err) + goto out; + + prg_wait = jiffies + msecs_to_jiffies(card->ext_csd.out_of_int_time); + do { + err = mmc_send_status(card, &status); + + if (!err && R1_CURRENT_STATE(status) == R1_STATE_TRAN) + break; + if (time_after(jiffies, prg_wait)) + err = -ETIMEDOUT; + } while (!err); + +out: + mmc_release_host(card->host); + return err; +} + int mmc_can_ext_csd(struct mmc_card *card) { return (card && card->csd.mmca_vsn > CSD_SPEC_VER_3); diff --git a/drivers/mmc/core/mmc_ops.h b/drivers/mmc/core/mmc_ops.h index b8d0552..063500c 100644 --- a/drivers/mmc/core/mmc_ops.h +++ b/drivers/mmc/core/mmc_ops.h @@ -31,7 +31,6 @@ int mmc_send_cid(struct mmc_host *host, u32 *cid); int mmc_spi_read_ocr(struct mmc_host *host, int highcap, u32 *ocrp); int mmc_spi_set_crc(struct mmc_host *host, int use_crc); int mmc_bus_test(struct mmc_card *card, u8 bus_width); -int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status); int mmc_interrupt_hpi(struct mmc_card *card); int mmc_can_ext_csd(struct mmc_card *card); int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd); From patchwork Thu Jun 8 13:27:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 103388 Delivered-To: patches@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2439525qgd; Thu, 8 Jun 2017 06:27:56 -0700 (PDT) X-Received: by 10.25.18.154 with SMTP id 26mr10022466lfs.176.1496928476382; Thu, 08 Jun 2017 06:27:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496928476; cv=none; d=google.com; s=arc-20160816; b=Wg1eRyAp0j94aPoeaxcM+XTp/usjsxilaF7jdHnQhMlGPLiQmuQ36BOopBI2TdF7Fi LGO+kpVWHwFO9p+V9s41DjoPCsyegeT2Y5izUHxiNGdaAzeaWgqr/QGqfIAv2QKrwjKk svK5M9yy0pilrfCJFB3Kqw1omRr4Qdda6d2Gfrp220Wfk5bHYYCAf3Yf82rQxIg31mix jHMKROKCiAx7VbKIFzYHdL7AdflmwmHXDJ49Eyzl/EgNdVEVpoZMv3xagA4WT4arhU3r 91jwJJw+6gyKo9Lr2+6KrZ/nyD2/FZzYFLkkklLwscVXhEEzzzU3xpfpvPsopZbTVXoM T+lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=oGnESwVEVw9CBhkEzwv4OisHXcw7Gcl+TzSvzqRXWX0=; b=YE1jsEo/V0moUWGFYqiTs+tLWliChgb1nMYPluZcWmIc0jjmMse92E1TNESt+k4TOu V3bF0SvboftldcnoJfrnXGq/svHcwo1ikT9z8S6a2exrl21TDRabhkP5x74uzWj2BK+r iv6On8yqVfszvj0669aYn/W5Ifs5jE5Dg2XAq7xUYnOdGHCfJdZ/I8pn2/7+M7AN7NAu hQ2zZg6u7I5zC/a/DRhdm+GZU4Ub9K5WHk10IcbAIhU7sG7kMzNzRr1952zyWdh2ADeN EcFgB7kSfx/E6eqGJ/zdqCou3NZjWxkKUpc2XRquwUHaXW+2vMSZosMd5KuX2RAF3n6h 0ewg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::235 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-lf0-x235.google.com (mail-lf0-x235.google.com. [2a00:1450:4010:c07::235]) by mx.google.com with ESMTPS id f22si2518571lfa.275.2017.06.08.06.27.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 06:27:56 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::235 as permitted sender) client-ip=2a00:1450:4010:c07::235; 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::235 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x235.google.com with SMTP id o83so18027681lff.3 for ; Thu, 08 Jun 2017 06:27:56 -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=oGnESwVEVw9CBhkEzwv4OisHXcw7Gcl+TzSvzqRXWX0=; b=FQ3ZWQfHnS8rfnkBEY1OfI8QDjp3/yHgp38lTAOlDN7RtvsjdcxwbmMpgz/LOGRZ4x yAQlwc47DErb4eMKCV2DqxJmVGe3goLFdFiY07bi3YFt0TBAv3tS8CgS1YZo6Vcmn+q2 FON75YzaPpuVFLi5BWJzfr2xYuD6orS4/tNXE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oGnESwVEVw9CBhkEzwv4OisHXcw7Gcl+TzSvzqRXWX0=; b=DL8jsbfd9dZ5obibYaDnyTEmCpwQ1+SLoIXzyqy6/n/RiDNUCfEJXQ7eRbRgaOE04l 5UV6PD5Wl2S/yo+qx0GHX3jtTD2FSseNbX0q6J2ub2Fma+CPLJ6EPDNXdGFjNYFpK25F eKdznlV9BGWvJVlNfEA3gW55C5zIw3fr7hvqKVTsF90qh/zVgyxJTrbGzHVFIDgp+mSK ij4Xl4s+AXkltA/ssFSYI7t9/4BU12bP5zh01gnZK9mQ9sdcTeCGEa/B9I6/7gzY8qBq WvEfbz2YyTb85bQzbNIYH8/O3GKR+Xv/2OKAdZicYZDngGxlqOATobyHMtrOyI1xNKKf WGqA== X-Gm-Message-State: AODbwcBolERNoAyFDy+GFl7tiWNuPdI28XuAaL0LqbtD1ic0eo+f7JSc /BWpXif13/gdD6FlE0k= X-Received: by 10.25.29.20 with SMTP id d20mr11715451lfd.77.1496928476032; Thu, 08 Jun 2017 06:27:56 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i8sm1025178ljb.55.2017.06.08.06.27.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 06:27:55 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij Subject: [PATCH 4/9] mmc: core: Move mmc_flush_cache() from core.c to mmc_ops.c Date: Thu, 8 Jun 2017 15:27:40 +0200 Message-Id: <1496928465-25004-5-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> References: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> The mmc_flush_cache() is a eMMC specific function, let's move it to mmc_ops.c to make that clear. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 21 --------------------- drivers/mmc/core/mmc_ops.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) -- 2.7.4 Reviewed-by: Linus Walleij diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index de31f30..d40697f 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2729,27 +2729,6 @@ int mmc_power_restore_host(struct mmc_host *host) } EXPORT_SYMBOL(mmc_power_restore_host); -/* - * Flush the cache to the non-volatile storage. - */ -int mmc_flush_cache(struct mmc_card *card) -{ - int err = 0; - - if (mmc_card_mmc(card) && - (card->ext_csd.cache_size > 0) && - (card->ext_csd.cache_ctrl & 1)) { - err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_FLUSH_CACHE, 1, 0); - if (err) - pr_err("%s: cache flush error %d\n", - mmc_hostname(card->host), err); - } - - return err; -} -EXPORT_SYMBOL(mmc_flush_cache); - #ifdef CONFIG_PM_SLEEP /* Do the card removal on suspend if card is assumed removeable * Do that in pm notifier while userspace isn't yet frozen, so we will be able diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 53e4da48..f79d680 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -1022,6 +1022,27 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception) mmc_release_host(card->host); } +/* + * Flush the cache to the non-volatile storage. + */ +int mmc_flush_cache(struct mmc_card *card) +{ + int err = 0; + + if (mmc_card_mmc(card) && + (card->ext_csd.cache_size > 0) && + (card->ext_csd.cache_ctrl & 1)) { + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_FLUSH_CACHE, 1, 0); + if (err) + pr_err("%s: cache flush error %d\n", + mmc_hostname(card->host), err); + } + + return err; +} +EXPORT_SYMBOL(mmc_flush_cache); + static int mmc_cmdq_switch(struct mmc_card *card, bool enable) { u8 val = enable ? EXT_CSD_CMDQ_MODE_ENABLED : 0; From patchwork Thu Jun 8 13:27:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 103389 Delivered-To: patches@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2439534qgd; Thu, 8 Jun 2017 06:27:57 -0700 (PDT) X-Received: by 10.25.202.26 with SMTP id a26mr47136lfg.137.1496928477582; Thu, 08 Jun 2017 06:27:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496928477; cv=none; d=google.com; s=arc-20160816; b=rWWj5WKUtBtL0xbruAL2791sC+IEb116ePAQ3qc2WDGXVSs3ibEAwS8sUW4YMTjGpq EGjy+Is1fu2q+sfxHdCcEXt0gB73xy3Jf+lgwWoPExuX2ery9RJ9w7Hxn9BS8WtXoKZ2 7z9ac/ZCyqG0On96TErpcgL5YQ47VdkEEHrpBLruuMw8LqzqYHQZn14NAffaXma/PKSY y4t6H3PZ8H2hK2CQ9ONazWftqNNhot2PfqxofNtQ77k5H1ddZkQhsgxwK0t2/jEqXinA UvvuAFi4xQkC/7qLlVeMCkpMn9njUQ02k43WiHMvbtDUo8g7VPYc8dBdAL3O2VFXKXsn r7vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=gv9urixTXcyPrzcJGjNTDA4NFOgkqpyZgz+f2XByE2A=; b=zrTGJu+jItDHhOwPouIPNfkLUkVrGZ3flNOdOsPWRTG6Q0pp4pi13ZkZG75Xx/bdaa 5vBCwfmeDFjlKaoEYrAFGOpmhZ6TCTOTjb1OH8P467aL7YgrnEgiODpGtXb6Kp/nK6P6 j/b/XisSJ/M9MBxKMyOlIiKQxIW9yTBiQlw6omHKbnPxk/ahESS0Ke17Q1OauHvRiJmN HoWvooNAG1po6aeDXxs1klcizI5yt+ptvQBHhAqCjAeVnxb5G9cZ/+M2RgXgfTtaxLoK uVWPKWzDVAPzh/xt0WVCaVdYRW9AM64RnDP4Jod+kbntOp/BgahMJxhXDzMpVDs2m0AX Z8WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::229 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-lf0-x229.google.com (mail-lf0-x229.google.com. [2a00:1450:4010:c07::229]) by mx.google.com with ESMTPS id c185si2518152lfc.140.2017.06.08.06.27.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 06:27:57 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::229 as permitted sender) client-ip=2a00:1450:4010:c07::229; 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::229 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x229.google.com with SMTP id p189so18038378lfe.2 for ; Thu, 08 Jun 2017 06:27:57 -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=gv9urixTXcyPrzcJGjNTDA4NFOgkqpyZgz+f2XByE2A=; b=Fj8p6Axb9VhDImXKUzPulyyjRXc6zjUtqxHpz1tqiVeWsUhvBYCSQoEeDAvbrdCyVe Sq+u3DIo7bE/CM80ZB7UpEfXaueSYxze/o+g01SzEpSagt4PY2OUHE2mlS9urhNirTfF YOKNXyc2z1aybIB34nB+ljbWCrlWYhEhwz7uo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gv9urixTXcyPrzcJGjNTDA4NFOgkqpyZgz+f2XByE2A=; b=ltyu1NB/9d6sh57DVJth2JyDYDx84vD8uWCkZv+zkJ1AJ9Q16+jgxd23QKjFAF6iI1 B0/q1MKJeOMv96UFOzCS0Nxw7X0tG+JcjRuO+LxHOROSKiWYm+dznIap2XYW1q5uz3kW 5/eUmUFKLPpMvuis/QnrzqX6zYI0I6BTcl92ipJm6YNjHMVOA0dXJSlzWuUTGa59bMMG oFYPd5hwc9dOBJ6r7aQXHPwFucw/eFWHtm3x6pPNlgOHqYSpHVu9XYTmG/5JUUUkVeu+ LPGcDh0JGqo3gvunEVIrpaTkB5ojyhboHK0VIjI9+iCLpPSAD0eloO7q0FWmy7wLIm7t X0mA== X-Gm-Message-State: AODbwcBTDygzBSN1/te2hXEAuJ3vh1zhw2OJnHFrlZCGLE5CKM8T3UvK b9MBF34lsaN08Z9SFpI= X-Received: by 10.25.26.206 with SMTP id a197mr7279191lfa.5.1496928477245; Thu, 08 Jun 2017 06:27:57 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i8sm1025178ljb.55.2017.06.08.06.27.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 06:27:56 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij Subject: [PATCH 5/9] mmc: core: Make mmc_can_reset() static Date: Thu, 8 Jun 2017 15:27:41 +0200 Message-Id: <1496928465-25004-6-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> References: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc.c | 3 +-- drivers/mmc/core/mmc_ops.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) -- 2.7.4 Reviewed-by: Linus Walleij diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index e3b6bea..ff6cdc3 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -2097,7 +2097,7 @@ static int mmc_runtime_resume(struct mmc_host *host) return 0; } -int mmc_can_reset(struct mmc_card *card) +static int mmc_can_reset(struct mmc_card *card) { u8 rst_n_function; @@ -2106,7 +2106,6 @@ int mmc_can_reset(struct mmc_card *card) return 0; return 1; } -EXPORT_SYMBOL(mmc_can_reset); static int mmc_reset(struct mmc_host *host) { diff --git a/drivers/mmc/core/mmc_ops.h b/drivers/mmc/core/mmc_ops.h index 063500c..9d6b15b 100644 --- a/drivers/mmc/core/mmc_ops.h +++ b/drivers/mmc/core/mmc_ops.h @@ -44,7 +44,6 @@ int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, int mmc_stop_bkops(struct mmc_card *card); int mmc_read_bkops_status(struct mmc_card *card); void mmc_start_bkops(struct mmc_card *card, bool from_exception); -int mmc_can_reset(struct mmc_card *card); int mmc_flush_cache(struct mmc_card *card); int mmc_cmdq_enable(struct mmc_card *card); int mmc_cmdq_disable(struct mmc_card *card); From patchwork Thu Jun 8 13:27:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 103390 Delivered-To: patches@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2439540qgd; Thu, 8 Jun 2017 06:27:59 -0700 (PDT) X-Received: by 10.25.166.15 with SMTP id p15mr3331709lfe.43.1496928478935; Thu, 08 Jun 2017 06:27:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496928478; cv=none; d=google.com; s=arc-20160816; b=idUB+EviC4MDKzIIHqh+nqCtuKEoYE8q+KNwpGO32Aj1c8f5Z83xzByXX7Mh1J6bCt B+INg3POSQJRfJRwNQ22xOylm824npms7Va8gS0WQuMzu6WdD2C8bD9KRD/EFQNmCey0 nWHaqwo94NjXnjgajvUwZAWTVXL9xxJJEgKWYkSr5iHpgOdEDDlHDr6ltqN6dHp8c4PJ rqppaY+XKOC+P4UntlLOHXR8xNI7bjqU/7u/+/CiXlJA/IAPhxHiCdjZFhmLIj24wtoS lppxxkS/iZbSSeUJZYlQ52UhzBM4X7A7JJ4Lgqis5do+yd/1MMNaQuFF9anz1MvEY1vD A7jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Q7IWASeDRnuMzLozuYCoVKUz0uR497CzWcm5E9AaMp0=; b=NYGRLpy1/lE6dnJ5kBFCUyJn9txf6Y/KONINRUWM7lIHeuY0S/gMYfoRRMcXDm4xlx W13QuA7u7jOh8jtkYvO1l3FRdur63QUBqS85IfEUl0K9TAGpZ5KSx/tYDfgvpt912/zB GT5v6diLWxgoV4PjaQvEf1OztPGg/BpSCvYDT4mRVTNCi3q7f7WcZkHo7u+x642JcDS3 CHZl0wlx0PmtOCyCxmlKkTKqbcToT8k2FNt0GOXtZrdVlWUCVGug5Dp3UDvvdk7WPYIb VnbpX47ZTg6PwkHehGs6+iy1gwItIWA41ORRzJxE2UX3h+5NHXTyyJLvGllWDSMIDfgN DBrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::233 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-lf0-x233.google.com (mail-lf0-x233.google.com. [2a00:1450:4010:c07::233]) by mx.google.com with ESMTPS id w19si2569401ljd.168.2017.06.08.06.27.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 06:27:58 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::233 as permitted sender) client-ip=2a00:1450:4010:c07::233; 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::233 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x233.google.com with SMTP id v20so18056985lfa.1 for ; Thu, 08 Jun 2017 06:27:58 -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=Q7IWASeDRnuMzLozuYCoVKUz0uR497CzWcm5E9AaMp0=; b=WtXiKZBiatkcyCeSnqPglvNCiiBgPG2lls12yoGjBR2WiLr6/G0kUSOO/1/dmI9pKv JNH6zxtZk935dWiX6RTrsAGXChbmYCF8fcYFNULFhDk+z9qKISbrg7ZiOKD11nNlLbSU /Vb8isU40m3cz/8sDKsFlGjc/HU8rDKo2m9Uw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Q7IWASeDRnuMzLozuYCoVKUz0uR497CzWcm5E9AaMp0=; b=L0Oc24GQNZZyuuRY1XY2Cvn97I8u8Dyy4bM5dkcoGJRnWBPRMP29t4fKe7ELO9Xvw+ +WvTu85N971IPT65FLEo6R0lmI8V4QGt5tdQkDuzxqW2/AK9jHtLGDgghQOW1nL0BQ9C CJzlJr8sCvNQBGXiGm7NE/FlOEnoQkAC7MqMokV+vCAnigk0vdupGtk5pTaBuhJ4ALXO GsA8WNN1anMUR26lk4poYc2jc9G4QNw7NuQF1K8v7OcMc/KqDcCraFT54hFDTbkQXHbS 0R+Z/fMvCCZiHLKuAvCOKUOffZdA8CJlWwLoNVn1WlbF1/CuhWr3b79IWggLa73E8yE5 MxlQ== X-Gm-Message-State: AODbwcAv770lmnOIqDGBGa81r1NLOf50dnGVGjAJ14eVLtTrEgFLTADG hzo7XAiRzD7oy+7ZaOQ= X-Received: by 10.46.69.198 with SMTP id s189mr12122189lja.13.1496928478631; Thu, 08 Jun 2017 06:27:58 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i8sm1025178ljb.55.2017.06.08.06.27.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 06:27:57 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij Subject: [PATCH 6/9] mmc: core: Remove redundant code in mmc_send_cid() Date: Thu, 8 Jun 2017 15:27:42 +0200 Message-Id: <1496928465-25004-7-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> References: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> The mmc_send_cid() is never called using non SPI mode. Thus, let's remove the redundant code dealing with this. Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc_ops.c | 7 ------- 1 file changed, 7 deletions(-) -- 2.7.4 Reviewed-by: Linus Walleij diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index f79d680..9994840 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -339,13 +339,6 @@ int mmc_send_cid(struct mmc_host *host, u32 *cid) int ret, i; __be32 *cid_tmp; - if (!mmc_host_is_spi(host)) { - if (!host->card) - return -EINVAL; - return mmc_send_cxd_native(host, host->card->rca << 16, - cid, MMC_SEND_CID); - } - cid_tmp = kzalloc(16, GFP_KERNEL); if (!cid_tmp) return -ENOMEM; From patchwork Thu Jun 8 13:27:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 103391 Delivered-To: patches@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2439545qgd; Thu, 8 Jun 2017 06:28:00 -0700 (PDT) X-Received: by 10.25.15.157 with SMTP id 29mr8725536lfp.10.1496928479973; Thu, 08 Jun 2017 06:27:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496928479; cv=none; d=google.com; s=arc-20160816; b=Q6ItS+YvAfj+SltpTNbJRazbZFJNIntpv/hZ0Jgk11l1wupvVEDLVH6LhrpsRSyoH0 1RK6+PqhcyC0WdhBWxZa+KhK1kBD1TCSXn70yurvjxgXTe7EBdVvPg7ev9RaJ+UQ//lc qV8d+84M5sOMZ4idWoK7nKrdlDy/rHk6U3+XAFOWBZRIA2wE2ri+YOUc3b31BFNELsqy BOI5eAcXPUwG97e3TYi4evuguw694YK0ayTwdLgmKA/ttVibnSI+xfwWjlsaEbemc/li ZqtEvA2qqAE22LFaCdiAyXDCc6TfmKEH8gQmvie+7Ahkq+Juo/ceP4ayRYYsTW1CUDTD 4r3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=YrZyqzdOqLiOchSGsGsAgBc1j+YuZWec945LHFHiZsE=; b=isw6XRTmT9xD07sAYUEflL44uTxqzhkFwElk+dmGrDA7XEVe+vRv7xF5q/IWebFjmr 3FncN5TmENYM1g9RhI6BlrFnuceAF6F1RIoGeiZ9AZMLeVNYWOBqPps0pkp9D1X+9u5m ajkQtt8oNDXmcvHpRO6S+ZC6FIhWIUL6K5UB2ZldnL44IgHt+fvNnuFEsPMGVfVu92Dq Qcg0v3DCHEku85GOeg4rMo1B7WJHf8Pzky/uoBQ37i5lLFTXVotno4KLSAAYj4NJjpaq l9wTyEVDbWVEUNMtd5s269Ky3AeNd5qvQjjTtcYw/TPBBR/hZ41dzKH8r/SZWjpamHpc 9x0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22a as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-lf0-x22a.google.com (mail-lf0-x22a.google.com. [2a00:1450:4010:c07::22a]) by mx.google.com with ESMTPS id c82si2515787lfc.169.2017.06.08.06.27.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 06:27:59 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22a as permitted sender) client-ip=2a00:1450:4010:c07::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:4010:c07::22a as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x22a.google.com with SMTP id v20so18057205lfa.1 for ; Thu, 08 Jun 2017 06:27:59 -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=YrZyqzdOqLiOchSGsGsAgBc1j+YuZWec945LHFHiZsE=; b=Gy9AMSc6Bb9Uq1fQ2rLSwJYuRZYmKzpASQyoN0YjYZyodwHlLI3r8STDMw75wkx89z icA6I80pgxbL7GY7n2Jzt5et/6KKnfFLngnhwfzrBTGxbVGZFEiEcXlFJU2pDIMAD6as JyoGeDuz7ILeIux2Bdv04sd39wsgXBGwHSNKY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YrZyqzdOqLiOchSGsGsAgBc1j+YuZWec945LHFHiZsE=; b=FLUkgK6zES0Mvlpu92F0pF6s2bAPPI0iB6HlaSqJrbjRjJHhSJ8KdIffABIPgZYaPV RmgQQeSRGEhrm1AcMx+NN2FPO9kBNaTUOQOYkObLTtPrn/Xz5y/3/RWrpNcGYEtKh5zI 0mSh9MNecwcR+T7uNIaTsH2Q3ifPPBBkNpZrIpLv4rtWnUCMx7P3Q37u0HLP+gTwxAlF 1Rbe+YuP7rwFudSbj/FiWkGpMRYzzkJMn0MC+iHJion3kk16r8w5VUnt2SnLRUGMOdkL pnUBUHrnERjgv6eQOJNSSIEPGh4QbxE31F/cpsbliBCbaE+zgyjVJX4yhDwli622SFaX HV9A== X-Gm-Message-State: AODbwcD1xNcFn8c+Dr2Dgdi6tXTdLuTkEARaEk7YoxM3rEAcHC6/7OB+ JLO6IuEGlCXXF2CfX4kzBjgY X-Received: by 10.46.84.14 with SMTP id i14mr4792126ljb.100.1496928479621; Thu, 08 Jun 2017 06:27:59 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i8sm1025178ljb.55.2017.06.08.06.27.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 06:27:59 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij Subject: [PATCH 7/9] mmc: core: Re-factor code for sending CID Date: Thu, 8 Jun 2017 15:27:43 +0200 Message-Id: <1496928465-25004-8-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> References: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> Instead of having the caller to check for SPI mode, let's leave that to internals of mmc_send_cid(). In this way the code gets cleaner and it becomes clear what is specific to SPI and non-SPI mode. Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc.c | 5 +---- drivers/mmc/core/mmc_ops.c | 12 ++++++++++-- drivers/mmc/core/mmc_ops.h | 1 - drivers/mmc/core/sd.c | 6 +----- 4 files changed, 12 insertions(+), 12 deletions(-) -- 2.7.4 Reviewed-by: Linus Walleij diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index ff6cdc3..e504b66 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1556,10 +1556,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, /* * Fetch CID from card. */ - if (mmc_host_is_spi(host)) - err = mmc_send_cid(host, cid); - else - err = mmc_all_send_cid(host, cid); + err = mmc_send_cid(host, cid); if (err) goto err; diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 9994840..50571a6 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -207,7 +207,7 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) return err; } -int mmc_all_send_cid(struct mmc_host *host, u32 *cid) +static int mmc_all_send_cid(struct mmc_host *host, u32 *cid) { int err; struct mmc_command cmd = {}; @@ -334,7 +334,7 @@ int mmc_send_csd(struct mmc_card *card, u32 *csd) return ret; } -int mmc_send_cid(struct mmc_host *host, u32 *cid) +static int mmc_spi_send_cid(struct mmc_host *host, u32 *cid) { int ret, i; __be32 *cid_tmp; @@ -355,6 +355,14 @@ int mmc_send_cid(struct mmc_host *host, u32 *cid) return ret; } +int mmc_send_cid(struct mmc_host *host, u32 *cid) +{ + if (mmc_host_is_spi(host)) + return mmc_spi_send_cid(host, cid); + + return mmc_all_send_cid(host, cid); +} + int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd) { int err; diff --git a/drivers/mmc/core/mmc_ops.h b/drivers/mmc/core/mmc_ops.h index 9d6b15b..d3d5d68 100644 --- a/drivers/mmc/core/mmc_ops.h +++ b/drivers/mmc/core/mmc_ops.h @@ -22,7 +22,6 @@ int mmc_deselect_cards(struct mmc_host *host); int mmc_set_dsr(struct mmc_host *host); int mmc_go_idle(struct mmc_host *host); int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr); -int mmc_all_send_cid(struct mmc_host *host, u32 *cid); int mmc_set_relative_addr(struct mmc_card *card); int mmc_send_csd(struct mmc_card *card, u32 *csd); int __mmc_send_status(struct mmc_card *card, u32 *status, unsigned int retries); diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 1d7542d..a1b0aa1 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -788,11 +788,7 @@ int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr) } } - if (mmc_host_is_spi(host)) - err = mmc_send_cid(host, cid); - else - err = mmc_all_send_cid(host, cid); - + err = mmc_send_cid(host, cid); return err; } From patchwork Thu Jun 8 13:27:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 103392 Delivered-To: patches@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2439554qgd; Thu, 8 Jun 2017 06:28:01 -0700 (PDT) X-Received: by 10.25.158.78 with SMTP id h75mr496332lfe.178.1496928481043; Thu, 08 Jun 2017 06:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496928481; cv=none; d=google.com; s=arc-20160816; b=D9xFICZHtKV5Yg2k6o/ssh15iQftsmv9Da1okjNWRsira3uE+3UGOUS9oMskUwJeZX 0rZ+53kkHeHeFIeCljxFjUHMFLMdHWOVYRF9g6vFb16JifcPj8ny4FGqj/tcQ1RRcv0Q 9k0Jdh4HoMzOlO/q+42RYlts4cL7oQj9Vpt1Q3nTxZAs1fJQ0Z1eOYPIVlL+3UH9YCxj mghT2h4SJe38iTIlP2BaiCfjvwdpTEyrigjymqHBTluPpBd01IOg6j1sopXyQ7cfyMMI 0pWdl5828nqnPcDhZDJoGGw6VcAP30suuiK384QXZv60ruIIn4tPk5rNx1PCE68apBPM VDtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=8vrJ8JNp015h+FcjlglTh2tZ1Qqp3j3yOCYXRc/XfPk=; b=DfxMW/v3kCiLIyhSDsZdyd49+QG0qyBufwBjGUWQi89GdpruPOAbuVamdupEhSyb52 eClnjWiJgz5/mzv+zuVq3VnrCpjx99L1bFnCL+DpmPGFCFhKGHzD/xzirsDhwrLf6BjV 7MutLxgq5nwnN2rVedjRCMpboyDdOveW/4nRgXGvi+znvuaRom6IxkswxvB6xNmAFBv2 APljWZVOGBmsHQGUAgKeWyrWO1B6iJ+M7RT4P69OwmTng1vJJduCrx3gTtGjDub4oOva UGql1aCVtQsfX97x/0gl3L+80RhoCsoUx9J9LLYney8D9i4aP/EHghBpUNkDAJWlQQKk 9/Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::232 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com. [2a00:1450:4010:c07::232]) by mx.google.com with ESMTPS id w8si694765ljd.282.2017.06.08.06.28.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 06:28:01 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::232 as permitted sender) client-ip=2a00:1450:4010:c07::232; 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::232 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x232.google.com with SMTP id p189so18039135lfe.2 for ; Thu, 08 Jun 2017 06:28:00 -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=8vrJ8JNp015h+FcjlglTh2tZ1Qqp3j3yOCYXRc/XfPk=; b=SOYBWx6sPgLN24gUL4zM+zABqvyIzcboKUxixybXkvcws5QFVgxg4odlA+2I8DJetl k4mO480hS9aZui6L+TykEoe0TT2RT+m2N3R+VrnhTin9j3gyb7RMui356wrC/2Da2vYJ pp4wrBf9YvW0iH4pFH0YYMTF0iwvPMEAEKhhA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8vrJ8JNp015h+FcjlglTh2tZ1Qqp3j3yOCYXRc/XfPk=; b=P62DCfkP8o3LWji+zUhqRGXIJ1IKbQnGvr08A1X3RfVm6n/DOuvj+zhuQhDZwWDbpZ qS71nj5hWztRvTluolIDAgRgiJ9nrvjBWLLdDaL/zY12cYnJ/IyDACh+GBE7e5tDzW2v Q2LK4XO0gciDmMZ7sRdF3quu+s/SgwyojHgKPY3MY6Q0vLOtr3+9667cTBYMZWSc3oWy 9YITTtTMvzvPAOvdlwg5XmHpc6ISAKJCEZObj24ewk2uhLJxnEajle+EfArhEgvINFxX ZATEnO1wlTN/3Sih/Jlta+CnsrbcxKPR/iZo5ufp2HkS4FRImE6o8P/T8rMRZKdBbIU+ tTVg== X-Gm-Message-State: AODbwcAdes54ie2uwViX9AgVCcUYz7BSuKtbJxIILUEsupbqHLxSRBzn fWLS19/eCWDJ7hN6fso= X-Received: by 10.46.88.29 with SMTP id m29mr5009344ljb.138.1496928480706; Thu, 08 Jun 2017 06:28:00 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i8sm1025178ljb.55.2017.06.08.06.27.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 06:28:00 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij Subject: [PATCH 8/9] mmc: core: Drop mmc_all_send_cid() and use mmc_send_cxd_native() instead Date: Thu, 8 Jun 2017 15:27:44 +0200 Message-Id: <1496928465-25004-9-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> References: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc_ops.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) -- 2.7.4 Reviewed-by: Linus Walleij diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 50571a6..b60b4da 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -207,24 +207,6 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) return err; } -static int mmc_all_send_cid(struct mmc_host *host, u32 *cid) -{ - int err; - struct mmc_command cmd = {}; - - cmd.opcode = MMC_ALL_SEND_CID; - cmd.arg = 0; - cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR; - - err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); - if (err) - return err; - - memcpy(cid, cmd.resp, sizeof(u32) * 4); - - return 0; -} - int mmc_set_relative_addr(struct mmc_card *card) { struct mmc_command cmd = {}; @@ -360,7 +342,7 @@ int mmc_send_cid(struct mmc_host *host, u32 *cid) if (mmc_host_is_spi(host)) return mmc_spi_send_cid(host, cid); - return mmc_all_send_cid(host, cid); + return mmc_send_cxd_native(host, 0, cid, MMC_ALL_SEND_CID); } int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd) From patchwork Thu Jun 8 13:27:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 103393 Delivered-To: patches@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2439567qgd; Thu, 8 Jun 2017 06:28:03 -0700 (PDT) X-Received: by 10.46.81.17 with SMTP id f17mr11612451ljb.96.1496928482277; Thu, 08 Jun 2017 06:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496928482; cv=none; d=google.com; s=arc-20160816; b=GemKBFMOVL0/nYelHGZPtXXiMAJ5SsAlTfGfltzPuRK/fDJolY+W3A6ovs8mizgNTO SIsOASH39iXnjF060iQXufytwsz7SFlaojD39/+xINmXme2cNO1Jil6pr2GXvHYxOxBU rqNtnaaod+Uluo1xczlHtTWtcY+7kytiwdN4EQzLyZ7fWBm5v3wQIjczifxiBHj+cJvF QiqbTXbuvL6C/1fmznNHadS2XltYv3C8weP/H80G1/FAGv2U3TyW1F64Hh/bBOqgJVeV 4vLTP08jA2/miHVy+zHKwj1rDfzmVOYP4GzSr7hzz11y2u3u1YJ4HQGck7JAb7vOaRJq g6uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=61hvngFNBmID7dK9WxOaB7kPPIqB9HXMtO7V4mrOmkM=; b=wChKce6hJiKZ+xtEKI822LvJKk6EK/csYBhnmxQboIcNHjoDZMkOPhdSE7xT+obp/s 4Hs0XjnZ49X3yZB6v67t3A1oqv5oImgE49/TijqxmtS9aRCoCdJfy6CWgcHSLFyztYE+ nGymyU1/v3+wcaGim4qAPkDU8eQJCRLE1NWOmVdJmFbDv/f+IwtBEyPVCuartEh1RjRY YuZtimowdtV0X8At6uzF1MmdpgBznFW49rBqRKh67yDzVJAqgfimUTyCQ6btv+WbaVJi q9BSJmfXv+dr8savk9BlEWxWqgO5kb74cB0zIZXqbE1crSTFj60PtmsU39DCCaLbS3gx cbFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22f as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-lf0-x22f.google.com (mail-lf0-x22f.google.com. [2a00:1450:4010:c07::22f]) by mx.google.com with ESMTPS id m188si2508764lfm.86.2017.06.08.06.28.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 06:28:02 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22f as permitted sender) client-ip=2a00:1450:4010:c07::22f; 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::22f as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x22f.google.com with SMTP id p189so18039386lfe.2 for ; Thu, 08 Jun 2017 06:28:02 -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=61hvngFNBmID7dK9WxOaB7kPPIqB9HXMtO7V4mrOmkM=; b=KQxXyl4jtnsH/FSl6JtIVcNXi97gpv/Pj1Q0/giViy72OYHmg2Zm4ZlAdbMKxp+zjz wafUI0tgLk1CsLwUUY2Wc/Dv8S7pScF2tdK6BHsXDvy+Ea8abYFvOpHw/4uKwGIsucTd R+ltFKTqwGERXnNUdnm87gV2bT5H7ibrPb+CU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=61hvngFNBmID7dK9WxOaB7kPPIqB9HXMtO7V4mrOmkM=; b=n+WL8l3rgjkGu8w/MIhvj97Zzb3sPPkeo79Vk1ik2ep2Xz8OD9+Rj1BhM88LczL9Y1 Hb7FKa6l+9LhbYP/5lPZ6VUwylW0XORGVBAWl9oflrg368JECrO1Za49jJw7oNXWFQh6 iW4NYUTgoenwW/mDHMwEswkEVR0yqvJX45Y/XGzKxoQCZUcotrNEoZDWa2lEg4fApSaU xJg3te0hl8N7r1X1GUxwbWB22Tw1npz77BG7h5vziP+U7O44Emjq3I1jFtUDJi77BseS l7BVCn4pld0HRN4+vT41Amok1Os4nk1z0e3EiCQunL7e6epb6cdvhLJaMVVNh+LybMgL QhcQ== X-Gm-Message-State: AODbwcBJ3jRUcKIZKhezJWH8uklDNb0eA7jFLv/f57BzzsoMdxUvQ7Z0 i8UNhYLv5g6UG5vdbRU= X-Received: by 10.46.20.81 with SMTP id 17mr7553920lju.111.1496928481740; Thu, 08 Jun 2017 06:28:01 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i8sm1025178ljb.55.2017.06.08.06.28.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 06:28:01 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij Subject: [PATCH 9/9] mmc: core: Clarify code for sending CSD Date: Thu, 8 Jun 2017 15:27:45 +0200 Message-Id: <1496928465-25004-10-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> References: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> To make the code more consistent and to increase readability, add an mmc_spi_send_csd() function, which gets called from mmc_send_csd() in case of SPI mode. Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc_ops.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) -- 2.7.4 Reviewed-by: Linus Walleij diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index b60b4da..5f051ea 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -291,15 +291,11 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host, return 0; } -int mmc_send_csd(struct mmc_card *card, u32 *csd) +static int mmc_spi_send_csd(struct mmc_card *card, u32 *csd) { int ret, i; __be32 *csd_tmp; - if (!mmc_host_is_spi(card->host)) - return mmc_send_cxd_native(card->host, card->rca << 16, - csd, MMC_SEND_CSD); - csd_tmp = kzalloc(16, GFP_KERNEL); if (!csd_tmp) return -ENOMEM; @@ -316,6 +312,15 @@ int mmc_send_csd(struct mmc_card *card, u32 *csd) return ret; } +int mmc_send_csd(struct mmc_card *card, u32 *csd) +{ + if (mmc_host_is_spi(card->host)) + return mmc_spi_send_csd(card, csd); + + return mmc_send_cxd_native(card->host, card->rca << 16, csd, + MMC_SEND_CSD); +} + static int mmc_spi_send_cid(struct mmc_host *host, u32 *cid) { int ret, i;