From patchwork Mon Sep 16 14:17:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 20342 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 30CAD24694 for ; Mon, 16 Sep 2013 14:18:13 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id jy13sf4467773veb.8 for ; Mon, 16 Sep 2013 07:18:12 -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=3jy6He0106MR7X9cKzyn0EAJi4BFafeg3vw00peiG+o=; b=WO7JTODejApLgXqw31s/LS98mWeEpbRMUKop8+es5WgKwdJr5TbaRfBBb2Uac0OaVx yV8R8HzsX0JRU3c8nDgi2VLgdyYcD/p1kDoxQ0ijR+LhrEBrN/TDyd2jK4P+BLJWy11K s7Llg0U1i/WlwIYnpQrHnbxbvfi0uDaQ6dOTtLVffWqCpaOVWxzCwMf6vheu46hrLY6Q 0MDogF9EiKkb5EvIrDIauvR03RiDPlAKKeGAVW2modnXl/jY7d1RBiXst0NojmhYJhq/ dYtCoKAXddZZ6RzD6MlwsTA9glhlWFb9HXLkutwFOKBfsnSWj2DHsIfaDWvarqgP71DW UfvA== X-Gm-Message-State: ALoCoQmauO5k8Pf3iFA6nU3Dz3hmold20sL5PGdvauj6AtDiZE2NK8A6YOIldJWVpcs9I/m5KUvk X-Received: by 10.236.115.198 with SMTP id e46mr11542650yhh.33.1379341092167; Mon, 16 Sep 2013 07:18:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.42.39 with SMTP id k7ls2223021qel.52.gmail; Mon, 16 Sep 2013 07:18:12 -0700 (PDT) X-Received: by 10.52.229.73 with SMTP id so9mr1425856vdc.27.1379341092088; Mon, 16 Sep 2013 07:18:12 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id uh5si7156719vcb.52.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 07:18:12 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id oz11so3090085veb.31 for ; Mon, 16 Sep 2013 07:18:12 -0700 (PDT) X-Received: by 10.220.186.202 with SMTP id ct10mr27738156vcb.14.1379341091996; Mon, 16 Sep 2013 07:18:11 -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 u4csp99352vcz; Mon, 16 Sep 2013 07:18:11 -0700 (PDT) X-Received: by 10.112.155.39 with SMTP id vt7mr2023336lbb.29.1379341090768; Mon, 16 Sep 2013 07:18:10 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx.google.com with ESMTPS id 6si10005354lay.13.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 07:18:10 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.54 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id ea20so3144434lab.41 for ; Mon, 16 Sep 2013 07:18:10 -0700 (PDT) X-Received: by 10.152.37.103 with SMTP id x7mr2055554laj.28.1379341090066; Mon, 16 Sep 2013 07:18:10 -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:09 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Prasanna NAVARATNA , Ulf Hansson Subject: [PATCH 4/7] mmc: core: Cleanup code for setting ocr mask for SDIO Date: Mon, 16 Sep 2013 16:17:45 +0200 Message-Id: <1379341068-27097-5-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.128.172 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: , At several places in mmc_sdio_init_card function the cached mask in host->ocr were being updated. To simplify code, we make use of an local ocr parameter instead. Signed-off-by: Ulf Hansson --- drivers/mmc/core/sdio.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 26b1316..9587d9f 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -593,23 +593,27 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr, struct mmc_card *card; int err; int retries = 10; + u32 rocr = 0; BUG_ON(!host); WARN_ON(!host->claimed); + /* to query card if 1.8V signalling is supported */ + if (mmc_host_uhs(host)) + ocr |= R4_18V_PRESENT; + try_again: if (!retries) { pr_warning("%s: Skipping voltage switch\n", mmc_hostname(host)); ocr &= ~R4_18V_PRESENT; - host->ocr &= ~R4_18V_PRESENT; } /* * Inform the card of the voltage */ if (!powered_resume) { - err = mmc_send_io_op_cond(host, host->ocr, &ocr); + err = mmc_send_io_op_cond(host, ocr, &rocr); if (err) goto err; } @@ -632,8 +636,8 @@ try_again: goto err; } - if ((ocr & R4_MEMORY_PRESENT) && - mmc_sd_get_cid(host, host->ocr & ocr, card->raw_cid, NULL) == 0) { + if ((rocr & R4_MEMORY_PRESENT) && + mmc_sd_get_cid(host, ocr & rocr, card->raw_cid, NULL) == 0) { card->type = MMC_TYPE_SD_COMBO; if (oldcard && (oldcard->type != MMC_TYPE_SD_COMBO || @@ -663,9 +667,9 @@ try_again: * systems that claim 1.8v signalling in fact do not support * it. */ - if (!powered_resume && (ocr & R4_18V_PRESENT) && mmc_host_uhs(host)) { + if (!powered_resume && (rocr & ocr & R4_18V_PRESENT)) { err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180, - host->ocr); + ocr); if (err == -EAGAIN) { sdio_reset(host); mmc_go_idle(host); @@ -675,12 +679,10 @@ try_again: goto try_again; } else if (err) { ocr &= ~R4_18V_PRESENT; - host->ocr &= ~R4_18V_PRESENT; } err = 0; } else { ocr &= ~R4_18V_PRESENT; - host->ocr &= ~R4_18V_PRESENT; } /* @@ -1084,10 +1086,6 @@ static int mmc_sdio_power_restore(struct mmc_host *host) goto out; } - if (mmc_host_uhs(host)) - /* to query card if 1.8V signalling is supported */ - host->ocr |= R4_18V_PRESENT; - ret = mmc_sdio_init_card(host, host->ocr, host->card, mmc_card_keep_power(host)); if (!ret && host->sdio_irqs) @@ -1170,10 +1168,6 @@ int mmc_attach_sdio(struct mmc_host *host) /* * Detect and init the card. */ - if (mmc_host_uhs(host)) - /* to query card if 1.8V signalling is supported */ - host->ocr |= R4_18V_PRESENT; - err = mmc_sdio_init_card(host, host->ocr, NULL, 0); if (err) goto err;