From patchwork Tue Jun 21 13:12:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 70554 Delivered-To: patches@linaro.org Received: by 10.140.28.4 with SMTP id 4csp2011135qgy; Tue, 21 Jun 2016 06:13:09 -0700 (PDT) X-Received: by 10.46.1.148 with SMTP id f20mr6117596lji.52.1466514789504; Tue, 21 Jun 2016 06:13:09 -0700 (PDT) Return-Path: Received: from mail-lf0-x22c.google.com (mail-lf0-x22c.google.com. [2a00:1450:4010:c07::22c]) by mx.google.com with ESMTPS id s5si29912935lfs.188.2016.06.21.06.13.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Jun 2016 06:13:09 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22c as permitted sender) client-ip=2a00:1450:4010:c07::22c; 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::22c as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x22c.google.com with SMTP id h129so23394965lfh.1 for ; Tue, 21 Jun 2016 06:13:09 -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=sy/E4ytes6IwH3xJxcg1jtdZMOnWa9evp+4JrYxLakY=; b=W8mwzlCSr0qLUGlsklzE+vpvtl5A6I5phBDSpBeuxOawpV9jeazFyn2bz18kIgZmCD fiXMli22m+M87nWTqr07V40xmSkIf5DMH3cmlkaVc3laRQAzYdsFG45ylFcP+/hcSU+W tLS+dvC56WN4e2Ioz4viXR+lcPdK2a8OWKhIo= 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=sy/E4ytes6IwH3xJxcg1jtdZMOnWa9evp+4JrYxLakY=; b=TmXybPNMa63fTS3bsZOgwQEdxXj1aL6UPKu1KWp9R1OmQx7rWx9+HIS3H62Hy4hg7A VPobkggSer38YKA3apDifXdGH76pHGdzIlTI2uaeVJXhWhY6HYtknqMGIhkUm1pguKeF rBrFnw4zXo3hiI/+7ArHav8pUKnD2zDDLCBEKda1J5KdDAB6PfbEG9uNJTbOkfipvYZ4 dVUh5oyWXHyULu3V6u/03wUfWp14TvHyIZ4mBUN/1EYBmoTTSRcvLtuy2A8ihy6bpUFW oPc+JhqXARD7pGNockd+lVKk9s0KOWI+21OSmK7bzFRz2+5AaYuf5+APicX419oMbiMb Uv/Q== X-Gm-Message-State: ALyK8tIVe0mitRpyz1u8eCirkyh7yHGgNRIMqdSXcNzKpLoeNDdDPhMKavFOAmlQ1VKo1D2F9cU= X-Received: by 10.25.23.72 with SMTP id n69mr7043785lfi.64.1466514789112; Tue, 21 Jun 2016 06:13:09 -0700 (PDT) Return-Path: 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.06 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Jun 2016 06:13:07 -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 1/5] mmc: core: Allow hosts to specify non-support for SD commands Date: Tue, 21 Jun 2016 15:12:46 +0200 Message-Id: <1466514770-9462-2-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> There are host drivers which needs to valdiate for non-supported SD commands and returnn error code for such requests. To improve and simplify the behaviour, let's invent MMC_CAP2_NO_SD which these host drivers can set to tell the mmc core to skip sending SD commands during card initialization. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 9 ++++++--- include/linux/mmc/host.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) -- 1.9.1 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index e864187..8b11028 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2500,15 +2500,18 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq) mmc_go_idle(host); - mmc_send_if_cond(host, host->ocr_avail); + if (!(host->caps2 & MMC_CAP2_NO_SD)) + mmc_send_if_cond(host, host->ocr_avail); /* Order's important: probe SDIO, then SD, then MMC */ if (!(host->caps2 & MMC_CAP2_NO_SDIO)) if (!mmc_attach_sdio(host)) return 0; - if (!mmc_attach_sd(host)) - return 0; + if (!(host->caps2 & MMC_CAP2_NO_SD)) + if (!mmc_attach_sd(host)) + return 0; + if (!mmc_attach_mmc(host)) return 0; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index d72c0c3..c22476d 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -309,6 +309,7 @@ struct mmc_host { #define MMC_CAP2_NO_WRITE_PROTECT (1 << 18) /* No physical write protect pin, assume that card is always read-write */ #define MMC_CAP2_NO_SDIO (1 << 19) /* Do not send SDIO commands during initialization */ #define MMC_CAP2_HS400_ES (1 << 20) /* Host supports enhanced strobe */ +#define MMC_CAP2_NO_SD (1 << 21) /* Do not send SD commands during initialization */ mmc_pm_flag_t pm_caps; /* supported pm features */