From patchwork Tue Oct 21 17:19:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 39205 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0224224039 for ; Tue, 21 Oct 2014 17:19:39 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id 10sf1102597lbg.5 for ; Tue, 21 Oct 2014 10:19:34 -0700 (PDT) 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: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=kl+0pArEGcSuylUd+Q70Aoam+tCAp5aC+T4TGIWTWNA=; b=CSSx096G5fv+vYXqbZGwQhfR2wShrH7cGSCjGF0yBYutR9pUth7ck6gfH62U+9lYpQ QRdtA8O1cfGTFVT2LWHgxxZYwzNJf1GHCljDsCoigLbvMY9JRcKx+ov8ppks4UG1syUj l43Ubp4U49B3Z0AxWA/zYzrMnNjXNjQaw6vqvqU3G1tWjuOUt2iJsVZtXQB5fXIwyS+v YHU5mCLu555wAwcOG5x6DDJaD0+v33qa9R0x3xmaIIepRfONulTF3BQAyS1X2qNlyd2Y Xwby7KYpswOb7VnoOwPmT11PXWjbNgZL1gU9C5ctzwyUu/aJDjF0V5Ig0q5/IpkPSRju Qi4Q== X-Gm-Message-State: ALoCoQl6NyBwhAZ2D1McO7Kuame7SrQp1IDlPd5AsbSKJe9HGx/4VaEMyPTeWHzeLi0mb7oUWxEw X-Received: by 10.112.26.82 with SMTP id j18mr648192lbg.16.1413911974713; Tue, 21 Oct 2014 10:19:34 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.67 with SMTP id o3ls86246laj.22.gmail; Tue, 21 Oct 2014 10:19:34 -0700 (PDT) X-Received: by 10.152.2.100 with SMTP id 4mr36181621lat.6.1413911974513; Tue, 21 Oct 2014 10:19:34 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id y9si20020641lbr.1.2014.10.21.10.19.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 10:19:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id pv20so1498053lab.34 for ; Tue, 21 Oct 2014 10:19:34 -0700 (PDT) X-Received: by 10.112.167.38 with SMTP id zl6mr36154046lbb.34.1413911974368; Tue, 21 Oct 2014 10:19:34 -0700 (PDT) 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.112.84.229 with SMTP id c5csp545247lbz; Tue, 21 Oct 2014 10:19:34 -0700 (PDT) X-Received: by 10.152.28.134 with SMTP id b6mr37157935lah.12.1413911973735; Tue, 21 Oct 2014 10:19:33 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id zm10si19910654lbb.125.2014.10.21.10.19.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 10:19:33 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id p9so1434724lbv.33 for ; Tue, 21 Oct 2014 10:19:31 -0700 (PDT) X-Received: by 10.112.210.102 with SMTP id mt6mr19404660lbc.73.1413911969535; Tue, 21 Oct 2014 10:19:29 -0700 (PDT) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id uh7sm4791085lac.1.2014.10.21.10.19.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Oct 2014 10:19:28 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Chris Ball Subject: [PATCH 06/15] mmc: core: Add helper function for EXT_CSD support Date: Tue, 21 Oct 2014 19:19:04 +0200 Message-Id: <1413911953-19012-7-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413911953-19012-1-git-send-email-ulf.hansson@linaro.org> References: <1413911953-19012-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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) 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: , The helper function mmc_can_ext_csd() will return a positive value if the card supports the EXT_CSD register. Start using it at relavant places in the mmc core. Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc.c | 8 ++++---- drivers/mmc/core/mmc_ops.c | 5 +++++ drivers/mmc/core/mmc_ops.h | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 1ed3d82..24dc30f 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -190,7 +190,7 @@ static int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd) *new_ext_csd = NULL; - if (card->csd.mmca_vsn < CSD_SPEC_VER_4) + if (!mmc_can_ext_csd(card)) return 0; /* @@ -827,7 +827,7 @@ static int mmc_select_powerclass(struct mmc_card *card) int err, ddr; /* Power class selection is supported for versions >= 4.0 */ - if (card->csd.mmca_vsn < CSD_SPEC_VER_4) + if (!mmc_can_ext_csd(card)) return 0; bus_width = host->ios.bus_width; @@ -888,7 +888,7 @@ static int mmc_select_bus_width(struct mmc_card *card) unsigned idx, bus_width = 0; int err = 0; - if ((card->csd.mmca_vsn < CSD_SPEC_VER_4) && + if (!mmc_can_ext_csd(card) && !(host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) return 0; @@ -1129,7 +1129,7 @@ static int mmc_select_timing(struct mmc_card *card) { int err = 0; - if (card->csd.mmca_vsn < CSD_SPEC_VER_4) + if (!mmc_can_ext_csd(card)) goto bus_speed; if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200) diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 7911e05..1db60be4 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -675,3 +675,8 @@ int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status) return 0; } + +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 f752ec6..6f4b00e 100644 --- a/drivers/mmc/core/mmc_ops.h +++ b/drivers/mmc/core/mmc_ops.h @@ -26,6 +26,7 @@ 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_can_ext_csd(struct mmc_card *card); #endif