From patchwork Mon Sep 16 14:17:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 20345 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1C9B424694 for ; Mon, 16 Sep 2013 14:18:22 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id jy13sf4467968veb.8 for ; Mon, 16 Sep 2013 07:18:21 -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:cc: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=sUrl4S+n5gs0SJIH8VLt6qHTpWGm55qWPQS8R0ZZ4ak=; b=JfXLz4m/P2rVX9Q0cip6JNQgRn3WJeWselGcDFTqntT39bfiR/OvGbPaufdJW7xP+G ZLS3bvkzYAWG5EOtFK6pYk3Y4YQdCbQzjbZFr7k4wCWWm8HUtyqIvppk4Aqxsozn9UAv tWjv+CLzhoUh3+MqwhiCpFB/viT9WNsU3up+C8r43o9IOY/t+KMXb7RvxU4yicnfwntE GG1ItD6WjtTohA1wr3b3o6NNw5sLIh04cEPD+zxig8ql1hKXWSePG6b5uZUGVna7T+Tl SBJAmbKRhwfqFIzQYKww4MkgwFu0JTcdLmnqLP5J4yefTOfHI07/nC56RpNR/IkSaLFZ SYSw== X-Gm-Message-State: ALoCoQnD1tWaPS8cyjFNZZXKdnM+O41xN9FyozUPzLpJU5WhJLIoEvrGwkR++m9WmK3FHrqqSvDx X-Received: by 10.236.163.67 with SMTP id z43mr10465757yhk.27.1379341101934; Mon, 16 Sep 2013 07:18:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.18.199 with SMTP id y7ls2287675qed.78.gmail; Mon, 16 Sep 2013 07:18:21 -0700 (PDT) X-Received: by 10.58.152.3 with SMTP id uu3mr27221781veb.16.1379341101853; Mon, 16 Sep 2013 07:18:21 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id tq4si7135350vdc.77.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 07:18:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id hf12so2844988vcb.41 for ; Mon, 16 Sep 2013 07:18:21 -0700 (PDT) X-Received: by 10.220.164.70 with SMTP id d6mr5856888vcy.19.1379341101768; Mon, 16 Sep 2013 07:18:21 -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.220.174.196 with SMTP id u4csp99363vcz; Mon, 16 Sep 2013 07:18:21 -0700 (PDT) X-Received: by 10.112.29.147 with SMTP id k19mr25633737lbh.9.1379341100576; Mon, 16 Sep 2013 07:18:20 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com [209.85.215.44]) by mx.google.com with ESMTPS id y3si12026183lbq.8.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 07:18:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.44 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id eo20so3250333lab.3 for ; Mon, 16 Sep 2013 07:18:20 -0700 (PDT) X-Received: by 10.112.42.103 with SMTP id n7mr25560730lbl.6.1379341100020; Mon, 16 Sep 2013 07:18:20 -0700 (PDT) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id ur6sm13161703lbc.5.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 07:18:19 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Prasanna NAVARATNA , Ulf Hansson Subject: [PATCH 7/7] mmc: core: Collect common code for card ocr validation Date: Mon, 16 Sep 2013 16:17:48 +0200 Message-Id: <1379341068-27097-8-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1379341068-27097-1-git-send-email-ulf.hansson@linaro.org> References: <1379341068-27097-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=neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , Since mmc_select_voltage now only gets called from the attach sequence, it makes sense to move the out of spec validations of the card ocr into this function. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 10 ++++++++++ drivers/mmc/core/mmc.c | 11 ----------- drivers/mmc/core/sd.c | 19 ------------------- drivers/mmc/core/sdio.c | 10 ---------- 4 files changed, 10 insertions(+), 40 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 0d89ccc..5806bfc 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1382,6 +1382,16 @@ u32 mmc_select_voltage(struct mmc_host *host, u32 ocr) { int bit; + /* + * Sanity check the voltages that the card claims to + * support. + */ + if (ocr & 0x7F) { + dev_warn(mmc_dev(host), + "card claims to support voltages below defined range\n"); + ocr &= ~0x7F; + } + ocr &= host->ocr_avail; if (!ocr) { dev_warn(mmc_dev(host), "no support for card's volts\n"); diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 9149eab..69398f4 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1666,17 +1666,6 @@ int mmc_attach_mmc(struct mmc_host *host) goto err; } - /* - * Sanity check the voltages that the card claims to - * support. - */ - if (ocr & 0x7F) { - pr_warning("%s: card claims to support voltages " - "below the defined range. These will be ignored.\n", - mmc_hostname(host)); - ocr &= ~0x7F; - } - rocr = mmc_select_voltage(host, ocr); /* diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 53db60a..6ef84d0 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -1231,25 +1231,6 @@ int mmc_attach_sd(struct mmc_host *host) goto err; } - /* - * Sanity check the voltages that the card claims to - * support. - */ - if (ocr & 0x7F) { - pr_warning("%s: card claims to support voltages " - "below the defined range. These will be ignored.\n", - mmc_hostname(host)); - ocr &= ~0x7F; - } - - if ((ocr & MMC_VDD_165_195) && - !(host->ocr_avail_sd & MMC_VDD_165_195)) { - pr_warning("%s: SD card claims to support the " - "incompletely defined 'low voltage range'. This " - "will be ignored.\n", mmc_hostname(host)); - ocr &= ~MMC_VDD_165_195; - } - rocr = mmc_select_voltage(host, ocr); /* diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index b7c19e8..4d721c6 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -1133,16 +1133,6 @@ int mmc_attach_sdio(struct mmc_host *host) if (host->ocr_avail_sdio) host->ocr_avail = host->ocr_avail_sdio; - /* - * Sanity check the voltages that the card claims to - * support. - */ - if (ocr & 0x7F) { - pr_warning("%s: card claims to support voltages " - "below the defined range. These will be ignored.\n", - mmc_hostname(host)); - ocr &= ~0x7F; - } rocr = mmc_select_voltage(host, ocr);