From patchwork Mon Aug 24 10:15:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 7063191 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8E0389F305 for ; Mon, 24 Aug 2015 10:15:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C6E1320651 for ; Mon, 24 Aug 2015 10:15:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C92C62047B for ; Mon, 24 Aug 2015 10:15:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932782AbbHXKPd (ORCPT ); Mon, 24 Aug 2015 06:15:33 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:44539 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754177AbbHXKPa (ORCPT ); Mon, 24 Aug 2015 06:15:30 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id t7OAFPQ5010469; Mon, 24 Aug 2015 05:15:25 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t7OAFOw7009584; Mon, 24 Aug 2015 05:15:24 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Mon, 24 Aug 2015 05:15:24 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t7OAFIUK026925; Mon, 24 Aug 2015 05:15:22 -0500 From: Kishon Vijay Abraham I To: , , , CC: , , , , Subject: [RFC PATCH 2/2] mmc: core: sdio: claim host before power up or power off Date: Mon, 24 Aug 2015 15:45:17 +0530 Message-ID: <1440411317-8813-2-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1440411317-8813-1-git-send-email-kishon@ti.com> References: <1440411317-8813-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP mmc_sdio_runtime_resume and mmc_sdio_runtime_suspend does power up and power off respectively but does so without claiming the host. Among other things mmc_claim_host inovkes pm_runtime_get_sync to enable the clocks. Invoke mmc_claim_host before mmc_power_up and mmc_power_off in mmc_sdio_runtime_resume and mmc_sdio_runtime_suspend respectively. This is required since certain platforms (like TI SoCs) access the controller registers during power up. Signed-off-by: Kishon Vijay Abraham I --- drivers/mmc/core/sdio.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 0cbbfb8..40795b2 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -1023,16 +1023,24 @@ static int mmc_sdio_power_restore(struct mmc_host *host) static int mmc_sdio_runtime_suspend(struct mmc_host *host) { + mmc_claim_host(host); /* No references to the card, cut the power to it. */ mmc_power_off(host); + mmc_release_host(host); return 0; } static int mmc_sdio_runtime_resume(struct mmc_host *host) { + int ret; + + mmc_claim_host(host); /* Restore power and re-initialize. */ mmc_power_up(host, host->card->ocr); - return mmc_sdio_power_restore(host); + ret = _mmc_sdio_power_restore(host); + mmc_release_host(host); + + return ret; } static int mmc_sdio_reset(struct mmc_host *host)