From patchwork Wed Jun 8 08:22:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 9163615 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 C16E560467 for ; Wed, 8 Jun 2016 08:22:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0B1E28305 for ; Wed, 8 Jun 2016 08:22:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A580028378; Wed, 8 Jun 2016 08:22:38 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 5176328305 for ; Wed, 8 Jun 2016 08:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161696AbcFHIWS (ORCPT ); Wed, 8 Jun 2016 04:22:18 -0400 Received: from lucky1.263xmail.com ([211.157.147.134]:49525 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161670AbcFHIWQ (ORCPT ); Wed, 8 Jun 2016 04:22:16 -0400 Received: from shawn.lin?rock-chips.com (unknown [192.168.167.229]) by lucky1.263xmail.com (Postfix) with SMTP id ED1D869D; Wed, 8 Jun 2016 16:22:11 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 7F72D2B6C; Wed, 8 Jun 2016 16:22:08 +0800 (CST) X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: ulf.hansson@linaro.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: lintao@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 5546PC95EU; Wed, 08 Jun 2016 16:22:09 +0800 (CST) From: Shawn Lin To: Ulf Hansson Cc: Jaehoon Chung , Rob Herring , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Doug Anderson , linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, Shawn Lin Subject: [RFC PATCH 4/4] mmc: core: improve initialization flow Date: Wed, 8 Jun 2016 16:22:01 +0800 Message-Id: <1465374121-2652-1-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1465373996-2485-1-git-send-email-shawn.lin@rock-chips.com> References: <1465373996-2485-1-git-send-email-shawn.lin@rock-chips.com> 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 We should skip sending some unnecessary cmds during initialization if we know that this controller can't support the claimed function. In this way, we provide the capabilities for DT to decide whether they need to reduce booting time if they know a slot is just only for one card type. We also don't want to break the backward compatibility if not assigning any one of these caps for existing dts or dtb. So this patch should be safe. Signed-off-by: Shawn Lin --- drivers/mmc/core/core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index e864187..663bf18 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2503,13 +2503,13 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq) 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 (!(host->caps2 & MMC_CAP2_NO_SDIO) && !mmc_attach_sdio(host)) + return 0; - if (!mmc_attach_sd(host)) + if (!(host->caps2 & MMC_CAP2_NO_SD) && !mmc_attach_sd(host)) return 0; - if (!mmc_attach_mmc(host)) + + if (!(host->caps2 & MMC_CAP2_NO_MMC) && !mmc_attach_mmc(host)) return 0; mmc_power_off(host);