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: 9190529 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 24B1C6075E for ; Tue, 21 Jun 2016 13:21:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1455128119 for ; Tue, 21 Jun 2016 13:21:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08F5328178; Tue, 21 Jun 2016 13:21:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84B1328119 for ; Tue, 21 Jun 2016 13:21:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751720AbcFUNVm (ORCPT ); Tue, 21 Jun 2016 09:21:42 -0400 Received: from mail-lf0-f51.google.com ([209.85.215.51]:36636 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750696AbcFUNVJ (ORCPT ); Tue, 21 Jun 2016 09:21:09 -0400 Received: by mail-lf0-f51.google.com with SMTP id q132so23582599lfe.3 for ; Tue, 21 Jun 2016 06:20:12 -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=Sbwox6qNQpBD/oXQlXgLfRxQyk+sWu7aOS8Ddw5iAvC6hZuLX8BwmDOw9nAWpG4oaC SFYYkQqjWqfS7ucVB9tet1TQRmaJ4n/D3WYQDqmzUIKy3Dx8Vn9H68aockx802PWffF6 q5NkEi8GM2EwsQ9KTO+60KDUZRfTkI95xN71lizk6CxS5W43MgCHg1aZk3nUBKITyCmh 1IDfDwZ1YhaK8nhkV8p3o54kCzUdtgR3PP2cLIwApBtP4w3EDXuRyG9LUrjOmWrib/UA qet02s8O3tvXpzotJZQ/HHfWx7RCDhCvOEZH4ckzCvSsQyMHXrQ9LobB/+fazL3/L+SC 2gxQ== X-Gm-Message-State: ALyK8tJhIJD6QucBUmmD+/De8X7XIa/CHa7VIuZBbr21LOMlq4llEK7zmyhh6UIij/LTxWfI X-Received: by 10.25.23.72 with SMTP id n69mr7043785lfi.64.1466514789112; Tue, 21 Jun 2016 06:13:09 -0700 (PDT) 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> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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 */